@crystaldesign/diva-web-planner-react 25.14.0-beta.1 → 25.14.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 9060.diva-web-planner-react.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[9060],{59060:(t,o,i)=>{i.r(o),i.d(o,{default:()=>B});var l=i(84658),r=i(13125),a=i(43860),h=i(80248),c=i(50747),u=i.n(c),m=i(49740),d=i(12952),g=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),E=function(){return(0,a.Z)((function BoxPlannerPartlistHelper(t,o,i,l,a,c,u){(0,r.Z)(this,BoxPlannerPartlistHelper),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"getOptionVal",void 0),(0,h.Z)(this,"setOptionValue",void 0),(0,h.Z)(this,"getElementHasBottomPlate",void 0),(0,h.Z)(this,"getElementIsCornerElement",void 0),(0,h.Z)(this,"getCornerType",void 0),(0,h.Z)(this,"getElementHasTopPlate",void 0),(0,h.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=i,this.setOptionValue=o,this.getElementIsCornerElement=l,this.getCornerType=a,this.getElementHasTopPlate=c,this.getElementIsGarderobeElement=u}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasBottomPlate(t,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(r,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasBottomPlate(h,i)&&l++,this.getElementHasBottomPlate(c,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasBottomPlate(d,i)&&l++}return l}return l}g.error(new m.GE("BoxPlannerError - function getGroundPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasTopPlate(t,o,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(r,o,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasTopPlate(h,o,i)&&l++,this.getElementHasTopPlate(c,o,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasTopPlate(d,o,i)&&l++}return l}return l}g.error(new m.GE("BoxPlannerError - function getTopPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getElementHeight",value:function getElementHeight(t,o){var i=this.getOptionVal(t.getElementId(),"OPTHOEHE",o);return"OPVH_6"==i?"6":"OPVH_11"==i?"11":"OPVH_18"==i?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,o){var i=this.getOptionVal(t.getElementId(),"OPTTIEFE",o);return"OPVTIEFE_18"==i?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,o){var i=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",o);return"OPVCHROM"==i?"CHROM":"OPVSCHWARZ_MATT"==i?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,o){for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(i[l],t,o),this.correctRahmenVerticalLeftBack(i[l],t,o),this.correctRahmenVerticalRightFront(i[l],t,o),this.correctRahmenVerticalRightBack(i[l],t,o),g.debug("---------Correct Senkrechte Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_V",o)),g.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_H",o)),g.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_V",o)),g.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_H",o))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(i[l],t,o),this.correctRahmenDepthLeftTop(i[l],t,o),this.correctRahmenDepthRightBottom(i[l],t,o),this.correctRahmenDepthRightTop(i[l],t,o),g.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Tiefen Rahmen links unten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_U",o)),g.debug("Tiefen Rahmen links oben: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_O",o)),g.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_U",o)),g.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_O",o)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId()))&&!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(this.getElementHasTopPlate(t,o,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(l){var r=o.getRightElements(t.getElementId());if(r.length>0){var a=r[0];if(!this.getElementHasBottomPlate(t,i)||this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(!this.getElementHasBottomPlate(a,i)||this.getElementIsCornerElement(a,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i)}}else if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":l?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else g.error(new m.GE("BoxPlannerError - function correctRahmenDepthRightBottom not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(!this.getElementHasTopPlate(t,o,i)||this.getElementIsCornerElement(t,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}if(!r)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];if(!this.getElementHasTopPlate(h,o,i)||this.getElementIsCornerElement(h,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i);break;case"BLACK":r?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else g.error(new m.GE("BoxPlannerError - function correctRahmenDepthRightTop not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l&&!(l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}else g.error(new m.GE("BoxPlannerError - function correctRahmenVerticalRightFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(0==a.length)return;if(a.length>0){var h=a[0];if(o.getPlannerHasActiveBackside()){var c=o.getOppositeElement(t.getElementId());if(!c)return;var u=o.getOppositeElement(h.getElementId());if(!u)return;this.getElementIsGarderobeElement(h,i)||this.getElementIsGarderobeElement(c,i)||this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else if(o.getPlannerHasActiveBackside()){var d=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}}else g.error(new m.GE("BoxPlannerError - function correctRahmenVerticalRightBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"calculateKnots",value:function calculateKnots(t,o){if(this.constructionRules.hasKNOTS)for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.correctKnotLeftTopFront(i[l],t,o),this.correctKnotLeftTopBack(i[l],t,o),this.correctKnotLeftBottomFront(i[l],t,o),this.correctKnotLeftBottomBack(i[l],t,o),this.correctKnotRightTopFront(i[l],t,o),this.correctKnotRightTopBack(i[l],t,o),this.correctKnotRightBottomFront(i[l],t,o),this.correctKnotRightBottomBack(i[l],t,o),this.correctKnotRightMiddleBack(i[l],t,o),this.correctKnotLeftMiddleBack(i[l],t,o),g.debug("---------Correct Knots for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Links oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTF",o)),g.debug("Links oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTB",o)),g.debug("Links unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBF",o)),g.debug("Links unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBB",o)),g.debug("Rechts oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTF",o)),g.debug("Rechts oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTB",o)),g.debug("Rechts unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBF",o)),g.debug("Links mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LMB",o)),g.debug("Rechts mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RMB",o)),g.debug("Rechts unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBB",o))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&(l||(o.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i))){var r=o.getLeftElements(t.getElementId());if(r.length>0){var a=r[0];if(this.getElementIsCornerElement(a,i))return;var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(l||(o.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,o,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i)){var r=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var a=o.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else if(!a&&r){var u=o.getLeftElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(a&&r){var E=o.getLeftElements(t.getElementId())[0],I=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(E,o,i)?this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasBottomPlate(t,i)?this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsCornerElement(a,i))return;switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":var h=o.getRightElements(t.getElementId())[0];this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasTopPlate(t,o,i)?this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var h=o.getElementHasRightElement(t.getElementId());if(a||h){if(h&&!a){var c=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(!h&&a){var u=o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(h&&a){var d=o.getLeftElements(t.getElementId())[0],E=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(d,o,i)?this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftTopBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)&&!o.getCellsInGridByElementId(t.getElementId()).backside)if(o.getElementHasRightElement(t.getElementId()))if(o.getPlannerHasActiveBackside()){var l=o.getOppositeElement(t.getElementId());if(!l)return;var r=o.getRightElements(t.getElementId());if(0==r.length)return;var a=r[0],h=o.getOppositeElement(a.getElementId());if(!h)return;this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(l,i)?this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else{var c=o.getRightElements(t.getElementId());if(0==c.length)return;var u=c[0];this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else if(o.getPlannerHasActiveBackside()){var d=o.getOppositeElement(t.getElementId());if(!d)return;this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else g.error(new m.GE("BoxPlannerError - function correctKnotRightMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(r){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsGarderobeElement(a,i))return}if(r)if(o.getPlannerHasActiveBackside()){var h=o.getLeftElements(t.getElementId());if(0==h.length)return;var c=h[0],u=o.getOppositeElement(t.getElementId());if(!u)return;var d=o.getOppositeElement(null==c?void 0:c.getElementId());if(!d)return;this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);else if(o.getPlannerHasActiveBackside()){var E=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(E,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(o.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasBottomPlate(t,i)){var d=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),E=void 0;d.length>0&&(E=d[0]),E&&!this.getElementHasBottomPlate(E,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasBottomPlate(p,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":var O=o.getRightElements(t.getElementId())[0];if(O&&this.getElementIsCornerElement(O,i))if(o.getElementHasRightElement(O.getElementId())){var R=o.getRightElements(O.getElementId())[0];this.getElementHasBottomPlate(R,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else O&&this.getElementHasBottomPlate(O,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,o,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasTopPlate(t,o,i)){if(r){var d=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),E=void 0;d.length>0&&(E=d[0]),E&&(this.getElementHasTopPlate(E,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasTopPlate(p,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i)){var O=o.getElementHasLeftElement(t.getElementId()),R=o.getElementHasRightElement(t.getElementId());if(O||R){if(R&&!O){var k=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(k,i))if(o.getElementHasRightElement(k.getElementId())){var P=o.getRightElements(k.getElementId())[0];this.getElementHasTopPlate(P,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(k,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!R&&O){o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(R&&O){var v=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(v,i))if(o.getElementHasRightElement(v.getElementId())){var T=o.getRightElements(v.getElementId())[0];this.getElementHasTopPlate(T,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(v,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,o,i)){case 0:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);break;case 3:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else if(this.getElementHasBottomPlate(t,i)){if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i))}}else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&!this.getElementIsCornerElement(u,i)&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":var d=o.getRightElements(t.getElementId())[0];if(this.getElementIsCornerElement(d,i)){var E=o.getRightElements(d.getElementId())[0];this.getElementHasBottomPlate(E,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.getElementHasBottomPlate(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())if(r)switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else if(this.getElementHasTopPlate(t,o,i)){if(r){var a=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];this.getElementIsCornerElement(a,i)||this.getElementHasTopPlate(a,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(r){var h=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];h&&!this.getElementIsCornerElement(h,i)&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var c=o.getElementHasLeftElement(t.getElementId()),u=o.getElementHasRightElement(t.getElementId());if(c||u){if(u&&!c){var m=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(m,i))if(o.getElementHasRightElement(m.getElementId())){var d=o.getRightElements(m.getElementId())[0];this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!u&&c)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(u&&c){var g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(g,i))if(o.getElementHasRightElement(g.getElementId())){var E=o.getRightElements(g.getElementId())[0];this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}])}();function _createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function _unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return _arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function _arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}var I=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),p=function(){return(0,a.Z)((function ConstructionRulesHandler(t,o,i){var l=this;(0,r.Z)(this,ConstructionRulesHandler),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"checkArticleHasOption",void 0),(0,h.Z)(this,"updateCfgValuesByPlanner",void 0),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"constructionRulesLoaded",void 0),(0,h.Z)(this,"hideOptionsForConstruction",void 0),(0,h.Z)(this,"partlistHelper",void 0),(0,h.Z)(this,"getOptionVal",(function(t,o,i){if(i.has(t)&&i.get(t).has(o)){var r=i.get(t).get(o);return null!=r?r:""}var a=l.getValueOfOptionOfArticle(t,o);return null!=a?a:""})),(0,h.Z)(this,"hasOptionValue",(function(t,o,i){return!(!i.has(t)||!i.get(t).has(o))||!!l.getValueOfOptionOfArticle(t,o)})),(0,h.Z)(this,"setOptionValue",(function(t,o,i,r){var a;if(r.has(t)||r.set(t,new Map),null===(a=r.get(t))||void 0===a||a.set(o,i),l.hideOptionsForConstruction.has(t)){var h=l.hideOptionsForConstruction.get(t).indexOf(o);h>=0&&l.hideOptionsForConstruction.get(t).splice(h,1)}})),(0,h.Z)(this,"getElementHasBottomPlate",(function(t,o){if(!t)return!1;if(l.constructionRules.knotInfo.elementsWithGroundPlate)for(var i=0;i<l.constructionRules.knotInfo.elementsWithGroundPlate.length;i++){var r=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPT,a=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPVs,h=l.getOptionVal(t.getElementId(),r,o);return l.arrayContainsValue(a,h)}return!1})),(0,h.Z)(this,"getElementIsCornerElement",(function(t,o){return!!t&&(l.constructionRules.hasCORNER&&l.arrayContainsValue(l.constructionRules.knotInfo.cornerElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.cornerElements.onOPT,o)))})),(0,h.Z)(this,"getElementIsGarderobeElement",(function(t,o){return l.constructionRules.hasGARDEROBE&&l.arrayContainsValue(l.constructionRules.knotInfo.garderobeElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.garderobeElements.onOPT,o))})),(0,h.Z)(this,"getCornerType",(function(t,o){return"OPVECK_I"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"INSIDE":"OPVECK_A"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"OUTSIDE":"NOCORNER"})),(0,h.Z)(this,"getElementHasTopPlate",(function(t,o,i){if(o.getElementHasTopElement(t.getElementId())){var r=o.getTopElements(t.getElementId()),a=!1;return l.getElementHasBottomPlate(r[0],i)&&(a=!0),a}return!0})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=o,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=i,this.partlistHelper=new E(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,o){if(!t)return!1;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if(t[i]==o)return!0;return!1}var l=t.split(";");for(i=0;i<l.length;i++)if(l[i]==o)return!0;return!1}},{key:"evalRule",value:function evalRule(t,o,i){for(var l=!0,r=o.split("&"),a=0;a<r.length;a++){var h=r[a].split("=")[0],c=r[a].split("=")[1],u=this.getOptionVal(t,h,i);u&&u!=c&&(l=!1)}return l}},{key:"setOptionDoShow",value:function setOptionDoShow(t,o,i){var l=this.constructionRules.optionsVisibilityInfo[o];if(l){var r;if(null!=l.doShow)i.has(t)||i.set(t,new Map),null===(r=i.get(t))||void 0===r||r.set(o,l.doShow);if(this.hideOptionsForConstruction.has(t)){var a,h=this.hideOptionsForConstruction.get(t).indexOf(o);if(h>=0)null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.splice(h,1)}}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,o,i){var l,r,a=this.constructionRules.optionsVisibilityInfo[o];a&&(i.has(t)||i.set(t,new Map),null===(l=i.get(t))||void 0===l||l.set(o,a.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(r=this.hideOptionsForConstruction.get(t))||void 0===r||r.push(o))}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,o){for(var i=[],l=0;l<this.constructionRules.optionBasedConstructionRules.length;l++){var r=this.constructionRules.optionBasedConstructionRules[l];this.getOptionVal(t,r.masterOptionName,o)==r.masterOptionValue&&i.push(r)}return i}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,o,i,l){for(var r=[],a=void 0,h=0;h<this.constructionRules.optionsInfluenceRulesOfAllElements.length;h++){var c=this.constructionRules.optionsInfluenceRulesOfAllElements[h];for(var u in i)u==c.onOPT&&this.arrayContainsValue(c.onOPVs,i[u])&&r.push({opt:c.influenceOPT,opv:c.forceOPV,unvalidOPVs:c.unvalidOPVs,warning:c.warning,doShowWarning:!1})}for(var m=t.getAllElementIdsInGrid(),d=0;d<m.length;d++){var g;if(this.hideOptionsForConstruction.has(m[d])&&this.hideOptionsForConstruction.get(m[d]).length>0){for(;this.hideOptionsForConstruction.get(m[d]).length>0;){var E=this.hideOptionsForConstruction.get(m[d])[0];this.setOptionDoShow(m[d],E,o)}this.hideOptionsForConstruction.delete(m[d])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(m[d],"OPTDMOD",o):this.setOptionDoHide(m[d],"OPTDMOD",o));var I=t.getColumnCount();I>1?this.setOptionDoShow(m[d],"OPTMULTICOL",o):this.setOptionDoHide(m[d],"OPTMULTICOL",o),this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVOHNE",o),this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVOHNE",o);var p=t.getCellsInGridByElementId(m[d]);if(p.backside)this.setOptionValue(m[d],"OPTELEM_ON_BACK","OPVJA",o);else{if(this.setOptionValue(m[d],"OPTELEM_ON_BACK","OPVNEIN",o),p.startColIndex>0){var O=t.getPlannerElementAtGridPos(p.startColIndex-1,0,!1);if(O){var R=this.getOptionVal(O.getElementId(),"OPTELEMENT",o);"OPVECK_I"==R?this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVECK_I",o):"OPVECK_A"==R?this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVECK_A",o):this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVOHNE",o)}}if(p.endColIndex<I-1){var k=t.getPlannerElementAtGridPos(p.endColIndex,0,!1);if(k){var P=this.getOptionVal(k.getElementId(),"OPTELEMENT",o);"OPVECK_I"==P?this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVECK_I",o):"OPVECK_A"==P?this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVECK_A",o):this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVOHNE",o)}}}if(this.constructionRules.avoidOptionLastCol){var v=this.getOptionVal(m[d],this.constructionRules.avoidOptionLastCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,v)&&p.endColIndex-1==I-1&&this.setOptionValue(m[d],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,o)}if(this.constructionRules.avoidOptionFirstCol){var T=this.getOptionVal(m[d],this.constructionRules.avoidOptionFirstCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,T)&&0==p.startColIndex&&this.setOptionValue(m[d],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,o)}var V=this.hasOptionValue(m[d],"OPTWW",o);if(t.getElementIsFirstInGrid(m[d])?(this.setOptionDoShow(m[d],"OPTWERKZEUGKASTEN",o),V&&(t.getSizeOfWholeSet(!0).y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(m[d],"OPTWW",o):this.setOptionDoHide(m[d],"OPTWW",o))):(this.setOptionDoHide(m[d],"OPTWERKZEUGKASTEN",o),V&&this.setOptionDoHide(m[d],"OPTWW",o)),o.has(m[d])||o.set(m[d],new Map),null===(g=o.get(m[d]))||void 0===g||g.set("DEBUG",t.getElementById(m[d]).getPosNr()+""),r.length>0)for(var _=0;_<r.length;_++){var B=this.getOptionVal(m[d],r[_].opt,o),C=!1;if(r[_].unvalidOPVs&&0!=r[_].unvalidOPVs.length){for(var x=r[_].unvalidOPVs.split(";"),y=0;y<x.length;y++)if(x[y]==B){C=!0;break}}else C=!0;C&&(B!=r[_].opv&&(this.setOptionValue(m[d],r[_].opt,r[_].opv,o),r[_].doShowWarning||(r[_].doShowWarning=!0,a=r[_].warning)))}if(i)for(var u in i)if(""!=u&&i[u]&&""!=i[u])for(h=0;h<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;h++){c=this.constructionRules.optionsInfluenceRulesOfSingleElement[h];var H=!1;if(c.dir&&l&&l.length>0){if("TOP"==c.dir&&t.getElementHasBottomElement(m[d]))for(var b=t.getBottomElements(m[d]),G=0;G<b.length;G++)l.indexOf(b[G].getElementId())>=0&&(H=!0);if("DOWN"==c.dir&&t.getElementHasTopElement(m[d]))for(var D=t.getTopElements(m[d]),L=0;L<D.length;L++)l.indexOf(D[L].getElementId())>=0&&(H=!0);if("LEFT_RIGHT"==c.dir){if(t.getElementHasLeftElement(m[d]))for(var A=t.getLeftElements(m[d]),S=0;S<A.length;S++)l.indexOf(A[S].getElementId())>=0&&(H=!0);if(t.getElementHasRightElement(m[d]))for(var w=t.getRightElements(m[d]),N=0;N<w.length;N++)l.indexOf(w[N].getElementId())>=0&&(H=!0)}if("COL"==c.dir){var M=t.getCellsInGridByElementId(m[d]);t.getAllElementsInColumn(M.startColIndex,M.backside).forEach((function(t){return l.indexOf(t.ElementId)>=0?H=!0:void 0}))}if("BACK"==c.dir&&t.getPlannerHasActiveBackside()){var W=t.getOppositeElement(m[d]);W&&l.indexOf(W.getElementId())>=0&&(H=!0)}}else H=!0;if(H){B=this.getOptionVal(m[d],c.influenceOPT,o);u==c.onOPT&&B&&""!=B&&this.arrayContainsValue(c.unvalidOPVs,B)&&this.arrayContainsValue(c.onOPVs,i[u])&&(this.setOptionValue(m[d],c.influenceOPT,c.defaultOpv,o),c.warning&&(a=c.warning))}}var K=this.getCurOptionBasedConstructionRules(m[d],o);if(K)for(var X=0;X<K.length;X++)if(K[X].defaultOptions)for(var Z=0;Z<K[X].defaultOptions.length;Z++){var z=K[X].defaultOptions[Z];if(!z.rule||""==z.rule||this.evalRule(m[d],z.rule,o))for(var Y=0;Y<z.options.length;Y++)"doShow"==z.value?this.setOptionDoShow(m[d],z.options[Y],o):"doHide"==z.value&&this.setOptionDoHide(m[d],z.options[Y],o),z.opv&&this.setOptionValue(m[d],z.options[Y],z.opv,o)}this.setOptionValue(m[d],"OPTFAF_L_V","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_L_H","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_R_V","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_R_H","OPVOHNE_FAF",o)}return a}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,o,i,l){if(null!=l&&1==l.length){var r=l[0];if(null!=i)for(var a in i){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,a)){var h=t.getCellsInGridByElementId(r).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=h)for(var c=0;c<h.length;c++)this.setOptionValue(h[c].ElementId,a,i[a],o)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,a)){var u=t.getCellsInGridByElementId(r),m=t.getAllElementsInColumn(u.startColIndex,u.backside);if(null!=m){if(t.getPlannerHasActiveBackside()){var d,g=t.getAllElementsInColumn(u.startColIndex,!u.backside);g&&(m=null===(d=m)||void 0===d?void 0:d.concat(g))}for(c=0;c<m.length;c++)this.setOptionValue(m[c].ElementId,a,i[a],o)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,a)){var E=t.getCellsInGridByElementId(r),I=t.getAllElementsInRow(E.startRowIndex,E.backside);if(I&&t.getPlannerHasActiveBackside()){var p=t.getAllElementsInRow(E.startRowIndex,!E.backside);p&&(I=I.concat(p))}for(c=0;c<I.length;c++)this.setOptionValue(I[c].ElementId,a,i[a],o)}}var O=t.getCellsInGridByElementId(r),R=t.getAllElementsInRow(O.startRowIndex,O.backside);for(c=0;c<R.length;c++)if(R[c].getElementId()!=r)for(var k=0;k<(null===(P=this.constructionRules.forceSameOptionInRow)||void 0===P?void 0:P.length);k++){var P,v=this.getOptionVal(R[c].getElementId(),this.constructionRules.forceSameOptionInRow[k],o);this.setOptionValue(r,this.constructionRules.forceSameOptionInRow[k],v,o);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(i.OPTCurrentElem)>=0;this.setOptionDoHide(o,i.OPTNeighborElem,l),r||this.setOptionDoShow(t,i.OPTCurrentElem,l)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem],a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem];r&&a&&this.getOptionVal(t,i.OPTCurrentElem,l)==r.doShow&&this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow&&this.setOptionDoHide(t,i.OPTCurrentElem,l)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,o,i,l){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem];if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem],h=r.doShow==this.getOptionVal(t,i.OPTCurrentElem,l),c=this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow;h&&c&&(this.setOptionDoHide(t,i.OPTCurrentElem,l),this.setOptionDoHide(o,i.OPTNeighborElem,l))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,o,i,l,r){var a=i.getPlannerElementAtGridPos(t,o,r);if(this.constructionRules.defaultConstructionRules.TOP){var h=void 0;if(i.getElementHasTopElement(a.ElementId)){h=i.getPlannerElementAtGridPos(t,o+1,r);for(var c=0;c<this.constructionRules.defaultConstructionRules.TOP.length;c++){var u=this.constructionRules.defaultConstructionRules.TOP[c];"SHOW_HIDE"==u.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,h.ElementId,u,l):"HIDE_HIDE"==u.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,h.ElementId,u,l)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var m=void 0;if(r?i.getElementHasLeftElement(a.ElementId):i.getElementHasRightElement(a.ElementId)){m=r?i.getPlannerElementAtGridPos(t-1,o,r):i.getPlannerElementAtGridPos(t+1,o,r);for(c=0;c<this.constructionRules.defaultConstructionRules.RIGHT.length;c++){var d=this.constructionRules.defaultConstructionRules.RIGHT[c];"SHOW_HIDE"==d.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,m.ElementId,d,l):"HIDE_HIDE"==d.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,m.ElementId,d,l)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var g=void 0;if(o>0){g=i.getPlannerElementAtGridPos(t,o-1,r);for(c=0;c<this.constructionRules.defaultConstructionRules.DOWN.length;c++){var E=this.constructionRules.defaultConstructionRules.DOWN[c];"SHOW_HIDE"==E.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,g.ElementId,E,l):"HIDE_HIDE"==E.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,g.ElementId,E,l)}}}var I=r?i.getLeftElements(a.ElementId):i.getRightElements(a.ElementId),p=r?i.getRightElements(a.ElementId):i.getLeftElements(a.ElementId),O=i.getTopElements(a.ElementId),R=i.getBottomElements(a.ElementId),k=r?i.getTopLeftElement(a.ElementId):i.getTopRightElement(a.ElementId);I.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(I[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_RECHTS",l),p.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(p[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_LINKS",l),O.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(O[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN",l),k?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(k.ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",l),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(R.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(R[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_UNTEN",l))}},{key:"correctBack",value:function correctBack(t,o,i){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var l=void 0;if(l=t.getOppositeElement(i),this.constructionRules.defaultConstructionRules.BACK)for(var r=0;r<this.constructionRules.defaultConstructionRules.BACK.length;r++){var a,h,c=this.constructionRules.defaultConstructionRules.BACK[r],u=!1;if(c.hideOnElemAndOppositeOPT&&c.hideOnElemAndOppositeOPV)this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(i,c.hideOnElemAndOppositeOPT,o))&&this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(null===(a=l)||void 0===a?void 0:a.getElementId(),c.hideOnElemAndOppositeOPT,o))&&(u=!0);if(u)this.setOptionDoHide(i,c.OPTCurrentElem,o),this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o);else if("FORCE_HIDE"==c.OPTValueRule&&this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o),"SHOW_HIDE"==c.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(h=l)||void 0===h?void 0:h.getElementId(),i,c,o);else"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(l.ElementId,i,c,o)}l&&this.getElementHasBottomPlate(l,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_U_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.getElementHasTopPlate(l,t,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_O_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}else this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}},{key:"correctBottom",value:function correctBottom(t,o,i){var l="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var r=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,i),a=0;a<r.length;a++){var h=r[a];if(0==a){if(null==(l=this.getOptionVal(h.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,o)))return;i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeftBack,l,o))}i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRightBack,l,o))}}},{key:"getValidLadder",value:function getValidLadder(t,o,i){for(var l=o.getAllElementsInColumn(t,!1),r=0;r<this.constructionRules.correctLadder.validLadder.length;r++){var a=this.constructionRules.correctLadder.validLadder[r];if(l.length==a.colCount){for(var h=!0,c=0;c<l.length;c++){var u=l[c];if(this.getOptionVal(u.ElementId,a.heightOption,i)!=a.heightPerRow[c]&&(h=!1),!h)break}if(h)return a}}}},{key:"validateDimensionRule",value:function validateDimensionRule(t,o){var i=!1,l=!1;if("height"==t.dimension.toLowerCase()&&o.y>t.dimensionLimit&&(i=!0),"height"==t.dimension.toLowerCase()&&o.y==t.dimensionLimit&&(l=!0),"width"==t.dimension.toLowerCase()&&o.x>t.dimensionLimit&&(i=!0),"width"==t.dimension.toLowerCase()&&o.x==t.dimensionLimit&&(l=!0),"depth"==t.dimension.toLowerCase()&&o.z>t.dimensionLimit&&(i=!0),"depth"==t.dimension.toLowerCase()&&o.z==t.dimensionLimit&&(l=!0),i){if("doshow"==t.higherLimit.toLowerCase())return!0;if("dohide"==t.higherLimit.toLowerCase())return!1}else{if(l)return!0;if("doshow"==t.lowerLimit.toLowerCase())return!0;if("dohide"==t.lowerLimit.toLowerCase())return!1}return!1}},{key:"correctOverHangingElement",value:function correctOverHangingElement(t,o,i,l){var r=this;if(l)for(var a=function _loop(){var a=o.getAllElementsInColumn(h,!1,!1),c=null;a.findIndex((function(o){return o.ElementId==t}));a.forEach((function(t,o){var a,h,u,m;if(c){if((null!==(a=c.Width)&&void 0!==a?a:0)>(null!==(h=t.Width)&&void 0!==h?h:0)){var d=Object.entries(l),g=d[0][0],E=d[0][1];r.setOptionValue(t.ElementId,g,E,i)}if((null!==(u=c.Depth)&&void 0!==u?u:0)>(null!==(m=t.Depth)&&void 0!==m?m:0)){var I=Object.entries(l),p=I[0][0],O=I[0][1];r.setOptionValue(t.ElementId,p,O,i)}c=t}else c=t}))},h=0;h<o.getColumnCount();h++)a()}},{key:"correctFoot",value:function correctFoot(t,o){var i=this;t.getAllElementsInFrontGrid().forEach((function(l){t.getElementHasBottomElement(l.ElementId)&&i.setOptionValue(l.ElementId,"OPTFUSS_SYS","OPVOHNE",o)}))}},{key:"correctOptionsInfluencedByDimensions",value:function correctOptionsInfluencedByDimensions(t,o){var i=this;if(this.constructionRules.optionsInfluencedByDimensions){var l=t.getSizeOfWholeSet(!1),r=t.getAllElementsInFrontGrid();this.constructionRules.optionsInfluencedByDimensions.forEach((function(t){Array.isArray(t)?t.every((function(t){return i.validateDimensionRule(t,l)}))?t.forEach((function(t){return r.forEach((function(l){return i.setOptionDoShow(l.ElementId,t.option,o)}))})):t.forEach((function(t){return r.forEach((function(l){return i.setOptionDoHide(l.ElementId,t.option,o)}))})):i.validateDimensionRule(t,l)?r.forEach((function(l){return i.setOptionDoShow(l.ElementId,t.option,o)})):r.forEach((function(l){return i.setOptionDoHide(l.ElementId,t.option,o)}))}))}}},{key:"correctLadder",value:function correctLadder(t,o){if(this.constructionRules.correctLadder){for(var i=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),l=0;l<i.length;l++){var r=t.getRowCount(l,!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(r))for(var a=t.getAllElementsInColumn(l,!1),h=0;h<a.length;h++)this.setOptionValue(a[h].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o);if(r<t.getSizeOfHighesRow(!1)){var c,u=null===(c=t.getPlannerElementAtGridPos(l,r-1,!1))||void 0===c?void 0:c.getElementId();u&&this.getOptionVal(u,this.constructionRules.correctLadder.optHeight,o)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(u,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o)}}for(l=0;l<i.length;l++){var m=i[l],d=this.getValidLadder(l,t,o);0==l&&this.setOptionValue(m.ElementId,this.constructionRules.correctLadder.optLadderLeft,d.optLadder,o);var g=d;if(t.getElementHasRightElement(m.getElementId())){var E=this.getValidLadder(l+1,t,o);E.colCount>d.colCount&&(g=E)}this.setOptionValue(m.getElementId(),this.constructionRules.correctLadder.optLadderRight,g.optLadder,o)}var I=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(I)>=0){var p=t.getAllElementsInRow(I-1,!1);for(l=0;l<p.length;l++){var O=p[l];this.setOptionDoShow(O.getElementId(),this.constructionRules.correctLadder.optHasHeight,o)}}}}},{key:"correctCoverPlate",value:function correctCoverPlate(t,o,i){var l=this;t.onHighestElementsOnly||o.getHighestElementsPerSeries(!!t.onBottom).forEach((function(r){var a=0,h=t.seriesWidthToPlateOpv;r.forEach((function(r){var h;a+=null!==(h=r.Width)&&void 0!==h?h:0,o.getAllElementsDown(r.ElementId).elements.forEach((function(o){return l.setOptionValue(o,t.optABD,"OPVOHNE",i)})),l.setOptionValue(r.ElementId,t.optABD,"OPVOHNE",i)}));for(var c,u=r[0],m=function _loop2(){var o=h.findLast((function(t){var o=0,i=!1;return r.forEach((function(l){var r;o+=null!==(r=l.Width)&&void 0!==r?r:0,Math.abs(o-t.limit)<1&&(i=!0)})),!!(t.limit<=a&&i)}));if(!o)return{v:void 0};l.setOptionValue(u.ElementId,t.optABD,o.plateOpv,i);var c=0;u=r.find((function(t){var i;return(c+=null!==(i=t.Width)&&void 0!==i?i:0)>o.limit})),a-=o.limit,h[1].limit>a&&(a=0)};0!=a;)if(c=m())return c.v}))}},{key:"correctSeries",value:function correctSeries(t,o){for(var i=!1,l=t.getAllElementIdsInGrid(),r=!1,a=!1,h=0;h<l.length;h++){var c=l[h];this.getElementIsCornerElement(t.getElementById(c),o)&&(r=!0),this.checkArticleHasOption(c,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(c,"OPTBR_ABDECKPLATTE",o);var u=this.getOptionVal(c,"OPTABDECKPLATTE",o);this.checkArticleHasOption(c,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==u&&(i=!0),"OPVBR_18"==this.getOptionVal(c,"OPTBR",o)&&(a=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var m=t.getSizeOfHighesRow(!1),d=[],g=[],E=[],I=0,p=0,O=t.getAllElementsInColumn(p,!1);O.length>0;){if(O.length==m){var R=O[m-1];E.push(R),"OPVBR_75"==(u=this.getOptionVal(R.ElementId,"OPTBR",o))?I+=75:"OPVBR_18"==u?I+=18.75:"OPVBR_37"==u&&(I+=37.5),this.setOptionDoHide(R.ElementId,"OPTOBEN",o)}else E.length>0&&(d.push(E),g.push(I)),E=[],I=0;p++,O=t.getAllElementsInColumn(p,!1)}for(E.length>0&&(d.push(E),g.push(I)),h=0;h<d.length;h++){var k=d[h][0],P="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(g[h]-40.4)<3?P="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(g[h]-77.8)<3?P="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(g[h]-115.3)<3?P="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(g[h]-152.8)<3?P="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(g[h]-190.3)<3?P="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(g[h]-227.8)<3&&(P="OPVABDECKPLATTE_227"),""==P||r)for(var v=t.getAllElementsInGridSortedbyGridPos(),T=0;T<v.length;T++)this.checkArticleHasOption(v[T].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(v[T].getElementId(),"OPTABD_HIDE",o);else for(var V=t.getAllElementsInGridSortedbyGridPos(),_=0;_<V.length;_++)this.checkArticleHasOption(V[_].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(V[_].getElementId(),"OPTABD_HIDE",o);if(""==P||!i||r||a)for(var B=0;B<d[h].length;B++)this.setOptionDoShow(d[h][B].ElementId,"OPTOBEN",o);else this.setOptionValue(k.ElementId,"OPTBR_ABDECKPLATTE",P,o)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,o,i,l){if(0!=o.getCellsInGridByElementId(t).cells.length)for(var r=this.getCurOptionBasedConstructionRules(t,i),a=0;a<r.length;a++){if(r[a].forceOptions)for(var h=0;h<r[a].forceOptions.length;h++){var c=r[a].forceOptions[h];if(!c.rule||""==c.rule||this.evalRule(t,c.rule,i))for(var u=c.options,m=c.value,d=0;d<u.length;d++){var g=u[d],E=this.constructionRules.optionsVisibilityInfo[g];if(E.complementDir){var I=E.complementDir;l&&("LEFT"==I?I="RIGHT":"RIGHT"==I&&(I="LEFT"));var p=o.getNeighborElements(t,I);if(p.length>0)for(var O=0;O<p.length;O++){for(var R=p[O],k=this.getCurOptionBasedConstructionRules(R.ElementId,i),P=E.complementOPT,v=!1,T=0;T<k.length;T++)if(k[T].forceOptions)for(var V=0;V<k[T].forceOptions.length;V++){var _=k[T].forceOptions[V];if((!_.rule||""==_.rule||this.evalRule(R.ElementId,_.rule,i))&&(this.arrayContainsValue(_.options,P)&&(v=!0,"doShow"==m&&"doShow"==_.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",i)&&"OPVFUELLUNG"==this.getOptionVal(R.ElementId,"OPTELEMENT",i)?(this.setOptionDoHide(R.ElementId,P,i),this.setOptionDoHide(R.ElementId,P,i)):this.setOptionDoShow(R.ElementId,P,i)),"doHide"==m&&"doHide"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doShow"==m&&"doHide"==_.value||"doHide"==m&&"doShow"==_.value))){var B=!0;c.prio&&_.prio?B=c.prio<=_.prio:c.prio?B=!0:_.prio&&(B=!1),B?"doHide"==m?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==m&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doHide"==_.value?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoShow(R.ElementId,P,i))}}v||("doShow"==m&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doHide"==m&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)))}else"doShow"==m&&this.setOptionDoShow(t,g,i),"doHide"==m&&this.setOptionDoHide(t,g,i)}}}if(r[a].changeOptions)for(var C=0;C<r[a].changeOptions.length;C++){for(var x=!0,y=r[a].changeOptions[C].rule.split("&"),H=0;H<y.length;H++)if(y[H].indexOf("!=")>0){var b=y[H].split("!=")[0],G=y[H].split("!=")[1];this.getOptionVal(t,b,i)==G&&(x=!1)}else{b=y[H].split("=")[0],G=y[H].split("=")[1];this.getOptionVal(t,b,i)!=G&&(x=!1)}x&&(r[a].changeOptions[C].doShow&&this.setOptionDoShow(t,r[a].changeOptions[C].doShow,i),r[a].changeOptions[C].doHide&&this.setOptionDoHide(t,r[a].changeOptions[C].doHide,i),r[a].changeOptions[C].opt&&r[a].changeOptions[C].opv&&this.setOptionValue(t,r[a].changeOptions[C].opt,r[a].changeOptions[C].opv,i))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,o,i){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var l=0;l<this.constructionRules.correctNeighborOPT.length;l++){var r=o.getCellsInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,"OPVOHNE",i),0==r.cells.length)return;var a=o.getNeighborElements(t,this.constructionRules.correctNeighborOPT[l].dir);if(a.length>0){var h=this.getOptionVal(a[0].ElementId,this.constructionRules.correctNeighborOPT[l].neighborOPT,i);""!=h&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,h,i)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,o){var i=t.getAllElementsInGridSortedbyGridPos();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var l=0;l<this.constructionRules.correctRetailArticleNumberByRule.length;l++){var r=!0,a=this.constructionRules.correctRetailArticleNumberByRule[l];if("global"==a.range){for(var h=0;h<i.length&&r;h++){this.evalRule(i[h].getElementId(),a.rule,o)||(r=!1)}if(r)return{doChange:!0,retailArticleRules:a.retailArticleRules}}}return{doChange:!1}}},{key:"setConstructionRules",value:function setConstructionRules(t){t&&t.constructionRules&&(this.constructionRules=t.constructionRules,this.partlistHelper.setConstructionRules(t.constructionRules),this.constructionRulesLoaded=!0)}},{key:"getConstructionRulesLoaded",value:function getConstructionRulesLoaded(){return this.constructionRulesLoaded}},{key:"updateOptionLogicBoxPlanner",value:(t=(0,l.Z)(u().mark((function _callee(t,o,i,l){var r,a,h,c,d,g,E,p,O,R,k;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){u.next=3;break}return I.error(new m.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),u.abrupt("return");case 3:if(a=(new Date).getTime(),h=void 0,I.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),c=new Map,l)for(d=t.getAllElementIdsInGrid(),o=void 0,i=void 0,g=0;g<d.length;g++)this.getElementIsCornerElement(t.getElementById(d[g]),c)&&this.setOptionValue(d[g],"OPTELEMENT","OPVOFFENES_FACH",c);if(h=this.setAllOptToDefault(t,c,o,i),this.doCorrectAffectedElementsByOption(t,c,o,i),this.correctBottom(t,c,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,c,!0),this.correctSeries(t,c),this.constructionRules.coverPlateRule){E=_createForOfIteratorHelper(this.constructionRules.coverPlateRule);try{for(E.s();!(p=E.n()).done;)O=p.value,this.correctCoverPlate(O,t,c)}catch(t){E.e(t)}finally{E.f()}}for(g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctSimpleOpt(g,R,t,c,!1);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(R=0;R<t.getRowCount(g,!1);R++)this.correctSimpleOpt(g,R,t,c,!0);for(g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(g,R,!1).ElementId,t,c,!1),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(g,R,!1).ElementId,t,c);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(R=0;R<t.getRowCount(g,!1);R++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(g,R,!0).ElementId,t,c,!0),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(g,R,!0).ElementId,t,c);for(this.correctFoot(t,c),this.correctLadder(t,c),this.correctOptionsInfluencedByDimensions(t,c),this.correctOverHangingElement(null===(r=i)||void 0===r?void 0:r[0],t,c,o),this.partlistHelper.calculateKnots(t,c),this.partlistHelper.calculateRahmen(t,c),g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctBack(t,c,t.getPlannerElementAtGridPos(g,R,!1).getElementId());return k=this.doChangeRetailArticleNumbers(t,c),u.next=29,this.updateCfgValuesByPlanner(c,void 0,this.constructionRules.partlistRules.bundleRules,k);case 29:return I.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-a)),I.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-a)),u.abrupt("return",h);case 32:case"end":return u.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(o,i,l,r){return t.apply(this,arguments)})},{key:"onElemDeleted",value:function onElemDeleted(t){this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.delete(t)}},{key:"onElementCopy",value:function onElementCopy(t,o){if(this.hideOptionsForConstruction.has(t)){var i=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(o,(0,d.Z)(i))}}},{key:"getHasMaxElemCountPerColumn",value:function getHasMaxElemCountPerColumn(){return null!=this.constructionRules.maxElemCountPerCol}},{key:"getMaxElemCountPerColumn",value:function getMaxElemCountPerColumn(){return this.constructionRules.maxElemCountPerCol}},{key:"getForceWholePlanningSameHeight",value:function getForceWholePlanningSameHeight(){return this.constructionRules.forceWholePlanningSameHeight}}]);var t}(),O=i(64357),R=i(19610);function BoxPlannerGrid_createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function BoxPlannerGrid_unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return BoxPlannerGrid_arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?BoxPlannerGrid_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function BoxPlannerGrid_arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}function ownKeys(t,o){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),i.push.apply(i,l)}return i}function _objectSpread(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(i),!0).forEach((function(o){(0,h.Z)(t,o,i[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o))}))}return t}var k=m.ZP.initLog("Planner","BOX-PLANNER_GRID"),P=function(){return(0,a.Z)((function BoxPlannerGrid(t,o){(0,r.Z)(this,BoxPlannerGrid),(0,h.Z)(this,"plannerElements",void 0),(0,h.Z)(this,"generalPlanningState",void 0),(0,h.Z)(this,"hasActiveBackside",void 0),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"gridSetupParams",void 0),this.plannerElements=new Map,this.generalPlanningState={grids:[{matrix:[[]]}]},this.gridSetupParams=t,this.getValueOfOptionOfArticle=o,this.hasActiveBackside=!1}),[{key:"createNewCells",value:function createNewCells(t,o,i,l){if(this.gridSetupParams.forceSingleCellPerElement)return[{plannedElement:{elementId:t.ElementId,basketId:t.getBasketId(),size:{width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth()},articleCodex:t.ArticleCodex,area:{fromX:o,toX:o+1,fromY:i,toY:i+1}},index:new O.FM(o,i)}];this.gridSetupParams.forceFixCellRasterSize||k.error(new m.GE("Box planner with params forceSingleCellPerElement is false and forceFixCellRasterSize is false are not allowed"));for(var r=Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),a=Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterHeight),h=[],c=0;c<r;c++)for(var u=0;u<a;u++){var d={plannedElement:{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.ArticleCodex,size:{width:t.getWidth(),depth:t.getDepth(),height:t.getHeight()},area:{fromX:o,toX:o+t.getWidth()/this.gridSetupParams.fixCellRasterWidth,fromY:i,toY:i+t.getHeight()/this.gridSetupParams.fixCellRasterHeight}},index:new O.FM(o+c,i+u)};h.push(d)}return h}},{key:"createEmptyCells",value:function createEmptyCells(t,o,i,l,r,a){for(var h=[],c=t;c<=i;c++)for(var u=o;u<=l;u++){var m={plannerElementId:-1,width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:r,height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:a,index:new O.FM(c,u)};h.push(m)}return h}},{key:"getCellCount",value:function getCellCount(t){return this.gridSetupParams.forceSingleCellPerElement?{colCount:1,rowCount:1}:{colCount:Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),rowCount:Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterWidth)}}},{key:"getAllUsedCellsInGrid",value:function getAllUsedCellsInGrid(t){for(var o=new Array,i=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=0;l<i.length;l++)for(var r=0;r<i[l].length;r++)null!=i[l][r]&&o.push(i[l][r]);return o}},{key:"getGridColumnWidth",value:function getGridColumnWidth(t){for(var o=this.generalPlanningState.grids[0].matrix;t<o[0].length;t++){var i,l,r=o[t][0];if(r)return null!==(i=null===(l=r.plannedElement)||void 0===l?void 0:l.size.width)&&void 0!==i?i:0}return 0}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var o=0,i=!1,l=this.generalPlanningState.grids[0].matrix;if(l.length>t)for(var r=l[t],a=r.length-1;a>=0;a--){var h,c,u=r[a];!i&&u&&(i=!0),i&&(o+=null!==(h=null===(c=u.plannedElement)||void 0===c?void 0:c.size.height)&&void 0!==h?h:0),a=u.plannedElement?u.plannedElement.area.fromY-1:a-1}return o}},{key:"deleteElementByIdFromGrid",value:function deleteElementByIdFromGrid(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.endRowIndex-o.startRowIndex+1;this.getRowCount(o.startColIndex,o.backside),o.cells.reverse().forEach((function(t){i[t.index.x].splice(t.index.y,1),0==i[t.index.x].length&&i.splice(t.index.x,1)}));var r=[];i.forEach((function(t,o){r[o]=[],t.forEach((function(t,i){var l=t.plannedElement.area;r[o][i]={index:{x:o,y:i},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:o,fromY:i,toX:o+(l.toX-l.fromX),toY:i+(l.toY-l.fromY)}})}}))})),o.backside?this.generalPlanningState.grids[1].matrix=r:this.generalPlanningState.grids[0].matrix=r}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,o,i){var l=i?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(l[t]&&l[t][o]){var r,a=l[t][o];if(null==a)return;var h=null===(r=a.plannedElement)||void 0===r?void 0:r.elementId;if(!h)return;return this.plannerElements.get(h)}}},{key:"getCellsInGridByElementId",value:function getCellsInGridByElementId(t){var o,i,l,r,a,h,c=!1,u=this.generalPlanningState.grids[0].matrix,m=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix,d=[];if(u.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&d.push(o)}))})),null==m||m.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&(d.push(o),c=!0)}))})),0==d.length)return{cells:d,backside:c,startColIndex:0,endColIndex:0,startRowIndex:0,endRowIndex:0,colCount:0,rowCount:0};var g=null===(i=d[0].plannedElement)||void 0===i?void 0:i.area;return{cells:d,backside:c,startColIndex:null!==(l=null==g?void 0:g.fromX)&&void 0!==l?l:0,endColIndex:null!==(r=null==g?void 0:g.toX)&&void 0!==r?r:0,startRowIndex:null!==(a=null==g?void 0:g.fromY)&&void 0!==a?a:0,endRowIndex:null!==(h=null==g?void 0:g.toY)&&void 0!==h?h:0,colCount:g?g.toX-g.toX:0,rowCount:g?g.toY-g.fromY:0}}},{key:"GridSetupParams",set:function set(t){this.gridSetupParams=t}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){return Array.from(this.plannerElements.keys())}},{key:"_getAllElementsInGrid",value:function _getAllElementsInGrid(t){for(var o=[],i=[],l=0;l<t.length;l++)for(var r=0;r<t[l].length;r++){var a,h=t[l][r];null!=h&&(null!==(a=h.plannedElement)&&void 0!==a&&a.elementId&&-1==o.indexOf(h.plannedElement.elementId)&&(o.push(h.plannedElement.elementId),i.push(this.plannerElements.get(h.plannedElement.elementId))))}return i}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[0].matrix)}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix)}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix).map((function(t){return t.ElementId}))}},{key:"getAllElementsInGridSortedbyElementId",value:function getAllElementsInGridSortedbyElementId(){return Array.from(this.plannerElements.values())}},{key:"getAllElementsInGridSortedbyGridPos",value:function getAllElementsInGridSortedbyGridPos(){for(var t,o,i=[],l=[],r=this.generalPlanningState.grids[0].matrix,a=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:0,h=0;h<r.length;h++)for(var c=0;c<r[h].length;c++){var u,m=r[h][c],d=null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;if(m&&d&&-1==l.indexOf(d)){var g=this.getElementById(d);l.push(d),i.push(g)}}for(h=0;h<a.length;h++)for(c=0;c<a[h].length;c++){var E,I=a[h][c],p=null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(I&&p&&-1==l.indexOf(p)){var O=this.getElementById(p);l.push(p),i.push(O)}}return i}},{key:"getElementById",value:function getElementById(t){return this.plannerElements.get(t)}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var o=this.getCellsInGridByElementId(t);return 0!=o.cells.length&&(0==o.cells[0].index.x&&0==o.cells[0].index.y&&!o.backside)}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,o){var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return this.getCellsInGridByElementId(t).endColIndex==i.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){for(var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.startColIndex;l<o.endColIndex;l++)if(i[l].length>o.endRowIndex&&i[l][o.endRowIndex])return!0;return!1}},{key:"getTopElements",value:function getTopElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.toY];h;){var c=h.plannedElement;if(!c)break;r.push(this.plannerElements.get(c.elementId)),h=l[c.area.fromX][c.area.toY]}return r}},{key:"getTopRightElement",value:function getTopRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.endRowIndex&&i[o.endColIndex][o.endRowIndex]){var l=i[o.endColIndex][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(o.startColIndex>0&&i[o.startColIndex-1].length>0&&i[o.startColIndex-1][o.endRowIndex]){var l=i[o.startColIndex-1][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getCellsInGridByElementId(t).startRowIndex-1>=0}},{key:"getBottomElements",value:function getBottomElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.fromY-1];h;){var c,u=h.plannedElement;if(!u)break;r.push(this.plannerElements.get(u.elementId)),h=null===(c=l[u.area.fromX])||void 0===c?void 0:c[u.area.fromY-1]}return r}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.startRowIndex&&i[o.endColIndex][o.startRowIndex])return!0;return!1}},{key:"getRightElements",value:function getRightElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,m=null===(c=i[a.area.toX])||void 0===c?void 0:c[h],d=null==m||null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;m&&d&&-1==r.indexOf(d)&&(r.push(d),l.push(this.plannerElements.get(d)))}return l}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return!!(o.startColIndex>0&&i[o.startColIndex-1][o.startRowIndex])}},{key:"getLeftElements",value:function getLeftElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,m=null===(c=i[a.area.fromX-1])||void 0===c?void 0:c[h],d=null==m||null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;m&&d&&-1==r.indexOf(d)&&(r.push(d),l.push(this.plannerElements.get(d)))}return l}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,o){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=[];if(!l[t])return r;if(i)for(var h=0;h<l[t].length;h++){var c,u=l[t][h],m=null==u||null===(c=u.plannedElement)||void 0===c?void 0:c.elementId;m&&u&&-1==a.indexOf(m)&&(a.push(m),r.push(this.plannerElements.get(m)))}else for(h=l[t].length-1;h>=0;h--){var d,g=l[t][h],E=null==g||null===(d=g.plannedElement)||void 0===d?void 0:d.elementId;g&&E&&-1==a.indexOf(E)&&(a.push(E),r.push(this.plannerElements.get(E)))}return r}},{key:"getColumnCount",value:function getColumnCount(){return this.generalPlanningState.grids[0].matrix.length}},{key:"getRowCount",value:function getRowCount(t,o){return o?this.generalPlanningState.grids[1].matrix[t].length:this.generalPlanningState.grids[0].matrix[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,o){for(var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=0;a<i.length;a++)if(i[a].length>t){var h,c=i[a][t],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==r.indexOf(u)&&(r.push(u),l.push(this.plannerElements.get(u)))}return l}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var o=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,i=0,l=0;l<o.length;l++)for(var r=o[l].length;r>=0;r--){if(o[l][r]){i<r&&(i=r);break}}return i+1}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i,l,r,a,h,c,u,m,d=this.getCellsInGridByElementId(t),g=d.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,E=[],I=d.cells[0].plannedElement;if(!I)return E;switch(o){case"RIGHT":var p=null===(i=g[I.area.toX])||void 0===i||null===(i=i[I.area.fromY])||void 0===i||null===(i=i.plannedElement)||void 0===i?void 0:i.elementId;p==(null===(l=g[I.area.toX])||void 0===l||null===(l=l[I.area.toY-1])||void 0===l||null===(l=l.plannedElement)||void 0===l?void 0:l.elementId)&&p&&E.push(this.plannerElements.get(p));break;case"LEFT":var O=null===(r=g[I.area.fromX-1])||void 0===r||null===(r=r[I.area.fromY])||void 0===r||null===(r=r.plannedElement)||void 0===r?void 0:r.elementId;O==(null===(a=g[I.area.fromX-1])||void 0===a||null===(a=a[I.area.toY-1])||void 0===a||null===(a=a.plannedElement)||void 0===a?void 0:a.elementId)&&O&&E.push(this.plannerElements.get(O));break;case"TOP":var R=null===(h=g[I.area.fromX])||void 0===h?void 0:h[I.area.toY],k=null==R||null===(c=R.plannedElement)||void 0===c?void 0:c.elementId;k&&E.push(this.plannerElements.get(k));break;case"DOWN":var P=null===(u=g[I.area.fromX])||void 0===u?void 0:u[I.area.fromY-1],v=null==P||null===(m=P.plannedElement)||void 0===m?void 0:m.elementId;v&&E.push(this.plannerElements.get(v));break;case"BACK":if(this.hasActiveBackside){var T=this.getPlannerElementAtGridPos(d.startColIndex,d.startRowIndex,!0);null!=T&&(E=[T])}}return E}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var o=this.getCellsInGridByElementId(t);return o.backside?this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!1):this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!0)}}},{key:"getOppositeElements",value:function getOppositeElements(t){var o=[];if(this.hasActiveBackside)for(var i=0;i<t.length;i++){var l=this.getOppositeElement(t[i]);null!=l&&o.push(l)}return o}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(t){for(var o=0,i=0,l=0,r=[],a=this.generalPlanningState.grids[0].matrix,h=0;h<a.length;){for(var c,u,m=0,d=a[h],g=0;g<d.length;){var E,I,p,R=d[g],k=null===(E=R)||void 0===E||null===(E=E.plannedElement)||void 0===E?void 0:E.elementId;k&&R&&-1==r.indexOf(k)&&(m+=this.plannerElements.get(k).getHeight(),0==h&&0==g&&(i=this.plannerElements.get(k).getDepth())),g=null!==(I=null===(p=R.plannedElement)||void 0===p?void 0:p.area.toY)&&void 0!==I?I:g+1}m>l&&(l=m);var P=this.getGridColumnWidth(h);t&&h>0&&(77.9==P?P=75:40.4==P?P=37.5:21.7==P&&(P=18.75)),o+=P,h=null!==(c=null===(u=d[0].plannedElement)||void 0===u?void 0:u.area.toX)&&void 0!==c?c:h+1}return this.hasActiveBackside&&(i*=2),new O.P(o,l,i)}},{key:"getHighestElementsPerSeries",value:function getHighestElementsPerSeries(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.hasActiveBackside)throw new Error("this function is doesnt implement the backside logic (yet)");for(var o=[],i=-1,l=0;l<this.getColumnCount();){for(var r=this.generalPlanningState.grids[0].matrix[l],a=0,h=0;h<r.length;){var c=r[h].plannedElement;a+=c.size.height,h=c.area.toY}Math.round(a)==Math.round(i)||t?(o[o.length-1]||o.push([]),o[o.length-1].push(this.getPlannerElementAtGridPos(l,r.length-1,!1))):o.push([this.getPlannerElementAtGridPos(l,r.length-1,!1)]),i=a,l=r[r.length-1].plannedElement?r[r.length-1].plannedElement.area.toX:l+1}return o}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInRow(o.startRowIndex,!1);return this.hasActiveBackside&&(i=i.concat(this.getAllElementsInRow(o.startRowIndex,!0))),{elementIds:i.map((function(t){return t.ElementId})),plannerElements:i,backside:o.backside}}},{key:"getAllElementsToFillUp",value:function getAllElementsToFillUp(t,o){for(var i=this,l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement,a=l.startColIndex,h=l.startRowIndex,c=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],m=[],d=function _loop(t){var l,h=null===(l=c[a][t])||void 0===l?void 0:l.plannedElement;if(!h)return g=t,1;var d=r.area.toX-r.area.fromX,E="RIGHT"==o?+d:-d,I=c.every((function(o,i){var l;return i<r.area.fromX+E||i>=r.area.toX+E||(null===(l=o[t])||void 0===l?void 0:l.plannedElement)}));0==i.getNeighborElements(h.elementId,o).length&&!I&&h?u.push(h.elementId):h&&m.push(h.elementId),t=h.area.toY,g=t},g=0;g<=h&&!d(g););return{elements:0==u.length?m:u,backside:l.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var o=this.getCellsInGridByElementId(t);if(0==o.startRowIndex)return{elements:[],backside:!1};for(var i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=o.startColIndex;r<o.endColIndex;r++)for(var a=o.startRowIndex--;a>=0;a--){var h,c=i[r][a],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==l.indexOf(u)&&l.push(u)}return{elements:l,backside:o.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInColumn(o.startColIndex,o.backside);return null==i&&(i=[]),{elements:i.map((function(t){return t.ElementId})),backside:o.backside}}},{key:"prepareGridForColCopy",value:function prepareGridForColCopy(t,o){var i,l,r;if(!(o.y>0)){var a=this.getCellsInGridByElementId(t),h=o.x>0,c=a.cells[0].plannedElement,u={x:c.area.toX-1+o.x,y:c.area.fromY+o.y};o.x<0&&(u.x=a.cells[0].plannedElement.area.fromX-1);var m=this.generalPlanningState.grids[0].matrix,d=null!==(i=null===(l=this.generalPlanningState.grids[1])||void 0===l?void 0:l.matrix)&&void 0!==i?i:0,g=c.area.toX-c.area.fromX,E=null===(r=m[a.cells[0].index.x+o.x])||void 0===r?void 0:r[a.cells[0].index.y];(-1==u.x||E&&!h)&&(u.x-=o.x),m=moveGrid(this.getAllUsedCellsInGrid(!1));for(var I=0;I<g;I++)m[u.x+I]||(m[u.x+I]=[]);if(this.generalPlanningState.grids[0].matrix=m,this.hasActiveBackside){d=moveGrid(this.getAllUsedCellsInGrid(!0));for(var p=0;p<g;p++)d[u.x+p]||(d[u.x+p]=[]);this.generalPlanningState.grids[1].matrix=d}}function moveGrid(t){var o=new Array,i=t.filter((function(t){return t.index.x==c.area.toX})),l=i.find((function(t){return t.index.y==u.y})),r=t.filter((function(t){return t.index.x==c.area.fromX-1})),a=r.find((function(t){return t.index.y==u.y}));return t.forEach((function(t){t.index.x>=u.x&&(h&&(l||0==i.length)||!h&&(a||0==r.length)||-1==u.x)&&(t.index.x+=g,t.plannedElement.area.fromX+=g,t.plannedElement.area.toX+=g),o[t.index.x]||(o[t.index.x]=[]),o[t.index.x][t.index.y]=t})),o}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.generalPlanningState.grids[1]={matrix:[[]]},this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,o,i,l){for(var r=l?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=this.createNewCells(t,o,i,l),h=0;h<a.length;h++){var c=a[h];r[c.index.x]||(r[c.index.x]=[]),r[c.index.x][c.index.y]=c}this.plannerElements.set(t.getElementId(),t),l&&(this.hasActiveBackside=!0)}},{key:"moveElementAsCopy",value:function moveElementAsCopy(t,o){var i=this.plannerElements.get(t),l=this.getCellsInGridByElementId(t);if(i){this.deleteElement(t,"STD");var r=this.generalPlanningState.grids[0].matrix,a=void 0;if(o.x<0||0==o.y&&l.endRowIndex>=o.x){var h=l.endColIndex>=o.x;l.startColIndex>=o.x&&(o.x-=l.endColIndex-l.startColIndex),o.x<0&&(o.x=0),a=this.createNewCells(i,o.x,o.y,!1);var c=[],u=a[0].plannedElement;r.forEach((function(t,i){t.forEach((function(t,l){var a=i,m=0;l==o.y&&(a+=h?u.area.toX-u.area.fromX:-(u.area.toX-u.area.fromX),m=h?u.area.toX-u.area.fromX:-(u.area.toX-u.area.fromX)),c[a]||(c[a]=[]);var d=r[i][l].plannedElement,g={plannedElement:_objectSpread(_objectSpread({},d),{},{area:{fromX:a,toX:d.area.toX+m,fromY:d.area.fromY,toY:d.area.toY}}),index:{x:a,y:l}};c[a][l]=g}))})),r=c}else o.x>l.startColIndex&&o.y==l.startRowIndex&&(o.x-=l.endColIndex-l.startColIndex),a=this.createNewCells(i,o.x,o.y,!1);for(var m=0;m<a.length;m++)r[a[m].index.x]||(r[a[m].index.x]=[]),r[a[m].index.x][a[m].index.y]=a[m];this.plannerElements.set(t,i),this.generalPlanningState.grids[0].matrix=r}}},{key:"addElementAsCopy",value:function addElementAsCopy(t,o,i){var l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement.area,a={x:r.fromX,y:r.fromY};i.x>0?a.x=r.toX-1+i.x:i.x<0?a.x=r.fromX-(r.toX-r.fromX):i.y>0&&(a.y=r.toY-1+i.y);var h=-1==i.z||1==l.backside;a.x<0&&(a.x=0);var c=h?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;c[a.x].length<a.y&&(a.y=c[a.x].length);for(var u=this.createNewCells(o,a.x,a.y,h),m=0;m<u.length;m++)c[u[m].index.x]||(c[u[m].index.x]=[]),c[u[m].index.x][u[m].index.y]=u[m];this.plannerElements.set(o.getElementId(),o)}},{key:"deleteElement",value:function deleteElement(t,o){this.plannerElements.has(t)||k.error(new m.GE("Try to delete an elementId that does not exist"));this.getCellsInGridByElementId(t);R.Z.removeDockingPointRelations(this.plannerElements.get(t)),this.deleteElementByIdFromGrid(t),this.plannerElements.delete(t),this.hasActiveBackside}},{key:"updateGridElementDimensions",value:function updateGridElementDimensions(t,o){var i=this;if(o){var l=this.getCellsInGridByElementId(t),r=this.gridSetupParams.forceSingleCellPerElement;if(l.cells.forEach((function(t){t.plannedElement&&(t.plannedElement.size.width=o.width,t.plannedElement.size.height=o.height,t.plannedElement.area={fromX:t.index.x,toX:r?t.index.x+1:Math.round(t.index.x+o.width/i.gridSetupParams.fixCellRasterWidth),fromY:t.index.y,toY:r?t.index.y+1:Math.round(t.index.y+o.height/i.gridSetupParams.fixCellRasterHeight)})})),!r){var a=new Array;this.getAllUsedCellsInGrid(!1).forEach((function(t){var o=t.plannedElement.area;if(!a.find((function(o){return o.find((function(o){var i,l;return(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==(null===(l=t.plannedElement)||void 0===l?void 0:l.elementId)}))})))for(var l=o.fromX;l<o.toX;l++)for(var r=function _loop2(r){if(a[l]||(a[l]=[]),r<o.fromY){if(a[l][r])return 0;var h=i.generalPlanningState.grids[0].matrix.findLast((function(t){return t[r].plannedElement}));return a[l][r]={index:{x:l,y:r},plannedElement:h&&h.length>0?h[0].plannedElement:void 0},0}a[l][r]=_objectSpread(_objectSpread({},t),{},{index:{x:l,y:r},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:l,toX:l+(t.plannedElement.area.toX-t.plannedElement.area.fromX),fromY:r,toY:r+(t.plannedElement.area.toY-t.plannedElement.area.fromY)}})})},h=0;h<o.toY;h++)r(h)})),l.backside?this.generalPlanningState.grids[1].matrix=a:this.generalPlanningState.grids[0].matrix=a}}}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){var t,o,i,l=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(l.s();!(i=l.n()).done;){var r=i.value;R.Z.removeDockingPointRelations(r)}}catch(t){l.e(t)}finally{l.f()}for(var a=1,h=[],c=this.generalPlanningState.grids[0].matrix,u=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:[],d=0;d<c.length;d++)for(var g=0;g<c[d].length;g++){var E,I=c[d][g],p=null==I||null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(p&&-1==h.indexOf(p)){var O=this.plannerElements.get(p);h.push(p);var P=this.getNeighborElements(p,"TOP"),v=this.getNeighborElements(p,"RIGHT"),T=this.getNeighborElements(p,"LEFT");P.length>0&&R.Z.tryDockElement(O,"AVO",[P[0]]),T.length>0&&R.Z.tryDockElement(O,"AVL",[T[0]]),v.length>0&&R.Z.tryDockElement(O,"AVR",[v[0]]),O.PosNr=a,a++}}for(var V=0;V<u.length;V++)for(var _=0;_<u[V].length;_++){var B,C=u[V][_],x=null==C||null===(B=C.plannedElement)||void 0===B?void 0:B.elementId;if(x&&-1==h.indexOf(x)){var y=this.plannerElements.get(x);h.push(x);var H=c[V][_],b=this.plannerElements.get(H.plannedElement.elementId);if(b){var G=null==b?void 0:b.getDockingPointById("AVO_AVO_2_IL");G?y&&R.Z.tryDockElementToDP(y,b,G):k.error(new m.GE("Error Loading DockingPoint AVO_2 for plannerElement"))}var D=this.getNeighborElements(x,"TOP"),L=this.getNeighborElements(x,"RIGHT");D.length>0&&R.Z.tryDockElement(y,"AVO",[D[0]]),L.length>0&&R.Z.tryDockElement(y,"AVL",[L[0]]),y.PosNr=a,a++}}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){var t,o=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(o.s();!(t=o.n()).done;){t.value.destroy()}}catch(t){o.e(t)}finally{o.f()}this.plannerElements.clear(),this.generalPlanningState.grids[0].matrix=[],this.hasActiveBackside&&(this.hasActiveBackside=!1,this.generalPlanningState.grids[1].matrix=[])}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;var t,o=this.getAllElementsInBackGrid(),i=BoxPlannerGrid_createForOfIteratorHelper(o.values());try{for(i.s();!(t=i.n()).done;){var l=t.value;this.plannerElements.delete(l.ElementId),l.destroy()}}catch(t){i.e(t)}finally{i.f()}o=[],this.generalPlanningState.grids[1].matrix=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getForceSingleCellPerElement",value:function getForceSingleCellPerElement(){return this.gridSetupParams.forceSingleCellPerElement}},{key:"getBoundingBox",value:function getBoundingBox(){var t,o,i=this.generalPlanningState.grids[0].matrix,l=null==i||null===(t=i[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.plannedElement,r=0,a=0,h=0,c=0,u=0,m=l?l.size.depth:0,d=0;o="RIGHT";for(var g=[],E=0;E<i.length;E++){var I,p=i[E][0];if(!p)break;var O=null===(I=p.plannedElement)||void 0===I?void 0:I.elementId;if(O&&-1==g.indexOf(O)){g.push(O);var R=this.plannerElements.get(O);if(!R)continue;var k=this.getValueOfOptionOfArticle(O,"OPTELEMENT");"RIGHT"==o?c+=R.getWidth():"FRONT"==o?m+=R.getWidth():"LEFT"==o?c-=R.getWidth():"BACK"==o&&(m-=R.getWidth()),"OPVECK_I"==k?"RIGHT"==o?o="FRONT":"FRONT"==o?o="LEFT":"LEFT"==o?o="BACK":"BACK"==o&&(o="RIGHT"):"OPVECK_A"==k&&("RIGHT"==o?o="BACK":"FRONT"==o?o="RIGHT":"LEFT"==o?o="FRONT":"BACK"==o&&(o="LEFT")),c<a&&(a=c),c>h&&(h=c),m<u&&(u=m),m>d&&(d=m);var P=this.getGridColumnHeight(E);r=r<P?P:r}}var v=d-u,T=h-a;return this.hasActiveBackside&&(v=2*m),{width:Math.round(1e3*T)/1e3,height:Math.round(1e3*r)/1e3,depth:Math.round(1e3*v)/1e3}}},{key:"getFreeMoveLocation",value:function getFreeMoveLocation(t){var o=this.getElementById(t);if(!o)return[];var i=this.getCellsInGridByElementId(t);if(0===i.cells.length)return[];var l,r=[],a=function isEmptyCell(t,o){var i;return void 0===(null===(i=h[t])||void 0===i?void 0:i[o])},h=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,c=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.keys());try{for(c.s();!(l=c.n()).done;){var u=l.value;if(u!=t){var m=this.getElementById(u);if(this.gridSetupParams.forceSingleCellPerElement){if(!this.getElementHasTopElement(u)&&m.getWidth()==o.getWidth()){var d=this.getCellsInGridByElementId(u),g=this.getAllElementsInRow(d.endRowIndex+1,d.backside);if(g.length>0&&g[0].getHeight()!=o.getHeight())continue;var E=this.createLocationInformation(o,i.backside,this.createEmptyCells(d.cells[0].plannedElement.area.fromX,d.cells[0].plannedElement.area.toX,d.cells[0].plannedElement.area.fromY,d.cells[0].plannedElement.area.toY+1,o.getWidth(),o.getHeight()),d.cells[0].plannedElement.area.fromX,d.cells[0].plannedElement.area.toX,1,1);r.push(E)}}else for(var I=this.getCellsInGridByElementId(u),p=-1,O=-1,R=I.cells[0].plannedElement.area.toY+1,k=I.startColIndex;k<=I.startColIndex+I.colCount-1;k++){var P=!1;if(a(k,R)){if(-1==p?(p=k,O=k):O=k,k==I.startColIndex+I.colCount-1)if(i.colCount<=O-p+1)P=!0;else{P=!0;for(var v=0;v<i.colCount;v++)if(a(p+v,I.endRowIndex)){P=!1;break}}}else i.colCount<=O-p+1&&(P=!0);if(P){var T=this.createLocationInformation(o,i.backside,this.createEmptyCells(p,I.endRowIndex+1,p+i.colCount-1,I.endRowIndex+i.rowCount-1,o.getWidth(),o.getHeight()),p,I.endRowIndex+1,i.colCount,i.rowCount);r.push(T)}}}}}catch(t){c.e(t)}finally{c.f()}var V=this.createLocationInformation(o,i.backside,this.createEmptyCells(-i.colCount,0,-1,i.rowCount-1,o.getWidth(),o.getHeight()),-i.colCount,0,i.colCount,i.rowCount);r.push(V);var _=this.createLocationInformation(o,i.backside,this.createEmptyCells(this.getColumnCount(),0,this.getColumnCount()+i.colCount-1,i.rowCount-1,o.getWidth(),o.getHeight()),this.getColumnCount(),0,i.colCount,i.rowCount);return r.push(_),r}},{key:"getFreePlanningLocation",value:function getFreePlanningLocation(t,o){var i=this.getElementById(t);if(i){var l=this.getCellsInGridByElementId(t);if(0!==l.cells.length){var r=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=l.startColIndex,h=l.endColIndex,c=l.startRowIndex,u=l.endRowIndex,m=-1,d=-1,g=-1,E=-1,I=[],p=function isValidCell(t,o){var i;return void 0===(null===(i=r[t])||void 0===i?void 0:i[o])};switch(o){case"LEFT":for(var O=a-1,R=!1,k=c;k<=u;k++)if(p(O,k)){d=k,R=!0;break}if(!R)return;R=!1;for(var P=a-1;P>=a-l.colCount&&(p(P,d)&&(0==d||!p(P,d-1)));P--)R=!0,m=P;if(!R)return;g=a-1,E=u,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;case"TOP":for(var v=u+1,T=!1,V=h;V>=a;V--)p(V,v)&&(m=V,T=!0);if(!T)return;d=v,g=h,E=v+l.rowCount-1,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;case"RIGHT":for(var _=h,B=!1,C=c;C<=u;C++)if(p(_,C)){d=C,B=!0;break}if(!B)return;B=!1;for(var x=h;x<=h+l.colCount&&(p(x,d)&&(0==d||!p(x,d-1)));x++)g=x,B=!0;if(!B)return;m=h,E=u,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;default:return}return this.createLocationInformation(i,l.backside,I,m,d,g-m+1,E-d+1)}}}},{key:"createLocationInformation",value:function createLocationInformation(t,o,i,l,r,a,h){var c=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u={cells:i,widthPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),heightPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depthPerCell:t.getDepth(),width:this.gridSetupParams.forceFixCellRasterSize?a*this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?h*this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth(),startIndexWorldPos:new O.FM(0,0)};if(this.gridSetupParams.forceFixCellRasterSize)u.startIndexWorldPos=new O.FM(l*this.gridSetupParams.fixCellRasterWidth,r*this.gridSetupParams.fixCellRasterHeight);else{for(var m=0,d=0;d<l;d++){var g,E;m+=null!==(g=null===(E=c[d][0].plannedElement)||void 0===E?void 0:E.size.width)&&void 0!==g?g:0}l<0&&(m=-t.getWidth());var I=0;for(d=0;d<r;d++){var p,R;I+=null!==(p=null===(R=c[l][d].plannedElement)||void 0===R?void 0:R.size.width)&&void 0!==p?p:0}u.startIndexWorldPos=new O.FM(m,I)}return u}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){for(var t=this.getAllElementsInGridSortedbyGridPos(),o={boxPlannerInteractionInformationPerElement:new Map},i=0;i<t.length;i++){var l=t[i],r=this.getCellsInGridByElementId(l.getElementId()),a=r.cells[0].plannedElement.area,h=this.createLocationInformation(l,r.backside,r.cells,a.fromX,a.toX,a.fromY,a.toY),c=this.getFreePlanningLocation(l.getElementId(),"LEFT"),u=this.getFreePlanningLocation(l.getElementId(),"RIGHT"),m=this.getFreePlanningLocation(l.getElementId(),"TOP"),d=this.getElementHasTopElement(l.getElementId()),g=[];!d&&t.length>1&&(g=this.getFreeMoveLocation(l.getElementId()));var E={location:h,isDeletable:!d&&t.length>1,availablePlanningLocations:{availableBoxPlannerCellsLeft:c,availableBoxPlannerCellsTop:m,availableBoxPlannerCellsRight:u},availableMovingLocations:g};o.boxPlannerInteractionInformationPerElement.set(l.getElementId(),E)}return o}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(){var t,o,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1?arguments[1]:void 0;if(!i)return this.generalPlanningState;var r=this.generalPlanningState.grids[0].matrix,a=[],h=r.length,c=0;r.forEach((function(t){t.length>c&&(c=t.length)}));Array.from(this.plannerElements.values()).map((function(t){return{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.getArticleCodex(),size:{width:t.getWidth(),height:t.getHeight(),depth:t.getDepth()},area:{fromX:void 0,toX:void 0,fromY:void 0,toY:void 0}}}));var u=!1,m=void 0,g=void 0;if(l){var E=this.getCellsInGridByElementId(l);m={articleCodex:(g=E.cells[0].plannedElement).articleCodex,elementId:g.elementId,gridSpace:{rows:g.area.toY-g.area.fromY+1,colums:g.area.toX-g.area.fromX+1},area:g.area,size:g.size,rules:[]},u=!!r.find((function(t,o){return o>=g.area.fromX&&o<g.area.toX&&r[o].length>g.area.toY}))}if(u)return this.generalPlanningState;for(var I=0;I<h;I++){var p=0==g.area.fromX?I:I+1;a[p]||r[I]&&(a[p]=(0,d.Z)(r[I]));for(var O=0;O<c;O++)if(r[I].length>O&&r[I][O]){a[p][O].plannedElement;a[p][O]=_objectSpread({},r[I][O])}}var R=0==g.area.fromX?g.area.fromX:g.area.fromX+1,k=0==g.area.fromX?g.area.toX:g.area.toX+1;a.forEach((function(t,o){if(!(o>=R&&o<k)){var i=a[o],l=i.length,r=0==g.fromX?o:o-1;i[l]={index:{x:r,y:l}}}}));var P=a.length;return(null===(t=g)||void 0===t?void 0:t.area.toX)!=r.length&&(a[P]=[{index:{x:0==g.fromX?P:P-1,y:0}}]),0!=(null===(o=g)||void 0===o?void 0:o.area.fromX)&&(a[0]=[{index:{x:-1,y:0}}]),_objectSpread(_objectSpread({},this.generalPlanningState),{},{selectedElement:m,grids:[_objectSpread(_objectSpread({},this.generalPlanningState.grids[0]),{},{matrix:a})]})}},{key:"getRowSizes",value:function getRowSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t[0].length,l=Array(i).fill(-1),r=function _loop3(i){var r,a=null===(r=t.find((function(t){var o,l;return void 0!==(null===(o=t[i].plannedElement)||void 0===o?void 0:o.size.height)&&-1!=(null===(l=t[i].plannedElement)||void 0===l?void 0:l.size.height)})))||void 0===r?void 0:r[i];if(null!=a&&a.plannedElement?l[i]=a.plannedElement.size.height:o&&(l[i]=o.size.height),-1===l[i])return 1},a=0;a<i&&!r(a);a++);return l.includes(-1)&&k.error(new Error("Column sizes are not set")),l}return 15}},{key:"getColumnSizes",value:function getColumnSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t.length,l=Array(i).fill(-1),r=0;r<i;r++){var a=t[r].find((function(t){return t.plannedElement}));if(null!=a&&a.plannedElement?l[r]=a.plannedElement.size.width:o&&(l[r]=o.size.width),!l.includes(-1))break}if(l.includes(-1))throw new Error("Row sizes are not set");return l}return 15}},{key:"addFreeCellsToMatrix",value:function addFreeCellsToMatrix(t,o,i){o.forEach((function(o){var i=o.index.x,l=o.index.y,r=t.find((function(t){return t.find((function(t){return t.index.x===i}))}));if(!r){for(var a=[],h=0;h<t[0].length;h++)a.push({index:new O.FM(i,h),plannedElement:void 0});t[0][0].index.x>i?t.unshift(a):t.push(a)}var c=t.find((function(t){return t.find((function(t){return t.index.y===l}))}));c||t.map((function(t){var o;return t.push({index:new O.FM((null===(o=t[0])||void 0===o?void 0:o.index.x)||0,l),plannedElement:void 0})}))})),i.push({type:"FixedPositon",grids:[{gridIndex:0,places:[{lowestX:Math.min.apply(Math,(0,d.Z)(o.map((function(t){return t.index.x})))),lowestY:Math.min.apply(Math,(0,d.Z)(o.map((function(t){return t.index.y}))))}]}]})}}])}(),v=i(57330),T=i(57312),V=i(58178),_=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),B=function(){function DivaBoxPlanner(t,o){(0,r.Z)(this,DivaBoxPlanner),(0,h.Z)(this,"set",void 0),(0,h.Z)(this,"plannerID",void 0),(0,h.Z)(this,"constructionRulesHandler",void 0),(0,h.Z)(this,"boxPlannerGrid",void 0),(0,h.Z)(this,"nextElementId",1),this.set=t,this.plannerID=o,this.constructionRulesHandler=new p(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner);this.boxPlannerGrid=new P({hasMaxGridRasterHeight:!1,hasMaxGridRasterWidth:!1,forceSingleCellPerElement:!0,forceFixCellRasterSize:!1},this.set.getValueOfOptionOfArticle)}return(0,a.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(E=(0,l.Z)(u().mark((function _callee(t){var o,i,l,r,a,h,c,d,g,E;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null==(o=JSON.parse(m.ZP.decodeBase64(t))).v||2!=o.v){u.next=26;break}if(o.set&&o.set.elements&&0!=o.set.elements.length){u.next=4;break}return u.abrupt("return");case 4:i=o.set.elements,l=0;case 6:if(!(l<i.length)){u.next=21;break}return r=i[l],a=parseInt(r.elementID),h=new T.Z(this.set.getSetId(),r.basketID,a,DivaBoxPlanner.plannerType),this.nextElementId<a+1&&(this.nextElementId=a+1),this.set.setElementId(r.basketID,h.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(h.ElementId)),(c=this.set.getPlannerData(h.ElementId))&&h.updatePlannerData(c),u.next=17,v.Z.loadSVG(h,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(h,r.boxPlannerInfo.gridPosCol,r.boxPlannerInfo.gridPosRow,r.boxPlannerInfo.isOnBackside);case 18:l++,u.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:u.next=42;break;case 26:d=1,l=0;case 28:if(!(l<o.Elements.length)){u.next=38;break}return g=o.Elements[l],(a=parseInt(g.ID))>d&&(d=a),E={boxElementID:g.ID,boxCol:g.col,boxRow:g.row,boxUpdateWholePlanning:!1},u.next=35,this.addPlannerElement(g.BasketID,E);case 35:l++,u.next=28;break;case 38:return this.nextElementId=d+1,this.boxPlannerGrid.updateWorldPosOfElements(),u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return u.abrupt("return",o);case 43:case"end":return u.stop()}}),_callee,this)}))),function initPlanner(t){return E.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=this.boxPlannerGrid.getElementById(o[i]);if(l){for(var r=this.boxPlannerGrid.getCellsInGridByElementId(o[i]),a=l.getDockingDockingPoints(),h=[],c=0;c<a.length;c++){var u,m={id:a[c].DpId,onID:a[c].OnElementId,onDPID:null===(u=a[c].OnDP)||void 0===u?void 0:u.DpId};h.push(m)}var d={elementID:l.getElementId(),basketID:this.set.getBasketId(l.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(l.getElementId()),posNr:l.PosNr,x:l.WorldPosCenter.x,y:l.WorldPosCenter.y,z:l.WorldPosCenter.z,rot:l.RotDeg,width:l.Width?l.Width:-1,height:l.Height?l.Height:-1,depth:l.Depth?l.Depth:-1,DP:h,boxPlannerInfo:{gridPosCol:r.startColIndex,gridPosRow:r.startRowIndex,isOnBackside:r.backside}};t.push(d)}}var g=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:g.width,height:g.height,depth:g.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(g=(0,l.Z)(u().mark((function _callee2(t,o){var i,l,r,a,h;return u().wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:if(null!=o&&null!=o.boxElementID&&null!=o.boxCol&&null!=o.boxRow){c.next=2;break}return c.abrupt("return");case 2:return i=new T.Z(this.set.getSetId(),t,o.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(o.boxElementID)?this.nextElementId:o.boxElementID+1,this.set.setElementId(t,i.ElementId),l=this.set.getPlannerData(i.ElementId),i.updatePlannerData(l),c.next=9,v.Z.loadSVG(i,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||(r=this.set.getConstructionRuleOfElementId(i.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(a=r.constructionRules.forceFixCellRasterSize)||void 0===a||a,forceSingleCellPerElement:null===(h=r.constructionRules.forceSingleCellPerElement)||void 0===h||h,hasMaxGridRasterHeight:r.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:r.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:r.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:r.constructionRules.maxGridRasterWidth},this.constructionRulesHandler.setConstructionRules(r)),this.boxPlannerGrid.addElementAtGridPos(i,o.boxCol,o.boxRow,null!=o.backside&&o.backside),!o.boxUpdateWholePlanning){c.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),c.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return c.stop()}}),_callee2,this)}))),function addPlannerElement(t,o){return g.apply(this,arguments)})},{key:"extendPlanner",value:(d=(0,l.Z)(u().mark((function _callee3(t,o){return u().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),_callee3)}))),function extendPlanner(t,o){return d.apply(this,arguments)})},{key:"movePlannerElement",value:(c=(0,l.Z)(u().mark((function _callee4(t,o){return u().wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return this.boxPlannerGrid.moveElementAsCopy(t,o),this.boxPlannerGrid.updateWorldPosOfElements(),i.next=4,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,"",[t]);case 4:case"end":return i.stop()}}),_callee4,this)}))),function movePlannerElement(t,o){return c.apply(this,arguments)})},{key:"copyPlannerElement",value:(i=(0,l.Z)(u().mark((function _callee5(t,o){var i,l,r,a,h,c,m=this;return u().wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(i=!1,o){u.next=3;break}return u.abrupt("return");case 3:"STD"==o.copyType&&(o.targetElements=[]),l=[],r=this,t.forEach((function(t,r){var a;i||(-1==o.copyIndex.z?m.boxPlannerGrid.getPlannerHasActiveBackside()||m.boxPlannerGrid.prepareGridForBackSideCopy():m.boxPlannerGrid.prepareGridForColCopy(r,o.copyIndex)),i=!0;var h=new T.Z(m.set.getSetId(),t,m.nextElementId,DivaBoxPlanner.plannerType);m.nextElementId++,m.set.setElementId(t,h.ElementId);var c=m.set.getPlannerData(h.ElementId);h.updatePlannerData(c),m.boxPlannerGrid.addElementAsCopy(r,h,o.copyIndex),m.constructionRulesHandler.onElementCopy(r,h.getElementId()),l.push(h),"STD"==o.copyType&&(null===(a=o.targetElements)||void 0===a||a.push(h.getElementId()))})),a=0;case 8:if(!(a<l.length)){u.next=15;break}return u.next=11,v.Z.loadSVG(l[a],this.set);case 11:if(1==o.copyIndex.y&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&this.boxPlannerGrid.getCellsInGridByElementId(l[a].ElementId).endRowIndex+1==r.constructionRulesHandler.getMaxElemCountPerColumn())for(h=l[a].getFreeDockingPointsByType("AVO"),c=0;c<h.length;c++)h[c].disableDP(!0);case 12:a++,u.next=8;break;case 15:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=18,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,o.changedOPT,o.targetElements);case 18:case"end":return u.stop()}}),_callee5,this)}))),function copyPlannerElement(t,o){return i.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){_.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t,o){if(this.constructionRulesHandler.getForceWholePlanningSameHeight())return 0==this.boxPlannerGrid.getCellsInGridByElementId(t).startRowIndex?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(o){return o!=t}));if(this.boxPlannerGrid.getPlannerHasActiveBackside()){if("BoxPlanner_backside"==o)return this.boxPlannerGrid.getAllElementsInBackGrid().map((function(t){return t.ElementId})).filter((function(o){return o!=t}));var i=this.boxPlannerGrid.getOppositeElement(t);if(i)return[i.getElementId()]}return[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,o){var i=[];if(o&&-1==o.copyIndex.z)return this.boxPlannerGrid.getAllElementIdsInGrid();if(o&&"BoxPlanner_COL"==o.copyType){for(var l=this.boxPlannerGrid.getCellsInGridByElementId(t),r=this.boxPlannerGrid.getAllElementsInColumn(l.startColIndex,l.backside),a=0;a<r.length;a++)i.push(r[a].getElementId());return i}if(i.push(t),o){if(0!=o.copyIndex.x)if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var h=this.boxPlannerGrid.getAllElementsInSameCol(t);i=h.elements,h.backside}else{var c=this.boxPlannerGrid.getAllElementsToFillUp(t,o.copyIndex.x>0?"RIGHT":"LEFT");i=c.elements,c.backside}if(0!=o.copyIndex.y&&this.constructionRulesHandler.getForceWholePlanningSameHeight()){var u=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);i=u.elementIds,u.backside}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(i=i.concat(this.boxPlannerGrid.getOppositeElements(i).map((function(t){return t.ElementId}))))}return Array.from(new Set(i))}},{key:"deletePlannerElement",value:(o=(0,l.Z)(u().mark((function _callee6(t,o,i){var l,r,a,h;return u().wrap((function _callee6$(o){for(;;)switch(o.prev=o.next){case 0:if(l=this.boxPlannerGrid.getCellsInGridByElementId(t),r={row:l.startRowIndex,col:l.startColIndex,backside:!1},i&&"BoxPlanner_backside"==i?r={row:0,col:0,backside:!1}:l.startRowIndex>0?r.row--:(r.col=0==l.startColIndex?0:l.startColIndex-1,r.row=this.boxPlannerGrid.getRowCount(r.col,l.backside)-1),this.boxPlannerGrid.deleteElement(t,i),this.constructionRulesHandler.onElemDeleted(t),a=!0,i&&("BoxPlanner_backside"==i?(this.boxPlannerGrid.destroyBacksideModuleGrid(),a=!0):"STD_DONTUPDATE"==i&&(a=!1)),!a){o.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),o.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside)){o.next=13;break}return o.abrupt("return",{newElementToSelect:null===(h=this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside))||void 0===h?void 0:h.getElementId()});case 13:return o.abrupt("return",{});case 14:case"end":return o.stop()}}),_callee6,this)}))),function deletePlannerElement(t,i,l){return o.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos()}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i=this.boxPlannerGrid.getElementById(t);if(!i)return[];var l=null==i?void 0:i.getDockingDockingPointsByType(o);if(!l)return[];for(var r=[],a=0;a<(null==l?void 0:l.length);a++)null!=l[a]&&r.push(l[a].OnElementId);return r}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,o){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,o){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return _.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new V.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,o,i,l,r,a){return _.error(new m.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,l.Z)(u().mark((function _callee7(t,o){var i,l,r,a,h,c,m,d,g,E=this;return u().wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:if(_.debug("BoxPlanner - configurationHasChanged "+t),null==o||o.forEach((function(t){var o;return E.boxPlannerGrid.updateGridElementDimensions(t,null===(o=E.set.getArticleByElementId(t))||void 0===o?void 0:o.plannerData)})),!(t&&o&&o.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){u.next=19;break}if(!(o.length>1)){u.next=10;break}return u.next=6,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o,!0);case 6:if(!(i=u.sent)){u.next=9;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:i});case 9:case 47:case 48:return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[]});case 10:if(l=this.boxPlannerGrid.getCellsInGridByElementId(o[0]),r=o[0],l.startRowIndex>0&&(r=this.boxPlannerGrid.getPlannerElementAtGridPos(l.startColIndex,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(r)&&this.boxPlannerGrid.getElementHasRightElement(r)){u.next=19;break}return a={x:0,y:0,z:0},this.boxPlannerGrid.getElementHasLeftElement(r)||(a.x=-1),this.boxPlannerGrid.getElementHasRightElement(r)||(a.x=1),h=this.getPlannerElementsInfluencedByCopy(r,{copyIndex:a,copyType:"BoxPlanner_COL"}),u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:h,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:o});case 19:if(!t||!t.OPTDMOD){u.next=34;break}u.t0=t.OPTDMOD,u.next="OPVD_EIN"===u.t0?23:"OPVD_AUS"===u.t0?27:32;break;case 23:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=26;break}return c=this.getPlannerElementsInfluencedByCopy(-1,{copyIndex:{x:0,y:0,z:-1},copyType:"BoxPlanner_backside"}),u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:c,copyType:"BoxPlanner_backside",changedOPT:t});case 26:case 31:return u.abrupt("break",32);case 27:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=31;break}if(!((m=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=31;break}return u.abrupt("return",{doDeleteBackGrid:!0,elemIdsToDelete:m.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t});case 32:case 38:u.next=48;break;case 34:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){u.next=40;break}if(!((d=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=38;break}return u.abrupt("return",{doDeleteBackGrid:!0,elemIdsToDelete:d.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:o,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 40:return u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o);case 42:if(!(g=u.sent)){u.next=47;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:g});case 49:case"end":return u.stop()}}),_callee7,this)}))),function updatePlanner(o,i){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,o,i,l){for(var r={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:i},a=this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos(),h=0;h<a.length;h++){var c=a[h],u=c.ElementId,d=this.set.getPlannerConfigData(u).config,g={ID:"E"+u,N:d.N,Model:d.Model,x:-c.WorldPosCenter.x,y:c.WorldPosCenter.y,z:c.WorldPosCenter.z,PosPivot:"Center",w:c.getRotDeg(),RotPivot:"Center",DP:c.getDockingPointJS3D(),MAT:d.MAT,CFG:d.CFG,H:""},E=(0,m.FB)(JSON.stringify(g));g.H=E,r.ELE.push(g)}E=(0,m.FB)(JSON.stringify(r));return r.H=E,{constructionSet:r}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){_.error(new m.GE("BoxPlanner - getElementPosInfo not implemented yet",{code:"WC_0012"}))}},{key:"destroyPlanner",value:function destroyPlanner(){this.boxPlannerGrid.destroyBoxPlannerGrid()}},{key:"getCatalogData",value:function getCatalogData(){return this.set.CatalogData}},{key:"getPlannerBoundingBox",value:function getPlannerBoundingBox(){return this.boxPlannerGrid.getBoundingBox()}},{key:"updatePlannerBoundingBox",value:function updatePlannerBoundingBox(){}},{key:"getPlanningIsComplete",value:function getPlanningIsComplete(){return null!=this.boxPlannerGrid.getPlannerElementAtGridPos(0,0,!1)}},{key:"updateSetPosNr",value:function updateSetPosNr(t){for(var o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=o[i],r=this.boxPlannerGrid.getElementById(l);r&&(r.SetPosNr=t+r.PosNr-1,this.set.setPosNr(r.ElementId,r.getPosNr()))}return o.length}},{key:"clonePlanner",value:function clonePlanner(t,o,i){var l=new DivaBoxPlanner(t,o);return l.initPlanner(i),l}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){return this.boxPlannerGrid.getPlannerInteractionInformation()}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(t){return this.boxPlannerGrid.getGeneralPlanningState(!0,t)}}]);var t,o,i,c,d,g,E}();(0,h.Z)(B,"plannerType","BOX")}}]);
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[9060],{59060:(t,o,i)=>{i.r(o),i.d(o,{default:()=>B});var l=i(84658),r=i(13125),a=i(43860),h=i(80248),c=i(50747),u=i.n(c),m=i(49740),d=i(12952),g=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),E=function(){return(0,a.Z)((function BoxPlannerPartlistHelper(t,o,i,l,a,c,u){(0,r.Z)(this,BoxPlannerPartlistHelper),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"getOptionVal",void 0),(0,h.Z)(this,"setOptionValue",void 0),(0,h.Z)(this,"getElementHasBottomPlate",void 0),(0,h.Z)(this,"getElementIsCornerElement",void 0),(0,h.Z)(this,"getCornerType",void 0),(0,h.Z)(this,"getElementHasTopPlate",void 0),(0,h.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=i,this.setOptionValue=o,this.getElementIsCornerElement=l,this.getCornerType=a,this.getElementHasTopPlate=c,this.getElementIsGarderobeElement=u}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasBottomPlate(t,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(r,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasBottomPlate(h,i)&&l++,this.getElementHasBottomPlate(c,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasBottomPlate(d,i)&&l++}return l}return l}g.error(new m.GE("BoxPlannerError - function getGroundPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasTopPlate(t,o,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(r,o,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasTopPlate(h,o,i)&&l++,this.getElementHasTopPlate(c,o,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasTopPlate(d,o,i)&&l++}return l}return l}g.error(new m.GE("BoxPlannerError - function getTopPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getElementHeight",value:function getElementHeight(t,o){var i=this.getOptionVal(t.getElementId(),"OPTHOEHE",o);return"OPVH_6"==i?"6":"OPVH_11"==i?"11":"OPVH_18"==i?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,o){var i=this.getOptionVal(t.getElementId(),"OPTTIEFE",o);return"OPVTIEFE_18"==i?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,o){var i=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",o);return"OPVCHROM"==i?"CHROM":"OPVSCHWARZ_MATT"==i?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,o){for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(i[l],t,o),this.correctRahmenVerticalLeftBack(i[l],t,o),this.correctRahmenVerticalRightFront(i[l],t,o),this.correctRahmenVerticalRightBack(i[l],t,o),g.debug("---------Correct Senkrechte Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_V",o)),g.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_H",o)),g.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_V",o)),g.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_H",o))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(i[l],t,o),this.correctRahmenDepthLeftTop(i[l],t,o),this.correctRahmenDepthRightBottom(i[l],t,o),this.correctRahmenDepthRightTop(i[l],t,o),g.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Tiefen Rahmen links unten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_U",o)),g.debug("Tiefen Rahmen links oben: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_O",o)),g.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_U",o)),g.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_O",o)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId()))&&!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(this.getElementHasTopPlate(t,o,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(l){var r=o.getRightElements(t.getElementId());if(r.length>0){var a=r[0];if(!this.getElementHasBottomPlate(t,i)||this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(!this.getElementHasBottomPlate(a,i)||this.getElementIsCornerElement(a,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i)}}else if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":l?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else g.error(new m.GE("BoxPlannerError - function correctRahmenDepthRightBottom not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(!this.getElementHasTopPlate(t,o,i)||this.getElementIsCornerElement(t,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}if(!r)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];if(!this.getElementHasTopPlate(h,o,i)||this.getElementIsCornerElement(h,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i);break;case"BLACK":r?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else g.error(new m.GE("BoxPlannerError - function correctRahmenDepthRightTop not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l&&!(l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}else g.error(new m.GE("BoxPlannerError - function correctRahmenVerticalRightFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(0==a.length)return;if(a.length>0){var h=a[0];if(o.getPlannerHasActiveBackside()){var c=o.getOppositeElement(t.getElementId());if(!c)return;var u=o.getOppositeElement(h.getElementId());if(!u)return;this.getElementIsGarderobeElement(h,i)||this.getElementIsGarderobeElement(c,i)||this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else if(o.getPlannerHasActiveBackside()){var d=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}}else g.error(new m.GE("BoxPlannerError - function correctRahmenVerticalRightBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"calculateKnots",value:function calculateKnots(t,o){if(this.constructionRules.hasKNOTS)for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.correctKnotLeftTopFront(i[l],t,o),this.correctKnotLeftTopBack(i[l],t,o),this.correctKnotLeftBottomFront(i[l],t,o),this.correctKnotLeftBottomBack(i[l],t,o),this.correctKnotRightTopFront(i[l],t,o),this.correctKnotRightTopBack(i[l],t,o),this.correctKnotRightBottomFront(i[l],t,o),this.correctKnotRightBottomBack(i[l],t,o),this.correctKnotRightMiddleBack(i[l],t,o),this.correctKnotLeftMiddleBack(i[l],t,o),g.debug("---------Correct Knots for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),g.debug("Links oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTF",o)),g.debug("Links oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTB",o)),g.debug("Links unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBF",o)),g.debug("Links unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBB",o)),g.debug("Rechts oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTF",o)),g.debug("Rechts oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTB",o)),g.debug("Rechts unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBF",o)),g.debug("Links mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LMB",o)),g.debug("Rechts mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RMB",o)),g.debug("Rechts unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBB",o))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&(l||(o.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i))){var r=o.getLeftElements(t.getElementId());if(r.length>0){var a=r[0];if(this.getElementIsCornerElement(a,i))return;var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(l||(o.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,o,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i)){var r=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var a=o.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else if(!a&&r){var u=o.getLeftElements(t.getElementId());if(u.length>0){var d=u[0];this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(a&&r){var E=o.getLeftElements(t.getElementId())[0],I=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(E,o,i)?this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasBottomPlate(t,i)?this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsCornerElement(a,i))return;switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":var h=o.getRightElements(t.getElementId())[0];this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasTopPlate(t,o,i)?this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var h=o.getElementHasRightElement(t.getElementId());if(a||h){if(h&&!a){var c=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(!h&&a){var u=o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(h&&a){var d=o.getLeftElements(t.getElementId())[0],E=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(d,o,i)?this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftTopBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)&&!o.getCellsInGridByElementId(t.getElementId()).backside)if(o.getElementHasRightElement(t.getElementId()))if(o.getPlannerHasActiveBackside()){var l=o.getOppositeElement(t.getElementId());if(!l)return;var r=o.getRightElements(t.getElementId());if(0==r.length)return;var a=r[0],h=o.getOppositeElement(a.getElementId());if(!h)return;this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(l,i)?this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else{var c=o.getRightElements(t.getElementId());if(0==c.length)return;var u=c[0];this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else if(o.getPlannerHasActiveBackside()){var d=o.getOppositeElement(t.getElementId());if(!d)return;this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else g.error(new m.GE("BoxPlannerError - function correctKnotRightMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(r){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsGarderobeElement(a,i))return}if(r)if(o.getPlannerHasActiveBackside()){var h=o.getLeftElements(t.getElementId());if(0==h.length)return;var c=h[0],u=o.getOppositeElement(t.getElementId());if(!u)return;var d=o.getOppositeElement(null==c?void 0:c.getElementId());if(!d)return;this.getElementIsGarderobeElement(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);else if(o.getPlannerHasActiveBackside()){var E=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(E,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotLeftMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(o.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasBottomPlate(t,i)){var d=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),E=void 0;d.length>0&&(E=d[0]),E&&!this.getElementHasBottomPlate(E,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasBottomPlate(p,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":var O=o.getRightElements(t.getElementId())[0];if(O&&this.getElementIsCornerElement(O,i))if(o.getElementHasRightElement(O.getElementId())){var R=o.getRightElements(O.getElementId())[0];this.getElementHasBottomPlate(R,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else O&&this.getElementHasBottomPlate(O,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,o,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasTopPlate(t,o,i)){if(r){var d=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),E=void 0;d.length>0&&(E=d[0]),E&&(this.getElementHasTopPlate(E,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasTopPlate(p,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i)){var O=o.getElementHasLeftElement(t.getElementId()),R=o.getElementHasRightElement(t.getElementId());if(O||R){if(R&&!O){var k=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(k,i))if(o.getElementHasRightElement(k.getElementId())){var P=o.getRightElements(k.getElementId())[0];this.getElementHasTopPlate(P,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(k,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!R&&O){o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(R&&O){var v=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(v,i))if(o.getElementHasRightElement(v.getElementId())){var T=o.getRightElements(v.getElementId())[0];this.getElementHasTopPlate(T,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(v,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,o,i)){case 0:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);break;case 3:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else if(this.getElementHasBottomPlate(t,i)){if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i))}}else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&!this.getElementIsCornerElement(u,i)&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":var d=o.getRightElements(t.getElementId())[0];if(this.getElementIsCornerElement(d,i)){var E=o.getRightElements(d.getElementId())[0];this.getElementHasBottomPlate(E,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.getElementHasBottomPlate(d,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else g.error(new m.GE("BoxPlannerError - function correctKnotRightBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())if(r)switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else if(this.getElementHasTopPlate(t,o,i)){if(r){var a=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];this.getElementIsCornerElement(a,i)||this.getElementHasTopPlate(a,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(r){var h=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];h&&!this.getElementIsCornerElement(h,i)&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var c=o.getElementHasLeftElement(t.getElementId()),u=o.getElementHasRightElement(t.getElementId());if(c||u){if(u&&!c){var m=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(m,i))if(o.getElementHasRightElement(m.getElementId())){var d=o.getRightElements(m.getElementId())[0];this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!u&&c)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(u&&c){var g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(g,i))if(o.getElementHasRightElement(g.getElementId())){var E=o.getRightElements(g.getElementId())[0];this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}])}();function _createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function _unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return _arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function _arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}var I=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),p=function(){return(0,a.Z)((function ConstructionRulesHandler(t,o,i){var l=this;(0,r.Z)(this,ConstructionRulesHandler),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"checkArticleHasOption",void 0),(0,h.Z)(this,"updateCfgValuesByPlanner",void 0),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"constructionRulesLoaded",void 0),(0,h.Z)(this,"hideOptionsForConstruction",void 0),(0,h.Z)(this,"partlistHelper",void 0),(0,h.Z)(this,"getOptionVal",(function(t,o,i){if(i.has(t)&&i.get(t).has(o)){var r=i.get(t).get(o);return null!=r?r:""}var a=l.getValueOfOptionOfArticle(t,o);return null!=a?a:""})),(0,h.Z)(this,"hasOptionValue",(function(t,o,i){return!(!i.has(t)||!i.get(t).has(o))||!!l.getValueOfOptionOfArticle(t,o)})),(0,h.Z)(this,"setOptionValue",(function(t,o,i,r){var a;if(r.has(t)||r.set(t,new Map),null===(a=r.get(t))||void 0===a||a.set(o,i),l.hideOptionsForConstruction.has(t)){var h=l.hideOptionsForConstruction.get(t).indexOf(o);h>=0&&l.hideOptionsForConstruction.get(t).splice(h,1)}})),(0,h.Z)(this,"getElementHasBottomPlate",(function(t,o){if(!t)return!1;if(l.constructionRules.knotInfo.elementsWithGroundPlate)for(var i=0;i<l.constructionRules.knotInfo.elementsWithGroundPlate.length;i++){var r=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPT,a=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPVs,h=l.getOptionVal(t.getElementId(),r,o);return l.arrayContainsValue(a,h)}return!1})),(0,h.Z)(this,"getElementIsCornerElement",(function(t,o){return!!t&&(l.constructionRules.hasCORNER&&l.arrayContainsValue(l.constructionRules.knotInfo.cornerElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.cornerElements.onOPT,o)))})),(0,h.Z)(this,"getElementIsGarderobeElement",(function(t,o){return l.constructionRules.hasGARDEROBE&&l.arrayContainsValue(l.constructionRules.knotInfo.garderobeElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.garderobeElements.onOPT,o))})),(0,h.Z)(this,"getCornerType",(function(t,o){return"OPVECK_I"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"INSIDE":"OPVECK_A"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"OUTSIDE":"NOCORNER"})),(0,h.Z)(this,"getElementHasTopPlate",(function(t,o,i){if(o.getElementHasTopElement(t.getElementId())){var r=o.getTopElements(t.getElementId()),a=!1;return l.getElementHasBottomPlate(r[0],i)&&(a=!0),a}return!0})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=o,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=i,this.partlistHelper=new E(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,o){if(!t)return!1;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if(t[i]==o)return!0;return!1}var l=t.split(";");for(i=0;i<l.length;i++)if(l[i]==o)return!0;return!1}},{key:"evalRule",value:function evalRule(t,o,i){for(var l=!0,r=o.split("&"),a=0;a<r.length;a++){var h=r[a].split("=")[0],c=r[a].split("=")[1],u=this.getOptionVal(t,h,i);u&&u!=c&&(l=!1)}return l}},{key:"setOptionDoShow",value:function setOptionDoShow(t,o,i){var l=this.constructionRules.optionsVisibilityInfo[o];if(l){var r;if(null!=l.doShow)i.has(t)||i.set(t,new Map),null===(r=i.get(t))||void 0===r||r.set(o,l.doShow);if(this.hideOptionsForConstruction.has(t)){var a,h=this.hideOptionsForConstruction.get(t).indexOf(o);if(h>=0)null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.splice(h,1)}}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,o,i){var l,r,a=this.constructionRules.optionsVisibilityInfo[o];a&&(i.has(t)||i.set(t,new Map),null===(l=i.get(t))||void 0===l||l.set(o,a.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(r=this.hideOptionsForConstruction.get(t))||void 0===r||r.push(o))}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,o){for(var i=[],l=0;l<this.constructionRules.optionBasedConstructionRules.length;l++){var r=this.constructionRules.optionBasedConstructionRules[l];this.getOptionVal(t,r.masterOptionName,o)==r.masterOptionValue&&i.push(r)}return i}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,o,i,l){for(var r=[],a=void 0,h=0;h<this.constructionRules.optionsInfluenceRulesOfAllElements.length;h++){var c=this.constructionRules.optionsInfluenceRulesOfAllElements[h];for(var u in i)u==c.onOPT&&this.arrayContainsValue(c.onOPVs,i[u])&&r.push({opt:c.influenceOPT,opv:c.forceOPV,unvalidOPVs:c.unvalidOPVs,warning:c.warning,doShowWarning:!1})}for(var m=t.getAllElementIdsInGrid(),d=0;d<m.length;d++){var g;if(this.hideOptionsForConstruction.has(m[d])&&this.hideOptionsForConstruction.get(m[d]).length>0){for(;this.hideOptionsForConstruction.get(m[d]).length>0;){var E=this.hideOptionsForConstruction.get(m[d])[0];this.setOptionDoShow(m[d],E,o)}this.hideOptionsForConstruction.delete(m[d])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(m[d],"OPTDMOD",o):this.setOptionDoHide(m[d],"OPTDMOD",o));var I=t.getColumnCount();I>1?this.setOptionDoShow(m[d],"OPTMULTICOL",o):this.setOptionDoHide(m[d],"OPTMULTICOL",o),this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVOHNE",o),this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVOHNE",o);var p=t.getCellsInGridByElementId(m[d]);if(p.backside)this.setOptionValue(m[d],"OPTELEM_ON_BACK","OPVJA",o);else{if(this.setOptionValue(m[d],"OPTELEM_ON_BACK","OPVNEIN",o),p.startColIndex>0){var O=t.getPlannerElementAtGridPos(p.startColIndex-1,0,!1);if(O){var R=this.getOptionVal(O.getElementId(),"OPTELEMENT",o);"OPVECK_I"==R?this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVECK_I",o):"OPVECK_A"==R?this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVECK_A",o):this.setOptionValue(m[d],"OPTCORNER_COL_L","OPVOHNE",o)}}if(p.endColIndex<I-1){var k=t.getPlannerElementAtGridPos(p.endColIndex,0,!1);if(k){var P=this.getOptionVal(k.getElementId(),"OPTELEMENT",o);"OPVECK_I"==P?this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVECK_I",o):"OPVECK_A"==P?this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVECK_A",o):this.setOptionValue(m[d],"OPTCORNER_COL_R","OPVOHNE",o)}}}if(this.constructionRules.avoidOptionLastCol){var v=this.getOptionVal(m[d],this.constructionRules.avoidOptionLastCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,v)&&p.endColIndex-1==I-1&&this.setOptionValue(m[d],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,o)}if(this.constructionRules.avoidOptionFirstCol){var T=this.getOptionVal(m[d],this.constructionRules.avoidOptionFirstCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,T)&&0==p.startColIndex&&this.setOptionValue(m[d],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,o)}var V=this.hasOptionValue(m[d],"OPTWW",o);if(t.getElementIsFirstInGrid(m[d])?(this.setOptionDoShow(m[d],"OPTWERKZEUGKASTEN",o),V&&(t.getSizeOfWholeSet(!0).y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(m[d],"OPTWW",o):this.setOptionDoHide(m[d],"OPTWW",o))):(this.setOptionDoHide(m[d],"OPTWERKZEUGKASTEN",o),V&&this.setOptionDoHide(m[d],"OPTWW",o)),o.has(m[d])||o.set(m[d],new Map),null===(g=o.get(m[d]))||void 0===g||g.set("DEBUG",t.getElementById(m[d]).getPosNr()+""),r.length>0)for(var _=0;_<r.length;_++){var B=this.getOptionVal(m[d],r[_].opt,o),C=!1;if(r[_].unvalidOPVs&&0!=r[_].unvalidOPVs.length){for(var x=r[_].unvalidOPVs.split(";"),y=0;y<x.length;y++)if(x[y]==B){C=!0;break}}else C=!0;C&&(B!=r[_].opv&&(this.setOptionValue(m[d],r[_].opt,r[_].opv,o),r[_].doShowWarning||(r[_].doShowWarning=!0,a=r[_].warning)))}if(i)for(var u in i)if(""!=u&&i[u]&&""!=i[u])for(h=0;h<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;h++){c=this.constructionRules.optionsInfluenceRulesOfSingleElement[h];var H=!1;if(c.dir&&l&&l.length>0){if("TOP"==c.dir&&t.getElementHasBottomElement(m[d]))for(var b=t.getBottomElements(m[d]),G=0;G<b.length;G++)l.indexOf(b[G].getElementId())>=0&&(H=!0);if("DOWN"==c.dir&&t.getElementHasTopElement(m[d]))for(var D=t.getTopElements(m[d]),L=0;L<D.length;L++)l.indexOf(D[L].getElementId())>=0&&(H=!0);if("LEFT_RIGHT"==c.dir){if(t.getElementHasLeftElement(m[d]))for(var A=t.getLeftElements(m[d]),S=0;S<A.length;S++)l.indexOf(A[S].getElementId())>=0&&(H=!0);if(t.getElementHasRightElement(m[d]))for(var w=t.getRightElements(m[d]),N=0;N<w.length;N++)l.indexOf(w[N].getElementId())>=0&&(H=!0)}if("COL"==c.dir){var M=t.getCellsInGridByElementId(m[d]);t.getAllElementsInColumn(M.startColIndex,M.backside).forEach((function(t){return l.indexOf(t.ElementId)>=0?H=!0:void 0}))}if("BACK"==c.dir&&t.getPlannerHasActiveBackside()){var W=t.getOppositeElement(m[d]);W&&l.indexOf(W.getElementId())>=0&&(H=!0)}}else H=!0;if(H){B=this.getOptionVal(m[d],c.influenceOPT,o);u==c.onOPT&&B&&""!=B&&this.arrayContainsValue(c.unvalidOPVs,B)&&this.arrayContainsValue(c.onOPVs,i[u])&&(this.setOptionValue(m[d],c.influenceOPT,c.defaultOpv,o),c.warning&&(a=c.warning))}}var K=this.getCurOptionBasedConstructionRules(m[d],o);if(K)for(var X=0;X<K.length;X++)if(K[X].defaultOptions)for(var Z=0;Z<K[X].defaultOptions.length;Z++){var z=K[X].defaultOptions[Z];if(!z.rule||""==z.rule||this.evalRule(m[d],z.rule,o))for(var Y=0;Y<z.options.length;Y++)"doShow"==z.value?this.setOptionDoShow(m[d],z.options[Y],o):"doHide"==z.value&&this.setOptionDoHide(m[d],z.options[Y],o),z.opv&&this.setOptionValue(m[d],z.options[Y],z.opv,o)}this.setOptionValue(m[d],"OPTFAF_L_V","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_L_H","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_R_V","OPVOHNE_FAF",o),this.setOptionValue(m[d],"OPTFAF_R_H","OPVOHNE_FAF",o)}return a}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,o,i,l){if(null!=l){var r=l[0];if(null!=i)for(var a in i){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,a)){var h=t.getCellsInGridByElementId(r).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=h)for(var c=0;c<h.length;c++)this.setOptionValue(h[c].ElementId,a,i[a],o)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,a)){var u=t.getCellsInGridByElementId(r),m=t.getAllElementsInColumn(u.startColIndex,u.backside);if(null!=m){if(t.getPlannerHasActiveBackside()){var d,g=t.getAllElementsInColumn(u.startColIndex,!u.backside);g&&(m=null===(d=m)||void 0===d?void 0:d.concat(g))}for(c=0;c<m.length;c++)this.setOptionValue(m[c].ElementId,a,i[a],o)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,a)){var E=t.getCellsInGridByElementId(r),I=t.getAllElementsInRow(E.startRowIndex,E.backside);if(I&&t.getPlannerHasActiveBackside()){var p=t.getAllElementsInRow(E.startRowIndex,!E.backside);p&&(I=I.concat(p))}for(c=0;c<I.length;c++)this.setOptionValue(I[c].ElementId,a,i[a],o)}}var O=t.getCellsInGridByElementId(r),R=t.getAllElementsInRow(O.startRowIndex,O.backside);for(c=0;c<R.length;c++)if(R[c].getElementId()!=r)for(var k=0;k<(null===(P=this.constructionRules.forceSameOptionInRow)||void 0===P?void 0:P.length);k++){var P,v=this.getOptionVal(R[c].getElementId(),this.constructionRules.forceSameOptionInRow[k],o);this.setOptionValue(r,this.constructionRules.forceSameOptionInRow[k],v,o);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(i.OPTCurrentElem)>=0;this.setOptionDoHide(o,i.OPTNeighborElem,l),r||this.setOptionDoShow(t,i.OPTCurrentElem,l)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem],a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem];r&&a&&this.getOptionVal(t,i.OPTCurrentElem,l)==r.doShow&&this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow&&this.setOptionDoHide(t,i.OPTCurrentElem,l)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,o,i,l){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem];if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem],h=r.doShow==this.getOptionVal(t,i.OPTCurrentElem,l),c=this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow;h&&c&&(this.setOptionDoHide(t,i.OPTCurrentElem,l),this.setOptionDoHide(o,i.OPTNeighborElem,l))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,o,i,l,r){var a=i.getPlannerElementAtGridPos(t,o,r);if(this.constructionRules.defaultConstructionRules.TOP){var h=void 0;if(i.getElementHasTopElement(a.ElementId)){h=i.getPlannerElementAtGridPos(t,o+1,r);for(var c=0;c<this.constructionRules.defaultConstructionRules.TOP.length;c++){var u=this.constructionRules.defaultConstructionRules.TOP[c];"SHOW_HIDE"==u.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,h.ElementId,u,l):"HIDE_HIDE"==u.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,h.ElementId,u,l)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var m=void 0;if(r?i.getElementHasLeftElement(a.ElementId):i.getElementHasRightElement(a.ElementId)){m=r?i.getPlannerElementAtGridPos(t-1,o,r):i.getPlannerElementAtGridPos(t+1,o,r);for(c=0;c<this.constructionRules.defaultConstructionRules.RIGHT.length;c++){var d=this.constructionRules.defaultConstructionRules.RIGHT[c];"SHOW_HIDE"==d.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,m.ElementId,d,l):"HIDE_HIDE"==d.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,m.ElementId,d,l)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var g=void 0;if(o>0){g=i.getPlannerElementAtGridPos(t,o-1,r);for(c=0;c<this.constructionRules.defaultConstructionRules.DOWN.length;c++){var E=this.constructionRules.defaultConstructionRules.DOWN[c];"SHOW_HIDE"==E.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,g.ElementId,E,l):"HIDE_HIDE"==E.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,g.ElementId,E,l)}}}var I=r?i.getLeftElements(a.ElementId):i.getRightElements(a.ElementId),p=r?i.getRightElements(a.ElementId):i.getLeftElements(a.ElementId),O=i.getTopElements(a.ElementId),R=i.getBottomElements(a.ElementId),k=r?i.getTopLeftElement(a.ElementId):i.getTopRightElement(a.ElementId);I.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(I[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_RECHTS",l),p.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(p[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_LINKS",l),O.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(O[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN",l),k?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(k.ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",l),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(R.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(R[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_UNTEN",l))}},{key:"correctBack",value:function correctBack(t,o,i){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var l=void 0;if(l=t.getOppositeElement(i),this.constructionRules.defaultConstructionRules.BACK)for(var r=0;r<this.constructionRules.defaultConstructionRules.BACK.length;r++){var a,h,c=this.constructionRules.defaultConstructionRules.BACK[r],u=!1;if(c.hideOnElemAndOppositeOPT&&c.hideOnElemAndOppositeOPV)this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(i,c.hideOnElemAndOppositeOPT,o))&&this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(null===(a=l)||void 0===a?void 0:a.getElementId(),c.hideOnElemAndOppositeOPT,o))&&(u=!0);if(u)this.setOptionDoHide(i,c.OPTCurrentElem,o),this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o);else if("FORCE_HIDE"==c.OPTValueRule&&this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o),"SHOW_HIDE"==c.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(h=l)||void 0===h?void 0:h.getElementId(),i,c,o);else"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(l.ElementId,i,c,o)}l&&this.getElementHasBottomPlate(l,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_U_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.getElementHasTopPlate(l,t,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_O_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}else this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}},{key:"correctBottom",value:function correctBottom(t,o,i){var l="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var r=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,i),a=0;a<r.length;a++){var h=r[a];if(0==a){if(null==(l=this.getOptionVal(h.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,o)))return;i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeftBack,l,o))}i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRightBack,l,o))}}},{key:"getValidLadder",value:function getValidLadder(t,o,i){for(var l=o.getAllElementsInColumn(t,!1),r=0;r<this.constructionRules.correctLadder.validLadder.length;r++){var a=this.constructionRules.correctLadder.validLadder[r];if(l.length==a.colCount){for(var h=!0,c=0;c<l.length;c++){var u=l[c];if(this.getOptionVal(u.ElementId,a.heightOption,i)!=a.heightPerRow[c]&&(h=!1),!h)break}if(h)return a}}}},{key:"validateDimensionRule",value:function validateDimensionRule(t,o){var i=!1,l=!1;if("height"==t.dimension.toLowerCase()&&o.y>t.dimensionLimit&&(i=!0),"height"==t.dimension.toLowerCase()&&o.y==t.dimensionLimit&&(l=!0),"width"==t.dimension.toLowerCase()&&o.x>t.dimensionLimit&&(i=!0),"width"==t.dimension.toLowerCase()&&o.x==t.dimensionLimit&&(l=!0),"depth"==t.dimension.toLowerCase()&&o.z>t.dimensionLimit&&(i=!0),"depth"==t.dimension.toLowerCase()&&o.z==t.dimensionLimit&&(l=!0),i){if("doshow"==t.higherLimit.toLowerCase())return!0;if("dohide"==t.higherLimit.toLowerCase())return!1}else{if(l)return!0;if("doshow"==t.lowerLimit.toLowerCase())return!0;if("dohide"==t.lowerLimit.toLowerCase())return!1}return!1}},{key:"correctOverHangingElement",value:function correctOverHangingElement(t,o,i,l){var r=this;if(l)for(var a=function _loop(){var a=o.getAllElementsInColumn(h,!1,!1),c=null;a.findIndex((function(o){return o.ElementId==t}));a.forEach((function(t,o){var a,h,u,m;if(c){if((null!==(a=c.Width)&&void 0!==a?a:0)>(null!==(h=t.Width)&&void 0!==h?h:0)){var d=Object.entries(l),g=d[0][0],E=d[0][1];r.setOptionValue(t.ElementId,g,E,i)}if((null!==(u=c.Depth)&&void 0!==u?u:0)>(null!==(m=t.Depth)&&void 0!==m?m:0)){var I=Object.entries(l),p=I[0][0],O=I[0][1];r.setOptionValue(t.ElementId,p,O,i)}c=t}else c=t}))},h=0;h<o.getColumnCount();h++)a()}},{key:"correctFoot",value:function correctFoot(t,o){var i=this;t.getAllElementsInFrontGrid().forEach((function(l){t.getElementHasBottomElement(l.ElementId)&&i.setOptionValue(l.ElementId,"OPTFUSS_SYS","OPVOHNE",o)}))}},{key:"correctOptionsInfluencedByDimensions",value:function correctOptionsInfluencedByDimensions(t,o){var i=this;if(this.constructionRules.optionsInfluencedByDimensions){var l=t.getSizeOfWholeSet(!1),r=t.getAllElementsInFrontGrid();this.constructionRules.optionsInfluencedByDimensions.forEach((function(t){Array.isArray(t)?t.every((function(t){return i.validateDimensionRule(t,l)}))?t.forEach((function(t){return r.forEach((function(l){return i.setOptionDoShow(l.ElementId,t.option,o)}))})):t.forEach((function(t){return r.forEach((function(l){return i.setOptionDoHide(l.ElementId,t.option,o)}))})):i.validateDimensionRule(t,l)?r.forEach((function(l){return i.setOptionDoShow(l.ElementId,t.option,o)})):r.forEach((function(l){return i.setOptionDoHide(l.ElementId,t.option,o)}))}))}}},{key:"correctLadder",value:function correctLadder(t,o){if(this.constructionRules.correctLadder){for(var i=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),l=0;l<i.length;l++){var r=t.getRowCount(l,!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(r))for(var a=t.getAllElementsInColumn(l,!1),h=0;h<a.length;h++)this.setOptionValue(a[h].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o);if(r<t.getSizeOfHighesRow(!1)){var c,u=null===(c=t.getPlannerElementAtGridPos(l,r-1,!1))||void 0===c?void 0:c.getElementId();u&&this.getOptionVal(u,this.constructionRules.correctLadder.optHeight,o)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(u,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o)}}for(l=0;l<i.length;l++){var m=i[l],d=this.getValidLadder(l,t,o);0==l&&this.setOptionValue(m.ElementId,this.constructionRules.correctLadder.optLadderLeft,d.optLadder,o);var g=d;if(t.getElementHasRightElement(m.getElementId())){var E=this.getValidLadder(l+1,t,o);E.colCount>d.colCount&&(g=E)}this.setOptionValue(m.getElementId(),this.constructionRules.correctLadder.optLadderRight,g.optLadder,o)}var I=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(I)>=0){var p=t.getAllElementsInRow(I-1,!1);for(l=0;l<p.length;l++){var O=p[l];this.setOptionDoShow(O.getElementId(),this.constructionRules.correctLadder.optHasHeight,o)}}}}},{key:"correctCoverPlate",value:function correctCoverPlate(t,o,i){var l=this;t.onHighestElementsOnly||o.getHighestElementsPerSeries(!!t.onBottom).forEach((function(r){var a=0,h=t.seriesWidthToPlateOpv;r.forEach((function(r){var h;a+=null!==(h=r.Width)&&void 0!==h?h:0,o.getAllElementsDown(r.ElementId).elements.forEach((function(o){return l.setOptionValue(o,t.optABD,"OPVOHNE",i)})),l.setOptionValue(r.ElementId,t.optABD,"OPVOHNE",i)}));for(var c,u=r[0],m=function _loop2(){var o=h.findLast((function(t){var o=0,i=!1;return r.forEach((function(l){var r;o+=null!==(r=l.Width)&&void 0!==r?r:0,Math.abs(o-t.limit)<1&&(i=!0)})),!!(t.limit<=a&&i)}));if(!o)return{v:void 0};l.setOptionValue(u.ElementId,t.optABD,o.plateOpv,i);var c=0;u=r.find((function(t){var i;return(c+=null!==(i=t.Width)&&void 0!==i?i:0)>o.limit})),a-=o.limit,h[1].limit>a&&(a=0)};0!=a;)if(c=m())return c.v}))}},{key:"correctSeries",value:function correctSeries(t,o){for(var i=!1,l=t.getAllElementIdsInGrid(),r=!1,a=!1,h=0;h<l.length;h++){var c=l[h];this.getElementIsCornerElement(t.getElementById(c),o)&&(r=!0),this.checkArticleHasOption(c,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(c,"OPTBR_ABDECKPLATTE",o);var u=this.getOptionVal(c,"OPTABDECKPLATTE",o);this.checkArticleHasOption(c,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==u&&(i=!0),"OPVBR_18"==this.getOptionVal(c,"OPTBR",o)&&(a=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var m=t.getSizeOfHighesRow(!1),d=[],g=[],E=[],I=0,p=0,O=t.getAllElementsInColumn(p,!1);O.length>0;){if(O.length==m){var R=O[m-1];E.push(R),"OPVBR_75"==(u=this.getOptionVal(R.ElementId,"OPTBR",o))?I+=75:"OPVBR_18"==u?I+=18.75:"OPVBR_37"==u&&(I+=37.5),this.setOptionDoHide(R.ElementId,"OPTOBEN",o)}else E.length>0&&(d.push(E),g.push(I)),E=[],I=0;p++,O=t.getAllElementsInColumn(p,!1)}for(E.length>0&&(d.push(E),g.push(I)),h=0;h<d.length;h++){var k=d[h][0],P="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(g[h]-40.4)<3?P="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(g[h]-77.8)<3?P="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(g[h]-115.3)<3?P="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(g[h]-152.8)<3?P="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(g[h]-190.3)<3?P="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(g[h]-227.8)<3&&(P="OPVABDECKPLATTE_227"),""==P||r)for(var v=t.getAllElementsInGridSortedbyGridPos(),T=0;T<v.length;T++)this.checkArticleHasOption(v[T].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(v[T].getElementId(),"OPTABD_HIDE",o);else for(var V=t.getAllElementsInGridSortedbyGridPos(),_=0;_<V.length;_++)this.checkArticleHasOption(V[_].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(V[_].getElementId(),"OPTABD_HIDE",o);if(""==P||!i||r||a)for(var B=0;B<d[h].length;B++)this.setOptionDoShow(d[h][B].ElementId,"OPTOBEN",o);else this.setOptionValue(k.ElementId,"OPTBR_ABDECKPLATTE",P,o)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,o,i,l){if(0!=o.getCellsInGridByElementId(t).cells.length)for(var r=this.getCurOptionBasedConstructionRules(t,i),a=0;a<r.length;a++){if(r[a].forceOptions)for(var h=0;h<r[a].forceOptions.length;h++){var c=r[a].forceOptions[h];if(!c.rule||""==c.rule||this.evalRule(t,c.rule,i))for(var u=c.options,m=c.value,d=0;d<u.length;d++){var g=u[d],E=this.constructionRules.optionsVisibilityInfo[g];if(E.complementDir){var I=E.complementDir;l&&("LEFT"==I?I="RIGHT":"RIGHT"==I&&(I="LEFT"));var p=o.getNeighborElements(t,I);if(p.length>0)for(var O=0;O<p.length;O++){for(var R=p[O],k=this.getCurOptionBasedConstructionRules(R.ElementId,i),P=E.complementOPT,v=!1,T=0;T<k.length;T++)if(k[T].forceOptions)for(var V=0;V<k[T].forceOptions.length;V++){var _=k[T].forceOptions[V];if((!_.rule||""==_.rule||this.evalRule(R.ElementId,_.rule,i))&&(this.arrayContainsValue(_.options,P)&&(v=!0,"doShow"==m&&"doShow"==_.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",i)&&"OPVFUELLUNG"==this.getOptionVal(R.ElementId,"OPTELEMENT",i)?(this.setOptionDoHide(R.ElementId,P,i),this.setOptionDoHide(R.ElementId,P,i)):this.setOptionDoShow(R.ElementId,P,i)),"doHide"==m&&"doHide"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doShow"==m&&"doHide"==_.value||"doHide"==m&&"doShow"==_.value))){var B=!0;c.prio&&_.prio?B=c.prio<=_.prio:c.prio?B=!0:_.prio&&(B=!1),B?"doHide"==m?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==m&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doHide"==_.value?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoShow(R.ElementId,P,i))}}v||("doShow"==m&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doHide"==m&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)))}else"doShow"==m&&this.setOptionDoShow(t,g,i),"doHide"==m&&this.setOptionDoHide(t,g,i)}}}if(r[a].changeOptions)for(var C=0;C<r[a].changeOptions.length;C++){for(var x=!0,y=r[a].changeOptions[C].rule.split("&"),H=0;H<y.length;H++)if(y[H].indexOf("!=")>0){var b=y[H].split("!=")[0],G=y[H].split("!=")[1];this.getOptionVal(t,b,i)==G&&(x=!1)}else{b=y[H].split("=")[0],G=y[H].split("=")[1];this.getOptionVal(t,b,i)!=G&&(x=!1)}x&&(r[a].changeOptions[C].doShow&&this.setOptionDoShow(t,r[a].changeOptions[C].doShow,i),r[a].changeOptions[C].doHide&&this.setOptionDoHide(t,r[a].changeOptions[C].doHide,i),r[a].changeOptions[C].opt&&r[a].changeOptions[C].opv&&this.setOptionValue(t,r[a].changeOptions[C].opt,r[a].changeOptions[C].opv,i))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,o,i){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var l=0;l<this.constructionRules.correctNeighborOPT.length;l++){var r=o.getCellsInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,"OPVOHNE",i),0==r.cells.length)return;var a=o.getNeighborElements(t,this.constructionRules.correctNeighborOPT[l].dir);if(a.length>0){var h=this.getOptionVal(a[0].ElementId,this.constructionRules.correctNeighborOPT[l].neighborOPT,i);""!=h&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,h,i)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,o){var i=t.getAllElementsInGridSortedbyGridPos();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var l=0;l<this.constructionRules.correctRetailArticleNumberByRule.length;l++){var r=!0,a=this.constructionRules.correctRetailArticleNumberByRule[l];if("global"==a.range){for(var h=0;h<i.length&&r;h++){this.evalRule(i[h].getElementId(),a.rule,o)||(r=!1)}if(r)return{doChange:!0,retailArticleRules:a.retailArticleRules}}}return{doChange:!1}}},{key:"setConstructionRules",value:function setConstructionRules(t){t&&t.constructionRules&&(this.constructionRules=t.constructionRules,this.partlistHelper.setConstructionRules(t.constructionRules),this.constructionRulesLoaded=!0)}},{key:"getConstructionRulesLoaded",value:function getConstructionRulesLoaded(){return this.constructionRulesLoaded}},{key:"updateOptionLogicBoxPlanner",value:(t=(0,l.Z)(u().mark((function _callee(t,o,i,l){var r,a,h,c,d,g,E,p,O,R,k;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){u.next=3;break}return I.error(new m.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),u.abrupt("return");case 3:if(a=(new Date).getTime(),h=void 0,I.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),c=new Map,l)for(d=t.getAllElementIdsInGrid(),o=void 0,i=void 0,g=0;g<d.length;g++)this.getElementIsCornerElement(t.getElementById(d[g]),c)&&this.setOptionValue(d[g],"OPTELEMENT","OPVOFFENES_FACH",c);if(h=this.setAllOptToDefault(t,c,o,i),this.doCorrectAffectedElementsByOption(t,c,o,i),this.correctBottom(t,c,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,c,!0),this.correctSeries(t,c),this.constructionRules.coverPlateRule){E=_createForOfIteratorHelper(this.constructionRules.coverPlateRule);try{for(E.s();!(p=E.n()).done;)O=p.value,this.correctCoverPlate(O,t,c)}catch(t){E.e(t)}finally{E.f()}}for(g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctSimpleOpt(g,R,t,c,!1);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(R=0;R<t.getRowCount(g,!1);R++)this.correctSimpleOpt(g,R,t,c,!0);for(g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(g,R,!1).ElementId,t,c,!1),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(g,R,!1).ElementId,t,c);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(R=0;R<t.getRowCount(g,!1);R++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(g,R,!0).ElementId,t,c,!0),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(g,R,!0).ElementId,t,c);for(this.correctFoot(t,c),this.correctLadder(t,c),this.correctOptionsInfluencedByDimensions(t,c),this.correctOverHangingElement(null===(r=i)||void 0===r?void 0:r[0],t,c,o),this.partlistHelper.calculateKnots(t,c),this.partlistHelper.calculateRahmen(t,c),g=0;g<t.getColumnCount();g++)for(R=0;R<t.getRowCount(g,!1);R++)this.correctBack(t,c,t.getPlannerElementAtGridPos(g,R,!1).getElementId());return k=this.doChangeRetailArticleNumbers(t,c),u.next=29,this.updateCfgValuesByPlanner(c,void 0,this.constructionRules.partlistRules.bundleRules,k);case 29:return I.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-a)),I.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-a)),u.abrupt("return",h);case 32:case"end":return u.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(o,i,l,r){return t.apply(this,arguments)})},{key:"onElemDeleted",value:function onElemDeleted(t){this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.delete(t)}},{key:"onElementCopy",value:function onElementCopy(t,o){if(this.hideOptionsForConstruction.has(t)){var i=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(o,(0,d.Z)(i))}}},{key:"getHasMaxElemCountPerColumn",value:function getHasMaxElemCountPerColumn(){return null!=this.constructionRules.maxElemCountPerCol}},{key:"getMaxElemCountPerColumn",value:function getMaxElemCountPerColumn(){return this.constructionRules.maxElemCountPerCol}},{key:"getForceWholePlanningSameHeight",value:function getForceWholePlanningSameHeight(){return this.constructionRules.forceWholePlanningSameHeight}}]);var t}(),O=i(64357),R=i(19610);function BoxPlannerGrid_createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function BoxPlannerGrid_unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return BoxPlannerGrid_arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?BoxPlannerGrid_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function BoxPlannerGrid_arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}function ownKeys(t,o){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),i.push.apply(i,l)}return i}function _objectSpread(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(i),!0).forEach((function(o){(0,h.Z)(t,o,i[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o))}))}return t}var k=m.ZP.initLog("Planner","BOX-PLANNER_GRID"),P=function(){return(0,a.Z)((function BoxPlannerGrid(t,o){(0,r.Z)(this,BoxPlannerGrid),(0,h.Z)(this,"plannerElements",void 0),(0,h.Z)(this,"generalPlanningState",void 0),(0,h.Z)(this,"hasActiveBackside",void 0),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"gridSetupParams",void 0),this.plannerElements=new Map,this.generalPlanningState={grids:[{matrix:[[]]}]},this.gridSetupParams=t,this.getValueOfOptionOfArticle=o,this.hasActiveBackside=!1}),[{key:"createNewCells",value:function createNewCells(t,o,i,l){if(this.gridSetupParams.forceSingleCellPerElement)return[{plannedElement:{elementId:t.ElementId,basketId:t.getBasketId(),size:{width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth()},articleCodex:t.ArticleCodex,area:{fromX:o,toX:o+1,fromY:i,toY:i+1}},index:new O.FM(o,i)}];this.gridSetupParams.forceFixCellRasterSize||k.error(new m.GE("Box planner with params forceSingleCellPerElement is false and forceFixCellRasterSize is false are not allowed"));for(var r=Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),a=Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterHeight),h=[],c=0;c<r;c++)for(var u=0;u<a;u++){var d={plannedElement:{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.ArticleCodex,size:{width:t.getWidth(),depth:t.getDepth(),height:t.getHeight()},area:{fromX:o,toX:Math.round(o+t.getWidth()/this.gridSetupParams.fixCellRasterWidth),fromY:i,toY:Math.round(i+t.getHeight()/this.gridSetupParams.fixCellRasterHeight)}},index:new O.FM(o+c,i+u)};h.push(d)}return h}},{key:"createEmptyCells",value:function createEmptyCells(t,o,i,l,r,a){for(var h=[],c=t;c<=i;c++)for(var u=o;u<=l;u++){var m={plannerElementId:-1,width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:r,height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:a,index:new O.FM(c,u)};h.push(m)}return h}},{key:"getCellCount",value:function getCellCount(t){return this.gridSetupParams.forceSingleCellPerElement?{colCount:1,rowCount:1}:{colCount:Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),rowCount:Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterWidth)}}},{key:"getAllUsedCellsInGrid",value:function getAllUsedCellsInGrid(t){for(var o=new Array,i=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=0;l<i.length;l++)for(var r=0;r<i[l].length;r++)null!=i[l][r]&&o.push(i[l][r]);return o}},{key:"getGridColumnWidth",value:function getGridColumnWidth(t){for(var o=this.generalPlanningState.grids[0].matrix;t<o[0].length;t++){var i,l,r=o[t][0];if(r)return null!==(i=null===(l=r.plannedElement)||void 0===l?void 0:l.size.width)&&void 0!==i?i:0}return 0}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var o=0,i=!1,l=this.generalPlanningState.grids[0].matrix;if(l.length>t)for(var r=l[t],a=r.length-1;a>=0;a--){var h,c,u=r[a];!i&&u&&(i=!0),i&&(o+=null!==(h=null===(c=u.plannedElement)||void 0===c?void 0:c.size.height)&&void 0!==h?h:0),a=u.plannedElement?u.plannedElement.area.fromY-1:a-1}return o}},{key:"deleteElementByIdFromGrid",value:function deleteElementByIdFromGrid(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.endRowIndex-o.startRowIndex+1;this.getRowCount(o.startColIndex,o.backside),o.cells.reverse().forEach((function(t){i[t.index.x].splice(t.index.y,1),0==i[t.index.x].length&&i.splice(t.index.x,1)}));var r=[];i.forEach((function(t,o){r[o]=[],t.forEach((function(t,i){var l=t.plannedElement.area;r[o][i]={index:{x:o,y:i},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:o,fromY:i,toX:o+(l.toX-l.fromX),toY:i+(l.toY-l.fromY)}})}}))})),o.backside?this.generalPlanningState.grids[1].matrix=r:this.generalPlanningState.grids[0].matrix=r}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,o,i){var l=i?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(l[t]&&l[t][o]){var r,a=l[t][o];if(null==a)return;var h=null===(r=a.plannedElement)||void 0===r?void 0:r.elementId;if(!h)return;return this.plannerElements.get(h)}}},{key:"getCellsInGridByElementId",value:function getCellsInGridByElementId(t){var o,i,l,r,a,h,c=!1,u=this.generalPlanningState.grids[0].matrix,m=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix,d=[];if(u.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&d.push(o)}))})),null==m||m.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&(d.push(o),c=!0)}))})),0==d.length)return{cells:d,backside:c,startColIndex:0,endColIndex:0,startRowIndex:0,endRowIndex:0,colCount:0,rowCount:0};var g=null===(i=d[0].plannedElement)||void 0===i?void 0:i.area;return{cells:d,backside:c,startColIndex:null!==(l=null==g?void 0:g.fromX)&&void 0!==l?l:0,endColIndex:null!==(r=null==g?void 0:g.toX)&&void 0!==r?r:0,startRowIndex:null!==(a=null==g?void 0:g.fromY)&&void 0!==a?a:0,endRowIndex:null!==(h=null==g?void 0:g.toY)&&void 0!==h?h:0,colCount:g?g.toX-g.toX:0,rowCount:g?g.toY-g.fromY:0}}},{key:"GridSetupParams",set:function set(t){this.gridSetupParams=t}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){return Array.from(this.plannerElements.keys())}},{key:"_getAllElementsInGrid",value:function _getAllElementsInGrid(t){for(var o=[],i=[],l=0;l<t.length;l++)for(var r=0;r<t[l].length;r++){var a,h=t[l][r];null!=h&&(null!==(a=h.plannedElement)&&void 0!==a&&a.elementId&&-1==o.indexOf(h.plannedElement.elementId)&&(o.push(h.plannedElement.elementId),i.push(this.plannerElements.get(h.plannedElement.elementId))))}return i}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[0].matrix)}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix)}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix).map((function(t){return t.ElementId}))}},{key:"getAllElementsInGridSortedbyElementId",value:function getAllElementsInGridSortedbyElementId(){return Array.from(this.plannerElements.values())}},{key:"getAllElementsInGridSortedbyGridPos",value:function getAllElementsInGridSortedbyGridPos(){for(var t,o,i=[],l=[],r=this.generalPlanningState.grids[0].matrix,a=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:0,h=0;h<r.length;h++)for(var c=0;c<r[h].length;c++){var u,m=r[h][c],d=null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;if(m&&d&&-1==l.indexOf(d)){var g=this.getElementById(d);l.push(d),i.push(g)}}for(h=0;h<a.length;h++)for(c=0;c<a[h].length;c++){var E,I=a[h][c],p=null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(I&&p&&-1==l.indexOf(p)){var O=this.getElementById(p);l.push(p),i.push(O)}}return i}},{key:"getElementById",value:function getElementById(t){return this.plannerElements.get(t)}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var o=this.getCellsInGridByElementId(t);return 0!=o.cells.length&&(0==o.cells[0].index.x&&0==o.cells[0].index.y&&!o.backside)}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,o){var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return this.getCellsInGridByElementId(t).endColIndex==i.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){for(var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.startColIndex;l<o.endColIndex;l++)if(i[l].length>o.endRowIndex&&i[l][o.endRowIndex])return!0;return!1}},{key:"getTopElements",value:function getTopElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.toY];h;){var c=h.plannedElement;if(!c)break;r.push(this.plannerElements.get(c.elementId)),h=l[c.area.fromX][c.area.toY]}return r}},{key:"getTopRightElement",value:function getTopRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.endRowIndex&&i[o.endColIndex][o.endRowIndex]){var l=i[o.endColIndex][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(o.startColIndex>0&&i[o.startColIndex-1].length>0&&i[o.startColIndex-1][o.endRowIndex]){var l=i[o.startColIndex-1][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getCellsInGridByElementId(t).startRowIndex-1>=0}},{key:"getBottomElements",value:function getBottomElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.fromY-1];h;){var c,u=h.plannedElement;if(!u)break;r.push(this.plannerElements.get(u.elementId)),h=null===(c=l[u.area.fromX])||void 0===c?void 0:c[u.area.fromY-1]}return r}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.startRowIndex&&i[o.endColIndex][o.startRowIndex])return!0;return!1}},{key:"getRightElements",value:function getRightElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,m=null===(c=i[a.area.toX])||void 0===c?void 0:c[h],d=null==m||null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;m&&d&&-1==r.indexOf(d)&&(r.push(d),l.push(this.plannerElements.get(d)))}return l}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return!!(o.startColIndex>0&&i[o.startColIndex-1][o.startRowIndex])}},{key:"getLeftElements",value:function getLeftElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,m=null===(c=i[a.area.fromX-1])||void 0===c?void 0:c[h],d=null==m||null===(u=m.plannedElement)||void 0===u?void 0:u.elementId;m&&d&&-1==r.indexOf(d)&&(r.push(d),l.push(this.plannerElements.get(d)))}return l}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,o){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=[];if(!l[t])return r;if(i)for(var h=0;h<l[t].length;h++){var c,u=l[t][h],m=null==u||null===(c=u.plannedElement)||void 0===c?void 0:c.elementId;m&&u&&-1==a.indexOf(m)&&(a.push(m),r.push(this.plannerElements.get(m)))}else for(h=l[t].length-1;h>=0;h--){var d,g=l[t][h],E=null==g||null===(d=g.plannedElement)||void 0===d?void 0:d.elementId;g&&E&&-1==a.indexOf(E)&&(a.push(E),r.push(this.plannerElements.get(E)))}return r}},{key:"getColumnCount",value:function getColumnCount(){return this.generalPlanningState.grids[0].matrix.length}},{key:"getRowCount",value:function getRowCount(t,o){return o?this.generalPlanningState.grids[1].matrix[t].length:this.generalPlanningState.grids[0].matrix[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,o){for(var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=0;a<i.length;a++)if(i[a].length>t){var h,c=i[a][t],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==r.indexOf(u)&&(r.push(u),l.push(this.plannerElements.get(u)))}return l}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var o=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,i=0,l=0;l<o.length;l++)for(var r=o[l].length;r>=0;r--){if(o[l][r]){i<r&&(i=r);break}}return i+1}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i,l,r,a,h,c,u,m,d=this.getCellsInGridByElementId(t),g=d.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,E=[],I=d.cells[0].plannedElement;if(!I)return E;switch(o){case"RIGHT":var p=null===(i=g[I.area.toX])||void 0===i||null===(i=i[I.area.fromY])||void 0===i||null===(i=i.plannedElement)||void 0===i?void 0:i.elementId;p==(null===(l=g[I.area.toX])||void 0===l||null===(l=l[I.area.toY-1])||void 0===l||null===(l=l.plannedElement)||void 0===l?void 0:l.elementId)&&p&&E.push(this.plannerElements.get(p));break;case"LEFT":var O=null===(r=g[I.area.fromX-1])||void 0===r||null===(r=r[I.area.fromY])||void 0===r||null===(r=r.plannedElement)||void 0===r?void 0:r.elementId;O==(null===(a=g[I.area.fromX-1])||void 0===a||null===(a=a[I.area.toY-1])||void 0===a||null===(a=a.plannedElement)||void 0===a?void 0:a.elementId)&&O&&E.push(this.plannerElements.get(O));break;case"TOP":var R=null===(h=g[I.area.fromX])||void 0===h?void 0:h[I.area.toY],k=null==R||null===(c=R.plannedElement)||void 0===c?void 0:c.elementId;k&&E.push(this.plannerElements.get(k));break;case"DOWN":var P=null===(u=g[I.area.fromX])||void 0===u?void 0:u[I.area.fromY-1],v=null==P||null===(m=P.plannedElement)||void 0===m?void 0:m.elementId;v&&E.push(this.plannerElements.get(v));break;case"BACK":if(this.hasActiveBackside){var T=this.getPlannerElementAtGridPos(d.startColIndex,d.startRowIndex,!0);null!=T&&(E=[T])}}return E}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var o=this.getCellsInGridByElementId(t);return o.backside?this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!1):this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!0)}}},{key:"getOppositeElements",value:function getOppositeElements(t){var o=[];if(this.hasActiveBackside)for(var i=0;i<t.length;i++){var l=this.getOppositeElement(t[i]);null!=l&&o.push(l)}return o}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(t){for(var o=0,i=0,l=0,r=[],a=this.generalPlanningState.grids[0].matrix,h=0;h<a.length;){for(var c,u,m=0,d=a[h],g=0;g<d.length;){var E,I,p,R=d[g],k=null===(E=R)||void 0===E||null===(E=E.plannedElement)||void 0===E?void 0:E.elementId;k&&R&&-1==r.indexOf(k)&&(m+=this.plannerElements.get(k).getHeight(),0==h&&0==g&&(i=this.plannerElements.get(k).getDepth())),g=null!==(I=null===(p=R.plannedElement)||void 0===p?void 0:p.area.toY)&&void 0!==I?I:g+1}m>l&&(l=m);var P=this.getGridColumnWidth(h);t&&h>0&&(77.9==P?P=75:40.4==P?P=37.5:21.7==P&&(P=18.75)),o+=P,h=null!==(c=null===(u=d[0].plannedElement)||void 0===u?void 0:u.area.toX)&&void 0!==c?c:h+1}return this.hasActiveBackside&&(i*=2),new O.P(o,l,i)}},{key:"getHighestElementsPerSeries",value:function getHighestElementsPerSeries(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.hasActiveBackside)throw new Error("this function is doesnt implement the backside logic (yet)");for(var o=[],i=-1,l=0;l<this.getColumnCount();){for(var r=this.generalPlanningState.grids[0].matrix[l],a=0,h=0;h<r.length;){var c=r[h].plannedElement;a+=c.size.height,h=c.area.toY}Math.round(a)==Math.round(i)||t?(o[o.length-1]||o.push([]),o[o.length-1].push(this.getPlannerElementAtGridPos(l,r.length-1,!1))):o.push([this.getPlannerElementAtGridPos(l,r.length-1,!1)]),i=a,l=r[r.length-1].plannedElement?r[r.length-1].plannedElement.area.toX:l+1}return o}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInRow(o.startRowIndex,!1);return this.hasActiveBackside&&(i=i.concat(this.getAllElementsInRow(o.startRowIndex,!0))),{elementIds:i.map((function(t){return t.ElementId})),plannerElements:i,backside:o.backside}}},{key:"getAllElementsToFillUp",value:function getAllElementsToFillUp(t,o){for(var i=this,l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement,a=l.startColIndex,h=l.startRowIndex,c=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],m=[],d=function _loop(t){var l,h=null===(l=c[a][t])||void 0===l?void 0:l.plannedElement;if(!h)return g=t,1;var d=r.area.toX-r.area.fromX,E="RIGHT"==o?+d:-d,I=c.every((function(o,i){var l;return i<r.area.fromX+E||i>=r.area.toX+E||(null===(l=o[t])||void 0===l?void 0:l.plannedElement)}));0==i.getNeighborElements(h.elementId,o).length&&!I&&h?u.push(h.elementId):h&&m.push(h.elementId),t=h.area.toY,g=t},g=0;g<=h&&!d(g););return{elements:0==u.length?m:u,backside:l.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var o=this.getCellsInGridByElementId(t);if(0==o.startRowIndex)return{elements:[],backside:!1};for(var i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=o.startColIndex;r<o.endColIndex;r++)for(var a=o.startRowIndex--;a>=0;a--){var h,c=i[r][a],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==l.indexOf(u)&&l.push(u)}return{elements:l,backside:o.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInColumn(o.startColIndex,o.backside);return null==i&&(i=[]),{elements:i.map((function(t){return t.ElementId})),backside:o.backside}}},{key:"prepareGridForColCopy",value:function prepareGridForColCopy(t,o){var i,l,r;if(!(o.y>0)){var a=this.getCellsInGridByElementId(t),h=o.x>0,c=a.cells[0].plannedElement,u={x:c.area.toX-1+o.x,y:c.area.fromY+o.y};o.x<0&&(u.x=a.cells[0].plannedElement.area.fromX-1);var m=this.generalPlanningState.grids[0].matrix,d=null!==(i=null===(l=this.generalPlanningState.grids[1])||void 0===l?void 0:l.matrix)&&void 0!==i?i:0,g=c.area.toX-c.area.fromX,E=null===(r=m[a.cells[0].index.x+o.x])||void 0===r?void 0:r[a.cells[0].index.y];(-1==u.x||E&&!h)&&(u.x-=o.x),m=moveGrid(this.getAllUsedCellsInGrid(!1));for(var I=0;I<g;I++)m[u.x+I]||(m[u.x+I]=[]);if(this.generalPlanningState.grids[0].matrix=m,this.hasActiveBackside){d=moveGrid(this.getAllUsedCellsInGrid(!0));for(var p=0;p<g;p++)d[u.x+p]||(d[u.x+p]=[]);this.generalPlanningState.grids[1].matrix=d}}function moveGrid(t){var o=new Array,i=t.filter((function(t){return t.index.x==c.area.toX})),l=i.find((function(t){return t.index.y==u.y})),r=t.filter((function(t){return t.index.x==c.area.fromX-1})),a=r.find((function(t){return t.index.y==u.y}));return t.forEach((function(t){t.index.x>=u.x&&(h&&(l||0==i.length)||!h&&(a||0==r.length)||-1==u.x)&&(t.index.x+=g,t.plannedElement.area.fromX+=g,t.plannedElement.area.toX+=g),o[t.index.x]||(o[t.index.x]=[]),o[t.index.x][t.index.y]=t})),o}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.generalPlanningState.grids[1]={matrix:[[]]},this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,o,i,l){for(var r=l?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=this.createNewCells(t,o,i,l),h=0;h<a.length;h++){var c=a[h];r[c.index.x]||(r[c.index.x]=[]),r[c.index.x][c.index.y]=c}this.plannerElements.set(t.getElementId(),t),l&&(this.hasActiveBackside=!0)}},{key:"moveElementAsCopy",value:function moveElementAsCopy(t,o){var i=this.plannerElements.get(t),l=this.getCellsInGridByElementId(t);if(i){this.deleteElement(t,"STD");var r=this.generalPlanningState.grids[0].matrix,a=void 0;if(o.x<0||0==o.y&&l.endRowIndex>=o.x){var h=l.endColIndex>=o.x;l.startColIndex>=o.x&&(o.x-=l.endColIndex-l.startColIndex),o.x<0&&(o.x=0),a=this.createNewCells(i,o.x,o.y,!1);var c=[],u=a[0].plannedElement;r.forEach((function(t,i){t.forEach((function(t,l){var a=i,m=0;l==o.y&&(a+=h?u.area.toX-u.area.fromX:-(u.area.toX-u.area.fromX),m=h?u.area.toX-u.area.fromX:-(u.area.toX-u.area.fromX)),c[a]||(c[a]=[]);var d=r[i][l].plannedElement,g={plannedElement:_objectSpread(_objectSpread({},d),{},{area:{fromX:a,toX:d.area.toX+m,fromY:d.area.fromY,toY:d.area.toY}}),index:{x:a,y:l}};c[a][l]=g}))})),r=c}else o.x>l.startColIndex&&o.y==l.startRowIndex&&(o.x-=l.endColIndex-l.startColIndex),a=this.createNewCells(i,o.x,o.y,!1);for(var m=0;m<a.length;m++)r[a[m].index.x]||(r[a[m].index.x]=[]),r[a[m].index.x][a[m].index.y]=a[m];this.plannerElements.set(t,i),this.generalPlanningState.grids[0].matrix=r}}},{key:"addElementAsCopy",value:function addElementAsCopy(t,o,i){var l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement.area,a={x:r.fromX,y:r.fromY};i.x>0?a.x=r.toX-1+i.x:i.x<0?a.x=r.fromX-(r.toX-r.fromX):i.y>0&&(a.y=r.toY-1+i.y);var h=-1==i.z||1==l.backside;a.x<0&&(a.x=0);var c=h?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;c[a.x].length<a.y&&(a.y=c[a.x].length);for(var u=this.createNewCells(o,a.x,a.y,h),m=0;m<u.length;m++)c[u[m].index.x]||(c[u[m].index.x]=[]),c[u[m].index.x][u[m].index.y]=u[m];this.plannerElements.set(o.getElementId(),o)}},{key:"deleteElement",value:function deleteElement(t,o){this.plannerElements.has(t)||k.error(new m.GE("Try to delete an elementId that does not exist"));this.getCellsInGridByElementId(t);R.Z.removeDockingPointRelations(this.plannerElements.get(t)),this.deleteElementByIdFromGrid(t),this.plannerElements.delete(t),this.hasActiveBackside}},{key:"updateGridElementDimensions",value:function updateGridElementDimensions(t,o){var i=this;if(o){var l=this.getCellsInGridByElementId(t),r=this.gridSetupParams.forceSingleCellPerElement;if(l.cells.forEach((function(t){t.plannedElement&&(t.plannedElement.size.width=o.width,t.plannedElement.size.height=o.height,t.plannedElement.area={fromX:t.index.x,toX:r?t.index.x+1:Math.round(t.index.x+o.width/i.gridSetupParams.fixCellRasterWidth),fromY:t.index.y,toY:r?t.index.y+1:Math.round(t.index.y+o.height/i.gridSetupParams.fixCellRasterHeight)})})),!r){var a=new Array;this.getAllUsedCellsInGrid(!1).forEach((function(t){var o=t.plannedElement.area;if(!a.find((function(o){return o.find((function(o){var i,l;return(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==(null===(l=t.plannedElement)||void 0===l?void 0:l.elementId)}))})))for(var l=o.fromX;l<o.toX;l++)for(var r=function _loop2(r){if(a[l]||(a[l]=[]),r<o.fromY){if(a[l][r])return 0;var h=i.generalPlanningState.grids[0].matrix.findLast((function(t){return t[r].plannedElement}));return a[l][r]={index:{x:l,y:r},plannedElement:h&&h.length>0?h[0].plannedElement:void 0},0}a[l][r]=_objectSpread(_objectSpread({},t),{},{index:{x:l,y:r},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:l,toX:l+(t.plannedElement.area.toX-t.plannedElement.area.fromX),fromY:r,toY:r+(t.plannedElement.area.toY-t.plannedElement.area.fromY)}})})},h=0;h<o.toY;h++)r(h)})),l.backside?this.generalPlanningState.grids[1].matrix=a:this.generalPlanningState.grids[0].matrix=a}}}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){var t,o,i,l=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(l.s();!(i=l.n()).done;){var r=i.value;R.Z.removeDockingPointRelations(r)}}catch(t){l.e(t)}finally{l.f()}for(var a=1,h=[],c=this.generalPlanningState.grids[0].matrix,u=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:[],d=0;d<c.length;d++)for(var g=0;g<c[d].length;g++){var E,I=c[d][g],p=null==I||null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(p&&-1==h.indexOf(p)){var O=this.plannerElements.get(p);h.push(p);var P=this.getNeighborElements(p,"TOP"),v=this.getNeighborElements(p,"RIGHT"),T=this.getNeighborElements(p,"LEFT");P.length>0&&R.Z.tryDockElement(O,"AVO",[P[0]]),T.length>0&&R.Z.tryDockElement(O,"AVL",[T[0]]),v.length>0&&R.Z.tryDockElement(O,"AVR",[v[0]]),O.PosNr=a,a++}}for(var V=0;V<u.length;V++)for(var _=0;_<u[V].length;_++){var B,C=u[V][_],x=null==C||null===(B=C.plannedElement)||void 0===B?void 0:B.elementId;if(x&&-1==h.indexOf(x)){var y=this.plannerElements.get(x);h.push(x);var H=c[V][_],b=this.plannerElements.get(H.plannedElement.elementId);if(b){var G=null==b?void 0:b.getDockingPointById("AVO_AVO_2_IL");G?y&&R.Z.tryDockElementToDP(y,b,G):k.error(new m.GE("Error Loading DockingPoint AVO_2 for plannerElement"))}var D=this.getNeighborElements(x,"TOP"),L=this.getNeighborElements(x,"RIGHT");D.length>0&&R.Z.tryDockElement(y,"AVO",[D[0]]),L.length>0&&R.Z.tryDockElement(y,"AVL",[L[0]]),y.PosNr=a,a++}}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){var t,o=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(o.s();!(t=o.n()).done;){t.value.destroy()}}catch(t){o.e(t)}finally{o.f()}this.plannerElements.clear(),this.generalPlanningState.grids[0].matrix=[],this.hasActiveBackside&&(this.hasActiveBackside=!1,this.generalPlanningState.grids[1].matrix=[])}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;var t,o=this.getAllElementsInBackGrid(),i=BoxPlannerGrid_createForOfIteratorHelper(o.values());try{for(i.s();!(t=i.n()).done;){var l=t.value;this.plannerElements.delete(l.ElementId),l.destroy()}}catch(t){i.e(t)}finally{i.f()}o=[],this.generalPlanningState.grids[1].matrix=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getForceSingleCellPerElement",value:function getForceSingleCellPerElement(){return this.gridSetupParams.forceSingleCellPerElement}},{key:"getBoundingBox",value:function getBoundingBox(){var t,o,i=this.generalPlanningState.grids[0].matrix,l=null==i||null===(t=i[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.plannedElement,r=0,a=0,h=0,c=0,u=0,m=l?l.size.depth:0,d=0;o="RIGHT";for(var g=[],E=0;E<i.length;E++){var I,p=i[E][0];if(!p)break;var O=null===(I=p.plannedElement)||void 0===I?void 0:I.elementId;if(O&&-1==g.indexOf(O)){g.push(O);var R=this.plannerElements.get(O);if(!R)continue;var k=this.getValueOfOptionOfArticle(O,"OPTELEMENT");"RIGHT"==o?c+=R.getWidth():"FRONT"==o?m+=R.getWidth():"LEFT"==o?c-=R.getWidth():"BACK"==o&&(m-=R.getWidth()),"OPVECK_I"==k?"RIGHT"==o?o="FRONT":"FRONT"==o?o="LEFT":"LEFT"==o?o="BACK":"BACK"==o&&(o="RIGHT"):"OPVECK_A"==k&&("RIGHT"==o?o="BACK":"FRONT"==o?o="RIGHT":"LEFT"==o?o="FRONT":"BACK"==o&&(o="LEFT")),c<a&&(a=c),c>h&&(h=c),m<u&&(u=m),m>d&&(d=m);var P=this.getGridColumnHeight(E);r=r<P?P:r}}var v=d-u,T=h-a;return this.hasActiveBackside&&(v=2*m),{width:Math.round(1e3*T)/1e3,height:Math.round(1e3*r)/1e3,depth:Math.round(1e3*v)/1e3}}},{key:"getFreeMoveLocation",value:function getFreeMoveLocation(t){var o=this.getElementById(t);if(!o)return[];var i=this.getCellsInGridByElementId(t);if(0===i.cells.length)return[];var l,r=[],a=function isEmptyCell(t,o){var i;return void 0===(null===(i=h[t])||void 0===i?void 0:i[o])},h=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,c=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.keys());try{for(c.s();!(l=c.n()).done;){var u=l.value;if(u!=t){var m=this.getElementById(u);if(this.gridSetupParams.forceSingleCellPerElement){if(!this.getElementHasTopElement(u)&&m.getWidth()==o.getWidth()){var d=this.getCellsInGridByElementId(u),g=this.getAllElementsInRow(d.endRowIndex+1,d.backside);if(g.length>0&&g[0].getHeight()!=o.getHeight())continue;var E=this.createLocationInformation(o,i.backside,this.createEmptyCells(d.cells[0].plannedElement.area.fromX,d.cells[0].plannedElement.area.toX,d.cells[0].plannedElement.area.fromY,d.cells[0].plannedElement.area.toY+1,o.getWidth(),o.getHeight()),d.cells[0].plannedElement.area.fromX,d.cells[0].plannedElement.area.toX,1,1);r.push(E)}}else for(var I=this.getCellsInGridByElementId(u),p=-1,O=-1,R=I.cells[0].plannedElement.area.toY+1,k=I.startColIndex;k<=I.startColIndex+I.colCount-1;k++){var P=!1;if(a(k,R)){if(-1==p?(p=k,O=k):O=k,k==I.startColIndex+I.colCount-1)if(i.colCount<=O-p+1)P=!0;else{P=!0;for(var v=0;v<i.colCount;v++)if(a(p+v,I.endRowIndex)){P=!1;break}}}else i.colCount<=O-p+1&&(P=!0);if(P){var T=this.createLocationInformation(o,i.backside,this.createEmptyCells(p,I.endRowIndex+1,p+i.colCount-1,I.endRowIndex+i.rowCount-1,o.getWidth(),o.getHeight()),p,I.endRowIndex+1,i.colCount,i.rowCount);r.push(T)}}}}}catch(t){c.e(t)}finally{c.f()}var V=this.createLocationInformation(o,i.backside,this.createEmptyCells(-i.colCount,0,-1,i.rowCount-1,o.getWidth(),o.getHeight()),-i.colCount,0,i.colCount,i.rowCount);r.push(V);var _=this.createLocationInformation(o,i.backside,this.createEmptyCells(this.getColumnCount(),0,this.getColumnCount()+i.colCount-1,i.rowCount-1,o.getWidth(),o.getHeight()),this.getColumnCount(),0,i.colCount,i.rowCount);return r.push(_),r}},{key:"getFreePlanningLocation",value:function getFreePlanningLocation(t,o){var i=this.getElementById(t);if(i){var l=this.getCellsInGridByElementId(t);if(0!==l.cells.length){var r=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=l.startColIndex,h=l.endColIndex,c=l.startRowIndex,u=l.endRowIndex,m=-1,d=-1,g=-1,E=-1,I=[],p=function isValidCell(t,o){var i;return void 0===(null===(i=r[t])||void 0===i?void 0:i[o])};switch(o){case"LEFT":for(var O=a-1,R=!1,k=c;k<=u;k++)if(p(O,k)){d=k,R=!0;break}if(!R)return;R=!1;for(var P=a-1;P>=a-l.colCount&&(p(P,d)&&(0==d||!p(P,d-1)));P--)R=!0,m=P;if(!R)return;g=a-1,E=u,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;case"TOP":for(var v=u+1,T=!1,V=h;V>=a;V--)p(V,v)&&(m=V,T=!0);if(!T)return;d=v,g=h,E=v+l.rowCount-1,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;case"RIGHT":for(var _=h,B=!1,C=c;C<=u;C++)if(p(_,C)){d=C,B=!0;break}if(!B)return;B=!1;for(var x=h;x<=h+l.colCount&&(p(x,d)&&(0==d||!p(x,d-1)));x++)g=x,B=!0;if(!B)return;m=h,E=u,I=this.createEmptyCells(m,d,g,E,i.getWidth(),i.getHeight());break;default:return}return this.createLocationInformation(i,l.backside,I,m,d,g-m+1,E-d+1)}}}},{key:"createLocationInformation",value:function createLocationInformation(t,o,i,l,r,a,h){var c=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u={cells:i,widthPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),heightPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depthPerCell:t.getDepth(),width:this.gridSetupParams.forceFixCellRasterSize?a*this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?h*this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth(),startIndexWorldPos:new O.FM(0,0)};if(this.gridSetupParams.forceFixCellRasterSize)u.startIndexWorldPos=new O.FM(l*this.gridSetupParams.fixCellRasterWidth,r*this.gridSetupParams.fixCellRasterHeight);else{for(var m=0,d=0;d<l;d++){var g,E;m+=null!==(g=null===(E=c[d][0].plannedElement)||void 0===E?void 0:E.size.width)&&void 0!==g?g:0}l<0&&(m=-t.getWidth());var I=0;for(d=0;d<r;d++){var p,R;I+=null!==(p=null===(R=c[l][d].plannedElement)||void 0===R?void 0:R.size.width)&&void 0!==p?p:0}u.startIndexWorldPos=new O.FM(m,I)}return u}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){for(var t=this.getAllElementsInGridSortedbyGridPos(),o={boxPlannerInteractionInformationPerElement:new Map},i=0;i<t.length;i++){var l=t[i],r=this.getCellsInGridByElementId(l.getElementId()),a=r.cells[0].plannedElement.area,h=this.createLocationInformation(l,r.backside,r.cells,a.fromX,a.toX,a.fromY,a.toY),c=this.getFreePlanningLocation(l.getElementId(),"LEFT"),u=this.getFreePlanningLocation(l.getElementId(),"RIGHT"),m=this.getFreePlanningLocation(l.getElementId(),"TOP"),d=this.getElementHasTopElement(l.getElementId()),g=[];!d&&t.length>1&&(g=this.getFreeMoveLocation(l.getElementId()));var E={location:h,isDeletable:!d&&t.length>1,availablePlanningLocations:{availableBoxPlannerCellsLeft:c,availableBoxPlannerCellsTop:m,availableBoxPlannerCellsRight:u},availableMovingLocations:g};o.boxPlannerInteractionInformationPerElement.set(l.getElementId(),E)}return o}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(){var t,o,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1?arguments[1]:void 0;if(!i)return this.generalPlanningState;var r=this.generalPlanningState.grids[0].matrix,a=[],h=r.length,c=0;r.forEach((function(t){t.length>c&&(c=t.length)}));Array.from(this.plannerElements.values()).map((function(t){return{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.getArticleCodex(),size:{width:t.getWidth(),height:t.getHeight(),depth:t.getDepth()},area:{fromX:void 0,toX:void 0,fromY:void 0,toY:void 0}}}));var u=!1,m=void 0,g=void 0;if(l){var E=this.getCellsInGridByElementId(l);m={articleCodex:(g=E.cells[0].plannedElement).articleCodex,elementId:g.elementId,gridSpace:{rows:g.area.toY-g.area.fromY+1,colums:g.area.toX-g.area.fromX+1},area:g.area,size:g.size,rules:[]},u=!!r.find((function(t,o){return o>=g.area.fromX&&o<g.area.toX&&r[o].length>g.area.toY}))}if(u)return this.generalPlanningState;for(var I=0;I<h;I++){var p=0==g.area.fromX?I:I+1;a[p]||r[I]&&(a[p]=(0,d.Z)(r[I]));for(var O=0;O<c;O++)if(r[I].length>O&&r[I][O]){a[p][O].plannedElement;a[p][O]=_objectSpread({},r[I][O])}}var R=0==g.area.fromX?g.area.fromX:g.area.fromX+1,k=0==g.area.fromX?g.area.toX:g.area.toX+1;a.forEach((function(t,o){if(!(o>=R&&o<k)){var i=a[o],l=i.length,r=0==g.fromX?o:o-1;i[l]={index:{x:r,y:l}}}}));var P=a.length;return(null===(t=g)||void 0===t?void 0:t.area.toX)!=r.length&&(a[P]=[{index:{x:0==g.fromX?P:P-1,y:0}}]),0!=(null===(o=g)||void 0===o?void 0:o.area.fromX)&&(a[0]=[{index:{x:-1,y:0}}]),_objectSpread(_objectSpread({},this.generalPlanningState),{},{selectedElement:m,grids:[_objectSpread(_objectSpread({},this.generalPlanningState.grids[0]),{},{matrix:a})]})}},{key:"getRowSizes",value:function getRowSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t[0].length,l=Array(i).fill(-1),r=function _loop3(i){var r,a=null===(r=t.find((function(t){var o,l;return void 0!==(null===(o=t[i].plannedElement)||void 0===o?void 0:o.size.height)&&-1!=(null===(l=t[i].plannedElement)||void 0===l?void 0:l.size.height)})))||void 0===r?void 0:r[i];if(null!=a&&a.plannedElement?l[i]=a.plannedElement.size.height:o&&(l[i]=o.size.height),-1===l[i])return 1},a=0;a<i&&!r(a);a++);return l.includes(-1)&&k.error(new Error("Column sizes are not set")),l}return 15}},{key:"getColumnSizes",value:function getColumnSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t.length,l=Array(i).fill(-1),r=0;r<i;r++){var a=t[r].find((function(t){return t.plannedElement}));if(null!=a&&a.plannedElement?l[r]=a.plannedElement.size.width:o&&(l[r]=o.size.width),!l.includes(-1))break}if(l.includes(-1))throw new Error("Row sizes are not set");return l}return 15}},{key:"addFreeCellsToMatrix",value:function addFreeCellsToMatrix(t,o,i){o.forEach((function(o){var i=o.index.x,l=o.index.y,r=t.find((function(t){return t.find((function(t){return t.index.x===i}))}));if(!r){for(var a=[],h=0;h<t[0].length;h++)a.push({index:new O.FM(i,h),plannedElement:void 0});t[0][0].index.x>i?t.unshift(a):t.push(a)}var c=t.find((function(t){return t.find((function(t){return t.index.y===l}))}));c||t.map((function(t){var o;return t.push({index:new O.FM((null===(o=t[0])||void 0===o?void 0:o.index.x)||0,l),plannedElement:void 0})}))})),i.push({type:"FixedPositon",grids:[{gridIndex:0,places:[{lowestX:Math.min.apply(Math,(0,d.Z)(o.map((function(t){return t.index.x})))),lowestY:Math.min.apply(Math,(0,d.Z)(o.map((function(t){return t.index.y}))))}]}]})}}])}(),v=i(57330),T=i(57312),V=i(58178),_=m.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),B=function(){function DivaBoxPlanner(t,o){(0,r.Z)(this,DivaBoxPlanner),(0,h.Z)(this,"set",void 0),(0,h.Z)(this,"plannerID",void 0),(0,h.Z)(this,"constructionRulesHandler",void 0),(0,h.Z)(this,"boxPlannerGrid",void 0),(0,h.Z)(this,"nextElementId",1),this.set=t,this.plannerID=o,this.constructionRulesHandler=new p(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner);this.boxPlannerGrid=new P({hasMaxGridRasterHeight:!1,hasMaxGridRasterWidth:!1,forceSingleCellPerElement:!0,forceFixCellRasterSize:!1},this.set.getValueOfOptionOfArticle)}return(0,a.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(E=(0,l.Z)(u().mark((function _callee(t){var o,i,l,r,a,h,c,d,g,E;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null==(o=JSON.parse(m.ZP.decodeBase64(t))).v||2!=o.v){u.next=26;break}if(o.set&&o.set.elements&&0!=o.set.elements.length){u.next=4;break}return u.abrupt("return");case 4:i=o.set.elements,l=0;case 6:if(!(l<i.length)){u.next=21;break}return r=i[l],a=parseInt(r.elementID),h=new T.Z(this.set.getSetId(),r.basketID,a,DivaBoxPlanner.plannerType),this.nextElementId<a+1&&(this.nextElementId=a+1),this.set.setElementId(r.basketID,h.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(h.ElementId)),(c=this.set.getPlannerData(h.ElementId))&&h.updatePlannerData(c),u.next=17,v.Z.loadSVG(h,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(h,r.boxPlannerInfo.gridPosCol,r.boxPlannerInfo.gridPosRow,r.boxPlannerInfo.isOnBackside);case 18:l++,u.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:u.next=42;break;case 26:d=1,l=0;case 28:if(!(l<o.Elements.length)){u.next=38;break}return g=o.Elements[l],(a=parseInt(g.ID))>d&&(d=a),E={boxElementID:g.ID,boxCol:g.col,boxRow:g.row,boxUpdateWholePlanning:!1},u.next=35,this.addPlannerElement(g.BasketID,E);case 35:l++,u.next=28;break;case 38:return this.nextElementId=d+1,this.boxPlannerGrid.updateWorldPosOfElements(),u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return u.abrupt("return",o);case 43:case"end":return u.stop()}}),_callee,this)}))),function initPlanner(t){return E.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=this.boxPlannerGrid.getElementById(o[i]);if(l){for(var r=this.boxPlannerGrid.getCellsInGridByElementId(o[i]),a=l.getDockingDockingPoints(),h=[],c=0;c<a.length;c++){var u,m={id:a[c].DpId,onID:a[c].OnElementId,onDPID:null===(u=a[c].OnDP)||void 0===u?void 0:u.DpId};h.push(m)}var d={elementID:l.getElementId(),basketID:this.set.getBasketId(l.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(l.getElementId()),posNr:l.PosNr,x:l.WorldPosCenter.x,y:l.WorldPosCenter.y,z:l.WorldPosCenter.z,rot:l.RotDeg,width:l.Width?l.Width:-1,height:l.Height?l.Height:-1,depth:l.Depth?l.Depth:-1,DP:h,boxPlannerInfo:{gridPosCol:r.startColIndex,gridPosRow:r.startRowIndex,isOnBackside:r.backside}};t.push(d)}}var g=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:g.width,height:g.height,depth:g.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(g=(0,l.Z)(u().mark((function _callee2(t,o){var i,l,r,a,h;return u().wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:if(null!=o&&null!=o.boxElementID&&null!=o.boxCol&&null!=o.boxRow){c.next=2;break}return c.abrupt("return");case 2:return i=new T.Z(this.set.getSetId(),t,o.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(o.boxElementID)?this.nextElementId:o.boxElementID+1,this.set.setElementId(t,i.ElementId),l=this.set.getPlannerData(i.ElementId),i.updatePlannerData(l),c.next=9,v.Z.loadSVG(i,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||(r=this.set.getConstructionRuleOfElementId(i.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(a=r.constructionRules.forceFixCellRasterSize)||void 0===a||a,forceSingleCellPerElement:null===(h=r.constructionRules.forceSingleCellPerElement)||void 0===h||h,hasMaxGridRasterHeight:r.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:r.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:r.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:r.constructionRules.maxGridRasterWidth},this.constructionRulesHandler.setConstructionRules(r)),this.boxPlannerGrid.addElementAtGridPos(i,o.boxCol,o.boxRow,null!=o.backside&&o.backside),!o.boxUpdateWholePlanning){c.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),c.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return c.stop()}}),_callee2,this)}))),function addPlannerElement(t,o){return g.apply(this,arguments)})},{key:"extendPlanner",value:(d=(0,l.Z)(u().mark((function _callee3(t,o){return u().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),_callee3)}))),function extendPlanner(t,o){return d.apply(this,arguments)})},{key:"movePlannerElement",value:(c=(0,l.Z)(u().mark((function _callee4(t,o){return u().wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return this.boxPlannerGrid.moveElementAsCopy(t,o),this.boxPlannerGrid.updateWorldPosOfElements(),i.next=4,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,"",[t]);case 4:case"end":return i.stop()}}),_callee4,this)}))),function movePlannerElement(t,o){return c.apply(this,arguments)})},{key:"copyPlannerElement",value:(i=(0,l.Z)(u().mark((function _callee5(t,o){var i,l,r,a,h,c,m=this;return u().wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(i=!1,o){u.next=3;break}return u.abrupt("return");case 3:"STD"==o.copyType&&(o.targetElements=[]),l=[],r=this,t.forEach((function(t,r){var a;i||(-1==o.copyIndex.z?m.boxPlannerGrid.getPlannerHasActiveBackside()||m.boxPlannerGrid.prepareGridForBackSideCopy():m.boxPlannerGrid.prepareGridForColCopy(r,o.copyIndex)),i=!0;var h=new T.Z(m.set.getSetId(),t,m.nextElementId,DivaBoxPlanner.plannerType);m.nextElementId++,m.set.setElementId(t,h.ElementId);var c=m.set.getPlannerData(h.ElementId);h.updatePlannerData(c),m.boxPlannerGrid.addElementAsCopy(r,h,o.copyIndex),m.constructionRulesHandler.onElementCopy(r,h.getElementId()),l.push(h),"STD"==o.copyType&&(null===(a=o.targetElements)||void 0===a||a.push(h.getElementId()))})),a=0;case 8:if(!(a<l.length)){u.next=15;break}return u.next=11,v.Z.loadSVG(l[a],this.set);case 11:if(1==o.copyIndex.y&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&this.boxPlannerGrid.getCellsInGridByElementId(l[a].ElementId).endRowIndex+1==r.constructionRulesHandler.getMaxElemCountPerColumn())for(h=l[a].getFreeDockingPointsByType("AVO"),c=0;c<h.length;c++)h[c].disableDP(!0);case 12:a++,u.next=8;break;case 15:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=18,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,o.changedOPT,o.targetElements);case 18:case"end":return u.stop()}}),_callee5,this)}))),function copyPlannerElement(t,o){return i.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){_.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t,o){if(this.constructionRulesHandler.getForceWholePlanningSameHeight())return 0==this.boxPlannerGrid.getCellsInGridByElementId(t).startRowIndex?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(o){return o!=t}));if(this.boxPlannerGrid.getPlannerHasActiveBackside()){if("BoxPlanner_backside"==o)return this.boxPlannerGrid.getAllElementsInBackGrid().map((function(t){return t.ElementId})).filter((function(o){return o!=t}));var i=this.boxPlannerGrid.getOppositeElement(t);if(i)return[i.getElementId()]}return[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,o){var i=[];if(o&&-1==o.copyIndex.z)return this.boxPlannerGrid.getAllElementIdsInGrid();if(o&&"BoxPlanner_COL"==o.copyType){for(var l=this.boxPlannerGrid.getCellsInGridByElementId(t),r=this.boxPlannerGrid.getAllElementsInColumn(l.startColIndex,l.backside),a=0;a<r.length;a++)i.push(r[a].getElementId());return i}if(i.push(t),o){if(0!=o.copyIndex.x)if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var h=this.boxPlannerGrid.getAllElementsInSameCol(t);i=h.elements,h.backside}else{var c=this.boxPlannerGrid.getAllElementsToFillUp(t,o.copyIndex.x>0?"RIGHT":"LEFT");i=c.elements,c.backside}if(0!=o.copyIndex.y&&this.constructionRulesHandler.getForceWholePlanningSameHeight()){var u=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);i=u.elementIds,u.backside}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(i=i.concat(this.boxPlannerGrid.getOppositeElements(i).map((function(t){return t.ElementId}))))}return Array.from(new Set(i))}},{key:"deletePlannerElement",value:(o=(0,l.Z)(u().mark((function _callee6(t,o,i){var l,r,a,h;return u().wrap((function _callee6$(o){for(;;)switch(o.prev=o.next){case 0:if(l=this.boxPlannerGrid.getCellsInGridByElementId(t),r={row:l.startRowIndex,col:l.startColIndex,backside:!1},i&&"BoxPlanner_backside"==i?r={row:0,col:0,backside:!1}:l.startRowIndex>0?r.row--:(r.col=0==l.startColIndex?0:l.startColIndex-1,r.row=this.boxPlannerGrid.getRowCount(r.col,l.backside)-1),this.boxPlannerGrid.deleteElement(t,i),this.constructionRulesHandler.onElemDeleted(t),a=!0,i&&("BoxPlanner_backside"==i?(this.boxPlannerGrid.destroyBacksideModuleGrid(),a=!0):"STD_DONTUPDATE"==i&&(a=!1)),!a){o.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),o.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside)){o.next=13;break}return o.abrupt("return",{newElementToSelect:null===(h=this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside))||void 0===h?void 0:h.getElementId()});case 13:return o.abrupt("return",{});case 14:case"end":return o.stop()}}),_callee6,this)}))),function deletePlannerElement(t,i,l){return o.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos()}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i=this.boxPlannerGrid.getElementById(t);if(!i)return[];var l=null==i?void 0:i.getDockingDockingPointsByType(o);if(!l)return[];for(var r=[],a=0;a<(null==l?void 0:l.length);a++)null!=l[a]&&r.push(l[a].OnElementId);return r}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,o){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,o){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return _.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new V.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,o,i,l,r,a){return _.error(new m.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,l.Z)(u().mark((function _callee7(t,o){var i,l,r,a,h,c,m,d,g,E=this;return u().wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:if(_.debug("BoxPlanner - configurationHasChanged "+t),null==o||o.forEach((function(t){var o;return E.boxPlannerGrid.updateGridElementDimensions(t,null===(o=E.set.getArticleByElementId(t))||void 0===o?void 0:o.plannerData)})),!(t&&o&&o.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){u.next=19;break}if(!(o.length>1)){u.next=10;break}return u.next=6,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o,!0);case 6:if(!(i=u.sent)){u.next=9;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:i});case 9:case 47:case 48:return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[]});case 10:if(l=this.boxPlannerGrid.getCellsInGridByElementId(o[0]),r=o[0],l.startRowIndex>0&&(r=this.boxPlannerGrid.getPlannerElementAtGridPos(l.startColIndex,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(r)&&this.boxPlannerGrid.getElementHasRightElement(r)){u.next=19;break}return a={x:0,y:0,z:0},this.boxPlannerGrid.getElementHasLeftElement(r)||(a.x=-1),this.boxPlannerGrid.getElementHasRightElement(r)||(a.x=1),h=this.getPlannerElementsInfluencedByCopy(r,{copyIndex:a,copyType:"BoxPlanner_COL"}),u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:h,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:o});case 19:if(!t||!t.OPTDMOD){u.next=34;break}u.t0=t.OPTDMOD,u.next="OPVD_EIN"===u.t0?23:"OPVD_AUS"===u.t0?27:32;break;case 23:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=26;break}return c=this.getPlannerElementsInfluencedByCopy(-1,{copyIndex:{x:0,y:0,z:-1},copyType:"BoxPlanner_backside"}),u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:c,copyType:"BoxPlanner_backside",changedOPT:t});case 26:case 31:return u.abrupt("break",32);case 27:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=31;break}if(!((m=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=31;break}return u.abrupt("return",{doDeleteBackGrid:!0,elemIdsToDelete:m.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t});case 32:case 38:u.next=48;break;case 34:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){u.next=40;break}if(!((d=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=38;break}return u.abrupt("return",{doDeleteBackGrid:!0,elemIdsToDelete:d.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:o,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 40:return u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o);case 42:if(!(g=u.sent)){u.next=47;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:g});case 49:case"end":return u.stop()}}),_callee7,this)}))),function updatePlanner(o,i){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,o,i,l){for(var r={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:i},a=this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos(),h=0;h<a.length;h++){var c=a[h],u=c.ElementId,d=this.set.getPlannerConfigData(u).config,g={ID:"E"+u,N:d.N,Model:d.Model,x:-c.WorldPosCenter.x,y:c.WorldPosCenter.y,z:c.WorldPosCenter.z,PosPivot:"Center",w:c.getRotDeg(),RotPivot:"Center",DP:c.getDockingPointJS3D(),MAT:d.MAT,CFG:d.CFG,H:""},E=(0,m.FB)(JSON.stringify(g));g.H=E,r.ELE.push(g)}E=(0,m.FB)(JSON.stringify(r));return r.H=E,{constructionSet:r}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){_.error(new m.GE("BoxPlanner - getElementPosInfo not implemented yet",{code:"WC_0012"}))}},{key:"destroyPlanner",value:function destroyPlanner(){this.boxPlannerGrid.destroyBoxPlannerGrid()}},{key:"getCatalogData",value:function getCatalogData(){return this.set.CatalogData}},{key:"getPlannerBoundingBox",value:function getPlannerBoundingBox(){return this.boxPlannerGrid.getBoundingBox()}},{key:"updatePlannerBoundingBox",value:function updatePlannerBoundingBox(){}},{key:"getPlanningIsComplete",value:function getPlanningIsComplete(){return null!=this.boxPlannerGrid.getPlannerElementAtGridPos(0,0,!1)}},{key:"updateSetPosNr",value:function updateSetPosNr(t){for(var o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=o[i],r=this.boxPlannerGrid.getElementById(l);r&&(r.SetPosNr=t+r.PosNr-1,this.set.setPosNr(r.ElementId,r.getPosNr()))}return o.length}},{key:"clonePlanner",value:function clonePlanner(t,o,i){var l=new DivaBoxPlanner(t,o);return l.initPlanner(i),l}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){return this.boxPlannerGrid.getPlannerInteractionInformation()}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(t){return this.boxPlannerGrid.getGeneralPlanningState(!0,t)}}]);var t,o,i,c,d,g,E}();(0,h.Z)(B,"plannerType","BOX")}}]);
|