import{a as Ft,e as Q,f as w,g as k,h as v,F as ut,G as dt,m as I,p as B,n as H,t as M,i as p,U as Me,j as ze,r as te,J as nt,K as hn,o as Bt,s as mn,k as ve,z as gn,u as Zt,l as Y,L as vn,M as bn,N as _n,O as We,E as ot,P as yn,b as wn,Q as Sn,R as En,c as Dn,S as kn,x as bt,v as Cn,I as _t,D as Ie,T as Tn,A as yt,V as In,w as wt,W as Ge,B as Yt,X as On}from"./app-72c44b80.js";import{_ as $n,a as An,b as Mn}from"./OtpDisplay-62239862.js";import{u as xn}from"./userService-d2ada2ab.js";import{u as Pn}from"./bus-222e275f.js";import"./Spinner-0e4f49a2.js";/*! 2FAuth version 5.0.3 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const Nn={id:"groupSwitch",class:"container groups"},Fn={class:"columns is-centered"},Bn={class:"column is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},Rn={class:"columns is-multiline"},Gn=["onClick"],Ln={class:"columns is-centered"},Xn={class:"column has-text-centered"},Yn={__name:"GroupSwitch",props:{showGroupSwitch:Boolean,groups:Array},emits:["update:showGroupSwitch"],setup(t,{emit:e}){const n=Ft();function o(i){n.preferences.activeGroup=i,n.preferences.rememberActiveGroup&&xn.updatePreference("activeGroup",i),e("update:showGroupSwitch",!1)}return(i,r)=>{const s=Q("RouterLink"),l=Q("ButtonBackCloseCancel"),u=Q("VueFooter");return w(),k("div",Nn,[v("div",Fn,[v("div",Bn,[v("div",Rn,[(w(!0),k(ut,null,dt(t.groups,a=>(w(),k("div",{class:"column is-full",key:a.id},[I(p(Me),null,{default:B(({mode:c})=>[v("button",{class:H(["button is-fullwidth",{"is-dark has-text-light is-outlined":c=="dark"}]),onClick:f=>o(a.id)},M(a.name),11,Gn)]),_:2},1024)]))),128))]),v("div",Ln,[v("div",Xn,[I(s,{to:{name:"groups"}},{default:B(()=>[ze(M(i.$t("groups.manage_groups")),1)]),_:1})])])])]),I(u,{showButtons:!0},{default:B(()=>[I(l,{action:"close",useLinkTag:!1,onClosed:r[0]||(r[0]=a=>i.$emit("update:showGroupSwitch",!1))})]),_:1})])}}},zn={class:"container group-selector"},Wn={class:"columns is-centered is-multiline"},Un={class:"column is-full has-text-centered"},qn={class:"column is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},Hn={class:"columns is-multiline"},jn=["onClick"],Vn={key:0,class:"is-italic"},Kn={key:1},Qn={class:"columns is-centered"},Zn={class:"column has-text-centered"},Jn={class:"control"},eo={__name:"DestinationGroupSelector",props:{showDestinationGroupSelector:Boolean,selectedAccountsIds:Array,groups:Array},emits:["update:showDestinationGroupSelector","accounts-moved"],setup(t,{emit:e}){const n=t,o=te(null);async function i(){o.value===0?await nt.withdraw(n.selectedAccountsIds):await hn.assign(n.selectedAccountsIds,o.value),e("accounts-moved")}return(r,s)=>{const l=Q("RouterLink"),u=Q("ButtonBackCloseCancel"),a=Q("VueFooter");return w(),k("div",zn,[v("div",Wn,[v("div",Un,M(r.$t("groups.move_selected_to")),1),v("div",qn,[v("div",Hn,[(w(!0),k(ut,null,dt(t.groups,c=>(w(),k("div",{class:"column is-full",key:c.id},[I(p(Me),null,{default:B(({mode:f})=>[v("button",{class:H(["button is-fullwidth",{"is-link":p(o)===c.id,"is-dark has-text-light is-outlined":f=="dark"}]),onClick:y=>o.value=c.id},[c.id===0?(w(),k("span",Vn,M(r.$t("groups.no_group")),1)):(w(),k("span",Kn,M(c.name),1))],10,jn)]),_:2},1024)]))),128))]),v("div",Qn,[v("div",Zn,[I(l,{to:{name:"groups"}},{default:B(()=>[ze(M(r.$t("groups.manage_groups")),1)]),_:1})])])])]),I(a,{showButtons:!0},{default:B(()=>[v("p",Jn,[v("button",{class:"button is-link is-rounded",onClick:i},M(r.$t("commons.move")),1)]),I(u,{action:"cancel",useLinkTag:!1,onCanceled:s[0]||(s[0]=c=>r.$emit("update:showDestinationGroupSelector",!1))})]),_:1})])}}},to={role:"search",class:"field"},no={class:"control has-icons-right"},oo=["aria-label","title","value"],io={class:"icon is-small is-right"},ro=["title"],so={__name:"SearchBox",props:{keyword:String},setup(t){const e=te(null);Bt(()=>{document.addEventListener("keydown",n)}),mn(()=>{document.removeEventListener("keydown",n)});function n(o){var i;o.key==="f"&&(o.ctrlKey||o.metaKey)&&(o.preventDefault(),(i=e.value)==null||i.focus())}return(o,i)=>{const r=Q("FontAwesomeIcon");return w(),k("div",to,[v("div",no,[v("input",{ref_key:"searchInput",ref:e,id:"txtSearch",type:"search",tabindex:"1","aria-label":o.$t("commons.search"),title:o.$t("commons.search"),class:"input is-rounded is-search",value:t.keyword,onKeyup:i[0]||(i[0]=s=>o.$emit("update:keyword",s.target.value))},null,40,oo),v("span",io,[t.keyword!=""?(w(),k("button",{key:0,id:"btnClearSearch",tabindex:"1",title:o.$t("commons.clear_search"),class:"clear-selection delete",onClick:i[1]||(i[1]=s=>o.$emit("update:keyword",""))},null,8,ro)):(w(),ve(r,{key:1,icon:["fas","search"]}))])])])}}},ao={class:"toolbar has-text-centered"},lo={class:"columns"},uo={class:"column has-nowrap px-0"},co={class:"has-text-grey mr-1"},fo=["title"],po=["title"],ho=["title"],mo=["title"],go={__name:"Toolbar",props:{selectedCount:Number},setup(t){return(e,n)=>{const o=Q("FontAwesomeIcon");return w(),k("div",ao,[v("div",lo,[v("div",uo,[v("span",co,M(t.selectedCount)+" "+M(e.$t("commons.selected")),1),v("button",{id:"btnUnselectAll",onClick:n[0]||(n[0]=i=>e.$emit("clear-selected")),class:"clear-selection delete mr-4",style:gn({visibility:t.selectedCount>0?"visible":"hidden"}),title:e.$t("commons.clear_selection")},null,12,fo),v("button",{id:"btnSelectAll",onClick:n[1]||(n[1]=i=>e.$emit("select-all")),class:"button mr-5 has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.select_all")},[v("span",null,M(e.$t("commons.all")),1),I(o,{class:"ml-1",icon:["fas","check-square"]})],8,po),v("button",{id:"btnSortAscending",onClick:n[2]||(n[2]=i=>e.$emit("sort-asc")),class:"button has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.sort_ascending")},[I(o,{icon:["fas","sort-alpha-down"]})],8,ho),v("button",{id:"btnSortDescending",onClick:n[3]||(n[3]=i=>e.$emit("sort-desc")),class:"button has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.sort_descending")},[I(o,{icon:["fas","sort-alpha-up"]})],8,mo)])])])}}},vo={key:0,class:"control"},bo={class:"icon is-small"},_o={key:1,class:"control"},yo={key:2,class:"control"},wo=["disabled","title"],So={key:3,class:"control"},Eo=["disabled"],Do={key:4,class:"control"},ko=["disabled","title"],Co={__name:"ActionButtons",props:{inManagementMode:Boolean,areDisabled:Boolean},emits:["update:inManagementMode","move-button-clicked","delete-button-clicked","export-button-clicked"],setup(t,{emit:e}){const n=Zt(),o=Ft();function i(){o.preferences.useDirectCapture&&o.preferences.defaultCaptureMode==="advancedForm"?n.push({name:"createAccount"}):o.preferences.useDirectCapture&&o.preferences.defaultCaptureMode==="livescan"?n.push({name:"capture"}):n.push({name:"start"})}return(r,s)=>{const l=Q("FontAwesomeIcon");return w(),ve(p(Me),null,{default:B(({mode:u})=>[t.inManagementMode?Y("",!0):(w(),k("p",vo,[v("button",{class:"button is-link is-rounded is-focus",onClick:i},[v("span",null,M(r.$t("commons.new")),1),v("span",bo,[I(l,{icon:["fas","qrcode"]})])])])),t.inManagementMode?Y("",!0):(w(),k("p",_o,[v("button",{id:"btnManage",class:H(["button is-rounded",{"is-dark":u=="dark"}]),onClick:s[0]||(s[0]=a=>r.$emit("update:inManagementMode",!0))},M(r.$t("commons.manage")),3)])),t.inManagementMode?(w(),k("p",yo,[v("button",{id:"btnMove",disabled:t.areDisabled,class:H(["button is-rounded",[{"is-outlined":u=="dark"||t.areDisabled},t.areDisabled?"is-dark":"is-link"]]),onClick:s[1]||(s[1]=a=>r.$emit("move-button-clicked")),title:r.$t("groups.move_selected_to_group")},M(r.$t("commons.move")),11,wo)])):Y("",!0),t.inManagementMode?(w(),k("p",So,[v("button",{id:"btnDelete",disabled:t.areDisabled,class:H(["button is-rounded",[{"is-outlined":u=="dark"||t.areDisabled},t.areDisabled?"is-dark":"is-link"]]),onClick:s[2]||(s[2]=a=>r.$emit("delete-button-clicked"))},M(r.$t("commons.delete")),11,Eo)])):Y("",!0),t.inManagementMode?(w(),k("p",Do,[v("button",{id:"btnExport",disabled:t.areDisabled,class:H(["button is-rounded",[{"is-outlined":u=="dark"||t.areDisabled},t.areDisabled?"is-dark":"is-link"]]),onClick:s[3]||(s[3]=a=>r.$emit("export-button-clicked")),title:r.$t("twofaccounts.export_selected_to_json")},M(r.$t("commons.export")),11,ko)])):Y("",!0)]),_:1})}}};function To(t){return vn()?(bn(t),!0):!1}function At(t){return typeof t=="function"?t():p(t)}const Io=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function Oo(t,e=!0){_n()?Bt(t):e?t():We(t)}function $o(t){var e;const n=At(t);return(e=n==null?void 0:n.$el)!=null?e:n}const Ao=Io?window.document:void 0;/**! * Sortable 1.15.0 * @author RubaXa * @author owenm * @license MIT */function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function me(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function Po(t,e){if(t==null)return{};var n=xo(t,e),o,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var No="1.15.0";function be(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var ye=be(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ke=be(/Edge/i),Wt=be(/firefox/i),Ue=be(/safari/i)&&!be(/chrome/i)&&!be(/android/i),Jt=be(/iP(ad|od|hone)/i),en=be(/chrome/i)&&be(/android/i),tn={capture:!1,passive:!1};function O(t,e,n){t.addEventListener(e,n,!ye&&tn)}function T(t,e,n){t.removeEventListener(e,n,!ye&&tn)}function ct(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Fo(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function pe(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&ct(t,e):ct(t,e))||o&&t===n)return t;if(t===n)break}while(t=Fo(t))}return null}var Ut=/\s+/g;function ee(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ut," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ut," ")}}function b(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function Be(t,e){var n="";if(typeof t=="string")n=t;else do{var o=b(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function nn(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=r:s=i<=r,!s)return o;if(o===he())break;o=ke(o,!1)}return!1}function Re(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&arguments[2]!==void 0?arguments[2]:{},i=o.evt,r=Po(o,Wo);Qe.pluginEvent.bind(_)(e,n,me({dragEl:d,parentEl:x,ghostEl:S,rootEl:$,nextEl:Ae,lastDownEl:rt,cloneEl:A,cloneHidden:De,dragStarted:Le,putSortable:X,activeSortable:_.active,originalEvent:i,oldIndex:Fe,oldDraggableIndex:He,newIndex:ne,newDraggableIndex:Ee,hideGhostForTarget:dn,unhideGhostForTarget:cn,cloneNowHidden:function(){De=!0},cloneNowShown:function(){De=!1},dispatchSortableEvent:function(l){j({sortable:n,name:l,originalEvent:i})}},r))};function j(t){zo(me({putSortable:X,cloneEl:A,targetEl:d,rootEl:$,oldIndex:Fe,oldDraggableIndex:He,newIndex:ne,newDraggableIndex:Ee},t))}var d,x,S,$,Ae,rt,A,De,Fe,ne,He,Ee,Ze,X,Ne=!1,ft=!1,pt=[],Oe,se,Dt,kt,jt,Vt,Le,Pe,je,Ve=!1,Je=!1,st,q,Ct=[],Mt=!1,ht=[],gt=typeof document<"u",et=Jt,Kt=Ke||ye?"cssFloat":"float",Uo=gt&&!en&&!Jt&&"draggable"in document.createElement("div"),an=function(){if(gt){if(ye)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),ln=function(e,n){var o=b(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=Re(e,0,n),s=Re(e,1,n),l=r&&b(r),u=s&&b(s),a=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+G(r).width,c=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+G(s).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var f=l.float==="left"?"left":"right";return s&&(u.clear==="both"||u.clear===f)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||a>=i&&o[Kt]==="none"||s&&o[Kt]==="none"&&a+c>i)?"vertical":"horizontal"},qo=function(e,n,o){var i=o?e.left:e.top,r=o?e.right:e.bottom,s=o?e.width:e.height,l=o?n.left:n.top,u=o?n.right:n.bottom,a=o?n.width:n.height;return i===l||r===u||i+s/2===l+a/2},Ho=function(e,n){var o;return pt.some(function(i){var r=i[oe].options.emptyInsertThreshold;if(!(!r||Rt(i))){var s=G(i),l=e>=s.left-r&&e<=s.right+r,u=n>=s.top-r&&n<=s.bottom+r;if(l&&u)return o=i}}),o},un=function(e){function n(r,s){return function(l,u,a,c){var f=l.options.group.name&&u.options.group.name&&l.options.group.name===u.options.group.name;if(r==null&&(s||f))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return n(r(l,u,a,c),s)(l,u,a,c);var y=(s?l:u).options.group.name;return r===!0||typeof r=="string"&&r===y||r.join&&r.indexOf(y)>-1}}var o={},i=e.group;(!i||it(i)!="object")&&(i={name:i}),o.name=i.name,o.checkPull=n(i.pull,!0),o.checkPut=n(i.put),o.revertClone=i.revertClone,e.group=o},dn=function(){!an&&S&&b(S,"display","none")},cn=function(){!an&&S&&b(S,"display","")};gt&&!en&&document.addEventListener("click",function(t){if(ft)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ft=!1,!1},!0);var $e=function(e){if(d){e=e.touches?e.touches[0]:e;var n=Ho(e.clientX,e.clientY);if(n){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[oe]._onDragOver(o)}}},jo=function(e){d&&d.parentNode[oe]._isOutsideThisEl(e.target)};function _(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=_e({},e),t[oe]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ln(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,l){s.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:_.supportPointer!==!1&&"PointerEvent"in window&&!Ue,emptyInsertThreshold:5};Qe.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);un(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:Uo,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?O(t,"pointerdown",this._onTapStart):(O(t,"mousedown",this._onTapStart),O(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(O(t,"dragover",this),O(t,"dragenter",this)),pt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),_e(this,Lo())}_.prototype={constructor:_,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Pe=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,d):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,i=this.options,r=i.preventOnFilter,s=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(l||e).target,a=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,c=i.filter;if(ni(o),!d&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||i.disabled)&&!a.isContentEditable&&!(!this.nativeDraggable&&Ue&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=pe(u,i.draggable,o,!1),!(u&&u.animated)&&rt!==u)){if(Fe=ie(u),He=ie(u,i.draggable),typeof c=="function"){if(c.call(this,e,u,this)){j({sortable:n,rootEl:a,name:"filter",targetEl:u,toEl:o,fromEl:o}),K("filter",n,{evt:e}),r&&e.cancelable&&e.preventDefault();return}}else if(c&&(c=c.split(",").some(function(f){if(f=pe(a,f.trim(),o,!1),f)return j({sortable:n,rootEl:f,name:"filter",targetEl:u,fromEl:o,toEl:o}),K("filter",n,{evt:e}),!0}),c)){r&&e.cancelable&&e.preventDefault();return}i.handle&&!pe(a,i.handle,o,!1)||this._prepareDragStart(e,l,u)}}},_prepareDragStart:function(e,n,o){var i=this,r=i.el,s=i.options,l=r.ownerDocument,u;if(o&&!d&&o.parentNode===r){var a=G(o);if($=r,d=o,x=d.parentNode,Ae=d.nextSibling,rt=o,Ze=s.group,_.dragged=d,Oe={target:d,clientX:(n||e).clientX,clientY:(n||e).clientY},jt=Oe.clientX-a.left,Vt=Oe.clientY-a.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,d.style["will-change"]="all",u=function(){if(K("delayEnded",i,{evt:e}),_.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Wt&&i.nativeDraggable&&(d.draggable=!0),i._triggerDragStart(e,n),j({sortable:i,name:"choose",originalEvent:e}),ee(d,s.chosenClass,!0)},s.ignore.split(",").forEach(function(c){nn(d,c.trim(),Tt)}),O(l,"dragover",$e),O(l,"mousemove",$e),O(l,"touchmove",$e),O(l,"mouseup",i._onDrop),O(l,"touchend",i._onDrop),O(l,"touchcancel",i._onDrop),Wt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,d.draggable=!0),K("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Ke||ye))){if(_.eventCanceled){this._onDrop();return}O(l,"mouseup",i._disableDelayedDrag),O(l,"touchend",i._disableDelayedDrag),O(l,"touchcancel",i._disableDelayedDrag),O(l,"mousemove",i._delayedDragTouchMoveHandler),O(l,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&O(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(u,s.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){d&&Tt(d),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;T(e,"mouseup",this._disableDelayedDrag),T(e,"touchend",this._disableDelayedDrag),T(e,"touchcancel",this._disableDelayedDrag),T(e,"mousemove",this._delayedDragTouchMoveHandler),T(e,"touchmove",this._delayedDragTouchMoveHandler),T(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?O(document,"pointermove",this._onTouchMove):n?O(document,"touchmove",this._onTouchMove):O(document,"mousemove",this._onTouchMove):(O(d,"dragend",this),O($,"dragstart",this._onDragStart));try{document.selection?at(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(Ne=!1,$&&d){K("dragStarted",this,{evt:n}),this.nativeDraggable&&O(document,"dragover",jo);var o=this.options;!e&&ee(d,o.dragClass,!1),ee(d,o.ghostClass,!0),_.active=this,e&&this._appendGhost(),j({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(se){this._lastX=se.clientX,this._lastY=se.clientY,dn();for(var e=document.elementFromPoint(se.clientX,se.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(se.clientX,se.clientY),e!==n);)n=e;if(d.parentNode[oe]._isOutsideThisEl(e),n)do{if(n[oe]){var o=void 0;if(o=n[oe]._onDragOver({clientX:se.clientX,clientY:se.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);cn()}},_onTouchMove:function(e){if(Oe){var n=this.options,o=n.fallbackTolerance,i=n.fallbackOffset,r=e.touches?e.touches[0]:e,s=S&&Be(S,!0),l=S&&s&&s.a,u=S&&s&&s.d,a=et&&q&&Ht(q),c=(r.clientX-Oe.clientX+i.x)/(l||1)+(a?a[0]-Ct[0]:0)/(l||1),f=(r.clientY-Oe.clientY+i.y)/(u||1)+(a?a[1]-Ct[1]:0)/(u||1);if(!_.active&&!Ne){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(j({rootEl:x,name:"add",toEl:x,fromEl:$,originalEvent:e}),j({sortable:this,name:"remove",toEl:x,originalEvent:e}),j({rootEl:x,name:"sort",toEl:x,fromEl:$,originalEvent:e}),j({sortable:this,name:"sort",toEl:x,originalEvent:e})),X&&X.save()):ne!==Fe&&ne>=0&&(j({sortable:this,name:"update",toEl:x,originalEvent:e}),j({sortable:this,name:"sort",toEl:x,originalEvent:e})),_.active&&((ne==null||ne===-1)&&(ne=Fe,Ee=He),j({sortable:this,name:"end",toEl:x,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){K("nulling",this),$=d=x=S=Ae=A=rt=De=Oe=se=Le=ne=Ee=Fe=He=Pe=je=X=Ze=_.dragged=_.ghost=_.clone=_.active=null,ht.forEach(function(e){e.checked=!0}),ht.length=Dt=kt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":d&&(this._onDragOver(e),Vo(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,i=0,r=o.length,s=this.options;io.right+i||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+i}function Jo(t,e,n,o,i,r,s,l){var u=o?t.clientY:t.clientX,a=o?n.height:n.width,c=o?n.top:n.left,f=o?n.bottom:n.right,y=!1;if(!s){if(l&&stc+a*r/2:uf-st)return-je}else if(u>c+a*(1-i)/2&&uf-a*r/2)?u>c+a/2?1:-1:0}function ei(t){return ie(d){pn(e,c.oldIndex,c.newIndex)}},l=()=>{const c=typeof t=="string"?i==null?void 0:i.querySelector(t):$o(t);!c||o!==void 0||(o=new _(c,{...s,...r}))},u=()=>{o==null||o.destroy(),o=void 0},a=(c,f)=>{if(f!==void 0)o==null||o.option(c,f);else return o==null?void 0:o.option(c)};return Oo(l),To(u),{stop:u,start:l,option:a}}function pn(t,e,n){const o=ot(t),i=o?[...At(t)]:At(t);if(n>=0&&n{i.splice(n,0,r),o&&(t.value=i)})}}const ri={key:2,class:"header"},si={class:"columns is-gapless is-mobile is-centered"},ai={class:"column is-three-quarters-mobile is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},li={key:1,class:"has-text-centered"},ui={class:"columns"},di={key:0,class:"column"},ci=["title"],fi={key:1,class:"column"},pi=["title"],hi={key:3},mi={class:"accounts"},gi={class:"tfa-container"},vi={key:0,class:"tfa-cell tfa-checkbox"},bi={class:"field"},_i=["id","value","name"],yi=["for","onKeypress"],wi=["onClick","onKeyup"],Si={class:"tfa-text has-ellipsis"},Ei=["src","alt"],Di={class:"has-ellipsis is-family-primary is-size-6 is-size-7-mobile has-text-grey"},ki={class:"has-text-right"},Ci={key:0},Ti={key:0,class:"has-nowrap has-text-grey has-text-centered is-size-5"},Ii=["onClick","onKeyup","title"],Oi={key:1},$i=["onClick","title"],Ai={class:"has-text-right"},Mi=["onClick"],xi={key:0,class:"tfa-cell tfa-edit has-text-grey"},Pi={key:0,class:"drag-handle tfa-cell tfa-dots has-text-grey"},Li={__name:"Accounts",setup(t){const e=yn("2fauth"),n=Zt(),o=wn(),i=Ft(),r=Pn(),s=Sn(),{copy:l,copied:u}=En({legacy:!0}),a=Dn(),c=kn(),f=te(!1),y=te(!1),E=te(!1);te(!1);const D=te(!1),C=te(null),z=te(null),Z=te(null),P=te({otp_type:"",account:"",service:"",icon:""}),V=te([]),L=te([]);bt(f,g=>{var m;g==!1&&((m=Z.value)==null||m.clearOTP())}),bt(()=>a.items,g=>{r.inManagementMode&&J()}),bt(()=>r.inManagementMode,g=>{g&&J()});const ae=Cn(()=>!a.isEmpty&&!y.value&&!E.value);Bt(async()=>{i.preferences.getOtpOnRequest?a.fetch().then(()=>{a.backendWasNewer&&o.info({text:_t("commons.data_refreshed_to_reflect_server_changes"),duration:1e4})}):de(),c.fetch()});function J(){ii("#dv",a.filtered,{animation:200,handle:".drag-handle",onUpdate:g=>{const m=a.filtered[g.oldIndex].id,R=a.items.findIndex(fe=>fe.id==m);pn(a.items,R,g.newIndex),We(()=>{a.saveOrder()})}})}function ge(){a.fetch(),a.selectNone(),E.value=!1,o.success({text:_t("twofaccounts.accounts_moved")})}function we(g){P.value.otp_type=g.otp_type,P.value.service=g.service,P.value.account=g.account,P.value.icon=g.icon,We().then(()=>{f.value=!0,Z.value.show(g.id)})}function W(g){r.inManagementMode?a.select(g.id):!i.preferences.getOtpOnRequest&&g.otp_type.includes("totp")?le(g.otp.password):we(g)}function le(g){l(g),u&&(i.preferences.kickUserAfter==-1&&i.logout({kicked:!0}),o.success({text:_t("commons.copied_to_clipboard")}))}async function ue(g){nt.getOtpById(g.id).then(m=>{let R=m.data;if(le(R.password),R.otp_type=="hotp"){let fe=accounts.value.find(U=>U.id==g.id);fe!=null&&(fe.counter=R.counter)}})}function Se(g,m){L.value.filter(R=>R.props.period==g||g==null).forEach(R=>{R.turnOn(m)})}function re(g){L.value.filter(m=>m.props.period==g||g==null).forEach(m=>{m.turnOff()})}async function de(g){D.value=!0,re(g);let m;g==null?(C.value=-1,m=nt.getAll(!0)):(C.value=g,m=nt.getByIds(a.accountIdsWithPeriod(g).join(","),!0)),m.then(R=>{let fe=0;R.data.forEach(U=>{if(U.otp_type==="totp"){const Te=a.items.findIndex(vt=>vt.id===U.id);a.items[Te]==null?a.items.push(U):a.items[Te].otp=U.otp,fe=U.otp.generated_at}}),V.value.forEach(U=>{(U.props.period==g||g==null)&&We().then(()=>{U.startLoop(fe)})})}).finally(()=>{D.value=!1,C.value=null})}async function Ce(){await a.deleteSelected(),a.isEmpty&&(r.inManagementMode=!1,n.push({name:"start"}))}function ce(){r.inManagementMode=!1,a.selectNone()}return(g,m)=>{const R=Q("FontAwesomeIcon"),fe=Q("Modal"),U=Q("font-awesome-icon"),Te=Q("RouterLink"),vt=Q("VueFooter");return w(),k("div",null,[p(y)?(w(),ve(Yn,{key:0,showGroupSwitch:p(y),"onUpdate:showGroupSwitch":m[0]||(m[0]=h=>ot(y)?y.value=h:null),groups:p(c).items,"onUpdate:groups":m[1]||(m[1]=h=>p(c).items=h)},null,8,["showGroupSwitch","groups"])):Y("",!0),p(E)?(w(),ve(eo,{key:1,showDestinationGroupSelector:p(E),"onUpdate:showDestinationGroupSelector":m[2]||(m[2]=h=>ot(E)?E.value=h:null),selectedAccountsIds:p(a).selectedIds,"onUpdate:selectedAccountsIds":m[3]||(m[3]=h=>p(a).selectedIds=h),groups:p(c).items,onAccountsMoved:ge},null,8,["showDestinationGroupSelector","selectedAccountsIds","groups"])):Y("",!0),p(ae)||p(y)?(w(),k("div",ri,[v("div",si,[v("div",ai,[I(so,{keyword:p(a).filter,"onUpdate:keyword":m[4]||(m[4]=h=>p(a).filter=h)},null,8,["keyword"]),p(r).inManagementMode?(w(),ve(go,{key:0,selectedCount:p(a).selectedCount,onClearSelected:m[5]||(m[5]=h=>p(a).selectNone()),onSelectAll:m[6]||(m[6]=h=>p(a).selectAll()),onSortAsc:m[7]||(m[7]=h=>p(a).sortAsc()),onSortDesc:m[8]||(m[8]=h=>p(a).sortDesc())},null,8,["selectedCount"])):(w(),k("div",li,[v("div",ui,[I(p(Me),null,{default:B(({mode:h})=>[p(y)?(w(),k("div",di,[v("button",{id:"btnHideGroupSwitch",title:g.$t("groups.hide_group_selector"),tabindex:"1",class:H(["button is-text is-like-text",{"has-text-grey":h!="dark"}]),onClick:m[9]||(m[9]=Ie(N=>y.value=!p(y),["stop"]))},M(g.$t("groups.select_accounts_to_show")),11,ci)])):(w(),k("div",fi,[v("button",{id:"btnShowGroupSwitch",title:g.$t("groups.show_group_selector"),tabindex:"1",class:H(["button is-text is-like-text",{"has-text-grey":h!="dark"}]),onClick:m[10]||(m[10]=Ie(N=>y.value=!p(y),["stop"]))},[ze(M(p(c).current)+" ("+M(p(a).filteredCount)+")  ",1),I(R,{icon:["fas","caret-down"]})],10,pi)]))]),_:1})])]))])])])):Y("",!0),I(fe,{modelValue:p(f),"onUpdate:modelValue":m[12]||(m[12]=h=>ot(f)?f.value=h:null)},{default:B(()=>[I($n,Tn({ref_key:"otpDisplay",ref:Z},p(P),{onPleaseCloseMe:m[11]||(m[11]=h=>f.value=!1)}),null,16)]),_:1},8,["modelValue"]),p(i).preferences.getOtpOnRequest?Y("",!0):(w(),k("span",hi,[(w(!0),k(ut,null,dt(p(a).periods,h=>(w(),ve(An,{key:h.period,autostart:!1,period:h.period,generated_at:h.generated_at,onLoopEnded:N=>de(h.period),onLoopStarted:N=>Se(h.period,N),onSteppedUp:N=>Se(h.period,N),ref_for:!0,ref_key:"looperRefs",ref:V},null,8,["period","generated_at","onLoopEnded","onLoopStarted","onSteppedUp"]))),128))])),p(ae)?(w(),k("div",{key:4,class:H(["container",p(r).inManagementMode?"is-edit-mode":""])},[v("div",mi,[v("span",{id:"dv",class:H(["columns is-multiline",{"is-centered":p(i).preferences.displayMode==="grid"}])},[(w(!0),k(ut,null,dt(p(a).filtered,h=>(w(),k("div",{class:H([[p(i).preferences.displayMode==="grid"?"tfa-grid":"tfa-list"],"column is-narrow"]),key:h.id},[v("div",gi,[I(Ge,{name:"slideCheckbox"},{default:B(()=>[p(r).inManagementMode?(w(),k("div",vi,[v("div",bi,[I(p(Me),null,{default:B(({mode:N})=>[yt(v("input",{class:H(["is-checkradio is-small",N=="dark"?"is-white":"is-info"]),id:"ckb_"+h.id,value:h.id,type:"checkbox",name:"ckb_"+h.id,"onUpdate:modelValue":m[13]||(m[13]=Xt=>p(a).selectedIds=Xt)},null,10,_i),[[In,p(a).selectedIds]])]),_:2},1024),v("label",{tabindex:"0",for:"ckb_"+h.id,onKeypress:wt(Ie(N=>p(a).select(h.id),["prevent"]),["space"])},null,40,yi)])])):Y("",!0)]),_:2},1024),v("div",{tabindex:"0",class:"tfa-cell tfa-content is-size-3 is-size-4-mobile",onClick:[Ie(N=>W(h),["exact"]),Ie(N=>ue(h),["ctrl"])],onKeyup:wt(N=>W(h),["enter"]),role:"button"},[v("div",Si,[h.icon&&p(i).preferences.showAccountsIcons?(w(),k("img",{key:0,class:"tfa-icon",src:p(e).config.subdirectory+"/storage/icons/"+h.icon,alt:g.$t("twofaccounts.icon_for_account_x_at_service_y",{account:h.account,service:h.service})},null,8,Ei)):Y("",!0),ze(" "+M(h.service?h.service:g.$t("twofaccounts.no_service")),1),p(s).useEncryption&&h.account===g.$t("errors.indecipherable")?(w(),ve(R,{key:1,class:"has-text-danger is-size-5 ml-2",icon:["fas","exclamation-circle"]})):Y("",!0),v("span",Di,M(h.account),1)])],40,wi),I(Ge,{name:"popLater"},{default:B(()=>[yt(v("div",ki,[h.otp!=null?(w(),k("span",Ci,[p(D)==!0&&(p(C)==-1||p(C)==h.period)?(w(),k("span",Ti,[I(R,{icon:["fas","circle-notch"],spin:""})])):(w(),k("span",{key:1,class:"always-on-otp is-clickable has-nowrap has-text-grey is-size-5 ml-4",onClick:N=>le(h.otp.password),onKeyup:wt(N=>le(h.otp.password),["enter"]),title:g.$t("commons.copy_to_clipboard")},M(p(On)(h.otp.password,p(i).preferences.showOtpAsDot&&p(i).preferences.revealDottedOTP&&p(z)==h.id)),41,Ii)),h.otp_type.includes("totp")?(w(),ve(Mn,{key:2,class:H("condensed"),ref_for:!0,ref_key:"dotsRefs",ref:L,period:h.period},null,8,["period"])):Y("",!0)])):(w(),k("span",Oi,[I(p(Me),null,{default:B(({mode:N})=>[v("button",{class:H(["button tag",N=="dark"?"is-dark":"is-white"]),onClick:Xt=>we(h),title:g.$t("twofaccounts.import.import_this_account")},M(g.$t("commons.generate")),11,$i)]),_:2},1024)]))],512),[[Yt,p(i).preferences.getOtpOnRequest==!1&&!p(r).inManagementMode]])]),_:2},1024),p(i).preferences.showOtpAsDot&&p(i).preferences.revealDottedOTP?(w(),ve(Ge,{key:0,name:"popLater"},{default:B(()=>[yt(v("div",Ai,[p(z)==h.id?(w(),k("button",{key:0,class:"pr-0 button is-ghost has-text-grey-dark",onClick:m[14]||(m[14]=Ie(N=>z.value=null,["stop"]))},[I(U,{icon:["fas","eye"]})])):(w(),k("button",{key:1,class:"pr-0 button is-ghost has-text-grey-dark",onClick:Ie(N=>z.value=h.id,["stop"])},[I(U,{icon:["fas","eye-slash"]})],8,Mi))],512),[[Yt,p(i).preferences.getOtpOnRequest==!1&&!p(r).inManagementMode]])]),_:2},1024)):Y("",!0),I(Ge,{name:"fadeInOut"},{default:B(()=>[p(r).inManagementMode?(w(),k("div",xi,[I(p(Me),null,{default:B(({mode:N})=>[I(Te,{to:{name:"editAccount",params:{twofaccountId:h.id}},class:H(["tag is-rounded mr-1",N=="dark"?"is-dark":"is-white"])},{default:B(()=>[ze(M(g.$t("commons.edit")),1)]),_:2},1032,["to","class"]),I(Te,{to:{name:"showQRcode",params:{twofaccountId:h.id}},class:H(["tag is-rounded",N=="dark"?"is-dark":"is-white"]),title:g.$t("twofaccounts.show_qrcode")},{default:B(()=>[I(R,{icon:["fas","qrcode"]})]),_:2},1032,["to","class","title"])]),_:2},1024)])):Y("",!0)]),_:2},1024),I(Ge,{name:"fadeInOut"},{default:B(()=>[p(r).inManagementMode?(w(),k("div",Pi,[I(R,{icon:["fas","bars"]})])):Y("",!0)]),_:1})])],2))),128))],2)]),I(vt,{showButtons:!0,internalFooterType:p(r).inManagementMode&&!p(E)?"doneButton":"navLinks",onDoneButtonClicked:ce},{default:B(()=>[I(Co,{inManagementMode:p(r).inManagementMode,"onUpdate:inManagementMode":m[15]||(m[15]=h=>p(r).inManagementMode=h),areDisabled:p(a).hasNoneSelected,onMoveButtonClicked:m[16]||(m[16]=h=>E.value=!0),onDeleteButtonClicked:Ce,onExportButtonClicked:m[17]||(m[17]=h=>p(a).export())},null,8,["inManagementMode","areDisabled"])]),_:1},8,["internalFooterType"])],2)):Y("",!0)])}}};export{Li as default};