(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["remote"],{"19d7":function(e,t,n){"use strict";n("c6fb")},"1c68":function(e,t,n){"use strict";n.r(t);n("b0c0");var c=n("7a23"),o={class:"lb-remote"},a={class:"lb-buttons"},r={class:"lb-thumbs-up"},u={class:"lb-sequences-container"},l=["onClick"],s=Object(c["createElementVNode"])("h1",null,"Browse the hub",-1),i={class:"lb-presets-container"},b=["onClick"];function d(e,t,n,d,m,f){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",o,[Object(c["withDirectives"])(Object(c["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.state.connection.lbHost=t}),maxlength:"15",onChange:t[1]||(t[1]=function(){return e.hostChanged&&e.hostChanged.apply(e,arguments)})},null,544),[[c["vModelText"],e.state.connection.lbHost,void 0,{lazy:!0}]]),Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.connectionStatus)+" ",1),Object(c["createElementVNode"])("div",a,[Object(c["createElementVNode"])("div",null,[Object(c["createElementVNode"])("button",{class:"lb-auto",onClick:t[2]||(t[2]=function(t){return e.toggle("colormaps")})},[Object(c["createElementVNode"])("span",{class:Object(c["normalizeClass"])(e.colormapsButtonClass)},"Colormaps",2)]),Object(c["createElementVNode"])("button",{class:"lb-auto",onClick:t[3]||(t[3]=function(t){return e.toggle("images")})},[Object(c["createElementVNode"])("span",{class:Object(c["normalizeClass"])(e.imagesButtonClass)},"Images",2)]),Object(c["createElementVNode"])("button",{class:"lb-generate",onClick:t[4]||(t[4]=function(t){return e.vuiCommand("VUI_GENERATE_RANDOM")})}," Generate ")]),Object(c["createElementVNode"])("div",r,[Object(c["createElementVNode"])("button",{onClick:t[5]||(t[5]=function(){return e.saveSequence&&e.saveSequence.apply(e,arguments)})},"👍")])]),Object(c["createElementVNode"])("div",u,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.sequences,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n},[Object(c["createElementVNode"])("button",{onClick:function(n){return e.useSequence(t.id)}},Object(c["toDisplayString"])(t.name),9,l)])})),128))]),s,Object(c["createElementVNode"])("div",i,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.hubPresets,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n},[Object(c["createElementVNode"])("button",{onClick:function(t){return e.usePreset(n)}},Object(c["toDisplayString"])(t.id),9,b)])})),128))])])}n("fb6a"),n("d3b7"),n("d81d"),n("25f0"),n("99af");var m=n("f3ea"),f=n("8f70"),p=n("3ea3"),O=Object(c["defineComponent"])({name:"RemoteView",setup:function(){var e=10,t=function(e){return m["b"].allSequences.slice(0,e)},n=Object(c["ref"])(),o=Object(c["computed"])((function(){return t(e)})),a=Object(c["computed"])((function(){return"".concat(m["b"].connected?"C":"Disc","onnected")})),r=Object(c["computed"])((function(){return"lb-auto-".concat(m["b"].engine.allowAutoColormaps?"en":"dis","abled")})),u=Object(c["computed"])((function(){return"lb-auto-".concat(m["b"].engine.allowAutoImages?"en":"dis","abled")})),l=function(){fetch("".concat(f["a"].getHubUrl(m["b"]),"/presets")).then((function(e){return e.json()})).then((function(e){n.value=e.map((function(e){return{_id:e._id,id:e.id}}))}))},s=function(e){console.log("hostChanged",e),Object(p["c"])()},i=function(){Object(p["a"])("CMD_SEQ_SAVE_FULL");var e=JSON.parse(JSON.stringify(m["b"].sequence));e.plugins=e.plugins.map((function(e){return b(e)})),e.version=4,e.id=(new Date).getTime(),e.name=e.id.toString(),e.autoColormaps=m["b"].engine.allowAutoColormaps,e.autoImages=m["b"].engine.allowAutoImages,delete e.modified,fetch("".concat(f["a"].getHubUrl(m["b"]),"/preset"),{method:"put",headers:{"Content-type":"application/json"},body:JSON.stringify(e)}).then((function(e){return e.json()})).then((function(e){n.value.unshift({_id:e._id,id:e.id})})).catch((function(e){return console.error(e)}))},b=function(e){if(e.parameters){for(var t in e.parameters){var n=e.parameters[t].value;e.parameters[t]={value:n}}return e}return e},d=function(e){return Object(p["g"])("VUI_TOGGLE",{what:e,allow:!0})},O=function(e){fetch("".concat(f["a"].getHubUrl(m["b"]),"/preset/").concat(n.value[e]._id)).then((function(e){return console.log(e),e.json()})).then((function(e){delete e._id;var t=e;Object(p["g"])("VUI_POST_SEQUENCE",t)}))},j=function(e){e&&Object(p["g"])("VUI_USE_SEQUENCE",{id:e})};return l(),{colormapsButtonClass:r,connectionStatus:a,hostChanged:s,hubPresets:n,imagesButtonClass:u,saveSequence:i,sequences:o,state:m["b"],toggle:d,usePreset:O,useSequence:j,vuiCommand:p["g"],window:window}}});n("19d7");O.render=d;t["default"]=O},c6fb:function(e,t,n){}}]);
//# sourceMappingURL=remote.js.map