"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5190],{42118:function(e,n,t){t.r(n);var r=t(62540),a=t(96802),o=t(63696),i=t(9055),l=t(65242),c=t(5898),s=t(42301),u=t(50723),d=t(69410),f=function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,a,o=t.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i};n.default=function(){var e,n=(0,d.gf)(),t=n.api,p=n.user,y=f((0,i.ok)(),1)[0],h=f((0,o.useState)(null!==(e=y.get("code"))&&void 0!==e?e:""),2),b=h[0],m=h[1],v=f((0,o.useState)(),2),j=v[0],g=v[1],x=f((0,o.useState)(!1),2),k=x[0],C=x[1],O=(0,o.useCallback)((function(e){m(e.currentTarget.value)}),[]),N=(0,o.useCallback)((function(e){var n;if(e.preventDefault(),g(void 0),e.currentTarget.checkValidity()){if(!t)return console.error("[QuickConnect] cannot authorize, missing api instance"),void g("UnknownError");var r=null!==(n=y.get("userId"))&&void 0!==n?n:null==p?void 0:p.Id,o=b.replace(/\s/g,"");console.log("[QuickConnect] authorizing code %s as user %s",o,r),(0,a.k)(t).authorizeQuickConnect({code:o,userId:r}).then((function(){C(!0)})).catch((function(){g("QuickConnectAuthorizeFail")}))}else g("QuickConnectInvalidCode")}),[t,b,y,null==p?void 0:p.Id]);return(0,r.jsx)(l.A,{id:"quickConnectPreferencesPage",title:c.Ay.translate("QuickConnect"),className:"mainAnimatedPage libraryPage userPreferencesPage noSecondaryNavPage",shouldAutoFocus:!0,children:(0,r.jsx)("div",{className:"padded-left padded-right padded-bottom-page",children:(0,r.jsx)("form",{onSubmit:N,children:(0,r.jsxs)("div",{className:"verticalSection",children:[(0,r.jsx)("h2",{className:"sectionTitle",children:c.Ay.translate("QuickConnect")}),(0,r.jsx)("div",{children:c.Ay.translate("QuickConnectDescription")}),(0,r.jsx)("br",{}),j&&(0,r.jsx)("div",{className:"quickConnectError",children:c.Ay.translate(j)}),k?(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("p",{children:c.Ay.translate("QuickConnectAuthorizeSuccess")}),(0,r.jsx)(i.N_,{to:"/home",className:"button-link emby-button",children:c.Ay.translate("GoHome")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"inputContainer",children:(0,r.jsx)(s.A,{value:b,onChange:O,id:"txtQuickConnectCode",label:c.Ay.translate("LabelQuickConnectCode"),type:"text",inputMode:"numeric",pattern:"[0-9\\s]*",minLength:6,required:!0,autoComplete:"off"})}),(0,r.jsx)(u.A,{type:"submit",className:"raised button-submit block",title:c.Ay.translate("Authorize")})]})]})})})})}},42301:function(e,n,t){var r=t(62540),a=t(4452),o=t.n(a),i=t(63696),l=function(){return l=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i}((0,i.useState)(!1),2),p=f[0],y=f[1],h=(0,i.useCallback)((function(e){y(!1),null==s||s(e)}),[s]),b=(0,i.useCallback)((function(e){y(!0),null==u||u(e)}),[u]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{htmlFor:t,className:o()("inputLabel",{inputLabelUnfocused:!p,inputLabelFocused:p}),children:a}),(0,r.jsx)("input",l({ref:n,id:t,className:o()("emby-input",c),onBlur:h,onFocus:b},d))]})}));c.displayName="Input",n.A=c},50723:function(e,n,t){var r,a=t(62540),o=(t(63696),t(4452)),i=t.n(o),l=t(46782),c=function(){return c=Object.assign||function(e){for(var n,t=1,r=arguments.length;t