import{r as t,h as s}from"./p-aba8aa16.js";let i=1;const l=["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"],a=["red","yellow","blue","green","pink","brown","purple","brown","white","black","orange"],n=["table","chair","house","bbq","desk","car","pony","cookie","sandwich","burger","pizza","mouse","keyboard"];function o(t){return Math.round(1e3*Math.random())%t}function e(t){let s=new Array(t);for(let e=0;e<t;e++){const t=`${l[o(l.length)]} ${a[o(a.length)]} ${n[o(n.length)]}`;s[e]={id:i++,label:t}}return s}const c=class{constructor(s){t(this,s),this.data=[],this.select=this.select.bind(this),this.delete=this.delete.bind(this),this.add=this.add.bind(this),this.run=this.run.bind(this),this.update=this.update.bind(this),this.runLots=this.runLots.bind(this),this.clear=this.clear.bind(this),this.swapRows=this.swapRows.bind(this)}run(){this.data=e(1e3),this.selected=void 0}add(){this.data=this.data.concat(e(1e3))}update(){const t=this.data.slice(0);for(let s=0;s<t.length;s+=10){const i=t[s];t[s]={id:i.id,label:i.label+" !!!"}}this.data=t}select(t){this.selected=t}delete(t){const s=this.data.findIndex((s=>s.id===t));this.data=[...this.data.slice(0,s),...this.data.slice(s+1)]}runLots(){this.data=e(1e4),this.selected=void 0}clear(){this.data=[],this.selected=void 0}swapRows(){this.data.length>998&&(this.data=[this.data[0],this.data[998],...this.data.slice(2,998),this.data[1],this.data[999]])}render(){return s("div",{class:"container"},s("div",{class:"jumbotron"},s("div",{class:"row"},s("div",{class:"col-md-6"},s("h1",null,"Stencil Keyed")),s("div",{class:"col-md-6"},s("div",{class:"row"},s("div",{class:"col-sm-6 smallpad"},s("button",{id:"run",class:"btn btn-primary btn-block",type:"button",onClick:this.run},"Create 1,000 rows")),s("div",{class:"col-sm-6 smallpad"},s("button",{id:"runlots",class:"btn btn-primary btn-block",type:"button",onClick:this.runLots},"Create 10,000 rows")),s("div",{class:"col-sm-6 smallpad"},s("button",{id:"add",class:"btn btn-primary btn-block",type:"button",onClick:this.add},"Append 1,000 rows")),s("div",{class:"col-sm-6 smallpad"},s("button",{id:"update",class:"btn btn-primary btn-block",type:"button",onClick:this.update},"Update every 10th row")),s("div",{class:"col-sm-6 smallpad"},s("button",{id:"clear",class:"btn btn-primary btn-block",type:"button",onClick:this.clear},"Clear")),s("div",{class:"col-sm-6 smallpad"},s("button",{id:"swaprows",class:"btn btn-primary btn-block",type:"button",onClick:this.swapRows},"Swap Rows")))))),s("table",{class:"table table-hover table-striped test-data"},s("tbody",null,this.data.map((t=>s("tr",{key:t.id,class:t.id===this.selected?"danger":""},s("td",{class:"col-md-1"},t.id),s("td",{class:"col-md-4"},s("a",{onClick:()=>this.select(t.id)},t.label)),s("td",{class:"col-md-1"},s("a",{onClick:()=>this.delete(t.id)},s("span",{class:"glyphicon glyphicon-remove","aria-hidden":"true"}))),s("td",{class:"col-md-6"})))))),s("span",{class:"preloadicon glyphicon glyphicon-remove","aria-hidden":"true"}))}};export{c as stencil_app}