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