function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _classCallCheck(e,t){if(!_instanceof(e,t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i '+i.titleText+"
"}$(".current-filters").html(t),$(".vit-content-rooms").hide(),$(".vit-content-filters").hide(),$(".vit-content-wishlist").hide(),$(".vit-content-basket").hide(),$(".vit-content-help").hide();var n=Xe(),a=!1;"Paint"!=ot&&"Cabinets"!=ot&&"Worktops"!=ot||(a=!0);for(var t="",i=0;i
Please note any non-square single tiles will be removed.")),k(t,3e3)}}function O(){for(vi.savedThumbnailDataURL=vt(400,300).toDataURL("image/jpeg",.5),"Room0"==$t.id&&(vi.uyoData=Ii.getSaveData()),makingPredecoratedRooms&&V(),yi.savedRoomsDecorateData.unshift(VUtils.clone(vi));null==U();)yi.savedRoomsDecorateData.pop();e.broadcastMessage("Saving"),k("Your room has now been saved.",1500)}function k(e,t){null!=Ai&&(clearTimeout(Ai),Ai=null),null!=e?($(".vit-message img").hide(),$(".vit-message p").html(e),$(".vit-message").show(),null!=t&&(Ai=setTimeout((function(){Ai=null,$(".vit-message").hide()}),t))):$(".vit-message").hide()}function B(e,t){if(null!=Ai&&(clearTimeout(Ai),Ai=null),null==e)return Ai=null,void $(".vit-message").hide();$(".vit-message img").show(),$(".vit-message p").html(e),$(".vit-message").show(),null!=t&&(Ai=setTimeout((function(){Ai=null,$(".vit-message").hide()}),t))}function F(e){var t=mt(e);""!=t.productDetailsLink?window.open(t.productDetailsLink):window.open("http://www.toppstiles.co.uk/product.asp?productid="+t.id360)}function G(e){return;if(makingPredecoratedRooms)return V(),void e();var t="engine/room-styles-data.txt?"+uncache;VUtils.loadTextFromURL(t,(function(t){_i=JSON.parse(t),e()}))}function V(){(_i=new Object).version=Et,_i.predecoratedRoomsDecorateData=VUtils.clone(yi.savedRoomsDecorateData),$("a.save-saved-rooms-to-disk").attr("href","data:text/plain,"+JSON.stringify(_i))}function N(e){return;Bt=e,Pi.setRoomStylesMode(e,Yt)}function z(){var e=Li.loadStorageData(Rt);null!=e&&((yi=JSON.parse(e)).version!=It?e=null:-1!=location.href.indexOf("resetvisualiser")&&(e=null,alert("Resetting visualiser data"))),null==e&&((yi=new Object).version=It,yi.savedRoomsDecorateData=new Array,U())}function U(){return Li.saveStorageData(Rt,JSON.stringify(yi))}function H(){return;var e=new Object;Dt.roomTypes=new Array;for(var t=0;t=i||_>=i||b>=i)&&(x=t),y=Math.min(Math.max(parseInt(y+x),0),255),_=Math.min(Math.max(parseInt(_+x),0),255),b=Math.min(Math.max(parseInt(b+x),0),255);for(var T=m.canvas.getContext("2d"),S=T.getImageData(0,0,m.canvas.width,m.canvas.height),w=0;w$e.width-1&&(t=$e.width-1),i<0?i=0:i>$e.height-1&&(i=$e.height-1),e.updateStringerQuadNode(ci,t,i),T()}function Me(){Vi="AdjustingAddStep"==Vi?"DraggingStepOneNodeWhileAddStep":"AdjustingStepOneNode"==Vi?"DraggingStepOneNode":"DraggingStepOneNode2",si=!1,T()}function Pe(){var e;Ue.getStairCalculator().updateStepOneRearPosition(Oi,ki),T()}function Re(){Vi="AdjustingAddStep"==Vi?"DraggingStepTwoNodeWhileAddStep":"AdjustingStepOneNode"==Vi||"AdjustingStepOneNode2"==Vi?"DraggingStepTwoNodeWhileAdjustingStepOneNode":"AdjustingStepTwoNode"==Vi?"DraggingStepTwoNode":"DraggingStepTwoNode2",si=!1,T()}function Ie(){var e;Ue.getStairCalculator().updateStepTwoPosition(Oi,ki),T()}function Ee(e){var t=Ue.getStairCalculator();const i=3*25.4,r=685.8,n=48*25.4;e>0?t.m_TreadWidthMM<=n-i+.1&&(t.m_TreadWidthMM+=i):t.m_TreadWidthMM>=761.9&&(t.m_TreadWidthMM-=i),T()}function Le(e){var t=Ue.getStairCalculator();e>0?t.addStep():t.subtractStep(),T()}function De(){var e=Ue.getStairCalculator();Vi="Full3"==bi&&xi?"AdjustingStairsQuadAndLines":"DraggingStringerPointWhileAddStep"==Vi?e.getExtendBottomVisible()?"AdjustingAddStep":"AdjustingStepOneNode2":"DraggingStringerPointStepTwoNode"==Vi?"AdjustingStepTwoNode2":"DraggingStringerPointStepOneNode"==Vi?"AdjustingStepOneNode2":"AdjustingStairsQuad2",T()}function Oe(){var e=Ue.getStairCalculator();Vi="Full3"==bi&&xi?"AdjustingStairsQuadAndLines":"DraggingStepOneNodeWhileAddStep"==Vi&&e.getExtendBottomVisible()?"AdjustingAddStep":"AdjustingStepOneNode2",T()}function ke(){var e=Ue.getStairCalculator();Vi="Full3"==bi&&xi?"AdjustingStairsQuadAndLines":"DraggingStepTwoNodeWhileAddStep"==Vi?e.getExtendBottomVisible()?"AdjustingAddStep":"AdjustingStepOneNode2":"DraggingStepTwoNodeWhileAdjustingStepOneNode"==Vi?"AdjustingStepOneNode2":"AdjustingStepTwoNode2",T()}function Be(){var e;Ue.getStairCalculator().extendBottom(),T()}function Fe(){var e;Ue.getStairCalculator().contractBottom(),T()}var Ge=this,Ve=e,Ne=t,ze=i,Ue=r,He=!1,We=!1;-1!=location.href.indexOf("cjc-macbookpro")&&(We=!0);var Ye=!1,$e=null,je=($e=visualizerPlugin?$(".visualizer-plugin-render-canvas")[0]:$(".v-uyo-edit-canvas")[0]).getContext("2d"),Xe=1.5,qe=Xe;const Qe=.5,Ze=2.5,Je=.1,Ke=.65;var et=0,tt=0;const it=160;var rt=0,nt=0,at=0;const ot=160,st="60px Arial";var lt=20;VUtils.isTabletOrPhoneDevice()&&(lt=40),VUtils.isPhoneDevice()&&(lt=45);var ut=20;VUtils.isTabletOrPhoneDevice()&&(ut=30),VUtils.isPhoneDevice()&&(ut=45);var ht="#00ffff",ct="#00ff00",dt="#ff0000",pt="rgba(0,255,255,0.15)",mt="rgba(0,255,0,0.15)",ft="#00ff00",gt="rgba(0,255,0,0.15)",vt="#4040ff",yt="rgba(64,64,255,0.15)",_t="#00c000",bt="rgba(0,192,0,0.05)",xt=!1,Tt=!1,St="rgba(255,255,255,1)",wt="rgba(0,200,0,1)",At="rgba(0,0,0,0.6)",Ct="rgba(0,0,0,1)",Mt="rgba(255,255,255,1)",Pt="rgba(255,144,38,1)",Rt="rgba(255,144,38,0.7)",It="rgba(0,0,255,0.3)",Et="rgba(255,145,0,0.3)",Lt="rgba(255,255,0,1)",Dt="rgba(0,0,255,1)",Ot="rgba(0,150,150,1)",kt="rgba(255,255,255,1)",Bt="rgba(255,255,255,1)",Ft="rgba(192,192,192,1)",Pt="rgba(221,143,85,1)",Rt="rgba(221,143,85,0.8)",Lt="rgba(250,251,63,1)",Dt="rgba(0,110,182,1)",Ot="rgba(25,146,164,1)",Gt=0,Vt=0,Nt=0,zt=0,Ut=0,Ht=0,Wt=0,Yt=0,$t=0,jt=0,Xt=0,qt=0,$t=0,jt=0,Xt=0,qt=0,Qt=0,Zt=0,Jt=0,Kt=0,ei=0,ti=0,ii=[[0,0],[0,0],[0,0],[0,0]],ri=[[0,0],[0,0],[0,0],[0,0]],ni,ai,oi,si,li,ui=document.createElement("canvas");ui.width=200,ui.height=200;var hi=ui.getContext("2d"),ci,di,pi=new Image,mi=new Image,fi=new Image,gi=new Image,vi=new Image,yi=new Image,_i=new Image;"undefined"==typeof vitNoPluginImageLoads&&(pi.src="images/stairs-help-quad.jpg",mi.src="images/stairs-help-quad-small.jpg",fi.src="images/stairs-help-step1.jpg",gi.src="images/stairs-help-step1-can-add-step.jpg",vi.src="images/stairs-help-step2.jpg",yi.src="images/stairs-help-add-step.jpg",_i.src="images/stairs-help-width.jpg");var bi="Full3";switch("Carpet"==stairsCarpetVisualizer&&(bi="Steps"),VUtils.GetQueryStringParam("mode")){case"steps":bi="Steps";break;case"risers":bi="Risers";break;case"risers2":bi="Risers2";break;case"full":bi="Full";break;case"full2":bi="Full2";break;case"full3":bi="Full3";break;case"lines":bi="Full3";break}-1!=location.href.indexOf("step")?bi="Steps":-1!=location.href.indexOf("line")&&(bi="Full3"),-1!=location.href.indexOf("manningtonstairs")&&(bi="Full3",-1!=location.href.indexOf("step")&&(bi="Steps")),bi="Full3";var xi=!1,Ti="rgba(0,0,0,0.8)",Si="rgba(255,255,0,0.8)",wi="rgba(0,255,0,0.8)",Ai="#ff0000",Ci="#440000",Mi=1;(VUtils.isTabletOrPhoneDevice()||fr)&&(Mi=2),visualizerPlugin&&(VUtils.isTabletOrPhoneDevice()||fr)&&(Mi=4,lt=50);var Pi=3*Mi,Ri="rgba(0,255,255,0.5)",Ii="rgba(0,255,0,0.5)",Ei="rgba(0,255,0,0.5)",Li="rgba(64,64,255,0.5)";"HunterDouglasDemo"==visualizerConfigType&&(Mi=3);var Di=2,Oi,ki;Ve.fixedUYOWidth>1600&&(Di=6,Pi*=5,Mi=6,lt*=3,ut*=3);var Bi=-1,Fi=-1,Gi,Vi="None",Ni=null,zi,Ui=-1,Hi,Wi=!1,Yi=-1,$i=null,ji=null,Xi=null,qi=null,Qi,Zi=null,Ji=null,Ki=1,er,tr,ir=1,rr,nr,ar=!0,or=!0,sr=!0,lr=!1,ur=null,hr=!1,cr="Foot",dr=!0;dr=!1,m(!0);var pr=!1,mr=!1;visualizerPlugin?$(".visualizer-plugin-render-canvas").bind("mousedown mousemove mouseup mouseout touchstart touchmove touchend",(function(e){G(e)})):$(".v-uyo-edit-canvas").bind("mousedown mousemove mouseup mouseout touchstart touchmove touchend",(function(e){G(e)}));var fr=!1,gr=null,vr=null,yr=10,_r=null,br=!1,xr=null,Tr=null,Sr=null,wr=null,Ar=null,Cr=null,Mr=!1,Pr=!1,Rr;this.enable=function(){function e(){if(!visualizerPlugin||visualizerPlugin&&!vogelPlugin){var e;e=visualizerPlugin?document.getElementById("id-visualizer-plugin-render-canvas"):document.getElementById("id-v-scene-render");var t=$e.width;e.clientWidth>e.parentElement.clientWidth&&(t=$e.width*e.parentElement.clientWidth/e.clientWidth);var i=$e.height;e.clientHeight>e.parentElement.clientHeight&&(i=$e.height*e.parentElement.clientHeight/e.clientHeight);var r=Math.max(t,i);lt="Phone"==VUtils.deviceType()?.075*r/2:"Tablet"==VUtils.deviceType()?.045*r/2:.015*r/2,Pi=3*(Mi=2),VUtils.isTabletOrPhoneDevice()||(lt*=1.5)}}if(Sr=null,wr=null,Ar=null,Cr=null,Rr&&(Rr=!1),vitStairsRoom&&Ve.isEditingStairs(),e(),visualizerPlugin&&(!vitStairsRoom||vitStairsRoom&&0==Ue.getNumOutlines()))return Ye=!0,vogelPlugin&&Ue.isUYOOutlinesEnabled()&&$(".visualizer-plugin-render-canvas").css("border-width","10px"),T(),void(vitStairsRoom&&setTimeout((function(){e(),T()}),100));if("HunterDouglasDemo"==visualizerConfigType&&(Ge.setUYOEditMeshSizeUnit("Inch",!0),$(".v-uyo-edit-mesh-two-values .v-size-a-colour").attr("placeholder","Width"),$(".v-uyo-edit-mesh-two-values .v-size-b-colour").attr("placeholder","Height")),vitStairsRoom&&0!=Ue.getNumOutlines()){ze.editStairs();var t=!1;"Steps"!=bi&&"Risers"!=bi&&"Risers2"!=bi||(t=!0),Ue.editStairs(t),Ge.startEditingStairs(!0)}Ye=!0,$(".v-uyo-edit-canvas").show(),T(),"StairsVisualizer"==visualizerConfigType&&setTimeout((function(){e(),T()}),100)},this.disable=function(){if(visualizerPlugin&&Ye)return Ye=!1,$(".visualizer-plugin-render-canvas").css("border-width","0px"),Ue.clearDecorations(),vitStairsRoom||Ue.hasWorktop()&&Ue.clearRender(),je.drawImage(Ue.getRenderedSceneCanvas(),0,0),void(Vi="None");Ye=!1,$(".v-uyo-edit-canvas").hide(),Ve.broadcastMessage(null)},this.getStairsMode=function(){return bi},this.loadedNewRoom=function(){Rr=!0},this.uyoEditDeleteOutline=function(){x()},this.uyoEditFinishedAdjustingOutline=function(){y()},this.uyoEditFinishedAdjustingPerspective=function(){d()},
this.enableAutoFindFloorScaling=function(){br=!0},this.isAutoFindFloorScalingEnabled=function(){return br},this.setSegmentationScalingFinishedCallback=function(e){xr=e},this.setSegmentationCameraHeight=function(e){qe=e},this.isPrepareEnabled=function(){return Ye},this.setSize=function(e,t){$e.width=e,$e.height=t},this.setUYOEditMeshSizeUnit=function(e,t){switch(cr=e,$(".v-uyo-edit-mesh-foot-button").hide(),$(".v-uyo-edit-mesh-inch-button").hide(),$(".v-uyo-edit-mesh-metre-button").hide(),$(".v-uyo-edit-mesh-cm-button").hide(),$(".v-uyo-edit-mesh-foot-text").hide(),$(".v-uyo-edit-mesh-inch-text").hide(),$(".v-uyo-edit-mesh-metre-text").hide(),$(".v-uyo-edit-mesh-cm-text").hide(),cr){case"Foot":$(".v-uyo-edit-mesh-foot-button").show(),$(".v-uyo-edit-mesh-foot-text").show();break;case"Inch":$(".v-uyo-edit-mesh-inch-button").show(),$(".v-uyo-edit-mesh-inch-text").show();break;case"Metre":$(".v-uyo-edit-mesh-metre-button").show(),$(".v-uyo-edit-mesh-metre-text").show();break;case"CM":$(".v-uyo-edit-mesh-cm-button").show(),$(".v-uyo-edit-mesh-cm-text").show();break}null!=t&&t||(q(),Q())},this.scaleUYOAllMeshDimensions=function(e,t){const i=100/30.48,r=undefined;var n=Ji,a=Ji*.3048,o,s,o,s;return t?(e>0?a+=.1:e<0&&(a-=.1),a=Math.round(10*a),(o=(a/=10)*i)<1?Ji:(Zi*=s=o/Ji,Ji=o,T(),a)):(e>0?n+=.25:e<0&&(n-=.25),n=Math.round(4*n),(o=n/=4)<1||(Zi*=s=o/Ji,Ji=o,T()),Ji)},this.setUYOEditMeshSizeA=function(e){switch(vout("setUYOEditMeshSizeA((): "+e+" meshSizeLink="+hr),ar=!1,""==e&&(e="0.5"),e=parseFloat(e),cr){case"Foot":break;case"Inch":e/=12;break;case"Metre":e*=3.281;break;case"CM":e*=.03281;break}if(e<.5?e=.5:e>50&&(e=50),e=parseFloat(e.toFixed(2)),Zi=e,hr){var t=ur.attemptAutoAspectScale(Zi*Ki,Ji*ir,!0,!1);Ji=parseFloat(t[1].toFixed(2)),Ji/=ir,Ji=parseFloat(Ji.toFixed(2)),Q()}if(T(),visualizerPlugin){var i=Zi;i=i.toFixed(2).replace(/\.?0+$/,"");var r=Ji;return[i,r=r.toFixed(2).replace(/\.?0+$/,"")]}},this.setUYOEditMeshSizeB=function(e){switch(or=!1,""==e&&(e="0.5"),e=parseFloat(e),cr){case"Foot":break;case"Inch":e/=12;break;case"Metre":e*=3.281;break;case"CM":e*=.03281;break}if(e<.5?e=.5:e>50&&(e=50),e=parseFloat(e.toFixed(2)),Ji=e,hr){var t=ur.attemptAutoAspectScale(Zi*Ki,Ji*ir,!1,!0);Zi=parseFloat(t[0].toFixed(2)),Zi/=Ki,Zi=parseFloat(Zi.toFixed(2)),q()}if(T(),visualizerPlugin){var i=Zi;i=i.toFixed(2).replace(/\.?0+$/,"");var r=Ji;return[i,r=r.toFixed(2).replace(/\.?0+$/,"")]}},this.setUYOEditMeshSizeMinAB=function(e){switch(sr=!1,""==e&&(e="0.5"),e=parseFloat(e),cr){case"Foot":break;case"Inch":e/=12;break;case"Metre":e*=3.281;break;case"CM":e*=.03281;break}if(e<.5?e=.5:e>50&&(e=50),e=parseFloat(e.toFixed(2)),Zi
"+e)),$(".v-message").html(e),$(".v-message").show(),Ee=setTimeout((function(){Ee=null,$(".v-message").hide(),"HunterDouglasDemo"==visualizerConfigType&&$(".v-hd-message-anim").hide()}),t)},this.message=function(e){null==e?$(".v-message").fadeOut():($(".v-message").html(e),$(".v-message").fadeIn())},this.makeSureFullView=function(){Re||H(!0)},this.flashDecorateButton=function(){U()},this.showSelectRoomPopup=function(){d()},this.showSelectGroutPopup=function(){g()},this.showSelectPatternPopup=function(){C()},this.showSelectTilesPopup=function(){f()},this.decorateActionsPrompt=function(e){k(e)},this.updateButtons=function(){F()},this.updateWindow=function(){Y()},this.action=function(e,t,i,n){r(e,t,i,n)},this.openRunnersPopup=function(){f()},this.hidePrepareButtons=function(){$(".visualizeit-logo").hide(),$(".v-top-button-group").hide()},this.showPrepareButtons=function(){$(".visualizeit-logo").show(),$(".v-top-button-group").show(),V()},this.showTargetAreasButtons=function(e){"Target"!=visualizerConfiguration.operationalType&&(e=!1),e?(z(),$(".v-targets-on-off-container").show()):$(".v-targets-on-off-container").hide()},this.areTargetAreasShown=function(){return Ie},this.setTargetAreasShown=function(){"Target"==visualizerConfiguration.operationalType&&(Ie=!0,z(),ae.updateTargetAreas())};var We=""}function ColourPattern(e,t,i){function r(e){null!=e?($(".v-colour-pattern-message").html(e),$(".v-colour-pattern-message").show()):$(".v-colour-pattern-message").hide()}function n(e){function t(e,t,i){var r=4*i*e.width+4*t,n=e.data[r+0]<<16;return n+=e.data[r+1]<<8,n+=e.data[r+2]}var i=-1,r=-1;"touchmove"==e.type||"touchstart"==e.type||"touchend"==e.type?(i=e.originalEvent.changedTouches[0].pageX-$(".v-coloured-pattern-canvas").offset().left,r=e.originalEvent.changedTouches[0].pageY-$(".v-coloured-pattern-canvas").offset().top):(i=e.pageX-$(".v-coloured-pattern-canvas").offset().left,r=e.pageY-$(".v-coloured-pattern-canvas").offset().top),i=parseInt(i/440*L.width),r=parseInt(r/440*L.height);var n,a=t(A.getImageData(i,r,1,1),0,0);$(".v-colour-pattern-buttons-container button").removeClass("v-hovering-over"),"mouseout"!=e.type&&$(".v-colour-pattern-buttons-container button").eq(a).addClass("v-hovering-over"),"mousedown"==e.type&&d.selectColourPatternColourNum(a)}function a(e){T=e,e=parseInt(e,16),S[x]=e,O?l():l((function(){o()})),s()}function o(){r("Rendering..."),m.setCurTargetAreaAndType("Area1,All,-1"),visualizerConfiguration.operationalType="",rubberDemo?m.setCurTileSKU("rubberfloor_base"):m.setCurTileSKU("PeerlessBaseCarpet1"),visualizerConfiguration.operationalType="Target",f.tileTargetArea("Area1","All",-1,-1,-1,(function(){r(null)}))}function s(){$(".v-colour-pattern-selector-container img").removeClass("v-active"),$(".v-colour-pattern-selector-container img[data-ref='"+_+"']").addClass("v-active"),$(".v-colour-pattern-buttons-container button").hide(),$(".v-colour-pattern-buttons-container button").removeClass("v-active");for(var e=0;e>16,e.data[n+1]=(65280&r)>>8,e.data[n+2]=255&r}var a=e,o="config/"+visualizerConfigType+"/colour-patterns/"+e,l=new Image;l.crossOrigin="Anonymous",l.onload=function(){w.width=l.width,w.height=l.height,w.getContext("2d").drawImage(l,0,0),C.width=l.width,C.height=l.height,L.width=l.width,L.height=l.height,I.width=l.width,I.height=l.height;var e=E.createPattern(P,"repeat");E.rect(0,0,I.width,I.height),E.fillStyle=e,E.fill(),i(),s(),t()},VUtils.isInternetExplorerBrowser()||(l.src=""),l.src=o}function h(e){var t=new Image;t.crossOrigin="Anonymous",t.onload=function(){P.width=t.width,P.height=t.height,R.drawImage(t,0,0),e()},VUtils.isInternetExplorerBrowser()||(t.src=""),t.src=rubberDemo?"config/"+visualizerConfigType+"/textures/rubberfloor_base_c.png":"config/"+visualizerConfigType+"/colour-patterns/tufts-plain-7dpi.jpg"}function c(){function e(e,t,i){var r=4*i*e.width+4*t,n=e.data[r+0]<<16;return n+=e.data[r+1]<<8,n+=e.data[r+2]}function t(e,t,i,r){var n=4*i*e.width+4*t;e.data[n+0]=(16711680&r)>>16,e.data[n+1]=(65280&r)>>8,e.data[n+2]=255&r,e.data[n+3]=255}function i(){var e=document.createElement("canvas");e.width=1,e.height=1;var t=e.getContext("2d"),i;return t.fillStyle="#000",t.fillRect(0,0,1,1),t.globalCompositeOperation="multiply",t.fillStyle="#fff",t.fillRect(0,0,1,1),e=null,0===t.getImageData(0,0,1,1).data[0]}for(var r=A.getImageData(0,0,w.width,w.height),n=M.getImageData(0,0,C.width,C.height),a=0;a
"+i+"
";var n=visualizerConfiguration.emailFrom,a=visualizerConfiguration.emailSubjectLine;N.sendEmail(n,t,a,r)},this.sendEmail=function(e,t,i){Se.track("Send Email"),E.broadcastMessage("SendingEmail"),i=i.replace(/\r\n|\r|\n/g,"=i.get(r).length?(a=new ht(e,t),i.get(r).push(a)):a=i.get(r)[n],a},dispose:function(){i=new WeakMap}}}function dt(e,t,i){function r(i,r){var n=t.update(b);g.uniforms.shadow_pass.value=i.map.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,n,g,b,null),y.uniforms.shadow_pass.value=i.mapPass.texture,y.uniforms.resolution.value=i.mapSize,y.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,n,y,b,null)}function n(e,t,i){var r=e<<0|t<<1|i<<2,n=d[r];return void 0===n&&(n=new Do({depthPacking:3201,morphTargets:e,skinning:t}),d[r]=n),n}function a(e,t,i){var r=e<<0|t<<1|i<<2,n=p[r];return void 0===n&&(n=new Oo({morphTargets:e,skinning:t}),p[r]=n),n}function o(t,i,r,o,s,l,u){var h=null,c=n,d=t.customDepthMaterial;if(!0===o.isPointLight&&(c=a,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0);var g=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?g=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),h=c(p,g,!0===t.isInstancedMesh)}else h=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var v=h.uuid,y=r.uuid,_=m[v];void 0===_&&(_={},m[v]=_);var b=_[y];void 0===b&&(b=h.clone(),_[y]=b),h=b}return h.visible=r.visible,h.wireframe=r.wireframe,h.side=3===u?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],h.clipShadows=r.clipShadows,h.clippingPlanes=r.clippingPlanes,h.clipIntersection=r.clipIntersection,h.wireframeLinewidth=r.wireframeLinewidth,h.linewidth=r.linewidth,!0===o.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(o.matrixWorld),h.nearDistance=s,h.farDistance=l),h}function s(i,r,n,a,u){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===u)&&(!i.frustumCulled||l.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,i.matrixWorld);var h=t.update(i),c=i.material;if(Array.isArray(c))for(var d=h.groups,p=0,m=d.length;p=1):-1!==B.indexOf("OpenGL ES")&&(k=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),O=k>=2);var F=null,G={},V=new an,N=new an,z={};z[3553]=r(3553,3553,1),z[34067]=r(34067,34069,6),m.setClear(0,0,0,1),f.setClear(1),g.setClear(0),n(2929),f.setFunc(3),s(!1),l(1),n(2884),o(0);var U=((c={})[100]=32774,c[101]=32778,c[102]=32779,c);if(p)U[103]=32775,U[104]=32776;else{var H=t.get("EXT_blend_minmax");null!==H&&(U[103]=H.MIN_EXT,U[104]=H.MAX_EXT)}var W=((d={})[200]=0,d[201]=1,d[202]=768,d[204]=770,d[210]=776,d[208]=774,d[206]=772,d[203]=769,d[205]=771,d[209]=775,d[207]=773,d);return{buffers:{color:m,depth:f,stencil:g},enable:n,disable:a,useProgram:function(t){return y!==t&&(e.useProgram(t),y=t,!0)},setBlending:o,setMaterial:function(e,t){2===e.side?a(2884):n(2884);var i=1===e.side;t&&(i=!i),s(i),1===e.blending&&!1===e.transparent?o(0):o(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),f.setFunc(e.depthFunc),f.setTest(e.depthTest),f.setMask(e.depthWrite),m.setMask(e.colorWrite);var r=e.stencilWrite;g.setTest(r),r&&(g.setMask(e.stencilWriteMask),g.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),g.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),u(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:s,setCullFace:l,setLineWidth:function(t){t!==I&&(O&&e.lineWidth(t),I=t)},setPolygonOffset:u,setScissorTest:function(e){e?n(3089):a(3089)},activeTexture:h,bindTexture:function(t,i){null===F&&h();var r=G[F];void 0===r&&(r={type:void 0,texture:void 0},G[F]=r),r.type===t&&r.texture===i||(e.bindTexture(t,i||z[t]),r.type=t,r.texture=i)},unbindTexture:function(){var t=G[F];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===V.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),V.copy(t))},viewport:function(t){!1===N.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),v={},F=null,G={},y=null,_=!1,b=null,x=null,T=null,S=null,w=null,A=null,C=null,M=!1,P=null,R=null,I=null,E=null,L=null,m.reset(),f.reset(),g.reset()}}}function mt(e,t,i,r,n,a,o){function s(e,t){return O?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function l(e,t,i,r){var n=1;if((e.width>r||e.height>r)&&(n=r/Math.max(e.width,e.height)),n<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Zr.floorPowerOfTwo:Math.floor,o=a(n*e.width),l=a(n*e.height);void 0===M&&(M=s(o,l));var u=i?s(o,l):M;return u.width=o,u.height=l,u.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function u(e){return Zr.isPowerOfTwo(e.width)&&Zr.isPowerOfTwo(e.height)}function h(e,t){return e.generateMipmaps&&t&&e.minFilter!==nr&&e.minFilter!==sr}function c(t,i,n,a){e.generateMipmap(t),r.get(i).__maxMipLevel=Math.log2(Math.max(n,a))}function d(i,r,n){if(!1===P)return r;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}var a=r;return 6403===r&&(5126===n&&(a=33326),5131===n&&(a=33325),5121===n&&(a=33321)),6407===r&&(5126===n&&(a=34837),5131===n&&(a=34843),5121===n&&(a=32849)),6408===r&&(5126===n&&(a=34836),5131===n&&(a=34842),5121===n&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function p(e){return e===nr||e===ar||e===or?9728:9729}function m(t){var i=t.target;i.removeEventListener("dispose",m),function(t){var i=r.get(t);void 0!==i.__webglInit&&(e.deleteTexture(i.__webglTexture),r.remove(t))}(i),i.isVideoTexture&&D.delete(i),o.memory.textures--}function f(t){var i=t.target;i.removeEventListener("dispose",f),function(t){var i=t.texture,n=r.get(t),a=r.get(i);if(t){if(void 0!==a.__webglTexture&&e.deleteTexture(a.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(i),r.remove(t)}}(i),o.memory.textures--}function g(e,t){var n=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;D.get(e)!==t&&(D.set(e,t),e.update())}(e),e.version>0&&n.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void b(n,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+t),i.bindTexture(3553,n.__webglTexture)}function v(t,n){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,n){if(6===r.image.length){_(t,r),i.activeTexture(33984+n),i.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),s=r.image[0]&&r.image[0].isDataTexture,p=[],m=0;m<6;m++)p[m]=o||s?s?r.image[m].image:r.image[m]:l(r.image[m],!1,!0,I);var f,g=p[0],v=u(g)||P,b=a.convert(r.format),x=a.convert(r.type),T=d(r.internalFormat,b,x);if(y(34067,r,v),o){for(var S=0;S<6;S++){f=p[S].mipmaps;for(var w=0;w0&&f){for(var C=0,M=x.length;C