2 lines
651 KiB
JavaScript
2 lines
651 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6197f6ea"],{1276:function(e,t,r){"use strict";var i=r("2ba4"),n=r("c65b"),a=r("e330"),o=r("d784"),s=r("44e7"),l=r("825a"),u=r("1d80"),c=r("4840"),h=r("8aa5"),d=r("50c4"),f=r("577e"),p=r("dc4a"),m=r("4dae"),g=r("14c3"),v=r("9263"),_=r("9f7f"),y=r("d039"),x=_.UNSUPPORTED_Y,T=4294967295,b=Math.min,w=[].push,E=a(/./.exec),S=a(w),C=a("".slice),A=!y((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));o("split",(function(e,t,r){var a;return a="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var a=f(u(this)),o=void 0===r?T:r>>>0;if(0===o)return[];if(void 0===e)return[a];if(!s(e))return n(t,a,e,o);var l,c,h,d=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),g=0,_=new RegExp(e.source,p+"g");while(l=n(v,_,a)){if(c=_.lastIndex,c>g&&(S(d,C(a,g,l.index)),l.length>1&&l.index<a.length&&i(w,d,m(l,1)),h=l[0].length,g=c,d.length>=o))break;_.lastIndex===l.index&&_.lastIndex++}return g===a.length?!h&&E(_,"")||S(d,""):S(d,C(a,g)),d.length>o?m(d,0,o):d}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:n(t,this,e,r)}:t,[function(t,r){var i=u(this),o=void 0==t?void 0:p(t,e);return o?n(o,t,i,r):n(a,f(i),t,r)},function(e,i){var n=l(this),o=f(e),s=r(a,n,o,i,a!==t);if(s.done)return s.value;var u=c(n,RegExp),p=n.unicode,m=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(x?"g":"y"),v=new u(x?"^(?:"+n.source+")":n,m),_=void 0===i?T:i>>>0;if(0===_)return[];if(0===o.length)return null===g(v,o)?[o]:[];var y=0,w=0,E=[];while(w<o.length){v.lastIndex=x?0:w;var A,M=g(v,x?C(o,w):o);if(null===M||(A=b(d(v.lastIndex+(x?w:0)),o.length))===y)w=h(o,w,p);else{if(S(E,C(o,y,w)),E.length===_)return E;for(var L=1;L<=M.length-1;L++)if(S(E,M[L]),E.length===_)return E;w=y=A}}return S(E,C(o,y)),E}]}),!A,x)},2379:function(e,t,r){e.exports=r.p+"9bd77f36df9057eef4019cec75e6d932.svg"},"2c3e":function(e,t,r){var i=r("da84"),n=r("83ab"),a=r("9f7f").MISSED_STICKY,o=r("c6b6"),s=r("9bf2").f,l=r("69f3").get,u=RegExp.prototype,c=i.TypeError;n&&a&&s(u,"sticky",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!l(this).sticky;throw c("Incompatible receiver, RegExp required")}}})},"3db9":function(e,t,r){"use strict";function i(e){var t=new XMLHttpRequest;t.open("get",e.url),t.responseType=e.responseType||"text",e.onprogress&&(t.onprogress=function(t){if(t.lengthComputable){var r=t.loaded/t.total;e.onprogress(r,t.loaded,t.total)}else e.onprogress(null)}),t.onload=function(r){t.status>=400?e.onerror&&e.onerror():e.onload&&e.onload(t.response)},e.onerror&&(t.onerror=e.onerror),t.send(null)}t["a"]={get:i}},4032:function(e,t,r){e.exports=r.p+"b5dd9dba39162e1200d19c96bc356dd4.svg"},"4d63":function(e,t,r){var i=r("83ab"),n=r("da84"),a=r("e330"),o=r("94ca"),s=r("7156"),l=r("9112"),u=r("9bf2").f,c=r("241c").f,h=r("3a9b"),d=r("44e7"),f=r("577e"),p=r("ad6d"),m=r("9f7f"),g=r("6eeb"),v=r("d039"),_=r("1a2d"),y=r("69f3").enforce,x=r("2626"),T=r("b622"),b=r("fce3"),w=r("107c"),E=T("match"),S=n.RegExp,C=S.prototype,A=n.SyntaxError,M=a(p),L=a(C.exec),D=a("".charAt),N=a("".replace),R=a("".indexOf),I=a("".slice),P=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,O=/a/g,B=/a/g,F=new S(O)!==O,U=m.MISSED_STICKY,z=m.UNSUPPORTED_Y,G=i&&(!F||U||b||w||v((function(){return B[E]=!1,S(O)!=O||S(B)==B||"/a/i"!=S(O,"i")}))),H=function(e){for(var t,r=e.length,i=0,n="",a=!1;i<=r;i++)t=D(e,i),"\\"!==t?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),n+=t):n+="[\\s\\S]":n+=t+D(e,++i);return n},k=function(e){for(var t,r=e.length,i=0,n="",a=[],o={},s=!1,l=!1,u=0,c="";i<=r;i++){if(t=D(e,i),"\\"===t)t+=D(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:L(P,I(e,i+1))&&(i+=2,l=!0),n+=t,u++;continue;case">"===t&&l:if(""===c||_(o,c))throw new A("Invalid capture group name");o[c]=!0,a[a.length]=[c,u],l=!1,c="";continue}l?c+=t:n+=t}return[n,a]};if(o("RegExp",G)){for(var V=function(e,t){var r,i,n,a,o,u,c=h(C,this),p=d(e),m=void 0===t,g=[],v=e;if(!c&&p&&m&&e.constructor===V)return e;if((p||h(C,e))&&(e=e.source,m&&(t="flags"in v?v.flags:M(v))),e=void 0===e?"":f(e),t=void 0===t?"":f(t),v=e,b&&"dotAll"in O&&(i=!!t&&R(t,"s")>-1,i&&(t=N(t,/s/g,""))),r=t,U&&"sticky"in O&&(n=!!t&&R(t,"y")>-1,n&&z&&(t=N(t,/y/g,""))),w&&(a=k(e),e=a[0],g=a[1]),o=s(S(e,t),c?this:C,V),(i||n||g.length)&&(u=y(o),i&&(u.dotAll=!0,u.raw=V(H(e),r)),n&&(u.sticky=!0),g.length&&(u.groups=g)),e!==v)try{l(o,"source",""===v?"(?:)":v)}catch(_){}return o},W=function(e){e in V||u(V,e,{configurable:!0,get:function(){return S[e]},set:function(t){S[e]=t}})},j=c(S),X=0;j.length>X;)W(j[X++]);C.constructor=V,V.prototype=C,g(n,"RegExp",V)}x("RegExp")},5273:function(e,t,r){e.exports=r.p+"5a41dc7276f8fc56a3ab2dcbe2d83b79.svg"},"5f3a":function(e,t,r){e.exports=r.p+"48070211cbc83cefb19af43a33b5682e.svg"},"620a":function(e,t,r){"use strict";(function(e){var i,n=r("3db9"),a={supportWebGL:function(){if(null==i)try{var e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)throw new Error}catch(r){i=!1}return i}};a.Int8Array="undefined"===typeof Int8Array?Array:Int8Array,a.Uint8Array="undefined"===typeof Uint8Array?Array:Uint8Array,a.Uint16Array="undefined"===typeof Uint16Array?Array:Uint16Array,a.Uint32Array="undefined"===typeof Uint32Array?Array:Uint32Array,a.Int16Array="undefined"===typeof Int16Array?Array:Int16Array,a.Float32Array="undefined"===typeof Float32Array?Array:Float32Array,a.Float64Array="undefined"===typeof Float64Array?Array:Float64Array;var o={};"undefined"!==typeof window?o=window:"undefined"!==typeof e&&(o=e),a.requestAnimationFrame=o.requestAnimationFrame||o.msRequestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||function(e){setTimeout(e,16)},a.createCanvas=function(){return document.createElement("canvas")},a.createImage=function(){return new o.Image},a.request={get:n["a"].get},a.addEventListener=function(e,t,r,i){e.addEventListener(t,r,i)},a.removeEventListener=function(e,t,r){e.removeEventListener(t,r)},t["a"]=a}).call(this,r("c8ba"))},"6e9f":function(e,t,r){e.exports=r.p+"46ab537aba1d9109bd64cf9641e26f43.svg"},"7fa6":function(e,t,r){"use strict";r.r(t);var i=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"screen"},[r("div",{staticClass:"top"},[e.logoForm.enTitle?r("div",{staticClass:"text"},[e._v(" "+e._s("en"==this.$i18n.locale?e.logoForm.enTitle:e.logoForm.title)+" ")]):r("div",{staticClass:"text"},[e._v(" "+e._s(e.$t("name"))+" ")]),r("div",{staticClass:"up"}),r("div",{staticClass:"down"})]),r("div",{staticClass:"content"},[r("div",{staticClass:"left"},[r("div",{staticClass:"bg"}),r("div",{staticClass:"devList"},[r("div",{staticClass:"title"},[e._v(e._s(e.$t("screen.deviceNumCount")))]),r("div",{staticClass:"card"},[r("div",{staticClass:"list",style:{top:-25*e.num+"%",transition:e.transition}},e._l(e.list,(function(t){return r("div",{key:t.typeCode,staticClass:"item"},[r("div",{staticClass:"icon"},[r("i",{staticClass:"iconfont",class:"icon-"+t.icon,attrs:{icon:""}})]),r("div",{staticClass:"dev"},[r("div",{staticClass:"val"},[e._v(e._s(t.typeName))]),r("div",{staticClass:"num"},[r("span",{staticClass:"v"},[e._v(e._s(t.deviceCount))])])])])})),0),r("div",{staticClass:"list",style:{top:-25*e.num+25*(Math.ceil(e.list.length/2)-4)+"%",transition:e.transition}},e._l(e.list,(function(t){return r("div",{key:t.typeCode,staticClass:"item"},[r("div",{staticClass:"icon"},[r("i",{staticClass:"iconfont",class:"icon-"+t.icon,attrs:{icon:""}})]),r("div",{staticClass:"dev"},[r("div",{staticClass:"val"},[e._v(e._s(t.typeName))]),r("div",{staticClass:"num"},[r("span",{staticClass:"v"},[e._v(e._s(t.deviceCount))])])])])})),0)])]),r("div",{staticClass:"item deviceType"},[r("div",{staticClass:"title"},[e._v(e._s(e.$t("screen.deviceTypeCount")))]),r("div",{staticClass:"device"},[r("div",{ref:"myCharts",staticClass:"myCharts",attrs:{id:"myCharts"}}),r("div",{staticClass:"legend"},[r("div",{staticClass:"legend-item"},[r("div",[r("span",{staticClass:"point"}),e._v(e._s(e.$t("screen.onlineCount"))+" ")]),r("div",{staticClass:"num"},[e._v(e._s(e.deviceType.onlineCount))])]),r("div",{staticClass:"legend-item finish"},[r("div",[r("span",{staticClass:"point"}),e._v(e._s(e.$t("screen.unOnlineCount"))+" ")]),r("div",{staticClass:"num"},[e._v(e._s(e.deviceType.unOnlineCount))])])])])]),r("div",{staticClass:"item alarm"},[r("div",{staticClass:"title"},[e._v(e._s(e.$t("alarm.alarmInfo")))]),r("div",{staticClass:"alarmtable"},[r("dv-scroll-board",{staticStyle:{width:"100%",height:"100%"},attrs:{config:e.configTable}})],1)])]),r("div",{staticClass:"center"},[e._m(0),e._m(1),r("div",{staticClass:"cabinetNum"},[r("div",{staticClass:"cir"},[r("Circles",{attrs:{width:"5",color:"#47E5BC",percentNum:e.cabinetCount.multiple,backgroundColor:"#092C2D",fontSize:"30px",icon:"duoguiti"}})],1),r("div",{staticClass:"cabNum"},[r("div",{staticClass:"row"},[r("div",{staticClass:"num"},[e._v(e._s(e.cabinetCount.multipleCount))]),r("div",{staticClass:"text"},[e._v(e._s(e.$t("screen.multipleCount")))])]),r("div",{staticClass:"row"},[r("div",{staticClass:"num"},[e._v(e._s(e.cabinetCount.multiple)+"%")]),r("div",{staticClass:"text"},[e._v(e._s(e.$t("screen.Percentage")))])])]),r("div",{staticClass:"cabtTotal"},[r("div",{staticClass:"text"},[e._v(e._s(e.$t("screen.totalNumber")))]),r("div",{staticClass:"totalList"},e._l(e.cabinetCount.totalList,(function(t,i){return r("div",{key:i},[e._v(" "+e._s(t)+" ")])})),0)]),r("div",{staticClass:"cabNum"},[r("div",{staticClass:"row"},[r("div",{staticClass:"num"},[e._v(e._s(e.cabinetCount.singleCount))]),r("div",{staticClass:"text"},[e._v(e._s(e.$t("screen.singleCount")))])]),r("div",{staticClass:"row"},[r("div",{staticClass:"num"},[e._v(e._s(e.cabinetCount.single)+"%")]),r("div",{staticClass:"text"},[e._v(e._s(e.$t("screen.Percentage")))])])]),r("div",{staticClass:"cir"},[r("Circles",{attrs:{width:"5",color:"#47E5BC",percentNum:e.cabinetCount.single,backgroundColor:"#092C2D",fontSize:"30px"}})],1)]),r("div",{staticClass:"mapBox"},[r("el-autocomplete",{staticClass:"search",attrs:{"fetch-suggestions":e.querySearch,"prefix-icon":"el-icon-search",placeholder:e.$t("pEnter")+e.$t("device.deviceCode"),clearable:""},on:{select:e.handleFilter},model:{value:e.searchItem,callback:function(t){e.searchItem=t},expression:"searchItem"}}),r("div",{ref:"myMap",attrs:{id:"myMap"}})],1),r("div",{staticClass:"echartBox"},[r("div",{staticClass:"item"},[r("div",{staticClass:"title"},[r("span",[e._v(e._s(e.$t("screen.power")))]),r("span",{staticClass:"drop"},[e._v(e._s(e.seletedItem.deviceName))])]),r("div",{staticClass:"info"},[r("div",{ref:"powerbox",staticClass:"box",style:{top:-18*e.powerNum+"px",transition:e.powerTransition}},e._l(e.powerInfo,(function(t){return r("div",{key:t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0),e.powershow?r("div",{staticClass:"box",style:{top:-18*e.powerNum+"px",transition:e.powerTransition}},e._l(e.powerInfo,(function(t){return r("div",{key:t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0):e._e()]),r("div",{staticClass:"echart",attrs:{id:"powerEchart"}})]),r("div",{staticClass:"item"},[r("div",{staticClass:"title"},[r("span",[e._v(e._s(e.$t("screen.rectify")))]),r("span",{staticClass:"drop"},[e._v(e._s(e.seletedItem.deviceName))])]),r("div",{staticClass:"info"},[r("div",{ref:"rectifybox",staticClass:"box",style:{top:-18*e.rectifyNum+"px",transition:e.rectifyTransition}},e._l(e.rectifyInfo,(function(t){return r("div",{key:t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0),e.rectifyshow?r("div",{staticClass:"box",style:{top:-18*e.rectifyNum+"px",transition:e.rectifyTransition}},e._l(e.rectifyInfo,(function(t){return r("div",{key:t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0):e._e()]),r("div",{staticClass:"echart",attrs:{id:"rectifyEchart"}})])])]),r("div",{staticClass:"right"},[r("div",{staticClass:"bg"}),r("div",{staticClass:"devInfo"},[r("div",{staticClass:"title"},[r("span",[e._v(e._s(e.$t("screen.basicInfo")))]),r("span",{staticClass:"drop"},[e._v(e._s(e.seletedItem.deviceName))])]),r("div",{staticClass:"cabinetInfo"},[r("div",{staticClass:"img"},[r("i",{staticClass:"iconfont",class:"icon-duoguiti",attrs:{icon:""}})]),r("div",{staticClass:"box"},e._l(e.cabinetInfo,(function(t,i){return r("div",{key:i,staticClass:"text"},[r("span",{staticClass:"lab",style:{marginLeft:t.width}},[e._v(e._s(t.label))]),r("span",{staticClass:"line"}),r("span",{staticClass:"val"},[e._v(e._s(e.siteInfo[t.value]+t.unit))])])})),0)])]),r("div",{staticClass:"environmental"},[r("div",{staticClass:"title"},[r("span",[e._v(e._s(e.$t("screen.environmental")))]),r("span",{staticClass:"drop"},[e._v(e._s(e.seletedItem.deviceName))])]),r("div",{staticClass:"info"},[r("div",{ref:"sensorbox",staticClass:"box",style:{top:-18*e.sensorNum+"px",transition:e.sensorTransition}},e._l(e.sensorInfo,(function(t){return r("div",{key:"1"+t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0),e.sensorshow?r("div",{staticClass:"box",style:{top:-18*e.sensorNum+"px",transition:e.sensorTransition}},e._l(e.sensorInfo,(function(t){return r("div",{key:"2"+t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0):e._e()]),r("div",{staticClass:"echart",attrs:{id:"sensorEchart"}})]),r("div",{staticClass:"battery"},[r("div",{staticClass:"title"},[r("span",[e._v(e._s(e.$t("screen.battery")))]),r("span",{staticClass:"drop"},[e._v(e._s(e.seletedItem.deviceName))])]),r("div",{staticClass:"info"},[r("div",{ref:"batterybox",staticClass:"box",style:{top:-18*e.batteryNum+"px",transition:e.batteryTransition}},e._l(e.batteryInfo,(function(t){return r("div",{key:"3"+t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0),e.batteryshow?r("div",{staticClass:"box",style:{top:-18*e.batteryNum+"px",transition:e.batteryTransition}},e._l(e.batteryInfo,(function(t){return r("div",{key:"4"+t.dictionaryId},[r("div",{staticClass:"label"},[e._v(" "+e._s(t.signName)+" ")]),r("div",{staticClass:"value"},[e._v(" "+e._s(t.value)+" ")])])})),0):e._e()]),r("div",{staticClass:"echart",attrs:{id:"batteryEchart"}})])])])])},n=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"bg"},[r("div",{staticClass:"corner"}),r("div",{staticClass:"bottom"})])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"bg bgr"},[r("div",{staticClass:"corner"}),r("div",{staticClass:"bottom"})])}],a=r("2909"),o=r("1da1"),s=(r("96cf"),r("d81d"),r("4de4"),r("d3b7"),r("ac1f"),r("5319"),r("159b"),r("1276"),r("b680"),r("99af"),r("fb6a"),r("25f0"),r("b0c0"),r("4d63"),r("c607"),r("2c3e"),r("00b4"),r("b775"));function l(e){return Object(s["a"])({url:"device-service/home/getCabinetCountInfo",method:"get",params:e})}function u(e){return Object(s["a"])({url:"device-service/home/getDeviceCountInfo",method:"get",params:e})}function c(e){return Object(s["a"])({url:"device-service/home/getDeviceStatusInfo",method:"get",params:e})}function h(e){return Object(s["a"])({url:"device-service/home/getBatteryCurve",method:"get",params:e})}function d(e){return Object(s["a"])({url:"device-service/home/getBatteryInfo",method:"get",params:e})}function f(e){return Object(s["a"])({url:"device-service/home/getPowerCurve",method:"get",params:e})}function p(e){return Object(s["a"])({url:"device-service/home/getPowerInfo",method:"get",params:e})}function m(e){return Object(s["a"])({url:"device-service/home/getRectifyCurve",method:"get",params:e})}function g(e){return Object(s["a"])({url:"device-service/home/getRectifyInfo",method:"get",params:e})}function v(e){return Object(s["a"])({url:"device-service/home/getSensorCurve",method:"get",params:e})}function _(e){return Object(s["a"])({url:"device-service/home/getSensorInfo",method:"get",params:e})}var y=r("f3bc"),x=r("aa98"),T=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"percentloop"},[r("div",{staticClass:"circle-left",style:{backgroundColor:e.color}},[r("div",{ref:"leftcontent"})]),r("div",{staticClass:"circle-right",style:{backgroundColor:e.color}},[r("div",{ref:"rightcontent"})]),r("div",{staticClass:"number",style:{top:e.width+"px",bottom:e.width+"px",left:e.width+"px",right:e.width+"px",backgroundColor:e.backgroundColor}},[r("div",[r("i",{class:"iconfont icon-"+e.icon,style:{color:e.color,fontSize:e.fontSize}})])])])},b=[],w=(r("a9e3"),{props:{percentNum:{type:[String,Number],default:0},fontSize:{type:String,default:"18px"},speed:{type:[String,Number],default:1},width:{type:[String,Number],default:5},color:{type:String,default:""},backgroundColor:{type:String,default:"#fff"},icon:{type:String,default:"danguiti"}},data:function(){return{percent:0,initDeg:0,timeId:null,animationing:!1}},beforeDestroy:function(){this.timeId&&clearInterval(this.timeId)},methods:{transformToDeg:function(e){var t=0;return t=isNaN(e)?0:e>=100?360:e<=-100?-360:parseInt(360*e/100),t},transformToPercent:function(e){var t=0;return t=e>=360?100:e<=-360?-100:parseInt(100*e/360),t},rotateLeft:function(e){e<0&&(e=-e),this.$refs.leftcontent.style.transform="rotate("+(e-180)+"deg)"},rotateRight:function(e){e<0&&(e=-e),this.$refs.rightcontent.style.transform="rotate("+e+"deg)"},goRotate:function(e){var t=this;this.animationing=!0,this.timeId=setInterval((function(){e>t.initDeg?(t.initDeg+=Number(t.speed),Math.abs(t.initDeg)>=180?(t.rotateLeft(t.initDeg),t.rotateRight(180)):t.rotateRight(t.initDeg)):(t.initDeg-=Number(t.speed),Math.abs(t.initDeg)>=180?t.rotateLeft(t.initDeg):(t.rotateLeft(180),t.rotateRight(t.initDeg))),t.percent=t.transformToPercent(t.initDeg);var r=Number(e)-t.initDeg;Math.abs(r)<t.speed&&(t.initDeg+=r,Math.abs(t.initDeg)>180?t.rotateLeft(e):t.rotateRight(e),t.animationFinished())}),10)},animationFinished:function(){this.percent=isNaN(this.percentNum)?0:this.percentNum,this.animationing=!1,clearInterval(this.timeId)}},created:function(){this.goRotate(this.transformToDeg(this.percentNum))},watch:{percentNum:function(e){this.animationing||this.goRotate(this.transformToDeg(e))}}}),E=w,S=(r("d958"),r("2877")),C=Object(S["a"])(E,T,b,!1,null,"57c44f0e",null),A=C.exports,M=r("313e"),L=r("aa74"),D=r("22b4"),N=(r("1be7"),r("f95e")),R=r("5e81"),I=r("ee29");Object(D["a"])([N["a"],R["a"]]);function P(e,t,r){"object"==typeof t&&(r=t,t=null);var i,n=this;if(!(e instanceof Function))for(var a in i=[],e)e.hasOwnProperty(a)&&i.push(a);var o=function(t){if(n.apply(this,arguments),e instanceof Function?O(this,e.call(this,t)):B(this,e,i),this.constructor===o)for(var r=o.__initializers__,a=0;a<r.length;a++)r[a].apply(this,arguments)};o.__super__=n,n.__initializers__?o.__initializers__=n.__initializers__.slice():o.__initializers__=[],t&&o.__initializers__.push(t);var s=function(){};return s.prototype=n.prototype,o.prototype=new s,o.prototype.constructor=o,O(o.prototype,r),o.extend=n.extend,o.derive=n.extend,o}function O(e,t){if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}function B(e,t,r){for(var i=0;i<r.length;i++){var n=r[i];e[n]=t[n]}}Object(D["a"])(I["a"]);var F={extend:P,derive:P};function U(e,t){this.action=e,this.context=t}var z={trigger:function(e){if(this.hasOwnProperty("__handlers__")&&this.__handlers__.hasOwnProperty(e)){var t=this.__handlers__[e],r=t.length,i=-1,n=arguments;switch(n.length){case 1:while(++i<r)t[i].action.call(t[i].context);return;case 2:while(++i<r)t[i].action.call(t[i].context,n[1]);return;case 3:while(++i<r)t[i].action.call(t[i].context,n[1],n[2]);return;case 4:while(++i<r)t[i].action.call(t[i].context,n[1],n[2],n[3]);return;case 5:while(++i<r)t[i].action.call(t[i].context,n[1],n[2],n[3],n[4]);return;default:while(++i<r)t[i].action.apply(t[i].context,Array.prototype.slice.call(n,1));return}}},on:function(e,t,r){if(e&&t){var i=this.__handlers__||(this.__handlers__={});if(i[e]){if(this.has(e,t))return}else i[e]=[];var n=new U(t,r||this);return i[e].push(n),this}},once:function(e,t,r){if(e&&t){var i=this;return this.on(e,n,r)}function n(){i.off(e,n),t.apply(this,arguments)}},before:function(e,t,r){if(e&&t)return e="before"+e,this.on(e,t,r)},after:function(e,t,r){if(e&&t)return e="after"+e,this.on(e,t,r)},success:function(e,t){return this.once("success",e,t)},error:function(e,t){return this.once("error",e,t)},off:function(e,t){var r=this.__handlers__||(this.__handlers__={});if(t){if(r[e]){for(var i=r[e],n=[],a=0;a<i.length;a++)t&&i[a].action!==t&&n.push(i[a]);r[e]=n}return this}r[e]=[]},has:function(e,t){var r=this.__handlers__;if(!r||!r[e])return!1;for(var i=r[e],n=0;n<i.length;n++)if(i[n].action===t)return!0}},G=z,H=0,k=Array.prototype,V=k.forEach,W={genGUID:function(){return++H},relative2absolute:function(e,t){if(!t||e.match(/^\//))return e;var r=e.split("/"),i=t.split("/"),n=r[0];while("."===n||".."===n)".."===n&&i.pop(),r.shift(),n=r[0];return i.join("/")+"/"+r.join("/")},extend:function(e,t){if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},defaults:function(e,t){if(t)for(var r in t)void 0===e[r]&&(e[r]=t[r]);return e},extendWithPropList:function(e,t,r){if(t)for(var i=0;i<r.length;i++){var n=r[i];e[n]=t[n]}return e},defaultsWithPropList:function(e,t,r){if(t)for(var i=0;i<r.length;i++){var n=r[i];null==e[n]&&(e[n]=t[n])}return e},each:function(e,t,r){if(e&&t)if(e.forEach&&e.forEach===V)e.forEach(t,r);else if(e.length===+e.length)for(var i=0,n=e.length;i<n;i++)t.call(r,e[i],i,e);else for(var a in e)e.hasOwnProperty(a)&&t.call(r,e[a],a,e)},isObject:function(e){return e===Object(e)},isArray:function(e){return Array.isArray(e)},isArrayLike:function(e){return!!e&&e.length===+e.length},clone:function(e){if(W.isObject(e)){if(W.isArray(e))return e.slice();if(W.isArrayLike(e)){for(var t=new e.constructor(e.length),r=0;r<e.length;r++)t[r]=e[r];return t}return W.extend({},e)}return e}},j=W,X=function(){this.__uid__=j.genGUID()};X.__initializers__=[function(e){j.extend(this,e)}],j.extend(X,F),j.extend(X.prototype,G);var q=X,Z=["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear","OES_standard_derivatives","OES_vertex_array_object","OES_element_index_uint","WEBGL_compressed_texture_s3tc","WEBGL_depth_texture","EXT_texture_filter_anisotropic","EXT_shader_texture_lod","WEBGL_draw_buffers","EXT_frag_depth","EXT_sRGB","ANGLE_instanced_arrays"],Y=["MAX_TEXTURE_SIZE","MAX_CUBE_MAP_TEXTURE_SIZE"];function K(e){for(var t={},r={},i=0;i<Z.length;i++){var n=Z[i];o(n)}for(i=0;i<Y.length;i++){var a=Y[i];r[a]=e.getParameter(e[a])}function o(r){if(e.getExtension){var i=e.getExtension(r);i||(i=e.getExtension("MOZ_"+r)),i||(i=e.getExtension("WEBKIT_"+r)),t[r]=i}}this.getExtension=function(e){return e in t||o(e),t[e]},this.getParameter=function(e){return r[e]}}var $=K,Q={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444},J=r("620a"),ee=function(){this.head=null,this.tail=null,this._length=0};ee.prototype.insert=function(e){var t=new ee.Entry(e);return this.insertEntry(t),t},ee.prototype.insertAt=function(e,t){if(!(e<0)){var r=this.head,i=0;while(r&&i!=e)r=r.next,i++;if(r){var n=new ee.Entry(t),a=r.prev;a?(a.next=n,n.prev=a):this.head=n,n.next=r,r.prev=n}else this.insert(t)}},ee.prototype.insertBeforeEntry=function(e,t){var r=new ee.Entry(e),i=t.prev;i?(i.next=r,r.prev=i):this.head=r,r.next=t,t.prev=r,this._length++},ee.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e,this._length++},ee.prototype.remove=function(e){var t=e.prev,r=e.next;t?t.next=r:this.head=r,r?r.prev=t:this.tail=t,e.next=e.prev=null,this._length--},ee.prototype.removeAt=function(e){if(!(e<0)){var t=this.head,r=0;while(t&&r!=e)t=t.next,r++;return t?(this.remove(t),t.value):void 0}},ee.prototype.getHead=function(){if(this.head)return this.head.value},ee.prototype.getTail=function(){if(this.tail)return this.tail.value},ee.prototype.getAt=function(e){if(!(e<0)){var t=this.head,r=0;while(t&&r!=e)t=t.next,r++;return t.value}},ee.prototype.indexOf=function(e){var t=this.head,r=0;while(t){if(t.value===e)return r;t=t.next,r++}},ee.prototype.length=function(){return this._length},ee.prototype.isEmpty=function(){return 0===this._length},ee.prototype.forEach=function(e,t){var r=this.head,i=0,n="undefined"!=typeof t;while(r)n?e.call(t,r.value,i):e(r.value,i),r=r.next,i++},ee.prototype.clear=function(){this.tail=this.head=null,this._length=0},ee.Entry=function(e){this.value=e,this.next=null,this.prev=null};var te=ee,re=function(e){this._list=new te,this._map={},this._maxSize=e||10};re.prototype.setMaxSize=function(e){this._maxSize=e},re.prototype.put=function(e,t){if(!this._map.hasOwnProperty(e)){var r=this._list.length();if(r>=this._maxSize&&r>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var n=this._list.insert(t);n.key=e,this._map[e]=n}},re.prototype.get=function(e){var t=this._map[e];if(this._map.hasOwnProperty(e))return t!==this._list.tail&&(this._list.remove(t),this._list.insertEntry(t)),t.value},re.prototype.remove=function(e){var t=this._map[e];"undefined"!==typeof t&&(delete this._map[e],this._list.remove(t))},re.prototype.clear=function(){this._list.clear(),this._map={}};var ie=re,ne={},ae={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function oe(e){return e=Math.round(e),e<0?0:e>255?255:e}function se(e){return e=Math.round(e),e<0?0:e>360?360:e}function le(e){return e<0?0:e>1?1:e}function ue(e){return e.length&&"%"===e.charAt(e.length-1)?oe(parseFloat(e)/100*255):oe(parseInt(e,10))}function ce(e){return e.length&&"%"===e.charAt(e.length-1)?le(parseFloat(e)/100):le(parseFloat(e))}function he(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){return e+(t-e)*r}function fe(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function pe(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var me=new ie(20),ge=null;function ve(e,t){ge&&pe(ge,t),ge=me.put(e,ge||t.slice())}function _e(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=ce(e[1]),n=ce(e[2]),a=n<=.5?n*(i+1):n+i-n*i,o=2*n-a;return t=t||[],fe(t,oe(255*he(o,a,r+1/3)),oe(255*he(o,a,r)),oe(255*he(o,a,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}function ye(e){if(e){var t,r,i=e[0]/255,n=e[1]/255,a=e[2]/255,o=Math.min(i,n,a),s=Math.max(i,n,a),l=s-o,u=(s+o)/2;if(0===l)t=0,r=0;else{r=u<.5?l/(s+o):l/(2-s-o);var c=((s-i)/6+l/2)/l,h=((s-n)/6+l/2)/l,d=((s-a)/6+l/2)/l;i===s?t=d-h:n===s?t=1/3+c-d:a===s&&(t=2/3+h-c),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,u];return null!=e[3]&&f.push(e[3]),f}}ne.parse=function(e,t){if(e){t=t||[];var r=me.get(e);if(r)return pe(t,r);e+="";var i=e.replace(/ /g,"").toLowerCase();if(i in ae)return pe(t,ae[i]),ve(e,t),t;if("#"!==i.charAt(0)){var n=i.indexOf("("),a=i.indexOf(")");if(-1!==n&&a+1===i.length){var o=i.substr(0,n),s=i.substr(n+1,a-(n+1)).split(","),l=1;switch(o){case"rgba":if(4!==s.length)return void fe(t,0,0,0,1);l=ce(s.pop());case"rgb":return 3!==s.length?void fe(t,0,0,0,1):(fe(t,ue(s[0]),ue(s[1]),ue(s[2]),l),ve(e,t),t);case"hsla":return 4!==s.length?void fe(t,0,0,0,1):(s[3]=ce(s[3]),_e(s,t),ve(e,t),t);case"hsl":return 3!==s.length?void fe(t,0,0,0,1):(_e(s,t),ve(e,t),t);default:return}}fe(t,0,0,0,1)}else{if(4===i.length){var u=parseInt(i.substr(1),16);return u>=0&&u<=4095?(fe(t,(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1),ve(e,t),t):void fe(t,0,0,0,1)}if(7===i.length){u=parseInt(i.substr(1),16);return u>=0&&u<=16777215?(fe(t,(16711680&u)>>16,(65280&u)>>8,255&u,1),ve(e,t),t):void fe(t,0,0,0,1)}}}},ne.parseToFloat=function(e,t){if(t=ne.parse(e,t),t)return t[0]/=255,t[1]/=255,t[2]/=255,t},ne.lift=function(e,t){var r=ne.parse(e);if(r){for(var i=0;i<3;i++)r[i]=t<0?r[i]*(1-t)|0:(255-r[i])*t+r[i]|0;return ne.stringify(r,4===r.length?"rgba":"rgb")}},ne.toHex=function(e){var t=ne.parse(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)},ne.fastLerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=t[n],s=t[a],l=i-n;return r[0]=oe(de(o[0],s[0],l)),r[1]=oe(de(o[1],s[1],l)),r[2]=oe(de(o[2],s[2],l)),r[3]=le(de(o[3],s[3],l)),r}},ne.fastMapToColor=ne.fastLerp,ne.lerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=ne.parse(t[n]),s=ne.parse(t[a]),l=i-n,u=ne.stringify([oe(de(o[0],s[0],l)),oe(de(o[1],s[1],l)),oe(de(o[2],s[2],l)),le(de(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:n,rightIndex:a,value:i}:u}},ne.mapToColor=ne.lerp,ne.modifyHSL=function(e,t,r,i){if(e=ne.parse(e),e)return e=ye(e),null!=t&&(e[0]=se(t)),null!=r&&(e[1]=ce(r)),null!=i&&(e[2]=ce(i)),ne.stringify(_e(e),"rgba")},ne.modifyAlpha=function(e,t){if(e=ne.parse(e),e&&null!=t)return e[3]=le(t),ne.stringify(e,"rgba")},ne.stringify=function(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}};var xe=ne,Te=xe.parseToFloat,be={};function we(e){var t=Object.keys(e);t.sort();for(var r=[],i=0;i<t.length;i++){var n=t[i],a=e[n];null===a?r.push(n):r.push(n+" "+a.toString())}return r.join("\n")}function Ee(e,t,r){r.sort();for(var i=[],n=0;n<r.length;n++){var a=r[n];i.push(a)}var o=we(e)+"\n"+we(t)+"\n"+i.join("\n");if(be[o])return be[o];var s=j.genGUID();return be[o]=s,s}var Se=q.extend((function(){return{name:"",depthTest:!0,depthMask:!0,transparent:!1,blend:null,autoUpdateTextureStatus:!0,uniforms:{},vertexDefines:{},fragmentDefines:{},_textureStatus:{},_enabledUniforms:null}}),(function(){this.name||(this.name="MATERIAL_"+this.__uid__),this.shader&&this.attachShader(this.shader,!0)}),{precision:"highp",setUniform:function(e,t){void 0===t&&console.warn('Uniform value "'+e+'" is undefined');var r=this.uniforms[e];r&&("string"===typeof t&&(t=Te(t)||t),r.value=t,this.autoUpdateTextureStatus&&"t"===r.type&&(t?this.enableTexture(e):this.disableTexture(e)))},setUniforms:function(e){for(var t in e){var r=e[t];this.setUniform(t,r)}},isUniformEnabled:function(e){return this._enabledUniforms.indexOf(e)>=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(e,t){if("object"===typeof e)for(var r in e){var i=e[r];this.setUniform(r,i)}else this.setUniform(e,t)},get:function(e){var t=this.uniforms[e];if(t)return t.value},attachShader:function(e,t){var r=this.uniforms;this.uniforms=e.createUniforms(),this.shader=e;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(e){var t=this.uniforms[e].type;return"t"===t||"tv"===t}),this);var n=this.vertexDefines,a=this.fragmentDefines;if(this.vertexDefines=j.clone(e.vertexDefines),this.fragmentDefines=j.clone(e.fragmentDefines),t){for(var o in r)i[o]&&(i[o].value=r[o].value);j.defaults(this.vertexDefines,n),j.defaults(this.fragmentDefines,a)}var s={};for(var l in e.textures)s[l]={shaderType:e.textures[l].shaderType,type:e.textures[l].type,enabled:!(!t||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var e=new this.constructor({name:this.name,shader:this.shader});for(var t in this.uniforms)e.uniforms[t].value=this.uniforms[t].value;return e.depthTest=this.depthTest,e.depthMask=this.depthMask,e.transparent=this.transparent,e.blend=this.blend,e.vertexDefines=j.clone(this.vertexDefines),e.fragmentDefines=j.clone(this.fragmentDefines),e.enableTexture(this.getEnabledTextures()),e.precision=this.precision,e},define:function(e,t,r){var i=this.vertexDefines,n=this.fragmentDefines;"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<3&&(r=t,t=e,e="both"),r=null!=r?r:null,"vertex"!==e&&"both"!==e||i[t]!==r&&(i[t]=r,this._programKey=""),"fragment"!==e&&"both"!==e||n[t]!==r&&(n[t]=r,"both"!==e&&(this._programKey=""))},undefine:function(e,t){"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<2&&(t=e,e="both"),"vertex"!==e&&"both"!==e||this.isDefined("vertex",t)&&(delete this.vertexDefines[t],this._programKey=""),"fragment"!==e&&"both"!==e||this.isDefined("fragment",t)&&(delete this.fragmentDefines[t],"both"!==e&&(this._programKey=""))},isDefined:function(e,t){switch(e){case"vertex":return void 0!==this.vertexDefines[t];case"fragment":return void 0!==this.fragmentDefines[t]}},getDefine:function(e,t){switch(e){case"vertex":return this.vertexDefines[t];case"fragment":return this.fragmentDefines[t]}},enableTexture:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.enableTexture(e[t]);else{var r=this._textureStatus[e];if(r){var i=r.enabled;i||(r.enabled=!0,this._programKey="")}}},enableTexturesAll:function(){var e=this._textureStatus;for(var t in e)e[t].enabled=!0;this._programKey=""},disableTexture:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.disableTexture(e[t]);else{var r=this._textureStatus[e];if(r){var i=!r.enabled;i||(r.enabled=!1,this._programKey="")}}},disableTexturesAll:function(){var e=this._textureStatus;for(var t in e)e[t].enabled=!1;this._programKey=""},isTextureEnabled:function(e){var t=this._textureStatus;return!!t[e]&&t[e].enabled},getEnabledTextures:function(){var e=[],t=this._textureStatus;for(var r in t)t[r].enabled&&e.push(r);return e},dirtyDefines:function(){this._programKey=""},getProgramKey:function(){return this._programKey||(this._programKey=Ee(this.vertexDefines,this.fragmentDefines,this.getEnabledTextures())),this._programKey}}),Ce=Se,Ae=1e-6,Me=Array,Le=Math.random,De={create:function(){var e=new Me(2);return e[0]=0,e[1]=0,e},clone:function(e){var t=new Me(2);return t[0]=e[0],t[1]=e[1],t},fromValues:function(e,t){var r=new Me(2);return r[0]=e,r[1]=t,r},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e},set:function(e,t,r){return e[0]=t,e[1]=r,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},subtract:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}};De.sub=De.subtract,De.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e},De.mul=De.multiply,De.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e},De.div=De.divide,De.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},De.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},De.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},De.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},De.distance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(r*r+i*i)},De.dist=De.distance,De.squaredDistance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i},De.sqrDist=De.squaredDistance,De.length=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},De.len=De.length,De.squaredLength=function(e){var t=e[0],r=e[1];return t*t+r*r},De.sqrLen=De.squaredLength,De.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},De.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},De.normalize=function(e,t){var r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n),e[0]=t[0]*n,e[1]=t[1]*n),e},De.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},De.cross=function(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e},De.lerp=function(e,t,r,i){var n=t[0],a=t[1];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e},De.random=function(e,t){t=t||1;var r=2*GLMAT_RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},De.transformMat2=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e},De.transformMat2d=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e},De.transformMat3=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e},De.transformMat4=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},De.forEach=function(){var e=De.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();var Ne=De,Re=function(e,t){e=e||0,t=t||0,this.array=Ne.fromValues(e,t),this._dirty=!0};if(Re.prototype={constructor:Re,add:function(e){return Ne.add(this.array,this.array,e.array),this._dirty=!0,this},set:function(e,t){return this.array[0]=e,this.array[1]=t,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this._dirty=!0,this},clone:function(){return new Re(this.x,this.y)},copy:function(e){return Ne.copy(this.array,e.array),this._dirty=!0,this},cross:function(e,t){return Ne.cross(e.array,this.array,t.array),e._dirty=!0,this},dist:function(e){return Ne.dist(this.array,e.array)},distance:function(e){return Ne.distance(this.array,e.array)},div:function(e){return Ne.div(this.array,this.array,e.array),this._dirty=!0,this},divide:function(e){return Ne.divide(this.array,this.array,e.array),this._dirty=!0,this},dot:function(e){return Ne.dot(this.array,e.array)},len:function(){return Ne.len(this.array)},length:function(){return Ne.length(this.array)},lerp:function(e,t,r){return Ne.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},min:function(e){return Ne.min(this.array,this.array,e.array),this._dirty=!0,this},max:function(e){return Ne.max(this.array,this.array,e.array),this._dirty=!0,this},mul:function(e){return Ne.mul(this.array,this.array,e.array),this._dirty=!0,this},multiply:function(e){return Ne.multiply(this.array,this.array,e.array),this._dirty=!0,this},negate:function(){return Ne.negate(this.array,this.array),this._dirty=!0,this},normalize:function(){return Ne.normalize(this.array,this.array),this._dirty=!0,this},random:function(e){return Ne.random(this.array,e),this._dirty=!0,this},scale:function(e){return Ne.scale(this.array,this.array,e),this._dirty=!0,this},scaleAndAdd:function(e,t){return Ne.scaleAndAdd(this.array,this.array,e.array,t),this._dirty=!0,this},sqrDist:function(e){return Ne.sqrDist(this.array,e.array)},squaredDistance:function(e){return Ne.squaredDistance(this.array,e.array)},sqrLen:function(){return Ne.sqrLen(this.array)},squaredLength:function(){return Ne.squaredLength(this.array)},sub:function(e){return Ne.sub(this.array,this.array,e.array),this._dirty=!0,this},subtract:function(e){return Ne.subtract(this.array,this.array,e.array),this._dirty=!0,this},transformMat2:function(e){return Ne.transformMat2(this.array,this.array,e.array),this._dirty=!0,this},transformMat2d:function(e){return Ne.transformMat2d(this.array,this.array,e.array),this._dirty=!0,this},transformMat3:function(e){return Ne.transformMat3(this.array,this.array,e.array),this._dirty=!0,this},transformMat4:function(e){return Ne.transformMat4(this.array,this.array,e.array),this._dirty=!0,this},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}},Object.defineProperty){var Ie=Re.prototype;Object.defineProperty(Ie,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),Object.defineProperty(Ie,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}})}Re.add=function(e,t,r){return Ne.add(e.array,t.array,r.array),e._dirty=!0,e},Re.set=function(e,t,r){return Ne.set(e.array,t,r),e._dirty=!0,e},Re.copy=function(e,t){return Ne.copy(e.array,t.array),e._dirty=!0,e},Re.cross=function(e,t,r){return Ne.cross(e.array,t.array,r.array),e._dirty=!0,e},Re.dist=function(e,t){return Ne.distance(e.array,t.array)},Re.distance=Re.dist,Re.div=function(e,t,r){return Ne.divide(e.array,t.array,r.array),e._dirty=!0,e},Re.divide=Re.div,Re.dot=function(e,t){return Ne.dot(e.array,t.array)},Re.len=function(e){return Ne.length(e.array)},Re.lerp=function(e,t,r,i){return Ne.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},Re.min=function(e,t,r){return Ne.min(e.array,t.array,r.array),e._dirty=!0,e},Re.max=function(e,t,r){return Ne.max(e.array,t.array,r.array),e._dirty=!0,e},Re.mul=function(e,t,r){return Ne.multiply(e.array,t.array,r.array),e._dirty=!0,e},Re.multiply=Re.mul,Re.negate=function(e,t){return Ne.negate(e.array,t.array),e._dirty=!0,e},Re.normalize=function(e,t){return Ne.normalize(e.array,t.array),e._dirty=!0,e},Re.random=function(e,t){return Ne.random(e.array,t),e._dirty=!0,e},Re.scale=function(e,t,r){return Ne.scale(e.array,t.array,r),e._dirty=!0,e},Re.scaleAndAdd=function(e,t,r,i){return Ne.scaleAndAdd(e.array,t.array,r.array,i),e._dirty=!0,e},Re.sqrDist=function(e,t){return Ne.sqrDist(e.array,t.array)},Re.squaredDistance=Re.sqrDist,Re.sqrLen=function(e){return Ne.sqrLen(e.array)},Re.squaredLength=Re.sqrLen,Re.sub=function(e,t,r){return Ne.subtract(e.array,t.array,r.array),e._dirty=!0,e},Re.subtract=Re.sub,Re.transformMat2=function(e,t,r){return Ne.transformMat2(e.array,t.array,r.array),e._dirty=!0,e},Re.transformMat2d=function(e,t,r){return Ne.transformMat2d(e.array,t.array,r.array),e._dirty=!0,e},Re.transformMat3=function(e,t,r){return Ne.transformMat3(e.array,t.array,r.array),e._dirty=!0,e},Re.transformMat4=function(e,t,r){return Ne.transformMat4(e.array,t.array,r.array),e._dirty=!0,e};var Pe=Re,Oe=1,Be=2,Fe=3,Ue={};function ze(e){for(var t=e.split("\n"),r=0,i=t.length;r<i;r++)t[r]=r+1+": "+t[r];return t.join("\n")}function Ge(e,t,r){if(!e.getShaderParameter(t,e.COMPILE_STATUS))return[e.getShaderInfoLog(t),ze(r)].join("\n")}var He=new J["a"].Float32Array(16),ke=q.extend({uniformSemantics:{},attributes:{}},(function(){this._locations={},this._textureSlot=0,this._program=null}),{bind:function(e){this._textureSlot=0,e.gl.useProgram(this._program)},hasUniform:function(e){var t=this._locations[e];return null!==t&&void 0!==t},useTextureSlot:function(e,t,r){t&&(e.gl.activeTexture(e.gl.TEXTURE0+r),t.isRenderable()?t.bind(e):t.unbind(e))},currentTextureSlot:function(){return this._textureSlot},resetTextureSlot:function(e){this._textureSlot=e||0},takeCurrentTextureSlot:function(e,t){var r=this._textureSlot;return this.useTextureSlot(e,t,r),this._textureSlot++,r},setUniform:function(e,t,r,i){var n=this._locations,a=n[r];if(null===a||void 0===a)return!1;switch(t){case"m4":if(!(i instanceof Float32Array)){for(var o=0;o<i.length;o++)He[o]=i[o];i=He}e.uniformMatrix4fv(a,!1,i);break;case"2i":e.uniform2i(a,i[0],i[1]);break;case"2f":e.uniform2f(a,i[0],i[1]);break;case"3i":e.uniform3i(a,i[0],i[1],i[2]);break;case"3f":e.uniform3f(a,i[0],i[1],i[2]);break;case"4i":e.uniform4i(a,i[0],i[1],i[2],i[3]);break;case"4f":e.uniform4f(a,i[0],i[1],i[2],i[3]);break;case"1i":e.uniform1i(a,i);break;case"1f":e.uniform1f(a,i);break;case"1fv":e.uniform1fv(a,i);break;case"1iv":e.uniform1iv(a,i);break;case"2iv":e.uniform2iv(a,i);break;case"2fv":e.uniform2fv(a,i);break;case"3iv":e.uniform3iv(a,i);break;case"3fv":e.uniform3fv(a,i);break;case"4iv":e.uniform4iv(a,i);break;case"4fv":e.uniform4fv(a,i);break;case"m2":case"m2v":e.uniformMatrix2fv(a,!1,i);break;case"m3":case"m3v":e.uniformMatrix3fv(a,!1,i);break;case"m4v":if(Array.isArray(i)&&Array.isArray(i[0])){var s=new J["a"].Float32Array(16*i.length),l=0;for(o=0;o<i.length;o++)for(var u=i[o],c=0;c<16;c++)s[l++]=u[c];e.uniformMatrix4fv(a,!1,s)}else e.uniformMatrix4fv(a,!1,i);break}return!0},setUniformOfSemantic:function(e,t,r){var i=this.uniformSemantics[t];return!!i&&this.setUniform(e,i.type,i.symbol,r)},enableAttributes:function(e,t,r){var i,n=e.gl,a=this._program,o=this._locations;i=r?r.__enabledAttributeList:Ue[e.__uid__],i||(i=r?r.__enabledAttributeList=[]:Ue[e.__uid__]=[]);for(var s=[],l=0;l<t.length;l++){var u=t[l];if(this.attributes[u]){var c=o[u];if(null==c){if(c=n.getAttribLocation(a,u),-1===c){s[l]=-1;continue}o[u]=c}s[l]=c,i[c]?i[c]=Be:i[c]=Oe}else s[l]=-1}for(l=0;l<i.length;l++)switch(i[l]){case Oe:n.enableVertexAttribArray(l),i[l]=Fe;break;case Be:i[l]=Fe;break;case Fe:n.disableVertexAttribArray(l),i[l]=0;break}return s},getAttribLocation:function(e,t){var r=this._locations,i=r[t];return null==i&&(i=e.getAttribLocation(this._program,t),r[t]=i),i},buildProgram:function(e,t,r,i){var n=e.createShader(e.VERTEX_SHADER),a=e.createProgram();e.shaderSource(n,r),e.compileShader(n);var o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,i),e.compileShader(o);var s=Ge(e,n,r);if(s)return s;if(s=Ge(e,o,i),s)return s;if(e.attachShader(a,n),e.attachShader(a,o),t.attributeSemantics["POSITION"])e.bindAttribLocation(a,0,t.attributeSemantics["POSITION"].symbol);else{var l=Object.keys(this.attributes);e.bindAttribLocation(a,0,l[0])}if(e.linkProgram(a),e.deleteShader(n),e.deleteShader(o),this._program=a,this.vertexCode=r,this.fragmentCode=i,!e.getProgramParameter(a,e.LINK_STATUS))return"Could not link program\n"+e.getProgramInfoLog(a);for(var u=0;u<t.uniforms.length;u++){var c=t.uniforms[u];this._locations[c]=e.getUniformLocation(a,c)}}}),Ve=ke,We=/for\s*?\(int\s*?_idx_\s*\=\s*([\w-]+)\;\s*_idx_\s*<\s*([\w-]+);\s*_idx_\s*\+\+\s*\)\s*\{\{([\s\S]+?)(?=\}\})\}\}/g;function je(e,t,r){function i(e,r,i,a){var o="";isNaN(r)&&(r=r in t?t[r]:n[r]),isNaN(i)&&(i=i in t?t[i]:n[i]);for(var s=parseInt(r);s<parseInt(i);s++)o+="{"+a.replace(/float\s*\(\s*_idx_\s*\)/g,s.toFixed(1)).replace(/_idx_/g,s)+"}";return o}var n={};for(var a in r)n[a+"_COUNT"]=r[a];return e.replace(We,i)}function Xe(e,t,r){var i=[];if(t)for(var n in t){var a=t[n];a>0&&i.push("#define "+n.toUpperCase()+"_COUNT "+a)}if(r)for(var o=0;o<r.length;o++){var s=r[o];i.push("#define "+s.toUpperCase()+"_ENABLED")}for(var s in e){var l=e[s];null===l?i.push("#define "+s):i.push("#define "+s+" "+l.toString())}return i.join("\n")}function qe(e){for(var t=[],r=0;r<e.length;r++)t.push("#extension GL_"+e[r]+" : enable");return t.join("\n")}function Ze(e){return["precision",e,"float"].join(" ")+";\n"+["precision",e,"int"].join(" ")+";\n"+["precision",e,"sampler2D"].join(" ")+";\n"}function Ye(e){this._renderer=e,this._cache={}}Ye.prototype.getProgram=function(e,t,r){var i=this._cache,n=e.isSkinnedMesh&&e.isSkinnedMesh(),a=e.isInstancedMesh&&e.isInstancedMesh(),o="s"+t.shader.shaderID+"m"+t.getProgramKey();r&&(o+="se"+r.getProgramKey(e.lightGroup)),n&&(o+=",sk"+e.joints.length),a&&(o+=",is");var s=i[o];if(s)return s;var l=r?r.getLightsNumbers(e.lightGroup):{},u=this._renderer,c=u.gl,h=t.getEnabledTextures(),d="";if(n){var f={SKINNING:null,JOINT_COUNT:e.joints.length};e.joints.length>u.getMaxJointNumber()&&(f.USE_SKIN_MATRICES_TEXTURE=null),d+="\n"+Xe(f)+"\n"}a&&(d+="\n#define INSTANCING\n");var p=d+Xe(t.vertexDefines,l,h),m=d+Xe(t.fragmentDefines,l,h),g=p+"\n"+t.shader.vertex,v=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(e){return null!=u.getGLExtension(e)}));v.indexOf("EXT_shader_texture_lod")>=0&&(m+="\n#define SUPPORT_TEXTURE_LOD"),v.indexOf("OES_standard_derivatives")>=0&&(m+="\n#define SUPPORT_STANDARD_DERIVATIVES");var _=qe(v)+"\n"+Ze(t.precision)+"\n"+m+"\n"+t.shader.fragment,y=je(g,t.vertexDefines,l),x=je(_,t.fragmentDefines,l);s=new Ve;s.uniformSemantics=t.shader.uniformSemantics,s.attributes=t.shader.attributes;var T=s.buildProgram(c,t.shader,y,x);return s.__error=T,i[o]=s,s};var Ke=Ye,$e=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g,Qe=/attribute\s+(float|int|vec2|vec3|vec4)\s+([\s\S]*?);/g,Je=/#define\s+(\w+)?(\s+[\d-.]+)?\s*;?\s*\n/g,et={bool:"1i",int:"1i",sampler2D:"t",samplerCube:"t",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",ivec2:"2i",ivec3:"3i",ivec4:"4i",mat2:"m2",mat3:"m3",mat4:"m4"};function tt(e){for(var t=[],r=0;r<e;r++)t[r]=0;return t}var rt={bool:function(){return!0},int:function(){return 0},float:function(){return 0},sampler2D:function(){return null},samplerCube:function(){return null},vec2:function(){return tt(2)},vec3:function(){return tt(3)},vec4:function(){return tt(4)},ivec2:function(){return tt(2)},ivec3:function(){return tt(3)},ivec4:function(){return tt(4)},mat2:function(){return tt(4)},mat3:function(){return tt(9)},mat4:function(){return tt(16)},array:function(){return[]}},it=["POSITION","NORMAL","BINORMAL","TANGENT","TEXCOORD","TEXCOORD_0","TEXCOORD_1","COLOR","JOINT","WEIGHT"],nt=["SKIN_MATRIX","VIEWPORT_SIZE","VIEWPORT","DEVICEPIXELRATIO","WINDOW_SIZE","NEAR","FAR","TIME"],at=["WORLD","VIEW","PROJECTION","WORLDVIEW","VIEWPROJECTION","WORLDVIEWPROJECTION","WORLDINVERSE","VIEWINVERSE","PROJECTIONINVERSE","WORLDVIEWINVERSE","VIEWPROJECTIONINVERSE","WORLDVIEWPROJECTIONINVERSE","WORLDTRANSPOSE","VIEWTRANSPOSE","PROJECTIONTRANSPOSE","WORLDVIEWTRANSPOSE","VIEWPROJECTIONTRANSPOSE","WORLDVIEWPROJECTIONTRANSPOSE","WORLDINVERSETRANSPOSE","VIEWINVERSETRANSPOSE","PROJECTIONINVERSETRANSPOSE","WORLDVIEWINVERSETRANSPOSE","VIEWPROJECTIONINVERSETRANSPOSE","WORLDVIEWPROJECTIONINVERSETRANSPOSE"],ot={vec4:4,vec3:3,vec2:2,float:1},st={},lt={};function ut(e,t){var r="vertex:"+e+"fragment:"+t;if(st[r])return st[r];var i=j.genGUID();return st[r]=i,lt[i]={vertex:e,fragment:t},i}function ct(e){return e.replace(/[ \t]*\/\/.*\n/g,"").replace(/[ \t]*\/\*[\s\S]*?\*\//g,"")}function ht(){console.error("Wrong uniform/attributes syntax")}function dt(e,t){for(var r=/[,=\(\):]/,i=t.replace(/:\s*\[\s*(.*)\s*\]/g,"="+e+"($1)").replace(/\s+/g,"").split(/(?=[,=\(\):])/g),n=[],a=0;a<i.length;a++)i[a].match(r)?n.push(i[a].charAt(0),i[a].slice(1)):n.push(i[a]);i=n;var o,s=0,l=1,u=2,c=3,h=4,d=5,f=s,p={},m=null;function g(e){e||ht();var t=e.match(/\[(.*?)\]/);o=e.replace(/\[(.*?)\]/,""),p[o]={},t&&(p[o].isArray=!0,p[o].arraySize=t[1])}g(i[0]);for(a=1;a<i.length;a++){var v=i[a];if(v)if("="!==v)if(":"!==v)if(","!==v)if(")"!==v)if("("!==v)if(v.indexOf("vec")>=0){if(f!==l&&f!==h){ht();break}f=u,m=[]}else if(f!==l)if(f!==h)g(v),f=s;else{var _=v;it.indexOf(_)>=0||nt.indexOf(_)>=0||at.indexOf(_)>=0?p[o].semantic=_:"ignore"===_||"unconfigurable"===_?p[o].ignore=!0:p[o].value="bool"===e?"true"===_:parseFloat(_)}else p[o].value="bool"===e?"true"===v:parseFloat(v),m=null;else{if(f!==u){ht();break}if(!(m instanceof Array)){ht();break}m.push(+i[++a])}else p[o].value=new J["a"].Float32Array(m),m=null,f=d;else if(f===u){if(!(m instanceof Array)){ht();break}m.push(+i[++a])}else f=d;else f=h;else{if(f!==s&&f!==c){ht();break}f=l}}return p}function ft(e,t){"object"===typeof e&&(t=e.fragment,e=e.vertex),e=ct(e),t=ct(t),this._shaderID=ut(e,t),this._vertexCode=ft.parseImport(e),this._fragmentCode=ft.parseImport(t),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}ft.prototype={constructor:ft,createUniforms:function(){var e={};for(var t in this.uniformTemplates){var r=this.uniformTemplates[t];e[t]={type:r.type,value:r.value()}}return e},_parseImport:function(){this._vertexCode=ft.parseImport(this.vertex),this._fragmentCode=ft.parseImport(this.fragment)},_addSemanticUniform:function(e,t,r){if(it.indexOf(r)>=0)this.attributeSemantics[r]={symbol:e,type:t};else if(at.indexOf(r)>=0){var i=!1,n=r;r.match(/TRANSPOSE$/)&&(i=!0,n=r.slice(0,-9)),this.matrixSemantics[r]={symbol:e,type:t,isTranspose:i,semanticNoTranspose:n}}else nt.indexOf(r)>=0&&(this.uniformSemantics[r]={symbol:e,type:t})},_addMaterialUniform:function(e,t,r,i,n,a){a[e]={type:r,value:n?rt["array"]:i||rt[t],semantic:null}},_parseUniforms:function(){var e={},t=this,r="vertex";function i(e){return null!=e?function(){return e}:null}function n(n,a,o){var s=dt(a,o),l=[];for(var u in s){var c=s[u],h=c.semantic,d=u,f=et[a],p=i(s[u].value);s[u].isArray&&(d+="["+s[u].arraySize+"]",f+="v"),l.push(d),t._uniformList.push(u),c.ignore||("sampler2D"!==a&&"samplerCube"!==a||(t.textures[u]={shaderType:r,type:a}),h?t._addSemanticUniform(u,f,h):t._addMaterialUniform(u,a,f,p,s[u].isArray,e))}return l.length>0?"uniform "+a+" "+l.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace($e,n),r="fragment",this._fragmentCode=this._fragmentCode.replace($e,n),t.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=e},_parseAttributes:function(){var e={},t=this;function r(r,i,n){var a=dt(i,n),o=ot[i]||1,s=[];for(var l in a){var u=a[l].semantic;if(e[l]={type:"float",size:o,semantic:u||null},u){if(it.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');t.attributeSemantics[u]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"}this._vertexCode=this._vertexCode.replace(Qe,r),this.attributes=e},_parseDefines:function(){var e=this,t="vertex";function r(r,i,n){var a="vertex"===t?e.vertexDefines:e.fragmentDefines;return a[i]||(a[i]="false"!==n&&("true"===n||(n?isNaN(parseFloat(n))?n.trim():parseFloat(n):null))),""}this._vertexCode=this._vertexCode.replace(Je,r),t="fragment",this._fragmentCode=this._fragmentCode.replace(Je,r)},clone:function(){var e=lt[this._shaderID],t=new ft(e.vertex,e.fragment);return t}},Object.defineProperty&&(Object.defineProperty(ft.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(ft.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(ft.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(ft.prototype,"uniforms",{get:function(){return this._uniformList}}));var pt=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;ft.parseImport=function(e){return e=e.replace(pt,(function(e,t,r){e=ft.source(r);return e?ft.parseImport(e):(console.error('Shader chunk "'+r+'" not existed in library'),"")})),e};var mt=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;ft["import"]=function(e){e.replace(mt,(function(e,t,r,i){i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"");if(i){var n,a=r.split("."),o=ft.codes,s=0;while(s<a.length-1)n=a[s++],o[n]||(o[n]={}),o=o[n];n=a[s],o[n]=i}return i}))},ft.codes={},ft.source=function(e){var t=e.split("."),r=ft.codes,i=0;while(r&&i<t.length){var n=t[i++];r=r[n]}return"string"!==typeof r?(console.error('Shader "'+e+'" not existed in library'),""):r};var gt=ft,vt="@export clay.prez.vertex\nuniform mat4 WVP : WORLDVIEWPROJECTION;\nattribute vec3 pos : POSITION;\nattribute vec2 uv : TEXCOORD_0;\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\n@import clay.chunk.skinning_header\n@import clay.chunk.instancing_header\nvarying vec2 v_Texcoord;\nvoid main()\n{\n vec4 P = vec4(pos, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = WVP * P;\n v_Texcoord = uv * uvRepeat + uvOffset;\n}\n@end\n@export clay.prez.fragment\nuniform sampler2D alphaMap;\nuniform float alphaCutoff: 0.0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n if (alphaCutoff > 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end",_t={create:function(){var e=new Me(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},clone:function(e){var t=new Me(16);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],t},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},transpose:function(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],v=t[15],_=r*s-i*o,y=r*l-n*o,x=r*u-a*o,T=i*l-n*s,b=i*u-a*s,w=n*u-a*l,E=c*m-h*p,S=c*g-d*p,C=c*v-f*p,A=h*g-d*m,M=h*v-f*m,L=d*v-f*g,D=_*L-y*M+x*A+T*C-b*S+w*E;return D?(D=1/D,e[0]=(s*L-l*M+u*A)*D,e[1]=(n*M-i*L-a*A)*D,e[2]=(m*w-g*b+v*T)*D,e[3]=(d*b-h*w-f*T)*D,e[4]=(l*C-o*L-u*S)*D,e[5]=(r*L-n*C+a*S)*D,e[6]=(g*x-p*w-v*y)*D,e[7]=(c*w-d*x+f*y)*D,e[8]=(o*M-s*C+u*E)*D,e[9]=(i*C-r*M-a*E)*D,e[10]=(p*b-m*x+v*_)*D,e[11]=(h*x-c*b-f*_)*D,e[12]=(s*S-o*A-l*E)*D,e[13]=(r*A-i*S+n*E)*D,e[14]=(m*y-p*T-g*_)*D,e[15]=(c*T-h*y+d*_)*D,e):null},adjoint:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(d*v-f*g)-h*(l*v-u*g)+m*(l*f-u*d),e[1]=-(i*(d*v-f*g)-h*(n*v-a*g)+m*(n*f-a*d)),e[2]=i*(l*v-u*g)-s*(n*v-a*g)+m*(n*u-a*l),e[3]=-(i*(l*f-u*d)-s*(n*f-a*d)+h*(n*u-a*l)),e[4]=-(o*(d*v-f*g)-c*(l*v-u*g)+p*(l*f-u*d)),e[5]=r*(d*v-f*g)-c*(n*v-a*g)+p*(n*f-a*d),e[6]=-(r*(l*v-u*g)-o*(n*v-a*g)+p*(n*u-a*l)),e[7]=r*(l*f-u*d)-o*(n*f-a*d)+c*(n*u-a*l),e[8]=o*(h*v-f*m)-c*(s*v-u*m)+p*(s*f-u*h),e[9]=-(r*(h*v-f*m)-c*(i*v-a*m)+p*(i*f-a*h)),e[10]=r*(s*v-u*m)-o*(i*v-a*m)+p*(i*u-a*s),e[11]=-(r*(s*f-u*h)-o*(i*f-a*h)+c*(i*u-a*s)),e[12]=-(o*(h*g-d*m)-c*(s*g-l*m)+p*(s*d-l*h)),e[13]=r*(h*g-d*m)-c*(i*g-n*m)+p*(i*d-n*h),e[14]=-(r*(s*g-l*m)-o*(i*g-n*m)+p*(i*l-n*s)),e[15]=r*(s*d-l*h)-o*(i*d-n*h)+c*(i*l-n*s),e},determinant:function(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],m=e[14],g=e[15],v=t*o-r*a,_=t*s-i*a,y=t*l-n*a,x=r*s-i*o,T=r*l-n*o,b=i*l-n*s,w=u*p-c*f,E=u*m-h*f,S=u*g-d*f,C=c*m-h*p,A=c*g-d*p,M=h*g-d*m;return v*M-_*A+y*C+x*S-T*E+b*w},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],m=t[12],g=t[13],v=t[14],_=t[15],y=r[0],x=r[1],T=r[2],b=r[3];return e[0]=y*i+x*s+T*h+b*m,e[1]=y*n+x*l+T*d+b*g,e[2]=y*a+x*u+T*f+b*v,e[3]=y*o+x*c+T*p+b*_,y=r[4],x=r[5],T=r[6],b=r[7],e[4]=y*i+x*s+T*h+b*m,e[5]=y*n+x*l+T*d+b*g,e[6]=y*a+x*u+T*f+b*v,e[7]=y*o+x*c+T*p+b*_,y=r[8],x=r[9],T=r[10],b=r[11],e[8]=y*i+x*s+T*h+b*m,e[9]=y*n+x*l+T*d+b*g,e[10]=y*a+x*u+T*f+b*v,e[11]=y*o+x*c+T*p+b*_,y=r[12],x=r[13],T=r[14],b=r[15],e[12]=y*i+x*s+T*h+b*m,e[13]=y*n+x*l+T*d+b*g,e[14]=y*a+x*u+T*f+b*v,e[15]=y*o+x*c+T*p+b*_,e},multiplyAffine:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[4],s=t[5],l=t[6],u=t[8],c=t[9],h=t[10],d=t[12],f=t[13],p=t[14],m=r[0],g=r[1],v=r[2];return e[0]=m*i+g*o+v*u,e[1]=m*n+g*s+v*c,e[2]=m*a+g*l+v*h,m=r[4],g=r[5],v=r[6],e[4]=m*i+g*o+v*u,e[5]=m*n+g*s+v*c,e[6]=m*a+g*l+v*h,m=r[8],g=r[9],v=r[10],e[8]=m*i+g*o+v*u,e[9]=m*n+g*s+v*c,e[10]=m*a+g*l+v*h,m=r[12],g=r[13],v=r[14],e[12]=m*i+g*o+v*u+d,e[13]=m*n+g*s+v*c+f,e[14]=m*a+g*l+v*h+p,e}};_t.mul=_t.multiply,_t.mulAffine=_t.multiplyAffine,_t.translate=function(e,t,r){var i,n,a,o,s,l,u,c,h,d,f,p,m=r[0],g=r[1],v=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=i*m+s*g+h*v+t[12],e[13]=n*m+l*g+d*v+t[13],e[14]=a*m+u*g+f*v+t[14],e[15]=o*m+c*g+p*v+t[15]),e},_t.scale=function(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},_t.rotate=function(e,t,r,i){var n,a,o,s,l,u,c,h,d,f,p,m,g,v,_,y,x,T,b,w,E,S,C,A,M=i[0],L=i[1],D=i[2],N=Math.sqrt(M*M+L*L+D*D);return Math.abs(N)<Ae?null:(N=1/N,M*=N,L*=N,D*=N,n=Math.sin(r),a=Math.cos(r),o=1-a,s=t[0],l=t[1],u=t[2],c=t[3],h=t[4],d=t[5],f=t[6],p=t[7],m=t[8],g=t[9],v=t[10],_=t[11],y=M*M*o+a,x=L*M*o+D*n,T=D*M*o-L*n,b=M*L*o-D*n,w=L*L*o+a,E=D*L*o+M*n,S=M*D*o+L*n,C=L*D*o-M*n,A=D*D*o+a,e[0]=s*y+h*x+m*T,e[1]=l*y+d*x+g*T,e[2]=u*y+f*x+v*T,e[3]=c*y+p*x+_*T,e[4]=s*b+h*w+m*E,e[5]=l*b+d*w+g*E,e[6]=u*b+f*w+v*E,e[7]=c*b+p*w+_*E,e[8]=s*S+h*C+m*A,e[9]=l*S+d*C+g*A,e[10]=u*S+f*C+v*A,e[11]=c*S+p*C+_*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)},_t.rotateX=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*i,e[5]=o*n+c*i,e[6]=s*n+h*i,e[7]=l*n+d*i,e[8]=u*n-a*i,e[9]=c*n-o*i,e[10]=h*n-s*i,e[11]=d*n-l*i,e},_t.rotateY=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*i,e[1]=o*n-c*i,e[2]=s*n-h*i,e[3]=l*n-d*i,e[8]=a*i+u*n,e[9]=o*i+c*n,e[10]=s*i+h*n,e[11]=l*i+d*n,e},_t.rotateZ=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*i,e[1]=o*n+c*i,e[2]=s*n+h*i,e[3]=l*n+d*i,e[4]=u*n-a*i,e[5]=c*n-o*i,e[6]=h*n-s*i,e[7]=d*n-l*i,e},_t.fromRotationTranslation=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=i+i,l=n+n,u=a+a,c=i*s,h=i*l,d=i*u,f=n*l,p=n*u,m=a*u,g=o*s,v=o*l,_=o*u;return e[0]=1-(f+m),e[1]=h+_,e[2]=d-v,e[3]=0,e[4]=h-_,e[5]=1-(c+m),e[6]=p+g,e[7]=0,e[8]=d+v,e[9]=p-g,e[10]=1-(c+f),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},_t.fromQuat=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,h=i*s,d=n*o,f=n*s,p=n*l,m=a*o,g=a*s,v=a*l;return e[0]=1-h-p,e[1]=c+v,e[2]=d-g,e[3]=0,e[4]=c-v,e[5]=1-u-p,e[6]=f+m,e[7]=0,e[8]=d+g,e[9]=f-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_t.frustum=function(e,t,r,i,n,a,o){var s=1/(r-t),l=1/(n-i),u=1/(a-o);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(n+i)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e},_t.perspective=function(e,t,r,i,n){var a=1/Math.tan(t/2),o=1/(i-n);return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+i)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*i*o,e[15]=0,e},_t.ortho=function(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=(o+a)*u,e[15]=1,e},_t.lookAt=function(e,t,r,i){var n,a,o,s,l,u,c,h,d,f,p=t[0],m=t[1],g=t[2],v=i[0],_=i[1],y=i[2],x=r[0],T=r[1],b=r[2];return Math.abs(p-x)<Ae&&Math.abs(m-T)<Ae&&Math.abs(g-b)<Ae?_t.identity(e):(c=p-x,h=m-T,d=g-b,f=1/Math.sqrt(c*c+h*h+d*d),c*=f,h*=f,d*=f,n=_*d-y*h,a=y*c-v*d,o=v*h-_*c,f=Math.sqrt(n*n+a*a+o*o),f?(f=1/f,n*=f,a*=f,o*=f):(n=0,a=0,o=0),s=h*o-d*a,l=d*n-c*o,u=c*a-h*n,f=Math.sqrt(s*s+l*l+u*u),f?(f=1/f,s*=f,l*=f,u*=f):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=c,e[3]=0,e[4]=a,e[5]=l,e[6]=h,e[7]=0,e[8]=o,e[9]=u,e[10]=d,e[11]=0,e[12]=-(n*p+a*m+o*g),e[13]=-(s*p+l*m+u*g),e[14]=-(c*p+h*m+d*g),e[15]=1,e)},_t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2)+Math.pow(e[9],2)+Math.pow(e[10],2)+Math.pow(e[11],2)+Math.pow(e[12],2)+Math.pow(e[13],2)+Math.pow(e[14],2)+Math.pow(e[15],2))};var yt=_t,xt={create:function(){var e=new Me(3);return e[0]=0,e[1]=0,e[2]=0,e},clone:function(e){var t=new Me(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},fromValues:function(e,t,r){var i=new Me(3);return i[0]=e,i[1]=t,i[2]=r,i},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},set:function(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e},subtract:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}};xt.sub=xt.subtract,xt.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e},xt.mul=xt.multiply,xt.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e},xt.div=xt.divide,xt.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},xt.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},xt.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e},xt.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},xt.distance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(r*r+i*i+n*n)},xt.dist=xt.distance,xt.squaredDistance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n},xt.sqrDist=xt.squaredDistance,xt.length=function(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)},xt.len=xt.length,xt.squaredLength=function(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i},xt.sqrLen=xt.squaredLength,xt.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},xt.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},xt.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e},xt.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},xt.cross=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e},xt.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e},xt.random=function(e,t){t=t||1;var r=2*Le()*Math.PI,i=2*Le()-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e},xt.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e},xt.transformMat3=function(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e},xt.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*i+s*a-l*n,h=u*n+l*i-o*a,d=u*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=c*u+f*-o+h*-l-d*-s,e[1]=h*u+f*-s+d*-o-c*-l,e[2]=d*u+f*-l+c*-s-h*-o,e},xt.rotateX=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},xt.rotateY=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},xt.rotateZ=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},xt.forEach=function(){var e=xt.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}(),xt.angle=function(e,t){var r=xt.fromValues(e[0],e[1],e[2]),i=xt.fromValues(t[0],t[1],t[2]);xt.normalize(r,r),xt.normalize(i,i);var n=xt.dot(r,i);return n>1?0:Math.acos(n)};var Tt=xt;gt["import"](vt);var bt=yt.create,wt={};function Et(e){return e.material}function St(e,t,r){return t.uniforms[r].value}function Ct(e,t,r,i){return r!==i}function At(e){return!0}function Mt(){}var Lt={float:Q.FLOAT,byte:Q.BYTE,ubyte:Q.UNSIGNED_BYTE,short:Q.SHORT,ushort:Q.UNSIGNED_SHORT};function Dt(e,t,r){this.availableAttributes=e,this.availableAttributeSymbols=t,this.indicesBuffer=r,this.vao=null}function Nt(e){var t,r;this.bind=function(e){t||(t=J["a"].createCanvas(),t.width=t.height=1,t.getContext("2d"));var i=e.gl,n=!r;n&&(r=i.createTexture()),i.bindTexture(i.TEXTURE_2D,r),n&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t)},this.unbind=function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var Rt=q.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!==typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=J["a"].createCanvas());var e=this.canvas;try{var t={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!this.gl)throw new Error;this._glinfo=new $(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(r){throw"Error creating WebGL Context "+r}this._programMgr=new Ke(this),this._placeholderTexture=new Nt(this)}),{resize:function(e,t){var r=this.canvas,i=this.devicePixelRatio;null!=e?(r.style&&(r.style.width=e+"px",r.style.height=t+"px"),r.width=e*i,r.height=t*i,this._width=e,this._height=t):(this._width=r.width/i,this._height=r.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var e=this.viewport;return e.width/e.height},setDevicePixelRatio:function(e){this.devicePixelRatio=e,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(e){return this._glinfo.getExtension(e)},getGLParameter:function(e){return this._glinfo.getParameter(e)},setViewport:function(e,t,r,i,n){if("object"===typeof e){var a=e;e=a.x,t=a.y,r=a.width,i=a.height,n=a.devicePixelRatio}n=n||this.devicePixelRatio,this.gl.viewport(e*n,t*n,r*n,i*n),this.viewport={x:e,y:t,width:r,height:i,devicePixelRatio:n}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var e=this._clearStack.pop();this.clearColor=e.clearColor,this.clearBit=e.clearBit}},bindSceneRendering:function(e){this._sceneRendering=e},render:function(e,t,r,i){var n=this.gl,a=this.clearColor;if(this.clearBit){n.colorMask(!0,!0,!0,!0),n.depthMask(!0);var o=this.viewport,s=!1,l=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||l&&l!==this.devicePixelRatio||o.x||o.y)&&(s=!0,n.enable(n.SCISSOR_TEST),n.scissor(o.x*l,o.y*l,o.width*l,o.height*l)),n.clearColor(a[0],a[1],a[2],a[3]),n.clear(this.clearBit),s&&n.disable(n.SCISSOR_TEST)}if(r||e.update(!1),e.updateLights(),t=t||e.getMainCamera(),t){t.update();var u=e.updateRenderList(t,!0);this._sceneRendering=e;var c=u.opaque,h=u.transparent,d=e.material;e.trigger("beforerender",this,e,t,u),i?(this.renderPreZ(c,e,t),n.depthFunc(n.LEQUAL)):n.depthFunc(n.LESS);for(var f=bt(),p=Tt.create(),m=0;m<h.length;m++){var g=h[m];yt.multiplyAffine(f,t.viewMatrix.array,g.worldTransform.array),Tt.transformMat4(p,g.position.array,f),g.__depth=p[2]}this.renderPass(c,t,{getMaterial:function(e){return d||e.material},sortCompare:this.opaqueSortCompare}),this.renderPass(h,t,{getMaterial:function(e){return d||e.material},sortCompare:this.transparentSortCompare}),e.trigger("afterrender",this,e,t,u),this._sceneRendering=null}else console.error("Can't find camera in the scene.")},getProgram:function(e,t,r){return t=t||e.material,this._programMgr.getProgram(e,t,r)},validateProgram:function(e){if(e.__error){var t=e.__error;if(wt[e.__uid__])return;if(wt[e.__uid__]=!0,this.throwError)throw new Error(t);this.trigger("error",t)}},updatePrograms:function(e,t,r){var i=r&&r.getMaterial||Et;t=t||null;for(var n=0;n<e.length;n++){var a=e[n],o=i.call(this,a);if(n>0){var s=e[n-1],l=s.joints?s.joints.length:0,u=a.joints?a.joints.length:0;if(u===l&&a.material===s.material&&a.lightGroup===s.lightGroup){a.__program=s.__program;continue}}var c=this._programMgr.getProgram(a,o,t);this.validateProgram(c),a.__program=c}},renderPass:function(e,t,r){this.trigger("beforerenderpass",this,e,t,r),r=r||{},r.getMaterial=r.getMaterial||Et,r.getUniform=r.getUniform||St,r.isMaterialChanged=r.isMaterialChanged||Ct,r.beforeRender=r.beforeRender||Mt,r.afterRender=r.afterRender||Mt;var i=r.ifRender||At;this.updatePrograms(e,this._sceneRendering,r),r.sortCompare&&e.sort(r.sortCompare);var n=this.viewport,a=n.devicePixelRatio,o=[n.x*a,n.y*a,n.width*a,n.height*a],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[o[2],o[3]],c=Date.now();t?(yt.copy(It.VIEW,t.viewMatrix.array),yt.copy(It.PROJECTION,t.projectionMatrix.array),yt.copy(It.VIEWINVERSE,t.worldTransform.array)):(yt.identity(It.VIEW),yt.identity(It.PROJECTION),yt.identity(It.VIEWINVERSE)),yt.multiply(It.VIEWPROJECTION,It.PROJECTION,It.VIEW),yt.invert(It.PROJECTIONINVERSE,It.PROJECTION),yt.invert(It.VIEWPROJECTIONINVERSE,It.VIEWPROJECTION);for(var h,d,f,p,m,g,v,_,y,x,T,b,w=this.gl,E=this._sceneRendering,S=null,C=0;C<e.length;C++){var A,M=e[C],L=null!=M.worldTransform;if(i(M)){L&&(A=M.isSkinnedMesh&&M.isSkinnedMesh()?M.offsetMatrix?M.offsetMatrix.array:It.IDENTITY:M.worldTransform.array);var D=M.geometry,N=r.getMaterial.call(this,M),R=M.__program,I=N.shader,P=D.__uid__+"-"+R.__uid__,O=P!==x;x=P,O&&S&&S.bindVertexArrayOES(null),L&&(yt.copy(It.WORLD,A),yt.multiply(It.WORLDVIEWPROJECTION,It.VIEWPROJECTION,A),yt.multiplyAffine(It.WORLDVIEW,It.VIEW,A),(I.matrixSemantics.WORLDINVERSE||I.matrixSemantics.WORLDINVERSETRANSPOSE)&&yt.invert(It.WORLDINVERSE,A),(I.matrixSemantics.WORLDVIEWINVERSE||I.matrixSemantics.WORLDVIEWINVERSETRANSPOSE)&&yt.invert(It.WORLDVIEWINVERSE,It.WORLDVIEW),(I.matrixSemantics.WORLDVIEWPROJECTIONINVERSE||I.matrixSemantics.WORLDVIEWPROJECTIONINVERSETRANSPOSE)&&yt.invert(It.WORLDVIEWPROJECTIONINVERSE,It.WORLDVIEWPROJECTION)),M.beforeRender&&M.beforeRender(this),r.beforeRender.call(this,M,N,h);var B=R!==d;B?(R.bind(this),R.setUniformOfSemantic(w,"VIEWPORT",o),R.setUniformOfSemantic(w,"WINDOW_SIZE",l),t&&(R.setUniformOfSemantic(w,"NEAR",t.near),R.setUniformOfSemantic(w,"FAR",t.far)),R.setUniformOfSemantic(w,"DEVICEPIXELRATIO",a),R.setUniformOfSemantic(w,"TIME",c),R.setUniformOfSemantic(w,"VIEWPORT_SIZE",u),E&&E.setLightUniforms(R,M.lightGroup,this)):R=d,(B||r.isMaterialChanged(M,f,N,h))&&(N.depthTest!==p&&(N.depthTest?w.enable(w.DEPTH_TEST):w.disable(w.DEPTH_TEST),p=N.depthTest),N.depthMask!==m&&(w.depthMask(N.depthMask),m=N.depthMask),N.transparent!==y&&(N.transparent?w.enable(w.BLEND):w.disable(w.BLEND),y=N.transparent),N.transparent&&(N.blend?N.blend(w):(w.blendEquationSeparate(w.FUNC_ADD,w.FUNC_ADD),w.blendFuncSeparate(w.SRC_ALPHA,w.ONE_MINUS_SRC_ALPHA,w.ONE,w.ONE_MINUS_SRC_ALPHA))),b=this._bindMaterial(M,N,R,f||null,h||null,d||null,r.getUniform),h=N);var F=I.matrixSemanticKeys;if(L)for(var U=0;U<F.length;U++){var z=F[U],G=I.matrixSemantics[z],H=It[z];if(G.isTranspose){var k=It[G.semanticNoTranspose];yt.transpose(H,k)}R.setUniform(w,G.type,G.symbol,H)}M.cullFace!==v&&(v=M.cullFace,w.cullFace(v)),M.frontFace!==_&&(_=M.frontFace,w.frontFace(_)),M.culling!==g&&(g=M.culling,g?w.enable(w.CULL_FACE):w.disable(w.CULL_FACE)),this._updateSkeleton(M,R,b),O&&(T=this._bindVAO(S,I,D,R)),this._renderObject(M,T,R),r.afterRender(this,M),M.afterRender&&M.afterRender(this),d=R,f=M}}S&&S.bindVertexArrayOES(null),this.trigger("afterrenderpass",this,e,t,r)},getMaxJointNumber:function(){return this.maxJointNumber},_updateSkeleton:function(e,t,r){var i=this.gl,n=e.skeleton;if(n)if(n.update(),e.joints.length>this.getMaxJointNumber()){var a=n.getSubSkinMatricesTexture(e.__uid__,e.joints);t.useTextureSlot(this,a,r),t.setUniform(i,"1i","skinMatricesTexture",r),t.setUniform(i,"1f","skinMatricesTextureSize",a.width)}else{var o=n.getSubSkinMatrices(e.__uid__,e.joints);t.setUniformOfSemantic(i,"SKIN_MATRIX",o)}},_renderObject:function(e,t,r){var i=this.gl,n=e.geometry,a=e.mode;null==a&&(a=4);var o=null,s=e.isInstancedMesh&&e.isInstancedMesh();if(!s||(o=this.getGLExtension("ANGLE_instanced_arrays"),o)){var l;if(s&&(l=this._bindInstancedAttributes(e,r,o)),t.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint"),c=u&&n.indices instanceof Uint32Array,h=c?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?o.drawElementsInstancedANGLE(a,t.indicesBuffer.count,h,0,e.getInstanceCount()):i.drawElements(a,t.indicesBuffer.count,h,0)}else s?o.drawArraysInstancedANGLE(a,0,n.vertexCount,e.getInstanceCount()):i.drawArrays(a,0,n.vertexCount);if(s)for(var d=0;d<l.length;d++)i.disableVertexAttribArray(l[d])}else console.warn("Device not support ANGLE_instanced_arrays extension")},_bindInstancedAttributes:function(e,t,r){for(var i=this.gl,n=e.getInstancedAttributesBuffers(this),a=[],o=0;o<n.length;o++){var s=n[o],l=t.getAttribLocation(i,s.symbol);if(!(l<0)){var u=Lt[s.type]||i.FLOAT;i.enableVertexAttribArray(l),i.bindBuffer(i.ARRAY_BUFFER,s.buffer),i.vertexAttribPointer(l,s.size,u,!1,0,0),r.vertexAttribDivisorANGLE(l,s.divisor),a.push(l)}}return a},_bindMaterial:function(e,t,r,i,n,a,o){for(var s=this.gl,l=a===r,u=r.currentTextureSlot(),c=t.getEnabledUniforms(),h=t.getTextureUniforms(),d=this._placeholderTexture,f=0;f<h.length;f++){var p=h[f],m=o(e,t,p),g=t.uniforms[p].type;if("t"===g&&m)m.__slot=-1;else if("tv"===g)for(var v=0;v<m.length;v++)m[v]&&(m[v].__slot=-1)}d.__slot=-1;for(f=0;f<c.length;f++){p=c[f];var _=t.uniforms[p],y=(m=o(e,t,p),g=_.type,"t"===g);if(y&&(m&&m.isRenderable()||(m=d)),n&&l){var x=o(i,n,p);if(y&&(x&&x.isRenderable()||(x=d)),x===m){if(y)r.takeCurrentTextureSlot(this,null);else if("tv"===g&&m)for(v=0;v<m.length;v++)r.takeCurrentTextureSlot(this,null);continue}}if(null!=m)if(y)if(m.__slot<0){var T=r.currentTextureSlot(),b=r.setUniform(s,"1i",p,T);b&&(r.takeCurrentTextureSlot(this,m),m.__slot=T)}else r.setUniform(s,"1i",p,m.__slot);else if(Array.isArray(m)){if(0===m.length)continue;if("tv"===g){if(!r.hasUniform(p))continue;var w=[];for(v=0;v<m.length;v++){var E=m[v];if(E.__slot<0){T=r.currentTextureSlot();w.push(T),r.takeCurrentTextureSlot(this,E),E.__slot=T}else w.push(E.__slot)}r.setUniform(s,"1iv",p,w)}else r.setUniform(s,_.type,p,m)}else r.setUniform(s,_.type,p,m)}var S=r.currentTextureSlot();return r.resetTextureSlot(u),S},_bindVAO:function(e,t,r,i){var n=!r.dynamic,a=this.gl,o=this.__uid__+"-"+i.__uid__,s=r.__vaoCache[o];if(!s){var l=r.getBufferChunks(this);if(!l||!l.length)return;for(var u=l[0],c=u.attributeBuffers,h=u.indicesBuffer,d=[],f=[],p=0;p<c.length;p++){var m,g=c[p],v=g.name,_=g.semantic;if(_){var y=t.attributeSemantics[_];m=y&&y.symbol}else m=v;m&&i.attributes[m]&&(d.push(g),f.push(m))}s=new Dt(d,f,h),n&&(r.__vaoCache[o]=s)}var x=!0;e&&n&&(null==s.vao?s.vao=e.createVertexArrayOES():x=!1,e.bindVertexArrayOES(s.vao));d=s.availableAttributes,h=s.indicesBuffer;if(x){var T=i.enableAttributes(this,s.availableAttributeSymbols,e&&n&&s);for(p=0;p<d.length;p++){var b=T[p];if(-1!==b){g=d[p];var w=g.buffer,E=g.size,S=Lt[g.type]||a.FLOAT;a.bindBuffer(a.ARRAY_BUFFER,w),a.vertexAttribPointer(b,E,S,!1,0,0)}}r.isUseIndices()&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,h.buffer)}return s},renderPreZ:function(e,t,r){var i=this.gl,n=this._prezMaterial||new Ce({shader:new gt(gt.source("clay.prez.vertex"),gt.source("clay.prez.fragment"))});this._prezMaterial=n,i.colorMask(!1,!1,!1,!1),i.depthMask(!0),this.renderPass(e,r,{ifRender:function(e){return!e.ignorePreZ},isMaterialChanged:function(e,t){var r=e.material,i=t.material;return r.get("diffuseMap")!==i.get("diffuseMap")||(r.get("alphaCutoff")||0)!==(i.get("alphaCutoff")||0)},getUniform:function(e,t,r){if("alphaMap"===r)return e.material.get("diffuseMap");if("alphaCutoff"===r){if(e.material.isDefined("fragment","ALPHA_TEST")&&e.material.get("diffuseMap")){var i=e.material.get("alphaCutoff");return i||0}return 0}return"uvRepeat"===r?e.material.get("uvRepeat"):"uvOffset"===r?e.material.get("uvOffset"):t.get(r)},getMaterial:function(){return n},sort:this.opaqueSortCompare}),i.colorMask(!0,!0,!0,!0),i.depthMask(!0)},disposeScene:function(e){this.disposeNode(e,!0,!0),e.dispose()},disposeNode:function(e,t,r){e.getParent()&&e.getParent().remove(e);var i={};e.traverse((function(e){var n=e.material;if(e.geometry&&t&&e.geometry.dispose(this),r&&n&&!i[n.__uid__]){for(var a=n.getTextureUniforms(),o=0;o<a.length;o++){var s=a[o],l=n.uniforms[s].value,u=n.uniforms[s].type;if(l)if("t"===u)l.dispose&&l.dispose(this);else if("tv"===u)for(var c=0;c<l.length;c++)l[c]&&l[c].dispose&&l[c].dispose(this)}i[n.__uid__]=!0}e.dispose&&e.dispose(this)}),this)},disposeGeometry:function(e){e.dispose(this)},disposeTexture:function(e){e.dispose(this)},disposeFrameBuffer:function(e){e.dispose(this)},dispose:function(){},screenToNDC:function(e,t,r){r||(r=new Pe),t=this._height-t;var i=this.viewport,n=r.array;return n[0]=(e-i.x)/i.width,n[0]=2*n[0]-1,n[1]=(t-i.y)/i.height,n[1]=2*n[1]-1,r}});Rt.opaqueSortCompare=Rt.prototype.opaqueSortCompare=function(e,t){return e.renderOrder===t.renderOrder?e.__program===t.__program?e.material===t.material?e.geometry.__uid__-t.geometry.__uid__:e.material.__uid__-t.material.__uid__:e.__program&&t.__program?e.__program.__uid__-t.__program.__uid__:0:e.renderOrder-t.renderOrder},Rt.transparentSortCompare=Rt.prototype.transparentSortCompare=function(e,t){return e.renderOrder===t.renderOrder?e.__depth===t.__depth?e.__program===t.__program?e.material===t.material?e.geometry.__uid__-t.geometry.__uid__:e.material.__uid__-t.material.__uid__:e.__program&&t.__program?e.__program.__uid__-t.__program.__uid__:0:e.__depth-t.__depth:e.renderOrder-t.renderOrder};var It={IDENTITY:bt(),WORLD:bt(),VIEW:bt(),PROJECTION:bt(),WORLDVIEW:bt(),VIEWPROJECTION:bt(),WORLDVIEWPROJECTION:bt(),WORLDINVERSE:bt(),VIEWINVERSE:bt(),PROJECTIONINVERSE:bt(),WORLDVIEWINVERSE:bt(),VIEWPROJECTIONINVERSE:bt(),WORLDVIEWPROJECTIONINVERSE:bt(),WORLDTRANSPOSE:bt(),VIEWTRANSPOSE:bt(),PROJECTIONTRANSPOSE:bt(),WORLDVIEWTRANSPOSE:bt(),VIEWPROJECTIONTRANSPOSE:bt(),WORLDVIEWPROJECTIONTRANSPOSE:bt(),WORLDINVERSETRANSPOSE:bt(),VIEWINVERSETRANSPOSE:bt(),PROJECTIONINVERSETRANSPOSE:bt(),WORLDVIEWINVERSETRANSPOSE:bt(),VIEWPROJECTIONINVERSETRANSPOSE:bt(),WORLDVIEWPROJECTIONINVERSETRANSPOSE:bt()};Rt.COLOR_BUFFER_BIT=Q.COLOR_BUFFER_BIT,Rt.DEPTH_BUFFER_BIT=Q.DEPTH_BUFFER_BIT,Rt.STENCIL_BUFFER_BIT=Q.STENCIL_BUFFER_BIT;var Pt=Rt,Ot=function(e,t,r){e=e||0,t=t||0,r=r||0,this.array=Tt.fromValues(e,t,r),this._dirty=!0};Ot.prototype={constructor:Ot,add:function(e){return Tt.add(this.array,this.array,e.array),this._dirty=!0,this},set:function(e,t,r){return this.array[0]=e,this.array[1]=t,this.array[2]=r,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this.array[2]=e[2],this._dirty=!0,this},clone:function(){return new Ot(this.x,this.y,this.z)},copy:function(e){return Tt.copy(this.array,e.array),this._dirty=!0,this},cross:function(e,t){return Tt.cross(this.array,e.array,t.array),this._dirty=!0,this},dist:function(e){return Tt.dist(this.array,e.array)},distance:function(e){return Tt.distance(this.array,e.array)},div:function(e){return Tt.div(this.array,this.array,e.array),this._dirty=!0,this},divide:function(e){return Tt.divide(this.array,this.array,e.array),this._dirty=!0,this},dot:function(e){return Tt.dot(this.array,e.array)},len:function(){return Tt.len(this.array)},length:function(){return Tt.length(this.array)},lerp:function(e,t,r){return Tt.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},min:function(e){return Tt.min(this.array,this.array,e.array),this._dirty=!0,this},max:function(e){return Tt.max(this.array,this.array,e.array),this._dirty=!0,this},mul:function(e){return Tt.mul(this.array,this.array,e.array),this._dirty=!0,this},multiply:function(e){return Tt.multiply(this.array,this.array,e.array),this._dirty=!0,this},negate:function(){return Tt.negate(this.array,this.array),this._dirty=!0,this},normalize:function(){return Tt.normalize(this.array,this.array),this._dirty=!0,this},random:function(e){return Tt.random(this.array,e),this._dirty=!0,this},scale:function(e){return Tt.scale(this.array,this.array,e),this._dirty=!0,this},scaleAndAdd:function(e,t){return Tt.scaleAndAdd(this.array,this.array,e.array,t),this._dirty=!0,this},sqrDist:function(e){return Tt.sqrDist(this.array,e.array)},squaredDistance:function(e){return Tt.squaredDistance(this.array,e.array)},sqrLen:function(){return Tt.sqrLen(this.array)},squaredLength:function(){return Tt.squaredLength(this.array)},sub:function(e){return Tt.sub(this.array,this.array,e.array),this._dirty=!0,this},subtract:function(e){return Tt.subtract(this.array,this.array,e.array),this._dirty=!0,this},transformMat3:function(e){return Tt.transformMat3(this.array,this.array,e.array),this._dirty=!0,this},transformMat4:function(e){return Tt.transformMat4(this.array,this.array,e.array),this._dirty=!0,this},transformQuat:function(e){return Tt.transformQuat(this.array,this.array,e.array),this._dirty=!0,this},applyProjection:function(e){var t=this.array;if(e=e.array,0===e[15]){var r=-1/t[2];t[0]=e[0]*t[0]*r,t[1]=e[5]*t[1]*r,t[2]=(e[10]*t[2]+e[14])*r}else t[0]=e[0]*t[0]+e[12],t[1]=e[5]*t[1]+e[13],t[2]=e[10]*t[2]+e[14];return this._dirty=!0,this},eulerFromQuat:function(e,t){Ot.eulerFromQuat(this,e,t)},eulerFromMat3:function(e,t){Ot.eulerFromMat3(this,e,t)},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var Bt=Object.defineProperty;if(Bt){var Ft=Ot.prototype;Bt(Ft,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),Bt(Ft,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}}),Bt(Ft,"z",{get:function(){return this.array[2]},set:function(e){this.array[2]=e,this._dirty=!0}})}function Ut(e,t,r){return e<t?t:e>r?r:e}Ot.add=function(e,t,r){return Tt.add(e.array,t.array,r.array),e._dirty=!0,e},Ot.set=function(e,t,r,i){Tt.set(e.array,t,r,i),e._dirty=!0},Ot.copy=function(e,t){return Tt.copy(e.array,t.array),e._dirty=!0,e},Ot.cross=function(e,t,r){return Tt.cross(e.array,t.array,r.array),e._dirty=!0,e},Ot.dist=function(e,t){return Tt.distance(e.array,t.array)},Ot.distance=Ot.dist,Ot.div=function(e,t,r){return Tt.divide(e.array,t.array,r.array),e._dirty=!0,e},Ot.divide=Ot.div,Ot.dot=function(e,t){return Tt.dot(e.array,t.array)},Ot.len=function(e){return Tt.length(e.array)},Ot.lerp=function(e,t,r,i){return Tt.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},Ot.min=function(e,t,r){return Tt.min(e.array,t.array,r.array),e._dirty=!0,e},Ot.max=function(e,t,r){return Tt.max(e.array,t.array,r.array),e._dirty=!0,e},Ot.mul=function(e,t,r){return Tt.multiply(e.array,t.array,r.array),e._dirty=!0,e},Ot.multiply=Ot.mul,Ot.negate=function(e,t){return Tt.negate(e.array,t.array),e._dirty=!0,e},Ot.normalize=function(e,t){return Tt.normalize(e.array,t.array),e._dirty=!0,e},Ot.random=function(e,t){return Tt.random(e.array,t),e._dirty=!0,e},Ot.scale=function(e,t,r){return Tt.scale(e.array,t.array,r),e._dirty=!0,e},Ot.scaleAndAdd=function(e,t,r,i){return Tt.scaleAndAdd(e.array,t.array,r.array,i),e._dirty=!0,e},Ot.sqrDist=function(e,t){return Tt.sqrDist(e.array,t.array)},Ot.squaredDistance=Ot.sqrDist,Ot.sqrLen=function(e){return Tt.sqrLen(e.array)},Ot.squaredLength=Ot.sqrLen,Ot.sub=function(e,t,r){return Tt.subtract(e.array,t.array,r.array),e._dirty=!0,e},Ot.subtract=Ot.sub,Ot.transformMat3=function(e,t,r){return Tt.transformMat3(e.array,t.array,r.array),e._dirty=!0,e},Ot.transformMat4=function(e,t,r){return Tt.transformMat4(e.array,t.array,r.array),e._dirty=!0,e},Ot.transformQuat=function(e,t,r){return Tt.transformQuat(e.array,t.array,r.array),e._dirty=!0,e};var zt=Math.atan2,Gt=Math.asin,Ht=Math.abs;Ot.eulerFromQuat=function(e,t,r){e._dirty=!0,t=t.array;var i=e.array,n=t[0],a=t[1],o=t[2],s=t[3],l=n*n,u=a*a,c=o*o,h=s*s;r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":i[0]=zt(2*(n*s-a*o),h-l-u+c),i[1]=Gt(Ut(2*(n*o+a*s),-1,1)),i[2]=zt(2*(o*s-n*a),h+l-u-c);break;case"YXZ":i[0]=Gt(Ut(2*(n*s-a*o),-1,1)),i[1]=zt(2*(n*o+a*s),h-l-u+c),i[2]=zt(2*(n*a+o*s),h-l+u-c);break;case"ZXY":i[0]=Gt(Ut(2*(n*s+a*o),-1,1)),i[1]=zt(2*(a*s-o*n),h-l-u+c),i[2]=zt(2*(o*s-n*a),h-l+u-c);break;case"ZYX":i[0]=zt(2*(n*s+o*a),h-l-u+c),i[1]=Gt(Ut(2*(a*s-n*o),-1,1)),i[2]=zt(2*(n*a+o*s),h+l-u-c);break;case"YZX":i[0]=zt(2*(n*s-o*a),h-l+u-c),i[1]=zt(2*(a*s-n*o),h+l-u-c),i[2]=Gt(Ut(2*(n*a+o*s),-1,1));break;case"XZY":i[0]=zt(2*(n*s+a*o),h-l+u-c),i[1]=zt(2*(n*o+a*s),h+l-u-c),i[2]=Gt(Ut(2*(o*s-n*a),-1,1));break;default:console.warn("Unkown order: "+r)}return e},Ot.eulerFromMat3=function(e,t,r){var i=t.array,n=i[0],a=i[3],o=i[6],s=i[1],l=i[4],u=i[7],c=i[2],h=i[5],d=i[8],f=e.array;r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":f[1]=Gt(Ut(o,-1,1)),Ht(o)<.99999?(f[0]=zt(-u,d),f[2]=zt(-a,n)):(f[0]=zt(h,l),f[2]=0);break;case"YXZ":f[0]=Gt(-Ut(u,-1,1)),Ht(u)<.99999?(f[1]=zt(o,d),f[2]=zt(s,l)):(f[1]=zt(-c,n),f[2]=0);break;case"ZXY":f[0]=Gt(Ut(h,-1,1)),Ht(h)<.99999?(f[1]=zt(-c,d),f[2]=zt(-a,l)):(f[1]=0,f[2]=zt(s,n));break;case"ZYX":f[1]=Gt(-Ut(c,-1,1)),Ht(c)<.99999?(f[0]=zt(h,d),f[2]=zt(s,n)):(f[0]=0,f[2]=zt(-a,l));break;case"YZX":f[2]=Gt(Ut(s,-1,1)),Ht(s)<.99999?(f[0]=zt(-u,l),f[1]=zt(-c,n)):(f[0]=0,f[1]=zt(o,d));break;case"XZY":f[2]=Gt(-Ut(a,-1,1)),Ht(a)<.99999?(f[0]=zt(h,l),f[1]=zt(o,n)):(f[0]=zt(-u,d),f[1]=0);break;default:console.warn("Unkown order: "+r)}return e._dirty=!0,e},Object.defineProperties(Ot,{POSITIVE_X:{get:function(){return new Ot(1,0,0)}},NEGATIVE_X:{get:function(){return new Ot(-1,0,0)}},POSITIVE_Y:{get:function(){return new Ot(0,1,0)}},NEGATIVE_Y:{get:function(){return new Ot(0,-1,0)}},POSITIVE_Z:{get:function(){return new Ot(0,0,1)}},NEGATIVE_Z:{get:function(){return new Ot(0,0,-1)}},UP:{get:function(){return new Ot(0,1,0)}},ZERO:{get:function(){return new Ot}}});var kt=Ot,Vt=1e-5,Wt=function(e,t){this.origin=e||new kt,this.direction=t||new kt};Wt.prototype={constructor:Wt,intersectPlane:function(e,t){var r=e.normal.array,i=e.distance,n=this.origin.array,a=this.direction.array,o=Tt.dot(r,a);if(0===o)return null;t||(t=new kt);var s=(Tt.dot(r,n)-i)/o;return Tt.scaleAndAdd(t.array,n,a,-s),t._dirty=!0,t},mirrorAgainstPlane:function(e){var t=Tt.dot(e.normal.array,this.direction.array);Tt.scaleAndAdd(this.direction.array,this.direction.array,e.normal.array,2*-t),this.direction._dirty=!0},distanceToPoint:function(){var e=Tt.create();return function(t){Tt.sub(e,t,this.origin.array);var r=Tt.dot(e,this.direction.array);if(r<0)return Tt.distance(this.origin.array,t);var i=Tt.lenSquared(e);return Math.sqrt(i-r*r)}}(),intersectSphere:function(){var e=Tt.create();return function(t,r,i){var n=this.origin.array,a=this.direction.array;t=t.array,Tt.sub(e,t,n);var o=Tt.dot(e,a),s=Tt.squaredLength(e),l=s-o*o,u=r*r;if(!(l>u)){var c=Math.sqrt(u-l),h=o-c,d=o+c;return i||(i=new kt),h<0?d<0?null:(Tt.scaleAndAdd(i.array,n,a,d),i):(Tt.scaleAndAdd(i.array,n,a,h),i)}}}(),intersectBoundingBox:function(e,t){var r,i,n,a,o,s,l=this.direction.array,u=this.origin.array,c=e.min.array,h=e.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(r=(c[0]-u[0])*d,i=(h[0]-u[0])*d):(i=(c[0]-u[0])*d,r=(h[0]-u[0])*d),f>=0?(n=(c[1]-u[1])*f,a=(h[1]-u[1])*f):(a=(c[1]-u[1])*f,n=(h[1]-u[1])*f),r>a||n>i)return null;if((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),p>=0?(o=(c[2]-u[2])*p,s=(h[2]-u[2])*p):(s=(c[2]-u[2])*p,o=(h[2]-u[2])*p),r>s||o>i)return null;if((o>r||r!==r)&&(r=o),(s<i||i!==i)&&(i=s),i<0)return null;var m=r>=0?r:i;return t||(t=new kt),Tt.scaleAndAdd(t.array,u,l,m),t},intersectTriangle:function(){var e=Tt.create(),t=Tt.create(),r=Tt.create(),i=Tt.create();return function(n,a,o,s,l,u){var c=this.direction.array,h=this.origin.array;n=n.array,a=a.array,o=o.array,Tt.sub(e,a,n),Tt.sub(t,o,n),Tt.cross(i,t,c);var d=Tt.dot(e,i);if(s){if(d>-Vt)return null}else if(d>-Vt&&d<Vt)return null;Tt.sub(r,h,n);var f=Tt.dot(i,r)/d;if(f<0||f>1)return null;Tt.cross(i,e,r);var p=Tt.dot(c,i)/d;if(p<0||p>1||f+p>1)return null;Tt.cross(i,e,t);var m=-Tt.dot(r,i)/d;return m<0?null:(l||(l=new kt),u&&kt.set(u,1-f-p,f,p),Tt.scaleAndAdd(l.array,h,c,m),l)}}(),applyTransform:function(e){kt.add(this.direction,this.direction,this.origin),kt.transformMat4(this.origin,this.origin,e),kt.transformMat4(this.direction,this.direction,e),kt.sub(this.direction,this.direction,this.origin),kt.normalize(this.direction,this.direction)},copy:function(e){kt.copy(this.origin,e.origin),kt.copy(this.direction,e.direction)},clone:function(){var e=new Wt;return e.copy(this),e}};var jt=Wt,Xt={create:function(){var e=new Me(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},clone:function(e){var t=new Me(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},fromValues:function(e,t,r,i){var n=new Me(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},set:function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},subtract:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}};Xt.sub=Xt.subtract,Xt.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},Xt.mul=Xt.multiply,Xt.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e},Xt.div=Xt.divide,Xt.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},Xt.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},Xt.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},Xt.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},Xt.distance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+i*i+n*n+a*a)},Xt.dist=Xt.distance,Xt.squaredDistance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return r*r+i*i+n*n+a*a},Xt.sqrDist=Xt.squaredDistance,Xt.length=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return Math.sqrt(t*t+r*r+i*i+n*n)},Xt.len=Xt.length,Xt.squaredLength=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n},Xt.sqrLen=Xt.squaredLength,Xt.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},Xt.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},Xt.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o),e},Xt.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Xt.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e[3]=s+i*(r[3]-s),e},Xt.random=function(e,t){return t=t||1,e[0]=Le(),e[1]=Le(),e[2]=Le(),e[3]=Le(),Xt.normalize(e,e),Xt.scale(e,e,t),e},Xt.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e},Xt.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*i+s*a-l*n,h=u*n+l*i-o*a,d=u*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=c*u+f*-o+h*-l-d*-s,e[1]=h*u+f*-s+d*-o-c*-l,e[2]=d*u+f*-l+c*-s-h*-o,e},Xt.forEach=function(){var e=Xt.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var qt=Xt,Zt={create:function(){var e=new Me(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromMat4:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},clone:function(e){var t=new Me(9);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},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:function(e,t){if(e===t){var r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=c*o-s*u,d=-c*a+s*l,f=u*a-o*l,p=r*h+i*d+n*f;return p?(p=1/p,e[0]=h*p,e[1]=(-c*i+n*u)*p,e[2]=(s*i-n*o)*p,e[3]=d*p,e[4]=(c*r-n*l)*p,e[5]=(-s*r+n*a)*p,e[6]=f*p,e[7]=(-u*r+i*l)*p,e[8]=(o*r-i*a)*p,e):null},adjoint:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-i*c,e[2]=i*s-n*o,e[3]=s*l-a*c,e[4]=r*c-n*l,e[5]=n*a-r*s,e[6]=a*u-o*l,e[7]=i*l-r*u,e[8]=r*o-i*a,e},determinant:function(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+r*(-u*n+o*s)+i*(l*n-a*s)},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=r[0],f=r[1],p=r[2],m=r[3],g=r[4],v=r[5],_=r[6],y=r[7],x=r[8];return e[0]=d*i+f*o+p*u,e[1]=d*n+f*s+p*c,e[2]=d*a+f*l+p*h,e[3]=m*i+g*o+v*u,e[4]=m*n+g*s+v*c,e[5]=m*a+g*l+v*h,e[6]=_*i+y*o+x*u,e[7]=_*n+y*s+x*c,e[8]=_*a+y*l+x*h,e}};Zt.mul=Zt.multiply,Zt.translate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=r[0],f=r[1];return e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*i+f*o+u,e[7]=d*n+f*s+c,e[8]=d*a+f*l+h,e},Zt.rotate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(r),f=Math.cos(r);return e[0]=f*i+d*o,e[1]=f*n+d*s,e[2]=f*a+d*l,e[3]=f*o-d*i,e[4]=f*s-d*n,e[5]=f*l-d*a,e[6]=u,e[7]=c,e[8]=h,e},Zt.scale=function(e,t,r){var i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},Zt.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},Zt.fromQuat=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,h=i*s,d=n*o,f=n*s,p=n*l,m=a*o,g=a*s,v=a*l;return e[0]=1-h-p,e[3]=c-v,e[6]=d+g,e[1]=c+v,e[4]=1-u-p,e[7]=f-m,e[2]=d-g,e[5]=f+m,e[8]=1-u-h,e},Zt.normalFromMat4=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],v=t[15],_=r*s-i*o,y=r*l-n*o,x=r*u-a*o,T=i*l-n*s,b=i*u-a*s,w=n*u-a*l,E=c*m-h*p,S=c*g-d*p,C=c*v-f*p,A=h*g-d*m,M=h*v-f*m,L=d*v-f*g,D=_*L-y*M+x*A+T*C-b*S+w*E;return D?(D=1/D,e[0]=(s*L-l*M+u*A)*D,e[1]=(l*C-o*L-u*S)*D,e[2]=(o*M-s*C+u*E)*D,e[3]=(n*M-i*L-a*A)*D,e[4]=(r*L-n*C+a*S)*D,e[5]=(i*C-r*M-a*E)*D,e[6]=(m*w-g*b+v*T)*D,e[7]=(g*x-p*w-v*y)*D,e[8]=(p*b-m*x+v*_)*D,e):null},Zt.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2))};var Yt=Zt,Kt={create:function(){var e=new Me(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}};Kt.rotationTo=function(){var e=Tt.create(),t=Tt.fromValues(1,0,0),r=Tt.fromValues(0,1,0);return function(i,n,a){var o=Tt.dot(n,a);return o<-.999999?(Tt.cross(e,t,n),Tt.length(e)<1e-6&&Tt.cross(e,r,n),Tt.normalize(e,e),Kt.setAxisAngle(i,e,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Tt.cross(e,n,a),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+o,Kt.normalize(i,i))}}(),Kt.setAxes=function(){var e=Yt.create();return function(t,r,i,n){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Kt.normalize(t,Kt.fromMat3(t,e))}}(),Kt.clone=qt.clone,Kt.fromValues=qt.fromValues,Kt.copy=qt.copy,Kt.set=qt.set,Kt.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},Kt.setAxisAngle=function(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e},Kt.add=qt.add,Kt.multiply=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*c+o*s+n*u-a*l,e[1]=n*c+o*l+a*s-i*u,e[2]=a*c+o*u+i*l-n*s,e[3]=o*c-i*s-n*l-a*u,e},Kt.mul=Kt.multiply,Kt.scale=qt.scale,Kt.rotateX=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-i*s,e},Kt.rotateY=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-a*s,e[1]=n*l+o*s,e[2]=a*l+i*s,e[3]=o*l-n*s,e},Kt.rotateZ=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},Kt.calculateW=function(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},Kt.dot=qt.dot,Kt.lerp=qt.lerp,Kt.slerp=function(e,t,r,i){var n,a,o,s,l,u=t[0],c=t[1],h=t[2],d=t[3],f=r[0],p=r[1],m=r[2],g=r[3];return a=u*f+c*p+h*m+d*g,a<0&&(a=-a,f=-f,p=-p,m=-m,g=-g),1-a>1e-6?(n=Math.acos(a),o=Math.sin(n),s=Math.sin((1-i)*n)/o,l=Math.sin(i*n)/o):(s=1-i,l=i),e[0]=s*u+l*f,e[1]=s*c+l*p,e[2]=s*h+l*m,e[3]=s*d+l*g,e},Kt.invert=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=a*s,e},Kt.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},Kt.length=qt.length,Kt.len=Kt.length,Kt.squaredLength=qt.squaredLength,Kt.sqrLen=Kt.squaredLength,Kt.normalize=qt.normalize,Kt.fromMat3=function(e,t){var r,i=t[0]+t[4]+t[8];if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[3*n+n]-t[3*a+a]-t[3*o+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+n]+t[3*n+a])*r,e[o]=(t[3*o+n]+t[3*n+o])*r}return e};var $t=Kt,Qt=function(){this._axisX=new kt,this._axisY=new kt,this._axisZ=new kt,this.array=yt.create(),this._dirty=!0};Qt.prototype={constructor:Qt,setArray:function(e){for(var t=0;t<this.array.length;t++)this.array[t]=e[t];return this._dirty=!0,this},adjoint:function(){return yt.adjoint(this.array,this.array),this._dirty=!0,this},clone:function(){return(new Qt).copy(this)},copy:function(e){return yt.copy(this.array,e.array),this._dirty=!0,this},determinant:function(){return yt.determinant(this.array)},fromQuat:function(e){return yt.fromQuat(this.array,e.array),this._dirty=!0,this},fromRotationTranslation:function(e,t){return yt.fromRotationTranslation(this.array,e.array,t.array),this._dirty=!0,this},fromMat2d:function(e){return Qt.fromMat2d(this,e),this},frustum:function(e,t,r,i,n,a){return yt.frustum(this.array,e,t,r,i,n,a),this._dirty=!0,this},identity:function(){return yt.identity(this.array),this._dirty=!0,this},invert:function(){return yt.invert(this.array,this.array),this._dirty=!0,this},lookAt:function(e,t,r){return yt.lookAt(this.array,e.array,t.array,r.array),this._dirty=!0,this},mul:function(e){return yt.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return yt.mul(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return yt.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return yt.multiply(this.array,e.array,this.array),this._dirty=!0,this},ortho:function(e,t,r,i,n,a){return yt.ortho(this.array,e,t,r,i,n,a),this._dirty=!0,this},perspective:function(e,t,r,i){return yt.perspective(this.array,e,t,r,i),this._dirty=!0,this},rotate:function(e,t){return yt.rotate(this.array,this.array,e,t.array),this._dirty=!0,this},rotateX:function(e){return yt.rotateX(this.array,this.array,e),this._dirty=!0,this},rotateY:function(e){return yt.rotateY(this.array,this.array,e),this._dirty=!0,this},rotateZ:function(e){return yt.rotateZ(this.array,this.array,e),this._dirty=!0,this},scale:function(e){return yt.scale(this.array,this.array,e.array),this._dirty=!0,this},translate:function(e){return yt.translate(this.array,this.array,e.array),this._dirty=!0,this},transpose:function(){return yt.transpose(this.array,this.array),this._dirty=!0,this},decomposeMatrix:function(){var e=Tt.create(),t=Tt.create(),r=Tt.create(),i=Yt.create();return function(n,a,o){var s=this.array;Tt.set(e,s[0],s[1],s[2]),Tt.set(t,s[4],s[5],s[6]),Tt.set(r,s[8],s[9],s[10]);var l=Tt.length(e),u=Tt.length(t),c=Tt.length(r),h=this.determinant();h<0&&(l=-l),n&&n.set(l,u,c),o.set(s[12],s[13],s[14]),Yt.fromMat4(i,s),i[0]/=l,i[1]/=l,i[2]/=l,i[3]/=u,i[4]/=u,i[5]/=u,i[6]/=c,i[7]/=c,i[8]/=c,$t.fromMat3(a.array,i),$t.normalize(a.array,a.array),a._dirty=!0,o._dirty=!0}}(),toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var Jt=Object.defineProperty;if(Jt){var er=Qt.prototype;Jt(er,"z",{get:function(){var e=this.array;return this._axisZ.set(e[8],e[9],e[10]),this._axisZ},set:function(e){var t=this.array;e=e.array,t[8]=e[0],t[9]=e[1],t[10]=e[2],this._dirty=!0}}),Jt(er,"y",{get:function(){var e=this.array;return this._axisY.set(e[4],e[5],e[6]),this._axisY},set:function(e){var t=this.array;e=e.array,t[4]=e[0],t[5]=e[1],t[6]=e[2],this._dirty=!0}}),Jt(er,"x",{get:function(){var e=this.array;return this._axisX.set(e[0],e[1],e[2]),this._axisX},set:function(e){var t=this.array;e=e.array,t[0]=e[0],t[1]=e[1],t[2]=e[2],this._dirty=!0}})}Qt.adjoint=function(e,t){return yt.adjoint(e.array,t.array),e._dirty=!0,e},Qt.copy=function(e,t){return yt.copy(e.array,t.array),e._dirty=!0,e},Qt.determinant=function(e){return yt.determinant(e.array)},Qt.identity=function(e){return yt.identity(e.array),e._dirty=!0,e},Qt.ortho=function(e,t,r,i,n,a,o){return yt.ortho(e.array,t,r,i,n,a,o),e._dirty=!0,e},Qt.perspective=function(e,t,r,i,n){return yt.perspective(e.array,t,r,i,n),e._dirty=!0,e},Qt.lookAt=function(e,t,r,i){return yt.lookAt(e.array,t.array,r.array,i.array),e._dirty=!0,e},Qt.invert=function(e,t){return yt.invert(e.array,t.array),e._dirty=!0,e},Qt.mul=function(e,t,r){return yt.mul(e.array,t.array,r.array),e._dirty=!0,e},Qt.multiply=Qt.mul,Qt.fromQuat=function(e,t){return yt.fromQuat(e.array,t.array),e._dirty=!0,e},Qt.fromRotationTranslation=function(e,t,r){return yt.fromRotationTranslation(e.array,t.array,r.array),e._dirty=!0,e},Qt.fromMat2d=function(e,t){e._dirty=!0;t=t.array,e=e.array;return e[0]=t[0],e[4]=t[2],e[12]=t[4],e[1]=t[1],e[5]=t[3],e[13]=t[5],e},Qt.rotate=function(e,t,r,i){return yt.rotate(e.array,t.array,r,i.array),e._dirty=!0,e},Qt.rotateX=function(e,t,r){return yt.rotateX(e.array,t.array,r),e._dirty=!0,e},Qt.rotateY=function(e,t,r){return yt.rotateY(e.array,t.array,r),e._dirty=!0,e},Qt.rotateZ=function(e,t,r){return yt.rotateZ(e.array,t.array,r),e._dirty=!0,e},Qt.scale=function(e,t,r){return yt.scale(e.array,t.array,r.array),e._dirty=!0,e},Qt.transpose=function(e,t){return yt.transpose(e.array,t.array),e._dirty=!0,e},Qt.translate=function(e,t,r){return yt.translate(e.array,t.array,r.array),e._dirty=!0,e};var tr=Qt,rr=function(e,t,r,i){e=e||0,t=t||0,r=r||0,i=void 0===i?1:i,this.array=$t.fromValues(e,t,r,i),this._dirty=!0};rr.prototype={constructor:rr,add:function(e){return $t.add(this.array,this.array,e.array),this._dirty=!0,this},calculateW:function(){return $t.calculateW(this.array,this.array),this._dirty=!0,this},set:function(e,t,r,i){return this.array[0]=e,this.array[1]=t,this.array[2]=r,this.array[3]=i,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this.array[2]=e[2],this.array[3]=e[3],this._dirty=!0,this},clone:function(){return new rr(this.x,this.y,this.z,this.w)},conjugate:function(){return $t.conjugate(this.array,this.array),this._dirty=!0,this},copy:function(e){return $t.copy(this.array,e.array),this._dirty=!0,this},dot:function(e){return $t.dot(this.array,e.array)},fromMat3:function(e){return $t.fromMat3(this.array,e.array),this._dirty=!0,this},fromMat4:function(){var e=Yt.create();return function(t){return Yt.fromMat4(e,t.array),Yt.transpose(e,e),$t.fromMat3(this.array,e),this._dirty=!0,this}}(),identity:function(){return $t.identity(this.array),this._dirty=!0,this},invert:function(){return $t.invert(this.array,this.array),this._dirty=!0,this},len:function(){return $t.len(this.array)},length:function(){return $t.length(this.array)},lerp:function(e,t,r){return $t.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},mul:function(e){return $t.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return $t.multiply(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return $t.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return $t.multiply(this.array,e.array,this.array),this._dirty=!0,this},normalize:function(){return $t.normalize(this.array,this.array),this._dirty=!0,this},rotateX:function(e){return $t.rotateX(this.array,this.array,e),this._dirty=!0,this},rotateY:function(e){return $t.rotateY(this.array,this.array,e),this._dirty=!0,this},rotateZ:function(e){return $t.rotateZ(this.array,this.array,e),this._dirty=!0,this},rotationTo:function(e,t){return $t.rotationTo(this.array,e.array,t.array),this._dirty=!0,this},setAxes:function(e,t,r){return $t.setAxes(this.array,e.array,t.array,r.array),this._dirty=!0,this},setAxisAngle:function(e,t){return $t.setAxisAngle(this.array,e.array,t),this._dirty=!0,this},slerp:function(e,t,r){return $t.slerp(this.array,e.array,t.array,r),this._dirty=!0,this},sqrLen:function(){return $t.sqrLen(this.array)},squaredLength:function(){return $t.squaredLength(this.array)},fromEuler:function(e,t){return rr.fromEuler(this,e,t)},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var ir=Object.defineProperty;if(ir){var nr=rr.prototype;ir(nr,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),ir(nr,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}}),ir(nr,"z",{get:function(){return this.array[2]},set:function(e){this.array[2]=e,this._dirty=!0}}),ir(nr,"w",{get:function(){return this.array[3]},set:function(e){this.array[3]=e,this._dirty=!0}})}rr.add=function(e,t,r){return $t.add(e.array,t.array,r.array),e._dirty=!0,e},rr.set=function(e,t,r,i,n){$t.set(e.array,t,r,i,n),e._dirty=!0},rr.copy=function(e,t){return $t.copy(e.array,t.array),e._dirty=!0,e},rr.calculateW=function(e,t){return $t.calculateW(e.array,t.array),e._dirty=!0,e},rr.conjugate=function(e,t){return $t.conjugate(e.array,t.array),e._dirty=!0,e},rr.identity=function(e){return $t.identity(e.array),e._dirty=!0,e},rr.invert=function(e,t){return $t.invert(e.array,t.array),e._dirty=!0,e},rr.dot=function(e,t){return $t.dot(e.array,t.array)},rr.len=function(e){return $t.length(e.array)},rr.lerp=function(e,t,r,i){return $t.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},rr.slerp=function(e,t,r,i){return $t.slerp(e.array,t.array,r.array,i),e._dirty=!0,e},rr.mul=function(e,t,r){return $t.multiply(e.array,t.array,r.array),e._dirty=!0,e},rr.multiply=rr.mul,rr.rotateX=function(e,t,r){return $t.rotateX(e.array,t.array,r),e._dirty=!0,e},rr.rotateY=function(e,t,r){return $t.rotateY(e.array,t.array,r),e._dirty=!0,e},rr.rotateZ=function(e,t,r){return $t.rotateZ(e.array,t.array,r),e._dirty=!0,e},rr.setAxisAngle=function(e,t,r){return $t.setAxisAngle(e.array,t.array,r),e._dirty=!0,e},rr.normalize=function(e,t){return $t.normalize(e.array,t.array),e._dirty=!0,e},rr.sqrLen=function(e){return $t.sqrLen(e.array)},rr.squaredLength=rr.sqrLen,rr.fromMat3=function(e,t){return $t.fromMat3(e.array,t.array),e._dirty=!0,e},rr.setAxes=function(e,t,r,i){return $t.setAxes(e.array,t.array,r.array,i.array),e._dirty=!0,e},rr.rotationTo=function(e,t,r){return $t.rotationTo(e.array,t.array,r.array),e._dirty=!0,e},rr.fromEuler=function(e,t,r){e._dirty=!0,t=t.array;var i=e.array,n=Math.cos(t[0]/2),a=Math.cos(t[1]/2),o=Math.cos(t[2]/2),s=Math.sin(t[0]/2),l=Math.sin(t[1]/2),u=Math.sin(t[2]/2);r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":i[0]=s*a*o+n*l*u,i[1]=n*l*o-s*a*u,i[2]=n*a*u+s*l*o,i[3]=n*a*o-s*l*u;break;case"YXZ":i[0]=s*a*o+n*l*u,i[1]=n*l*o-s*a*u,i[2]=n*a*u-s*l*o,i[3]=n*a*o+s*l*u;break;case"ZXY":i[0]=s*a*o-n*l*u,i[1]=n*l*o+s*a*u,i[2]=n*a*u+s*l*o,i[3]=n*a*o-s*l*u;break;case"ZYX":i[0]=s*a*o-n*l*u,i[1]=n*l*o+s*a*u,i[2]=n*a*u-s*l*o,i[3]=n*a*o+s*l*u;break;case"YZX":i[0]=s*a*o+n*l*u,i[1]=n*l*o+s*a*u,i[2]=n*a*u-s*l*o,i[3]=n*a*o-s*l*u;break;case"XZY":i[0]=s*a*o-n*l*u,i[1]=n*l*o-s*a*u,i[2]=n*a*u+s*l*o,i[3]=n*a*o+s*l*u;break}};var ar=rr,or=Tt.set,sr=Tt.copy,lr=function(e,t){this.min=e||new kt(1/0,1/0,1/0),this.max=t||new kt(-1/0,-1/0,-1/0),this.vertices=null};lr.prototype={constructor:lr,updateFromVertices:function(e){if(e.length>0){var t=this.min,r=this.max,i=t.array,n=r.array;sr(i,e[0]),sr(n,e[0]);for(var a=1;a<e.length;a++){var o=e[a];o[0]<i[0]&&(i[0]=o[0]),o[1]<i[1]&&(i[1]=o[1]),o[2]<i[2]&&(i[2]=o[2]),o[0]>n[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1]),o[2]>n[2]&&(n[2]=o[2])}t._dirty=!0,r._dirty=!0}},union:function(e){var t=this.min,r=this.max;return Tt.min(t.array,t.array,e.min.array),Tt.max(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersection:function(e){var t=this.min,r=this.max;return Tt.max(t.array,t.array,e.min.array),Tt.min(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(e){var t=this.min.array,r=this.max.array,i=e.min.array,n=e.max.array;return!(t[0]>n[0]||t[1]>n[1]||t[2]>n[2]||r[0]<i[0]||r[1]<i[1]||r[2]<i[2])},containBoundingBox:function(e){var t=this.min.array,r=this.max.array,i=e.min.array,n=e.max.array;return t[0]<=i[0]&&t[1]<=i[1]&&t[2]<=i[2]&&r[0]>=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},containPoint:function(e){var t=this.min.array,r=this.max.array,i=e.array;return t[0]<=i[0]&&t[1]<=i[1]&&t[2]<=i[2]&&r[0]>=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},isFinite:function(){var e=this.min.array,t=this.max.array;return isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])&&isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])},applyTransform:function(e){this.transformFrom(this,e)},transformFrom:function(){var e=Tt.create(),t=Tt.create(),r=Tt.create(),i=Tt.create(),n=Tt.create(),a=Tt.create();return function(o,s){var l=o.min.array,u=o.max.array,c=s.array;return e[0]=c[0]*l[0],e[1]=c[1]*l[0],e[2]=c[2]*l[0],t[0]=c[0]*u[0],t[1]=c[1]*u[0],t[2]=c[2]*u[0],r[0]=c[4]*l[1],r[1]=c[5]*l[1],r[2]=c[6]*l[1],i[0]=c[4]*u[1],i[1]=c[5]*u[1],i[2]=c[6]*u[1],n[0]=c[8]*l[2],n[1]=c[9]*l[2],n[2]=c[10]*l[2],a[0]=c[8]*u[2],a[1]=c[9]*u[2],a[2]=c[10]*u[2],l=this.min.array,u=this.max.array,l[0]=Math.min(e[0],t[0])+Math.min(r[0],i[0])+Math.min(n[0],a[0])+c[12],l[1]=Math.min(e[1],t[1])+Math.min(r[1],i[1])+Math.min(n[1],a[1])+c[13],l[2]=Math.min(e[2],t[2])+Math.min(r[2],i[2])+Math.min(n[2],a[2])+c[14],u[0]=Math.max(e[0],t[0])+Math.max(r[0],i[0])+Math.max(n[0],a[0])+c[12],u[1]=Math.max(e[1],t[1])+Math.max(r[1],i[1])+Math.max(n[1],a[1])+c[13],u[2]=Math.max(e[2],t[2])+Math.max(r[2],i[2])+Math.max(n[2],a[2])+c[14],this.min._dirty=!0,this.max._dirty=!0,this}}(),applyProjection:function(e){var t=this.min.array,r=this.max.array,i=e.array,n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],u=t[2],c=r[0],h=r[1],d=r[2];if(1===i[15])t[0]=i[0]*n+i[12],t[1]=i[5]*a+i[13],r[2]=i[10]*o+i[14],r[0]=i[0]*c+i[12],r[1]=i[5]*h+i[13],t[2]=i[10]*d+i[14];else{var f=-1/o;t[0]=i[0]*n*f,t[1]=i[5]*a*f,r[2]=(i[10]*o+i[14])*f,f=-1/u,r[0]=i[0]*s*f,r[1]=i[5]*l*f,f=-1/d,t[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var e=this.vertices;if(!e){e=[];for(var t=0;t<8;t++)e[t]=Tt.fromValues(0,0,0);this.vertices=e}var r=this.min.array,i=this.max.array;return or(e[0],r[0],r[1],r[2]),or(e[1],r[0],i[1],r[2]),or(e[2],i[0],r[1],r[2]),or(e[3],i[0],i[1],r[2]),or(e[4],r[0],r[1],i[2]),or(e[5],r[0],i[1],i[2]),or(e[6],i[0],r[1],i[2]),or(e[7],i[0],i[1],i[2]),this},copy:function(e){var t=this.min,r=this.max;return sr(t.array,e.min.array),sr(r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},clone:function(){var e=new lr;return e.copy(this),e}};var ur=lr,cr=0,hr=q.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+cr++),this.position||(this.position=new kt),this.rotation||(this.rotation=new ar),this.scale||(this.scale=new kt(1,1,1)),this.worldTransform=new tr,this.localTransform=new tr,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(e){var t=this._scene;if(t){var r=t._nodeRepository;delete r[this.name],r[e]=this}this.name=e},add:function(e){var t=e._parent;if(t!==this){t&&t.remove(e),e._parent=this,this._children.push(e);var r=this._scene;r&&r!==e.scene&&e.traverse(this._addSelfToScene,this),e._needsUpdateWorldTransform=!0}},remove:function(e){var t=this._children,r=t.indexOf(e);r<0||(t.splice(r,1),e._parent=null,this._scene&&e.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var e=this._children,t=0;t<e.length;t++)e[t]._parent=null,this._scene&&e[t].traverse(this._removeSelfFromScene,this);this._children=[]},getScene:function(){return this._scene},getParent:function(){return this._parent},_removeSelfFromScene:function(e){e._scene.removeFromScene(e),e._scene=null},_addSelfToScene:function(e){this._scene.addToScene(e),e._scene=this._scene},isAncestor:function(e){var t=e._parent;while(t){if(t===this)return!0;t=t._parent}return!1},children:function(){return this._children.slice()},childAt:function(e){return this._children[e]},getChildByName:function(e){for(var t=this._children,r=0;r<t.length;r++)if(t[r].name===e)return t[r]},getDescendantByName:function(e){for(var t=this._children,r=0;r<t.length;r++){var i=t[r];if(i.name===e)return i;var n=i.getDescendantByName(e);if(n)return n}},queryNode:function(e){if(e){for(var t=e.split("/"),r=this,i=0;i<t.length;i++){var n=t[i];if(n){for(var a=!1,o=r._children,s=0;s<o.length;s++){var l=o[s];if(l.name===n){r=l,a=!0;break}}if(!a)return}}return r}},getPath:function(e){if(!this._parent)return"/";var t=this._parent,r=this.name;while(t._parent){if(r=t.name+"/"+r,t._parent==e)break;t=t._parent}return!t._parent&&e?null:r},traverse:function(e,t){e.call(t,this);for(var r=this._children,i=0,n=r.length;i<n;i++)r[i].traverse(e,t)},eachChild:function(e,t){for(var r=this._children,i=0,n=r.length;i<n;i++){var a=r[i];e.call(t,a,i)}},setLocalTransform:function(e){yt.copy(this.localTransform.array,e.array),this.decomposeLocalTransform()},decomposeLocalTransform:function(e){var t=e?null:this.scale;this.localTransform.decomposeMatrix(t,this.rotation,this.position)},setWorldTransform:function(e){yt.copy(this.worldTransform.array,e.array),this.decomposeWorldTransform()},decomposeWorldTransform:function(){var e=yt.create();return function(t){var r=this.localTransform,i=this.worldTransform;this._parent?(yt.invert(e,this._parent.worldTransform.array),yt.multiply(r.array,e,i.array)):yt.copy(r.array,i.array);var n=t?null:this.scale;r.decomposeMatrix(n,this.rotation,this.position)}}(),transformNeedsUpdate:function(){return this.position._dirty||this.rotation._dirty||this.scale._dirty},updateLocalTransform:function(){var e=this.position,t=this.rotation,r=this.scale;if(this.transformNeedsUpdate()){var i=this.localTransform.array;yt.fromRotationTranslation(i,t.array,e.array),yt.scale(i,i,r.array),t._dirty=!1,r._dirty=!1,e._dirty=!1,this._needsUpdateWorldTransform=!0}},_updateWorldTransformTopDown:function(){var e=this.localTransform.array,t=this.worldTransform.array;this._parent?yt.multiplyAffine(t,this._parent.worldTransform.array,e):yt.copy(t,e)},updateWorldTransform:function(){var e=this;while(e&&e.getParent()&&e.getParent().transformNeedsUpdate())e=e.getParent();e.update()},update:function(e){this.autoUpdateLocalTransform?this.updateLocalTransform():e=!0,(e||this._needsUpdateWorldTransform)&&(this._updateWorldTransformTopDown(),e=!0,this._needsUpdateWorldTransform=!1);for(var t=this._children,r=0,i=t.length;r<i;r++)t[r].update(e)},getBoundingBox:function(){function e(e){return!e.invisible&&e.geometry}var t=new ur,r=new tr,i=new tr;return function(n,a){return a=a||new ur,n=n||e,this._parent?tr.invert(i,this._parent.worldTransform):tr.identity(i),this.traverse((function(e){e.geometry&&e.geometry.boundingBox&&(t.copy(e.geometry.boundingBox),tr.multiply(r,i,e.worldTransform),t.applyTransform(r),a.union(t))}),this,e),a}}(),getWorldPosition:function(e){this.transformNeedsUpdate()&&this.updateWorldTransform();var t=this.worldTransform.array;if(e){var r=e.array;return r[0]=t[12],r[1]=t[13],r[2]=t[14],e}return new kt(t[12],t[13],t[14])},clone:function(){var e=new this.constructor,t=this._children;e.setName(this.name),e.position.copy(this.position),e.rotation.copy(this.rotation),e.scale.copy(this.scale);for(var r=0;r<t.length;r++)e.add(t[r].clone());return e},rotateAround:function(){var e=new kt,t=new tr;return function(r,i,n){e.copy(this.position).subtract(r);var a=this.localTransform;a.identity(),a.translate(r),a.rotate(n,i),t.fromRotationTranslation(this.rotation,e),a.multiply(t),a.scale(this.scale),this.decomposeLocalTransform(),this._needsUpdateWorldTransform=!0}}(),lookAt:function(){var e=new tr;return function(t,r){e.lookAt(this.position,t,r||this.localTransform.y).invert(),this.setLocalTransform(e),this.target=t}}()}),dr=hr,fr=dr.extend({material:null,geometry:null,mode:Q.TRIANGLES,_renderInfo:null},{__program:null,lightGroup:0,renderOrder:0,culling:!0,cullFace:Q.BACK,frontFace:Q.CCW,frustumCulling:!0,receiveShadow:!0,castShadow:!0,ignorePicking:!1,ignorePreZ:!1,ignoreGBuffer:!1,isRenderable:function(){return this.geometry&&this.material&&this.material.shader&&!this.invisible&&this.geometry.vertexCount>0},beforeRender:function(e){},afterRender:function(e,t){},getBoundingBox:function(e,t){return t=dr.prototype.getBoundingBox.call(this,e,t),this.geometry&&this.geometry.boundingBox&&t.union(this.geometry.boundingBox),t},clone:function(){var e=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"];return function(){var t=dr.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var r=0;r<e.length;r++){var i=e[r];t[i]!==this[i]&&(t[i]=this[i])}return t}}()});fr.POINTS=Q.POINTS,fr.LINES=Q.LINES,fr.LINE_LOOP=Q.LINE_LOOP,fr.LINE_STRIP=Q.LINE_STRIP,fr.TRIANGLES=Q.TRIANGLES,fr.TRIANGLE_STRIP=Q.TRIANGLE_STRIP,fr.TRIANGLE_FAN=Q.TRIANGLE_FAN,fr.BACK=Q.BACK,fr.FRONT=Q.FRONT,fr.FRONT_AND_BACK=Q.FRONT_AND_BACK,fr.CW=Q.CW,fr.CCW=Q.CCW;var pr=fr,mr=q.extend({scene:null,camera:null,renderer:null},(function(){this._ray=new jt,this._ndc=new Pe}),{pick:function(e,t,r){var i=this.pickAll(e,t,[],r);return i[0]||null},pickAll:function(e,t,r,i){return this.renderer.screenToNDC(e,t,this._ndc),this.camera.castRay(this._ndc,this._ray),r=r||[],this._intersectNode(this.scene,r,i||!1),r.sort(this._intersectionCompareFunc),r},_intersectNode:function(e,t,r){e instanceof pr&&e.isRenderable()&&(e.ignorePicking&&!r||!(e.mode===Q.TRIANGLES&&e.geometry.isUseIndices()||e.geometry.pickByRay||e.geometry.pick)||this._intersectRenderable(e,t));for(var i=0;i<e._children.length;i++)this._intersectNode(e._children[i],t,r)},_intersectRenderable:function(){var e=new kt,t=new kt,r=new kt,i=new jt,n=new tr;return function(a,o){var s=a.isSkinnedMesh();i.copy(this._ray),tr.invert(n,a.worldTransform),s||i.applyTransform(n);var l=a.geometry,u=s?a.skeleton.boundingBox:l.boundingBox;if(!u||i.intersectBoundingBox(u))if(l.pick)l.pick(this._ndc.x,this._ndc.y,this.renderer,this.camera,a,o);else if(l.pickByRay)l.pickByRay(i,a,o);else{var c,h,d=a.cullFace===Q.BACK&&a.frontFace===Q.CCW||a.cullFace===Q.FRONT&&a.frontFace===Q.CW,f=l.indices,p=l.attributes.position,m=l.attributes.weight,g=l.attributes.joint,v=[];if(p&&p.value&&f){if(s){h=a.skeleton.getSubSkinMatrices(a.__uid__,a.joints);for(var _=0;_<a.joints.length;_++){v[_]=v[_]||[];for(var y=0;y<16;y++)v[_][y]=h[16*_+y]}var x=[],T=[],b=[],w=[],E=[],S=l.attributes.skinnedPosition;S&&S.value||(l.createAttribute("skinnedPosition","f",3),S=l.attributes.skinnedPosition,S.init(l.vertexCount));for(_=0;_<l.vertexCount;_++){p.get(_,x),m.get(_,T),g.get(_,b),T[3]=1-T[0]-T[1]-T[2],Tt.set(w,0,0,0);for(y=0;y<4;y++)b[y]>=0&&T[y]>1e-4&&(Tt.transformMat4(E,x,v[b[y]]),Tt.scaleAndAdd(w,w,E,T[y]));S.set(_,w)}}for(_=0;_<f.length;_+=3){var C=f[_],A=f[_+1],M=f[_+2],L=s?l.attributes.skinnedPosition:p;if(L.get(C,e.array),L.get(A,t.array),L.get(M,r.array),c=d?i.intersectTriangle(e,t,r,a.culling):i.intersectTriangle(e,r,t,a.culling),c){var D=new kt;s?kt.copy(D,c):kt.transformMat4(D,c,a.worldTransform),o.push(new mr.Intersection(c,D,a,[C,A,M],_/3,kt.dist(D,this._ray.origin)))}}}}}}(),_intersectionCompareFunc:function(e,t){return e.distance-t.distance}});mr.Intersection=function(e,t,r,i,n,a){this.point=e,this.pointWorld=t,this.target=r,this.triangle=i,this.triangleIndex=n,this.distance=a};var gr=mr,vr="__dt__",_r=function(){this._contextId=0,this._caches=[],this._context={}};_r.prototype={use:function(e,t){var r=this._caches;r[e]||(r[e]={},t&&(r[e]=t())),this._contextId=e,this._context=r[e]},put:function(e,t){this._context[e]=t},get:function(e){return this._context[e]},dirty:function(e){e=e||"";var t=vr+e;this.put(t,!0)},dirtyAll:function(e){e=e||"";for(var t=vr+e,r=this._caches,i=0;i<r.length;i++)r[i]&&(r[i][t]=!0)},fresh:function(e){e=e||"";var t=vr+e;this.put(t,!1)},freshAll:function(e){e=e||"";for(var t=vr+e,r=this._caches,i=0;i<r.length;i++)r[i]&&(r[i][t]=!1)},isDirty:function(e){e=e||"";var t=vr+e,r=this._context;return!r.hasOwnProperty(t)||!0===r[t]},deleteContext:function(e){delete this._caches[e],this._context={}},delete:function(e){delete this._context[e]},clearAll:function(){this._caches={}},getContext:function(){return this._context},eachContext:function(e,t){var r=Object.keys(this._caches);r.forEach((function(r){e&&e.call(t,r)}))},miss:function(e){return!this._context.hasOwnProperty(e)}},_r.prototype.constructor=_r;var yr=_r,xr=q.extend({width:512,height:512,type:Q.UNSIGNED_BYTE,format:Q.RGBA,wrapS:Q.REPEAT,wrapT:Q.REPEAT,minFilter:Q.LINEAR_MIPMAP_LINEAR,magFilter:Q.LINEAR,useMipmap:!0,anisotropic:1,flipY:!0,sRGB:!0,unpackAlignment:4,premultiplyAlpha:!1,dynamic:!1,NPOT:!1,__used:0},(function(){this._cache=new yr}),{getWebGLTexture:function(e){var t=e.gl,r=this._cache;return r.use(e.__uid__),r.miss("webgl_texture")&&r.put("webgl_texture",t.createTexture()),this.dynamic?this.update(e):r.isDirty()&&(this.update(e),r.fresh()),r.get("webgl_texture")},bind:function(){},unbind:function(){},dirty:function(){this._cache&&this._cache.dirtyAll()},update:function(e){},updateCommon:function(e){var t=e.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,this.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,this.unpackAlignment),this.format===Q.DEPTH_COMPONENT&&(this.useMipmap=!1);var r=e.getGLExtension("EXT_sRGB");this.format!==xr.SRGB||r||(this.format=xr.RGB),this.format!==xr.SRGB_ALPHA||r||(this.format=xr.RGBA),this.NPOT=!this.isPowerOfTwo()},getAvailableWrapS:function(){return this.NPOT?Q.CLAMP_TO_EDGE:this.wrapS},getAvailableWrapT:function(){return this.NPOT?Q.CLAMP_TO_EDGE:this.wrapT},getAvailableMinFilter:function(){var e=this.minFilter;return this.NPOT||!this.useMipmap?e===Q.NEAREST_MIPMAP_NEAREST||e===Q.NEAREST_MIPMAP_LINEAR?Q.NEAREST:e===Q.LINEAR_MIPMAP_LINEAR||e===Q.LINEAR_MIPMAP_NEAREST?Q.LINEAR:e:e},getAvailableMagFilter:function(){return this.magFilter},nextHighestPowerOfTwo:function(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("webgl_texture");r&&e.gl.deleteTexture(r),t.deleteContext(e.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(xr.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(xr.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),xr.BYTE=Q.BYTE,xr.UNSIGNED_BYTE=Q.UNSIGNED_BYTE,xr.SHORT=Q.SHORT,xr.UNSIGNED_SHORT=Q.UNSIGNED_SHORT,xr.INT=Q.INT,xr.UNSIGNED_INT=Q.UNSIGNED_INT,xr.FLOAT=Q.FLOAT,xr.HALF_FLOAT=36193,xr.UNSIGNED_INT_24_8_WEBGL=34042,xr.DEPTH_COMPONENT=Q.DEPTH_COMPONENT,xr.DEPTH_STENCIL=Q.DEPTH_STENCIL,xr.ALPHA=Q.ALPHA,xr.RGB=Q.RGB,xr.RGBA=Q.RGBA,xr.LUMINANCE=Q.LUMINANCE,xr.LUMINANCE_ALPHA=Q.LUMINANCE_ALPHA,xr.SRGB=35904,xr.SRGB_ALPHA=35906,xr.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,xr.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,xr.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,xr.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,xr.NEAREST=Q.NEAREST,xr.LINEAR=Q.LINEAR,xr.NEAREST_MIPMAP_NEAREST=Q.NEAREST_MIPMAP_NEAREST,xr.LINEAR_MIPMAP_NEAREST=Q.LINEAR_MIPMAP_NEAREST,xr.NEAREST_MIPMAP_LINEAR=Q.NEAREST_MIPMAP_LINEAR,xr.LINEAR_MIPMAP_LINEAR=Q.LINEAR_MIPMAP_LINEAR,xr.REPEAT=Q.REPEAT,xr.CLAMP_TO_EDGE=Q.CLAMP_TO_EDGE,xr.MIRRORED_REPEAT=Q.MIRRORED_REPEAT;var Tr=xr,br=pr.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var e=pr.prototype.clone.call(this);return e.skeleton=this.skeleton,this.joints&&(e.joints=this.joints.slice()),e}});br.POINTS=Q.POINTS,br.LINES=Q.LINES,br.LINE_LOOP=Q.LINE_LOOP,br.LINE_STRIP=Q.LINE_STRIP,br.TRIANGLES=Q.TRIANGLES,br.TRIANGLE_STRIP=Q.TRIANGLE_STRIP,br.TRIANGLE_FAN=Q.TRIANGLE_FAN,br.BACK=Q.BACK,br.FRONT=Q.FRONT,br.FRONT_AND_BACK=Q.FRONT_AND_BACK,br.CW=Q.CW,br.CCW=Q.CCW;var wr=br,Er={isPowerOfTwo:function(e){return 0===(e&e-1)},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}},Sr=Er,Cr=Sr.isPowerOfTwo;function Ar(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Mr(e,t){var r=Ar(e.width),i=Ar(e.height);t=t||document.createElement("canvas"),t.width=r,t.height=i;var n=t.getContext("2d");return n.drawImage(e.image,0,0,r,i),t}var Lr=Tr.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type,n=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==Tr.REPEAT&&this.wrapT!==Tr.REPEAT||!this.NPOT);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,n?this.wrapS:this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,n?this.wrapT:this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n?this.magFilter:this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n?this.minFilter:this.getAvailableMinFilter());var a=e.getGLExtension("EXT_texture_filter_anisotropic");if(a&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_2D,a.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i){var o=e.getGLExtension("OES_texture_half_float");o||(i=Q.FLOAT)}if(this.mipmaps.length)for(var s=this.width,l=this.height,u=0;u<this.mipmaps.length;u++){var c=this.mipmaps[u];this._updateTextureData(t,c,u,s,l,r,i,!1),s/=2,l/=2}else this._updateTextureData(t,this,0,this.width,this.height,r,i,n),!this.useMipmap||this.NPOT&&!n||t.generateMipmap(t.TEXTURE_2D);t.bindTexture(t.TEXTURE_2D,null)},_updateTextureData:function(e,t,r,i,n,a,o,s){if(t.image){var l=t.image;s&&(this._potCanvas=Mr(this,this._potCanvas),l=this._potCanvas),e.texImage2D(e.TEXTURE_2D,r,a,a,o,l)}else a<=Tr.COMPRESSED_RGBA_S3TC_DXT5_EXT&&a>=Tr.COMPRESSED_RGB_S3TC_DXT1_EXT?e.compressedTexImage2D(e.TEXTURE_2D,r,a,i,n,0,t.pixels):e.texImage2D(e.TEXTURE_2D,r,a,i,n,0,a,o,t.pixels)},generateMipmap:function(e){var t=e.gl;this.useMipmap&&!this.NPOT&&(t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),t.generateMipmap(t.TEXTURE_2D))},isPowerOfTwo:function(){return Cr(this.width)&&Cr(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,this.getWebGLTexture(e))},unbind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},load:function(e,t){var r=J["a"].createImage();t&&(r.crossOrigin=t);var i=this;return r.onload=function(){i.dirty(),i.trigger("success",i)},r.onerror=function(){i.trigger("error",i)},r.src=e,this.image=r,this}});Object.defineProperty(Lr.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(e){this.image?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Lr.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(e){this.image?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});var Dr=Lr;function Nr(e){return{byte:J["a"].Int8Array,ubyte:J["a"].Uint8Array,short:J["a"].Int16Array,ushort:J["a"].Uint16Array}[e]||J["a"].Float32Array}function Rr(e){return"attr_"+e}function Ir(e,t,r,i){switch(this.name=e,this.type=t,this.size=r,this.semantic=i||"",this.value=null,r){case 1:this.get=function(e){return this.value[e]},this.set=function(e,t){this.value[e]=t},this.copy=function(e,t){this.value[e]=this.value[e]};break;case 2:this.get=function(e,t){var r=this.value;return t[0]=r[2*e],t[1]=r[2*e+1],t},this.set=function(e,t){var r=this.value;r[2*e]=t[0],r[2*e+1]=t[1]},this.copy=function(e,t){var r=this.value;t*=2,e*=2,r[e]=r[t],r[e+1]=r[t+1]};break;case 3:this.get=function(e,t){var r=3*e,i=this.value;return t[0]=i[r],t[1]=i[r+1],t[2]=i[r+2],t},this.set=function(e,t){var r=3*e,i=this.value;i[r]=t[0],i[r+1]=t[1],i[r+2]=t[2]},this.copy=function(e,t){var r=this.value;t*=3,e*=3,r[e]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2]};break;case 4:this.get=function(e,t){var r=this.value,i=4*e;return t[0]=r[i],t[1]=r[i+1],t[2]=r[i+2],t[3]=r[i+3],t},this.set=function(e,t){var r=this.value,i=4*e;r[i]=t[0],r[i+1]=t[1],r[i+2]=t[2],r[i+3]=t[3]},this.copy=function(e,t){var r=this.value;t*=4,e*=4,r[e]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2],r[e+3]=r[t+3]}}}function Pr(e,t,r,i,n){this.name=e,this.type=t,this.buffer=r,this.size=i,this.semantic=n,this.symbol="",this.needsRemove=!1}function Or(e){this.buffer=e,this.count=0}Ir.prototype.init=function(e){if(!this.value||this.value.length!==e*this.size){var t=Nr(this.type);this.value=new t(e*this.size)}},Ir.prototype.fromArray=function(e){var t,r=Nr(this.type);if(e[0]&&e[0].length){var i=0,n=this.size;t=new r(e.length*n);for(var a=0;a<e.length;a++)for(var o=0;o<n;o++)t[i++]=e[a][o]}else t=new r(e);this.value=t},Ir.prototype.clone=function(e){var t=new Ir(this.name,this.type,this.size,this.semantic);return e&&console.warn("todo"),t};var Br=q.extend((function(){return{attributes:{},indices:null,dynamic:!0,_enabledAttributes:null,__used:0}}),(function(){this._cache=new yr,this._attributeList=Object.keys(this.attributes),this.__vaoCache={}}),{mainAttribute:"",pick:null,pickByRay:null,dirty:function(){for(var e=this.getEnabledAttributes(),t=0;t<e.length;t++)this.dirtyAttribute(e[t]);this.dirtyIndices(),this._enabledAttributes=null,this._cache.dirty("any")},dirtyIndices:function(){this._cache.dirtyAll("indices")},dirtyAttribute:function(e){this._cache.dirtyAll(Rr(e)),this._cache.dirtyAll("attributes")},getTriangleIndices:function(e,t){if(e<this.triangleCount&&e>=0){t||(t=[]);var r=this.indices;return t[0]=r[3*e],t[1]=r[3*e+1],t[2]=r[3*e+2],t}},setTriangleIndices:function(e,t){var r=this.indices;r[3*e]=t[0],r[3*e+1]=t[1],r[3*e+2]=t[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(e){var t,r=this.vertexCount>65535?J["a"].Uint32Array:J["a"].Uint16Array;if(e[0]&&e[0].length){var i=0,n=3;t=new r(e.length*n);for(var a=0;a<e.length;a++)for(var o=0;o<n;o++)t[i++]=e[a][o]}else t=new r(e);this.indices=t},createAttribute:function(e,t,r,i){var n=new Ir(e,t,r,i);return this.attributes[e]&&this.removeAttribute(e),this.attributes[e]=n,this._attributeList.push(e),n},removeAttribute:function(e){var t=this._attributeList,r=t.indexOf(e);return r>=0&&(t.splice(r,1),delete this.attributes[e],!0)},getAttribute:function(e){return this.attributes[e]},getEnabledAttributes:function(){var e=this._enabledAttributes,t=this._attributeList;if(e)return e;for(var r=[],i=this.vertexCount,n=0;n<t.length;n++){var a=t[n],o=this.attributes[a];o.value&&o.value.length===i*o.size&&r.push(a)}return this._enabledAttributes=r,r},getBufferChunks:function(e){var t=this._cache;t.use(e.__uid__);var r=t.isDirty("attributes"),i=t.isDirty("indices");if(r||i){this._updateBuffer(e.gl,r,i);for(var n=this.getEnabledAttributes(),a=0;a<n.length;a++)t.fresh(Rr(n[a]));t.fresh("attributes"),t.fresh("indices")}return t.fresh("any"),t.get("chunks")},_updateBuffer:function(e,t,r){var i=this._cache,n=i.get("chunks"),a=!1;n||(n=[],n[0]={attributeBuffers:[],indicesBuffer:null},i.put("chunks",n),a=!0);var o=n[0],s=o.attributeBuffers,l=o.indicesBuffer;if(t||a){var u=this.getEnabledAttributes(),c={};if(!a)for(var h=0;h<s.length;h++)c[s[h].name]=s[h];for(var d=0;d<u.length;d++){var f,p,m=u[d],g=this.attributes[m];a||(f=c[m]),p=f?f.buffer:e.createBuffer(),i.isDirty(Rr(m))&&(e.bindBuffer(e.ARRAY_BUFFER,p),e.bufferData(e.ARRAY_BUFFER,g.value,this.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW)),s[d]=new Pr(m,g.type,p,g.size,g.semantic)}for(h=d;h<s.length;h++)e.deleteBuffer(s[h].buffer);s.length=d}this.isUseIndices()&&(r||a)&&(l||(l=new Or(e.createBuffer()),o.indicesBuffer=l),l.count=this.indices.length,e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,l.buffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,this.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW))},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("chunks");if(r)for(var i=0;i<r.length;i++){for(var n=r[i],a=0;a<n.attributeBuffers.length;a++){var o=n.attributeBuffers[a];e.gl.deleteBuffer(o.buffer)}n.indicesBuffer&&e.gl.deleteBuffer(n.indicesBuffer.buffer)}if(this.__vaoCache){var s=e.getGLExtension("OES_vertex_array_object");for(var l in this.__vaoCache){var u=this.__vaoCache[l].vao;u&&s.deleteVertexArrayOES(u)}}this.__vaoCache={},t.deleteContext(e.__uid__)}});Object.defineProperty&&(Object.defineProperty(Br.prototype,"vertexCount",{enumerable:!1,get:function(){var e=this.attributes[this.mainAttribute];return e||(e=this.attributes[this._attributeList[0]]),e&&e.value?e.value.length/e.size:0}}),Object.defineProperty(Br.prototype,"triangleCount",{enumerable:!1,get:function(){var e=this.indices;return e?e.length/3:0}})),Br.STATIC_DRAW=Q.STATIC_DRAW,Br.DYNAMIC_DRAW=Q.DYNAMIC_DRAW,Br.STREAM_DRAW=Q.STREAM_DRAW,Br.AttributeBuffer=Pr,Br.IndicesBuffer=Or,Br.Attribute=Ir;var Fr=Br,Ur=Tt.create,zr=Tt.add,Gr=Tt.set,Hr=Fr.Attribute,kr=Fr.extend((function(){return{attributes:{position:new Hr("position","float",3,"POSITION"),texcoord0:new Hr("texcoord0","float",2,"TEXCOORD_0"),texcoord1:new Hr("texcoord1","float",2,"TEXCOORD_1"),normal:new Hr("normal","float",3,"NORMAL"),tangent:new Hr("tangent","float",4,"TANGENT"),color:new Hr("color","float",4,"COLOR"),weight:new Hr("weight","float",3,"WEIGHT"),joint:new Hr("joint","float",4,"JOINT"),barycentric:new Hr("barycentric","float",3,null)},boundingBox:null}}),{mainAttribute:"position",updateBoundingBox:function(){var e=this.boundingBox;e||(e=this.boundingBox=new ur);var t=this.attributes.position.value;if(t&&t.length){var r=e.min,i=e.max,n=r.array,a=i.array;Tt.set(n,t[0],t[1],t[2]),Tt.set(a,t[0],t[1],t[2]);for(var o=3;o<t.length;){var s=t[o++],l=t[o++],u=t[o++];s<n[0]&&(n[0]=s),l<n[1]&&(n[1]=l),u<n[2]&&(n[2]=u),s>a[0]&&(a[0]=s),l>a[1]&&(a[1]=l),u>a[2]&&(a[2]=u)}r._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var e=this.indices,t=this.attributes,r=t.position.value,i=t.normal.value;if(i&&i.length===r.length)for(var n=0;n<i.length;n++)i[n]=0;else i=t.normal.value=new J["a"].Float32Array(r.length);for(var a,o,s,l=Ur(),u=Ur(),c=Ur(),h=Ur(),d=Ur(),f=Ur(),p=e?e.length:this.vertexCount,m=0;m<p;){e?(a=e[m++],o=e[m++],s=e[m++]):(a=m++,o=m++,s=m++),Gr(l,r[3*a],r[3*a+1],r[3*a+2]),Gr(u,r[3*o],r[3*o+1],r[3*o+2]),Gr(c,r[3*s],r[3*s+1],r[3*s+2]),Tt.sub(h,l,u),Tt.sub(d,u,c),Tt.cross(f,h,d);for(n=0;n<3;n++)i[3*a+n]=i[3*a+n]+f[n],i[3*o+n]=i[3*o+n]+f[n],i[3*s+n]=i[3*s+n]+f[n]}for(n=0;n<i.length;)Gr(f,i[n],i[n+1],i[n+2]),Tt.normalize(f,f),i[n++]=f[0],i[n++]=f[1],i[n++]=f[2];this.dirty()}},generateFaceNormals:function(){if(this.vertexCount){this.isUniqueVertex()||this.generateUniqueVertex();var e=this.indices,t=this.attributes,r=t.position.value,i=t.normal.value,n=Ur(),a=Ur(),o=Ur(),s=Ur(),l=Ur(),u=Ur();i||(i=t.normal.value=new Float32Array(r.length));for(var c,h,d,f=e?e.length:this.vertexCount,p=0;p<f;){e?(c=e[p++],h=e[p++],d=e[p++]):(c=p++,h=p++,d=p++),Gr(n,r[3*c],r[3*c+1],r[3*c+2]),Gr(a,r[3*h],r[3*h+1],r[3*h+2]),Gr(o,r[3*d],r[3*d+1],r[3*d+2]),Tt.sub(s,n,a),Tt.sub(l,a,o),Tt.cross(u,s,l),Tt.normalize(u,u);for(var m=0;m<3;m++)i[3*c+m]=u[m],i[3*h+m]=u[m],i[3*d+m]=u[m]}this.dirty()}},generateTangents:function(){if(this.vertexCount){var e=this.vertexCount,t=this.attributes;t.tangent.value||(t.tangent.value=new Float32Array(4*e));var r=t.texcoord0.value,i=t.position.value,n=t.tangent.value,a=t.normal.value;if(r){for(var o=[],s=[],l=0;l<e;l++)o[l]=[0,0,0],s[l]=[0,0,0];var u,c,h,d=[0,0,0],f=[0,0,0],p=this.indices,m=p?p.length:this.vertexCount;for(l=0;l<m;){p?(u=p[l++],c=p[l++],h=p[l++]):(u=l++,c=l++,h=l++);var g=r[2*u],v=r[2*c],_=r[2*h],y=r[2*u+1],x=r[2*c+1],T=r[2*h+1],b=i[3*u],w=i[3*c],E=i[3*h],S=i[3*u+1],C=i[3*c+1],A=i[3*h+1],M=i[3*u+2],L=i[3*c+2],D=i[3*h+2],N=w-b,R=E-b,I=C-S,P=A-S,O=L-M,B=D-M,F=v-g,U=_-g,z=x-y,G=T-y,H=1/(F*G-z*U);d[0]=(G*N-z*R)*H,d[1]=(G*I-z*P)*H,d[2]=(G*O-z*B)*H,f[0]=(F*R-U*N)*H,f[1]=(F*P-U*I)*H,f[2]=(F*B-U*O)*H,zr(o[u],o[u],d),zr(o[c],o[c],d),zr(o[h],o[h],d),zr(s[u],s[u],f),zr(s[c],s[c],f),zr(s[h],s[h],f)}var k=Ur(),V=Ur(),W=Ur();for(l=0;l<e;l++){W[0]=a[3*l],W[1]=a[3*l+1],W[2]=a[3*l+2];var j=o[l];Tt.scale(k,W,Tt.dot(W,j)),Tt.sub(k,j,k),Tt.normalize(k,k),Tt.cross(V,W,j),n[4*l]=k[0],n[4*l+1]=k[1],n[4*l+2]=k[2],n[4*l+3]=Tt.dot(V,s[l])<0?-1:1}this.dirty()}else console.warn("Geometry without texcoords can't generate tangents.")}},isUniqueVertex:function(){return!this.isUseIndices()||this.vertexCount===this.indices.length},generateUniqueVertex:function(){if(this.vertexCount&&this.indices){this.indices.length>65535&&(this.indices=new J["a"].Uint32Array(this.indices));for(var e=this.attributes,t=this.indices,r=this.getEnabledAttributes(),i={},n=0;n<r.length;n++){var a=r[n];i[a]=e[a].value,e[a].init(this.indices.length)}for(var o=0,s=0;s<t.length;s++){var l=t[s];for(n=0;n<r.length;n++){a=r[n];for(var u=e[a].value,c=e[a].size,h=0;h<c;h++)u[o*c+h]=i[a][l*c+h]}t[s]=o,o++}this.dirty()}},generateBarycentric:function(){if(this.vertexCount){this.isUniqueVertex()||this.generateUniqueVertex();var e=this.attributes,t=e.barycentric.value,r=this.indices;if(!t||t.length!==3*r.length){t=e.barycentric.value=new Float32Array(3*r.length);for(var i=0;i<(r?r.length:this.vertexCount/3);)for(var n=0;n<3;n++){var a=r?r[i++]:3*i+n;t[3*a+n]=1}this.dirty()}}},applyTransform:function(e){var t=this.attributes,r=t.position.value,i=t.normal.value,n=t.tangent.value;e=e.array;var a=yt.create();yt.invert(a,e),yt.transpose(a,a);var o=Tt.transformMat4,s=Tt.forEach;s(r,3,0,null,o,e),i&&s(i,3,0,null,o,a),n&&s(n,4,0,null,o,a),this.boundingBox&&this.updateBoundingBox()},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("chunks");if(r)for(var i=0;i<r.length;i++){for(var n=r[i],a=0;a<n.attributeBuffers.length;a++){var o=n.attributeBuffers[a];e.gl.deleteBuffer(o.buffer)}n.indicesBuffer&&e.gl.deleteBuffer(n.indicesBuffer.buffer)}if(this.__vaoCache){var s=e.getGLExtension("OES_vertex_array_object");for(var l in this.__vaoCache){var u=this.__vaoCache[l].vao;u&&s.deleteVertexArrayOES(u)}}this.__vaoCache={},t.deleteContext(e.__uid__)}});kr.STATIC_DRAW=Fr.STATIC_DRAW,kr.DYNAMIC_DRAW=Fr.DYNAMIC_DRAW,kr.STREAM_DRAW=Fr.STREAM_DRAW,kr.AttributeBuffer=Fr.AttributeBuffer,kr.IndicesBuffer=Fr.IndicesBuffer,kr.Attribute=Hr;var Vr=kr,Wr="vec3 calcAmbientSHLight(int idx, vec3 N) {\n int offset = 9 * idx;\n return ambientSHLightCoefficients[0]\n + ambientSHLightCoefficients[1] * N.x\n + ambientSHLightCoefficients[2] * N.y\n + ambientSHLightCoefficients[3] * N.z\n + ambientSHLightCoefficients[4] * N.x * N.z\n + ambientSHLightCoefficients[5] * N.z * N.y\n + ambientSHLightCoefficients[6] * N.y * N.x\n + ambientSHLightCoefficients[7] * (3.0 * N.z * N.z - 1.0)\n + ambientSHLightCoefficients[8] * (N.x * N.x - N.y * N.y);\n}",jr="uniform vec3 ",Xr="uniform float ",qr="@export clay.header.",Zr="@end",Yr=":unconfigurable;",Kr=[qr+"directional_light",jr+"directionalLightDirection[DIRECTIONAL_LIGHT_COUNT]"+Yr,jr+"directionalLightColor[DIRECTIONAL_LIGHT_COUNT]"+Yr,Zr,qr+"ambient_light",jr+"ambientLightColor[AMBIENT_LIGHT_COUNT]"+Yr,Zr,qr+"ambient_sh_light",jr+"ambientSHLightColor[AMBIENT_SH_LIGHT_COUNT]"+Yr,jr+"ambientSHLightCoefficients[AMBIENT_SH_LIGHT_COUNT * 9]"+Yr,Wr,Zr,qr+"ambient_cubemap_light",jr+"ambientCubemapLightColor[AMBIENT_CUBEMAP_LIGHT_COUNT]"+Yr,"uniform samplerCube ambientCubemapLightCubemap[AMBIENT_CUBEMAP_LIGHT_COUNT]"+Yr,"uniform sampler2D ambientCubemapLightBRDFLookup[AMBIENT_CUBEMAP_LIGHT_COUNT]"+Yr,Zr,qr+"point_light",jr+"pointLightPosition[POINT_LIGHT_COUNT]"+Yr,Xr+"pointLightRange[POINT_LIGHT_COUNT]"+Yr,jr+"pointLightColor[POINT_LIGHT_COUNT]"+Yr,Zr,qr+"spot_light",jr+"spotLightPosition[SPOT_LIGHT_COUNT]"+Yr,jr+"spotLightDirection[SPOT_LIGHT_COUNT]"+Yr,Xr+"spotLightRange[SPOT_LIGHT_COUNT]"+Yr,Xr+"spotLightUmbraAngleCosine[SPOT_LIGHT_COUNT]"+Yr,Xr+"spotLightPenumbraAngleCosine[SPOT_LIGHT_COUNT]"+Yr,Xr+"spotLightFalloffFactor[SPOT_LIGHT_COUNT]"+Yr,jr+"spotLightColor[SPOT_LIGHT_COUNT]"+Yr,Zr].join("\n");gt["import"](Kr);var $r=dr.extend((function(){return{color:[1,1,1],intensity:1,castShadow:!0,shadowResolution:512,group:0}}),{type:"",clone:function(){var e=dr.prototype.clone.call(this);return e.color=Array.prototype.slice.call(this.color),e.intensity=this.intensity,e.castShadow=this.castShadow,e.shadowResolution=this.shadowResolution,e}}),Qr=$r,Jr=function(e,t){this.normal=e||new kt(0,1,0),this.distance=t||0};Jr.prototype={constructor:Jr,distanceToPoint:function(e){return Tt.dot(e.array,this.normal.array)-this.distance},projectPoint:function(e,t){t||(t=new kt);var r=this.distanceToPoint(e);return Tt.scaleAndAdd(t.array,e.array,this.normal.array,-r),t._dirty=!0,t},normalize:function(){var e=1/Tt.len(this.normal.array);Tt.scale(this.normal.array,e),this.distance*=e},intersectFrustum:function(e){for(var t=e.vertices,r=this.normal.array,i=Tt.dot(t[0].array,r)>this.distance,n=1;n<8;n++)if(Tt.dot(t[n].array,r)>this.distance!=i)return!0},intersectLine:function(){var e=Tt.create();return function(t,r,i){var n=this.distanceToPoint(t),a=this.distanceToPoint(r);if(n>0&&a>0||n<0&&a<0)return null;var o=this.normal.array,s=this.distance,l=t.array;Tt.sub(e,r.array,t.array),Tt.normalize(e,e);var u=Tt.dot(o,e);if(0===u)return null;i||(i=new kt);var c=(Tt.dot(o,l)-s)/u;return Tt.scaleAndAdd(i.array,l,e,-c),i._dirty=!0,i}}(),applyTransform:function(){var e=yt.create(),t=qt.create(),r=qt.create();return r[3]=1,function(i){i=i.array,Tt.scale(r,this.normal.array,this.distance),qt.transformMat4(r,r,i),this.distance=Tt.dot(r,this.normal.array),yt.invert(e,i),yt.transpose(e,e),t[3]=0,Tt.copy(t,this.normal.array),qt.transformMat4(t,t,e),Tt.copy(this.normal.array,t)}}(),copy:function(e){Tt.copy(this.normal.array,e.normal.array),this.normal._dirty=!0,this.distance=e.distance},clone:function(){var e=new Jr;return e.copy(this),e}};var ei=Jr,ti=Tt.set,ri=Tt.copy,ii=Tt.transformMat4,ni=Math.min,ai=Math.max,oi=function(){this.planes=[];for(var e=0;e<6;e++)this.planes.push(new ei);this.boundingBox=new ur,this.vertices=[];for(e=0;e<8;e++)this.vertices[e]=Tt.fromValues(0,0,0)};oi.prototype={setFromProjection:function(e){var t=this.planes,r=e.array,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],c=r[7],h=r[8],d=r[9],f=r[10],p=r[11],m=r[12],g=r[13],v=r[14],_=r[15];ti(t[0].normal.array,o-i,c-s,p-h),t[0].distance=-(_-m),t[0].normalize(),ti(t[1].normal.array,o+i,c+s,p+h),t[1].distance=-(_+m),t[1].normalize(),ti(t[2].normal.array,o+n,c+l,p+d),t[2].distance=-(_+g),t[2].normalize(),ti(t[3].normal.array,o-n,c-l,p-d),t[3].distance=-(_-g),t[3].normalize(),ti(t[4].normal.array,o-a,c-u,p-f),t[4].distance=-(_-v),t[4].normalize(),ti(t[5].normal.array,o+a,c+u,p+f),t[5].distance=-(_+v),t[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===_){var T=l/i,b=-v/(f-1),w=-v/(f+1),E=-w/l,S=-b/l;y.min.set(-E*T,-E,w),y.max.set(E*T,E,b),ti(x[0],-E*T,-E,w),ti(x[1],-E*T,E,w),ti(x[2],E*T,-E,w),ti(x[3],E*T,E,w),ti(x[4],-S*T,-S,b),ti(x[5],-S*T,S,b),ti(x[6],S*T,-S,b),ti(x[7],S*T,S,b)}else{var C=(-1-m)/i,A=(1-m)/i,M=(1-g)/l,L=(-1-g)/l,D=(-1-v)/f,N=(1-v)/f;y.min.set(Math.min(C,A),Math.min(L,M),Math.min(N,D)),y.max.set(Math.max(A,C),Math.max(M,L),Math.max(D,N));var R=y.min.array,I=y.max.array;ti(x[0],R[0],R[1],R[2]),ti(x[1],R[0],I[1],R[2]),ti(x[2],I[0],R[1],R[2]),ti(x[3],I[0],I[1],R[2]),ti(x[4],R[0],R[1],I[2]),ti(x[5],R[0],I[1],I[2]),ti(x[6],I[0],R[1],I[2]),ti(x[7],I[0],I[1],I[2])}},getTransformedBoundingBox:function(){var e=Tt.create();return function(t,r){var i=this.vertices,n=r.array,a=t.min,o=t.max,s=a.array,l=o.array,u=i[0];ii(e,u,n),ri(s,e),ri(l,e);for(var c=1;c<8;c++)u=i[c],ii(e,u,n),s[0]=ni(e[0],s[0]),s[1]=ni(e[1],s[1]),s[2]=ni(e[2],s[2]),l[0]=ai(e[0],l[0]),l[1]=ai(e[1],l[1]),l[2]=ai(e[2],l[2]);return a._dirty=!0,o._dirty=!0,t}}()};var si=oi,li=dr.extend((function(){return{projectionMatrix:new tr,invProjectionMatrix:new tr,viewMatrix:new tr,frustum:new si}}),(function(){this.update(!0)}),{update:function(e){dr.prototype.update.call(this,e),tr.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),tr.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(e){tr.copy(this.viewMatrix,e),tr.invert(this.worldTransform,e),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(e){tr.copy(this.projectionMatrix,e),tr.invert(this.invProjectionMatrix,e),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:function(){var e=qt.create();return function(t,r){var i=void 0!==r?r:new jt,n=t.array[0],a=t.array[1];return qt.set(e,n,a,-1,1),qt.transformMat4(e,e,this.invProjectionMatrix.array),qt.transformMat4(e,e,this.worldTransform.array),Tt.scale(i.origin.array,e,1/e[3]),qt.set(e,n,a,1,1),qt.transformMat4(e,e,this.invProjectionMatrix.array),qt.transformMat4(e,e,this.worldTransform.array),Tt.scale(e,e,1/e[3]),Tt.sub(i.direction.array,e,i.origin.array),Tt.normalize(i.direction.array,i.direction.array),i.direction._dirty=!0,i.origin._dirty=!0,i}}()}),ui=li,ci=yt.create(),hi=yt.create(),di={};function fi(e){var t=[],r=Object.keys(e);r.sort();for(var i=0;i<r.length;i++){var n=r[i];t.push(n+" "+e[n])}var a=t.join("\n");if(di[a])return di[a];var o=j.genGUID();return di[a]=o,o}function pi(){this.opaque=[],this.transparent=[],this._opaqueCount=0,this._transparentCount=0}pi.prototype.startCount=function(){this._opaqueCount=0,this._transparentCount=0},pi.prototype.add=function(e,t){t?this.transparent[this._transparentCount++]=e:this.opaque[this._opaqueCount++]=e},pi.prototype.endCount=function(){this.transparent.length=this._transparentCount,this.opaque.length=this._opaqueCount};var mi=dr.extend((function(){return{material:null,lights:[],viewBoundingBoxLastFrame:new ur,shadowUniforms:{},_cameraList:[],_lightUniforms:{},_previousLightNumber:{},_lightNumber:{},_lightProgramKeys:{},_nodeRepository:{},_renderLists:new ie(20)}}),(function(){this._scene=this}),{addToScene:function(e){e instanceof ui?(this._cameraList.length>0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(e)):e instanceof Qr&&this.lights.push(e),e.name&&(this._nodeRepository[e.name]=e)},removeFromScene:function(e){var t;e instanceof ui?(t=this._cameraList.indexOf(e),t>=0&&this._cameraList.splice(t,1)):e instanceof Qr&&(t=this.lights.indexOf(e),t>=0&&this.lights.splice(t,1)),e.name&&delete this._nodeRepository[e.name]},getNode:function(e){return this._nodeRepository[e]},setMainCamera:function(e){var t=this._cameraList.indexOf(e);t>=0&&this._cameraList.splice(t,1),this._cameraList.unshift(e)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var e=this.lights;this._previousLightNumber=this._lightNumber;for(var t={},r=0;r<e.length;r++){var i=e[r];if(!i.invisible){var n=i.group;t[n]||(t[n]={}),t[n][i.type]=t[n][i.type]||0,t[n][i.type]++}}for(var a in this._lightNumber=t,t)this._lightProgramKeys[a]=fi(t[a]);this._updateLightUniforms()},cloneNode:function(e){var t=e.clone(),r={};function i(e,t){r[e.__uid__]=t;for(var n=0;n<e._children.length;n++){var a=e._children[n],o=t._children[n];i(a,o)}}return i(e,t),t.traverse((function(e){e.skeleton&&(e.skeleton=e.skeleton.clone(r)),e.material&&(e.material=e.material.clone())})),t},updateRenderList:function(e,t){var r=e.__uid__,i=this._renderLists.get(r);i||(i=new pi,this._renderLists.put(r,i)),i.startCount(),t&&(this.viewBoundingBoxLastFrame.min.set(1/0,1/0,1/0),this.viewBoundingBoxLastFrame.max.set(-1/0,-1/0,-1/0));var n=this.material&&this.material.transparent||!1;return this._doUpdateRenderList(this,e,n,i,t),i.endCount(),i},getRenderList:function(e){return this._renderLists.get(e.__uid__)},_doUpdateRenderList:function(e,t,r,i,n){if(!e.invisible)for(var a=0;a<e._children.length;a++){var o=e._children[a];if(o.isRenderable()){var s=o.isSkinnedMesh()?ci:o.worldTransform.array,l=o.geometry;yt.multiplyAffine(hi,t.viewMatrix.array,s),(n&&!l.boundingBox||!this.isFrustumCulled(o,t,hi))&&i.add(o,o.material.transparent||r)}o._children.length>0&&this._doUpdateRenderList(o,t,r,i,n)}},isFrustumCulled:function(){var e=new ur,t=new tr;return function(r,i,n){var a=r.boundingBox;if(a||(a=r.skeleton&&r.skeleton.boundingBox?r.skeleton.boundingBox:r.geometry.boundingBox),!a)return!1;if(t.array=n,e.transformFrom(a,t),r.castShadow&&this.viewBoundingBoxLastFrame.union(e),r.frustumCulling){if(!e.intersectBoundingBox(i.frustum.boundingBox))return!0;t.array=i.projectionMatrix.array,e.max.array[2]>0&&e.min.array[2]<0&&(e.max.array[2]=-1e-20),e.applyProjection(t);var o=e.min.array,s=e.max.array;if(s[0]<-1||o[0]>1||s[1]<-1||o[1]>1||s[2]<-1||o[2]>1)return!0}return!1}}(),_updateLightUniforms:function(){var e=this.lights;e.sort(gi);var t=this._lightUniforms;for(var r in t)for(var i in t[r])t[r][i].value.length=0;for(var n=0;n<e.length;n++){var a=e[n];if(!a.invisible){r=a.group;for(var i in a.uniformTemplates){var o=a.uniformTemplates[i],s=o.value(a);if(null!=s){t[r]||(t[r]={}),t[r][i]||(t[r][i]={type:"",value:[]});var l=t[r][i];switch(l.type=o.type+"v",o.type){case"1i":case"1f":case"t":l.value.push(s);break;case"2f":case"3f":case"4f":for(var u=0;u<s.length;u++)l.value.push(s[u]);break;default:console.error("Unkown light uniform type "+o.type)}}}}}},getLightGroups:function(){var e=[];for(var t in this._lightNumber)e.push(t);return e},getNumberChangedLightGroups:function(){var e=[];for(var t in this._lightNumber)this.isLightNumberChanged(t)&&e.push(t);return e},isLightNumberChanged:function(e){var t=this._previousLightNumber,r=this._lightNumber;for(var i in r[e]){if(!t[e])return!0;if(r[e][i]!==t[e][i])return!0}for(var i in t[e]){if(!r[e])return!0;if(r[e][i]!==t[e][i])return!0}return!1},getLightsNumbers:function(e){return this._lightNumber[e]},getProgramKey:function(e){return this._lightProgramKeys[e]},setLightUniforms:function(){function e(e,t,r){for(var i in e){var n=e[i];if("tv"===n.type){if(!t.hasUniform(i))continue;for(var a=[],o=0;o<n.value.length;o++){var s=n.value[o],l=t.takeCurrentTextureSlot(r,s);a.push(l)}t.setUniform(r.gl,"1iv",i,a)}else t.setUniform(r.gl,n.type,i,n.value)}}return function(t,r,i){e(this._lightUniforms[r],t,i),e(this.shadowUniforms,t,i)}}(),dispose:function(){this.material=null,this._opaqueList=[],this._transparentList=[],this.lights=[],this._lightUniforms={},this._lightNumber={},this._nodeRepository={}}});function gi(e,t){if(t.castShadow&&!e.castShadow)return!0}var vi=mi,_i=r("d51b"),yi=Sr.isPowerOfTwo,xi=["px","nx","py","ny","pz","nz"],Ti=Tr.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var n=e.getGLExtension("EXT_texture_filter_anisotropic");if(n&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i){var a=e.getGLExtension("OES_texture_half_float");a||(i=Q.FLOAT)}if(this.mipmaps.length)for(var o=this.width,s=this.height,l=0;l<this.mipmaps.length;l++){var u=this.mipmaps[l];this._updateTextureData(t,u,l,o,s,r,i),o/=2,s/=2}else this._updateTextureData(t,this,0,this.width,this.height,r,i),!this.NPOT&&this.useMipmap&&t.generateMipmap(t.TEXTURE_CUBE_MAP);t.bindTexture(t.TEXTURE_CUBE_MAP,null)},_updateTextureData:function(e,t,r,i,n,a,o){for(var s=0;s<6;s++){var l=xi[s],u=t.image&&t.image[l];u?e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,r,a,a,o,u):e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,r,a,i,n,0,a,o,t.pixels&&t.pixels[l])}},generateMipmap:function(e){var t=e.gl;this.useMipmap&&!this.NPOT&&(t.bindTexture(t.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),t.generateMipmap(t.TEXTURE_CUBE_MAP))},bind:function(e){e.gl.bindTexture(e.gl.TEXTURE_CUBE_MAP,this.getWebGLTexture(e))},unbind:function(e){e.gl.bindTexture(e.gl.TEXTURE_CUBE_MAP,null)},isPowerOfTwo:function(){return this.image.px?yi(this.image.px.width)&&yi(this.image.px.height):yi(this.width)&&yi(this.height)},isRenderable:function(){return this.image.px?bi(this.image.px)&&bi(this.image.nx)&&bi(this.image.py)&&bi(this.image.ny)&&bi(this.image.pz)&&bi(this.image.nz):!(!this.width||!this.height)},load:function(e,t){var r=0,i=this;return j.each(e,(function(e,n){var a=J["a"].createImage();t&&(a.crossOrigin=t),a.onload=function(){r--,0===r&&(i.dirty(),i.trigger("success",i))},a.onerror=function(){r--},r++,a.src=e,i.image[n]=a})),this}});function bi(e){return e.width>0&&e.height>0}Object.defineProperty(Ti.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Ti.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});var wi=Ti,Ei=ui.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var e=this.fov/180*Math.PI;this.projectionMatrix.perspective(e,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array,t=2*Math.atan(1/e[5]);this.fov=t/Math.PI*180,this.aspect=e[5]/e[0],this.near=e[14]/(e[10]-1),this.far=e[14]/(e[10]+1)},clone:function(){var e=ui.prototype.clone.call(this);return e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e}}),Si=Ei,Ci="framebuffer",Ai="renderbuffer",Mi=Ai+"_width",Li=Ai+"_height",Di=Ai+"_attached",Ni="depthtexture_attached",Ri=Q.FRAMEBUFFER,Ii=Q.RENDERBUFFER,Pi=Q.DEPTH_ATTACHMENT,Oi=Q.COLOR_ATTACHMENT0,Bi=q.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new yr,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(e){if(e.__currentFrameBuffer){if(e.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}e.__currentFrameBuffer=this;var t=e.gl;t.bindFramebuffer(Ri,this._getFrameBufferGL(e)),this._boundRenderer=e;var r=this._cache;r.put("viewport",e.viewport);var i,n,a=!1;for(var o in this._textures){a=!0;var s=this._textures[o];s&&(i=s.texture.width,n=s.texture.height,this._doAttach(e,s.texture,o,s.target))}this._width=i,this._height=n,!a&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?e.setViewport(this.viewport):e.setViewport(0,0,i,n,1);var l=r.get("attached_textures");if(l)for(var o in l)if(!this._textures[o]){var u=l[o];this._doDetach(t,o,u)}if(!r.get(Ni)&&this.depthBuffer){r.miss(Ai)&&r.put(Ai,t.createRenderbuffer());var c=r.get(Ai);i===r.get(Mi)&&n===r.get(Li)||(t.bindRenderbuffer(Ii,c),t.renderbufferStorage(Ii,t.DEPTH_COMPONENT16,i,n),r.put(Mi,i),r.put(Li,n),t.bindRenderbuffer(Ii,null)),r.get(Di)||(t.framebufferRenderbuffer(Ri,Pi,Ii,c),r.put(Di,!0))}},unbind:function(e){e.__currentFrameBuffer=null;var t=e.gl;t.bindFramebuffer(Ri,null),this._boundRenderer=null,this._cache.use(e.__uid__);var r=this._cache.get("viewport");r&&e.setViewport(r),this.updateMipmap(e)},updateMipmap:function(e){var t=e.gl;for(var r in this._textures){var i=this._textures[r];if(i){var n=i.texture;if(!n.NPOT&&n.useMipmap&&n.minFilter===Tr.LINEAR_MIPMAP_LINEAR){var a="textureCube"===n.textureType?Q.TEXTURE_CUBE_MAP:Q.TEXTURE_2D;t.bindTexture(a,n.getWebGLTexture(e)),t.generateMipmap(a),t.bindTexture(a,null)}}}},checkStatus:function(e){return e.checkFramebufferStatus(Ri)},_getFrameBufferGL:function(e){var t=this._cache;return t.use(e.__uid__),t.miss(Ci)&&t.put(Ci,e.gl.createFramebuffer()),t.get(Ci)},attach:function(e,t,r){if(!e.width)throw new Error("The texture attached to color buffer is not a valid.");t=t||Oi,r=r||Q.TEXTURE_2D;var i,n=this._boundRenderer,a=n&&n.gl;if(a){var o=this._cache;o.use(n.__uid__),i=o.get("attached_textures")}var s=this._textures[t];if(!s||s.target!==r||s.texture!==e||!i||null==i[t]){var l=!0;n&&(l=this._doAttach(n,e,t,r),this.viewport||n.setViewport(0,0,e.width,e.height,1)),l&&(this._textures[t]=this._textures[t]||{},this._textures[t].texture=e,this._textures[t].target=r)}},_doAttach:function(e,t,r,i){var n=e.gl,a=t.getWebGLTexture(e),o=this._cache.get("attached_textures");if(o&&o[r]){var s=o[r];if(s.texture===t&&s.target===i)return}r=+r;var l=!0;if(r===Pi||r===Q.DEPTH_STENCIL_ATTACHMENT){var u=e.getGLExtension("WEBGL_depth_texture");if(u||(console.error("Depth texture is not supported by the browser"),l=!1),t.format!==Q.DEPTH_COMPONENT&&t.format!==Q.DEPTH_STENCIL&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l){var c=this._cache.get(Ai);c&&(n.framebufferRenderbuffer(Ri,Pi,Ii,null),n.deleteRenderbuffer(c),this._cache.put(Ai,!1)),this._cache.put(Di,!1),this._cache.put(Ni,!0)}}return n.framebufferTexture2D(Ri,r,i,a,0),o||(o={},this._cache.put("attached_textures",o)),o[r]=o[r]||{},o[r].texture=t,o[r].target=i,l},_doDetach:function(e,t,r){e.framebufferTexture2D(Ri,t,r,null,0);var i=this._cache.get("attached_textures");i&&i[t]&&(i[t]=null),t!==Pi&&t!==Q.DEPTH_STENCIL_ATTACHMENT||this._cache.put(Ni,!1)},detach:function(e,t){if(this._textures[e]=null,this._boundRenderer){var r=this._cache;r.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,e,t)}},dispose:function(e){var t=e.gl,r=this._cache;r.use(e.__uid__);var i=r.get(Ai);i&&t.deleteRenderbuffer(i);var n=r.get(Ci);n&&t.deleteFramebuffer(n),r.deleteContext(e.__uid__),this._textures={}}});Bi.DEPTH_ATTACHMENT=Pi,Bi.COLOR_ATTACHMENT0=Oi,Bi.STENCIL_ATTACHMENT=Q.STENCIL_ATTACHMENT,Bi.DEPTH_STENCIL_ATTACHMENT=Q.DEPTH_STENCIL_ATTACHMENT;var Fi=Bi,Ui=["px","nx","py","ny","pz","nz"],zi=q.extend((function(){var e={position:new kt,far:1e3,near:.1,texture:null,shadowMapPass:null},t=e._cameras={px:new Si({fov:90}),nx:new Si({fov:90}),py:new Si({fov:90}),ny:new Si({fov:90}),pz:new Si({fov:90}),nz:new Si({fov:90})};return t.px.lookAt(kt.POSITIVE_X,kt.NEGATIVE_Y),t.nx.lookAt(kt.NEGATIVE_X,kt.NEGATIVE_Y),t.py.lookAt(kt.POSITIVE_Y,kt.POSITIVE_Z),t.ny.lookAt(kt.NEGATIVE_Y,kt.NEGATIVE_Z),t.pz.lookAt(kt.POSITIVE_Z,kt.NEGATIVE_Y),t.nz.lookAt(kt.NEGATIVE_Z,kt.NEGATIVE_Y),e._frameBuffer=new Fi,e}),{getCamera:function(e){return this._cameras[e]},render:function(e,t,r){var i=e.gl;r||t.update();for(var n=this.texture.width,a=2*Math.atan(n/(n-.5))/Math.PI*180,o=0;o<6;o++){var s=Ui[o],l=this._cameras[s];if(kt.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=a,this.shadowMapPass){l.update();var u=t.getBoundingBox();u.applyTransform(l.viewMatrix),t.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(e,t,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._frameBuffer.bind(e),e.render(t,l,!0),this._frameBuffer.unbind(e)}},dispose:function(e){this._frameBuffer.dispose(e)}}),Gi=zi,Hi=Vr.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var e=this.heightSegments,t=this.widthSegments,r=this.attributes,i=[],n=[],a=[],o=[],s=0;s<=e;s++)for(var l=s/e,u=0;u<=t;u++){var c=u/t;if(i.push([2*c-1,2*l-1,0]),n&&n.push([c,l]),a&&a.push([0,0,1]),u<t&&s<e){var h=u+s*(t+1);o.push([h,h+1,h+t+1]),o.push([h+t+1,h+1,h+t+2])}}r.position.fromArray(i),r.texcoord0.fromArray(n),r.normal.fromArray(a),this.initIndicesFromArray(o),this.boundingBox=new ur,this.boundingBox.min.set(-1,-1,0),this.boundingBox.max.set(1,1,0)}}),ki=Hi,Vi=new tr,Wi=Vr.extend({dynamic:!1,widthSegments:1,heightSegments:1,depthSegments:1,inside:!1},(function(){this.build()}),{build:function(){var e={px:ji("px",this.depthSegments,this.heightSegments),nx:ji("nx",this.depthSegments,this.heightSegments),py:ji("py",this.widthSegments,this.depthSegments),ny:ji("ny",this.widthSegments,this.depthSegments),pz:ji("pz",this.widthSegments,this.heightSegments),nz:ji("nz",this.widthSegments,this.heightSegments)},t=["position","texcoord0","normal"],r=0,i=0;for(var n in e)r+=e[n].vertexCount,i+=e[n].indices.length;for(var a=0;a<t.length;a++)this.attributes[t[a]].init(r);this.indices=new J["a"].Uint16Array(i);var o=0,s=0;for(var n in e){var l=e[n];for(a=0;a<t.length;a++)for(var u=t[a],c=l.attributes[u].value,h=l.attributes[u].size,d="normal"===u,f=0;f<c.length;f++){var p=c[f];this.inside&&d&&(p=-p),this.attributes[u].value[f+h*s]=p}var m=l.indices.length;for(f=0;f<l.indices.length;f++)this.indices[f+o]=s+l.indices[this.inside?m-f-1:f];o+=l.indices.length,s+=l.vertexCount}this.boundingBox=new ur,this.boundingBox.max.set(1,1,1),this.boundingBox.min.set(-1,-1,-1)}});function ji(e,t,r){Vi.identity();var i=new ki({widthSegments:t,heightSegments:r});switch(e){case"px":tr.translate(Vi,Vi,kt.POSITIVE_X),tr.rotateY(Vi,Vi,Math.PI/2);break;case"nx":tr.translate(Vi,Vi,kt.NEGATIVE_X),tr.rotateY(Vi,Vi,-Math.PI/2);break;case"py":tr.translate(Vi,Vi,kt.POSITIVE_Y),tr.rotateX(Vi,Vi,-Math.PI/2);break;case"ny":tr.translate(Vi,Vi,kt.NEGATIVE_Y),tr.rotateX(Vi,Vi,Math.PI/2);break;case"pz":tr.translate(Vi,Vi,kt.POSITIVE_Z);break;case"nz":tr.translate(Vi,Vi,kt.NEGATIVE_Z),tr.rotateY(Vi,Vi,Math.PI);break}return i.applyTransform(Vi),i}var Xi=Wi,qi="@export clay.skybox.vertex\n#define SHADER_NAME skybox\nuniform mat4 world : WORLD;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nvarying vec3 v_WorldPosition;\nvoid main()\n{\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n@export clay.skybox.fragment\n#define PI 3.1415926\nuniform mat4 viewInverse : VIEWINVERSE;\n#ifdef EQUIRECTANGULAR\nuniform sampler2D environmentMap;\n#else\nuniform samplerCube environmentMap;\n#endif\nuniform float lod: 0.0;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\n@import clay.util.srgb\n@import clay.util.ACES\nvoid main()\n{\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n#ifdef EQUIRECTANGULAR\n float phi = acos(V.y);\n float theta = atan(-V.x, V.z) + PI * 0.5;\n vec2 uv = vec2(theta / 2.0 / PI, phi / PI);\n vec4 texel = decodeHDR(texture2D(environmentMap, fract(uv)));\n#else\n #if defined(LOD) || defined(SUPPORT_TEXTURE_LOD)\n vec4 texel = decodeHDR(textureCubeLodEXT(environmentMap, V, lod));\n #else\n vec4 texel = decodeHDR(textureCube(environmentMap, V));\n #endif\n#endif\n#ifdef SRGB_DECODE\n texel = sRGBToLinear(texel);\n#endif\n#ifdef TONEMAPPING\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n#ifdef SRGB_ENCODE\n texel = linearTosRGB(texel);\n#endif\n gl_FragColor = encodeHDR(vec4(texel.rgb, 1.0));\n}\n@end";gt.import(qi);var Zi=wr.extend((function(){var e=new gt({vertex:gt.source("clay.skybox.vertex"),fragment:gt.source("clay.skybox.fragment")}),t=new Ce({shader:e,depthMask:!1});return{scene:null,geometry:new Xi,material:t,environmentMap:null,culling:!1,_dummyCamera:new Si}}),(function(){var e=this.scene;e&&this.attachScene(e),this.environmentMap&&this.setEnvironmentMap(this.environmentMap)}),{attachScene:function(e){this.scene&&this.detachScene(),e.skybox=this,this.scene=e,e.on("beforerender",this._beforeRenderScene,this)},detachScene:function(){this.scene&&(this.scene.off("beforerender",this._beforeRenderScene),this.scene.skybox=null),this.scene=null},dispose:function(e){this.detachScene(),this.geometry.dispose(e)},setEnvironmentMap:function(e){"texture2D"===e.textureType?(this.material.define("EQUIRECTANGULAR"),e.minFilter=Tr.LINEAR):this.material.undefine("EQUIRECTANGULAR"),this.material.set("environmentMap",e)},getEnvironmentMap:function(){return this.material.get("environmentMap")},_beforeRenderScene:function(e,t,r){this.renderSkybox(e,r)},renderSkybox:function(e,t){var r=this._dummyCamera;r.aspect=e.getViewportAspect(),r.fov=t.fov||50,r.updateProjectionMatrix(),tr.invert(r.invProjectionMatrix,r.projectionMatrix),r.worldTransform.copy(t.worldTransform),r.viewMatrix.copy(t.viewMatrix),this.position.copy(t.getWorldPosition()),this.update(),e.gl.disable(e.gl.BLEND),this.material.get("lod")>0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),e.renderPass([this],r)}}),Yi=Zi,Ki=Yi,$i=542327876,Qi=131072,Ji=512,en=4;function tn(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var rn=31,nn=tn("DXT1"),an=tn("DXT3"),on=tn("DXT5"),sn=0,ln=1,un=2,cn=3,hn=4,dn=7,fn=20,pn=21,mn=28,gn={parse:function(e,t){var r=new Int32Array(e,0,rn);if(r[sn]!==$i)return null;if(!r(fn)&en)return null;var i,n,a=r(pn),o=r[hn],s=r[cn],l=r[mn]&Ji,u=r[un]&Qi;switch(a){case nn:i=8,n=Tr.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case an:i=16,n=Tr.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case on:i=16,n=Tr.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var c=r[ln]+4,h=l?6:1,d=1;u&&(d=Math.max(1,r[dn]));for(var f=[],p=0;p<h;p++){var m=o,g=s;f[p]=new Dr({width:m,height:g,format:n});for(var v=[],_=0;_<d;_++){var y=Math.max(4,m)/4*Math.max(4,g)/4*i,x=new Uint8Array(e,c,y);c+=y,m*=.5,g*=.5,v[_]=x}f[p].pixels=v[0],u&&(f[p].mipmaps=v)}if(!t)return f[0];t.width=f[0].width,t.height=f[0].height,t.format=f[0].format,t.pixels=f[0].pixels,t.mipmaps=f[0].mipmaps}},vn=gn,_n=String.fromCharCode,yn=8,xn=32767;function Tn(e,t,r,i){if(e[3]>0){var n=Math.pow(2,e[3]-128-8+i);t[r+0]=e[0]*n,t[r+1]=e[1]*n,t[r+2]=e[2]*n}else t[r+0]=0,t[r+1]=0,t[r+2]=0;return t[r+3]=1,t}function bn(e,t,r){for(var i="",n=t;n<r;n++)i+=_n(e[n]);return i}function wn(e,t){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]}function En(e,t,r,i){var n=0,a=0,o=i;while(o>0)if(e[a][0]=t[r++],e[a][1]=t[r++],e[a][2]=t[r++],e[a][3]=t[r++],1===e[a][0]&&1===e[a][1]&&1===e[a][2]){for(var s=e[a][3]<<n>>>0;s>0;s--)wn(e[a-1],e[a]),a++,o--;n+=8}else a++,o--,n=0;return r}function Sn(e,t,r,i){if(i<yn|i>xn)return En(e,t,r,i);var n=t[r++];if(2!=n)return En(e,t,r-1,i);if(e[0][1]=t[r++],e[0][2]=t[r++],n=t[r++],(e[0][2]<<8>>>0|n)>>>0!==i)return null;for(n=0;n<4;n++)for(var a=0;a<i;){var o=t[r++];if(o>128){o=(127&o)>>>0;var s=t[r++];while(o--)e[a++][n]=s}else while(o--)e[a++][n]=t[r++]}return r}var Cn={parseRGBE:function(e,t,r){null==r&&(r=0);var i=new Uint8Array(e),n=i.length;if("#?"===bn(i,0,2)){for(var a=2;a<n;a++)if("\n"===_n(i[a])&&"\n"===_n(i[a+1]))break;if(!(a>=n)){a+=2;for(var o="";a<n;a++){var s=_n(i[a]);if("\n"===s)break;o+=s}var l=o.split(" "),u=parseInt(l[1]),c=parseInt(l[3]);if(c&&u){for(var h=a+1,d=[],f=0;f<c;f++){d[f]=[];for(var p=0;p<4;p++)d[f][p]=0}for(var m=new Float32Array(c*u*4),g=0,v=0;v<u;v++){h=Sn(d,i,h,c);if(!h)return null;for(f=0;f<c;f++)Tn(d[f],m,g,r),g+=4}return t||(t=new Dr),t.width=c,t.height=u,t.pixels=m,t.type=Tr.FLOAT,t}}}},parseRGBEFromPNG:function(e){}},An=Cn,Mn={loadTexture:function(e,t,r,i){var n;if("function"===typeof t?(r=t,i=r,t={}):t=t||{},"string"===typeof e){if(e.match(/.hdr$/)||"hdr"===t.fileType)return n=new Dr({width:0,height:0,sRGB:!1}),Mn._fetchTexture(e,(function(e){An.parseRGBE(e,n,t.exposure),n.dirty(),r&&r(n)}),i),n;e.match(/.dds$/)||"dds"===t.fileType?(n=new Dr({width:0,height:0}),Mn._fetchTexture(e,(function(e){vn.parse(e,n),n.dirty(),r&&r(n)}),i)):(n=new Dr,n.load(e),n.success(r),n.error(i))}else"object"===typeof e&&"undefined"!==typeof e.px&&(n=new wi,n.load(e),n.success(r),n.error(i));return n},loadPanorama:function(e,t,r,i,n,a){var o=this;"function"===typeof i?(n=i,a=n,i={}):i=i||{},Mn.loadTexture(t,i,(function(t){t.flipY=i.flipY||!1,o.panoramaToCubeMap(e,t,r,i),t.dispose(e),n&&n(r)}),a)},panoramaToCubeMap:function(e,t,r,i){var n=new Gi,a=new Ki({scene:new vi});return a.setEnvironmentMap(t),i=i||{},i.encodeRGBM&&a.material.define("fragment","RGBM_ENCODE"),r.sRGB=t.sRGB,n.texture=r,n.render(e,a.scene),n.texture=null,n.dispose(e),r},heightToNormal:function(e,t){var r=document.createElement("canvas"),i=r.width=e.width,n=r.height=e.height,a=r.getContext("2d");a.drawImage(e,0,0,i,n),t=t||!1;for(var o=a.getImageData(0,0,i,n),s=a.createImageData(i,n),l=0;l<o.data.length;l+=4){if(t){var u=o.data[l],c=o.data[l+1],h=o.data[l+2],d=Math.abs(u-c)+Math.abs(c-h);if(d>20)return console.warn("Given image is not a height map"),e}var f,p,m,g;l%(4*i)===0?(f=o.data[l],m=o.data[l+4]):l%(4*i)===4*(i-1)?(f=o.data[l-4],m=o.data[l]):(f=o.data[l-4],m=o.data[l+4]),l<4*i?(p=o.data[l],g=o.data[l+4*i]):l>i*(n-1)*4?(p=o.data[l-4*i],g=o.data[l]):(p=o.data[l-4*i],g=o.data[l+4*i]),s.data[l]=f-m+127,s.data[l+1]=p-g+127,s.data[l+2]=255,s.data[l+3]=255}return a.putImageData(s,0,0),r},isHeightImage:function(e,t,r){if(!e||!e.width||!e.height)return!1;var i=document.createElement("canvas"),n=i.getContext("2d"),a=t||32;r=r||20,i.width=i.height=a,n.drawImage(e,0,0,a,a);for(var o=n.getImageData(0,0,a,a),s=0;s<o.data.length;s+=4){var l=o.data[s],u=o.data[s+1],c=o.data[s+2],h=Math.abs(l-u)+Math.abs(u-c);if(h>r)return!1}return!0},_fetchTexture:function(e,t,r){J["a"].request.get({url:e,responseType:"arraybuffer",onload:t,onerror:r})},createChessboard:function(e,t,r,i){e=e||512,t=t||64,r=r||"black",i=i||"white";var n=Math.ceil(e/t),a=document.createElement("canvas");a.width=e,a.height=e;var o=a.getContext("2d");o.fillStyle=i,o.fillRect(0,0,e,e),o.fillStyle=r;for(var s=0;s<n;s++)for(var l=0;l<n;l++){var u=l%2?s%2:s%2-1;u&&o.fillRect(s*t,l*t,t,t)}var c=new Dr({image:a,anisotropic:8});return c},createBlank:function(e){var t=document.createElement("canvas");t.width=1,t.height=1;var r=t.getContext("2d");r.fillStyle=e,r.fillRect(0,0,1,1);var i=new Dr({image:t});return i}},Ln=Mn,Dn=["mousedown","mouseup","mousemove","mouseover","mouseout","click","dblclick","contextmenu"];function Nn(e){return"_on"+e}var Rn=function(e){var t=this;this._texture=new Dr({anisotropic:32,flipY:!1,surface:this,dispose:function(e){t.dispose(),Dr.prototype.dispose.call(this,e)}}),Dn.forEach((function(e){this[Nn(e)]=function(t){t.triangle&&this._meshes.forEach((function(r){this.dispatchEvent(e,r,t.triangle,t.point)}),this)}}),this),this._meshes=[],e&&this.setECharts(e),this.onupdate=null};Rn.prototype={constructor:Rn,getTexture:function(){return this._texture},setECharts:function(e){this._chart=e;var t=e.getDom();if(t instanceof HTMLCanvasElement){var r=this,i=e.getZr(),n=i.__oldRefreshImmediately||i.refreshImmediately;i.refreshImmediately=function(){n.call(this),r._texture.dirty(),r.onupdate&&r.onupdate()},i.__oldRefreshImmediately=n}else console.error("ECharts must init on canvas if it is used as texture."),t=document.createElement("canvas");this._texture.image=t,this._texture.dirty(),this.onupdate&&this.onupdate()},dispatchEvent:function(){var e=new kt,t=new kt,r=new kt,i=new Pe,n=new Pe,a=new Pe,o=new Pe,s=new kt;return function(l,u,c,h){var d=u.geometry,f=d.attributes.position,p=d.attributes.texcoord0,m=kt.dot,g=kt.cross;f.get(c[0],e.array),f.get(c[1],t.array),f.get(c[2],r.array),p.get(c[0],i.array),p.get(c[1],n.array),p.get(c[2],a.array),g(s,t,r);var v=m(e,s),_=m(h,s)/v;g(s,r,e);var y=m(h,s)/v;g(s,e,t);var x=m(h,s)/v;Pe.scale(o,i,_),Pe.scaleAndAdd(o,o,n,y),Pe.scaleAndAdd(o,o,a,x);var T=o.x*this._chart.getWidth(),b=o.y*this._chart.getHeight();this._chart.getZr().handler.dispatch(l,{zrX:T,zrY:b})}}(),attachToMesh:function(e){this._meshes.indexOf(e)>=0||(Dn.forEach((function(t){e.on(t,this[Nn(t)],this)}),this),this._meshes.push(e))},detachFromMesh:function(e){var t=this._meshes.indexOf(e);t>=0&&this._meshes.splice(t,1),Dn.forEach((function(t){e.off(t,this[Nn(t)])}),this)},dispose:function(){this._meshes.forEach((function(e){this.detachFromMesh(e)}),this)}};var In=Rn,Pn=ui.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array;this.left=(-1-e[12])/e[0],this.right=(1-e[12])/e[0],this.top=(1-e[13])/e[5],this.bottom=(-1-e[13])/e[5],this.near=-(-1-e[14])/e[10],this.far=-(1-e[14])/e[10]},clone:function(){var e=ui.prototype.clone.call(this);return e.left=this.left,e.right=this.right,e.near=this.near,e.far=this.far,e.top=this.top,e.bottom=this.bottom,e}}),On=Pn,Bn="\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end";gt["import"](Bn);var Fn=new ki,Un=new wr({geometry:Fn,frustumCulling:!1}),zn=new On,Gn=q.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var e=new gt(gt.source("clay.compositor.vertex"),this.fragment),t=new Ce({shader:e});t.enableTexturesAll(),this.material=t}),{setUniform:function(e,t){this.material.setUniform(e,t)},getUniform:function(e){var t=this.material.uniforms[e];if(t)return t.value},attachOutput:function(e,t){this.outputs||(this.outputs={}),t=t||Q.COLOR_ATTACHMENT0,this.outputs[t]=e},detachOutput:function(e){for(var t in this.outputs)this.outputs[t]===e&&(this.outputs[t]=null)},bind:function(e,t){if(this.outputs)for(var r in this.outputs){var i=this.outputs[r];i&&t.attach(i,r)}t&&t.bind(e)},unbind:function(e,t){t.unbind(e)},render:function(e,t){var r=e.gl;if(t){this.bind(e,t);var i=e.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var n=[];for(var a in this.outputs)a=+a,a>=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&n.push(a);i.drawBuffersEXT(n)}}this.trigger("beforerender",this,e);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o|=r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(e),this.trigger("afterrender",this,e),t&&this.unbind(e,t)},renderQuad:function(e){Un.material=this.material,e.renderPass([Un],zn)},dispose:function(e){}}),Hn=Gn,kn="#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform sampler2D normalDistribution;\nuniform vec2 viewportSize : [512, 256];\nconst vec3 N = vec3(0.0, 0.0, 1.0);\nconst float fSampleNumber = float(SAMPLE_NUMBER);\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n",Vn="#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n",Wn={},jn=["px","nx","py","ny","pz","nz"];Wn.prefilterEnvironmentMap=function(e,t,r,i,n){n&&i||(i=Wn.generateNormalDistribution(),n=Wn.integrateBRDF(e,i)),r=r||{};var a=r.width||64,o=r.height||64,s=r.type||t.type,l=new wi({width:a,height:o,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(a,o),c=Math.log(u)/Math.log(2)+1,h=new Ce({shader:new gt({vertex:gt.source("clay.skybox.vertex"),fragment:Vn})});h.set("normalDistribution",i),r.encodeRGBM&&h.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&h.define("fragment","RGBM_DECODE");var d,f=new vi;if("texture2D"===t.textureType){var p=new wi({width:a,height:o,type:s===Tr.FLOAT?Tr.HALF_FLOAT:s});Ln.panoramaToCubeMap(e,t,p,{encodeRGBM:r.decodeRGBM}),t=p}d=new Yi({scene:f,material:h}),d.material.set("environmentMap",t);var m=new Gi({texture:l});r.encodeRGBM&&(s=l.type=Tr.UNSIGNED_BYTE);for(var g=new Dr({width:a,height:o,type:s}),v=new Fi({depthBuffer:!1}),_=J["a"][s===Tr.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y<c;y++){l.mipmaps[y]={pixels:{}},d.material.set("roughness",y/(c-1));for(var x=g.width,T=2*Math.atan(x/(x-.5))/Math.PI*180,b=0;b<jn.length;b++){var w=new _(g.width*g.height*4);v.attach(g),v.bind(e);var E=m.getCamera(jn[b]);E.fov=T,e.render(f,E),e.gl.readPixels(0,0,g.width,g.height,Tr.RGBA,s,w),v.unbind(e),l.mipmaps[y].pixels[jn[b]]=w}g.width/=2,g.height/=2,g.dirty()}return v.dispose(e),g.dispose(e),d.dispose(e),i.dispose(e),{environmentMap:l,brdfLookup:n,normalDistribution:i,maxMipmapLevel:c}},Wn.integrateBRDF=function(e,t){t=t||Wn.generateNormalDistribution();var r=new Fi({depthBuffer:!1}),i=new Hn({fragment:kn}),n=new Dr({width:512,height:256,type:Tr.HALF_FLOAT,wrapS:Tr.CLAMP_TO_EDGE,wrapT:Tr.CLAMP_TO_EDGE,minFilter:Tr.NEAREST,magFilter:Tr.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",t),i.setUniform("viewportSize",[512,256]),i.attachOutput(n),i.render(e,r),r.dispose(e),n},Wn.generateNormalDistribution=function(e,t){e=e||256,t=t||1024;for(var r=new Dr({width:e,height:t,type:Tr.FLOAT,minFilter:Tr.NEAREST,magFilter:Tr.NEAREST,wrapS:Tr.CLAMP_TO_EDGE,wrapT:Tr.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(t*e*4),n=[],a=0;a<e;a++){for(var o=a/e,s=o*o,l=0;l<t;l++){var u=(l<<16|l>>>16)>>>0;u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0,u=((858993459&u)<<2|(3435973836&u)>>>2)>>>0,u=((252645135&u)<<4|(4042322160&u)>>>4)>>>0,u=(((16711935&u)<<8|(4278255360&u)>>>8)>>>0)/4294967296;var c=Math.sqrt((1-u)/(1+(s*s-1)*u));n[l]=c}for(l=0;l<t;l++){var h=4*(l*e+a),d=(c=n[l],Math.sqrt(1-c*c)),f=l/t,p=2*Math.PI*f;i[h]=d*Math.cos(p),i[h+1]=c,i[h+2]=d*Math.sin(p),i[h+3]=1}}return r.pixels=i,r};var Xn=Wn,qn=Qr.extend({cubemap:null,castShadow:!1,_normalDistribution:null,_brdfLookup:null},{type:"AMBIENT_CUBEMAP_LIGHT",prefilter:function(e,t){if(e.getGLExtension("EXT_shader_texture_lod")){this._brdfLookup||(this._normalDistribution=Xn.generateNormalDistribution(),this._brdfLookup=Xn.integrateBRDF(e,this._normalDistribution));var r=this.cubemap;if(!r.__prefiltered){var i=Xn.prefilterEnvironmentMap(e,r,{encodeRGBM:!0,width:t,height:t},this._normalDistribution,this._brdfLookup);this.cubemap=i.environmentMap,this.cubemap.__prefiltered=!0,r.dispose(e)}}else console.warn("Device not support textureCubeLodEXT")},getBRDFLookup:function(){return this._brdfLookup},uniformTemplates:{ambientCubemapLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}},ambientCubemapLightCubemap:{type:"t",value:function(e){return e.cubemap}},ambientCubemapLightBRDFLookup:{type:"t",value:function(e){return e._brdfLookup}}}}),Zn=qn,Yn=Qr.extend({castShadow:!1,coefficients:[]},(function(){this._coefficientsTmpArr=new J["a"].Float32Array(27)}),{type:"AMBIENT_SH_LIGHT",uniformTemplates:{ambientSHLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}},ambientSHLightCoefficients:{type:"3f",value:function(e){for(var t=e._coefficientsTmpArr,r=0;r<e.coefficients.length;r++)t[r]=e.coefficients[r];return t}}}}),Kn=Yn,$n={},Qn=["px","nx","py","ny","pz","nz"];function Jn(e,t){var r=e[0],i=e[1],n=e[2];return 0===t?1:1===t?r:2===t?i:3===t?n:4===t?r*n:5===t?i*n:6===t?r*i:7===t?3*n*n-1:r*r-i*i}var ea={px:[2,1,0,-1,-1,1],nx:[2,1,0,1,-1,-1],py:[0,2,1,1,-1,-1],ny:[0,2,1,1,1,1],pz:[0,1,2,-1,-1,-1],nz:[0,1,2,1,-1,1]};function ta(e,t,r,i){for(var n=new J["a"].Float32Array(27),a=Tt.create(),o=Tt.create(),s=Tt.create(),l=0;l<9;l++){for(var u=Tt.create(),c=0;c<Qn.length;c++){for(var h=t[Qn[c]],d=Tt.create(),f=0,p=0,m=ea[Qn[c]],g=0;g<i;g++)for(var v=0;v<r;v++){a[0]=v/(r-1)*2-1,a[1]=g/(i-1)*2-1,a[2]=-1,Tt.normalize(a,a),s[0]=a[m[0]]*m[3],s[1]=a[m[1]]*m[4],s[2]=a[m[2]]*m[5],o[0]=h[p++]/255,o[1]=h[p++]/255,o[2]=h[p++]/255;var _=h[p++]/255*8.12;o[0]*=_,o[1]*=_,o[2]*=_,Tt.scaleAndAdd(d,d,o,Jn(s,l)*-a[2]),f+=-a[2]}Tt.scaleAndAdd(u,u,d,1/f)}n[3*l]=u[0]/6,n[3*l+1]=u[1]/6,n[3*l+2]=u[2]/6}return n}$n.projectEnvironmentMap=function(e,t,r){var i;r=r||{},r.lod=r.lod||0;var n=new vi,a=64;"texture2D"===t.textureType?i=new Ki({scene:n,environmentMap:t}):(a=t.image&&t.image.px?t.image.px.width:t.width,i=new Yi({scene:n,environmentMap:t}));var o=Math.ceil(a/Math.pow(2,r.lod)),s=Math.ceil(a/Math.pow(2,r.lod)),l=new Dr({width:o,height:s}),u=new Fi;i.material.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&i.material.define("fragment","RGBM_DECODE"),i.material.set("lod",r.lod);for(var c=new Gi({texture:l}),h={},d=0;d<Qn.length;d++){h[Qn[d]]=new Uint8Array(o*s*4);var f=c.getCamera(Qn[d]);f.fov=90,u.attach(l),u.bind(e),e.render(n,f),e.gl.readPixels(0,0,o,s,Tr.RGBA,Tr.UNSIGNED_BYTE,h[Qn[d]]),u.unbind(e)}return i.dispose(e),u.dispose(e),l.dispose(e),ta(e,h,o,s)};var ra=$n,ia={firstNotNull:function(){for(var e=0,t=arguments.length;e<t;e++)if(null!=arguments[e])return arguments[e]},queryDataIndex:function(e,t){return null!=t.dataIndexInside?t.dataIndexInside:null!=t.dataIndex?L["w"].isArray(t.dataIndex)?L["w"].map(t.dataIndex,(function(t){return e.indexOfRawIndex(t)})):e.indexOfRawIndex(t.dataIndex):null!=t.name?L["w"].isArray(t.name)?L["w"].map(t.name,(function(t){return e.indexOfName(t)})):e.indexOfName(t.name):void 0}},na=ia,aa=Vr.extend({dynamic:!1,widthSegments:40,heightSegments:20,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI,radius:1},(function(){this.build()}),{build:function(){var e=this.heightSegments,t=this.widthSegments,r=this.attributes.position,i=this.attributes.texcoord0,n=this.attributes.normal,a=(t+1)*(e+1);r.init(a),i.init(a),n.init(a);var o,s,l,u,c,h,d,f,p,m,g,v=a>65535?Uint32Array:Uint16Array,_=this.indices=new v(t*e*6),y=this.radius,x=this.phiStart,T=this.phiLength,b=this.thetaStart,w=this.thetaLength,E=(y=this.radius,[]),S=[],C=0,A=1/y;for(d=0;d<=e;d++)for(h=0;h<=t;h++)u=h/t,c=d/e,o=-y*Math.cos(x+u*T)*Math.sin(b+c*w),s=y*Math.cos(b+c*w),l=y*Math.sin(x+u*T)*Math.sin(b+c*w),E[0]=o,E[1]=s,E[2]=l,S[0]=u,S[1]=c,r.set(C,E),i.set(C,S),E[0]*=A,E[1]*=A,E[2]*=A,n.set(C,E),C++;var M=t+1,L=0;for(d=0;d<e;d++)for(h=0;h<t;h++)p=d*M+h,f=d*M+h+1,g=(d+1)*M+h+1,m=(d+1)*M+h,_[L++]=f,_[L++]=p,_[L++]=g,_[L++]=p,_[L++]=m,_[L++]=g;this.boundingBox=new ur,this.boundingBox.max.set(y,y,y),this.boundingBox.min.set(-y,-y,-y)}}),oa=aa,sa=Qr.extend({castShadow:!1},{type:"AMBIENT_LIGHT",uniformTemplates:{ambientLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}}}}),la=sa,ua=Qr.extend({shadowBias:.001,shadowSlopeScale:2,shadowCascade:1,cascadeSplitLogFactor:.2},{type:"DIRECTIONAL_LIGHT",uniformTemplates:{directionalLightDirection:{type:"3f",value:function(e){return e.__dir=e.__dir||new kt,e.__dir.copy(e.worldTransform.z).normalize().negate().array}},directionalLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}}},clone:function(){var e=Qr.prototype.clone.call(this);return e.shadowBias=this.shadowBias,e.shadowSlopeScale=this.shadowSlopeScale,e}}),ca=ua,ha=Qr.extend({range:100,castShadow:!1},{type:"POINT_LIGHT",uniformTemplates:{pointLightPosition:{type:"3f",value:function(e){return e.getWorldPosition().array}},pointLightRange:{type:"1f",value:function(e){return e.range}},pointLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}}},clone:function(){var e=Qr.prototype.clone.call(this);return e.range=this.range,e}}),da=ha,fa=Qr.extend({range:20,umbraAngle:30,penumbraAngle:45,falloffFactor:2,shadowBias:.001,shadowSlopeScale:2},{type:"SPOT_LIGHT",uniformTemplates:{spotLightPosition:{type:"3f",value:function(e){return e.getWorldPosition().array}},spotLightRange:{type:"1f",value:function(e){return e.range}},spotLightUmbraAngleCosine:{type:"1f",value:function(e){return Math.cos(e.umbraAngle*Math.PI/180)}},spotLightPenumbraAngleCosine:{type:"1f",value:function(e){return Math.cos(e.penumbraAngle*Math.PI/180)}},spotLightFalloffFactor:{type:"1f",value:function(e){return e.falloffFactor}},spotLightDirection:{type:"3f",value:function(e){return e.__dir=e.__dir||new kt,e.__dir.copy(e.worldTransform.z).negate().array}},spotLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}}},clone:function(){var e=Qr.prototype.clone.call(this);return e.range=this.range,e.umbraAngle=this.umbraAngle,e.penumbraAngle=this.penumbraAngle,e.falloffFactor=this.falloffFactor,e.shadowBias=this.shadowBias,e.shadowSlopeScale=this.shadowSlopeScale,e}}),pa=fa,ma=function(e,t,r,i){e=e||0,t=t||0,r=r||0,i=i||0,this.array=qt.fromValues(e,t,r,i),this._dirty=!0};ma.prototype={constructor:ma,add:function(e){return qt.add(this.array,this.array,e.array),this._dirty=!0,this},set:function(e,t,r,i){return this.array[0]=e,this.array[1]=t,this.array[2]=r,this.array[3]=i,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this.array[2]=e[2],this.array[3]=e[3],this._dirty=!0,this},clone:function(){return new ma(this.x,this.y,this.z,this.w)},copy:function(e){return qt.copy(this.array,e.array),this._dirty=!0,this},dist:function(e){return qt.dist(this.array,e.array)},distance:function(e){return qt.distance(this.array,e.array)},div:function(e){return qt.div(this.array,this.array,e.array),this._dirty=!0,this},divide:function(e){return qt.divide(this.array,this.array,e.array),this._dirty=!0,this},dot:function(e){return qt.dot(this.array,e.array)},len:function(){return qt.len(this.array)},length:function(){return qt.length(this.array)},lerp:function(e,t,r){return qt.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},min:function(e){return qt.min(this.array,this.array,e.array),this._dirty=!0,this},max:function(e){return qt.max(this.array,this.array,e.array),this._dirty=!0,this},mul:function(e){return qt.mul(this.array,this.array,e.array),this._dirty=!0,this},multiply:function(e){return qt.multiply(this.array,this.array,e.array),this._dirty=!0,this},negate:function(){return qt.negate(this.array,this.array),this._dirty=!0,this},normalize:function(){return qt.normalize(this.array,this.array),this._dirty=!0,this},random:function(e){return qt.random(this.array,e),this._dirty=!0,this},scale:function(e){return qt.scale(this.array,this.array,e),this._dirty=!0,this},scaleAndAdd:function(e,t){return qt.scaleAndAdd(this.array,this.array,e.array,t),this._dirty=!0,this},sqrDist:function(e){return qt.sqrDist(this.array,e.array)},squaredDistance:function(e){return qt.squaredDistance(this.array,e.array)},sqrLen:function(){return qt.sqrLen(this.array)},squaredLength:function(){return qt.squaredLength(this.array)},sub:function(e){return qt.sub(this.array,this.array,e.array),this._dirty=!0,this},subtract:function(e){return qt.subtract(this.array,this.array,e.array),this._dirty=!0,this},transformMat4:function(e){return qt.transformMat4(this.array,this.array,e.array),this._dirty=!0,this},transformQuat:function(e){return qt.transformQuat(this.array,this.array,e.array),this._dirty=!0,this},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var ga=Object.defineProperty;if(ga){var va=ma.prototype;ga(va,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),ga(va,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}}),ga(va,"z",{get:function(){return this.array[2]},set:function(e){this.array[2]=e,this._dirty=!0}}),ga(va,"w",{get:function(){return this.array[3]},set:function(e){this.array[3]=e,this._dirty=!0}})}ma.add=function(e,t,r){return qt.add(e.array,t.array,r.array),e._dirty=!0,e},ma.set=function(e,t,r,i,n){qt.set(e.array,t,r,i,n),e._dirty=!0},ma.copy=function(e,t){return qt.copy(e.array,t.array),e._dirty=!0,e},ma.dist=function(e,t){return qt.distance(e.array,t.array)},ma.distance=ma.dist,ma.div=function(e,t,r){return qt.divide(e.array,t.array,r.array),e._dirty=!0,e},ma.divide=ma.div,ma.dot=function(e,t){return qt.dot(e.array,t.array)},ma.len=function(e){return qt.length(e.array)},ma.lerp=function(e,t,r,i){return qt.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},ma.min=function(e,t,r){return qt.min(e.array,t.array,r.array),e._dirty=!0,e},ma.max=function(e,t,r){return qt.max(e.array,t.array,r.array),e._dirty=!0,e},ma.mul=function(e,t,r){return qt.multiply(e.array,t.array,r.array),e._dirty=!0,e},ma.multiply=ma.mul,ma.negate=function(e,t){return qt.negate(e.array,t.array),e._dirty=!0,e},ma.normalize=function(e,t){return qt.normalize(e.array,t.array),e._dirty=!0,e},ma.random=function(e,t){return qt.random(e.array,t),e._dirty=!0,e},ma.scale=function(e,t,r){return qt.scale(e.array,t.array,r),e._dirty=!0,e},ma.scaleAndAdd=function(e,t,r,i){return qt.scaleAndAdd(e.array,t.array,r.array,i),e._dirty=!0,e},ma.sqrDist=function(e,t){return qt.sqrDist(e.array,t.array)},ma.squaredDistance=ma.sqrDist,ma.sqrLen=function(e){return qt.sqrLen(e.array)},ma.squaredLength=ma.sqrLen,ma.sub=function(e,t,r){return qt.subtract(e.array,t.array,r.array),e._dirty=!0,e},ma.subtract=ma.sub,ma.transformMat4=function(e,t,r){return qt.transformMat4(e.array,t.array,r.array),e._dirty=!0,e},ma.transformQuat=function(e,t,r){return qt.transformQuat(e.array,t.array,r.array),e._dirty=!0,e};var _a=ma,ya={create:function(){var e=new Me(4);return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},clone:function(e){var t=new Me(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},transpose:function(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*a-n*i;return o?(o=1/o,e[0]=a*o,e[1]=-i*o,e[2]=-n*o,e[3]=r*o,e):null},adjoint:function(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e},determinant:function(e){return e[0]*e[3]-e[2]*e[1]},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*s+a*l,e[1]=n*s+o*l,e[2]=i*u+a*c,e[3]=n*u+o*c,e}};ya.mul=ya.multiply,ya.rotate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=i*-s+a*l,e[3]=n*-s+o*l,e},ya.scale=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1];return e[0]=i*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e},ya.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2))},ya.LDU=function(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]};var xa=ya,Ta=function(){this.array=xa.create(),this._dirty=!0};Ta.prototype={constructor:Ta,setArray:function(e){for(var t=0;t<this.array.length;t++)this.array[t]=e[t];return this._dirty=!0,this},clone:function(){return(new Ta).copy(this)},copy:function(e){return xa.copy(this.array,e.array),this._dirty=!0,this},adjoint:function(){return xa.adjoint(this.array,this.array),this._dirty=!0,this},determinant:function(){return xa.determinant(this.array)},identity:function(){return xa.identity(this.array),this._dirty=!0,this},invert:function(){return xa.invert(this.array,this.array),this._dirty=!0,this},mul:function(e){return xa.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return xa.mul(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return xa.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return xa.multiply(this.array,e.array,this.array),this._dirty=!0,this},rotate:function(e){return xa.rotate(this.array,this.array,e),this._dirty=!0,this},scale:function(e){return xa.scale(this.array,this.array,e.array),this._dirty=!0,this},transpose:function(){return xa.transpose(this.array,this.array),this._dirty=!0,this},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}},Ta.adjoint=function(e,t){return xa.adjoint(e.array,t.array),e._dirty=!0,e},Ta.copy=function(e,t){return xa.copy(e.array,t.array),e._dirty=!0,e},Ta.determinant=function(e){return xa.determinant(e.array)},Ta.identity=function(e){return xa.identity(e.array),e._dirty=!0,e},Ta.invert=function(e,t){return xa.invert(e.array,t.array),e._dirty=!0,e},Ta.mul=function(e,t,r){return xa.mul(e.array,t.array,r.array),e._dirty=!0,e},Ta.multiply=Ta.mul,Ta.rotate=function(e,t,r){return xa.rotate(e.array,t.array,r),e._dirty=!0,e},Ta.scale=function(e,t,r){return xa.scale(e.array,t.array,r.array),e._dirty=!0,e},Ta.transpose=function(e,t){return xa.transpose(e.array,t.array),e._dirty=!0,e};var ba=Ta,wa={create:function(){var e=new Me(6);return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},clone:function(e){var t=new Me(6);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},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=r*a-i*n;return l?(l=1/l,e[0]=a*l,e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-a*o)*l,e[5]=(i*o-r*s)*l,e):null},determinant:function(e){return e[0]*e[3]-e[1]*e[2]},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=r[0],c=r[1],h=r[2],d=r[3],f=r[4],p=r[5];return e[0]=i*u+a*c,e[1]=n*u+o*c,e[2]=i*h+a*d,e[3]=n*h+o*d,e[4]=i*f+a*p+s,e[5]=n*f+o*p+l,e}};wa.mul=wa.multiply,wa.rotate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=Math.sin(r),c=Math.cos(r);return e[0]=i*c+a*u,e[1]=n*c+o*u,e[2]=i*-u+a*c,e[3]=n*-u+o*c,e[4]=s,e[5]=l,e},wa.scale=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=r[0],c=r[1];return e[0]=i*u,e[1]=n*u,e[2]=a*c,e[3]=o*c,e[4]=s,e[5]=l,e},wa.translate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=r[0],c=r[1];return e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=i*u+a*c+s,e[5]=n*u+o*c+l,e},wa.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+1)};var Ea=wa,Sa=function(){this.array=Ea.create(),this._dirty=!0};Sa.prototype={constructor:Sa,setArray:function(e){for(var t=0;t<this.array.length;t++)this.array[t]=e[t];return this._dirty=!0,this},clone:function(){return(new Sa).copy(this)},copy:function(e){return Ea.copy(this.array,e.array),this._dirty=!0,this},determinant:function(){return Ea.determinant(this.array)},identity:function(){return Ea.identity(this.array),this._dirty=!0,this},invert:function(){return Ea.invert(this.array,this.array),this._dirty=!0,this},mul:function(e){return Ea.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return Ea.mul(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return Ea.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return Ea.multiply(this.array,e.array,this.array),this._dirty=!0,this},rotate:function(e){return Ea.rotate(this.array,this.array,e),this._dirty=!0,this},scale:function(e){return Ea.scale(this.array,this.array,e.array),this._dirty=!0,this},translate:function(e){return Ea.translate(this.array,this.array,e.array),this._dirty=!0,this},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}},Sa.copy=function(e,t){return Ea.copy(e.array,t.array),e._dirty=!0,e},Sa.determinant=function(e){return Ea.determinant(e.array)},Sa.identity=function(e){return Ea.identity(e.array),e._dirty=!0,e},Sa.invert=function(e,t){return Ea.invert(e.array,t.array),e._dirty=!0,e},Sa.mul=function(e,t,r){return Ea.mul(e.array,t.array,r.array),e._dirty=!0,e},Sa.multiply=Sa.mul,Sa.rotate=function(e,t,r){return Ea.rotate(e.array,t.array,r),e._dirty=!0,e},Sa.scale=function(e,t,r){return Ea.scale(e.array,t.array,r.array),e._dirty=!0,e},Sa.translate=function(e,t,r){return Ea.translate(e.array,t.array,r.array),e._dirty=!0,e};var Ca=Sa,Aa=function(){this.array=Yt.create(),this._dirty=!0};Aa.prototype={constructor:Aa,setArray:function(e){for(var t=0;t<this.array.length;t++)this.array[t]=e[t];return this._dirty=!0,this},adjoint:function(){return Yt.adjoint(this.array,this.array),this._dirty=!0,this},clone:function(){return(new Aa).copy(this)},copy:function(e){return Yt.copy(this.array,e.array),this._dirty=!0,this},determinant:function(){return Yt.determinant(this.array)},fromMat2d:function(e){return Yt.fromMat2d(this.array,e.array),this._dirty=!0,this},fromMat4:function(e){return Yt.fromMat4(this.array,e.array),this._dirty=!0,this},fromQuat:function(e){return Yt.fromQuat(this.array,e.array),this._dirty=!0,this},identity:function(){return Yt.identity(this.array),this._dirty=!0,this},invert:function(){return Yt.invert(this.array,this.array),this._dirty=!0,this},mul:function(e){return Yt.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return Yt.mul(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return Yt.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return Yt.multiply(this.array,e.array,this.array),this._dirty=!0,this},rotate:function(e){return Yt.rotate(this.array,this.array,e),this._dirty=!0,this},scale:function(e){return Yt.scale(this.array,this.array,e.array),this._dirty=!0,this},translate:function(e){return Yt.translate(this.array,this.array,e.array),this._dirty=!0,this},normalFromMat4:function(e){return Yt.normalFromMat4(this.array,e.array),this._dirty=!0,this},transpose:function(){return Yt.transpose(this.array,this.array),this._dirty=!0,this},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}},Aa.adjoint=function(e,t){return Yt.adjoint(e.array,t.array),e._dirty=!0,e},Aa.copy=function(e,t){return Yt.copy(e.array,t.array),e._dirty=!0,e},Aa.determinant=function(e){return Yt.determinant(e.array)},Aa.identity=function(e){return Yt.identity(e.array),e._dirty=!0,e},Aa.invert=function(e,t){return Yt.invert(e.array,t.array),e},Aa.mul=function(e,t,r){return Yt.mul(e.array,t.array,r.array),e._dirty=!0,e},Aa.multiply=Aa.mul,Aa.fromMat2d=function(e,t){return Yt.fromMat2d(e.array,t.array),e._dirty=!0,e},Aa.fromMat4=function(e,t){return Yt.fromMat4(e.array,t.array),e._dirty=!0,e},Aa.fromQuat=function(e,t){return Yt.fromQuat(e.array,t.array),e._dirty=!0,e},Aa.normalFromMat4=function(e,t){return Yt.normalFromMat4(e.array,t.array),e._dirty=!0,e},Aa.rotate=function(e,t,r){return Yt.rotate(e.array,t.array,r),e._dirty=!0,e},Aa.scale=function(e,t,r){return Yt.scale(e.array,t.array,r.array),e._dirty=!0,e},Aa.transpose=function(e,t){return Yt.transpose(e.array,t.array),e._dirty=!0,e},Aa.translate=function(e,t,r){return Yt.translate(e.array,t.array,r.array),e._dirty=!0,e};var Ma=Aa,La=r("06ad"),Da={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(e,t){this._animators=this._animators||[];var r,i=this;if(e){for(var n=e.split("."),a=i,o=0,s=n.length;o<s;o++)a&&(a=a[n[o]]);a&&(r=a)}else r=i;if(null==r)throw new Error("Target "+e+" not exists");var l=this._animators,u=new La["b"](r,t),c=this;return u.during((function(){c.__zr&&c.__zr.refresh()})).done((function(){var e=l.indexOf(u);e>=0&&l.splice(e,1)})),l.push(u),this.__zr&&this.__zr.animation.addAnimator(u),u},stopAnimation:function(e){this._animators=this._animators||[];for(var t=this._animators,r=t.length,i=0;i<r;i++)t[i].stop(e);return t.length=0,this},addAnimatorsToZr:function(e){if(this._animators)for(var t=0;t<this._animators.length;t++)e.animation.addAnimator(this._animators[t])},removeAnimatorsFromZr:function(e){if(this._animators)for(var t=0;t<this._animators.length;t++)e.animation.removeAnimator(this._animators[t])}},Na=Da,Ra="\n@export clay.util.rand\nhighp float rand(vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\n return fract(sin(sn) * c);\n}\n@end\n@export clay.util.calculate_attenuation\nuniform float attenuationFactor : 5.0;\nfloat lightAttenuation(float dist, float range)\n{\n float attenuation = 1.0;\n attenuation = dist*dist/(range*range+1.0);\n float att_s = attenuationFactor;\n attenuation = 1.0/(attenuation*att_s+1.0);\n att_s = 1.0/(att_s+1.0);\n attenuation = attenuation - att_s;\n attenuation /= 1.0 - att_s;\n return clamp(attenuation, 0.0, 1.0);\n}\n@end\n@export clay.util.edge_factor\n#ifdef SUPPORT_STANDARD_DERIVATIVES\nfloat edgeFactor(float width)\n{\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#else\nfloat edgeFactor(float width)\n{\n return 1.0;\n}\n#endif\n@end\n@export clay.util.encode_float\nvec4 encodeFloat(const in float depth)\n{\n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n vec4 res = fract(depth * bitShifts);\n res -= res.xxyz * bit_mask;\n return res;\n}\n@end\n@export clay.util.decode_float\nfloat decodeFloat(const in vec4 color)\n{\n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\n return dot(color, bitShifts);\n}\n@end\n@export clay.util.float\n@import clay.util.encode_float\n@import clay.util.decode_float\n@end\n@export clay.util.rgbm_decode\nvec3 RGBMDecode(vec4 rgbm, float range) {\n return range * rgbm.rgb * rgbm.a;\n}\n@end\n@export clay.util.rgbm_encode\nvec4 RGBMEncode(vec3 color, float range) {\n if (dot(color, color) == 0.0) {\n return vec4(0.0);\n }\n vec4 rgbm;\n color /= range;\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\n rgbm.rgb = color / rgbm.a;\n return rgbm;\n}\n@end\n@export clay.util.rgbm\n@import clay.util.rgbm_decode\n@import clay.util.rgbm_encode\nvec4 decodeHDR(vec4 color)\n{\n#if defined(RGBM_DECODE) || defined(RGBM)\n return vec4(RGBMDecode(color, 8.12), 1.0);\n#else\n return color;\n#endif\n}\nvec4 encodeHDR(vec4 color)\n{\n#if defined(RGBM_ENCODE) || defined(RGBM)\n return RGBMEncode(color.xyz, 8.12);\n#else\n return color;\n#endif\n}\n@end\n@export clay.util.srgb\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\n}\nvec4 linearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\n@end\n@export clay.chunk.skinning_header\n#ifdef SKINNING\nattribute vec3 weight : WEIGHT;\nattribute vec4 joint : JOINT;\n#ifdef USE_SKIN_MATRICES_TEXTURE\nuniform sampler2D skinMatricesTexture : ignore;\nuniform float skinMatricesTextureSize: ignore;\nmat4 getSkinMatrix(sampler2D tex, float idx) {\n float j = idx * 4.0;\n float x = mod(j, skinMatricesTextureSize);\n float y = floor(j / skinMatricesTextureSize) + 0.5;\n vec2 scale = vec2(skinMatricesTextureSize);\n return mat4(\n texture2D(tex, vec2(x + 0.5, y) / scale),\n texture2D(tex, vec2(x + 1.5, y) / scale),\n texture2D(tex, vec2(x + 2.5, y) / scale),\n texture2D(tex, vec2(x + 3.5, y) / scale)\n );\n}\nmat4 getSkinMatrix(float idx) {\n return getSkinMatrix(skinMatricesTexture, idx);\n}\n#else\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\nmat4 getSkinMatrix(float idx) {\n return skinMatrix[int(idx)];\n}\n#endif\n#endif\n@end\n@export clay.chunk.skin_matrix\nmat4 skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\nif (weight.y > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end",Ia="\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n",Pa="@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end",Oa="/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end",Ba="@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end",Fa="@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n",Ua="@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end";function za(e){return!e||"none"===e}function Ga(e){return e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof Image}function Ha(e){return e.getZr&&e.setOption}Object.assign(dr.prototype,Na),gt.import(Ra),gt.import(vt),gt.import(Ia),gt.import(Pa),gt.import(Oa),gt.import(Ba),gt.import(Fa),gt.import(Ua);var ka=vi.prototype.addToScene,Va=vi.prototype.removeFromScene;vi.prototype.addToScene=function(e){if(ka.call(this,e),this.__zr){var t=this.__zr;e.traverse((function(e){e.__zr=t,e.addAnimatorsToZr&&e.addAnimatorsToZr(t)}))}},vi.prototype.removeFromScene=function(e){Va.call(this,e),e.traverse((function(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)}))},Ce.prototype.setTextureImage=function(e,t,r,i){if(this.shader){var n,a=r.getZr(),o=this;return o.autoUpdateTextureStatus=!1,o.disableTexture(e),za(t)||(n=Wa.loadTexture(t,r,i,(function(t){o.enableTexture(e),a&&a.refresh()})),o.set(e,n)),n}};var Wa={};Wa.Renderer=Pt,Wa.Node=dr,Wa.Mesh=wr,Wa.Shader=gt,Wa.Material=Ce,Wa.Texture=Tr,Wa.Texture2D=Dr,Wa.Geometry=Vr,Wa.SphereGeometry=oa,Wa.PlaneGeometry=ki,Wa.CubeGeometry=Xi,Wa.AmbientLight=la,Wa.DirectionalLight=ca,Wa.PointLight=da,Wa.SpotLight=pa,Wa.PerspectiveCamera=Si,Wa.OrthographicCamera=On,Wa.Vector2=Pe,Wa.Vector3=kt,Wa.Vector4=_a,Wa.Quaternion=ar,Wa.Matrix2=ba,Wa.Matrix2d=Ca,Wa.Matrix3=Ma,Wa.Matrix4=tr,Wa.Plane=ei,Wa.Ray=jt,Wa.BoundingBox=ur,Wa.Frustum=si;var ja=null;function Xa(){return null!==ja||(ja=Ln.createBlank("rgba(255,255,255,0)").image),ja}function qa(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Za(e){if((e.wrapS===Tr.REPEAT||e.wrapT===Tr.REPEAT)&&e.image){var t=qa(e.width),r=qa(e.height);if(t!==e.width||r!==e.height){var i=document.createElement("canvas");i.width=t,i.height=r;var n=i.getContext("2d");n.drawImage(e.image,0,0,t,r),e.image=i}}}Wa.loadTexture=function(e,t,r,i){"function"===typeof r&&(i=r,r={}),r=r||{};for(var n=Object.keys(r).sort(),a="",o=0;o<n.length;o++)a+=n[o]+"_"+r[n[o]]+"_";var s=t.__textureCache=t.__textureCache||new _i["a"](20);if(Ha(e)){var l=e.__textureid__,u=s.get(a+l);if(u)u.texture.surface.setECharts(e),i&&i(u.texture);else{var c=new In(e);c.onupdate=function(){t.getZr().refresh()},u={texture:c.getTexture()};for(o=0;o<n.length;o++)u.texture[n[o]]=r[n[o]];l=e.__textureid__||"__ecgl_ec__"+u.texture.__uid__,e.__textureid__=l,s.put(a+l,u),i&&i(u.texture)}return u.texture}if(Ga(e)){l=e.__textureid__,u=s.get(a+l);if(!u){u={texture:new Wa.Texture2D({image:e})};for(o=0;o<n.length;o++)u.texture[n[o]]=r[n[o]];l=e.__textureid__||"__ecgl_image__"+u.texture.__uid__,e.__textureid__=l,s.put(a+l,u),Za(u.texture),i&&i(u.texture)}return u.texture}u=s.get(a+e);if(u)u.callbacks?u.callbacks.push(i):i&&i(u.texture);else if(e.match(/.hdr$|^data:application\/octet-stream/)){u={callbacks:[i]};var h=Ln.loadTexture(e,{exposure:r.exposure,fileType:"hdr"},(function(){h.dirty(),u.callbacks.forEach((function(e){e&&e(h)})),u.callbacks=null}));u.texture=h,s.put(a+e,u)}else{for(h=new Wa.Texture2D({image:new Image}),o=0;o<n.length;o++)h[n[o]]=r[n[o]];u={texture:h,callbacks:[i]};var d=h.image;d.onload=function(){h.image=d,Za(h),h.dirty(),u.callbacks.forEach((function(e){e&&e(h)})),u.callbacks=null},d.crossOrigin="Anonymous",d.src=e,h.image=Xa(),s.put(a+e,u)}return u.texture},Wa.createAmbientCubemap=function(e,t,r,i){e=e||{};var n=e.texture,a=na.firstNotNull(e.exposure,1),o=new Zn({intensity:na.firstNotNull(e.specularIntensity,1)}),s=new Kn({intensity:na.firstNotNull(e.diffuseIntensity,1),coefficients:[.844,.712,.691,-.037,.083,.167,.343,.288,.299,-.041,-.021,-.009,-.003,-.041,-.064,-.011,-.007,-.004,-.031,.034,.081,-.06,-.049,-.06,.046,.056,.05]});return o.cubemap=Wa.loadTexture(n,r,{exposure:a},(function(){o.cubemap.flipY=!1,o.prefilter(t,32),s.coefficients=ra.projectEnvironmentMap(t,o.cubemap,{lod:1}),i&&i()})),{specular:o,diffuse:s}},Wa.createBlankTexture=Ln.createBlank,Wa.isImage=Ga,Wa.additiveBlend=function(e){e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)},Wa.parseColor=function(e,t){return e instanceof Array?(t||(t=[]),t[0]=e[0],t[1]=e[1],t[2]=e[2],e.length>3?t[3]=e[3]:t[3]=1,t):(t=L["h"].parse(e||"#000",t)||[0,0,0,0],t[0]/=255,t[1]/=255,t[2]/=255,t)},Wa.directionFromAlphaBeta=function(e,t){var r=e/180*Math.PI+Math.PI/2,i=-t/180*Math.PI+Math.PI/2,n=[],a=Math.sin(r);return n[0]=a*Math.cos(i),n[1]=-Math.cos(r),n[2]=a*Math.sin(i),n},Wa.getShadowResolution=function(e){var t=1024;switch(e){case"low":t=512;break;case"medium":break;case"high":t=2048;break;case"ultra":t=4096;break}return t},Wa.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],Wa.createShader=function(e){"ecgl.shadow"===e&&(e="ecgl.displayShadow");var t=gt.source(e+".vertex"),r=gt.source(e+".fragment");t||console.error("Vertex shader of '%s' not exits",e),r||console.error("Fragment shader of '%s' not exits",e);var i=new gt(t,r);return i.name=e,i},Wa.createMaterial=function(e,t){t instanceof Array||(t=[t]);var r=Wa.createShader(e),i=new Ce({shader:r});return t.forEach((function(e){"string"===typeof e&&i.define(e)})),i},Wa.setMaterialFromModel=function(e,t,r,i){t.autoUpdateTextureStatus=!1;var n=r.getModel(e+"Material"),a=n.get("detailTexture"),o=na.firstNotNull(n.get("textureTiling"),1),s=na.firstNotNull(n.get("textureOffset"),0);"number"===typeof o&&(o=[o,o]),"number"===typeof s&&(s=[s,s]);var l=o[0]>1||o[1]>1?Wa.Texture.REPEAT:Wa.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===e){var c=n.get("roughness"),h=n.get("metalness");null!=h?isNaN(h)&&(t.setTextureImage("metalnessMap",h,i,u),h=na.firstNotNull(n.get("metalnessAdjust"),.5)):h=0,null!=c?isNaN(c)&&(t.setTextureImage("roughnessMap",c,i,u),c=na.firstNotNull(n.get("roughnessAdjust"),.5)):c=.5;var d=n.get("normalTexture");t.setTextureImage("detailMap",a,i,u),t.setTextureImage("normalMap",d,i,u),t.set({roughness:c,metalness:h,detailUvRepeat:o,detailUvOffset:s})}else if("lambert"===e)t.setTextureImage("detailMap",a,i,u),t.set({detailUvRepeat:o,detailUvOffset:s});else if("color"===e)t.setTextureImage("detailMap",a,i,u),t.set({detailUvRepeat:o,detailUvOffset:s});else if("hatching"===e){var f=n.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)t.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:Wa.Texture.REPEAT,wrapT:Wa.Texture.REPEAT});t.set({detailUvRepeat:o,detailUvOffset:s})}},Wa.updateVertexAnimation=function(e,t,r,i){var n=i.get("animation"),a=i.get("animationDurationUpdate"),o=i.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(n&&t&&a>0&&t.geometry.vertexCount===r.geometry.vertexCount){r.material.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l<e.length;l++)r.geometry.attributes[e[l][0]].value=t.geometry.attributes[e[l][1]].value;r.geometry.dirty(),r.__percent=0,r.material.set("percent",0),r.stopAnimation(),r.animate().when(a,{__percent:1}).during((function(){r.material.set("percent",r.__percent),s&&s.set("percent",r.__percent)})).done((function(){r.ignorePreZ=!1,r.material.undefine("vertex","VERTEX_ANIMATION"),s&&s.undefine("vertex","VERTEX_ANIMATION")})).start(o)}else r.material.undefine("vertex","VERTEX_ANIMATION"),s&&s.undefine("vertex","VERTEX_ANIMATION")};var Ya=Wa,Ka=r("98b7"),$a=function(e,t){this.id=e,this.zr=t;try{this.renderer=new Pt({clearBit:0,devicePixelRatio:t.painter.dpr,preserveDrawingBuffer:!0,premultipliedAlpha:!0}),this.renderer.resize(t.painter.getWidth(),t.painter.getHeight())}catch(i){return this.renderer=null,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute; left: 0; top: 0; right: 0; bottom: 0;",this.dom.className="ecgl-nowebgl",this.dom.innerHTML="Sorry, your browser does not support WebGL",void console.error(i)}this.onglobalout=this.onglobalout.bind(this),t.on("globalout",this.onglobalout),this.dom=this.renderer.canvas;var r=this.dom.style;r.position="absolute",r.left="0",r.top="0",this.views=[],this._picking=new gr({renderer:this.renderer}),this._viewsToDispose=[],this._accumulatingId=0,this._zrEventProxy=new L["l"].Rect({shape:{x:-1,y:-1,width:2,height:2},__isGLToZRProxy:!0}),this._backgroundColor=null,this._disposed=!1};function Qa(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)}$a.prototype.setUnpainted=function(){},$a.prototype.addView=function(e){if(e.layer!==this){var t=this._viewsToDispose.indexOf(e);t>=0&&this._viewsToDispose.splice(t,1),this.views.push(e),e.layer=this;var r=this.zr;e.scene.traverse((function(e){e.__zr=r,e.addAnimatorsToZr&&e.addAnimatorsToZr(r)}))}},$a.prototype.removeView=function(e){if(e.layer===this){var t=this.views.indexOf(e);t>=0&&(this.views.splice(t,1),e.scene.traverse(Qa,this),e.layer=null,this._viewsToDispose.push(e))}},$a.prototype.removeViewsAll=function(){this.views.forEach((function(e){e.scene.traverse(Qa,this),e.layer=null,this._viewsToDispose.push(e)}),this),this.views.length=0},$a.prototype.resize=function(e,t){var r=this.renderer;r.resize(e,t)},$a.prototype.clear=function(){var e=this.renderer.gl,t=this._backgroundColor||[0,0,0,0];e.clearColor(t[0],t[1],t[2],t[3]),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT)},$a.prototype.clearDepth=function(){var e=this.renderer.gl;e.clear(e.DEPTH_BUFFER_BIT)},$a.prototype.clearColor=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},$a.prototype.needsRefresh=function(){this.zr.refresh()},$a.prototype.refresh=function(e){this._backgroundColor=e?Ya.parseColor(e):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var t=0;t<this.views.length;t++)this.views[t].prepareRender(this.renderer);this._doRender(!1),this._trackAndClean();for(t=0;t<this._viewsToDispose.length;t++)this._viewsToDispose[t].dispose(this.renderer);this._viewsToDispose.length=0,this._startAccumulating()},$a.prototype.renderToCanvas=function(e){this._startAccumulating(!0),e.drawImage(this.dom,0,0,e.canvas.width,e.canvas.height)},$a.prototype._doRender=function(e){this.clear(),this.renderer.saveViewport();for(var t=0;t<this.views.length;t++)this.views[t].render(this.renderer,e);this.renderer.restoreViewport()},$a.prototype._stopAccumulating=function(){this._accumulatingId=0,clearTimeout(this._accumulatingTimeout)};var Ja=1;function eo(e){for(var t=0;t<e.length;t++)e[t].__used__=0}function to(e,t){for(var r=0;r<t.length;r++)t[r].__used__||t[r].dispose(e)}function ro(e,t){e.__used__=e.__used__||0,e.__used__++,1===e.__used__&&t.push(e)}function io(e,t,r){var i,n;e.traverse((function(e){if(e.isRenderable()){var a=e.geometry,o=e.material;if(o!==i)for(var s=o.getTextureUniforms(),l=0;l<s.length;l++){var u=s[l],c=o.uniforms[u].value;if(c)if(c instanceof Tr)ro(c,t);else if(c instanceof Array)for(var h=0;h<c.length;h++)c[h]instanceof Tr&&ro(c[h],t)}a!==n&&ro(a,r),i=o,n=a}}));for(var a=0;a<e.lights.length;a++)e.lights[a].cubemap&&ro(e.lights[a].cubemap,t)}$a.prototype._startAccumulating=function(e){var t=this;this._stopAccumulating();for(var r=!1,i=0;i<this.views.length;i++)r=this.views[i].needsAccumulate()||r;function n(i){if(t._accumulatingId&&i===t._accumulatingId){for(var a=!0,o=0;o<t.views.length;o++)a=t.views[o].isAccumulateFinished()&&r;a||(t._doRender(!0),e?n(i):Object(Ka["a"])((function(){n(i)})))}}r&&(this._accumulatingId=Ja++,e?n(t._accumulatingId):this._accumulatingTimeout=setTimeout((function(){n(t._accumulatingId)}),50))},$a.prototype._trackAndClean=function(){var e=[],t=[];this._textureList&&(eo(this._textureList),eo(this._geometriesList));for(var r=0;r<this.views.length;r++)io(this.views[r].scene,e,t);this._textureList&&(to(this.renderer,this._textureList),to(this.renderer,this._geometriesList)),this._textureList=e,this._geometriesList=t},$a.prototype.dispose=function(){this._disposed||(this._stopAccumulating(),this._textureList&&(eo(this._textureList),eo(this._geometriesList),to(this.renderer,this._textureList),to(this.renderer,this._geometriesList)),this.zr.off("globalout",this.onglobalout),this._disposed=!0)},$a.prototype.onmousedown=function(e){if(!e.target||!e.target.__isGLToZRProxy){e=e.event;var t=this.pickObject(e.offsetX,e.offsetY);t&&(this._dispatchEvent("mousedown",e,t),this._dispatchDataEvent("mousedown",e,t)),this._downX=e.offsetX,this._downY=e.offsetY}},$a.prototype.onmousemove=function(e){if(!e.target||!e.target.__isGLToZRProxy){e=e.event;var t=this.pickObject(e.offsetX,e.offsetY),r=t&&t.target,i=this._hovered;this._hovered=t,i&&r!==i.target&&(i.relatedTarget=r,this._dispatchEvent("mouseout",e,i),this.zr.setCursorStyle("default")),this._dispatchEvent("mousemove",e,t),t&&(this.zr.setCursorStyle("pointer"),i&&r===i.target||this._dispatchEvent("mouseover",e,t)),this._dispatchDataEvent("mousemove",e,t)}},$a.prototype.onmouseup=function(e){if(!e.target||!e.target.__isGLToZRProxy){e=e.event;var t=this.pickObject(e.offsetX,e.offsetY);t&&(this._dispatchEvent("mouseup",e,t),this._dispatchDataEvent("mouseup",e,t)),this._upX=e.offsetX,this._upY=e.offsetY}},$a.prototype.onclick=$a.prototype.dblclick=function(e){if(!e.target||!e.target.__isGLToZRProxy){var t=this._upX-this._downX,r=this._upY-this._downY;if(!(Math.sqrt(t*t+r*r)>20)){e=e.event;var i=this.pickObject(e.offsetX,e.offsetY);i&&(this._dispatchEvent(e.type,e,i),this._dispatchDataEvent(e.type,e,i));var n=this._clickToSetFocusPoint(e);if(n){var a=n.view.setDOFFocusOnPoint(n.distance);a&&this.zr.refresh()}}}},$a.prototype._clickToSetFocusPoint=function(e){for(var t=this.renderer,r=t.viewport,i=this.views.length-1;i>=0;i--){var n=this.views[i];if(n.hasDOF()&&n.containPoint(e.offsetX,e.offsetY)){this._picking.scene=n.scene,this._picking.camera=n.camera,t.viewport=n.viewport;var a=this._picking.pick(e.offsetX,e.offsetY,!0);if(a)return a.view=n,a}}t.viewport=r},$a.prototype.onglobalout=function(e){var t=this._hovered;t&&this._dispatchEvent("mouseout",e,{target:t.target})},$a.prototype.pickObject=function(e,t){for(var r=[],i=this.renderer,n=i.viewport,a=0;a<this.views.length;a++){var o=this.views[a];o.containPoint(e,t)&&(this._picking.scene=o.scene,this._picking.camera=o.camera,i.viewport=o.viewport,this._picking.pickAll(e,t,r))}return i.viewport=n,r.sort((function(e,t){return e.distance-t.distance})),r[0]},$a.prototype._dispatchEvent=function(e,t,r){r||(r={});var i=r.target;r.cancelBubble=!1,r.event=t,r.type=e,r.offsetX=t.offsetX,r.offsetY=t.offsetY;while(i)if(i.trigger(e,r),i=i.getParent(),r.cancelBubble)break;this._dispatchToView(e,r)},$a.prototype._dispatchDataEvent=function(e,t,r){var i=r&&r.target,n=i&&i.dataIndex,a=i&&i.seriesIndex,o=i&&i.eventData,s=!1,l=this._zrEventProxy;l.x=t.offsetX,l.y=t.offsetY,l.update();var u={target:l};const c=L["m"].getECData(l);"mousemove"===e&&(null!=n?n!==this._lastDataIndex&&(parseInt(this._lastDataIndex,10)>=0&&(c.dataIndex=this._lastDataIndex,c.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",t)),s=!0):null!=o&&o!==this._lastEventData&&(null!=this._lastEventData&&(c.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",t)),s=!0),this._lastEventData=o,this._lastDataIndex=n,this._lastSeriesIndex=a),c.eventData=o,c.dataIndex=n,c.seriesIndex=a,(null!=o||parseInt(n,10)>=0&&parseInt(a,10)>=0)&&(this.zr.handler.dispatchToElement(u,e,t),s&&this.zr.handler.dispatchToElement(u,"mouseover",t))},$a.prototype._dispatchToView=function(e,t){for(var r=0;r<this.views.length;r++)this.views[r].containPoint(t.offsetX,t.offsetY)&&this.views[r].trigger(e,t)},Object.assign($a.prototype,G);var no=$a,ao=["bar3D","line3D","map3D","scatter3D","surface","lines3D","scatterGL","scatter3D"];function oo(e,t){if(e&&e[t]&&(e[t].normal||e[t].emphasis)){var r=e[t].normal,i=e[t].emphasis;r&&(e[t]=r),i&&(e.emphasis=e.emphasis||{},e.emphasis[t]=i)}}function so(e){oo(e,"itemStyle"),oo(e,"lineStyle"),oo(e,"areaStyle"),oo(e,"label")}function lo(e){e&&(e instanceof Array||(e=[e]),L["w"].each(e,(function(e){if(e.axisLabel){var t=e.axisLabel;Object.assign(t,t.textStyle),t.textStyle=null}})))}var uo=function(e){L["w"].each(e.series,(function(t){L["w"].indexOf(ao,t.type)>=0&&(so(t),"mapbox"===t.coordinateSystem&&(t.coordinateSystem="mapbox3D",e.mapbox3D=e.mapbox))})),lo(e.xAxis3D),lo(e.yAxis3D),lo(e.zAxis3D),lo(e.grid3D),oo(e.geo3D)};function co(e){this._layers={},this._zr=e}co.prototype.update=function(e,t){var r=this,i=t.getZr();if(i.getWidth()&&i.getHeight()){for(var n in this._layers)this._layers[n].removeViewsAll();e.eachComponent((function(r,i){if("series"!==r){var n=t.getViewOfComponentModel(i),s=i.coordinateSystem;if(n.__ecgl__){if(s){if(!s.viewGL)return void console.error("Can't find viewGL in coordinateSystem of component "+i.id);l=s.viewGL}else{if(!i.viewGL)return void console.error("Can't find viewGL of component "+i.id);l=s.viewGL}var l=s.viewGL,u=a(i);u.addView(l),n.afterRender&&n.afterRender(i,e,t,u),o(n.groupGL,i.get("silent"))}}})),e.eachSeries((function(r){var i=t.getViewOfSeriesModel(r),n=r.coordinateSystem;if(i.__ecgl__){if(n&&!n.viewGL&&!i.viewGL)return void console.error("Can't find viewGL of series "+i.id);var s=n&&n.viewGL||i.viewGL,l=a(r);l.addView(s),i.afterRender&&i.afterRender(r,e,t,l),o(i.groupGL,r.get("silent"))}}))}else console.warn("Dom has no width or height");function a(e){var t;i.setSleepAfterStill(0),t=(e.coordinateSystem&&e.coordinateSystem.model,e.get("zlevel"));var n=r._layers,a=n[t];if(!a){if(a=n[t]=new no("gl-"+t,i),i.painter.isSingleCanvas()){a.virtual=!0;var o=new L["l"].Image({z:1e4,style:{image:a.renderer.canvas},silent:!0});a.__hostImage=o,i.add(o)}i.painter.insertLayer(t,a)}return a.__hostImage&&a.__hostImage.setStyle({width:a.renderer.getWidth(),height:a.renderer.getHeight()}),a}function o(e,t){e&&e.traverse((function(e){e.isRenderable&&e.isRenderable()&&(e.ignorePicking=null!=e.$ignorePicking?e.$ignorePicking:t)}))}},L["s"]((function(e){var t=e.getZr(),r=t.painter.dispose;t.painter.dispose=function(){"function"===typeof this.eachOtherLayer&&this.eachOtherLayer((function(e){e instanceof no&&e.dispose()})),r.call(this)},t.painter.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas)return this._layers[0].dom;var t=document.createElement("canvas"),r=e.pixelRatio||this.dpr;t.width=this.getWidth()*r,t.height=this.getHeight()*r;var i=t.getContext("2d");i.dpr=r,i.clearRect(0,0,t.width,t.height),e.backgroundColor&&(i.fillStyle=e.backgroundColor,i.fillRect(0,0,t.width,t.height));var n,a=this.storage.getDisplayList(!0),o={},s=this;function l(e,t){var r,n=s._zlevelList;null==e&&(e=-1/0);for(var a=0;a<n.length;a++){var o=n[a],l=s._layers[o];if(!l.__builtin__&&o>e&&o<t){r=l;break}}r&&r.renderToCanvas&&(i.save(),r.renderToCanvas(i),i.restore())}for(var u={ctx:i},c=0;c<a.length;c++){var h=a[c];h.zlevel!==n&&(l(n,h.zlevel),n=h.zlevel),this._doPaintEl(h,u,!0,null,o)}return l(n,1/0),t}})),L["t"]((function(e,t){var r=t.getZr(),i=r.__egl=r.__egl||new co(r);i.update(e,t)})),L["u"](uo);var ho={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(e){e=e||{},this.option.viewControl=this.option.viewControl||{},null!=e.alpha&&(this.option.viewControl.alpha=e.alpha),null!=e.beta&&(this.option.viewControl.beta=e.beta),null!=e.distance&&(this.option.viewControl.distance=e.distance),null!=e.center&&(this.option.viewControl.center=e.center)}},fo={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},po={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}},mo=L["c"].extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});L["w"].merge(mo.prototype,ho),L["w"].merge(mo.prototype,fo),L["w"].merge(mo.prototype,po);var go=mo,vo=r("7837"),_o=na.firstNotNull,yo={left:0,middle:1,right:2};function xo(e){return e instanceof Array||(e=[e,e]),e}var To=q.extend((function(){return{zr:null,viewGL:null,_center:new kt,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new Pe,_panVelocity:new Pe,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}}),(function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach((function(e){this[e]=this[e].bind(this)}),this)}),{init:function(){var e=this.zr;e&&(e.on("mousedown",this._mouseDownHandler),e.on("globalout",this._mouseUpHandler),e.on("mousewheel",this._mouseWheelHandler),e.on("pinch",this._pinchHandler),e.animation.on("frame",this._update),e.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var e=this.zr;e&&(e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("pinch",this._pinchHandler),e.off("globalout",this._mouseUpHandler),e.dom.removeEventListener("contextmenu",this._contextMenuHandler),e.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(e){this._distance=e,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(e){this._orthoSize=e,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(e){e=Math.max(Math.min(this.maxAlpha,e),this.minAlpha),this._theta=e/180*Math.PI,this._needsUpdate=!0},setBeta:function(e){e=Math.max(Math.min(this.maxBeta,e),this.minBeta),this._phi=-e/180*Math.PI,this._needsUpdate=!0},setCenter:function(e){this._center.setArray(e)},setViewGL:function(e){this.viewGL=e},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(e,t){t=t||{};var r=t.baseDistance||0,i=t.baseOrthoSize||1,n=e.get("projection");"perspective"!==n&&"orthographic"!==n&&"isometric"!==n&&(n="perspective"),this._projection=n,this.viewGL.setProjection(n);var a=e.get("distance")+r,o=e.get("orthographicSize")+i;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach((function(t){this[t[0]]=_o(e.get(t[0]),t[1])}),this),this.minDistance+=r,this.maxDistance+=r,this.minOrthographicSize+=i,this.maxOrthographicSize+=i;var s=e.ecModel,l={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach((function(t){l[t]=_o(e.get(t),s&&s.get(t))}));var u=_o(t.alpha,e.get("alpha"))||0,c=_o(t.beta,e.get("beta"))||0,h=_o(t.center,e.get("center"))||[0,0,0];l.animation&&l.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:u,beta:c,center:h,distance:a,orthographicSize:o,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(u),this.setBeta(c),this.setCenter(h),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){0},animateTo:function(e){var t=this.zr,r=this,i={},n={};return null!=e.distance&&(i.distance=this.getDistance(),n.distance=e.distance),null!=e.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),n.orthographicSize=e.orthographicSize),null!=e.alpha&&(i.alpha=this.getAlpha(),n.alpha=e.alpha),null!=e.beta&&(i.beta=this.getBeta(),n.beta=e.beta),null!=e.center&&(i.center=this.getCenter(),n.center=e.center),this._addAnimator(t.animation.animate(i).when(e.duration||1e3,n).during((function(){null!=i.alpha&&r.setAlpha(i.alpha),null!=i.beta&&r.setBeta(i.beta),null!=i.distance&&r.setDistance(i.distance),null!=i.center&&r.setCenter(i.center),null!=i.orthographicSize&&r.setOrthographicSize(i.orthographicSize),r._needsUpdate=!0}))).start(e.easing||"linear")},stopAllAnimation:function(){for(var e=0;e<this._animators.length;e++)this._animators[e].stop();this._animators.length=0},update:function(){this._needsUpdate=!0,this._update(20)},_isAnimating:function(){return this._animators.length>0},_update:function(e){if(this._rotating){var t=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=t*e/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(e=Math.min(e,50),this._updateDistanceOrSize(e),this._updatePan(e),this._updateRotate(e),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(e){var t=this._rotateVelocity;this._phi=t.y*e/20+this._phi,this._theta=t.x*e/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(t,Math.pow(this.damping,e/16))},_updateDistanceOrSize:function(e){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*e/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*e/20),this._zoomSpeed*=Math.pow(this.damping,e/16)},_setDistance:function(e){this._distance=Math.max(Math.min(e,this.maxDistance),this.minDistance)},_setOrthoSize:function(e){this._orthoSize=Math.max(Math.min(e,this.maxOrthographicSize),this.minOrthographicSize);var t=this.getCamera(),r=this._orthoSize,i=r/this.viewGL.viewport.height*this.viewGL.viewport.width;t.left=-i/2,t.right=i/2,t.top=r/2,t.bottom=-r/2},_updatePan:function(e){var t=this._panVelocity,r=this._distance,i=this.getCamera(),n=i.worldTransform.y,a=i.worldTransform.x;this._center.scaleAndAdd(a,-t.x*r/200).scaleAndAdd(n,-t.y*r/200),this._vectorDamping(t,0)},_updateTransform:function(){var e=this.getCamera(),t=new kt,r=this._theta+Math.PI/2,i=this._phi+Math.PI/2,n=Math.sin(r);t.x=n*Math.cos(i),t.y=-Math.cos(r),t.z=n*Math.sin(i),e.position.copy(this._center).scaleAndAdd(t,this._distance),e.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var e=this.autoRotateAfterStill,t=this;!isNaN(e)&&e>0&&(this._stillTimeout=setTimeout((function(){t._rotating=!0}),1e3*e))},_vectorDamping:function(e,t){var r=e.len();r*=t,r<1e-4&&(r=0),e.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var e=this.getCamera().worldTransform.z,t=Math.asin(e.y),r=Math.atan2(e.x,e.z);this._theta=t,this._phi=-r,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(e){if(!e.target&&!this._isAnimating()){var t=e.offsetX,r=e.offsetY;this.viewGL&&!this.viewGL.containPoint(t,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),e.event.targetTouches?1===e.event.targetTouches.length&&(this._mode="rotate"):e.event.button===yo[this.rotateMouseButton]?this._mode="rotate":e.event.button===yo[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=e.offsetX,this._mouseY=e.offsetY)}},_mouseMoveHandler:function(e){if((!e.target||!e.target.__isGLToZRProxy)&&!this._isAnimating()){var t=xo(this.panSensitivity),r=xo(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(e.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(e.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):"pan"===this._mode&&(this._panVelocity.x=(e.offsetX-this._mouseX)/this.zr.getWidth()*t[0]*400,this._panVelocity.y=(-e.offsetY+this._mouseY)/this.zr.getHeight()*t[1]*400),this._mouseX=e.offsetX,this._mouseY=e.offsetY,e.event.preventDefault()}},_mouseWheelHandler:function(e){if(!this._isAnimating()){var t=e.event.wheelDelta||-e.event.detail;this._zoomHandler(e,t)}},_pinchHandler:function(e){this._isAnimating()||(this._zoomHandler(e,e.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(e,t){if(0!==t){var r,i=e.offsetX,n=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(i,n))r="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(t>0?-1:1)*r*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),e.event.preventDefault()}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(e){this._isRightMouseButtonUsed()&&e.preventDefault()},_addAnimator:function(e){var t=this._animators;return t.push(e),e.done((function(){var r=t.indexOf(e);r>=0&&t.splice(r,1)})),e}});Object.defineProperty(To.prototype,"autoRotate",{get:function(e){return this._autoRotate},set:function(e){this._autoRotate=e,this._rotating=e}});var bo=To,wo={convertToDynamicArray:function(e){e&&this.resetOffset();var t=this.attributes;for(var r in t)e||!t[r].value?t[r].value=[]:t[r].value=Array.prototype.slice.call(t[r].value);e||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var e=this.attributes;for(var t in e)e[t].value&&e[t].value.length>0?e[t].value=new Float32Array(e[t].value):e[t].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},Eo={vec2:Ne,vec3:Tt,vec4:qt,mat2:xa,mat2d:Ea,mat3:Yt,mat4:yt,quat:$t},So=Eo,Co=So.vec3,Ao=[[0,0],[1,1]],Mo=Vr.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),positionPrev:new Vr.Attribute("positionPrev","float",3),positionNext:new Vr.Attribute("positionNext","float",3),prevPositionPrev:new Vr.Attribute("prevPositionPrev","float",3),prevPosition:new Vr.Attribute("prevPosition","float",3),prevPositionNext:new Vr.Attribute("prevPositionNext","float",3),offset:new Vr.Attribute("offset","float",1),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(e){var t=this.attributes;this.vertexCount!==e&&(t.position.init(e),t.color.init(e),this.useNativeLine||(t.positionPrev.init(e),t.positionNext.init(e),t.offset.init(e)),e>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){var n=Co.dist(e,t)+Co.dist(r,t)+Co.dist(i,r),a=1/(n+1)*this.segmentScale;return a},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(Ao)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(Ao)},getPolylineVertexCount:function(e){var t;if("number"===typeof e)t=e;else{var r="number"!==typeof e[0];t=r?e.length:e.length/3}return this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;if("number"===typeof e)t=e;else{var r="number"!==typeof e[0];t=r?e.length:e.length/3}return this.useNativeLine?0:2*Math.max(t-1,0)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=e[2],u=t[0],c=t[1],h=t[2],d=r[0],f=r[1],p=r[2],m=i[0],g=i[1],v=i[2],_=this._getCubicCurveApproxStep(e,t,r,i),y=_*_,x=y*_,T=3*_,b=3*y,w=6*y,E=6*x,S=o-2*u+d,C=s-2*c+f,A=l-2*h+p,M=3*(u-d)-o+m,L=3*(c-f)-s+g,D=3*(h-p)-l+v,N=o,R=s,I=l,P=(u-o)*T+S*b+M*x,O=(c-s)*T+C*b+L*x,B=(h-l)*T+A*b+D*x,F=S*w+M*E,U=C*w+L*E,z=A*w+D*E,G=M*E,H=L*E,k=D*E,V=0,W=0,j=Math.ceil(1/_),X=new Float32Array(3*(j+1)),q=(X=[],0);for(W=0;W<j+1;W++)X[q++]=N,X[q++]=R,X[q++]=I,N+=P,R+=O,I+=B,P+=F,O+=U,B+=z,F+=G,U+=H,z+=k,V+=_,V>1&&(N=P>0?Math.min(N,m):Math.max(N,m),R=O>0?Math.min(R,g):Math.max(R,g),I=B>0?Math.min(I,v):Math.max(I,v));return this.addPolyline(X,n,a)},addLine:function(e,t,r,i){return this.addPolyline([e,t],r,i)},addPolyline:function(e,t,r,i,n){if(e.length){var a="number"!==typeof e[0];if(null==n&&(n=a?e.length:e.length/3),!(n<2)){null==i&&(i=0),null==r&&(r=1),this._itemVertexOffsets.push(this._vertexOffset);a="number"!==typeof e[0];var o,s,l=a?"number"!==typeof t[0]:t.length/4===n,u=this.attributes.position,c=this.attributes.positionPrev,h=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,m=this._vertexOffset;r=Math.max(r,.01);for(var g=i;g<n;g++){if(a)o=e[g],s=l?t[g]:t;else{var v=3*g;if(o=o||[],o[0]=e[v],o[1]=e[v+1],o[2]=e[v+2],l){var _=4*g;s=s||[],s[0]=t[_],s[1]=t[_+1],s[2]=t[_+2],s[3]=t[_+3]}else s=t}if(this.useNativeLine?g>1&&(u.copy(m,m-1),d.copy(m,m-1),m++):(g<n-1&&(c.set(m+2,o),c.set(m+3,o)),g>0&&(h.set(m-2,o),h.set(m-1,o)),u.set(m,o),u.set(m+1,o),d.set(m,s),d.set(m+1,s),f.set(m,r/2),f.set(m+1,-r/2),m+=2),this.useNativeLine)d.set(m,s),u.set(m,o),m++;else if(g>0){var y=3*this._triangleOffset;p=this.indices;p[y]=m-4,p[y+1]=m-3,p[y+2]=m-2,p[y+3]=m-3,p[y+4]=m-1,p[y+5]=m-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,T=this._vertexOffset+2*n;c.copy(x,x+2),c.copy(x+1,x+3),h.copy(T-1,T-3),h.copy(T-2,T-4)}return this._vertexOffset=m,this._vertexOffset}}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=e<this._itemVertexOffsets.length-1?this._itemVertexOffsets[e+1]:this._vertexOffset,n=r;n<i;n++)this.attributes.color.set(n,t);this.dirty("color")},currentTriangleOffset:function(){return this._triangleOffset},currentVertexOffset:function(){return this._vertexOffset}});L["w"].defaults(Mo.prototype,wo);var Lo=Mo;function Do(e,t,r,i,n,a,o){this._zr=e,this._x=0,this._y=0,this._rowHeight=0,this.width=i,this.height=n,this.offsetX=t,this.offsetY=r,this.dpr=o,this.gap=a}function No(e){e=e||{},e.width=e.width||512,e.height=e.height||512,e.devicePixelRatio=e.devicePixelRatio||1,e.gap=null==e.gap?2:e.gap;var t=document.createElement("canvas");t.width=e.width*e.devicePixelRatio,t.height=e.height*e.devicePixelRatio,this._canvas=t,this._texture=new Dr({image:t,flipY:!1});var r=this;this._zr=L["x"].init(t);var i=this._zr.refreshImmediately;this._zr.refreshImmediately=function(){i.call(this),r._texture.dirty(),r.onupdate&&r.onupdate()},this._dpr=e.devicePixelRatio,this._coords={},this.onupdate=e.onupdate,this._gap=e.gap,this._textureAtlasNodes=[new Do(this._zr,0,0,e.width,e.height,this._gap,this._dpr)],this._nodeWidth=e.width,this._nodeHeight=e.height,this._currentNodeIdx=0}Do.prototype={constructor:Do,clear:function(){this._x=0,this._y=0,this._rowHeight=0},add:function(e,t,r){var i=e.getBoundingRect();null==t&&(t=i.width),null==r&&(r=i.height),t*=this.dpr,r*=this.dpr,this._fitElement(e,t,r);var n=this._x,a=this._y,o=this.width*this.dpr,s=this.height*this.dpr,l=this.gap;if(n+t+l>o&&(n=this._x=0,a+=this._rowHeight+l,this._y=a,this._rowHeight=0),this._x+=t+l,this._rowHeight=Math.max(this._rowHeight,r),a+r+l>s)return null;e.x+=this.offsetX*this.dpr+n,e.y+=this.offsetY*this.dpr+a,this._zr.add(e);var u=[this.offsetX/this.width,this.offsetY/this.height],c=[[n/o+u[0],a/s+u[1]],[(n+t)/o+u[0],(a+r)/s+u[1]]];return c},_fitElement:function(e,t,r){var i=e.getBoundingRect(),n=t/i.width,a=r/i.height;e.x=-i.x*n,e.y=-i.y*a,e.scaleX=n,e.scaleY=a,e.update()}},No.prototype={clear:function(){for(var e=0;e<this._textureAtlasNodes.length;e++)this._textureAtlasNodes[e].clear();this._currentNodeIdx=0,this._zr.clear(),this._coords={}},getWidth:function(){return this._width},getHeight:function(){return this._height},getTexture:function(){return this._texture},getDevicePixelRatio:function(){return this._dpr},getZr:function(){return this._zr},_getCurrentNode:function(){return this._textureAtlasNodes[this._currentNodeIdx]},_expand:function(){if(this._currentNodeIdx++,this._textureAtlasNodes[this._currentNodeIdx])return this._textureAtlasNodes[this._currentNodeIdx];var e=4096/this._dpr,t=this._textureAtlasNodes,r=t.length,i=r*this._nodeWidth%e,n=Math.floor(r*this._nodeWidth/e)*this._nodeHeight;if(!(n>=e)){var a=(i+this._nodeWidth)*this._dpr,o=(n+this._nodeHeight)*this._dpr;try{this._zr.resize({width:a,height:o})}catch(l){this._canvas.width=a,this._canvas.height=o}var s=new Do(this._zr,i,n,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(s),s}},add:function(e,t,r){if(this._coords[e.id])return this._coords[e.id];var i=this._getCurrentNode().add(e,t,r);if(!i){var n=this._expand();if(!n)return;i=n.add(e,t,r)}return this._coords[e.id]=i,i},getCoordsScale:function(){var e=this._dpr;return[this._nodeWidth/this._canvas.width*e,this._nodeHeight/this._canvas.height*e]},getCoords:function(e){return this._coords[e]},dispose:function(){this._zr.dispose()}};var Ro=No;function Io(){}Io.prototype={constructor:Io,setScene:function(e){this._scene=e,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(e){this._lightRoot=e,this.mainLight=new Ya.DirectionalLight({shadowBias:.005}),this.ambientLight=new Ya.AmbientLight,e.add(this.mainLight),e.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(e){var t=this.mainLight,r=this.ambientLight,i=e.getModel("light"),n=i.getModel("main"),a=i.getModel("ambient");t.intensity=n.get("intensity"),r.intensity=a.get("intensity"),t.color=Ya.parseColor(n.get("color")).slice(0,3),r.color=Ya.parseColor(a.get("color")).slice(0,3);var o=n.get("alpha")||0,s=n.get("beta")||0;t.position.setArray(Ya.directionFromAlphaBeta(o,s)),t.lookAt(Ya.Vector3.ZERO),t.castShadow=n.get("shadow"),t.shadowResolution=Ya.getShadowResolution(n.get("shadowQuality"))},updateAmbientCubemap:function(e,t,r){var i=t.getModel("light.ambientCubemap"),n=i.get("texture");if(n){this._cubemapLightsCache=this._cubemapLightsCache||{};var a=this._cubemapLightsCache[n];if(!a){var o=this;a=this._cubemapLightsCache[n]=Ya.createAmbientCubemap(i.option,e,r,(function(){o._isSkyboxFromAmbientCubemap&&o._skybox.setEnvironmentMap(a.specular.cubemap),r.getZr().refresh()}))}this._lightRoot.add(a.diffuse),this._lightRoot.add(a.specular),this._currentCubemapLights=a}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(e,t,r){var i=t.get("environment"),n=this;function a(){return n._skybox=n._skybox||new Yi,n._skybox}var o=a();if(i&&"none"!==i)if("auto"===i)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var s=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(s),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"===typeof i&&i.colorStops||"string"===typeof i&&L["h"].parse(i)){this._isSkyboxFromAmbientCubemap=!1;var l=new Ya.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(l);var u=l.image=document.createElement("canvas");u.width=u.height=16;var c=u.getContext("2d"),h=new L["l"].Rect({shape:{x:0,y:0,width:16,height:16},style:{fill:i}});L["o"](c,h),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;l=Ya.loadTexture(i,r,{anisotropic:8,flipY:!1});o.setEnvironmentMap(l),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var d=t.coordinateSystem;if(this._skybox)if(!d||!d.viewGL||"auto"===i||i.match&&i.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var f=d.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[f]("fragment","SRGB_DECODE")}}};var Po=Io,Oo=So.vec3,Bo=Vr.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(e){var t=this.attributes,r=this.getQuadVertexCount()*e,i=this.getQuadTriangleCount()*e;this.vertexCount!==r&&(t.position.init(r),t.normal.init(r),t.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var e=Oo.create(),t=Oo.create(),r=Oo.create(),i=[0,3,1,3,2,1];return function(n,a){var o=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;Oo.sub(e,n[1],n[0]),Oo.sub(t,n[2],n[1]),Oo.cross(r,e,t),Oo.normalize(r,r);for(var u=0;u<4;u++)o.set(this._vertexOffset+u,n[u]),l.set(this._vertexOffset+u,a),s.set(this._vertexOffset+u,r);var c=3*this._faceOffset;for(u=0;u<6;u++)this.indices[c+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});L["w"].defaults(Bo.prototype,wo);var Fo=Bo,Uo=na.firstNotNull,zo={x:0,y:2,z:1};function Go(e,t,r,i){var n=[0,0,0],a=i<0?r.getExtentMin():r.getExtentMax();n[zo[r.dim]]=a,e.position.setArray(n),e.rotation.identity(),t.distance=-Math.abs(a),t.normal.set(0,0,0),"x"===r.dim?(e.rotation.rotateY(i*Math.PI/2),t.normal.x=-i):"z"===r.dim?(e.rotation.rotateX(-i*Math.PI/2),t.normal.y=-i):(i>0&&e.rotation.rotateY(Math.PI),t.normal.z=-i)}function Ho(e,t,r){this.rootNode=new Ya.Node;var i=new Ya.Mesh({geometry:new Lo({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),n=new Ya.Mesh({geometry:new Fo,material:r,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(n),this.rootNode.add(i),this.faceInfo=e,this.plane=new Ya.Plane,this.linesMesh=i,this.quadsMesh=n}Ho.prototype.update=function(e,t,r){var i=e.coordinateSystem,n=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],a=this.linesMesh.geometry,o=this.quadsMesh.geometry;a.convertToDynamicArray(!0),o.convertToDynamicArray(!0),this._updateSplitLines(a,n,e,r),this._udpateSplitAreas(o,n,e,r),a.convertToTypedArray(),o.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);Go(this.rootNode,this.plane,s,this.faceInfo[3])},Ho.prototype._updateSplitLines=function(e,t,r,i){var n=i.getDevicePixelRatio();t.forEach((function(i,a){var o=i.model,s=t[1-a].getExtent();if(!i.scale.isBlank()){var l=o.getModel("splitLine",r.getModel("splitLine"));if(l.get("show")){var u=l.getModel("lineStyle"),c=u.get("color"),h=Uo(u.get("opacity"),1),d=Uo(u.get("width"),1);c=L["w"].isArray(c)?c:[c];for(var f=i.getTicksCoords({tickModel:l}),p=0,m=0;m<f.length;m++){var g=f[m].coord,v=Ya.parseColor(c[p%c.length]);v[3]*=h;var _=[0,0,0],y=[0,0,0];_[a]=y[a]=g,_[1-a]=s[0],y[1-a]=s[1],e.addLine(_,y,v,d*n),p++}}}}))},Ho.prototype._udpateSplitAreas=function(e,t,r,i){t.forEach((function(i,n){var a=i.model,o=t[1-n].getExtent();if(!i.scale.isBlank()){var s=a.getModel("splitArea",r.getModel("splitArea"));if(s.get("show")){var l=s.getModel("areaStyle"),u=l.get("color"),c=Uo(l.get("opacity"),1);u=L["w"].isArray(u)?u:[u];for(var h=i.getTicksCoords({tickModel:s,clamp:!0}),d=0,f=[0,0,0],p=[0,0,0],m=0;m<h.length;m++){var g=h[m].coord,v=[0,0,0],_=[0,0,0];if(v[n]=_[n]=g,v[1-n]=o[0],_[1-n]=o[1],0!==m){var y=Ya.parseColor(u[d%u.length]);y[3]*=c,e.addQuad([f,v,_,p],y),f=v,p=_,d++}else f=v,p=_}}}}))};var ko=Ho,Vo=[0,1,2,0,2,3],Wo=Vr.extend((function(){return{attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),texcoord:new Vr.Attribute("texcoord","float",2,"TEXCOORD_0"),offset:new Vr.Attribute("offset","float",2),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setSpriteCount:function(e){this._spriteCount=e;var t=4*e,r=2*e;this.vertexCount!==t&&(this.attributes.position.init(t),this.attributes.offset.init(t),this.attributes.color.init(t)),this.triangleCount!==r&&(this.indices=t>65535?new Uint32Array(3*r):new Uint16Array(3*r))},setSpriteAlign:function(e,t,r,i,n){var a,o,s,l;switch(null==r&&(r="left"),null==i&&(i="top"),n=n||0,r){case"left":a=n,s=t[0]+n;break;case"center":case"middle":a=-t[0]/2,s=t[0]/2;break;case"right":a=-t[0]-n,s=-n;break}switch(i){case"bottom":o=n,l=t[1]+n;break;case"middle":o=-t[1]/2,l=t[1]/2;break;case"top":o=-t[1]-n,l=-n;break}var u=4*e,c=this.attributes.offset;c.set(u,[a,l]),c.set(u+1,[s,l]),c.set(u+2,[s,o]),c.set(u+3,[a,o])},addSprite:function(e,t,r,i,n,a){var o=this._vertexOffset;this.setSprite(this._vertexOffset/4,e,t,r,i,n,a);for(var s=0;s<Vo.length;s++)this.indices[3*this._faceOffset+s]=Vo[s]+o;return this._faceOffset+=2,this._vertexOffset+=4,o/4},setSprite:function(e,t,r,i,n,a,o){for(var s=4*e,l=this.attributes,u=0;u<4;u++)l.position.set(s+u,t);var c=l.texcoord;c.set(s,[i[0][0],i[0][1]]),c.set(s+1,[i[1][0],i[0][1]]),c.set(s+2,[i[1][0],i[1][1]]),c.set(s+3,[i[0][0],i[1][1]]),this.setSpriteAlign(e,r,n,a,o)}});L["w"].defaults(Wo.prototype,wo);var jo=Wo,Xo="@export ecgl.labels.vertex\n\nattribute vec3 position: POSITION;\nattribute vec2 texcoord: TEXCOORD_0;\nattribute vec2 offset;\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n vec4 proj = worldViewProjection * vec4(position, 1.0);\n\n vec2 screen = (proj.xy / abs(proj.w) + 1.0) * 0.5 * viewport.zw;\n\n screen += offset;\n\n proj.xy = (screen / viewport.zw - 0.5) * 2.0 * abs(proj.w);\n gl_Position = proj;\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n v_Texcoord = texcoord;\n}\n@end\n\n\n@export ecgl.labels.fragment\n\nuniform vec3 color : [1.0, 1.0, 1.0];\nuniform float alpha : 1.0;\nuniform sampler2D textureAtlas;\nuniform vec2 uvScale: [1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\nvarying float v_Miter;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color, alpha) * texture2D(textureAtlas, v_Texcoord * uvScale);\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n}\n\n@end";Ya.Shader.import(Xo);var qo=Ya.Mesh.extend((function(){var e=new jo({dynamic:!0}),t=new Ya.Material({shader:Ya.createShader("ecgl.labels"),transparent:!0,depthMask:!1});return{geometry:e,material:t,culling:!1,castShadow:!1,ignorePicking:!0}})),Zo=na.firstNotNull,Yo={x:0,y:2,z:1};function Ko(e,t){var r=new Ya.Mesh({geometry:new Lo({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,renderOrder:2}),i=new qo;i.material.depthMask=!1;var n=new Ya.Node;n.add(r),n.add(i),this.rootNode=n,this.dim=e,this.linesMesh=r,this.labelsMesh=i,this.axisLineCoords=null,this.labelElements=[]}var $o={x:"y",y:"x",z:"y"};Ko.prototype.update=function(e,t,r){var i=e.coordinateSystem,n=i.getAxis(this.dim),a=this.linesMesh.geometry,o=this.labelsMesh.geometry;a.convertToDynamicArray(!0),o.convertToDynamicArray(!0);var s=n.model,l=n.getExtent(),u=r.getDevicePixelRatio(),c=s.getModel("axisLine",e.getModel("axisLine")),h=s.getModel("axisTick",e.getModel("axisTick")),d=s.getModel("axisLabel",e.getModel("axisLabel")),f=c.get("lineStyle.color");if(c.get("show")){var p=c.getModel("lineStyle"),m=[0,0,0],g=[0,0,0],v=Yo[n.dim];m[v]=l[0],g[v]=l[1],this.axisLineCoords=[m,g];var _=Ya.parseColor(f),y=Zo(p.get("width"),1),x=Zo(p.get("opacity"),1);_[3]*=x,a.addLine(m,g,_,y*u)}if(h.get("show")){var T=h.getModel("lineStyle"),b=Ya.parseColor(Zo(T.get("color"),f));y=Zo(T.get("width"),1);b[3]*=Zo(T.get("opacity"),1);for(var w=n.getTicksCoords(),E=h.get("length"),S=0;S<w.length;S++){var C=w[S].coord,A=(m=[0,0,0],g=[0,0,0],v=Yo[n.dim],Yo[$o[n.dim]]);m[v]=g[v]=C,g[A]=E,a.addLine(m,g,b,y*u)}}this.labelElements=[];u=r.getDevicePixelRatio();if(d.get("show")){w=n.getTicksCoords();var M=s.get("data"),D=d.get("margin"),N=n.getViewLabels();for(S=0;S<N.length;S++){var R=N[S].tickValue,I=N[S].formattedLabel,P=N[S].rawLabel,O=(C=n.dataToCoord(R),[0,0,0]);v=Yo[n.dim],A=Yo[$o[n.dim]];O[v]=O[v]=C,O[A]=D;var B=d;M&&M[R]&&M[R].textStyle&&(B=new L["f"](M[R].textStyle,d,s.ecModel));var F=Zo(B.get("color"),f),U=new L["l"].Text({style:Object(vo["c"])(B,{text:I,fill:"function"===typeof F?F("category"===n.type?P:"value"===n.type?R+"":R,S):F,verticalAlign:"top",align:"left"})}),z=t.add(U),G=U.getBoundingRect();o.addSprite(O,[G.width*u,G.height*u],z),this.labelElements.push(U)}}if(s.get("name")){var H=s.getModel("nameTextStyle"),k=(O=[0,0,0],v=Yo[n.dim],A=Yo[$o[n.dim]],Zo(H.get("color"),f)),V=H.get("borderColor");y=H.get("borderWidth");O[v]=O[v]=(l[0]+l[1])/2,O[A]=s.get("nameGap");U=new L["l"].Text({style:Object(vo["c"])(H,{text:s.get("name"),fill:k,stroke:V,lineWidth:y})}),z=t.add(U),G=U.getBoundingRect();o.addSprite(O,[G.width*u,G.height*u],z),U.__idx=this.labelElements.length,this.nameLabelElement=U}this.labelsMesh.material.set("textureAtlas",t.getTexture()),this.labelsMesh.material.set("uvScale",t.getCoordsScale()),a.convertToTypedArray(),o.convertToTypedArray()},Ko.prototype.setSpriteAlign=function(e,t,r){for(var i=r.getDevicePixelRatio(),n=this.labelsMesh.geometry,a=0;a<this.labelElements.length;a++){var o=this.labelElements[a],s=o.getBoundingRect();n.setSpriteAlign(a,[s.width*i,s.height*i],e,t)}var l=this.nameLabelElement;if(l){s=l.getBoundingRect();n.setSpriteAlign(l.__idx,[s.width*i,s.height*i],e,t),n.dirty()}this.textAlign=e,this.textVerticalAlign=t};var Qo=Ko,Jo="@export ecgl.lines3D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, 1.0);\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n}\n@end\n\n\n\n@export ecgl.lines3D.clipNear\n\nvec4 clipNear(vec4 p1, vec4 p2) {\n float n = (p1.w - near) / (p1.w - p2.w);\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\n}\n\n@end\n\n@export ecgl.lines3D.expandLine\n#ifdef VERTEX_ANIMATION\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\n#else\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\n#endif\n\n if (currProj.w < 0.0) {\n if (nextProj.w > 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end",es=na.firstNotNull;Ya.Shader.import(Jo);var ts={x:0,y:2,z:1},rs=L["d"].extend({type:"grid3D",__ecgl__:!0,init:function(e,t){var r=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]],i=["x","y","z"],n=new Ya.Material({shader:Ya.createShader("ecgl.color"),depthMask:!1,transparent:!0}),a=new Ya.Material({shader:Ya.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new Ya.Node,this._control=new bo({zr:t.getZr()}),this._control.init(),this._faces=r.map((function(e){var t=new ko(e,a,n);return this.groupGL.add(t.rootNode),t}),this),this._axes=i.map((function(e){var t=new Qo(e,a);return this.groupGL.add(t.rootNode),t}),this);var o=t.getDevicePixelRatio();this._axisLabelSurface=new Ro({width:256,height:256,devicePixelRatio:o}),this._axisLabelSurface.onupdate=function(){t.getZr().refresh()},this._axisPointerLineMesh=new Ya.Mesh({geometry:new Lo({useNativeLine:!1}),material:a,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new Ro({width:128,height:128,devicePixelRatio:o}),this._axisPointerLabelsMesh=new qo({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new Ya.Node,this._sceneHelper=new Po,this._sceneHelper.initLight(this._lightRoot)},render:function(e,t,r){this._model=e,this._api=r;var i=e.coordinateSystem;i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var n=this._control;n.setViewGL(i.viewGL);var a=e.getModel("viewControl");n.setFromViewControlModel(a,0),this._axisLabelSurface.clear(),n.off("update"),e.get("show")&&(this._faces.forEach((function(i){i.update(e,t,r)}),this),this._axes.forEach((function(t){t.update(e,this._axisLabelSurface,r)}),this)),n.on("update",this._onCameraChange.bind(this,e,r),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(e),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._initMouseHandler(e)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},showAxisPointer:function(e,t,r,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(e,t,r,i){this._doHideAxisPointer()},_initMouseHandler:function(e){var t=e.coordinateSystem,r=t.viewGL;e.get("show")&&e.get("axisPointer.show")?r.on("mousemove",this._updateAxisPointerOnMousePosition,this):r.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(e){if(!e.target){for(var t,r=this._model,i=r.coordinateSystem,n=i.viewGL,a=n.castRay(e.offsetX,e.offsetY,new Ya.Ray),o=0;o<this._faces.length;o++){var s=this._faces[o];if(!s.rootNode.invisible){s.plane.normal.dot(n.camera.worldTransform.z)<0&&s.plane.normal.negate();var l=a.intersectPlane(s.plane);if(l){var u=i.getAxis(s.faceInfo[0]),c=i.getAxis(s.faceInfo[1]),h=ts[s.faceInfo[0]],d=ts[s.faceInfo[1]];u.contain(l.array[h])&&c.contain(l.array[d])&&(t=l)}}}if(t){var f=i.pointToData(t.array,[],!0);this._updateAxisPointer(f),this._doShowAxisPointer()}else this._doHideAxisPointer()}},_onCameraChange:function(e,t){e.get("show")&&(this._updateFaceVisibility(),this._updateAxisLinePosition());var r=this._control;t.dispatchAction({type:"grid3DChangeCamera",alpha:r.getAlpha(),beta:r.getBeta(),distance:r.getDistance(),center:r.getCenter(),from:this.uid,grid3DId:e.id})},_updateFaceVisibility:function(){var e=this._control.getCamera(),t=new Ya.Vector3;e.update();for(var r=0;r<this._faces.length/2;r++){for(var i=[],n=0;n<2;n++){var a=this._faces[2*r+n];a.rootNode.getWorldPosition(t),t.transformMat4(e.viewMatrix),i[n]=t.z}var o=i[0]>i[1]?0:1,s=this._faces[2*r+o],l=this._faces[2*r+1-o];s.rootNode.invisible=!0,l.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var e=this._model.coordinateSystem,t=e.getAxis("x"),r=e.getAxis("y"),i=e.getAxis("z"),n=i.getExtentMax(),a=i.getExtentMin(),o=t.getExtentMin(),s=t.getExtentMax(),l=r.getExtentMax(),u=r.getExtentMin(),c=this._axes[0].rootNode,h=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?u:l,m=f[2].rootNode.invisible?n:a,g=f[0].rootNode.invisible?o:s,v=f[2].rootNode.invisible?n:a,_=f[0].rootNode.invisible?s:o,y=f[4].rootNode.invisible?u:l;c.rotation.identity(),h.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,c.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,h.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),c.position.set(0,m,p),h.position.set(g,v,0),d.position.set(_,0,y),c.update(),h.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var e=this._control.getCamera(),t=[new Ya.Vector4,new Ya.Vector4],r=new Ya.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach((function(i){for(var n=i.axisLineCoords,a=(i.labelsMesh.geometry,0);a<t.length;a++)t[a].setArray(n[a]),t[a].w=1,t[a].transformMat4(i.rootNode.worldTransform).transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),t[a].x/=t[a].w,t[a].y/=t[a].w;var o,s,l=t[1].x-t[0].x,u=t[1].y-t[0].y,c=(t[1].x+t[0].x)/2,h=(t[1].y+t[0].y)/2;Math.abs(u/l)<.5?(o="center",s=h>r.y?"bottom":"top"):(s="middle",o=c>r.x?"left":"right"),i.setSpriteAlign(o,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(e){var t=this._model.coordinateSystem,r=t.dataToPoint(e),i=this._axisPointerLineMesh,n=i.geometry,a=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function s(e){return na.firstNotNull(e.model.get("axisPointer.show"),a.get("show"))}function l(e){var t=e.model.getModel("axisPointer",a),r=t.getModel("lineStyle"),i=Ya.parseColor(r.get("color")),n=es(r.get("width"),1),o=es(r.get("opacity"),1);return i[3]*=o,{color:i,lineWidth:n}}n.convertToDynamicArray(!0);for(var u=0;u<this._faces.length;u++){var c=this._faces[u];if(!c.rootNode.invisible){for(var h=c.faceInfo,d=h[3]<0?t.getAxis(h[2]).getExtentMin():t.getAxis(h[2]).getExtentMax(),f=ts[h[2]],p=0;p<2;p++){var m=h[p],g=h[1-p],v=t.getAxis(m),_=t.getAxis(g);if(s(v)){var y=[0,0,0],x=[0,0,0],T=ts[m],b=ts[g];y[T]=x[T]=r[T],y[f]=x[f]=d,y[b]=_.getExtentMin(),x[b]=_.getExtentMax();var w=l(v);n.addLine(y,x,w.color,w.lineWidth*o)}}if(s(t.getAxis(h[2]))){y=r.slice(),x=r.slice();x[f]=d;w=l(t.getAxis(h[2]));n.addLine(y,x,w.color,w.lineWidth*o)}}}n.convertToTypedArray(),this._updateAxisPointerLabelsMesh(e),this._api.getZr().refresh()},_updateAxisPointerLabelsMesh:function(e){var t=this._model,r=this._axisPointerLabelsMesh,i=this._axisPointerLabelsSurface,n=t.coordinateSystem,a=t.getModel("axisPointer");r.geometry.convertToDynamicArray(!0),i.clear();var o={x:"y",y:"x",z:"y"};this._axes.forEach((function(t,s){var l=n.getAxis(t.dim),u=l.model,c=u.getModel("axisPointer",a),h=c.getModel("label"),d=c.get("lineStyle.color");if(h.get("show")&&c.get("show")){var f=e[s],p=h.get("formatter"),m=l.scale.getLabel({value:f});if(null!=p)m=p(m,e);else if("interval"===l.scale.type||"log"===l.scale.type){var g=L["p"].getPrecisionSafe(l.scale.getTicks()[0]);m=f.toFixed(g+2)}var v=h.get("color"),_=new L["l"].Text({style:Object(vo["c"])(h,{text:m,fill:v||d,align:"left",verticalAlign:"top"})}),y=i.add(_),x=_.getBoundingRect(),T=this._api.getDevicePixelRatio(),b=t.rootNode.position.toArray(),w=ts[o[t.dim]];b[w]+=(t.flipped?-1:1)*h.get("margin"),b[ts[t.dim]]=l.dataToCoord(e[s]),r.geometry.addSprite(b,[x.width*T,x.height*T],y,t.textAlign,t.textVerticalAlign)}}),this),i.getZr().refreshImmediately(),r.material.set("uvScale",i.getCoordsScale()),r.geometry.convertToTypedArray()},dispose:function(){this.groupGL.removeAll(),this._control.dispose(),this._axisLabelSurface.dispose(),this._axisPointerLabelsSurface.dispose()}}),is=r("cf7e");function ns(e){is["a"].call(this,e),this.type="cartesian3D",this.dimensions=["x","y","z"],this.size=[0,0,0]}ns.prototype={constructor:ns,model:null,containPoint:function(e){return this.getAxis("x").contain(e[0])&&this.getAxis("y").contain(e[2])&&this.getAxis("z").contain(e[1])},containData:function(e){return this.getAxis("x").containData(e[0])&&this.getAxis("y").containData(e[1])&&this.getAxis("z").containData(e[2])},dataToPoint:function(e,t,r){return t=t||[],t[0]=this.getAxis("x").dataToCoord(e[0],r),t[2]=this.getAxis("y").dataToCoord(e[1],r),t[1]=this.getAxis("z").dataToCoord(e[2],r),t},pointToData:function(e,t,r){return t=t||[],t[0]=this.getAxis("x").coordToData(e[0],r),t[1]=this.getAxis("y").coordToData(e[2],r),t[2]=this.getAxis("z").coordToData(e[1],r),t}},L["w"].inherits(ns,is["a"]);var as=ns;function os(e,t,r){L["a"].call(this,e,t,r)}os.prototype={constructor:os,getExtentMin:function(){var e=this._extent;return Math.min(e[0],e[1])},getExtentMax:function(){var e=this._extent;return Math.max(e[0],e[1])},calculateCategoryInterval:function(){return Math.floor(this.scale.count()/8)}},L["w"].inherits(os,L["a"]);var ss=os,ls=r("f934"),us=function(){this._pool={},this._allocatedTextures=[]};us.prototype={constructor:us,get:function(e){var t=ds(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]);var r=this._pool[t];if(!r.length){var i=new Dr(e);return this._allocatedTextures.push(i),i}return r.pop()},put:function(e){var t=ds(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]);var r=this._pool[t];r.push(e)},clear:function(e){for(var t=0;t<this._allocatedTextures.length;t++)this._allocatedTextures[t].dispose(e);this._pool={},this._allocatedTextures=[]}};var cs={width:512,height:512,type:Q.UNSIGNED_BYTE,format:Q.RGBA,wrapS:Q.CLAMP_TO_EDGE,wrapT:Q.CLAMP_TO_EDGE,minFilter:Q.LINEAR_MIPMAP_LINEAR,magFilter:Q.LINEAR,useMipmap:!0,anisotropic:1,flipY:!0,unpackAlignment:4,premultiplyAlpha:!1},hs=Object.keys(cs);function ds(e){j.defaultsWithPropList(e,cs,hs),fs(e);for(var t="",r=0;r<hs.length;r++){var i=hs[r],n=e[i].toString();t+=n}return t}function fs(e){var t=ps(e.width,e.height);e.format===Q.DEPTH_COMPONENT&&(e.useMipmap=!1),t&&e.useMipmap||(e.minFilter==Q.NEAREST_MIPMAP_NEAREST||e.minFilter==Q.NEAREST_MIPMAP_LINEAR?e.minFilter=Q.NEAREST:e.minFilter!=Q.LINEAR_MIPMAP_LINEAR&&e.minFilter!=Q.LINEAR_MIPMAP_NEAREST||(e.minFilter=Q.LINEAR)),t||(e.wrapS=Q.CLAMP_TO_EDGE,e.wrapT=Q.CLAMP_TO_EDGE)}function ps(e,t){return 0===(e&e-1)&&0===(t&t-1)}var ms=us,gs="@export clay.sm.depth.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nuniform vec2 uvRepeat = vec2(1.0, 1.0);\nuniform vec2 uvOffset = vec2(0.0, 0.0);\n@import clay.chunk.skinning_header\n@import clay.chunk.instancing_header\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\nvoid main(){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n v_ViewPosition = worldViewProjection * P;\n gl_Position = v_ViewPosition;\n v_Texcoord = texcoord * uvRepeat + uvOffset;\n}\n@end\n@export clay.sm.depth.fragment\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\nuniform float bias : 0.001;\nuniform float slopeScale : 1.0;\nuniform sampler2D alphaMap;\nuniform float alphaCutoff: 0.0;\n@import clay.util.encode_float\nvoid main(){\n float depth = v_ViewPosition.z / v_ViewPosition.w;\n if (alphaCutoff > 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end",vs=["px","nx","py","ny","pz","nz"];function _s(e,t,r){if("alphaMap"===r)return e.material.get("diffuseMap");if("alphaCutoff"===r){if(e.material.isDefined("fragment","ALPHA_TEST")&&e.material.get("diffuseMap")){var i=e.material.get("alphaCutoff");return i||0}return 0}return"uvRepeat"===r?e.material.get("uvRepeat"):"uvOffset"===r?e.material.get("uvOffset"):t.get(r)}function ys(e,t){var r=e.material,i=t.material;return r.get("diffuseMap")!==i.get("diffuseMap")||(r.get("alphaCutoff")||0)!==(i.get("alphaCutoff")||0)}gt["import"](gs);var xs=q.extend((function(){return{softShadow:xs.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new Fi,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new ms}}),(function(){this._gaussianPassH=new Hn({fragment:gt.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new Hn({fragment:gt.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new Hn({fragment:gt.source("clay.sm.debug_depth")})}),{render:function(e,t,r,i){r||(r=t.getMainCamera()),this.trigger("beforerender",this,e,t,r),this._renderShadowPass(e,t,r,i),this.trigger("afterrender",this,e,t,r)},renderDebug:function(e,t){e.saveClear();var r=e.viewport,i=0,n=0,a=t||r.width/4,o=a;for(var s in this.softShadow===xs.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var l=this._textures[s];e.setViewport(i,n,a*l.width/l.height,o),this._outputDepthPass.setUniform("depthMap",l),this._outputDepthPass.render(e),i+=a*l.width/l.height}e.setViewport(r),e.restoreClear()},_updateReceivers:function(e,t){if(t.receiveShadow?(this._receivers.push(t),t.material.set("shadowEnabled",1),t.material.set("pcfKernel",this.kernelPCF)):t.material.set("shadowEnabled",0),this.softShadow===xs.VSM)t.material.define("fragment","USE_VSM"),t.material.undefine("fragment","PCF_KERNEL_SIZE");else{t.material.undefine("fragment","USE_VSM");var r=this.kernelPCF;r&&r.length?t.material.define("fragment","PCF_KERNEL_SIZE",r.length/2):t.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(e,t){var r=this;t.traverse((function(t){t.isRenderable()&&r._updateReceivers(e,t)}));for(var i=0;i<t.lights.length;i++){var n=t.lights[i];n.castShadow&&!n.invisible&&this._lightsCastShadow.push(n)}},_renderShadowPass:function(e,t,r,i){for(var n in this._shadowMapNumber)this._shadowMapNumber[n]=0;this._lightsCastShadow.length=0,this._receivers.length=0;var a=e.gl;if(i||t.update(),r&&r.update(),t.updateLights(),this._update(e,t),this._lightsCastShadow.length||!this._lastRenderNotCastShadow){this._lastRenderNotCastShadow=0===this._lightsCastShadow,a.enable(a.DEPTH_TEST),a.depthMask(!0),a.disable(a.BLEND),a.clearColor(1,1,1,1);for(var o,s=[],l=[],u=[],c=[],h=[],d=[],f=0;f<this._lightsCastShadow.length;f++){var p=this._lightsCastShadow[f];if("DIRECTIONAL_LIGHT"===p.type){if(o){console.warn("Only one direectional light supported with shadow cascade");continue}if(p.shadowCascade>4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(o=p),this.renderDirectionalLightShadow(e,t,r,p,h,c,u)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(e,t,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(e,t,p,d);this._shadowMapNumber[p.type]++}for(var m in this._shadowMapNumber){var g=this._shadowMapNumber[m],v=m+"_SHADOWMAP_COUNT";for(f=0;f<this._receivers.length;f++){var _=this._receivers[f],y=_.material;y.fragmentDefines[v]!==g&&(g>0?y.define("fragment",v,g):y.isDefined("fragment",v)&&y.undefine("fragment",v))}}for(f=0;f<this._receivers.length;f++){_=this._receivers[f],y=_.material;o?y.define("fragment","SHADOW_CASCADE",o.shadowCascade):y.undefine("fragment","SHADOW_CASCADE")}var x=t.shadowUniforms;if(u.length>0){var T=u.map(S);if(x.directionalLightShadowMaps={value:u,type:"tv"},x.directionalLightMatrices={value:c,type:"m4v"},x.directionalLightShadowMapSizes={value:T,type:"1fv"},o){var b=h.slice(),w=h.slice();b.pop(),w.shift(),b.reverse(),w.reverse(),c.reverse(),x.shadowCascadeClipsNear={value:b,type:"1fv"},x.shadowCascadeClipsFar={value:w,type:"1fv"}}}if(s.length>0){var E=s.map(S);x=t.shadowUniforms;x.spotLightShadowMaps={value:s,type:"tv"},x.spotLightMatrices={value:l,type:"m4v"},x.spotLightShadowMapSizes={value:E,type:"1fv"}}d.length>0&&(x.pointLightShadowMaps={value:d,type:"tv"})}function S(e){return e.height}},renderDirectionalLightShadow:function(){var e=new si,t=new tr,r=new ur,i=new tr,n=new tr,a=new tr,o=new tr;return function(s,l,u,c,h,d,f){var p=this._getDepthMaterial(c),m={getMaterial:function(e){return e.shadowDepthMaterial||p},isMaterialChanged:ys,getUniform:_s,ifRender:function(e){return e.castShadow},sortCompare:Pt.opaqueSortCompare};if(!l.viewBoundingBoxLastFrame.isFinite()){var g=l.getBoundingBox();l.viewBoundingBoxLastFrame.copy(g).applyTransform(u.viewMatrix)}var v=Math.min(-l.viewBoundingBoxLastFrame.min.z,u.far),_=Math.max(-l.viewBoundingBoxLastFrame.max.z,u.near),y=this._getDirectionalLightCamera(c,l,u),x=a.array;o.copy(y.projectionMatrix),yt.invert(n.array,y.worldTransform.array),yt.multiply(n.array,n.array,u.worldTransform.array),yt.multiply(x,o.array,n.array);for(var T=[],b=u instanceof Si,w=(u.near+u.far)/(u.near-u.far),E=2*u.near*u.far/(u.near-u.far),S=0;S<=c.shadowCascade;S++){var C=_*Math.pow(v/_,S/c.shadowCascade),A=_+(v-_)*S/c.shadowCascade,M=C*c.cascadeSplitLogFactor+A*(1-c.cascadeSplitLogFactor);T.push(M),h.push(-(-M*w+E)/-M)}var L=this._getTexture(c,c.shadowCascade);f.push(L);var D=s.viewport,N=s.gl;this._frameBuffer.attach(L),this._frameBuffer.bind(s),N.clear(N.COLOR_BUFFER_BIT|N.DEPTH_BUFFER_BIT);for(S=0;S<c.shadowCascade;S++){var R=T[S],I=T[S+1];b?yt.perspective(t.array,u.fov/180*Math.PI,u.aspect,R,I):yt.ortho(t.array,u.left,u.right,u.bottom,u.top,R,I),e.setFromProjection(t),e.getTransformedBoundingBox(r,n),r.applyProjection(o);var P=r.min.array,O=r.max.array;P[0]=Math.max(P[0],-1),P[1]=Math.max(P[1],-1),O[0]=Math.min(O[0],1),O[1]=Math.min(O[1],1),i.ortho(P[0],O[0],P[1],O[1],1,-1),y.projectionMatrix.multiplyLeft(i);var B=c.shadowResolution||512;s.setViewport((c.shadowCascade-S-1)*B,0,B,B,1);var F=l.updateRenderList(y);s.renderPass(F.opaque,y,m),this.softShadow===xs.VSM&&this._gaussianFilter(s,L,L.width);var U=new tr;U.copy(y.viewMatrix).multiplyLeft(y.projectionMatrix),d.push(U.array),y.projectionMatrix.copy(o)}this._frameBuffer.unbind(s),s.setViewport(D)}}(),renderSpotLightShadow:function(e,t,r,i,n){var a=this._getTexture(r),o=this._getSpotLightCamera(r),s=e.gl;this._frameBuffer.attach(a),this._frameBuffer.bind(e),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT);var l=this._getDepthMaterial(r),u={getMaterial:function(e){return e.shadowDepthMaterial||l},isMaterialChanged:ys,getUniform:_s,ifRender:function(e){return e.castShadow},sortCompare:Pt.opaqueSortCompare},c=t.updateRenderList(o);e.renderPass(c.opaque,o,u),this._frameBuffer.unbind(e),this.softShadow===xs.VSM&&this._gaussianFilter(e,a,a.width);var h=new tr;h.copy(o.worldTransform).invert().multiplyLeft(o.projectionMatrix),n.push(a),i.push(h.array)},renderPointLightShadow:function(e,t,r,i){var n=this._getTexture(r),a=e.gl;i.push(n);var o=this._getDepthMaterial(r),s={getMaterial:function(e){return e.shadowDepthMaterial||o},getUniform:_s,sortCompare:Pt.opaqueSortCompare},l={px:[],py:[],pz:[],nx:[],ny:[],nz:[]},u=new ur,c=r.getWorldPosition().array,h=new ur,d=r.range;h.min.setArray(c),h.max.setArray(c);var f=new kt(d,d,d);h.max.add(f),h.min.sub(f);var p={px:!1,py:!1,pz:!1,nx:!1,ny:!1,nz:!1};t.traverse((function(e){if(e.isRenderable()&&e.castShadow){var t=e.geometry;if(!t.boundingBox){for(var r=0;r<vs.length;r++)l[vs[r]].push(e);return}if(u.transformFrom(t.boundingBox,e.worldTransform),!u.intersectBoundingBox(h))return;u.updateVertices();for(r=0;r<vs.length;r++)p[vs[r]]=!1;for(r=0;r<8;r++){var i=u.vertices[r],n=i[0]-c[0],a=i[1]-c[1],o=i[2]-c[2],s=Math.abs(n),d=Math.abs(a),f=Math.abs(o);s>d?s>f?p[n>0?"px":"nx"]=!0:p[o>0?"pz":"nz"]=!0:d>f?p[a>0?"py":"ny"]=!0:p[o>0?"pz":"nz"]=!0}for(r=0;r<vs.length;r++)p[vs[r]]&&l[vs[r]].push(e)}}));for(var m=0;m<6;m++){var g=vs[m],v=this._getPointLightCamera(r,g);this._frameBuffer.attach(n,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+m),this._frameBuffer.bind(e),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT),e.renderPass(l[g],v,s)}this._frameBuffer.unbind(e)},_getDepthMaterial:function(e){var t=this._lightMaterials[e.__uid__],r="POINT_LIGHT"===e.type;if(!t){var i=r?"clay.sm.distance.":"clay.sm.depth.";t=new Ce({precision:this.precision,shader:new gt(gt.source(i+"vertex"),gt.source(i+"fragment"))}),this._lightMaterials[e.__uid__]=t}return null!=e.shadowSlopeScale&&t.setUniform("slopeScale",e.shadowSlopeScale),null!=e.shadowBias&&t.setUniform("bias",e.shadowBias),this.softShadow===xs.VSM?t.define("fragment","USE_VSM"):t.undefine("fragment","USE_VSM"),r&&(t.set("lightPosition",e.getWorldPosition().array),t.set("range",e.range)),t},_gaussianFilter:function(e,t,r){var i={width:r,height:r,type:Tr.FLOAT},n=this._texturePool.get(i);this._frameBuffer.attach(n),this._frameBuffer.bind(e),this._gaussianPassH.setUniform("texture",t),this._gaussianPassH.setUniform("textureWidth",r),this._gaussianPassH.render(e),this._frameBuffer.attach(t),this._gaussianPassV.setUniform("texture",n),this._gaussianPassV.setUniform("textureHeight",r),this._gaussianPassV.render(e),this._frameBuffer.unbind(e),this._texturePool.put(n)},_getTexture:function(e,t){var r=e.__uid__,i=this._textures[r],n=e.shadowResolution||512;return t=t||1,i||(i="POINT_LIGHT"===e.type?new wi:new Dr,i.width=n*t,i.height=n,this.softShadow===xs.VSM?(i.type=Tr.FLOAT,i.anisotropic=4):(i.minFilter=Q.NEAREST,i.magFilter=Q.NEAREST,i.useMipmap=!1),this._textures[r]=i),i},_getPointLightCamera:function(e,t){this._lightCameras.point||(this._lightCameras.point={px:new Si,nx:new Si,py:new Si,ny:new Si,pz:new Si,nz:new Si});var r=this._lightCameras.point[t];switch(r.far=e.range,r.fov=90,r.position.set(0,0,0),t){case"px":r.lookAt(kt.POSITIVE_X,kt.NEGATIVE_Y);break;case"nx":r.lookAt(kt.NEGATIVE_X,kt.NEGATIVE_Y);break;case"py":r.lookAt(kt.POSITIVE_Y,kt.POSITIVE_Z);break;case"ny":r.lookAt(kt.NEGATIVE_Y,kt.NEGATIVE_Z);break;case"pz":r.lookAt(kt.POSITIVE_Z,kt.NEGATIVE_Y);break;case"nz":r.lookAt(kt.NEGATIVE_Z,kt.NEGATIVE_Y);break}return e.getWorldPosition(r.position),r.update(),r},_getDirectionalLightCamera:function(){var e=new tr,t=new ur,r=new ur;return function(i,n,a){this._lightCameras.directional||(this._lightCameras.directional=new On);var o=this._lightCameras.directional;t.copy(n.viewBoundingBoxLastFrame),t.intersection(a.frustum.boundingBox),o.position.copy(t.min).add(t.max).scale(.5).transformMat4(a.worldTransform),o.rotation.copy(i.rotation),o.scale.copy(i.scale),o.updateWorldTransform(),tr.invert(e,o.worldTransform),tr.multiply(e,e,a.worldTransform),r.copy(t).applyTransform(e);var s=r.min.array,l=r.max.array;return o.position.set((s[0]+l[0])/2,(s[1]+l[1])/2,l[2]).transformMat4(o.worldTransform),o.near=0,o.far=-s[2]+l[2],isNaN(this.lightFrustumBias)?o.far*=4:o.far+=this.lightFrustumBias,o.left=s[0],o.right=l[0],o.top=l[1],o.bottom=s[1],o.update(!0),o}}(),_getSpotLightCamera:function(e){this._lightCameras.spot||(this._lightCameras.spot=new Si);var t=this._lightCameras.spot;return t.fov=2*e.penumbraAngle,t.far=e.range,t.worldTransform.copy(e.worldTransform),t.updateProjectionMatrix(),yt.invert(t.viewMatrix.array,t.worldTransform.array),t},dispose:function(e){var t=e.gl||e;for(var r in this._frameBuffer&&this._frameBuffer.dispose(t),this._textures)this._textures[r].dispose(t);this._texturePool.clear(e.gl),this._depthMaterials={},this._distanceMaterials={},this._textures={},this._lightCameras={},this._shadowMapNumber={POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},this._meshMaterials={};for(var i=0;i<this._receivers.length;i++){var n=this._receivers[i];if(n.material){var a=n.material;a.undefine("fragment","POINT_LIGHT_SHADOW_COUNT"),a.undefine("fragment","DIRECTIONAL_LIGHT_SHADOW_COUNT"),a.undefine("fragment","AMBIENT_LIGHT_SHADOW_COUNT"),a.set("shadowEnabled",0)}}this._receivers=[],this._lightsCastShadow=[]}});xs.VSM=1,xs.PCF=2;var Ts=xs,bs=q.extend((function(){return{name:"",inputLinks:{},outputLinks:{},_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),{updateParameter:function(e,t){var r,i,n=this.outputs[e],a=n.parameters,o=n._parametersCopy;if(o||(o=n._parametersCopy={}),a)for(var s in a)"width"!==s&&"height"!==s&&(o[s]=a[s]);return r=a.width instanceof Function?a.width.call(this,t):a.width,i=a.height instanceof Function?a.height.call(this,t):a.height,o.width===r&&o.height===i||this._outputTextures[e]&&this._outputTextures[e].dispose(t.gl),o.width=r,o.height=i,o},setParameter:function(e,t){},getParameter:function(e){},setParameters:function(e){for(var t in e)this.setParameter(t,e[t])},render:function(){},getOutput:function(e,t){if(null==t)return t=e,this._outputTextures[t];var r=this.outputs[t];return r?this._rendered?r.outputLastFrame?this._prevOutputTextures[t]:this._outputTextures[t]:this._rendering?(this._prevOutputTextures[t]||(this._prevOutputTextures[t]=this._compositor.allocateTexture(r.parameters||{})),this._prevOutputTextures[t]):(this.render(e),this._outputTextures[t]):void 0},removeReference:function(e){if(this._outputReferences[e]--,0===this._outputReferences[e]){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}},link:function(e,t,r){this.inputLinks[e]={node:t,pin:r},t.outputLinks[r]||(t.outputLinks[r]=[]),t.outputLinks[r].push({node:this,pin:e}),this.pass.material.enableTexture(e)},clear:function(){this.inputLinks={},this.outputLinks={}},updateReference:function(e){if(!this._rendering){for(var t in this._rendering=!0,this.inputLinks){var r=this.inputLinks[t];r.node.updateReference(r.pin)}this._rendering=!1}e&&this._outputReferences[e]++},beforeFrame:function(){for(var e in this._rendered=!1,this.outputLinks)this._outputReferences[e]=0},afterFrame:function(){for(var e in this.outputLinks)if(this._outputReferences[e]>0){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}}}),ws=bs,Es=q.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(e){this.nodes.indexOf(e)>=0||(this.nodes.push(e),this._dirty=!0)},removeNode:function(e){"string"===typeof e&&(e=this.getNodeByName(e));var t=this.nodes.indexOf(e);t>=0&&(this.nodes.splice(t,1),this._dirty=!0)},getNodeByName:function(e){for(var t=0;t<this.nodes.length;t++)if(this.nodes[t].name===e)return this.nodes[t]},update:function(){for(var e=0;e<this.nodes.length;e++)this.nodes[e].clear();for(e=0;e<this.nodes.length;e++){var t=this.nodes[e];if(t.inputs)for(var r in t.inputs)if(t.inputs[r])if(!t.pass||t.pass.material.isUniformEnabled(r)){var i=t.inputs[r],n=this.findPin(i);n?t.link(r,n.node,n.pin):"string"===typeof i?console.warn("Node "+i+" not exist"):console.warn("Pin of "+i.node+"."+i.pin+" not exist")}else console.warn("Pin "+t.name+"."+r+" not used.")}},findPin:function(e){var t;if(("string"===typeof e||e instanceof ws)&&(e={node:e}),"string"===typeof e.node)for(var r=0;r<this.nodes.length;r++){var i=this.nodes[r];i.name===e.node&&(t=i)}else t=e.node;if(t){var n=e.pin;if(n||t.outputs&&(n=Object.keys(t.outputs)[0]),t.outputs[n])return{node:t,pin:n}}}}),Ss=Es,Cs=Ss.extend((function(){return{_outputs:[],_texturePool:new ms,_frameBuffer:new Fi({depthBuffer:!1})}}),{addNode:function(e){Ss.prototype.addNode.call(this,e),e._compositor=this},render:function(e,t){if(this._dirty){this.update(),this._dirty=!1,this._outputs.length=0;for(var r=0;r<this.nodes.length;r++)this.nodes[r].outputs||this._outputs.push(this.nodes[r])}for(r=0;r<this.nodes.length;r++)this.nodes[r].beforeFrame();for(r=0;r<this._outputs.length;r++)this._outputs[r].updateReference();for(r=0;r<this._outputs.length;r++)this._outputs[r].render(e,t);for(r=0;r<this.nodes.length;r++)this.nodes[r].afterFrame()},allocateTexture:function(e){return this._texturePool.get(e)},releaseTexture:function(e){this._texturePool.put(e)},getFrameBuffer:function(){return this._frameBuffer},dispose:function(e){this._texturePool.clear(e)}}),As=Cs,Ms=ws.extend({name:"scene",scene:null,camera:null,autoUpdateScene:!0,preZ:!1},(function(){this.frameBuffer=new Fi}),{render:function(e){this._rendering=!0;var t,r=e.gl;if(this.trigger("beforerender"),this.outputs){var i=this.frameBuffer;for(var n in this.outputs){var a=this.updateParameter(n,e),o=this.outputs[n],s=this._compositor.allocateTexture(a);this._outputTextures[n]=s;var l=o.attachment||r.COLOR_ATTACHMENT0;"string"==typeof l&&(l=r[l]),i.attach(s,l)}i.bind(e);var u=e.getGLExtension("EXT_draw_buffers");if(u){var c=[];for(var l in this.outputs)l=parseInt(l),l>=r.COLOR_ATTACHMENT0&&l<=r.COLOR_ATTACHMENT0+8&&c.push(l);u.drawBuffersEXT(c)}e.saveClear(),e.clearBit=Q.DEPTH_BUFFER_BIT|Q.COLOR_BUFFER_BIT,t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),e.restoreClear(),i.unbind(e)}else t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",t),this._rendering=!1,this._rendered=!0}}),Ls=Ms,Ds=ws.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(e,t){return this.texture},beforeFrame:function(){},afterFrame:function(){}}),Ns=Ds,Rs=ws.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var e=new Hn({fragment:this.shader});this.pass=e}),{render:function(e,t){this.trigger("beforerender",e),this._rendering=!0;var r=e.gl;for(var i in this.inputLinks){var n=this.inputLinks[i],a=n.node.getOutput(e,n.pin);this.pass.setUniform(i,a)}if(this.outputs){this.pass.outputs={};var o={};for(var s in this.outputs){var l=this.updateParameter(s,e);isNaN(l.width)&&this.updateParameter(s,e);var u=this.outputs[s],c=this._compositor.allocateTexture(l);this._outputTextures[s]=c;var h=u.attachment||r.COLOR_ATTACHMENT0;"string"===typeof h&&(h=r[h]),o[h]=c}for(var h in this._compositor.getFrameBuffer().bind(e),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(e),this._compositor.getFrameBuffer().updateMipmap(e)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(e),this.pass.render(e,t);for(var i in this.inputLinks){n=this.inputLinks[i];n.node.removeReference(n.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",e)},updateParameter:function(e,t){var r,i,n=this.outputs[e],a=n.parameters,o=n._parametersCopy;if(o||(o=n._parametersCopy={}),a)for(var s in a)"width"!==s&&"height"!==s&&(o[s]=a[s]);return r="function"===typeof a.width?a.width.call(this,t):a.width,i="function"===typeof a.height?a.height.call(this,t):a.height,r=Math.ceil(r),i=Math.ceil(i),o.width===r&&o.height===i||this._outputTextures[e]&&this._outputTextures[e].dispose(t),o.width=r,o.height=i,o},setParameter:function(e,t){this.pass.setUniform(e,t)},getParameter:function(e){return this.pass.getUniform(e)},setParameters:function(e){for(var t in e)this.setParameter(t,e[t])},define:function(e,t){this.pass.material.define("fragment",e,t)},undefine:function(e){this.pass.material.undefine("fragment",e)},removeReference:function(e){if(this._outputReferences[e]--,0===this._outputReferences[e]){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}},clear:function(){ws.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),Is=Rs,Ps="@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end",Os="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",Bs="@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end",Fs="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",Us="@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end",zs="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",Gs="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",Hs="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",ks="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",Vs="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",Ws="@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end",js="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",Xs="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";function qs(e){e["import"](Ps),e["import"](Os),e["import"](Bs),e["import"](Fs),e["import"](Us),e["import"](zs),e["import"](Gs),e["import"](Hs),e["import"](ks),e["import"](Vs),e["import"](Ws),e["import"](js),e["import"](Xs)}qs(gt);var Zs=/^#source\((.*?)\)/;function Ys(e,t){var r=new As;t=t||{};var i={textures:{},parameters:{}},n=function(n,a){for(var o=0;o<e.nodes.length;o++){var s=e.nodes[o],l=Ks(s,i,t);l&&r.addNode(l)}};for(var a in e.parameters){var o=e.parameters[a];i.parameters[a]=Js(o)}return el(e,i,t,(function(e){i.textures=e,n()})),r}function Ks(e,t,r){var i,n,a,o,s=e.type||"filter";if("filter"===s){var l=e.shader.trim(),u=Zs.exec(l);if(u?i=gt.source(u[1].trim()):"#"===l.charAt(0)&&(i=t.shaders[l.substr(1)]),i||(i=l),!i)return}if(e.inputs)for(var c in n={},e.inputs)"string"===typeof e.inputs[c]?n[c]=e.inputs[c]:n[c]={node:e.inputs[c].node,pin:e.inputs[c].pin};if(e.outputs)for(var c in a={},e.outputs){var h=e.outputs[c];a[c]={},null!=h.attachment&&(a[c].attachment=h.attachment),null!=h.keepLastFrame&&(a[c].keepLastFrame=h.keepLastFrame),null!=h.outputLastFrame&&(a[c].outputLastFrame=h.outputLastFrame),h.parameters&&(a[c].parameters=Js(h.parameters))}if(o="scene"===s?new Ls({name:e.name,scene:r.scene,camera:r.camera,outputs:a}):"texture"===s?new Ns({name:e.name,outputs:a}):new Is({name:e.name,shader:i,inputs:n,outputs:a}),o){if(e.parameters)for(var c in e.parameters){var d=e.parameters[c];"string"===typeof d?(d=d.trim(),"#"===d.charAt(0)?d=t.textures[d.substr(1)]:o.on("beforerender",tl(c,il(d)))):"function"===typeof d&&o.on("beforerender",d),o.setParameter(c,d)}if(e.defines&&o.pass)for(var c in e.defines){d=e.defines[c];o.pass.material.define("fragment",c,d)}}return o}function $s(e,t){return e}function Qs(e,t){return t}function Js(e){var t={};if(!e)return t;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(r){var i=e[r];null!=i&&("string"===typeof i&&(i=Tr[i]),t[r]=i)}));var r=e.scale||1;return["width","height"].forEach((function(i){if(null!=e[i]){var n=e[i];"string"===typeof n?(n=n.trim(),t[i]=rl(i,il(n),r)):t[i]=n}})),t.width||(t.width=$s),t.height||(t.height=Qs),null!=e.useMipmap&&(t.useMipmap=e.useMipmap),t}function el(e,t,r,i){if(e.textures){var n={},a=0,o=!1,s=r.textureRootPath;j.each(e.textures,(function(e,t){var r,l=e.path,u=Js(e.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(e){return j.relative2absolute(e,s)}))),r=new wi(u);else{if("string"!==typeof l)return;s&&(l=j.relative2absolute(l,s)),r=new Dr(u)}r.load(l),a++,r.once("success",(function(){n[t]=r,a--,0===a&&(i(n),o=!0)}))})),0!==a||o||i(n)}else i({})}function tl(e,t){return function(r){var i=r.getDevicePixelRatio(),n=r.getWidth(),a=r.getHeight(),o=t(n,a,i);this.setParameter(e,o)}}function rl(e,t,r){return r=r||1,function(e){var i=e.getDevicePixelRatio(),n=e.getWidth()*r,a=e.getHeight()*r;return t(n,a,i)}}function il(e){var t=/^expr\((.*)\)$/.exec(e);if(t)try{var r=new Function("width","height","dpr","return "+t[1]);return r(1,1),r}catch(i){throw new Error("Invalid expression.")}}var nl=Ys,al=nl;function ol(e,t){var r=0,i=1/t,n=e;while(n>0)r+=i*(n%t),n=Math.floor(n/t),i/=t;return r}var sl=ol,ll="@export ecgl.ssao.estimate\n\nuniform sampler2D depthTex;\n\nuniform sampler2D normalTex;\n\nuniform sampler2D noiseTex;\n\nuniform vec2 depthTexSize;\n\nuniform vec2 noiseTexSize;\n\nuniform mat4 projection;\n\nuniform mat4 projectionInv;\n\nuniform mat4 viewInverseTranspose;\n\nuniform vec3 kernel[KERNEL_SIZE];\n\nuniform float radius : 1;\n\nuniform float power : 1;\n\nuniform float bias: 1e-2;\n\nuniform float intensity: 1.0;\n\nvarying vec2 v_Texcoord;\n\nfloat ssaoEstimator(in vec3 originPos, in mat3 kernelBasis) {\n float occlusion = 0.0;\n\n for (int i = 0; i < KERNEL_SIZE; i++) {\n vec3 samplePos = kernel[i];\n#ifdef NORMALTEX_ENABLED\n samplePos = kernelBasis * samplePos;\n#endif\n samplePos = samplePos * radius + originPos;\n\n vec4 texCoord = projection * vec4(samplePos, 1.0);\n texCoord.xy /= texCoord.w;\n\n vec4 depthTexel = texture2D(depthTex, texCoord.xy * 0.5 + 0.5);\n\n float sampleDepth = depthTexel.r * 2.0 - 1.0;\n if (projection[3][3] == 0.0) {\n sampleDepth = projection[3][2] / (sampleDepth * projection[2][3] - projection[2][2]);\n }\n else {\n sampleDepth = (sampleDepth - projection[3][2]) / projection[2][2];\n }\n \n float rangeCheck = smoothstep(0.0, 1.0, radius / abs(originPos.z - sampleDepth));\n occlusion += rangeCheck * step(samplePos.z, sampleDepth - bias);\n }\n#ifdef NORMALTEX_ENABLED\n occlusion = 1.0 - occlusion / float(KERNEL_SIZE);\n#else\n occlusion = 1.0 - clamp((occlusion / float(KERNEL_SIZE) - 0.6) * 2.5, 0.0, 1.0);\n#endif\n return pow(occlusion, power);\n}\n\nvoid main()\n{\n\n vec4 depthTexel = texture2D(depthTex, v_Texcoord);\n\n#ifdef NORMALTEX_ENABLED\n vec4 tex = texture2D(normalTex, v_Texcoord);\n if (dot(tex.rgb, tex.rgb) == 0.0) {\n gl_FragColor = vec4(1.0);\n return;\n }\n vec3 N = tex.rgb * 2.0 - 1.0;\n N = (viewInverseTranspose * vec4(N, 0.0)).xyz;\n\n vec2 noiseTexCoord = depthTexSize / vec2(noiseTexSize) * v_Texcoord;\n vec3 rvec = texture2D(noiseTex, noiseTexCoord).rgb * 2.0 - 1.0;\n vec3 T = normalize(rvec - N * dot(rvec, N));\n vec3 BT = normalize(cross(N, T));\n mat3 kernelBasis = mat3(T, BT, N);\n#else\n if (depthTexel.r > 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n";function ul(e){for(var t=new Uint8Array(e*e*4),r=0,i=new kt,n=0;n<e;n++)for(var a=0;a<e;a++)i.set(2*Math.random()-1,2*Math.random()-1,0).normalize(),t[r++]=255*(.5*i.x+.5),t[r++]=255*(.5*i.y+.5),t[r++]=0,t[r++]=255;return t}function cl(e){return new Dr({pixels:ul(e),wrapS:Tr.REPEAT,wrapT:Tr.REPEAT,width:e,height:e})}function hl(e,t,r){var i=new Float32Array(3*e);t=t||0;for(var n=0;n<e;n++){var a=sl(n+t,2)*(r?1:2)*Math.PI,o=sl(n+t,3)*Math.PI,s=Math.random(),l=Math.cos(a)*Math.sin(o)*s,u=Math.cos(o)*s,c=Math.sin(a)*Math.sin(o)*s;i[3*n]=l,i[3*n+1]=u,i[3*n+2]=c}return i}function dl(e){e=e||{},this._ssaoPass=new Hn({fragment:gt.source("ecgl.ssao.estimate")}),this._blurPass=new Hn({fragment:gt.source("ecgl.ssao.blur")}),this._framebuffer=new Fi({depthBuffer:!1}),this._ssaoTexture=new Dr,this._blurTexture=new Dr,this._blurTexture2=new Dr,this._depthTex=e.depthTexture,this._normalTex=e.normalTexture,this.setNoiseSize(4),this.setKernelSize(e.kernelSize||12),null!=e.radius&&this.setParameter("radius",e.radius),null!=e.power&&this.setParameter("power",e.power),this._normalTex||(this._ssaoPass.material.disableTexture("normalTex"),this._blurPass.material.disableTexture("normalTex")),this._depthTex||this._blurPass.material.disableTexture("depthTex"),this._blurPass.material.setUniform("normalTex",this._normalTex),this._blurPass.material.setUniform("depthTex",this._depthTex)}gt.import(ll),dl.prototype.setDepthTexture=function(e){this._depthTex=e},dl.prototype.setNormalTexture=function(e){this._normalTex=e,this._ssaoPass.material[e?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},dl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._ssaoPass,o=this._blurPass;a.setUniform("kernel",this._kernels[r%this._kernels.length]),a.setUniform("depthTex",this._depthTex),null!=this._normalTex&&a.setUniform("normalTex",this._normalTex),a.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new tr;tr.transpose(s,t.worldTransform),a.setUniform("projection",t.projectionMatrix.array),a.setUniform("projectionInv",t.invProjectionMatrix.array),a.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,c=this._blurTexture2;l.width=i/2,l.height=n/2,u.width=i,u.height=n,c.width=i,c.height=n,this._framebuffer.attach(l),this._framebuffer.bind(e),e.gl.clearColor(1,1,1,1),e.gl.clear(e.gl.COLOR_BUFFER_BIT),a.render(e),o.setUniform("textureSize",[i/2,n/2]),o.setUniform("projection",t.projectionMatrix.array),this._framebuffer.attach(u),o.setUniform("direction",0),o.setUniform("ssaoTexture",l),o.render(e),this._framebuffer.attach(c),o.setUniform("textureSize",[i,n]),o.setUniform("direction",1),o.setUniform("ssaoTexture",u),o.render(e),this._framebuffer.unbind(e);var h=e.clearColor;e.gl.clearColor(h[0],h[1],h[2],h[3])},dl.prototype.getTargetTexture=function(){return this._blurTexture2},dl.prototype.setParameter=function(e,t){"noiseTexSize"===e?this.setNoiseSize(t):"kernelSize"===e?this.setKernelSize(t):"intensity"===e?this._ssaoPass.material.set("intensity",t):this._ssaoPass.setUniform(e,t)},dl.prototype.setKernelSize=function(e){this._kernelSize=e,this._ssaoPass.material.define("fragment","KERNEL_SIZE",e),this._kernels=this._kernels||[];for(var t=0;t<30;t++)this._kernels[t]=hl(e,t*e,!!this._normalTex)},dl.prototype.setNoiseSize=function(e){var t=this._ssaoPass.getUniform("noiseTex");t?(t.data=ul(e),t.width=t.height=e,t.dirty()):(t=cl(e),this._ssaoPass.setUniform("noiseTex",cl(e))),this._ssaoPass.setUniform("noiseTexSize",[e,e])},dl.prototype.dispose=function(e){this._blurTexture.dispose(e),this._ssaoTexture.dispose(e),this._blurTexture2.dispose(e)};var fl=dl,pl="@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end";function ml(e){e=e||{},this._ssrPass=new Hn({fragment:gt.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new Hn({fragment:gt.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new Hn({fragment:gt.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new Hn({fragment:gt.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",e.normalTexture),this._ssrPass.setUniform("gBufferTexture2",e.depthTexture),this._blurPass1.setUniform("gBufferTexture1",e.normalTexture),this._blurPass1.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.setUniform("gBufferTexture1",e.normalTexture),this._blurPass2.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new Dr({type:Tr.HALF_FLOAT}),this._texture2=new Dr({type:Tr.HALF_FLOAT}),this._texture3=new Dr({type:Tr.HALF_FLOAT}),this._prevTexture=new Dr({type:Tr.HALF_FLOAT}),this._currentTexture=new Dr({type:Tr.HALF_FLOAT}),this._frameBuffer=new Fi({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}gt.import(pl),ml.prototype.setAmbientCubemap=function(e,t){this._ssrPass.material.set("specularCubemap",e),this._ssrPass.material.set("specularIntensity",t);var r=e&&t;this._ssrPass.material[r?"enableTexture":"disableTexture"]("specularCubemap")},ml.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._ssrTexture,s=this._texture2,l=this._texture3;o.width=this._prevTexture.width=this._currentTexture.width=n/this._downScale,o.height=this._prevTexture.height=this._currentTexture.height=a/this._downScale,s.width=l.width=n,s.height=l.height=a;var u=this._frameBuffer,c=this._ssrPass,h=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new tr,m=new tr;tr.transpose(p,t.worldTransform),tr.transpose(m,t.viewMatrix),c.setUniform("sourceTexture",r),c.setUniform("projection",t.projectionMatrix.array),c.setUniform("projectionInv",t.invProjectionMatrix.array),c.setUniform("toViewSpace",p.array),c.setUniform("toWorldSpace",m.array),c.setUniform("nearZ",t.near);var g=i/this._totalSamples*this._samplePerFrame;if(c.setUniform("jitterOffset",g),c.setUniform("sampleOffset",i*this._samplePerFrame),h.setUniform("textureSize",[o.width,o.height]),d.setUniform("textureSize",[n,a]),d.setUniform("sourceTexture",r),h.setUniform("projection",t.projectionMatrix.array),d.setUniform("projection",t.projectionMatrix.array),u.attach(o),u.bind(e),c.render(e),this._physicallyCorrect&&(u.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",o),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(e)),u.attach(s),h.setUniform("texture",this._physicallyCorrect?this._currentTexture:o),h.render(e),u.attach(l),d.setUniform("texture",s),d.render(e),u.unbind(e),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},ml.prototype.getTargetTexture=function(){return this._texture3},ml.prototype.setParameter=function(e,t){"maxIteration"===e?this._ssrPass.material.define("fragment","MAX_ITERATION",t):this._ssrPass.setUniform(e,t)},ml.prototype.setPhysicallyCorrect=function(e){e?(this._normalDistribution||(this._normalDistribution=Xn.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=e},ml.prototype.setSSAOTexture=function(e){var t=this._blurPass2;e?(t.material.enableTexture("ssaoTex"),t.material.set("ssaoTex",e)):t.material.disableTexture("ssaoTex")},ml.prototype.isFinished=function(e){return!this._physicallyCorrect||e>this._totalSamples/this._samplePerFrame},ml.prototype.dispose=function(e){this._ssrTexture.dispose(e),this._texture2.dispose(e),this._texture3.dispose(e),this._prevTexture.dispose(e),this._currentTexture.dispose(e),this._frameBuffer.dispose(e)};var gl=ml,vl=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925],_l="@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end";function yl(e,t,r,i,n){var a=e.gl;t.setUniform(a,"1i",r,n),a.activeTexture(a.TEXTURE0+n),i.isRenderable()?i.bind(e):i.unbind(e)}function xl(e,t,r,i,n){var a,o,s,l,u=e.gl;return function(n,c,h){if(!l||l.material!==n.material){var d=n.material,f=n.__program,p=d.get("roughness");null==p&&(p=1);var m=d.get("normalMap")||t,g=d.get("roughnessMap"),v=d.get("bumpMap"),_=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),T=d.get("detailUvOffset"),b=!!v&&d.isTextureEnabled("bumpMap"),w=!!g&&d.isTextureEnabled("roughnessMap"),E=d.isDefined("fragment","DOUBLE_SIDED");v=v||r,g=g||i,h!==c?(c.set("normalMap",m),c.set("bumpMap",v),c.set("roughnessMap",g),c.set("useBumpMap",b),c.set("useRoughnessMap",w),c.set("doubleSide",E),null!=_&&c.set("uvRepeat",_),null!=y&&c.set("uvOffset",y),null!=x&&c.set("detailUvRepeat",x),null!=T&&c.set("detailUvOffset",T),c.set("roughness",p)):(f.setUniform(u,"1f","roughness",p),a!==m&&yl(e,f,"normalMap",m,0),o!==v&&v&&yl(e,f,"bumpMap",v,1),s!==g&&g&&yl(e,f,"roughnessMap",g,2),null!=_&&f.setUniform(u,"2f","uvRepeat",_),null!=y&&f.setUniform(u,"2f","uvOffset",y),null!=x&&f.setUniform(u,"2f","detailUvRepeat",x),null!=T&&f.setUniform(u,"2f","detailUvOffset",T),f.setUniform(u,"1i","useBumpMap",+b),f.setUniform(u,"1i","useRoughnessMap",+w),f.setUniform(u,"1i","doubleSide",+E)),a=m,o=v,s=g,l=n}}}function Tl(e){e=e||{},this._depthTex=new Dr({format:Tr.DEPTH_COMPONENT,type:Tr.UNSIGNED_INT}),this._normalTex=new Dr({type:Tr.HALF_FLOAT}),this._framebuffer=new Fi,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,Fi.DEPTH_ATTACHMENT),this._normalMaterial=new Ce({shader:new gt(gt.source("ecgl.normal.vertex"),gt.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=Ln.createBlank("#000"),this._defaultBumpMap=Ln.createBlank("#000"),this._defaultRoughessMap=Ln.createBlank("#000"),this._debugPass=new Hn({fragment:gt.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}gt.import(_l),Tl.prototype.getDepthTexture=function(){return this._depthTex},Tl.prototype.getNormalTexture=function(){return this._normalTex},Tl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._depthTex,o=this._normalTex,s=this._normalMaterial;a.width=i,a.height=n,o.width=i,o.height=n;var l=t.getRenderList(r).opaque;this._framebuffer.bind(e),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT|e.gl.DEPTH_BUFFER_BIT),e.gl.disable(e.gl.BLEND),e.renderPass(l,r,{getMaterial:function(){return s},ifRender:function(e){return e.renderNormal},beforeRender:xl(e,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:e.opaqueSortCompare}),this._framebuffer.unbind(e)},Tl.prototype.renderDebug=function(e){this._debugPass.render(e)},Tl.prototype.dispose=function(e){this._depthTex.dispose(e),this._normalTex.dispose(e)};var bl=Tl;function wl(e){e=e||{},this._edgePass=new Hn({fragment:gt.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",e.normalTexture),this._edgePass.setUniform("depthTexture",e.depthTexture),this._targetTexture=new Dr({type:Tr.HALF_FLOAT}),this._frameBuffer=new Fi,this._frameBuffer.attach(this._targetTexture)}wl.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._targetTexture;o.width=n,o.height=a;var s=this._frameBuffer;s.bind(e),this._edgePass.setUniform("projectionInv",t.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[n,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(e),s.unbind(e)},wl.prototype.getTargetTexture=function(){return this._targetTexture},wl.prototype.setParameter=function(e,t){this._edgePass.setUniform(e,t)},wl.prototype.dispose=function(e){this._targetTexture.dispose(e),this._frameBuffer.dispose(e)};var El=wl,Sl={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]},Cl="@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end",Al="@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end";function Ml(e,t){return{color:{parameters:{width:e,height:t}}}}gt["import"](Os),gt["import"](Fs),gt["import"](zs),gt["import"](Gs),gt["import"](Hs),gt["import"](ks),gt["import"](Vs),gt["import"](js),gt["import"](Xs),gt["import"](Cl),gt["import"](Al);var Ll=["composite","FXAA"];function Dl(){this._width,this._height,this._dpr,this._sourceTexture=new Dr({type:Tr.HALF_FLOAT}),this._depthTexture=new Dr({format:Tr.DEPTH_COMPONENT,type:Tr.UNSIGNED_INT}),this._framebuffer=new Fi,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,Fi.DEPTH_ATTACHMENT),this._normalPass=new bl,this._compositor=al(Sl);var e=this._compositor.getNodeByName("source");e.texture=this._sourceTexture;var t=this._compositor.getNodeByName("coc");this._sourceNode=e,this._cocNode=t,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map((function(e){return this._compositor.getNodeByName(e)}),this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=Ll.map((function(e){return this._compositor.getNodeByName(e)}),this);var r={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new fl(r),this._ssrPass=new gl(r),this._edgePass=new El(r)}Dl.prototype.resize=function(e,t,r){r=r||1;e*=r,t*=r;var i=this._sourceTexture,n=this._depthTexture;i.width=e,i.height=t,n.width=e,n.height=t;var a={getWidth:function(){return e},getHeight:function(){return t},getDevicePixelRatio:function(){return r}};function o(e,t){if("function"===typeof e[t]){var r=e[t].__original||e[t];e[t]=function(e){return r.call(this,a)},e[t].__original=r}}this._compositor.nodes.forEach((function(e){for(var t in e.outputs){var r=e.outputs[t].parameters;r&&(o(r,"width"),o(r,"height"))}for(var i in e.parameters)o(e.parameters,i)})),this._width=e,this._height=t,this._dpr=r},Dl.prototype.getWidth=function(){return this._width},Dl.prototype.getHeight=function(){return this._height},Dl.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},Dl.prototype._getPrevNode=function(e){var t=Ll.indexOf(e.name)-1,r=this._finalNodesChain[t];while(r&&!this._compositor.getNodeByName(r.name))t-=1,r=this._finalNodesChain[t];return r},Dl.prototype._getNextNode=function(e){var t=Ll.indexOf(e.name)+1,r=this._finalNodesChain[t];while(r&&!this._compositor.getNodeByName(r.name))t+=1,r=this._finalNodesChain[t];return r},Dl.prototype._addChainNode=function(e){var t=this._getPrevNode(e),r=this._getNextNode(e);t&&(e.inputs.texture=t.name,r?(e.outputs=Ml(this.getWidth.bind(this),this.getHeight.bind(this)),r.inputs.texture=e.name):e.outputs=null,this._compositor.addNode(e))},Dl.prototype._removeChainNode=function(e){var t=this._getPrevNode(e),r=this._getNextNode(e);t&&(r?(t.outputs=Ml(this.getWidth.bind(this),this.getHeight.bind(this)),r.inputs.texture=t.name):t.outputs=null,this._compositor.removeNode(e))},Dl.prototype.updateNormal=function(e,t,r,i){this._ifRenderNormalPass()&&this._normalPass.update(e,t,r)},Dl.prototype.updateSSAO=function(e,t,r,i){this._ssaoPass.update(e,r,i)},Dl.prototype.enableSSAO=function(){this._enableSSAO=!0},Dl.prototype.disableSSAO=function(){this._enableSSAO=!1},Dl.prototype.enableSSR=function(){this._enableSSR=!0},Dl.prototype.disableSSR=function(){this._enableSSR=!1},Dl.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()},Dl.prototype.getSourceFrameBuffer=function(){return this._framebuffer},Dl.prototype.getSourceTexture=function(){return this._sourceTexture},Dl.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},Dl.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},Dl.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()},Dl.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()},Dl.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()},Dl.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()},Dl.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0},Dl.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},Dl.prototype.enableEdge=function(){this._enableEdge=!0},Dl.prototype.disableEdge=function(){this._enableEdge=!1},Dl.prototype.setBloomIntensity=function(e){this._compositeNode.setParameter("bloomIntensity",e)},Dl.prototype.setSSAOParameter=function(e,t){switch(e){case"quality":var r={low:6,medium:12,high:32,ultra:62}[t]||12;this._ssaoPass.setParameter("kernelSize",r);break;case"radius":this._ssaoPass.setParameter(e,t),this._ssaoPass.setParameter("bias",t/200);break;case"intensity":this._ssaoPass.setParameter(e,t);break;default:0}},Dl.prototype.setDOFParameter=function(e,t){switch(e){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(e,t);break;case"blurRadius":for(var r=0;r<this._dofBlurNodes.length;r++)this._dofBlurNodes[r].setParameter("blurRadius",t);break;case"quality":var i={low:4,medium:8,high:16,ultra:32}[t]||8;this._dofBlurKernelSize=i;for(r=0;r<this._dofBlurNodes.length;r++)this._dofBlurNodes[r].pass.material.define("POISSON_KERNEL_SIZE",i);this._dofBlurKernel=new Float32Array(2*i);break;default:0}},Dl.prototype.setSSRParameter=function(e,t){if(null!=t)switch(e){case"quality":var r={low:10,medium:15,high:30,ultra:80}[t]||20,i={low:32,medium:16,high:8,ultra:4}[t]||16;this._ssrPass.setParameter("maxIteration",r),this._ssrPass.setParameter("pixelStride",i);break;case"maxRoughness":this._ssrPass.setParameter("minGlossiness",Math.max(Math.min(1-t,1),0));break;case"physical":this.setPhysicallyCorrectSSR(t);break;default:console.warn("Unkown SSR parameter "+e)}},Dl.prototype.setPhysicallyCorrectSSR=function(e){this._ssrPass.setPhysicallyCorrect(e)},Dl.prototype.setEdgeColor=function(e){var t=Ya.parseColor(e);this._edgePass.setParameter("edgeColor",t)},Dl.prototype.setExposure=function(e){this._compositeNode.setParameter("exposure",Math.pow(2,e))},Dl.prototype.setColorLookupTexture=function(e,t){this._compositeNode.pass.material.setTextureImage("lut",this._enableColorCorrection?e:"none",t,{minFilter:Ya.Texture.NEAREST,magFilter:Ya.Texture.NEAREST,flipY:!1})},Dl.prototype.setColorCorrection=function(e,t){this._compositeNode.setParameter(e,t)},Dl.prototype.isSSREnabled=function(){return this._enableSSR},Dl.prototype.composite=function(e,t,r,i,n){var a=this._sourceTexture,o=a;this._enableEdge&&(this._edgePass.update(e,r,a,n),a=o=this._edgePass.getTargetTexture()),this._enableSSR&&(this._ssrPass.update(e,r,a,n),o=this._ssrPass.getTargetTexture(),this._ssrPass.setSSAOTexture(this._enableSSAO?this._ssaoPass.getTargetTexture():null)),this._sourceNode.texture=o,this._cocNode.setParameter("depth",this._depthTexture);for(var s=this._dofBlurKernel,l=this._dofBlurKernelSize,u=Math.floor(vl.length/2/l),c=n%u,h=0;h<2*l;h++)s[h]=vl[h+c*l*2];for(h=0;h<this._dofBlurNodes.length;h++)this._dofBlurNodes[h].setParameter("percent",n/30),this._dofBlurNodes[h].setParameter("poissonKernel",s);this._cocNode.setParameter("zNear",r.near),this._cocNode.setParameter("zFar",r.far),this._compositor.render(e,i)},Dl.prototype.dispose=function(e){this._sourceTexture.dispose(e),this._depthTexture.dispose(e),this._framebuffer.dispose(e),this._compositor.dispose(e),this._normalPass.dispose(e),this._ssaoPass.dispose(e)};var Nl=Dl;function Rl(e){for(var t=[],r=0;r<30;r++)t.push([sl(r,2),sl(r,3)]);this._haltonSequence=t,this._frame=0,this._sourceTex=new Dr,this._sourceFb=new Fi,this._sourceFb.attach(this._sourceTex),this._prevFrameTex=new Dr,this._outputTex=new Dr;var i=this._blendPass=new Hn({fragment:gt.source("clay.compositor.blend")});i.material.disableTexturesAll(),i.material.enableTexture(["texture1","texture2"]),this._blendFb=new Fi({depthBuffer:!1}),this._outputPass=new Hn({fragment:gt.source("clay.compositor.output"),blendWithPrevious:!0}),this._outputPass.material.define("fragment","OUTPUT_ALPHA"),this._outputPass.material.blend=function(e){e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}}Rl.prototype={constructor:Rl,jitterProjection:function(e,t){var r=e.viewport,i=r.devicePixelRatio||e.getDevicePixelRatio(),n=r.width*i,a=r.height*i,o=this._haltonSequence[this._frame%this._haltonSequence.length],s=new tr;s.array[12]=(2*o[0]-1)/n,s.array[13]=(2*o[1]-1)/a,tr.mul(t.projectionMatrix,s,t.projectionMatrix),tr.invert(t.invProjectionMatrix,t.projectionMatrix)},resetFrame:function(){this._frame=0},getFrame:function(){return this._frame},getSourceFrameBuffer:function(){return this._sourceFb},getOutputTexture:function(){return this._outputTex},resize:function(e,t){this._prevFrameTex.width=e,this._prevFrameTex.height=t,this._outputTex.width=e,this._outputTex.height=t,this._sourceTex.width=e,this._sourceTex.height=t,this._prevFrameTex.dirty(),this._outputTex.dirty(),this._sourceTex.dirty()},isFinished:function(){return this._frame>=this._haltonSequence.length},render:function(e,t,r){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",t||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(e),i.render(e),this._blendFb.unbind(e),r||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(e));var n=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=n,this._frame++},dispose:function(e){this._sourceFb.dispose(e),this._blendFb.dispose(e),this._prevFrameTex.dispose(e),this._outputTex.dispose(e),this._sourceTex.dispose(e),this._outputPass.dispose(e),this._blendPass.dispose(e)}};var Il=Rl;function Pl(e){e=e||"perspective",this.layer=null,this.scene=new vi,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(e),this._compositor=new Nl,this._temporalSS=new Il,this._shadowMapPass=new Ts;for(var t=[],r=0,i=0;i<30;i++){for(var n=[],a=0;a<6;a++)n.push(4*sl(r,2)-2),n.push(4*sl(r,3)-2),r++;t.push(n)}this._pcfKernels=t,this.scene.on("beforerender",(function(e,t,r){this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,r)}),this)}Pl.prototype.setProjection=function(e){var t=this.camera;t&&t.update(),"perspective"===e?this.camera instanceof Si||(this.camera=new Si,t&&this.camera.setLocalTransform(t.localTransform)):this.camera instanceof On||(this.camera=new On,t&&this.camera.setLocalTransform(t.localTransform)),this.camera.near=.1,this.camera.far=2e3},Pl.prototype.setViewport=function(e,t,r,i,n){this.camera instanceof Si&&(this.camera.aspect=r/i),n=n||1,this.viewport.x=e,this.viewport.y=t,this.viewport.width=r,this.viewport.height=i,this.viewport.devicePixelRatio=n,this._compositor.resize(r*n,i*n),this._temporalSS.resize(r*n,i*n)},Pl.prototype.containPoint=function(e,t){var r=this.viewport,i=this.layer.renderer.getHeight();return t=i-t,e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height};var Ol=new Pe;Pl.prototype.castRay=function(e,t,r){var i=this.layer.renderer,n=i.viewport;return i.viewport=this.viewport,i.screenToNDC(e,t,Ol),this.camera.castRay(Ol,r),i.viewport=n,r},Pl.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var e=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var t=0;t<e.transparent.length;t++){var r=e.transparent[t],i=r.geometry;i.needsSortVerticesProgressively&&i.needsSortVerticesProgressively()&&(this._needsSortProgressively=!0),i.needsSortTrianglesProgressively&&i.needsSortTrianglesProgressively()&&(this._needsSortProgressively=!0)}this._frame=0,this._temporalSS.resetFrame()},Pl.prototype.render=function(e,t){this._doRender(e,t,this._frame),this._frame++},Pl.prototype.needsAccumulate=function(){return this.needsTemporalSS()||this._needsSortProgressively},Pl.prototype.needsTemporalSS=function(){var e=this._enableTemporalSS;return"auto"===e&&(e=this._enablePostEffect),e},Pl.prototype.hasDOF=function(){return this._enableDOF},Pl.prototype.isAccumulateFinished=function(){return this.needsTemporalSS()?this._temporalSS.isFinished():this._frame>30},Pl.prototype._doRender=function(e,t,r){var i=this.scene,n=this.camera;r=r||0,this._updateTransparent(e,i,n,r),t||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(e,i,n,!0)),this._updateShadowPCFKernel(r);var a=e.clearColor;if(e.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,n),this._compositor.updateNormal(e,i,n,this._temporalSS.getFrame())),this._updateSSAO(e,i,n,this._temporalSS.getFrame()),this._enablePostEffect){var o=this._compositor.getSourceFrameBuffer();o.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),e.render(i,n,!0,!0),o.unbind(e),this.needsTemporalSS()&&t?(this._compositor.composite(e,i,n,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),this._compositor.composite(e,i,n,null,0))}else if(this.needsTemporalSS()&&t){o=this._temporalSS.getSourceFrameBuffer();o.bind(e),e.saveClear(),e.clearBit=e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT,e.render(i,n,!0,!0),e.restoreClear(),o.unbind(e),e.setViewport(this.viewport),this._temporalSS.render(e)}else e.setViewport(this.viewport),e.render(i,n,!0,!0)},Pl.prototype._updateTransparent=function(e,t,r,i){for(var n=new kt,a=new tr,o=r.getWorldPosition(),s=t.getRenderList(r).transparent,l=0;l<s.length;l++){var u=s[l],c=u.geometry;tr.invert(a,u.worldTransform),kt.transformMat4(n,o,a),c.needsSortTriangles&&c.needsSortTriangles()&&c.doSortTriangles(n,i),c.needsSortVertices&&c.needsSortVertices()&&c.doSortVertices(n,i)}},Pl.prototype._updateSSAO=function(e,t,r){var i=this._enableSSAO&&this._enablePostEffect;i&&this._compositor.updateSSAO(e,t,r,this._temporalSS.getFrame());for(var n=t.getRenderList(r),a=0;a<n.opaque.length;a++){var o=n.opaque[a];o.renderNormal&&o.material[i?"enableTexture":"disableTexture"]("ssaoMap"),i&&o.material.set("ssaoMap",this._compositor.getSSAOTexture())}},Pl.prototype._updateShadowPCFKernel=function(e){for(var t=this._pcfKernels[e%this._pcfKernels.length],r=this.scene.getRenderList(this.camera),i=r.opaque,n=0;n<i.length;n++)i[n].receiveShadow&&(i[n].material.set("pcfKernel",t),i[n].material.define("fragment","PCF_KERNEL_SIZE",t.length/2))},Pl.prototype.dispose=function(e){this._compositor.dispose(e.gl),this._temporalSS.dispose(e.gl),this._shadowMapPass.dispose(e)},Pl.prototype.setPostEffect=function(e,t){var r=this._compositor;this._enablePostEffect=e.get("enable");var i=e.getModel("bloom"),n=e.getModel("edge"),a=e.getModel("DOF",e.getModel("depthOfField")),o=e.getModel("SSAO",e.getModel("screenSpaceAmbientOcclusion")),s=e.getModel("SSR",e.getModel("screenSpaceReflection")),l=e.getModel("FXAA"),u=e.getModel("colorCorrection");i.get("enable")?r.enableBloom():r.disableBloom(),a.get("enable")?r.enableDOF():r.disableDOF(),s.get("enable")?r.enableSSR():r.disableSSR(),u.get("enable")?r.enableColorCorrection():r.disableColorCorrection(),n.get("enable")?r.enableEdge():r.disableEdge(),l.get("enable")?r.enableFXAA():r.disableFXAA(),this._enableDOF=a.get("enable"),this._enableSSAO=o.get("enable"),this._enableSSAO?r.enableSSAO():r.disableSSAO(),r.setBloomIntensity(i.get("intensity")),r.setEdgeColor(n.get("color")),r.setColorLookupTexture(u.get("lookupTexture"),t),r.setExposure(u.get("exposure")),["radius","quality","intensity"].forEach((function(e){r.setSSAOParameter(e,o.get(e))})),["quality","maxRoughness","physical"].forEach((function(e){r.setSSRParameter(e,s.get(e))})),["quality","focalDistance","focalRange","blurRadius","fstop"].forEach((function(e){r.setDOFParameter(e,a.get(e))})),["brightness","contrast","saturation"].forEach((function(e){r.setColorCorrection(e,u.get(e))}))},Pl.prototype.setDOFFocusOnPoint=function(e){if(this._enablePostEffect){if(e>this.camera.far||e<this.camera.near)return;return this._compositor.setDOFParameter("focalDistance",e),!0}},Pl.prototype.setTemporalSuperSampling=function(e){this._enableTemporalSS=e.get("enable")},Pl.prototype.isLinearSpace=function(){return this._enablePostEffect},Pl.prototype.setRootNode=function(e){if(this.rootNode!==e){for(var t=this.rootNode.children(),r=0;r<t.length;r++)e.add(t[r]);e!==this.scene&&this.scene.add(e),this.rootNode=e}},Pl.prototype.add=function(e){this.rootNode.add(e)},Pl.prototype.remove=function(e){this.rootNode.remove(e)},Pl.prototype.removeAll=function(e){this.rootNode.removeAll(e)},Object.assign(Pl.prototype,G);var Bl=Pl;function Fl(e,t){var r=e.getBoxLayoutParams(),i=Object(ls["g"])(r,{width:t.getWidth(),height:t.getHeight()});i.y=t.getHeight()-i.y-i.height,this.viewGL.setViewport(i.x,i.y,i.width,i.height,t.getDevicePixelRatio());var n=e.get("boxWidth"),a=e.get("boxHeight"),o=e.get("boxDepth");this.getAxis("x").setExtent(-n/2,n/2),this.getAxis("y").setExtent(o/2,-o/2),this.getAxis("z").setExtent(-a/2,a/2),this.size=[n,a,o]}function Ul(e,t){var r={};function i(e,t){r[e]=r[e]||[1/0,-1/0],r[e][0]=Math.min(t[0],r[e][0]),r[e][1]=Math.max(t[1],r[e][1])}e.eachSeries((function(e){if(e.coordinateSystem===this){var t=e.getData();["x","y","z"].forEach((function(e){t.mapDimensionsAll(e,!0).forEach((function(r){i(e,t.getDataExtent(r,!0))}))}))}}),this),["xAxis3D","yAxis3D","zAxis3D"].forEach((function(t){e.eachComponent(t,(function(e){var i=t.charAt(0),n=e.getReferringComponents("grid3D").models[0],a=n.coordinateSystem;if(a===this){var o=a.getAxis(i);if(!o){var s=L["m"].createScale(r[i]||[1/0,-1/0],e);o=new ss(i,s),o.type=e.get("type");var l="category"===o.type;o.onBand=l&&e.get("boundaryGap"),o.inverse=e.get("inverse"),e.axis=o,o.model=e,o.getLabelModel=function(){return e.getModel("axisLabel",n.getModel("axisLabel"))},o.getTickModel=function(){return e.getModel("axisTick",n.getModel("axisTick"))},a.addAxis(o)}}}),this)}),this),this.resize(this.model,t)}var zl={dimensions:as.prototype.dimensions,create:function(e,t){var r=[];e.eachComponent("grid3D",(function(e){e.__viewGL=e.__viewGL||new Bl;var t=new as;t.model=e,t.viewGL=e.__viewGL,e.coordinateSystem=t,r.push(t),t.resize=Fl,t.update=Ul}));var i=["xAxis3D","yAxis3D","zAxis3D"];function n(e,t){return i.map((function(r){var i=e.getReferringComponents(r).models[0];return null==i&&(i=t.getComponent(r)),i}))}return e.eachSeries((function(t){if("cartesian3D"===t.get("coordinateSystem")){var r=t.getReferringComponents("grid3D").models[0];if(null==r){var i=n(t,e);r=i[0].getCoordSysModel();i.forEach((function(e){e.getCoordSysModel()}))}var a=r.coordinateSystem;t.coordinateSystem=a}})),r}},Gl=zl,Hl=L["c"].extend({type:"cartesian3DAxis",axis:null,getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"grid3D",index:this.option.gridIndex,id:this.option.gridId})[0]}});L["m"].mixinAxisModelCommonMethods(Hl);var kl=Hl,Vl={show:!0,grid3DIndex:0,inverse:!1,name:"",nameLocation:"middle",nameTextStyle:{fontSize:16},nameGap:20,axisPointer:{},axisLine:{},axisTick:{},axisLabel:{},splitArea:{}},Wl=L["w"].merge({boundaryGap:!0,axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"},axisPointer:{label:{show:!1}}},Vl),jl=L["w"].merge({boundaryGap:[0,0],splitNumber:5,axisPointer:{label:{}}},Vl),Xl=L["w"].defaults({scale:!0,min:"dataMin",max:"dataMax"},jl),ql=L["w"].defaults({logBase:10},jl);ql.scale=!0;var Zl={categoryAxis3D:Wl,valueAxis3D:jl,timeAxis3D:Xl,logAxis3D:ql},Yl=r("8e43"),Kl=["value","category","time","log"],$l=function(e,t,r,i,n){Kl.forEach((function(a){var o=r.extend({type:t+"Axis3D."+a,__ordinalMeta:null,mergeDefaultAndTheme:function(e,r){var n=r.getTheme();L["w"].merge(e,n.get(a+"Axis3D")),L["w"].merge(e,this.getDefaultOption()),e.type=i(t,e)},optionUpdated:function(){var e=this.option;"category"===e.type&&(this.__ordinalMeta=Yl["a"].createByAxisModel(this))},getCategories:function(){if("category"===this.option.type)return this.__ordinalMeta.categories},getOrdinalMeta:function(){return this.__ordinalMeta},defaultOption:L["w"].merge(L["w"].clone(Zl[a+"Axis3D"]),n||{},!0)});e.registerComponentModel(o)})),e.registerSubTypeDefaulter(t+"Axis3D",L["w"].curry(i,t))};function Ql(e,t){return t.type||(t.data?"category":"value")}function Jl(e){e.registerComponentModel(go),e.registerComponentView(rs),e.registerCoordinateSystem("grid3D",Gl),["x","y","z"].forEach((function(t){$l(e,t,kl,Ql,{name:t.toUpperCase()});const r=e.ComponentView.extend({type:t+"Axis3D"});e.registerComponentView(r)})),e.registerAction({type:"grid3DChangeCamera",event:"grid3dcamerachanged",update:"series:updateCamera"},(function(e,t){t.eachComponent({mainType:"grid3D",query:e},(function(t){t.setView(e)}))})),e.registerAction({type:"grid3DShowAxisPointer",event:"grid3dshowaxispointer",update:"grid3D:showAxisPointer"},(function(e,t){})),e.registerAction({type:"grid3DHideAxisPointer",event:"grid3dhideaxispointer",update:"grid3D:hideAxisPointer"},(function(e,t){}))}Object(L["v"])(Jl);var eu={defaultOption:{shading:null,realisticMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},lambertMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},colorMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},hatchingMaterial:{textureTiling:1,textureOffset:0,paperColor:"#fff"}}},tu={getFilledRegions:function(e,t){var r,i=(e||[]).slice();if("string"===typeof t?(t=L["k"](t),r=t&&t.geoJson):t&&t.features&&(r=t),!r)return[];for(var n={},a=r.features,o=0;o<i.length;o++)n[i[o].name]=i[o];for(o=0;o<a.length;o++){var s=a[o].properties.name;n[s]||i.push({name:s})}return i},defaultOption:{show:!0,zlevel:-10,map:"",left:0,top:0,width:"100%",height:"100%",boxWidth:100,boxHeight:10,boxDepth:"auto",regionHeight:3,environment:"auto",groundPlane:{show:!1,color:"#aaa"},shading:"lambert",light:{main:{alpha:40,beta:30}},viewControl:{alpha:40,beta:0,distance:100,orthographicSize:60,minAlpha:5,minBeta:-80,maxBeta:80},label:{show:!1,distance:2,textStyle:{fontSize:20,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:4}},itemStyle:{color:"#fff",borderWidth:0,borderColor:"#333"},emphasis:{itemStyle:{color:"#639fc0"},label:{show:!0}}}},ru=L["c"].extend({type:"geo3D",layoutMode:"box",coordinateSystem:null,optionUpdated:function(){var e=this.option;e.regions=this.getFilledRegions(e.regions,e.map);var t=L["m"].createDimensions(e.data||[],{coordDimensions:["value"],encodeDefine:this.get("encode"),dimensionsDefine:this.get("dimensions")}),r=new L["e"](t,this);r.initData(e.regions);var i={};r.each((function(e){var t=r.getName(e),n=r.getItemModel(e);i[t]=n})),this._regionModelMap=i,this._data=r},getData:function(){return this._data},getRegionModel:function(e){var t=this.getData().getName(e);return this._regionModelMap[t]||new L["f"](null,this)},getRegionPolygonCoords:function(e){var t=this.getData().getName(e),r=this.coordinateSystem.getRegion(t);return r?r.geometries:[]},getFormattedLabel:function(e,t){var r=this._data.getName(e),i=this.getRegionModel(e),n=i.get("normal"===t?["label","formatter"]:["emphasis","label","formatter"]);null==n&&(n=i.get(["label","formatter"]));var a={name:r};if("function"===typeof n)return a.status=t,n(a);if("string"===typeof n){var o=a.seriesName;return n.replace("{a}",null!=o?o:"")}return r},defaultOption:{regions:[]}});L["w"].merge(ru.prototype,tu),L["w"].merge(ru.prototype,ho),L["w"].merge(ru.prototype,fo),L["w"].merge(ru.prototype,po),L["w"].merge(ru.prototype,eu);var iu=ru,nu=au;function au(e,t,r){r=r||2;var i,n,a,o,s,l,u,c=t&&t.length,h=c?t[0]*r:e.length,d=ou(e,0,h,r,!0),f=[];if(!d)return f;if(c&&(d=fu(e,t,d,r)),e.length>80*r){i=a=e[0],n=o=e[1];for(var p=r;p<h;p+=r)s=e[p],l=e[p+1],s<i&&(i=s),l<n&&(n=l),s>a&&(a=s),l>o&&(o=l);u=Math.max(a-i,o-n)}return lu(d,f,r,i,n,u),f}function ou(e,t,r,i,n){var a,o;if(n===Iu(e,t,r,i)>0)for(a=t;a<r;a+=i)o=Du(a,e[a],e[a+1],o);else for(a=r-i;a>=t;a-=i)o=Du(a,e[a],e[a+1],o);return o&&Eu(o,o.next)&&(Nu(o),o=o.next),o}function su(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!Eu(i,i.next)&&0!==wu(i.prev,i,i.next))i=i.next;else{if(Nu(i),i=t=i.prev,i===i.next)return null;r=!0}}while(r||i!==t);return t}function lu(e,t,r,i,n,a,o){if(e){!o&&a&&vu(e,i,n,a);var s,l,u=e;while(e.prev!==e.next)if(s=e.prev,l=e.next,a?cu(e,i,n,a):uu(e))t.push(s.i/r),t.push(e.i/r),t.push(l.i/r),Nu(e),e=l.next,u=l.next;else if(e=l,e===u){o?1===o?(e=hu(e,t,r),lu(e,t,r,i,n,a,2)):2===o&&du(e,t,r,i,n,a):lu(su(e),t,r,i,n,a,1);break}}}function uu(e){var t=e.prev,r=e,i=e.next;if(wu(t,r,i)>=0)return!1;var n=e.next.next;while(n!==e.prev){if(Tu(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&wu(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function cu(e,t,r,i){var n=e.prev,a=e,o=e.next;if(wu(n,a,o)>=0)return!1;var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,l=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,u=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,c=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,h=yu(s,l,t,r,i),d=yu(u,c,t,r,i),f=e.nextZ;while(f&&f.z<=d){if(f!==e.prev&&f!==e.next&&Tu(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&wu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}f=e.prevZ;while(f&&f.z>=h){if(f!==e.prev&&f!==e.next&&Tu(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&wu(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function hu(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!Eu(n,a)&&Su(n,i,i.next,a)&&Au(n,a)&&Au(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),Nu(i),Nu(i.next),i=e=a),i=i.next}while(i!==e);return i}function du(e,t,r,i,n,a){var o=e;do{var s=o.next.next;while(s!==o.prev){if(o.i!==s.i&&bu(o,s)){var l=Lu(o,s);return o=su(o,o.next),l=su(l,l.next),lu(o,t,r,i,n,a),void lu(l,t,r,i,n,a)}s=s.next}o=o.next}while(o!==e)}function fu(e,t,r,i){var n,a,o,s,l,u=[];for(n=0,a=t.length;n<a;n++)o=t[n]*i,s=n<a-1?t[n+1]*i:e.length,l=ou(e,o,s,i,!1),l===l.next&&(l.steiner=!0),u.push(xu(l));for(u.sort(pu),n=0;n<u.length;n++)mu(u[n],r),r=su(r,r.next);return r}function pu(e,t){return e.x-t.x}function mu(e,t){if(t=gu(e,t),t){var r=Lu(t,e);su(r,r.next)}}function gu(e,t){var r,i=t,n=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>o){if(o=s,s===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===o)return r.prev;var l,u=r,c=r.x,h=r.y,d=1/0;i=r.next;while(i!==u)n>=i.x&&i.x>=c&&n!==i.x&&Tu(a<h?n:o,a,c,h,a<h?o:n,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(n-i.x),(l<d||l===d&&i.x>r.x)&&Au(i,e)&&(r=i,d=l)),i=i.next;return r}function vu(e,t,r,i){var n=e;do{null===n.z&&(n.z=yu(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,_u(n)}function _u(e){var t,r,i,n,a,o,s,l,u=1;do{r=e,e=null,a=null,o=0;while(r){for(o++,i=r,s=0,t=0;t<u;t++)if(s++,i=i.nextZ,!i)break;l=u;while(s>0||l>0&&i)0!==s&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,u*=2}while(o>1);return e}function yu(e,t,r,i,n){return e=32767*(e-r)/n,t=32767*(t-i)/n,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function xu(e){var t=e,r=e;do{t.x<r.x&&(r=t),t=t.next}while(t!==e);return r}function Tu(e,t,r,i,n,a,o,s){return(n-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(n-o)*(i-s)>=0}function bu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Cu(e,t)&&Au(e,t)&&Au(t,e)&&Mu(e,t)}function wu(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Eu(e,t){return e.x===t.x&&e.y===t.y}function Su(e,t,r,i){return!!(Eu(e,t)&&Eu(r,i)||Eu(e,i)&&Eu(r,t))||wu(e,t,r)>0!==wu(e,t,i)>0&&wu(r,i,e)>0!==wu(r,i,t)>0}function Cu(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Su(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Au(e,t){return wu(e.prev,e,e.next)<0?wu(e,t,e.next)>=0&&wu(e,e.prev,t)>=0:wu(e,t,e.prev)<0||wu(e,e.next,t)<0}function Mu(e,t){var r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!==r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}function Lu(e,t){var r=new Ru(e.i,e.x,e.y),i=new Ru(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function Du(e,t,r,i){var n=new Ru(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Nu(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 Ru(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Iu(e,t,r,i){for(var n=0,a=t,o=r-i;a<r;a+=i)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}function Pu(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function Ou(e,t,r,i,n){var a=r,o=e[t];Pu(e,t,i);for(var s=r;s<i;s++)n(e[s],o)<0&&(Pu(e,s,a),a++);return Pu(e,i,a),a}function Bu(e,t,r,i){if(r<i){var n=Math.floor((r+i)/2),a=Ou(e,n,r,i,t);Bu(e,t,r,a-1),Bu(e,t,a+1,i)}}function Fu(){this._parts=[]}au.deviation=function(e,t,r,i){var n=t&&t.length,a=n?t[0]*r:e.length,o=Math.abs(Iu(e,0,a,r));if(n)for(var s=0,l=t.length;s<l;s++){var u=t[s]*r,c=s<l-1?t[s+1]*r:e.length;o-=Math.abs(Iu(e,u,c,r))}var h=0;for(s=0;s<i.length;s+=3){var d=i[s]*r,f=i[s+1]*r,p=i[s+2]*r;h+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},Fu.prototype.step=function(e,t,r){var i=e.length;if(0===r){this._parts=[],this._sorted=!1;var n=Math.floor(i/2);this._parts.push({pivot:n,left:0,right:i-1}),this._currentSortPartIdx=0}if(!this._sorted){var a=this._parts;if(0===a.length)return this._sorted=!0,!0;if(a.length<512){for(var o=0;o<a.length;o++)a[o].pivot=Ou(e,a[o].pivot,a[o].left,a[o].right,t);var s=[];for(o=0;o<a.length;o++){var l=a[o].left,u=a[o].pivot-1;u>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});l=a[o].pivot+1,u=a[o].right;u>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}a=this._parts=s}else for(o=0;o<Math.floor(a.length/10);o++){var c=a.length-1-this._currentSortPartIdx;if(Bu(e,t,a[c].left,a[c].right),this._currentSortPartIdx++,this._currentSortPartIdx===a.length)return this._sorted=!0,!0}return!1}},Fu.sort=Bu;var Uu=Fu,zu=So.vec3,Gu=zu.create(),Hu=zu.create(),ku=zu.create(),Vu={needsSortTriangles:function(){return this.indices&&this.sortTriangles},needsSortTrianglesProgressively:function(){return this.needsSortTriangles()&&this.triangleCount>=2e4},doSortTriangles:function(e,t){var r=this.indices;if(0===t){var i=this.attributes.position;e=e.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var n,a=0,o=0;o<r.length;){i.get(r[o++],Gu),i.get(r[o++],Hu),i.get(r[o++],ku);var s=zu.sqrDist(Gu,e),l=zu.sqrDist(Hu,e),u=zu.sqrDist(ku,e),c=Math.min(s,l);c=Math.min(c,u),3===o?(n=c,c=0):c-=n,this._triangleZList[a++]=c}}var h=this._sortedTriangleIndices;for(o=0;o<h.length;o++)h[o]=o;if(this.triangleCount<2e4)0===t&&this._simpleSort(!0);else for(o=0;o<3;o++)this._progressiveQuickSort(3*t+o);var d=this._indicesTmp,f=this._triangleZListTmp,p=this._triangleZList;for(o=0;o<this.triangleCount;o++){var m=3*h[o],g=3*o;d[g++]=r[m++],d[g++]=r[m++],d[g]=r[m],f[o]=p[h[o]]}var v=this._indicesTmp;this._indicesTmp=this.indices,this.indices=v;v=this._triangleZListTmp;this._triangleZListTmp=this._triangleZList,this._triangleZList=v,this.dirtyIndices()},_simpleSort:function(e){var t=this._triangleZList,r=this._sortedTriangleIndices;function i(e,r){return t[r]-t[e]}e?Array.prototype.sort.call(r,i):Uu.sort(r,i,0,r.length-1)},_progressiveQuickSort:function(e){var t=this._triangleZList,r=this._sortedTriangleIndices;this._quickSort=this._quickSort||new Uu,this._quickSort.step(r,(function(e,r){return t[r]-t[e]}),e)}};function Wu(e){const t=e.getVisual("style");if(t){const r=e.getVisual("drawType");return t[r]}}function ju(e){const t=e.getVisual("style");return t.opacity}function Xu(e,t){const r=e.getItemVisual(t,"style");if(r){const t=e.getVisual("drawType");return r[t]}}function qu(e,t){const r=e.getItemVisual(t,"style");return r&&r.opacity}var Zu=1,Yu=2;function Ku(e,t,r){this._labelsMesh=new qo,this._labelTextureSurface=new Ro({width:512,height:512,devicePixelRatio:r.getDevicePixelRatio(),onupdate:function(){r.getZr().refresh()}}),this._api=r,this._labelsMesh.material.set("textureAtlas",this._labelTextureSurface.getTexture())}Ku.prototype.getLabelPosition=function(e,t,r){return[0,0,0]},Ku.prototype.getLabelDistance=function(e,t,r){return 0},Ku.prototype.getMesh=function(){return this._labelsMesh},Ku.prototype.updateData=function(e,t,r){null==t&&(t=0),null==r&&(r=e.count()),this._labelsVisibilitiesBits&&this._labelsVisibilitiesBits.length===r-t||(this._labelsVisibilitiesBits=new Uint8Array(r-t));for(var i=["label","show"],n=["emphasis","label","show"],a=t;a<r;a++){var o=e.getItemModel(a),s=o.get(i),l=o.get(n);null==l&&(l=s);var u=(s?Zu:0)|(l?Yu:0);this._labelsVisibilitiesBits[a-t]=u}this._start=t,this._end=r,this._data=e},Ku.prototype.updateLabels=function(e){if(this._data){e=e||[];for(var t=e.length>0,r={},i=0;i<e.length;i++)r[e[i]]=!0;this._labelsMesh.geometry.convertToDynamicArray(!0),this._labelTextureSurface.clear();for(var n=["label"],a=["emphasis","label"],o=this._data.hostModel,s=this._data,l=o.getModel(n),u=o.getModel(a,l),c={left:"right",right:"left",top:"center",bottom:"center"},h={left:"middle",right:"middle",top:"bottom",bottom:"top"},d=this._start;d<this._end;d++){var f=!1;t&&r[d]&&(f=!0);var p=this._labelsVisibilitiesBits[d-this._start]&(f?Yu:Zu);if(p){var m=s.getItemModel(d),g=m.getModel(f?a:n,f?u:l),v=g.get("distance")||0,_=g.get("position"),y=this._api.getDevicePixelRatio(),x=o.getFormattedLabel(d,f?"emphasis":"normal");if(null==x||""===x)return;var T=new L["l"].Text({style:Object(vo["c"])(g,{text:x,fill:g.get("color")||Xu(s,d)||"#000",align:"left",verticalAlign:"top",opacity:na.firstNotNull(g.get("opacity"),qu(s,d),1)})}),b=T.getBoundingRect(),w=1.2;b.height*=w;var E=this._labelTextureSurface.add(T),S=c[_]||"center",C=h[_]||"bottom";this._labelsMesh.geometry.addSprite(this.getLabelPosition(d,_,v),[b.width*y,b.height*y],E,S,C,this.getLabelDistance(d,_,v)*y)}}this._labelsMesh.material.set("uvScale",this._labelTextureSurface.getCoordsScale()),this._labelTextureSurface.getZr().refreshImmediately(),this._labelsMesh.geometry.convertToTypedArray(),this._labelsMesh.geometry.dirty()}},Ku.prototype.dispose=function(){this._labelTextureSurface.dispose()};var $u=Ku,Qu=So.vec3;function Ju(e){this.rootNode=new Ya.Node,this._triangulationResults={},this._shadersMap=Ya.COMMON_SHADERS.filter((function(e){return"shadow"!==e})).reduce((function(e,t){return e[t]=Ya.createShader("ecgl."+t),e}),{}),this._linesShader=Ya.createShader("ecgl.meshLines3D");var t={};Ya.COMMON_SHADERS.forEach((function(e){t[e]=new Ya.Material({shader:Ya.createShader("ecgl."+e)})})),this._groundMaterials=t,this._groundMesh=new Ya.Mesh({geometry:new Ya.PlaneGeometry({dynamic:!0}),castShadow:!1,renderNormal:!0,$ignorePicking:!0}),this._groundMesh.rotation.rotateX(-Math.PI/2),this._labelsBuilder=new $u(512,512,e),this._labelsBuilder.getMesh().renderOrder=100,this._labelsBuilder.getMesh().material.depthTest=!1,this.rootNode.add(this._labelsBuilder.getMesh()),this._initMeshes(),this._api=e}Ya.Shader.import(Jo),Ju.prototype={constructor:Ju,extrudeY:!0,update:function(e,t,r,i,n){var a=e.getData();null==i&&(i=0),null==n&&(n=a.count()),this._startIndex=i,this._endIndex=n-1,this._triangulation(e,i,n);var o=this._getShader(e.get("shading"));this._prepareMesh(e,o,r,i,n),this.rootNode.updateWorldTransform(),this._updateRegionMesh(e,r,i,n);var s=e.coordinateSystem;"geo3D"===s.type&&this._updateGroundPlane(e,s,r);var l=this;this._labelsBuilder.updateData(a,i,n),this._labelsBuilder.getLabelPosition=function(e,t,r){var i=a.getName(e),n=r;if("geo3D"===s.type){var o=s.getRegion(i);if(!o)return[NaN,NaN,NaN];h=o.getCenter();var u=s.dataToPoint([h[0],h[1],n]);return u}var c=l._triangulationResults[e-l._startIndex],h=l.extrudeY?[(c.max[0]+c.min[0])/2,c.max[1]+n,(c.max[2]+c.min[2])/2]:[(c.max[0]+c.min[0])/2,(c.max[1]+c.min[1])/2,c.max[2]+n]},this._data=a,this._labelsBuilder.updateLabels(),this._updateDebugWireframe(e),this._lastHoverDataIndex=0},_initMeshes:function(){var e=this;function t(){var t=new Ya.Mesh({name:"Polygon",material:new Ya.Material({shader:e._shadersMap.lambert}),geometry:new Ya.Geometry({sortTriangles:!0,dynamic:!0}),culling:!1,ignorePicking:!0,renderNormal:!0});return Object.assign(t.geometry,Vu),t}var r=t(),i=new Ya.Mesh({material:new Ya.Material({shader:this._linesShader}),castShadow:!1,ignorePicking:!0,$ignorePicking:!0,geometry:new Lo({useNativeLine:!1})});this.rootNode.add(r),this.rootNode.add(i),r.material.define("both","VERTEX_COLOR"),r.material.define("fragment","DOUBLE_SIDED"),this._polygonMesh=r,this._linesMesh=i,this.rootNode.add(this._groundMesh)},_getShader:function(e){var t=this._shadersMap[e];return t||(t=this._shadersMap.lambert),t.__shading=e,t},_prepareMesh:function(e,t,r,i,n){for(var a=0,o=0,s=0,l=0,u=i;u<n;u++){var c=this._getRegionPolygonInfo(u),h=this._getRegionLinesInfo(u,e,this._linesMesh.geometry);a+=c.vertexCount,o+=c.triangleCount,s+=h.vertexCount,l+=h.triangleCount}var d=this._polygonMesh,f=d.geometry;["position","normal","texcoord0","color"].forEach((function(e){f.attributes[e].init(a)})),f.indices=a>65535?new Uint32Array(3*o):new Uint16Array(3*o),d.material.shader!==t&&d.material.attachShader(t,!0),Ya.setMaterialFromModel(t.__shading,d.material,e,r),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(a),this._vertexRangeOfDataIndex=new Uint32Array(2*(n-i))},_updateRegionMesh:function(e,t,r,i){for(var n=e.getData(),a=0,o=0,s=!1,l=this._polygonMesh,u=this._linesMesh,c=r;c<i;c++){var h=e.getRegionModel(c),d=h.getModel("itemStyle"),f=na.firstNotNull(Xu(n,c),d.get("color"),"#fff"),p=na.firstNotNull(qu(n,c),d.get("opacity"),1),m=Ya.parseColor(f),g=Ya.parseColor(d.get("borderColor"));m[3]*=p,g[3]*=p;var v=m[3]<.99;l.material.set("color",[1,1,1,1]),s=s||v;for(var _=na.firstNotNull(h.get("height",!0),e.get("regionHeight")),y=this._updatePolygonGeometry(e,l.geometry,c,_,a,o,m),x=a;x<y.vertexOffset;x++)this._dataIndexOfVertex[x]=c;this._vertexRangeOfDataIndex[2*(c-r)]=a,this._vertexRangeOfDataIndex[2*(c-r)+1]=y.vertexOffset,a=y.vertexOffset,o=y.triangleOffset;var T=d.get("borderWidth"),b=T>0;b&&(T*=t.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,e,c,_,T,e.coordinateSystem.transform)),u.invisible=!b,u.material.set({color:g})}l=this._polygonMesh;l.material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?Ya.Mesh.CCW:Ya.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=e.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(e){var t=e.getModel("debug.wireframe");if(t.get("show")){var r=Ya.parseColor(t.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=na.firstNotNull(t.get("lineStyle.width"),1),n=this._polygonMesh;n.geometry.generateBarycentric(),n.material.define("both","WIREFRAME_TRIANGLE"),n.material.set("wireframeLineColor",r),n.material.set("wireframeLineWidth",i)}},_onmousemove:function(e){var t=this._dataIndexOfVertex[e.triangle[0]];null==t&&(t=-1),t!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(t),this._labelsBuilder.updateLabels([t])),this._lastHoverDataIndex=t,this._polygonMesh.dataIndex=t},_onmouseout:function(e){e.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(e,t,r){var i=e.getModel("groundPlane",e);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var n=e.get("shading"),a=this._groundMaterials[n];a||(a=this._groundMaterials.lambert),Ya.setMaterialFromModel(n,a,i,r),a.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=a,this._groundMesh.material.set("color",Ya.parseColor(i.get("color"))),this._groundMesh.scale.set(t.size[0],t.size[2],1)}},_triangulation:function(e,t,r){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],a=e.coordinateSystem,o=t;o<r;o++){for(var s=[],l=e.getRegionPolygonCoords(o),u=0;u<l.length;u++){var c=l[u].exterior,h=l[u].interiors,d=[],f=[];if(!(c.length<3)){for(var p=0,m=0;m<c.length;m++){var g=c[m];d[p++]=g[0],d[p++]=g[1]}for(m=0;m<h.length;m++)if(!(h[m].length<3)){for(var v=d.length/2,_=0;_<h[m].length;_++){g=h[m][_];d.push(g[0]),d.push(g[1])}f.push(v)}var y=nu(d,f),x=new Float64Array(d.length/2*3),T=[],b=[1/0,1/0,1/0],w=[-1/0,-1/0,-1/0],E=0;for(m=0;m<d.length;)Qu.set(T,d[m++],0,d[m++]),a&&a.transform&&Qu.transformMat4(T,T,a.transform),Qu.min(b,b,T),Qu.max(w,w,T),x[E++]=T[0],x[E++]=T[1],x[E++]=T[2];Qu.min(i,i,b),Qu.max(n,n,w),s.push({points:x,indices:y,min:b,max:w})}}this._triangulationResults.push(s)}this._geoBoundingBox=[i,n]},_getRegionPolygonInfo:function(e){for(var t=this._triangulationResults[e-this._startIndex],r=0,i=0,n=0;n<t.length;n++)r+=t[n].points.length/3,i+=t[n].indices.length/3;var a=2*r+4*r,o=2*i+2*r;return{vertexCount:a,triangleCount:o}},_updatePolygonGeometry:function(e,t,r,i,n,a,o){var s=e.get("projectUVOnGround"),l=t.attributes.position,u=t.attributes.normal,c=t.attributes.texcoord0,h=t.attributes.color,d=this._triangulationResults[r-this._startIndex],f=h.value&&o,p=t.indices,m=this.extrudeY?1:2,g=this.extrudeY?2:1,v=[this.rootNode.worldTransform.x.len(),this.rootNode.worldTransform.y.len(),this.rootNode.worldTransform.z.len()],_=Qu.mul([],this._geoBoundingBox[0],v),y=Qu.mul([],this._geoBoundingBox[1],v),x=Math.max(y[0]-_[0],y[2]-_[2]);function T(e,t,r){for(var i=e.points,a=i.length,s=[],u=[],d=0;d<a;d+=3)s[0]=i[d],s[m]=t,s[g]=i[d+2],u[0]=(i[d]*v[0]-_[0])/x,u[1]=(i[d+2]*v[g]-_[2])/x,l.set(n,s),f&&h.set(n,o),c.set(n++,u)}function b(e,t,r){var i=n;T(e,t,r);for(var o=e.indices.length,s=0;s<o;s++)p[3*a+s]=e.indices[s]+i;a+=e.indices.length/3}for(var w=this.extrudeY?[0,1,0]:[0,0,1],E=Qu.negate([],w),S=0;S<d.length;S++){var C=n,A=d[S];b(A,0,0),b(A,i,0);for(var M=A.points.length/3,L=0;L<M;L++)u.set(C+L,E),u.set(C+L+M,w);var D=[0,3,1,1,3,2],N=[[],[],[],[]],R=[],I=[],P=[],O=[],B=0;for(L=0;L<M;L++){for(var F=(L+1)%M,U=(A.points[3*F]-A.points[3*L])*v[0],z=(A.points[3*F+2]-A.points[3*L+2])*v[g],G=Math.sqrt(U*U+z*z),H=0;H<4;H++){var k=0===H||3===H,V=3*(k?L:F);N[H][0]=A.points[V],N[H][m]=H>1?i:0,N[H][g]=A.points[V+2],l.set(n+H,N[H]),s?(O[0]=(A.points[V]*v[0]-_[0])/x,O[1]=(A.points[V+2]*v[g]-_[g])/x):(O[0]=(k?B:B+G)/x,O[1]=(N[H][m]*v[m]-_[m])/x),c.set(n+H,O)}Qu.sub(R,N[1],N[0]),Qu.sub(I,N[3],N[0]),Qu.cross(P,R,I),Qu.normalize(P,P);for(H=0;H<4;H++)u.set(n+H,P),f&&h.set(n+H,o);for(H=0;H<6;H++)p[3*a+H]=D[H]+n;n+=4,a+=2,B+=G}}return t.dirty(),{vertexOffset:n,triangleOffset:a}},_getRegionLinesInfo:function(e,t,r){var i=0,n=0,a=t.getRegionModel(e),o=a.getModel("itemStyle"),s=o.get("borderWidth");if(s>0){var l=t.getRegionPolygonCoords(e);l.forEach((function(e){var t=e.exterior,a=e.interiors;i+=r.getPolylineVertexCount(t),n+=r.getPolylineTriangleCount(t);for(var o=0;o<a.length;o++)i+=r.getPolylineVertexCount(a[o]),n+=r.getPolylineTriangleCount(a[o])}),this)}return{vertexCount:i,triangleCount:n}},_updateLinesGeometry:function(e,t,r,i,n,a){function o(e){for(var t=new Float64Array(3*e.length),r=0,n=[],o=0;o<e.length;o++)n[0]=e[o][0],n[1]=i+.1,n[2]=e[o][1],a&&Qu.transformMat4(n,n,a),t[r++]=n[0],t[r++]=n[1],t[r++]=n[2];return t}var s=[1,1,1,1],l=t.getRegionPolygonCoords(r);l.forEach((function(t){var r=t.exterior,i=t.interiors;e.addPolyline(o(r),s,n);for(var a=0;a<i.length;a++)e.addPolyline(o(i[a]),s,n)}))},highlight:function(e){var t=this._data;if(t){var r=t.getItemModel(e),i=r.getModel(["emphasis","itemStyle"]),n=i.get("color"),a=na.firstNotNull(i.get("opacity"),qu(t,e),1);if(null==n){var o=Xu(t,e);n=L["h"].lift(o,-.4)}null==a&&(a=qu(t,e));var s=Ya.parseColor(n);s[3]*=a,this._setColorOfDataIndex(t,e,s)}},downplay:function(e){var t=this._data;if(t){var r=t.getItemModel(e),i=na.firstNotNull(Xu(t,e),r.get(["itemStyle","color"]),"#fff"),n=na.firstNotNull(qu(t,e),r.get(["itemStyle","opacity"]),1),a=Ya.parseColor(i);a[3]*=n,this._setColorOfDataIndex(t,e,a)}},dispose:function(){this._labelsBuilder.dispose()},_setColorOfDataIndex:function(e,t,r){if(!(t<this._startIndex&&t>this._endIndex)){t-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*t];i<this._vertexRangeOfDataIndex[2*t+1];i++)this._polygonMesh.geometry.attributes.color.set(i,r);this._polygonMesh.geometry.dirty(),this._api.getZr().refresh()}}};var ec=Ju,tc=L["d"].extend({type:"geo3D",__ecgl__:!0,init:function(e,t){this._geo3DBuilder=new ec(t),this.groupGL=new Ya.Node,this._lightRoot=new Ya.Node,this._sceneHelper=new Po(this._lightRoot),this._sceneHelper.initLight(this._lightRoot),this._control=new bo({zr:t.getZr()}),this._control.init()},render:function(e,t,r){this.groupGL.add(this._geo3DBuilder.rootNode);var i=e.coordinateSystem;if(i&&i.viewGL){i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var n=this._control;n.setViewGL(i.viewGL);var a=e.getModel("viewControl");n.setFromViewControlModel(a,0),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(e),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._geo3DBuilder.update(e,t,r,0,e.getData().count());var o=i.viewGL.isLinearSpace()?"define":"undefine";this._geo3DBuilder.rootNode.traverse((function(e){e.material&&e.material[o]("fragment","SRGB_DECODE")})),n.off("update"),n.on("update",(function(){r.dispatchAction({type:"geo3DChangeCamera",alpha:n.getAlpha(),beta:n.getBeta(),distance:n.getDistance(),center:n.getCenter(),from:this.uid,geo3DId:e.id})})),n.update()}},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},dispose:function(){this._control.dispose(),this._geo3DBuilder.dispose()}}),rc=r("1792"),ic={Russia:[100,60],"United States":[-99,38],"United States of America":[-99,38]};function nc(e,t){if("world"===e){var r=ic[t.name];if(r){var i=[r[0],r[1]];t.setCenter(i)}}}var ac=So.vec3,oc=So.mat4,sc=[rc["a"],nc];function lc(e,t,r,i,n){this.name=e,this.map=t,this.regionHeight=0,this.regions=[],this._nameCoordMap={},this.loadGeoJson(r,i,n),this.transform=oc.identity(new Float64Array(16)),this.invTransform=oc.identity(new Float64Array(16)),this.extrudeY=!0,this.altitudeAxis}lc.prototype={constructor:lc,type:"geo3D",dimensions:["lng","lat","alt"],containPoint:function(){},loadGeoJson:function(e,t,r){var i=L["q"]||L["r"];try{this.regions=e?i(e):[]}catch(u){throw"Invalid geoJson format\n"+u}t=t||{},r=r||{};for(var n=this.regions,a={},o=0;o<n.length;o++){var s=n[o].name;s=r[s]||s,n[o].name=s,a[s]=n[o],this.addGeoCoord(s,n[o].getCenter());var l=t[s];l&&n[o].transformTo(l.left,l.top,l.width,l.height)}this._regionsMap=a,this._geoRect=null,sc.forEach((function(e){e(this)}),this)},getGeoBoundingRect:function(){if(this._geoRect)return this._geoRect;for(var e,t=this.regions,r=0;r<t.length;r++){var i=t[r].getBoundingRect();e=e||i.clone(),e.union(i)}return this._geoRect=e||new L["l"].BoundingRect(0,0,0,0)},addGeoCoord:function(e,t){this._nameCoordMap[e]=t},getRegion:function(e){return this._regionsMap[e]},getRegionByCoord:function(e){for(var t=this.regions,r=0;r<t.length;r++)if(t[r].contain(e))return t[r]},setSize:function(e,t,r){this.size=[e,t,r];var i=this.getGeoBoundingRect(),n=e/i.width,a=-r/i.height,o=-e/2-i.x*n,s=r/2-i.y*a,l=this.extrudeY?[o,0,s]:[o,s,0],u=this.extrudeY?[n,1,a]:[n,a,1],c=this.transform;oc.identity(c),oc.translate(c,c,l),oc.scale(c,c,u),oc.invert(this.invTransform,c)},dataToPoint:function(e,t){t=t||[];var r=this.extrudeY?1:2,i=this.extrudeY?2:1,n=e[2];return isNaN(n)&&(n=0),t[0]=e[0],t[i]=e[1],this.altitudeAxis?t[r]=this.altitudeAxis.dataToCoord(n):t[r]=0,t[r]+=this.regionHeight,ac.transformMat4(t,t,this.transform),t},pointToData:function(e,t){}};var uc=lc;function cc(e,t){var r=e.getBoxLayoutParams(),i=Object(ls["g"])(r,{width:t.getWidth(),height:t.getHeight()});i.y=t.getHeight()-i.y-i.height,this.viewGL.setViewport(i.x,i.y,i.width,i.height,t.getDevicePixelRatio());var n=this.getGeoBoundingRect(),a=n.width/n.height*(e.get("aspectScale")||.75),o=e.get("boxWidth"),s=e.get("boxDepth"),l=e.get("boxHeight");null==l&&(l=5),isNaN(o)&&isNaN(s)&&(o=100),isNaN(s)?s=o/a:isNaN(o)&&(o=s/a),this.setSize(o,l,s),this.regionHeight=e.get("regionHeight"),this.altitudeAxis&&this.altitudeAxis.setExtent(0,Math.max(l-this.regionHeight,0))}function hc(e,t){var r=[1/0,-1/0];if(e.eachSeries((function(e){if(e.coordinateSystem===this&&"series.map3D"!==e.type){var t=e.getData(),i=e.coordDimToDataDim("alt"),n=i&&i[0];if(n){var a=t.getDataExtent(n,!0);r[0]=Math.min(r[0],a[0]),r[1]=Math.max(r[1],a[1])}}}),this),r&&isFinite(r[1]-r[0])){var i=L["m"].createScale(r,{type:"value",min:"dataMin",max:"dataMax"});this.altitudeAxis=new L["a"]("altitude",i),this.resize(this.model,t)}}var dc=0,fc={dimensions:uc.prototype.dimensions,create:function(e,t){var r=[];if(!L["k"])throw new Error("geo3D component depends on geo component");function i(e,i){var n=fc.createGeo3D(e);e.__viewGL=e.__viewGL||new Bl,n.viewGL=e.__viewGL,e.coordinateSystem=n,n.model=e,r.push(n),n.resize=cc,n.resize(e,t),n.update=hc}return e.eachComponent("geo3D",(function(e,t){i(e,t)})),e.eachSeriesByType("map3D",(function(e,t){var r=e.get("coordinateSystem");null==r&&(r="geo3D"),"geo3D"===r&&i(e,t)})),e.eachSeries((function(t){if("geo3D"===t.get("coordinateSystem")){if("series.map3D"===t.type)return;var r=t.getReferringComponents("geo3D").models[0];if(r||(r=e.getComponent("geo3D")),!r)throw new Error('geo "'+na.firstNotNull(t.get("geo3DIndex"),t.get("geo3DId"),0)+'" not found');t.coordinateSystem=r.coordinateSystem}})),r},createGeo3D:function(e){var t,r=e.get("map");return"string"===typeof r?(t=r,r=L["k"](r)):r&&r.features&&(r={geoJson:r}),null==t&&(t="GEO_ANONYMOUS_"+dc++),new uc(t+dc++,t,r&&r.geoJson,r&&r.specialAreas,e.get("nameMap"))}},pc=fc;function mc(e){e.registerComponentModel(iu),e.registerComponentView(tc),e.registerAction({type:"geo3DChangeCamera",event:"geo3dcamerachanged",update:"series:updateCamera"},(function(e,t){t.eachComponent({mainType:"geo3D",query:e},(function(t){t.setView(e)}))})),e.registerCoordinateSystem("geo3D",pc)}function gc(e,t){e.id=e.id||e.name||t+""}Object(L["v"])(mc);var vc=L["c"].extend({type:"globe",layoutMode:"box",coordinateSystem:null,init:function(){vc.superApply(this,"init",arguments),L["w"].each(this.option.layers,(function(e,t){L["w"].merge(e,this.defaultLayerOption),gc(e,t)}),this)},mergeOption:function(e){var t=this.option.layers;function r(e){return L["w"].reduce(e,(function(e,t,r){return gc(t,r),e[t.id]=t,e}),{})}if(this.option.layers=null,vc.superApply(this,"mergeOption",arguments),t&&t.length){var i=r(e.layers),n=r(t);for(var a in i)n[a]?L["w"].merge(n[a],i[a],!0):t.push(e.layers[a]);this.option.layers=t}L["w"].each(this.option.layers,(function(e){L["w"].merge(e,this.defaultLayerOption)}),this)},optionUpdated:function(){this.updateDisplacementHash()},defaultLayerOption:{show:!0,type:"overlay"},defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",baseColor:"#fff",baseTexture:"",heightTexture:"",displacementTexture:"",displacementScale:0,displacementQuality:"medium",globeRadius:100,globeOuterRadius:150,shading:"lambert",light:{main:{time:""}},atmosphere:{show:!1,offset:5,color:"#ffffff",glowPower:6,innerGlowPower:2},viewControl:{autoRotate:!0,panSensitivity:0,targetCoord:null},layers:[]},setDisplacementData:function(e,t,r){this.displacementData=e,this.displacementWidth=t,this.displacementHeight=r},getDisplacementTexture:function(){return this.get("displacementTexture")||this.get("heightTexture")},getDisplacemenScale:function(){var e=this.getDisplacementTexture(),t=this.get("displacementScale");return e&&"none"!==e||(t=0),t},hasDisplacement:function(){return this.getDisplacemenScale()>0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var e=this.getDisplacementTexture(),t=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==e||this._displacementScale!==t,this._displacementTexture=e,this._displacementScale=t},isDisplacementChanged:function(){return this._displacementChanged}});L["w"].merge(vc.prototype,ho),L["w"].merge(vc.prototype,fo),L["w"].merge(vc.prototype,po),L["w"].merge(vc.prototype,eu);var _c=vc,yc=Math.PI,xc=Math.sin,Tc=Math.cos,bc=Math.tan,wc=Math.asin,Ec=Math.atan2,Sc=yc/180,Cc=864e5,Ac=2440588,Mc=2451545;function Lc(e){return e.valueOf()/Cc-.5+Ac}function Dc(e){return Lc(e)-Mc}var Nc=23.4397*Sc;function Rc(e,t){return Ec(xc(e)*Tc(Nc)-bc(t)*xc(Nc),Tc(e))}function Ic(e,t){return wc(xc(t)*Tc(Nc)+Tc(t)*xc(Nc)*xc(e))}function Pc(e,t,r){return Ec(xc(e),Tc(e)*xc(t)-bc(r)*Tc(t))}function Oc(e,t,r){return wc(xc(t)*xc(r)+Tc(t)*Tc(r)*Tc(e))}function Bc(e,t){return Sc*(280.16+360.9856235*e)-t}function Fc(e){return Sc*(357.5291+.98560028*e)}function Uc(e){var t=Sc*(1.9148*xc(e)+.02*xc(2*e)+3e-4*xc(3*e)),r=102.9372*Sc;return e+t+r+yc}function zc(e){var t=Fc(e),r=Uc(t);return{dec:Ic(r,0),ra:Rc(r,0)}}var Gc={getPosition:function(e,t,r){var i=Sc*-r,n=Sc*t,a=Dc(e),o=zc(a),s=Bc(a,i)-o.ra;return{azimuth:Pc(s,n,o.dec),altitude:Oc(s,n,o.dec)}}},Hc=Gc,kc="@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end";Ya.Shader["import"](Ra),Ya.Shader["import"](kc);var Vc=L["d"].extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(e,t){this.groupGL=new Ya.Node,this._sphereGeometry=new Ya.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new Ya.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new Ya.PlaneGeometry,this._earthMesh=new Ya.Mesh({renderNormal:!0}),this._atmosphereMesh=new Ya.Mesh,this._atmosphereGeometry=new Ya.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new Ya.Material({shader:new Ya.Shader(Ya.Shader.source("ecgl.atmosphere.vertex"),Ya.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=Ya.Mesh.CW,this._lightRoot=new Ya.Node,this._sceneHelper=new Po,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new bo({zr:t.getZr()}),this._control.init(),this._layerMeshes={}},render:function(e,t,r){var i=e.coordinateSystem,n=e.get("shading");i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var a=this._earthMesh;a.geometry=this._sphereGeometry;var o="ecgl."+n;a.material&&a.material.shader.name===o||(a.material=Ya.createMaterial(o)),Ya.setMaterialFromModel(n,a.material,e,r),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(e){var t=a.material.get(e);t&&(t.flipY=!1)})),a.material.set("color",Ya.parseColor(e.get("baseColor")));var s=.99*i.radius;if(a.scale.set(s,s,s),e.get("atmosphere.show")){a.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:e.get("atmosphere.glowPower")||6,glowColor:e.get("atmosphere.color")||"#ffffff"}),a.material.setUniforms({glowPower:e.get("atmosphere.innerGlowPower")||2,glowColor:e.get("atmosphere.color")||"#ffffff"});var l=e.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else a.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=a.material.setTextureImage("diffuseMap",e.get("baseTexture"),r,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(a);var c=a.material.setTextureImage("bumpMap",e.get("heightTexture"),r,{flipY:!1,anisotropic:8});c&&c.surface&&c.surface.attachToMesh(a),a.material[e.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(e,r),this._displaceVertices(e,r),this._updateViewControl(e,r),this._updateLayers(e,r)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},_updateLayers:function(e,t){var r=e.coordinateSystem,i=e.get("layers"),n=r.radius,a=[],o=[],s=[],l=[];L["w"].each(i,(function(e){var i=new L["f"](e),u=i.get("type"),c=Ya.loadTexture(i.get("texture"),t,{flipY:!1,anisotropic:8});if(c.surface&&c.surface.attachToMesh(this._earthMesh),"blend"===u){var h=i.get("blendTo"),d=na.firstNotNull(i.get("intensity"),1);"emission"===h?(s.push(c),l.push(d)):(a.push(c),o.push(d))}else{var f=i.get("id"),p=this._layerMeshes[f];p||(p=this._layerMeshes[f]=new Ya.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0}));var m=i.get("shading");"lambert"===m?(p.material=p.__lambertMaterial||new Ya.Material({autoUpdateTextureStatus:!1,shader:Ya.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),p.__lambertMaterial=p.material):(p.material=p.__colorMaterial||new Ya.Material({autoUpdateTextureStatus:!1,shader:Ya.createShader("ecgl.color"),transparent:!0,depthMask:!1}),p.__colorMaterial=p.material),p.material.enableTexture("diffuseMap");var g=i.get("distance"),v=n+(null==g?r.radius/100:g);p.scale.set(v,v,v),n=v;var _=this._blankTexture||(this._blankTexture=Ya.createBlankTexture("rgba(255, 255, 255, 0)"));p.material.set("diffuseMap",_),Ya.loadTexture(i.get("texture"),t,{flipY:!1,anisotropic:8},(function(e){e.surface&&e.surface.attachToMesh(p),p.material.set("diffuseMap",e),t.getZr().refresh()})),i.get("show")?this.groupGL.add(p):this.groupGL.remove(p)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",a.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",s.length),u.set("layerDiffuseMap",a),u.set("layerDiffuseIntensity",o),u.set("layerEmissiveMap",s),u.set("layerEmissionIntensity",l);var c=e.getModel("debug.wireframe");if(c.get("show")){u.define("both","WIREFRAME_TRIANGLE");var h=Ya.parseColor(c.get("lineStyle.color")||"rgba(0,0,0,0.5)"),d=na.firstNotNull(c.get("lineStyle.width"),1);u.set("wireframeLineWidth",d),u.set("wireframeLineColor",h)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(e,t){var r=e.coordinateSystem,i=e.getModel("viewControl"),n=(r.viewGL.camera,this);function a(){return{type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-r.radius,center:o.getCenter(),from:n.uid,globeId:e.id}}var o=this._control;o.setViewGL(r.viewGL);var s,l,u=i.get("targetCoord");null!=u&&(l=u[0]+90,s=u[1]),o.setFromViewControlModel(i,{baseDistance:r.radius,alpha:s,beta:l}),o.off("update"),o.on("update",(function(){t.dispatchAction(a())}))},_displaceVertices:function(e,t){var r=e.get("displacementQuality"),i=e.get("debug.wireframe.show"),n=e.coordinateSystem;if(e.isDisplacementChanged()||r!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=r,this._showDebugWireframe=i;var a=this._sphereGeometry,o={low:100,medium:200,high:400,ultra:800}[r]||200,s=o/2;(a.widthSegments!==o||i)&&(a.widthSegments=o,a.heightSegments=s,a.build()),this._doDisplaceVertices(a,n),i&&a.generateBarycentric()}},_doDisplaceVertices:function(e,t){var r=e.attributes.position.value,i=e.attributes.texcoord0.value,n=e.__originalPosition;n&&n.length===r.length||(n=new Float32Array(r.length),n.set(r),e.__originalPosition=n);for(var a=t.displacementWidth,o=t.displacementHeight,s=t.displacementData,l=0;l<e.vertexCount;l++){var u=3*l,c=2*l,h=n[u+1],d=n[u+2],f=n[u+3],p=i[c++],m=i[c++],g=Math.round(p*(a-1)),v=Math.round(m*(o-1)),_=v*a+g,y=s?s[_]:0;r[u+1]=h+h*y,r[u+2]=d+d*y,r[u+3]=f+f*y}e.generateVertexNormals(),e.dirty(),e.updateBoundingBox()},_updateLight:function(e,t){var r=this._earthMesh;this._sceneHelper.updateLight(e);var i=this._sceneHelper.mainLight,n=e.get("light.main.time")||new Date,a=Hc.getPosition(L["p"].parseDate(n),0,0),o=Math.cos(a.altitude);i.position.y=-o*Math.cos(a.azimuth),i.position.x=Math.sin(a.altitude),i.position.z=o*Math.sin(a.azimuth),i.lookAt(r.getWorldPosition())},dispose:function(e,t){this.groupGL.removeAll(),this._control.dispose()}}),Wc=So.vec3;function jc(e){this.radius=e,this.viewGL=null,this.altitudeAxis,this.displacementData=null,this.displacementWidth,this.displacementHeight}jc.prototype={constructor:jc,dimensions:["lng","lat","alt"],type:"globe",containPoint:function(){},setDisplacementData:function(e,t,r){this.displacementData=e,this.displacementWidth=t,this.displacementHeight=r},_getDisplacementScale:function(e,t){var r=(e+180)/360*(this.displacementWidth-1),i=(90-t)/180*(this.displacementHeight-1),n=Math.round(r)+Math.round(i)*this.displacementWidth;return this.displacementData[n]},dataToPoint:function(e,t){var r=e[0],i=e[1],n=e[2]||0,a=this.radius;this.displacementData&&(a*=1+this._getDisplacementScale(r,i)),this.altitudeAxis&&(a+=this.altitudeAxis.dataToCoord(n)),r=r*Math.PI/180,i=i*Math.PI/180;var o=Math.cos(i)*a;return t=t||[],t[0]=-o*Math.cos(r+Math.PI),t[1]=Math.sin(i)*a,t[2]=o*Math.sin(r+Math.PI),t},pointToData:function(e,t){var r=e[0],i=e[1],n=e[2],a=Wc.len(e);r/=a,i/=a,n/=a;var o=Math.asin(i),s=Math.atan2(n,-r);s<0&&(s=2*Math.PI+s);var l=180*o/Math.PI,u=180*s/Math.PI-180;return t=t||[],t[0]=u,t[1]=l,t[2]=a-this.radius,this.altitudeAxis&&(t[2]=this.altitudeAxis.coordToData(t[2])),t}};var Xc=jc;function qc(e,t){var r=document.createElement("canvas"),i=r.getContext("2d"),n=e.width,a=e.height;r.width=n,r.height=a,i.drawImage(e,0,0,n,a);for(var o=i.getImageData(0,0,n,a).data,s=new Float32Array(o.length/4),l=0;l<o.length/4;l++){var u=o[4*l];s[l]=u/255*t}return{data:s,width:n,height:a}}function Zc(e,t){var r=e.getBoxLayoutParams(),i=Object(ls["g"])(r,{width:t.getWidth(),height:t.getHeight()});i.y=t.getHeight()-i.y-i.height,this.viewGL.setViewport(i.x,i.y,i.width,i.height,t.getDevicePixelRatio()),this.radius=e.get("globeRadius");var n=e.get("globeOuterRadius");this.altitudeAxis&&this.altitudeAxis.setExtent(0,n-this.radius)}function Yc(e,t){var r=[1/0,-1/0];if(e.eachSeries((function(e){if(e.coordinateSystem===this){var t=e.getData(),i=e.coordDimToDataDim("alt"),n=i&&i[0];if(n){var a=t.getDataExtent(n,!0);r[0]=Math.min(r[0],a[0]),r[1]=Math.max(r[1],a[1])}}}),this),r&&isFinite(r[1]-r[0])){var i=L["m"].createScale(r,{type:"value",min:"dataMin",max:"dataMax"});this.altitudeAxis=new L["a"]("altitude",i),this.resize(this.model,t)}}var Kc={dimensions:Xc.prototype.dimensions,create:function(e,t){var r=[];return e.eachComponent("globe",(function(e){e.__viewGL=e.__viewGL||new Bl;var i=new Xc;i.viewGL=e.__viewGL,e.coordinateSystem=i,i.model=e,r.push(i),i.resize=Zc,i.resize(e,t),i.update=Yc})),e.eachSeries((function(t){if("globe"===t.get("coordinateSystem")){var r=t.getReferringComponents("globe").models[0];if(r||(r=e.getComponent("globe")),!r)throw new Error('globe "'+na.firstNotNull(t.get("globe3DIndex"),t.get("globe3DId"),0)+'" not found');var i=r.coordinateSystem;t.coordinateSystem=i}})),e.eachComponent("globe",(function(e,r){var i=e.coordinateSystem,n=e.getDisplacementTexture(),a=e.getDisplacemenScale();if(e.isDisplacementChanged()){if(e.hasDisplacement()){var o=!0;Ya.loadTexture(n,t,(function(r){var i=r.image,n=qc(i,a);e.setDisplacementData(n.data,n.width,n.height),o||t.dispatchAction({type:"globeUpdateDisplacment"})})),o=!1}else i.setDisplacementData(null,0,0);i.setDisplacementData(e.displacementData,e.displacementWidth,e.displacementHeight)}})),r}},$c=Kc;function Qc(e){e.registerComponentModel(_c),e.registerComponentView(Vc),e.registerCoordinateSystem("globe",$c),e.registerAction({type:"globeChangeCamera",event:"globecamerachanged",update:"series:updateCamera"},(function(e,t){t.eachComponent({mainType:"globe",query:e},(function(t){t.setView(e)}))})),e.registerAction({type:"globeUpdateDisplacment",event:"globedisplacementupdated",update:"update"},(function(e,t){}))}Object(L["v"])(Qc);var Jc=["zoom","center","pitch","bearing"],eh=L["c"].extend({type:"mapbox3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,style:"mapbox://styles/mapbox/light-v9",center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMapboxCameraOption:function(){var e=this;return Jc.reduce((function(t,r){return t[r]=e.get(r),t}),{})},setMapboxCameraOption:function(e){null!=e&&Jc.forEach((function(t){null!=e[t]&&(this.option[t]=e[t])}),this)},getMapbox:function(){return this._mapbox},setMapbox:function(e){this._mapbox=e}});L["w"].merge(eh.prototype,fo),L["w"].merge(eh.prototype,po);var th=eh;function rh(e,t){if(this.id=e,this.zr=t,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!mapboxgl)throw new Error("Mapbox GL library must be included. See https://www.mapbox.com/mapbox-gl-js/api/");this._mapbox=new mapboxgl.Map({container:this.dom}),this._initEvents()}rh.prototype.setUnpainted=function(){},rh.prototype.resize=function(){this._mapbox.resize()},rh.prototype.getMapbox=function(){return this._mapbox},rh.prototype.clear=function(){},rh.prototype.refresh=function(){this._mapbox.resize()};var ih=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","wheel","touchstart","touchend","touchmove","touchcancel"];rh.prototype._initEvents=function(){var e=this._mapbox.getCanvasContainer();this._handlers=this._handlers||{contextmenu:function(e){return e.preventDefault(),!1}},ih.forEach((function(t){this._handlers[t]=function(t){var r={};for(var i in t)r[i]=t[i];r.bubbles=!1;var n=new t.constructor(t.type,r);e.dispatchEvent(n)},this.zr.dom.addEventListener(t,this._handlers[t])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},rh.prototype.dispose=function(){ih.forEach((function(e){this.zr.dom.removeEventListener(e,this._handlers[e])}),this)};var nh=rh,ah="\n@export ecgl.displayShadow.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_WorldPosition;\n\nvarying vec3 v_Normal;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end\n\n\n@export ecgl.displayShadow.fragment\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform float roughness: 0.2;\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.ssaoMap.header\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n float shadow = 1.0;\n\n @import ecgl.common.ssaoMap.main\n\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\n }\n#endif\n\n shadow *= 0.5 + ao * 0.5;\n shadow = clamp(shadow, 0.0, 1.0);\n\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\n}\n\n@end";Ya.Shader.import(ah);var oh=L["d"].extend({type:"mapbox3D",__ecgl__:!0,init:function(e,t){var r=t.getZr();this._zrLayer=new nh("mapbox3D",r),r.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Ya.Node,this._sceneHelper=new Po(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMapbox(),n=this._dispatchInteractAction.bind(this,t,i);["zoom","rotate","drag","pitch","rotate","move"].forEach((function(e){i.on(e,n)})),this._groundMesh=new Ya.Mesh({geometry:new Ya.PlaneGeometry,material:new Ya.Material({shader:new Ya.Shader({vertex:Ya.Shader.source("ecgl.displayShadow.vertex"),fragment:Ya.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},render:function(e,t,r){var i=this._zrLayer.getMapbox(),n=e.get("style"),a=JSON.stringify(n);a!==this._oldStyleStr&&n&&i.setStyle(n),this._oldStyleStr=a,i.setCenter(e.get("center")),i.setZoom(e.get("zoom")),i.setPitch(e.get("pitch")),i.setBearing(e.get("bearing")),e.setMapbox(i);var o=e.coordinateSystem;o.viewGL.scene.add(this._lightRoot),o.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(o.viewGL.scene),this._sceneHelper.updateLight(e),o.viewGL.setPostEffect(e.getModel("postEffect"),r),o.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._mapbox3DModel=e},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r),e.coordinateSystem.viewGL.scene.traverse((function(e){e.material&&(e.material.define("fragment","NORMAL_UP_AXIS",2),e.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(e,t,r,i){e.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),r.getZr().refresh()},_dispatchInteractAction:function(e,t,r){e.dispatchAction({type:"mapbox3DChangeCamera",pitch:t.getPitch(),zoom:t.getZoom(),center:t.getCenter().toArray(),bearing:t.getBearing(),mapbox3DId:this._mapbox3DModel&&this._mapbox3DModel.id})},_updateGroundMesh:function(){if(this._mapbox3DModel){var e=this._mapbox3DModel.coordinateSystem,t=e.dataToPoint(e.center);this._groundMesh.position.set(t[0],t[1],-.001);var r=new Ya.Plane(new Ya.Vector3(0,0,1),0),i=e.viewGL.camera.castRay(new Ya.Vector2(-1,-1)),n=e.viewGL.camera.castRay(new Ya.Vector2(1,1)),a=i.intersectPlane(r),o=n.intersectPlane(r),s=a.dist(o)/e.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(e,t){this._zrLayer&&this._zrLayer.dispose(),t.getZr().painter.delLayer(-1e3)}}),sh=So.mat4,lh=512,uh=.6435011087932844,ch=Math.PI,hh=.1;function dh(){this.width=0,this.height=0,this.altitudeScale=1,this.boxHeight="auto",this.altitudeExtent,this.bearing=0,this.pitch=0,this.center=[0,0],this._origin,this.zoom=0,this._initialZoom,this.maxPitch=60,this.zoomOffset=0}dh.prototype={constructor:dh,dimensions:["lng","lat","alt"],containPoint:function(){},setCameraOption:function(e){this.bearing=e.bearing,this.pitch=e.pitch,this.center=e.center,this.zoom=e.zoom,this._origin||(this._origin=this.projectOnTileWithScale(this.center,lh)),null==this._initialZoom&&(this._initialZoom=this.zoom),this.updateTransform()},updateTransform:function(){if(this.height){var e=.5/Math.tan(uh/2)*this.height*hh,t=Math.max(Math.min(this.pitch,this.maxPitch),0)/180*Math.PI,r=uh/2,i=Math.PI/2+t,n=Math.sin(r)*e/Math.sin(Math.PI-i-r),a=Math.cos(Math.PI/2-t)*n+e,o=1.1*a;this.pitch>50&&(o=1e3);var s=[];sh.perspective(s,uh,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(s),this.viewGL.camera.decomposeProjectionMatrix();s=sh.identity([]);var l=this.dataToPoint(this.center);sh.scale(s,s,[1,-1,1]),sh.translate(s,s,[0,0,-e]),sh.rotateX(s,s,t),sh.rotateZ(s,s,-this.bearing/180*Math.PI),sh.translate(s,s,[-l[0]*this.getScale()*hh,-l[1]*this.getScale()*hh,0]),this.viewGL.camera.viewMatrix.array=s;var u=[];sh.invert(u,s),this.viewGL.camera.worldTransform.array=u,this.viewGL.camera.decomposeWorldTransform();var c,h=lh*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var d=this.altitudeExtent[1]-this.altitudeExtent[0];c=this.boxHeight/d*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else c=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*hh;this.viewGL.rootNode.scale.set(this.getScale()*hh,this.getScale()*hh,c)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(e,t){return this.projectOnTileWithScale(e,this.getScale()*lh,t)},projectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1],a=i*ch/180,o=n*ch/180,s=t*(a+ch)/(2*ch),l=t*(ch-Math.log(Math.tan(ch/4+.5*o)))/(2*ch);return r=r||[],r[0]=s,r[1]=l,r},unprojectFromTile:function(e,t){return this.unprojectOnTileWithScale(e,this.getScale()*lh,t)},unprojectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1],a=i/t*(2*ch)-ch,o=2*(Math.atan(Math.exp(ch-n/t*(2*ch)))-ch/4);return r=r||[],r[0]=180*a/ch,r[1]=180*o/ch,r},dataToPoint:function(e,t){return t=this.projectOnTileWithScale(e,lh,t),t[0]-=this._origin[0],t[1]-=this._origin[1],t[2]=isNaN(e[2])?0:e[2],isNaN(e[2])||(t[2]=e[2],this.altitudeExtent&&(t[2]-=this.altitudeExtent[0])),t}};var fh=dh;function ph(){fh.apply(this,arguments)}ph.prototype=new fh,ph.prototype.constructor=ph,ph.prototype.type="mapbox3D";var mh=ph,gh=function(e,t,r){function i(e,t){var r=t.getWidth(),i=t.getHeight(),n=t.getDevicePixelRatio();this.viewGL.setViewport(0,0,r,i,n),this.width=r,this.height=i,this.altitudeScale=e.get("altitudeScale"),this.boxHeight=e.get("boxHeight")}function n(e,t){if("auto"!==this.model.get("boxHeight")){var r=[1/0,-1/0];e.eachSeries((function(e){if(e.coordinateSystem===this){var t=e.getData(),i=e.coordDimToDataDim("alt")[0];if(i){var n=t.getDataExtent(i,!0);r[0]=Math.min(r[0],n[0]),r[1]=Math.max(r[1],n[1])}}}),this),r&&isFinite(r[1]-r[0])&&(this.altitudeExtent=r)}}return{dimensions:t.prototype.dimensions,create:function(a,o){var s=[];return a.eachComponent(e,(function(e){var r=e.__viewGL;r||(r=e.__viewGL=new Bl,r.setRootNode(new Ya.Node));var a=new t;a.viewGL=e.__viewGL,a.resize=i,a.resize(e,o),s.push(a),e.coordinateSystem=a,a.model=e,a.update=n})),a.eachSeries((function(t){if(t.get("coordinateSystem")===e){var r=t.getReferringComponents(e).models[0];if(r||(r=a.getComponent(e)),!r)throw new Error(e+' "'+na.firstNotNull(t.get(e+"Index"),t.get(e+"Id"),0)+'" not found');t.coordinateSystem=r.coordinateSystem}})),r&&r(s,a,o),s}}},vh=gh("mapbox3D",mh,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMapboxCameraOption())}))})),_h=vh;function yh(e){e.registerComponentModel(th),e.registerComponentView(oh),e.registerCoordinateSystem("mapbox3D",_h),e.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"mapbox3D",query:e},(function(t){t.setMapboxCameraOption(e)}))}))}Object(L["v"])(yh);var xh=["zoom","center","pitch","bearing"],Th=L["c"].extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© <a href="http://osm.org">OpenStreetMap</a> contributors, © <a href="https://carto.com/">CARTO</a>',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var e=this;return xh.reduce((function(t,r){return t[r]=e.get(r),t}),{})},setMaptalksCameraOption:function(e){null!=e&&xh.forEach((function(t){null!=e[t]&&(this.option[t]=e[t])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(e){this._maptalks=e}});L["w"].merge(Th.prototype,fo),L["w"].merge(Th.prototype,po);var bh=Th;function wh(e,t,r,i){if(this.id=e,this.zr=t,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:r,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}wh.prototype.setUnpainted=function(){},wh.prototype.resize=function(){this._maptalks.checkSize()},wh.prototype.getMaptalks=function(){return this._maptalks},wh.prototype.clear=function(){},wh.prototype.refresh=function(){this._maptalks.checkSize()};var Eh=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];wh.prototype._initEvents=function(){var e=this.dom;this._handlers=this._handlers||{contextmenu:function(e){return e.preventDefault(),!1}},Eh.forEach((function(t){this._handlers[t]=function(r){var i={};for(var n in r)i[n]=r[n];i.bubbles=!1;var a=new r.constructor(r.type,i);"mousewheel"===t||"DOMMouseScroll"===t?e.dispatchEvent(a):e.firstElementChild.dispatchEvent(a)},this.zr.dom.addEventListener(t,this._handlers[t])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},wh.prototype.dispose=function(){Eh.forEach((function(e){this.zr.dom.removeEventListener(e,this._handlers[e])}),this),this._maptalks.remove()};var Sh=wh;Ya.Shader.import(ah);var Ch=L["d"].extend({type:"maptalks3D",__ecgl__:!0,init:function(e,t){this._groundMesh=new Ya.Mesh({geometry:new Ya.PlaneGeometry,material:new Ya.Material({shader:new Ya.Shader({vertex:Ya.Shader.source("ecgl.displayShadow.vertex"),fragment:Ya.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(e,t){var r=t.getZr();this._zrLayer=new Sh("maptalks3D",r,e.get("center"),e.get("zoom")),r.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Ya.Node,this._sceneHelper=new Po(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),n=this._dispatchInteractAction.bind(this,t,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(e){i.on(e,n)}))},render:function(e,t,r){this._zrLayer||this._initMaptalksLayer(e,r);var i=this._zrLayer.getMaptalks(),n=e.get("urlTemplate"),a=i.getBaseLayer();n!==this._oldUrlTemplate&&(a?a.setOptions({urlTemplate:n,attribution:e.get("attribution")}):(a=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:n,subdomains:["a","b","c"],attribution:e.get("attribution")}),i.setBaseLayer(a))),this._oldUrlTemplate=n,i.setCenter(e.get("center")),i.setZoom(e.get("zoom"),{animation:!1}),i.setPitch(e.get("pitch")),i.setBearing(e.get("bearing")),e.setMaptalks(i);var o=e.coordinateSystem;o.viewGL.scene.add(this._lightRoot),o.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(o.viewGL.scene),this._sceneHelper.updateLight(e),o.viewGL.setPostEffect(e.getModel("postEffect"),r),o.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._maptalks3DModel=e},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r),e.coordinateSystem.viewGL.scene.traverse((function(e){e.material&&(e.material.define("fragment","NORMAL_UP_AXIS",2),e.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(e,t,r,i){e.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),r.getZr().refresh()},_dispatchInteractAction:function(e,t,r){e.dispatchAction({type:"maptalks3DChangeCamera",pitch:t.getPitch(),zoom:Mh(t.getResolution())+1,center:t.getCenter().toArray(),bearing:t.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var e=this._maptalks3DModel.coordinateSystem,t=e.dataToPoint(e.center);this._groundMesh.position.set(t[0],t[1],-.001);var r=new Ya.Plane(new Ya.Vector3(0,0,1),0),i=e.viewGL.camera.castRay(new Ya.Vector2(-1,-1)),n=e.viewGL.camera.castRay(new Ya.Vector2(1,1)),a=i.intersectPlane(r),o=n.intersectPlane(r),s=a.dist(o)/e.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(e,t){this._zrLayer&&this._zrLayer.dispose(),t.getZr().painter.delLayer(-1e3)}});const Ah=12756274*Math.PI/(256*Math.pow(2,20));function Mh(e){return 19-Math.log(e/Ah)/Math.LN2}function Lh(){fh.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}Lh.prototype=new fh,Lh.prototype.constructor=Lh,Lh.prototype.type="maptalks3D";var Dh=Lh,Nh=gh("maptalks3D",Dh,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMaptalksCameraOption())}))})),Rh=Nh;function Ih(e){e.registerComponentModel(bh),e.registerComponentView(Ch),e.registerCoordinateSystem("maptalks3D",Rh),e.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"maptalks3D",query:e},(function(t){t.setMaptalksCameraOption(e)}))}))}Object(L["v"])(Ih);var Ph=So.vec3,Oh=L["m"].dataStack.isDimensionStacked;function Bh(e){var t=e[0],r=e[1];return!(t>0&&r>0||t<0&&r<0)}function Fh(e,t){var r=e.getData(),i=e.get("barSize");if(null==i){var n,a,o=t.size,s=t.getAxis("x"),l=t.getAxis("y");n="category"===s.type?.7*s.getBandWidth():.6*Math.round(o[0]/Math.sqrt(r.count())),a="category"===l.type?.7*l.getBandWidth():.6*Math.round(o[1]/Math.sqrt(r.count())),i=[n,a]}else L["w"].isArray(i)||(i=[i,i]);var u=t.getAxis("z").scale.getExtent(),c=Bh(u),h=["x","y","z"].map((function(t){return e.coordDimToDataDim(t)[0]})),d=Oh(r,h[2]),f=d?r.getCalculationInfo("stackResultDimension"):h[2];r.each(h,(function(e,n,a,o){var s=r.get(f,o),l=d?s-a:c?0:u[0],h=t.dataToPoint([e,n,l]),p=t.dataToPoint([e,n,s]),m=Ph.dist(h,p),g=[0,p[1]<h[1]?-1:1,0];0===Math.abs(m)&&(m=.1);var v=[i[0],m,i[1]];r.setItemLayout(o,[h,g,v])})),r.setLayout("orient",[1,0,0])}var Uh=Fh,zh=function(e,t,r){for(var i=e.getDataExtent(t),n=e.getDataExtent(r),a=i[1]-i[0]||i[0],o=n[1]-n[0]||n[0],s=50,l=new Uint8Array(s*s),u=0;u<e.count();u++){var c=e.get(t,u),h=e.get(r,u),d=Math.floor((c-i[0])/a*(s-1)),f=Math.floor((h-n[0])/o*(s-1)),p=f*s+d;l[p]=l[p]||1}var m=0;for(u=0;u<l.length;u++)l[u]&&m++;return m/l.length},Gh=So.vec3,Hh=L["m"].dataStack.isDimensionStacked;function kh(e,t){var r=e.getData(),i=e.get("minHeight")||0,n=e.get("barSize"),a=["lng","lat","alt"].map((function(t){return e.coordDimToDataDim(t)[0]}));if(null==n){var o=t.radius*Math.PI,s=zh(r,a[0],a[1]);n=[o/Math.sqrt(r.count()/s),o/Math.sqrt(r.count()/s)]}else L["w"].isArray(n)||(n=[n,n]);var l=jh(r,a);r.each(a,(function(e,a,o,s){var u=r.get(l.dimension,s),c=l.isStacked?u-o:t.altitudeAxis.scale.getExtent()[0],h=Math.max(t.altitudeAxis.dataToCoord(o),i),d=t.dataToPoint([e,a,c]),f=t.dataToPoint([e,a,u]),p=Gh.sub([],f,d);Gh.normalize(p,p);var m=[n[0],h,n[1]];r.setItemLayout(s,[d,p,m])})),r.setLayout("orient",kt.UP.array)}function Vh(e,t){var r=e.getData(),i=e.get("barSize"),n=e.get("minHeight")||0,a=["lng","lat","alt"].map((function(t){return e.coordDimToDataDim(t)[0]}));if(null==i){var o=Math.min(t.size[0],t.size[2]),s=zh(r,a[0],a[1]);i=[o/Math.sqrt(r.count()/s),o/Math.sqrt(r.count()/s)]}else L["w"].isArray(i)||(i=[i,i]);var l=[0,1,0],u=jh(r,a);r.each(a,(function(e,a,o,s){var c=r.get(u.dimension,s),h=u.isStacked?c-o:t.altitudeAxis.scale.getExtent()[0],d=Math.max(t.altitudeAxis.dataToCoord(o),n),f=t.dataToPoint([e,a,h]),p=[i[0],d,i[1]];r.setItemLayout(s,[f,l,p])})),r.setLayout("orient",[1,0,0])}function Wh(e,t){var r=e.getData(),i=e.coordDimToDataDim("lng")[0],n=e.coordDimToDataDim("lat")[0],a=e.coordDimToDataDim("alt")[0],o=e.get("barSize"),s=e.get("minHeight")||0;if(null==o){var l=r.getDataExtent(i),u=r.getDataExtent(n),c=t.dataToPoint([l[0],u[0]]),h=t.dataToPoint([l[1],u[1]]),d=Math.min(Math.abs(c[0]-h[0]),Math.abs(c[1]-h[1]))||1,f=zh(r,i,n);o=[d/Math.sqrt(r.count()/f),d/Math.sqrt(r.count()/f)]}else L["w"].isArray(o)||(o=[o,o]),o[0]/=t.getScale()/16,o[1]/=t.getScale()/16;var p=[0,0,1],m=[i,n,a],g=jh(r,m);r.each(m,(function(e,i,n,a){var l=r.get(g.dimension,a),u=g.isStacked?l-n:0,c=t.dataToPoint([e,i,u]),h=t.dataToPoint([e,i,l]),d=Math.max(h[2]-c[2],s),f=[o[0],d,o[1]];r.setItemLayout(a,[c,p,f])})),r.setLayout("orient",[1,0,0])}function jh(e,t){var r=Hh(e,t[2]);return{dimension:r?e.getCalculationInfo("stackResultDimension"):t[2],isStacked:r}}function Xh(e){e.registerLayout((function(e,t){e.eachSeriesByType("bar3D",(function(e){var t=e.coordinateSystem,r=t&&t.type;"globe"===r?kh(e,t):"cartesian3D"===r?Uh(e,t):"geo3D"===r?Vh(e,t):("mapbox3D"===r||"maptalks3D"===r)&&Wh(e,t)}))}))}var qh={getFormattedLabel:function(e,t,r,i,n){r=r||"normal";var a=e.getData(i),o=a.getItemModel(t),s=e.getDataParams(t,i);null!=n&&s.value instanceof Array&&(s.value=s.value[n]);var l,u=o.get("normal"===r?["label","formatter"]:["emphasis","label","formatter"]);return null==u&&(u=o.get(["label","formatter"])),"function"===typeof u?(s.status=r,l=u(s)):"string"===typeof u&&(l=L["i"].formatTpl(u,s)),l},normalizeToArray:function(e){return e instanceof Array?e:null==e?[]:[e]}},Zh=qh;function Yh(e,t){var r=[];return L["w"].each(e.dimensions,(function(i){var n=e.getDimensionInfo(i),a=n.otherDims,o=a[t];null!=o&&!1!==o&&(r[o]=n.name)})),r}var Kh=function(e,t,r){function i(e){var i=!0,a=[],o=Yh(n,"tooltip");function s(e,t){var o=n.getDimensionInfo(t);if(o&&!1!==o.otherDims.tooltip){var s=o.type,l=(i?"- "+(o.tooltipName||o.name)+": ":"")+("ordinal"===s?e+"":"time"===s?r?"":L["i"].formatTime("yyyy/MM/dd hh:mm:ss",e):L["i"].addCommas(e));l&&a.push(L["i"].encodeHTML(l))}}return o.length?L["w"].each(o,(function(e){s(n.get(e,t),e)})):L["w"].each(e,s),(i?"<br/>":"")+a.join(i?"<br/>":", ")}var n=e.getData(),a=e.getRawValue(t),o=L["w"].isArray(a)?i(a):L["i"].encodeHTML(L["i"].addCommas(a)),s=n.getName(t),l=Xu(n,t);L["w"].isObject(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var u=L["i"].getTooltipMarker(l),c=e.name;return"\0-"===c&&(c=""),c=c?L["i"].encodeHTML(c)+(r?": ":"<br/>"):"",r?u+c+o:c+u+(s?L["i"].encodeHTML(s)+": "+o:o)},$h=function(e,t,r){r=r||e.getSource();var i=t||L["j"](e.get("coordinateSystem"))||["x","y","z"],n=L["m"].createDimensions(r,{dimensionsDefine:r.dimensionsDefine||e.get("dimensions"),encodeDefine:r.encodeDefine||e.get("encode"),coordDimensions:i.map((function(t){var r=e.getReferringComponents(t+"Axis3D").models[0];return{type:r&&"category"===r.get("type")?"ordinal":"float",name:t}}))});"cartesian3D"===e.get("coordinateSystem")&&n.forEach((function(t){if(i.indexOf(t.coordDim)>=0){var r=e.getReferringComponents(t.coordDim+"Axis3D").models[0];r&&"category"===r.get("type")&&(t.ordinalMeta=r.getOrdinalMeta())}}));var a=L["m"].dataStack.enableDataStack(e,n,{byIndex:!0,stackedCoordDimension:"z"}),o=new L["e"](n,e);return o.setCalculationInfo(a),o.initData(r),o},Qh=L["g"].extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(e,t){return $h(this)},getFormattedLabel:function(e,t,r,i){var n=Zh.getFormattedLabel(this,e,t,r,i);return null==n&&(n=this.getData().get("z",e)),n},formatTooltip:function(e){return Kh(this,e)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});L["w"].merge(Qh.prototype,eu);var Jh=Qh,ed=So.vec3,td=So.mat3,rd=Vr.extend((function(){return{attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR"),prevPosition:new Vr.Attribute("prevPosition","float",3),prevNormal:new Vr.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(e){var t=this.enableNormal,r=this.getBarVertexCount()*e,i=this.getBarTriangleCount()*e;this.vertexCount!==r&&(this.attributes.position.init(r),t?this.attributes.normal.init(r):this.attributes.normal.value=null,this.attributes.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(r))},getBarVertexCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarVertexCount(e):this.enableNormal?24:8},getBarTriangleCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarTriangleCount(e):12},_getBevelBarVertexCount:function(e){return 4*(e+1)*(e+1)*2},_getBevelBarTriangleCount:function(e){var t=4*e+3,r=2*e+1;return(t+1)*r*2+4},setColor:function(e,t){for(var r=this.getBarVertexCount(),i=r*e,n=r*(e+1),a=i;a<n;a++)this.attributes.color.set(a,t);this.dirtyAttribute("color")},getDataIndexOfVertex:function(e){return this._dataIndices?this._dataIndices[e]:null},addBar:function(){for(var e=ed.create,t=ed.scaleAndAdd,r=e(),i=e(),n=e(),a=e(),o=e(),s=e(),l=e(),u=[],c=[],h=0;h<8;h++)u[h]=e();var d=[[0,1,5,4],[2,3,7,6],[4,5,6,7],[3,2,1,0],[0,4,7,3],[1,2,6,5]],f=[0,1,2,0,2,3],p=[];for(h=0;h<d.length;h++)for(var m=d[h],g=0;g<2;g++){for(var v=[],_=0;_<3;_++)v.push(m[f[3*g+_]]);p.push(v)}return function(e,h,m,g,v,_){var y=this._vertexOffset;if(this.bevelSize>0&&this.bevelSegments>0)this._addBevelBar(e,h,m,g,this.bevelSize,this.bevelSegments,v);else{ed.copy(n,h),ed.normalize(n,n),ed.cross(a,m,n),ed.normalize(a,a),ed.cross(i,n,a),ed.normalize(a,a),ed.negate(o,i),ed.negate(s,n),ed.negate(l,a),t(u[0],e,i,g[0]/2),t(u[0],u[0],a,g[2]/2),t(u[1],e,i,g[0]/2),t(u[1],u[1],l,g[2]/2),t(u[2],e,o,g[0]/2),t(u[2],u[2],l,g[2]/2),t(u[3],e,o,g[0]/2),t(u[3],u[3],a,g[2]/2),t(r,e,n,g[1]),t(u[4],r,i,g[0]/2),t(u[4],u[4],a,g[2]/2),t(u[5],r,i,g[0]/2),t(u[5],u[5],l,g[2]/2),t(u[6],r,o,g[0]/2),t(u[6],u[6],l,g[2]/2),t(u[7],r,o,g[0]/2),t(u[7],u[7],a,g[2]/2);var x=this.attributes;if(this.enableNormal){c[0]=i,c[1]=o,c[2]=n,c[3]=s,c[4]=a,c[5]=l;for(var T=this._vertexOffset,b=0;b<d.length;b++){for(var w=3*this._triangleOffset,E=0;E<6;E++)this.indices[w++]=T+f[E];T+=4,this._triangleOffset+=2}for(b=0;b<d.length;b++){var S=c[b];for(E=0;E<4;E++){var C=d[b][E];x.position.set(this._vertexOffset,u[C]),x.normal.set(this._vertexOffset,S),x.color.set(this._vertexOffset++,v)}}}else{for(b=0;b<p.length;b++){for(w=3*this._triangleOffset,E=0;E<3;E++)this.indices[w+E]=p[b][E]+this._vertexOffset;this._triangleOffset++}for(b=0;b<u.length;b++)x.position.set(this._vertexOffset,u[b]),x.color.set(this._vertexOffset++,v)}}var A=this._vertexOffset;for(b=y;b<A;b++)this._dataIndices[b]=_}}(),_addBevelBar:function(){var e=ed.create(),t=ed.create(),r=ed.create(),i=td.create(),n=[],a=[1,-1,-1,1],o=[1,1,-1,-1],s=[2,0];return function(l,u,c,h,d,f,p){ed.copy(t,u),ed.normalize(t,t),ed.cross(r,c,t),ed.normalize(r,r),ed.cross(e,t,r),ed.normalize(r,r),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=t[0],i[4]=t[1],i[5]=t[2],i[6]=r[0],i[7]=r[1],i[8]=r[2],d=Math.min(h[0],h[2])/2*d;for(var m=0;m<3;m++)n[m]=Math.max(h[m]-2*d,0);var g=(h[0]-n[0])/2,v=(h[1]-n[1])/2,_=(h[2]-n[2])/2,y=[],x=[],T=this._vertexOffset,b=[];for(m=0;m<2;m++){b[m]=b[m]=[];for(var w=0;w<=f;w++)for(var E=0;E<4;E++){(0===w&&0===m||1===m&&w===f)&&b[m].push(T);for(var S=0;S<=f;S++){var C=S/f*Math.PI/2+Math.PI/2*E,A=w/f*Math.PI/2+Math.PI/2*m;x[0]=g*Math.cos(C)*Math.sin(A),x[1]=v*Math.cos(A),x[2]=_*Math.sin(C)*Math.sin(A),y[0]=x[0]+a[E]*n[0]/2,y[1]=x[1]+v+s[m]*n[1]/2,y[2]=x[2]+o[E]*n[2]/2,Math.abs(g-v)<1e-6&&Math.abs(v-_)<1e-6||(x[0]/=g*g,x[1]/=v*v,x[2]/=_*_),ed.normalize(x,x),ed.transformMat3(y,y,i),ed.transformMat3(x,x,i),ed.add(y,y,l),this.attributes.position.set(T,y),this.enableNormal&&this.attributes.normal.set(T,x),this.attributes.color.set(T,p),T++}}}var M=4*f+3,L=2*f+1,D=M+1;for(E=0;E<L;E++)for(m=0;m<=M;m++){var N=E*D+m+this._vertexOffset,R=E*D+(m+1)%D+this._vertexOffset,I=(E+1)*D+(m+1)%D+this._vertexOffset,P=(E+1)*D+m+this._vertexOffset;this.setTriangleIndices(this._triangleOffset++,[I,N,R]),this.setTriangleIndices(this._triangleOffset++,[I,P,N])}this.setTriangleIndices(this._triangleOffset++,[b[0][0],b[0][2],b[0][1]]),this.setTriangleIndices(this._triangleOffset++,[b[0][0],b[0][3],b[0][2]]),this.setTriangleIndices(this._triangleOffset++,[b[1][0],b[1][1],b[1][2]]),this.setTriangleIndices(this._triangleOffset++,[b[1][0],b[1][2],b[1][3]]),this._vertexOffset=T}}()});L["w"].defaults(rd.prototype,wo),L["w"].defaults(rd.prototype,Vu);var id=rd,nd=So.vec3,ad=L["b"].extend({type:"bar3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this._api=t,this._labelsBuilder=new $u(256,256,t);var r=this;this._labelsBuilder.getLabelPosition=function(e,t,i){if(r._data){var n=r._data.getItemLayout(e),a=n[0],o=n[1],s=n[2][1];return nd.scaleAndAdd([],a,o,i+s)}return[0,0]},this._labelsBuilder.getMesh().renderOrder=100},render:function(e,t,r){var i=this._prevBarMesh;this._prevBarMesh=this._barMesh,this._barMesh=i,this._barMesh||(this._barMesh=new Ya.Mesh({geometry:new id,shadowDepthMaterial:new Ya.Material({shader:new Ya.Shader(Ya.Shader.source("ecgl.sm.depth.vertex"),Ya.Shader.source("ecgl.sm.depth.fragment"))}),culling:"cartesian3D"===e.coordinateSystem.type,renderOrder:10,renderNormal:!0})),this.groupGL.remove(this._prevBarMesh),this.groupGL.add(this._barMesh),this.groupGL.add(this._labelsBuilder.getMesh());var n=e.coordinateSystem;if(this._doRender(e,r),n&&n.viewGL){n.viewGL.add(this.groupGL);var a=n.viewGL.isLinearSpace()?"define":"undefine";this._barMesh.material[a]("fragment","SRGB_DECODE")}this._data=e.getData(),this._labelsBuilder.updateData(this._data),this._labelsBuilder.updateLabels(),this._updateAnimation(e)},_updateAnimation:function(e){Ya.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevBarMesh,this._barMesh,e)},_doRender:function(e,t){var r=e.getData(),i=e.get("shading"),n="color"!==i,a=this,o=this._barMesh,s="ecgl."+i;o.material&&o.material.shader.name===s||(o.material=Ya.createMaterial(s,["VERTEX_COLOR"])),Ya.setMaterialFromModel(i,o.material,e,t),o.geometry.enableNormal=n,o.geometry.resetOffset();var l=e.get("bevelSize"),u=e.get("bevelSmoothness");o.geometry.bevelSegments=u,o.geometry.bevelSize=l;var c=[],h=new Float32Array(4*r.count()),d=0,f=0,p=!1;r.each((function(e){if(r.hasValue(e)){var t=Xu(r,e),i=qu(r,e);null==i&&(i=1),Ya.parseColor(t,c),c[3]*=i,h[d++]=c[0],h[d++]=c[1],h[d++]=c[2],h[d++]=c[3],c[3]>0&&(f++,c[3]<.99&&(p=!0))}})),o.geometry.setBarCount(f);var m=r.getLayout("orient"),g=this._barIndexOfData=new Int32Array(r.count());f=0;r.each((function(e){if(r.hasValue(e)){var t=r.getItemLayout(e),i=t[0],n=t[1],o=t[2],s=4*e;c[0]=h[s++],c[1]=h[s++],c[2]=h[s++],c[3]=h[s++],c[3]>0&&(a._barMesh.geometry.addBar(i,n,m,o,c,e),g[e]=f++)}else g[e]=-1})),o.geometry.dirty(),o.geometry.updateBoundingBox();var v=o.material;v.transparent=p,v.depthMask=!p,o.geometry.sortTriangles=p,this._initHandler(e,t)},_initHandler:function(e,t){var r=e.getData(),i=this._barMesh,n="cartesian3D"===e.coordinateSystem.type;i.seriesIndex=e.seriesIndex;var a=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var o=i.geometry.getDataIndexOfVertex(e.triangle[0]);o!==a&&(this._downplay(a),this._highlight(o),this._labelsBuilder.updateLabels([o]),n&&t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",o),r.get("y",o),r.get("z",o,!0)]})),a=o,i.dataIndex=o}),this),i.on("mouseout",(function(e){this._downplay(a),this._labelsBuilder.updateLabels(),a=-1,i.dataIndex=-1,n&&t.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var i=t.getItemModel(e),n=i.getModel("emphasis.itemStyle"),a=n.get("color"),o=n.get("opacity");if(null==a){var s=Xu(t,e);a=L["h"].lift(s,-.4)}null==o&&(o=qu(t,e));var l=Ya.parseColor(a);l[3]*=o,this._barMesh.geometry.setColor(r,l),this._api.getZr().refresh()}}},_downplay:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var i=Xu(t,e),n=qu(t,e),a=Ya.parseColor(i);a[3]*=n,this._barMesh.geometry.setColor(r,a),this._api.getZr().refresh()}}},highlight:function(e,t,r,i){this._toggleStatus("highlight",e,t,r,i)},downplay:function(e,t,r,i){this._toggleStatus("downplay",e,t,r,i)},_toggleStatus:function(e,t,r,i,n){var a=t.getData(),o=na.queryDataIndex(a,n),s=this;null!=o?L["w"].each(Zh.normalizeToArray(o),(function(t){"highlight"===e?this._highlight(t):this._downplay(t)}),this):a.each((function(t){"highlight"===e?s._highlight(t):s._downplay(t)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});function od(e){e.registerChartView(ad),e.registerSeriesModel(Jh),Xh(e),e.registerProcessor((function(e,t){e.eachSeriesByType("bar3d",(function(e){var t=e.getData();t.filterSelf((function(e){return t.hasValue(e)}))}))}))}Object(L["v"])(od);var sd=L["g"].extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(e,t){return $h(this)},formatTooltip:function(e){return Kh(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}}),ld=sd,ud=r("9680"),cd=So.vec3;Ya.Shader.import(Jo);var hd=L["b"].extend({type:"line3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this._api=t},render:function(e,t,r){var i=this._prevLine3DMesh;this._prevLine3DMesh=this._line3DMesh,this._line3DMesh=i,this._line3DMesh||(this._line3DMesh=new Ya.Mesh({geometry:new Lo({useNativeLine:!1,sortTriangles:!0}),material:new Ya.Material({shader:Ya.createShader("ecgl.meshLines3D")}),renderOrder:10}),this._line3DMesh.geometry.pick=this._pick.bind(this)),this.groupGL.remove(this._prevLine3DMesh),this.groupGL.add(this._line3DMesh);var n=e.coordinateSystem;if(n&&n.viewGL){n.viewGL.add(this.groupGL);var a=n.viewGL.isLinearSpace()?"define":"undefine";this._line3DMesh.material[a]("fragment","SRGB_DECODE")}this._doRender(e,r),this._data=e.getData(),this._camera=n.viewGL.camera,this.updateCamera(),this._updateAnimation(e)},updateCamera:function(){this._updateNDCPosition()},_doRender:function(e,t){var r=e.getData(),i=this._line3DMesh;i.geometry.resetOffset();var n=r.getLayout("points"),a=[],o=new Float32Array(n.length/3*4),s=0,l=!1;r.each((function(e){var t=Xu(r,e),i=qu(r,e);null==i&&(i=1),Ya.parseColor(t,a),a[3]*=i,o[s++]=a[0],o[s++]=a[1],o[s++]=a[2],o[s++]=a[3],a[3]<.99&&(l=!0)})),i.geometry.setVertexCount(i.geometry.getPolylineVertexCount(n)),i.geometry.setTriangleCount(i.geometry.getPolylineTriangleCount(n)),i.geometry.addPolyline(n,o,na.firstNotNull(e.get("lineStyle.width"),1)),i.geometry.dirty(),i.geometry.updateBoundingBox();var u=i.material;u.transparent=l,u.depthMask=!l;var c=e.getModel("debug.wireframe");c.get("show")?(i.geometry.createAttribute("barycentric","float",3),i.geometry.generateBarycentric(),i.material.set("both","WIREFRAME_TRIANGLE"),i.material.set("wireframeLineColor",Ya.parseColor(c.get("lineStyle.color")||"rgba(0,0,0,0.5)")),i.material.set("wireframeLineWidth",na.firstNotNull(c.get("lineStyle.width"),1))):i.material.set("both","WIREFRAME_TRIANGLE"),this._points=n,this._initHandler(e,t)},_updateAnimation:function(e){Ya.updateVertexAnimation([["prevPosition","position"],["prevPositionPrev","positionPrev"],["prevPositionNext","positionNext"]],this._prevLine3DMesh,this._line3DMesh,e)},_initHandler:function(e,t){var r=e.getData(),i=e.coordinateSystem,n=this._line3DMesh,a=-1;n.seriesIndex=e.seriesIndex,n.off("mousemove"),n.off("mouseout"),n.on("mousemove",(function(e){var o=i.pointToData(e.point.array),s=r.indicesOfNearest("x",o[0])[0];s!==a&&(t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",s),r.get("y",s),r.get("z",s)]}),n.dataIndex=s),a=s}),this),n.on("mouseout",(function(e){a=-1,n.dataIndex=-1,t.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_updateNDCPosition:function(){var e=new tr,t=this._camera;tr.multiply(e,t.projectionMatrix,t.viewMatrix);var r=this._positionNDC,i=this._points,n=i.length/3;r&&r.length/2===n||(r=this._positionNDC=new Float32Array(2*n));for(var a=[],o=0;o<n;o++){var s=3*o,l=2*o;a[0]=i[s],a[1]=i[s+1],a[2]=i[s+2],a[3]=1,cd.transformMat4(a,a,e.array),r[l]=a[0]/a[3],r[l+1]=a[1]/a[3]}},_pick:function(e,t,r,i,n,a){var o=this._positionNDC,s=this._data.hostModel,l=s.get("lineStyle.width"),u=-1,c=r.viewport.width,h=r.viewport.height,d=.5*c,f=.5*h;e=(e+1)*d,t=(t+1)*f;for(var p=1;p<o.length/2;p++){var m=(o[2*(p-1)]+1)*d,g=(o[2*(p-1)+1]+1)*f,v=(o[2*p]+1)*d,_=(o[2*p+1]+1)*f;if(ud["a"](m,g,v,_,l,e,t)){var y=(m-e)*(m-e)+(g-t)*(g-t),x=(v-e)*(v-e)+(_-t)*(_-t);u=y<x?p-1:p}}if(u>=0){var T=3*u,b=new kt(this._points[T],this._points[T+1],this._points[T+2]);a.push({dataIndex:u,point:b,pointWorld:b.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(b)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function dd(e){e.registerChartView(hd),e.registerSeriesModel(ld),e.registerLayout((function(e,t){e.eachSeriesByType("line3D",(function(e){var t=e.getData(),r=e.coordinateSystem;if(r){if("cartesian3D"!==r.type)return void 0;var i=new Float32Array(3*t.count()),n=[],a=[],o=r.dimensions,s=o.map((function(t){return e.coordDimToDataDim(t)[0]}));r&&t.each(s,(function(e,t,o,s){n[0]=e,n[1]=t,n[2]=o,r.dataToPoint(n,a),i[3*s]=a[0],i[3*s+1]=a[1],i[3*s+2]=a[2]})),t.setLayout("points",i)}}))}))}Object(L["v"])(dd);var fd=L["g"].extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(e,t){return $h(this)},getFormattedLabel:function(e,t,r,i){var n=Zh.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},formatTooltip:function(e){return Kh(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function pd(e,t,r){t=t||document.createElement("canvas");t.width=e,t.height=e;var i=t.getContext("2d");return r&&r(i),t}function md(e,t,r,i){L["w"].isArray(t)||(t=[t,t]);var n=vd.getMarginByStyle(r,i),a=t[0]+n.left+n.right,o=t[1]+n.top+n.bottom,s=L["m"].createSymbol(e,0,0,t[0],t[1]),l=Math.max(a,o);s.x=n.left,s.y=n.top,a>o?s.y+=(l-o)/2:s.x+=(l-a)/2;var u=s.getBoundingRect();return s.x-=u.x,s.y-=u.y,s.setStyle(r),s.update(),s.__size=l,s}function gd(e,t,r){var i=t.width,n=t.height,a=e.canvas.width,o=e.canvas.height,s=i/a,l=n/o;function u(e){return e<128?1:-1}function c(e,a){var o=1/0;e=Math.floor(e*s),a=Math.floor(a*l);for(var c=a*i+e,h=t.data[4*c],d=u(h),f=Math.max(a-r,0);f<Math.min(a+r,n);f++)for(var p=Math.max(e-r,0);p<Math.min(e+r,i);p++){c=f*i+p;var m=t.data[4*c],g=u(m),v=p-e,_=f-a;if(d!==g){var y=v*v+_*_;y<o&&(o=y)}}return d*Math.sqrt(o)}for(var h=e.createImageData(a,o),d=0;d<o;d++)for(var f=0;f<a;f++){var p=c(f,d),m=p/r*.5+.5,g=4*(d*a+f);h.data[g++]=255*(1-m),h.data[g++]=255*(1-m),h.data[g++]=255*(1-m),h.data[g++]=255}return h}var vd={getMarginByStyle:function(e){var t=e.minMargin||0,r=0;e.stroke&&"none"!==e.stroke&&(r=null==e.lineWidth?1:e.lineWidth);var i=e.shadowBlur||0,n=e.shadowOffsetX||0,a=e.shadowOffsetY||0,o={};return o.left=Math.max(r/2,-n+i,t),o.right=Math.max(r/2,n+i,t),o.top=Math.max(r/2,-a+i,t),o.bottom=Math.max(r/2,a+i,t),o},createSymbolSprite:function(e,t,r,i){var n=md(e,t,r),a=vd.getMarginByStyle(r);return{image:pd(n.__size,i,(function(e){L["o"](e,n)})),margin:a}},createSDFFromCanvas:function(e,t,r,i){return pd(t,i,(function(t){var i=e.getContext("2d"),n=i.getImageData(0,0,e.width,e.height);t.putImageData(gd(t,n,r),0,0)}))},createSimpleSprite:function(e,t){return pd(e,t,(function(t){var r=e/2;t.beginPath(),t.arc(r,r,60,0,2*Math.PI,!1),t.closePath();var i=t.createRadialGradient(r,r,0,r,r,r);i.addColorStop(0,"rgba(255, 255, 255, 1)"),i.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),i.addColorStop(1,"rgba(255, 255, 255, 0)"),t.fillStyle=i,t.fill()}))}},_d=vd,yd=So.vec3,xd={needsSortVertices:function(){return this.sortVertices},needsSortVerticesProgressively:function(){return this.needsSortVertices()&&this.vertexCount>=2e4},doSortVertices:function(e,t){var r=this.indices,i=yd.create();if(!r){r=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var n=0;n<r.length;n++)r[n]=n}if(0===t){var a,o=this.attributes.position,s=(e=e.array,0);this._zList&&this._zList.length===this.vertexCount||(this._zList=new Float32Array(this.vertexCount));for(n=0;n<this.vertexCount;n++){o.get(n,i);var l=yd.sqrDist(i,e);isNaN(l)&&(l=1e7,s++),0===n?(a=l,l=0):l-=a,this._zList[n]=l}this._noneCount=s}if(this.vertexCount<2e4)0===t&&this._simpleSort(this._noneCount/this.vertexCount>.05);else for(n=0;n<3;n++)this._progressiveQuickSort(3*t+n);this.dirtyIndices()},_simpleSort:function(e){var t=this._zList,r=this.indices;function i(e,r){return t[r]-t[e]}e?Array.prototype.sort.call(r,i):Uu.sort(r,i,0,r.length-1)},_progressiveQuickSort:function(e){var t=this._zList,r=this.indices;this._quickSort=this._quickSort||new Uu,this._quickSort.step(r,(function(e,r){return t[r]-t[e]}),e)}},Td="@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end",bd=So.vec4;Ya.Shader.import(Td);var wd=Ya.Mesh.extend((function(){var e=new Ya.Geometry({dynamic:!0,attributes:{color:new Ya.Geometry.Attribute("color","float",4,"COLOR"),position:new Ya.Geometry.Attribute("position","float",3,"POSITION"),size:new Ya.Geometry.Attribute("size","float",1),prevPosition:new Ya.Geometry.Attribute("prevPosition","float",3),prevSize:new Ya.Geometry.Attribute("prevSize","float",1)}});Object.assign(e,xd);var t=new Ya.Material({shader:Ya.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});t.enableTexture("sprite"),t.define("both","VERTEX_COLOR"),t.define("both","VERTEX_SIZE");var r=new Ya.Texture2D({image:document.createElement("canvas"),flipY:!1});return t.set("sprite",r),e.pick=this._pick.bind(this),{geometry:e,material:t,mode:Ya.Mesh.POINTS,sizeScale:1}}),{_pick:function(e,t,r,i,n,a){var o=this._positionNDC;if(o)for(var s=r.viewport,l=2/s.width,u=2/s.height,c=this.geometry.vertexCount-1;c>=0;c--){var h;h=this.geometry.indices?this.geometry.indices[c]:c;var d=o[2*h],f=o[2*h+1],p=this.geometry.attributes.size.get(h)/this.sizeScale,m=p/2;if(e>d-m*l&&e<d+m*l&&t>f-m*u&&t<f+m*u){var g=new Ya.Vector3,v=new Ya.Vector3;this.geometry.attributes.position.get(h,g.array),Ya.Vector3.transformMat4(v,g,this.worldTransform),a.push({vertexIndex:h,point:g,pointWorld:v,target:this,distance:v.distance(i.getWorldPosition())})}}},updateNDCPosition:function(e,t,r){var i=this._positionNDC,n=this.geometry;i&&i.length/2===n.vertexCount||(i=this._positionNDC=new Float32Array(2*n.vertexCount));for(var a=bd.create(),o=0;o<n.vertexCount;o++)n.attributes.position.get(o,a),a[3]=1,bd.transformMat4(a,a,e.array),bd.scale(a,a,1/a[3]),i[2*o]=a[0],i[2*o+1]=a[1]}}),Ed=wd,Sd=20,Cd=-10;function Ad(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}function Md(e,t){this.rootNode=new Ya.Node,this.is2D=e,this._labelsBuilder=new $u(256,256,t),this._labelsBuilder.getMesh().renderOrder=100,this.rootNode.add(this._labelsBuilder.getMesh()),this._api=t,this._spriteImageCanvas=document.createElement("canvas"),this._startDataIndex=0,this._endDataIndex=0,this._sizeScale=1}Md.prototype={constructor:Md,highlightOnMouseover:!0,update:function(e,t,r,i,n){var a=this._prevMesh;this._prevMesh=this._mesh,this._mesh=a;var o=e.getData();if(null==i&&(i=0),null==n&&(n=o.count()),this._startDataIndex=i,this._endDataIndex=n-1,!this._mesh){var s=this._prevMesh&&this._prevMesh.material;this._mesh=new Ed({renderOrder:10,frustumCulling:!1}),s&&(this._mesh.material=s)}s=this._mesh.material;var l=this._mesh.geometry,u=l.attributes;this.rootNode.remove(this._prevMesh),this.rootNode.add(this._mesh),this._setPositionTextureToMesh(this._mesh,this._positionTexture);var c=this._getSymbolInfo(e,i,n),h=r.getDevicePixelRatio(),d=e.getModel("itemStyle").getItemStyle(),f=e.get("large"),p=1;c.maxSize>2?(p=this._updateSymbolSprite(e,d,c,h),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(n-i);var m=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var g=Wu(o),v=ju(o);Ya.parseColor(g,m),m[3]*=v,s.set({color:m,u_Size:c.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(n-i),u.color.init(n-i),this._originalOpacity=new Float32Array(n-i);for(var _=o.getLayout("points"),y=u.position.value,x=0;x<n-i;x++){var T=3*x,b=2*x;if(this.is2D?(y[T]=_[b],y[T+1]=_[b+1],y[T+2]=Cd):(y[T]=_[T],y[T+1]=_[T+1],y[T+2]=_[T+2]),!f){g=Xu(o,x),v=qu(o,x);Ya.parseColor(g,m),m[3]*=v,u.color.set(x,m),m[3]<.99&&!0;var w=o.getItemVisual(x,"symbolSize");w=w instanceof Array?Math.max(w[0],w[1]):w,isNaN(w)&&(w=0),u.size.value[x]=w*p*this._sizeScale,this._originalOpacity[x]=m[3]}}this._mesh.sizeScale=p,l.updateBoundingBox(),l.dirty(),this._updateMaterial(e,d);var E=e.coordinateSystem;if(E&&E.viewGL){var S=E.viewGL.isLinearSpace()?"define":"undefine";s[S]("fragment","SRGB_DECODE")}f||this._updateLabelBuilder(e,i,n),this._updateHandler(e,t,r),this._updateAnimation(e),this._api=r},getPointsMesh:function(){return this._mesh},updateLabels:function(e){this._labelsBuilder.updateLabels(e)},hideLabels:function(){this.rootNode.remove(this._labelsBuilder.getMesh())},showLabels:function(){this.rootNode.add(this._labelsBuilder.getMesh())},dispose:function(){this._labelsBuilder.dispose()},_updateSymbolSprite:function(e,t,r,i){r.maxSize=Math.min(2*r.maxSize,200);var n=[];return r.aspect>1?(n[0]=r.maxSize,n[1]=r.maxSize/r.aspect):(n[1]=r.maxSize,n[0]=r.maxSize*r.aspect),n[0]=n[0]||1,n[1]=n[1]||1,this._symbolType===r.type&&Ad(this._symbolSize,n)&&this._lineWidth===t.lineWidth||(_d.createSymbolSprite(r.type,n,{fill:"#fff",lineWidth:t.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(n[0]/2,10)},this._spriteImageCanvas),_d.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),Sd,this._mesh.material.get("sprite").image),this._symbolType=r.type,this._symbolSize=n,this._lineWidth=t.lineWidth),this._spriteImageCanvas.width/r.maxSize*i},_updateMaterial:function(e,t){var r="lighter"===e.get("blendMode")?Ya.additiveBlend:null,i=this._mesh.material;i.blend=r,i.set("lineWidth",t.lineWidth/Sd);var n=Ya.parseColor(t.stroke);i.set("strokeColor",n),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(e,t,r){var i=e.getData(),n=this._mesh.geometry,a=n.attributes.position.value,o=(t=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,t,r),this._labelsBuilder.getLabelPosition=function(e,r,i){var n=3*(e-t);return[a[n],a[n+1],a[n+2]]},this._labelsBuilder.getLabelDistance=function(e,r,i){var a=n.attributes.size.get(e-t)/o;return a/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(e){Ya.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,e)},_updateHandler:function(e,t,r){var i,n=e.getData(),a=this._mesh,o=this,s=-1,l=e.coordinateSystem&&"cartesian3D"===e.coordinateSystem.type;l&&(i=e.coordinateSystem.model),a.seriesIndex=e.seriesIndex,a.off("mousemove"),a.off("mouseout"),a.on("mousemove",(function(t){var u=t.vertexIndex+o._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(n,s),this.highlight(n,u),this._labelsBuilder.updateLabels([u])),l&&r.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get(e.coordDimToDataDim("x")[0],u),n.get(e.coordDimToDataDim("y")[0],u),n.get(e.coordDimToDataDim("z")[0],u)],grid3DIndex:i.componentIndex})),a.dataIndex=u,s=u}),this),a.on("mouseout",(function(e){var t=e.vertexIndex+o._startDataIndex;this.highlightOnMouseover&&(this.downplay(n,t),this._labelsBuilder.updateLabels()),s=-1,a.dataIndex=-1,l&&r.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(e,t,r){var i=e.getData();if(this._mesh){var n=this._mesh.geometry.attributes.position.value,a=i.getLayout("points");if(this.is2D)for(var o=0;o<a.length/2;o++){var s=3*o,l=2*o;n[s]=a[l],n[s+1]=a[l+1],n[s+2]=Cd}else for(o=0;o<a.length;o++)n[o]=a[o];this._mesh.geometry.dirty(),r.getZr().refresh()}},updateView:function(e){if(this._mesh){var t=new tr;tr.mul(t,e.viewMatrix,this._mesh.worldTransform),tr.mul(t,e.projectionMatrix,t),this._mesh.updateNDCPosition(t,this.is2D,this._api)}},highlight:function(e,t){if(!(t>this._endDataIndex||t<this._startDataIndex)){var r=e.getItemModel(t),i=r.getModel("emphasis.itemStyle"),n=i.get("color"),a=i.get("opacity");if(null==n){var o=Xu(e,t);n=L["h"].lift(o,-.4)}null==a&&(a=qu(e,t));var s=Ya.parseColor(n);s[3]*=a,this._mesh.geometry.attributes.color.set(t-this._startDataIndex,s),this._mesh.geometry.dirtyAttribute("color"),this._api.getZr().refresh()}},downplay:function(e,t){if(!(t>this._endDataIndex||t<this._startDataIndex)){var r=Xu(e,t),i=qu(e,t),n=Ya.parseColor(r);n[3]*=i,this._mesh.geometry.attributes.color.set(t-this._startDataIndex,n),this._mesh.geometry.dirtyAttribute("color"),this._api.getZr().refresh()}},fadeOutAll:function(e){if(this._originalOpacity){for(var t=this._mesh.geometry,r=0;r<t.vertexCount;r++){var i=this._originalOpacity[r]*e;t.attributes.color.value[4*r+3]=i}t.dirtyAttribute("color"),this._api.getZr().refresh()}},fadeInAll:function(){this.fadeOutAll(1)},setPositionTexture:function(e){this._mesh&&this._setPositionTextureToMesh(this._mesh,e),this._positionTexture=e},removePositionTexture:function(){this._positionTexture=null,this._mesh&&this._setPositionTextureToMesh(this._mesh,null)},setSizeScale:function(e){if(e!==this._sizeScale){if(this._mesh){var t=this._mesh.material.get("u_Size");this._mesh.material.set("u_Size",t/this._sizeScale*e);var r=this._mesh.geometry.attributes;if(r.size.value)for(var i=0;i<r.size.value.length;i++)r.size.value[i]=r.size.value[i]/this._sizeScale*e}this._sizeScale=e}},_setPositionTextureToMesh:function(e,t){t&&e.material.set("positionTexture",t),e.material[t?"enableTexture":"disableTexture"]("positionTexture")},_getSymbolInfo:function(e,t,r){if(e.get("large")){var i=na.firstNotNull(e.get("symbolSize"),1);return i instanceof Array?(s=Math.max(i[0],i[1]),n=i[0]/i[1]):(s=i,n=1),{maxSize:i,type:e.get("symbol"),aspect:n}}for(var n,a=e.getData(),o=a.getItemVisual(0,"symbol")||"circle",s=0,l=t;l<r;l++){i=a.getItemVisual(l,"symbolSize");var u,c=a.getItemVisual(l,"symbol");if(i instanceof Array)u=i[0]/i[1],s=Math.max(Math.max(i[0],i[1]),s);else{if(isNaN(i))continue;u=1,s=Math.max(i,s)}0,o=c,n=u}return{maxSize:s,type:o,aspect:n}}};var Ld=Md,Dd=L["b"].extend({type:"scatter3D",hasSymbolVisual:!0,__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this._pointsBuilderList=[],this._currentStep=0},render:function(e,t,r){if(this.groupGL.removeAll(),e.getData().count()){var i=e.coordinateSystem;if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._camera=i.viewGL.camera;var n=this._pointsBuilderList[0];n||(n=this._pointsBuilderList[0]=new Ld(!1,r)),this._pointsBuilderList.length=1,this.groupGL.add(n.rootNode),n.update(e,t,r),n.updateView(i.viewGL.camera)}else 0}},incrementalPrepareRender:function(e,t,r){var i=e.coordinateSystem;i&&i.viewGL&&(i.viewGL.add(this.groupGL),this._camera=i.viewGL.camera),this.groupGL.removeAll(),this._currentStep=0},incrementalRender:function(e,t,r,i){if(!(e.end<=e.start)){var n=this._pointsBuilderList[this._currentStep];n||(n=new Ld(!1,i),this._pointsBuilderList[this._currentStep]=n),this.groupGL.add(n.rootNode),n.update(t,r,i,e.start,e.end),n.updateView(t.coordinateSystem.viewGL.camera),this._currentStep++}},updateCamera:function(){this._pointsBuilderList.forEach((function(e){e.updateView(this._camera)}),this)},highlight:function(e,t,r,i){this._toggleStatus("highlight",e,t,r,i)},downplay:function(e,t,r,i){this._toggleStatus("downplay",e,t,r,i)},_toggleStatus:function(e,t,r,i,n){var a=t.getData(),o=na.queryDataIndex(a,n),s="highlight"===e;null!=o?L["w"].each(Zh.normalizeToArray(o),(function(e){for(var t=0;t<this._pointsBuilderList.length;t++){var r=this._pointsBuilderList[t];s?r.highlight(a,e):r.downplay(a,e)}}),this):a.each((function(e){for(var t=0;t<this._pointsBuilderList.length;t++){var r=this._pointsBuilderList[t];s?r.highlight(a,e):r.downplay(a,e)}}))},dispose:function(){this._pointsBuilderList.forEach((function(e){e.dispose()})),this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function Nd(e){e.registerChartView(Dd),e.registerSeriesModel(fd),e.registerLayout({seriesType:"scatter3D",reset:function(e){var t=e.coordinateSystem;if(t){var r=t.dimensions;if(r.length<3)return void 0;var i=r.map((function(t){return e.coordDimToDataDim(t)[0]})),n=[],a=[];return{progress:function(e,r){for(var o=new Float32Array(3*(e.end-e.start)),s=e.start;s<e.end;s++){var l=3*(s-e.start);n[0]=r.get(i[0],s),n[1]=r.get(i[1],s),n[2]=r.get(i[2],s),t.dataToPoint(n,a),o[l]=a[0],o[l+1]=a[1],o[l+2]=a[2]}r.setLayout("points",o)}}}}})}Object(L["v"])(Nd);var Rd=So.vec3,Id=So.vec2,Pd=Rd.normalize,Od=Rd.cross,Bd=Rd.sub,Fd=Rd.add,Ud=Rd.create,zd=Ud(),Gd=Ud(),Hd=Ud(),kd=Ud(),Vd=[],Wd=[];function jd(e,t){Id.copy(Vd,e[0]),Id.copy(Wd,e[1]);var r=[],i=r[0]=Ud(),n=r[1]=Ud(),a=r[2]=Ud(),o=r[3]=Ud();t.dataToPoint(Vd,i),t.dataToPoint(Wd,o),Pd(zd,i),Bd(Gd,o,i),Pd(Gd,Gd),Od(Hd,Gd,zd),Pd(Hd,Hd),Od(Gd,zd,Hd),Fd(n,zd,Gd),Pd(n,n),Pd(zd,o),Bd(Gd,i,o),Pd(Gd,Gd),Od(Hd,Gd,zd),Pd(Hd,Hd),Od(Gd,zd,Hd),Fd(a,zd,Gd),Pd(a,a),Fd(kd,i,o),Pd(kd,kd);var s=Rd.dot(i,kd),l=Rd.dot(kd,n),u=(Math.max(Rd.len(i),Rd.len(o))-s)/l*2;return Rd.scaleAndAdd(n,i,n,u),Rd.scaleAndAdd(a,o,a,u),r}function Xd(e,t,r){var i=[],n=i[0]=Rd.create(),a=i[1]=Rd.create(),o=i[2]=Rd.create(),s=i[3]=Rd.create();t.dataToPoint(e[0],n),t.dataToPoint(e[1],s);var l=Rd.dist(n,s);return Rd.lerp(a,n,s,.3),Rd.lerp(o,n,s,.3),Rd.scaleAndAdd(a,a,r,Math.min(.1*l,10)),Rd.scaleAndAdd(o,o,r,Math.min(.1*l,10)),i}function qd(e,t){for(var r=new Float32Array(3*e.length),i=0,n=[],a=0;a<e.length;a++)t.dataToPoint(e[a],n),r[i++]=n[0],r[i++]=n[1],r[i++]=n[2];return r}function Zd(e){var t=[];return e.each((function(r){var i=e.getItemModel(r),n=i.option instanceof Array?i.option:i.getShallow("coords",!0);t.push(n)})),{coordsList:t}}function Yd(e,t){var r=e.getData(),i=e.get("polyline");r.setLayout("lineType",i?"polyline":"cubicBezier");var n=Zd(r);r.each((function(e){var a=n.coordsList[e],o=i?qd:jd;r.setItemLayout(e,o(a,t))}))}function Kd(e,t,r){var i=e.getData(),n=e.get("polyline"),a=Zd(i);i.setLayout("lineType",n?"polyline":"cubicBezier"),i.each((function(e){var o=a.coordsList[e],s=n?qd(o,t):Xd(o,t,r);i.setItemLayout(e,s)}))}function $d(e,t){e.eachSeriesByType("lines3D",(function(e){var t=e.coordinateSystem;"globe"===t.type?Yd(e,t):"geo3D"===t.type?Kd(e,t,[0,1,0]):"mapbox3D"!==t.type&&"maptalks3D"!==t.type||Kd(e,t,[0,0,1])}))}var Qd=L["g"].extend({type:"series.lines3D",dependencies:["globe"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(e,t){var r=new L["e"](["value"],this);return r.hasItemOption=!1,r.initData(e.data,[],(function(e,t,i,n){if(e instanceof Array)return NaN;r.hasItemOption=!0;var a=e.value;return null!=a?a instanceof Array?a[n]:a:void 0})),r},defaultOption:{coordinateSystem:"globe",globeIndex:0,geo3DIndex:0,zlevel:-10,polyline:!1,effect:{show:!1,period:4,trailWidth:4,trailLength:.2,spotIntensity:6},silent:!0,blendMode:"source-over",lineStyle:{width:1,opacity:.5}}}),Jd="@export ecgl.trail2.vertex\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute float dist;\nattribute float distAll;\nattribute float start;\n\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nuniform float speed : 0;\nuniform float trailLength: 0.3;\nuniform float time;\nuniform float period: 1000;\n\nuniform float spotSize: 1;\n\nvarying vec4 v_Color;\nvarying float v_Percent;\nvarying float v_SpotPercent;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n\n#ifdef CONSTANT_SPEED\n float t = mod((speed * time + start) / distAll, 1. + trailLength) - trailLength;\n#else\n float t = mod((time + start) / period, 1. + trailLength) - trailLength;\n#endif\n\n float trailLen = distAll * trailLength;\n\n v_Percent = (dist - t * distAll) / trailLen;\n\n v_SpotPercent = spotSize / distAll;\n\n }\n@end\n\n\n@export ecgl.trail2.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform float spotIntensity: 5;\n\nvarying vec4 v_Color;\nvarying float v_Percent;\nvarying float v_SpotPercent;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n if (v_Percent > 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end",ef=So.vec3;function tf(e){return e>0?1:-1}Ya.Shader.import(Jd);var rf=Ya.Mesh.extend((function(){var e=new Ya.Material({shader:new Ya.Shader(Ya.Shader.source("ecgl.trail2.vertex"),Ya.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),t=new Lo({dynamic:!0});return t.createAttribute("dist","float",1),t.createAttribute("distAll","float",1),t.createAttribute("start","float",1),{geometry:t,material:e,culling:!1,$ignorePicking:!0}}),{updateData:function(e,t,r){var i=e.hostModel,n=this.geometry,a=i.getModel("effect"),o=a.get("trailWidth")*t.getDevicePixelRatio(),s=a.get("trailLength"),l=i.get("effect.constantSpeed"),u=1e3*i.get("effect.period"),c=null!=l;c?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[c?"define":"undefine"]("vertex","CONSTANT_SPEED");var h=i.get("polyline");n.trailLength=s,this.material.set("trailLength",s),n.resetOffset(),["position","positionPrev","positionNext"].forEach((function(e){n.attributes[e].value=r.attributes[e].value}));var d=["dist","distAll","start","offset","color"];d.forEach((function(e){n.attributes[e].init(n.vertexCount)})),n.indices=r.indices;var f=[],p=a.get("trailColor"),m=a.get("trailOpacity"),g=null!=p,v=null!=m;this.updateWorldTransform();var _=this.worldTransform.x.len(),y=this.worldTransform.y.len(),x=this.worldTransform.z.len(),T=0,b=0;e.each((function(t){var i=e.getItemLayout(t),a=v?m:qu(e,t),s=Xu(e,t);null==a&&(a=1),f=Ya.parseColor(g?p:s,f),f[3]*=a;for(var l=h?r.getPolylineVertexCount(i):r.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),d=0,w=[],E=[],S=T;S<T+l;S++)n.attributes.position.get(S,w),w[0]*=_,w[1]*=y,w[2]*=x,S>T&&(d+=ef.dist(w,E)),n.attributes.dist.set(S,d),ef.copy(E,w);b=Math.max(b,d);var C=Math.random()*(c?d:u);for(S=T;S<T+l;S++)n.attributes.distAll.set(S,d),n.attributes.start.set(S,C),n.attributes.offset.set(S,tf(r.attributes.offset.get(S))*o/2),n.attributes.color.set(S,f);T+=l})),this.material.set("spotSize",.1*b*s),this.material.set("spotIntensity",a.get("spotIntensity")),n.dirty()},setAnimationTime:function(e){this.material.set("time",e)}});function nf(e){return null!=e.radius?e.radius:null!=e.size?Math.max(e.size[0],e.size[1],e.size[2]):100}Ya.Shader.import(Jo);var af=L["b"].extend({type:"lines3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this._meshLinesMaterial=new Ya.Material({shader:Ya.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new Ya.Mesh({geometry:new Lo,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new rf},render:function(e,t,r){this.groupGL.add(this._linesMesh);var i=e.coordinateSystem,n=e.getData();if(i&&i.viewGL){var a=i.viewGL;a.add(this.groupGL),this._updateLines(e,t,r);var o=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var s=this._trailMesh;if(s.stopAnimation(),e.get("effect.show")){this.groupGL.add(s),s.updateData(n,r,this._linesMesh.geometry),s.__time=s.__time||0;var l=36e5;this._curveEffectsAnimator=s.animate("",{loop:!0}).when(l,{__time:l}).during((function(){s.setAnimationTime(s.__time)})).start()}else this.groupGL.remove(s),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===e.get("blendMode")?Ya.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var e=this._curveEffectsAnimator;e&&(e.isPaused()?e.resume():e.pause())},_updateLines:function(e,t,r){var i=e.getData(),n=e.coordinateSystem,a=this._linesMesh.geometry,o=e.get("polyline");a.expandLine=!0;var s=nf(n);a.segmentScale=s/20;var l="lineStyle.width".split("."),u=r.getDevicePixelRatio(),c=0;i.each((function(e){var t=i.getItemModel(e),r=t.get(l);null==r&&(r=1),i.setItemVisual(e,"lineWidth",r),c=Math.max(r,c)})),a.useNativeLine=!1;var h=0,d=0;i.each((function(e){var t=i.getItemLayout(e);o?(h+=a.getPolylineVertexCount(t),d+=a.getPolylineTriangleCount(t)):(h+=a.getCubicCurveVertexCount(t[0],t[1],t[2],t[3]),d+=a.getCubicCurveTriangleCount(t[0],t[1],t[2],t[3]))})),a.setVertexCount(h),a.setTriangleCount(d),a.resetOffset();var f=[];i.each((function(e){var t=i.getItemLayout(e),r=Xu(i,e),n=qu(i,e),s=i.getItemVisual(e,"lineWidth")*u;null==n&&(n=1),f=Ya.parseColor(r,f),f[3]*=n,o?a.addPolyline(t,f,s):a.addCubicCurve(t[0],t[1],t[2],t[3],f,s)})),a.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function of(e){e.registerChartView(af),e.registerSeriesModel(Qd),e.registerLayout($d),e.registerAction({type:"lines3DPauseEffect",event:"lines3deffectpaused",update:"series.lines3D:pauseEffect"},(function(){})),e.registerAction({type:"lines3DResumeEffect",event:"lines3deffectresumed",update:"series.lines3D:resumeEffect"},(function(){})),e.registerAction({type:"lines3DToggleEffect",event:"lines3deffectchanged",update:"series.lines3D:toggleEffect"},(function(){}))}function sf(e,t){for(var r=[],i=0;i<t.length;i++)r.push(e.dataToPoint(t[i]));return r}Object(L["v"])(of);var lf=L["g"].extend({type:"series.polygons3D",getRegionModel:function(e){return this.getData().getItemModel(e)},getRegionPolygonCoords:function(e){var t=this.coordinateSystem,r=this.getData().getItemModel(e),i=r.option instanceof Array?r.option:r.getShallow("coords");r.get("multiPolygon")||(i=[i]);for(var n=[],a=0;a<i.length;a++){for(var o=[],s=1;s<i[a].length;s++)o.push(sf(t,i[a][s]));n.push({exterior:sf(t,i[a][0]),interiors:o})}return n},getInitialData:function(e){var t=new L["e"](["value"],this);return t.hasItemOption=!1,t.initData(e.data,[],(function(e,r,i,n){if(e instanceof Array)return NaN;t.hasItemOption=!0;var a=e.value;return null!=a?a instanceof Array?a[n]:a:void 0})),t},defaultOption:{show:!0,data:null,multiPolygon:!1,progressiveThreshold:1e3,progressive:1e3,zlevel:-10,label:{show:!1,distance:2,textStyle:{fontSize:20,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:4}},itemStyle:{color:"#fff",borderWidth:0,borderColor:"#333"},emphasis:{itemStyle:{color:"#639fc0"},label:{show:!0}}}});L["w"].merge(lf.prototype,eu);var uf=lf,cf=L["b"].extend({type:"polygons3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this._geo3DBuilderList=[],this._currentStep=0},render:function(e,t,r){this.groupGL.removeAll();var i=e.coordinateSystem;i&&i.viewGL&&i.viewGL.add(this.groupGL);var n=this._geo3DBuilderList[0];n||(n=new ec(r),n.extrudeY="mapbox3D"!==i.type&&"maptalks3D"!==i.type,this._geo3DBuilderList[0]=n),this._updateShaderDefines(i,n),n.update(e,t,r),this._geo3DBuilderList.length=1,this.groupGL.add(n.rootNode)},incrementalPrepareRender:function(e,t,r){this.groupGL.removeAll();var i=e.coordinateSystem;i&&i.viewGL&&i.viewGL.add(this.groupGL),this._currentStep=0},incrementalRender:function(e,t,r,i){var n=this._geo3DBuilderList[this._currentStep],a=t.coordinateSystem;n||(n=new ec(i),n.extrudeY="mapbox3D"!==a.type&&"maptalks3D"!==a.type,this._geo3DBuilderList[this._currentStep]=n),n.update(t,r,i,e.start,e.end),this.groupGL.add(n.rootNode),this._updateShaderDefines(a,n),this._currentStep++},_updateShaderDefines:function(e,t){var r=e.viewGL.isLinearSpace()?"define":"undefine";t.rootNode.traverse((function(t){t.material&&(t.material[r]("fragment","SRGB_DECODE"),"mapbox3D"!==e.type&&"maptalks3D"!==e.type||(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1)))}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll(),this._geo3DBuilderList.forEach((function(e){e.dispose()}))}});function hf(e){e.registerChartView(cf),e.registerSeriesModel(uf)}Object(L["v"])(hf);var df=L["g"].extend({type:"series.surface",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",formatTooltip:function(e){return Kh(this,e)},getInitialData:function(e,t){var r=e.data;function i(e){return!(isNaN(e.min)||isNaN(e.max)||isNaN(e.step))}function n(e){var t=L["p"].getPrecisionSafe;return Math.max(t(e.min),t(e.max),t(e.step))+1}if(!r)if(e.parametric){var a=e.parametricEquation||{},o=a.u||{},s=a.v||{};["u","v"].forEach((function(e){i(a[e])})),["x","y","z"].forEach((function(e){a[e]}));var l=Math.floor((o.max+o.step-o.min)/o.step),u=Math.floor((s.max+s.step-s.min)/s.step);r=new Float32Array(l*u*5);var c=n(o),h=n(s);for(w=0,E=0;E<u;E++)for(S=0;S<l;S++){var d=S*o.step+o.min,f=E*s.step+s.min,p=L["p"].round(Math.min(d,o.max),c),m=L["p"].round(Math.min(f,s.max),h);C=a.x(p,m),A=a.y(p,m),N=a.z(p,m);r[w++]=C,r[w++]=A,r[w++]=N,r[w++]=p,r[w++]=m}}else{var g=e.equation||{},v=g.x||{},_=g.y||{};if(["x","y"].forEach((function(e){i(g[e])})),"function"!==typeof g.z)return void 0;var y=Math.floor((v.max+v.step-v.min)/v.step),x=Math.floor((_.max+_.step-_.min)/_.step);r=new Float32Array(y*x*3);for(var T=n(v),b=n(_),w=0,E=0;E<x;E++)for(var S=0;S<y;S++){var C=S*v.step+v.min,A=E*_.step+_.min,M=L["p"].round(Math.min(C,v.max),T),D=L["p"].round(Math.min(A,_.max),b),N=g.z(M,D);r[w++]=M,r[w++]=D,r[w++]=N}}var R=["x","y","z"];e.parametric&&R.push("u","v");var I=$h(this,R,r);return I},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,shading:"lambert",parametric:!1,wireframe:{show:!0,lineStyle:{color:"rgba(0,0,0,0.5)",width:1}},equation:{x:{min:-1,max:1,step:.1},y:{min:-1,max:1,step:.1},z:null},parametricEquation:{u:{min:-1,max:1,step:.1},v:{min:-1,max:1,step:.1},x:null,y:null,z:null},dataShape:null,itemStyle:{},animationDurationUpdate:500}});L["w"].merge(df.prototype,eu);var ff=df,pf=So.vec3;function mf(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])}var gf=L["b"].extend({type:"surface",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node},render:function(e,t,r){var i=this._prevSurfaceMesh;this._prevSurfaceMesh=this._surfaceMesh,this._surfaceMesh=i,this._surfaceMesh||(this._surfaceMesh=this._createSurfaceMesh()),this.groupGL.remove(this._prevSurfaceMesh),this.groupGL.add(this._surfaceMesh);var n=e.coordinateSystem,a=e.get("shading"),o=e.getData(),s="ecgl."+a;if(this._surfaceMesh.material&&this._surfaceMesh.material.shader.name===s||(this._surfaceMesh.material=Ya.createMaterial(s,["VERTEX_COLOR","DOUBLE_SIDED"])),Ya.setMaterialFromModel(a,this._surfaceMesh.material,e,r),n&&n.viewGL){n.viewGL.add(this.groupGL);var l=n.viewGL.isLinearSpace()?"define":"undefine";this._surfaceMesh.material[l]("fragment","SRGB_DECODE")}var u=e.get("parametric"),c=e.get("dataShape");c||(c=this._getDataShape(o,u));var h=e.getModel("wireframe"),d=h.get("lineStyle.width"),f=h.get("show")&&d>0;this._updateSurfaceMesh(this._surfaceMesh,e,c,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",Ya.parseColor(h.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(e,r),this._updateAnimation(e)},_updateAnimation:function(e){Ya.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,e)},_createSurfaceMesh:function(){var e=new Ya.Mesh({geometry:new Ya.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new Ya.Material({shader:new Ya.Shader(Ya.Shader.source("ecgl.sm.depth.vertex"),Ya.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return e.geometry.createAttribute("barycentric","float",4),e.geometry.createAttribute("prevPosition","float",3),e.geometry.createAttribute("prevNormal","float",3),Object.assign(e.geometry,Vu),e},_initHandler:function(e,t){var r=e.getData(),i=this._surfaceMesh,n=e.coordinateSystem;function a(e,t){for(var r=1/0,n=-1,a=[],o=0;o<e.length;o++){i.geometry.attributes.position.get(e[o],a);var s=pf.dist(t.array,a);s<r&&(r=s,n=e[o])}return n}i.seriesIndex=e.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var s=a(e.triangle,e.point);if(s>=0){var l=[];i.geometry.attributes.position.get(s,l);for(var u=n.pointToData(l),c=1/0,h=-1,d=[],f=0;f<r.count();f++){d[0]=r.get("x",f),d[1]=r.get("y",f),d[2]=r.get("z",f);var p=pf.squaredDistance(d,u);p<c&&(h=f,c=p)}h!==o&&t.dispatchAction({type:"grid3DShowAxisPointer",value:u}),o=h,i.dataIndex=h}else i.dataIndex=-1}),this),i.on("mouseout",(function(e){o=-1,i.dataIndex=-1,t.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_updateSurfaceMesh:function(e,t,r,i){var n=e.geometry,a=t.getData(),o=a.getLayout("points"),s=0;a.each((function(e){a.hasValue(e)||s++}));var l=s||i,u=n.attributes.position,c=n.attributes.normal,h=n.attributes.texcoord0,d=n.attributes.barycentric,f=n.attributes.color,p=r[0],m=r[1],g=t.get("shading"),v="color"!==g;if(l){var _=(p-1)*(m-1)*4;u.init(_),i&&d.init(_)}else u.value=new Float32Array(o);f.init(n.vertexCount),h.init(n.vertexCount);var y=[0,3,1,1,3,2],x=[[1,1,0,0],[0,1,0,1],[1,0,0,1],[1,0,1,0]],T=n.indices=new(n.vertexCount>65535?Uint32Array:Uint16Array)((p-1)*(m-1)*6),b=function(e,t,r){r[1]=e*m+t,r[0]=e*m+t+1,r[3]=(e+1)*m+t+1,r[2]=(e+1)*m+t},w=!1;if(l){var E=[],S=[],C=0;v?c.init(n.vertexCount):c.value=null;for(var A=[[],[],[]],M=[],L=[],D=pf.create(),N=function(e,t,r){var i=3*t;return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r},R=new Float32Array(o.length),I=new Float32Array(o.length/3*4),P=0;P<a.count();P++)if(a.hasValue(P)){var O=Ya.parseColor(Xu(a,P)),B=qu(a,P);null!=B&&(O[3]*=B),O[3]<.99&&(w=!0);for(var F=0;F<4;F++)I[4*P+F]=O[F]}var U=[1e7,1e7,1e7];for(P=0;P<p-1;P++)for(var z=0;z<m-1;z++){var G=P*(m-1)+z,H=4*G;b(P,z,E);var k=!1;for(F=0;F<4;F++)N(o,E[F],S),mf(S)&&(k=!0);for(F=0;F<4;F++)k?u.set(H+F,U):(N(o,E[F],S),u.set(H+F,S)),i&&d.set(H+F,x[F]);for(F=0;F<6;F++)T[C++]=y[F]+H;if(v&&!k)for(F=0;F<2;F++){for(var V=3*F,W=0;W<3;W++){var j=E[y[V]+W];N(o,j,A[W])}pf.sub(M,A[0],A[1]),pf.sub(L,A[1],A[2]),pf.cross(D,M,L);for(W=0;W<3;W++){var X=3*E[y[V]+W];R[X]=R[X]+D[0],R[X+1]=R[X+1]+D[1],R[X+2]=R[X+2]+D[2]}}}if(v)for(P=0;P<R.length/3;P++)N(R,P,D),pf.normalize(D,D),R[3*P]=D[0],R[3*P+1]=D[1],R[3*P+2]=D[2];O=[];var q=[];for(P=0;P<p-1;P++)for(z=0;z<m-1;z++){G=P*(m-1)+z,H=4*G;b(P,z,E);for(F=0;F<4;F++){for(W=0;W<4;W++)O[W]=I[4*E[F]+W];f.set(H+F,O),v&&(N(R,E[F],D),c.set(H+F,D));j=E[F];q[0]=j%m/(m-1),q[1]=Math.floor(j/m)/(p-1),h.set(H+F,q)}G++}}else{for(q=[],P=0;P<a.count();P++){q[0]=P%m/(m-1),q[1]=Math.floor(P/m)/(p-1);O=Ya.parseColor(Xu(a,P)),B=qu(a,P);null!=B&&(O[3]*=B),O[3]<.99&&(w=!0),f.set(P,O),h.set(P,q)}E=[];var Z=0;for(P=0;P<p-1;P++)for(z=0;z<m-1;z++){b(P,z,E);for(F=0;F<6;F++)T[Z++]=E[y[F]]}v?n.generateVertexNormals():c.value=null}e.material.get("normalMap")&&n.generateTangents(),n.updateBoundingBox(),n.dirty(),e.material.transparent=w,e.material.depthMask=!w},_getDataShape:function(e,t){for(var r=-1/0,i=0,n=0,a=!1,o=t?"u":"x",s=e.count(),l=0;l<s;l++){var u=e.get(o,l);u<r&&(n,n=0,i++),r=u,n++}if(i&&1!==n||(a=!0),!a)return[i+1,n];var c=Math.floor(Math.sqrt(s));while(c>0){if(Math.floor(s/c)===s/c)return[c,s/c];c--}return c=Math.floor(Math.sqrt(s)),[c,c]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function vf(e){e.registerChartView(gf),e.registerSeriesModel(ff),e.registerLayout((function(e,t){e.eachSeriesByType("surface",(function(e){var t=e.coordinateSystem;t&&t.type;var r=e.getData(),i=new Float32Array(3*r.count()),n=[NaN,NaN,NaN];if(t&&"cartesian3D"===t.type){var a=t.dimensions,o=a.map((function(t){return e.coordDimToDataDim(t)[0]}));r.each(o,(function(e,a,o,s){var l;l=r.hasValue(s)?t.dataToPoint([e,a,o]):n,i[3*s]=l[0],i[3*s+1]=l[1],i[3*s+2]=l[2]}))}r.setLayout("points",i)}))}))}function _f(e,t){for(var r=[],i=0;i<t.length;i++)r.push(e.dataToPoint(t[i]));return r}Object(L["v"])(vf);var yf=L["g"].extend({type:"series.map3D",layoutMode:"box",coordinateSystem:null,visualStyleAccessPath:"itemStyle",optionUpdated:function(e){e=e||{};var t=this.get("coordinateSystem");null!=t&&"geo3D"!==t&&(this.get("groundPlane.show")&&(this.option.groundPlane.show=!1),this._geo=null)},getInitialData:function(e){e.data=this.getFilledRegions(e.data,e.map);var t=L["m"].createDimensions(e.data,{coordDimensions:["value"]}),r=new L["e"](t,this);r.initData(e.data);var i={};return r.each((function(e){var t=r.getName(e),n=r.getItemModel(e);i[t]=n})),this._regionModelMap=i,r},formatTooltip:function(e){return Kh(this,e)},getRegionModel:function(e){var t=this.getData().getName(e);return this._regionModelMap[t]||new L["f"](null,this)},getRegionPolygonCoords:function(e){var t=this.coordinateSystem,r=this.getData().getName(e);if(t.transform){var i=t.getRegion(r);return i?i.geometries:[]}this._geo||(this._geo=pc.createGeo3D(this));i=this._geo.getRegion(r);for(var n=[],a=0;a<i.geometries.length;a++){var o=i.geometries[a],s=[],l=_f(t,o.exterior);if(s&&s.length)for(var u=0;u<o.interiors.length;u++)s.push(_f(t,s[u]));n.push({interiors:s,exterior:l})}return n},getFormattedLabel:function(e,t){var r=Zh.getFormattedLabel(this,e,t);return null==r&&(r=this.getData().getName(e)),r},defaultOption:{coordinateSystem:"geo3D",data:null}});L["w"].merge(yf.prototype,tu),L["w"].merge(yf.prototype,ho),L["w"].merge(yf.prototype,fo),L["w"].merge(yf.prototype,po),L["w"].merge(yf.prototype,eu);var xf=yf,Tf=L["b"].extend({type:"map3D",__ecgl__:!0,init:function(e,t){this._geo3DBuilder=new ec(t),this.groupGL=new Ya.Node},render:function(e,t,r){var i=e.coordinateSystem;if(i&&i.viewGL){if(this.groupGL.add(this._geo3DBuilder.rootNode),i.viewGL.add(this.groupGL),"geo3D"===i.type){i,this._sceneHelper||(this._sceneHelper=new Po,this._sceneHelper.initLight(this.groupGL)),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(e),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var n=this._control;n||(n=this._control=new bo({zr:r.getZr()}),this._control.init());var a=e.getModel("viewControl");n.setViewGL(i.viewGL),n.setFromViewControlModel(a,0),n.off("update"),n.on("update",(function(){r.dispatchAction({type:"map3DChangeCamera",alpha:n.getAlpha(),beta:n.getBeta(),distance:n.getDistance(),from:this.uid,map3DId:e.id})})),this._geo3DBuilder.extrudeY=!0}else this._control&&(this._control.dispose(),this._control=null),this._sceneHelper&&(this._sceneHelper.dispose(),this._sceneHelper=null),e.getData().getLayout("geo3D"),this._geo3DBuilder.extrudeY=!1;this._geo3DBuilder.update(e,t,r,0,e.getData().count());var o=i.viewGL.isLinearSpace()?"define":"undefine";this._geo3DBuilder.rootNode.traverse((function(e){e.material&&e.material[o]("fragment","SRGB_DECODE")}))}},afterRender:function(e,t,r,i){var n=i.renderer,a=e.coordinateSystem;a&&"geo3D"===a.type&&(this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r))},dispose:function(){this.groupGL.removeAll(),this._control.dispose(),this._geo3DBuilder.dispose()}});function bf(e){mc(e),e.registerChartView(Tf),e.registerSeriesModel(xf),e.registerAction({type:"map3DChangeCamera",event:"map3dcamerachanged",update:"series:updateCamera"},(function(e,t){t.eachComponent({mainType:"series",subType:"map3D",query:e},(function(t){t.setView(e)}))}))}Object(L["v"])(bf);var wf=L["g"].extend({type:"series.scatterGL",dependencies:["grid","polar","geo","singleAxis"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(){return L["m"].createList(this)},defaultOption:{coordinateSystem:"cartesian2d",zlevel:10,progressive:1e5,progressiveThreshold:1e5,large:!1,symbol:"circle",symbolSize:10,zoomScale:0,blendMode:"source-over",itemStyle:{opacity:.8},postEffect:{enable:!1,colorCorrection:{exposure:0,brightness:0,contrast:1,saturation:1,enable:!0}}}}),Ef=r("1687"),Sf=r("401b");function Cf(e){this.viewGL=e}Cf.prototype.reset=function(e,t){this._updateCamera(t.getWidth(),t.getHeight(),t.getDevicePixelRatio()),this._viewTransform=Ef["c"](),this.updateTransform(e,t)},Cf.prototype.updateTransform=function(e,t){var r=e.coordinateSystem;r.getRoamTransform&&(Ef["e"](this._viewTransform,r.getRoamTransform()),this._setCameraTransform(this._viewTransform),t.getZr().refresh())},Cf.prototype.dataToPoint=function(e,t,r){r=e.dataToPoint(t,null,r);var i=this._viewTransform;i&&Sf["b"](r,r,i)},Cf.prototype.removeTransformInPoint=function(e){return this._viewTransform&&Sf["b"](e,e,this._viewTransform),e},Cf.prototype.getZoom=function(){if(this._viewTransform){var e=this._viewTransform;return 1/Math.max(Math.sqrt(e[0]*e[0]+e[1]*e[1]),Math.sqrt(e[2]*e[2]+e[3]*e[3]))}return 1},Cf.prototype._setCameraTransform=function(e){var t=this.viewGL.camera;t.position.set(e[4],e[5],0),t.scale.set(Math.sqrt(e[0]*e[0]+e[1]*e[1]),Math.sqrt(e[2]*e[2]+e[3]*e[3]),1)},Cf.prototype._updateCamera=function(e,t,r){this.viewGL.setViewport(0,0,e,t,r);var i=this.viewGL.camera;i.left=i.top=0,i.bottom=t,i.right=e,i.near=0,i.far=100};var Af=Cf,Mf=L["b"].extend({type:"scatterGL",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this.viewGL=new Bl("orthographic"),this.viewGL.add(this.groupGL),this._pointsBuilderList=[],this._currentStep=0,this._sizeScale=1,this._glViewHelper=new Af(this.viewGL)},render:function(e,t,r){if(this.groupGL.removeAll(),this._glViewHelper.reset(e,r),e.getData().count()){var i=this._pointsBuilderList[0];i||(i=this._pointsBuilderList[0]=new Ld(!0,r)),this._pointsBuilderList.length=1,this.groupGL.add(i.rootNode),this._removeTransformInPoints(e.getData().getLayout("points")),i.update(e,t,r),this.viewGL.setPostEffect(e.getModel("postEffect"),r)}},incrementalPrepareRender:function(e,t,r){this.groupGL.removeAll(),this._glViewHelper.reset(e,r),this._currentStep=0,this.viewGL.setPostEffect(e.getModel("postEffect"),r)},incrementalRender:function(e,t,r,i){if(!(e.end<=e.start)){var n=this._pointsBuilderList[this._currentStep];n||(n=new Ld(!0,i),this._pointsBuilderList[this._currentStep]=n),this.groupGL.add(n.rootNode),this._removeTransformInPoints(t.getData().getLayout("points")),n.setSizeScale(this._sizeScale),n.update(t,r,i,e.start,e.end),i.getZr().refresh(),this._currentStep++}},updateTransform:function(e,t,r){if(e.coordinateSystem.getRoamTransform){this._glViewHelper.updateTransform(e,r);var i=this._glViewHelper.getZoom(),n=Math.max((e.get("zoomScale")||0)*(i-1)+1,0);this._sizeScale=n,this._pointsBuilderList.forEach((function(e){e.setSizeScale(n)}))}},_removeTransformInPoints:function(e){if(e)for(var t=[],r=0;r<e.length;r+=2)t[0]=e[r],t[1]=e[r+1],this._glViewHelper.removeTransformInPoint(t),e[r]=t[0],e[r+1]=t[1]},dispose:function(){this.groupGL.removeAll(),this._pointsBuilderList.forEach((function(e){e.dispose()}))},remove:function(){this.groupGL.removeAll()}});function Lf(e){e.registerChartView(Mf),e.registerSeriesModel(wf),e.registerLayout({seriesType:"scatterGL",reset:function(e){var t,r=e.coordinateSystem,i=e.getData();if(r){var n=r.dimensions.map((function(e){return i.mapDimension(e)})).slice(0,2),a=[];1===n.length?t=function(e){for(var t=new Float32Array(2*(e.end-e.start)),a=e.start;a<e.end;a++){var o=2*(a-e.start),s=i.get(n[0],a),l=r.dataToPoint(s);t[o]=l[0],t[o+1]=l[1]}i.setLayout("points",t)}:2===n.length&&(t=function(e){for(var t=new Float32Array(2*(e.end-e.start)),o=e.start;o<e.end;o++){var s=2*(o-e.start),l=i.get(n[0],o),u=i.get(n[1],o);a[0]=l,a[1]=u,a=r.dataToPoint(a),t[s]=a[0],t[s+1]=a[1]}i.setLayout("points",t)})}return{progress:t}}})}Object(L["v"])(Lf);var Df=r("7368"),Nf=r("6a2f"),Rf=Nf["a"],If=function(e,t,r,i,n){for(var a=new Df["a"](i),o=0;o<e.length;o++)a.addNode(na.firstNotNull(e[o].id,e[o].name,o),o);var s,l=[],u=[],c=0;for(o=0;o<t.length;o++){var h=t[o],d=h.source,f=h.target;a.addEdge(d,f,c)&&(u.push(h),l.push(na.firstNotNull(h.id,d+" > "+f)),c++)}var p=L["m"].createDimensions(e,{coordDimensions:["value"]});s=new L["e"](p,r),s.initData(e);var m=new L["e"](["value"],r);return m.initData(u,l),n&&n(s,m),Rf({mainData:s,struct:a,structAttr:"graph",datas:{node:s,edge:m},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a},Pf=L["g"].extend({type:"series.graphGL",visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,init:function(e){Pf.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this._updateCategoriesData()},mergeOption:function(e){Pf.superApply(this,"mergeOption",arguments),this._updateCategoriesData()},getFormattedLabel:function(e,t,r,i){var n=Zh.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},getInitialData:function(e,t){var r=e.edges||e.links||[],i=e.data||e.nodes||[],n=this;if(i&&r)return If(i,r,this,!0,a).data;function a(e,r){e.wrapMethod("getItemModel",(function(e){const t=n._categoriesModels,r=e.getShallow("category"),i=t[r];return i&&(i.parentModel=e.parentModel,e.parentModel=i),e}));const i=t.getModel([]).getModel;function a(e,t){const r=i.call(this,e,t);return r.resolveParentPath=o,r}function o(e){if(e&&("label"===e[0]||"label"===e[1])){const t=e.slice();return"label"===e[0]?t[0]="edgeLabel":"label"===e[1]&&(t[1]="edgeLabel"),t}return e}r.wrapMethod("getItemModel",(function(e){return e.resolveParentPath=o,e.getModel=a,e}))}},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(e,t,r){if("edge"===r){var i=this.getData(),n=this.getDataParams(e,r),a=i.graph.getEdgeByIndex(e),o=i.getName(a.node1.dataIndex),s=i.getName(a.node2.dataIndex),l=[];return null!=o&&l.push(o),null!=s&&l.push(s),l=L["i"].encodeHTML(l.join(" > ")),n.value&&(l+=" : "+L["i"].encodeHTML(n.value)),l}return Pf.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var e=(this.option.categories||[]).map((function(e){return null!=e.value?e:Object.assign({value:0},e)})),t=new L["e"](["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray((function(e){return t.getItemModel(e,!0)}))},setView:function(e){null!=e.zoom&&(this.option.zoom=e.zoom),null!=e.offset&&(this.option.offset=e.offset)},setNodePosition:function(e){for(var t=0;t<e.length/2;t++){var r=e[2*t],i=e[2*t+1],n=this.getData().getRawDataItem(t);n.x=r,n.y=i}},isAnimationEnabled:function(){return Pf.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:10,z:2,legendHoverLink:!0,layout:"forceAtlas2",forceAtlas2:{initLayout:null,GPU:!0,steps:1,maxSteps:1e3,repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,edgeWeightInfluence:1,edgeWeight:[1,4],nodeWeight:[1,4],preventOverlap:!1,gravityCenter:null},focusNodeAdjacency:!0,focusNodeAdjacencyOn:"mouseover",left:"center",top:"center",symbol:"circle",symbolSize:5,roam:!1,center:null,zoom:1,label:{show:!1,formatter:"{b}",position:"right",distance:5,textStyle:{fontSize:14}},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{label:{show:!0}},animation:!1}}),Of=Pf,Bf=So.vec2,Ff=[[0,0],[1,1]],Uf=Vr.extend((function(){return{segmentScale:4,dynamic:!0,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",2,"POSITION"),normal:new Vr.Attribute("normal","float",2),offset:new Vr.Attribute("offset","float",1),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(e){var t=this.attributes;this.vertexCount!==e&&(t.position.init(e),t.color.init(e),this.useNativeLine||(t.offset.init(e),t.normal.init(e)),e>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){var n=Bf.dist(e,t)+Bf.dist(r,t)+Bf.dist(i,r),a=1/(n+1)*this.segmentScale;return a},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(Ff)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(Ff)},getPolylineVertexCount:function(e){var t;if("number"===typeof e)t=e;else{var r="number"!==typeof e[0];t=r?e.length:e.length/2}return this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;if("number"===typeof e)t=e;else{var r="number"!==typeof e[0];t=r?e.length:e.length/2}return this.useNativeLine?0:2*(t-1)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=t[0],u=t[1],c=r[0],h=r[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(e,t,r,i),m=p*p,g=m*p,v=3*p,_=3*m,y=6*m,x=6*g,T=o-2*l+c,b=s-2*u+h,w=3*(l-c)-o+d,E=3*(u-h)-s+f,S=o,C=s,A=(l-o)*v+T*_+w*g,M=(u-s)*v+b*_+E*g,L=T*y+w*x,D=b*y+E*x,N=w*x,R=E*x,I=0,P=0,O=Math.ceil(1/p),B=new Float32Array(3*(O+1)),F=(B=[],0);for(P=0;P<O+1;P++)B[F++]=S,B[F++]=C,S+=A,C+=M,A+=L,M+=D,L+=N,D+=R,I+=p,I>1&&(S=A>0?Math.min(S,d):Math.max(S,d),C=M>0?Math.min(C,f):Math.max(C,f));this.addPolyline(B,n,a)},addLine:function(e,t,r,i){this.addPolyline([e,t],r,i)},addPolyline:function(){var e=Bf.create(),t=Bf.create(),r=Bf.create(),i=Bf.create(),n=[],a=[],o=[];return function(s,l,u,c,h){if(s.length){var d="number"!==typeof s[0];if(null==h&&(h=d?s.length:s.length/2),!(h<2)){null==c&&(c=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!==typeof l[0]:l.length/4===h,m=this.attributes.position,g=this.attributes.color,v=this.attributes.offset,_=this.attributes.normal,y=this.indices,x=this._vertexOffset,T=0;T<h;T++){if(d)n=s[T+c],f=p?l[T+c]:l;else{var b=2*T+c;if(n=n||[],n[0]=s[b],n[1]=s[b+1],p){var w=4*T+c;f=f||[],f[0]=l[w],f[1]=l[w+1],f[2]=l[w+2],f[3]=l[w+3]}else f=l}if(this.useNativeLine)T>1&&(m.copy(x,x-1),g.copy(x,x-1),x++);else{var E;if(T<h-1){if(d)Bf.copy(a,s[T+1]);else{b=2*(T+1)+c;a=a||[],a[0]=s[b],a[1]=s[b+1]}if(T>0){Bf.sub(e,n,o),Bf.sub(t,a,n),Bf.normalize(e,e),Bf.normalize(t,t),Bf.add(i,e,t),Bf.normalize(i,i);var S=u/2*Math.min(1/Bf.dot(e,i),2);r[0]=-i[1],r[1]=i[0],E=S}else Bf.sub(e,a,n),Bf.normalize(e,e),r[0]=-e[1],r[1]=e[0],E=u/2}else Bf.sub(e,n,o),Bf.normalize(e,e),r[0]=-e[1],r[1]=e[0],E=u/2;_.set(x,r),_.set(x+1,r),v.set(x,E),v.set(x+1,-E),Bf.copy(o,n),m.set(x,n),m.set(x+1,n),g.set(x,f),g.set(x+1,f),x+=2}if(this.useNativeLine)g.set(x,f),m.set(x,n),x++;else if(T>0){var C=3*this._faceOffset;y=this.indices;y[C]=x-4,y[C+1]=x-3,y[C+2]=x-2,y[C+3]=x-3,y[C+4]=x-1,y[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=e<this._itemVertexOffsets.length-1?this._itemVertexOffsets[e+1]:this._vertexOffset,n=r;n<i;n++)this.attributes.color.set(n,t);this.dirty("color")}});L["w"].defaults(Uf.prototype,wo);var zf=Uf,Gf="@export ecgl.forceAtlas2.updateNodeRepulsion\n\n#define NODE_COUNT 0\n\nuniform sampler2D positionTex;\n\nuniform vec2 textureSize;\nuniform float gravity;\nuniform float scaling;\nuniform vec2 gravityCenter;\n\nuniform bool strongGravityMode;\nuniform bool preventOverlap;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, v_Texcoord);\n\n vec2 force = vec2(0.0);\n for (int i = 0; i < NODE_COUNT; i++) {\n vec2 uv = vec2(\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\n );\n vec4 n1 = texture2D(positionTex, uv);\n\n vec2 dir = n0.xy - n1.xy;\n float d2 = dot(dir, dir);\n\n if (d2 > 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end";Ya.Shader.import(Gf);var Hf={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function kf(e){var t={type:Ya.Texture.FLOAT,minFilter:Ya.Texture.NEAREST,magFilter:Ya.Texture.NEAREST};this._positionSourceTex=new Ya.Texture2D(t),this._positionSourceTex.flipY=!1,this._positionTex=new Ya.Texture2D(t),this._positionPrevTex=new Ya.Texture2D(t),this._forceTex=new Ya.Texture2D(t),this._forcePrevTex=new Ya.Texture2D(t),this._weightedSumTex=new Ya.Texture2D(t),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new Ya.Texture2D(t),this._globalSpeedPrevTex=new Ya.Texture2D(t),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new Hn({fragment:Ya.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new Hn({fragment:Ya.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new Hn({fragment:Ya.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new Hn({fragment:Ya.Shader.source("clay.compositor.output")});var r=function(e){e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE)};this._edgeForceMesh=new Ya.Mesh({geometry:new Ya.Geometry({attributes:{node1:new Ya.Geometry.Attribute("node1","float",2),node2:new Ya.Geometry.Attribute("node2","float",2),weight:new Ya.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new Ya.Material({transparent:!0,shader:Ya.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:r,depthMask:!1,depthText:!1}),mode:Ya.Mesh.POINTS}),this._weightedSumMesh=new Ya.Mesh({geometry:new Ya.Geometry({attributes:{node:new Ya.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new Ya.Material({transparent:!0,shader:Ya.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:r,depthMask:!1,depthText:!1}),mode:Ya.Mesh.POINTS}),this._framebuffer=new Fi({depthBuffer:!1}),this._dummyCamera=new Ya.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}kf.prototype.updateOption=function(e){for(var t in Hf)this[t]=Hf[t];var r=this._nodes.length;if(this.jitterTolerence=r>5e4?10:r>5e3?1:.1,this.scaling=r>100?2:10,e)for(var t in Hf)null!=e[t]&&(this[t]=e[t]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,n=0;n<this._nodes.length;n++)i[4*n+2]=(this._nodes[n].degree||0)+1},kf.prototype._updateGravityCenter=function(e){var t=this._nodes,r=this._edges;if(this.gravityCenter)this._gravityCenter=this.gravityCenter;else{for(var i=[1/0,1/0],n=[-1/0,-1/0],a=0;a<t.length;a++)i[0]=Math.min(t[a].x,i[0]),i[1]=Math.min(t[a].y,i[1]),n[0]=Math.max(t[a].x,n[0]),n[1]=Math.max(t[a].y,n[1]);this._gravityCenter=[.5*(i[0]+n[0]),.5*(i[1]+n[1])]}for(a=0;a<r.length;a++){var o=r[a].node1,s=r[a].node2;t[o].degree=(t[o].degree||0)+1,t[s].degree=(t[s].degree||0)+1}},kf.prototype.initData=function(e,t){this._nodes=e,this._edges=t,this._updateGravityCenter();var r=Math.ceil(Math.sqrt(e.length)),i=r,n=new Float32Array(r*i*4);this._resize(r,i);for(var a=0,o=0;o<e.length;o++){var s=e[o];n[a++]=s.x||0,n[a++]=s.y||0,n[a++]=s.mass||1,n[a++]=s.size||1}this._positionSourceTex.pixels=n;var l=this._edgeForceMesh.geometry,u=t.length;l.attributes.node1.init(2*u),l.attributes.node2.init(2*u),l.attributes.weight.init(2*u);var c=[];for(o=0;o<t.length;o++){var h=l.attributes,d=t[o].weight;null==d&&(d=1),h.node1.set(o,this.getNodeUV(t[o].node1,c)),h.node2.set(o,this.getNodeUV(t[o].node2,c)),h.weight.set(o,d),h.node1.set(o+u,this.getNodeUV(t[o].node2,c)),h.node2.set(o+u,this.getNodeUV(t[o].node1,c)),h.weight.set(o+u,d)}var f=this._weightedSumMesh.geometry;f.attributes.node.init(e.length);for(o=0;o<e.length;o++)f.attributes.node.set(o,this.getNodeUV(o,c));l.dirty(),f.dirty(),this._nodeRepulsionPass.material.define("fragment","NODE_COUNT",e.length),this._nodeRepulsionPass.material.setUniform("textureSize",[r,i]),this._inited=!1,this._frame=0},kf.prototype.getNodes=function(){return this._nodes},kf.prototype.getEdges=function(){return this._edges},kf.prototype.step=function(e){this._inited||(this._initFromSource(e),this._inited=!0),this._frame++,this._framebuffer.attach(this._forceTex),this._framebuffer.bind(e);var t=this._nodeRepulsionPass;t.setUniform("strongGravityMode",this.strongGravityMode),t.setUniform("gravity",this.gravity),t.setUniform("gravityCenter",this._gravityCenter),t.setUniform("scaling",this.scaling),t.setUniform("preventOverlap",this.preventOverlap),t.setUniform("positionTex",this._positionPrevTex),t.render(e);var r=this._edgeForceMesh;r.material.set("linLogMode",this.linLogMode),r.material.set("edgeWeightInfluence",this.edgeWeightInfluence),r.material.set("preventOverlap",this.preventOverlap),r.material.set("positionTex",this._positionPrevTex),e.gl.enable(e.gl.BLEND),e.renderPass([r],this._dummyCamera),this._framebuffer.attach(this._weightedSumTex),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT),e.gl.enable(e.gl.BLEND);var i=this._weightedSumMesh;i.material.set("positionTex",this._positionPrevTex),i.material.set("forceTex",this._forceTex),i.material.set("forcePrevTex",this._forcePrevTex),e.renderPass([i],this._dummyCamera),this._framebuffer.attach(this._globalSpeedTex);var n=this._globalSpeedPass;n.setUniform("globalSpeedPrevTex",this._globalSpeedPrevTex),n.setUniform("weightedSumTex",this._weightedSumTex),n.setUniform("jitterTolerence",this.jitterTolerence),e.gl.disable(e.gl.BLEND),n.render(e);var a=this._positionPass;this._framebuffer.attach(this._positionTex),a.setUniform("globalSpeedTex",this._globalSpeedTex),a.setUniform("positionTex",this._positionPrevTex),a.setUniform("forceTex",this._forceTex),a.setUniform("forcePrevTex",this._forcePrevTex),a.render(e),this._framebuffer.unbind(e),this._swapTexture()},kf.prototype.update=function(e,t,r){null==t&&(t=1),t=Math.max(t,1);for(var i=0;i<t;i++)this.step(e);r&&r()},kf.prototype.getNodePositionTexture=function(){return this._inited?this._positionPrevTex:this._positionSourceTex},kf.prototype.getNodeUV=function(e,t){t=t||[];var r=this._positionTex.width,i=this._positionTex.height;return t[0]=e%r/(r-1),t[1]=Math.floor(e/r)/(i-1)||0,t},kf.prototype.getNodePosition=function(e,t){var r=this._positionArr,i=this._positionTex.width,n=this._positionTex.height,a=i*n;r&&r.length===4*a||(r=this._positionArr=new Float32Array(4*a)),this._framebuffer.bind(e),this._framebuffer.attach(this._positionPrevTex),e.gl.readPixels(0,0,i,n,e.gl.RGBA,e.gl.FLOAT,r),this._framebuffer.unbind(e),t||(t=new Float32Array(2*this._nodes.length));for(var o=0;o<this._nodes.length;o++)t[2*o]=r[4*o],t[2*o+1]=r[4*o+1];return t},kf.prototype.getTextureData=function(e,t){var r=this["_"+t+"Tex"],i=r.width,n=r.height;this._framebuffer.bind(e),this._framebuffer.attach(r);var a=new Float32Array(i*n*4);return e.gl.readPixels(0,0,i,n,e.gl.RGBA,e.gl.FLOAT,a),this._framebuffer.unbind(e),a},kf.prototype.getTextureSize=function(){return{width:this._positionTex.width,height:this._positionTex.height}},kf.prototype.isFinished=function(e){return this._frame>e},kf.prototype._swapTexture=function(){var e=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=e;e=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=e;e=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=e},kf.prototype._initFromSource=function(e){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(e),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(e),e.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(e)},kf.prototype._resize=function(e,t){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(r){this[r].width=e,this[r].height=t,this[r].dirty()}),this)},kf.prototype.dispose=function(e){this._framebuffer.dispose(e),this._copyPass.dispose(e),this._nodeRepulsionPass.dispose(e),this._positionPass.dispose(e),this._globalSpeedPass.dispose(e),this._edgeForceMesh.geometry.dispose(e),this._weightedSumMesh.geometry.dispose(e),this._positionSourceTex.dispose(e),this._positionTex.dispose(e),this._positionPrevTex.dispose(e),this._forceTex.dispose(e),this._forcePrevTex.dispose(e),this._weightedSumTex.dispose(e),this._globalSpeedTex.dispose(e),this._globalSpeedPrevTex.dispose(e)};var Vf=kf;function Wf(){var e={create:function(){return new Float32Array(2)},dist:function(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(r*r+i*i)},len:function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},scaleAndAdd:function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},scale:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},sub:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},normalize:function(e,t){var r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n),e[0]=t[0]*n,e[1]=t[1]*n),e},negate:function(e,t){return e[0]=-t[0],e[1]=-t[1],e},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e},set:function(e,t,r){return e[0]=t,e[1]=r,e}};function t(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var r=t.prototype;function i(){this.position=new Float32Array(2),this.force=e.create(),this.forcePrev=e.create(),this.mass=1,this.inDegree=0,this.outDegree=0}function n(e,t){this.source=e,this.target=t,this.weight=1}function a(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new t,this.rootRegion.centerOfMass=e.create(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}r.beforeUpdate=function(){for(var e=0;e<this.nSubRegions;e++)this.subRegions[e].beforeUpdate();this.mass=0,this.centerOfMass&&(this.centerOfMass[0]=0,this.centerOfMass[1]=0),this.nSubRegions=0,this.node=null},r.afterUpdate=function(){this.subRegions.length=this.nSubRegions;for(var e=0;e<this.nSubRegions;e++)this.subRegions[e].afterUpdate()},r.addNode=function(e){if(0===this.nSubRegions){if(null==this.node)return void(this.node=e);this._addNodeToSubRegion(this.node),this.node=null}this._addNodeToSubRegion(e),this._updateCenterOfMass(e)},r.findSubRegion=function(e,t){for(var r=0;r<this.nSubRegions;r++){var i=this.subRegions[r];if(i.contain(e,t))return i}},r.contain=function(e,t){return this.bbox[0]<=e&&this.bbox[2]>=e&&this.bbox[1]<=t&&this.bbox[3]>=t},r.setBBox=function(e,t,r,i){this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=i,this.size=(r-e+i-t)/2},r._newSubRegion=function(){var e=this.subRegions[this.nSubRegions];return e||(e=new t,this.subRegions[this.nSubRegions]=e),this.nSubRegions++,e},r._addNodeToSubRegion=function(e){var t=this.findSubRegion(e.position[0],e.position[1]),r=this.bbox;if(!t){var i=(r[0]+r[2])/2,n=(r[1]+r[3])/2,a=(r[2]-r[0])/2,o=(r[3]-r[1])/2,s=e.position[0]>=i?1:0,l=e.position[1]>=n?1:0;t=this._newSubRegion();t.setBBox(s*a+r[0],l*o+r[1],(s+1)*a+r[0],(l+1)*o+r[1])}t.addNode(e)},r._updateCenterOfMass=function(e){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var t=this.centerOfMass[0]*this.mass,r=this.centerOfMass[1]*this.mass;t+=e.position[0]*e.mass,r+=e.position[1]*e.mass,this.mass+=e.mass,this.centerOfMass[0]=t/this.mass,this.centerOfMass[1]=r/this.mass};var o=a.prototype;o.initNodes=function(e,t,r){var n=t.length;this.nodes.length=0;for(var a="undefined"!=typeof r,o=0;o<n;o++){var s=new i;s.position[0]=e[2*o],s.position[1]=e[2*o+1],s.mass=t[o],a&&(s.size=r[o]),this.nodes.push(s)}this._massArr=t,this._swingingArr=new Float32Array(n),a&&(this._sizeArr=r)},o.initEdges=function(e,t){var r=e.length/2;this.edges.length=0;for(var i=0;i<r;i++){var a=e[2*i],o=e[2*i+1],s=this.nodes[a],l=this.nodes[o];if(!s||!l)return void console.error("Node not exists, try initNodes before initEdges");s.outDegree++,l.inDegree++;var u=new n(s,l);t&&(u.weight=t[i]),this.edges.push(u)}},o.updateSettings=function(){if(this.repulsionByDegree)for(var e=0;e<this.nodes.length;e++){var t=this.nodes[e];t.mass=t.inDegree+t.outDegree+1}else for(e=0;e<this.nodes.length;e++){t=this.nodes[e];t.mass=this._massArr[e]}},o.update=function(){var t=this.nodes.length;if(this.updateSettings(),this.updateBBox(),this.barnesHutOptimize){this.rootRegion.setBBox(this.bbox[0],this.bbox[1],this.bbox[2],this.bbox[3]),this.rootRegion.beforeUpdate();for(var r=0;r<t;r++)this.rootRegion.addNode(this.nodes[r]);this.rootRegion.afterUpdate()}for(r=0;r<t;r++){var i=this.nodes[r];e.copy(i.forcePrev,i.force),e.set(i.force,0,0)}for(r=0;r<t;r++){var n=this.nodes[r];if(this.barnesHutOptimize)this.applyRegionToNodeRepulsion(this.rootRegion,n);else for(var a=r+1;a<t;a++){var o=this.nodes[a];this.applyNodeToNodeRepulsion(n,o,!1)}this.gravity>0&&(this.strongGravityMode?this.applyNodeStrongGravity(n):this.applyNodeGravity(n))}for(r=0;r<this.edges.length;r++)this.applyEdgeAttraction(this.edges[r]);var s=0,l=0,u=e.create();for(r=0;r<t;r++){i=this.nodes[r];var c=e.dist(i.force,i.forcePrev);s+=c*i.mass,e.add(u,i.force,i.forcePrev);var h=.5*e.len(u);l+=h*i.mass,this._swingingArr[r]=c}var d=this.jitterTolerence*this.jitterTolerence*l/s;this._globalSpeed>0&&(d=Math.min(d/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=d;for(r=0;r<t;r++){i=this.nodes[r],c=this._swingingArr[r];var f=.1*d/(1+d*Math.sqrt(c)),p=e.len(i.force);p>0&&(f=Math.min(p*f,10)/p,e.scaleAndAdd(i.position,i.position,i.force,f))}},o.applyRegionToNodeRepulsion=function(){var t=e.create();return function(r,i){if(r.node)this.applyNodeToNodeRepulsion(r.node,i,!0);else{e.sub(t,i.position,r.centerOfMass);var n=t[0]*t[0]+t[1]*t[1];if(n>this.barnesHutTheta*r.size*r.size){var a=this.scaling*i.mass*r.mass/n;e.scaleAndAdd(i.force,i.force,t,a)}else for(var o=0;o<r.nSubRegions;o++)this.applyRegionToNodeRepulsion(r.subRegions[o],i)}}}(),o.applyNodeToNodeRepulsion=function(){var t=e.create();return function(r,i,n){if(r!=i){e.sub(t,r.position,i.position);var a=t[0]*t[0]+t[1]*t[1];if(0!==a){var o;if(this.preventOverlap){var s=Math.sqrt(a);if(s=s-r.size-i.size,s>0)o=this.scaling*r.mass*i.mass/(s*s);else{if(!(s<0))return;o=100*this.scaling*r.mass*i.mass}}else o=this.scaling*r.mass*i.mass/a;e.scaleAndAdd(r.force,r.force,t,o),e.scaleAndAdd(i.force,i.force,t,-o)}}}}(),o.applyEdgeAttraction=function(){var t=e.create();return function(r){var i=r.source,n=r.target;e.sub(t,i.position,n.position);var a,o,s=e.len(t);a=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?r.weight:Math.pow(r.weight,this.edgeWeightInfluence),this.preventOverlap&&(s=s-i.size-n.size,s<=0)||(o=this.linLogMode?-a*Math.log(s+1)/(s+1):-a,e.scaleAndAdd(i.force,i.force,t,o),e.scaleAndAdd(n.force,n.force,t,-o))}}(),o.applyNodeGravity=function(){var t=e.create();return function(r){e.sub(t,this.gravityCenter,r.position);var i=e.len(t);e.scaleAndAdd(r.force,r.force,t,this.gravity*r.mass/(i+1))}}(),o.applyNodeStrongGravity=function(){var t=e.create();return function(r){e.sub(t,this.gravityCenter,r.position),e.scaleAndAdd(r.force,r.force,t,this.gravity*r.mass)}}(),o.updateBBox=function(){for(var e=1/0,t=1/0,r=-1/0,i=-1/0,n=0;n<this.nodes.length;n++){var a=this.nodes[n].position;e=Math.min(e,a[0]),t=Math.min(t,a[1]),r=Math.max(r,a[0]),i=Math.max(i,a[1])}this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=i},o.getGlobalSpeed=function(){return this._globalSpeed};var s=null;self.onmessage=function(e){switch(e.data.cmd){case"init":s=new a,s.initNodes(e.data.nodesPosition,e.data.nodesMass,e.data.nodesSize),s.initEdges(e.data.edges,e.data.edgesWeight);break;case"updateConfig":if(s)for(var t in e.data.config)s[t]=e.data.config[t];break;case"update":var r=e.data.steps;if(s){for(var i=0;i<r;i++)s.update();var n=s.nodes.length,o=new Float32Array(2*n);for(i=0;i<n;i++){var l=s.nodes[i];o[2*i]=l.position[0],o[2*i+1]=l.position[1]}self.postMessage({buffer:o.buffer,globalSpeed:s.getGlobalSpeed()},[o.buffer])}else{var u=new Float32Array;self.postMessage({buffer:u.buffer,globalSpeed:s.getGlobalSpeed()},[u.buffer])}break}}}var jf=Wf,Xf=jf.toString();Xf=Xf.slice(Xf.indexOf("{")+1,Xf.lastIndexOf("}"));var qf={barnesHutOptimize:!0,barnesHutTheta:1.5,repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null},Zf=function(e){for(var t in qf)this[t]=qf[t];if(e)for(var t in e)this[t]=e[t];this._nodes=[],this._edges=[],this._disposed=!1,this._positionTex=new Dr({type:Tr.FLOAT,flipY:!1,minFilter:Tr.NEAREST,magFilter:Tr.NEAREST})};Zf.prototype.initData=function(e,t){var r=new Blob([Xf]),i=window.URL.createObjectURL(r);this._worker=new Worker(i),this._worker.onmessage=this._$onupdate.bind(this),this._nodes=e,this._edges=t,this._frame=0;for(var n=e.length,a=t.length,o=new Float32Array(2*n),s=new Float32Array(n),l=new Float32Array(n),u=new Float32Array(2*a),c=new Float32Array(a),h=0;h<e.length;h++){var d=e[h];o[2*h]=d.x,o[2*h+1]=d.y,s[h]=null==d.mass?1:d.mass,l[h]=null==d.size?1:d.size}for(h=0;h<t.length;h++){var f=t[h],p=f.node1,m=f.node2;u[2*h]=p,u[2*h+1]=m,c[h]=null==f.weight?1:f.weight}var g=Math.ceil(Math.sqrt(e.length)),v=g,_=new Float32Array(g*v*4),y=this._positionTex;y.width=g,y.height=v,y.pixels=_,this._worker.postMessage({cmd:"init",nodesPosition:o,nodesMass:s,nodesSize:l,edges:u,edgesWeight:c}),this._globalSpeed=1/0},Zf.prototype.updateOption=function(e){var t={};for(var r in qf)t[r]=qf[r];var i=this._nodes,n=this._edges,a=i.length;if(t.jitterTolerence=a>5e4?10:a>5e3?1:.1,t.scaling=a>100?2:10,t.barnesHutOptimize=a>1e3,e)for(var r in qf)null!=e[r]&&(t[r]=e[r]);if(!t.gravityCenter){for(var o=[1/0,1/0],s=[-1/0,-1/0],l=0;l<i.length;l++)o[0]=Math.min(i[l].x,o[0]),o[1]=Math.min(i[l].y,o[1]),s[0]=Math.max(i[l].x,s[0]),s[1]=Math.max(i[l].y,s[1]);t.gravityCenter=[.5*(o[0]+s[0]),.5*(o[1]+s[1])]}for(l=0;l<n.length;l++){var u=n[l].node1,c=n[l].node2;i[u].degree=(i[u].degree||0)+1,i[c].degree=(i[c].degree||0)+1}this._worker&&this._worker.postMessage({cmd:"updateConfig",config:t})},Zf.prototype.update=function(e,t,r){null==t&&(t=1),t=Math.max(t,1),this._frame+=t,this._onupdate=r,this._worker&&this._worker.postMessage({cmd:"update",steps:Math.round(t)})},Zf.prototype._$onupdate=function(e){if(!this._disposed){var t=new Float32Array(e.data.buffer);this._globalSpeed=e.data.globalSpeed,this._positionArr=t,this._updateTexture(t),this._onupdate&&this._onupdate()}},Zf.prototype.getNodePositionTexture=function(){return this._positionTex},Zf.prototype.getNodeUV=function(e,t){t=t||[];var r=this._positionTex.width,i=this._positionTex.height;return t[0]=e%r/(r-1),t[1]=Math.floor(e/r)/(i-1),t},Zf.prototype.getNodes=function(){return this._nodes},Zf.prototype.getEdges=function(){return this._edges},Zf.prototype.isFinished=function(e){return this._frame>e},Zf.prototype.getNodePosition=function(e,t){if(t||(t=new Float32Array(2*this._nodes.length)),this._positionArr)for(var r=0;r<this._positionArr.length;r++)t[r]=this._positionArr[r];return t},Zf.prototype._updateTexture=function(e){for(var t=this._positionTex.pixels,r=0,i=0;i<e.length;)t[r++]=e[i++],t[r++]=e[i++],t[r++]=1,t[r++]=1;this._positionTex.dirty()},Zf.prototype.dispose=function(e){this._disposed=!0,this._worker=null};var Yf=Zf,Kf=q.extend((function(){return{zr:null,viewGL:null,minZoom:.2,maxZoom:5,_needsUpdate:!1,_dx:0,_dy:0,_zoom:1}}),(function(){this._mouseDownHandler=this._mouseDownHandler.bind(this),this._mouseWheelHandler=this._mouseWheelHandler.bind(this),this._mouseMoveHandler=this._mouseMoveHandler.bind(this),this._mouseUpHandler=this._mouseUpHandler.bind(this),this._update=this._update.bind(this)}),{init:function(){var e=this.zr;e.on("mousedown",this._mouseDownHandler),e.on("mousewheel",this._mouseWheelHandler),e.on("globalout",this._mouseUpHandler),e.animation.on("frame",this._update)},setTarget:function(e){this._target=e},setZoom:function(e){this._zoom=Math.max(Math.min(e,this.maxZoom),this.minZoom),this._needsUpdate=!0},setOffset:function(e){this._dx=e[0],this._dy=e[1],this._needsUpdate=!0},getZoom:function(){return this._zoom},getOffset:function(){return[this._dx,this._dy]},_update:function(){if(this._target&&this._needsUpdate){var e=this._target,t=this._zoom;e.position.x=this._dx,e.position.y=this._dy,e.scale.set(t,t,t),this.zr.refresh(),this._needsUpdate=!1,this.trigger("update")}},_mouseDownHandler:function(e){if(!e.target){var t=e.offsetX,r=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(t,r)){this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler);var i=this._convertPos(t,r);this._x=i.x,this._y=i.y}}},_convertPos:function(e,t){var r=this.viewGL.camera,i=this.viewGL.viewport;return{x:(e-i.x)/i.width*(r.right-r.left)+r.left,y:(t-i.y)/i.height*(r.bottom-r.top)+r.top}},_mouseMoveHandler:function(e){var t=this._convertPos(e.offsetX,e.offsetY);this._dx+=t.x-this._x,this._dy+=t.y-this._y,this._x=t.x,this._y=t.y,this._needsUpdate=!0},_mouseUpHandler:function(e){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_mouseWheelHandler:function(e){e=e.event;var t=e.wheelDelta||-e.detail;if(0!==t){var r=e.offsetX,i=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(r,i)){var n=t>0?1.1:.9,a=Math.max(Math.min(this._zoom*n,this.maxZoom),this.minZoom);n=a/this._zoom;var o=this._convertPos(r,i),s=(o.x-this._dx)*(n-1),l=(o.y-this._dy)*(n-1);this._dx-=s,this._dy-=l,this._zoom=a,this._needsUpdate=!0}}},dispose:function(){var e=this.zr;e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("globalout",this._mouseUpHandler),e.animation.off("frame",this._update)}}),$f=Kf,Qf="@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end",Jf=So.vec2;Ya.Shader.import(Qf);var ep=1,tp=L["b"].extend({type:"graphGL",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this.viewGL=new Bl("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Ld(!0,t),this._forceEdgesMesh=new Ya.Mesh({material:new Ya.Material({shader:Ya.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Ya.Geometry({attributes:{node:new Ya.Geometry.Attribute("node","float",2),color:new Ya.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:Ya.Mesh.LINES}),this._edgesMesh=new Ya.Mesh({material:new Ya.Material({shader:Ya.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new zf({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new $f({zr:t.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode),this._model=e,this._api=r,this._initLayout(e,t,r),this._pointsBuilder.update(e,t,r),this._forceLayoutInstance instanceof Vf||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(e,r),this._control.off("update"),this._control.on("update",(function(){r.dispatchAction({type:"graphGLRoam",seriesId:e.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(na.firstNotNull(e.get("zoom"),1)),this._control.setOffset(e.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),r.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,e.get("focusNodeAdjacency")){var n=e.get("focusNodeAdjacencyOn");"click"===n?r.getZr().on("click",this._clickHandler):"mouseover"===n&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?t!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._mouseOutHandler(e),this._lastMouseOverDataIndex=t}},_mouseOutHandler:function(e){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(e,t){var r=this._forceEdgesMesh.geometry,i=t.getEdgeData(),n=0,a=this._forceLayoutInstance,o=2*i.count();r.attributes.node.init(o),r.attributes.color.init(o),i.each((function(t){var o=e[t];r.attributes.node.set(n,a.getNodeUV(o.node1)),r.attributes.node.set(n+1,a.getNodeUV(o.node2));var s=Xu(i,o.dataIndex),l=Ya.parseColor(s);l[3]*=na.firstNotNull(qu(i,o.dataIndex),1),r.attributes.color.set(n,l),r.attributes.color.set(n+1,l),n+=2})),r.dirty()},_updateMeshLinesGeometry:function(){var e=this._model.getEdgeData(),t=this._edgesMesh.geometry,r=(e=this._model.getEdgeData(),this._model.getData().getLayout("points"));t.resetOffset(),t.setVertexCount(e.count()*t.getLineVertexCount()),t.setTriangleCount(e.count()*t.getLineTriangleCount());var i=[],n=[],a=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*e.count()),this._edgeIndicesMap=new Float32Array(e.count()),e.each((function(o){var s=e.graph.getEdgeByIndex(o),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;i[0]=r[l],i[1]=r[l+1],n[0]=r[u],n[1]=r[u+1];var c=Xu(e,s.dataIndex),h=Ya.parseColor(c);h[3]*=na.firstNotNull(qu(e,s.dataIndex),1);var d=e.getItemModel(s.dataIndex),f=na.firstNotNull(d.get(a),1)*this._api.getDevicePixelRatio();t.addLine(i,n,h,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=h[p];this._edgeIndicesMap[s.dataIndex]=o}),this),t.dirty()},_updateForceNodesGeometry:function(e){for(var t=this._pointsBuilder.getPointsMesh(),r=[],i=0;i<e.count();i++)this._forceLayoutInstance.getNodeUV(i,r),t.geometry.attributes.position.set(i,r);t.geometry.dirty("position")},_initLayout:function(e,t,r){var i=e.get("layout"),n=e.getGraph(),a=e.getBoxLayoutParams(),o=Object(ls["g"])(a,{width:r.getWidth(),height:r.getHeight()});"force"===i&&(i="forceAtlas2"),this.stopLayout(e,t,r,{beforeLayout:!0});var s=e.getData(),l=e.getData();if("forceAtlas2"===i){var u=e.getModel("forceAtlas2"),c=this._forceLayoutInstance,h=[],d=[],f=s.getDataExtent("value"),p=l.getDataExtent("value"),m=na.firstNotNull(u.get("edgeWeight"),1),g=na.firstNotNull(u.get("nodeWeight"),1);"number"===typeof m&&(m=[m,m]),"number"===typeof g&&(g=[g,g]);var v=0,_={},y=new Float32Array(2*s.count());if(n.eachNode((function(e){var t,r,i=e.dataIndex,n=s.get("value",i);if(s.hasItemOption){var a=s.getItemModel(i);t=a.get("x"),r=a.get("y")}null==t&&(t=o.x+Math.random()*o.width,r=o.y+Math.random()*o.height),y[2*v]=t,y[2*v+1]=r,_[e.id]=v++;var l=L["p"].linearMap(n,f,g);isNaN(l)&&(l=isNaN(g[0])?1:g[0]),h.push({x:t,y:r,mass:l,size:s.getItemVisual(i,"symbolSize")})})),s.setLayout("points",y),n.eachEdge((function(e){var t=e.dataIndex,r=s.get("value",t),i=L["p"].linearMap(r,p,m);isNaN(i)&&(i=isNaN(m[0])?1:m[0]),d.push({node1:_[e.node1.id],node2:_[e.node2.id],weight:i,dataIndex:t})})),!c){var x=u.get("GPU");this._forceLayoutInstance&&((!x||this._forceLayoutInstance instanceof Vf)&&(x||this._forceLayoutInstance instanceof Yf)||(this._forceLayoutInstanceToDispose=this._forceLayoutInstance)),c=this._forceLayoutInstance=x?new Vf:new Yf}c.initData(h,d),c.updateOption(u.option),this._updateForceEdgesGeometry(c.getEdges(),e),this._updatePositionTexture(),r.dispatchAction({type:"graphGLStartLayout",from:this.uid})}else{y=new Float32Array(2*s.count()),v=0;n.eachNode((function(e){var t,r,i=e.dataIndex;if(s.hasItemOption){var n=s.getItemModel(i);t=n.get("x"),r=n.get("y")}y[v++]=t,y[v++]=r})),s.setLayout("points",y),this._updateAfterLayout(e,t,r)}},_updatePositionTexture:function(){var e=this._forceLayoutInstance.getNodePositionTexture();this._pointsBuilder.setPositionTexture(e),this._forceEdgesMesh.material.set("positionTex",e)},startLayout:function(e,t,r,i){if(!i||null==i.from||i.from===this.uid){var n=this.viewGL,a=(r=this._api,this._forceLayoutInstance),o=this._model.getData(),s=this._model.getModel("forceAtlas2");if(a&&(this.groupGL.remove(this._edgesMesh),this.groupGL.add(this._forceEdgesMesh),this._forceLayoutInstance)){this._updateForceNodesGeometry(e.getData()),this._pointsBuilder.hideLabels();var l=this,u=this._layoutId=ep++,c=s.getShallow("maxSteps"),h=s.getShallow("steps"),d=0,f=Math.max(2*h,20),p=function(t){if(t===l._layoutId)return a.isFinished(c)?(r.dispatchAction({type:"graphGLStopLayout",from:l.uid}),void r.dispatchAction({type:"graphGLFinishLayout",points:o.getLayout("points"),from:l.uid})):void a.update(n.layer.renderer,h,(function(){l._updatePositionTexture(),d+=h,d>=f&&(l._syncNodePosition(e),d=0),r.getZr().refresh(),Object(Ka["a"])((function(){p(t)}))}))};Object(Ka["a"])((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(n.layer.renderer),l._forceLayoutInstanceToDispose=null),p(u)})),this._layouting=!0}}},stopLayout:function(e,t,r,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(e),this._updateAfterLayout(e,t,r)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(e){var t=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);e.getData().setLayout("points",t),e.setNodePosition(t)},_updateAfterLayout:function(e,t,r){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(e,t,r,i){var n=this._model.getData();this._downplayAll();var a=i.dataIndex,o=n.graph,s=[],l=o.getNodeByIndex(a);s.push(l),l.edges.forEach((function(e){e.dataIndex<0||(e.node1!==l&&s.push(e.node1),e.node2!==l&&s.push(e.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(e){this._pointsBuilder.highlight(n,e.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(e){return e.dataIndex})));var u=[];l.edges.forEach((function(e){e.dataIndex>=0&&(this._highlightEdge(e.dataIndex),u.push(e))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(e,t,r,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(e){var t=this._model.getEdgeData().getItemModel(e),r=Ya.parseColor(t.get("emphasis.lineStyle.color")||t.get("lineStyle.color")),i=na.firstNotNull(t.get("emphasis.lineStyle.opacity"),t.get("lineStyle.opacity"),1);r[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],r)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(e){this._pointsBuilder.downplay(this._model.getData(),e.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(e){this._downplayEdge(e.dataIndex)}),this)},_downplayEdge:function(e){var t=this._getColor(e,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)},_setEdgeFade:function(){var e=[];return function(t,r){this._getColor(t,e),e[3]*=r,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)}}(),_getColor:function(e,t){for(var r=0;r<4;r++)t[r]=this._originalEdgeColors[4*e+r];return t},_fadeOutEdgesAll:function(e){var t=this._model.getData().graph;t.eachEdge((function(t){this._setEdgeFade(t.dataIndex,e)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(e,t){this.viewGL.setViewport(0,0,t.getWidth(),t.getHeight(),t.getDevicePixelRatio());for(var r=this.viewGL.camera,i=e.getData(),n=i.getLayout("points"),a=Jf.create(1/0,1/0),o=Jf.create(-1/0,-1/0),s=[],l=0;l<n.length;)s[0]=n[l++],s[1]=n[l++],Jf.min(a,a,s),Jf.max(o,o,s);var u=(o[1]+a[1])/2,c=(o[0]+a[0])/2;if(!(c>r.left&&c<r.right&&u<r.bottom&&u>r.top)){var h=Math.max(o[0]-a[0],10),d=h/t.getWidth()*t.getHeight();h*=1.4,d*=1.4,a[0]-=.2*h,r.left=a[0],r.top=u-d/2,r.bottom=u+d/2,r.right=h+a[0],r.near=0,r.far=100}},dispose:function(){var e=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(e),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});function rp(e){return e instanceof Array||(e=[e,e]),e}function ip(e){function t(){}e.registerChartView(tp),e.registerSeriesModel(Of),e.registerVisual((function(e){const t={};e.eachSeriesByType("graphGL",(function(e){var r=e.getCategoriesData(),i=e.getData(),n={};r.each((function(i){var a=r.getName(i);n["ec-"+a]=i;var o=r.getItemModel(i),s=o.getModel("itemStyle").getItemStyle();s.fill||(s.fill=e.getColorFromPalette(a,t)),r.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let e=0;e<l.length;e++){var u=o.getShallow(l[e],!0);null!=u&&r.setItemVisual(i,l[e],u)}})),r.count()&&i.each((function(e){var t=i.getItemModel(e);let a=t.getShallow("category");if(null!=a){"string"===typeof a&&(a=n["ec-"+a]);var o=r.getItemVisual(a,"style"),s=i.ensureUniqueItemVisual(e,"style");L["w"].extend(s,o);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t<l.length;t++)i.setItemVisual(e,l[t],r.getItemVisual(a,l[t]))}}))}))})),e.registerVisual((function(e){e.eachSeriesByType("graphGL",(function(e){var t=e.getGraph(),r=e.getEdgeData(),i=rp(e.get("edgeSymbol")),n=rp(e.get("edgeSymbolSize"));r.setVisual("drawType","stroke"),r.setVisual("fromSymbol",i&&i[0]),r.setVisual("toSymbol",i&&i[1]),r.setVisual("fromSymbolSize",n&&n[0]),r.setVisual("toSymbolSize",n&&n[1]),r.setVisual("style",e.getModel("lineStyle").getLineStyle()),r.each((function(e){var i=r.getItemModel(e),n=t.getEdgeByIndex(e),a=rp(i.getShallow("symbol",!0)),o=rp(i.getShallow("symbolSize",!0)),s=i.getModel("lineStyle").getLineStyle(),l=r.ensureUniqueItemVisual(e,"style");switch(L["w"].extend(l,s),l.stroke){case"source":var u=n.node1.getVisual("style");l.stroke=u&&u.fill;break;case"target":u=n.node2.getVisual("style");l.stroke=u&&u.fill;break}a[0]&&n.setVisual("fromSymbol",a[0]),a[1]&&n.setVisual("toSymbol",a[1]),o[0]&&n.setVisual("fromSymbolSize",o[0]),o[1]&&n.setVisual("toSymbolSize",o[1])}))}))})),e.registerAction({type:"graphGLRoam",event:"graphglroam",update:"series.graphGL:roam"},(function(e,t){t.eachComponent({mainType:"series",query:e},(function(t){t.setView(e)}))})),e.registerAction({type:"graphGLStartLayout",event:"graphgllayoutstarted",update:"series.graphGL:startLayout"},t),e.registerAction({type:"graphGLStopLayout",event:"graphgllayoutstopped",update:"series.graphGL:stopLayout"},t),e.registerAction({type:"graphGLFocusNodeAdjacency",event:"graphGLFocusNodeAdjacency",update:"series.graphGL:focusNodeAdjacency"},t),e.registerAction({type:"graphGLUnfocusNodeAdjacency",event:"graphGLUnfocusNodeAdjacency",update:"series.graphGL:unfocusNodeAdjacency"},t)}Object(L["v"])(ip);var np=L["g"].extend({type:"series.flowGL",dependencies:["geo","grid","bmap"],visualStyleAccessPath:"itemStyle",getInitialData:function(e,t){var r=this.get("coordinateSystem"),i="geo"===r?["lng","lat"]:L["j"](r)||["x","y"];i.push("vx","vy");var n=L["m"].createDimensions(this.getSource(),{coordDimensions:i,encodeDefine:this.get("encode"),dimensionsDefine:this.get("dimensions")}),a=new L["e"](n,this);return a.initData(this.getSource()),a},defaultOption:{coordinateSystem:"cartesian2d",zlevel:10,supersampling:1,particleType:"point",particleDensity:128,particleSize:1,particleSpeed:1,particleTrail:2,colorTexture:null,gridWidth:"auto",gridHeight:"auto",itemStyle:{color:"#fff",opacity:.8}}}),ap=Vr.extend((function(){return{dynamic:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setLineCount:function(e){var t=this.attributes,r=4*e,i=2*e;this.vertexCount!==r&&t.position.init(r),this.triangleCount!==i&&(this.indices=0===i?null:this.vertexCount>65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(e){var t=this._vertexOffset;this.attributes.position.set(t,[e[0],e[1],1]),this.attributes.position.set(t+1,[e[0],e[1],-1]),this.attributes.position.set(t+2,[e[0],e[1],2]),this.attributes.position.set(t+3,[e[0],e[1],-2]),this.setTriangleIndices(this._faceOffset++,[t,t+1,t+2]),this.setTriangleIndices(this._faceOffset++,[t+1,t+2,t+3]),this._vertexOffset+=4}}),op=ap,sp="@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n";function lp(e){var t=document.createElement("canvas");t.width=t.height=e;var r=t.getContext("2d");return r.fillStyle="#fff",r.arc(e/2,e/2,e/2,0,2*Math.PI),r.fill(),t}gt["import"](sp);var up=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new Dr({type:Tr.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};up.prototype={constructor:up,init:function(){var e={type:Tr.FLOAT,minFilter:Tr.NEAREST,magFilter:Tr.NEAREST,useMipmap:!1};this._spawnTexture=new Dr(e),this._particleTexture0=new Dr(e),this._particleTexture1=new Dr(e),this._frameBuffer=new Fi({depthBuffer:!1}),this._particlePass=new Hn({fragment:gt.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new Hn({fragment:gt.source("clay.compositor.downsample")});var t=new wr({renderOrder:10,material:new Ce({shader:new gt(gt.source("ecgl.vfParticle.renderPoints.vertex"),gt.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:wr.POINTS,geometry:new Vr({dynamic:!0,mainAttribute:"texcoord0"})}),r=new wr({renderOrder:10,material:new Ce({shader:new gt(gt.source("ecgl.vfParticle.renderLines.vertex"),gt.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new op,culling:!1}),i=new wr({material:new Ce({shader:new gt(gt.source("ecgl.color.vertex"),gt.source("ecgl.color.fragment"))}),geometry:new ki});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=t,this._particleLinesMesh=r,this._lastFrameFullQuadMesh=i,this._camera=new On,this._thisFrameTexture=new Dr,this._lastFrameTexture=new Dr},setParticleDensity:function(e,t){for(var r=e*t,i=new Float32Array(4*r),n=0,a=this.particleLife,o=0;o<e;o++)for(var s=0;s<t;s++,n++){i[4*n]=Math.random(),i[4*n+1]=Math.random(),i[4*n+2]=Math.random();var l=(a[1]-a[0])*Math.random()+a[0];i[4*n+3]=l}"line"===this._particleType?this._setLineGeometry(e,t):this._setPointsGeometry(e,t),this._spawnTexture.width=e,this._spawnTexture.height=t,this._spawnTexture.pixels=i,this._particleTexture0.width=this._particleTexture1.width=e,this._particleTexture0.height=this._particleTexture1.height=t,this._particlePass.setUniform("textureSize",[e,t])},_setPointsGeometry:function(e,t){var r=e*t,i=this._particlePointsMesh.geometry,n=i.attributes;n.texcoord0.init(r);for(var a=0,o=0;o<e;o++)for(var s=0;s<t;s++,a++)n.texcoord0.value[2*a]=o/e,n.texcoord0.value[2*a+1]=s/t;i.dirty()},_setLineGeometry:function(e,t){var r=e*t,i=this._getParticleMesh().geometry;i.setLineCount(r),i.resetOffset();for(var n=0;n<e;n++)for(var a=0;a<t;a++)i.addLine([n/e,a/t]);i.dirty()},_getParticleMesh:function(){return"line"===this._particleType?this._particleLinesMesh:this._particlePointsMesh},update:function(e,t,r,i){var n=this._getParticleMesh(),a=this._frameBuffer,o=this._particlePass;i&&this._updateDownsampleTextures(e,t),n.material.set("size",this._particleSize*this._supersampling),n.material.set("color",this.particleColor),o.setUniform("speedScaling",this.particleSpeedScaling),a.attach(this._particleTexture1),o.setUniform("firstFrameTime",i?(this.particleLife[1]+this.particleLife[0])/2:0),o.setUniform("particleTexture",this._particleTexture0),o.setUniform("deltaTime",r),o.setUniform("elapsedTime",this._elapsedTime),o.render(e,a),n.material.set("particleTexture",this._particleTexture1),n.material.set("prevParticleTexture",this._particleTexture0),a.attach(this._thisFrameTexture),a.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT);var s=this._lastFrameFullQuadMesh;s.material.set("diffuseMap",this._lastFrameTexture),s.material.set("color",[1,1,1,this.motionBlurFactor]),this._camera.update(!0),e.renderPass([s,n],this._camera),a.unbind(e),this._downsample(e),this._swapTexture(),this._elapsedTime+=r},_downsample:function(e){var t=this._downsampleTextures;if(0!==t.length){var r=0,i=this._thisFrameTexture,n=t[r];while(n)this._frameBuffer.attach(n),this._downsamplePass.setUniform("texture",i),this._downsamplePass.setUniform("textureSize",[i.width,i.height]),this._downsamplePass.render(e,this._frameBuffer),i=n,n=t[++r]}},getSurfaceTexture:function(){var e=this._downsampleTextures;return e.length>0?e[e.length-1]:this._lastFrameTexture},setRegion:function(e){this._particlePass.setUniform("region",e)},resize:function(e,t){this._lastFrameTexture.width=e*this._supersampling,this._lastFrameTexture.height=t*this._supersampling,this._thisFrameTexture.width=e*this._supersampling,this._thisFrameTexture.height=t*this._supersampling,this._width=e,this._height=t},setParticleSize:function(e){var t=this._getParticleMesh();if(e<=2)return t.material.disableTexture("spriteTexture"),void(t.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new Dr),this._spriteTexture.image&&this._spriteTexture.image.width===e||(this._spriteTexture.image=lp(e),this._spriteTexture.dirty()),t.material.transparent=!0,t.material.enableTexture("spriteTexture"),t.material.set("spriteTexture",this._spriteTexture),this._particleSize=e},setGradientTexture:function(e){var t=this._getParticleMesh().material;t[e?"enableTexture":"disableTexture"]("gradientTexture"),t.setUniform("gradientTexture",e)},setColorTextureImage:function(e,t){var r=this._getParticleMesh().material;r.setTextureImage("colorTexture",e,t,{flipY:!0})},setParticleType:function(e){this._particleType=e},clearFrame:function(e){var t=this._frameBuffer;t.attach(this._lastFrameTexture),t.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),t.unbind(e)},setSupersampling:function(e){this._supersampling=e,this.resize(this._width,this._height)},_updateDownsampleTextures:function(e,t){for(var r=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/t.getDevicePixelRatio())/Math.log(2)),0),n=2,a=this._width*this._supersampling,o=this._height*this._supersampling,s=0;s<i;s++)r[s]=r[s]||new Dr,r[s].width=a/n,r[s].height=o/n,n*=2;for(;s<r.length;s++)r[s].dispose(e);r.length=i},_swapTexture:function(){var e=this._particleTexture0;this._particleTexture0=this._particleTexture1,this._particleTexture1=e;e=this._thisFrameTexture;this._thisFrameTexture=this._lastFrameTexture,this._lastFrameTexture=e},dispose:function(e){e.disposeFrameBuffer(this._frameBuffer),e.disposeTexture(this.vectorFieldTexture),e.disposeTexture(this._spawnTexture),e.disposeTexture(this._particleTexture0),e.disposeTexture(this._particleTexture1),e.disposeTexture(this._thisFrameTexture),e.disposeTexture(this._lastFrameTexture),e.disposeGeometry(this._particleLinesMesh.geometry),e.disposeGeometry(this._particlePointsMesh.geometry),e.disposeGeometry(this._lastFrameFullQuadMesh.geometry),this._spriteTexture&&e.disposeTexture(this._spriteTexture),this._particlePass.dispose(e),this._downsamplePass.dispose(e),this._downsampleTextures.forEach((function(t){t.dispose(e)}))}};var cp=up,hp=L["b"].extend({type:"flowGL",__ecgl__:!0,init:function(e,t){this.viewGL=new Bl("orthographic"),this.groupGL=new Ya.Node,this.viewGL.add(this.groupGL),this._particleSurface=new cp;var r=new Ya.Mesh({geometry:new Ya.PlaneGeometry,material:new Ya.Material({shader:new Ya.Shader({vertex:Ya.Shader.source("ecgl.color.vertex"),fragment:Ya.Shader.source("ecgl.color.fragment")}),transparent:!0})});r.material.enableTexture("diffuseMap"),this.groupGL.add(r),this._planeMesh=r},render:function(e,t,r){var i=this._particleSurface;i.setParticleType(e.get("particleType")),i.setSupersampling(e.get("supersampling")),this._updateData(e,r),this._updateCamera(r.getWidth(),r.getHeight(),r.getDevicePixelRatio());var n=na.firstNotNull(e.get("particleDensity"),128);i.setParticleDensity(n,n);var a=this._planeMesh,o=+new Date,s=this,l=!0;a.__percent=0,a.stopAnimation(),a.animate("",{loop:!0}).when(1e5,{__percent:1}).during((function(){var e=+new Date,t=Math.min(e-o,20);o+=t,s._renderer&&(i.update(s._renderer,r,t/1e3,l),a.material.set("diffuseMap",i.getSurfaceTexture())),l=!1})).start();var u=e.getModel("itemStyle"),c=Ya.parseColor(u.get("color"));c[3]*=na.firstNotNull(u.get("opacity"),1),a.material.set("color",c),i.setColorTextureImage(e.get("colorTexture"),r),i.setParticleSize(e.get("particleSize")),i.particleSpeedScaling=e.get("particleSpeed"),i.motionBlurFactor=1-Math.pow(.1,e.get("particleTrail"))},updateTransform:function(e,t,r){this._updateData(e,r)},afterRender:function(e,t,r,i){var n=i.renderer;this._renderer=n},_updateData:function(e,t){var r=e.coordinateSystem,i=r.dimensions.map((function(t){return e.coordDimToDataDim(t)[0]})),n=e.getData(),a=n.getDataExtent(i[0]),o=n.getDataExtent(i[1]),s=e.get("gridWidth"),l=e.get("gridHeight");if(null==s||"auto"===s){var u=(a[1]-a[0])/(o[1]-o[0]);s=Math.round(Math.sqrt(u*n.count()))}null!=l&&"auto"!==l||(l=Math.ceil(n.count()/s));var c=this._particleSurface.vectorFieldTexture,h=c.pixels;if(h&&h.length===l*s*4)for(var d=0;d<h.length;d++)h[d]=0;else h=c.pixels=new Float32Array(s*l*4);var f=0,p=1/0,m=new Float32Array(2*n.count()),g=0,v=[[1/0,1/0],[-1/0,-1/0]];n.each([i[0],i[1],"vx","vy"],(function(e,t,i,n){var a=r.dataToPoint([e,t]);m[g++]=a[0],m[g++]=a[1],v[0][0]=Math.min(a[0],v[0][0]),v[0][1]=Math.min(a[1],v[0][1]),v[1][0]=Math.max(a[0],v[1][0]),v[1][1]=Math.max(a[1],v[1][1]);var o=Math.sqrt(i*i+n*n);f=Math.max(f,o),p=Math.min(p,o)})),n.each(["vx","vy"],(function(e,t,r){var i=Math.round((m[2*r]-v[0][0])/(v[1][0]-v[0][0])*(s-1)),n=l-1-Math.round((m[2*r+1]-v[0][1])/(v[1][1]-v[0][1])*(l-1)),a=4*(n*s+i);h[a]=e/f*.5+.5,h[a+1]=t/f*.5+.5,h[a+3]=1})),c.width=s,c.height=l,"bmap"===e.get("coordinateSystem")&&this._fillEmptyPixels(c),c.dirty(),this._updatePlanePosition(v[0],v[1],e,t),this._updateGradientTexture(n.getVisual("visualMeta"),[p,f])},_fillEmptyPixels:function(e){var t=e.pixels,r=e.width,i=e.height;function n(e,n,a){e=Math.max(Math.min(e,r-1),0),n=Math.max(Math.min(n,i-1),0);var o=4*(n*(r-1)+e);return 0!==t[o+3]&&(a[0]=t[o],a[1]=t[o+1],!0)}function a(e,t,r){r[0]=e[0]+t[0],r[1]=e[1]+t[1]}for(var o=[],s=[],l=[],u=[],c=[],h=0,d=0;d<i;d++)for(var f=0;f<r;f++){var p=4*(d*(r-1)+f);0===t[p+3]&&(h=o[0]=o[1]=0,n(f-1,d,s)&&(h++,a(s,o,o)),n(f+1,d,l)&&(h++,a(l,o,o)),n(f,d-1,u)&&(h++,a(u,o,o)),n(f,d+1,c)&&(h++,a(c,o,o)),o[0]/=h,o[1]/=h,t[p]=o[0],t[p+1]=o[1]),t[p+3]=1}},_updateGradientTexture:function(e,t){if(e&&e.length){this._gradientTexture=this._gradientTexture||new Ya.Texture2D({image:document.createElement("canvas")});var r=this._gradientTexture,i=r.image;i.width=200,i.height=1;var n=i.getContext("2d"),a=n.createLinearGradient(0,.5,i.width,.5);e[0].stops.forEach((function(e){var r;t[1]===t[0]?r=0:(r=e.value/t[1],r=Math.min(Math.max(r,0),1)),a.addColorStop(r,e.color)})),n.fillStyle=a,n.fillRect(0,0,i.width,i.height),r.dirty(),this._particleSurface.setGradientTexture(this._gradientTexture)}else this._particleSurface.setGradientTexture(null)},_updatePlanePosition:function(e,t,r,i){var n=this._limitInViewportAndFullFill(e,t,r,i);e=n.leftTop,t=n.rightBottom,this._particleSurface.setRegion(n.region),this._planeMesh.position.set((e[0]+t[0])/2,i.getHeight()-(e[1]+t[1])/2,0);var a=t[0]-e[0],o=t[1]-e[1];this._planeMesh.scale.set(a/2,o/2,1),this._particleSurface.resize(Math.max(Math.min(a,2048),1),Math.max(Math.min(o,2048),1)),this._renderer&&this._particleSurface.clearFrame(this._renderer)},_limitInViewportAndFullFill:function(e,t,r,i){var n=[Math.max(e[0],0),Math.max(e[1],0)],a=[Math.min(t[0],i.getWidth()),Math.min(t[1],i.getHeight())];if("bmap"===r.get("coordinateSystem")){var o=r.getData().getDataExtent(r.coordDimToDataDim("lng")[0]),s=Math.floor(o[1]-o[0])>=359;s&&(n[0]>0&&(n[0]=0),a[0]<i.getWidth()&&(a[0]=i.getWidth()))}var l=t[0]-e[0],u=t[1]-e[1],c=a[0]-n[0],h=a[1]-n[1],d=[(n[0]-e[0])/l,1-h/u-(n[1]-e[1])/u,c/l,h/u];return{leftTop:n,rightBottom:a,region:d}},_updateCamera:function(e,t,r){this.viewGL.setViewport(0,0,e,t,r);var i=this.viewGL.camera;i.left=i.bottom=0,i.top=t,i.right=e,i.near=0,i.far=100,i.position.z=10},remove:function(){this._planeMesh.stopAnimation(),this.groupGL.removeAll()},dispose:function(){this._renderer&&this._particleSurface.dispose(this._renderer),this.groupGL.removeAll()}});function dp(e){e.registerChartView(hp),e.registerSeriesModel(np)}Object(L["v"])(dp);var fp=r("6d8b"),pp=L["g"].extend({type:"series.linesGL",dependencies:["grid","geo"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",streamEnabled:!0,init:function(e){var t=this._processFlatCoordsArray(e.data);this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset,t.flatCoords&&(e.data=new Float32Array(t.count)),pp.superApply(this,"init",arguments)},mergeOption:function(e){var t=this._processFlatCoordsArray(e.data);this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset,t.flatCoords&&(e.data=new Float32Array(t.count)),pp.superApply(this,"mergeOption",arguments)},appendData:function(e){var t=this._processFlatCoordsArray(e.data);t.flatCoords&&(this._flatCoords?(this._flatCoords=Object(fp["e"])(this._flatCoords,t.flatCoords),this._flatCoordsOffset=Object(fp["e"])(this._flatCoordsOffset,t.flatCoordsOffset)):(this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset),e.data=new Float32Array(t.count)),this.getRawData().appendData(e.data)},_getCoordsFromItemModel:function(e){var t=this.getData().getItemModel(e),r=t.option instanceof Array?t.option:t.getShallow("coords");return r},getLineCoordsCount:function(e){return this._flatCoordsOffset?this._flatCoordsOffset[2*e+1]:this._getCoordsFromItemModel(e).length},getLineCoords:function(e,t){if(this._flatCoordsOffset){for(var r=this._flatCoordsOffset[2*e],i=this._flatCoordsOffset[2*e+1],n=0;n<i;n++)t[n]=t[n]||[],t[n][0]=this._flatCoords[r+2*n],t[n][1]=this._flatCoords[r+2*n+1];return i}var a=this._getCoordsFromItemModel(e);for(n=0;n<a.length;n++)t[n]=t[n]||[],t[n][0]=a[n][0],t[n][1]=a[n][1];return a.length},_processFlatCoordsArray:function(e){var t=0;if(this._flatCoords&&(t=this._flatCoords.length),"number"===typeof e[0]){for(var r=e.length,i=new Uint32Array(r),n=new Float64Array(r),a=0,o=0,s=0,l=0;l<r;){s++;var u=e[l++];i[o++]=a+t,i[o++]=u;for(var c=0;c<u;c++){var h=e[l++],d=e[l++];n[a++]=h,n[a++]=d}}return{flatCoordsOffset:new Uint32Array(i.buffer,0,o),flatCoords:n,count:s}}return{flatCoordsOffset:null,flatCoords:null,count:e.length}},getInitialData:function(e,t){var r=new L["e"](["value"],this);return r.hasItemOption=!1,r.initData(e.data,[],(function(e,t,i,n){if(e instanceof Array)return NaN;r.hasItemOption=!0;var a=e.value;return null!=a?a instanceof Array?a[n]:a:void 0})),r},defaultOption:{coordinateSystem:"geo",zlevel:10,progressive:1e4,progressiveThreshold:5e4,blendMode:"source-over",lineStyle:{opacity:.8},postEffect:{enable:!1,colorCorrection:{exposure:0,brightness:0,contrast:1,saturation:1,enable:!0}}}}),mp=pp,gp=L["b"].extend({type:"linesGL",__ecgl__:!0,init:function(e,t){this.groupGL=new Ya.Node,this.viewGL=new Bl("orthographic"),this.viewGL.add(this.groupGL),this._glViewHelper=new Af(this.viewGL),this._nativeLinesShader=Ya.createShader("ecgl.lines3D"),this._meshLinesShader=Ya.createShader("ecgl.meshLines3D"),this._linesMeshes=[],this._currentStep=0},render:function(e,t,r){this.groupGL.removeAll(),this._glViewHelper.reset(e,r);var i=this._linesMeshes[0];i||(i=this._linesMeshes[0]=this._createLinesMesh(e)),this._linesMeshes.length=1,this.groupGL.add(i),this._updateLinesMesh(e,i,0,e.getData().count()),this.viewGL.setPostEffect(e.getModel("postEffect"),r)},incrementalPrepareRender:function(e,t,r){this.groupGL.removeAll(),this._glViewHelper.reset(e,r),this._currentStep=0,this.viewGL.setPostEffect(e.getModel("postEffect"),r)},incrementalRender:function(e,t,r,i){var n=this._linesMeshes[this._currentStep];n||(n=this._createLinesMesh(t),this._linesMeshes[this._currentStep]=n),this._updateLinesMesh(t,n,e.start,e.end),this.groupGL.add(n),i.getZr().refresh(),this._currentStep++},updateTransform:function(e,t,r){e.coordinateSystem.getRoamTransform&&this._glViewHelper.updateTransform(e,r)},_createLinesMesh:function(e){var t=new Ya.Mesh({$ignorePicking:!0,material:new Ya.Material({shader:Ya.createShader("ecgl.lines3D"),transparent:!0,depthMask:!1,depthTest:!1}),geometry:new zf({segmentScale:10,useNativeLine:!0,dynamic:!1}),mode:Ya.Mesh.LINES,culling:!1});return t},_updateLinesMesh:function(e,t,r,i){var n=e.getData();t.material.blend="lighter"===e.get("blendMode")?Ya.additiveBlend:null;var a=e.get("lineStyle.curveness")||0,o=e.get("polyline"),s=t.geometry,l=e.coordinateSystem,u=na.firstNotNull(e.get("lineStyle.width"),1);u>1?(t.material.shader!==this._meshLinesShader&&t.material.attachShader(this._meshLinesShader),t.mode=Ya.Mesh.TRIANGLES):(t.material.shader!==this._nativeLinesShader&&t.material.attachShader(this._nativeLinesShader),t.mode=Ya.Mesh.LINES),r=r||0,i=i||n.count(),s.resetOffset();var c=0,h=0,d=[],f=[],p=[],m=[],g=[],v=.3,_=.7;function y(){f[0]=d[0]*_+m[0]*v-(d[1]-m[1])*a,f[1]=d[1]*_+m[1]*v-(m[0]-d[0])*a,p[0]=d[0]*v+m[0]*_-(d[1]-m[1])*a,p[1]=d[1]*v+m[1]*_-(m[0]-d[0])*a}if(o||0!==a)for(var x=r;x<i;x++)if(o){var T=e.getLineCoordsCount(x);c+=s.getPolylineVertexCount(T),h+=s.getPolylineTriangleCount(T)}else e.getLineCoords(x,g),this._glViewHelper.dataToPoint(l,g[0],d),this._glViewHelper.dataToPoint(l,g[1],m),y(),c+=s.getCubicCurveVertexCount(d,f,p,m),h+=s.getCubicCurveTriangleCount(d,f,p,m);else{var b=i-r;c+=b*s.getLineVertexCount(),h+=b*s.getLineVertexCount()}s.setVertexCount(c),s.setTriangleCount(h);var w=r,E=[];for(x=r;x<i;x++){Ya.parseColor(Xu(n,w),E);var S=na.firstNotNull(qu(n,w),1);E[3]*=S;T=e.getLineCoords(x,g);for(var C=0;C<T;C++)this._glViewHelper.dataToPoint(l,g[C],g[C]);o?s.addPolyline(g,E,u,0,T):0!==a?(d=g[0],m=g[1],y(),s.addCubicCurve(d,f,p,m,E,u)):s.addPolyline(g,E,u,0,2),w++}},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function vp(e){e.registerChartView(gp),e.registerSeriesModel(mp)}Object(L["v"])(vp);var _p=r("9e04"),yp={name:"Screen",components:{Circles:A},data:function(){return{searchItem:"",mapList:[],seletedItem:{},map:null,num:0,upDatetimer:null,timer:null,transition:null,echartTimer:null,batteryshow:!0,batteryNum:0,batteryTransition:null,sensorshow:!0,sensorNum:0,sensorTransition:null,rectifyshow:!0,rectifyNum:0,rectifyTransition:null,powershow:!0,powerNum:0,powerTransition:null,rectifyNums:0,powerNums:0,sensorNums:0,batteryNums:0,cabinetCount:{multipleCount:0,singleCount:0,multiple:0,single:0,total:0,totalList:[0,0,0,0,1]},list:[],deviceType:{},configTable:{header:[this.$t("device.deviceName"),this.$t("alarm.alarmInfo"),this.$t("alarm.uploadTime"),this.$t("alarm.status")],data:[],rowNum:6,headerBGC:"rgba(43, 244, 201, 0.15)",evenRowBGC:"rgba(43, 244, 201, 0.1)",oddRowBGC:"rgba(43, 244, 201, 0.05)",waitTime:4e3,align:["left","left","left","center"],columnWidth:[60]},cabinetInfo:[{label:this.$t("cabinet.info.longitude"),value:"longitude",width:"37px",unit:"°E"},{label:this.$t("cabinet.info.latitude"),value:"latitude",width:"74px",unit:"°N"},{label:this.$t("cabinet.info.siteName"),value:"siteName",width:"82px",unit:""},{label:this.$t("cabinet.info.siteCode"),value:"siteCode",width:"80px",unit:""},{label:this.$t("cabinet.info.address"),value:"address",width:"60px",unit:""},{label:this.$t("cabinet.info.director"),value:"director",width:"20px",unit:""}],siteInfo:{},batteryCurve:{},batteryInfo:[],sensorCurve:{},sensorInfo:[],rectifyCurve:{},rectifyInfo:[],powerCurve:{},powerInfo:[]}},computed:{logoForm:{get:function(){return this.$store.state.user.logoForm}}},activated:function(){this.getCabinetList(),h({deviceCode:"saf"})},mounted:function(){var e=this;console.log(this.logoForm,"this.");var t=document.getElementById("app");t.classList.add("largeScreen"),this.getList(),this.upDatetimer=setTimeout((function(){e.updateData()}),5e3)},destroyed:function(){var e=document.getElementById("app");e.classList.remove("largeScreen"),clearInterval(this.timer),clearInterval(this.echartTimer),this.upDatetimer&&clearTimeout(this.upDatetimer),this.upDatetimer=null},methods:{getList:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.getCabinetCountInfo(),e.getDeviceStatusInfo(),e.getAlarmList(),u().then((function(t){e.list=t.data.length&&t.data.map((function(t){return t.icon=e.getIcon(t.typeCode),t.deviceCount=t.deviceCount||0,t})),e.timer=setInterval((function(){e.num+=1,e.num>=e.list.length/2+(Math.ceil(e.list.length/2)-5)&&setTimeout((function(){e.transition="inherit",e.num=0,setTimeout((function(){e.transition="0.3s"}),300)}),1e3)}),2e3)})),t.next=6,Object(x["l"])().then((function(t){console.log(t);var r=[];e.mapList=t.data.list.map((function(e){var t=r.filter((function(t){return t===e.siteCode}));return r.push(e.siteCode),e.numIndex=t.length,e})),e.seletedItem=e.mapList[0]||{},e.initMap().then((function(){console.log("加载成功...",Microsoft),e.loadingMap()}))}));case 6:return Object(y["a"])({deviceId:e.seletedItem.deviceId}).then((function(t){e.siteInfo=t.data.site||{}})),h({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.batteryCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.batteryCurve,"batteryEchart"),console.log(e.batteryCurve)})),t.next=10,d({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),console.log(t.value,r[t.value],t.mean),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 10:return v({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.sensorCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.sensorCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.sensorCurve,"sensorEchart")})),t.next=13,_({deviceCode:e.seletedItem.deviceCode}).then((function(t){var r=[];for(var i in t.data)r=[].concat(Object(a["a"])(r),Object(a["a"])(t.data[i]));e.sensorInfo=r.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 13:return m({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.rectifyCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.rectifyCurve,"rectifyEchart")})),t.next=16,g({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 16:return f({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.powerCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.powerCurve,"powerEchart")})),t.next=19,p({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 19:e.$nextTick((function(){console.log("------------2-----------"),e.echartTimer&&clearInterval(e.echartTimer),e.rectifyNums=e.$refs.rectifybox.clientHeight/18,e.powerNums=e.$refs.powerbox.clientHeight/18,e.sensorNums=e.$refs.sensorbox.clientHeight/18,e.batteryNums=e.$refs.batterybox.clientHeight/18,e.echartTimer=setInterval((function(){console.log("------------3-----------"),e.rectifyNums>12?(e.rectifyshow=!0,e.rectifyNum+=1,e.rectifyNum==e.rectifyNums&&setTimeout((function(){e.rectifyTransition="inherit",e.rectifyNum=0,setTimeout((function(){e.rectifyTransition="0.3s"}),300)}),1e3)):e.rectifyshow=!1,e.powerNums>12?(e.powershow=!0,e.powerNum+=1,e.powerNum==e.powerNums&&setTimeout((function(){e.powerTransition="inherit",e.powerNum=0,setTimeout((function(){e.powerTransition="0.3s"}),300)}),1e3)):e.powershow=!1,e.sensorNums>12?(e.sensorshow=!0,e.sensorNum+=1,e.sensorNum==e.sensorNums&&setTimeout((function(){e.sensorTransition="inherit",e.sensorNum=0,setTimeout((function(){e.sensorTransition="0.3s"}),300)}),1e3)):e.sensorshow=!1,e.batteryNums>12?(e.batteryshow=!0,e.batteryNum+=1,e.batteryNum==e.batteryNums&&setTimeout((function(){e.batteryTransition="inherit",e.batteryNum=0,setTimeout((function(){e.batteryTransition="0.3s"}),300)}),1e3)):e.batteryshow=!1}),2e3)}));case 20:case"end":return t.stop()}}),t)})))()},updateData:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.getCabinetCountInfo(),e.getDeviceCountInfo(),e.getDeviceStatusInfo(),e.getAlarmList(),t.next=6,Object(x["l"])().then((function(t){var r=[];e.mapList=t.data.list.map((function(e){var t=r.filter((function(t){return t===e.siteCode}));return r.push(e.siteCode),e.numIndex=t.length,e}))}));case 6:return Object(y["a"])({deviceId:e.seletedItem.deviceId}).then((function(t){e.siteInfo=t.data.site||{}})),h({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.batteryCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.batteryCurve,"batteryEchart"),console.log(e.batteryCurve)})),t.next=10,d({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 10:return v({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.sensorCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.sensorCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.sensorCurve,"sensorEchart")})),t.next=13,_({deviceCode:e.seletedItem.deviceCode}).then((function(t){var r=[];for(var i in t.data)r=[].concat(Object(a["a"])(r),Object(a["a"])(t.data[i]));e.sensorInfo=r.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 13:return m({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.rectifyCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.rectifyCurve,"rectifyEchart")})),t.next=16,g({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 16:return f({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.powerCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.powerCurve,"powerEchart")})),t.next=19,p({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 19:e.upDatetimer=setTimeout((function(){e.upDatetimer&&e.updateData()}),6e3);case 20:case"end":return t.stop()}}),t)})))()},changeCabinet:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return Object(y["a"])({deviceId:e.seletedItem.deviceId}).then((function(t){e.siteInfo=t.data.site||{}})),h({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.batteryCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.batteryCurve,"batteryEchart"),console.log(e.batteryCurve)})),t.next=4,d({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.batteryInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 4:return v({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.sensorCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.sensorCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.sensorCurve,"sensorEchart")})),t.next=7,_({deviceCode:e.seletedItem.deviceCode}).then((function(t){var r=[];for(var i in t.data)r=[].concat(Object(a["a"])(r),Object(a["a"])(t.data[i]));e.sensorInfo=r.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 7:return m({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.rectifyCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.rectifyCurve,"rectifyEchart")})),t.next=10,g({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.rectifyInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 10:return f({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerCurve=[];var r=function(r){var i=t.data[r].map((function(t){return[e.switchTimeFormat(t.time),t.value]})),n=i.map((function(e){return e[0]}));i=i.filter((function(e,t){return n.indexOf(e[0])==t})),e.powerCurve.push({date:t.data[r].map((function(t){return e.switchTimeFormat(t.time)})),name:t.data[r][0].field,data:i})};for(var i in t.data)r(i);e.getBarChert(e.powerCurve,"powerEchart")})),t.next=13,p({deviceCode:e.seletedItem.deviceCode}).then((function(t){e.powerInfo=t.data.length&&t.data.map((function(t){if("en"==e.$i18n.locale&&(t.signName=t.enSignName),t.mean&&t.value){var r={},i=t.mean.replace(/; /g,";").replace(/:/g,":");i.split(";").forEach((function(e){e=e.split(":"),r[e[0]]=e[1]})),t.value=r[t.value]}return t.factor>1&&t.value&&(t.value=(t.value/t.factor).toFixed(t.factor>10?2:1)),t.unit&&t.value&&(t.value=t.value+" "+t.unit),t.value||(t.value=e.$t("cabinet.sensor.noData")),t}))}));case 13:e.$nextTick((function(){e.rectifyNums=e.$refs.rectifybox.clientHeight/18,e.powerNums=e.$refs.powerbox.clientHeight/18,e.sensorNums=e.$refs.sensorbox.clientHeight/18,e.batteryNums=e.$refs.batterybox.clientHeight/18}));case 14:case"end":return t.stop()}}),t)})))()},switchTimeFormat:function(e){var t=new Date(e),r=t.getFullYear(),i=t.getMonth()+1,n=t.getDate(),a=t.getHours(),o=t.getMinutes(),s=t.getSeconds();return r+"-"+this.addZero(i)+"-"+this.addZero(n)+" "+this.addZero(a)+":"+this.addZero(o)+":"+this.addZero(s)},addZero:function(e){return e<10?"0"+e:e},getIcon:function(e){switch(e){case"TEMP":return"wenshidu";case"SOURCE":return"dianyuan";case"CABINET":return"danguiti";case"GF":return"guangfu";case"AIR":return"kongtiao";case"WATER":return"shuijin";case"BATTERY":return"dianchi";case"UPS":return"UPS";case"PD":return"peidian";case"FAN":return"fengjifengshan";case"SMOKE":return"yangan";case"DOOR":return"menjin";case"video":return"shipin";case"fire":return"xiaofang";case"fanglei":return"fanglei";default:return"wenshidu"}},getDeviceCountInfo:function(){var e=this;u().then((function(t){e.list=t.data.length&&t.data.map((function(t){return t.icon=e.getIcon(t.typeCode),t.deviceCount=t.deviceCount||0,t}))}))},getCabinetCountInfo:function(){var e=this;l().then((function(t){e.cabinetCount=t.data,e.cabinetCount.total=t.data.multipleCount+t.data.singleCount,e.cabinetCount.totalList=("000000"+e.cabinetCount.total).slice(-5).split(""),e.cabinetCount.multiple=parseFloat((t.data.multipleCount/e.cabinetCount.total*100).toFixed(1)),e.cabinetCount.single=parseFloat((t.data.singleCount/e.cabinetCount.total*100).toFixed(1))}))},getAlarmList:function(){var e=this;Object(_p["c"])({curPage:1,pageSize:99}).then((function(t){t.data.list.length>0?e.configTable.data=e.configTable={header:[e.$t("alarm.device"),e.$t("alarm.alarmInfo"),e.$t("alarm.uploadTime"),e.$t("alarm.status")],data:t.data.list.map((function(t){return[t.deviceName,t.alarmInfo,t.uploadTime,0==t.alarmStatus?'<span style="color:#29f0be;">'.concat(e.$t("alarm.processed"),"</span>"):'<span style="color:#E2502C;">'.concat(e.$t("alarm.unprocessed"),"</span>")]})),rowNum:6,headerBGC:"rgba(43, 244, 201, 0.15)",evenRowBGC:"rgba(43, 244, 201, 0.1)",oddRowBGC:"rgba(43, 244, 201, 0.05)",waitTime:4e3,align:["left","left","left","center"],columnWidth:[60]}:e.configTable={header:[e.$t("alarm.device"),e.$t("alarm.alarmInfo"),e.$t("alarm.uploadTime")],data:[["",e.$t("cabinet.sensor.noData"),""]],rowNum:6,headerBGC:"rgba(43, 244, 201, 0.15)",evenRowBGC:"rgba(43, 244, 201, 0.1)",oddRowBGC:"rgba(43, 244, 201, 0.05)",waitTime:4e3,align:["left","left","left","center"],columnWidth:[60]}}))},getDeviceStatusInfo:function(){var e=this,t=M["a"](this.$refs.myCharts);function r(e,t,r,i,n,a){var o=(e+t)/2,s=e*Math.PI*2,l=t*Math.PI*2,u=o*Math.PI*2;0===e&&1===t&&(r=!1),n="undefined"!==typeof n?n:1/3;var c=r?.1*Math.cos(u):0,h=r?.1*Math.sin(u):0,d=i?1.05:1;return{u:{min:-Math.PI,max:3*Math.PI,step:Math.PI/32},v:{min:0,max:2*Math.PI,step:Math.PI/20},x:function(e,t){return e<s?c+Math.cos(s)*(1+Math.cos(t)*n)*d:e>l?c+Math.cos(l)*(1+Math.cos(t)*n)*d:c+Math.cos(e)*(1+Math.cos(t)*n)*d},y:function(e,t){return e<s?h+Math.sin(s)*(1+Math.cos(t)*n)*d:e>l?h+Math.sin(l)*(1+Math.cos(t)*n)*d:h+Math.sin(e)*(1+Math.cos(t)*n)*d},z:function(e,t){return e<.5*-Math.PI||e>2.5*Math.PI?Math.sin(e):Math.sin(t)>0?a:-1}}}function i(e,t,i){var n=[],a=0,o=0,s=0,l=[],u="undefined"!==typeof t?(1-t)/(1+t):1/3,c=e.reduce((function(e,t){return e.value>t.value?e.value:t}));c=Math.pow(10,parseInt(c.value).toString().length-1);for(var h=0;h<e.length;h++){a+=e[h].value;var d={name:"undefined"===typeof e[h].name?"series".concat(h):e[h].name,type:"surface",parametric:!0,wireframe:{show:!1},pieData:e[h],pieStatus:{selected:!1,hovered:!1,k:u}};if("undefined"!=typeof e[h].itemStyle){var f={};"undefined"!=typeof e[h].itemStyle.color&&(f.color=e[h].itemStyle.color),"undefined"!=typeof e[h].itemStyle.opacity&&(f.opacity=e[h].itemStyle.opacity),d.itemStyle=f}n.push(d)}for(var p=0;p<n.length;p++)s=o+n[p].pieData.value,n[p].pieData.startRatio=o/a,n[p].pieData.endRatio=s/a,n[p].parametricEquation=r(n[p].pieData.startRatio,n[p].pieData.endRatio,!1,!1,u,n[p].pieData.value/c),o=s,l.push(n[p].name);var m={tooltip:{formatter:function(e){if("mouseoutSeries"!==e.seriesName)return"".concat(e.seriesName,'<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:').concat(e.color,';"></span>').concat(m.series[e.seriesIndex].pieData.value)}},legend:{show:!1,data:l},xAxis3D:{min:-.6,max:.6},yAxis3D:{min:-.6,max:.6},zAxis3D:{min:-1,max:1},grid3D:{show:!1,boxHeight:i>100?5:50,environment:"auto",viewControl:{distance:300,alpha:25,beta:90}},series:n};return m}c().then((function(r){var n=r.data.unOnlineCount>r.data.onlineCount?r.data.unOnlineCount:r.data.onlineCount;e.deviceType=r.data;var a=i([{name:e.$t("screen.onlineCount"),value:r.data.onlineCount-0,itemStyle:{opacity:"0.5",color:"#29F0BE"}},{name:e.$t("screen.unOnlineCount"),value:r.data.unOnlineCount-0,itemStyle:{opacity:"0.5",color:"#E2502C"}}],1.5,n);t.setOption(a)}))},getBarChert:function(e,t){var r=M["a"](document.getElementById(t)),i={grid:{left:"5%",right:"15%",top:"25%",bottom:"5%",containLabel:!0},tooltip:{trigger:"axis",axisPointer:{lineStyle:{color:"rgba(255,255,255,0.7)"}},backgroundColor:"rgba(0,0,0,0.5)",padding:[5,10],textStyle:{color:"rgb(255,255,255)"}},legend:{x:"center",y:5,icon:"stack",itemWidth:6,itemHeight:5,textStyle:{color:"#FFFFFF",lineHeight:"6"},data:e.map((function(e){return e.name}))},xAxis:{type:"time",data:e[0]&&e[0].date,boundaryGap:!0,splitLine:{show:!1},axisTick:{show:!1},axisLine:{lineStyle:{color:"rgba(255,255,255,0.5)"}},axisLabel:{margin:10,textStyle:{fontSize:14,color:"rgba(255,255,255,0.5)"},rotate:"45"}},yAxis:[{type:"value",position:"left",name:e[0]&&e[0].unit,offset:5,axisLabel:{color:"rgba(255,255,255,0.5)",textStyle:{fontSize:12}},max:function(t){return e[0]&&"℃"==e[0].unit?50:parseInt(t.max+20)},axisLine:{show:!1,lineStyle:{color:"#2B6A61"}},axisTick:{show:!1},splitLine:{lineStyle:{color:"#2B6A61",type:"dashed"}}},{type:"value",max:function(t){return console.log(e[1]&&e[1].unit,"--------2------------"),e[1]&&"%"==e[1].unit?100:parseInt(t.max+20)},name:e[1]&&e[1].unit,position:e.length>2?"left":"right",axisLabel:{color:"rgba(255,255,255,0.5)",textStyle:{fontSize:12}},axisLine:{show:!1,lineStyle:{color:"#2B6A61"}},axisTick:{show:!1},splitLine:{lineStyle:{color:"#2B6A61",type:"dashed"}}},{type:"value",max:function(e){return parseInt(e.max+20)},name:e[2]&&e[2].unit,position:"left",axisLabel:{color:"rgba(255,255,255,0.5)",textStyle:{fontSize:12}},axisLine:{show:!1,lineStyle:{color:"#2B6A61"}},axisTick:{show:!1},splitLine:{lineStyle:{color:"#2B6A61",type:"dashed"}}}],series:[{name:e[0]&&e[0].name,type:"line",smooth:!0,showSymbol:!1,data:e[0]&&e[0].data,itemStyle:{normal:{color:"#f5bc4e"}},lineStyle:{normal:{width:2}}},{name:e[1]&&e[1].name,type:"line",smooth:!0,yAxisIndex:1,showSymbol:!1,symbol:"circle",symbolSize:6,data:e[1]&&e[1].data,itemStyle:{normal:{color:"#00ffd8"}},lineStyle:{normal:{width:2}}},{name:e[2]&&e[2].name,type:"line",smooth:!0,yAxisIndex:1,showSymbol:!1,symbol:"circle",symbolSize:6,data:e[2]&&e[2].data,itemStyle:{normal:{color:"#f9632f"}},lineStyle:{normal:{width:2}}}]};r.setOption(i,!0)},getCabinetList:function(){var e=this,t=this;console.log(this.map,"this.map"),this.map||this.loadMap(),Object(x["l"])().then((function(i){var n=[];e.mapList=i.data.list.map((function(e){var t=n.filter((function(t){return t===e.siteCode}));return n.push(e.siteCode),e.numIndex=t.length,console.log(t,"1-----"),e})),e.map.entities.clear(),e.list.forEach((function(i){var n=new Microsoft.Maps.Pushpin({latitude:i.latitude||0,longitude:i.longitude||0},{icon:r("9956")("./".concat(1==i.online?"normal":"fault").concat(1==i.cabinetType?"":"s",".svg")),anchor:new Microsoft.Maps.Point(40+30*i.numIndex,40),title:i.deviceName});e.map.entities.push(n),Microsoft.Maps.Events.addHandler(n,"click",(function(){t.goLink(i),console.log(i,"Microsoft !== undefined")}))}))}))},goLink:function(e){e.deviceCode!=this.seletedItem.deviceCode&&(this.seletedItem=e,this.map.setView({zoom:15,center:new Microsoft.Maps.Location(this.seletedItem.latitude,this.seletedItem.longitude)}),this.changeCabinet())},initMap:function(){var e=this.$i18n.locale;e="zh"==e?"zh-CN":e,console.log(e,"lang");var t="As2AhniKpC-v86mSiiJVKNwebR8WcyYw9ICr4RDcnHhpCo5HwcSUPbyYjdoDn77R",r="http://www.bing.com/api/maps/mapcontrol?setLang="+e+"&key="+t;return new Promise((function(e,t){if("undefined"!==typeof Microsoft)return console.log(n,"Microsoft !== undefined"),e(),!0;var i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",r),document.body.appendChild(i);var n=0,a=setInterval((function(){console.log(n,"加载..."),n>=40&&(t(),clearInterval(a)),"undefined"!==typeof Microsoft&&(e(),clearInterval(a)),n+=1}),100)}))},loadMap:function(){var e=this,t=this;this.map=new Microsoft.Maps.Map(document.getElementById("myMap"),{zoom:10,showCopyright:!1,center:{latitude:this.seletedItem.latitude||0,longitude:this.seletedItem.longitude||0}}),this.mapList.forEach((function(i){var n=new Microsoft.Maps.Pushpin({latitude:i.latitude||0,longitude:i.longitude||0},{icon:r("9956")("./".concat(1==i.online?"normal":"fault").concat(1==i.cabinetType?"":"s",".svg")),anchor:new Microsoft.Maps.Point(40+25*i.numIndex,40),title:i.deviceName});e.map.entities.push(n),Microsoft.Maps.Events.addHandler(n,"click",(function(){t.goLink(i),console.log(i,"Microsoft !== undefined")}))}))},loadingMap:function(){var e=this;setTimeout((function(){console.log("检查是否加载成功...",e.map),e.map||e.loadingMap()}),200),this.loadMap()},querySearch:function(e,t){var r;e||(r=this.mapList.map((function(e){return{label:e.deviceCode,latitude:e.latitude,longitude:e.longitude,value:e.deviceName}})),t(r)),e=e.replace(/[-]/g,"[-]"),e=e.replace(/[(|(]/g,"[(]"),e=e.replace(/[)|)]/g,"[)]");var i=new RegExp(e);r=this.mapList.filter((function(e){return i.test(e.deviceCode)||i.test(e.deviceName)})),r=r.map((function(e){return{label:e.deviceCode,latitude:e.latitude,longitude:e.longitude,value:e.deviceName}})),t(r)},handleFilter:function(e){this.map.setView({center:new Microsoft.Maps.Location(e.latitude,e.longitude),zoom:15})}}},xp=yp,Tp=(r("c780"),Object(S["a"])(xp,i,n,!1,null,"4fa0d7d7",null));t["default"]=Tp.exports},"94d1":function(e,t,r){},9956:function(e,t,r){var i={"./alarm.svg":"df19","./alarms.svg":"6e9f","./fault.svg":"5273","./faults.svg":"4032","./normal.svg":"2379","./normals.svg":"5f3a"};function n(e){var t=a(e);return r(t)}function a(e){if(!r.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}n.keys=function(){return Object.keys(i)},n.resolve=a,e.exports=n,n.id="9956"},"9e04":function(e,t,r){"use strict";r.d(t,"g",(function(){return n})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o})),r.d(t,"i",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"h",(function(){return u})),r.d(t,"b",(function(){return c})),r.d(t,"d",(function(){return h})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return f}));var i=r("b775");function n(e){return Object(i["a"])({url:"trajectory-service/deptAlarm/getTaskByAlarmId",method:"get",params:e})}function a(e){return Object(i["a"])({url:"alarm-service/alarm/clearAlarmStatus?alarmId="+e,method:"post"})}function o(e){return Object(i["a"])({url:"alarm-service/alarm/getAlarmList",method:"get",params:e})}function s(e){return Object(i["a"])({url:"alarm-service/alarm/getTipAlarmList",method:"get",params:e})}function l(e){return Object(i["a"])({url:"alarm-service/alarm/updateAlarmReadStatus",method:"post",params:e})}function u(e){return Object(i["a"])({url:"device-service/deviceLog/getDeviceLogList",method:"get",params:e})}function c(e){return Object(i["a"])({url:"alarm-service/statistics/getAlarmLevel",method:"get",params:e})}function h(e){return Object(i["a"])({url:"alarm-service/statistics/getAlarmStatus",method:"get",params:e})}function d(e){return Object(i["a"])({url:"alarm-service/statistics/getAlarmTypeLevel",method:"get",params:e})}function f(e){return Object(i["a"])({url:"alarm-service/statistics/getAlarmTypeStatus",method:"get",params:e})}},aa98:function(e,t,r){"use strict";r.d(t,"l",(function(){return n})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o})),r.d(t,"q",(function(){return s})),r.d(t,"h",(function(){return l})),r.d(t,"i",(function(){return u})),r.d(t,"m",(function(){return c})),r.d(t,"p",(function(){return h})),r.d(t,"b",(function(){return d})),r.d(t,"o",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"s",(function(){return m})),r.d(t,"g",(function(){return g})),r.d(t,"t",(function(){return v})),r.d(t,"n",(function(){return _})),r.d(t,"e",(function(){return y})),r.d(t,"d",(function(){return x})),r.d(t,"r",(function(){return T})),r.d(t,"j",(function(){return b})),r.d(t,"k",(function(){return w}));var i=r("b775");function n(e){return Object(i["a"])({url:"device-service/cabinet/getCabinetList",method:"get",params:e})}function a(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/cabinet/addCabinet",method:"post",data:e})}function o(e){var t=new FormData;return t.append("file",e),Object(i["a"])({headers:{"Content-Type":"multipart/form-data"},url:"device-service/import/addCabinetsImport",method:"post",data:t})}function s(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/cabinet/updateCabinet",method:"put",data:e})}function l(e){var t={cabinetCode:e};return Object(i["a"])({url:"device-service/cabinet/deleteCabinet",method:"delete",params:t})}function u(e){var t={cabinetCodes:e};return Object(i["a"])({url:"device-service/cabinet/deleteCabinetList",method:"delete",params:t})}function c(e){return Object(i["a"])({url:"device-service/cabinet/getInsideDeviceByCabinetCode",method:"get",params:e})}function h(e){return Object(i["a"])({url:"device-service/cabinet/getUnCheckDeviceByDeptId",method:"get",params:e})}function d(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/cabinet/addCabinetInsideDevice",method:"post",data:e})}function f(e){return Object(i["a"])({url:"device-service/inside/getMoveDeviceList",method:"get",params:e})}function p(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/inside/addInsideMove",method:"post",data:e})}function m(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/inside/updateMoveDevice",method:"put",data:e})}function g(e){var t=new FormData;return t.append("file",e),Object(i["a"])({headers:{"Content-Type":"multipart/form-data"},url:"device-service/import/addMovesImport",method:"post",data:t})}function v(e){var t=new FormData;return t.append("file",e.file),t.append("moveCode",e.moveCode),Object(i["a"])({headers:{"Content-Type":"multipart/form-data"},url:"device-service/import/updateMoveOidImport",method:"post",data:t})}function _(e){return Object(i["a"])({url:"device-service/inside/getInsideDeviceList",method:"get",params:e})}function y(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/inside/addInsideDevice",method:"post",data:e})}function x(e){var t=new FormData;return t.append("file",e),Object(i["a"])({headers:{"Content-Type":"multipart/form-data"},url:"device-service/import/addDevicesImport",method:"post",data:t})}function T(e){return Object(i["a"])({headers:{"Content-Type":"application/json"},url:"device-service/inside/updateInsideDevice",method:"put",data:e})}function b(e){var t={deviceCode:e};return Object(i["a"])({url:"device-service/inside/deleteCabinet",method:"delete",params:t})}function w(e){var t={deviceCodes:e};return Object(i["a"])({url:"device-service/inside/deleteInsideDeviceList",method:"delete",params:t})}},abc4:function(e,t,r){},c607:function(e,t,r){var i=r("da84"),n=r("83ab"),a=r("fce3"),o=r("c6b6"),s=r("9bf2").f,l=r("69f3").get,u=RegExp.prototype,c=i.TypeError;n&&a&&s(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!l(this).dotAll;throw c("Incompatible receiver, RegExp required")}}})},c780:function(e,t,r){"use strict";r("abc4")},d958:function(e,t,r){"use strict";r("94d1")},df19:function(e,t,r){e.exports=r.p+"8c88bf8df025c391b7894b387a32167c.svg"},f3bc:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return a})),r.d(t,"f",(function(){return o})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"l",(function(){return u})),r.d(t,"e",(function(){return c})),r.d(t,"k",(function(){return h})),r.d(t,"j",(function(){return d})),r.d(t,"h",(function(){return f})),r.d(t,"i",(function(){return p})),r.d(t,"g",(function(){return m}));var i=r("b775");function n(e){return Object(i["a"])({url:"device-service/cabinetDetails/getCabinetBeanById",method:"get",params:e})}function a(e){return Object(i["a"])({url:"device-service/cabinetDetails/getCabinetTypesByCode",method:"get",params:e})}function o(e){return Object(i["a"])({url:"device-service/inside/getInsideDeviceByCode",method:"get",params:e})}function s(e){return Object(i["a"])({url:"snmp-service/param/getDeviceParamByCode",method:"get",params:e})}function l(e){return Object(i["a"])({url:"snmp-service/param/getDeviceDetailByCode",method:"get",params:e})}function u(e){return Object(i["a"])({url:"snmp-service/param/updateDeviceParamByCode",method:"get",params:e})}function c(e){return Object(i["a"])({url:"snmp-service/param/getDeviceRemoteParamByCode",method:"get",params:e})}function h(e){return Object(i["a"])({url:"snmp-service/param/sendDeviceParam",method:"post",data:e})}function d(e){return Object(i["a"])({url:"trajectory-service/trajectory/getTaskTrajectoryList",method:"get",params:e})}function f(){return Object(i["a"])({url:"camera-service/token/getShiYingToken",method:"get"})}function p(e){return Object(i["a"])({url:"camera-service/token/getShiYingVideoPath",method:"get",params:e})}function m(e){return Object(i["a"])({url:"device-service/monitor/getMonitorList",method:"get",params:e})}}}]);
|
||
//# sourceMappingURL=chunk-6197f6ea.725c4d90.js.map
|