bundle.global.js 17 KB

12
  1. "use strict";var __TAURI_IIFE__=(()=>{var D=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var n in e)D(t,n,{get:e[n],enumerable:!0})},Y=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of J(e))!K.call(t,u)&&u!==n&&D(t,u,{get:()=>e[u],enumerable:!(o=Z(e,u))||o.enumerable});return t};var X=t=>Y(D({},"__esModule",{value:!0}),t);var N=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var C=(t,e,n)=>(N(t,e,"read from private field"),n?n.call(t):e.get(t)),O=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},x=(t,e,n,o)=>(N(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n);var Ve={};p(Ve,{app:()=>L,dpi:()=>k,event:()=>W,path:()=>A,primitives:()=>z,window:()=>S});var L={};p(L,{getName:()=>ne,getTauriVersion:()=>te,getVersion:()=>ie,hide:()=>oe,show:()=>re});var z={};p(z,{Channel:()=>y,PluginListener:()=>w,addPluginListener:()=>B,convertFileSrc:()=>ee,invoke:()=>i,transformCallback:()=>P});function P(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}var m,y=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;O(this,m,()=>{});this.id=P(e=>{C(this,m).call(this,e)})}set onmessage(e){x(this,m,e)}get onmessage(){return C(this,m)}toJSON(){return`__CHANNEL__:${this.id}`}};m=new WeakMap;var w=class{constructor(e,n,o){this.plugin=e,this.event=n,this.channelId=o}async unregister(){return i(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function B(t,e,n){let o=new y;return o.onmessage=n,i(`plugin:${t}|register_listener`,{event:e,handler:o}).then(()=>new w(t,e,o.id))}async function i(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}function ee(t,e="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(t,e)}async function ie(){return i("plugin:app|version")}async function ne(){return i("plugin:app|name")}async function te(){return i("plugin:app|tauri_version")}async function re(){return i("plugin:app|app_show")}async function oe(){return i("plugin:app|app_hide")}var W={};p(W,{TauriEvent:()=>I,emit:()=>E,listen:()=>v,once:()=>T});var I=(a=>(a.WINDOW_RESIZED="tauri://resize",a.WINDOW_MOVED="tauri://move",a.WINDOW_CLOSE_REQUESTED="tauri://close-requested",a.WINDOW_CREATED="tauri://window-created",a.WINDOW_DESTROYED="tauri://destroyed",a.WINDOW_FOCUS="tauri://focus",a.WINDOW_BLUR="tauri://blur",a.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",a.WINDOW_THEME_CHANGED="tauri://theme-changed",a.WINDOW_FILE_DROP="tauri://file-drop",a.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",a.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",a.MENU="tauri://menu",a))(I||{});async function F(t,e){await i("plugin:event|unlisten",{event:t,eventId:e})}async function v(t,e,n){return i("plugin:event|listen",{event:t,windowLabel:n?.target,handler:P(e)}).then(o=>async()=>F(t,o))}async function T(t,e,n){return v(t,o=>{e(o),F(t,o.id).catch(()=>{})},n)}async function E(t,e,n){await i("plugin:event|emit",{event:t,windowLabel:n?.target,payload:e})}var S={};p(S,{CloseRequestedEvent:()=>f,Effect:()=>G,EffectState:()=>q,LogicalPosition:()=>b,LogicalSize:()=>h,PhysicalPosition:()=>d,PhysicalSize:()=>c,ProgressBarStatus:()=>H,UserAttentionType:()=>M,Window:()=>g,availableMonitors:()=>ae,currentMonitor:()=>se,getAll:()=>_,getCurrent:()=>V,primaryMonitor:()=>le});var k={};p(k,{LogicalPosition:()=>b,LogicalSize:()=>h,PhysicalPosition:()=>d,PhysicalSize:()=>c});var h=class{constructor(e,n){this.type="Logical";this.width=e,this.height=n}},c=class{constructor(e,n){this.type="Physical";this.width=e,this.height=n}toLogical(e){return new h(this.width/e,this.height/e)}},b=class{constructor(e,n){this.type="Logical";this.x=e,this.y=n}},d=class{constructor(e,n){this.type="Physical";this.x=e,this.y=n}toLogical(e){return new b(this.x/e,this.y/e)}};var M=(n=>(n[n.Critical=1]="Critical",n[n.Informational=2]="Informational",n))(M||{}),f=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},H=(l=>(l.None="none",l.Normal="normal",l.Indeterminate="indeterminate",l.Paused="paused",l.Error="error",l))(H||{});function V(){return new g(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function _(){return window.__TAURI_INTERNALS__.metadata.windows.map(t=>new g(t.label,{skip:!0}))}var U=["tauri://created","tauri://error"],g=class t{constructor(e,n={}){this.label=e,this.listeners=Object.create(null),n?.skip||i("plugin:window|create",{options:{...n,label:e}}).then(async()=>this.emit("tauri://created")).catch(async o=>this.emit("tauri://error",o))}static getByLabel(e){return _().some(n=>n.label===e)?new t(e,{skip:!0}):null}static getCurrent(){return V()}static getAll(){return _()}static async getFocusedWindow(){for(let e of _())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{let o=this.listeners[e];o.splice(o.indexOf(n),1)}):v(e,n,{target:this.label})}async once(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{let o=this.listeners[e];o.splice(o.indexOf(n),1)}):T(e,n,{target:this.label})}async emit(e,n){if(U.includes(e)){for(let o of this.listeners[e]||[])o({event:e,id:-1,windowLabel:this.label,payload:n});return Promise.resolve()}return E(e,n,{target:this.label})}_handleTauriEvent(e,n){return U.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then(({x:e,y:n})=>new d(e,n))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then(({x:e,y:n})=>new d(e,n))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then(({width:e,height:n})=>new c(e,n))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then(({width:e,height:n})=>new c(e,n))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===1?n={type:"Critical"}:n={type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:typeof e=="string"?e:Array.from(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async onResized(e){return this.listen("tauri://resize",n=>{n.payload=j(n.payload),e(n)})}async onMoved(e){return this.listen("tauri://move",n=>{n.payload=$(n.payload),e(n)})}async onCloseRequested(e){return this.listen("tauri://close-requested",n=>{let o=new f(n);Promise.resolve(e(o)).then(()=>{if(!o.isPreventDefault())return this.close()})})}async onFocusChanged(e){let n=await this.listen("tauri://focus",u=>{e({...u,payload:!0})}),o=await this.listen("tauri://blur",u=>{e({...u,payload:!1})});return()=>{n(),o()}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let n=await this.listen("tauri://file-drop",l=>{e({...l,payload:{type:"drop",paths:l.payload}})}),o=await this.listen("tauri://file-drop-hover",l=>{e({...l,payload:{type:"hover",paths:l.payload}})}),u=await this.listen("tauri://file-drop-cancelled",l=>{e({...l,payload:{type:"cancel"}})});return()=>{n(),o(),u()}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},G=(s=>(s.AppearanceBased="appearanceBased",s.Light="light",s.Dark="dark",s.MediumLight="mediumLight",s.UltraDark="ultraDark",s.Titlebar="titlebar",s.Selection="selection",s.Menu="menu",s.Popover="popover",s.Sidebar="sidebar",s.HeaderView="headerView",s.Sheet="sheet",s.WindowBackground="windowBackground",s.HudWindow="hudWindow",s.FullScreenUI="fullScreenUI",s.Tooltip="tooltip",s.ContentBackground="contentBackground",s.UnderWindowBackground="underWindowBackground",s.UnderPageBackground="underPageBackground",s.Mica="mica",s.Blur="blur",s.Acrylic="acrylic",s.Tabbed="tabbed",s.TabbedDark="tabbedDark",s.TabbedLight="tabbedLight",s))(G||{}),q=(o=>(o.FollowsWindowActiveState="followsWindowActiveState",o.Active="active",o.Inactive="inactive",o))(q||{});function R(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:$(t.position),size:j(t.size)}}function $(t){return new d(t.x,t.y)}function j(t){return new c(t.width,t.height)}async function se(){return i("plugin:window|current_monitor").then(R)}async function le(){return i("plugin:window|primary_monitor").then(R)}async function ae(){return i("plugin:window|available_monitors").then(t=>t.map(R))}var A={};p(A,{BaseDirectory:()=>Q,appCacheDir:()=>pe,appConfigDir:()=>ue,appDataDir:()=>ce,appLocalDataDir:()=>de,appLogDir:()=>ke,audioDir:()=>me,basename:()=>Me,cacheDir:()=>he,configDir:()=>be,dataDir:()=>ge,delimiter:()=>Ae,desktopDir:()=>ye,dirname:()=>Fe,documentDir:()=>we,downloadDir:()=>Pe,executableDir:()=>ve,extname:()=>Ue,fontDir:()=>_e,homeDir:()=>fe,isAbsolute:()=>He,join:()=>xe,localDataDir:()=>De,normalize:()=>Oe,pictureDir:()=>Ce,publicDir:()=>ze,resolve:()=>Ne,resolveResource:()=>Ie,resourceDir:()=>Le,runtimeDir:()=>Te,sep:()=>Se,tempDir:()=>Re,templateDir:()=>Ee,videoDir:()=>We});var Q=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(Q||{});async function ue(){return i("plugin:path|resolve_directory",{directory:13})}async function ce(){return i("plugin:path|resolve_directory",{directory:14})}async function de(){return i("plugin:path|resolve_directory",{directory:15})}async function pe(){return i("plugin:path|resolve_directory",{directory:16})}async function me(){return i("plugin:path|resolve_directory",{directory:1})}async function he(){return i("plugin:path|resolve_directory",{directory:2})}async function be(){return i("plugin:path|resolve_directory",{directory:3})}async function ge(){return i("plugin:path|resolve_directory",{directory:4})}async function ye(){return i("plugin:path|resolve_directory",{directory:18})}async function we(){return i("plugin:path|resolve_directory",{directory:6})}async function Pe(){return i("plugin:path|resolve_directory",{directory:7})}async function ve(){return i("plugin:path|resolve_directory",{directory:19})}async function _e(){return i("plugin:path|resolve_directory",{directory:20})}async function fe(){return i("plugin:path|resolve_directory",{directory:21})}async function De(){return i("plugin:path|resolve_directory",{directory:5})}async function Ce(){return i("plugin:path|resolve_directory",{directory:8})}async function ze(){return i("plugin:path|resolve_directory",{directory:9})}async function Le(){return i("plugin:path|resolve_directory",{directory:11})}async function Ie(t){return i("plugin:path|resolve_directory",{directory:11,path:t})}async function Te(){return i("plugin:path|resolve_directory",{directory:22})}async function Ee(){return i("plugin:path|resolve_directory",{directory:23})}async function We(){return i("plugin:path|resolve_directory",{directory:10})}async function ke(){return i("plugin:path|resolve_directory",{directory:17})}async function Re(t){return i("plugin:path|resolve_directory",{directory:12})}function Se(){return window.__TAURI_INTERNALS__.plugins.path.sep}function Ae(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function Ne(...t){return i("plugin:path|resolve",{paths:t})}async function Oe(t){return i("plugin:path|normalize",{path:t})}async function xe(...t){return i("plugin:path|join",{paths:t})}async function Fe(t){return i("plugin:path|dirname",{path:t})}async function Ue(t){return i("plugin:path|extname",{path:t})}async function Me(t,e){return i("plugin:path|basename",{path:t,ext:e})}async function He(t){return i("plugin:path|isAbsolute",{path:t})}return X(Ve);})();
  2. window.__TAURI__ = __TAURI_IIFE__