var b=Object.defineProperty;var w=(s,e,a)=>e in s?b(s,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[e]=a;var d=(s,e,a)=>(w(s,typeof e!="symbol"?e+"":e,a),a);import{a as t}from"./assets/vendor.33e7bd35.js";function n(s){return Math.round(Math.random()*1e3)%s}const i=["pretty","large","big","small","tall","short","long","handsome","plain","quaint","clean","elegant","easy","angry","crazy","helpful","mushy","odd","unsightly","adorable","important","inexpensive","cheap","expensive","fancy"],c=["red","yellow","blue","green","pink","brown","purple","brown","white","black","orange"],h=["table","chair","house","bbq","desk","car","pony","cookie","sandwich","burger","pizza","mouse","keyboard"];let y=1;function r(s){const e=new Array(s);for(let a=0;a<s;a++)e[a]={id:y++,label:`${i[n(i.length)]} ${c[n(c.length)]} ${h[n(h.length)]}`};return e}class g extends t.Component{constructor(){super(...arguments);d(this,"onSelect",()=>{this.props.select(this.props.item)});d(this,"onRemove",()=>{this.props.remove(this.props.item)})}shouldComponentUpdate(e){return e.item!==this.props.item||e.selected!==this.props.selected}render(){let{selected:e,item:a}=this.props;return t.h("tr",{className:e?"danger":""},t.h("td",{className:"col-md-1"},a.id),t.h("td",{className:"col-md-4"},t.h("a",{onClick:this.onSelect},a.label)),t.h("td",{className:"col-md-1"},t.h("a",{onClick:this.onRemove},t.h("span",{className:"glyphicon glyphicon-remove",ariaHidden:"true"}))),t.h("td",{className:"col-md-6"}))}}class l extends t.Component{render(){return t.h("div",{className:"col-sm-6 smallpad"},t.h("button",{type:"button",className:"btn btn-primary btn-block",id:this.props.id,onClick:this.props.cb},this.props.title))}}class v extends t.Component{render(){const{run:e,runLots:a,add:o,update:p,clear:m,swapRows:u}=this.props;return t.h("div",{className:"jumbotron"},t.h("div",{className:"row"},t.h("div",{className:"col-md-6"},t.h("h1",null,"Art")),t.h("div",{className:"col-md-6"},t.h("div",{className:"row"},t.h(l,{id:"run",title:"Create 1,000 rows",cb:e}),t.h(l,{id:"runlots",title:"Create 10,000 rows",cb:a}),t.h(l,{id:"add",title:"Append 1,000 rows",cb:o}),t.h(l,{id:"update",title:"Update every 10th row",cb:p}),t.h(l,{id:"clear",title:"Clear",cb:m}),t.h(l,{id:"swaprows",title:"Swap Rows",cb:u})))))}}class N extends t.Component{constructor(){super(...arguments);d(this,"data",{data:[],selected:0});d(this,"run",()=>{this.setData({data:r(1e3),selected:0})});d(this,"runLots",()=>{this.setData({data:r(1e4),selected:0})});d(this,"add",()=>{this.setData({data:this.data.data.concat(r(1e3))})});d(this,"update",()=>{const e=this.data.data;for(let a=0;a<e.length;a+=10){const o=e[a];e[a]={id:o.id,label:o.label+" !!!"}}this.forceUpdate()});d(this,"select",e=>{this.setData({selected:e.id})});d(this,"remove",e=>{const a=this.data.data;a.splice(a.indexOf(e),1),this.forceUpdate()});d(this,"clear",()=>{this.setData({data:[],selected:0})});d(this,"swapRows",()=>{const e=this.data.data;if(e.length>998){let a=e[1];e[1]=e[998],e[998]=a}this.forceUpdate()})}render(){return t.h("div",{className:"container"},t.h(v,{run:this.run,runLots:this.runLots,add:this.add,update:this.update,clear:this.clear,swapRows:this.swapRows}),t.h("table",{className:"table table-hover table-striped test-data"},t.h("tbody",null,this.data.data.map((e,a)=>t.h(g,{key:a,item:e,selected:this.data.selected===e.id,select:this.select,remove:this.remove})))),t.h("span",{className:"preloadicon glyphicon glyphicon-remove",ariaHidden:"true"}))}}t.render(t.h(N,null),document.getElementById("root"));
