1"use strict";(self["webpackChunkchalkyWeb"]=self["webpackChunkchalkyWeb"]||[]).push([[8342],{28342(e,t,s){s.r(t),s.d(t,{default:()=>m});var n=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("section",{staticClass:"page-dev"},[e._m(0),t("section",{staticClass:"panel remote"},[t("h2",[e._v("Trainer Remote")]),t("div",{staticClass:"connection"},[t("span",{staticClass:"indicator",class:{"state-connected":e.connected}}),t("span",{staticClass:"label"},[e._v(e._s(e.connected?"Connected":"Disconnected"))]),e.connected?t("button",{staticClass:"action",on:{click:e.Handle_OnClickDisconnect}},[e._v("Disconnect")]):t("button",{staticClass:"action",attrs:{disabled:e.connectBusy},on:{click:e.Handle_OnClickConnect}},[e._v(" "+e._s(e.connectBusy?"Connectingâ¦":"Connect")+" ")])]),e.connectError?t("p",{staticClass:"error"},[e._v(e._s(e.connectError))]):e._e(),e.connected?t("div",{staticClass:"receivers"},[t("h3",[e._v("Trainers")]),0===e.receivers.length?t("p",{staticClass:"empty"},[e._v("No Trainer instances are present. Open the Trainer with remote control enabled while signed in as this admin.")]):e._e(),e._l(e.receivers,function(s){return t("label",{key:s.instanceId,staticClass:"receiver"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedInstanceId,expression:"selectedInstanceId"}],attrs:{name:"receiver",type:"radio"},domProps:{value:s.instanceId,checked:e._q(e.selectedInstanceId,s.instanceId)},on:{change:function(t){e.selectedInstanceId=s.instanceId}}}),t("span",{staticClass:"name"},[e._v(e._s(s.label))]),t("span",{staticClass:"meta"},[e._v(e._s(s.instanceId))])])}),t("button",{staticClass:"action",on:{click:e.Handle_OnClickRefreshReceivers}},[e._v("Refresh")])],2):e._e(),e.connected?t("div",{staticClass:"scan"},[t("h3",[e._v("Table Photo")]),t("input",{ref:"fileInput",attrs:{accept:"image/*",capture:"environment",type:"file"},on:{change:e.Handle_OnFileChange}}),e.scanBusy?t("p",{staticClass:"busy"},[e._v("Scanning tableâ¦")]):e._e(),e.scanError?t("p",{staticClass:"error"},[e._v(e._s(e.scanError))]):e._e()]):e._e(),e.balls.length>0?t("div",{staticClass:"preview"},[t("h3",[e._v("Preview ("+e._s(e.balls.length)+" balls)")]),t("ViewCreatorDiagram",{attrs:{balls:e.previewBalls}})],1):e._e(),e.connected?t("div",{staticClass:"send"},[t("button",{staticClass:"primary",attrs:{disabled:!e.canSend},on:{click:e.Handle_OnClickSend}},[e._v(" "+e._s(e.sendBusy?"Sendingâ¦":"Send Rack to Trainer")+" ")]),e.ackMessage?t("p",{staticClass:"ack",class:"state-"+e.ackStatus},[e._v(e._s(e.ackMessage))]):e._e()]):e._e()]),t("section",{staticClass:"panel"},[t("h2",[e._v("Session")]),t("dl",{staticClass:"details"},[t("dt",[e._v("User ID")]),t("dd",[e._v(e._s(e.userId))]),t("dt",[e._v("Name")]),t("dd",[e._v(e._s(e.userName))]),t("dt",[e._v("Email")]),t("dd",[e._v(e._s(e.userEmail))]),t("dt",[e._v("Environment")]),t("dd",[e._v(e._s(e.environment))])])])])},a=[function(){var e=this,t=e._self._c;return e._self._setupProxy,t("header",{staticClass:"header"},[t("h1",[e._v("Developer")]),t("p",{staticClass:"subtitle"},[e._v("Admin-only tools and diagnostics.")])])}],i=(s(16280),s(18111),s(61701),s(13579),s(45367),s(92731),s(27495),s(62953),s(31635)),c=s(56002),l=s(46424),r=s(21133),o=s(68366),d=s(93120);let u=class extends r.A{constructor(){super(...arguments),this.ackMessage="",this.ackStatus="",this.balls=[],this.connectBusy=!1,this.connectError="",this.connected=!1,this.receivers=[],this.scanBusy=!1,this.scanError="",this.selectedInstanceId="",this.sendBusy=!1,this.Handle_OnReceiversChanged=()=>{this.syncReceivers()}}get canSend(){return this.connected&&!this.sendBusy&&this.balls.length>0&&""!==this.selectedInstanceId}get environment(){return"production"}get previewBalls(){return this.balls.map(e=>({type:0===e.ball?"cue":String(e.ball),x:e.x,y:e.y}))}get user(){return this.$store.getters["authentication/user"]}get userEmail(){var e,t;return(null===(t=null===(e=this.user)||void 0===e?void 0:e.attributes)||void 0===t?void 0:t.email)||"—"}get userId(){var e,t;return(null===(t=null===(e=this.user)||void 0===e?void 0:e.id)||void 0===t?void 0:t.toString())||"—"}get userName(){var e,t;return(null===(t=null===(e=this.user)||void 0===e?void 0:e.attributes)||void 0===t?void 0:t.name)||"—"}async attachEvents(){c.qA.on(c.KO.ReceiversChanged,this.Handle_OnReceiversChanged),await this.connect()}async detachEvents(){c.qA.off(c.KO.ReceiversChanged,this.Handle_OnReceiversChanged),await c.qA.disconnect()}async connect(){this.connectBusy=!0,this.connectError="";try{await c.qA.connect(),this.connected=!0,this.syncReceivers()}catch(e){this.connectError=(null===e||void 0===e?void 0:e.message)||"Failed to connect."}finally{this.connectBusy=!1}}syncReceivers(){this.receivers=c.qA.getReceivers();const e=this.receivers.some(e=>e.instanceId===this.selectedInstanceId);e||(this.selectedInstanceId=1===this.receivers.length?this.receivers[0].instanceId:"")}toPlacement(e){var t;const s=String(null!==(t=null===e||void 0===e?void 0:e.ball_type)&&void 0!==t?t:"").toLowerCase(),n="cue"===s?0:/^([1-9]|1[0-5])$/.test(s)?parseInt(s,10):null;if(null===n)return null;const a=Number(null===e||void 0===e?void 0:e.x),i=Number(null===e||void 0===e?void 0:e.y);return!Number.isFinite(a)||!Number.isFinite(i)||a<0||a>1||i<0||i>1?null:{ball:n,x:a,y:i}}async Handle_OnClickConnect(){await this.connect()}async Handle_OnClickDisconnect(){await c.qA.disconnect(),this.connected=!1,this.receivers=[],this.selectedInstanceId=""}async Handle_OnClickRefreshReceivers(){await c.qA.refreshReceivers()}async Handle_OnClickSend(){this.ackMessage="",this.ackStatus="",this.sendBusy=!0;try{const e=this.balls.map(e=>({ball:e.ball,x:Math.round(1e4*e.x)/1e4,y:Math.round(1e4*e.y)/1e4})),t=await c.qA.sendRackCustom(this.selectedInstanceId,e);this.ackStatus=t.status,this.ackMessage="applied"===t.status?"Rack a
1pplied on Trainer.":`Rejected (${t.code}): ${t.message||"No detail."}`}catch(e){this.ackStatus="error",this.ackMessage=(null===e||void 0===e?void 0:e.message)||"Send failed."}finally{this.sendBusy=!1}}async Handle_OnFileChange(e){var t;const s=e.target,n=null===(t=s.files)||void 0===t?void 0:t[0];if(n){this.scanBusy=!0,this.scanError="",this.ackMessage="",this.ackStatus="";try{const e=new l["default"].Extras.Model.TableScan({},{baseUrl:l["default"].Core.Constants.API_URL_V3}),t=await e.imageToDiagram(n);if(!t.is_transformed)throw new Error("Could not find the table in that photo. Try a clearer, more overhead angle.");const s=new Map;for(const e of t.balls){const t=this.toPlacement(e);if(!t)continue;const n=Number(null===e||void 0===e?void 0:e.confidence)||0,a=s.get(t.ball);(!a||n>a.confidence)&&s.set(t.ball,{confidence:n,placement:t})}this.balls=Array.from(s.values()).map(e=>e.placement).sort((e,t)=>e.ball-t.ball),0===this.balls.length&&(this.scanError="The table was found but no identifiable balls were detected.")}catch(e){this.scanError=(null===e||void 0===e?void 0:e.message)||"Scan failed."}finally{this.scanBusy=!1,s.value=""}}}};(0,i.Cg)([d.P0],u.prototype,"attachEvents",null),(0,i.Cg)([d.EB],u.prototype,"detachEvents",null),u=(0,i.Cg)([o.Component],u);const h=u,v=h;var _=s(81656),p=(0,_.A)(v,n,a,!1,null,null,null);const m=p.exports},21133(e,t,s){s.d(t,{A:()=>_});var n=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"page-base"})},a=[],i=s(31635),c=s(46424),l=s(54162),r=s(68366);let o=class extends l.A{get shortcut(){return new c["default"].Core.Input.Shortcut}};o=(0,i.Cg)([r.Component],o);const d=o,u=d;var h=s(81656),v=(0,h.A)(u,n,a,!1,null,null,null);const _=v.exports},54162(e,t,s){s.d(t,{A:()=>p}),s(62953);var n=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"view-base",class:[...e.className]})},a=[],i=(s(44114),s(31635)),c=s(67346),l={};s.r(l),s.d(l,{AnalyticsEvents:()=>c.oA,App:()=>c.qw,Ask:()=>c.QA,Create:()=>c.X5,Environment:()=>c.OH,Find:()=>c.ko,Marketing:()=>c.Ff,News:()=>c.Kn,Privacy:()=>c.ZZ,RemoteControl:()=>c.qA,Review:()=>c.p_,UserProfile:()=>c.Fv,Venue:()=>c.mu});var r=s(68366),o=s(93120);let d=class extends r.Vue{constructor(){super(...arguments),this.cid=Math.random().toString(32).substr(2,7),this.className=[],this.config=l,this.mounted=!1,this.symbol=Symbol(),this.bindings=[],this.delta=0}setupBindings(){let e;for(e of this.bindings)this[e]=this[e].bind(this)}getQueryParameter(e){var t;return null===(t=this.$route)||void 0===t?void 0:t.query[e]}setQueryParameter(e,t){const s=window.scrollY;this.$router.push({query:Object.assign({...this.$route.query},{[e]:t})}),window.scrollTo(0,s)}bind(e){this[e]=this[e].bind(this)}attachCid(){this.$el["setAttribute"]&&this.$el.setAttribute("data-cid",this.cid)}isMounted(){this.mounted=!0}};(0,i.Cg)([o.zu],d.prototype,"setupBindings",null),(0,i.Cg)([o.P0],d.prototype,"attachCid",null),(0,i.Cg)([o.P0],d.prototype,"isMounted",null),d=(0,i.Cg)([r.Component],d);const u=d,h=u;var v=s(81656),_=(0,v.A)(h,n,a,!1,null,null,null);const p=_.exports}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.