@synnaxlabs/drift 0.44.0 → 0.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tauri.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-yfMrLzJG.cjs"),K=require("./debounce-BUAIXXZt.cjs");function X(t,e,i,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ee(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var D;const h="__TAURI_TO_IPC_KEY__";function ie(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class te{get rid(){return X(this,D,"f")}constructor(e){D.set(this,void 0),ee(this,D,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}D=new WeakMap;var r;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(r||(r={}));async function U(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof i?.target=="string"?{kind:"AnyLabel",label:i.target}:(n=i?.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:ie(e)}).then(o=>async()=>U(t,o))}async function R(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function k(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function G(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new d(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class d{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class m extends te{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var I;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(I||(I={}));class ne{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var T;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(T||(T={}));function H(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function x(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const P=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await x()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return H()}static async getAll(){return x()}static async getFocusedWindow(){for(const e of await x())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(P.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(P.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return G(e,i,n)}_handleTauriEvent(e,i){return P.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===I.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e?.minWidth),minHeight:i(e?.minHeight),maxWidth:i(e?.maxWidth),maxHeight:i(e?.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(r.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ne(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}async onFocusChanged(e){const i=await this.listen(r.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(r.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var C;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(C||(C={}));var M;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(M||(M={}));var F;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(F||(F={}));function se(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size),workArea:{position:new u(t.workArea.position),size:new d(t.workArea.size)}}}async function le(){return s("plugin:window|available_monitors").then(t=>t.map(se))}function j(){return new L(H(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function B(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new L(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class L{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n?.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...n,label:i}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await B()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return B()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return G(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}}function J(){const t=j();return new b(t.label,{skip:!0})}async function S(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new b(e,{skip:!0})))}class b{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await S()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new b(n.label,{skip:!0}):null}static getCurrent(){return J()}static async getAll(){return S()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ae(b,[E,L]);function ae(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const re=t=>JSON.stringify(t),oe=t=>JSON.parse(t),W="drift://action",ue="tauri://error",ce="tauri://created",he=t=>new Error(`Window not found: ${t}`),p=250,we=c.a.seconds(1),v=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},de=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:v(i),size:v(e)}},be=async()=>(await le()).map(e=>{const i=O(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.$t.construct(i,n)}),V=async t=>(await be()).some(i=>c.$t.contains(i,t));class ye{win;unsubscribe;fullscreenPoll=null;constructor(e){this.win=e??J(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},we.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e?.()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=re({...e,emitter:n});if(i==null)return await k(W,l);const o=await b.getByLabel(i);if(o==null)throw he(i);await o.emit(W,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[W]=await f(W,n=>e(oe(n.payload)));const i=pe();for(const{key:n,handler:l,debounce:o}of i)this.unsubscribe[n]=await this.win.listen(n,K.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},o))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.m.copy(i);const{size:n,minSize:l,maxSize:o,position:a,...Z}=de(i);n?.width!=null&&(n.width=Math.max(n.width,p)),n?.height!=null&&(n.height=Math.max(n.height,p)),o?.width!=null&&(o.width=Math.max(o.width,p)),o?.height!=null&&(o.height=Math.max(o.height,p)),a!=null&&(await V(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a?.x,y:a?.y,width:n?.width,height:n?.height,minWidth:l?.width,minHeight:l?.height,maxWidth:o?.width,maxHeight:o?.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Z});return await new Promise(($,Q)=>{g.once(ue,Y=>Q(new Error(JSON.stringify(Y.payload)))),g.once(ce,()=>$())})}catch(g){console.error(g)}}async close(e){const i=await b.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await S();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await S()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await V(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=v(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=v(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=v(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){return r.WINDOW_RESIZED in this.unsubscribe&&!e&&(this.unsubscribe[r.WINDOW_RESIZED]?.(),delete this.unsubscribe[r.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:O(await this.win.innerPosition(),e),size:q(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const pe=()=>[{key:r.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:O(await t.innerPosition(),e),size:q(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:r.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await t?.scaleFactor();if(e==null)return null;const i=O(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:r.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:r.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],O=(t,e)=>c.J.scale(t,1/e),q=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=ye;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-pRw1_Nwc.cjs"),Y=require("./debounce-BUAIXXZt.cjs");function X(t,e,i,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ee(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var D;const h="__TAURI_TO_IPC_KEY__";function ie(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class te{get rid(){return X(this,D,"f")}constructor(e){D.set(this,void 0),ee(this,D,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}D=new WeakMap;var r;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(r||(r={}));async function U(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof i?.target=="string"?{kind:"AnyLabel",label:i.target}:(n=i?.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:ie(e)}).then(o=>async()=>U(t,o))}async function R(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function k(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function H(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new d(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class d{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class m extends te{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var I;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(I||(I={}));class ne{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var T;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(T||(T={}));function G(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function x(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const P=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await x()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return G()}static async getAll(){return x()}static async getFocusedWindow(){for(const e of await x())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(P.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(P.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return P.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===I.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e?.minWidth),minHeight:i(e?.minHeight),maxWidth:i(e?.maxWidth),maxHeight:i(e?.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(r.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ne(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}async onFocusChanged(e){const i=await this.listen(r.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(r.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var C;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(C||(C={}));var M;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(M||(M={}));var F;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(F||(F={}));function se(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size),workArea:{position:new u(t.workArea.position),size:new d(t.workArea.size)}}}async function le(){return s("plugin:window|available_monitors").then(t=>t.map(se))}function j(){return new L(G(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function B(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new L(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class L{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n?.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...n,label:i}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await B()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return B()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}}function q(){const t=j();return new b(t.label,{skip:!0})}async function S(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new b(e,{skip:!0})))}class b{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await S()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new b(n.label,{skip:!0}):null}static getCurrent(){return q()}static async getAll(){return S()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ae(b,[E,L]);function ae(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const re=t=>JSON.stringify(t),oe=t=>JSON.parse(t),W="drift://action",ue="tauri://error",ce="tauri://created",he=t=>new Error(`Window not found: ${t}`),p=250,we=c.i.seconds(1),v=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},de=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:v(i),size:v(e)}},be=async()=>(await le()).map(e=>{const i=O(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.Ho.construct(i,n)}),V=async t=>(await be()).some(i=>c.Ho.contains(i,t));class ye{win;unsubscribe;fullscreenPoll=null;constructor(e){this.win=e??q(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},we.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e?.()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=re({...e,emitter:n});if(i==null)return await k(W,l);const o=await b.getByLabel(i);if(o==null)throw he(i);await o.emit(W,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[W]=await f(W,n=>e(oe(n.payload)));const i=pe();for(const{key:n,handler:l,debounce:o}of i)this.unsubscribe[n]=await this.win.listen(n,Y.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},o))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.N.copy(i);const{size:n,minSize:l,maxSize:o,position:a,...Z}=de(i);n?.width!=null&&(n.width=Math.max(n.width,p)),n?.height!=null&&(n.height=Math.max(n.height,p)),o?.width!=null&&(o.width=Math.max(o.width,p)),o?.height!=null&&(o.height=Math.max(o.height,p)),a!=null&&(await V(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a?.x,y:a?.y,width:n?.width,height:n?.height,minWidth:l?.width,minHeight:l?.height,maxWidth:o?.width,maxHeight:o?.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Z});return await new Promise(($,K)=>{g.once(ue,Q=>K(new Error(JSON.stringify(Q.payload)))),g.once(ce,()=>$())})}catch(g){console.error(g)}}async close(e){const i=await b.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await S();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await S()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await V(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=v(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=v(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=v(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){return r.WINDOW_RESIZED in this.unsubscribe&&!e&&(this.unsubscribe[r.WINDOW_RESIZED]?.(),delete this.unsubscribe[r.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:O(await this.win.innerPosition(),e),size:J(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const pe=()=>[{key:r.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:O(await t.innerPosition(),e),size:J(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:r.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await t?.scaleFactor();if(e==null)return null;const i=O(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:r.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:r.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],O=(t,e)=>c.K.scale(t,1/e),J=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=ye;
package/dist/tauri.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G as X, H as ee, r as g, M as ie, K as te, _ as ne, J as se, $ as U } from "./state-D41-Dai4.js";
1
+ import { G as X, H as ee, r as g, M as ie, N as te, _ as ne, K as se, J as U } from "./state-Ca5Yd_KX.js";
2
2
  import { o as le } from "./debounce-DOZKRZa9.js";
3
3
  function ae(t, e, i, n) {
4
4
  if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -239,7 +239,7 @@ class d {
239
239
  return this[c]();
240
240
  }
241
241
  }
242
- class m extends ue {
242
+ class v extends ue {
243
243
  /**
244
244
  * Creates an Image from a resource ID. For internal use only.
245
245
  *
@@ -254,7 +254,7 @@ class m extends ue {
254
254
  rgba: z(e),
255
255
  width: i,
256
256
  height: n
257
- }).then((l) => new m(l));
257
+ }).then((l) => new v(l));
258
258
  }
259
259
  /**
260
260
  * Creates a new image using the provided bytes by inferring the file format.
@@ -272,7 +272,7 @@ class m extends ue {
272
272
  static async fromBytes(e) {
273
273
  return s("plugin:image|from_bytes", {
274
274
  bytes: z(e)
275
- }).then((i) => new m(i));
275
+ }).then((i) => new v(i));
276
276
  }
277
277
  /**
278
278
  * Creates a new image using the provided path.
@@ -287,7 +287,7 @@ class m extends ue {
287
287
  * ```
288
288
  */
289
289
  static async fromPath(e) {
290
- return s("plugin:image|from_path", { path: e }).then((i) => new m(i));
290
+ return s("plugin:image|from_path", { path: e }).then((i) => new v(i));
291
291
  }
292
292
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
293
293
  async rgba() {
@@ -301,7 +301,7 @@ class m extends ue {
301
301
  }
302
302
  }
303
303
  function z(t) {
304
- return t == null ? null : typeof t == "string" ? t : t instanceof m ? t.rid : t;
304
+ return t == null ? null : typeof t == "string" ? t : t instanceof v ? t.rid : t;
305
305
  }
306
306
  var R;
307
307
  (function(t) {
@@ -2523,15 +2523,15 @@ function be(t, e) {
2523
2523
  });
2524
2524
  });
2525
2525
  }
2526
- const de = (t) => JSON.stringify(t), ye = (t) => JSON.parse(t), D = "drift://action", pe = "tauri://error", ge = "tauri://created", _e = (t) => new Error(`Window not found: ${t}`), y = 250, me = X.seconds(1), v = (t) => {
2526
+ const de = (t) => JSON.stringify(t), ye = (t) => JSON.parse(t), D = "drift://action", pe = "tauri://error", ge = "tauri://created", _e = (t) => new Error(`Window not found: ${t}`), y = 250, ve = X.seconds(1), m = (t) => {
2527
2527
  if (t != null)
2528
2528
  return {
2529
2529
  width: Math.max(t.width, y),
2530
2530
  height: Math.max(t.height, y)
2531
2531
  };
2532
- }, ve = (t) => {
2532
+ }, me = (t) => {
2533
2533
  const { size: e, maxSize: i } = t;
2534
- return { ...t, maxSize: v(i), size: v(e) };
2534
+ return { ...t, maxSize: m(i), size: m(e) };
2535
2535
  }, fe = async () => (await we()).map((e) => {
2536
2536
  const i = S(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
2537
2537
  return U.construct(i, n);
@@ -2566,7 +2566,7 @@ class Oe {
2566
2566
  "WHITELIST"
2567
2567
  ).catch(console.error));
2568
2568
  }).catch(console.error);
2569
- }, me.milliseconds);
2569
+ }, ve.milliseconds);
2570
2570
  }
2571
2571
  label() {
2572
2572
  return this.win.label;
@@ -2609,7 +2609,7 @@ class Oe {
2609
2609
  }
2610
2610
  async create(e, i) {
2611
2611
  i = te.copy(i);
2612
- const { size: n, minSize: l, maxSize: o, position: a, ...$ } = ve(i);
2612
+ const { size: n, minSize: l, maxSize: o, position: a, ...$ } = me(i);
2613
2613
  n?.width != null && (n.width = Math.max(n.width, y)), n?.height != null && (n.height = Math.max(n.height, y)), o?.width != null && (o.width = Math.max(o.width, y)), o?.height != null && (o.height = Math.max(o.height, y)), a != null && (await V(a) || (a.x = 0, a.y = 0));
2614
2614
  try {
2615
2615
  const p = new b(e, {
@@ -2675,13 +2675,13 @@ class Oe {
2675
2675
  await V(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
2676
2676
  }
2677
2677
  async setSize(e) {
2678
- e = v(e), await this.win.setSize(new _(e.width, e.height));
2678
+ e = m(e), await this.win.setSize(new _(e.width, e.height));
2679
2679
  }
2680
2680
  async setMinSize(e) {
2681
- e = v(e), await this.win.setMinSize(new _(e.width, e.height));
2681
+ e = m(e), await this.win.setMinSize(new _(e.width, e.height));
2682
2682
  }
2683
2683
  async setMaxSize(e) {
2684
- e = v(e), await this.win.setMaxSize(new _(e.width, e.height));
2684
+ e = m(e), await this.win.setMaxSize(new _(e.width, e.height));
2685
2685
  }
2686
2686
  async setResizable(e) {
2687
2687
  return r.WINDOW_RESIZED in this.unsubscribe && !e && (this.unsubscribe[r.WINDOW_RESIZED]?.(), delete this.unsubscribe[r.WINDOW_RESIZED]), await this.win.setResizable(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/drift",
3
- "version": "0.44.0",
3
+ "version": "0.44.2",
4
4
  "description": "State synchronization and Redux state synchronization for Tauri Apps",
5
5
  "repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "react-dom": "^19.1.0",
23
23
  "react-redux": "^9.2.0",
24
24
  "zod": "^4.0.2",
25
- "@synnaxlabs/x": "^0.44.0"
25
+ "@synnaxlabs/x": "^0.44.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "^19.1.8",
@@ -35,9 +35,9 @@
35
35
  "typescript": "^5.8.3",
36
36
  "vite": "^7.0.4",
37
37
  "vitest": "^3.2.4",
38
+ "eslint-config-synnaxlabs": "^0.43.0",
38
39
  "@synnaxlabs/tsconfig": "^0.43.0",
39
- "@synnaxlabs/vite-plugin": "^0.43.0",
40
- "eslint-config-synnaxlabs": "^0.43.0"
40
+ "@synnaxlabs/vite-plugin": "^0.43.0"
41
41
  },
42
42
  "files": [
43
43
  "dist"