CuttingBoard/docs/js/app.62fd703d.js

2 lines
45 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(t){function e(e){for(var n,a,s=e[0],c=e[1],d=e[2],u=0,h=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(i,a)&&i[a]&&h.push(i[a][0]),i[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(t[n]=c[n]);l&&l(e);while(h.length)h.shift()();return o.push.apply(o,d||[]),r()}function r(){for(var t,e=0;e<o.length;e++){for(var r=o[e],n=!0,s=1;s<r.length;s++){var c=r[s];0!==i[c]&&(n=!1)}n&&(o.splice(e--,1),t=a(a.s=r[0]))}return t}var n={},i={app:0},o=[];function a(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=n,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var d=0;d<s.length;d++)e(s[d]);var l=c;o.push([0,"chunk-vendors"]),r()})({0:function(t,e,r){t.exports=r("56d7")},"15d0":function(t,e,r){},"1cce":function(t,e,r){},2440:function(t,e,r){"use strict";r("9c63")},"298b":function(t,e,r){"use strict";r("8938")},"56d7":function(t,e,r){"use strict";r.r(e);r("e260"),r("e6cf"),r("cca6"),r("a79d");var n=r("7a23"),i=Object(n["y"])("data-v-0a5c6a00");Object(n["m"])("data-v-0a5c6a00");var o={class:"sidebar hideOnPrint"},a={class:"toolbar"},s=Object(n["f"])(" Settings"),c=Object(n["f"])(" Wood"),d=Object(n["f"])(" Layers"),l=Object(n["f"])(" Save / load"),u=Object(n["f"])(" Print"),h=Object(n["f"])(" About"),g={class:"tabs"},b={class:"tab"},f={class:"tab"},p={class:"tab"},O={class:"tab"},v=Object(n["g"])("p",null," Use your browser's built-in print functionality (for example, Ctrl+P on Windows) or click the button below to get a printable version of your board and cutting list. ",-1),m=Object(n["g"])("label",{for:"printEndGrain"}," End grain preview",-1),j=Object(n["g"])("label",{for:"printEdgeGrain"}," Edge grain preview",-1),y=Object(n["g"])("label",{for:"printCuttingList"}," Cutting list and bill of materials",-1),w=Object(n["g"])("br",null,null,-1),k={class:"tab"},x=Object(n["g"])("p",null," Below you can download the current settings or load them again from a file. You can also bookmark the current page or copy the URL from the address bar instead, as it is automatically updated whenever you change anything. ",-1),B={type:"file",ref:"loadFile",accept:".json"},L={class:"tab"},P=Object(n["g"])("p",null,[Object(n["f"])(" Created by Mark van Renswoude. Open-source and available under the Unlicense to the public domain on "),Object(n["g"])("a",{href:"https://github.com/MvRens/CuttingBoard",target:"_blank"},"Github"),Object(n["f"])(", where feedback is welcome under Issues. ")],-1),W=Object(n["g"])("p",null,[Object(n["f"])(" Heavily inspired by "),Object(n["g"])("a",{href:"http://www.lastalias.com/cbdesigner/"},"CBdesigner"),Object(n["f"])(". ")],-1),C={class:"content"},G=Object(n["g"])("h1",null,"End grain",-1),$=Object(n["g"])("h1",null,"Edge grain",-1),E={key:0},I=Object(n["g"])("h1",null,"Cutting list",-1);Object(n["l"])();var M=i((function(t,e,r,i,M,T){var H=Object(n["p"])("font-awesome-icon"),S=Object(n["p"])("Settings"),D=Object(n["p"])("Layers"),A=Object(n["p"])("Wood"),q=Object(n["p"])("EndGrainPreview"),U=Object(n["p"])("EdgeGrainPreview"),V=Object(n["p"])("CuttingList");return Object(n["k"])(),Object(n["c"])(n["a"],null,[Object(n["g"])("div",o,[Object(n["g"])("div",a,[Object(n["g"])("a",{class:{active:"settings"===M.tab},onClick:e[1]||(e[1]=function(t){return M.tab="settings"})},[Object(n["g"])(H,{icon:"sliders-h",size:"2x","fixed-width":""}),s],2),Object(n["g"])("a",{class:{active:"wood"===M.tab},onClick:e[2]||(e[2]=function(t){return M.tab="wood"})},[Object(n["g"])(H,{icon:"tree",size:"2x","fixed-width":""}),c],2),Object(n["g"])("a",{class:{active:"layers"===M.tab},onClick:e[3]||(e[3]=function(t){return M.tab="layers"})},[Object(n["g"])(H,{icon:"layer-group",size:"2x","fixed-width":""}),d],2),Object(n["g"])("a",{class:{active:"saveLoad"===M.tab},onClick:e[4]||(e[4]=function(t){return M.tab="saveLoad"})},[Object(n["g"])(H,{icon:"save",size:"2x","fixed-width":""}),l],2),Object(n["g"])("a",{class:{active:"print"===M.tab},onClick:e[5]||(e[5]=function(t){return M.tab="print"})},[Object(n["g"])(H,{icon:"print",size:"2x","fixed-width":""}),u],2),Object(n["g"])("a",{class:{active:"about"===M.tab},onClick:e[6]||(e[6]=function(t){return M.tab="about"})},[Object(n["g"])(H,{icon:"info-circle",size:"2x","fixed-width":""}),h],2)]),Object(n["g"])("div",g,[Object(n["w"])(Object(n["g"])("div",b,[Object(n["g"])(S)],512),[[n["u"],"settings"===M.tab]]),Object(n["w"])(Object(n["g"])("div",f,[Object(n["g"])(D)],512),[[n["u"],"layers"===M.tab]]),Object(n["w"])(Object(n["g"])("div",p,[Object(n["g"])(A)],512),[[n["u"],"wood"===M.tab]]),Object(n["w"])(Object(n["g"])("div",O,[v,Object(n["g"])("div",null,[Object(n["w"])(Object(n["g"])("input",{type:"checkbox","onUpdate:modelValue":e[7]||(e[7]=function(t){return M.printEndGrain=t}),id:"printEndGrain"},null,512),[[n["r"],M.printEndGrain]]),m]),Object(n["g"])("div",null,[Object(n["w"])(Object(n["g"])("input",{type:"checkbox","onUpdate:modelValue":e[8]||(e[8]=function(t){return M.printEdgeGrain=t}),id:"printEdgeGrain"},null,512),[[n["r"],M.printEdgeGrain]]),j]),Object(n["g"])("div",null,[Object(n["w"])(Object(n["g"])("input",{type:"checkbox","onUpdate:modelValue":e[9]||(e[9]=function(t){return M.printCuttingList=t}),id:"printCuttingList"},null,512),[[n["r"],M.printCuttingList]]),y]),w,Object(n["g"])("button",{onClick:e[10]||(e[10]=function(){return T.print&&T.print.apply(T,arguments)})},"Print")],512),[[n["u"],"print"===M.tab]]),Object(n["w"])(Object(n["g"])("div",k,[x,Object(n["g"])("p",null,[Object(n["w"])(Object(n["g"])("input",{type:"text","onUpdate:modelValue":e[11]||(e[11]=function(t){return M.saveFilename=t})},null,512),[[n["t"],M.saveFilename]]),Object(n["g"])("button",{onClick:e[12]||(e[12]=function(){return T.save&&T.save.apply(T,arguments)})},"Save")]),Object(n["g"])("p",null,[Object(n["g"])("input",B,null,512),Object(n["g"])("button",{onClick:e[13]||(e[13]=function(){return T.load&&T.load.apply(T,arguments)})},"Load")])],512),[[n["u"],"saveLoad"===M.tab]]),Object(n["w"])(Object(n["g"])("div",L,[P,W],512),[[n["u"],"about"===M.tab]])])]),Object(n["g"])("div",C,[Object(n["g"])("div",{class:{hideOnPrint:!M.printEndGrain}},[G,Object(n["g"])(q,{scale:1})],2),Object(n["g"])("div",{class:{hideOnPrint:!M.printEdgeGrain}},[$,(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(T.boards,(function(t,e){return Object(n["k"])(),Object(n["c"])(n["a"],null,[T.boards.length>1?(Object(n["k"])(),Object(n["c"])("h2",E,"Board "+Object(n["q"])(e+1),1)):Object(n["d"])("",!0),Object(n["g"])(U,{board:t,scale:1},null,8,["board"])],64)})),256))],2),Object(n["g"])("div",{class:{hideOnPrint:!M.printCuttingList}},[I,Object(n["g"])(V)],2)])],64)})),T=(r("b0c0"),r("8a79"),Object(n["y"])("data-v-7067c7c7"));Object(n["m"])("data-v-7067c7c7");var H={class:"settings"},S=Object(n["g"])("h2",null,"Designer",-1),D=Object(n["g"])("label",{for:"units"},"Units",-1),A=Object(n["g"])("option",{value:"mm"},"Millimeters",-1),q=Object(n["g"])("option",{value:"cm"},"Centimeters",-1),U=Object(n["g"])("option",{value:"inchdecimal"},"Inches (decimal)",-1),V=Object(n["g"])("h2",null,"Tools",-1),_=Object(n["g"])("label",{for:"bladeKerf"},"Blade kerf",-1),F=Object(n["g"])("h2",null,"End grain",-1),K=Object(n["g"])("label",{for:"crosscutWidth"},"Crosscut width",-1);Object(n["l"])();var R=T((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])("div",H,[S,D,Object(n["g"])("select",{id:"units",value:a.settings.units,onChange:e[1]||(e[1]=function(e){return t.$store.commit("updateSettings",{units:e.target.value})})},[A,q,U],40,["value"]),V,_,Object(n["g"])("input",{id:"bladeKerf",type:"number",value:a.settings.bladeKerf,onChange:e[2]||(e[2]=function(e){return t.$store.commit("updateSettings",{bladeKerf:a.parseFloatDef(e.target.value)})})},null,40,["value"]),F,K,Object(n["g"])("input",{id:"crosscutWidth",type:"number",value:a.settings.crosscutWidth,onChange:e[3]||(e[3]=function(e){return t.$store.commit("updateSettings",{crosscutWidth:a.parseFloatDef(e.target.value)})})},null,40,["value"])])})),N=(r("2b19"),25.4),z=10,X=1,Y={convert:function(t,e,r){var n=this.toMillimeters(t,e);return this.fromMillimeters(n,r)},toPixels:function(t,e){return Math.ceil(this.toMillimeters(t,e)*X)},toMillimeters:function(t,e){switch(e){case"mm":return t;case"cm":return t*z;case"inchdecimal":return t*N}return console.error("Invalid units type: "+e),0},fromMillimeters:function(t,e){switch(e){case"mm":return t;case"cm":return t/z;case"inchdecimal":return t/N}return console.error("Invalid units type: "+e),0},display:function(t,e){var r=this.limitDecimals(t,3);switch(e){case"mm":return r+" mm";case"cm":return r+" cm";case"inchdecimal":return r+" inch"}return console.error("Invalid units type: "+e),r},limitDecimals:function(t,e){var r=Math.pow(10,e);return Math.round(t*r)/r}},J={computed:{settings:function(){return this.$store.state.settings}},methods:{parseFloatDef:function(t){var e=parseFloat(t);return Object.is(e,NaN)?0:e}}};r("e9ae");J.render=R,J.__scopeId="data-v-7067c7c7";var Q=J,Z=Object(n["y"])("data-v-342492d6");Object(n["m"])("data-v-342492d6");var tt={class:"name"},et={class:"boardsettings"},rt=Object(n["g"])("label",{for:"boardLength"},"Board length",-1),nt=Object(n["g"])("label",{for:"boardThickness"},"Board thickness",-1),it={class:"layers"},ot=Object(n["e"])('<div class="hint" data-v-342492d6> Tip: click and drag the layer number to move a layer </div><span class="header" data-v-342492d6> </span><span class="header" data-v-342492d6>Wood species</span><span class="header" data-v-342492d6>Width</span><span class="header" data-v-342492d6> </span>',5),at={key:0,class:"widthwarning"},st={class:"add"},ct=Object(n["g"])("h2",null,"Preview settings",-1),dt=Object(n["g"])("label",{for:"borders"}," Show borders",-1),lt=Object(n["g"])("label",{for:"highlightBoard"}," Highlight current board in end grain preview",-1),ut=Object(n["g"])("label",{for:"highlightLayer"}," Highlight current layer in end grain preview",-1),ht=Object(n["g"])("h2",null,"End grain layer direction",-1),gt=Object(n["g"])("label",{for:"directionUniform"}," Uniform",-1),bt=Object(n["g"])("label",{for:"directionAlternate"}," Alternate",-1),ft=Object(n["g"])("label",{for:"directionCustom"}," Custom",-1),pt={key:0},Ot=Object(n["f"])(" Click the strips in the preview to reverse their direction. "),vt={key:0},mt=Object(n["f"])("This may be easier if you "),jt=Object(n["f"])(" the 'Show borders' setting.");Object(n["l"])();var yt=Z((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])(n["a"],null,[Object(n["g"])("div",{class:"board",onMouseenter:e[5]||(e[5]=function(){return a.highlightBoard&&a.highlightBoard.apply(a,arguments)}),onMouseleave:e[6]||(e[6]=function(){return a.removeHighlightBoard&&a.removeHighlightBoard.apply(a,arguments)})},[Object(n["g"])("button",{onClick:e[1]||(e[1]=function(){return a.previousBoard&&a.previousBoard.apply(a,arguments)}),disabled:0==o.boardIndex},"<",8,["disabled"]),Object(n["g"])("div",tt,"Board "+Object(n["q"])(o.boardIndex+1)+" of "+Object(n["q"])(a.boards.length),1),a.boards.length>1?(Object(n["k"])(),Object(n["c"])("button",{key:0,onClick:e[2]||(e[2]=function(){return a.removeBoard&&a.removeBoard.apply(a,arguments)})},"Remove")):Object(n["d"])("",!0),Object(n["g"])("button",{onClick:e[3]||(e[3]=function(){return a.addBoard&&a.addBoard.apply(a,arguments)})},"Add"),Object(n["g"])("button",{onClick:e[4]||(e[4]=function(){return a.nextBoard&&a.nextBoard.apply(a,arguments)}),disabled:o.boardIndex==a.boards.length-1},">",8,["disabled"])],32),null!==a.currentBoard?(Object(n["k"])(),Object(n["c"])(n["a"],{key:0},[Object(n["g"])("div",et,[rt,Object(n["g"])("input",{id:"boardLength",type:"number",value:a.currentBoard.length,onChange:e[7]||(e[7]=function(e){return t.$store.commit("updateBoard",{board:o.boardIndex,values:{length:a.parseFloatDef(e.target.value)}})})},null,40,["value"]),nt,Object(n["g"])("input",{id:"boardThickness",type:"number",value:a.currentBoard.thickness,onChange:e[8]||(e[8]=function(e){return t.$store.commit("updateBoard",{board:o.boardIndex,values:{thickness:a.parseFloatDef(e.target.value)}})})},null,40,["value"])]),Object(n["g"])("div",it,[ot,(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.currentBoard.layers,(function(t,e){return Object(n["k"])(),Object(n["c"])(n["a"],null,[Object(n["g"])("div",{class:["index",{dropTargetAbove:o.dropTarget===e,dropTargetBelow:o.dropTarget===a.currentBoard.layers.length&&e===a.currentBoard.layers.length-1}],ref:"layer"+e,onMousedown:Object(n["x"])((function(t){return a.startDrag(e)}),["prevent"]),onMouseenter:function(t){return a.highlightLayer(e)},onMouseleave:function(t){return a.removeHighlightLayer(e)}},Object(n["q"])(e+1),43,["onMousedown","onMouseenter","onMouseleave"]),Object(n["w"])(Object(n["g"])("select",{"onUpdate:modelValue":function(e){return t.wood=e},class:"wood",onMouseenter:function(t){return a.highlightLayer(e)},onMouseleave:function(t){return a.removeHighlightLayer(e)}},[(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.wood,(function(t,e){return Object(n["k"])(),Object(n["c"])("option",{value:e},Object(n["q"])(t.name),9,["value"])})),256))],40,["onUpdate:modelValue","onMouseenter","onMouseleave"]),[[n["s"],t.wood]]),Object(n["g"])("input",{type:"number",class:"width",value:t.width,onInput:function(e){return t.width=a.parseFloatDef(e.target.value)},onMouseenter:function(t){return a.highlightLayer(e)},onMouseleave:function(t){return a.removeHighlightLayer(e)}},null,40,["value","onInput","onMouseenter","onMouseleave"]),Object(n["g"])("div",{class:"remove",onMouseenter:function(t){return a.highlightLayer(e)},onMouseleave:function(t){return a.removeHighlightLayer(e)}},[Object(n["g"])("button",{onClick:function(t){return a.removeLayer(e)}},"X",8,["onClick"])],40,["onMouseenter","onMouseleave"])],64)})),256)),null!==a.widthWarning?(Object(n["k"])(),Object(n["c"])("div",at,Object(n["q"])(a.widthWarning),1)):Object(n["d"])("",!0),Object(n["g"])("div",st,[Object(n["g"])("button",{onClick:e[9]||(e[9]=function(t){return a.addLayer()})},"Add layer")])]),Object(n["g"])("div",null,[ct,Object(n["g"])("div",null,[Object(n["g"])("input",{id:"borders",type:"checkbox",checked:a.settings.borders,onChange:e[10]||(e[10]=function(e){return t.$store.commit("updateSettings",{borders:e.target.checked})})},null,40,["checked"]),dt]),Object(n["g"])("div",null,[Object(n["g"])("input",{id:"highlightBoard",type:"checkbox",checked:a.settings.highlightBoard,onChange:e[11]||(e[11]=function(e){return t.$store.commit("updateSettings",{highlightBoard:e.target.checked})})},null,40,["checked"]),lt]),Object(n["g"])("div",null,[Object(n["g"])("input",{id:"highlightLayer",type:"checkbox",checked:a.settings.highlightLayer,onChange:e[12]||(e[12]=function(e){return t.$store.commit("updateSettings",{highlightLayer:e.target.checked})})},null,40,["checked"]),ut])]),Object(n["g"])("div",null,[ht,Object(n["g"])("div",null,[Object(n["g"])("input",{id:"directionUniform",type:"radio",checked:"uniform"===a.settings.direction,onChange:e[13]||(e[13]=function(t){return a.setDirection(t,"uniform")})},null,40,["checked"]),gt]),Object(n["g"])("div",null,[Object(n["g"])("input",{id:"directionAlternate",type:"radio",checked:"alternate"===a.settings.direction,onChange:e[14]||(e[14]=function(t){return a.setDirection(t,"alternate")})},null,40,["checked"]),bt]),Object(n["g"])("div",null,[Object(n["g"])("input",{id:"directionCustom",type:"radio",checked:"custom"===a.settings.direction,onChange:e[15]||(e[15]=function(t){return a.setDirection(t,"custom")})},null,40,["checked"]),ft,"custom"===a.settings.direction?(Object(n["k"])(),Object(n["c"])("p",pt,[Ot,a.settings.borders?Object(n["d"])("",!0):(Object(n["k"])(),Object(n["c"])("span",vt,[mt,Object(n["g"])("a",{href:"#",onClick:e[16]||(e[16]=Object(n["x"])((function(e){return t.$store.commit("updateSettings",{borders:!0})}),["prevent"]))},"turn on"),jt]))])):Object(n["d"])("",!0)])])],64)):Object(n["d"])("",!0)],64)})),wt=(r("4160"),r("d81d"),r("13d5"),r("159b"),{data:function(){return{boardIndex:0,dragIndex:null,dropTarget:null,updateHighlightedBoard:!1}},computed:{volatile:function(){return this.$store.state.volatile},settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood},boards:function(){return this.$store.state.boards},currentBoard:function(){return this.boardIndex>=0&&this.boardIndex<this.boards.length?this.boards[this.boardIndex]:null},widthWarning:function(){var t=this;if(null===t.currentBoard||1==t.boards.length)return null;var e=null,r=null,n=null;if(t.boards.forEach((function(i,o){var a=Y.limitDecimals(i.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}),0),3);o==t.boardIndex&&(r=a),(null===e||a<e)&&(e=a),(null===n||a>n)&&(n=a)})),e==n)return null;var i="Your board are not of equal width. The current board is "+Y.display(r,this.settings.units)+" ";return i+=r<n?"while the widest is "+Y.display(n,this.settings.units)+". ":"while the smallest is "+Y.display(e,this.settings.units)+". ",i+="The end grain board will not align.",i},maxBoardWidth:function(){return this.boards.map((function(t){return t.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return e>t?e:t}),0)}},methods:{parseFloatDef:function(t){var e=parseFloat(t);return Object.is(e,NaN)?0:e},previousBoard:function(){this.boardIndex>0&&this.boardIndex--},nextBoard:function(){this.boardIndex<this.boards.length-1&&this.boardIndex++},addBoard:function(){this.$store.commit("addBoard",this.boardIndex),this.boardIndex=this.boards.length-1},removeBoard:function(){this.boards.length<=1||(this.$store.commit("removeBoard",this.boardIndex),this.boardIndex>=this.boards.length&&(this.boardIndex=this.boards.length-1))},addLayer:function(){this.$store.commit("addLayer",this.boardIndex)},removeLayer:function(t){this.$store.commit("removeLayer",{board:this.boardIndex,layer:t})},startDrag:function(t){var e=this,r=this;r.dragIndex=t,r.dropTarget=t;var n,i=function(t){r.dropTarget=r.getTargetLayer(t.pageY)};n=function(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n),r.dragIndex!==r.dropTarget&&r.$store.commit("moveLayer",{board:e.boardIndex,from:r.dragIndex,to:r.dropTarget}),r.dropTarget=null,r.dragIndex=null},document.addEventListener("mousemove",i),document.addEventListener("mouseup",n)},getTargetLayer:function(t){if(null===this.currentBoard||0==this.currentBoard.layers.length)return null;var e=this.getPageOffsetRect(this.$refs.layer0),r=this.getPageOffsetRect(this.$refs["layer"+(this.currentBoard.layers.length-1)]);if(t<=e.bottom)return 0;if(t>=r.bottom)return this.currentBoard.layers.length;if(t>=r.top)return this.currentBoard.layers.length-1;if(null!==this.dropTarget&&this.dropTarget>0&&this.dropTarget<this.currentBoard.layers.length-1){var n=this.getPageOffsetRect(this.$refs["layer"+this.dropTarget]);if(t>=n.top&&t<n.bottom)return this.dropTarget}for(var i=1;i<this.currentBoard.layers.length-1;i++){var o=this.getPageOffsetRect(this.$refs["layer"+i]);if(t>=o.top&&t<o.bottom)return i}return null},getPageOffsetRect:function(t){var e=t.getBoundingClientRect(),r=window.pageXOffset||document.documentElement.scrollLeft,n=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+n,left:e.left+r,right:e.right+r,bottom:e.bottom+n}},setDirection:function(t,e){t.target.checked&&this.$store.commit("updateSettings",{direction:e})},highlightBoard:function(){this.updateHighlightedBoard=!0,this.$store.commit("updateVolatile",{highlightedBoard:this.boardIndex})},removeHighlightBoard:function(){this.updateHighlightedBoard=!1,this.$store.commit("updateVolatile",{highlightedBoard:null})},highlightLayer:function(t){this.$store.commit("updateVolatile",{highlightedBoard:this.boardIndex,highlightedLayer:t})},removeHighlightLayer:function(t){this.volatile.highlightedLayer===t&&this.$store.commit("updateVolatile",{highlightedBoard:null,highlightedLayer:null})}},watch:{boardIndex:function(t){this.updateHighlightedBoard&&this.$store.commit("updateVolatile",{highlightedBoard:t})}}});r("b47d");wt.render=yt,wt.__scopeId="data-v-342492d6";var kt=wt,xt=Object(n["y"])("data-v-15338ab0");Object(n["m"])("data-v-15338ab0");var Bt={class:"wood"},Lt=Object(n["g"])("span",{class:"header"},"Name",-1),Pt=Object(n["g"])("span",{class:"header"},"Colour",-1),Wt=Object(n["g"])("span",{class:"header"}," ",-1),Ct={class:"remove"},Gt={class:"add"};Object(n["l"])();var $t=xt((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])("div",Bt,[Lt,Pt,Wt,(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.wood,(function(t,e){return Object(n["k"])(),Object(n["c"])(n["a"],null,[Object(n["w"])(Object(n["g"])("input",{type:"text",class:"name","onUpdate:modelValue":function(e){return t.name=e}},null,8,["onUpdate:modelValue"]),[[n["t"],t.name]]),Object(n["w"])(Object(n["g"])("input",{type:"color",class:"color","onUpdate:modelValue":function(e){return t.color=e}},null,8,["onUpdate:modelValue"]),[[n["t"],t.color]]),Object(n["g"])("div",Ct,[Object(n["g"])("button",{onClick:function(t){return a.removeWood(e)}},"X",8,["onClick"])])],64)})),256)),Object(n["g"])("div",Gt,[Object(n["g"])("button",{onClick:e[1]||(e[1]=function(t){return a.addWood()})},"Add wood species")])])})),Et={computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood}},methods:{addWood:function(){this.$store.commit("addWood")},removeWood:function(t){this.$store.commit("removeWood",t)}}};r("8b67");Et.render=$t,Et.__scopeId="data-v-15338ab0";var It=Et,Mt=Object(n["y"])("data-v-a8f1d07c");Object(n["m"])("data-v-a8f1d07c");var Tt={class:"preview"},Ht={class:"dimensions"},St={key:0,class:"draghint hideOnPrint"},Dt={id:"dropTarget"};Object(n["l"])();var At=Mt((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])("div",Tt,[Object(n["g"])("div",Ht,"Dimensions: "+Object(n["q"])(a.display(a.boardWidth))+" x "+Object(n["q"])(a.display(a.boardHeight))+" x "+Object(n["q"])(a.display(a.settings.crosscutWidth)),1),a.boards.length>1?(Object(n["k"])(),Object(n["c"])("div",St,"Click and drag strips to reorder them. Click once to reverse the direction.")):Object(n["d"])("",!0),(Object(n["k"])(),Object(n["c"])("svg",{width:a.viewportWidth,height:a.viewportHeight,viewBox:a.viewBox,class:{dragging:null!==o.dropTarget,highlightBoard:a.settings.highlightBoard&&null!==a.volatile.highlightedBoard,highlightLayer:a.settings.highlightLayer&&null!==a.volatile.highlightedBoard&&null!==a.volatile.highlightedLayer}},[Object(n["g"])("defs",null,[(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.boards,(function(t,e){return Object(n["k"])(),Object(n["c"])("g",{id:"strip"+e,class:["boardLayer",{highlightedBoard:e===a.volatile.highlightedBoard}]},[(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(t.layers,(function(r,i){return Object(n["k"])(),Object(n["c"])("rect",{width:a.toPixels(t.thickness),height:a.toPixels(r.width),x:"0",y:a.getBoardLayerOffset(t,i),style:a.getBoardLayerStyle(t,i),class:["layer",{highlightedLayer:e===a.volatile.highlightedBoard&&i==a.volatile.highlightedLayer}]},null,14,["width","height","y"])})),256))],10,["id"])})),256)),Object(n["g"])("g",Dt,[Object(n["g"])("line",{x1:"0",y1:"0",x2:"0",y2:a.boardPixelHeight,style:{stroke:"white","stroke-width":"2"}},null,8,["y2"])])]),(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.endGrain,(function(t,e){return Object(n["k"])(),Object(n["c"])("use",{ref:"strip"+e,href:"#strip"+t.board,x:a.getLayerOffset(e),y:"0",transform:a.getLayerTransform(e),onMousedown:Object(n["x"])((function(t){return a.mouseDown(e,t)}),["prevent"])},null,40,["href","x","transform","onMousedown"])})),256)),null!==o.dropTarget?(Object(n["k"])(),Object(n["c"])("use",{key:0,href:"#dropTarget",x:a.getLayerOffset(o.dropTarget)},null,8,["x"])):Object(n["d"])("",!0)],10,["width","height","viewBox"]))])})),qt=(r("a9e3"),{props:{scale:Number},data:function(){return{dragIndex:null,dropTarget:null}},computed:{volatile:function(){return this.$store.state.volatile},settings:function(){return this.$store.state.settings},boards:function(){return this.$store.state.boards},wood:function(){return this.$store.state.wood},endGrain:function(){return this.$store.state.endGrain},boardWidth:function(){var t=this;return this.endGrain.map((function(e){return e.board>=0&&e.board<t.boards.length?t.boards[e.board].thickness:0})).reduce((function(t,e){return t+e}),0)},boardHeight:function(){return this.boards.map((function(t){return t.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return e>t?e:t}),0)},boardPixelWidth:function(){return this.toPixels(this.boardWidth)},boardPixelHeight:function(){return this.toPixels(this.boardHeight)},viewportWidth:function(){return Math.floor(this.boardPixelWidth*this.scale)},viewportHeight:function(){return Math.floor(this.boardPixelHeight*this.scale)},viewBox:function(){return"0 0 "+this.boardPixelWidth+" "+this.boardPixelHeight}},methods:{toPixels:function(t){return Y.toPixels(t,this.settings.units)},display:function(t){return Y.display(t,this.settings.units)},getBoardLayerOffset:function(t,e){if(e<0||e>=t.layers.length)return 0;for(var r=0,n=0;n<e;n++)r+=t.layers[n].width;return this.toPixels(r)},getBoardLayerStyle:function(t,e){if(e<0||e>=t.layers.length)return"fill: fuchsia";var r=t.layers[e].wood;if(r<0||r>=this.wood.length)return"";var n=this.settings.borders?"; stroke-width: 1; stroke: black":"";return"fill: "+this.wood[r].color+n},getLayerOffset:function(t){if(t<0||t>this.endGrain.length)return 0;for(var e=0,r=0;r<t;r++){var n=this.endGrain[r].board;n>=0&&n<this.boards.length&&(e+=this.boards[n].thickness)}return this.toPixels(e)},getLayerTransform:function(t){var e=!1;switch(this.settings.direction){case"alternate":e=t%2==0;break;case"custom":e=t>=0&&t<this.endGrain.length&&this.endGrain[t].reversed;break}return e?"scale(1, -1) translate(0, -"+this.boardPixelHeight+")":""},reverseLayer:function(t){"custom"===this.settings.direction&&(t<0||t>=this.endGrain.length||(this.endGrain[t].reversed=!this.endGrain[t].reversed))},mouseDown:function(t,e){var r,n=this,i=e.pageX,o=!1,a=function(e){o||Math.abs(e.pageX-i)>=5&&(n.dragIndex=t,o=!0),o&&(n.dropTarget=n.getTargetStrip(e.pageX))};r=function(){document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",r),o?(n.dragIndex!==n.dropTarget&&n.$store.commit("moveEndgrain",{from:n.dragIndex,to:n.dropTarget}),n.dropTarget=null,n.dragIndex=null):n.reverseLayer(t)},document.addEventListener("mousemove",a),document.addEventListener("mouseup",r)},getTargetStrip:function(t){if(0==this.endGrain.length)return null;var e=this.getPageOffsetRect(this.$refs.strip0),r=this.getPageOffsetRect(this.$refs["strip"+(this.endGrain.length-1)]);if(t<=e.right)return 0;if(t>=r.right)return this.endGrain.length;if(t>=r.left)return this.endGrain.length-1;if(null!==this.dropTarget&&this.dropTarget>0&&this.dropTarget<this.endGrain.length-1){var n=this.getPageOffsetRect(this.$refs["strip"+this.dropTarget]);if(t>=n.left&&t<n.right)return this.dropTarget}for(var i=1;i<this.endGrain.length-1;i++){var o=this.getPageOffsetRect(this.$refs["strip"+i]);if(t>=o.left&&t<o.right)return i}return null},getPageOffsetRect:function(t){var e=t.getBoundingClientRect(),r=window.pageXOffset||document.documentElement.scrollLeft,n=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+n,left:e.left+r,right:e.right+r,bottom:e.bottom+n}}}});r("298b");qt.render=At,qt.__scopeId="data-v-a8f1d07c";var Ut=qt,Vt=Object(n["y"])("data-v-a5fd011a");Object(n["m"])("data-v-a5fd011a");var _t={class:"preview"},Ft={class:"dimensions"};Object(n["l"])();var Kt=Vt((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])("div",_t,[Object(n["g"])("div",Ft,"Dimensions: "+Object(n["q"])(a.display(a.boardWidth))+" x "+Object(n["q"])(a.display(a.boardHeight))+" x "+Object(n["q"])(a.display(r.board.thickness)),1),(Object(n["k"])(),Object(n["c"])("svg",{width:a.viewportWidth,height:a.viewportHeight,viewBox:a.viewBox},[(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.layers,(function(t,e){return Object(n["k"])(),Object(n["c"])("rect",{width:a.toPixels(r.board.length),height:a.toPixels(t.width),x:"0",y:a.getLayerOffset(e),style:a.getLayerStyle(e)},null,12,["width","height","y"])})),256))],8,["width","height","viewBox"]))])})),Rt={props:{scale:Number,board:Object},computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood},layers:function(){return this.board.layers},boardWidth:function(){return this.board.length},boardHeight:function(){return 0==this.layers.length?0:this.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}),0)},boardPixelWidth:function(){return this.toPixels(this.boardWidth)},boardPixelHeight:function(){return this.toPixels(this.boardHeight)},viewportWidth:function(){return Math.floor(this.boardPixelWidth*this.scale)},viewportHeight:function(){return Math.floor(this.boardPixelHeight*this.scale)},viewBox:function(){return"0 0 "+this.boardPixelWidth+" "+this.boardPixelHeight}},methods:{toPixels:function(t){return Y.toPixels(t,this.settings.units)},display:function(t){return Y.display(t,this.settings.units)},getLayerOffset:function(t){if(t<0||t>=this.layers.length)return 0;for(var e=0,r=0;r<t;r++)e+=this.layers[r].width;return this.toPixels(e)},getLayerStyle:function(t){if(t<0||t>=this.layers.length)return"fill: fuchsia";var e=this.layers[t].wood;if(e<0||e>=this.wood.length)return"";var r=this.settings.borders?"; stroke-width: 1; stroke: black":"";return"fill: "+this.wood[e].color+r}}};r("6dfb");Rt.render=Kt,Rt.__scopeId="data-v-a5fd011a";var Nt=Rt,zt=Object(n["y"])("data-v-30665a8d");Object(n["m"])("data-v-30665a8d");var Xt={class:"list"},Yt=Object(n["g"])("tr",null,[Object(n["g"])("th",null,"Layer"),Object(n["g"])("th",null,"Wood species"),Object(n["g"])("th",{class:"dimension"},"Width")],-1),Jt={key:0,class:"board"},Qt={colspan:"3"},Zt={class:"dimension"},te=Object(n["g"])("h2",null,"Bill of materials",-1),ee={class:"list"},re=Object(n["g"])("tr",null,[Object(n["g"])("th",null,"Wood species"),Object(n["g"])("th",{class:"dimension"},"Length"),Object(n["g"])("th",{class:"dimension"},"Width"),Object(n["g"])("th",{class:"dimension"},"Thickness")],-1),ne={key:0,class:"board"},ie={colspan:"3"},oe={class:"dimension"},ae={class:"dimension"},se={class:"dimension"};Object(n["l"])();var ce=zt((function(t,e,r,i,o,a){return Object(n["k"])(),Object(n["c"])(n["a"],null,[Object(n["g"])("table",Xt,[Yt,(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.boards,(function(t,e){return Object(n["k"])(),Object(n["c"])(n["a"],null,[a.boards.length>1?(Object(n["k"])(),Object(n["c"])("tr",Jt,[Object(n["g"])("td",Qt,"Board "+Object(n["q"])(e+1),1)])):Object(n["d"])("",!0),(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(t.layers,(function(e,r){return Object(n["k"])(),Object(n["c"])("tr",null,[Object(n["g"])("td",null,Object(n["q"])(r+1),1),Object(n["g"])("td",null,Object(n["q"])(a.getLayerWood(t,r)),1),Object(n["g"])("td",Zt,Object(n["q"])(a.getLayerWidth(t,r)),1)])})),256))],64)})),256))]),te,Object(n["g"])("table",ee,[re,(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(a.bom,(function(t,e){return Object(n["k"])(),Object(n["c"])(n["a"],null,[a.bom.length>1?(Object(n["k"])(),Object(n["c"])("tr",ne,[Object(n["g"])("td",ie,"Board "+Object(n["q"])(e+1),1)])):Object(n["d"])("",!0),(Object(n["k"])(!0),Object(n["c"])(n["a"],null,Object(n["o"])(t,(function(t){return Object(n["k"])(),Object(n["c"])("tr",null,[Object(n["g"])("td",null,Object(n["q"])(t.woodName),1),Object(n["g"])("td",oe,Object(n["q"])(a.display(t.length)),1),Object(n["g"])("td",ae,Object(n["q"])(a.display(t.width)),1),Object(n["g"])("td",se,Object(n["q"])(a.display(t.thickness)),1)])})),256))],64)})),256))])],64)})),de={computed:{settings:function(){return this.$store.state.settings},boards:function(){return this.$store.state.boards},wood:function(){return this.$store.state.wood},bom:function(){var t=this;return t.boards.map((function(e,r){var n=[],i={};for(var o in e.layers.forEach((function(e){i.hasOwnProperty(e.wood)?i[e.wood]+=e.width+t.settings.bladeKerf:i[e.wood]=e.width})),i)i.hasOwnProperty(o)&&n.push({board:r,woodName:o>=0&&o<t.wood.length?t.wood[o].name:"",length:e.length,width:i[o],thickness:e.thickness});return n}))}},methods:{getLayerWood:function(t,e){if(e<0||e>=t.layers.length)return"";var r=t.layers[e].wood;return r<0||r>=this.wood.length?"":this.wood[r].name},getLayerWidth:function(t,e){return e<0||e>=t.layers.length?"":this.display(t.layers[e].width)},display:function(t){return Y.display(t,this.settings.units)}}};r("978e");de.render=ce,de.__scopeId="data-v-30665a8d";var le=de,ue=r("21a6"),he=(r("c975"),r("d3b7"),r("5cc6"),r("9a8c"),r("a975"),r("735e"),r("c1ac"),r("d139"),r("3a7b"),r("d5d6"),r("82f8"),r("e91f"),r("60bd"),r("5f96"),r("3280"),r("3fcc"),r("ca91"),r("25a1"),r("cd26"),r("3c5d"),r("2954"),r("649e"),r("219c"),r("170b"),r("b39a"),r("72f7"),["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"]),ge=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function be(t){if(t>=ge.length)throw new Error("Unable to parse base64 string.");var e=ge[t];if(255===e)throw new Error("Unable to parse base64 string.");return e}function fe(t){var e,r="",n=t.length;for(e=2;e<n;e+=3)r+=he[t[e-2]>>2],r+=he[(3&t[e-2])<<4|t[e-1]>>4],r+=he[(15&t[e-1])<<2|t[e]>>6],r+=he[63&t[e]];return e===n+1&&(r+=he[t[e-2]>>2],r+=he[(3&t[e-2])<<4],r+="=="),e===n&&(r+=he[t[e-2]>>2],r+=he[(3&t[e-2])<<4|t[e-1]>>4],r+=he[(15&t[e-1])<<2],r+="="),r}function pe(t){if(t.length%4!==0)throw new Error("Unable to parse base64 string.");var e=t.indexOf("=");if(-1!==e&&e<t.length-2)throw new Error("Unable to parse base64 string.");for(var r,n=t.endsWith("==")?2:t.endsWith("=")?1:0,i=t.length,o=new Uint8Array(i/4*3),a=0,s=0;a<i;a+=4,s+=3)r=be(t.charCodeAt(a))<<18|be(t.charCodeAt(a+1))<<12|be(t.charCodeAt(a+2))<<6|be(t.charCodeAt(a+3)),o[s]=r>>16,o[s+1]=r>>8&255,o[s+2]=255&r;return o.subarray(0,o.length-n)}var Oe={name:"App",components:{EndGrainPreview:Ut,EdgeGrainPreview:Nt,Settings:Q,Layers:kt,Wood:It,CuttingList:le},data:function(){return{tab:"settings",saveFilename:"My cutting board",printEdgeGrain:!0,printEndGrain:!0,printCuttingList:!0}},created:function(){var t=this,e=function(){if(location.hash){var e=location.hash.substring(1);try{var r=pe(e);r&&t.$store.commit("loadMsgPack",r)}catch(n){console.error(n)}}};e(),window.addEventListener("hashchange",(function(){e()}))},computed:{boards:function(){return this.$store.state.boards},hash:function(){return fe(this.$store.getters.saveMsgPack)}},methods:{save:function(){var t=this.$store.getters.save,e=new Blob([t],{type:"text/plain; charset=utf-8"});Object(ue["saveAs"])(e,this.saveFilename+".json")},load:function(){var t=this,e=this.$refs.loadFile.files[0];if(e){this.saveFilename=e.name.toLowerCase().endsWith(".json")?e.name.substring(0,e.name.length-5):e.name;var r=new FileReader;r.addEventListener("load",(function(e){t.$store.commit("load",e.target.result)})),r.readAsBinaryString(e)}},print:function(){window.print()}},watch:{hash:function(t){history.replaceState({},"","#"+t)}}};r("2440"),r("ac47");Oe.render=M,Oe.__scopeId="data-v-0a5c6a00";var ve=Oe,me=(r("a434"),r("ddb0"),r("5502")),je={mm:"mm",cm:"cm",inchdecimal:"inchdecimal",isValid:function(t){switch(t){case je.mm:case je.cm:case je.inchdecimal:return!0;default:return!1}}},ye={uniform:"uniform",alternate:"alternate",custom:"custom",isValid:function(t){switch(t){case ye.uniform:case ye.alternate:case ye.custom:return t;default:return ye.uniform}}},we=r("d8b3");function ke(){return{units:je.cm,borders:!1,bladeKerf:.35,crosscutWidth:3,direction:ye.alternate,highlightBoard:!0,highlightLayer:!0}}function xe(){return[{name:"Walnut",color:"#58443f"},{name:"Maple",color:"#f2e0aa"},{name:"Cherry",color:"#bb8359"},{name:"Mahogany",color:"#98473f"},{name:"Yellowheart",color:"#ffff84"},{name:"White oak",color:"#fdf4b9"},{name:"Bubinga",color:"#7e3c34"},{name:"Jatoba",color:"#9b281c"},{name:"Padouk",color:"#933350"}]}function Be(){return[{thickness:2,length:70,layers:[{wood:8,width:1},{wood:1,width:1.5},{wood:8,width:2},{wood:1,width:2},{wood:8,width:15},{wood:1,width:2},{wood:8,width:1.5},{wood:1,width:1}]}]}function Le(){var t=ke(),e=Be(),r=[];return Ce(r,t,e),r}var Pe=Object(me["a"])({state:{volatile:{highlightedBoard:null,highlightedLayer:null},settings:ke(),wood:xe(),boards:Be(),endGrain:Le()},mutations:{addLayer:function(t,e){e<0||e>=t.boards.length||t.boards[e].layers.push({wood:0,width:Y.fromMillimeters(20,t.settings.units)})},removeLayer:function(t,e){if(!(e.board<0||e.board>=t.boards.length)){var r=t.boards[e.board];e.layer<0||e.layer>=r.layers.length||r.layers.splice(e.layer,1)}},moveLayer:function(t,e){if(!(e.board<0||e.board>=t.boards.length)){var r=t.boards[e.board];We(r.layers,e.from,e.to)}},addWood:function(t){t.wood.push({name:"Wood #"+(t.wood.length+1),color:"#f2e0aa"})},removeWood:function(t,e){e<0||e>=t.wood.length||(t.boards.forEach((function(t){t.layers.forEach((function(t){t.wood===e?t.wood=-1:t.wood>e&&t.wood--}))})),t.wood.splice(e,1))},updateVolatile:function(t,e){Ge(e,t.volatile)},updateSettings:function(t,e){var r=t.settings.units;Ge(e,t.settings),r!==t.settings.units&&(t.settings.bladeKerf=Y.limitDecimals(Y.convert(t.settings.bladeKerf,r,t.settings.units),3),t.settings.crosscutWidth=Y.limitDecimals(Y.convert(t.settings.crosscutWidth,r,t.settings.units),3),t.boards.forEach((function(e){e.thickness=Y.limitDecimals(Y.convert(e.thickness,r,t.settings.units),3),e.length=Y.limitDecimals(Y.convert(e.length,r,t.settings.units),3),e.layers.forEach((function(e){e.width=Y.limitDecimals(Y.convert(e.width,r,t.settings.units),3)}))})))},addBoard:function(t,e){if(e<0||e>=t.boards.length)t.boards.push({thickness:2,length:70,layers:[]});else{var r=t.boards[e];t.boards.push({thickness:r.thickness,length:r.length,layers:r.layers.map((function(t){return{wood:t.wood,width:t.width}}))}),Ce(t.endGrain,t.settings,t.boards)}},removeBoard:function(t,e){e<0||e>=t.boards.length||(t.boards.splice(e,1),t.endGrain.forEach((function(t){t.board==e?t.board=-1:t.board>e&&t.board--})),Ce(t.endGrain,t.settings,t.boards))},updateBoard:function(t,e){if(!(e.board<0||e.board>=t.boards.length)){var r=t.boards[e.board],n=r.length;Ge(e.values,r),n!==r.length&&Ce(t.endGrain,t.settings,t.boards)}},moveEndgrain:function(t,e){We(t.endGrain,e.from,e.to)},load:function(t,e){var r=JSON.parse(e);Ie(t,r)},loadMsgPack:function(t,e){try{var r=Object(we["deserialize"])(e);r&&Ie(t,r)}catch(n){console.error(n)}}},getters:{save:function(t){var e=He(t,!1);return JSON.stringify(e)},saveMsgPack:function(t){var e=He(t,!0);return Object(we["serialize"])(e)}}});function We(t,e,r){if(!(e<0||e>=t.length)&&!(r<0||r>t.length))if(r==t.length)t.push(t[e]),t.splice(e,1);else{var n=t[e];t.splice(e,1),r>e&&r--,t.splice(r,0,n)}}function Ce(t,e,r){for(var n=[],i=0;i<r.length;i++)n[i]=r[i].length+e.bladeKerf;var o=e.crosscutWidth+e.bladeKerf,a=[];t.forEach((function(t,e){var i=!1;t.board>=0&&t.board<r.length&&(i=n[t.board]>=o,i&&(n[t.board]-=o)),i||a.push(e)}));for(var s=a.length-1;s>=0;s--)t.splice(a[s],1);n.forEach((function(e,r){while(e>=o)t.push({board:r,reversed:!1}),e-=o,e=Y.limitDecimals(e,3)}))}function Ge(t,e){for(var r in t)t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(e[r]=t[r])}function $e(t){var e=parseFloat(t);return isNaN(e)?0:e}function Ee(t){var e=parseInt(t);return isNaN(e)?0:e}function Ie(t,e){var r=Ue(e);Ge(r.settings,t.settings),t.wood=r.wood,t.boards=r.boards,t.endGrain=r.endGrain,Ce(t.endGrain,t.settings,t.boards)}var Me={settings:{self:"settings",units:"units",borders:"borders",bladeKerf:"bladeKerf",crosscutWidth:"crosscutWidth",direction:"direction",highlightBoard:"highlightBoard",highlightLayer:"highlightLayer"},wood:{self:"wood",name:"name",color:"color"},boards:{self:"boards",thickness:"thickness",length:"length",layers:{self:"layers",wood:"wood",width:"width"}},endGrain:{self:"endGrain",board:"board",reversed:"reversed"}},Te={settings:{self:"s",units:"u",borders:"b",bladeKerf:"k",crosscutWidth:"c",direction:"d",highlightBoard:"h",highlightLayer:"l"},wood:{self:"w",name:"n",color:"c"},boards:{self:"b",thickness:"t",length:"x",layers:{self:"l",wood:"w",width:"x"}},endGrain:{self:"e",board:"b",reversed:"r"}};function He(t,e){var r=e?Te:Me,n={};return n[r.settings.self]=Se(t.settings,r),n[r.wood.self]=De(t.wood,r),n[r.boards.self]=Ae(t.boards,r),n[r.endGrain.self]=qe(t.endGrain,r),n}function Se(t,e){var r={};return r[e.settings.units]=t.units,r[e.settings.borders]=t.borders,r[e.settings.bladeKerf]=t.bladeKerf,r[e.settings.crosscutWidth]=t.crosscutWidth,r[e.settings.direction]=t.direction,r[e.settings.highlightBoard]=t.highlightBoard,r[e.settings.highlightLayer]=t.highlightLayer,r}function De(t,e){return 0===t.length?[]:t.map((function(t){var r={};return r[e.wood.name]=t.name,r[e.wood.color]=t.color,r}))}function Ae(t,e){return t.map((function(t){var r={};return r[e.boards.length]=t.length,r[e.boards.thickness]=t.thickness,r[e.boards.layers.self]=t.layers.map((function(t){var r={};return r[e.boards.layers.wood]=t.wood,r[e.boards.layers.width]=t.width,r})),r}))}function qe(t,e){return t.map((function(t){var r={};return r[e.endGrain.board]=t.board,r[e.endGrain.reversed]=t.reversed,r}))}function Ue(t){var e=t.hasOwnProperty(Te.settings.self)?Te:Me,r={settings:Ve(t,e),wood:_e(t,e),boards:Fe(t,e),endGrain:Ke(t,e)};return t.hasOwnProperty("settings")&&(t.settings.hasOwnProperty("alternateDirection")&&(r.settings.direction=t.settings.alternateDirection?ye.alternate:ye.uniform),t.settings.hasOwnProperty("boardLength")&&(r.boards[0].length=$e(t.settings.boardLength)),t.settings.hasOwnProperty("boardThickness")&&(r.boards[0].thickness=$e(t.settings.boardThickness))),t.hasOwnProperty(e.settings.self)&&(t[e.settings.self].hasOwnProperty(e.settings.highlightBoard)||(r.settings.highlightBoard=!0),t[e.settings.self].hasOwnProperty(e.settings.highlightLayer)||(r.settings.highlightLayer=!0)),0===r.endGrain.length&&Ce(r.endGrain,r.settings,r.boards),r}function Ve(t,e){if(!t.hasOwnProperty(e.settings.self))return ke();var r=t[e.settings.self];return{units:je.isValid(r[e.settings.units])?r[e.settings.units]:je.cm,borders:!0===r[e.settings.borders],bladeKerf:$e(r[e.settings.bladeKerf]),crosscutWidth:$e(r[e.settings.crosscutWidth]),direction:ye.isValid(r[e.settings.direction])?r[e.settings.direction]:ye.uniform,highlightBoard:!0===r[e.settings.highlightBoard],highlightLayer:!0===r[e.settings.highlightLayer]}}function _e(t,e){return t.hasOwnProperty(e.wood.self)&&Array.isArray(t[e.wood.self])?t[e.wood.self].map((function(t){return{name:t[e.wood.name],color:/^#[0-9A-F]{6}$/i.test(t[e.wood.color]||"")?t[e.wood.color]:"#000000"}})):[]}function Fe(t,e){if(!t.hasOwnProperty(e.boards.self)||!Array.isArray(t[e.boards.self]))return[];var r=t[e.boards.self].map((function(t){var r={thickness:$e(t[e.boards.thickness]),length:$e(t[e.boards.length]),layers:[]};return t.hasOwnProperty(e.boards.layers.self)&&Array.isArray(t[e.boards.layers.self])&&(r.layers=t[e.boards.layers.self].map((function(t){return{wood:Ee(t[e.boards.layers.wood]),width:$e(t[e.boards.layers.width])}}))),r}));return r.length>0?r:{length:0,thickness:0,layers:[]}}function Ke(t,e){return t.hasOwnProperty(e.endGrain.self)&&Array.isArray(t[e.endGrain.self])?t[e.endGrain.self].map((function(t){return{board:Ee(t[e.endGrain.board]),reversed:!0===t[e.endGrain.reversed]}})):[]}var Re=r("ecee"),Ne=r("c074"),ze=r("ad3d");Re["c"].add(Ne["e"],Ne["b"],Ne["d"],Ne["c"],Ne["a"],Ne["f"]),Object(n["b"])(ve).use(Pe).component("font-awesome-icon",ze["a"]).mount("#app")},"6dfb":function(t,e,r){"use strict";r("1cce")},8938:function(t,e,r){},"8b67":function(t,e,r){"use strict";r("c355")},"978e":function(t,e,r){"use strict";r("bfd1")},"9c63":function(t,e,r){},"9e1e":function(t,e,r){},"9f4a":function(t,e,r){},ac47:function(t,e,r){"use strict";r("9f4a")},b47d:function(t,e,r){"use strict";r("15d0")},bfd1:function(t,e,r){},c355:function(t,e,r){},e9ae:function(t,e,r){"use strict";r("9e1e")}});
//# sourceMappingURL=app.62fd703d.js.map