import{v as ke,x as Ye,y as Me,r as f,w as X,k as Ne,z as c,A as v,B as l,C as s,D as T,E as m,F as o,H as ee,J as le,K,G as E,Y as Je,Z as mt,L as q,e as $t,g as ye,h as Te,n as Nt,j as Vt,i as it,f as je,l as Fa,q as Aa,aq as he,V as rt,I as pt,T as Ba,t as Qe,m as ge,S as ta,o as qa,p as Lt,R as Z,X as St,W as aa,aG as la,a1 as oa,aH as Pa,_ as na,$ as sa,a as Ha,a3 as Ea,a4 as Ua,a0 as Wa,aI as lt,U as Qa,a2 as Oa,aJ as ot}from"./index.f89c7e6e.js";import{k as Ft,B as fe,o as We,q as Q,r as N,v as te,w as ut,C as Tt,t as Ge,a as ia,c as ra,T as Ka,_ as Ve,ax as ua,I as ja,W as Ga,ay as da,ai as Xa,an as Ja,l as ca,x as Ya,s as De,D as Za,a0 as fa,G as el,m as tl,n as al,y as Xe,z as Mt,A as It,M as st,P as Wt,F as ll,U as Qt,R as Ot,az as zt,aA as Kt,aB as jt,S as Ue,aC as ne,a5 as va,a6 as ae,Z as ga,Y as ha,$ as ol,a4 as ma,aD as Gt,H as Xt,aE as pa,J as nl,K as sl,L as il,X as ba,V as rl,a1 as ul,p as dl,a2 as cl,Q as fl}from"./QTable.18dd05c1.js";import{b as gt,a as vl,c as gl,d as hl,e as ml,Q as _e}from"./QBtn.9455f382.js";/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jt=Ft("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ht=Ft("FlagIcon",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yt=Ft("MinusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}]]),pl={__name:"MarkMenu",props:{records:{type:Array,required:!0}},setup(i){const p=ke();Ye();const{t:C}=Me(),u=f(!1),d=f(!1),_=f(!1),S=i;X(()=>S.records,R=>{x()}),Ne(()=>{x()});const x=()=>{if(S.records.length==1){const R=S.records[0];let g=typeof R=="string"?fe(R):R;g!=null&&(d.value=g.unread!=null?g.unread:!1,u.value=g.flagged!=null?g.flagged:!1,_.value=g.locked!=null?g.locked:!1)}else u.value=!1,_.value=!1,d.value=!1};function b(){u.value=!u.value;for(const R of S.records){const g=typeof R=="string"?R:R.id;p.saveMetadata(g,"flagged",u.value,!0)}}function L(){d.value=!d.value;for(const R of S.records){const g=typeof R=="string"?R:R.id;p.saveMetadata(g,"unread",d.value,!0)}}function k(){_.value=!_.value;for(const R of S.records){const g=typeof R=="string"?R:R.id;p.saveMetadata(g,"locked",_.value,!0)}}return(R,g)=>(c(),v(ut,{anchor:"top right",self:"top left","auto-close":"",class:ee(o(te)("DTContextMenu DTContextMenuLight","DTContextMenu"))},{default:l(()=>[s(We,{dense:""},{default:l(()=>[s(Q,{clickable:"",onClick:b},{default:l(()=>[u.value?(c(),v(N,{key:0},{default:l(()=>[T(m(o(C)("actionUnflagged")),1)]),_:1})):(c(),v(N,{key:1},{default:l(()=>[T(m(o(C)("actionFlagged")),1)]),_:1}))]),_:1}),s(Q,{clickable:"",onClick:L},{default:l(()=>[d.value?(c(),v(N,{key:0},{default:l(()=>[T(m(o(C)("actionRead")),1)]),_:1})):(c(),v(N,{key:R.markKey},{default:l(()=>[T(m(o(C)("actionUnread")),1)]),_:1}))]),_:1}),(c(),v(Q,{clickable:"",onClick:k,key:R.markKey},{default:l(()=>[_.value?(c(),v(N,{key:0},{default:l(()=>[T(m(o(C)("actionUnlocked")),1)]),_:1})):(c(),v(N,{key:1},{default:l(()=>[T(m(o(C)("actionLocked")),1)]),_:1}))]),_:1}))]),_:1})]),_:1},8,["class"]))}},bl=["fill"],_l=q("rect",{width:"20",height:"10",x:"2",y:"7",rx:"5"},null,-1),yl=[_l],wl=["fill"],Dl=q("rect",{width:"20",height:"10",x:"2",y:"7",rx:"5"},null,-1),kl=[Dl],Cl={__name:"LabelMenu",setup(i){const p=Ye(),C=ke(),{t:u}=Me(),{selectedRecords:d}=le(C),_=f([]);Ne(()=>{_.value=new Array,d.value.forEach(x=>{let b=fe(x),L=b.label!=null?b.label:0;_.value.includes(L)||_.value.push(L)})});function S(x){d.value.forEach(b=>{C.saveMetadata(b,"label",x,!0)})}return(x,b)=>(c(),v(ut,{anchor:"top right",self:"top left","auto-close":"",class:ee(o(te)("DTContextMenu DTContextMenuLight","DTContextMenu"))},{default:l(()=>[s(We,{dense:""},{default:l(()=>[s(Q,{clickable:"",onClick:b[0]||(b[0]=L=>S(0))},{default:l(()=>[s(N,{side:""},{default:l(()=>[(c(),K("svg",{"data-v-a764920c":"",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:x.white,stroke:"#0000004d","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-rectangle-horizontal-icon"},yl,8,bl))]),_:1}),s(N,null,{default:l(()=>[T(m(o(u)("none")),1)]),_:1}),_.value.includes(0)?(c(),v(N,{key:0,side:""},{default:l(()=>[_.value.length==1?(c(),v(o(Tt),{key:0,size:"20",color:o(p).iconColor},null,8,["color"])):(c(),v(o(Yt),{key:1,size:"20",color:o(p).iconColor},null,8,["color"]))]),_:1})):E("",!0)]),_:1}),s(Ge),(c(!0),K(Je,null,mt(o(C).database.labels,(L,k)=>(c(),v(Q,{key:L.value,clickable:"",onClick:R=>S(k+1)},{default:l(()=>[s(N,{side:""},{default:l(()=>[(c(),K("svg",{"data-v-a764920c":"",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:L.color,stroke:"#0000004d","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-rectangle-horizontal-icon"},kl,8,wl))]),_:2},1024),s(N,null,{default:l(()=>[T(m(L.description),1)]),_:2},1024),_.value.includes(k+1)?(c(),v(N,{key:0,side:""},{default:l(()=>[_.value.length==1?(c(),v(o(Tt),{key:0,size:"20",color:o(p).iconColor},null,8,["color"])):(c(),v(o(Yt),{key:1,size:"20",color:o(p).iconColor},null,8,["color"]))]),_:1})):E("",!0)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["class"]))}};var xl=$t({name:"QSplitter",props:{...ia,modelValue:{type:Number,required:!0},reverse:Boolean,unit:{type:String,default:"%",validator:i=>["%","px"].includes(i)},limits:{type:Array,validator:i=>i.length!==2||typeof i[0]!="number"||typeof i[1]!="number"?!1:i[0]>=0&&i[0]<=i[1]},emitImmediately:Boolean,horizontal:Boolean,disable:Boolean,beforeClass:[Array,String,Object],afterClass:[Array,String,Object],separatorClass:[Array,String,Object],separatorStyle:[Array,String,Object]},emits:["update:modelValue"],setup(i,{slots:p,emit:C}){const{proxy:{$q:u}}=Vt(),d=ra(i,u),_=f(null),S={before:f(null),after:f(null)},x=ye(()=>`q-splitter no-wrap ${i.horizontal===!0?"q-splitter--horizontal column":"q-splitter--vertical row"} q-splitter--${i.disable===!0?"disabled":"workable"}`+(d.value===!0?" q-splitter--dark":"")),b=ye(()=>i.horizontal===!0?"height":"width"),L=ye(()=>i.reverse!==!0?"before":"after"),k=ye(()=>i.limits!==void 0?i.limits:i.unit==="%"?[10,90]:[50,1/0]);function R(B){return(i.unit==="%"?B:Math.round(B))+i.unit}const g=ye(()=>({[L.value]:{[b.value]:R(i.modelValue)}}));let se,U,A,J,Y;function z(B){if(B.isFirst===!0){const $=_.value.getBoundingClientRect()[b.value];se=i.horizontal===!0?"up":"left",U=i.unit==="%"?100:$,A=Math.min(U,k.value[1],Math.max(k.value[0],i.modelValue)),J=(i.reverse!==!0?1:-1)*(i.horizontal===!0?1:u.lang.rtl===!0?-1:1)*(i.unit==="%"?$===0?0:100/$:1),_.value.classList.add("q-splitter--active");return}if(B.isFinal===!0){Y!==i.modelValue&&C("update:modelValue",Y),_.value.classList.remove("q-splitter--active");return}const j=A+J*(B.direction===se?-1:1)*B.distance[i.horizontal===!0?"y":"x"];Y=Math.min(U,k.value[1],Math.max(k.value[0],j)),S[L.value].value.style[b.value]=R(Y),i.emitImmediately===!0&&i.modelValue!==Y&&C("update:modelValue",Y)}const ie=ye(()=>[[Ka,z,void 0,{[i.horizontal===!0?"vertical":"horizontal"]:!0,prevent:!0,stop:!0,mouse:!0,mouseAllDir:!0}]]);function re(B,j){B<j[0]?C("update:modelValue",j[0]):B>j[1]&&C("update:modelValue",j[1])}return X(()=>i.modelValue,B=>{re(B,k.value)}),X(()=>i.limits,()=>{Nt(()=>{re(i.modelValue,k.value)})}),()=>{const B=[Te("div",{ref:S.before,class:["q-splitter__panel q-splitter__before"+(i.reverse===!0?" col":""),i.beforeClass],style:g.value.before},gt(p.before)),Te("div",{class:["q-splitter__separator",i.separatorClass],style:i.separatorStyle,"aria-disabled":i.disable===!0?"true":void 0},[vl("div",{class:"q-splitter__separator-area absolute-full"},gt(p.separator),"sep",i.disable!==!0,()=>ie.value)]),Te("div",{ref:S.after,class:["q-splitter__panel q-splitter__after"+(i.reverse===!0?"":" col"),i.afterClass],style:g.value.after},gt(p.after))];return Te("div",{class:x.value,ref:_},gl(p.default,B))}}}),Rl=$t({name:"QPage",props:{padding:Boolean,styleFn:Function},setup(i,{slots:p}){const{proxy:{$q:C}}=Vt(),u=it(Fa,je);if(u===je)return console.error("QPage needs to be a deep child of QLayout"),je;if(it(Aa,je)===je)return console.error("QPage needs to be child of QPageContainer"),je;const _=ye(()=>{const x=(u.header.space===!0?u.header.size:0)+(u.footer.space===!0?u.footer.size:0);if(typeof i.styleFn=="function"){const b=u.isContainer.value===!0?u.containerHeight.value:C.screen.height;return i.styleFn(x,b)}return{minHeight:u.isContainer.value===!0?u.containerHeight.value-x+"px":C.screen.height===0?x!==0?`calc(100vh - ${x}px)`:"100vh":C.screen.height-x+"px"}}),S=ye(()=>`q-page${i.padding===!0?" q-layout-padding":""}`);return()=>Te("main",{class:S.value,style:_.value},gt(p.default))}});function Zt(i){var p=!1;switch(i){case"aac":case"m4a":p=!0;break;case"webm":he.is.safari||(p=!0);break;case"aiff":case"aif":case"ogg":case"ogv":console.log(he.userAgent),!he.is.safari&&!he.is.chrome&&!he.is.opera&&(p=!0);break;case"mp3":case"mp4":case"m4v":case"mov":p=!0;break;case"mpg":case"mpeg":he.is.safari&&(p=!0);break}return p}const Sl={class:"absolute-center"},Tl={__name:"NoSelection",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(i){return Me(),(p,C)=>(c(),K("div",Sl,[q("p",{class:ee(o(te)("dt-text-light","dt-text-dark"))},m(p.$t("noSelection")),3)]))}};var Rt=Ve(Tl,[["__scopeId","data-v-39593886"]]);const Ml={class:"absolute-center"},Il={__name:"MultiSelection",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(i){Me();const p=ke();le(p);const C=it("editorData");return(u,d)=>(c(),K("div",Ml,[q("p",{class:ee(o(te)("dt-text-light","dt-text-dark"))},m(o(C).selectionCount)+" "+m(u.$t("selectedItems")),3)]))}};var zl=Ve(Il,[["__scopeId","data-v-89ab4c86"]]);const $l=["height","src"],Nl={__name:"DefaultViewer",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(i){ke(),f(null);const p=i,C=it("editorData");X(()=>p.recordID,x=>{S()}),X(()=>p.height,x=>{u()}),Ne(()=>{S(),u()});const u=()=>{_.value=p.height-6},d=f(""),_=f(100),S=()=>{C.recordID!=null?d.value=ua(C.recordID):d.value=""};return(x,b)=>(c(),K("div",{class:"dt-default-viewer",name:"DTDefault",style:rt("height:"+i.height+"px;")},[q("iframe",{height:_.value,src:d.value,class:"DTFrame",frameborder:"0",width:"100%",allowfullscreen:"",target:"_parent"},null,8,$l)],4))}};var Ee=Ve(Nl,[["__scopeId","data-v-2003b799"]]);const Vl={__name:"ImageView",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(i){const p=ke();le(p),Me(),pt();const C=f(null),u=f("height 300px; max-width: 100% ;"),d=i;X(()=>d.recordID,x=>{S()}),X(()=>d.height,x=>{_()}),Ne(()=>{S(),_()});const _=()=>{u.value="height:"+d.height+"px; max-width: 100% ;"},S=()=>{var x="";d.recordID!=null&&(x=ua(d.recordID)),C.value=x};return(x,b)=>(c(),v(Ga,{style:rt(u.value)},{default:l(()=>[s(ja,{src:C.value,"spinner-color":"white",style:{"max-width":"100%"}},null,8,["src"])]),_:1},8,["style"]))}};const Ll={class:"absolute-center"},Fl={class:"dt-download-container"},Al={__name:"UnsupportedView",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(i){const p=ke(),{t:C}=Me(),u=i,d=()=>{p.downloadRecord(u.recordID)};return(_,S)=>(c(),K("div",Ll,[q("p",{class:ee(o(te)("dt-text-light","dt-text-dark"))},m(o(C)("formatNotSupported")),3),q("div",Fl,[o(da)(u.recordID)?(c(),v(hl,{key:0,class:"dt-download",color:"light-blue",label:o(C)("downloadToView"),"no-caps":"",flat:"",onClick:d},null,8,["label"])):E("",!0)])]))}};var nt=Ve(Al,[["__scopeId","data-v-4ed8b1a6"]]),Bl=$t({name:"QInnerLoading",props:{...ia,...Xa,showing:Boolean,color:String,size:{type:[String,Number],default:"42px"},label:String,labelClass:String,labelStyle:[String,Array,Object]},setup(i,{slots:p}){const C=Vt(),u=ra(i,C.proxy.$q),{transitionProps:d,transitionStyle:_}=Ja(i),S=ye(()=>"q-inner-loading q--avoid-card-border absolute-full column flex-center"+(u.value===!0?" q-inner-loading--dark":"")),x=ye(()=>"q-inner-loading__label"+(i.labelClass!==void 0?` ${i.labelClass}`:""));function b(){const k=[Te(ml,{size:i.size,color:i.color})];return i.label!==void 0&&k.push(Te("div",{class:x.value,style:i.labelStyle},[i.label])),k}function L(){return i.showing===!0?Te("div",{class:S.value,style:_.value},p.default!==void 0?p.default():b()):null}return()=>Te(Ba,d.value,L)}});const ql={__name:"MainTableMenu",props:{editColumns:{type:Boolean,default:!1}},emits:["action-clicked"],setup(i,{emit:p}){const C=ke(),u=Ye(),d=ca();pt();const{t:_}=Me(),S=f(""),x=f(""),{isSupported:b,copy:L,copied:k}=Ya({source:x}),R=p;Qe({columnEdit:!1,row:null});const g=it("tableData");f(null);const se=f(!1),U=f(!1),A=f(!0),J=h=>{R("action-clicked",h)};function Y(h){J("hideMenu")}Ne(()=>{G(),re(),j()});const z=()=>{u.settings.rightDrawerOpen=!0},ie=()=>{for(const h of g.targetRows){const w=typeof h=="string"?h:h.id;el(w)}},re=()=>{se.value=!1,A.value=g.targetRows.length==1;for(const w of g.targetRows){var h=null;typeof w=="string"?h=fe(w):h=w,h!=null&&h.url!=null&&(h.type=="DTnx"||h.type=="html")&&(se.value=!0)}},B=()=>{var h=null;for(const F of g.targetRows){var w=null;typeof F=="string"?w=fe(F):w=F,w!=null&&w.url!=null&&(w.type=="DTnx"||w.type=="html")&&(h=window.open(w.url,"_blank"))}h!=null&&h.focus()},j=()=>{U.value=!1,A.value=g.targetRows.length==1;for(const w of g.targetRows){var h=null;typeof w=="string"?h=fe(w):h=w,h!=null&&h.url!=null&&h.url!=""&&window.location.protocol=="https:"&&(U.value=!0)}},$=()=>{if(g.targetRows.length==1){const w=g.targetRows.at(0);var h=null;typeof w=="string"?h=fe(w):h=w,h!=null&&h.url!=null&&(x.value=h.url,L())}},I=()=>{S.value!=""&&(x.value=S.value,L())},G=()=>{var h="",w=1;for(const F of g.targetRows){const Oe=typeof F=="string"?F:F.id;h=h+"x-devonthink-item://"+Oe,w<g.targetRows.length&&(h=h+`
`),w++}S.value=h},ue=()=>{for(const h of g.targetRows){const w=typeof h=="string"?h:h.id;C.downloadRecord(w)}},P=()=>{u.showFileUpload=!0},Le=h=>{const w=d.columnData.columns[h-1];d.columnData.visibleColumns.includes(w.name)?(d.columnData.visibleColumns=d.columnData.visibleColumns.filter(F=>F!=w.name),w.visible=!1):(d.columnData.visibleColumns.push(w.name),w.visible=!0),d.saveColumns()};return(h,w)=>(c(),v(ut,{"context-menu":"","touch-position":"",class:ee(o(te)("DTContextMenu DTContextMenuLight","DTContextMenu")),onHide:Y},{default:l(()=>[i.editColumns?(c(),v(We,{key:0,dense:""},{default:l(()=>[(c(!0),K(Je,null,mt(o(d).allAvailableColumns,F=>ge((c(),v(Q,{key:F.key,clickable:"",onClick:Oe=>Le(F.key)},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)(F.label)),1)]),_:2},1024),s(N,{side:""},{default:l(()=>[o(d).columnData.visibleColumns.includes(F.name)?(c(),v(o(Tt),{key:0,size:"20",color:o(u).iconColor},null,8,["color"])):E("",!0)]),_:2},1024)]),_:2},1032,["onClick"])),[[De]])),128))]),_:1})):(c(),v(We,{key:1,dense:""},{default:l(()=>[s(Q,{clickable:"",disable:!o(g).canAdd},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("newTitle")),1)]),_:1}),s(N,{side:""},{default:l(()=>[s(_e,{name:"icon-icons8-forward",class:"DTMenuIcon"})]),_:1}),s(Za)]),_:1},8,["disable"]),s(Ge),ge((c(),v(Q,{clickable:"",onClick:z},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("actionInfo")),1)]),_:1})]),_:1})),[[De]]),s(Ge),se.value?ge((c(),v(Q,{key:0,clickable:"",onClick:w[0]||(w[0]=F=>B())},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("launchUrl")),1)]),_:1})]),_:1})),[[De]]):E("",!0),U.value&&A.value?ge((c(),v(Q,{key:1,disable:!o(b),clickable:"",onClick:w[1]||(w[1]=F=>$())},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("copyUrl")),1)]),_:1})]),_:1},8,["disable"])),[[De]]):E("",!0),ge((c(),v(Q,{clickable:"",onClick:w[2]||(w[2]=F=>I()),disable:!o(b)},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("copyItemLink")),1)]),_:1})]),_:1},8,["disable"])),[[De]]),s(Ge),s(Q,{clickable:"",disable:!o(g).canChange},{default:l(()=>[s(N,null,{default:l(()=>[T(m(h.$t("actionMark")),1)]),_:1}),s(N,{side:""},{default:l(()=>[s(_e,{name:"icon-icons8-forward",class:"DTMenuIcon"})]),_:1}),s(pl,{records:o(g).targetRows},null,8,["records"])]),_:1},8,["disable"]),s(Q,{clickable:"",disable:!o(g).canChange},{default:l(()=>[s(N,null,{default:l(()=>[T(m(h.$t("actionRating")),1)]),_:1}),s(N,{side:""},{default:l(()=>[s(_e,{name:"icon-icons8-forward",class:"DTMenuIcon"})]),_:1}),s(ut,{anchor:"top right",self:"top left","auto-close":""},{default:l(()=>[s(We,{dense:""},{default:l(()=>[o(g).canChange?(c(),v(Q,{key:0},{default:l(()=>[s(N,null,{default:l(()=>[(c(),v(fa,{class:"DTRating",size:"1.5rem",key:h.ratingKey,disable:!o(g).canChange,modelValue:h.rating,"onUpdate:modelValue":w[3]||(w[3]=F=>h.rating=F),color:"grey-4","color-selected":"grey-9",max:5,icon:"star"},null,8,["disable","modelValue"]))]),_:1})]),_:1})):E("",!0)]),_:1})]),_:1})]),_:1},8,["disable"]),s(Q,{clickable:"",disable:!o(g).canChange},{default:l(()=>[s(N,null,{default:l(()=>[T(m(h.$t("actionLabel")),1)]),_:1}),s(N,{side:""},{default:l(()=>[s(_e,{name:"icon-icons8-forward",class:"DTMenuIcon"})]),_:1}),s(Cl)]),_:1},8,["disable"]),s(Ge),ge((c(),v(Q,{disable:!o(g).canAdd,clickable:"",onClick:P},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("uploadFile")),1)]),_:1})]),_:1},8,["disable"])),[[De]]),ge((c(),v(Q,{disable:!o(g).canDownloadFile,clickable:"",onClick:ue},{default:l(()=>[s(N,null,{default:l(()=>[T(m(o(_)("actionDownload")),1)]),_:1})]),_:1},8,["disable"])),[[De]]),s(Ge),ge((c(),v(Q,{disable:!o(g).canDelete,clickable:"",onClick:w[4]||(w[4]=F=>ie(F))},{default:l(()=>[s(N,{label:""},{default:l(()=>[T(m(o(_)("actionMoveTrash")),1)]),_:1})]),_:1},8,["disable"])),[[De]])]),_:1}))]),_:1},8,["class"]))}};var _a=Ve(ql,[["__scopeId","data-v-976404fc"]]);const Pl=i=>(na("data-v-070e2650"),i=i(),sa(),i),Hl={class:"table-header row",id:"dt-table-header"},El=Pl(()=>q("div",{class:"dt-spacer__back"},null,-1)),Ul={class:"row table-header-item"},Wl={class:"table-title"},Ql={class:"row dt-menu-text-align"},Ol={key:0,class:"dt-row-group"},Kl=["onUpdate:modelValue","onKeyup","onFocus","onBlur","id"],jl={key:1,class:"dt-row-group dt-primary-text"},Gl={class:"truncate dt-name-col"},Xl={key:0},Jl={class:"truncate dt-url-col"},ea=33,Yl={__name:"MainTableView",props:{height:{type:Number,required:!0},width:{type:Number,required:!0}},emits:["selection-changed"],setup(i,{emit:p}){ta(e=>({"0a28e2ca":kt.value,ec3f2230:Ct.value,"1b8c7b52":e.primaryColor,"42e07ee0":e.secondaryColor,ce2ade90:o(U).tableDragHighlight,"90cc6f94":B.height,"10fe808f":o(U).backgroundColor,"7cf4ed55":o(U).secondaryColor}));const C=Ye(),u=ke(),d=ca(),_=tl(),S=al(),{columnData:x}=le(d),{rowData:b,updateTitle:L}=le(d),{selectedGroup:k,refreshTable:R}=le(u),{selectedRecords:g,lastSelected:se}=le(u),{dtTheme:U}=le(C),{t:A}=Me();pt();const J=f(!1),Y=f("height: 200px;");f("10px"),f(!1);const z=f("icon-icons8-sortup"),ie=p,re=f(!1),B=i;X(()=>B.height,()=>{j()});const j=()=>{document.getElementById("dt-table-header");var e=48.5;let t=B.height-e;Y.value="height: "+t+"px;"};X(k,()=>{$()}),X(R,()=>{R.value!=""&&R.value==k.value&&d.refreshTableRowData(),u.refreshTable=""});const $=()=>{k.value!=null&&k.value!="none"?(u.clearSelectedRecords(),ie("selection-changed"),d.updateRowData(),oe.canChange=Xe(k.value),oe.canAdd=Mt(k.value),oe.canDelete=It(k.value),oe.canDownloadFile=da(k.value),Ie(),xt(),Le(),J.value=!1,ue.value=!1,re.value=Xe(k.value)):re.value=!1};X(L,()=>{L.value&&(Ie(),Le(),L.value=!1)});const I=f(!0),G=f([]),ue=f(!1),P=f([14,10]),Le=()=>{var e="";if(G.value=[],I.value=!0,k.value==null||k.value=="")return;let t=new Array;var a=null;do{e==""?e=k.value:e=a.parentID,a=fe(e);let n=h(a);t.push(n)}while(!st(e)&&!Wt(e)&&!ll(e)&&!Qt(e)&&!Ot(e));I.value=t.length<=1,G.value=t},h=e=>{let t={};return e!=null?(t.iconName=zt(e),t.displayName=w(e),t.id=e.id):k.value=="inboxes-root"?(t.iconName="web-container-icon-inbox",t.displayName=A("inboxes")):k.value=="tags-root"?(t.iconName="web-container-icon-tag",t.displayName=A("tags")):k.value=="trash-root"&&(t.iconName="web-container-icon-trash",t.displayName=A("trash")),t.iconColor=Kt(e),t.iconStyle=jt(e),t},w=e=>{var t=e.displayName==null?e.title:e.displayName;return(Qt(e.id)||Wt(e.id)||Ot(e.id))&&(t=e.location),t},F=()=>{ue.value=!1},Oe=e=>{var t="regularMenu-title";return e==0&&(t="mainMenu-title"),t},dt=e=>{if(e!=k.value){var t=Gt(e);t?_.expandNode=e:S.expandNode=e,J.value=!0,u.setSelectedGroup(e),Xt(e),ue.value=!1}},W=Qe({iconName:"",iconColor:"",iconStyle:"",displayName:"",showBackBtn:!1}),Ie=()=>{let e=u.recordWithID(k.value);e!=null?(W.iconName=zt(e),W.displayName=w(e)):k.value=="inboxes-root"?(W.iconName="web-container-icon-inbox",W.displayName=A("inboxes")):k.value=="tags-root"?(W.iconName="web-container-icon-tag",W.displayName=A("tags")):k.value=="trash-root"?(W.iconName="web-container-icon-trash",W.displayName=A("trash")):(W.iconName="",W.displayName=""),W.iconColor=Kt(e),W.iconStyle=jt(e)};Ne(()=>{j(),Ie(),Ia(),d.loadColumns()}),qa(()=>{za()});const Fe=f(!0),Ae=f(!0),oe=Qe({canAdd:!1,canChange:!1,canDelete:!1,canDownloadFile:!1,targetRows:[]});Lt("tableData",oe);const me=(e,t)=>{e.preventDefault(),Ze(t)},Ze=e=>{Ae.value=e==null,Ae.value?oe.targetRows=[]:(pa(e.id)?(oe.targetRows=[],g.value.forEach(t=>{const a=fe(t);oe.targetRows.push(a)})):(oe.targetRows=[e],u.addSelectedRecords(e.id,!0),ie("selection-changed")),oe.canAdd=Mt(e.id),oe.canChange=Xe(e.id),oe.canDelete=It(e.id)),Fe.value=!1};function Ke(e){Fe.value=!0,Ae.value&&xt(),Ae.value=!0}const pe=(e,t)=>t+e,et=e=>"ROW"+e,Be=f(0),y=e=>g.value.has(e.id)?"background-color: "+U.value.tableSelectionColor:"",D=(e,t,a)=>{if((he.is.mac||he.is.ios)&&e.metaKey||(he.is.win||he.is.linux)&&e.ctrlKey)u.addSelectedRecords(t.row.id,!1),ie("selection-changed"),e.preventDefault();else if(e.shiftKey)e.preventDefault();else if(e.preventDefault(),u.selectedRecords.has(t.row.id))u.selectedRecords.size==1&&Xe(t.row.id)&&setTimeout(function(){Be.value==1&&M(a)&&we(a)&&(de.value=t.row.id,Ce.value=a,Nt(()=>{var n=pe(t.row.id,a),O=document.getElementById(n);O.focus()})),Be.value=0},500);else{u.addSelectedRecords(t.row.id,!0),ie("selection-changed"),Be.value=0;return}Be.value+=1},H=e=>{Be.value=0,r(e.row)},r=e=>{if(tt(e)){var t=Gt(e.id);t?_.expandNode=k.value:S.expandNode=k.value,J.value=!0,u.setSelectedGroup(e.id),Xt(e.id)}},M=e=>x.value.editableColumns.includes(e)&&!st(k.value),we=e=>e=="title"||e=="url",tt=e=>e.type=="DTgr"||e.type=="DTsg"||e.type=="feed"||e.isInbox!=null&&e.isInbox,de=f(null),Ce=f(""),ce=f(),ct=(e,t)=>{de.value=e.id,Ce.value=t,ce.value=e.title},xe=(e,t)=>{de.value==e.id&&ce.value!=e.title&&u.saveMetadata(de.value,"title",e.title,!0),de.value=null,ce.value=null,Ce.value=""},at=(e,t)=>{xe(e)},ft=(e,t)=>{e.title=ce.value,xe(e)},qe=(e,t)=>{u.saveMetadata(t.id,"rating",t.rating,!0),b.value.sortBy=="rating"&&setTimeout(function(){d.updateRowSorting()},50)},bt=e=>{if(e.label==null||e.label==0)return"background-color: black;";{const t=u.database.labels[e.label-1];return"background-color: "+t.color+";"}},Re=e=>{if(e.label==0)return"black";{const t=u.database.labels[e.label-1];return Pa(t.color)}},_t=e=>e.label==0?"--":u.database.labels[e.label-1].description,yt=f(null);f(null);const ya=f(!1),At=f({rowsPerPage:0});f([]),ye(()=>ya.value===!0?"shadow-8 no-outline":null);const Bt=e=>b.value.rows.findIndex(a=>a.id==e),wa=()=>se.value!=""?se.value:g.value.size>0?[...g.value][0]:"",Da=e=>{if(b.value.rows.length==0||de.value!=null&&de.value!="")return;const t=wa();if(e.key=="ArrowDown"){if(t!=""){var a=Bt(t)+1;if(a<b.value.rows.length){const O=b.value.rows[a];e.shiftKey?u.extendSelectedRecords(O.id):u.addSelectedRecords(O.id,!0),ie("selection-changed"),e.preventDefault(),e.stopPropagation(),yt.value.scrollTo(a,"end")}}}else if(e.key=="ArrowUp"){if(t!=""){var a=Bt(t)-1;if(a>=0&&b.value.rows.length>0){const ve=b.value.rows[a];e.shiftKey?u.extendSelectedRecords(ve.id):u.addSelectedRecords(ve.id,!0),ie("selection-changed"),e.preventDefault(),e.stopPropagation(),yt.value.scrollTo(a,"start")}}}else if(e.key=="Enter"&&de.value==null){let n=ka();n!=null&&r(n)}else e.key=="ArrowLeft"&&e.altKey&&de.value==null&&navigateBack()},ka=()=>{var e=null;if(g.value.size==1){let a=g.value.values().next().value;e=fe(a)}return e},Ca=e=>Xe(e.id)&&!st(k.value),xa=(e,t)=>{e.dataTransfer.dropEffect="none",e.dataTransfer.effectAllowed="all",e.dataTransfer.setData("recordID",t.id);let a=Array.from(u.selectedRecords);a.includes(t.id)||a.push(t.id),u.dragDropData.dragRecords=a},wt=f(!1),Ra=(e,t)=>{var a=k.value;let n=fe(t.id);if(n.type=="DTgr"&&(a=n.id),u.dragDropData.dragRecords!=null&&u.dragDropData.dragRecords.length>0)e.preventDefault(),e.altKey&&!e.metaKey?nl(u.dragDropData.dragRecords,a):e.altKey&&e.metaKey?sl(u.dragDropData.dragRecords,a):il(u.dragDropData.dragRecords,a);else if(e.dataTransfer.files.length>0){e.preventDefault();let O=e.dataTransfer.files;for(let ve=0;ve<O.length;ve++){let La=O[ve];u.importFile(La,a,null)}}wt.value=!0},be=f(""),qt=(e,t)=>{t==null&&e.preventDefault();let a=e.target,n=!0;if(a!=null){let O=Pt(a,3);if(O!=null){let ve=fe(O);ve!=null&&ve.type=="DTgr"&&(be.value!=""&&be.value!=ve.id&&vt(be.value),be.value=ve.id,Ma(ve.id),n=!1)}}n&&be.value!=""&&(vt(be.value),be.value=""),u.dragDropData.dragRecords!=null&&u.dragDropData.dragRecords.length>0?e.altKey&&!e.metaKey?e.dataTransfer.dropEffect="copy":e.dataTransfer.dropEffect="move":e.dataTransfer.files.length>0&&(e.dataTransfer.dropEffect="copy")},Sa=e=>{be.value!=""&&(vt("highlightID.value"),be.value="",u.dragDropData.dragRecords=[])},Ta=e=>{if(be.value!=""&&(vt("highlightID.value"),be.value=""),!wt.value&&e.dataTransfer.files.length>0){e.preventDefault();var t=k.value;if(t==""&&(t=u.database.globalInbox),t!=""){let a=e.dataTransfer.files;for(let n=0;n<a.length;n++){let O=a[n];u.importFile(O,t,null)}}}wt.value=!1,u.dragDropData.dragRecords=[]},Pt=(e,t)=>{if(e!=null){if(e.classList.contains("DTDragMarker")){if(e.id!=null&&e.id.length>3&&e.id.startsWith("ROW"))return e.id.substr(3)}else if(t>0&&e.parentElement!=null)return Pt(e.parentElement,t-1)}return null},Ma=e=>{let t=et(e),a=document.getElementById(t);a!=null&&(a.classList.contains("tableDropzone")||a.classList.add("tableDropzone"))},vt=e=>{if(e!=null){let t=et(e),a=document.getElementById(t);a!=null&&a.classList.remove("tableDropzone")}};f("title");const Pe=e=>{Dt.value?Dt.value=!1:b.value.sortBy!=e?(d.rowData.sortBy=e,d.updateRowData(),z.value=e!="timestamp"?"icon-icons8-sortup":"icon-icons8-sortdown"):(d.toggleSortType(),z.value=z.value=="icon-icons8-sortup"?"icon-icons8-sortdown":"icon-icons8-sortup")};f(null);const V={pageX:void 0,curCol:void 0,nxtCol:void 0,curColWidth:void 0,offsetWidth:void 0,nxtColWidth:void 0,padding:void 0,colName:""},Dt=f(!1),kt=f("250px"),Ct=f("250px"),Ia=()=>{Na(),document.addEventListener("mousemove",function(e){$a(e)}),document.addEventListener("mouseup",function(e){Et(e)}),xt()},za=()=>{document.removeEventListener("mousemove",e=>Se(e)),document.removeEventListener("mouseup",e=>Et(e))},ze=e=>{e.target.style.borderRight="2px solid #c0c0c0"},$e=e=>{e.target.style.borderRight=""},Se=(e,t)=>{t.stopPropagation(),t.preventDefault(),V.colName=e,V.curCol=t.target.parentElement,V.nxtCol=V.curCol.nextElementSibling,V.pageX=t.pageX;const a=Ut(V.curCol);V.padding=a,V.offsetWidth=V.curCol.offsetWidth,V.curColWidth=V.offsetWidth-a,V.nxtCol&&(V.nxtColWidth=V.nxtCol.offsetWidth-a)},$a=e=>{if(V.curCol){const a=e.pageX-V.pageX;if(a!=0){var t=V.offsetWidth+a;if(V.colName=="title"||V.colName=="url"){let n=He.value.get(V.colName);if(t<n)return;if(V.colName=="title"){let O=t-(V.padding+ea);kt.value=O+"px"}else{let O=t-V.padding;Ct.value=O+"px"}}V.curCol.style.width=t+"px"}}},He=f(new Map),Na=()=>{He.value.set("title",250),He.value.set("modified",175),He.value.set("flagged",50),He.value.set("size",175),He.value.set("rating",175),He.value.set("url",250)},xt=()=>{setTimeout(()=>{let e=Ht("dt-title-header",ea);if(kt.value=e+"px",d.columnData.visibleColumns.includes("url")){let t=Ht("dt-url-header",0);Ct.value=t+"px"}},1e3)},Ht=(e,t)=>{let a=document.getElementById(e),n=Ut(a);return a.offsetWidth-(n+t)},Et=e=>{V.curCol&&(Dt.value=!0,Va(),e.stopPropagation(),e.preventDefault())},Va=()=>{V.pageX=void 0,V.curCol=void 0,V.nxtCol=void 0,V.curColWidth=void 0,V.offsetWidth=void 0,V.nxtColWidth=void 0,V.padding=void 0,V.colName=""},Ut=e=>{const t=window.getComputedStyle(e,null),a=t.getPropertyValue("padding-left"),n=t.getPropertyValue("padding-right");return parseInt(a,10)+parseInt(n,10)};return(e,t)=>(c(),K(Je,null,[s(ma,{ref_key:"tableRef",ref:yt,"table-style":Y.value,columns:o(x).columns,rows:o(b).rows,"visible-columns":o(x).visibleColumns,"row-key":"id",bordered:"false","hide-no-data":"","hide-bottom":"","virtual-scroll":"","virtual-scroll-item-size":48,"virtual-scroll-sticky-size-start":36,pagination:At.value,"onUpdate:pagination":t[25]||(t[25]=a=>At.value=a),loading:J.value,"rows-per-page-options":[0],dark:o(oa).isActive,class:"DTDragMarker dt-sticky-header-table",onDragover:t[26]||(t[26]=a=>qt(a,null)),onDragend:t[27]||(t[27]=a=>Sa()),onDrop:Ta,onKeydown:Da},{top:l(()=>[q("div",Hl,[El,q("div",Ul,[W.iconName.length>0?(c(),v(Ue,{key:0,name:W.iconName,class:"dt-header-icon"},null,8,["name"])):E("",!0),q("p",Wl,m(W.displayName),1),I.value?E("",!0):(c(),v(o(Jt),{key:1,size:"22"})),I.value?E("",!0):(c(),v(ut,{key:2,modelValue:ue.value,"onUpdate:modelValue":t[0]||(t[0]=a=>ue.value=a),anchor:"top left",self:"top left",offset:P.value,class:ee(o(te)("DTContextMenu DTContextMenuLight","DTContextMenu")),onHide:F},{default:l(()=>[(c(!0),K(Je,null,mt(G.value,(a,n)=>(c(),v(We,{dense:"",key:a.id,style:{"min-width":"100px"}},{default:l(()=>[ge((c(),v(Q,{clickable:"",onClick:O=>dt(a.id)},{default:l(()=>[s(N,null,{default:l(()=>[q("div",Ql,[s(Ue,{name:a.iconName,class:"dt-header-icon"},null,8,["name"]),q("div",{class:ee(Oe(n))},m(a.displayName),3),n==0?(c(),v(o(Jt),{key:0,size:"22"})):E("",!0)])]),_:2},1024)]),_:2},1032,["onClick"])),[[De]])]),_:2},1024))),128))]),_:1},8,["modelValue","offset","class"]))])])]),loading:l(()=>[s(Bl,{showing:"",color:"primary"})]),"header-cell-title":l(a=>[s(ne,{props:a,id:"dt-title-header",onContextmenu:t[2]||(t[2]=Z(n=>me(n,null),["prevent"])),onClick:t[3]||(t[3]=n=>Pe("title"))},{default:l(()=>[T(m(o(A)("name"))+" ",1),o(b).sortBy=="title"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[1]||(t[1]=n=>Se("title",n))},null,32)]),_:2},1032,["props"])]),"header-cell-modified":l(a=>[s(ne,{props:a,onContextmenu:t[5]||(t[5]=Z(n=>me(n,null),["prevent"])),onClick:t[6]||(t[6]=n=>Pe("timestamp"))},{default:l(()=>[T(m(o(A)("modified"))+" ",1),o(b).sortBy=="timestamp"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[4]||(t[4]=n=>Se("modified",n))},null,32)]),_:2},1032,["props"])]),"header-cell-kind":l(a=>[s(ne,{props:a,onContextmenu:t[8]||(t[8]=Z(n=>me(n,null),["prevent"])),onClick:t[9]||(t[9]=n=>Pe("kind"))},{default:l(()=>[T(m(o(A)("kind"))+" ",1),o(b).sortBy=="kind"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[7]||(t[7]=n=>Se("kind",n))},null,32)]),_:2},1032,["props"])]),"header-cell-flagged":l(a=>[s(ne,{props:a,onContextmenu:t[11]||(t[11]=Z(n=>me(n,null),["prevent"]))},{default:l(()=>[s(o(ht),{size:"1em"}),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[10]||(t[10]=n=>Se("flagged",n))},null,32)]),_:2},1032,["props"])]),"header-cell-label":l(a=>[s(ne,{props:a,onContextmenu:t[13]||(t[13]=Z(n=>me(n,null),["prevent"])),onClick:t[14]||(t[14]=n=>Pe("label"))},{default:l(()=>[T(m(o(A)("label"))+" ",1),o(b).sortBy=="label"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[12]||(t[12]=n=>Se("label",n))},null,32)]),_:2},1032,["props"])]),"header-cell-rating":l(a=>[s(ne,{props:a,onContextmenu:t[16]||(t[16]=Z(n=>me(n,null),["prevent"])),onClick:t[17]||(t[17]=n=>Pe("rating"))},{default:l(()=>[T(m(o(A)("rating"))+" ",1),o(b).sortBy=="rating"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[15]||(t[15]=n=>Se("rating",n))},null,32)]),_:2},1032,["props"])]),"header-cell-size":l(a=>[s(ne,{props:a,onContextmenu:t[19]||(t[19]=Z(n=>me(n,null),["prevent"])),onClick:t[20]||(t[20]=n=>Pe("filesize"))},{default:l(()=>[T(m(o(A)("size"))+" ",1),o(b).sortBy=="filesize"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[18]||(t[18]=n=>Se("size",n))},null,32)]),_:2},1032,["props"])]),"header-cell-url":l(a=>[s(ne,{props:a,id:"dt-url-header",onContextmenu:t[22]||(t[22]=Z(n=>me(n,null),["prevent"])),onClick:t[23]||(t[23]=n=>Pe("url"))},{default:l(()=>[T(m(o(A)("url"))+" ",1),o(b).sortBy=="url"?(c(),v(_e,{key:0,name:z.value,class:ee(o(te)("dt-sort-icon table-icon-light","dt-sort-icon  table-icon-dark")),size:"12px"},null,8,["name","class"])):E("",!0),q("div",{class:"dt-table-col-resize",onMouseover:ze,onMouseout:$e,onMousedown:t[21]||(t[21]=n=>Se("url",n))},null,32)]),_:2},1032,["props"])]),body:l(a=>[s(va,{style:rt(y(a.row)),onContextmenu:Z(n=>me(n,a.row),["prevent"]),class:"DTDragMarker DTListItem",draggable:Ca(a.row),props:"props",onDragstart:n=>xa(n,a.row),onDrop:Z(n=>Ra(n,a.row),["prevent"]),onDragenter:t[24]||(t[24]=Z(()=>{},["prevent"])),onDragover:Z(n=>qt(n,a.row),["prevent"]),id:et(a.row.id)},{default:l(()=>[s(ae,{key:"title",props:a,onClick:n=>D(n,a,"title"),onDblclick:n=>H(a)},{default:l(()=>[Ce.value=="title"&&de.value==a.row.id?(c(),K("div",Ol,[s(Ue,{name:a.row.icon,class:"dt-table-icon"},null,8,["name"]),Ce.value=="title"&&de.value==a.row.id?ge((c(),K("input",{key:0,"onUpdate:modelValue":n=>a.row.title=n,onKeyup:[St(n=>at(a.row,"title"),["enter"]),St(n=>ft(a.row,"title"),["esc"])],onFocus:n=>ct(a.row,"title"),onBlur:n=>xe(a.row,"title"),class:"dt-tablecol-text-edit",id:pe(a.row.id,"title")},null,40,Kl)),[[aa,a.row.title]]):E("",!0)])):(c(),K("div",jl,[s(Ue,{name:a.row.icon,class:"dt-table-icon"},null,8,["name"]),q("div",Gl,m(a.row.displayName==null?a.row.title:a.row.displayName),1)]))]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"modified",props:a,class:"dt-secondary-text",onClick:n=>D(n,a,"modified"),onDblclick:n=>H(a)},{default:l(()=>[T(m(o(ga)(a.row.timestamp)),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"kind",props:a,class:"dt-secondary-text",onClick:n=>D(n,a,"kind"),onDblclick:n=>H(a)},{default:l(()=>[T(m(e.$t(o(ha)(a.row))),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"flagged",props:a},{default:l(()=>[a.row.flagged!=null&&a.row.flagged?(c(),v(o(ht),{key:0,size:"1em"})):E("",!0)]),_:2},1032,["props"]),s(ae,{key:"label",props:a,onClick:n=>D(n,a,"label"),onDblclick:n=>H(a)},{default:l(()=>[a.row.label==="undefined"||a.row.label==0?(c(),K("div",Xl)):(c(),v(ol,{key:1,style:rt(bt(a.row)),dense:"","text-color":Re(a.row)},{default:l(()=>[T(m(_t(a.row)),1)]),_:2},1032,["style","text-color"]))]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"rating",props:a,onClick:n=>D(n,a,"rating"),onDblclick:n=>H(a)},{default:l(()=>[s(fa,{modelValue:a.row.rating,"onUpdate:modelValue":[n=>a.row.rating=n,n=>qe(a.rowIndex,a.row)],max:5,class:"dt-rating",color:"grey-7",size:"1.0rem",readonly:!re.value},null,8,["modelValue","onUpdate:modelValue","readonly"])]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"size",props:a,class:"dt-secondary-text",onClick:n=>D(n,a,"size"),onDblclick:n=>H(a)},{default:l(()=>[T(m(o(la)(a.row)),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"url",props:a,class:"dt-secondary-text",onClick:n=>D(n,a,"url"),onDblclick:n=>H(a)},{default:l(()=>[q("div",Jl,m(a.row.url),1)]),_:2},1032,["props","onClick","onDblclick"])]),_:2},1032,["style","onContextmenu","draggable","onDragstart","onDrop","onDragover","id"])]),_:1},8,["table-style","columns","rows","visible-columns","pagination","loading","dark"]),Fe.value?E("",!0):(c(),v(_a,{key:0,onActionClicked:Ke,editColumns:Ae.value},null,8,["editColumns"]))],64))}};var Zl=Ve(Yl,[["__scopeId","data-v-070e2650"]]);const eo=i=>(na("data-v-1fa572fe"),i=i(),sa(),i),to={class:"search-results-header"},ao={class:"table-title dt-secondary-text dt-left-margin"},lo=eo(()=>q("div",{class:"search-results-spacer"},null,-1)),oo={class:"table-title dt-secondary-text dt-right-margin"},no=["onUpdate:modelValue","onKeyup","onFocus","onBlur","id"],so={key:1,class:"dt-row-group dt-primary-text"},io={class:"truncate dtsearch-name-col"},ro={__name:"SearchTableView",props:{height:{type:Number,required:!0},width:{type:Number,required:!0}},emits:["selection-changed"],setup(i,{emit:p}){ta(y=>({d7b2efe2:o(b).primaryColor,"05ab5f46":o(b).secondaryColor,"7e95d53e":J.height,d11502f2:o(b).backgroundColor}));const C=Ye(),u=ke(),d=ba(),{columnData:_}=le(d),{searchRowData:S,searchString:x}=le(d),{dtTheme:b}=le(C),{selectedGroup:L,selectedRecords:k}=le(u),{t:R}=Me();pt();const g=f(!1),se=f("height: 200px;"),U=p,A=f(null),J=i,Y=f({rowsPerPage:0}),z=Qe({requested:new Date,started:new Date});X(x,(y,D)=>{d.lastSearchText!=d.searchString&&(d.searchRowData.currentID="",d.searchRowData.rows=new Array,d.searchRowData.recordMap=new Map,z.requested=new Date,setTimeout(function(){let H=z.requested.getTime(),r=z.started.getTime();H>r&&ue({index:0,from:0,to:30,direction:"increase",ref:null})},50))},{immediate:!0}),X(L,(y,D)=>{I(),d.searchRowData.rows=new Array,d.searchRowData.recordMap=new Map,ie()});const ie=()=>{z.requested=new Date,setTimeout(function(){let y=z.requested.getTime(),D=z.started.getTime();y>D&&ue({index:0,from:0,to:30,direction:"increase",ref:null})},50)},re=(y,D)=>D+y,B=f(""),j=f([]),$=f({name:R("allDatabases"),id:"allDbs",icon:"web-container-icon-database"}),I=()=>{var y=new Array,D={};D.name=R("allDatabases"),D.id="allDbs",D.icon="web-container-icon-database";var H=D;if(y.push(D),L.value!="none"&&!st(L.value)){let we=rl(L.value);if(we!=null){var r={};r.name=we.title,r.id="database",r.recordID=we.id,r.icon="web-container-icon-database",y.push(r),$.value.id=="database"&&(H=r)}if(we.id!=L.value&&!st(L.value)){let tt=fe(L.value);var M={};M.name=tt.title,M.id="group",M.recordID=tt.id,M.icon="web-container-icon-group",y.push(M),$.value.id=="group"&&(H=M)}$.value=H}j.value=y},G=y=>{y.id!=$.value.id&&($.value=y,d.searchRowData.currentID="",d.searchRowData.rows=new Array,d.searchRowData.recordMap=new Map)},ue=y=>{const{index:D,from:H,to:r,direction:M,ref:we}=y,de=(r>=H?r:H)+10,Ce=d.serverAvailbleRows;var ce=0,ct=30;if(z.started=z.requested,de>S.value.rows.length&&(ce=S.value.rows.length),Ce!=-1){if(ce!=0&&ce>=Ce)return;ce>0&&S.value.rows.length==0&&(ct+=ce,ce=0)}if(!g.value&&(Ce==-1||de>S.value.rows.length)){g.value=!0,d.searchRowData.isSearching=!0;let xe="/search?q="+x.value+"*&start="+ce+"&num="+ct+"&format=JSON";$.value.id=="database"?xe=xe+"&database="+$.value.recordID:$.value.id=="group"&&(xe=xe+"&group="+$.value.recordID),Ha.get(xe).then(at=>{const ft=at.data;var qe=ft.items,bt=ft.statistics;d.searchRowData.isSearching=!1,qe.sort((Re,_t)=>_t.relevance-Re.relevance),qe.forEach(Re=>{Re.icon=zt(Re)}),x.value==""?clearSearch():(ce==0?(d.searchRowData.rows=qe,d.searchRowData.recordMap=new Map(qe.map(Re=>[Re.id,Re]))):d.appendSearchRows(qe),d.searchRowData.stats=bt,d.lastSearchText=x.value),g.value=!1,P(),we!=null&&(ce==0?we.refresh(0):we.refresh())}).catch(at=>{g.value=!1,console.log("Catch error"),console.log(at),d.searchRowData.isSearching=!1})}},P=()=>{if(S.value.stats!=null){const y=S.value.stats.count;y==0?B.value=R("noRecords"):B.value=" "+y+" "+R("itemsFound")}else B.value=""},Le=f(0),h=f(null),w=y=>h.value==y.id?"background-color: "+b.value.tableSelectionColor:"",F=(y,D,H)=>{h.value!=D.row.id?(Le.value=1,h.value=D.row.id):Le.value+=1,S.value.restoreSelectedRows||(d.searchRowData.selectedRows=new Set(k.value),d.searchRowData.restoreSelectedRows=!0),u.selectedRecords.has(D.row.id)?H=="title"&&(W.value=D.row.id,Ie.value=H,Nt(()=>{var r=re(D.row.id,H),M=document.getElementById(r);M.focus()})):(u.addSelectedRecords(D.row.id,!0),U("selection-changed"))};X(()=>J.height,()=>{dt()}),Ne(()=>{dt(),I(),Oe()});const Oe=()=>{d.columnData.columns.forEach(y=>{y.label=R(y.label)})},dt=()=>{let D=J.height-36.5;se.value="height: "+D+"px;"},W=f(null),Ie=f(""),Fe=f(),Ae=(y,D)=>{W.value=y.id,Ie.value=D,Fe.value=y.title},oe=(y,D)=>{W.value==y.id&&Fe.value!=y.title&&u.saveMetadata(W.value,"title",y.title,!0),W.value=null,Fe.value=null,Ie.value=""},me=(y,D)=>{oe(y)},Ze=f(!0),Ke=f(!0),pe=Qe({canAdd:!1,canChange:!1,canDelete:!1,targetRows:[]});Lt("tableData",pe);const et=(y,D)=>{y.preventDefault(),Ke.value=D==null,Ke.value?pe.targetRows=[]:(pa(D.id)?(pe.targetRows=[],k.value.forEach(H=>{const r=fe(H);pe.targetRows.push(r)})):(pe.targetRows=[D],u.addSelectedRecords(D.id,!0),U("selection-changed")),pe.canAdd=Mt(D.id),pe.canChange=Xe(D.id),pe.canDelete=It(D.id)),Ze.value=!1};function Be(y){Ze.value=!0,Ke.value=!0}return(y,D)=>{const H=Ea("Check");return c(),K(Je,null,[s(ma,{ref_key:"searchRef",ref:A,"table-style":se.value,columns:o(_).columns,rows:o(S).rows,"visible-columns":o(_).visibleColumns,"row-key":"id",bordered:"false","hide-no-data":"","hide-bottom":"","virtual-scroll":"","virtual-scroll-item-size":48,"virtual-scroll-sticky-size-start":36.5,"rows-per-page-options":[0],onVirtualScroll:ue,pagination:Y.value,"onUpdate:pagination":D[2]||(D[2]=r=>Y.value=r),loading:g.value,dark:o(oa).isActive,class:"DTDragMarker dt-search-header-table"},{top:l(()=>[q("div",to,[q("p",ao,m(o(R)("searchIn")),1),s(Ue,{name:$.value.icon,class:"dt-search-hdr-icon"},null,8,["name"]),s(ul,{class:"dt-primary-header",flat:"",dense:"","no-icon-animation":"","no-caps":"",label:$.value.name},{default:l(()=>[s(We,null,{default:l(()=>[(c(!0),K(Je,null,mt(j.value,r=>ge((c(),v(Q,{key:r.id,clickable:"",onClick:M=>G(r)},{default:l(()=>[s(N,{side:""},{default:l(()=>[s(Ue,{name:r.icon},null,8,["name"])]),_:2},1024),s(N,null,{default:l(()=>[s(dl,null,{default:l(()=>[T(m(r.name),1)]),_:2},1024)]),_:2},1024),s(N,{side:""},{default:l(()=>[$.value!=null&&$.value.id==r.id?(c(),v(H,{key:0,size:"18",color:o(C).iconColor},null,8,["color"])):E("",!0)]),_:2},1024)]),_:2},1032,["onClick"])),[[De]])),128))]),_:1})]),_:1},8,["label"]),lo,q("p",oo,m(B.value),1)])]),"header-cell-relevance":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("score")),1)]),_:2},1032,["props"])]),"header-cell-title":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("name")),1)]),_:2},1032,["props"])]),"header-cell-modified":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("modified")),1)]),_:2},1032,["props"])]),"header-cell-kind":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("kind")),1)]),_:2},1032,["props"])]),"header-cell-flagged":l(r=>[s(ne,{props:r},{default:l(()=>[s(o(ht),{size:"1em"})]),_:2},1032,["props"])]),"header-cell-size":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("size")),1)]),_:2},1032,["props"])]),"header-cell-url":l(r=>[s(ne,{props:r},{default:l(()=>[T(m(o(R)("url")),1)]),_:2},1032,["props"])]),body:l(r=>[s(va,{style:rt(w(r.row)),onContextmenu:Z(M=>et(M,r.row),["prevent"]),class:"DTDragMarker DTListItem",draggable:"true",props:"props",onDragstart:M=>y.startDrag(M,r.row),onDrop:Z(M=>y.onDrop(M,r.row),["prevent"]),onDragenter:D[0]||(D[0]=Z(()=>{},["prevent"])),onDragover:D[1]||(D[1]=Z(()=>{},["prevent"]))},{default:l(()=>[s(ae,{key:"relevance",props:r},{default:l(()=>[s(cl,{class:"dt-relevance",id:"DTRelevance",value:r.row.relevance.toFixed(2),color:o(Ua)(r.row.relevance)},null,8,["value","color"])]),_:2},1032,["props"]),s(ae,{key:"title",props:r,onClick:M=>F(M,r,"title")},{default:l(()=>[Ie.value=="title"&&W.value==r.row.id?ge((c(),K("input",{key:0,"onUpdate:modelValue":M=>r.row.title=M,onKeyup:St(M=>me(r.row,"title"),["enter"]),onFocus:M=>Ae(r.row,"title"),onBlur:M=>oe(r.row,"title"),class:"dt-searchcol-text-edit",id:re(r.row.id,"title")},null,40,no)),[[aa,r.row.title]]):(c(),K("div",so,[s(Ue,{name:r.row.icon,class:"dt-table-icon"},null,8,["name"]),q("div",io,m(r.row.displayName==null?r.row.title:r.row.displayName),1)]))]),_:2},1032,["props","onClick"]),s(ae,{key:"modified",props:r,class:"dt-secondary-text",onClick:M=>F(M,r,"modified"),onDblclick:M=>y.onRowDblClick(r)},{default:l(()=>[T(m(o(ga)(r.row.timestamp)),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"kind",props:r,class:"dt-secondary-text",onClick:M=>F(M,r,"kind"),onDblclick:M=>y.onRowDblClick(r)},{default:l(()=>[T(m(y.$t(o(ha)(r.row))),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"label",props:r,onClick:M=>F(M,r,"label"),onDblclick:M=>y.onRowDblClick(r)},{default:l(()=>[T(m(r.row.label),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"flagged",props:r},{default:l(()=>[r.row.flagged!=null&&r.row.flagged?(c(),v(o(ht),{key:0,size:"1em"})):E("",!0)]),_:2},1032,["props"]),s(ae,{key:"size",props:r,class:"dt-secondary-text",onClick:M=>F(M,r,"size"),onDblclick:M=>y.onRowDblClick(r)},{default:l(()=>[T(m(o(la)(r.row)),1)]),_:2},1032,["props","onClick","onDblclick"]),s(ae,{key:"url",props:r,class:"dt-secondary-text",onClick:M=>F(M,r,"url"),onDblclick:M=>y.onRowDblClick(r)},{default:l(()=>[T(m(r.row.url),1)]),_:2},1032,["props","onClick","onDblclick"])]),_:2},1032,["style","onContextmenu","onDragstart","onDrop"])]),_:1},8,["table-style","columns","rows","visible-columns","pagination","loading","dark"]),Ze.value?E("",!0):(c(),v(_a,{key:0,onActionClicked:Be,"edit-columns":Ke.value},null,8,["edit-columns"]))],64)}}};var uo=Ve(ro,[["__scopeId","data-v-1fa572fe"]]);const co={__name:"MainPage",setup(i){const p=Ye(),C=ke(),u=ba(),{seeAlsoData:d}=le(C);le(C);const{unableToLoadPreview:_}=le(C),{selectedRecords:S}=le(C),x=f(50),b=Wa(Rt),L=lt(()=>ot(()=>import("./RichTextViewer.d31142e2.js"),["assets/RichTextViewer.d31142e2.js","assets/RichTextViewer.06b7535c.css","assets/index.f89c7e6e.js","assets/index.d3a8eba6.css","assets/QBtn.9455f382.js","assets/QToolbarTitle.4eccf591.js","assets/QTable.18dd05c1.js","assets/QTable.b04ac4ec.css","assets/rectangle-horizontal.719c7b3b.js"])),k=lt(()=>ot(()=>import("./CodeEditor.d9a6ae07.js"),["assets/CodeEditor.d9a6ae07.js","assets/index.f89c7e6e.js","assets/index.d3a8eba6.css","assets/QTable.18dd05c1.js","assets/QTable.b04ac4ec.css","assets/QBtn.9455f382.js"])),R=lt(()=>ot(()=>import("./MessageView.d867ccc4.js"),["assets/MessageView.d867ccc4.js","assets/MessageView.82152ceb.css","assets/QTable.18dd05c1.js","assets/QTable.b04ac4ec.css","assets/index.f89c7e6e.js","assets/index.d3a8eba6.css","assets/QBtn.9455f382.js"])),g=lt(()=>ot(()=>import("./MarkdownEditor.7e41eafd.js"),["assets/MarkdownEditor.7e41eafd.js","assets/QBtn.9455f382.js","assets/index.f89c7e6e.js","assets/index.d3a8eba6.css","assets/QToolbarTitle.4eccf591.js","assets/QTable.18dd05c1.js","assets/QTable.b04ac4ec.css","assets/CodeEditor.d9a6ae07.js"])),se=lt(()=>ot(()=>import("./PDFViewer.166494b4.js"),["assets/PDFViewer.166494b4.js","assets/index.f89c7e6e.js","assets/index.d3a8eba6.css","assets/QTable.18dd05c1.js","assets/QTable.b04ac4ec.css","assets/QBtn.9455f382.js"]));X(()=>d.value.selectedSeeAlso,()=>{A(!0)}),X(S,()=>{A(!1)}),X(_,$=>{$&&(A(!1),C.unableToLoadPreview=!1)});const U=Qe({selectionCount:0,recordID:""});Lt("editorData",U);const A=$=>{if(_.value){p.previewMessage="previewError",b.value=R;return}if($&&d.value.selectedSeeAlso!="")b.value=J(d.value.selectedSeeAlso),U.recordID=d.value.selectedSeeAlso;else if(U.selectionCount=S.value.size,U.selectionCount==0)b.value=Rt;else if(U.selectionCount>1)b.value=zl;else{var I=Array.from(S.value);const G=I[0];b.value=J(G),U.recordID=G}},J=$=>{const I=fe($);var G=!1,ue=!1;if(I.pending!=null&&(G=I.pending),I.missing!=null&&(ue=I.missing),ue)return p.previewMessage="fileNotAvailable",R;G&&console.log("latest version is not yet available");let P=Rt;switch(I.type){case"DTgr":case"DTsg":case"feed":case"pict":!he.is.safari&&(I.extension=="tif"||I.extension=="tiff")?P=nt:P=Vl;break;case"DTnx":P=Ee;break;case"pdf ":he.is.safari?P=Ee:P=se;break;case"rtf ":case"rtfd":case"scpt":case"wbar":case"tabl":P=Ee;break;case"ctxt":case"txt ":case"xml ":case"plis":case"apsc":P=k;break;case"DTft":case"html":I.editableNote?P=L:P=Ee;break;case"quti":Zt(I.extension)?P=Ee:P=nt;break;case"****":p.filetypes.notSupportedExts.indexOf(I.extension)>-1?P=nt:p.filetypes.markdownExts.indexOf(I.extension)>-1?P=g:p.filetypes.mediaExts.indexOf(I.extension)>-1?Zt(I.extension)?P=Ee:P=nt:p.filetypes.mindmaps.indexOf(I.extension)>-1?P=nt:P=Ee;break}return P},Y=$=>{B()},z=Qe({height:0,width:0,tableHeight:100,editorHeight:100,pageHeight:200}),ie=$=>{re()},re=()=>{p.windowInnerHeight=window.innerHeight,z.width=document.getElementById("mainsplitter").offsetWidth;let $=Qa();$!=z.pageHeight&&(z.pageHeight=$,B())},B=()=>{let $=z.pageHeight/100*x.value;z.tableHeight=j($,1);let I=z.pageHeight/100*(100-x.value);z.editorHeight=j(I,1)-1},j=($,I)=>Number(Math.floor(parseFloat($+"e"+I))+"e-"+I);return Ne(()=>{re()}),($,I)=>(c(),v(Rl,{class:ee(o(te)("page-light, flex","page-dark, flex")),id:"mainPageContainer"},{default:l(()=>[s(xl,{modelValue:x.value,"onUpdate:modelValue":[I[2]||(I[2]=G=>x.value=G),Y],"emit-immediately":!0,id:"mainsplitter",class:"full-width","before-class":o(te)("DTSplitBefore","DTSplitBefore  dt-split-dark"),"after-class":"DTSplitAfter",horizontal:""},{before:l(()=>[o(u).showSearchResults?(c(),v(uo,{key:1,width:z.width,height:z.tableHeight,onSelectionChanged:I[1]||(I[1]=G=>A(!1))},null,8,["width","height"])):(c(),v(Zl,{key:0,width:z.width,height:z.tableHeight,onSelectionChanged:I[0]||(I[0]=G=>A(!1))},null,8,["width","height"]))]),after:l(()=>[(c(),v(Oa(b.value),{width:z.width,height:z.editorHeight,recordID:U.recordID},null,8,["width","height","recordID"]))]),_:1},8,["modelValue","before-class"]),s(fl,{onResize:ie})]),_:1},8,["class"]))}};var fo=Ve(co,[["__scopeId","data-v-3df56537"]]),mo=Object.freeze(Object.defineProperty({__proto__:null,default:fo},Symbol.toStringTag,{value:"Module"}));export{Ee as D,mo as M,xl as Q};
