-1)){t=t>e.friends[r].idx?t:e.friends[r].idx,n.push(e.friends[r]);var a=Bx(e.friends[r],t,n);t=t>a?t:a}return t}function oG(e){var t=e.events,n=e.minimumStartDifference,r=e.slotMetrics,a=e.accessors,o=Hx({events:t,minimumStartDifference:n,slotMetrics:r,accessors:a});o.sort(function(ie,ge){return ie=ie.style,ge=ge.style,ie.top!==ge.top?ie.top>ge.top?1:-1:ie.height!==ge.height?ie.top+ie.height=m&&S<=p||S>m&&S<=p||D>=m&&Dce?K:ce}K<=W.idx&&(W.size=100-W.idx*W.size);var fe=W.idx===0?0:3;W.style.width="calc(".concat(W.size,"% - ").concat(fe,"px)"),W.style.height="calc(".concat(W.style.height,"% - 2px)"),W.style.xOffset="calc(".concat(W.style.left,"% + ").concat(fe,"px)")}return o}var f2={overlap:Hx,"no-overlap":oG};function iG(e){return!!(e&&e.constructor&&e.call&&e.apply)}function sG(e){e.events,e.minimumStartDifference,e.slotMetrics,e.accessors;var t=e.dayLayoutAlgorithm,n=t;return t in f2&&(n=f2[t]),iG(n)?n.apply(this,arguments):[]}var Yx=function(e){ta(t,e);function t(){return pr(this,t),ea(this,t,arguments)}return gr(t,[{key:"render",value:function(){var r=this.props,a=r.renderSlot,o=r.resource,s=r.group,u=r.getters,d=r.components,m=d===void 0?{}:d,p=m.timeSlotWrapper,g=p===void 0?cs:p,w=u?u.slotGroupProp(s):{};return q.createElement("div",Object.assign({className:"rbc-timeslot-group"},w),s.map(function(D,S){var T=u?u.slotProp(D,o):{};return q.createElement(g,{key:S,value:D,resource:o},q.createElement("div",Object.assign({},T,{className:Qn("rbc-time-slot",T.className)}),a&&a(D,S)))}))}}]),t}(O.Component);function Og(e){return typeof e=="string"?e:e+"%"}function lG(e){var t=e.style,n=e.className,r=e.event,a=e.accessors,o=e.rtl,s=e.selected,u=e.label,d=e.continuesPrior,m=e.continuesAfter,p=e.getters,g=e.onClick,w=e.onDoubleClick,D=e.isBackgroundEvent,S=e.onKeyPress,T=e.components,E=T.event,A=T.eventWrapper,N=a.title(r),R=a.tooltip(r),F=a.end(r),H=a.start(r),P=p.eventProp(r,H,F,s),L=[q.createElement("div",{key:"1",className:"rbc-event-label"},u),q.createElement("div",{key:"2",className:"rbc-event-content"},E?q.createElement(E,{event:r,title:N}):N)],z=t.height,U=t.top,W=t.width,K=t.xOffset,ae=nn(nn({},P.style),{},Ic({top:Og(U),height:Og(z),width:Og(W)},o?"right":"left",Og(K)));return q.createElement(A,Object.assign({type:"time"},e),q.createElement("div",{role:"button",tabIndex:0,onClick:g,onDoubleClick:w,style:ae,onKeyDown:S,title:R?(typeof u=="string"?u+": ":"")+R:void 0,className:Qn(D?"rbc-background-event":"rbc-event",n,P.className,{"rbc-selected":s,"rbc-event-continues-earlier":d,"rbc-event-continues-later":m})},L))}var cG=function(t){var n=t.children,r=t.className,a=t.style,o=t.innerRef;return q.createElement("div",{className:r,style:a,ref:o},n)},uG=q.forwardRef(function(e,t){return q.createElement(cG,Object.assign({},e,{innerRef:t}))}),dG=["dayProp"],fG=["eventContainerWrapper"],zx=function(e){ta(t,e);function t(){var n;pr(this,t);for(var r=arguments.length,a=new Array(r),o=0;o0&&arguments[0]!==void 0?arguments[0]:!1;!this.intervalTriggered&&!a&&this.positionTimeIndicator(),this._timeIndicatorTimeout=window.setTimeout(function(){r.intervalTriggered=!0,r.positionTimeIndicator(),r.setTimeIndicatorPositionUpdateInterval()},6e4)}},{key:"clearTimeIndicatorInterval",value:function(){this.intervalTriggered=!1,window.clearTimeout(this._timeIndicatorTimeout)}},{key:"positionTimeIndicator",value:function(){var r=this.props,a=r.min,o=r.max,s=r.getNow,u=s();if(u>=a&&u<=o){var d=this.slotMetrics.getCurrentTimePosition(u);this.intervalTriggered=!0,this.setState({timeIndicatorPosition:d})}else this.clearTimeIndicatorInterval()}},{key:"render",value:function(){var r=this.props,a=r.date,o=r.max,s=r.rtl,u=r.isNow,d=r.resource,m=r.accessors,p=r.localizer,g=r.getters,w=g.dayProp,D=Ai(g,dG),S=r.components,T=S.eventContainerWrapper,E=Ai(S,fG),A=this.slotMetrics,N=this.state,R=N.selecting,F=N.top,H=N.height,P=N.startDate,L=N.endDate,z={start:P,end:L},U=w(o),W=U.className,K=U.style,ae=E.dayColumnWrapper||uG;return q.createElement(ae,{ref:this.containerRef,date:a,style:K,className:Qn(W,"rbc-day-slot","rbc-time-column",u&&"rbc-now",u&&"rbc-today",R&&"rbc-slot-selecting"),slotMetrics:A},A.groups.map(function(ce,fe){return q.createElement(Yx,{key:fe,group:ce,resource:d,getters:D,components:E})}),q.createElement(T,{localizer:p,resource:d,accessors:m,getters:D,components:E,slotMetrics:A},q.createElement("div",{className:Qn("rbc-events-container",s&&"rtl")},this.renderEvents({events:this.props.backgroundEvents,isBackgroundEvent:!0}),this.renderEvents({events:this.props.events}))),R&&q.createElement("div",{className:"rbc-slot-selection",style:{top:F,height:H}},q.createElement("span",null,p.format(z,"selectRangeFormat"))),u&&this.intervalTriggered&&q.createElement("div",{className:"rbc-current-time-indicator",style:{top:"".concat(this.state.timeIndicatorPosition,"%")}}))}}]),t}(q.Component);zx.defaultProps={dragThroughEvents:!0,timeslots:2};function hG(e){var t=e.min,n=e.max,r=e.localizer;return r.getTimezoneOffset(t)!==r.getTimezoneOffset(n)?{start:r.add(t,-1,"day"),end:r.add(n,-1,"day")}:{start:t,end:n}}var mG=function(t){var n=t.min,r=t.max,a=t.timeslots,o=t.step,s=t.localizer,u=t.getNow,d=t.resource,m=t.components,p=t.getters,g=t.gutterRef,w=m.timeGutterWrapper,D=O.useMemo(function(){return hG({min:n,max:r,localizer:s})},[n==null?void 0:n.toISOString(),r==null?void 0:r.toISOString(),s]),S=D.start,T=D.end,E=O.useState(rb({min:S,max:T,timeslots:a,step:o,localizer:s})),A=us(E,2),N=A[0],R=A[1];O.useEffect(function(){N&&R(N.update({min:S,max:T,timeslots:a,step:o,localizer:s}))},[S==null?void 0:S.toISOString(),T==null?void 0:T.toISOString(),a,o]);var F=O.useCallback(function(H,P){if(P)return null;var L=N.dateIsInGroup(u(),P);return q.createElement("span",{className:Qn("rbc-label",L&&"rbc-now")},s.format(H,"timeGutterFormat"))},[N,s,u]);return q.createElement(w,{slotMetrics:N},q.createElement("div",{className:"rbc-time-gutter rbc-time-column",ref:g},N.groups.map(function(H,P){return q.createElement(Yx,{key:P,group:H,resource:d,components:m,renderSlot:F,getters:p})})))},pG=q.forwardRef(function(e,t){return q.createElement(mG,Object.assign({gutterRef:t},e))}),gG=function(t){var n=t.label;return q.createElement(q.Fragment,null,n)},vG=function(e){ta(t,e);function t(){var n;pr(this,t);for(var r=arguments.length,a=new Array(r),o=0;oa.clientHeight;r.state.isOverflowing!==o&&(r._updatingOverflow=!0,r.setState({isOverflowing:o},function(){r._updatingOverflow=!1}))}}},r.memoizedResources=sx(function(a,o){return yG(a,o)}),r.state={gutterWidth:void 0,isOverflowing:null},r.scrollRef=q.createRef(),r.contentRef=q.createRef(),r.containerRef=q.createRef(),r._scrollRatio=null,r.gutterRef=O.createRef(),r}return gr(t,[{key:"getSnapshotBeforeUpdate",value:function(){return this.checkOverflow(),null}},{key:"componentDidMount",value:function(){this.props.width==null&&this.measureGutter(),this.calculateScroll(),this.applyScroll(),window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),iS(this.rafHandle),this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest)}},{key:"componentDidUpdate",value:function(){this.applyScroll()}},{key:"renderEvents",value:function(r,a,o,s){var u=this,d=this.props,m=d.min,p=d.max,g=d.components,w=d.accessors,D=d.localizer,S=d.dayLayoutAlgorithm,T=this.memoizedResources(this.props.resources,w),E=T.groupEvents(a),A=T.groupEvents(o);return T.map(function(N,R){var F=us(N,2),H=F[0],P=F[1];return r.map(function(L,z){var U=(E.get(H)||[]).filter(function(K){return D.inRange(L,w.start(K),w.end(K),"day")}),W=(A.get(H)||[]).filter(function(K){return D.inRange(L,w.start(K),w.end(K),"day")});return q.createElement(zx,Object.assign({},u.props,{localizer:D,min:D.merge(L,m),max:D.merge(L,p),resource:P&&H,components:g,isNow:D.isSameDate(L,s),key:R+"-"+z,date:L,events:U,backgroundEvents:W,dayLayoutAlgorithm:S}))})})}},{key:"render",value:function(){var r,a=this.props,o=a.events,s=a.backgroundEvents,u=a.range,d=a.width,m=a.rtl,p=a.selected,g=a.getNow,w=a.resources,D=a.components,S=a.accessors,T=a.getters,E=a.localizer,A=a.min,N=a.max,R=a.showMultiDayTimes,F=a.longPressThreshold,H=a.resizable;d=d||this.state.gutterWidth;var P=u[0],L=u[u.length-1];this.slots=u.length;var z=[],U=[],W=[];return o.forEach(function(K){if(fm(K,P,L,S,E)){var ae=S.start(K),ce=S.end(K);S.allDay(K)||E.startAndEndAreDateOnly(ae,ce)||!R&&!E.isSameDate(ae,ce)?z.push(K):U.push(K)}}),s.forEach(function(K){fm(K,P,L,S,E)&&W.push(K)}),z.sort(function(K,ae){return Vw(K,ae,S,E)}),q.createElement("div",{className:Qn("rbc-time-view",w&&"rbc-time-view-resources"),ref:this.containerRef},q.createElement(vG,{range:u,events:z,width:d,rtl:m,getNow:g,localizer:E,selected:p,allDayMaxRows:this.props.showAllEvents?1/0:(r=this.props.allDayMaxRows)!==null&&r!==void 0?r:1/0,resources:this.memoizedResources(w,S),selectable:this.props.selectable,accessors:S,getters:T,components:D,scrollRef:this.scrollRef,isOverflowing:this.state.isOverflowing,longPressThreshold:F,onSelectSlot:this.handleSelectAllDaySlot,onSelectEvent:this.handleSelectEvent,onShowMore:this.handleShowMore,onDoubleClickEvent:this.props.onDoubleClickEvent,onKeyPressEvent:this.props.onKeyPressEvent,onDrillDown:this.props.onDrillDown,getDrilldownView:this.props.getDrilldownView,resizable:H}),this.props.popup&&this.renderOverlay(),q.createElement("div",{ref:this.contentRef,className:"rbc-time-content",onScroll:this.handleScroll},q.createElement(pG,{date:P,ref:this.gutterRef,localizer:E,min:E.merge(P,A),max:E.merge(P,N),step:this.props.step,getNow:this.props.getNow,timeslots:this.props.timeslots,components:D,className:"rbc-time-gutter",getters:T}),this.renderEvents(u,U,W,g())))}},{key:"renderOverlay",value:function(){var r,a,o=this,s=(r=(a=this.state)===null||a===void 0?void 0:a.overlay)!==null&&r!==void 0?r:{},u=this.props,d=u.accessors,m=u.localizer,p=u.components,g=u.getters,w=u.selected,D=u.popupOffset,S=u.handleDragStart,T=function(){return o.setState({overlay:null})};return q.createElement(nb,{overlay:s,accessors:d,localizer:m,components:p,getters:g,selected:w,popupOffset:D,ref:this.containerRef,handleKeyPressEvent:this.handleKeyPressEvent,handleSelectEvent:this.handleSelectEvent,handleDoubleClickEvent:this.handleDoubleClickEvent,handleDragStart:S,show:!!s.position,overlayDisplay:this.overlayDisplay,onHide:T})}},{key:"clearSelection",value:function(){clearTimeout(this._selectTimer),this._pendingSelection=[]}},{key:"measureGutter",value:function(){var r=this;this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest),this.measureGutterAnimationFrameRequest=window.requestAnimationFrame(function(){var a,o=(a=r.gutterRef)!==null&&a!==void 0&&a.current?zw(r.gutterRef.current):void 0;o&&r.state.gutterWidth!==o&&r.setState({gutterWidth:o})})}},{key:"applyScroll",value:function(){if(this._scrollRatio!=null&&this.props.enableAutoScroll===!0){var r=this.contentRef.current;r.scrollTop=r.scrollHeight*this._scrollRatio,this._scrollRatio=null}}},{key:"calculateScroll",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props,a=r.min,o=r.max,s=r.scrollToTime,u=r.localizer,d=u.diff(u.merge(s,a),s,"milliseconds"),m=u.diff(a,o,"milliseconds");this._scrollRatio=d/m}}]),t}(O.Component);af.defaultProps={step:30,timeslots:2};var wG=["date","localizer","min","max","scrollToTime","enableAutoScroll"],cy=function(e){ta(t,e);function t(){return pr(this,t),ea(this,t,arguments)}return gr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,u=s===void 0?o.startOf(new Date,"day"):s,d=r.max,m=d===void 0?o.endOf(new Date,"day"):d,p=r.scrollToTime,g=p===void 0?o.startOf(new Date,"day"):p,w=r.enableAutoScroll,D=w===void 0?!0:w,S=Ai(r,wG),T=t.range(a,{localizer:o});return q.createElement(af,Object.assign({},S,{range:T,eventOffset:10,localizer:o,min:u,max:m,scrollToTime:g,enableAutoScroll:D}))}}]),t}(q.Component);cy.range=function(e,t){var n=t.localizer;return[n.startOf(e,"day")]};cy.navigate=function(e,t,n){var r=n.localizer;switch(t){case Da.PREVIOUS:return r.add(e,-1,"day");case Da.NEXT:return r.add(e,1,"day");default:return e}};cy.title=function(e,t){var n=t.localizer;return n.format(e,"dayHeaderFormat")};var bG=["date","localizer","min","max","scrollToTime","enableAutoScroll"],wl=function(e){ta(t,e);function t(){return pr(this,t),ea(this,t,arguments)}return gr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,u=s===void 0?o.startOf(new Date,"day"):s,d=r.max,m=d===void 0?o.endOf(new Date,"day"):d,p=r.scrollToTime,g=p===void 0?o.startOf(new Date,"day"):p,w=r.enableAutoScroll,D=w===void 0?!0:w,S=Ai(r,bG),T=t.range(a,this.props);return q.createElement(af,Object.assign({},S,{range:T,eventOffset:15,localizer:o,min:u,max:m,scrollToTime:g,enableAutoScroll:D}))}}]),t}(q.Component);wl.defaultProps=af.defaultProps;wl.navigate=function(e,t,n){var r=n.localizer;switch(t){case Da.PREVIOUS:return r.add(e,-1,"week");case Da.NEXT:return r.add(e,1,"week");default:return e}};wl.range=function(e,t){var n=t.localizer,r=n.startOfWeek(),a=n.startOf(e,"week",r),o=n.endOf(e,"week",r);return n.range(a,o)};wl.title=function(e,t){var n=t.localizer,r=wl.range(e,{localizer:n}),a=mx(r),o=a[0],s=a.slice(1);return n.format({start:o,end:s.pop()},"dayRangeHeaderFormat")};var DG=["date","localizer","min","max","scrollToTime","enableAutoScroll"];function ab(e,t){return wl.range(e,t).filter(function(n){return[6,0].indexOf(n.getDay())===-1})}var zm=function(e){ta(t,e);function t(){return pr(this,t),ea(this,t,arguments)}return gr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,u=s===void 0?o.startOf(new Date,"day"):s,d=r.max,m=d===void 0?o.endOf(new Date,"day"):d,p=r.scrollToTime,g=p===void 0?o.startOf(new Date,"day"):p,w=r.enableAutoScroll,D=w===void 0?!0:w,S=Ai(r,DG),T=ab(a,this.props);return q.createElement(af,Object.assign({},S,{range:T,eventOffset:15,localizer:o,min:u,max:m,scrollToTime:g,enableAutoScroll:D}))}}]),t}(q.Component);zm.defaultProps=af.defaultProps;zm.range=ab;zm.navigate=wl.navigate;zm.title=function(e,t){var n=t.localizer,r=ab(e,{localizer:n}),a=mx(r),o=a[0],s=a.slice(1);return n.format({start:o,end:s.pop()},"dayRangeHeaderFormat")};function bl(e){var t=e.accessors,n=e.components,r=e.date,a=e.events,o=e.getters,s=e.length,u=e.localizer,d=e.onDoubleClickEvent,m=e.onSelectEvent,p=e.selected,g=O.useRef(null),w=O.useRef(null),D=O.useRef(null),S=O.useRef(null),T=O.useRef(null);O.useEffect(function(){N()});var E=function(L,z,U){var W=n.event,K=n.date;return z=z.filter(function(ae){return fm(ae,u.startOf(L,"day"),u.endOf(L,"day"),t,u)}),z.map(function(ae,ce){var fe=t.title(ae),ie=t.end(ae),ge=t.start(ae),Te=o.eventProp(ae,ge,ie,sy(ae,p)),se=ce===0&&u.format(L,"agendaDateFormat"),we=ce===0?q.createElement("td",{rowSpan:z.length,className:"rbc-agenda-date-cell"},K?q.createElement(K,{day:L,label:se}):se):!1;return q.createElement("tr",{key:U+"_"+ce,className:Te.className,style:Te.style},we,q.createElement("td",{className:"rbc-agenda-time-cell"},A(L,ae)),q.createElement("td",{className:"rbc-agenda-event-cell",onClick:function($){return m&&m(ae,$)},onDoubleClick:function($){return d&&d(ae,$)}},W?q.createElement(W,{event:ae,title:fe}):fe))},[])},A=function(L,z){var U="",W=n.time,K=u.messages.allDay,ae=t.end(z),ce=t.start(z);return t.allDay(z)||(u.eq(ce,ae)?K=u.format(ce,"agendaTimeFormat"):u.isSameDate(ce,ae)?K=u.format({start:ce,end:ae},"agendaTimeRangeFormat"):u.isSameDate(L,ce)?K=u.format(ce,"agendaTimeFormat"):u.isSameDate(L,ae)&&(K=u.format(ae,"agendaTimeFormat"))),u.gt(L,ce,"day")&&(U="rbc-continues-prior"),u.lt(L,ae,"day")&&(U+=" rbc-continues-after"),q.createElement("span",{className:U.trim()},W?q.createElement(W,{event:z,day:L,label:K}):K)},N=function(){if(T.current){var L=g.current,z=T.current.firstChild;if(z){var U=S.current.scrollHeight>S.current.clientHeight,W=[],K=W;W=[zw(z.children[0]),zw(z.children[1])],(K[0]!==W[0]||K[1]!==W[1])&&(w.current.style.width=W[0]+"px",D.current.style.width=W[1]+"px"),U?(D7(L,"rbc-header-overflowing"),L.style.marginRight=VE()+"px"):S7(L,"rbc-header-overflowing")}}},R=u.messages,F=u.add(r,s,"day"),H=u.range(r,F,"day");return a=a.filter(function(P){return fm(P,u.startOf(r,"day"),u.endOf(F,"day"),t,u)}),a.sort(function(P,L){return+t.start(P)-+t.start(L)}),q.createElement("div",{className:"rbc-agenda-view"},a.length!==0?q.createElement(q.Fragment,null,q.createElement("table",{ref:g,className:"rbc-agenda-table"},q.createElement("thead",null,q.createElement("tr",null,q.createElement("th",{className:"rbc-header",ref:w},R.date),q.createElement("th",{className:"rbc-header",ref:D},R.time),q.createElement("th",{className:"rbc-header"},R.event)))),q.createElement("div",{className:"rbc-agenda-content",ref:S},q.createElement("table",{className:"rbc-agenda-table"},q.createElement("tbody",{ref:T},H.map(function(P,L){return E(P,a,L)}))))):q.createElement("span",{className:"rbc-agenda-empty"},R.noEventsInRange))}bl.defaultProps={length:30};bl.range=function(e,t){var n=t.length,r=n===void 0?bl.defaultProps.length:n,a=t.localizer,o=a.add(e,r,"day");return{start:e,end:o}};bl.navigate=function(e,t,n){var r=n.length,a=r===void 0?bl.defaultProps.length:r,o=n.localizer;switch(t){case Da.PREVIOUS:return o.add(e,-a,"day");case Da.NEXT:return o.add(e,a,"day");default:return e}};bl.title=function(e,t){var n=t.length,r=n===void 0?bl.defaultProps.length:n,a=t.localizer,o=a.add(e,r,"day");return a.format({start:e,end:o},"agendaHeaderFormat")};var Qg=Ic(Ic(Ic(Ic(Ic({},Qr.MONTH,ly),Qr.WEEK,wl),Qr.WORK_WEEK,zm),Qr.DAY,cy),Qr.AGENDA,bl),SG=["action","date","today"];function IG(e,t){var n=t.action,r=t.date,a=t.today,o=Ai(t,SG);switch(e=typeof e=="string"?Qg[e]:e,n){case Da.TODAY:r=a||new Date;break;case Da.DATE:break;default:nm(e&&typeof e.navigate=="function","Calendar View components must implement a static `.navigate(date, action)` method.s"),r=e.navigate(r,n,o)}return r}var TG=function(e){ta(t,e);function t(){var n;pr(this,t);for(var r=arguments.length,a=new Array(r),o=0;o1)return o.map(function(u){return q.createElement("button",{type:"button",key:u,className:Qn({"rbc-active":s===u}),onClick:a.view.bind(null,u)},r[u])})}}]),t}(q.Component);function EG(e,t){var n=null;return typeof t=="function"?n=t(e):typeof t=="string"&&ps(e)==="object"&&e!=null&&t in e&&(n=e[t]),n}var dl=function(t){return function(n){return EG(n,t)}},xG=["view","date","getNow","onNavigate"],CG=["view","toolbar","events","backgroundEvents","style","className","elementProps","date","getNow","length","showMultiDayTimes","onShowMore","doShowMoreDrillDown","components","formats","messages","culture"];function Ux(e){if(Array.isArray(e))return e;for(var t=[],n=0,r=Object.entries(e);n0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1?arguments[1]:void 0,ve=fl(X);return ve?e($).startOf(ve).toDate():e($).toDate()}function u(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1?arguments[1]:void 0,ve=fl(X);return ve?e($).endOf(ve).toDate():e($).toDate()}function d($,X,ve){var De=o($,X,ve),be=us(De,3),ke=be[0],Be=be[1],_e=be[2];return ke.isSame(Be,_e)}function m($,X,ve){return!d($,X,ve)}function p($,X,ve){var De=o($,X,ve),be=us(De,3),ke=be[0],Be=be[1],_e=be[2];return ke.isAfter(Be,_e)}function g($,X,ve){var De=o($,X,ve),be=us(De,3),ke=be[0],Be=be[1],_e=be[2];return ke.isBefore(Be,_e)}function w($,X,ve){var De=o($,X,ve),be=us(De,3),ke=be[0],Be=be[1],_e=be[2];return ke.isSameOrBefore(Be,_e)}function D($,X,ve){var De=o($,X,ve),be=us(De,3),ke=be[0],Be=be[1],_e=be[2];return ke.isSameOrBefore(Be,_e)}function S($,X,ve){var De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"day",be=fl(De),ke=e($),Be=e(X),_e=e(ve);return ke.isBetween(Be,_e,be,"[]")}function T($,X){var ve=e($),De=e(X),be=e.min(ve,De);return be.toDate()}function E($,X){var ve=e($),De=e(X),be=e.max(ve,De);return be.toDate()}function A($,X){if(!$&&!X)return null;var ve=e(X).format("HH:mm:ss"),De=e($).startOf("day").format("MM/DD/YYYY");return e("".concat(De," ").concat(ve),"MM/DD/YYYY HH:mm:ss").toDate()}function N($,X,ve){var De=fl(ve);return e($).add(X,De).toDate()}function R($,X){for(var ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"day",De=fl(ve),be=e($).toDate(),ke=[];D(be,X);)ke.push(be),be=N(be,1,De);return ke}function F($,X){var ve=fl(X),De=s($,ve);return d(De,$)?De:N(De,1,ve)}function H($,X){var ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"day",De=fl(ve),be=e($),ke=e(X);return ke.diff(be,De)}function P($){var X=e($);return X.minutes()}function L($){var X=$?e.localeData($):e.localeData();return X?X.firstDayOfWeek():0}function z($){return e($).startOf("month").startOf("week").toDate()}function U($){return e($).endOf("month").endOf("week").toDate()}function W($){for(var X=z($),ve=U($),De=[];D(X,ve);)De.push(X),X=N(X,1,"d");return De}function K($,X,ve){return e($).startOf("day").minute(X+ve).toDate()}function ae($,X){return H($,X,"minutes")}function ce($){var X=e($).startOf("day"),ve=e($);return ve.diff(X,"minutes")+a($)}function fe($,X){var ve=e($),De=e(X);return ve.isBefore(De,"day")}function ie($,X,ve){var De=e(X),be=e(ve);return De.isSameOrAfter(be,"minutes")}function ge($,X){var ve=e($),De=e(X),be=e.duration(De.diff(ve));return be.days()}function Te($){var X=$.evtA,ve=X.start,De=X.end,be=X.allDay,ke=$.evtB,Be=ke.start,_e=ke.end,it=ke.allDay,Vt=+s(ve,"day")-+s(Be,"day"),Se=ge(ve,De),Ue=ge(Be,_e);return Vt||Ue-Se||!!it-!!be||+ve-+Be||+De-+_e}function se($){var X=$.event,ve=X.start,De=X.end,be=$.range,ke=be.start,Be=be.end,_e=e(ve).startOf("day"),it=e(De),Vt=e(ke),Se=e(Be),Ue=_e.isSameOrBefore(Se,"day"),Je=!_e.isSame(it,"minutes"),$e=Je?it.isAfter(Vt,"minutes"):it.isSameOrAfter(Vt,"minutes");return Ue&&$e}function we($,X){var ve=e($),De=e(X);return ve.isSame(De,"day")}function Z(){var $=new Date,X=/-/.test($.toString())?"-":"",ve=$.getTimezoneOffset(),De=Number("".concat(X).concat(Math.abs(ve))),be=e().utcOffset();return be>De?1:0}return new N$({formats:PG,firstOfWeek:L,firstVisibleDay:z,lastVisibleDay:U,visibleDays:W,format:function(X,ve,De){return t(e(X),De).format(ve)},lt:g,lte:D,gt:p,gte:w,eq:d,neq:m,merge:A,inRange:S,startOf:s,endOf:u,range:R,add:N,diff:H,ceil:F,min:T,max:E,minutes:P,getSlotDate:K,getTimezoneOffset:n,getDstOffset:r,getTotalMin:ae,getMinutesFromMidnight:ce,continuesPrior:fe,continuesAfter:ie,sortEvents:Te,inEventRange:se,isSameDate:we,daySpan:ge,browserTZOffset:Z})}function h2(e,t,n,r,a){const o={start:r.start(e),end:r.end(e)},s={start:t,end:n};return a.inEventRange({event:o,range:s})}function LG(e,t){return!e||t==null?!1:EI.isEqual(e,t)}const Td={PREVIOUS:"PREV",NEXT:"NEXT",TODAY:"TODAY",DATE:"DATE"};function gs({accessors:e,components:t,date:n,events:r,getters:a,length:o,localizer:s,onDoubleClickEvent:u,onSelectEvent:d,selected:m}){O.useRef(null);const p=O.useRef(null),g=O.useRef(null),w=O.useRef(null),D=O.useRef(null),[S,T]=O.useState(!1),[E,A]=O.useState(!1),N=(W,K,ae)=>{const{event:ce,date:fe}=t;return K=K.filter(ie=>h2(ie,s.startOf(W,"day"),s.endOf(W,"day"),e,s)),K.map((ie,ge)=>{const Te=e.title(ie),se=e.end(ie),we=e.start(ie),Z=a.eventProp(ie,we,se,LG(ie,m)),$=ge===0&&s.format(W,"agendaDateFormat"),X=ge===0?y.jsx("td",{rowSpan:K.length,className:"rbc-agenda-date-cell",children:fe?y.jsx(fe,{day:W,label:$}):$}):!1;return y.jsxs("tr",{className:Z.className,style:Z.style,children:[X,y.jsx("td",{className:"rbc-agenda-time-cell",children:R(W,ie)}),y.jsx("td",{className:"rbc-agenda-event-cell",onClick:ve=>d&&d(ie,ve),onDoubleClick:ve=>u&&u(ie,ve),children:ce?y.jsx(ce,{event:ie,title:Te}):Te})]},ae+"_"+ge)},[])},R=(W,K)=>{const ae=t.time;let ce="",fe=s.messages.allDay;const ie=e.end(K),ge=e.start(K);return e.allDay(K)||(s.eq(ge,ie)?fe=s.format(ge,"agendaTimeFormat"):s.isSameDate(ge,ie)?fe=s.format({start:ge,end:ie},"agendaTimeRangeFormat"):s.isSameDate(W,ge)?fe=s.format(ge,"agendaTimeFormat"):s.isSameDate(W,ie)&&(fe=s.format(ie,"agendaTimeFormat"))),s.gt(W,ge,"day")&&(ce="rbc-continues-prior"),s.lt(W,ie,"day")&&(ce+=" rbc-continues-after"),y.jsx("span",{className:ce.trim(),children:ae?y.jsx(ae,{event:K,day:W,label:fe}):fe})},{messages:F}=s,H=s.add(n,-o/2,"day"),P=s.add(n,o/2,"day"),L=s.range(H,P,"day");S&&L.reverse(),r=r.filter(W=>h2(W,s.startOf(H,"day"),s.endOf(P,"day"),e,s)),r.sort((W,K)=>+e.start(W)-+e.start(K)),E&&r.reverse();const z=O.useCallback(()=>setTimeout(()=>{D.current&&Uv(D.current,{backgroundColor:"#ffffff",pixelRatio:window.devicePixelRatio*2}).then(W=>{new x.Notice(k("Image is generating..."));const K=rt.getState().settings.AutoSaveWhenOnMobile,ae=rt.getState().app.vault;if(K&&x.Platform.isMobile){const ce=W.split("base64,")[1];Av(ce,"image/png").arrayBuffer().then(async ie=>{let ge;const Te="png",se=ws();for(const we in se)if(se[we]instanceof x.TFile){ge=se[we];break}ge!==void 0&&await ae.createBinary(await ae.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,Te,ge),ie)})}Vv({imgUrl:W})}).catch(W=>{console.error(W)})},0),[D.current,L]),U=O.useCallback(W=>{const K=new x.Menu;K.addItem(ae=>{ae.setIcon("share-2").setTitle(k("Share")).onClick(()=>{z()})}),K.showAtMouseEvent(W.nativeEvent)},[D.current,L,z]);return y.jsx("div",{className:"rbc-agenda-view",children:r.length!==0?y.jsx(q.Fragment,{children:y.jsxs("table",{ref:D,className:"rbc-agenda-table",children:[y.jsx("thead",{onContextMenu:U,children:y.jsxs("tr",{children:[y.jsx("th",{className:"rbc-header",ref:p,onClick:()=>{T(!S)},children:F.date+(S?" 🔼":" 🔽")}),y.jsx("th",{className:"rbc-header",ref:g,onClick:()=>{A(!E)},children:F.time+(E?" 🔼":" 🔽")}),y.jsx("th",{className:"rbc-header",children:F.event})]})}),y.jsx("tbody",{ref:w,children:L.map((W,K)=>N(W,r,K))})]})}):y.jsx("span",{className:"rbc-agenda-empty",children:F.noEventsInRange})})}gs.propTypes={accessors:Ae.object.isRequired,components:Ae.object.isRequired,date:Ae.instanceOf(Date),events:Ae.array,getters:Ae.object.isRequired,length:Ae.number.isRequired,localizer:Ae.object.isRequired,onSelectEvent:Ae.func,onDoubleClickEvent:Ae.func,selected:Ae.object};gs.defaultProps={length:30};gs.range=(e,{length:t=gs.defaultProps.length,localizer:n})=>{const r=n.add(e,-t/2,"day"),a=n.add(e,t/2,"day");return{customStart:r,customEnd:a}};gs.navigate=(e,t,{length:n=gs.defaultProps.length,localizer:r})=>{switch(t){case Td.PREVIOUS:return r.add(e,-n,"day");case Td.NEXT:return r.add(e,n,"day");default:return e}};gs.title=(e,{length:t=gs.defaultProps.length,localizer:n})=>{const r=n.add(e,-t/2,"day"),a=n.add(e,t/2,"day");return n.format({start:r,end:a},"agendaHeaderFormat")};function RG(e,t){e.hoverEl.toggleClass("thino-hover-popover",!0);const n=Lv(e.hoverEl);return n.render(y.jsx(Sl,{store:Ee,context:wt,children:y.jsx(Ua,{memo:t})})),n}function _G({event:e}){const t=e.resource,n=t.content.split(`
`)[0].slice(0,20),r=q.useRef(null),a=q.useRef(null),o=q.useRef(null);O.useEffect(()=>{if(a.current)return x.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const s=O.useCallback(d=>{o.current&&(o.current.unmount(),o.current=null),o.current=d},[]),u=O.useCallback(d=>{if(!r.current||!x.Keymap.isModifier(d.nativeEvent,"Mod"))return;const m=new x.HoverPopover(rt.getState().view,r.current,100),p=RG(m,t);s(p)},[r.current]);return y.jsxs("span",{className:"rbc-event-renderer","data-source-type":t.sourceType,"data-thino-type":t.thinoType,"data-thino-id":t.id,ref:r,"aria-label":t.path,onMouseOver:u,children:[y.jsx(HG,{event:e}),y.jsx("strong",{children:n})]})}const HG=({event:e})=>{const t=q.useRef(null),n=e.resource;O.useEffect(()=>{t.current&&x.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=O.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const s=await Ie.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");s&&Ie.editMemo(s)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return y.jsx(y.Fragment,{children:y.jsxs("span",{className:"rbc-event-icon-group",children:[y.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),y.jsx("span",{className:mr("rbc-event-time","hidden"),children:y.jsx("span",{className:"rbc-event-time-text",children:x.moment(e.start).format("HH:mm")})})]})})};function Zx({views:e,view:t,messages:n,onView:r}){return e.map(a=>y.jsx("button",{type:"button",className:mr({"rbc-active":t===a}),onClick:()=>r(a),children:n[a]},a))}Zx.propTypes={messages:Ae.object,onView:Ae.func,view:Ae.string,views:Ae.array};function Wx({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:s}){const u={previous:O.useRef(null),today:O.useRef(null),next:O.useRef(null)};O.useEffect(()=>{u&&(x.setIcon(u.previous.current,"chevron-left"),x.setIcon(u.today.current,"dot"),x.setIcon(u.next.current,"chevron-right"))},[u]);const d=O.useMemo(()=>y.jsxs(y.Fragment,{children:[y.jsx("button",{ref:u.previous,type:"button",onClick:()=>r(Td.PREVIOUS),"aria-label":n.previous,children:"<"}),y.jsx("button",{ref:u.today,type:"button",onClick:()=>r(Td.TODAY),"aria-label":n.today,children:"•"}),y.jsx("button",{ref:u.next,type:"button",onClick:()=>r(Td.NEXT),"aria-label":n.next,children:">"})]}),[n]);return y.jsxs("div",{className:"rbc-toolbar",children:[y.jsx("span",{className:mr("rbc-btn-group","thino-view-custom-toolbar"),children:d}),y.jsx("span",{className:"rbc-toolbar-label",children:y.jsx(dv,{type:"text",handleValueChange:m=>{r(Td.DATE,x.moment(m,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(o==="week"?x.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:x.moment(e.valueOf(),"x").valueOf()})}),y.jsx("span",{className:"rbc-btn-group",children:y.jsx(Zx,{view:o,views:s,messages:n,onView:a})})]})}Wx.propTypes={date:Ae.instanceOf(Date),label:Ae.string,localizer:Ae.object,messages:Ae.object,onNavigate:Ae.func,onView:Ae.func,view:Ae.string,views:Ae.array};function BG({event:e,children:t,showPopup:n,callRender:r,...a}){const o=O.useRef(null),s=O.useRef(null),u=O.useCallback(d=>{if(!d.isTrusted){r();return}s.current=d.nativeEvent.target,s.current&&(s.current.hasClass("rbc-event")||(s.current=s.current.closest(".rbc-event")),o.current!==null?(window.clearTimeout(o.current),o.current=null):o.current=window.setTimeout(()=>{n(e,s.current),o.current=null},250))},[e,n]);return y.jsx(y.Fragment,{children:y.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:u,children:t})})}const YG=jG(x.moment),zG=({event:e})=>{const t=e.resource;return y.jsx(y.Fragment,{children:y.jsx(Ua,{memo:t})})},UG=e=>{var ae;const{thinos:t}=e,[n,r]=q.useState([]),[a,o]=q.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[s,u]=q.useState(null),d=q.useRef(null),m=q.useRef(null),[p,g]=q.useState(!1),w=O.useRef(null),[D,S]=O.useState(new Date);O.useEffect(()=>()=>{d.current&&(d.current=null),m.current&&(m.current=null),w.current&&(w.current=null)},[]),O.useEffect(()=>{const ce=t.map(fe=>{const ie=x.moment(fe.createdAt,"YYYY/MM/DD HH:mm:ss"),ge=ie.clone().add(1,"minute");return{title:fe.content,start:new Date(ie.format("YYYY-MM-DDTHH:mm:ss")),end:new Date(ge.format("YYYY-MM-DDTHH:mm:ss")),resource:fe}});r(ce)},[t]),O.useEffect(()=>{app==null||app.saveLocalStorage("thino-calendar-view",a)},[a]),O.useEffect(()=>{p&&u(t.find(ce=>ce.id===s.id))},[t]),O.useEffect(()=>{s&&w.current.update()},[s]),w.current=zv(d.current,m.current,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,4]}}]});const T=O.useCallback(()=>{w.current.update(),w.current.update()},[]),E=O.useCallback((ce,fe)=>{u(null),F(),w.current.state.elements.reference=fe,u(ce.resource),H()},[]),A=O.useCallback(()=>{F(),u(null)},[]),N=O.useCallback((ce,fe,ie)=>{var ge;if(R(ce),fe==="week"||fe==="day"){const Te=d.current.find(".rbc-event-wrapper");if(d.current.closest(".memolist-wrapper"),Te){(ge=Te.children[0])==null||ge.click();return}else{setTimeout(()=>{var we,Z;const se=d.current.find(".rbc-event-wrapper");(Z=(we=se==null?void 0:se.children)==null?void 0:we[0])==null||Z.click()},0);return}}},[]),R=O.useCallback(ce=>{S(ce)},[S]);Mm(m,A);const F=O.useCallback(()=>{g(!1)},[g]),H=O.useCallback(()=>{w.current.update(),g(!0)},[g]),P=O.useCallback(ce=>{const fe=ce.resource;Qe.setEditMemoId(fe.id)},[]),L=O.useCallback(ce=>{o(ce)},[o]),{components:z,views:U,messages:W}=O.useMemo(()=>({components:{toolbar:Wx,eventWrapper:ce=>y.jsx(BG,{...ce,callRender:T,showPopup:E}),agenda:{event:zG},event:_G},views:{month:!0,agenda:gs,week:!0,day:!0},messages:{month:k("Month"),day:k("Day"),next:k("Next"),previous:k("Previous"),today:k("Today"),agenda:k("Agenda"),week:k("Week"),yesterday:k("Yesterday"),tomorrow:k("Tomorrow"),noEventsInRange:k("No thinos in range"),date:k("date"),time:k("time"),event:k("event")}}),[]),K=O.useMemo(()=>({timeGutterFormat:(ce,fe,ie)=>ie.format(ce,"HH:mm",fe),agendaTimeRangeFormat:({start:ce,end:fe},ie,ge)=>ge.format(ce,"HH:mm",ie)+" — "+ge.format(fe,"HH:mm",ie),agendaHeaderFormat:({start:ce,end:fe},ie,ge)=>ge.format(ce,"YYYY-MM-DD")+" — "+ge.format(fe,"YYYY-MM-DD")}),[]);return y.jsxs("div",{ref:d,className:"calendar-view",children:[y.jsx(NG,{date:D,messages:W,components:z,localizer:YG,events:n,views:U,onView:L,onDoubleClickEvent:P,onNavigate:N,formats:K,defaultView:a,tooltipAccessor:null,startAccessor:"start",endAccessor:"end"}),y.jsx("div",{ref:m,style:(ae=w.current)==null?void 0:ae.styles.popper,className:mr("thino-popup-container",p?"":"hidden"),children:s&&y.jsx(Ua,{memo:s})})]})};function vl(e,t){return typeof e=="function"?e(t):e}function Va(e,t){return n=>{t.setState(r=>({...r,[e]:vl(n,r[e])}))}}function Ev(e){return e instanceof Function}function VG(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function ZG(e,t){const n=[],r=a=>{a.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function ht(e,t,n){let r=[],a;return o=>{let s;n.key&&n.debug&&(s=Date.now());const u=e(o);if(!(u.length!==r.length||u.some((p,g)=>r[g]!==p)))return a;r=u;let m;if(n.key&&n.debug&&(m=Date.now()),a=t(...u),n==null||n.onChange==null||n.onChange(a),n.key&&n.debug&&n!=null&&n.debug()){const p=Math.round((Date.now()-s)*100)/100,w=Math.round((Date.now()-m)*100)/100/16,D=(S,T)=>{for(S=String(S);S.length{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[t]},key:!1,onChange:r}}function WG(e,t,n,r){var a,o;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let m=(a=(o=u.id)!=null?o:d?d.replace(".","_"):void 0)!=null?a:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:d&&(d.includes(".")?p=w=>{let D=w;for(const T of d.split(".")){var S;D=(S=D)==null?void 0:S[T]}return D}:p=w=>w[u.accessorKey]),!m)throw new Error;let g={id:`${String(m)}`,accessorFn:p,parent:r,depth:n,columnDef:u,columns:[],getFlatColumns:ht(()=>[!0],()=>{var w;return[g,...(w=g.columns)==null?void 0:w.flatMap(D=>D.getFlatColumns())]},mt(e.options,"debugColumns")),getLeafColumns:ht(()=>[e._getOrderColumnsFn()],w=>{var D;if((D=g.columns)!=null&&D.length){let S=g.columns.flatMap(T=>T.getLeafColumns());return w(S)}return[g]},mt(e.options,"debugColumns"))};for(const w of e._features)w.createColumn==null||w.createColumn(g,e);return g}const Rr="debugHeaders";function m2(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),s.push(d)};return u(o),s},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(o,e)}),o}const $G={createTable:e=>{e.getHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>{var o,s;const u=(o=r==null?void 0:r.map(g=>n.find(w=>w.id===g)).filter(Boolean))!=null?o:[],d=(s=a==null?void 0:a.map(g=>n.find(w=>w.id===g)).filter(Boolean))!=null?s:[],m=n.filter(g=>!(r!=null&&r.includes(g.id))&&!(a!=null&&a.includes(g.id)));return Fg(t,[...u,...m,...d],e)},mt(e.options,Rr)),e.getCenterHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(a!=null&&a.includes(o.id))),Fg(t,n,e,"center")),mt(e.options,Rr)),e.getLeftHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var a;const o=(a=r==null?void 0:r.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?a:[];return Fg(t,o,e,"left")},mt(e.options,Rr)),e.getRightHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var a;const o=(a=r==null?void 0:r.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?a:[];return Fg(t,o,e,"right")},mt(e.options,Rr)),e.getFooterGroups=ht(()=>[e.getHeaderGroups()],t=>[...t].reverse(),mt(e.options,Rr)),e.getLeftFooterGroups=ht(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),mt(e.options,Rr)),e.getCenterFooterGroups=ht(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),mt(e.options,Rr)),e.getRightFooterGroups=ht(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),mt(e.options,Rr)),e.getFlatHeaders=ht(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),mt(e.options,Rr)),e.getLeftFlatHeaders=ht(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),mt(e.options,Rr)),e.getCenterFlatHeaders=ht(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),mt(e.options,Rr)),e.getRightFlatHeaders=ht(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),mt(e.options,Rr)),e.getCenterLeafHeaders=ht(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),mt(e.options,Rr)),e.getLeftLeafHeaders=ht(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),mt(e.options,Rr)),e.getRightLeafHeaders=ht(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),mt(e.options,Rr)),e.getLeafHeaders=ht(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var a,o,s,u,d,m;return[...(a=(o=t[0])==null?void 0:o.headers)!=null?a:[],...(s=(u=n[0])==null?void 0:u.headers)!=null?s:[],...(d=(m=r[0])==null?void 0:m.headers)!=null?d:[]].map(p=>p.getLeafHeaders()).flat()},mt(e.options,Rr))}};function Fg(e,t,n,r){var a,o;let s=0;const u=function(w,D){D===void 0&&(D=1),s=Math.max(s,D),w.filter(S=>S.getIsVisible()).forEach(S=>{var T;(T=S.columns)!=null&&T.length&&u(S.columns,D+1)},0)};u(e);let d=[];const m=(w,D)=>{const S={depth:D,id:[r,`${D}`].filter(Boolean).join("_"),headers:[]},T=[];w.forEach(E=>{const A=[...T].reverse()[0],N=E.column.depth===S.depth;let R,F=!1;if(N&&E.column.parent?R=E.column.parent:(R=E.column,F=!0),A&&(A==null?void 0:A.column)===R)A.subHeaders.push(E);else{const H=m2(n,R,{id:[r,D,R.id,E==null?void 0:E.id].filter(Boolean).join("_"),isPlaceholder:F,placeholderId:F?`${T.filter(P=>P.column===R).length}`:void 0,depth:D,index:T.length});H.subHeaders.push(E),T.push(H)}S.headers.push(E),E.headerGroup=S}),d.push(S),D>0&&m(T,D-1)},p=t.map((w,D)=>m2(n,w,{depth:s,index:D}));m(p,s-1),d.reverse();const g=w=>w.filter(S=>S.column.getIsVisible()).map(S=>{let T=0,E=0,A=[0];S.subHeaders&&S.subHeaders.length?(A=[],g(S.subHeaders).forEach(R=>{let{colSpan:F,rowSpan:H}=R;T+=F,A.push(H)})):T=1;const N=Math.min(...A);return E+=N,S.colSpan=T,S.rowSpan=E,{colSpan:T,rowSpan:E}});return g((a=(o=d[0])==null?void 0:o.headers)!=null?a:[]),d}const Pg={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},$0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),GG={getDefaultColumnDef:()=>Pg,getInitialState:e=>({columnSizing:{},columnSizingInfo:$0(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Va("columnSizing",e),onColumnSizingInfoChange:Va("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,a;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Pg.minSize,(r=o??e.columnDef.size)!=null?r:Pg.size),(a=e.columnDef.maxSize)!=null?a:Pg.maxSize)},e.getStart=ht(n=>[n,Jh(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((a,o)=>a+o.getSize(),0),mt(t.options,"debugColumns")),e.getAfter=ht(n=>[n,Jh(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((a,o)=>a+o.getSize(),0),mt(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...a}=n;return a})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=a=>{if(a.subHeaders.length)a.subHeaders.forEach(r);else{var o;n+=(o=a.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),a=r==null?void 0:r.getCanResize();return o=>{if(!r||!a||(o.persist==null||o.persist(),G0(o)&&o.touches&&o.touches.length>1))return;const s=e.getSize(),u=e?e.getLeafHeaders().map(A=>[A.column.id,A.column.getSize()]):[[r.id,r.getSize()]],d=G0(o)?Math.round(o.touches[0].clientX):o.clientX,m={},p=(A,N)=>{typeof N=="number"&&(t.setColumnSizingInfo(R=>{var F,H;const P=t.options.columnResizeDirection==="rtl"?-1:1,L=(N-((F=R==null?void 0:R.startOffset)!=null?F:0))*P,z=Math.max(L/((H=R==null?void 0:R.startSize)!=null?H:0),-.999999);return R.columnSizingStart.forEach(U=>{let[W,K]=U;m[W]=Math.round(Math.max(K+K*z,0)*100)/100}),{...R,deltaOffset:L,deltaPercentage:z}}),(t.options.columnResizeMode==="onChange"||A==="end")&&t.setColumnSizing(R=>({...R,...m})))},g=A=>p("move",A),w=A=>{p("end",A),t.setColumnSizingInfo(N=>({...N,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},D=n||typeof document<"u"?document:null,S={moveHandler:A=>g(A.clientX),upHandler:A=>{D==null||D.removeEventListener("mousemove",S.moveHandler),D==null||D.removeEventListener("mouseup",S.upHandler),w(A.clientX)}},T={moveHandler:A=>(A.cancelable&&(A.preventDefault(),A.stopPropagation()),g(A.touches[0].clientX),!1),upHandler:A=>{var N;D==null||D.removeEventListener("touchmove",T.moveHandler),D==null||D.removeEventListener("touchend",T.upHandler),A.cancelable&&(A.preventDefault(),A.stopPropagation()),w((N=A.touches[0])==null?void 0:N.clientX)}},E=qG()?{passive:!1}:!1;G0(o)?(D==null||D.addEventListener("touchmove",T.moveHandler,E),D==null||D.addEventListener("touchend",T.upHandler,E)):(D==null||D.addEventListener("mousemove",S.moveHandler,E),D==null||D.addEventListener("mouseup",S.upHandler,E)),t.setColumnSizingInfo(A=>({...A,startOffset:d,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?$0():(n=e.initialState.columnSizingInfo)!=null?n:$0())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0}}};let jg=null;function qG(){if(typeof jg=="boolean")return jg;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return jg=e,jg}function G0(e){return e.type==="touchstart"}const JG={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Va("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,a;if(!t){e._queue(()=>{t=!0});return}if((r=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var a,o;e.setExpanded(r?{}:(a=(o=e.initialState)==null?void 0:o.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const s=o.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var a;const o=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{s[u]=!0}):s=r,n=(a=n)!=null?a:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){const{[e.id]:u,...d}=s;return d}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,a;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},$x=(e,t,n)=>{var r;const a=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(a))};$x.autoRemove=e=>Lo(e);const Gx=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};Gx.autoRemove=e=>Lo(e);const qx=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};qx.autoRemove=e=>Lo(e);const Jx=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};Jx.autoRemove=e=>Lo(e)||!(e!=null&&e.length);const Kx=(e,t,n)=>!n.some(r=>{var a;return!((a=e.getValue(t))!=null&&a.includes(r))});Kx.autoRemove=e=>Lo(e)||!(e!=null&&e.length);const Qx=(e,t,n)=>n.some(r=>{var a;return(a=e.getValue(t))==null?void 0:a.includes(r)});Qx.autoRemove=e=>Lo(e)||!(e!=null&&e.length);const Xx=(e,t,n)=>e.getValue(t)===n;Xx.autoRemove=e=>Lo(e);const eC=(e,t,n)=>e.getValue(t)==n;eC.autoRemove=e=>Lo(e);const ob=(e,t,n)=>{let[r,a]=n;const o=e.getValue(t);return o>=r&&o<=a};ob.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,a=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(a)?1/0:a;if(o>s){const u=o;o=s,s=u}return[o,s]};ob.autoRemove=e=>Lo(e)||Lo(e[0])&&Lo(e[1]);const ss={includesString:$x,includesStringSensitive:Gx,equalsString:qx,arrIncludes:Jx,arrIncludesAll:Kx,arrIncludesSome:Qx,equals:Xx,weakEquals:eC,inNumberRange:ob};function Lo(e){return e==null||e===""}const KG={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Va("columnFilters",e),onGlobalFilterChange:Va("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?ss.includesString:typeof r=="number"?ss.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?ss.equals:Array.isArray(r)?ss.arrIncludes:ss.weakEquals},e.getFilterFn=()=>{var n,r;return Ev(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:ss[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,a;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var n,r,a,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(a=>a.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const a=e.getFilterFn(),o=r==null?void 0:r.find(p=>p.id===e.id),s=vl(n,o?o.value:void 0);if(p2(a,s,e)){var u;return(u=r==null?void 0:r.filter(p=>p.id!==e.id))!=null?u:[]}const d={id:e.id,value:s};if(o){var m;return(m=r==null?void 0:r.map(p=>p.id===e.id?d:p))!=null?m:[]}return r!=null&&r.length?[...r,d]:[d]})},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>ss.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Ev(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:ss[r]},e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=a=>{var o;return(o=vl(t,a))==null?void 0:o.filter(s=>{const u=n.find(d=>d.id===s.id);if(u){const d=u.getFilterFn();if(p2(d,s.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function p2(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const QG=(e,t,n)=>n.reduce((r,a)=>{const o=a.getValue(e);return r+(typeof o=="number"?o:0)},0),XG=(e,t,n)=>{let r;return n.forEach(a=>{const o=a.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},eq=(e,t,n)=>{let r;return n.forEach(a=>{const o=a.getValue(e);o!=null&&(r=o)&&(r=o)}),r},tq=(e,t,n)=>{let r,a;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r===void 0?s>=s&&(r=a=s):(r>s&&(r=s),a{let n=0,r=0;if(t.forEach(a=>{let o=a.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},rq=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!VG(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),a=n.sort((o,s)=>o-s);return n.length%2!==0?a[r]:(a[r-1]+a[r])/2},aq=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),oq=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,iq=(e,t)=>t.length,q0={sum:QG,min:XG,max:eq,extent:tq,mean:nq,median:rq,unique:aq,uniqueCount:oq,count:iq},sq={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Va("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r,a,o;return(n=(r=(a=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?a:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return q0.sum;if(Object.prototype.toString.call(r)==="[object Date]")return q0.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Ev(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:q0[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=n.subRows)!=null&&a.length)}}};function lq(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(s=>s.id===o)).filter(Boolean),...r]}const cq={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Va("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ht(n=>[Jh(t,n)],n=>n.findIndex(r=>r.id===e.id),mt(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Jh(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const a=Jh(t,n);return((r=a[a.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ht(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>a=>{let o=[];if(!(t!=null&&t.length))o=a;else{const s=[...t],u=[...a];for(;u.length&&s.length;){const d=s.shift(),m=u.findIndex(p=>p.id===d);m>-1&&o.push(u.splice(m,1)[0])}o=[...o,...u]}return lq(o,n,r)},mt(e.options,"debugTable"))}},Zw=0,Ww=10,J0=()=>({pageIndex:Zw,pageSize:Ww}),uq={getInitialState:e=>({...e,pagination:{...J0(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Va("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,a;if(!t){e._queue(()=>{t=!0});return}if((r=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const a=o=>vl(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=r=>{var a;e.setPagination(r?J0():(a=e.initialState.pagination)!=null?a:J0())},e.setPageIndex=r=>{e.setPagination(a=>{let o=vl(r,a.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,s)),{...a,pageIndex:o}})},e.resetPageIndex=r=>{var a,o;e.setPageIndex(r?Zw:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?a:Zw)},e.resetPageSize=r=>{var a,o;e.setPageSize(r?Ww:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?a:Ww)},e.setPageSize=r=>{e.setPagination(a=>{const o=Math.max(1,vl(r,a.pageSize)),s=a.pageSize*a.pageIndex,u=Math.floor(s/o);return{...a,pageIndex:u,pageSize:o}})},e.setPageCount=r=>e.setPagination(a=>{var o;let s=vl(r,(o=e.options.pageCount)!=null?o:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...a,pageCount:s}}),e.getPageOptions=ht(()=>[e.getPageCount()],r=>{let a=[];return r&&r>0&&(a=[...new Array(r)].fill(null).map((o,s)=>s)),a},mt(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},K0=()=>({left:[],right:[]}),Q0=()=>({top:[],bottom:[]}),dq={getInitialState:e=>({columnPinning:K0(),rowPinning:Q0(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Va("columnPinning",e),onRowPinningChange:Va("rowPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(a=>a.id).filter(Boolean);t.setColumnPinning(a=>{var o,s;if(n==="right"){var u,d;return{left:((u=a==null?void 0:a.left)!=null?u:[]).filter(g=>!(r!=null&&r.includes(g))),right:[...((d=a==null?void 0:a.right)!=null?d:[]).filter(g=>!(r!=null&&r.includes(g))),...r]}}if(n==="left"){var m,p;return{left:[...((m=a==null?void 0:a.left)!=null?m:[]).filter(g=>!(r!=null&&r.includes(g))),...r],right:((p=a==null?void 0:a.right)!=null?p:[]).filter(g=>!(r!=null&&r.includes(g)))}}return{left:((o=a==null?void 0:a.left)!=null?o:[]).filter(g=>!(r!=null&&r.includes(g))),right:((s=a==null?void 0:a.right)!=null?s:[]).filter(g=>!(r!=null&&r.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var a,o,s;return((a=r.columnDef.enablePinning)!=null?a:!0)&&((o=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(u=>u.id),{left:r,right:a}=t.getState().columnPinning,o=n.some(u=>r==null?void 0:r.includes(u)),s=n.some(u=>a==null?void 0:a.includes(u));return o?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const a=e.getIsPinned();return a?(n=(r=t.getState().columnPinning)==null||(r=r[a])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.pin=(n,r,a)=>{const o=r?e.getLeafRows().map(d=>{let{id:m}=d;return m}):[],s=a?e.getParentRows().map(d=>{let{id:m}=d;return m}):[],u=new Set([...s,e.id,...o]);t.setRowPinning(d=>{var m,p;if(n==="bottom"){var g,w;return{top:((g=d==null?void 0:d.top)!=null?g:[]).filter(T=>!(u!=null&&u.has(T))),bottom:[...((w=d==null?void 0:d.bottom)!=null?w:[]).filter(T=>!(u!=null&&u.has(T))),...Array.from(u)]}}if(n==="top"){var D,S;return{top:[...((D=d==null?void 0:d.top)!=null?D:[]).filter(T=>!(u!=null&&u.has(T))),...Array.from(u)],bottom:((S=d==null?void 0:d.bottom)!=null?S:[]).filter(T=>!(u!=null&&u.has(T)))}}return{top:((m=d==null?void 0:d.top)!=null?m:[]).filter(T=>!(u!=null&&u.has(T))),bottom:((p=d==null?void 0:d.bottom)!=null?p:[]).filter(T=>!(u!=null&&u.has(T)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:a}=t.options;return typeof r=="function"?r(e):(n=r??a)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:a}=t.getState().rowPinning,o=n.some(u=>r==null?void 0:r.includes(u)),s=n.some(u=>a==null?void 0:a.includes(u));return o?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const a=e.getIsPinned();if(!a)return-1;const o=(n=t._getPinnedRows(a))==null?void 0:n.map(s=>{let{id:u}=s;return u});return(r=o==null?void 0:o.indexOf(e.id))!=null?r:-1},e.getCenterVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,a)=>{const o=[...r??[],...a??[]];return n.filter(s=>!o.includes(s.column.id))},mt(t.options,"debugRows")),e.getLeftVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),mt(t.options,"debugRows")),e.getRightVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),mt(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?K0():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:K0())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var a,o;return!!((a=r.left)!=null&&a.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(a=>a.id===r)).filter(Boolean),mt(e.options,"debugColumns")),e.getRightLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(a=>a.id===r)).filter(Boolean),mt(e.options,"debugColumns")),e.getCenterLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const a=[...n??[],...r??[]];return t.filter(o=>!a.includes(o.id))},mt(e.options,"debugColumns")),e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Q0():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Q0())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var a,o;return!!((a=r.top)!=null&&a.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=ht(t=>[e.getRowModel().rows,e.getState().rowPinning[t],t],(t,n,r)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(n??[]).map(s=>{const u=e.getRow(s,!0);return u.getIsAllParentsExpanded()?u:null}):(n??[]).map(s=>t.find(u=>u.id===s))).filter(Boolean).map(s=>({...s,position:r}))},mt(e.options,"debugRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=ht(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const a=new Set([...n??[],...r??[]]);return t.filter(o=>!a.has(o.id))},mt(e.options,"debugRows"))}},fq={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Va("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):a.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),a={...n};return e.getRowModel().rows.forEach(o=>{$w(a,o.id,r,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?X0(e,n):{rows:[],flatRows:[],rowsById:{}},mt(e.options,"debugTable")),e.getFilteredSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?X0(e,n):{rows:[],flatRows:[],rowsById:{}},mt(e.options,"debugTable")),e.getGroupedSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?X0(e,n):{rows:[],flatRows:[],rowsById:{}},mt(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(a=>a.getCanSelect()&&!n[a.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(a=>!n[a.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const a=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=typeof n<"u"?n:!a,e.getCanSelect()&&a===n)return o;const u={...o};return $w(u,e.id,n,(s=r==null?void 0:r.selectChildren)!=null?s:!0,t),u})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return ib(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Gw(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Gw(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var a;n&&e.toggleSelected((a=r.target)==null?void 0:a.checked)}}}},$w=(e,t,n,r,a)=>{var o;const s=a.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=s.subRows)!=null&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(u=>$w(e,u.id,n,r,a))};function X0(e,t){const n=e.getState().rowSelection,r=[],a={},o=function(s,u){return s.map(d=>{var m;const p=ib(d,n);if(p&&(r.push(d),a[d.id]=d),(m=d.subRows)!=null&&m.length&&(d={...d,subRows:o(d.subRows)}),p)return d}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:a}}function ib(e,t){var n;return(n=t[e.id])!=null?n:!1}function Gw(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let a=!0,o=!1;return e.subRows.forEach(s=>{if(!(o&&!a)&&(s.getCanSelect()&&(ib(s,t)?o=!0:a=!1),s.subRows&&s.subRows.length)){const u=Gw(s,t);u==="all"?o=!0:(u==="some"&&(o=!0),a=!1)}}),a?"all":o?"some":!1}const qw=/([0-9]+)/gm,hq=(e,t,n)=>tC(Dl(e.getValue(n)).toLowerCase(),Dl(t.getValue(n)).toLowerCase()),mq=(e,t,n)=>tC(Dl(e.getValue(n)),Dl(t.getValue(n))),pq=(e,t,n)=>sb(Dl(e.getValue(n)).toLowerCase(),Dl(t.getValue(n)).toLowerCase()),gq=(e,t,n)=>sb(Dl(e.getValue(n)),Dl(t.getValue(n))),vq=(e,t,n)=>{const r=e.getValue(n),a=t.getValue(n);return r>a?1:rsb(e.getValue(n),t.getValue(n));function sb(e,t){return e===t?0:e>t?1:-1}function Dl(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function tC(e,t){const n=e.split(qw).filter(Boolean),r=t.split(qw).filter(Boolean);for(;n.length&&r.length;){const a=n.shift(),o=r.shift(),s=parseInt(a,10),u=parseInt(o,10),d=[s,u].sort();if(isNaN(d[0])){if(a>o)return 1;if(o>a)return-1;continue}if(isNaN(d[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}return n.length-r.length}const Id={alphanumeric:hq,alphanumericCaseSensitive:mq,text:pq,textCaseSensitive:gq,datetime:vq,basic:yq},wq={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Va("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const a of n){const o=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Id.datetime;if(typeof o=="string"&&(r=!0,o.split(qw).length>1))return Id.alphanumeric}return r?Id.text:Id.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Ev(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Id[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const a=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(s=>{const u=s==null?void 0:s.find(D=>D.id===e.id),d=s==null?void 0:s.findIndex(D=>D.id===e.id);let m=[],p,g=o?n:a==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?u?p="toggle":p="add":s!=null&&s.length&&d!==s.length-1?p="replace":u?p="toggle":p="replace",p==="toggle"&&(o||a||(p="remove")),p==="add"){var w;m=[...s,{id:e.id,desc:g}],m.splice(0,m.length-((w=t.options.maxMultiSortColCount)!=null?w:Number.MAX_SAFE_INTEGER))}else p==="toggle"?m=s.map(D=>D.id===e.id?{...D,desc:g}:D):p==="remove"?m=s.filter(D=>D.id!==e.id):m=[{id:e.id,desc:g}];return m})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,a;const o=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(a=t.options.enableMultiRemove)!=null)||a)?!1:s==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(a=>a.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(a=>a.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},bq={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Va("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const a=e.columns;return(n=a.length?a.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ht(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),mt(t.options,"debugRows")),e.getVisibleCells=ht(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,a)=>[...n,...r,...a],mt(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ht(()=>[r(),r().filter(a=>a.getIsVisible()).map(a=>a.id).join("_")],a=>a.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),mt(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,o)=>({...a,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Jh(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const g2=[$G,bq,cq,dq,KG,wq,sq,JG,uq,fq,GG];function Dq(e){var t;e.debugAll||e.debugTable;let n={_features:g2};const r=n._features.reduce((p,g)=>Object.assign(p,g.getDefaultOptions==null?void 0:g.getDefaultOptions(n)),{}),a=p=>n.options.mergeOptions?n.options.mergeOptions(r,p):{...r,...p};let s={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(p=>{var g;s=(g=p.getInitialState==null?void 0:p.getInitialState(s))!=null?g:s});const u=[];let d=!1;const m={_features:g2,options:{...r,...e},initialState:s,_queue:p=>{u.push(p),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{n.setState(n.initialState)},setOptions:p=>{const g=vl(p,n.options);n.options=a(g)},getState:()=>n.options.state,setState:p=>{n.options.onStateChange==null||n.options.onStateChange(p)},_getRowId:(p,g,w)=>{var D;return(D=n.options.getRowId==null?void 0:n.options.getRowId(p,g,w))!=null?D:`${w?[w.id,g].join("."):g}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(p,g)=>{let w=(g?n.getPrePaginationRowModel():n.getRowModel()).rowsById[p];if(!w&&(w=n.getCoreRowModel().rowsById[p],!w))throw new Error;return w},_getDefaultColumnDef:ht(()=>[n.options.defaultColumn],p=>{var g;return p=(g=p)!=null?g:{},{header:w=>{const D=w.header.column.columnDef;return D.accessorKey?D.accessorKey:D.accessorFn?D.id:null},cell:w=>{var D,S;return(D=(S=w.renderValue())==null||S.toString==null?void 0:S.toString())!=null?D:null},...n._features.reduce((w,D)=>Object.assign(w,D.getDefaultColumnDef==null?void 0:D.getDefaultColumnDef()),{}),...p}},mt(e,"debugColumns")),_getColumnDefs:()=>n.options.columns,getAllColumns:ht(()=>[n._getColumnDefs()],p=>{const g=function(w,D,S){return S===void 0&&(S=0),w.map(T=>{const E=WG(n,T,S,D),A=T;return E.columns=A.columns?g(A.columns,E,S+1):[],E})};return g(p)},mt(e,"debugColumns")),getAllFlatColumns:ht(()=>[n.getAllColumns()],p=>p.flatMap(g=>g.getFlatColumns()),mt(e,"debugColumns")),_getAllFlatColumnsById:ht(()=>[n.getAllFlatColumns()],p=>p.reduce((g,w)=>(g[w.id]=w,g),{}),mt(e,"debugColumns")),getAllLeafColumns:ht(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(p,g)=>{let w=p.flatMap(D=>D.getLeafColumns());return g(w)},mt(e,"debugColumns")),getColumn:p=>n._getAllFlatColumnsById()[p]};Object.assign(n,m);for(let p=0;p{var s;return(s=o.getValue())!=null?s:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:a,getContext:ht(()=>[e,n,t,o],(s,u,d,m)=>({table:s,column:u,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),mt(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(o,n,t,e)},{}),o}const lb=(e,t,n,r,a,o,s)=>{let u={id:t,index:r,original:n,depth:a,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(u._valuesCache.hasOwnProperty(d))return u._valuesCache[d];const m=e.getColumn(d);if(m!=null&&m.accessorFn)return u._valuesCache[d]=m.accessorFn(u.original,r),u._valuesCache[d]},getUniqueValues:d=>{if(u._uniqueValuesCache.hasOwnProperty(d))return u._uniqueValuesCache[d];const m=e.getColumn(d);if(m!=null&&m.accessorFn)return m.columnDef.getUniqueValues?(u._uniqueValuesCache[d]=m.columnDef.getUniqueValues(u.original,r),u._uniqueValuesCache[d]):(u._uniqueValuesCache[d]=[u.getValue(d)],u._uniqueValuesCache[d])},renderValue:d=>{var m;return(m=u.getValue(d))!=null?m:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>ZG(u.subRows,d=>d.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let d=[],m=u;for(;;){const p=m.getParentRow();if(!p)break;d.push(p),m=p}return d.reverse()},getAllCells:ht(()=>[e.getAllLeafColumns()],d=>d.map(m=>Sq(e,u,m,m.id)),mt(e.options,"debugRows")),_getAllCellsByColumnId:ht(()=>[u.getAllCells()],d=>d.reduce((m,p)=>(m[p.column.id]=p,m),{}),mt(e.options,"debugRows"))};for(let d=0;dht(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(a,o,s){o===void 0&&(o=0);const u=[];for(let m=0;me._autoResetPageIndex()))}function nC(e,t,n){return n.options.filterFromLeafRows?Tq(e,t,n):Eq(e,t,n)}function Tq(e,t,n){var r;const a=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,u=function(d,m){m===void 0&&(m=0);const p=[];for(let w=0;wht(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let w=0;w{var D;const S=e.getColumn(w.id);if(!S)return;const T=S.getFilterFn();T&&a.push({id:w.id,filterFn:T,resolvedValue:(D=T.resolveFilterValue==null?void 0:T.resolveFilterValue(w.value))!=null?D:w.value})});const s=n.map(w=>w.id),u=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(w=>w.getCanGlobalFilter());r&&u&&d.length&&(s.push("__global__"),d.forEach(w=>{var D;o.push({id:w.id,filterFn:u,resolvedValue:(D=u.resolveFilterValue==null?void 0:u.resolveFilterValue(r))!=null?D:r})}));let m,p;for(let w=0;w{D.columnFiltersMeta[T]=E})}if(o.length){for(let S=0;S{D.columnFiltersMeta[T]=E})){D.columnFilters.__global__=!0;break}}D.columnFilters.__global__!==!0&&(D.columnFilters.__global__=!1)}}const g=w=>{for(let D=0;De._autoResetPageIndex()))}function Cq(){return(e,t)=>ht(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,a)=>{if(!n.rows.length||!(r!=null&&r.length)&&!a)return n;const o=[...r.map(u=>u.id).filter(u=>u!==t),a?"__global__":void 0].filter(Boolean),s=u=>{for(let d=0;dht(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;oht(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{var r;if(!n)return;const a=(r=n.flatRows[0])==null?void 0:r.getUniqueValues(t);if(typeof a>"u")return;let o=[a,a];for(let s=0;so[1]&&(o[1]=m)}}return o},mt(e.options,"debugTable"))}function kq(){return e=>ht(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,a=[],o=r.filter(d=>{var m;return(m=e.getColumn(d.id))==null?void 0:m.getCanSort()}),s={};o.forEach(d=>{const m=e.getColumn(d.id);m&&(s[d.id]={sortUndefined:m.columnDef.sortUndefined,invertSorting:m.columnDef.invertSorting,sortingFn:m.getSortingFn()})});const u=d=>{const m=d.map(p=>({...p}));return m.sort((p,g)=>{for(let D=0;D{var g;a.push(p),(g=p.subRows)!=null&&g.length&&(p.subRows=u(p.subRows))}),m};return{rows:u(n.rows),flatRows:a,rowsById:n.rowsById}},mt(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Aq(e){const t=[],n=r=>{var a;t.push(r),(a=r.subRows)!=null&&a.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Oq(e){return t=>ht(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:a,pageIndex:o}=n;let{rows:s,flatRows:u,rowsById:d}=r;const m=a*o,p=m+a;s=s.slice(m,p);let g;t.options.paginateExpandedRows?g={rows:s,flatRows:u,rowsById:d}:g=Aq({rows:s,flatRows:u,rowsById:d}),g.flatRows=[];const w=D=>{g.flatRows.push(D),D.subRows.length&&D.subRows.forEach(w)};return g.rows.forEach(w),g},mt(t.options,"debugTable"))}function v2(e,t){return e?Fq(e)?O.createElement(e,t):e:null}function Fq(e){return Pq(e)||typeof e=="function"||jq(e)}function Pq(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function jq(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Lq(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=O.useState(()=>({current:Dq(t)})),[r,a]=O.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{a(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const rC={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ì:"i",í:"i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:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z"},Rq=Object.keys(rC).join("|"),_q=new RegExp(Rq,"g");function Hq(e){return e.replace(_q,t=>rC[t])}const ya={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function Bq(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:ya.MATCHES,!n.accessors){const s=y2(e,t,n);return{rankedValue:e,rank:s,accessorIndex:-1,accessorThreshold:n.threshold,passed:s>=n.threshold}}const a=Zq(e,n.accessors),o={rankedValue:e,rank:ya.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=ya.MATCHES?d=m:d>p&&(d=p),d=Math.min(d,p),d>=g&&d>o.rank&&(o.rank=d,o.passed=!0,o.accessorIndex=s,o.accessorThreshold=g,o.rankedValue=u.itemValue)}return o}function y2(e,t,n){return e=w2(e,n),t=w2(t,n),t.length>e.length?ya.NO_MATCH:e===t?ya.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?ya.EQUAL:e.startsWith(t)?ya.STARTS_WITH:e.includes(` ${t}`)?ya.WORD_STARTS_WITH:e.includes(t)?ya.CONTAINS:t.length===1?ya.NO_MATCH:Yq(e).includes(t)?ya.ACRONYM:zq(e,t))}function Yq(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function zq(e,t){let n=0,r=0;function a(d,m,p){for(let g=p,w=m.length;g-1))return ya.NO_MATCH}const u=r-s;return o(u)}function Uq(e,t){return e.rank===t.rank?0:e.rank>t.rank?-1:1}function w2(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=Hq(e)),e}function Vq(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function Zq(e,t){const n=[];for(let r=0,a=t.length;r{const t=O.useRef(null);O.useEffect(()=>(t.current&&x.setIcon(t.current,"pin"),()=>{t.current&&(t.current=null)}),[t]);const n=O.useCallback(async()=>{e.pinned?await Ie.unpinMemoById(e.id):await Ie.pinMemoById(e.id)},[e]);return y.jsx("span",{ref:t,className:mr("pinned-status",e.pinned?"pinned":"not-pinned"),onClick:n})},Gq=({thino:e})=>{const t=O.useRef(null);O.useEffect(()=>(t.current&&x.setIcon(t.current,e.thinoType==="JOURNAL"?"calendar":"check-square"),()=>{t.current&&(t.current=null)}),[t,e==null?void 0:e.thinoType]);const n=O.useCallback(async()=>{if(e.thinoType==="JOURNAL")return;const r=await Ie.updateMemo(e.id,e.content,e.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");r&&Ie.editMemo(r)},[e]);return y.jsx(y.Fragment,{children:e.thinoType!=="JOURNAL"?y.jsx("input",{className:mr("thino-type-status","task-list-item-checkbox"),type:"checkbox",checked:e.thinoType!=="TASK-TODO","data-task":e.thinoType==="TASK-TODO"?"":e.thinoType==="TASK-DONE"?"x":e.thinoType.slice(5),onClick:n}):y.jsx("span",{ref:t,className:"thino-type-status"})})},qq=({id:e,path:t})=>{const n=O.useRef(null);O.useEffect(()=>(n.current&&x.setIcon(n.current,"link"),()=>{n.current&&(n.current=null)}),[]);const r=O.useCallback(()=>{!e||!t||Ie.openThinoByID(e)},[e,t]);return y.jsxs("span",{className:"source-thino",onClick:r,children:[y.jsx("span",{children:t}),y.jsx("span",{ref:n,className:"source-thino-icon"})]})},Jq=({id:e,sourceType:t})=>{const n=O.useRef(null);O.useEffect(()=>{var a;return n.current&&x.setIcon(n.current,((a=Md.find(o=>o.title===t))==null?void 0:a.icon)||"list"),()=>{n.current&&(n.current=null)}},[]);const r=O.useCallback(async()=>{e&&await Ie.openThinoByID(e)},[e]);return y.jsx("span",{ref:n,className:"source-type-icon",onClick:r})},D2=(e,t,n,r)=>{const a=Bq(e.getValue(t),n);return r({itemRank:a}),a.passed},S2=(e,t,n)=>{var a,o;let r=0;return e.columnFiltersMeta[n]&&(r=Uq((a=e.columnFiltersMeta[n])==null?void 0:a.itemRank,(o=t.columnFiltersMeta[n])==null?void 0:o.itemRank)),r===0?Id.alphanumeric(e,t,n):r};function Kq({thinos:e}){var p;q.useReducer(()=>({}),{})[1];const[t,n]=q.useState([]),[r,a]=q.useState(""),o=q.useMemo(()=>[{header:k("Basic Info"),footer:g=>g.column.id,columns:[{accessorKey:"createdAt",header:()=>y.jsx("span",{className:"create-at-header-cell",children:k("Created At")}),cell:g=>g.getValue(),footer:g=>g.column.id,enableColumnFilter:!1},{accessorFn:g=>g.content,id:"content",header:()=>y.jsx("span",{className:"thino-header-cell",children:k("Thino")}),cell:g=>y.jsx(Ua,{memo:g.row.original,type:"table"}),footer:g=>g.column.id,filterFn:"fuzzy",sortingFn:S2},{accessorFn:g=>g.thinoType,id:"thinoType",cell:g=>y.jsx(Gq,{thino:g.row.original}),header:()=>y.jsx("span",{children:k("Thino Type")}),footer:g=>g.column.id},{accessorFn:g=>g.sourceType,id:"sourceType",cell:g=>y.jsx(Jq,{id:g.row.original.id,sourceType:g.getValue()}),header:()=>y.jsx("span",{children:k("Source Type")}),footer:g=>g.column.id}]},{header:k("Additional Info"),footer:g=>g.column.id,columns:[{accessorKey:"pinned",header:()=>y.jsx("span",{children:k("Pinned Status")}),cell:g=>y.jsx($q,{thino:g.row.original}),footer:g=>g.column.id,filterFn:"fuzzy",sortingFn:S2},{accessorKey:"rowStatus",header:()=>y.jsx("span",{children:k("Row status")}),cell:g=>y.jsx("span",{children:g.getValue()==="NORMAL"?"":g.getValue()}),footer:g=>g.column.id},{accessorKey:"path",header:()=>k("Path"),cell:g=>y.jsx(qq,{id:g.row.original.id,path:g.getValue()}),footer:g=>g.column.id}]}],[]),[s,u]=q.useState(()=>e),d=()=>u(g=>e);O.useEffect(()=>{d()},[e]);const m=Lq({data:s,columns:o,filterFns:{fuzzy:D2},initialState:{pagination:{pageSize:20}},state:{columnFilters:t,globalFilter:r},onColumnFiltersChange:n,onGlobalFilterChange:a,globalFilterFn:D2,getCoreRowModel:Iq(),getFilteredRowModel:xq(),getSortedRowModel:kq(),getPaginationRowModel:Oq(),getFacetedRowModel:Cq(),getFacetedUniqueValues:Mq(),getFacetedMinMaxValues:Nq(),debugTable:!1,debugHeaders:!1,debugColumns:!1});return q.useEffect(()=>{var g,w;((g=m.getState().columnFilters[0])==null?void 0:g.id)==="createdAt"&&((w=m.getState().sorting[0])==null?void 0:w.id)!=="createdAt"&&m.setSorting([{id:"createdAt",desc:!1}])},[(p=m.getState().columnFilters[0])==null?void 0:p.id]),y.jsxs("div",{className:"table-view",children:[y.jsx("div",{children:y.jsx(Xg,{value:r||"",onChange:g=>a(String(g)),className:"table-search-bar",placeholder:k("Search all columns...")})}),y.jsxs("table",{children:[y.jsx("thead",{children:m.getHeaderGroups().map(g=>y.jsx("tr",{children:g.headers.map(w=>y.jsx("th",{colSpan:w.colSpan,children:w.isPlaceholder?null:y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:mr(w.column.getCanSort()?"filter-header":"","table-header",w.column.id==="content"?"content-header":""),onClick:w.column.getToggleSortingHandler(),children:[v2(w.column.columnDef.header,w.getContext()),{asc:" 🔼",desc:" 🔽"}[w.column.getIsSorted()]??null]}),w.column.getCanFilter()?y.jsx(Xq,{column:w.column,table:m}):null]})},w.id))},g.id))}),y.jsx("tbody",{children:m.getRowModel().rows.map(g=>y.jsx("tr",{className:mr(g.getValue("pinned")?"pinned":""),children:g.getVisibleCells().map(w=>y.jsx("td",{children:v2(w.column.columnDef.cell,w.getContext())},w.id))},g.id))})]}),y.jsxs("div",{className:"table-nav-bar",children:[y.jsx("button",{className:"prev-start-btn",onClick:()=>m.setPageIndex(0),disabled:!m.getCanPreviousPage(),children:"<<"}),y.jsx("button",{className:"prev-btn",onClick:()=>m.previousPage(),disabled:!m.getCanPreviousPage(),children:"<"}),y.jsx("button",{className:"next-btn",onClick:()=>m.nextPage(),disabled:!m.getCanNextPage(),children:">"}),y.jsx("button",{className:"next-end-btn",onClick:()=>m.setPageIndex(m.getPageCount()-1),disabled:!m.getCanNextPage(),children:">>"}),y.jsxs("span",{className:"table-page-info",children:[y.jsx("div",{children:k("Page")}),y.jsxs("strong",{children:[m.getState().pagination.pageIndex+1," of ",m.getPageCount()]})]}),y.jsxs("span",{className:"table-page-jump",children:["| ",k("Go to page"),":",y.jsx("input",{type:"number",defaultValue:m.getState().pagination.pageIndex+1,onChange:g=>{const w=g.target.value?Number(g.target.value)-1:0;m.setPageIndex(w)},className:"jump-inputer"})]}),y.jsx("select",{value:m.getState().pagination.pageSize,onChange:g=>{m.setPageSize(Number(g.target.value))},children:[10,20,30,40,50].map(g=>y.jsxs("option",{value:g,children:[k("Show")," ",g," ",k("rows")]},g))})]})]})}const Qq=e=>e==="sourceType"?["ALL"]:["ALL","ALL-TASK"];function Xq({column:e,table:t}){var o,s,u,d,m,p,g,w,D;const n=(o=t.getPreFilteredRowModel().flatRows[0])==null?void 0:o.getValue(e.id),r=e.getFilterValue(),a=q.useMemo(()=>typeof n=="number"?[]:Array.from(e.getFacetedUniqueValues().keys()).sort(),[e.getFacetedUniqueValues()]);return typeof n=="number"?y.jsx("div",{children:y.jsxs("div",{className:"filter-input-group",children:[y.jsx(Xg,{type:"number",min:Number(((s=e.getFacetedMinMaxValues())==null?void 0:s[0])??""),max:Number(((u=e.getFacetedMinMaxValues())==null?void 0:u[1])??""),value:(r==null?void 0:r[0])??"",onChange:S=>e.setFilterValue(T=>[S,T==null?void 0:T[1]]),placeholder:`Min ${(d=e.getFacetedMinMaxValues())!=null&&d[0]?`(${(m=e.getFacetedMinMaxValues())==null?void 0:m[0]})`:""}`,className:"filter-input-short"}),y.jsx(Xg,{type:"number",min:Number(((p=e.getFacetedMinMaxValues())==null?void 0:p[0])??""),max:Number(((g=e.getFacetedMinMaxValues())==null?void 0:g[1])??""),value:(r==null?void 0:r[1])??"",onChange:S=>e.setFilterValue(T=>[T==null?void 0:T[0],S]),placeholder:`Max ${(w=e.getFacetedMinMaxValues())!=null&&w[1]?`(${(D=e.getFacetedMinMaxValues())==null?void 0:D[1]})`:""}`,className:"filter-input-short"})]})}):y.jsx(y.Fragment,{children:a.length>1?y.jsxs(y.Fragment,{children:[e.id!=="path"&&e.id!=="content"&&e.id!=="thinoType"&&e.id!=="sourceType"&&y.jsx("datalist",{id:e.id+"list",children:a.slice(0,5e3).map(S=>y.jsx("option",{value:S},S))}),e.id==="thinoType"||e.id==="sourceType"?y.jsx("select",{id:e.id,onChange:S=>e.setFilterValue(S.target.value==="ALL"?"":S.target.value==="ALL-TASK"?"TASK":S.target.value),children:[...Qq(e.id),...a].map(S=>y.jsx("option",{value:S,children:k(S)},S))}):"",e.id!=="thinoType"&&e.id!=="sourceType"?y.jsx(Xg,{type:"text",value:r??"",onChange:S=>e.setFilterValue(S),placeholder:`Search... (${e.getFacetedUniqueValues().size})`,className:"filter-input-long",list:e.id+"list"}):""]}):""})}function Xg({value:e,onChange:t,debounce:n=500,...r}){const[a,o]=q.useState(e);return q.useEffect(()=>{o(e)},[e]),q.useEffect(()=>{const s=setTimeout(()=>{t(a)},n);return()=>clearTimeout(s)},[a]),y.jsx("input",{...r,value:a,onChange:s=>o(s.target.value)})}const eJ=e=>{const{locationState:{query:t},globalState:{memoListView:n,manifest:r},dailyNotesState:{app:a,settings:o}}=O.useContext(wt),{thinos:s}=e,[u,d]=q.useState(xv(s,"day")),m=q.useRef(null),p=O.useRef([]),g=O.useRef(0);O.useEffect(()=>{d(xv(s,"day"))},[s]),O.useEffect(()=>{var N,R;const S=s.filter(F=>F.pinned),T=s.filter(F=>!F.pinned),E=p.current.filter(F=>F.pinned)[0],A=p.current.filter(F=>!F.pinned)[0];if(E&&E.id!==((N=S[0])==null?void 0:N.id)||A&&A.id!==((R=T[0])==null?void 0:R.id)){const F=m.current.closest(".memolist-wrapper");F.scrollTop=F.scrollHeight}else{const F=m.current.closest(".memolist-wrapper");F.scrollTop=F.scrollHeight-g.current,p.current=s}},[s]),O.useEffect(()=>{if(!m.current)return;const S=m.current.closest(".memolist-wrapper");S.scrollTop=S.scrollHeight},[t]),O.useEffect(()=>{if(n==="chat"&&m.current){const S=m.current.closest(".memolist-wrapper");S.scrollTop=S.scrollHeight,g.current=S.scrollHeight-S.scrollTop,p.current=s,S.onscrollend=()=>{g.current=S.scrollHeight-S.scrollTop}}},[m.current]);const w=O.useCallback(()=>{a.setting.open(),a.setting.openTabById(r.id||"obsidian-memos")},[a]),D=O.useMemo(()=>y.jsx(y.Fragment,{children:Object.keys(u).map((S,T)=>y.jsx(y.Fragment,{children:y.jsx(tJ,{thinos:u[S],dayMark:S,handleOpenSettings:w},S+T)}))}),[u]);return y.jsx("div",{ref:m,className:mr("chat-view",`${o==null?void 0:o.chatViewStyle}-style`),children:D})},tJ=({thinos:e,dayMark:t,handleOpenSettings:n})=>{const{dailyNotesState:{settings:r}}=O.useContext(wt),[a,o]=q.useState(!0),s=q.useRef(null),u=p=>{if(x.Keymap.isModifier(p.nativeEvent,"Mod")){const g=x.moment(t,"YYYY-MM-DD");We.setFromAndToQuery(g.startOf("day").valueOf(),g.endOf("day").valueOf());return}o(!a),s.current.scrollIntoView(!0)},d=p=>{Gd(p)},m=O.useMemo(()=>e.map((p,g)=>y.jsxs("div",{className:"thino-bubble right",children:[y.jsx(nJ,{icon:r==null?void 0:r.MomentsIcon}),y.jsx("div",{className:"wrap",children:y.jsx(rJ,{thino:p,handleClickTimeStamp:d},`${p.id}-${x.moment(p.createdAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${g}`)})]},p.id+g)),[e,r==null?void 0:r.MomentsIcon]);return y.jsxs(y.Fragment,{children:[a&&m,y.jsx("div",{className:`thino-chat-day-mark day-mark ${a?"":"folded"}`,onClick:u,children:y.jsx("div",{className:"day-mark-bubble",children:(t==="PINNED"?t+" 📌":t)+(a?"":"...")})})]})},nJ=({icon:e})=>{const t=O.useCallback(()=>{app.setting.open(),app.setting.openTabById(manifest.id||"obsidian-memos")},[]);return y.jsx("div",{ref:n=>{if(e){n==null||n.empty();return}e||n&&x.setIcon(n,"Memos")},className:"icon-img",style:{backgroundImage:`url(${e})`},onClick:t})},rJ=({thino:e,handleClickTimeStamp:t})=>{const n=O.useCallback(async()=>{if(e.thinoType==="JOURNAL")return;const o=await Ie.updateMemo(e.id,e.content,e.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");o&&Ie.editMemo(o)},[e]),r=O.useMemo(()=>y.jsxs("div",{className:"content",children:[y.jsx("div",{className:"time-stamp","data-date":x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),"data-time":x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss"),onClick:()=>{t(e)},children:x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss")}),y.jsx(Ua,{memo:e})]}),[e.content]),a=O.useMemo(()=>y.jsxs("div",{className:"content task",children:[y.jsx("div",{className:"task-inputer",children:y.jsx("input",{className:mr("thino-type-status","task-list-item-checkbox"),type:"checkbox",checked:e.thinoType!=="TASK-TODO","data-task":e.thinoType==="TASK-TODO"?"":e.thinoType==="TASK-DONE"?"x":e.thinoType.slice(5),onClick:n})}),y.jsx("div",{className:"time-stamp","data-date":x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),"data-time":x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss"),onClick:()=>{t(e)},children:x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss")}),y.jsx(Ua,{memo:e})]}),[e.content,e.thinoType]);return e.thinoType==="JOURNAL"?r:a};class aC extends x.Modal{constructor(n){super(n);he(this,"root")}onOpen(){const{contentEl:n,modalEl:r}=this;try{this.root=tK(n,this.close.bind(this)),r.toggleClass("thino-editor-modal",!0),setTimeout(()=>{var a;(a=n.querySelector("textarea"))==null||a.focus(),this.app.workspace.trigger("focus-on-textarea")},10)}catch(a){console.error(a)}}onClose(){this.root.unmount(),this.containerEl&&this.containerEl.empty()}}const aJ=({userIcon:e})=>y.jsx("div",{className:"moments-view-user-icon",ref:t=>{if(e){t==null||t.empty();return}e||t&&x.setIcon(t,"Memos")},style:{backgroundImage:`url(${e})`}}),I2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuZGV2L3N2Z2pzIiB3aWR0aD0iMTQ0MCIgaGVpZ2h0PSI1NjAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDQwIDU2MCI+PGcgbWFzaz0idXJsKCZxdW90OyNTdmdqc01hc2sxMDgwJnF1b3Q7KSIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjE0NDAiIGhlaWdodD0iNTYwIiB4PSIwIiB5PSIwIiBmaWxsPSIjMGUyYTQ3Ij48L3JlY3Q+PHVzZSB4bGluazpocmVmPSIjU3ZnanNTeW1ib2wxMDg3IiB4PSIwIiB5PSIwIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1N5bWJvbDE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5MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2OTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI2OTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48L3N5bWJvbD48L3N2Zz4=",oJ=e=>{const{globalState:{memoListView:t,markMemoId:n,manifest:r,editMemoId:a},dailyNotesState:{app:o,settings:s}}=O.useContext(wt),{thinos:u}=e,d=q.useRef(null),m=q.useRef(null),[p,g]=q.useState(!1);O.useEffect(()=>{d.current.closest(".workspace-window")&&g(!0)},[d.current]),O.useEffect(()=>{n&&g(!0)},[n]),O.useEffect(()=>{a?(g(!0),setTimeout(()=>{o.workspace.trigger("focus-on-textarea")},200)):g(!1)},[a]),O.useEffect(()=>{m.current&&(!p&&x.setIcon(m.current,"camera"),p&&x.setIcon(m.current,"camera-off"))},[m.current,p]);const w=O.useCallback(()=>{o.setting.open(),o.setting.openTabById(r.id||"obsidian-memos")},[o]);return O.useEffect(()=>{},[p]),y.jsxs("div",{ref:d,className:mr("moments-view",p?"show-editor":""),children:[y.jsxs("div",{className:"moments-view-background-wrapper",children:[y.jsx(iJ,{}),y.jsx("div",{ref:m,className:"moments-show-editor-btn",onClick:()=>{(p||a)&&g(!p),!p&&!a&&new aC(o).open()}}),y.jsxs("div",{className:"moments-view-background-overlay",children:[y.jsxs("div",{className:"moments-view-user-info",children:[y.jsx("div",{className:"moments-view-user-name",children:s==null?void 0:s.UserName}),y.jsx(aJ,{userIcon:s==null?void 0:s.MomentsIcon})]}),y.jsx("div",{className:"moments-view-user-idea",children:s.MomentsQuote||" "})]})]}),u.map((D,S)=>y.jsx(lJ,{thino:D,handleOpenSettings:w},D.createdAt+S))]})},iJ=()=>{const{dailyNotesState:{view:e,settings:t}}=O.useContext(wt),[n,r]=O.useState((t==null?void 0:t.MomentsBackgroundImage)||ew);return O.useEffect(()=>{if(!(t!=null&&t.MomentsBackgroundImage)){r(document.body.hasClass("theme-dark")?I2:ew);return}r(t==null?void 0:t.MomentsBackgroundImage)},[t==null?void 0:t.MomentsBackgroundImage]),O.useEffect(()=>{e&&e.registerEvent(e.app.workspace.on("css-change",()=>{r(document.body.hasClass("theme-dark")&&!(t!=null&&t.MomentsBackgroundImage)?I2:!document.body.hasClass("theme-dark")&&!(t!=null&&t.MomentsBackgroundImage)?ew:t==null?void 0:t.MomentsBackgroundImage)}))},[e]),y.jsx("div",{className:"moments-view-background",style:{backgroundImage:`url(${n})`}})},sJ=e=>{const{icon:t}=e,n=O.useCallback(()=>{app.setting.open(),app.setting.openTabById(manifest.id||"obsidian-memos")},[]);return y.jsx("div",{className:"thino-moment-icon",ref:r=>{if(t){r==null||r.empty();return}t||r&&x.setIcon(r,"Memos")},style:{backgroundImage:`url(${t})`},onClick:n})},lJ=e=>{const{dailyNotesState:{settings:t}}=O.useContext(wt),n=O.useRef(null),r=O.useRef(null),{thino:a}=e;return O.useEffect(()=>{n.current&&x.setIcon(n.current,"more-horizontal")},[n.current]),y.jsxs("div",{className:"thino-moment-wrapper",children:[y.jsx(sJ,{icon:t==null?void 0:t.MomentsIcon}),y.jsxs("div",{ref:r,className:"thino-moment-container",children:[y.jsx("div",{className:"thino-moment-user-name",children:t==null?void 0:t.UserName}),y.jsx("div",{className:"thino-moment-user-content",children:y.jsx(Ua,{memo:a})})]})]})};function cJ(e){const t=e.filter(r=>r.pinned),n=e.filter(r=>!r.pinned);return[...t,...n]}function xv(e,t){const n={},r={day:"YYYY-MM-DD",week:"YYYY-[W]WW",month:"YYYY-MM",quarter:"YYYY-[Q]1",year:"YYYY"};for(const a of e){const o=x.moment(a.createdAt,"YYYY/MM/DD HH:mm:ss").format(r[t]);if(a.pinned){n.PINNED||(n.PINNED=[]),n.PINNED.push(a);continue}n[o]||(n[o]=[]),n[o].push(a)}return n}function Lg(e){const{tag:t,duration:n,type:r,text:a,filter:o}=e,s=tn.getQueryById(o);return!(!!(t||n&&n.from{const r=e.filter(g=>g.rowStatus!=="ARCHIVED"&&!(g.deletedAt!==""&&g.deletedAt)),{tag:a,duration:o,type:s,text:u,filter:d}=t,m=tn.getQueryById(d);return!!(a||o&&o.from{let w=!0;if(g.thinoType!==void 0&&n&&g.thinoType==="TASK-DONE"&&(w=!1),g.content.contains("comment:")&&(w=!1),m){const D=JSON.parse(m.querystring);Array.isArray(D)&&(w=$d(g,D))}if(a){const D=new Set;for(const S of Array.from(g.content.match(An)||[])){const E=S.replace(An,"$1").trim().split("/");let A="";for(const N of E)A+=N,D.add(A),A+="/"}for(const S of Array.from(g.content.match($n)||[])){const E=S.replace($n,"$1").trim().split("/");let A="";for(const N of E)A+=N,D.add(A),A+="/"}for(const S of Array.from(g.content.match(hr)||[])){const E=S.replace(hr,"$2").trim().split("/");let A="";for(const N of E)A+=N,D.add(A),A+="/"}D.has(a)||(w=!1)}return o&&o.fromo.to)&&(w=!1),s&&(s==="NOT_TAGGED"&&(g.content.match(An)!==null||g.content.match(hr)!==null||g.content.match($n)!==null)||s==="LINKED"&&g.content.match(Rc)===null||s==="IMAGED"&&g.content.match(_c)===null||s==="CONNECTED"&&g.content.match(Il)===null)&&(w=!1),u&&!g.content.toLowerCase().includes(u.toLowerCase())&&(w=!1),w}):r.filter(g=>!g.content.contains("comment:"))},dJ=({updateThinos:e})=>{var $;const{locationState:{query:t},memoState:{memos:n},globalState:{memoListView:r},dailyNotesState:{app:a,settings:o,verifyState:s,plugin:u}}=O.useContext(wt),[d,m]=O.useState(!1),[p,g]=O.useState(!1),[w,D,S]=Br([]),[T,E]=O.useState([]),[A,N]=O.useState({}),[R,F]=O.useState(($=window.app||a)==null?void 0:$.loadLocalStorage("thinoListView")),[H,P]=O.useState((a==null?void 0:a.loadLocalStorage("showDayMark"))||!1),[L,z]=O.useState((a==null?void 0:a.loadLocalStorage("dayMarkRange"))||"day"),[U,W,K]=Br([]),ae=O.useRef(0),ce=O.useRef(!1),fe=O.useRef(null),ie=O.useRef(null),ge=O.useRef(null),Te=O.useRef(null),se=O.useRef(!1);O.useEffect(()=>{F(r),a&&a.saveLocalStorage("thinoListView",r),D(U.slice(0,w.length>20?Math.min(w.length,40):40))},[r]),O.useEffect(()=>()=>{ie.current&&(ie.current=null),ge.current&&(ge.current=null),Te.current&&(Te.current=null)},[]),O.useLayoutEffect(()=>{if((n.length!==0||!a)&&se.current===!0)return;const X=fJ(a);!X||X.length===0||(W(X),E(X),P((a==null?void 0:a.loadLocalStorage("showDayMark"))||!1),a!=null&&a.loadLocalStorage("showDayMark")&&N(xv(X,(a==null?void 0:a.loadLocalStorage("dayMarkRange"))||"day")))},[a]),O.useEffect(()=>{if(n.length===0&&!Ie.initialized)return;m(!1);const X=cJ(n),ve=uJ({tempMemos:X,query:t,HideDoneTasks:(o==null?void 0:o.HideDoneTasks)||!1});return se.current=!0,e&&e(ve),W(ve),()=>{se.current=!1}},[n,t,o==null?void 0:o.HideDoneTasks]),O.useEffect(()=>{D(U.slice(0,w.length>20?Math.min(w.length,40):40))},[U]),O.useEffect(()=>{var X;w.length<40&&((X=ge.current)==null||X.click())},[U]),O.useEffect(()=>{(Lg(t)&&w.length0||!Lg(t)&&w.length===U.length&&U.length>0)&&g(!0),hJ(w||[],a),E(w),a==null||a.saveLocalStorage("showDayMark",o==null?void 0:o.showDayMark),a==null||a.saveLocalStorage("dayMarkRange",o==null?void 0:o.dayMarkRange),P((o==null?void 0:o.showDayMark)||!1),z((o==null?void 0:o.dayMarkRange)||"day"),o!=null&&o.showDayMark&&N(xv(w,o==null?void 0:o.dayMarkRange))},[w,o==null?void 0:o.showDayMark,o==null?void 0:o.dayMarkRange]),O.useEffect(()=>{if(!ie.current)return;const X=async()=>{ce.current||(ae.current++,await we(),ae.current>=1&&(ce.current=!0,setTimeout(()=>{ae.current=0,ce.current=!1},3e3)))};w.length<40&&X();const ve=new IntersectionObserver(([De])=>{if(De.isIntersecting){if(p)return;X()}else ae.current=0,ce.current=!1});return ie!=null&&ie.current&&ve.observe(ie.current),()=>{ie!=null&&ie.current&&ve.unobserve(ie.current)}},[d,p,ie.current]),O.useEffect(()=>{var X;(X=Te.current)==null||X.scrollTo({top:0})},[t]);const we=async()=>{try{if(K.current.length>S.current.length){m(!0);const X=Math.min(S.current.length+40,K.current.length)-S.current.length,ve=K.current.slice(S.current.length,S.current.length+X);D(De=>[...De,...ve]),m(!1),g(ve.length<40)}}catch(X){console.error(X),new x.Notice(X.response.data.message)}},Z=O.useMemo(()=>y.jsx("div",{ref:ie,className:mr("status-text-container",R==="calendar"||R==="table"?"hidden":""),children:y.jsx("p",{className:"status-text",children:d?k("Fetching data..."):p?U.length===0?k("Noooop!"):k("All Data is Loaded 🎉"):y.jsx(y.Fragment,{children:y.jsx("span",{ref:ge,className:"cursor-pointer hover:text-green-600",onClick:we,children:k("fetch more")})})})}),[R,we,U,d,p,ie]);return y.jsxs("div",{className:`memolist-wrapper ${p?"completed":""}`,ref:Te,children:[R==="chat"&&Z,y.jsxs("div",{ref:fe,className:"memolist-container",children:[R==="chat"&&y.jsx(eJ,{thinos:T}),R==="calendar"&&y.jsx(UG,{thinos:U}),R==="table"&&y.jsx(Kq,{thinos:U}),R==="moments"&&y.jsx(oJ,{thinos:T}),R==="list"&&y.jsx(hv,{breakpointCols:1,className:`${R}-view masonry-memolist`,columnClassName:"masonry-memolist-grid_column",children:H?y.jsx(y.Fragment,{children:Object.keys(A).map(X=>y.jsx(ZD,{type:"list",thinos:A[X],dayMark:X,dayMarkRange:L},X))}):T.map((X,ve)=>y.jsx(Ua,{memo:X},`${X.id}-${x.moment(X.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${ve}`))}),R==="waterfall"&&y.jsx(y.Fragment,{children:H&&Object.keys(A).length>0?Object.keys(A).map(X=>y.jsx(ZD,{type:"waterfall",thinos:A[X],dayMark:X,dayMarkRange:L},X)):y.jsx(hv,{breakpointCols:3,className:`${R}-view masonry-memolist`,columnClassName:"masonry-memolist-grid_column",children:T.map((X,ve)=>y.jsx(Ua,{memo:X},`${X.id}-${x.moment(X.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${ve}`))})})]}),R!=="chat"&&Z]})};function oC(e){return`memosListCache:${e}`}function fJ(e){var t;try{const n=oC(e==null?void 0:e.appId),r=Kn.get([n])[n];return r?((t=JSON.parse(r))==null?void 0:t.memos)||[]:[]}catch(n){return console.error(n),[]}}function hJ(e,t){try{if(!e)return;const n=e==null?void 0:e.slice(0,100),r=oC(t==null?void 0:t.appId);Kn.set({[r]:JSON.stringify({memos:n})})}catch(n){console.error(n)}}const Tc=async e=>{const{app:t,settings:n}=rt.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await _A(e);if(!r||r.length===0)return;r.sort((s,u)=>x.moment(s.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(x.moment(u.createdAt,"YYYY/MM/DD HH:mm:ss"))?1:-1);const a=r.filter(s=>!s.deleted),o=r.filter(s=>s.deleted);for(let s=0;s{if(!t||!r||!n||!(t==null?void 0:t.loadLocalStorage("tokenForSync"))||!e.startSync)return;s.current=window.setInterval(async()=>{const w=Jw(t);await Tc(w)},3e4),n.registerInterval(s.current);const g=Jw(t);return Tc(g),()=>{s.current&&window.clearInterval(s.current)}},[n,t,r,e.startSync]);const m=[y.jsx(Om,{thinosCount:u.length,thinos:u},"filter"),y.jsx(dJ,{updateThinos:p=>{d(p)}},"list")];return y.jsx(y.Fragment,{children:a==="chat"?y.jsx(y.Fragment,{children:[y.jsx(ev,{syncThino:Tc},"header"),...m.reverse(),y.jsx(Cd,{className:"mod-editor-bottom",editorType:"inline"},"editor")]}):y.jsx(y.Fragment,{children:o?[y.jsx(ev,{syncThino:Tc},"header"),...m,y.jsx(Cd,{className:"mod-editor-bottom",editorType:"block"},"editor")]:[y.jsx(ev,{syncThino:Tc},"header"),y.jsx(Cd,{editorType:"block"},"editor"),...m]})})}function pJ(e){try{e!=null&&e.saveLocalStorage&&(e==null||e.saveLocalStorage("thinoLastUpdated",x.moment("2000-01-01 00:01:00","YYYY-MM-DD HH:mm:ss").format("x")))}catch(t){console.error(t)}}function Jw(e){try{const t=(e==null?void 0:e.loadLocalStorage)&&(e==null?void 0:e.loadLocalStorage("thinoLastUpdated"));return t||x.moment("2000-01-01 00:01:00","YYYY-MM-DD HH:mm:ss").format("x")}catch(t){return console.error(t),x.moment().format("x")}}function gJ(e){try{e!=null&&e.saveLocalStorage&&(e==null||e.saveLocalStorage("thinoLastUpdated",x.moment().format("x")))}catch(t){console.error(t)}}function Yc(e=!0){const[t,n]=O.useState({isLoading:e,isFailed:!1,isSucceed:!1,isPending:!1});return{...t,setLoading:()=>{n({...t,isLoading:!0,isFailed:!1,isPending:!1,isSucceed:!1})},setFinish:()=>{n({...t,isLoading:!1,isFailed:!1,isPending:!1,isSucceed:!0})},setError:()=>{n({...t,isLoading:!1,isFailed:!0,isPending:!1,isSucceed:!1})},setPending:()=>{n({...t,isLoading:!1,isFailed:!1,isPending:!0,isSucceed:!1})}}}const vJ={text:k("SELECT"),value:""},yJ=e=>{const{className:t,dataSource:n,handleValueChanged:r,value:a}=e,[o,s]=_o(!1),u=O.useRef(null);let d=vJ;for(const g of n)if(g.value===a){d=g;break}O.useEffect(()=>{if(o){const g=w=>{var D;(D=u.current)!=null&&D.contains(w.target)||s(!1)};window.addEventListener("click",g,{capture:!0,once:!0})}},[o]);const m=g=>{r&&r(g.value),s(!1)},p=g=>{g.stopPropagation(),s()};return y.jsxs("div",{className:`selector-wrapper ${t||""}`,ref:u,children:[y.jsxs("div",{className:`current-value-container ${o?"active":""}`,onClick:p,children:[y.jsx("span",{className:"value-text",children:d.text}),y.jsx("span",{ref:g=>{g&&x.setIcon(g,"chevron-right")},className:"btn arrow-text"})]}),y.jsx("div",{className:`items-wrapper ${o?"":"hidden"}`,children:n.map(g=>y.jsx("div",{className:`item-container ${g.value===a?"selected":""}`,onClick:()=>{m(g)},children:g.text},g.value))})]})},bd=O.memo(yJ),cb=e=>{const{destroy:t,queryId:n,type:r="dialog"}=e,[a,o]=O.useState(""),[s,u]=O.useState(r!=="dialog"?[SD()]:[]),d=Yc(!1),[m,p]=O.useState(!1),[g,w]=_o(!1),D=Ie.getState().memos.filter(P=>!(P.deletedAt!==""&&P.deletedAt)).filter(P=>$d(P,s)).length;O.useEffect(()=>{S()},[n]);const S=()=>{const P=tn.getQueryById(n??"");if(P){o(P.title);const L=JSON.parse(P.querystring);return Array.isArray(L)&&u(L),P}},T=P=>{const L=P.target.value;o(L)},E=async()=>{if(!a)return new x.Notice(k("TITLE CANNOT BE NULL!")),null;if(s.length===0)return new x.Notice(k("FILTER CANNOT BE NULL!")),null;if(s.length===1&&s[s.length-1].value.value==="")return new x.Notice(k("Please finish the last filter setting first")),null;let P;try{n&&!n.startsWith("Filter [Temp] ")?(P=await tn.updateQuery(n,a,JSON.stringify(s)),tn.editQuery(P),await tn.getMyAllQueries()):(P=await tn.createQuery(a,JSON.stringify(s)),tn.pushQuery(P),await tn.getMyAllQueries())}catch(L){new x.Notice(L.message)}return P},A=async()=>{switch(r){case"modal":case"inline":if(s.length===0){new x.Notice(k("FILTER CANNOT BE NULL!"));return}if(s.length===1&&s[s.length-1].value.value===""){new x.Notice(k("Please finish the last filter setting first"));return}try{const P=tn.getQueryById(n??"");if(P&&JSON.stringify(s)===P.querystring){We.setMemoFilter(P.id),t();return}const L=tn.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify(s));tn.pushQuery(L),We.setMemoFilter(L.id)}catch(P){new x.Notice(P.message)}t();break;case"dialog":try{if(!await E())return}catch(P){console.error(P),new x.Notice(P.message)}t();break}},N=()=>{if(s.length===0){new x.Notice(k("FILTER CANNOT BE NULL!"));return}if(m){We.setMemoFilter(""),p(!1);return}const P=tn.getQueryById(n??"");if(P&&JSON.stringify(s)===P.querystring){We.setMemoFilter(P.id);return}const L=tn.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify(s));tn.pushQuery(L),We.setMemoFilter(L.id),e.setPreview&&e.setPreview(L.id),p(!0)},R=()=>{if(s.length>0&&s[s.length-1].value.value===""){new x.Notice(k("Please finish the last filter setting first"));return}u([...s,SD()])},F=O.useCallback((P,L)=>{u(z=>{const U=[...z];return U[P]=L,U})},[]),H=O.useCallback(P=>{u(L=>L.filter((U,W)=>W!==P))},[]);return y.jsxs(y.Fragment,{children:[r==="dialog"&&y.jsxs("div",{className:"dialog-header-container",children:[y.jsxs("span",{className:"title-text",children:[y.jsx("span",{className:"icon-text",children:"🔖"}),k(n?"EDIT QUERY":"CREATE QUERY")]}),y.jsx("button",{ref:P=>{P&&x.setIcon(P,"x")},className:"btn close-btn",onClick:t})]}),y.jsxs("div",{className:"dialog-content-container",children:[(r==="dialog"||g)&&y.jsxs("div",{className:"form-item-container input-form-container",children:[y.jsx("span",{className:"normal-text",children:k("TITLE")}),y.jsx("input",{className:"title-input",type:"text",value:a,onChange:T})]}),y.jsxs("div",{className:"form-item-container filter-form-container",children:[y.jsx("span",{className:"normal-text",children:k("FILTER")}),y.jsxs("div",{className:"filters-wrapper",children:[s.map((P,L)=>y.jsx(bJ,{index:L,filter:P,handleFilterChange:F,handleFilterRemove:H},L)),y.jsx("div",{className:"create-filter-btn",onClick:R,children:k("ADD FILTER TERMS")})]})]})]}),y.jsx("div",{className:"dialog-footer-container",children:y.jsxs("div",{className:"btns-container",children:[(r==="inline"||r==="modal")&&y.jsx("button",{className:`btn ${g?"mod-cta":"save-btn"}`,onClick:async()=>{if(!g)w();else{const P=await E();w(!1),t(),P&&We.setMemoFilter(P.id)}},children:k(g?"Set and save":"Save")}),y.jsxs("div",{className:"btns-group-container",children:[y.jsxs("span",{className:`tip-text ${s.length===0&&"hidden"}`,children:[k("MATCH")," Thino ",y.jsx("strong",{children:D})," ",k("TIMES")]}),y.jsx(y.Fragment,{children:r==="inline"&&y.jsx("button",{className:"btn mod-cta",onClick:N,children:k("Preview")})}),y.jsx("button",{className:`btn save-btn ${d.isLoading?"requesting":""}`,onClick:A,children:k(r==="inline"||r==="modal"?"Filter":n?"EDIT":"Save")})]})]})})]})},wJ=e=>{const{index:t,filter:n,handleFilterChange:r,handleFilterRemove:a}=e,{type:o}=n,s=O.useRef(null),u=O.useRef(null),d=O.useRef(n),m=O.useRef(o);O.useEffect(()=>{d.current=e.filter},[n]),O.useEffect(()=>{if(s.current)return o==="TAG"&&!u.current&&(m.current=o,u.current=new dE(s.current,D)),()=>{u.current&&(u.current.destroy(),u.current=null)}},[s,o]);const p=O.useCallback(E=>{["AND","OR"].includes(E)&&r(t,{...n,relation:E})},[n]),g=O.useCallback(async E=>{var A;if(n.type!==E){const{verifyState:N}=rt.getState(),R=!x.Platform.isDesktop&&await((A=window.Capacitor)==null?void 0:A.Plugins.Device.getId()),F=x.Platform.isDesktop?await zn():R.identifier||R.uuid,H=N&&(N==null?void 0:N.appId)===F;if(E==="SOURCE"&&!H){fn();return}const P=Object.values(hl[E].operators);r(t,{...n,type:E,value:{operator:P[0].value,value:""}})}},[n]),w=O.useCallback(E=>{r(t,{...n,value:{...n.value,operator:E}})},[n]),D=O.useCallback(E=>{r(t,{...d.current,value:{...d.current.value,value:E}})},[n]),S=()=>{a(t)},T={TYPE:y.jsx(bd,{className:"value-selector",dataSource:hl.TYPE.values,value:n.value.value,handleValueChanged:D}),LIST:y.jsx(bd,{className:"value-selector",dataSource:hl.LIST.values,value:n.value.value,handleValueChanged:D}),SOURCE:y.jsx(bd,{className:"value-selector",dataSource:hl.SOURCE.values,value:n.value.value,handleValueChanged:D}),TAG:y.jsx("input",{type:"text",id:Math.random().toString(36).substring(7),className:"value-inputer",ref:s,value:n.value.value,onChange:E=>{D(E.target.value)}}),TEXT:y.jsx("input",{type:"text",className:"value-inputer",value:n.value.value,onChange:E=>{D(E.target.value)}}),DATE:y.jsxs("div",{className:"date-inputer",children:[y.jsx(dv,{type:"icon",handleValueChange:D}),y.jsx("input",{type:"text",className:"value-inputer",value:n.value.value,onChange:E=>{D(E.target.value)}})]})};return y.jsxs("div",{className:"memo-filter-input-wrapper",children:[t>0&&y.jsx(bd,{className:"relation-selector",dataSource:t8,value:n.relation,handleValueChanged:p}),y.jsx(bd,{className:"type-selector",dataSource:Object.values(hl),value:n.type,handleValueChanged:g}),y.jsxs(y.Fragment,{children:[Object.keys(hl).includes(o)&&y.jsx(bd,{className:"operator-selector",dataSource:Object.values(hl[o].operators),value:n.value.operator,handleValueChanged:w}),T[o]]}),y.jsx("div",{ref:E=>{E&&x.setIcon(E,"x")},className:"btn remove-btn",onClick:S})]})},bJ=O.memo(wJ);function Kw(e){xm({className:"create-query-dialog"},cb,{queryId:e})}const iC=e=>{var D,S;const{dailyNotesState:{app:t,verifyState:n},locationState:{query:r}}=O.useContext(wt),a=q.useRef(null),[o,s]=q.useState(!1),u=q.useRef(null),[d,m]=q.useState(""),p=zv(a.current,u.current,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,10]}}]});O.useEffect(()=>{o&&p.update&&(p==null||p.update())},[o]),O.useEffect(()=>{a&&x.setIcon(a.current,"filter")},[a]);const g=async()=>{var A;const T=!x.Platform.isDesktop&&await((A=window.Capacitor)==null?void 0:A.Plugins.Device.getId()),E=x.Platform.isDesktop?await zn():T.identifier||T.uuid;return!n||(n==null?void 0:n.appId)!==E?(fn(),!1):!0};return Mm(u,()=>{s(!1),d&&We.getState().query.filter===d&&We.setMemoFilter("")}),y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"thino-inline-filter-wrapper pro",ref:a,onClick:async()=>{await g()&&(x.Platform.isDesktop?(s(!o),await(p==null?void 0:p.update())):new DJ(rt.getState().app,r.filter,E=>{m(E)}).open())}}),y.jsx("div",{ref:u,className:`thino-inline-filter-container ${o?"":"hidden"}`,style:p.styles.popper,children:o&&y.jsx(cb,{type:"inline",queryId:(D=r.filter)!=null&&D.startsWith("Filter [Temp] ")&&!((S=r.filter)!=null&&S.includes("Filter [Temp]"))?"":r.filter,destroy:()=>{s(!1)},setPreview:T=>{m(T)}})})]})};class DJ extends x.Modal{constructor(n,r,a){super(n);he(this,"root");he(this,"setPreview");this.filter=r,this.setPreview=a}onOpen(){var r,a;const{contentEl:n}=this;this.root=Lv(n),this.root.render(y.jsx(Sl,{store:Ee,context:wt,children:y.jsx("div",{className:"thino-inline-filter-container",children:y.jsx(cb,{type:"modal",queryId:(r=this.filter)!=null&&r.startsWith("Filter [Temp] ")&&!((a=this.filter)!=null&&a.includes("Filter [Temp]"))?"":this.filter,destroy:()=>{this.close()},setPreview:o=>{this.setPreview(o)}})})}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const sC=()=>{const{dailyNotesState:{app:e},globalState:{isMobileView:t,showSiderbarInMobileView:n}}=O.useContext(wt),[r]=O.useState(q.createRef());O.useEffect(()=>{if(!r.current)return;const o=r.current;x.setIcon(o,"refresh-cw")},[r.current]);const a=O.useCallback(async()=>{if(!(t&&n)){if(Tc){const o=Jw(e);await Tc(o)}await Ie.fetchAllMemos()}},[]);return y.jsx("span",{className:"refresh-icon",ref:r,onClick:()=>{a(),r&&r.current.firstElementChild.toggleClass("rotate-hidden",!0),setTimeout(()=>{r&&r.current.firstElementChild.toggleClass("rotate-hidden",!1)},1e3)}})},ev=()=>{const{locationState:{query:{filter:e}},globalState:{isMobileView:t},queryState:{queries:n}}=O.useContext(wt),[r,a]=O.useState("THINO");O.useEffect(()=>{const s=tn.getQueryById(e);a(s?s.title:"THINO")},[e,n]);const o=O.useCallback(s=>{s.stopPropagation(),Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"section-header-container memos-header-container",children:[y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:t,children:y.jsx("button",{ref:s=>{s&&x.setIcon(s,"menu")},className:"btn action-btn clickable-icon",onClick:o})}),y.jsx("span",{className:"normal-text",children:r}),y.jsx(sC,{})]}),y.jsxs("div",{className:"memos-header-search-section",children:[y.jsx(h8,{}),y.jsx(f8,{}),y.jsx(iC,{}),y.jsx(Rv,{})]})]})},SJ=()=>{const{dailyNotesState:{settings:e,app:t,verifyState:n},globalState:{manifest:r,showSiderbarInMobileView:a,isMobileView:o}}=O.useContext(wt),[s,u]=O.useState("Memos"),[d,m]=O.useState(!1);O.useEffect(()=>{e&&u(e.UserName)},[e]);const p=O.useCallback(()=>{We.pushHistory("/"),We.clearQuery()},[]),g=()=>{const w=document.querySelector(".memos-sidebar-wrapper"),D=document.querySelector(".menu-btns-popup");D.style.top=70-w.scrollTop+"px",m(!0)};return y.jsxs("div",{className:"user-banner-container",children:[y.jsxs("div",{className:"userinfo-header-container",children:[y.jsxs("span",{className:"username-container",children:[y.jsx("span",{className:"username-text",onClick:p,children:s==="MEMO 😉"?"THINO 😉":s||"THINO"}),y.jsx("span",{className:`user-pro-badge ${n?"activated":""}`,onClick:()=>{t.setting.open(),t.setting.openTabById(r.id||"obsidian-memos")},children:"PRO"})]}),y.jsxs("span",{className:"btn-group",children:[(e==null?void 0:e.DefaultThemeForThino)==="modern"&&!o&&y.jsx(sC,{}),y.jsx("span",{ref:w=>{w&&w.hasChildNodes()||w&&x.setIcon(w,"more-horizontal")},className:"btn action-btn menu-popup-btn",onClick:g}),a&&y.jsx("span",{ref:w=>{w&&w.hasChildNodes()||w&&x.setIcon(w,"x")},className:"btn action-btn",onClick:()=>{Qe.setShowSiderbarInMobileView(!1)}})]}),y.jsx(JA,{shownStatus:d,setShownStatus:m})]}),y.jsx(LT,{statusType:"banner"})]})},T2=()=>{const{queryState:{queries:e},dailyNotesState:{app:t},locationState:{query:{filter:n}}}=O.useContext(wt),r=Yc(),[a,o]=O.useState([]);return O.useEffect(()=>{const s=e.filter(u=>{var d,m;return!((d=u.id)!=null&&d.toString().startsWith("Filter [Temp]"))&&!((m=u.id)!=null&&m.toString().includes("Filter [Temp]"))}).sort((u,d)=>{if(d.pinnedAt&&!u.pinnedAt)return 1;if(u.pinnedAt&&!d.pinnedAt)return-1;const m=Re.getTimeStampByDate(u.pinnedAt||u.createdAt);return Re.getTimeStampByDate(d.pinnedAt||d.createdAt)-m});o(s)},[e]),O.useEffect(()=>{tn.getMyAllQueries().catch(()=>{}).finally(()=>{r.setFinish()})},[t]),y.jsxs("div",{className:"queries-wrapper",children:[y.jsxs("span",{className:"title-text",children:[y.jsx("span",{className:"normal-text",children:k("QUERY")}),y.jsx("span",{ref:s=>{s&&x.setIcon(s,"plus")},className:"btn create-query-btn",onClick:()=>Kw()})]}),y.jsx(lo,{when:r.isSucceed&&a.length===0,children:y.jsx("div",{className:"create-query-btn-container",children:y.jsx("span",{className:"btn",onClick:()=>Kw(),children:k("CREATE FILTER")})})}),y.jsx("div",{className:"queries-container",children:a.map(s=>y.jsx(IJ,{query:s,isActive:s.id===n},`${s.id}-${x.moment(s.createdAt,"YYYY/MM/DD HH:mm:ss").format("x")}`))})]})},IJ=e=>{const{query:t,isActive:n}=e,[r,a]=_o(!1),[o,s]=_o(!1),u=()=>{We.setMemoFilter(n?"":t.id)},d=T=>{T.stopPropagation(),a()},m=()=>{a(!1)},p=async T=>{if(T.stopPropagation(),o)try{await tn.deleteQuery(t.id)}catch(E){new x.Notice(E.message)}else s()},g=T=>{T.stopPropagation(),Kw(t.id)},w=async T=>{T.stopPropagation();try{t.pinnedAt?await tn.unpinQuery(t.id):await tn.pinQuery(t.id),tn.editQuery({...t,pinnedAt:t.pinnedAt?"":Re.getDateTimeString(Date.now())})}catch(E){console.error(E)}},D=()=>{s(!1)},S=O.useMemo(()=>y.jsxs("div",{className:"action-btns-container",children:[y.jsxs("span",{className:"btn",onClick:w,children:[y.jsx("span",{ref:T=>{T&&x.setIcon(T,t.pinnedAt?"pin-off":"pin")},className:"icon-text"}),y.jsx("span",{className:"normal-text",children:t.pinnedAt?k("UNPIN"):k("PIN")})]}),y.jsxs("span",{className:"btn",onClick:g,children:[y.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&x.setIcon(T,"edit")},className:"icon-text"}),y.jsx("span",{className:"normal-text",children:k("EDIT")})]}),y.jsxs("span",{className:`btn delete-btn ${o?"final-confirm":""}`,onClick:p,onMouseLeave:D,children:[y.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&x.setIcon(T,"trash-2")},className:"icon-text"}),y.jsx("span",{className:"normal-text",children:k(o?"CONFIRM!":"DELETE")})]})]}),[t.pinnedAt,o]);return y.jsx(y.Fragment,{children:y.jsxs("div",{className:`query-item-container ${n?"active":""}`,onClick:u,children:[y.jsxs("div",{className:"query-text-container",children:[y.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&x.setIcon(T,"filter")},className:"icon-text"}),y.jsxs("span",{className:"query-text",children:[t.title,t.pinnedAt&&" 📌"]})]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&x.setIcon(T,"more-horizontal")},className:"btn action-btn toggle-btn",onClick:d}),y.jsx("div",{className:`action-btns-wrapper ${r?"":"hidden"}`,onMouseLeave:m,children:S})]})]})})},E2=()=>{var p;const{locationState:{query:{tag:e}},dailyNotesState:{app:t},memoState:{tags:n,tagsNum:r,memos:a}}=O.useContext(wt),[o,s]=O.useState([]),[u,d]=O.useState(((p=t||app)==null?void 0:p.loadLocalStorage("thino-tag-sort-order"))||"alphabetical");O.useEffect(()=>{var w;const g=(w=t||app)==null?void 0:w.loadLocalStorage("thino-temp-tags");s(g||[])},[]),O.useEffect(()=>{Ie.updateTagsState()},[a]),O.useEffect(()=>{const g=Array.from(n).sort(),w={subTags:[]};for(const D of g){const S=D.split("/");let T=w,E="";for(let A=0;A{var g;Ie.initialized&&((g=t||app)==null||g.saveLocalStorage("thino-temp-tags",o))},[o]);const m=g=>{g.stopPropagation();const w=new x.Menu;for(const D of["alphabetical","alphabeticalReverse","byCount","byCountReverse"])w.addItem(S=>{S.setTitle(k(D)).onClick(()=>{d(D),t==null||t.saveLocalStorage("thino-tag-sort-order",D)}).setChecked(u===D)}),D==="alphabeticalReverse"&&w.addSeparator();w.showAtMouseEvent(g.nativeEvent)};return y.jsxs("div",{className:"tags-wrapper",children:[y.jsxs("div",{className:"tags-header title-text",children:[y.jsx("span",{className:"normal-text",children:k("Frequently Used Tags")}),y.jsx("span",{ref:g=>{g&&x.setIcon(g,"arrow-down-narrow-wide")},className:"tags-sort-btn",onClick:m})]}),y.jsxs("div",{className:"tags-container",children:[o.sort(TJ(u)).map((g,w)=>y.jsx(lC,{tag:g,tagQuery:e},g.text+"-"+w)),y.jsx(lo,{when:o.length<5&&Ie.initialized,children:y.jsxs("span",{className:"tag-tip-container",children:[k("Input")," ",y.jsxs("span",{className:"code-text",children:[k("#Tag")," "]}),k("to create tag"),"..."]})})]})]})},lC=e=>{const{tag:t,tagQuery:n}=e,r=n===t.text,a=t.subTags.length>0,[o,s]=_o(!1),u=()=>{r?We.setTagQuery(""):(Re.copyTextToClipboard(`#${t.text} `),["/","/recycle","/archive","/daily"].includes(We.getState().pathname)||We.setPathname("/"),We.setTagQuery(t.text))},d=m=>{m.stopPropagation(),s()};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tag-item-container ${r?"active":""}`,onClick:u,children:[y.jsxs("div",{className:"tag-text-container",children:[y.jsx("span",{ref:m=>{m&&x.setIcon(m,"hash")},className:"btn tag-btn"}),y.jsx("span",{className:"tag-text",children:t.key})]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{className:"tag-count",children:t.count}),a?y.jsx("span",{ref:m=>{m&&x.setIcon(m,"chevron-right")},className:`btn action-btn toggle-btn ${o?"shown":""}`,onClick:d}):null]})]}),a?y.jsx("div",{className:`subtags-container ${o?"":"hidden"}`,children:t.subTags.map((m,p)=>y.jsx(lC,{tag:m,tagQuery:n},m.text+"-"+p))}):null]})},x2=new Intl.Collator(void 0,{usage:"sort",sensitivity:"base",numeric:!0}).compare,tw={alphabetical:(e,t)=>x2(e.text,t.text),alphabeticalReverse:(e,t)=>-x2(e.text,t.text),byCount:(e,t)=>t.count-e.count,byCountReverse:(e,t)=>e.count-t.count},TJ=(e="byCount")=>tw.hasOwnProperty(e)?tw[e]:tw.alphabetical;class Ke extends x.Setting{constructor(n,r){super(n);he(this,"settingTab");he(this,"name","");he(this,"desc","");this.settingTab=r}setName(n){return super.setName(n),this.name=n,this}setDesc(n){return super.setDesc(n),this.desc=n,this}setTab(n){const r=typeof this.name=="string"?this.name:this.name.textContent||"",a=typeof this.desc=="string"?this.desc:this.desc.textContent||"";return this.settingTab.addSettingToMasterSettingsList(n,this.settingEl,r,a),this}}class EJ extends x.Modal{constructor(n,r,a,o,s){super(n);he(this,"plugin");he(this,"settingTab");he(this,"target",5);he(this,"cb");this.app=n,this.settingTab=r,this.plugin=a,this.target=o,this.cb=s}onOpen(){var u;const{contentEl:n}=this;(u=n.parentElement)==null||u.classList.add("memo-save-location-modal"),n.createEl("h3",{text:k("Thino Daily Target")});const r=n.createDiv("modal-setting");new Ke(r,this.settingTab).setName(k("Target Thino Count")).addSlider(d=>{d.setDynamicTooltip().setValue(this.target).setLimits(1,30,1).onChange(async m=>{this.target=m})});const a=n.createDiv("button-group"),o=a.createEl("button",{text:k("Cancel")}),s=a.createEl("button",{text:k("Save")});s.onclick=async()=>{this.plugin.settings.MemoDailyTarget=this.target,this.settingTab.applySettingsUpdate(),this.cb(this.target),this.close()},o.onclick=async()=>{this.close()}}onClose(){const{contentEl:n}=this;n.empty()}}const xJ=({allStat:e,todayTimeStamp:t,calendarType:n,handleCalendarTypeChange:r})=>{const{dailyNotesState:{app:a,settings:o},globalState:{manifest:s}}=O.useContext(wt),[u,d]=O.useState(),[m,p]=O.useState(5),[g,w]=O.useState(0),[D,S]=O.useState(0),[T,E]=O.useState(o.HeatmapColorScheme||"default"),A=O.useRef(null),N=O.useRef(null);O.useEffect(()=>{o.HeatmapColorScheme&&E(o.HeatmapColorScheme)},[o.HeatmapColorScheme]),O.useEffect(()=>{let F,H=5;s&&a&&(F=a==null?void 0:a.plugins.getPlugin(s.id),H=F==null?void 0:F.settings.MemoDailyTarget,d(F)),p(H)},[s,a]),O.useEffect(()=>{const F=e.find(L=>L.timestamp===t),H=F?F.count:0;S(H);const P=Math.min(100,H/m*100);w(P)},[e,m]),O.useEffect(()=>{x.requireApiVersion("1.4.4")&&(x.setTooltip(N.current,g.toFixed(2)+"%"),x.setTooltip(A.current,k("Set daily target")+` (${D}/${m})`))},[g,D]),O.useEffect(()=>{A.current&&(A.current.hasChildNodes()||x.setIcon(A.current,"crosshair"),x.requireApiVersion("1.4.4")&&x.setTooltip(N.current,g+"%"))},[A,m]);const R=O.useCallback(()=>{if(!u)return;new EJ(a,u==null?void 0:u.settingTab,u,m,H=>{p(H)}).open()},[u,m]);return y.jsx(y.Fragment,{children:y.jsxs("div",{className:`usage-daily-progress-wrapper heatmap-${T}`,children:[y.jsx("div",{ref:N,className:"daily-progress-bar",children:y.jsx("div",{className:"daily-progress-bar-inner",style:{width:`${g}%`}})}),y.jsx("div",{ref:A,className:"daily-progress-target",onClick:R}),y.jsx("div",{ref:F=>{F&&x.setIcon(F,n==="basic"?"layout-grid":"calendar"),F&&x.setTooltip&&x.setTooltip(F,k("Switch calendar type"))},className:"switch-calendar-type-btn",onClick:()=>r&&r(n==="basic"?"heatmap":"basic")})]})})},CJ=e=>{const{className:t,view:n,datestamp:r,handleDateStampChange:a,handleDateItemClick:o,handleMonthChange:s,dailyStat:u}=e,d=x.moment().startOf("day").valueOf(),[m,p]=O.useState(_h(r)),[g,w]=O.useState(null);O.useEffect(()=>{p(_h(r))},[r]);const D=new Date(m),S=D.getDay(),T=[];for(let N=0;N{const R=D.getFullYear(),F=D.getMonth()+1;let H=0;F===1&&N===-1?H=new Date(`${R-1}/12/1`).getTime():F===12&&N===1?H=new Date(`${R+1}/1/1`).getTime():H=new Date(`${R}/${F+N}/1`).getTime(),p(_h(H)),s&&s(H)};return y.jsxs("div",{className:`heatmap-date-picker-wrapper ${t}`,children:[y.jsxs("div",{className:"date-picker-header",children:[y.jsx("span",{ref:N=>{N&&x.setIcon(N,"chevron-left")},className:"btn btn-text",onClick:()=>A(-1)}),y.jsxs("span",{className:"normal-text",children:[y.jsx(zT,{year:D.getFullYear().toString(),handleYearChange:N=>{p(_h(new Date(`${N}/${D.getMonth()+1}/1`).getTime()))}}),y.jsx(UT,{month:D.getMonth().toString(),handleMonthChange:N=>{p(_h(new Date(`${D.getFullYear()}/${parseInt(N)}/1`).getTime()))}})]}),y.jsx("span",{ref:N=>{N&&x.setIcon(N,"chevron-right")},className:"btn btn-text",onClick:()=>A(1)})]}),y.jsxs("div",{className:"date-picker-day-container",children:[y.jsx("div",{className:"date-picker-day-header",children:k("weekDaysShort").map(N=>y.jsx("span",{className:"day-item",children:N},N))}),y.jsx("div",{className:"date-picker-day-content",children:T.map(N=>{if(N.date===0)return y.jsx("span",{className:"day-item null",children:""},N.datestamp);const R=u.find(P=>P.timestamp===N.datestamp)||{count:0,timestamp:N.datestamp,list:0},F=R.count-R.list,H=R.list;return y.jsxs("span",{className:`day-item ${N.datestamp===d?"current":""} ${N.datestamp===g?"selected":""} ${nw(R.count)}`,onClick:P=>{a(r,P.nativeEvent),w(N.datestamp===g?null:N.datestamp),o&&o(P,R)},onMouseOver:P=>{if(!R||!R.count)return;const L=new x.HoverPopover(n,P.currentTarget,100);MJ(L,{d:N,list:H,task:F})},children:[y.jsx("span",{className:"day-item-text",children:N.date}),y.jsx(y.Fragment,{children:R&&R.count!==0&&y.jsxs("span",{className:"day-item-dots",children:[F>0&&y.jsx("div",{className:`day-item-dot thino-task-dot ${nw(F)}`}),H>0&&y.jsx("div",{className:`day-item-dot thino-list-dot ${nw(H)}`})]})})]},N.datestamp)})})]})]})};function MJ(e,{d:t,list:n,task:r}){e.hoverEl.toggleClass("thino-hover-popover",!0);const a=e.hoverEl.createDiv({cls:"thino-hover-popover-content"});a.createDiv({cls:"thino-date-item",text:`${x.moment(t.datestamp).format("YYYY-MM-DD")}`});const o=a.createDiv({cls:"thino-task-item"});o.createSpan({cls:"thino-task-item-title-text",text:`${k("Task")}: `}),o.createSpan({cls:"thino-task-item-title-count",text:`${r}`});const s=a.createDiv({cls:"thino-list-item"});s.createSpan({cls:"thino-list-item-title-text",text:`${k("List")}: `}),s.createSpan({cls:"thino-list-item-title-count",text:`${n}`})}function NJ(e){const t=new Date(e),n=new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`);return((n.getMonth()===11?new Date(`${n.getFullYear()+1}/1/1`):new Date(`${n.getFullYear()}/${n.getMonth()+2}/1`)).getTime()-n.getTime())/Ba}function _h(e){const t=new Date(e);return new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`).getTime()}function nw(e){return e<=0?"":e<=1?"stat-day-L1-bg":e<=2?"stat-day-L2-bg":e<=4?"stat-day-L3-bg":"stat-day-L4-bg"}const C2={width:12,height:7},M2=(e,t)=>{const n=[];for(let r=0;r<=e;r++)n.push({timestamp:parseInt(x.moment(t).add(r,"days").format("x")),count:0,list:0});return n},N2=()=>{const e=parseInt(x.moment().endOf("day").format("x")),t=new Date(e).getDay()||7,n=parseInt(x.moment().startOf("day").format("x")),r=new Array(7-(t===7?1:t)).fill(0),a=(C2.width-1)*C2.height+t,o=parseInt(x.moment().startOf("day").subtract(a,"days").format("x")),s=x.moment().startOf("day").subtract(a,"days"),{memoState:{memos:u},dailyNotesState:{view:d,app:m,settings:p,verifyState:g}}=O.useContext(wt),[w,D]=Br(AJ(m||window.app)||"heatmap"),[S,T]=Br(x.moment().startOf("day").valueOf()),[E,A]=Br(p.HeatmapColorScheme||"default"),[N,R]=Br(M2(a,o)),[F,H]=Br(null),[P,L]=Br(null),[z,U,W]=Br(""),K=O.useRef(null),ae=O.useRef(null);O.useEffect(()=>{const se=M2(a,o),we=u.filter(Z=>!Z.deletedAt&&Z.rowStatus!=="ARCHIVED");for(const Z of we){const X=x.moment(Z.createdAt.replaceAll("/","-"),"YYYY-MM-DD HH:mm:ss").startOf("day").diff(s,"days");X>=0&&X{p.HeatmapColorScheme&&A(p.HeatmapColorScheme)},[p.HeatmapColorScheme]);const ce=O.useCallback((se,we)=>{var De;if(H(we),!ae.current)return;const{isMobileView:Z}=Qe.getState(),$=se.target,X=document.querySelector(".memos-sidebar-wrapper");ae.current.style.left=$.offsetLeft-(((De=K.current)==null?void 0:De.offsetLeft)??0)+"px";let ve=$.offsetTop;Z||(ve-=X==null?void 0:X.scrollTop),ae.current.style.top=ve+"px"},[]),fe=O.useCallback(()=>{H(null)},[]),ie=()=>{D(w==="heatmap"?"basic":"heatmap"),kJ(m,w==="heatmap"?"basic":"heatmap"),T(x.moment().startOf("day").valueOf())},ge=O.useCallback(async(se,we)=>{if(we.count===0)return;const Z=We.getState().query.duration,$=Z==null?void 0:Z.from,X=Z==null?void 0:Z.to,ve=x.moment($).diff(X,"day")==0;if($===we.timestamp&&ve)We.setFromAndToQuery(0,0),L(null),U(null);else if($!==we.timestamp&&$>0&&se.shiftKey){const De=x.moment(we.timestamp).endOf("day").diff(X,"day");$===0&&se.shiftKey?U("from"):De<0&&ve&&U("to"),x.moment($).isBefore(we.timestamp)?W.current==="to"?De<0?We.setFromAndToQuery(we.timestamp,X):(We.setFromAndToQuery(parseInt(x.moment(X).startOf("day").format("x")),parseInt(x.moment(we.timestamp).endOf("day").format("x"))),U("from")):W.current==="from"&&(De<0,We.setFromAndToQuery($,parseInt(x.moment(we.timestamp).endOf("day").format("x")))):W.current==="to"?We.setFromAndToQuery(we.timestamp,X):W.current==="from"&&(We.setFromAndToQuery(we.timestamp,parseInt(x.moment($).endOf("day").format("x"))),U("to"))}else if($===0&&se.shiftKey)We.setFromAndToQuery(we.timestamp,parseInt(x.moment().endOf("day").format("x")));else if(we.count>0&&(se.ctrlKey||se.metaKey)){const{app:De,dailyNotes:be}=rt.getState(),ke=kv(x.moment(we.timestamp),be);if(!x.Platform.isMobile)await De.workspace.getLeaf("split").openFile(ke);else{let Be=De.workspace.activeLeaf;Be===null&&(Be=De.workspace.getLeaf(!0)),Be.openFile(ke)}}else we.count>0&&!se.shiftKey&&!se.ctrlKey&&!se.metaKey&&(["/","/recycle"].includes(We.getState().pathname)||We.setPathname("/"),We.setFromAndToQuery(we.timestamp,Re.getTimeStampByDate(x.moment(we.timestamp+Ba).subtract(1,"days").endOf("day").format("YYYY-MM-DD HH:mm:ss"))),L(we))},[]),Te=O.useMemo(()=>y.jsx(CJ,{className:`heatmap-${E}`,view:d,datestamp:S,dailyStat:N,handleMonthChange:se=>{T(se)},handleDateStampChange:se=>{},handleDateItemClick:(se,we)=>ge(se,we)}),[JSON.stringify(N),d,S,E]);return y.jsxs(y.Fragment,{children:[w==="basic"&&Te,w==="heatmap"&&y.jsxs("div",{className:`usage-heat-map-wrapper heatmap-${E}`,ref:K,children:[y.jsxs("div",{className:"day-tip-text-container",children:[y.jsx("span",{className:"tip-text",children:k("weekDaysShort")[0]}),y.jsx("span",{className:"tip-text"}),y.jsx("span",{className:"tip-text",children:k("weekDaysShort")[2]}),y.jsx("span",{className:"tip-text"}),y.jsx("span",{className:"tip-text",children:k("weekDaysShort")[4]}),y.jsx("span",{className:"tip-text"}),y.jsx("span",{className:"tip-text",children:k("weekDaysShort")[6]})]}),y.jsxs("div",{ref:ae,className:"usage-detail-container pop-up "+(F?"":"hidden"),children:[F==null?void 0:F.count," thino ",k("on")," ",y.jsx("span",{className:"date-text",children:x.moment(F==null?void 0:F.timestamp,"x").format("YYYY/MM/DD ddd")})]}),y.jsxs("div",{className:"usage-heat-map",children:[N.map((se,we)=>{const Z=se.count,$=Z<=0?"":Z<=1?"stat-day-L1-bg":Z<=2?"stat-day-L2-bg":Z<=4?"stat-day-L3-bg":"stat-day-L4-bg";return y.jsx("span",{className:`stat-container ${$} ${P===se?"current":""} ${n===se.timestamp?"today":""}`,onMouseEnter:X=>ce(X,se),onMouseLeave:fe,onClick:X=>ge(X,se)},we)}),r.map((se,we)=>y.jsx("span",{className:"stat-container null"},we))]})]}),g&&y.jsx(xJ,{allStat:N,todayTimeStamp:n,calendarType:w,handleCalendarTypeChange:ie})]})};function kJ(e,t){try{e==null||e.saveLocalStorage("calendarType",t)}catch(n){console.error(n)}}function AJ(e){try{return(e==null?void 0:e.loadLocalStorage("calendarType"))||"heatmap"}catch(t){return console.error(t),"heatmap"}}const k2=()=>{const{dailyNotesState:{app:e,settings:t,verifyState:n}}=O.useContext(wt),r=[{name:k("Random Review"),path:"/review",iconID:"star"},{name:k("ARCHIVE"),path:"/archive",iconID:"archive"},{name:k("Recycle bin"),path:"/recycle",iconID:"recycle"}],a=O.useRef([]);return O.useEffect(()=>{a.current.forEach((o,s)=>{o&&x.setIcon(o,r[s].iconID)})},[t,a]),y.jsx(y.Fragment,{children:y.jsx("div",{className:"path-entry-wrapper",children:r.map((o,s)=>y.jsx(y.Fragment,{children:y.jsxs("div",{className:`path-entry-container ${We.getState().pathname===o.path?"active":""} ${t.DeleteThinoDirectly&&o.path==="/recycle"?"hidden":""} ${o.path==="/review"&&"pro"}`,onClick:async()=>{var m;const u=!x.Platform.isDesktop&&await((m=window.Capacitor)==null?void 0:m.Plugins.Device.getId()),d=x.Platform.isDesktop?await zn():u.identifier||u.uuid;if(!n&&(n==null?void 0:n.appId)!==d&&o.path==="/review"){fn();return}We.setPathname(o.path),We.clearQuery(),o.path==="/review"&&We.getState().pathname==="/review"&&e.workspace.trigger("refresh-review-memos")},children:[y.jsx("span",{ref:u=>a.current[s]=u,className:"path-entry-icon"}),y.jsx("span",{className:"path-entry-text",children:o.name})]},s)}))})})},A2=e=>{const{dailyNotesState:{settings:t},locationState:n,globalState:{isMobileView:r,showSiderbarInMobileView:a}}=O.useContext(wt),o=O.useRef(null),s=O.useMemo(()=>u=>{var m,p,g;const d=Qe.getState().showSiderbarInMobileView;if(!d){window.removeEventListener("click",s,{capture:!0});return}(m=o.current)!=null&&m.contains(u.target)||(g=(p=o.current)==null?void 0:p.parentNode)!=null&&g.contains(u.target)&&(d&&u.stopPropagation(),Qe.setShowSiderbarInMobileView(!1),window.removeEventListener("click",s,{capture:!0}))},[]);return O.useEffect(()=>{Qe.setShowSiderbarInMobileView(!1)},[n]),O.useEffect(()=>{a?document.body.classList.add(Hb):document.body.classList.remove(Hb)},[a]),O.useEffect(()=>{r&&a&&window.addEventListener("click",s,{capture:!0})},[r,a]),y.jsxs("aside",{className:mr("memos-sidebar-wrapper",e.className),ref:o,children:[e.children,y.jsx(SJ,{}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="right"?y.jsx(N2,{}):null:y.jsx(N2,{}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="left"?y.jsxs(y.Fragment,{children:[y.jsx(k2,{}),y.jsx(T2,{}),y.jsx(LT,{statusType:"sidebar"})]}):null:y.jsxs(y.Fragment,{children:[y.jsx(k2,{}),y.jsx(T2,{})]}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="right"?y.jsx(y.Fragment,{children:y.jsx(E2,{})}):null:y.jsx(y.Fragment,{children:y.jsx(E2,{})})]})},OJ=()=>{const{dailyNotesState:{settings:e}}=O.useContext(wt),[t,n]=q.useState(""),r=a=>{n(a.target.value)};return y.jsx("div",{className:"locked-screen-wrapper",children:y.jsxs("div",{className:"locked-screen-content",children:[y.jsx("div",{className:"locked-screen-header",children:y.jsx("div",{className:"locked-screen-header-title",children:k("Locked")})}),y.jsx("div",{className:"locked-screen-body",children:y.jsxs("div",{className:"locked-screen-body-content",children:[y.jsxs("div",{className:"locked-screen-body-content-text",children:[y.jsx("div",{className:"locked-screen-body-content-text-title",children:k("Thino is locked")}),y.jsx("div",{className:"locked-screen-body-content-text-desc",children:k("Please unlock Thino by input password")})]}),y.jsxs("div",{className:"locked-screen-body-content-inputer",children:[y.jsx("input",{onChange:r,value:t,type:"password",className:"locked-screen-body-content-input"}),y.jsx("button",{className:"locked-screen-body-content-btn",onClick:()=>{(e==null?void 0:e.password)===t?Qe.setLocked(!1):new x.Notice(k("Password is incorrect"))},children:k("Unlock")})]})]})})]})})};function FJ(){const{dailyNotesState:{settings:e,verifyState:t},locationState:{pathname:n},globalState:{isMobileView:r,memoListView:a,globalEditorShown:o,locked:s}}=O.useContext(wt),u=O.useRef(null);return O.useEffect(()=>{if(!e.needVerify){Qe.setLocked(!1);return}Qe.setLocked(!0)},[e==null?void 0:e.needVerify]),O.useEffect(()=>{if(!u.current)return;(async()=>{var g;const m=!x.Platform.isDesktop&&await((g=window.Capacitor)==null?void 0:g.Plugins.Device.getId()),p=x.Platform.isDesktop?await zn():m.identifier||m.uuid;!t||(t==null?void 0:t.appId)!==p?u.current.toggleClass("hide-pro",!0):u.current.toggleClass("hide-pro",!1)})()},[t,u.current]),y.jsxs(y.Fragment,{children:[s&&y.jsx(OJ,{}),!s&&o&&y.jsx(Cd,{editorType:"block"}),!s&&!o&&y.jsx("section",{ref:u,id:"page-wrapper","data-path":n,className:mr(`memos-${n==="/"?a:"list"}-view`,(e==null?void 0:e.DefaultThemeForThino)==="modern"?"modern":"classic"),children:y.jsxs(y.Fragment,{children:[y.jsx(A2,{sidebarPosition:"left",className:"left-sidebar"}),y.jsx("main",{className:"content-wrapper",children:JJ(n)}),(e==null?void 0:e.DefaultThemeForThino)==="modern"&&!r?y.jsx(A2,{sidebarPosition:"right",className:"right-sidebar"}):null]})})]})}const PJ={"*":y.jsx(FJ,{})},jJ=e=>{const{memo:t,handleDeletedMemoAction:n}=e,{dailyNotesState:r}=O.useContext(wt),a={...t,createdAtStr:Re.getDateTimeString(t.createdAt),deletedAtStr:Re.getDateTimeString(t.deletedAt||t.createdAt)},o=q.useRef(null),s=q.useRef(null),[u,d]=q.useState(""),[m,p]=_o(!1),g={restore:O.useRef(null),delete:O.useRef(null),source:O.useRef(null)};O.useEffect(()=>{s&&(x.setIcon(g.restore.current,"archive-restore"),x.setIcon(g.delete.current,"trash"),x.setIcon(g.source.current,"home"))},[s]),O.useEffect(()=>{if(!o.current||!s.current||o.current.hasChildNodes()&&t.content===u||!r.view)return;const E=r.view;d(t.content),o.current.hasChildNodes()&&o.current.empty();async function A(){var R;await x.MarkdownRenderer.render(r.app,t.content+`
`,o.current,t.path,E);const N=(R=o.current)==null?void 0:R.querySelectorAll(".internal-link");N==null||N.forEach(F=>{const H=F,P=H.getAttribute("data-href");if(!P)return;r.app.metadataCache.getFirstLinkpathDest(P,t.path)||F.classList.add("is-unresolved"),H.addEventListener("mouseover",z=>{z.stopPropagation(),r.app.workspace.trigger("hover-link",{event:z,source:"thino",hoverParent:E.containerEl,targetEl:H,linktext:P,sourcePath:H.href})})})}A()},[t.content,s]);const w=async()=>{if(m)try{await Ie.deleteMemoById(a.id),n(a.id)}catch(E){new x.Notice(E.message)}else p()},D=async()=>{switch(a.sourceType){case"DAILY":await p1(a.id,a.path);break;case"CANVAS":await v1(a.id,a.path);break;case"MULTI":await m1(a.path);break;case"FILE":await g1(a.id,a.path);break}},S=async()=>{try{const E=await Ie.restoreMemoById(a.id),A=r.app,N=A==null?void 0:A.loadLocalStorage("tokenForSync");E&&E.webId&&N&&r.settings.startSync&&await AT(E.webId),E&&Ie.editMemo(E),n(a.id),new x.Notice(k("RESTORE SUCCEED"))}catch(E){new x.Notice(E.message)}},T=()=>{m&&p(!1)};return y.jsxs("div",{ref:s,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:T,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[k("DELETE AT")," ",a.deletedAtStr]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:E=>{E&&x.setIcon(E,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:S,children:k("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:D,children:k("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${m?"final-confirm":""}`,onClick:w,children:k(m?"CONFIRM!":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:o,className:"memo-content-text",onContextMenu:E=>{E.preventDefault(),E.stopPropagation()}})]})},LJ=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:u}=t,d=tn.getQueryById(u);return!!(r||a&&a.from{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),d){const w=JSON.parse(d.querystring);Array.isArray(w)&&(g=$d(p,w))}if(r){const w=new Set;for(const D of Array.from(p.content.match(An)||[])){const T=D.replace(An,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match(hr)||[])){const T=D.replace(hr,"$2").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}w.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match(An)!==null||p.content.match(hr)!==null||p.content.match($n)!==null)||o==="LINKED"&&p.content.match(Rc)===null||o==="IMAGED"&&p.content.match(_c)===null||o==="CONNECTED"&&p.content.match(Il)===null)&&(g=!1),s&&!p.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},RJ=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=O.useContext(wt),r=Yc(),[a,o]=O.useState([]),s=q.useRef(null);O.useEffect(()=>{const m=LJ({memos:n.filter(p=>p.deletedAt!==""&&p.deletedAt),query:e,HideDoneTasks:!1});o(m),r.setFinish()},[n,s.current,e]);const u=O.useCallback(m=>{o(p=>p.filter(g=>g.id!==m))},[]),d=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[y.jsxs("div",{className:"section-header-container",children:[y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:t,children:y.jsx("button",{ref:m=>{m&&x.setIcon(m,"menu")},className:"btn action-btn clickable-icon",onClick:d})}),y.jsx("span",{className:"normal-text",children:k("Recycle bin")}),y.jsxs("span",{className:"go-home-btn",onClick:()=>{We.clearQuery(),We.setPathname("/")},children:["🏠 ",k("Return To Home Page")]})]}),y.jsx(Rv,{})]}),y.jsx(Om,{thinosCount:a.length,thinos:a}),r.isLoading?y.jsx("div",{className:"tip-text-container",children:y.jsx("span",{className:"tip-text",children:k("Fetching data...")})}):a.length===0?y.jsx("div",{className:"tip-text-container",children:y.jsx("span",{className:"tip-text",children:k("Here is No Memos.")})}):y.jsx("div",{className:"deleted-memos-container",children:a.map(m=>y.jsx(jJ,{memo:m,handleDeletedMemoAction:u},`${m.id}-${m.updatedAt}`))})]})},Rg="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%200%2024%2024'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M0%200h24v24H0V0z'%20fill='none'/%3e%3cpath%20d='M19%203H5c-1.1%200-2%20.9-2%202v14c0%201.1.9%202%202%202h14c1.1%200%202-.9%202-2V5c0-1.1-.9-2-2-2zm0%2016H5V5h14v14zM17.99%209l-1.41-1.42-6.59%206.59-2.58-2.57-1.42%201.41%204%203.99z'/%3e%3c/svg%3e",_g="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='currentColor'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='none'%20d='M0%200h24v24H0V0z'/%3e%3cpath%20d='M19%205v14H5V5h14m0-2H5c-1.1%200-2%20.9-2%202v14c0%201.1.9%202%202%202h14c1.1%200%202-.9%202-2V5c0-1.1-.9-2-2-2z'/%3e%3c/svg%3e",_J=()=>{const{globalState:e}=O.useContext(wt),{useTinyUndoHistoryCache:t,shouldHideImageUrl:n,shouldSplitMemoWord:r,shouldUseMarkdownParser:a}=e,o=`👋 你好呀~欢迎使用memos!
* ✨ **开源项目**;
* 😋 精美且细节的视觉样式;
* 📑 体验优良的交互逻辑;`,s=()=>{Qe.setAppSetting({useTinyUndoHistoryCache:!t})},u=()=>{Qe.setAppSetting({shouldSplitMemoWord:!r})},d=()=>{Qe.setAppSetting({shouldHideImageUrl:!n})},m=()=>{Qe.setAppSetting({shouldUseMarkdownParser:!a})},p=async()=>{const g=Ie.getState().memos.map(S=>({...S})),w=JSON.stringify(g),D=document.createElement("a");D.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(w)),D.setAttribute("download","data.json"),D.style.display="none",document.body.appendChild(D),D.click(),document.body.removeChild(D)};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"Memo 显示相关"}),y.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:hw(o)}}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:u,children:[y.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),y.jsx("img",{className:"icon-img",src:r?Rg:_g})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:m,children:[y.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),y.jsx("img",{className:"icon-img",src:a?Rg:_g})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:d,children:[y.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),y.jsx("img",{className:"icon-img",src:n?Rg:_g})]})]}),y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"编辑器"}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:s,children:[y.jsxs("span",{className:"normal-text",children:["启用"," ",y.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),y.jsx("img",{className:"icon-img",src:t?Rg:_g})]})]}),y.jsxs("div",{className:"section-container hidden",children:[y.jsx("p",{className:"title-text",children:"其他"}),y.jsx("div",{className:"btn-container",children:y.jsx("button",{className:"btn export-btn",onClick:p,children:"导出数据(JSON)"})})]})]})},HJ=()=>{const{globalState:{isMobileView:e}}=O.useContext(wt);O.useEffect(()=>{Ie.fetchAllMemos()},[]);const t=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"preference-wrapper",children:[y.jsx("div",{className:"section-header-container",children:y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:e,children:y.jsx("button",{className:"action-btn",onClick:t})}),y.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),y.jsx("div",{className:"sections-wrapper",children:y.jsx(_J,{})})]})},BJ=e=>{const{dailyNotesState:{app:t,settings:n,view:r}}=O.useContext(wt),{memo:a,handleUnarchivedMemoAction:o}=e,s=q.useRef(null),u=q.useRef(null),[d,m]=q.useState(""),p={...a,createdAtStr:Re.getDateTimeString(a.createdAt),deletedAtStr:Re.getDateTimeString(a.deletedAt||a.createdAt)},[g,w]=_o(!1),D={restore:O.useRef(null),delete:O.useRef(null),source:O.useRef(null)};O.useEffect(()=>{u&&(x.setIcon(D.restore.current,"archive-restore"),x.setIcon(D.delete.current,"trash"),x.setIcon(D.source.current,"home"))},[u]),O.useEffect(()=>{if(!s.current||!u.current||s.current.hasChildNodes()&&a.content===d||!r)return;m(a.content),s.current.hasChildNodes()&&s.current.empty();async function N(){var F;await x.MarkdownRenderer.render(t,a.content+`
`,s.current,a.path,r);const R=(F=s.current)==null?void 0:F.querySelectorAll(".internal-link");R==null||R.forEach(H=>{const P=H,L=P.getAttribute("data-href");if(!L)return;t.metadataCache.getFirstLinkpathDest(L,a.path)||H.classList.add("is-unresolved"),P.addEventListener("mouseover",U=>{U.stopPropagation(),t.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:r.containerEl,targetEl:P,linktext:L,sourcePath:P.href})})})}N()},[a.content,u]);const S=async()=>{switch(p.sourceType){case"DAILY":await p1(p.id,p.path);break;case"CANVAS":await v1(p.id,p.path);break;case"MULTI":await m1(p.path);break;case"FILE":await g1(p.id,p.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await Ie.deleteMemoById(p.id);else{const N=await Ie.hideMemoById(p.id);N&&Ie.editMemo(N)}}catch(N){new x.Notice(N.message)}else w()},E=async()=>{try{const N=await Ie.unarchiveMemo(p);N&&Ie.editMemo(N),o(p.id),new x.Notice(k("RESTORE SUCCEED"))}catch(N){new x.Notice(N.message)}},A=()=>{g&&w(!1)};return y.jsxs("div",{ref:u,className:`memo-wrapper ${"memos-"+p.id}`,onMouseLeave:A,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[k("ARCHIVED AT")," ",p.updatedAt]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:N=>{N&&x.setIcon(N,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:D.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:E,children:k("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:D.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:S,children:k("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:D.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:T,children:k(g?"CONFIRM!":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:s,className:"memo-content-text"})]})},YJ=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:u}=t,d=tn.getQueryById(u);return!!(r||a&&a.from{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),d){const w=JSON.parse(d.querystring);Array.isArray(w)&&(g=$d(p,w))}if(r){const w=new Set;for(const D of Array.from(p.content.match(An)||[])){const T=D.replace(An,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match(hr)||[])){const T=D.replace(hr,"$2").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}w.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match(An)!==null||p.content.match(hr)!==null||p.content.match($n)!==null)||o==="LINKED"&&p.content.match(Rc)===null||o==="IMAGED"&&p.content.match(_c)===null||o==="CONNECTED"&&p.content.match(Il)===null)&&(g=!1),s&&!p.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},zJ=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=O.useContext(wt),r=Yc(),[a,o]=O.useState([]),s=q.useRef(null);O.useEffect(()=>{const p=YJ({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});o(p),r.setFinish()},[n,s.current,e]);const u=O.useCallback(p=>{o(g=>g.filter(w=>w.id!==p))},[]),d=O.useCallback(p=>{o(g=>g.filter(w=>w.id!==p))},[]),m=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[y.jsxs("div",{className:"section-header-container",children:[y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:t,children:y.jsx("button",{ref:p=>{p&&x.setIcon(p,"menu")},className:"btn action-btn clickable-icon",onClick:m})}),y.jsx("span",{className:"normal-text",children:k("ARCHIVE")}),y.jsxs("span",{className:"go-home-btn",onClick:()=>{We.clearQuery(),We.setPathname("/")},children:["🏠 ",k("Return To Home Page")]})]}),y.jsx(Rv,{})]}),y.jsx(Om,{thinosCount:a.length,thinos:a}),r.isLoading?y.jsx("div",{className:"tip-text-container",children:y.jsx("p",{className:"tip-text",children:k("Fetching data...")})}):a.length===0?y.jsx("div",{className:"tip-text-container",children:y.jsx("p",{className:"tip-text",children:k("Here is No Memos.")})}):y.jsx("div",{className:"deleted-memos-container",children:a.map(p=>y.jsx(BJ,{memo:p,handleUnarchivedMemoAction:d,handleDeletedMemoAction:u},`${p.id}-${p.updatedAt}`))})]})},UJ=()=>{const{dailyNotesState:{app:e},locationState:{query:t},globalState:{isMobileView:n,changedByMemos:r},memoState:{memos:a}}=O.useContext(wt),o=Yc(),[s,u]=O.useState([]),[d,m]=O.useState([]),p=q.useRef(null),g=q.useRef(null),[w,D]=O.useState(!1),[S,T]=O.useState([]),E=q.useRef([]),A=O.useCallback(({memos:F,query:H,HideDoneTasks:P})=>{const{tag:L,duration:z,type:U,text:W,filter:K}=H,ae=tn.getQueryById(K);return!!(L||z&&z.from{let ie=!0;if(fe.thinoType!==void 0&&P&&fe.thinoType==="TASK-DONE"&&(ie=!1),fe.content.contains("comment:")&&(ie=!1),ae){const ge=JSON.parse(ae.querystring);Array.isArray(ge)&&(ie=$d(fe,ge))}if(L){const ge=new Set;for(const Te of Array.from(fe.content.match(An)||[])){const we=Te.replace(An,"$1").trim().split("/");let Z="";for(const $ of we)Z+=$,ge.add(Z),Z+="/"}for(const Te of Array.from(fe.content.match($n)||[])){const we=Te.replace($n,"$1").trim().split("/");let Z="";for(const $ of we)Z+=$,ge.add(Z),Z+="/"}for(const Te of Array.from(fe.content.match(hr)||[])){const we=Te.replace(hr,"$2").trim().split("/");let Z="";for(const $ of we)Z+=$,ge.add(Z),Z+="/"}ge.has(L)||(ie=!1)}return z&&z.fromz.to)&&(ie=!1),U&&(U==="NOT_TAGGED"&&(fe.content.match(An)!==null||fe.content.match($n)!==null)||U==="LINKED"&&fe.content.match(Rc)===null||U==="IMAGED"&&fe.content.match(_c)===null||U==="CONNECTED"&&fe.content.match(Il)===null)&&(ie=!1),W&&!fe.content.toLowerCase().includes(W.toLowerCase())&&(ie=!1),ie}):F},[]);O.useEffect(()=>{g.current&&(x.setIcon(g.current,"refresh-cw"),e.workspace.on("refresh-review-memos",R))},[g]),O.useEffect(()=>{if(!w)return;const F=[...S].sort(()=>Math.random()-Math.random()).slice(0,10);u(F),D(!1)},[w]),O.useEffect(()=>{if(!(S.length>0))return;const F=[...S].sort(()=>Math.random()-Math.random()).slice(0,10);u(F),D(!1)},[S]),O.useEffect(()=>{p.current&&(T(A({memos:a,query:t,HideDoneTasks:!1}).filter(F=>F.rowStatus!=="ARCHIVED"&&!(F.deletedAt!==""&&F.deletedAt))),o.setFinish(),We.clearQuery())},[a,p.current]),O.useEffect(()=>{if(r&&E.current.length>0){const F=S.filter(P=>E.current.includes(P.id)),H=E.current.map(P=>F.find(L=>L.id===P)).filter(P=>P!==void 0);m(H);return}E.current=s.map(F=>F.id),m(s)},[s]),O.useEffect(()=>{if(s.length===0)return;const F=A({memos:s,query:t,HideDoneTasks:!1});m(F)},[t]);const N=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]),R=()=>{D(!0)};return y.jsxs("div",{className:"memo-review-wrapper",ref:p,children:[y.jsx("div",{className:"section-header-container",children:y.jsxs("div",{className:"title-wrapper",children:[y.jsxs("div",{className:"title-btns-left-wrapper",children:[y.jsx(lo,{when:n,children:y.jsx("button",{ref:F=>{F&&x.setIcon(F,"menu")},className:"btn action-btn clickable-icon",onClick:N})}),y.jsx("span",{className:"normal-text",children:k("Random Review")}),y.jsx("span",{ref:g,onClick:R,className:"refresh-icon"})]}),y.jsx("div",{className:"title-btns-right-wrapper",children:y.jsxs("span",{className:"go-home-btn",onClick:()=>{We.setPathname("/")},children:["🏠 ",k("Return To Home Page")]})})]})}),y.jsx(Om,{}),o.isLoading?y.jsx("div",{className:"tip-text-container",children:y.jsx("span",{className:"tip-text",children:k("Fetching data...")})}):a.length===0?y.jsx("div",{className:"tip-text-container",children:y.jsx("span",{className:"tip-text",children:k("Here is No Memos.")})}):y.jsx("div",{className:"review-memos-container",children:d.map(F=>y.jsx(Ua,{memo:F},`${F==null?void 0:F.id}-${F.createdAt}`))})]})},VJ=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:u}=t,d=tn.getQueryById(u);return!!(r||a&&a.from{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),d){const w=JSON.parse(d.querystring);Array.isArray(w)&&(g=$d(p,w))}if(r){const w=new Set;for(const D of Array.from(p.content.match(An)||[])){const T=D.replace(An,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match(hr)||[])){const T=D.replace(hr,"$2").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}w.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match(An)!==null||p.content.match(hr)!==null||p.content.match($n)!==null)||o==="LINKED"&&p.content.match(Rc)===null||o==="IMAGED"&&p.content.match(_c)===null||o==="CONNECTED"&&p.content.match(Il)===null)&&(g=!1),s&&!p.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},ZJ=O.forwardRef((e,t)=>{const{currentDate:n,setCurrentDateStamp:r}=e,[a,o]=O.useState(!1),s=Re.getDateStampByDate(Re.getDateString(n)),u=O.useRef(null);O.useEffect(()=>{u.current&&(!a&&x.setIcon(u.current,"more-horizontal"),a&&x.setIcon(u.current,"x"))},[u.current,a]);const d=m=>{r(m)};return O.useImperativeHandle(t,()=>({closeDatePicker:()=>{o(!1)}})),y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"date-card-container",children:[y.jsxs("div",{className:"date-container-details",children:[y.jsxs("div",{className:"details-text",children:[x.moment(s,"x").format("dddd")+" ",y.jsx("div",{className:"date-text",children:x.moment(s,"x").format("MMM")+" "+x.moment(s,"x").format("DD")})]}),y.jsx("div",{className:"details-logo-text",children:k("Daily Memos")})]}),y.jsxs("div",{className:"date-container-info",children:[y.jsxs("div",{className:"date-container-info-text",children:["Week ",y.jsx("div",{className:"week-text",children:x.moment(s,"x").format("ww")}),"of ",y.jsx("div",{className:"year-text",children:x.moment(s,"x").format("YYYY")})]}),y.jsx("div",{ref:u,onClick:()=>o(!a)})]})]}),y.jsx(Nm,{className:`date-picker ${a?"":"hidden"}`,datestamp:s,handleDateStampChange:d})]})}),WJ=({thino:e})=>{const t=O.useCallback(()=>{Gd(e)},[]);return y.jsxs("div",{className:"daily-thino-wrapper",children:[y.jsx("div",{className:"time-wrapper",onClick:t,children:y.jsx("span",{className:"normal-text",children:x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm")})}),y.jsx("div",{className:"daily-thino-container",children:y.jsx(Ua,{memo:e})})]})},$J=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n},dailyNotesState:{settings:r,app:a}}=O.useContext(wt),o=Yc(),[s,u]=O.useState([]),[d,m]=O.useState(Re.getDateStampByDate(Re.getDateString(x.moment().format("YYYY-MM-DD HH:mm:ss")))),p=O.useRef(),g=O.useRef(null),w=q.useRef(null),D=O.useRef(null),[S,T]=O.useState(!1);O.useEffect(()=>{D.current&&(x.setIcon&&D&&!S&&x.setIcon(D.current,"share"),x.setIcon&&D&&S&&x.setIcon(D.current,"chrome"))},[D.current,S]),O.useEffect(()=>{const R=VJ({memos:n,query:e,HideDoneTasks:!1}).filter(F=>Re.getTimeStampByDate(F.createdAt)>=d&&Re.getTimeStampByDate(F.createdAt)F.deletedAt==="").sort((F,H)=>Re.getTimeStampByDate(F.createdAt)-Re.getTimeStampByDate(H.createdAt));u(R),o.setFinish()},[n,d,w.current,e]);const E=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]),A=async()=>{var N;p.current&&((N=p==null?void 0:p.current)==null||N.closeDatePicker()),T(!0),setTimeout(()=>{if(!g.current){T(!1);return}let R;document.body.hasClass("theme-dark")?R="#232323":R="#eaeaea",Uv(g.current,{backgroundColor:R,pixelRatio:window.devicePixelRatio*2}).then(F=>{if(r!=null&&r.AutoSaveWhenOnMobile&&x.Platform.isMobile){const H=F.split("base64,")[1];Av(H,"image/png").arrayBuffer().then(async L=>{let z;const U="png",W=ws();for(const K in W)if(W[K]instanceof x.TFile){z=W[K];break}z!==void 0&&await a.vault.createBinary(await vault.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,U,z),L)})}Vv({imgUrl:F}),T(!1)}).catch(()=>{T(!1)})},0)};return y.jsxs("div",{className:"daily-thinos-list-wrapper",ref:w,children:[y.jsxs("div",{className:"section-header-container",children:[y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:t,children:y.jsx("button",{ref:N=>{N&&x.setIcon(N,"menu")},className:"btn action-btn clickable-icon",onClick:E})}),y.jsxs("span",{className:"go-home-btn",onClick:()=>{We.clearQuery(),We.setPathname("/")},children:["🏠 ",k("Return To Home Page")]})]}),y.jsxs("div",{className:"header-right-section",children:[y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-left")},className:"btn btn-text",onClick:()=>m(N=>N-Ba)}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-right")},className:"btn btn-text",onClick:()=>m(N=>N+Ba)}),y.jsx("span",{ref:D,className:mr("btn btn-text share-btn",S?"generating":""),onClick:A})]}),y.jsx(iC,{}),y.jsx(Rv,{})]})]}),y.jsx(Om,{thinosCount:s.length,thinos:s}),y.jsx("div",{className:"daily-thinos-view-wrapper",children:y.jsxs("div",{ref:g,className:"daily-thinos-view-container",children:[y.jsx(ZJ,{ref:p,currentDate:new Date(d),setCurrentDateStamp:m}),o.isLoading?y.jsx("div",{className:"tip-text-container",children:y.jsx("p",{className:"tip-text",children:k("Fetching data...")})}):s.length===0?y.jsx("div",{className:"tip-container",children:y.jsx("p",{className:"tip-text",children:k("Noooop!")})}):y.jsx("div",{className:"daily-thinos-list-container",children:s.map(N=>y.jsx(WJ,{thino:N},`${N.id}-${N.updatedAt}`))})]})})]})},GJ={"/recycle":y.jsx(RJ,{}),"/setting":y.jsx(HJ,{}),"/archive":y.jsx(zJ,{}),"/review":y.jsx(UJ,{}),"/daily":y.jsx($J,{}),"*":y.jsx(mJ,{})},cC=e=>t=>{for(const n of Object.keys(e))if(n===t)return e[n];return e["*"]},qJ=cC(PJ),JJ=cC(GJ);function KJ({app:e}){const{locationState:{pathname:t},dailyNotesState:{settings:n}}=O.useContext(wt);return O.useEffect(()=>{Ie.fetchAllMemos()},[]),!vI()&&!e.plugins.getPlugin("periodic-notes")&&(n!=null&&n.EnabledLocationList.find(r=>r.value==="DAILY"))&&new x.Notice(k("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),y.jsx(Sl,{store:Ee,context:wt,children:qJ(t)})}const Hr="thino_view";class QJ extends x.EditorSuggest{constructor(n,r){super(n);he(this,"root");he(this,"editor");he(this,"cursor");he(this,"plugin");this.plugin=r,this.suggestEl.toggleClass("thino-date-selector",!0)}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}onTrigger(n,r){const o=r.getLine(n.line)[n.ch-1];return this.checkInMemosView(r)&&o==="@"?(this.cursor=n,this.editor=r,x.Platform.isMobile?(new cE(this.app,"text",s=>{this.selectSuggestion(parseInt(s),new MouseEvent("click"))}).open(),null):{start:{line:n.line,ch:n.ch-1},end:n,query:""}):null}getSuggestions(){return[parseInt(x.moment().startOf("day").format("x"))]}renderSuggestion(n,r){r.empty(),this.root=hs.createRoot(r),this.root.render(y.jsx(q.StrictMode,{children:y.jsx(Nm,{className:"editor-date-picker",datestamp:n,handleDateStampChange:this.selectSuggestion.bind(this)})}))}selectSuggestion(n,r){var u,d,m;if(r instanceof KeyboardEvent||r instanceof PointerEvent&&!r.target.closest(".day-item"))return;const a=(u=this.app.workspace.getLeavesOfType("thino_view")[0])==null?void 0:u.view;(d=a==null?void 0:a.contentEl.find(".action-btn.list-or-task.list"))==null||d.click();let o="",s="";switch(this.plugin.settings.InsertDateFormat){case"Dataview":o="[due::",s="]";break;case"Tasks":o="📆";break}this.editor.replaceRange(o+x.moment(n).format("YYYY-MM-DD")+s,{line:this.cursor.line,ch:this.cursor.ch-1},this.cursor),(m=this.root)==null||m.unmount(),this.close()}}class XJ extends x.EditorSuggest{constructor(n,r){super(n);he(this,"root");he(this,"editor");he(this,"cursor");he(this,"plugin");he(this,"memos",[]);this.plugin=r,this.memos=Ie.getState().memos.filter(a=>!a.deletedAt&&a.rowStatus!=="ARCHIVED")}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}fuzzySearchItemsOptimized(n,r){const a=x.prepareFuzzySearch(n);return r.map(o=>{const s=a(o.content);return s?{item:o,match:s}:null}).filter(Boolean)}onTrigger(n,r){if(!this.checkInMemosView(r))return null;const o=r.getLine(n.line).slice(0,n.ch);if(o.lastIndexOf("~")===-1)return null;const s=o.slice(o.lastIndexOf("~")+1,n.ch);if(o[o.lastIndexOf("~")-1]!==" "&&o.lastIndexOf("~")!==0)return null;const u=s.trim();return this.memos=Ie.getState().memos.filter(d=>!d.deletedAt&&d.rowStatus!=="ARCHIVED"),{start:{line:n.line,ch:n.ch-u.length},end:n,query:u}}getSuggestions(n){return n.query?this.fuzzySearchItemsOptimized(n.query,this.memos).sort((a,o)=>o.match.score-a.match.score).map(a=>a.item).map(a=>({time:a.createdAt,id:a.id,content:a.content})):this.memos.map(a=>({time:a.createdAt,id:a.id,content:a.content}))}renderSuggestion(n,r){r.toggleClass("thino-suggestion",!0),r.createEl("div",{cls:"thino-suggestion-time",text:n.time}),r.createEl("div",{cls:"thino-suggestion-container"}).createEl("div",{cls:"thino-suggestion-content",text:n.content})}selectSuggestion(n){const r=n.id;this.context.editor.replaceRange("MARK: [@THINO]("+r+")",{line:this.context.end.line,ch:this.context.start.ch-1},this.context.end)}}class eK{constructor(){he(this,"path","/fake-file-that-generated-for-thino.png");he(this,"basename","fake-file-that-generated-for-thino");he(this,"extension","png");he(this,"deleted",!1);he(this,"name","fake-file-that-generated-for-thino.png");he(this,"parent",null);he(this,"stat");he(this,"vault",null)}static[Symbol.hasInstance](t){return t instanceof x.TFile}setPath(t){}getNewPathAfterRename(t){}getShortName(){}cache(t){}updateCacheLimit(){}}function tK(e,t){try{const n=hs.createRoot(e);return n.render(y.jsx(q.StrictMode,{children:y.jsx(Sl,{store:Ee,context:wt,children:y.jsx(Cd,{editorType:"inline",destroy:t})})})),n}catch(n){console.error(n)}}class yl extends x.ItemView{constructor(n,r){super(n);he(this,"scope",new x.Scope(this.app.scope));he(this,"root");he(this,"mobileHeaderRoot");he(this,"plugin");he(this,"hoverPopover");he(this,"memosComponent");he(this,"editor",null);he(this,"navigation",!1);he(this,"file",new eK);he(this,"handleUpdateInstance",n=>{this.editor=n.editor});this.plugin=r,this.registerScope()}getDisplayText(){return"Thino"}getIcon(){return"Memos"}getViewType(){return Hr}getMode(){return"source"}registerScope(){const{scope:n}=this;n.register(["Mod"],"Enter",()=>{});for(let r=0;r{});n.register([],"i",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-textarea"))}),n.register(["Mod"],"f",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-searchBar"))}),n.register([],"o",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-searchBar"))}),n.register([],"Escape",()=>{setTimeout(()=>{this.plugin.app.workspace.trigger("blur-on-memos")},20)})}async onFileDeleted(n){var d,m,p;const r=Zh(n,"day"),a=n.path.contains(".thino")&&n.path.contains(".canvas"),o=n.path.contains(".thino")&&n.path.contains(".md"),s=((d=this.plugin.settings)==null?void 0:d.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",u=(p=((m=n.parent)==null?void 0:m.path)||n.path)==null?void 0:p.contains(s==null?void 0:s.trim());(r||a&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="CANVAS"))&&(await Ie.removeMemosInFile(n),Ie.updateTagsState()),u&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="MULTI")&&(await Ie.removeMemosInFile(n,s),Ie.updateTagsState()),o&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="FILE")&&(await Ie.removeMemosInFile(n),Ie.updateTagsState())}async onFileModified(n){var d;if(Qe.getState().changedByMemos){Qe.setChangedByMemos(!1);return}const r=Zh(n,"day"),a=n.path.contains(".thino")&&n.path.contains(".canvas"),o=n.path.contains(".thino")&&n.path.contains(".md"),s=((d=this.plugin.settings)==null?void 0:d.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",u=n.parent.path.contains(s==null?void 0:s.trim());if(r||a&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="CANVAS")){await Ie.updateMemosInFile(n),Ie.updateTagsState();return}u&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="MULTI")&&(await Ie.updateMemosInFile(n,s),Ie.updateTagsState()),o&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="FILE")&&(await Ie.updateMemosInFile(n),Ie.updateTagsState())}async onFileCreated(n){var r;if(this.app.workspace.layoutReady&&this.memosComponent){const a=Zh(n,"day"),o=n.path.contains(".thino")&&n.path.contains(".canvas"),s=n.path.contains(".thino")&&n.path.contains(".md"),u=((r=this.plugin.settings)==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",d=n.parent.path.contains(u==null?void 0:u.trim());if(a){await rt.updateDailyNotes(n,!1),await Ie.updateMemosInFile(n),Ie.updateTagsState();return}if(o&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="CANVAS")){await Ie.updateMemosInFile(n),Ie.updateTagsState();return}d&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="MULTI")&&(await Ie.updateMemosInFile(n,u),Ie.updateTagsState()),s&&this.plugin.settings.EnabledLocationList.find(m=>m.value==="FILE")&&(await Ie.updateMemosInFile(n),Ie.updateTagsState())}}async onResize(){var r;super.onResize();const n=this.leaf;if(n&&n.height!==0){if(n.view.containerEl.toggleClass("tiny-view",n.width<600),n.view.containerEl.toggleClass("waterfall-small-group",n.width<1300),n.width>950){n.view.containerEl.classList.toggle("mobile-view",!1),Qe.setIsMobileView(n.width<=950);return}if((r=this.plugin.settings)!=null&&r.ShowLeftSideBar&&!x.Platform.isMobile)return;n.view.containerEl.classList.toggle("mobile-view",!0),Qe.setIsMobileView(n.width<=950)}}appendToHeader(){const n=this.leaf.view.titleContainerEl;n&&(this.mobileHeaderRoot=hs.createRoot(n),this.mobileHeaderRoot.render(y.jsx(q.StrictMode,{children:y.jsx(Sl,{store:Ee,context:wt,children:y.jsx(ev,{})})})))}async onOpen(){this.navigation=this.plugin.settings.navigation,await this.onResize(),this.onFileCreated=this.onFileCreated.bind(this),this.onFileDeleted=this.onFileDeleted.bind(this),this.onFileModified=this.onFileModified.bind(this),x.Platform.isTablet&&document.body.toggleClass("is-tablet",!0),x.Platform.isMobile&&!x.Platform.isTablet&&this.appendToHeader(),this.registerEvent(this.app.vault.on("create",this.onFileCreated)),this.registerEvent(this.app.vault.on("delete",this.onFileDeleted)),this.registerEvent(this.app.vault.on("modify",x.debounce(this.onFileModified,2e3,!0)));try{this.root=hs.createRoot(this.contentEl),rt.setView(this),this.root.render(y.jsx(q.StrictMode,{children:y.jsx(KJ,{app:this.plugin.app})}))}catch(n){console.error(n)}}onunload(){super.onunload(),this.root.unmount()}}const O2={Memos:''};function nK(){Object.keys(O2).forEach(e=>{x.addIcon(e,O2[e])})}class F2 extends uE{fuzzySearchItemsOptimized(t,n){const r=x.prepareFuzzySearch(t);return n.map(a=>{const o=r(a.path);return o?{item:a,match:o,score:o.score}:null}).sort((a,o)=>(o==null?void 0:o.score)-(a==null?void 0:a.score)).filter(Boolean)}getSuggestions(t){const r=app.vault.getFiles().filter(o=>["png","jpg","jpeg","gif"].includes(o.extension)),a=t.toLowerCase();return this.fuzzySearchItemsOptimized(a,r).map(o=>o.item)}renderSuggestion(t,n){var o;const r=t.basename,a=((o=t.parent)==null?void 0:o.path)||"";n.toggleClass("thino-image-suggest-item",!0),n.createSpan({cls:"suggestion-name",text:r}),n.createSpan({cls:"suggestion-path",text:a})}selectSuggestion(t){this.inputEl.value=t.path,this.inputEl.trigger("input"),this.close()}}const ub=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder;const P2=typeof TextEncoder=="function"?new TextEncoder:void 0,rK="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Vh=Array.prototype.slice.call(rK);(e=>{let t={};return e.forEach((n,r)=>t[n]=r),t})(Vh);const Di=String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);const aK=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),oK=e=>{let t,n,r,a,o="";const s=e.length%3;for(let u=0;u255||(r=e.charCodeAt(u++))>255||(a=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|a,o+=Vh[t>>18&63]+Vh[t>>12&63]+Vh[t>>6&63]+Vh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},uC=typeof btoa=="function"?e=>btoa(e):ub?e=>Buffer.from(e,"binary").toString("base64"):oK,iK=ub?e=>Buffer.from(e).toString("base64"):e=>{let n=[];for(let r=0,a=e.length;r{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?Di(192|t>>>6)+Di(128|t&63):Di(224|t>>>12&15)+Di(128|t>>>6&63)+Di(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Di(240|t>>>18&7)+Di(128|t>>>12&63)+Di(128|t>>>6&63)+Di(128|t&63)}},lK=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,cK=e=>e.replace(lK,sK),j2=ub?e=>Buffer.from(e,"utf8").toString("base64"):P2?e=>iK(P2.encode(e)):e=>uC(cK(e)),uK=(e,t=!1)=>t?aK(j2(e)):j2(e),rw=x.Platform.isDesktop&&require("os"),dC=async()=>{var r,a;let e="";if(x.Platform.isDesktop)e=await zn();else{const o=await((r=window.Capacitor)==null?void 0:r.Plugins.Device.getId());e=o.identifier||o.uuid}let t;if(rw)t=JSON.stringify({hostname:rw.hostname(),platform:rw.platform(),machineid:e});else{const o=await((a=window.Capacitor)==null?void 0:a.Plugins.Device.getInfo()),s=o==null?void 0:o.model,u=o==null?void 0:o.platform;t=JSON.stringify({hostname:s||("mobile"+x.Platform.isMobile?Math.random().toString(36).substring(7):""),platform:u||"mobile",machineid:e})}return uK(t)},dK=async()=>{var t;let e="";if(x.Platform.isDesktop)e=await zn();else{const n=await((t=window.Capacitor)==null?void 0:t.Plugins.Device.getId());e=n.identifier||n.uuid}return e},fK={General:"chef-hat",Thino:"Memos",Theme:"brush",Share:"share-2",Advanced:"cog"},fC=[{value:"DAILY",target:"ProcessEntriesBelow",insert:"InsertAfter"},{value:"CANVAS",target:"MemoDefaultCanvasPath"},{value:"MULTI",target:"MemoDefaultMultiFilePath"},{value:"FILE",target:"MemoDefaultSingleFilePath"}],Oo={StartDate:"Sunday",InsertAfter:"# Journal",UserName:"THINO 😉",ProcessEntriesBelow:"",Language:"en",SaveMemoButtonLabel:"NOTE",SaveMemoButtonIcon:"✍️",ShareFooterStart:"{ThinoNum} Thino {UsedDay} Day",ShareFooterEnd:"✍️ by {UserName}",DefaultPrefix:"List",UseDailyOrPeriodic:"Daily",InsertDateFormat:"Tasks",DefaultEditorLocation:"Top",UseButtonToShowEditor:!1,FocusOnEditor:!0,OpenDailyMemosWithMemos:!0,HideDoneTasks:!1,ShowTaskLabel:!1,MobileAndDesktop:"All",OpenMemosAutomatically:!1,ShowTime:!0,ShowDate:!0,AddBlankLineWhenDate:!1,AutoSaveWhenOnMobile:!1,DeleteFileName:"delete",QueryFileName:"query",UseVaultTags:!1,SetCustomBackgroundImage:!1,SetCustomMemoFooter:!1,DefaultLightBackgroundImage:"",DefaultDarkBackgroundImage:"",DefaultMemoComposition:"{TIME} {CONTENT}",CommentOnMemos:!1,CommentsInOriginalNotes:!1,FetchMemosMark:"#memo",FetchMemosFromNote:!1,ShowCommentOnMemos:!1,ShowLeftSideBar:!1,MemoListView:"list",MemoSaveLocation:"DAILY",MemoOtherSaveLocation:{MemoDefaultCanvasPath:"basic.thino.canvas",MemoDefaultMultiFilePath:"Thino",MemoDefaultSingleFilePath:"basic.thino.md"},MemoDailyTarget:5,HeatmapColorScheme:"default",EnabledHttpApi:!1,HttpApiIpType:"localhost",HttpApiPort:"43999",AutoDownloadImage:!1,EditorType:"obsidian",EnabledLocationList:fC,DeleteThinoDirectly:!1,CaptureKey:{EnableCaptureKey:!1,OpenThinoGlobally:"CommandOrControl+Shift+T",ShowNearMouse:!1},startSync:!1,tokenForVerify:{},saveThinoType:"FILE",showDayMark:!1,dayMarkRange:"day",navigation:!1,password:"",needVerify:!1,addTagAutomatically:!1,addTagPosition:"End",addTagWithNewline:!1,chatViewStyle:"default",MomentsBackgroundImage:"https://images.pexels.com/photos/531767/pexels-photo-531767.jpeg",MomentsIcon:"https://images.pexels.com/photos/256514/pexels-photo-256514.jpeg",MomentsQuote:"Share your thino with the world",DefaultThemeForThino:"classic",LastUpdatedVersion:"0.0.0"};function hK({plugin:e}){const{dailyNotesState:{verifyState:t}}=O.useContext(wt),[n,r]=O.useState(!1),[a,o]=O.useState(!1),[s,u]=O.useState(""),[d,m]=O.useState("");O.useEffect(()=>{dK().then(w=>{m(w)})},[]);const p=async()=>{var T;const w=s,D=!x.Platform.isDesktop&&await((T=window.Capacitor)==null?void 0:T.Plugins.Device.getId()),S=x.Platform.isDesktop?await zn():D.identifier||D.uuid;w&&(e.settingTab.updateSettings("tokenForVerify",{...e.settings.tokenForVerify,[S]:w}),e.verify().then(E=>{E&&(r(!0),Qe.setRefresh(!0),setTimeout(()=>{e.settingTab.display()},200),e.registerToolbarCheck()),new x.Notice(k(E?"Verify successfully":"Failed to verify"))}).catch(E=>{new x.Notice(k("Failed to verify"))}))},g=async w=>{u(w)};return y.jsx("div",{className:"thino-verify-component",children:t?y.jsxs("div",{className:"thino-verify-content verified",children:[y.jsx("div",{className:"thino-verified-text",children:k("You have verified your account. Congrats!")}),y.jsx("div",{className:"thino-description-link",children:y.jsxs("p",{children:[k("If you have any questions, please contact us."),y.jsx("span",{className:"thino-url",onClick:()=>{const w=localStorage.getItem("language");w&&(w==="zh"||w==="zh-TW")?window.open("https://pkmer.cn"):window.open("https://thino.pkmer.net/en/")},children:"@ PKMer"})]})})]}):y.jsxs("div",{className:"thino-verify-content",children:[y.jsxs("div",{className:"thino-description-link",children:[k("You can buy a license from")+"->",y.jsxs("span",{className:"thino-url",onClick:()=>{const w=localStorage.getItem("language");w&&(w==="zh"||w==="zh-TW")?window.open("https://pkmer.cn/products/thino"):window.open("https://thino.pkmer.net/en/#price")},children:[" ","PKMer"]})]}),y.jsx("textarea",{className:"thino-verify-textarea",value:s,onChange:w=>g(w.target.value),placeholder:k("Input activation code here")}),y.jsxs("div",{className:"thino-button-container",children:[y.jsxs("div",{className:"thino-button-group",children:[y.jsx("button",{onClick:async()=>{try{const w=await dC();await navigator.clipboard.writeText(w),o(!0)}catch(w){console.error(w),new x.Notice("Failed to copy id");return}new x.Notice(k("Copied to clipboard Successfully"))},children:k("Copy Thino id")}),y.jsx("button",{onClick:()=>{if(!a){new x.Notice(k("Please copy Thino id first"));return}const w=localStorage.getItem("language");w&&(w==="zh"||w==="zh-TW")?window.open("https://pkmer.cn/products/UserProfile/#tab-21&getCode"):window.open("https://pkmer.net/en/userprofile/#tab-21&getCode"),r(!0)},children:k("Get activation code")}),s&&y.jsx(y.Fragment,{children:y.jsx("button",{onClick:async()=>{await p()},children:k("Verify")})})]}),n?y.jsx("p",{children:k("After you verify your account, please refresh this page.")}):""]}),y.jsxs("div",{className:"thino-description-link",children:[k("If you have any questions, please contact us."),y.jsx("span",{className:"thino-url",onClick:()=>{const w=localStorage.getItem("language");w&&(w==="zh"||w==="zh-TW")?window.open("https://pkmer.cn"):window.open("https://thino.pkmer.net/en/")},children:"@ PKMer"})]})]})})}class mK extends x.PluginSettingTab{constructor(n,r){super(n,r);he(this,"plugin");he(this,"applyDebounceTimer",0);he(this,"tabContent",new Map);he(this,"selectedTab","General");he(this,"search");he(this,"searchSettingInfo",new Map);he(this,"searchZeroState");he(this,"navigateEl");he(this,"passwordMatched",!1);he(this,"root");he(this,"debounceApplySettingsUpdate",x.debounce(async()=>{await this.plugin.saveSettings()},100,!0));he(this,"debounceDisplay",x.debounce(async()=>{await this.display()},300,!0));this.plugin=r}updateSettings(n,r){this.plugin.settings={...this.plugin.settings,[n]:r},this.applySettingsUpdate()}applySettingsUpdate(){this.debounceApplySettingsUpdate(),Ie.updateTagsState()}async hide(){var n;(n=this.root)==null||n.unmount(),this.passwordMatched=!1}async display(){var n;await this.plugin.loadSettings(),this.root&&((n=this.root)==null||n.unmount()),this.containerEl.empty(),this.containerEl.toggleClass("memos-settings",!0),x.Platform.isMobile&&this.containerEl.toggleClass("memos-mobile",!0),this.generateSettingsTitle(),this.addTabHeader()}generateSettingsTitle(){const n=this.containerEl.createDiv("memos-setting-title");n.createEl("h2",{text:"Thino"}),this.generateSearchBar(n)}addTabHeader(){const n=this.containerEl.createEl("nav",{cls:"memos-setting-header"});this.navigateEl=n.createDiv("memos-setting-tab-group");const r=this.containerEl.createDiv("memos-setting-content");this.updateOldData(),this.createTabAndContent("General",this.navigateEl,r,(a,o)=>this.generateGeneralSettings(o,a)),this.createTabAndContent("Thino",this.navigateEl,r,(a,o)=>this.generateMemosSettings(o,a)),this.createTabAndContent("Theme",this.navigateEl,r,(a,o)=>this.generateThemeSettings(o,a)),this.createTabAndContent("Share",this.navigateEl,r,(a,o)=>this.generateShareSettings(o,a)),this.createTabAndContent("Advanced",this.navigateEl,r,(a,o)=>this.generateAdvancedSettings(o,a)),this.createSearchZeroState(r)}updateOldData(){this.plugin.settings.UserName.startsWith("MEMO ")&&(this.plugin.settings.UserName="THINO 😉"),this.plugin.settings.ShareFooterStart.contains("{Memo")&&(this.plugin.settings.ShareFooterStart=this.plugin.settings.ShareFooterStart.replace("{MemosNum}","{ThinoNum}").replace("memos","thino")),this.applySettingsUpdate()}generateSearchBar(n){const r=new x.Setting(n);r.settingEl.style.border="none",r.addSearch(a=>{this.search=a}),this.search.setPlaceholder(k("Search all settings")),this.search.inputEl.oninput=()=>{for(const a of this.tabContent){const o=a[1];o.navButton.removeClass("memos-navigation-item-selected"),o.content.show(),o.heading.show();const s=this.search.getValue();this.selectedTab==""&&s.trim()!=""&&this.searchSettings(s.toLowerCase()),this.selectedTab=""}this.navigateEl.addClass("memos-setting-searching")},this.search.inputEl.onblur=()=>{this.navigateEl.removeClass("memos-setting-searching")},this.search.onChange(a=>{var o;if(a===""){this.triggerTabChange((o=this.tabContent.get("General"))==null?void 0:o.navButton,"General");return}this.searchSettings(a.toLowerCase())})}triggerTabChange(n,r){if(this.selectedTab==r)return;n.toggleClass("memos-navigation-item-selected",!0);const a=this.tabContent.get(r);if((a==null?void 0:a.content).show(),this.selectedTab!=""){const o=this.tabContent.get(this.selectedTab);o==null||o.navButton.removeClass("memos-navigation-item-selected"),(o==null?void 0:o.content).hide()}else{this.searchZeroState.hide();for(const o of this.searchSettingInfo)for(const s of o[1])s.containerEl.show();for(const o of this.tabContent){const s=o[1];s.heading.hide(),r!==o[0]&&s.content.hide()}}this.selectedTab=r}createTabAndContent(n,r,a,o){const s=this.selectedTab===n,u=r.createDiv("memos-navigation-item");u.toggleClass("memos-desktop",!0),x.setIcon(u.createEl("div",{cls:"memos-navigation-item-icon"}),fK[n]),u.createSpan({text:k(n)}),u.onclick=()=>{this.triggerTabChange(u,n)};const d=a.createDiv("memos-tab-settings"),m=d.createEl("h2",{cls:"memos-setting-heading",text:n+" Settings"});m.hide(),d.id=n.toLowerCase().replace(" ","-"),s?u.addClass("memos-navigation-item-selected"):d.hide(),o&&o(d,n),this.tabContent.set(n,{content:d,heading:m,navButton:u})}searchSettings(n){var o;const r=new Set,a=(s,u)=>{s.show(),r.has(u)||r.add(u)};for(const s of this.searchSettingInfo){const u=s[0],d=s[1];for(const m of d)if(n.trim()===""||(o=m.alias)!=null&&o.includes(n)||m.description.includes(n)||m.name.includes(n))a(m.containerEl,u);else if(m.options&&m.options.length>0)for(const p of m.options){if(p.description.toLowerCase().includes(n)||p.name.toLowerCase().includes(n)){a(m.containerEl,u);break}else if(p.options){for(const g of p.options)if(g.description.toLowerCase().includes(n)||g.value.toLowerCase().includes(n)){a(m.containerEl,u);break}}m.containerEl.hide()}else m.containerEl.hide()}for(const s of this.tabContent)r.has(s[0])?s[1].heading.show():s[1].heading.hide();r.size===0?this.searchZeroState.show():this.searchZeroState.hide()}addSettingToMasterSettingsList(n,r,a="",o="",s=[],u=""){var m;const d={containerEl:r,name:a.toLowerCase(),description:o.toLowerCase(),options:s,alias:u};this.searchSettingInfo.has(n)?(m=this.searchSettingInfo.get(n))==null||m.push(d):this.searchSettingInfo.set(n,[d])}createSearchZeroState(n){this.searchZeroState=n.createDiv(),this.searchZeroState.hide(),this.searchZeroState.createEl(x.Platform.isMobile?"h3":"h2",{text:"No settings match search"}).style.textAlign="center"}generateGeneralSettings(n,r){this.customHeading(n,r)}async generateThemeSettings(n,r){var d;const a=rt.getState().verifyState,o=!x.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=x.Platform.isDesktop?await zn():o.identifier||o.uuid,u=a&&(a==null?void 0:a.appId)===s;await this.customNameAndTheme(n,r,u)}async generateMemosSettings(n,r){var d;const a=rt.getState().verifyState,o=!x.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=x.Platform.isDesktop?await zn():o.identifier||o.uuid,u=a&&(a==null?void 0:a.appId)===s;this.addMemoSettings(n,r),this.addThinoProSettings(n,r,u)}generateShareSettings(n,r){this.copyMemosSettings(n,r),this.shareMemosSettings(n,r)}async generateAdvancedSettings(n,r){var d;this.saveDataSettings(n,r),this.fetchDataSettings(n,r),this.navigationSettings(n,r);const a=rt.getState().verifyState,o=!x.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=x.Platform.isDesktop?await zn():o.identifier||o.uuid,u=a&&(a==null?void 0:a.appId)===s;this.customFileNameSettings(n,r,u),this.setGlobalSettings(n,r,u)}async customNameAndTheme(n,r,a){new Ke(r,this).setName(k("Theme for Thino")).setDesc(k("Set the theme for Thino")).setTab(n).addDropdown(async s=>{s.addOption("modern","Modern"),s.addOption("classic","Classic"),s.setValue(this.plugin.settings.DefaultThemeForThino).onChange(async u=>{this.plugin.settings.DefaultThemeForThino=u,this.applySettingsUpdate()})}),new Ke(r,this).setTab(n).setHeading().setName(k("Theme Details"));let o;new Ke(r,this).setName(k("Heatmap Color Scheme")).setDesc(k("Set different color scheme for heatmap.")).setTab(n).addDropdown(async s=>{o=s,o.addOption("default","default"),o.addOption("gray","gray"),o.addOption("grass","grass"),o.addOption("frame","frame"),o.addOption("olive","olive"),o.addOption("ice","ice"),o.addOption("magenta","magenta"),o.setValue(this.plugin.settings.HeatmapColorScheme).onChange(async u=>{this.plugin.settings.HeatmapColorScheme=u,this.applySettingsUpdate()})}),new Ke(r,this).setName(k("Hide done tasks in Memo list")).setDesc(k("Hide all done tasks in Memo list. Show done tasks by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.HideDoneTasks).onChange(async u=>{this.plugin.settings.HideDoneTasks=u,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Show Tasks Label")).setDesc(k("Show tasks label near the time text. False by default")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.ShowTaskLabel).onChange(async u=>{this.plugin.settings.ShowTaskLabel=u,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Save Memo button label")).setDesc(k("The text shown on the save Memo button in the UI. 'NOTEIT' by default.")).setTab(n).addText(s=>s.setPlaceholder(Oo.SaveMemoButtonLabel).setValue(this.plugin.settings.SaveMemoButtonLabel).onChange(async u=>{this.plugin.settings.SaveMemoButtonLabel=u,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Save Memo button icon")).setDesc(k("The icon shown on the save Memo button in the UI.")).setTab(n).addText(s=>s.setPlaceholder(Oo.SaveMemoButtonIcon).setValue(this.plugin.settings.SaveMemoButtonIcon).onChange(async u=>{this.plugin.settings.SaveMemoButtonIcon=u,this.applySettingsUpdate()})),x.Platform.isDesktop&&new Ke(r,this).setName(k("Always Show Leaf Sidebar on PC")).setDesc(k("Show left sidebar on PC even when the leaf width is less than 875px. False by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.ShowLeftSideBar).onChange(async u=>{this.plugin.settings.ShowLeftSideBar=u,this.applySettingsUpdate()})),await this.getEditorLocation(r,n),new Ke(r,this).setHeading().setTab(n).setName(k("Pro Features")),this.addThinoDailyMarkSettings(n,r,a),new Ke(r,this).setName(k("Chat view style")).setDesc(k("Set the style of chat view")).setTab(n).addDropdown(async s=>{o=s,o.addOption("default","Default"),o.addOption("fluent","Fluent"),o.addOption("inline","Inline"),o.setValue(this.plugin.settings.chatViewStyle).onChange(async u=>{if(!a){fn();return}this.plugin.settings.chatViewStyle=u,this.applySettingsUpdate()})}),this.addThinoMomentsSettings(n,r,a)}addThinoDailyMarkSettings(n,r,a){let o;new Ke(r,this).setName(k("Show day mark on list mode")).setDesc(k("Show day mark on the top of daily range thino. False by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.showDayMark).onChange(async u=>{if(!a){fn();return}this.plugin.settings.showDayMark=u,this.applySettingsUpdate(),this.debounceDisplay()})),this.plugin.settings.showDayMark&&new Ke(r,this).setName(k("Day mark range")).setDesc(k("Set the range of day mark. Day by default.")).setTab(n).addDropdown(async s=>{o=s,o.addOption("day","day"),o.addOption("week","week"),o.addOption("month","month"),o.addOption("quarter","quarter"),o.addOption("year","year"),o.setValue(this.plugin.settings.dayMarkRange).onChange(async u=>{this.plugin.settings.dayMarkRange=u,this.applySettingsUpdate()})})}addThinoMomentsSettings(n,r,a){new Ke(r,this).setTab(n).setName(k("Background image for moments view")).setDesc(k("Set the background image for moments view")).addText(o=>o.setPlaceholder("URL").setValue(this.plugin.settings.MomentsBackgroundImage).onChange(async s=>{a&&(this.plugin.settings.MomentsBackgroundImage=s,this.applySettingsUpdate())})),new Ke(r,this).setTab(n).setName(k("Icon for moments/chat view")).setDesc(k("Set the icon for moments/chat view")).addText(o=>o.setPlaceholder("URL").setValue(this.plugin.settings.MomentsIcon).onChange(async s=>{a&&(this.plugin.settings.MomentsIcon=s,this.applySettingsUpdate())})),new Ke(r,this).setTab(n).setName(k("Quote for moments view")).setDesc(k("Set the quote for moments view")).addText(o=>o.setPlaceholder("Input anything here").setValue(this.plugin.settings.MomentsQuote).onChange(async s=>{a&&(this.plugin.settings.MomentsQuote=s,this.applySettingsUpdate())}))}async getEditorLocation(n,r){let a;x.Platform.isMobile&&(new Ke(n,this).setName(k("Default editor position on mobile")).setDesc(k("Set the default editor position on Mobile, 'Top' by default.")).setTab(r).addDropdown(async o=>{a=o,a.addOption("Top",k("Top")),a.addOption("Bottom",k("Bottom")),a.setValue(this.plugin.settings.DefaultEditorLocation).onChange(async s=>{this.plugin.settings.DefaultEditorLocation=s,this.applySettingsUpdate(),setTimeout(()=>{this.display()},200)})}),this.plugin.settings.DefaultEditorLocation!=="Top"&&new Ke(n,this).setName(k("Use button to show editor on mobile")).setDesc(k("Set a float button to call editor on mobile. Only when editor located at the bottom works.")).setTab(r).addToggle(o=>o.setValue(this.plugin.settings.UseButtonToShowEditor).onChange(async s=>{this.plugin.settings.UseButtonToShowEditor=s,this.applySettingsUpdate()})))}customHeading(n,r){var D;new Ke(r,this).setName(k("User name in Memos")).setDesc(k("Set your user name here. 'Memos 😏' By default")).setTab(n).addText(S=>S.setPlaceholder(Oo.UserName).setValue(this.plugin.settings.UserName).onChange(async T=>{this.plugin.settings.UserName=T,this.applySettingsUpdate()}));let a=!1;const o=document.createDocumentFragment();o.createEl("span",{text:k("Connect to PKMer Sync, you can check it in ")});const s=localStorage.getItem("language");let u;s&&s==="zh"?u="https://pkmer.cn/products/UserProfile/#tab-21&activateSync":u="https://thino.pkmer.net/en/",o.createEl("a",{text:k("PKMer Sync"),attr:{href:u}});const d=!!((D=this.plugin.app)!=null&&D.loadLocalStorage("tokenForSync"));d&&new Ke(r,this).setHeading().setName(k("Sync service")).setTab(n),(s==="zh"||s==="zh-TW")&&new Ke(r,this).setName(k("Sync Thino via PKMer")).setDesc(o).setTab(n).addButton(S=>{var E;const T=(E=this.plugin.app)==null?void 0:E.loadLocalStorage("tokenForSync");S.setButtonText(k(T?"Unlink":"Link")).onClick(async()=>{var A;if(!T){const N=localStorage.getItem("language");N&&(N==="zh"||N==="zh-TW")?window.open("https://pkmer.cn/products/UserProfile/#tab-21&activateSync"):window.open("https://thino.pkmer.net/en/");return}if(!a){S.setButtonText(k("Confirm?")),a=!0;return}a=!1,T&&((A=this.plugin.app)==null||A.saveLocalStorage("tokenForSync",""),new x.Notice(k("Remove successfully"))),Qe.setRefresh(!0),setTimeout(()=>{this.display()},20)})}),(s==="zh"||s==="zh-TW")&&this.showSyncStatus(r,n),d&&new Ke(r,this).setHeading().setName(k("Pro verification status")).setTab(n);const m=document.createDocumentFragment(),p=m.createEl("div",{cls:"thino-activation"}),g=new Ke(r,this).setName(k("Activate Pro Version")).setDesc(m).setTab(n);g.settingEl.toggleClass("thino-activation-setting",!0),g.nameEl.toggleClass("thino-activation-title",!0),this.root=hs.createRoot(p),this.root.render(y.jsx(Sl,{store:Ee,context:wt,children:y.jsx(hK,{plugin:this.plugin})}));let w=!1;new Ke(r,this).setName(k("Deactivate")).setTab(n).addButton(S=>{S.setWarning().setButtonText(k("Remove")).onClick(async()=>{var A;if(!w){S.setButtonText(k("Confirm?")),w=!0;return}w=!1;const T=!x.Platform.isDesktop&&await((A=window.Capacitor)==null?void 0:A.Plugins.Device.getId()),E=x.Platform.isDesktop?await zn():T.identifier||T.uuid;this.plugin.settings.tokenForVerify[E]&&(delete this.plugin.settings.tokenForVerify[E],await this.plugin.saveSettings(),new x.Notice(k("Remove successfully"))),await this.plugin.verify(),Qe.setRefresh(!0),setTimeout(()=>{this.display()},20)})})}showSyncStatus(n,r){var o;(o=this.plugin.app)!=null&&o.loadLocalStorage("tokenForSync")&&(new Ke(n,this).setName(k("Save thino type when sync local")).setDesc(k("Set the default save thino type when sync local, FILE by default.")).setTab(r).addDropdown(async s=>{s.addOption("DAILY",k("DAILY")),s.addOption("FILE",k("FILE")),s.setValue(this.plugin.settings.saveThinoType).onChange(async u=>{this.plugin.settings.saveThinoType=u,this.applySettingsUpdate()})}),new Ke(n,this).setName(k("Sync Status")).setDesc(k("Start or stop sync")).setTab(r).addButton(s=>{s.setButtonText(this.plugin.settings.startSync?k("Stop"):k("Start")).onClick(async()=>{this.plugin.settings.startSync=!this.plugin.settings.startSync,await this.plugin.saveSettings(),Qe.setRefresh(!0),new x.Notice(this.plugin.settings.startSync?k("Start sync successfully"):k("Stop sync successfully")),setTimeout(()=>{this.display()},200)})}))}addMemoSettings(n,r){new Ke(r,this).setName(k("Use Tags In Vault")).setDesc(k("Use tags in vault rather than only in Memos. False by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.UseVaultTags).onChange(async s=>{this.plugin.settings.UseVaultTags=s,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Focus on editor when open memos")).setDesc(k("Focus on editor when open memos. Focus by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.FocusOnEditor).onChange(async s=>{this.plugin.settings.FocusOnEditor=s,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Open daily memos with open memos")).setDesc(k("Open daily memos with open memos. Open by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.OpenDailyMemosWithMemos).onChange(async s=>{this.plugin.settings.OpenDailyMemosWithMemos=s,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Open Memos when obsidian opens")).setDesc(k("When enable this, Memos will open when Obsidian opens. False by default.")).setTab(n).addDropdown(o=>{o.addOption("Desktop","Desktop"),o.addOption("Mobile","Mobile"),o.addOption("All","All"),o.setValue(this.plugin.settings.MobileAndDesktop).onChange(async s=>{this.plugin.settings.MobileAndDesktop=s,this.applySettingsUpdate()})}).addToggle(o=>o.setValue(this.plugin.settings.OpenMemosAutomatically).onChange(async s=>{this.plugin.settings.OpenMemosAutomatically=s,this.applySettingsUpdate()}));let a;new Ke(r,this).setName(k("Default prefix")).setDesc(k("Set the default prefix when create memo, 'List' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("List",k("List")),a.addOption("Task",k("Task")),a.setValue(this.plugin.settings.DefaultPrefix).onChange(async s=>{this.plugin.settings.DefaultPrefix=s,this.applySettingsUpdate()})}),new Ke(r,this).setName(k("Default insert date format")).setDesc(k("Set the default date format when insert date by @, 'Tasks' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("Tasks","Tasks"),a.addOption("Dataview","Dataview"),a.setValue(this.plugin.settings.InsertDateFormat).onChange(async s=>{this.plugin.settings.InsertDateFormat=s,this.applySettingsUpdate()})})}addThinoProSettings(n,r,a){new Ke(r,this).setHeading().setTab(n).setName(k("Pro Features")),new Ke(r,this).setName(k("Add tag automatically")).setDesc(k("Add tag to the end or beginning of the thino content when creating a thino and filtering tags")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.addTagAutomatically).onChange(async s=>{if(!a){fn();return}this.plugin.settings.addTagAutomatically=s,this.applySettingsUpdate(),this.debounceDisplay()})),this.plugin.settings.addTagAutomatically&&(new Ke(r,this).setName(k("Add tag position")).setDesc(k("Set the position of the tag when adding tag automatically")).setTab(n).addDropdown(async o=>{o.addOption("End",k("End")),o.addOption("Beginning",k("Beginning")),o.setValue(this.plugin.settings.addTagPosition).onChange(async s=>{this.plugin.settings.addTagPosition=s,this.applySettingsUpdate()})}),new Ke(r,this).setName(k("Add tag with new line")).setDesc(k("Add tag with new line when adding tag automatically")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.addTagWithNewline).onChange(async s=>{this.plugin.settings.addTagWithNewline=s,this.applySettingsUpdate()})))}memosCommentSettings(n,r){new Ke(r,this).setName(k("Allow Comments On Memos")).setDesc(k("You can comment on memos. False by default")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.CommentOnMemos).onChange(async o=>{this.plugin.settings.CommentOnMemos=o,this.applySettingsUpdate(),this.display()})),this.plugin.settings.CommentOnMemos&&(new Ke(r,this).setName(k("Always Show Memo Comments")).setDesc(k("Always show memo comments on memos. False by default")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowCommentOnMemos).onChange(async o=>{this.plugin.settings.ShowCommentOnMemos=o,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Comments In Original DailyNotes/Notes")).setDesc(k("You should install Dataview Plugin ver 0.5.9 or later to use this feature.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.CommentsInOriginalNotes).onChange(async o=>{this.plugin.settings.CommentsInOriginalNotes=o,this.applySettingsUpdate()})))}copyMemosSettings(n,r){new Ke(r,this).setName(k("Show Time When Copy Results")).setDesc(k("Show time when you copy results, like 12:00. Copy time by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowTime).onChange(async o=>{this.plugin.settings.ShowTime=o,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Show Date When Copy Results")).setDesc(k("Show date when you copy results, like [[2022-01-01]]. Copy date by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowDate).onChange(async o=>{this.plugin.settings.ShowDate=o,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Add Blank Line Between Different Date")).setDesc(k("Add blank line when copy result with date. No blank line by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.AddBlankLineWhenDate).onChange(async o=>{this.plugin.settings.AddBlankLineWhenDate=o,this.applySettingsUpdate()}))}shareMemosSettings(n,r){new Ke(r,this).setName(k("Save Shared Image To Folder For Mobile")).setDesc(k("Save image to folder for mobile. False by Default")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.AutoSaveWhenOnMobile).onChange(async o=>{this.plugin.settings.AutoSaveWhenOnMobile=o,this.applySettingsUpdate()})),this.customMemoFooter(n,r),new Ke(r,this).setName(k("Custom Background Image")).setDesc(k("Set custom background image.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.SetCustomBackgroundImage).onChange(async o=>{this.plugin.settings.SetCustomBackgroundImage=o,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.SetCustomBackgroundImage&&(new Ke(r,this).setName(k("Background Image in Light Theme")).setDesc(k('Set background image in light theme. Set something like "Daily/one.png"')).setTab(n).addText(a=>{new F2(a.inputEl),a.setPlaceholder(Oo.DefaultLightBackgroundImage).setValue(this.plugin.settings.DefaultLightBackgroundImage).onChange(async o=>{this.plugin.settings.DefaultLightBackgroundImage=o,this.applySettingsUpdate()})}),new Ke(r,this).setName(k("Background Image in Dark Theme")).setDesc(k('Set background image in dark theme. Set something like "Daily/one.png"')).setTab(n).addText(a=>{new F2(a.inputEl),a.setPlaceholder(Oo.DefaultDarkBackgroundImage).setValue(this.plugin.settings.DefaultDarkBackgroundImage).onChange(async o=>{this.plugin.settings.DefaultDarkBackgroundImage=o,this.applySettingsUpdate()})}))}customMemoFooter(n,r){new Ke(r,this).setName(k("Custom Memo Footer")).setDesc(k("Set custom memo footer.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.SetCustomMemoFooter).onChange(async o=>{this.plugin.settings.SetCustomMemoFooter=o,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.SetCustomMemoFooter&&(new Ke(r,this).setName(k("Share Memos Image Footer Start")).setDesc(k("Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default")).setTab(n).addText(a=>a.setPlaceholder(Oo.ShareFooterStart).setValue(this.plugin.settings.ShareFooterStart).onChange(async o=>{this.plugin.settings.ShareFooterStart=o,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Share Memos Image Footer End")).setDesc(k("Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default")).setTab(n).addText(a=>a.setPlaceholder(Oo.ShareFooterEnd).setValue(this.plugin.settings.ShareFooterEnd).onChange(async o=>{this.plugin.settings.ShareFooterEnd=o,this.applySettingsUpdate()})))}saveDataSettings(n,r){new Ke(r,this).setName(k("Default Memo Composition")).setDesc(k('Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default')).setTab(n).addText(o=>o.setPlaceholder(Oo.DefaultMemoComposition).setValue(this.plugin.settings.DefaultMemoComposition).setDisabled(!0).onChange(async s=>{this.plugin.settings.DefaultMemoComposition=s,this.applySettingsUpdate()}));let a;new Ke(r,this).setName(k("Default Editor Mode")).setDesc(k("Live-Preview Mode OR Source Mode.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("obsidian",k("Live-preview")),a.addOption("memos",k("Source")),a.setValue(this.plugin.settings.EditorType).onChange(async s=>{this.plugin.settings.EditorType=s,this.applySettingsUpdate()})}),new Ke(r,this).setName(k("Delete Thino Directly")).setDesc(k("When delete thino directly, it will not be moved to trash. False by default.")).setTab(n).addToggle(o=>{o.setValue(this.plugin.settings.DeleteThinoDirectly).onChange(async s=>{this.plugin.settings.DeleteThinoDirectly=s,this.applySettingsUpdate()})})}async initHttpServer(n,r){var d;const a=rt.getState().verifyState,o=!x.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=x.Platform.isDesktop?await zn():o.identifier||o.uuid,u=a&&(a==null?void 0:a.appId)===s;new Ke(n,this).setName(k("Enable Local Http Server")).setTab(r).setDisabled(!u).addToggle(m=>m.setValue(this.plugin.settings.EnabledHttpApi).onChange(async p=>{if(!u){fn();return}this.plugin.settings.EnabledHttpApi=p,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.settings.EnabledHttpApi?this.plugin.initServer():this.plugin.stopServer(),this.display()},100)})),this.plugin.settings.EnabledHttpApi&&(new Ke(n,this).setName(k("Memos Http Server Port")).setDesc(k("Set memos http server port to listen. '43999' by default")).setTab(r).addText(m=>m.setPlaceholder(Oo.HttpApiPort).setValue(this.plugin.settings.HttpApiPort).onChange(async p=>{if(!u){fn();return}this.plugin.settings.HttpApiPort=p,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})),new Ke(n,this).setName(k("Auto Download Image")).setDesc(k("Auto download image when save to thino. 'false' by default")).setTab(r).setDisabled(!u).addToggle(m=>{m.setValue(this.plugin.settings.AutoDownloadImage).onChange(async p=>{if(!u){fn();return}this.plugin.settings.AutoDownloadImage=p,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})}),new Ke(n,this).setName(k("Thino Http IP Type")).setDesc(k("Set Thino http server ip to listen. 'localhost' by default")).setTab(r).addDropdown(m=>{m.addOption("localhost","localhost"),m.addOption("127.0.0.1","127.0.0.1"),m.setValue(this.plugin.settings.HttpApiIpType).onChange(async p=>{if(!a||(a==null?void 0:a.appId)!==s){fn();return}this.plugin.settings.HttpApiIpType=p,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})}))}fetchDataSettings(n,r){let a;new Ke(r,this).setName(k("Use which plugin's default configuration")).setDesc(k("Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("Daily",k("Daily")),a.addOption("Periodic","Periodic"),a.setValue(this.plugin.settings.UseDailyOrPeriodic).onChange(async s=>{this.plugin.settings.UseDailyOrPeriodic=s,this.applySettingsUpdate()})})}navigationSettings(n,r){new Ke(r,this).setName(k("Allow navigation from view to Thino or Thino to view")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.navigation).onChange(async o=>{this.plugin.settings.navigation=o,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Need password to unlock Thino")).setTab(n).addToggle(a=>{this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched&&(a.toggleEl.onclick=o=>{this.passwordMatched||(o.preventDefault(),new L2(this.app,this,this.plugin,s=>{a.setDisabled(!s),this.passwordMatched=s,this.debounceDisplay()}).open(),new x.Notice(k("Please input your password to change password settings")))}),a.setDisabled(this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched).setValue(this.plugin.settings.needVerify).onChange(async o=>{this.plugin.settings.needVerify=o,o&&(this.passwordMatched=!1),this.applySettingsUpdate(),this.debounceDisplay()})}),this.plugin.settings.needVerify&&new Ke(r,this).setName(k("Password to lock Thino")).setTab(n).addText(a=>{this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched&&(a.inputEl.onclick=o=>{this.passwordMatched||(o.preventDefault(),new L2(this.app,this,this.plugin,s=>{a.inputEl.readOnly=!s,this.passwordMatched=s,this.debounceDisplay()}).open(),new x.Notice(k("Please input your password to change password settings")))}),a.inputEl.readOnly=this.plugin.settings.password&&this.plugin.settings.needVerify&&!this.passwordMatched,a.inputEl.oncopy=()=>!1,a.inputEl.type="password",a.setValue(this.plugin.settings.password).onChange(async o=>{this.plugin.settings.password=o,this.applySettingsUpdate()})})}setGlobalSettings(n,r,a){new Ke(r,this).setHeading().setTab(n).setName(k("Pro Features")),new Ke(r,this).setName(k("Default save location")).setDesc(k('Set the default save location for thino. "DAILY" by default')).setTab(n).addDropdown(async o=>{for(const s of this.plugin.settings.EnabledLocationList)o.addOption(s.value,k(s.value));o.setValue(this.plugin.settings.MemoSaveLocation||this.plugin.settings.EnabledLocationList[0].value).onChange(async s=>{if(!a){fn();return}this.plugin.settings.MemoSaveLocation=s,this.applySettingsUpdate()})}),this.initHttpServer(r,n),new Ke(r,this).setName(k("Enable opening thino globally")).setDesc(k("Enable opening thino globally. False by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.CaptureKey.EnableCaptureKey).onChange(async s=>{if(!a){fn();return}this.plugin.settings.CaptureKey.EnableCaptureKey=s,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.CaptureKey.EnableCaptureKey&&(new Ke(r,this).setName(k("Key for opening thino globally")).setDesc(k("Set key for opening thino globally. CTRL + SHIFT + T by default.")).setTab(n).addText(o=>o.setPlaceholder(Oo.CaptureKey.OpenThinoGlobally).setValue(this.plugin.settings.CaptureKey.OpenThinoGlobally).onChange(async s=>{if(!a){fn();return}this.plugin.settings.CaptureKey.OpenThinoGlobally=s,this.applySettingsUpdate()})),new Ke(r,this).setName(k("Show thino near mouse")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.CaptureKey.ShowNearMouse).onChange(async s=>{if(!a){fn();return}this.plugin.settings.CaptureKey.ShowNearMouse=s,this.applySettingsUpdate()})))}checkInList(n){return this.plugin.settings.EnabledLocationList.find(r=>r.value===n)!==void 0}customFileNameSettings(n,r,a){var d;const o=document.createDocumentFragment(),s=o.createEl("div",{cls:"memo-save-location-desc"});for(const m of fC){const p=s.createEl("div",{cls:`memo-save-location-desc-item ${m.value}`}),g=p.createEl("span",{cls:"memo-save-location-desc-item-icon"});x.setIcon(g,((d=Md.find(E=>E.title===m.value))==null?void 0:d.icon)||""),p.createEl("span",{cls:"memo-save-location-desc-item-desc",text:`${k(m.value)}`});const w=p.createEl("span",{cls:"memo-save-location-desc-item-toggle"}),D=p.createEl("span",{cls:"memo-save-location-desc-item-setting"});m.value!=="DAILY"&&p.createEl("span",{cls:["memo-save-location-desc-item-pro","user-pro-badge"],text:"PRO"}),new x.ToggleComponent(w).setValue(this.checkInList(m.value)).onChange(async E=>{if(!a){fn();return}E?(await Ie.updateTypeMemos(m.value),this.plugin.settings.EnabledLocationList=[...this.plugin.settings.EnabledLocationList,m]):(await Ie.removeTypeMemos(m.value),this.plugin.settings.EnabledLocationList=this.plugin.settings.EnabledLocationList.filter(A=>A.value!==m.value)),this.plugin.settings.EnabledLocationList.length===1&&(this.plugin.settings.MemoSaveLocation=m.value),this.applySettingsUpdate(),setTimeout(()=>{this.display()},500)}).setDisabled(this.plugin.settings.EnabledLocationList.length===1&&this.checkInList(m.value)),new x.ExtraButtonComponent(D).setIcon("settings").onClick(()=>{new pK(this.app,this,this.plugin,m,a).open()})}const u=new Ke(r,this).setName(k("Save Location for Memos")).setDesc(o).setTab(n);u.settingEl.toggleClass("memo-save-location-setting",!0),u.nameEl.toggleClass("memo-save-location-title",!0)}}class pK extends x.Modal{constructor(n,r,a,o,s){super(n);he(this,"plugin");he(this,"settingTab");he(this,"LocationList");he(this,"target","");he(this,"insertTarget","");he(this,"verified");he(this,"updateValue",x.debounce(n=>{this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"?this.target=n.trim()===""?"basic":n.trim():this.target=n.trim()===""&&this.LocationList.value==="MULTI"?"Memos":n.trim()},400,!0));this.verified=s,this.app=n,this.settingTab=r,this.plugin=a,this.LocationList=o,this.target=o.target!=="ProcessEntriesBelow"?a.settings.MemoOtherSaveLocation[o.target]:a.settings[o.target],this.insertTarget=a.settings.InsertAfter}onOpen(){var p;const{contentEl:n}=this;(p=n.parentElement)==null||p.classList.add("memo-save-location-modal"),this.titleEl.toggleClass("modal-title",!0),this.titleEl.setText(k("Save Location for Memos")+` [${k(this.LocationList.value)}]`),(this.LocationList.value==="FILE"||this.LocationList.value==="CANVAS")&&n.createDiv("modal-desc",g=>{g.setText(k('You can set folder name with file name like "folder/file"'))}),this.LocationList.value==="MULTI"&&n.createDiv("modal-desc",g=>{g.setText(k('You can set folder name like "folder1/folder2/folder3" to create sub-folder'))}),this.LocationList.value==="DAILY"&&n.createDiv("modal-desc",g=>{g.setText(k('You can set target heading like "# Heading" to control data location'))});const r=n.createDiv("modal-setting"),a=this.LocationList.value==="DAILY"?k("Process Memos below"):this.LocationList.value==="MULTI"?k("Set the folder name"):k("Set the filename"),o=k("Insert after heading");this.LocationList.value==="DAILY"&&new Ke(r,this.settingTab).setName(o).setDesc(k("If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.")).addText(g=>g.setPlaceholder(k("# Heading")).setValue(this.insertTarget).onChange(async w=>{this.insertTarget=w}));const s=new Ke(r,this.settingTab).setName(a).addText(g=>g.setPlaceholder(this.LocationList.value==="DAILY"?k("# Heading"):k("Set the filename for current location file")).setValue(this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"?this.target.replace(/\.thino\.(canvas|md)/g,""):this.target).onChange(async w=>{const D=this.LocationList.value==="CANVAS"?".thino.canvas":this.LocationList.value==="FILE"?".thino.md":"";this.updateValue(w.replace(/\.thino\.(canvas|md)/g,"")+D)}));this.LocationList.value==="DAILY"&&s.setDesc(k("If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.")),this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"&&s.controlEl.createEl("span",{text:`${this.LocationList.value==="FILE"?".thino.md":".thino.canvas"}`});const u=n.createDiv("button-group"),d=u.createEl("button",{text:k("Cancel")}),m=u.createEl("button",{text:k("Save")});m.onclick=async()=>{if(!this.verified&&this.LocationList.value!=="DAILY"){this.close(),fn();return}this.LocationList.target!=="ProcessEntriesBelow"?this.plugin.settings.MemoOtherSaveLocation[this.LocationList.target]=this.target:this.plugin.settings[this.LocationList.target]=this.target,this.LocationList.target==="ProcessEntriesBelow"&&(this.plugin.settings.InsertAfter=this.insertTarget),this.settingTab.applySettingsUpdate(),setTimeout(()=>{Ie.updateTypeMemos(this.LocationList.value)},1e3),this.close()},d.onclick=async()=>{this.close()}}onClose(){const{contentEl:n}=this;n.empty()}}class L2 extends x.Modal{constructor(n,r,a,o){super(n);he(this,"plugin");he(this,"settingTab");this.cb=o,this.app=n,this.settingTab=r,this.plugin=a}onOpen(){var d;const{contentEl:n}=this;(d=n.parentElement)==null||d.classList.add("memo-save-location-modal"),this.titleEl.toggleClass("modal-title",!0),this.titleEl.setText(k("Password for Thino")),n.createDiv("modal-desc",m=>{m.setText(k("Please input your password to change password settings"))});const r=n.createDiv("modal-setting"),a=new Ke(r,this.settingTab).setName(k("Password")).addText(m=>m.setPlaceholder(k("Please input your password")).inputEl.type="password"),o=n.createDiv("button-group"),s=o.createEl("button",{text:k("Cancel")}),u=o.createEl("button",{text:k("Confirm?").replace(/(\?|?)/g,"")});u.onclick=async()=>{var m;a.controlEl.querySelector("input").value===this.plugin.settings.password?((m=this.cb)==null||m.call(this,!0),this.close()):new x.Notice(k("Password is incorrect"))},s.onclick=async()=>{this.close()}}onClose(){const{contentEl:n}=this;n.empty()}}const gK=e=>{const{app:t,view:n}=Ee.getState().dailyNotesState,{memo:r}=e,a={...r,createdAtStr:Re.getDateTimeString(r.createdAt),timeStr:Re.getTimeString(r.createdAt)},o=q.useRef(null),s=q.useRef(null);O.useEffect(()=>{if(!s.current||!o.current||(s.current.hasChildNodes()&&s.current.children[0].detach(),!n))return;async function g(){var D;await x.MarkdownRenderer.render(t,r.content+`
`,s.current,r.path,n);const w=(D=s.current)==null?void 0:D.querySelectorAll(".internal-link");w==null||w.forEach(S=>{const T=S,E=T.getAttribute("data-href");if(!E)return;t.metadataCache.getFirstLinkpathDest(E,r.path)||S.classList.add("is-unresolved"),T.addEventListener("mouseover",N=>{N.stopPropagation(),t.workspace.trigger("hover-link",{event:N,source:"thino",hoverParent:n.containerEl,targetEl:T,linktext:E,sourcePath:T.href})})})}g()},[e.memo.content]);const u=()=>{e.onClickThino&&e.onClickThino(a)},d=async(g,w,D)=>{var E;const S=((E=D.parentElement.dataset)==null?void 0:E.task)==="x"?"DONE":"TODO",T=[...(w==null?void 0:w.querySelectorAll("li.task-list-item"))||[]];for(const A of T)if(A===D||A===D.closest("li.task-list-item")){const N=T.indexOf(A),R=g.content.split(/\n/),F=[];for(let U=0;U{g.preventDefault();const w=g.target;if(w.tagName==="INPUT"&&w.hasClass("task-list-item-checkbox")){await d(a,o.current,w);return}};return O.useMemo(()=>y.jsxs("div",{ref:o,className:"daily-memo-wrapper",children:[y.jsx("div",{className:"time-wrapper",onClick:u,children:y.jsx("span",{className:"normal-text",children:a.timeStr})}),y.jsx("div",{className:"memo-content-container",children:y.jsx("div",{ref:s,onClick:m,className:"memo-content-text"})})]}),[r.content])},vK=e=>{const{memoState:{memos:t}}=O.useContext(wt),n=Yc(),[r,a]=O.useState([]),[o,s]=O.useState(Re.getDateStampByDate(Re.getDateString(e.currentDateStamp))),[u,d]=_o(!1),m=O.useRef(null),p=new Date(o),{vault:g}=Ee.getState().dailyNotesState.app,w=Ee.getState().dailyNotesState.settings,[D,S]=O.useState("");O.useEffect(()=>{(()=>{const R=t.filter(F=>Re.getTimeStampByDate(F.createdAt)>=o&&Re.getTimeStampByDate(F.createdAt)F.deletedAt==="").sort((F,H)=>Re.getTimeStampByDate(F.createdAt)-Re.getTimeStampByDate(H.createdAt));a(R),n.setFinish()})()},[o,t]);const T=async()=>{d(!1),setTimeout(()=>{m.current&&Uv(m.current,{backgroundColor:"#ffffff",pixelRatio:window.devicePixelRatio*2}).then(N=>{if(w!=null&&w.AutoSaveWhenOnMobile&&x.Platform.isMobile){const R=N.split("base64,")[1];Av(R,"image/png").arrayBuffer().then(async H=>{let P;const L="png",z=ws();for(const U in z)if(z[U]instanceof x.TFile){P=z[U];break}P!==void 0&&await g.createBinary(await g.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,L,P),H)})}Vv({imgUrl:N})}).catch(()=>{})},0)},E=N=>{s(N),d(!1)},A=O.useMemo(()=>y.jsxs("div",{className:"header-wrapper",children:[y.jsx("span",{className:"title-text",children:k("Daily Memos")}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-left")},className:"btn btn-text",onClick:()=>s(N=>N-Ba)}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-right")},className:"btn btn-text",onClick:()=>s(N=>N+Ba)}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"share")},className:"btn btn-text share-btn",onClick:T}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"x")},className:"btn btn-text",onClick:()=>e.destroy()})]})]}),[]);return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"dialog-header-container",children:A}),y.jsx("div",{className:"dialog-header-container",children:y.jsx("input",{onChange:N=>S(N.target.value),value:D,placeholder:k("Search")})}),y.jsxs("div",{className:"dialog-content-container",ref:m,children:[y.jsxs("div",{className:"date-card-container",onClick:()=>d(),children:[y.jsx("div",{className:"year-text",children:p.getFullYear()}),y.jsxs("div",{className:"date-container",children:[y.jsx("div",{className:"month-text",children:k("months")[p.getMonth()]}),y.jsx("div",{className:"date-text",children:p.getDate()}),y.jsx("div",{className:"day-text",children:k("weekDays")[p.getDay()]})]})]}),y.jsx(Nm,{className:`date-picker ${u?"":"hidden"}`,datestamp:o,handleDateStampChange:E}),n.isLoading?y.jsx("div",{className:"tip-container",children:y.jsx("span",{className:"tip-text",children:k("Loading...")})}):r.length===0?y.jsx("div",{className:"tip-container",children:y.jsx("span",{className:"tip-text",children:k("Noooop!")})}):y.jsx("div",{className:"dailymemos-wrapper",children:r.filter(N=>N.content.toLowerCase().includes(D.toLowerCase())).map(N=>y.jsx(gK,{memo:N,onClickThino:R=>{e.destroy(),Gd(R)}},`${N.id}-${N.updatedAt}`))})]})]})};function aw(e=Date.now()){xm({className:"daily-memo-diary-dialog"},vK,{currentDateStamp:e})}function uy(e){return e.split("-")[0]}function hC(e){return e.split("-")[1]}function db(e){return["top","bottom"].includes(uy(e))?"x":"y"}function mC(e){return e==="y"?"height":"width"}function R2(e){let{reference:t,floating:n,placement:r}=e;const a=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2;let s;switch(uy(r)){case"top":s={x:a,y:t.y-n.height};break;case"bottom":s={x:a,y:t.y+t.height};break;case"right":s={x:t.x+t.width,y:o};break;case"left":s={x:t.x-n.width,y:o};break;default:s={x:t.x,y:t.y}}const u=db(r),d=mC(u);switch(hC(r)){case"start":s[u]=s[u]-(t[d]/2-n[d]/2);break;case"end":s[u]=s[u]+(t[d]/2-n[d]/2);break}return s}const yK=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n;let u=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:m}=R2({...u,placement:r}),p=r,g={};for(let w=0;wDK[t])}function SK(e,t){const n=hC(e)==="start",r=db(e),a=mC(r);let o=r==="x"?n?"right":"left":n?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Cv(o)),{main:o,cross:Cv(o)}}const IK={start:"end",end:"start"};function _2(e){return e.replace(/start|end/g,t=>IK[t])}function TK(e){const t=Cv(e);return[_2(e),t,_2(t)]}const EK=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:s,initialPlacement:u}=t;if((n=o.flip)!=null&&n.skip)return{};const{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",flipAlignment:w=!0,...D}=e,S=uy(a),E=p||(S===u||!w?[Cv(u)]:TK(u)),A=[u,...E],N=await Xw(t,D),R=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&R.push(N[S]),m){const{main:z,cross:U}=SK(a,s);R.push(N[z],N[U])}if(F=[...F,{placement:a,overflows:R}],!R.every(z=>z<=0)){var H,P;const z=((H=(P=o.flip)==null?void 0:P.index)!=null?H:0)+1,U=A[z];if(U)return{data:{index:z,overflows:F},reset:{placement:U}};let W="bottom";switch(g){case"bestFit":{var L;const K=(L=F.slice().sort((ae,ce)=>ae.overflows.filter(fe=>fe>0).reduce((fe,ie)=>fe+ie,0)-ce.overflows.filter(fe=>fe>0).reduce((fe,ie)=>fe+ie,0))[0])==null?void 0:L.placement;K&&(W=K);break}case"initialPlacement":W=u;break}return{data:{skip:!0},reset:{placement:W}}}return{}}}};function xK(e){let{placement:t,rects:n,value:r}=e;const a=uy(t),o=["left","top"].includes(a)?-1:1,s=typeof r=="function"?r({...n,placement:t}):r,{mainAxis:u,crossAxis:d}=typeof s=="number"?{mainAxis:s,crossAxis:0}:{mainAxis:0,crossAxis:0,...s};return db(a)==="x"?{x:d,y:u*o}:{x:u*o,y:d}}const CK=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(t){const{x:n,y:r,placement:a,rects:o}=t,s=xK({placement:a,rects:o,value:e});return{x:n+s.x,y:r+s.y,data:s}}}};function fb(e){return(e==null?void 0:e.toString())==="[object Window]"}function Cl(e){if(e==null)return window;if(!fb(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function dy(e){return Cl(e).getComputedStyle(e)}function vs(e){return fb(e)?"":e?(e.nodeName||"").toLowerCase():""}function ys(e){return e instanceof Cl(e).HTMLElement}function Mv(e){return e instanceof Cl(e).Element}function MK(e){return e instanceof Cl(e).Node}function pC(e){const t=Cl(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function fy(e){const{overflow:t,overflowX:n,overflowY:r}=dy(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function NK(e){return["table","td","th"].includes(vs(e))}function gC(e){const t=navigator.userAgent.toLowerCase().includes("firefox"),n=dy(e);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||t&&n.willChange==="filter"||t&&(n.filter?n.filter!=="none":!1)}const H2=Math.min,Kh=Math.max,Nv=Math.round;function Rd(e,t){t===void 0&&(t=!1);const n=e.getBoundingClientRect();let r=1,a=1;return t&&ys(e)&&(r=e.offsetWidth>0&&Nv(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Nv(n.height)/e.offsetHeight||1),{width:n.width/r,height:n.height/a,top:n.top/a,right:n.right/r,bottom:n.bottom/a,left:n.left/r,x:n.left/r,y:n.top/a}}function Ml(e){return((MK(e)?e.ownerDocument:e.document)||window.document).documentElement}function hy(e){return fb(e)?{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function vC(e){return Rd(Ml(e)).left+hy(e).scrollLeft}function kK(e){const t=Rd(e);return Nv(t.width)!==e.offsetWidth||Nv(t.height)!==e.offsetHeight}function AK(e,t,n){const r=ys(t),a=Ml(t),o=Rd(e,r&&kK(t));let s={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if(r||!r&&n!=="fixed")if((vs(t)!=="body"||fy(a))&&(s=hy(t)),ys(t)){const d=Rd(t,!0);u.x=d.x+t.clientLeft,u.y=d.y+t.clientTop}else a&&(u.x=vC(a));return{x:o.left+s.scrollLeft-u.x,y:o.top+s.scrollTop-u.y,width:o.width,height:o.height}}function my(e){return vs(e)==="html"?e:e.assignedSlot||e.parentNode||(pC(e)?e.host:null)||Ml(e)}function B2(e){return!ys(e)||getComputedStyle(e).position==="fixed"?null:e.offsetParent}function OK(e){let t=my(e);for(;ys(t)&&!["html","body"].includes(vs(t));){if(gC(t))return t;t=t.parentNode}return null}function e1(e){const t=Cl(e);let n=B2(e);for(;n&&NK(n)&&getComputedStyle(n).position==="static";)n=B2(n);return n&&(vs(n)==="html"||vs(n)==="body"&&getComputedStyle(n).position==="static"&&!gC(n))?t:n||OK(e)||t}function Y2(e){return{width:e.offsetWidth,height:e.offsetHeight}}function FK(e){let{rect:t,offsetParent:n,strategy:r}=e;const a=ys(n),o=Ml(n);if(n===o)return t;let s={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if((a||!a&&r!=="fixed")&&((vs(n)!=="body"||fy(o))&&(s=hy(n)),ys(n))){const d=Rd(n,!0);u.x=d.x+n.clientLeft,u.y=d.y+n.clientTop}return{...t,x:t.x-s.scrollLeft+u.x,y:t.y-s.scrollTop+u.y}}function PK(e){const t=Cl(e),n=Ml(e),r=t.visualViewport;let a=n.clientWidth,o=n.clientHeight,s=0,u=0;return r&&(a=r.width,o=r.height,Math.abs(t.innerWidth/r.scale-r.width)<.01&&(s=r.offsetLeft,u=r.offsetTop)),{width:a,height:o,x:s,y:u}}function jK(e){var t;const n=Ml(e),r=hy(e),a=(t=e.ownerDocument)==null?void 0:t.body,o=Kh(n.scrollWidth,n.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),s=Kh(n.scrollHeight,n.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0);let u=-r.scrollLeft+vC(e);const d=-r.scrollTop;return dy(a||n).direction==="rtl"&&(u+=Kh(n.clientWidth,a?a.clientWidth:0)-o),{width:o,height:s,x:u,y:d}}function yC(e){return["html","body","#document"].includes(vs(e))?e.ownerDocument.body:ys(e)&&fy(e)?e:yC(my(e))}function wC(e,t){var n;t===void 0&&(t=[]);const r=yC(e),a=r===((n=e.ownerDocument)==null?void 0:n.body),o=Cl(r),s=a?[o].concat(o.visualViewport||[],fy(r)?r:[]):r,u=t.concat(s);return a?u:u.concat(wC(my(s)))}function LK(e,t){const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&pC(n)){let r=t;do{if(r&&e===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function RK(e){const t=Rd(e),n=t.top+e.clientTop,r=t.left+e.clientLeft;return{top:n,left:r,x:r,y:n,right:r+e.clientWidth,bottom:n+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}function z2(e,t){return t==="viewport"?Qw(PK(e)):Mv(t)?RK(t):Qw(jK(Ml(e)))}function _K(e){const t=wC(my(e)),r=["absolute","fixed"].includes(dy(e).position)&&ys(e)?e1(e):e;return Mv(r)?t.filter(a=>Mv(a)&&LK(a,r)&&vs(a)!=="body"):[]}function HK(e){let{element:t,boundary:n,rootBoundary:r}=e;const o=[...n==="clippingParents"?_K(t):[].concat(n),r],s=o[0],u=o.reduce((d,m)=>{const p=z2(t,m);return d.top=Kh(p.top,d.top),d.right=H2(p.right,d.right),d.bottom=H2(p.bottom,d.bottom),d.left=Kh(p.left,d.left),d},z2(t,s));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}const BK={getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:AK(t,e1(n),r),floating:{...Y2(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:e=>FK(e),getOffsetParent:e=>{let{element:t}=e;return e1(t)},isElement:e=>Mv(e),getDocumentElement:e=>{let{element:t}=e;return Ml(t)},getClippingClientRect:e=>HK(e),getDimensions:e=>{let{element:t}=e;return Y2(t)},getClientRects:e=>{let{element:t}=e;return t.getClientRects()}},YK=(e,t,n)=>yK(e,t,{platform:BK,...n});var zK=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,a,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(a=r;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(a=r;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=r;a--!==0;){var s=o[a];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const UK=Xn(zK),ow=Qh.Facet.define({combine:e=>{var t,n;return{defaultPlacement:((t=e.find(r=>r.defaultPlacement))==null?void 0:t.defaultPlacement)||"top",padding:((n=e.find(r=>r.padding))==null?void 0:n.padding)||8}}}),bC=e=>e.split("-")[0],VK=e=>e==="x"?"y":"x",ZK=e=>["top","bottom"].includes(bC(e))?"x":"y",Hh=(e,t,n)=>Math.max(e,Math.min(t,n)),WK=(e,t)=>Object.fromEntries(Object.entries(e).map(([n,r],a)=>[n,t(r,n,a)])),$K=e=>e===void 0?e:typeof e=="number"?-e:WK(e,t=>t!==void 0?-t:t),GK=(e={})=>({name:"shift",fn:async t=>{const{x:n,y:r,placement:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:u=({x:E,y:A})=>({x:E,y:A}),editorMenu:d,...m}=e,p={x:n,y:r},g=await Xw(t,m),w=ZK(bC(a)),D=VK(w);let S=p[w],T=p[D];if(o){const E=w==="y"?"top":"left",A=w==="y"?"bottom":"right",N=S+g[E],R=S-g[A];if(d){const F=await Xw(t,{...m,boundary:d.dom,padding:$K(m.padding)});if((D==="y"?["top","bottom"]:["left","right"]).every(P=>F[P]<=0)){const P=t.rects.floating.width,L=S+F[E]-P,z=S-F[A]+P,U=Math.abs(g[E]-F[E]),W=Math.abs(g[A]-F[A]);U>=P||W({width:0,height:0,top:t,left:e,bottom:t,right:e,x:e,y:t}),KK=(e,t)=>{if(!e)return null;const n=Math.min(e.left,(t==null?void 0:t.left)??e.left),r=Math.max(e.right,(t==null?void 0:t.right)??e.right),a=Math.max(e.bottom,(t==null?void 0:t.bottom)??e.bottom)-Math.min(e.top,(t==null?void 0:t.top)??e.top),o=Math.min(e.top,(t==null?void 0:t.top)??e.top),s=o+a,u={left:n,right:r,top:o,bottom:s,width:0,height:a,x:o,y:n};return t&&(u.width=Math.abs(r-n)),u},QK=JK();class XK{constructor(t){he(this,"containerEl");he(this,"virtualEl");he(this,"toolbar",null);he(this,"isThinoView");he(this,"tooltipInfo");he(this,"inView",!0);he(this,"defaultPlacement");he(this,"editorMenu");he(this,"cachedRefRect",null);he(this,"readFromDOM",()=>{if(this.tooltipInfo){const{start:t}=this.tooltipInfo;let{end:n}=this.tooltipInfo;n&&t===n&&(n=void 0);const r=this.view.coordsAtPos(t);let a=n?this.view.coordsAtPos(n):null;if(r&&a&&r.top!==a.top){const s=this.view.contentDOM.getBoundingClientRect();a={left:s.right,right:s.right,top:r.top,bottom:r.bottom}}const o=KK(r,a);o&&(this.cachedRefRect=o,this.computePosition(o))}});this.view=t,this.containerEl=this.view.dom.parentElement,this.defaultPlacement=this.view.state.facet(ow).defaultPlacement,this.tooltipInfo=t.state.facet(t1),this.virtualEl={rect:QK,getBoundingClientRect(){return this.rect}},this.maybeMeasure(),this.editorMenu={currMenu:null,evtRef:t.state.field(x.editorInfoField)},this.isThinoView=this.checkThinoView()}get workspace(){return this.view.state.field(x.editorInfoField).app.workspace}checkThinoView(){return this.view.state.field(x.editorInfoField)&&this.view.state.field(x.editorInfoField)instanceof yl}shouldRemoveToolbar(t){const n=t??this.tooltipInfo;return!(n!=null&&n.end||this.editorMenu.currMenu)}onEditorMenuOpen(t){this.editorMenu.currMenu||(this.editorMenu.currMenu=t,this.cachedRefRect?this.computePosition(this.cachedRefRect):this.maybeMeasure(),!x.Platform.isMacOS&&this.tooltipInfo&&(this.createToolbar(),this.maybeMeasure()))}onEditorMenuClose(t){this.editorMenu.currMenu===t&&(this.editorMenu.currMenu=null),!x.Platform.isMacOS&&this.toolbar&&this.shouldRemoveToolbar()&&this.removeToolbar()}createToolbar(t){const n=t??this.tooltipInfo;if(!n)return;this.removeToolbar();const r=n.create(this.containerEl),a=this.view.state.field(x.editorInfoField);if(!a||!(a!=null&&a.editor))return;const o=a.editor.offsetToPos(n.start),s=n.end?a.editor.offsetToPos(n.end):o;this.workspace.trigger(qK,r,{from:o,to:s},a.editor,a),this.toolbar=r}removeToolbar(){this.toolbar&&(this.toolbar.hide(),this.toolbar=null)}update(t){if(!this.isThinoView)return;const n=t.state.facet(t1),r=n!==this.tooltipInfo&&!UK(n,this.tooltipInfo);r&&(this.tooltipInfo=n,this.shouldRemoveToolbar()?this.removeToolbar():n&&!this.toolbar&&this.createToolbar(n));const a=r||t.geometryChanged,o=t.state.facet(ow);o.defaultPlacement!=this.defaultPlacement&&(o.defaultPlacement=this.defaultPlacement),a&&this.maybeMeasure()}destroy(){this.editorMenu.currMenu=null,this.removeToolbar(),this.toolbar=null,this.view.state.field(x.editorInfoField).app.workspace.offref(this.editorMenu.evtRef)}async computePosition(t){if(!this.toolbar)return;this.virtualEl.rect=t;const{padding:n}=this.view.state.facet(ow),{x:r,y:a}=await YK(this.virtualEl,this.toolbar.dom,{placement:this.defaultPlacement,middleware:[CK({mainAxis:5}),EK({padding:n,boundary:this.view.scrollDOM}),GK({padding:n,boundary:this.view.scrollDOM,editorMenu:this.editorMenu.currMenu})]});Object.assign(this.toolbar.dom.style,{top:"0",left:"0",transform:`translate(${Math.round(r)}px,${Math.round(a)}px)`})}maybeMeasure(){this.view.inView&&this.toolbar&&this.view.requestMeasure({read:this.readFromDOM}),this.inView!=this.view.inView&&(this.inView=this.view.inView,this.inView||this.removeToolbar())}}const eQ=Ci.ViewPlugin.fromClass(XK,{eventHandlers:{scroll(){this.maybeMeasure()}}}),t1=Qh.Facet.define({enables:[eQ],combine:e=>e.filter(t=>t!=null).first()??null}),tQ=e=>{const t=iQ(e);t&&window.navigator.clipboard.writeText(t==null?void 0:t.getSelection())},nQ=e=>{e.commands.executeCommandById("editor:toggle-bold",e)},rQ=e=>{e.commands.executeCommandById("editor:toggle-strikethrough",e)},aQ=e=>{e.commands.executeCommandById("editor:toggle-highlight",e)},oQ=e=>{e.commands.executeCommandById("editor:toggle-italics",e)},iQ=e=>{const{editor:t}=e.field(x.editorInfoField);return t},U2=(e,t)=>{const n=e.selection.ranges[0];if(!n)return null;const{anchor:r,head:a,empty:o}=n,[s,u]=[r,a].sort();return{start:s,end:o?void 0:u,create:m=>new uQ(m).addSmallButton(g=>g.setClass("clickable-icon").setIcon("copy").onClick(()=>tQ(e))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("bold").onClick(()=>nQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("italic").onClick(()=>oQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("strikethrough").onClick(()=>rQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("highlighter").onClick(()=>aQ(t)))}},sQ=e=>Qh.StateField.define({create:t=>U2(t,e),update:(t,n)=>!n.docChanged&&!n.selection?t:U2(n.state,e),provide:t=>t1.from(t)}),lQ=e=>[sQ(e)];class cQ extends x.BaseComponent{constructor(n){super();he(this,"button");he(this,"disabled",!1);he(this,"dropdownOptions",[]);he(this,"menu");he(this,"menuOpened",!1);this.button=new x.ButtonComponent(n)}setDisabled(n){return this.button.setDisabled(n),this.disabled=n,this}setIcon(n){return this.button.setIcon(n),this}setClass(n){return this.button.setClass(n),this}setDropdownText(n){var d;const r=this.button.buttonEl.createDiv("mini-toolbar-text"),a=this.button.buttonEl.createDiv("mini-toolbar-icon-with-text");x.setIcon(a,"chevron-down");const o=(d=n.doc.lineAt(n.selection.ranges[0].from))==null?void 0:d.from,s=y0.syntaxTree(n).resolveInner(o+1),u=s.type.prop(y0.tokenClassNodeProp);return r.setText(this.detectFormat(u,s)||"Text"),this}setDropdownIcon(){const n=this.button.buttonEl.createDiv("mini-toolbar-highlight-icon"),r=this.button.buttonEl.createDiv("mini-toolbar-icon-with-icon");return x.setIcon(n,"highlighter"),x.setIcon(r,"chevron-down"),this}detectFormat(n,r){var a;if(!n)return"Text";if(n.includes("strong"))return"Bold";if(n.includes("em"))return"Italic";if(n.includes("strikethrough"))return"Strike";if(n.contains("hmd-codeblock"))return"CodeBlock";if(n.contains("hmd-inline-code"))return"Code";if(n.contains("formatting-header")){const o=n.match(/header-\d{1,}/);if(o)return"Heading "+o[0].slice(-1)}if(n.contains("formatting-list")||n.contains("hmd-list-indent")){if(r!=null&&r.parent){const o=(a=r.parent)==null?void 0:a.type.prop(y0.lineClassNodeProp);if(o!=null&&o.contains("HyperMD-task-line"))return"To-do list"}if(n.contains("formatting-list-ol"))return"Numbered list";if(n.contains("formatting-list-ul"))return"Bulleted list"}}setTooltip(n){return this.button.setTooltip(n),this}setOptionsList(n){return this.dropdownOptions=n,this}onClick(n){return this.dropdownOptions.length>0?(this.button.onClick(r=>this.showEditMenu(r)),this):(this.button.onClick(n),this)}showEditMenu(n){var s,u;if(this.menuOpened=!this.menuOpened,!this.menuOpened)return;this.menu=new x.Menu,this.menu.onHide(()=>{this.menuOpened=!1});const r=n.currentTarget,a=(s=n.currentTarget)==null?void 0:s.getBoundingClientRect(),o={x:a.left-6,y:a.bottom+6};for(let d=0;d<((u=this.dropdownOptions)==null?void 0:u.length);d++)this.menu.addItem(m=>{m.setIcon("zap").setTitle(this.dropdownOptions[d]).onClick(()=>{})});this.menu.setParentElement(r).showAtPosition(o)}then(n){return n(this),this}}class uQ extends x.Component{constructor(n){super();he(this,"dom");he(this,"smallBtnContainer");he(this,"unloading",!1);this.dom=n==null?void 0:n.createDiv({cls:"cm-mini-toolbar"},r=>r.style.position="absolute"),this.smallBtnContainer=this.dom}addSmallButton(n){return n(new cQ(this.smallBtnContainer)),this}hide(){return this.unload(),this.unloading?this:(this.unloading=!0,this.dom.detach(),this.unloading=!1,this)}}const dQ=Ci.Decoration.line({attributes:{"data-ph":k("What do you think now...")},class:"thino-editor-placeholder"}),fQ=Qh.StateField.define({create(){return Ci.Decoration.none},update(e,t){const n=t.state.field(x.editorInfoField);if(!(n!=null&&n.view)&&!((n==null?void 0:n.view)instanceof yl))return e;const r=new Qh.RangeSetBuilder,a=t.state.doc.toString(),o=t.state.doc.lineAt(0);return(a==null?void 0:a.length)==0&&r.add(o.from,o.from,dQ),r.finish()},provide:e=>Ci.EditorView.decorations.from(e)});function DC(e){return`userId:${e}`}function hQ(e,t){return`expiryDate:${t}:${e}`}function mQ(e){try{const t=DC(e==null?void 0:e.appId);return Kn.get([t])[t]||""}catch(t){return console.error(t),""}}function pQ(e,t){try{const n=DC(t==null?void 0:t.appId);return Kn.set({[n]:e}),{userId:e,key:n}}catch(n){console.error(n)}}function gQ(e,t){try{const n=hQ(mQ(t),t==null?void 0:t.appId);Kn.set({[n]:e})}catch(n){console.error(n)}}const vQ=Re.grabImageFromUrl,yQ=require("http"),wQ=require("url");function bQ(e){const t=e.indexOf(";base64,"),n=e.substring(5,t),r=e.substr(t+8),a=atob(r),o=new ArrayBuffer(a.length),s=new Uint8Array(o);for(let d=0;d{const{type:t}=e;if(t.startsWith("image"))try{return`${await y1.upload(e)}`}catch(n){new x.Notice(n)}};function DQ(e){const t=yQ.createServer(async function(n,r){r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Allow-Methods","GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE"),r.setHeader("Access-Control-Allow-Headers","Access-Control-Allow-Headers, Origin, Authorization,Accept,x-client-id, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, hypothesis-client-version"),r.setHeader("Access-Control-Allow-Credentials","true");try{if(n.url){const a=wQ.parse(n.url,!0);if(a.pathname==="/create"&&n.method==="POST"){let o="";n.on("data",s=>{o+=s}),n.on("end",async()=>{const s=JSON.parse(o),{text:u,isList:d,type:m,imageList:p}=s;let g=u;if(!g){r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:null,link:null}));return}new RegExp(/(<([^>]+)>)/g).test(u)&&(g=x.htmlToMarkdown(u));let D=[];const S=[];if(e.AutoDownloadImage){const E=g.match(_c)||[];if(E.length>0){for(const A of E)try{const N=await vQ(A);if(N.size===0)continue;const R=new File([N],"image.png",{type:"image/png"}),F=await V2(R);S.push({oldUrl:A,newUrl:F})}catch(N){console.error(N)}S.forEach(A=>{g=g.replace(A.oldUrl,A.newUrl)}),p&&p.length>0&&(D=await Promise.all(p.map(async A=>{const N=bQ(A);return new File([N],"image.png",{type:"image/png"})})));for(const A of D){const N=await V2(A);g+=`
${N}`}}}const T=await Ie.createThino({content:g,isList:d,type:m});T&&(Ie.pushMemo(T),We.clearQuery()),r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:T,link:`obsidian://thino?openId=${T.id}`}))})}else if(a.pathname==="/search"&&n.method==="GET"){const o=a.query,{keyword:s}=o,u=Ie.getThinoViaKeyword(s);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:u});r.end(d)}else r.statusCode=404,r.end()}}catch(a){console.error(a),r.statusCode=500,r.end({status:"error",message:a.message})}});return{listen(n,r){try{t.listen({port:parseInt(r),host:n})}catch(a){console.error(a),new x.Notice(k("Thino - Failed to start HTTP server, please check the port is available."))}new x.Notice(`${k("Thino - Started HTTP server on port")} ${r}`)},close(){t.close(),new x.Notice(k("Thino - Terminated HTTP server"))}}}const{clipboard:gn}=x.Platform.isDesktop?require("electron"):"";class SQ{constructor(){he(this,"eventListeners");this.eventListeners={}}on(t,n){this.eventListeners[t]=this.eventListeners[t]||[],this.eventListeners[t].push(n)}once(t,n){n.$emitOnce=!0,this.on(t,n)}removeListener(t,n){if(this.eventListeners[t]){const r=this.eventListeners[t].findIndex(a=>a===n);r>=0&&this.eventListeners[t].splice(r,1)}}removeAllListeners(t){this.eventListeners[t]&&(this.eventListeners[t].length=0)}emit(t,...n){this.eventListeners[t]&&this.eventListeners[t].forEach(r=>{r.call(this,...n),r.$emitOnce&&this.removeListener(t,r)})}}const Dd=new SQ;let Bh=null,Z2=gn==null?void 0:gn.readText(),W2=gn==null?void 0:gn.readImage();gn&&(gn.on=(e,t)=>(Dd.on(e,t),gn),gn.once=(e,t)=>(Dd.once(e,t),gn),gn.off=(e,t)=>(t?Dd.removeListener(e,t):Dd.removeAllListeners(e),gn),gn.startWatching=()=>(Bh||(Bh=setInterval(()=>{IQ(Z2,Z2=gn==null?void 0:gn.readText())&&Dd.emit("text-changed"),TQ(W2,W2=gn==null?void 0:gn.readImage())&&Dd.emit("image-changed")},500)),gn),gn.stopWatching=()=>(Bh&&clearInterval(Bh),Bh=null,gn));function IQ(e,t){return t&&e!==t}function TQ(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var Q2;const iw=(Q2=require("electron"))==null?void 0:Q2.remote;var X2,eI;const $2=(eI=(X2=require("electron"))==null?void 0:X2.remote)==null?void 0:eI.screen;class EQ{constructor(t,n){he(this,"isRegisted");he(this,"leaf");he(this,"clipboard");he(this,"isScreenTop",!1);he(this,"currentSplitWindow");he(this,"intervalNum");he(this,"allowsCopy",!1);he(this,"plugin");he(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=gn}async onload(){x.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{iw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:k("Global copy"),callback:()=>{this.allowsCopy=!this.allowsCopy,!this.allowsCopy&&this.clipboard.stopWatching(),this.allowsCopy&&this.clipboard.startWatching(),this.leaf&&this.allowsCopy&&(this.actionEl=this.leaf.view.addAction("clipboard-x","Stop global copying",()=>{var t;this.allowsCopy=!1,this.clipboard.stopWatching(),(t=this.actionEl)==null||t.remove()}))}})}onunload(){this.isRegisted&&(iw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally),this.clipboard.off("text-changed"),this.clipboard.off("image-changed"),this.clipboard.stopWatching(),this.leaf&&this.leaf.detach())}getCurrentLeaf(){var n;return this.leaf?this.app.workspace.getLeavesOfType("thino_view").length>0&&!!this.app.workspace.getLeafById(this.leaf.id)?!0:((n=this.leaf)==null||n.detach(),this.currentSplitWindow.close(),this.currentSplitWindow=null,this.leaf=null,this.isScreenTop=!1,!1):!1}async registerAllShortcuts(){iw.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,a,o,s;const t=$2.getCursorScreenPoint(),n=(s=(o=(a=(r=this.leaf)==null?void 0:r.parent)==null?void 0:a.parent)==null?void 0:o.win)==null?void 0:s.electronWindow;if(n){if(n.setAlwaysOnTop(!this.isScreenTop,"screen"),this.leaf.setPinned(!this.isScreenTop),this.leaf.view.containerEl.toggleClass("thino-float-window",!0),n.isMinimized()&&n.restore(),n.focus(),this.plugin.settings.CaptureKey.ShowNearMouse){const{width:u,height:d}=n.getBounds();n.setBounds({x:t.x,y:t.y,width:u,height:d})}if(this.app.workspace.trigger("focus-on-textarea"),this.isScreenTop){this.isScreenTop=!1,setTimeout(()=>{n.setAlwaysOnTop(!1,"screen")},200);return}this.isScreenTop=!0}}openThinoView(){var o,s,u,d,m;this.leaf=this.app.workspace.openPopoutLeaf({size:{width:400,height:400}});const t=this.leaf;this.leaf.view.containerEl.toggleClass("thino-float-window",!0),this.leaf.setViewState({type:"thino_view"}),setTimeout(()=>{t.view.containerEl.classList.toggle("mobile-view",!0)},0),this.currentSplitWindow=(s=(o=this.leaf)==null?void 0:o.parent)==null?void 0:s.parent;const n=(m=(d=(u=this.leaf)==null?void 0:u.parent)==null?void 0:d.parent)==null?void 0:m.win.electronWindow;if(!n)return;n.setAlwaysOnTop(!this.isScreenTop,"screen"),this.leaf.setPinned(!this.isScreenTop),this.isScreenTop=!0;const r=this.app,a=p=>{var D,S,T;const g=$2.getCursorScreenPoint(),w=(T=(S=(D=t==null?void 0:t.parent)==null?void 0:D.parent)==null?void 0:S.win)==null?void 0:T.electronWindow;if(w){if(w.isMinimized()&&w.restore(),!this.isScreenTop&&this.plugin.settings.CaptureKey.ShowNearMouse){const{width:E,height:A}=w.getBounds();w.setBounds({x:g.x,y:g.y-200,width:E,height:A})}w.setAlwaysOnTop(!0,"screen"),r.workspace.trigger("focus-on-textarea"),r.workspace.trigger("send-to-thino",p,t)}};this.clipboard.on("text-changed",()=>{const p=this.clipboard.readText();a(p)}).on("image-changed",()=>{const p=this.clipboard.readImage();a(p)})}}class G2 extends x.EditorSuggest{constructor(n,r){super(n);he(this,"root");he(this,"editor");he(this,"cursor");he(this,"plugin");he(this,"tags");he(this,"type","customTag");he(this,"HASHTAG_REGEX",/(^|\s)#[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]*$/g);this.plugin=r}checkSettings(){return this.plugin.settings.UseVaultTags}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}fuzzySearchItemsOptimized(n,r){const a=x.prepareFuzzySearch(n);return r.map(s=>{const u=a(s);return u?{item:s,match:u}:null}).filter(Boolean)}onTrigger(n,r){if(!this.checkInMemosView(r)||this.checkSettings())return null;this.tags=Ie.getState().tags,this.cursor=n,this.editor=r;const a=n.line,o=r.getLine(a),s=o.substr(0,n.ch);if(s.match(this.HASHTAG_REGEX)&&o.substr(n.ch,1)!=="#"){const u=s.lastIndexOf("#"),d=s.substr(u+1);return{start:{line:a,ch:u},end:{line:a,ch:n.ch},query:d}}return null}getSuggestions(n){return this.fuzzySearchItemsOptimized(n.query,this.tags).map(r=>r.item).sort((r,a)=>r.localeCompare(a))||[]}renderSuggestion(n,r){r.setText(n)}selectSuggestion(n){if(this.context){const r=this.context.editor,a=this.context.start,o=this.context.end;r.transaction({changes:[{from:a,to:o,text:"#"+n+" "}]}),setTimeout(function(){return r.focus()})}this.close()}}const hb=crypto,SC=e=>e instanceof CryptoKey,Hg=new TextEncoder,mb=new TextDecoder;function xQ(...e){const t=e.reduce((a,{length:o})=>a+o,0),n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}const CQ=e=>{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{let t=e;t instanceof Uint8Array&&(t=mb.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return CQ(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class py extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(t){var n;super(t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}}class MQ extends py{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}class gy extends py{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}class xr extends py{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}class NQ extends py{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}function ls(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Bg(e,t){return e.name===t}function lw(e){return parseInt(e.name.slice(4),10)}function kQ(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function AQ(e,t){if(t.length&&!t.some(n=>e.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function OQ(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Bg(e.algorithm,"HMAC"))throw ls("HMAC");const r=parseInt(t.slice(2),10);if(lw(e.algorithm.hash)!==r)throw ls(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Bg(e.algorithm,"RSASSA-PKCS1-v1_5"))throw ls("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(lw(e.algorithm.hash)!==r)throw ls(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Bg(e.algorithm,"RSA-PSS"))throw ls("RSA-PSS");const r=parseInt(t.slice(2),10);if(lw(e.algorithm.hash)!==r)throw ls(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448")throw ls("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!Bg(e.algorithm,"ECDSA"))throw ls("ECDSA");const r=kQ(t);if(e.algorithm.namedCurve!==r)throw ls(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}AQ(e,n)}function IC(e,t,...n){var r;if(n.length>2){const a=n.pop();e+=`one of type ${n.join(", ")}, or ${a}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const q2=(e,...t)=>IC("Key must be ",e,...t);function TC(e,t,...n){return IC(`Key for the ${e} algorithm must be `,t,...n)}const EC=e=>SC(e),xi=["CryptoKey"],FQ=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const a=Object.keys(r);if(!n||n.size===0){n=new Set(a);continue}for(const o of a){if(n.has(o))return!1;n.add(o)}}return!0};function PQ(e){return typeof e=="object"&&e!==null}function J2(e){if(!PQ(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}const jQ=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}},ml=(e,t,n=0)=>{n===0&&(t.unshift(t.length),t.unshift(6));const r=e.indexOf(t[0],n);if(r===-1)return!1;const a=e.subarray(r,r+t.length);return a.length!==t.length?!1:a.every((o,s)=>o===t[s])||ml(e,t,r+1)},K2=e=>{switch(!0){case ml(e,[42,134,72,206,61,3,1,7]):return"P-256";case ml(e,[43,129,4,0,34]):return"P-384";case ml(e,[43,129,4,0,35]):return"P-521";case ml(e,[43,101,110]):return"X25519";case ml(e,[43,101,111]):return"X448";case ml(e,[43,101,112]):return"Ed25519";case ml(e,[43,101,113]):return"Ed448";default:throw new gy("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},LQ=async(e,t,n,r,a)=>{let o,s;const u=new Uint8Array(atob(n.replace(e,"")).split("").map(m=>m.charCodeAt(0))),d=t==="spki";switch(r){case"PS256":case"PS384":case"PS512":o={name:"RSA-PSS",hash:`SHA-${r.slice(-3)}`},s=d?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":o={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.slice(-3)}`},s=d?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":o={name:"RSA-OAEP",hash:`SHA-${parseInt(r.slice(-3),10)||1}`},s=d?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":o={name:"ECDSA",namedCurve:"P-256"},s=d?["verify"]:["sign"];break;case"ES384":o={name:"ECDSA",namedCurve:"P-384"},s=d?["verify"]:["sign"];break;case"ES512":o={name:"ECDSA",namedCurve:"P-521"},s=d?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const m=K2(u);o=m.startsWith("P-")?{name:"ECDH",namedCurve:m}:{name:m},s=d?[]:["deriveBits"];break}case"EdDSA":o={name:K2(u)},s=d?["verify"]:["sign"];break;default:throw new gy('Invalid or unsupported "alg" (Algorithm) value')}return hb.subtle.importKey(t,u,o,(a==null?void 0:a.extractable)??!1,s)},RQ=(e,t,n)=>LQ(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",e,t,n);async function _Q(e,t,n){if(typeof e!="string"||e.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw new TypeError('"spki" must be SPKI formatted string');return RQ(e,t,n)}const HQ=(e,t)=>{if(!(t instanceof Uint8Array)){if(!EC(t))throw new TypeError(TC(e,t,...xi,"Uint8Array"));if(t.type!=="secret")throw new TypeError(`${xi.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},BQ=(e,t,n)=>{if(!EC(t))throw new TypeError(TC(e,t,...xi));if(t.type==="secret")throw new TypeError(`${xi.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${xi.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${xi.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${xi.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${xi.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},YQ=(e,t,n)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?HQ(e,t):BQ(e,t,n)};function zQ(e,t,n,r,a){if(a.crit!==void 0&&r.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;n!==void 0?o=new Map([...Object.entries(n),...t.entries()]):o=t;for(const s of r.crit){if(!o.has(s))throw new gy(`Extension Header Parameter "${s}" is not recognized`);if(a[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(o.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)}const UQ=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};function VQ(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new gy(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}function ZQ(e,t,n){if(SC(t))return OQ(t,e,n),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(q2(t,...xi));return hb.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(q2(t,...xi,"Uint8Array"))}const WQ=async(e,t,n,r)=>{const a=await ZQ(e,t,"verify");jQ(e,a);const o=VQ(e,a.algorithm);try{return await hb.subtle.verify(o,a,n,r)}catch{return!1}};async function $Q(e,t,n){if(!J2(e))throw new xr("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new xr('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new xr("JWS Protected Header incorrect type");if(e.payload===void 0)throw new xr("JWS Payload missing");if(typeof e.signature!="string")throw new xr("JWS Signature missing or incorrect type");if(e.header!==void 0&&!J2(e.header))throw new xr("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const T=sw(e.protected);r=JSON.parse(mb.decode(T))}catch{throw new xr("JWS Protected Header is invalid")}if(!FQ(r,e.header))throw new xr("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...r,...e.header},o=zQ(xr,new Map([["b64",!0]]),n==null?void 0:n.crit,r,a);let s=!0;if(o.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new xr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:u}=a;if(typeof u!="string"||!u)throw new xr('JWS "alg" (Algorithm) Header Parameter missing or invalid');const d=n&&UQ("algorithms",n.algorithms);if(d&&!d.has(u))throw new MQ('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new xr("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new xr("JWS Payload must be a string or an Uint8Array instance");let m=!1;typeof t=="function"&&(t=await t(r,e),m=!0),YQ(u,t,"verify");const p=xQ(Hg.encode(e.protected??""),Hg.encode("."),typeof e.payload=="string"?Hg.encode(e.payload):e.payload);let g;try{g=sw(e.signature)}catch{throw new xr("Failed to base64url decode the signature")}if(!await WQ(u,t,g,p))throw new NQ;let D;if(s)try{D=sw(e.payload)}catch{throw new xr("Failed to base64url decode the payload")}else typeof e.payload=="string"?D=Hg.encode(e.payload):D=e.payload;const S={payload:D};return e.protected!==void 0&&(S.protectedHeader=r),e.header!==void 0&&(S.unprotectedHeader=e.header),m?{...S,key:t}:S}async function GQ(e,t,n){if(e instanceof Uint8Array&&(e=mb.decode(e)),typeof e!="string")throw new xr("Compact JWS must be a string or Uint8Array");const{0:r,1:a,2:o,length:s}=e.split(".");if(s!==3)throw new xr("Invalid Compact JWS");const u=await $Q({payload:a,protected:r,signature:o},t,n),d={payload:u.payload,protectedHeader:u.protectedHeader};return typeof t=="function"?{...d,key:u.key}:d}const qQ={webId:"globe-2",pinned:"pin",archived:"archive",visibility:"eye",deleted:"trash"};class JQ extends Ci.WidgetType{constructor(n,r,a,o,s){super();he(this,"error",!1);this.view=n,this.plugin=r,this.target=a,this.type=o,this.to=s}eq(n){return this.target===n.target}toDOM(){const n=createSpan();return n.toggleClass("thino-inline-widget",!0),x.setIcon(n,qQ[this.type]||"help-circle"),x.setTooltip&&x.setTooltip(n,this.target),n}}function KQ(e){class t{constructor(a){he(this,"view");he(this,"match",new Ci.MatchDecorator({regexp:/\[(webId|pinned|archived|visibility|deleted)::([^\]]+)\]/g,decorate:(a,o,s,u,d)=>{this.shouldRender(d,o,s)&&a(o,s,Ci.Decoration.replace({widget:new JQ(d,e,u[0],u[1],s)}))}}));he(this,"decorations",Ci.Decoration.none);this.view=a,this.updateDecorations(a)}update(a){this.updateDecorations(a.view,a)}destroy(){this.decorations=Ci.Decoration.none}updateDecorations(a,o){!o||this.decorations.size===0?this.decorations=this.match.createDeco(a):this.decorations=this.match.updateDeco(o,this.decorations)}isLivePreview(a){return a.field(x.editorLivePreviewField)}shouldRender(a,o,s){return!a.state.selection.ranges.some(d=>d.from<=o?d.to>=o:d.from<=s)&&this.isLivePreview(a.state)}}const n={decorations:r=>r.decorations.update({filter:(a,o,s)=>{const u=s.spec.widget;return u&&u.error?!1:a===o||!r.view.state.selection.ranges.filter(d=>{const m=d.from,p=d.to;return m<=a?p>=a:m<=o}).length}})};return Ci.ViewPlugin.fromClass(t,n)}const QQ=e=>e.ctrlKey!==void 0||e.metaKey!==void 0||e.shiftKey!==void 0||e.altKey!==void 0,Yg=()=>{new x.Notice(k("Open Memos Successfully"))},zg=[{id:"open-thino-in-left-sidebar",shortName:k("Left sidebar"),name:k("Open thino in left sidebar"),icon:"arrow-left",location:"left",cb:Yg,modKeys:"shift"},{id:"open-thino-in-right-sidebar",shortName:k("Right sidebar"),name:k("Open thino in right sidebar"),icon:"arrow-right",location:"right",cb:Yg,modKeys:["ctrl","meta"]},{id:"open-thino-in-float",shortName:k("Float window"),name:k("Open thino in float window"),icon:"layout",location:"float",cb:Yg,modKeys:"alt"},{id:"open-thino-in-center",shortName:k("Center window"),name:k("Open thino in center window"),icon:"tv-2",location:"center",cb:Yg,modKeys:void 0}];class XQ extends x.Plugin{constructor(){super(...arguments);he(this,"settings");he(this,"settingTab");he(this,"triggerBySelf",!1);he(this,"updatedID","");he(this,"debounceTimer",0);he(this,"apiHttpServer",null);he(this,"captureService",null);he(this,"loaded",!1)}async onload(){await this.loadSettings(),nK(),this.registerRibbon(),await this.verify(),this.checkVersionAndShowChangeLog(),this.settingTab=new mK(this.app,this),this.addSettingTab(this.settingTab),this.initEditor(),this.initURIHandler(),this.registerMobileEvent(),this.registerCommands(),this.registerCanvasNodeMemos(),this.registerHoverEvent(),this.registerEditorSuggest(new QJ(this.app,this)),this.registerEditorExtension([fQ]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(Hr,n=>new yl(n,this))}async loadSettings(){this.settings=Object.assign({},Oo,await this.loadData()),rt.setSettings(this.settings)}async saveSettings(){await this.saveData(this.settings),rt.setSettings(this.settings)}onunload(){var r;this.app.workspace.detachLeavesOfType(Hr),Ie.clearMemos(),Ee.dispatch({type:"CLEAR_MEMOS",payload:null}),Ee.dispatch({type:"CLEAR_FILES",payload:null}),Ee.dispatch({type:"CLEAR_VIEW",payload:null});const n=document.body.find(".dialog-wrapper");n&&((r=n.parentElement)==null||r.detach()),this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null),this.captureService&&this.captureService.onunload(),new x.Notice(k("Close Memos Successfully"))}initEditor(){const n=()=>{const r=this.app.embedRegistry;if(!r)return!1;const a=r.embedByExtension.md,o=createEl("div"),s=a({app:this.app,containerEl:o},null,null);if(s.editable=!0,s.set(""),s.showEditor(),!s.editMode)return!1;const u=Object.getPrototypeOf(Object.getPrototypeOf(s.editMode));return rt.setEditor(u),o.detach(),!0};this.app.workspace.onLayoutReady(()=>{n()||this.app.workspace.onLayoutReady(()=>{setTimeout(()=>{n()},100)})}),this.register(cv(x.MetadataCache.prototype,{getFileCache:r=>function(a){return!(a!=null&&a.path)&&!a?null:r.call(this,a)}}))}initApp(){rt.setApp(this.app)}initURIHandler(){this.registerObsidianProtocolHandler("thino",async n=>{var s,u,d;if(!n)return;if(n.userid)try{const m=n.userid;pQ(m,this.app),gQ(x.moment().add(30,"days").valueOf(),this.app),Qe.setRefresh(!0)}catch(m){console.error(m),new x.Notice(k("Failed to verify"))}if(n.token)try{const m=n.token;(s=this.app)==null||s.saveLocalStorage("tokenForSync",m),setTimeout(()=>{this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos"),this.settingTab.display()},200),new x.Notice(k("Saved sync token successfully"))}catch(m){console.error(m),new x.Notice(k("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const m=await dC();await navigator.clipboard.writeText(m),new x.Notice(k("Copied app id successfully"))}const r=(u=rt.getState())==null?void 0:u.verifyState,a=!x.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),o=x.Platform.isDesktop?await zn():a.identifier||a.uuid;if(!(!r||(r==null?void 0:r.appId)!==o)){if(n.content){const m=n.type,p=decodeURI(n.content)!==n.content?decodeURI(n.content):n.content,g=n.task,w=await Ie.createThino({content:p,type:m,isList:!!g});if(!w)return;Ie.pushMemo(w),We.clearQuery()}n.openId&&await Ie.openThinoByID(n.openId)}})}initGlobalManifest(){Qe.setPluginManifest(this.manifest)}stopServer(){this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null)}async initServer(){var o,s;if(x.Platform.isMobile||!this.settings.EnabledHttpApi)return;const n=(o=rt.getState())==null?void 0:o.verifyState,r=!x.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=x.Platform.isDesktop?await zn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.apiHttpServer=DQ(this.settings),this.initServerPort())}initServerPort(){this.apiHttpServer&&this.settings.EnabledHttpApi&&this.apiHttpServer.listen(this.settings.HttpApiIpType,this.settings.HttpApiPort)}async initCaptureService(){var o,s;if(x.Platform.isMobile||!this.settings.CaptureKey.EnableCaptureKey)return;const n=(o=rt.getState())==null?void 0:o.verifyState,r=!x.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=x.Platform.isDesktop?await zn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.captureService=new EQ(this.app,this),await this.captureService.onload())}registerMobileEvent(){x.Platform.isMobile&&(this.registerEvent(this.app.workspace.on("receive-text-menu",(n,r)=>{n.addItem(a=>{a.setIcon("popup-open").setTitle(k("Insert as Memo")).onClick(async()=>{const o=await Ie.createMemoDaily(r,!1);Ie.pushMemo(o)})})})),this.registerEvent(this.app.workspace.on("receive-files-menu",(n,r)=>{n.addItem(a=>{a.setIcon("popup-open").setTitle(k("Insert file as memo content")).onClick(async()=>{const o=r.map(u=>this.app.fileManager.generateMarkdownLink(u,u.path)),s=await Ie.createMemoDaily(o.join(`
`),!1);Ie.pushMemo(s)})})})))}registerCommands(){zg.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),x.Platform.isDesktop&&this.addCommand({id:"show-thino-editor",name:k("Show thino editor"),checkCallback:n=>{if(Ie.initialized&&rt.initialized)return n||new aC(this.app).open(),!0}}),this.addCommand({id:"lock-thino",name:k("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(yl)&&this.settings.needVerify)return n||Qe.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:k("Copy debug info"),callback:()=>{try{const n={settings:{...this.settings,tokenForVerify:"***"},manifest:this.manifest,obsidianVer:this.app.version,platform:x.Platform.resourcePathPrefix};navigator.clipboard.writeText(JSON.stringify(n,null,2)),new x.Notice(k("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"toggle-minimal-thino",name:k("Toggle minimal mode"),callback:()=>{const n=document.body.hasClass("minimal-thino");document.body.toggleClass("minimal-thino",!n)}}),this.addCommand({id:"focus-on-thino-editor",name:k("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:k("ReSync web thinos to local"),callback:()=>{pJ(this.app)}}),this.addCommand({id:"init-thino-sync",name:k("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new x.Notice(k("Please input token first"));return}if(!this.settings.startSync){new x.Notice(k("Please enable sync first"));return}try{await Ie.initSync()}catch(a){console.error(a),new x.Notice(k("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:k("Show daily thino dialog"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:k("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:k("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){this.initApp(),await this.initServer(),this.initGlobalManifest(),await this.initMemos(),this.autoOpenMemos(),this.registerThinoWidget(),await this.registerToolbarCheck(),await this.initCaptureService(),rt.setPlugin(this);const n=this.app.workspace.editorSuggest.suggests.findIndex(r=>r.type==="customTag");n!==-1?(this.app.workspace.editorSuggest.suggests.splice(n,1),this.app.workspace.editorSuggest.suggests.unshift(new G2(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(new G2(this.app,this))}async initMemos(){try{await this.initDailyNotes()}catch(n){console.error(n)}rt.getState(),Ie.getState(),await Ie.fetchAllMemos()}async initDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&await rt.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!x.requireApiVersion("1.2.0"))return;const n=o=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{const s=o.canvas.getData(),u=s.nodes.find(d=>d.id===o.id);if(u&&(r(u),o.canvas.setData(s),Ie.getMemoById(o.id))){const m=await Ie.updateMemo(o.id,u.text,u.thinoType);Ie.editMemo(m)}o.canvas.requestSave(!0)},0)},800)},r=o=>{o.createdAt||(o.createdAt=x.moment().format("YYYY-MM-DD HH:mm:ss")),o.updatedAt=x.moment().format("YYYY-MM-DD HH:mm:ss"),o.deletedAt=o.deletedAt?o.deletedAt:"",o.pinned=o.pinned?o.pinned:!1,o.visibility=o.visibility?o.visibility:"PUBLIC",o.rowStatus=o.rowStatus?o.rowStatus:"NORMAL",o.thinoType=o.thinoType?o.thinoType:"JOURNAL",o.hasId=o.hasId?o.hasId:"",o.linkId=o.linkId?o.linkId:"",o.resourceList=[]},a=()=>{var w,D;const o=(w=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:w.view;if(!o||!(o==null?void 0:o.canvas))return!1;const u=((D=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:D.view).canvas.nodes.values(),m=Array.from(u).filter(S=>S.text!==void 0);if(!m||m.length===0)return!1;const p=m[0].child;if(!p)return!1;const g=cv(p.constructor.prototype,{save:S=>function(...T){S.call(this,...T),this.node.isEditing&&n(this.node)}});return this.register(g),!0};this.app.workspace.onLayoutReady(()=>{if(!a()){const o=this.app.workspace.on("layout-change",()=>{a()&&this.app.workspace.offref(o)});this.registerEvent(o)}})}registerHoverEvent(){this.registerHoverLinkSource("thino",{defaultMod:!0,display:"Thino"})}registerRibbon(){this.addRibbonIcon("Memos",k("ribbonIconTitle"),async n=>{if(n.button===2){n.preventDefault();const r=new x.Menu;zg.forEach(a=>{r.addItem(o=>{o.setTitle(a.shortName).setIcon(a.icon).onClick(async()=>{await this.openMemos(a.location,a.cb)})})}),r.showAtMouseEvent(n);return}for(let r=0;rn[`${s}Key`];if(typeof a.modKeys=="string"&&o(a.modKeys)||Array.isArray(a.modKeys)&&a.modKeys.some(o)){await this.openMemos(a.location,a.cb);break}}})}registerThinoWidget(){this.registerEditorExtension([KQ(this)])}async registerToolbarCheck(){var o,s;if(this.loaded)return;const n=(o=rt.getState())==null?void 0:o.verifyState,r=!x.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=x.Platform.isDesktop?await zn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.registerEditorExtension([lQ(this.app)]),this.registerEditorSuggest(new XJ(this.app,this)),this.loaded=!0)}async verify(){var a;let n="";if(x.Platform.isDesktop)n=await zn();else{const o=await((a=window.Capacitor.Plugins.Device)==null?void 0:a.getId());if(!o)return;n=o.identifier||o.uuid}async function r(o){if(!o)return rt.setVerifyState(null),!1;const d=await _Q(`-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
-----END PUBLIC KEY-----`,"RS256");try{const{payload:m}=await GQ(o,d),p=JSON.parse(new TextDecoder().decode(m));return!p||p.iss!=="pkmer"||p.type!=="thino"||p.appId!==n?!1:(rt.setVerifyState(p),!0)}catch(m){console.error(m)}}return await r(this.settings.tokenForVerify[n])}async checkVersionAndShowChangeLog(){const n=this.manifest.version,r=this.settings.LastUpdatedVersion;n!==r&&(this.settings.LastUpdatedVersion=n,await this.saveSettings(),this.showChangeLog())}showChangeLog(){new pb(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(Hr).length>0||this.settings.MobileAndDesktop==="Mobile"&&x.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&x.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){const n=this.app.workspace.getLeavesOfType(Hr);if(!this.settings.OpenDailyMemosWithMemos){aw();return}if(n.length>0){aw();return}await this.openMemos(),aw()}async openMemos(n="center",r){const a=this.app.workspace;if(a.getLeavesOfType(Hr).length>0){const s=a.getLeavesOfType(Hr)[0];a.setActiveLeaf(s),a.revealLeaf(s);return}a.detachLeavesOfType(Hr);let o;switch(n){case"left":o=a.getLeftLeaf(!1);break;case"right":o=a.getRightLeaf(!1);break;case"float":o=a.getLeaf("window");break;default:o=a.getLeaf(!1);break}if(o&&(await o.setViewState({type:Hr}),a.revealLeaf(o)),this.settings.FocusOnEditor){const s=o.view.containerEl.querySelector("textarea");s&&s.focus()}r==null||r()}searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(Hr);if(!(r.length>0)){this.openMemos();return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".search-bar-inputer .text-input").focus()}async focusOnEditor(){if(!(this.app.workspace.getLeavesOfType(Hr).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(Hr);if(!(r.length>0)){new x.Notice(k("Please Open Memos First"));return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var o,s,u;const n=this.app.workspace;if(n.detachLeavesOfType(Hr),!this.app.plugins.getPlugin("obsidian-hover-editor")){new x.Notice(k("Please install obsidian-hover-editor plugin first"));return}const a=await((o=this.app.plugins.getPlugin("obsidian-hover-editor"))==null?void 0:o.spawnPopover());a&&(await a.setViewState({type:Hr}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(s=this.settings)!=null&&s.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((u=a.view.containerEl.querySelector("textarea"))==null||u.focus()))}}class pb extends x.Modal{constructor(n,r){super(n);he(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;n.createEl("h2",{text:k("Thino update info")+` version ${this.version}`});try{n.createEl("h3",{text:k("Latest version")});const r=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:k("Previous version")});const a=n.createDiv("prev-change-log"),s=await x.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new x.Component;const[u,d]=this.getLatestVersionContent(s.text);await x.MarkdownRenderer.render(this.app,u,r,"",this.component),await x.MarkdownRenderer.render(this.app,d,a,"",this.component)}catch(r){console.error(r),n.createEl("p",{text:k("Failed to load changelog")}),n.createEl("a",{text:k("View online"),attr:{href:"https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md",target:"_blank"}})}}getLatestVersionContent(n){const r=/^# .+/gm,a=[...n.matchAll(r)];if(a.length===0)return[n,""];const o=a[0].index||0;a[0][0].length;let s=n.length;a.length>1&&(s=a[1].index||n.length);const u=n.substring(o,s).trim(),d=n.substring(s).trim();return[u,d]}onClose(){var r;const{contentEl:n}=this;n.empty(),(r=this.component)==null||r.unload()}}exports.ChangeLogModal=pb;exports.default=XQ;