text: (this["webpackJsonpbullet-buddy"]=this["webpackJsonpbullet-buddy"]||[]).push([[0],{391:function(e,t,a){e.exports=a(723)},395:function(e,t,a){},396:function(e,t,a){},723:function(e,t,a){"use strict";a.r(t);var n=a(2),r=a.n(n),l=a(46),i=a.n(l),o=(a(395),a(86)),s=a(87),u=a(120),c=a(89),p=a(88),h=a(756),b=a(758),d=a(757),m=a(763),f=a(759),v=(a(396),r.a.Component,a(268)),g=a.n(v),x=a(369),y=a(222),w=a(386),E=a(753),T=a(370),C=a.n(T),k=a(214),S=a.n(k),O=(a(413),function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).handlePopoverOpen=function(e){n.setState({open:!0})},n.handlePopoverClose=function(){n.setState({open:!1})},n.isNotEditable=function(e){return null!=e.match(/([A-Z]{2,})/)|null!=e.match(/([0-9])/)|e.length<=2|n.props.index<1},n.getAbbreviations=function(e){if(null===n.props.abbreviationData)return null;var t=n.props.abbreviationData.find((function(t){return t.abbr===e.toLowerCase()|t.value.toLowerCase()===e.toLowerCase()}));return"undefined"===typeof t?null:t},n.getSynonyms=function(e){C.a.get("https://api.datamuse.com/words?max=15&ml="+e).then((function(e){if(200===e.status){var t=e.data;if(0!==t.length){var a=t.map((function(e){return e.word}));n.setState({synonyms:a})}}})).catch((function(e){}))},n.state={open:!1,anchorE1:null,synonyms:null,isEditable:null},n.handlePopoverClose=n.handlePopoverClose.bind(Object(u.a)(n)),n.handlePopoverOpen=n.handlePopoverOpen.bind(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){this.isNotEditable(this.props.value)?this.setState({isEditable:!1}):(this.getSynonyms(this.props.value),this.setState({isEditable:!0}))}},{key:"componentDidUpdate",value:function(e){this.props.value!==e.value&&this.state.isEditable&&this.getSynonyms(this.props.value)}},{key:"render",value:function(){var e=this,t=this.props.value,a="bullet-editor-word-editable",n=this.getAbbreviations(t);if(null!==n){if(n.value.toLowerCase()===t.toLowerCase())return a+=" abbreviable popup",r.a.createElement("span",{className:a,onMouseEnter:this.handlePopoverOpen,onMouseLeave:this.handlePopoverClose},t,r.a.createElement("span",{className:this.state.open?"popuptext show":"popuptext"},r.a.createElement("ul",{className:"popuptextlist"},r.a.createElement("li",{className:"synonym-button",onClick:function(){return e.props.changeWord(n.abbr,e.props.parentIndex)}},n.abbr))));if(n.abbr===t)return a+=" approved-abbreviation popup",r.a.createElement("span",{className:a,onMouseEnter:this.handlePopoverOpen,onMouseLeave:this.handlePopoverClose},t,r.a.createElement("span",{className:this.state.open?"popuptext show":"popuptext"},r.a.createElement("ul",{className:"popuptextlist"},r.a.createElement("li",{className:"synonym-button",onClick:function(){return e.props.changeWord(n.value.toLowerCase(),e.props.parentIndex)}},n.value))))}if(this.isNotEditable(t))return a="bullet-editor-word popup",r.a.createElement("span",{className:a},t);a+=" popup";var l=null;return null!==this.state.synonyms&&(l=this.state.synonyms.map((function(t){return r.a.createElement("li",{className:"synonym-button",onClick:function(){return e.props.changeWord(t,e.props.parentIndex)}},t)}))),r.a.createElement("span",{className:a,onMouseEnter:this.handlePopoverOpen,onMouseLeave:this.handlePopoverClose},t,r.a.createElement("span",{className:this.state.open?"popuptext show":"popuptext"},r.a.createElement("ul",{className:"popuptextlist"},l)))}}]),a}(r.a.Component)),j=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).tokenize=function(e){var t=[];if(null!==e.match(";")&&null!==e.match(/-{2}/)){var a=e.split(/;|-{2}/),n=Object(w.a)(a,3),r=n[0],l=n[1],i=n[2];r=r.split(/[\s]/),l=l.split(/[\s]/),i=i.split(/[\s]/),t=[].concat(Object(y.a)(r),[";"],Object(y.a)(l),["--"],Object(y.a)(i))}else t=e.split(/\s/);return t},n.tweak=function(e){return e=(e=e.replace(/(\w)\//g,"$1/\u200b")).replace(/-/g,"\u2011")},n.updateBullet=function(e){return n.tokenize(e)},n.changeWord=function(e,t){var a=n.tokenize(n.props.text);a[t]=e,n.props.updateBulletText(a.join(" "),n.props.parentIndex)},n.state={indexOfColon:null,indexOfDashes:null},n.changeWord=n.changeWord.bind(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"render",value:function(){var e=this,t=this.props.text;return this.tokenize(t).map((function(t,a){return r.a.createElement(O,{value:t,parentIndex:a,changeWord:e.changeWord,abbreviationData:e.props.abbreviationData})}))}}]),a}(r.a.Component),B=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).extractBullets=function(e){var t=e.split(/-\s{1}/);return t.shift(),t=t.map((function(e){return"- "+e.trim()}))},n.updateBulletText=function(e,t){var a=n.state.bullets;a[t]=e,a.join(" "),a[t]=a[t].replace(/\s;\s/,";"),a[t]=a[t].replace(/\s-{2}\s/,"--"),a[t]="- "+a[t].charAt(2).toUpperCase()+a[t].slice(3),n.props.updateInputText(a.join("\n"))},n.onChange=function(e,t){var a=e.nativeEvent.target.childNodes;a=Array.from(a).map((function(e){return e.innerText}));window.getSelection();n.updateBulletText(a.join(" "),t)},n.state={bullets:[]},n.ref=r.a.createRef(),n.updateBulletText=n.updateBulletText.bind(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){this.setState({bullets:this.extractBullets(this.props.inputBullets)})}},{key:"componentDidUpdate",value:function(e){this.props.inputBullets!==e.inputBullets&&this.setState({bullets:this.extractBullets(this.props.inputBullets)})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("div",{className:"bullet-editor",style:{width:this.props.width}},this.state.bullets.map((function(t,a){return r.a.createElement("span",{ref:e.ref,className:"bullet-editor-bullet"},r.a.createElement(j,{text:t,updateBulletText:e.updateBulletText,parentIndex:a,abbreviationData:e.props.abbreviationData}))}))),r.a.createElement("div",{className:"legend"},"Legend:",r.a.createElement("span",{className:"approved-abbreviation"},"Approved Abbreviation"),r.a.createElement("span",{className:"abbreviable"},"Abbreviable Word"),r.a.createElement("span",{className:"bullet-editor-word-editable"},"Synonyms Available")))}}]),a}(r.a.Component),A=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).xToPx=function(e){var t=document.createElement("div");t.style.display="block",t.style.height=e,document.body.appendChild(t);var a=parseFloat(window.getComputedStyle(t,null).height);return t.parentNode.removeChild(t),a},n.evaluateBullet=function(){if(null!==n.ref){var e=n.ref.current,t=e.parentNode,a=n.xToPx(n.props.width),r=t.style.width;t.style.width="800.00mm";var l=e.getBoundingClientRect(),i=l.width;l.height;return t.style.width=r,{widthDiff:i-a}}},n.getNormalBullet=function(e){var t=e.split(/\s/);return t.shift(),"- "+(t=t.join(" ")).trim()},n.getSmallestBullet=function(e){var t=e.split(/\s/);return t.shift(),"- "+(t=t.join("\u2006")).trim()},n.getLargestBullet=function(e){var t=e.split(/\s/);return t.shift(),"- "+(t=t.join("\u2004")).trim()},n.tweak=function(e){return e=(e=e.replace(/(\w)\//g,"$1/\u200b")).replace(/-/g,"\u2011")},n.ref=r.a.createRef(),n.state={idealHeight:null,idealWidth:null,optimized:!1,bulletText:null},n.processing=!1,n.processed=!1,n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){this.setState({bulletText:this.props.bulletText})}},{key:"componentDidUpdate",value:function(e,t){var a=this.state.currentBulletText,n=this.props.width,r=t.bulletText!==a&&null!==a;this.props.bulletText!==e.bulletText|n!==e.width?(console.log("did update with new props"),this.processing=!1,this.processed=!1,this.setState({bulletText:this.props.bulletText,optimized:!1})):!r||this.processing||this.processed||(console.log("did update with new state to process"),this.optimizeBullet(),this.props.handleBulletChange(this.state.bulletText,this.props.index))}},{key:"setStateAsync",value:function(e){var t=this;return new Promise((function(a){t.setState(e,a)}))}},{key:"optimizeBullet",value:function(){var e=Object(x.a)(g.a.mark((function e(){var t,a,n,r,l,i,o,s,u,c,p,h,b,d,m;return g.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==(t=this.state.bulletText)){e.next=3;break}return e.abrupt("return");case 3:return this.processing=!0,console.log("building bullet: "+t),t=this.getNormalBullet(t),e.next=8,this.setStateAsync({bulletText:t});case 8:if(a=this.evaluateBullet(),n=t,r=!0,!(a.widthDiff>-.02&&a.widthDiff<0)){e.next=17;break}return console.log("Bullet Already Optimized"),this.processed=!0,this.processing=!1,this.setState({bulletText:t,optimized:!0}),e.abrupt("return");case 17:a.widthDiff>0?(console.log("Shrinking Bullet: "+t),r=!1):console.log("Shrinking Bullet: "+t),l=[],Array.from(t).map((function(e,t){e.match(/\s/)&&l.push(t)})),l.shift(),i=!1,o=[],s=0,u=l.length,c=!0,p=0;case 27:if(!(p<u)){e.next=44;break}e.t0=s,e.next=0===e.t0?31:1===e.t0?33:2===e.t0?35:38;break;case 31:return o.push(l.shift()),e.abrupt("break",39);case 33:return o.push(l.pop()),e.abrupt("break",39);case 35:return h=l.splice(Math.floor(l.length/2),1),o.push(h[0]),e.abrupt("break",39);case 38:return e.abrupt("break",39);case 39:3===(s+=1)&&(s=0);case 41:p++,e.next=27;break;case 44:if(i){e.next=71;break}if(0!==o.length){e.next=50;break}return console.log("exhausted all index values"),i=!0,c=!1,e.abrupt("continue",44);case 50:return b=r?"\u2004":"\u2006",d=o.shift(),t=t.substring(0,d)+b+t.substring(d+1),e.next=55,this.setStateAsync({bulletText:t});case 55:if(m=this.evaluateBullet(),!r){e.next=64;break}if(!(m.widthDiff<0)){e.next=61;break}return a=m,n=t,e.abrupt("continue",44);case 61:m.widthDiff>0&&(t=n,i=!0,c=!0),e.next=69;break;case 64:if(!(m.widthDiff>0)){e.next=68;break}return a=m,n=t,e.abrupt("continue",44);case 68:m.widthDiff<0&&(c=!0,i=!0);case 69:e.next=44;break;case 71:return this.processed=!0,this.processing=!1,this.setState({bulletText:t,optimized:c}),e.abrupt("return",t);case 75:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this.state.optimized?"bullet-output-bullet optimized":"bullet-output-bullet notoptimized";return r.a.createElement("div",{className:e,ref:this.ref},this.state.bulletText)}}]),a}(r.a.Component),D=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).extractBullets=function(e){var t=e.split(/-\s{1}/);return t.shift(),t=t.map((function(e){return"- "+e.trim()+"\r\n"}))},n.handleSelectionCopy=function(e){e.preventDefault();var t=window.getSelection().toString();(t=(t=n.extractBullets(t)).join("")).replace(/\n/g,"\r\n"),e.clipboardData.setData("text/plain",t)},n.handleCopyButtonClick=function(e){var t=document.createRange();t.selectNode(n.ref.current),window.getSelection().removeAllRanges(),window.getSelection().addRange(t),document.execCommand("copy"),window.getSelection().removeAllRanges()},n.handleBulletChange=function(e,t){var a=n.state.bullets;a[t]=e,n.setState({bullets:a})},n.state={bullets:[]},n.ref=r.a.createRef(),n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){this.setState({bullets:this.extractBullets(this.props.bulletsText)})}},{key:"componentDidUpdate",value:function(e){this.props.bulletsText!==e.bulletsText&&this.setState({bullets:this.extractBullets(this.props.bulletsText)})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("div",{className:"bullet-output-container",style:{width:this.props.width},onCopy:this.handleSelectionCopy},r.a.createElement("p",null,"XX. AMAZING BULLETS ",r.a.createElement("mark",null,"(Dont forget to copy to the right place!)")),r.a.createElement("div",{ref:this.ref},this.state.bullets.map((function(t,a){return r.a.createElement(A,{width:e.props.width,bulletText:t,index:a,handleBulletChange:e.handleBulletChange})})))),r.a.createElement(E.a,{variant:"outlined",color:"primary",size:"small",onClick:function(t){return e.handleCopyButtonClick(t)},startIcon:r.a.createElement(S.a,null)},"Copy Bullets to Clipboard"))}}]),a}(r.a.Component),N=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).handleCopyButtonClick=function(e){var t=document.createRange();t.selectNode(n.ref.current),window.getSelection().removeAllRanges(),window.getSelection().addRange(t),document.execCommand("copy"),window.getSelection().removeAllRanges()},n.extractAcroyms=function(){var e=n.props.text;if(null===e)return"no acronyms yet";var t=e.match(/[A-Z]{2,}/g);if(null===t)return"no acronyms yet";t=t.sort();var a=[];return t=t.map((function(e){if(-1===a.indexOf(e))return a.push(e)," ("+e+"); "}))},n.ref=r.a.createRef(),n}return Object(s.a)(a,[{key:"render",value:function(){var e=this,t=this.extractAcroyms();return r.a.createElement("div",null,r.a.createElement("div",{className:"bullet-output-container",style:{width:this.props.width}},r.a.createElement("p",null,"X. REMARKS ",r.a.createElement("mark",null,"(use this section to spell out acronyms from the front)")),r.a.createElement("div",{className:"bullet-output-bullet",ref:this.ref},t)),r.a.createElement(E.a,{variant:"outlined",color:"primary",size:"small",onClick:function(t){return e.handleCopyButtonClick(t)},startIcon:r.a.createElement(S.a,null)},"Copy Acronym List to Clipboard"))}}]),a}(r.a.Component),R=a(385),z={columns:[{data:"value",type:"text"},{data:"abbr",type:"text"}],stretchH:"all",width:500,autoWrapRow:!0,height:500,maxRows:1/0,manualRowResize:!0,manualColumnResize:!0,rowHeaders:!1,colHeaders:["Word","Abbreviation"],trimWhitespace:!1,enterBeginsEditing:!1,manualRowMove:!0,manualColumnMove:!0,columnSorting:{indicator:!0},autoColumnSize:!1,minRows:2,minSpareRows:1,contextMenu:!0,licenseKey:"non-commercial-and-evaluation",search:{queryMethod:function(e,t){return e.toString()===t.toString()},callback:function(e,t,a,n,r){var l=function(e,t,a,n,r){e.getCellMeta(t,a).isSearchResult=r};l.apply(this,arguments)}}},I=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).handleChange=function(e){null!==e&&n.props.onAbbrevitionDataChange(e)},n.state={},n}return Object(s.a)(a,[{key:"render",value:function(){var e=this.props.abbreviationData;return r.a.createElement(R.a,{className:"abbreviation-table",settings:z,data:e,afterChange:this.handleChange})}}]),a}(r.a.Component),P=a(760),M=a(761),W=a(384),U=a.n(W),L=a(762),H=a(383),J=a.n(H),F=function(e){Object(c.a)(a,e);var t=Object(p.a)(a);function a(e){var n;return Object(o.a)(this,a),(n=t.call(this,e)).saveSettings=function(e){try{window.localStorage.setItem("settings",JSON.stringify(e))}catch(t){console.log(t)}},n.getSettings=function(){try{if(window.localStorage.getItem("settings"))return JSON.parse(window.localStorage.getItem("settings"))}catch(e){return console.log(e),null}return null},n.onAbbreviationTableChange=function(e){var t=n.state.abbreviationData;n.setAbbreviationTable(t),console.log(t);var a={abbreviationData:t};n.saveSettings(a)},n.setAbbreviationTable=function(e){var t=e.filter((function(e){return null!==e.value&&null!==e.abbr}));t=t.map((function(e){return e.abbr=e.abbr.trim(),e.value=e.value.trim(),e})),n.setState({abbreviationTable:t})},n.handleTextAreaUpdate=function(e){n.inputTextRef.current.style.height=n.inputTextRef.current.scrollHeight+"px",n.setState({bulletInputText:e})},n.bulletTypeChange=function(e,t){n.setState({tabValue:t,bulletType:["OPR","EPR","AWD"][t]})},n.toggleDrawer=function(e,t){("keydown"!==e.type||"Tab"!==e.key&&"Shift"!==e.key)&&n.setState({drawerOpen:t})},n.state={bulletInputText:"- Action section of bullet should go here; put the how/what you did in this part--bring it home w/ a great impact line\n- This tool can optimize spacing; output will be red if the optimizer could not fix spacing with 2004 or 2006 Unicode spaces",abbreviationData:[{value:"organizations",abbr:"orgs"},{value:"expandable",abbr:"expdble"}],abbreviationTable:[{value:"organizations",abbr:"orgs"},{value:"expandable",abbr:"expdble"}],bulletType:"OPR",tabValue:0,drawerOpen:!1},n.inputTextRef=r.a.createRef(),n.handleTextAreaUpdate=n.handleTextAreaUpdate.bind(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"componentDidMount",value:function(){var e=document.querySelector(".loader-container");e&&e.remove();var t=this.getSettings();null!==t&&(this.setState({abbreviationData:t.abbreviationData}),this.setAbbreviationTable(t.abbreviationData))}},{key:"componentDidUpdate",value:function(){}},{key:"render",value:function(){var e=this,t={AWD:"202.321mm",EPR:"202.321mm",OPR:"201.050mm"},a=t[this.state.bulletType];return r.a.createElement("div",{id:"root",className:"root"},r.a.createElement(h.a,{position:"static",className:"app-bar"},r.a.createElement(d.a,null,r.a.createElement(b.a,{variant:"h6",color:"inherit",className:"title"},"Bullet Buddy!"),r.a.createElement(m.a,{className:"",value:this.state.tabValue,onChange:this.bulletTypeChange},r.a.createElement(f.a,{label:"OPR"}),r.a.createElement(f.a,{label:"EPR"}),r.a.createElement(f.a,{label:"AWD"})),r.a.createElement(E.a,{size:"small",variant:"outlined",color:"inherit",startIcon:r.a.createElement(J.a,null),onClick:function(t){return e.toggleDrawer(t,!0)}},"Abbreviations"))),r.a.createElement(P.a,{className:"content",maxWidth:"xl"},r.a.createElement(M.a,{container:!0,justify:"space-around"},r.a.createElement(M.a,{item:!0,xs:12,md:12,lg:12,xl:6,spacing:1,align:"center"},r.a.createElement(b.a,{variant:"h6"},"Input Bullets Here"),r.a.createElement("textarea",{ref:this.inputTextRef,value:this.state.bulletInputText,rows:6,onChange:function(t){return e.handleTextAreaUpdate(t.target.value)},className:"bullet-input-text",style:{width:t[this.state.bulletType],resize:"none",minHeight:"5em"}}),r.a.createElement("div",null,r.a.createElement(E.a,{variant:"outlined",color:"primary",size:"small",startIcon:r.a.createElement(U.a,null),onClick:function(){e.handleTextAreaUpdate(""),e.inputTextRef.current.style.height="5em"}},"Clear Input")),r.a.createElement(b.a,{variant:"h6",component:"h2"},"Smart Bullet Editor"),r.a.createElement(B,{inputBullets:this.state.bulletInputText,updateInputText:this.handleTextAreaUpdate,abbreviationData:this.state.abbreviationTable,width:a})),r.a.createElement(M.a,{item:!0,xs:12,md:12,lg:12,xl:6,spacing:1,align:"center"},r.a.createElement(b.a,{variant:"h6",component:"h2"},"Bullet Output"),r.a.createElement(D,{bulletsText:this.state.bulletInputText,width:a,updateInputText:this.handleTextAreaUpdate}),r.a.createElement(N,{width:a,text:this.state.bulletInputText}))),r.a.createElement(L.a,{className:"drawer",anchor:"bottom",open:this.state.drawerOpen,onClose:function(t){return e.toggleDrawer(t,!1)}},r.a.createElement("div",{className:"drawer-header"},r.a.createElement(b.a,{variant:"h6"},"Current Abbreviations Table"),r.a.createElement(b.a,{variant:"subtitle1"},"Copy your organizations approved abbreviations into the table. (They will save in your browser for future use!)")),r.a.createElement(I,{abbreviationData:this.state.abbreviationData,onAbbrevitionDataChange:this.onAbbreviationTableChange}))),r.a.createElement("div",{class:"bottom-text"},r.a.createElement("p",null,"This site utilizes ",r.a.createElement("a",{href:"https://material-ui.com/"}," Material-UI"),", ",r.a.createElement("a",{href:"https://handsontable.com/"},"HandsOnTable"),", and the ",r.a.createElement("a",{href:"https://www.datamuse.com/api/"},"DataMuse API")," The inspiration for this tool came from the ",r.a.createElement("a",{href:"https://ea-pods-team.github.io/pdf-bullets/ "}," EA-Pods Team pdf-bullets project")),r.a.createElement("p",null,"Submit an ",r.a.createElement("a",{href:"https://github.com/AF-Tools/bullet-buddy/issues/new/choose"},"issue")," or view our ",r.a.createElement("a",{href:"https://github.com/AF-Tools/bullet-buddy/"},"GitHub Page")),r.a.createElement("p",null,"Maintained by Nicholas Schweikart")))}}]),a}(r.a.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));i.a.render(r.a.createElement(r.a.StrictMode,null,r.a.createElement(F,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))}},[[391,1,2]]]);
  //# sourceMappingURL=main.6d4024a7.chunk.js.map