diff --git a/.changes/tracing.md b/.changes/tracing.md new file mode 100644 index 000000000000..baee89fdbb1c --- /dev/null +++ b/.changes/tracing.md @@ -0,0 +1,7 @@ +--- +"tauri": patch:enhance +"tauri-runtime-wry": patch:enhance +"tauri-macros": patch:enhance +--- + +Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag. diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 46aafffaa561..f56316088efd 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -13,7 +13,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { version = "0.35", default-features = false, features = [ "file-drop", "protocol", "os-webview" ] } +wry = { version = "0.35.2", default-features = false, features = [ "file-drop", "protocol", "os-webview" ] } tao = { version = "0.24", default-features = false, features = [ "rwh_05" ] } tauri-runtime = { version = "1.0.0-alpha.7", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.12", path = "../tauri-utils" } @@ -48,4 +48,4 @@ macos-private-api = [ ] objc-exception = [ "wry/objc-exception" ] linux-protocol-body = [ "wry/linux-body", "webkit2gtk/v2_40" ] -tracing = [ "dep:tracing" ] +tracing = [ "dep:tracing", "wry/tracing" ] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 61dde457bbb9..3b81c31ea909 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -1070,9 +1070,9 @@ pub enum WindowMessage { #[derive(Debug, Clone)] pub enum WebviewMessage { - #[cfg(not(feature = "tracing"))] + #[cfg(not(all(feature = "tracing", not(target_os = "android"))))] EvaluateScript(String), - #[cfg(feature = "tracing")] + #[cfg(all(feature = "tracing", not(target_os = "android")))] EvaluateScript(String, Sender<()>, tracing::Span), #[allow(dead_code)] WebviewEvent(WebviewEvent), @@ -1583,7 +1583,7 @@ impl Dispatch for WryDispatcher { ) } - #[cfg(feature = "tracing")] + #[cfg(all(feature = "tracing", not(target_os = "android")))] fn eval_script>(&self, script: S) -> Result<()> { // use a channel so the EvaluateScript task uses the current span as parent let (tx, rx) = channel(); @@ -1597,7 +1597,7 @@ impl Dispatch for WryDispatcher { ) } - #[cfg(not(feature = "tracing"))] + #[cfg(not(all(feature = "tracing", not(target_os = "android"))))] fn eval_script>(&self, script: S) -> Result<()> { send_user_message( &self.context, @@ -2429,7 +2429,7 @@ fn handle_user_message( } } Message::Webview(id, webview_message) => match webview_message { - #[cfg(feature = "tracing")] + #[cfg(all(feature = "tracing", not(target_os = "android")))] WebviewMessage::EvaluateScript(script, tx, span) => { let _span = span.entered(); if let Some(WindowHandle::Webview { inner: webview, .. }) = @@ -2441,7 +2441,7 @@ fn handle_user_message( } tx.send(()).unwrap(); } - #[cfg(not(feature = "tracing"))] + #[cfg(not(all(feature = "tracing", not(target_os = "android"))))] WebviewMessage::EvaluateScript(script) => { if let Some(WindowHandle::Webview { inner: webview, .. }) = windows.borrow().get(&id).and_then(|w| w.inner.as_ref()) diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 92f2791871ed..c9de41b64d43 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -762,6 +762,10 @@ shared_app_impl!(App); shared_app_impl!(AppHandle); impl App { + #[cfg_attr( + feature = "tracing", + tracing::instrument(name = "app::core_plugins::register") + )] fn register_core_plugins(&self) -> crate::Result<()> { self.handle.plugin(crate::path::plugin::init())?; self.handle.plugin(crate::event::plugin::init())?; @@ -1663,6 +1667,7 @@ unsafe impl HasRawDisplayHandle for App { } } +#[cfg_attr(feature = "tracing", tracing::instrument(name = "app::setup"))] fn setup(app: &mut App) -> crate::Result<()> { let pending_windows = app.pending_windows.take(); if let Some(pending_windows) = pending_windows { diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index eb37295f959e..9d7412d7460e 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -204,6 +204,19 @@ pub enum InvokeResponse { Err(InvokeError), } +impl Serialize for InvokeResponse { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + match self { + Self::Ok(InvokeBody::Json(j)) => j.serialize(serializer), + Self::Ok(InvokeBody::Raw(b)) => b.serialize(serializer), + Self::Err(e) => e.0.serialize(serializer), + } + } +} + impl> From> for InvokeResponse { #[inline] fn from(result: Result) -> Self { diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 14e5780dec39..694b50467a19 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -4,16 +4,15 @@ use std::{borrow::Cow, sync::Arc}; -use http::{ - header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, - HeaderValue, Method, StatusCode, -}; - use crate::{ manager::AppManager, window::{InvokeRequest, UriSchemeProtocolHandler}, Runtime, }; +use http::{ + header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, + HeaderValue, Method, StatusCode, +}; use super::{CallbackFn, InvokeBody, InvokeResponse}; @@ -29,6 +28,14 @@ pub fn message_handler( pub fn get(manager: Arc>, label: String) -> UriSchemeProtocolHandler { Box::new(move |request, responder| { + #[cfg(feature = "tracing")] + let span = tracing::trace_span!( + "ipc::request", + kind = "custom-protocol", + request = tracing::field::Empty + ) + .entered(); + let manager = manager.clone(); let label = label.clone(); @@ -44,9 +51,35 @@ pub fn get(manager: Arc>, label: String) -> UriSchemeP if let Some(window) = manager.get_window(&label) { match parse_invoke_request(&manager, request) { Ok(request) => { + #[cfg(feature = "tracing")] + span.record( + "request", + match &request.body { + InvokeBody::Json(j) => serde_json::to_string(j).unwrap(), + InvokeBody::Raw(b) => serde_json::to_string(b).unwrap(), + }, + ); + #[cfg(feature = "tracing")] + let request_span = tracing::trace_span!("ipc::request::handle", cmd = request.cmd); + window.on_message( request, Box::new(move |_window, _cmd, response, _callback, _error| { + #[cfg(feature = "tracing")] + let _respond_span = tracing::trace_span!( + parent: &request_span, + "ipc::request::respond" + ) + .entered(); + + #[cfg(feature = "tracing")] + let response_span = tracing::trace_span!( + "ipc::request::response", + response = serde_json::to_string(&response).unwrap(), + mime_type = tracing::field::Empty + ) + .entered(); + let (mut response, mime_type) = match response { InvokeResponse::Ok(InvokeBody::Json(v)) => ( http::Response::new(serde_json::to_vec(&v).unwrap().into()), @@ -64,6 +97,9 @@ pub fn get(manager: Arc>, label: String) -> UriSchemeP } }; + #[cfg(feature = "tracing")] + response_span.record("mime_type", mime_type.essence_str()); + response.headers_mut().insert( CONTENT_TYPE, HeaderValue::from_str(mime_type.essence_str()).unwrap(), @@ -129,6 +165,10 @@ pub fn get(manager: Arc>, label: String) -> UriSchemeP #[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))] fn handle_ipc_message(message: String, manager: &AppManager, label: &str) { if let Some(window) = manager.get_window(label) { + #[cfg(feature = "tracing")] + let _span = + tracing::trace_span!("ipc::request", kind = "post-message", request = message).entered(); + use serde::{Deserialize, Deserializer}; pub(crate) struct HeaderMap(http::HeaderMap); @@ -185,6 +225,9 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe } if let crate::Pattern::Isolation { crypto_keys, .. } = &*manager.pattern { + #[cfg(feature = "tracing")] + let _span = tracing::trace_span!("ipc::request::decrypt_isolation_payload").entered(); + invoke_message.replace( serde_json::from_str::>(&message) .map_err(Into::into) @@ -201,18 +244,25 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe } } - match invoke_message - .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) - { + match invoke_message.unwrap_or_else(|| { + #[cfg(feature = "tracing")] + let _span = tracing::trace_span!("ipc::request::deserialize").entered(); + serde_json::from_str::(&message).map_err(Into::into) + }) { Ok(message) => { + let request = InvokeRequest { + cmd: message.cmd, + callback: message.callback, + error: message.error, + body: message.payload.into(), + headers: message.options.map(|o| o.headers.0).unwrap_or_default(), + }; + + #[cfg(feature = "tracing")] + let request_span = tracing::trace_span!("ipc::request::handle", cmd = request.cmd); + window.on_message( - InvokeRequest { - cmd: message.cmd, - callback: message.callback, - error: message.error, - body: message.payload.into(), - headers: message.options.map(|o| o.headers.0).unwrap_or_default(), - }, + request, Box::new(move |window, cmd, response, callback, error| { use crate::ipc::{ format_callback::{ @@ -222,6 +272,13 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe }; use serde_json::Value as JsonValue; + #[cfg(feature = "tracing")] + let _respond_span = tracing::trace_span!( + parent: &request_span, + "ipc::request::respond" + ) + .entered(); + // the channel data command is the only command that uses a custom protocol on Linux if window.manager.window.invoke_responder.is_none() && cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND @@ -240,6 +297,19 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe let _ = window.eval(&eval_js); } + #[cfg(feature = "tracing")] + let _response_span = tracing::trace_span!( + "ipc::request::response", + response = serde_json::to_string(&response).unwrap(), + mime_type = match &response { + InvokeResponse::Ok(InvokeBody::Json(_)) => mime::APPLICATION_JSON, + InvokeResponse::Ok(InvokeBody::Raw(_)) => mime::APPLICATION_OCTET_STREAM, + InvokeResponse::Err(_) => mime::TEXT_PLAIN, + } + .essence_str() + ) + .entered(); + match &response { InvokeResponse::Ok(InvokeBody::Json(v)) => { if !(cfg!(target_os = "macos") || cfg!(target_os = "ios")) @@ -277,6 +347,9 @@ fn handle_ipc_message(message: String, manager: &AppManager, labe ); } Err(e) => { + #[cfg(feature = "tracing")] + tracing::trace!("ipc.request.error {}", e); + let _ = window.eval(&format!( r#"console.error({})"#, serde_json::Value::String(e.to_string()) @@ -301,6 +374,9 @@ fn parse_invoke_request( // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it #[cfg(all(feature = "isolation", ipc_custom_protocol))] if let crate::Pattern::Isolation { crypto_keys, .. } = &*manager.pattern { + #[cfg(feature = "tracing")] + let _span = tracing::trace_span!("ipc::request::decrypt_isolation_payload").entered(); + body = crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) .and_then(|raw| crypto_keys.decrypt(raw)) .map_err(|e| e.to_string())?; @@ -334,6 +410,10 @@ fn parse_invoke_request( .map(|mime| mime.parse()) .unwrap_or(Ok(mime::APPLICATION_OCTET_STREAM)) .map_err(|_| "unknown content type")?; + + #[cfg(feature = "tracing")] + let span = tracing::trace_span!("ipc::request::deserialize").entered(); + let body = if content_type == mime::APPLICATION_OCTET_STREAM { body.into() } else if content_type == mime::APPLICATION_JSON { @@ -349,6 +429,9 @@ fn parse_invoke_request( return Err(format!("content type {content_type} is not implemented")); }; + #[cfg(feature = "tracing")] + drop(span); + let payload = InvokeRequest { cmd, callback, diff --git a/core/tauri/src/manager/mod.rs b/core/tauri/src/manager/mod.rs index c244c240136d..980fb07056c3 100644 --- a/core/tauri/src/manager/mod.rs +++ b/core/tauri/src/manager/mod.rs @@ -480,6 +480,9 @@ impl AppManager { { assert_event_name_is_valid(event); + #[cfg(feature = "tracing")] + let _span = tracing::debug_span!("emit::run").entered(); + let emit_args = EmitArgs::from(event, source_window_label, payload)?; self @@ -506,6 +509,9 @@ impl AppManager { ) -> crate::Result<()> { assert_event_name_is_valid(event); + #[cfg(feature = "tracing")] + let _span = tracing::debug_span!("emit::run").entered(); + let emit_args = EmitArgs::from(event, source_window_label, payload)?; self diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index e4376a7de954..8054a9fae2c0 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -750,6 +750,9 @@ impl PluginStore { pub(crate) fn on_navigation(&mut self, window: &Window, url: &Url) -> bool { for plugin in self.store.iter_mut() { + #[cfg(feature = "tracing")] + let _span = + tracing::trace_span!("plugin::hooks::on_navigation", name = plugin.name()).entered(); if !plugin.on_navigation(window, url) { return false; } diff --git a/core/tauri/src/window/mod.rs b/core/tauri/src/window/mod.rs index d5c3bad684db..ffd8e910d754 100644 --- a/core/tauri/src/window/mod.rs +++ b/core/tauri/src/window/mod.rs @@ -2410,6 +2410,8 @@ impl Window { load_channels(&payload, &message.window); let resolver_ = resolver.clone(); + #[cfg(feature = "span")] + let _span = tracing::debug_span!("ipc::request::mobile_plugin").entered(); if let Err(e) = crate::plugin::mobile::run_command( plugin, &app_handle, diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 7501bda4d4f5..28b029f56903 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,9 +1,9 @@ -var yr=Object.defineProperty;var vr=(t,e,n)=>e in t?yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _t=(t,e,n)=>(vr(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function n(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(s){if(s.ep)return;s.ep=!0;const u=n(s);fetch(s.href,u)}})();function ie(){}function sr(t){return t()}function Ms(){return Object.create(null)}function Ce(t){t.forEach(sr)}function rr(t){return typeof t=="function"}function je(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Vi;function Cr(t,e){return t===e?!0:(Vi||(Vi=document.createElement("a")),Vi.href=e,t===Vi.href)}function Sr(t){return Object.keys(t).length===0}function Lr(t,...e){if(t==null){for(const l of e)l(void 0);return ie}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Ar(t,e,n){t.$$.on_destroy.push(Lr(e,n))}function i(t,e){t.appendChild(e)}function C(t,e,n){t.insertBefore(e,n||null)}function v(t){t.parentNode&&t.parentNode.removeChild(t)}function Je(t,e){for(let n=0;nt.removeEventListener(e,n,l)}function Ps(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Q(t){return t===""?null:+t}function Pr(t){return Array.from(t.childNodes)}function re(t,e){e=""+e,t.data!==e&&(t.data=e)}function I(t,e){t.value=e??""}function xt(t,e,n,l){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,l?"important":"")}function Qe(t,e,n){for(let l=0;l{const s=t.$$.callbacks[e];if(s){const u=Er(e,n,{cancelable:l});return s.slice().forEach(d=>{d.call(t,u)}),!u.defaultPrevented}return!0}}const tn=[],sn=[];let nn=[];const El=[],or=Promise.resolve();let Tl=!1;function cr(){Tl||(Tl=!0,or.then(hr))}function Ts(){return cr(),or}function wt(t){nn.push(t)}function dr(t){El.push(t)}const Sl=new Set;let $t=0;function hr(){if($t!==0)return;const t=On;do{try{for(;$tt.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),nn=e}const qi=new Set;let zt;function Wr(){zt={r:0,c:[],p:zt}}function Ir(){zt.r||Ce(zt.c),zt=zt.p}function rn(t,e){t&&t.i&&(qi.delete(t),t.i(e))}function Wn(t,e,n,l){if(t&&t.o){if(qi.has(t))return;qi.add(t),zt.c.push(()=>{qi.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function fe(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function fr(t,e,n){const l=t.$$.props[e];l!==void 0&&(t.$$.bound[l]=n,n(t.$$.ctx[l]))}function In(t){t&&t.c()}function an(t,e,n){const{fragment:l,after_update:s}=t.$$;l&&l.m(e,n),wt(()=>{const u=t.$$.on_mount.map(sr).filter(rr);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ce(u),t.$$.on_mount=[]}),s.forEach(wt)}function un(t,e){const n=t.$$;n.fragment!==null&&(Or(n.after_update),Ce(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Rr(t,e){t.$$.dirty[0]===-1&&(tn.push(t),cr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=k.length?k[0]:A;return h.ctx&&s(h.ctx[_],h.ctx[_]=y)&&(!h.skip_bound&&h.bound[_]&&h.bound[_](y),w&&Rr(t,_)),A}):[],h.update(),w=!0,Ce(h.before_update),h.fragment=l?l(h.ctx):!1,e.target){if(e.hydrate){const _=Pr(e.target);h.fragment&&h.fragment.l(_),_.forEach(v)}else h.fragment&&h.fragment.c();e.intro&&rn(t.$$.fragment),an(t,e.target,e.anchor),hr()}zn(c)}class xe{constructor(){_t(this,"$$");_t(this,"$$set")}$destroy(){un(this,1),this.$destroy=ie}$on(e,n){if(!rr(n))return ie;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const s=l.indexOf(n);s!==-1&&l.splice(s,1)}}$set(e){this.$$set&&!Sr(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Dr="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Dr);const en=[];function Fr(t,e=ie){let n;const l=new Set;function s(o){if(je(t,o)&&(t=o,n)){const c=!en.length;for(const h of l)h[1](),en.push(h,t);if(c){for(let h=0;h{l.delete(h),l.size===0&&n&&(n(),n=null)}}return{set:s,update:u,subscribe:d}}function Rn(t,e,n,l){if(n==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!l:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?l:n==="a"?l.call(t):l?l.value:e.get(t)}function Xi(t,e,n,l,s){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n}var Tn;function pr(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class Il{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Tn.set(this,()=>{}),this.id=pr(e=>{Rn(this,Tn,"f").call(this,e)})}set onmessage(e){Xi(this,Tn,e,"f")}get onmessage(){return Rn(this,Tn,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}Tn=new WeakMap;async function m(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}async function Hr(){return m("plugin:app|version")}async function Ur(){return m("plugin:app|name")}async function Br(){return m("plugin:app|tauri_version")}async function Vr(){return m("plugin:app|app_show")}async function qr(){return m("plugin:app|app_hide")}function Nr(t){let e,n,l,s,u,d,o,c,h,w,_,A,k,y,L,M,B,D,O,P,E,z,R,J;return{c(){e=r("div"),n=r("p"),n.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +var yr=Object.defineProperty;var vr=(t,e,n)=>e in t?yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _t=(t,e,n)=>(vr(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function n(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(s){if(s.ep)return;s.ep=!0;const u=n(s);fetch(s.href,u)}})();function ie(){}function sr(t){return t()}function Ms(){return Object.create(null)}function Ce(t){t.forEach(sr)}function rr(t){return typeof t=="function"}function je(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Vi;function Cr(t,e){return t===e?!0:(Vi||(Vi=document.createElement("a")),Vi.href=e,t===Vi.href)}function Sr(t){return Object.keys(t).length===0}function Lr(t,...e){if(t==null){for(const l of e)l(void 0);return ie}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Ar(t,e,n){t.$$.on_destroy.push(Lr(e,n))}function i(t,e){t.appendChild(e)}function C(t,e,n){t.insertBefore(e,n||null)}function v(t){t.parentNode&&t.parentNode.removeChild(t)}function Je(t,e){for(let n=0;nt.removeEventListener(e,n,l)}function Ps(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Q(t){return t===""?null:+t}function Pr(t){return Array.from(t.childNodes)}function re(t,e){e=""+e,t.data!==e&&(t.data=e)}function I(t,e){t.value=e??""}function xt(t,e,n,l){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,l?"important":"")}function Qe(t,e,n){for(let l=0;l{const s=t.$$.callbacks[e];if(s){const u=Er(e,n,{cancelable:l});return s.slice().forEach(d=>{d.call(t,u)}),!u.defaultPrevented}return!0}}const tn=[],sn=[];let nn=[];const El=[],or=Promise.resolve();let Tl=!1;function cr(){Tl||(Tl=!0,or.then(hr))}function Ts(){return cr(),or}function wt(t){nn.push(t)}function dr(t){El.push(t)}const Sl=new Set;let $t=0;function hr(){if($t!==0)return;const t=On;do{try{for(;$tt.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),nn=e}const qi=new Set;let zt;function Wr(){zt={r:0,c:[],p:zt}}function Ir(){zt.r||Ce(zt.c),zt=zt.p}function rn(t,e){t&&t.i&&(qi.delete(t),t.i(e))}function Wn(t,e,n,l){if(t&&t.o){if(qi.has(t))return;qi.add(t),zt.c.push(()=>{qi.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function fe(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function fr(t,e,n){const l=t.$$.props[e];l!==void 0&&(t.$$.bound[l]=n,n(t.$$.ctx[l]))}function In(t){t&&t.c()}function an(t,e,n){const{fragment:l,after_update:s}=t.$$;l&&l.m(e,n),wt(()=>{const u=t.$$.on_mount.map(sr).filter(rr);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ce(u),t.$$.on_mount=[]}),s.forEach(wt)}function un(t,e){const n=t.$$;n.fragment!==null&&(Or(n.after_update),Ce(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Rr(t,e){t.$$.dirty[0]===-1&&(tn.push(t),cr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=k.length?k[0]:A;return h.ctx&&s(h.ctx[_],h.ctx[_]=y)&&(!h.skip_bound&&h.bound[_]&&h.bound[_](y),w&&Rr(t,_)),A}):[],h.update(),w=!0,Ce(h.before_update),h.fragment=l?l(h.ctx):!1,e.target){if(e.hydrate){const _=Pr(e.target);h.fragment&&h.fragment.l(_),_.forEach(v)}else h.fragment&&h.fragment.c();e.intro&&rn(t.$$.fragment),an(t,e.target,e.anchor),hr()}zn(c)}class xe{constructor(){_t(this,"$$");_t(this,"$$set")}$destroy(){un(this,1),this.$destroy=ie}$on(e,n){if(!rr(n))return ie;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const s=l.indexOf(n);s!==-1&&l.splice(s,1)}}$set(e){this.$$set&&!Sr(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Dr="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Dr);const en=[];function Fr(t,e=ie){let n;const l=new Set;function s(o){if(je(t,o)&&(t=o,n)){const c=!en.length;for(const h of l)h[1](),en.push(h,t);if(c){for(let h=0;h{l.delete(h),l.size===0&&n&&(n(),n=null)}}return{set:s,update:u,subscribe:d}}function Rn(t,e,n,l){if(n==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!l:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?l:n==="a"?l.call(t):l?l.value:e.get(t)}function Xi(t,e,n,l,s){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n}var Tn,Ni;function pr(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class Il{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Tn.set(this,()=>{}),this.id=pr(e=>{Rn(this,Tn,"f").call(this,e)})}set onmessage(e){Xi(this,Tn,e,"f")}get onmessage(){return Rn(this,Tn,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}Tn=new WeakMap;async function m(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class mr{get rid(){return Rn(this,Ni,"f")}constructor(e){Ni.set(this,void 0),Xi(this,Ni,e,"f")}async close(){return m("plugin:resources|close",{rid:this.rid})}}Ni=new WeakMap;async function Hr(){return m("plugin:app|version")}async function Ur(){return m("plugin:app|name")}async function Br(){return m("plugin:app|tauri_version")}async function Vr(){return m("plugin:app|app_show")}async function qr(){return m("plugin:app|app_hide")}function Nr(t){let e,n,l,s,u,d,o,c,h,w,_,A,k,y,L,M,B,D,O,P,E,z,R,J;return{c(){e=r("div"),n=r("p"),n.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration tests.`,l=p(),s=r("br"),u=p(),d=r("br"),o=p(),c=r("pre"),h=b(" App name: "),w=r("code"),_=b(t[2]),A=b(` App version: `),k=r("code"),y=b(t[0]),L=b(` Tauri version: `),M=r("code"),B=b(t[1]),D=b(` - `),O=p(),P=r("br"),E=p(),z=r("button"),z.textContent="Context menu",a(z,"class","btn")},m(V,Z){C(V,e,Z),i(e,n),i(e,l),i(e,s),i(e,u),i(e,d),i(e,o),i(e,c),i(c,h),i(c,w),i(w,_),i(c,A),i(c,k),i(k,y),i(c,L),i(c,M),i(M,B),i(c,D),i(e,O),i(e,P),i(e,E),i(e,z),R||(J=S(z,"click",t[3]),R=!0)},p(V,[Z]){Z&4&&re(_,V[2]),Z&1&&re(y,V[0]),Z&2&&re(B,V[1])},i:ie,o:ie,d(V){V&&v(e),R=!1,J()}}}function jr(t,e,n){let l="1.0.0",s="1.0.0",u="Unknown";Ur().then(o=>{n(2,u=o)}),Hr().then(o=>{n(0,l=o)}),Br().then(o=>{n(1,s=o)});function d(){m("popup_context_menu")}return[l,s,u,d]}class Gr extends xe{constructor(e){super(),Ze(this,e,jr,Nr,je,{})}}var Oe;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",t.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",t.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled"})(Oe||(Oe={}));async function mr(t,e){await m("plugin:event|unlisten",{event:t,eventId:e})}async function Rl(t,e,n){return m("plugin:event|listen",{event:t,windowLabel:n==null?void 0:n.target,handler:pr(e)}).then(l=>async()=>mr(t,l))}async function Kr(t,e,n){return Rl(t,l=>{e(l),mr(t,l.id).catch(()=>{})},n)}async function gr(t,e,n){await m("plugin:event|emit",{event:t,windowLabel:n==null?void 0:n.target,payload:e})}function Xr(t){let e,n,l,s,u,d,o,c;return{c(){e=r("div"),n=r("button"),n.textContent="Call Log API",l=p(),s=r("button"),s.textContent="Call Request (async) API",u=p(),d=r("button"),d.textContent="Send event to Rust",a(n,"class","btn"),a(n,"id","log"),a(s,"class","btn"),a(s,"id","request"),a(d,"class","btn"),a(d,"id","event")},m(h,w){C(h,e,w),i(e,n),i(e,l),i(e,s),i(e,u),i(e,d),o||(c=[S(n,"click",t[0]),S(s,"click",t[1]),S(d,"click",t[2])],o=!0)},p:ie,i:ie,o:ie,d(h){h&&v(e),o=!1,Ce(c)}}}function Yr(t,e,n){let{onMessage:l}=e,s;Ki(async()=>{s=await Rl("rust-event",l)}),ar(()=>{s&&s()});function u(){m("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function d(){m("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(l).catch(l)}function o(){gr("js-event","this is the payload string")}return t.$$set=c=>{"onMessage"in c&&n(3,l=c.onMessage)},[u,d,o,l]}class Qr extends xe{constructor(e){super(),Ze(this,e,Yr,Xr,je,{onMessage:3})}}class zl{constructor(e,n){this.type="Logical",this.width=e,this.height=n}}class ln{constructor(e,n){this.type="Physical",this.width=e,this.height=n}toLogical(e){return new zl(this.width/e,this.height/e)}}class Jr{constructor(e,n){this.type="Logical",this.x=e,this.y=n}}class it{constructor(e,n){this.type="Physical",this.x=e,this.y=n}toLogical(e){return new Jr(this.x/e,this.y/e)}}var Yi;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(Yi||(Yi={}));class Zr{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}}var Qi;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(Qi||(Qi={}));function _r(){return new Dn(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function Ll(){return window.__TAURI_INTERNALS__.metadata.windows.map(t=>new Dn(t.label,{skip:!0}))}const zs=["tauri://created","tauri://error"];class Dn{constructor(e,n={}){this.label=e,this.listeners=Object.create(null),n!=null&&n.skip||m("plugin:window|create",{options:{...n,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static getByLabel(e){return Ll().some(n=>n.label===e)?new Dn(e,{skip:!0}):null}static getCurrent(){return _r()}static getAll(){return Ll()}static async getFocusedWindow(){for(const e of Ll())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}):Rl(e,n,{target:this.label})}async once(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}):Kr(e,n,{target:this.label})}async emit(e,n){if(zs.includes(e)){for(const l of this.listeners[e]||[])l({event:e,id:-1,windowLabel:this.label,payload:n});return Promise.resolve()}return gr(e,n,{target:this.label})}_handleTauriEvent(e,n){return zs.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return m("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return m("plugin:window|inner_position",{label:this.label}).then(({x:e,y:n})=>new it(e,n))}async outerPosition(){return m("plugin:window|outer_position",{label:this.label}).then(({x:e,y:n})=>new it(e,n))}async innerSize(){return m("plugin:window|inner_size",{label:this.label}).then(({width:e,height:n})=>new ln(e,n))}async outerSize(){return m("plugin:window|outer_size",{label:this.label}).then(({width:e,height:n})=>new ln(e,n))}async isFullscreen(){return m("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return m("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return m("plugin:window|is_maximized",{label:this.label})}async isFocused(){return m("plugin:window|is_focused",{label:this.label})}async isDecorated(){return m("plugin:window|is_decorated",{label:this.label})}async isResizable(){return m("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return m("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return m("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return m("plugin:window|is_closable",{label:this.label})}async isVisible(){return m("plugin:window|is_visible",{label:this.label})}async title(){return m("plugin:window|title",{label:this.label})}async theme(){return m("plugin:window|theme",{label:this.label})}async center(){return m("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===Yi.Critical?n={type:"Critical"}:n={type:"Informational"}),m("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return m("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return m("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return m("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return m("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return m("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return m("plugin:window|maximize",{label:this.label})}async unmaximize(){return m("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return m("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return m("plugin:window|minimize",{label:this.label})}async unminimize(){return m("plugin:window|unminimize",{label:this.label})}async show(){return m("plugin:window|show",{label:this.label})}async hide(){return m("plugin:window|hide",{label:this.label})}async close(){return m("plugin:window|close",{label:this.label})}async setDecorations(e){return m("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return m("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return m("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return m("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return m("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return m("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return m("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 m("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 m("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 m("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 m("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return m("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return m("plugin:window|set_focus",{label:this.label})}async setIcon(e){return m("plugin:window|set_icon",{label:this.label,value:typeof e=="string"?e:Array.from(e)})}async setSkipTaskbar(e){return m("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return m("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return m("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return m("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 m("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return m("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return m("plugin:window|start_dragging",{label:this.label})}async setProgressBar(e){return m("plugin:window|set_progress_bar",{label:this.label,value:e})}async onResized(e){return this.listen(Oe.WINDOW_RESIZED,n=>{n.payload=xr(n.payload),e(n)})}async onMoved(e){return this.listen(Oe.WINDOW_MOVED,n=>{n.payload=Al(n.payload),e(n)})}async onCloseRequested(e){return this.listen(Oe.WINDOW_CLOSE_REQUESTED,n=>{const l=new Zr(n);Promise.resolve(e(l)).then(()=>{if(!l.isPreventDefault())return this.close()})})}async onFocusChanged(e){const n=await this.listen(Oe.WINDOW_FOCUS,s=>{e({...s,payload:!0})}),l=await this.listen(Oe.WINDOW_BLUR,s=>{e({...s,payload:!1})});return()=>{n(),l()}}async onScaleChanged(e){return this.listen(Oe.WINDOW_SCALE_FACTOR_CHANGED,e)}async onFileDropEvent(e){const n=await this.listen(Oe.WINDOW_FILE_DROP,u=>{e({...u,payload:{type:"drop",paths:u.payload.paths,position:Al(u.payload.position)}})}),l=await this.listen(Oe.WINDOW_FILE_DROP_HOVER,u=>{e({...u,payload:{type:"hover",paths:u.payload.paths,position:Al(u.payload.position)}})}),s=await this.listen(Oe.WINDOW_FILE_DROP_CANCELLED,u=>{e({...u,payload:{type:"cancel"}})});return()=>{n(),l(),s()}}async onThemeChanged(e){return this.listen(Oe.WINDOW_THEME_CHANGED,e)}}var Ji;(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"})(Ji||(Ji={}));var Zi;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(Zi||(Zi={}));function Al(t){return new it(t.x,t.y)}function xr(t){return new ln(t.width,t.height)}function Os(t,e,n){const l=t.slice();return l[105]=e[n],l}function Ws(t,e,n){const l=t.slice();return l[108]=e[n],l}function Is(t,e,n){const l=t.slice();return l[111]=e[n],l}function Rs(t,e,n){const l=t.slice();return l[114]=e[n],l}function Ds(t,e,n){const l=t.slice();return l[117]=e[n],l}function Fs(t){let e,n,l,s,u,d,o=fe(Object.keys(t[1])),c=[];for(let h=0;ht[59].call(l))},m(h,w){C(h,e,w),C(h,n,w),C(h,l,w),i(l,s);for(let _=0;_{n(2,u=o)}),Hr().then(o=>{n(0,l=o)}),Br().then(o=>{n(1,s=o)});function d(){m("popup_context_menu")}return[l,s,u,d]}class Gr extends xe{constructor(e){super(),Ze(this,e,jr,Nr,je,{})}}var Oe;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_CREATED="tauri://window-created",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_FILE_DROP="tauri://file-drop",t.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",t.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled"})(Oe||(Oe={}));async function gr(t,e){await m("plugin:event|unlisten",{event:t,eventId:e})}async function Rl(t,e,n){return m("plugin:event|listen",{event:t,windowLabel:n==null?void 0:n.target,handler:pr(e)}).then(l=>async()=>gr(t,l))}async function Kr(t,e,n){return Rl(t,l=>{e(l),gr(t,l.id).catch(()=>{})},n)}async function _r(t,e,n){await m("plugin:event|emit",{event:t,windowLabel:n==null?void 0:n.target,payload:e})}function Xr(t){let e,n,l,s,u,d,o,c;return{c(){e=r("div"),n=r("button"),n.textContent="Call Log API",l=p(),s=r("button"),s.textContent="Call Request (async) API",u=p(),d=r("button"),d.textContent="Send event to Rust",a(n,"class","btn"),a(n,"id","log"),a(s,"class","btn"),a(s,"id","request"),a(d,"class","btn"),a(d,"id","event")},m(h,w){C(h,e,w),i(e,n),i(e,l),i(e,s),i(e,u),i(e,d),o||(c=[S(n,"click",t[0]),S(s,"click",t[1]),S(d,"click",t[2])],o=!0)},p:ie,i:ie,o:ie,d(h){h&&v(e),o=!1,Ce(c)}}}function Yr(t,e,n){let{onMessage:l}=e,s;Ki(async()=>{s=await Rl("rust-event",l)}),ar(()=>{s&&s()});function u(){m("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function d(){m("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(l).catch(l)}function o(){_r("js-event","this is the payload string")}return t.$$set=c=>{"onMessage"in c&&n(3,l=c.onMessage)},[u,d,o,l]}class Qr extends xe{constructor(e){super(),Ze(this,e,Yr,Xr,je,{onMessage:3})}}class zl{constructor(e,n){this.type="Logical",this.width=e,this.height=n}}class ln{constructor(e,n){this.type="Physical",this.width=e,this.height=n}toLogical(e){return new zl(this.width/e,this.height/e)}}class Jr{constructor(e,n){this.type="Logical",this.x=e,this.y=n}}class it{constructor(e,n){this.type="Physical",this.x=e,this.y=n}toLogical(e){return new Jr(this.x/e,this.y/e)}}var Yi;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(Yi||(Yi={}));class Zr{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}}var Qi;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(Qi||(Qi={}));function br(){return new Dn(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function Ll(){return window.__TAURI_INTERNALS__.metadata.windows.map(t=>new Dn(t.label,{skip:!0}))}const zs=["tauri://created","tauri://error"];class Dn{constructor(e,n={}){this.label=e,this.listeners=Object.create(null),n!=null&&n.skip||m("plugin:window|create",{options:{...n,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static getByLabel(e){return Ll().some(n=>n.label===e)?new Dn(e,{skip:!0}):null}static getCurrent(){return br()}static getAll(){return Ll()}static async getFocusedWindow(){for(const e of Ll())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}):Rl(e,n,{target:this.label})}async once(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}):Kr(e,n,{target:this.label})}async emit(e,n){if(zs.includes(e)){for(const l of this.listeners[e]||[])l({event:e,id:-1,windowLabel:this.label,payload:n});return Promise.resolve()}return _r(e,n,{target:this.label})}_handleTauriEvent(e,n){return zs.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return m("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return m("plugin:window|inner_position",{label:this.label}).then(({x:e,y:n})=>new it(e,n))}async outerPosition(){return m("plugin:window|outer_position",{label:this.label}).then(({x:e,y:n})=>new it(e,n))}async innerSize(){return m("plugin:window|inner_size",{label:this.label}).then(({width:e,height:n})=>new ln(e,n))}async outerSize(){return m("plugin:window|outer_size",{label:this.label}).then(({width:e,height:n})=>new ln(e,n))}async isFullscreen(){return m("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return m("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return m("plugin:window|is_maximized",{label:this.label})}async isFocused(){return m("plugin:window|is_focused",{label:this.label})}async isDecorated(){return m("plugin:window|is_decorated",{label:this.label})}async isResizable(){return m("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return m("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return m("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return m("plugin:window|is_closable",{label:this.label})}async isVisible(){return m("plugin:window|is_visible",{label:this.label})}async title(){return m("plugin:window|title",{label:this.label})}async theme(){return m("plugin:window|theme",{label:this.label})}async center(){return m("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===Yi.Critical?n={type:"Critical"}:n={type:"Informational"}),m("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return m("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return m("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return m("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return m("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return m("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return m("plugin:window|maximize",{label:this.label})}async unmaximize(){return m("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return m("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return m("plugin:window|minimize",{label:this.label})}async unminimize(){return m("plugin:window|unminimize",{label:this.label})}async show(){return m("plugin:window|show",{label:this.label})}async hide(){return m("plugin:window|hide",{label:this.label})}async close(){return m("plugin:window|close",{label:this.label})}async setDecorations(e){return m("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return m("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return m("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return m("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return m("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return m("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return m("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 m("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 m("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 m("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 m("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return m("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return m("plugin:window|set_focus",{label:this.label})}async setIcon(e){return m("plugin:window|set_icon",{label:this.label,value:typeof e=="string"?e:Array.from(e)})}async setSkipTaskbar(e){return m("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return m("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return m("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return m("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 m("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return m("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return m("plugin:window|start_dragging",{label:this.label})}async setProgressBar(e){return m("plugin:window|set_progress_bar",{label:this.label,value:e})}async onResized(e){return this.listen(Oe.WINDOW_RESIZED,n=>{n.payload=xr(n.payload),e(n)})}async onMoved(e){return this.listen(Oe.WINDOW_MOVED,n=>{n.payload=Al(n.payload),e(n)})}async onCloseRequested(e){return this.listen(Oe.WINDOW_CLOSE_REQUESTED,n=>{const l=new Zr(n);Promise.resolve(e(l)).then(()=>{if(!l.isPreventDefault())return this.close()})})}async onFocusChanged(e){const n=await this.listen(Oe.WINDOW_FOCUS,s=>{e({...s,payload:!0})}),l=await this.listen(Oe.WINDOW_BLUR,s=>{e({...s,payload:!1})});return()=>{n(),l()}}async onScaleChanged(e){return this.listen(Oe.WINDOW_SCALE_FACTOR_CHANGED,e)}async onFileDropEvent(e){const n=await this.listen(Oe.WINDOW_FILE_DROP,u=>{e({...u,payload:{type:"drop",paths:u.payload.paths,position:Al(u.payload.position)}})}),l=await this.listen(Oe.WINDOW_FILE_DROP_HOVER,u=>{e({...u,payload:{type:"hover",paths:u.payload.paths,position:Al(u.payload.position)}})}),s=await this.listen(Oe.WINDOW_FILE_DROP_CANCELLED,u=>{e({...u,payload:{type:"cancel"}})});return()=>{n(),l(),s()}}async onThemeChanged(e){return this.listen(Oe.WINDOW_THEME_CHANGED,e)}}var Ji;(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"})(Ji||(Ji={}));var Zi;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(Zi||(Zi={}));function Al(t){return new it(t.x,t.y)}function xr(t){return new ln(t.width,t.height)}function Os(t,e,n){const l=t.slice();return l[105]=e[n],l}function Ws(t,e,n){const l=t.slice();return l[108]=e[n],l}function Is(t,e,n){const l=t.slice();return l[111]=e[n],l}function Rs(t,e,n){const l=t.slice();return l[114]=e[n],l}function Ds(t,e,n){const l=t.slice();return l[117]=e[n],l}function Fs(t){let e,n,l,s,u,d,o=fe(Object.keys(t[1])),c=[];for(let h=0;ht[59].call(l))},m(h,w){C(h,e,w),C(h,n,w),C(h,l,w),i(l,s);for(let _=0;_e in t?yr(t,e,{enumerable:!0,config `),u=r("select");for(let W=0;Wt[89].call(u)),a(h,"class","input"),t[37]===void 0&&wt(()=>t[90].call(h)),a(k,"class","input"),a(k,"type","number"),a(n,"class","flex"),xt(O,"max-width","120px"),a(O,"class","input"),a(O,"type","number"),a(O,"placeholder","R"),xt(E,"max-width","120px"),a(E,"class","input"),a(E,"type","number"),a(E,"placeholder","G"),xt(R,"max-width","120px"),a(R,"class","input"),a(R,"type","number"),a(R,"placeholder","B"),xt(V,"max-width","120px"),a(V,"class","input"),a(V,"type","number"),a(V,"placeholder","A"),a(D,"class","flex"),a(L,"class","flex"),a(te,"class","btn"),xt(te,"width","80px"),a(le,"class","flex"),a(de,"class","btn"),xt(de,"width","80px"),a(G,"class","flex"),a(e,"class","flex flex-col gap-1")},m(W,x){C(W,e,x),i(e,n),i(n,l),i(l,s),i(l,u);for(let H=0;H=1,w,_,A,k=h&&Fs(t),y=t[1][t[0]]&&Us(t);return{c(){e=r("div"),n=r("div"),l=r("input"),s=p(),u=r("button"),u.textContent="New window",d=p(),o=r("br"),c=p(),k&&k.c(),w=p(),y&&y.c(),a(l,"class","input grow"),a(l,"type","text"),a(l,"placeholder","New Window label.."),a(u,"class","btn"),a(n,"class","flex gap-1"),a(e,"class","flex flex-col children:grow gap-2")},m(L,M){C(L,e,M),i(e,n),i(n,l),I(l,t[28]),i(n,s),i(n,u),i(e,d),i(e,o),i(e,c),k&&k.m(e,null),i(e,w),y&&y.m(e,null),_||(A=[S(l,"input",t[58]),S(u,"click",t[53])],_=!0)},p(L,M){M[0]&268435456&&l.value!==L[28]&&I(l,L[28]),M[0]&2&&(h=Object.keys(L[1]).length>=1),h?k?k.p(L,M):(k=Fs(L),k.c(),k.m(e,w)):k&&(k.d(1),k=null),L[1][L[0]]?y?y.p(L,M):(y=Us(L),y.c(),y.m(e,null)):y&&(y.d(1),y=null)},i:ie,o:ie,d(L){L&&v(e),k&&k.d(),y&&y.d(),_=!1,Ce(A)}}}function ta(t,e,n){const l=_r();let s=l.label;const u={[l.label]:l},d=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"],o=["mica","blur","acrylic","tabbed","tabbedDark","tabbedLight"],c=navigator.appVersion.includes("Windows"),h=navigator.appVersion.includes("Macintosh");let w=c?o:Object.keys(Ji).map(N=>Ji[N]).filter(N=>!o.includes(N));const _=Object.keys(Zi).map(N=>Zi[N]),A=Object.keys(Qi).map(N=>Qi[N]);let{onMessage:k}=e;const y=document.querySelector("main");let L,M=!0,B=!0,D=!0,O=!0,P=!1,E=!0,z=!1,R=!1,J=!0,V=!1,Z=null,le=null,te=null,q=null,G=null,T=null,K=null,X=null,be=1,ke=new it(K,X),de=new it(K,X),ae=new ln(Z,le),$=new ln(Z,le),pe,Y,se=!1,ne=!0,W=null,x=null,H="default",ue=!1,Ae="Awesome Tauri Example!",we=[],me,We,Me,Ie,ge,_e,Se,Pe="none",he=0,Le;function oe(){u[s].setTitle(Ae)}function Re(){u[s].hide(),setTimeout(u[s].show,2e3)}function De(){u[s].minimize(),setTimeout(u[s].unminimize,2e3)}function Ee(){if(!L)return;const N=new Dn(L);n(1,u[L]=N,u),N.once("tauri://error",function(){k("Error creating new webview")})}function ce(){u[s].innerSize().then(N=>{n(32,ae=N),n(12,Z=ae.width),n(13,le=ae.height)}),u[s].outerSize().then(N=>{n(33,$=N)})}function F(){u[s].innerPosition().then(N=>{n(30,ke=N)}),u[s].outerPosition().then(N=>{n(31,de=N),n(18,K=de.x),n(19,X=de.y)})}async function ee(N){N&&(pe&&pe(),Y&&Y(),Y=await N.listen("tauri://move",F),pe=await N.listen("tauri://resize",ce))}async function U(){await u[s].minimize(),await u[s].requestUserAttention(Yi.Critical),await new Promise(N=>setTimeout(N,3e3)),await u[s].requestUserAttention(null)}async function Te(){we.includes(me)||n(35,we=[...we,me]);const N={effects:we,state:We,radius:Me};Number.isInteger(Ie)&&Number.isInteger(ge)&&Number.isInteger(_e)&&Number.isInteger(Se)&&(N.color=[Ie,ge,_e,Se]),y.classList.remove("bg-primary"),y.classList.remove("dark:bg-darkPrimary"),await u[s].clearEffects(),await u[s].setEffects(N)}async function Vn(){n(35,we=[]),await u[s].clearEffects(),y.classList.add("bg-primary"),y.classList.add("dark:bg-darkPrimary")}function Fe(){L=this.value,n(28,L)}function qn(){s=En(this),n(0,s),n(1,u)}function Ot(){Le=this.value,n(43,Le)}const Nn=()=>u[s].center();function He(){P=this.checked,n(6,P)}function jn(){M=this.checked,n(2,M)}function lt(){B=this.checked,n(3,B)}function Wt(){D=this.checked,n(4,D)}function Gn(){O=this.checked,n(5,O)}function Ue(){E=this.checked,n(7,E)}function Kn(){z=this.checked,n(8,z)}function It(){R=this.checked,n(9,R)}function Xn(){J=this.checked,n(10,J)}function Be(){V=this.checked,n(11,V)}function Yn(){K=Q(this.value),n(18,K)}function st(){X=Q(this.value),n(19,X)}function Rt(){Z=Q(this.value),n(12,Z)}function Qn(){le=Q(this.value),n(13,le)}function Ge(){te=Q(this.value),n(14,te)}function Jn(){q=Q(this.value),n(15,q)}function Dt(){G=Q(this.value),n(16,G)}function Zn(){T=Q(this.value),n(17,T)}function Ke(){se=this.checked,n(20,se)}function xn(){ne=this.checked,n(21,ne)}function rt(){ue=this.checked,n(25,ue)}function Ft(){H=En(this),n(24,H),n(44,d)}function $n(){W=Q(this.value),n(22,W)}function Ve(){x=Q(this.value),n(23,x)}function ei(){Ae=this.value,n(34,Ae)}function Ht(){Pe=En(this),n(26,Pe),n(49,A)}function ti(){he=Q(this.value),n(27,he)}function qe(){me=En(this),n(36,me),n(47,w)}function hn(){We=En(this),n(37,We),n(48,_)}function fn(){Me=Q(this.value),n(38,Me)}function pn(){Ie=Q(this.value),n(39,Ie)}function ze(){ge=Q(this.value),n(40,ge)}function at(){_e=Q(this.value),n(41,_e)}function Xe(){Se=Q(this.value),n(42,Se)}return t.$$set=N=>{"onMessage"in N&&n(57,k=N.onMessage)},t.$$.update=()=>{var N,mn,kt,gn,yt,Ut,_n,vt,bn,Ct,Bt,wn,Ne,St,kn,Lt,yn,At,Vt,vn,Mt,Cn,Pt,qt;t.$$.dirty[0]&3&&(u[s],F(),ce()),t.$$.dirty[0]&7&&((N=u[s])==null||N.setResizable(M)),t.$$.dirty[0]&11&&((mn=u[s])==null||mn.setMaximizable(B)),t.$$.dirty[0]&19&&((kt=u[s])==null||kt.setMinimizable(D)),t.$$.dirty[0]&35&&((gn=u[s])==null||gn.setClosable(O)),t.$$.dirty[0]&67&&(P?(yt=u[s])==null||yt.maximize():(Ut=u[s])==null||Ut.unmaximize()),t.$$.dirty[0]&131&&((_n=u[s])==null||_n.setDecorations(E)),t.$$.dirty[0]&259&&((vt=u[s])==null||vt.setAlwaysOnTop(z)),t.$$.dirty[0]&515&&((bn=u[s])==null||bn.setAlwaysOnBottom(R)),t.$$.dirty[0]&1027&&((Ct=u[s])==null||Ct.setContentProtected(J)),t.$$.dirty[0]&2051&&((Bt=u[s])==null||Bt.setFullscreen(V)),t.$$.dirty[0]&12291&&Z&&le&&((wn=u[s])==null||wn.setSize(new ln(Z,le))),t.$$.dirty[0]&49155&&(te&&q?(Ne=u[s])==null||Ne.setMinSize(new zl(te,q)):(St=u[s])==null||St.setMinSize(null)),t.$$.dirty[0]&196611&&(G>800&&T>400?(kn=u[s])==null||kn.setMaxSize(new zl(G,T)):(Lt=u[s])==null||Lt.setMaxSize(null)),t.$$.dirty[0]&786435&&K!==null&&X!==null&&((yn=u[s])==null||yn.setPosition(new it(K,X))),t.$$.dirty[0]&3&&((At=u[s])==null||At.scaleFactor().then(ni=>n(29,be=ni))),t.$$.dirty[0]&3&&ee(u[s]),t.$$.dirty[0]&1048579&&((Vt=u[s])==null||Vt.setCursorGrab(se)),t.$$.dirty[0]&2097155&&((vn=u[s])==null||vn.setCursorVisible(ne)),t.$$.dirty[0]&16777219&&((Mt=u[s])==null||Mt.setCursorIcon(H)),t.$$.dirty[0]&12582915&&W!==null&&x!==null&&((Cn=u[s])==null||Cn.setCursorPosition(new it(W,x))),t.$$.dirty[0]&33554435&&((Pt=u[s])==null||Pt.setIgnoreCursorEvents(ue)),t.$$.dirty[0]&201326595&&((qt=u[s])==null||qt.setProgressBar({status:Pe,progress:he}))},[s,u,M,B,D,O,P,E,z,R,J,V,Z,le,te,q,G,T,K,X,se,ne,W,x,H,ue,Pe,he,L,be,ke,de,ae,$,Ae,we,me,We,Me,Ie,ge,_e,Se,Le,d,c,h,w,_,A,oe,Re,De,Ee,U,Te,Vn,k,Fe,qn,Ot,Nn,He,jn,lt,Wt,Gn,Ue,Kn,It,Xn,Be,Yn,st,Rt,Qn,Ge,Jn,Dt,Zn,Ke,xn,rt,Ft,$n,Ve,ei,Ht,ti,qe,hn,fn,pn,ze,at,Xe]}class na extends xe{constructor(e){super(),Ze(this,e,ta,ea,je,{onMessage:57},null,[-1,-1,-1,-1])}}function ia(t){let e;return{c(){e=r("div"),e.innerHTML='
Not available for Linux
',a(e,"class","flex flex-col gap-2")},m(n,l){C(n,e,l)},p:ie,i:ie,o:ie,d(n){n&&v(e)}}}function la(t,e,n){let{onMessage:l}=e;const s=window.constraints={audio:!0,video:!0};function u(o){const c=document.querySelector("video"),h=o.getVideoTracks();l("Got stream with constraints:",s),l(`Using video device: ${h[0].label}`),window.stream=o,c.srcObject=o}function d(o){if(o.name==="ConstraintNotSatisfiedError"){const c=s.video;l(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else o.name==="PermissionDeniedError"&&l("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");l(`getUserMedia error: ${o.name}`,o)}return Ki(async()=>{try{const o=await navigator.mediaDevices.getUserMedia(s);u(o)}catch(o){d(o)}}),ar(()=>{var o;(o=window.stream)==null||o.getTracks().forEach(function(c){c.stop()})}),t.$$set=o=>{"onMessage"in o&&n(0,l=o.onMessage)},[l]}class sa extends xe{constructor(e){super(),Ze(this,e,la,ia,je,{onMessage:0})}}function ra(t){let e,n,l,s,u,d;return{c(){e=r("div"),n=r("button"),n.textContent="Show",l=p(),s=r("button"),s.textContent="Hide",a(n,"class","btn"),a(n,"id","show"),a(n,"title","Hides and shows the app after 2 seconds"),a(s,"class","btn"),a(s,"id","hide")},m(o,c){C(o,e,c),i(e,n),i(e,l),i(e,s),u||(d=[S(n,"click",t[0]),S(s,"click",t[1])],u=!0)},p:ie,i:ie,o:ie,d(o){o&&v(e),u=!1,Ce(d)}}}function aa(t,e,n){let{onMessage:l}=e;function s(){u().then(()=>{setTimeout(()=>{Vr().then(()=>l("Shown app")).catch(l)},2e3)}).catch(l)}function u(){return qr().then(()=>l("Hide app")).catch(l)}return t.$$set=d=>{"onMessage"in d&&n(2,l=d.onMessage)},[s,u,l]}class ua extends xe{constructor(e){super(),Ze(this,e,aa,ra,je,{onMessage:2})}}var Ni;class br{get rid(){return Rn(this,Ni,"f")}constructor(e){Ni.set(this,void 0),Xi(this,Ni,e,"f")}async close(){return m("plugin:resources|close",{rid:this.rid})}}Ni=new WeakMap;var ji,Gi;function wr(t){var e;if("items"in t)t.items=(e=t.items)==null?void 0:e.map(n=>"rid"in n?n:wr(n));else if("action"in t&&t.action){const n=new Il;return n.onmessage=t.action,delete t.action,{...t,handler:n}}return t}async function on(t,e){const n=new Il;let l=null;return e&&typeof e=="object"&&("action"in e&&e.action&&(n.onmessage=e.action,delete e.action),"items"in e&&e.items&&(l=e.items.map(s=>"rid"in s?[s.rid,s.kind]:wr(s)))),m("plugin:menu|new",{kind:t,options:e?{...e,items:l}:void 0,handler:n})}class cn extends br{get id(){return Rn(this,ji,"f")}get kind(){return Rn(this,Gi,"f")}constructor(e,n,l){super(e),ji.set(this,void 0),Gi.set(this,void 0),Xi(this,ji,n,"f"),Xi(this,Gi,l,"f")}}ji=new WeakMap,Gi=new WeakMap;class Fn extends cn{constructor(e,n){super(e,n,"MenuItem")}static async new(e){return on("MenuItem",e).then(([n,l])=>new Fn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}}class dn extends cn{constructor(e,n){super(e,n,"Check")}static async new(e){return on("Check",e).then(([n,l])=>new dn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async isChecked(){return m("plugin:menu|is_checked",{rid:this.rid})}async setChecked(e){return m("plugin:menu|set_checked",{rid:this.rid,checked:e})}}var js;(function(t){t.Add="Add",t.Advanced="Advanced",t.Bluetooth="Bluetooth",t.Bookmarks="Bookmarks",t.Caution="Caution",t.ColorPanel="ColorPanel",t.ColumnView="ColumnView",t.Computer="Computer",t.EnterFullScreen="EnterFullScreen",t.Everyone="Everyone",t.ExitFullScreen="ExitFullScreen",t.FlowView="FlowView",t.Folder="Folder",t.FolderBurnable="FolderBurnable",t.FolderSmart="FolderSmart",t.FollowLinkFreestanding="FollowLinkFreestanding",t.FontPanel="FontPanel",t.GoLeft="GoLeft",t.GoRight="GoRight",t.Home="Home",t.IChatTheater="IChatTheater",t.IconView="IconView",t.Info="Info",t.InvalidDataFreestanding="InvalidDataFreestanding",t.LeftFacingTriangle="LeftFacingTriangle",t.ListView="ListView",t.LockLocked="LockLocked",t.LockUnlocked="LockUnlocked",t.MenuMixedState="MenuMixedState",t.MenuOnState="MenuOnState",t.MobileMe="MobileMe",t.MultipleDocuments="MultipleDocuments",t.Network="Network",t.Path="Path",t.PreferencesGeneral="PreferencesGeneral",t.QuickLook="QuickLook",t.RefreshFreestanding="RefreshFreestanding",t.Refresh="Refresh",t.Remove="Remove",t.RevealFreestanding="RevealFreestanding",t.RightFacingTriangle="RightFacingTriangle",t.Share="Share",t.Slideshow="Slideshow",t.SmartBadge="SmartBadge",t.StatusAvailable="StatusAvailable",t.StatusNone="StatusNone",t.StatusPartiallyAvailable="StatusPartiallyAvailable",t.StatusUnavailable="StatusUnavailable",t.StopProgressFreestanding="StopProgressFreestanding",t.StopProgress="StopProgress",t.TrashEmpty="TrashEmpty",t.TrashFull="TrashFull",t.User="User",t.UserAccounts="UserAccounts",t.UserGroup="UserGroup",t.UserGuest="UserGuest"})(js||(js={}));class Hn extends cn{constructor(e,n){super(e,n,"Icon")}static async new(e){return on("Icon",e).then(([n,l])=>new Hn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async setIcon(e){return m("plugin:menu|set_icon",{rid:this.rid,icon:e})}}class Un extends cn{constructor(e,n){super(e,n,"Predefined")}static async new(e){return on("Predefined",e).then(([n,l])=>new Un(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}}function Ml([t,e,n]){switch(n){case"Submenu":return new Bn(t,e);case"Predefined":return new Un(t,e);case"Check":return new dn(t,e);case"Icon":return new Hn(t,e);case"MenuItem":default:return new Fn(t,e)}}class Bn extends cn{constructor(e,n){super(e,n,"Submenu")}static async new(e){return on("Submenu",e).then(([n,l])=>new Bn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async append(e){return m("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(e){return m("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(e,n){return m("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(l=>"rid"in l?[l.rid,l.kind]:l),position:n})}async remove(e){return m("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return m("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(Ml)}async items(){return m("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(e=>e.map(Ml))}async get(e){return m("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then(n=>n?Ml(n):null)}async popup(e,n){let l=null;return e&&(l={type:e instanceof it?"Physical":"Logical",data:e}),m("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(n==null?void 0:n.label)??null,at:l})}async setAsWindowsMenuForNSApp(){return m("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return m("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}}function Pl([t,e,n]){switch(n){case"Submenu":return new Bn(t,e);case"Predefined":return new Un(t,e);case"Check":return new dn(t,e);case"Icon":return new Hn(t,e);case"MenuItem":default:return new Fn(t,e)}}class bt extends cn{constructor(e,n){super(e,n,"Menu")}static async new(e){return on("Menu",e).then(([n,l])=>new bt(n,l))}static async default(){return m("plugin:menu|default").then(([e,n])=>new bt(e,n))}async append(e){return m("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(e){return m("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(e,n){return m("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(l=>"rid"in l?[l.rid,l.kind]:l),position:n})}async remove(e){return m("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return m("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(Pl)}async items(){return m("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(e=>e.map(Pl))}async get(e){return m("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then(n=>n?Pl(n):null)}async popup(e,n){let l=null;return e&&(l={type:e instanceof it?"Physical":"Logical",data:e}),m("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(n==null?void 0:n.label)??null,at:l})}async setAsAppMenu(){return m("plugin:menu|set_as_app_menu",{rid:this.rid}).then(e=>e?new bt(e[0],e[1]):null)}async setAsWindowMenu(e){return m("plugin:menu|set_as_window_menu",{rid:this.rid,window:(e==null?void 0:e.label)??null}).then(n=>n?new bt(n[0],n[1]):null)}}function Gs(t,e,n){const l=t.slice();return l[16]=e[n],l[17]=e,l[18]=n,l}function Ks(t,e,n){const l=t.slice();return l[19]=e[n],l[20]=e,l[21]=n,l}function Xs(t){let e,n,l,s,u,d,o=t[19]+"",c,h,w,_,A;function k(){t[9].call(n,t[20],t[21])}return{c(){e=r("div"),n=r("input"),u=p(),d=r("label"),c=b(o),w=p(),a(n,"id",l=t[19]+"Input"),n.checked=s=t[0]===t[19],a(n,"type","radio"),a(n,"name","kind"),a(d,"for",h=t[19]+"Input"),a(e,"class","flex gap-1")},m(y,L){C(y,e,L),i(e,n),I(n,t[19]),i(e,u),i(e,d),i(d,c),i(e,w),_||(A=[S(n,"change",t[6]),S(n,"change",k)],_=!0)},p(y,L){t=y,L&16&&l!==(l=t[19]+"Input")&&a(n,"id",l),L&17&&s!==(s=t[0]===t[19])&&(n.checked=s),L&16&&I(n,t[19]),L&16&&o!==(o=t[19]+"")&&re(c,o),L&16&&h!==(h=t[19]+"Input")&&a(d,"for",h)},d(y){y&&v(e),_=!1,Ce(A)}}}function Ys(t){let e,n,l;return{c(){e=r("input"),a(e,"class","input"),a(e,"type","text"),a(e,"placeholder","Text")},m(s,u){C(s,e,u),I(e,t[1]),n||(l=S(e,"input",t[10]),n=!0)},p(s,u){u&2&&e.value!==s[1]&&I(e,s[1])},d(s){s&&v(e),n=!1,l()}}}function oa(t){let e,n=fe(t[5]),l=[];for(let s=0;sl("itemClick",{id:z,text:E})},P=await Fn.new(O);break;case"Icon":O={text:u,icon:d,action:z=>l("itemClick",{id:z,text:E})},P=await Hn.new(O);break;case"Check":O={text:u,checked:c,action:z=>l("itemClick",{id:z,text:E})},P=await dn.new(O);break;case"Predefined":O={item:o},P=await Un.new(O);break}l("new",{item:P,options:O}),n(1,u=""),o=""}function y(O,P){O[P]=this.value,n(4,h)}function L(){u=this.value,n(1,u)}function M(){d=this.value,n(2,d)}function B(){c=this.checked,n(3,c)}function D(O,P){O[P]=this.value,n(5,w)}return[s,u,d,c,h,w,_,A,k,y,L,M,B,D]}class pa extends xe{constructor(e){super(),Ze(this,e,fa,ha,je,{})}}function Js(t,e,n){const l=t.slice();return l[5]=e[n],l}function Zs(t){let e,n,l,s,u,d=xs(t[5])+"",o,c;return{c(){e=r("div"),n=r("div"),s=p(),u=r("p"),o=b(d),c=p(),a(n,"class",l=t[3](t[5])),a(e,"class","flex flex-row gap-1")},m(h,w){C(h,e,w),i(e,n),i(e,s),i(e,u),i(u,o),i(e,c)},p(h,w){w&1&&l!==(l=h[3](h[5]))&&a(n,"class",l),w&1&&d!==(d=xs(h[5])+"")&&re(o,d)},d(h){h&&v(e)}}}function ma(t){let e,n,l,s,u;n=new pa({}),n.$on("new",t[1]),n.$on("itemClick",t[2]);let d=fe(t[0]),o=[];for(let c=0;c{"items"in c&&n(0,l=c.items)},[l,u,d,o]}class kr extends xe{constructor(e){super(),Ze(this,e,ga,ma,je,{items:0})}}function _a(t){let e,n,l,s,u,d,o,c,h,w;function _(k){t[5](k)}let A={};return t[0]!==void 0&&(A.items=t[0]),n=new kr({props:A}),sn.push(()=>fr(n,"items",_)),n.$on("itemClick",t[3]),{c(){e=r("div"),In(n.$$.fragment),s=p(),u=r("button"),u.textContent="Create menu",d=p(),o=r("button"),o.textContent="Popup",a(u,"class","btn"),a(o,"class","btn")},m(k,y){C(k,e,y),an(n,e,null),i(e,s),i(e,u),i(e,d),i(e,o),c=!0,h||(w=[S(u,"click",t[1]),S(o,"click",t[2])],h=!0)},p(k,[y]){const L={};!l&&y&1&&(l=!0,L.items=k[0],dr(()=>l=!1)),n.$set(L)},i(k){c||(rn(n.$$.fragment,k),c=!0)},o(k){Wn(n.$$.fragment,k),c=!1},d(k){k&&v(e),un(n),h=!1,Ce(w)}}}function ba(t,e,n){let{onMessage:l}=e,s=[],u=null,d=null,o=0;const c=navigator.userAgent.includes("Macintosh");async function h(){d=await Bn.new({text:"app",items:s.map(y=>y.item)})}async function w(){await h(),o=s.length,u=await bt.new({items:[d]}),await(c?u.setAsAppMenu():u.setAsWindowMenu())}async function _(){(!d||o!==s.length)&&await h(),(await bt.new({items:[d]})).popup()}function A(y){l(`Item ${y.detail.text} clicked`)}function k(y){s=y,n(0,s)}return t.$$set=y=>{"onMessage"in y&&n(4,l=y.onMessage)},[s,w,_,A,l,k]}class wa extends xe{constructor(e){super(),Ze(this,e,ba,_a,je,{onMessage:4})}}class Dl extends br{constructor(e,n){super(e),this.id=n}static async new(e){e!=null&&e.menu&&(e.menu=[e.menu.rid,e.menu.kind]),e!=null&&e.icon&&(e.icon=typeof e.icon=="string"?e.icon:Array.from(e.icon));const n=new Il;return e!=null&&e.action&&(n.onmessage=e.action,delete e.action),m("plugin:tray|new",{options:e??{},handler:n}).then(([l,s])=>new Dl(l,s))}async setIcon(e){let n=null;return e&&(n=typeof e=="string"?e:Array.from(e)),m("plugin:tray|set_icon",{rid:this.rid,icon:n})}async setMenu(e){return e&&(e=[e.rid,e.kind]),m("plugin:tray|set_menu",{rid:this.rid,menu:e})}async setTooltip(e){return m("plugin:tray|set_tooltip",{rid:this.rid,tooltip:e})}async setTitle(e){return m("plugin:tray|set_title",{rid:this.rid,title:e})}async setVisible(e){return m("plugin:tray|set_visible",{rid:this.rid,visible:e})}async setTempDirPath(e){return m("plugin:tray|set_temp_dir_path",{rid:this.rid,path:e})}async setIconAsTemplate(e){return m("plugin:tray|set_icon_as_template",{rid:this.rid,asTemplate:e})}async setMenuOnLeftClick(e){return m("plugin:tray|set_show_menu_on_left_click",{rid:this.rid,onLeft:e})}}function ka(t){let e,n,l,s,u,d,o,c,h,w,_,A,k,y,L,M,B,D,O,P,E,z,R,J,V,Z;function le(q){t[14](q)}let te={};return t[5]!==void 0&&(te.items=t[5]),O=new kr({props:te}),sn.push(()=>fr(O,"items",le)),O.$on("itemClick",t[6]),{c(){e=r("div"),n=r("div"),l=r("input"),s=p(),u=r("input"),d=p(),o=r("label"),c=b(`Menu on left click + `),D=r("div"),O=r("input"),P=p(),E=r("input"),z=p(),R=r("input"),J=p(),V=r("input"),Z=p(),le=r("div"),te=r("button"),te.textContent="Add",q=p(),G=r("div"),T=r("div"),K=b("Applied effects: "),be=b(X),ke=p(),de=r("button"),de.textContent="Clear",a(u,"class","input"),t[36]===void 0&&wt(()=>t[89].call(u)),a(h,"class","input"),t[37]===void 0&&wt(()=>t[90].call(h)),a(k,"class","input"),a(k,"type","number"),a(n,"class","flex"),xt(O,"max-width","120px"),a(O,"class","input"),a(O,"type","number"),a(O,"placeholder","R"),xt(E,"max-width","120px"),a(E,"class","input"),a(E,"type","number"),a(E,"placeholder","G"),xt(R,"max-width","120px"),a(R,"class","input"),a(R,"type","number"),a(R,"placeholder","B"),xt(V,"max-width","120px"),a(V,"class","input"),a(V,"type","number"),a(V,"placeholder","A"),a(D,"class","flex"),a(L,"class","flex"),a(te,"class","btn"),xt(te,"width","80px"),a(le,"class","flex"),a(de,"class","btn"),xt(de,"width","80px"),a(G,"class","flex"),a(e,"class","flex flex-col gap-1")},m(W,x){C(W,e,x),i(e,n),i(n,l),i(l,s),i(l,u);for(let H=0;H=1,w,_,A,k=h&&Fs(t),y=t[1][t[0]]&&Us(t);return{c(){e=r("div"),n=r("div"),l=r("input"),s=p(),u=r("button"),u.textContent="New window",d=p(),o=r("br"),c=p(),k&&k.c(),w=p(),y&&y.c(),a(l,"class","input grow"),a(l,"type","text"),a(l,"placeholder","New Window label.."),a(u,"class","btn"),a(n,"class","flex gap-1"),a(e,"class","flex flex-col children:grow gap-2")},m(L,M){C(L,e,M),i(e,n),i(n,l),I(l,t[28]),i(n,s),i(n,u),i(e,d),i(e,o),i(e,c),k&&k.m(e,null),i(e,w),y&&y.m(e,null),_||(A=[S(l,"input",t[58]),S(u,"click",t[53])],_=!0)},p(L,M){M[0]&268435456&&l.value!==L[28]&&I(l,L[28]),M[0]&2&&(h=Object.keys(L[1]).length>=1),h?k?k.p(L,M):(k=Fs(L),k.c(),k.m(e,w)):k&&(k.d(1),k=null),L[1][L[0]]?y?y.p(L,M):(y=Us(L),y.c(),y.m(e,null)):y&&(y.d(1),y=null)},i:ie,o:ie,d(L){L&&v(e),k&&k.d(),y&&y.d(),_=!1,Ce(A)}}}function ta(t,e,n){const l=br();let s=l.label;const u={[l.label]:l},d=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"],o=["mica","blur","acrylic","tabbed","tabbedDark","tabbedLight"],c=navigator.appVersion.includes("Windows"),h=navigator.appVersion.includes("Macintosh");let w=c?o:Object.keys(Ji).map(N=>Ji[N]).filter(N=>!o.includes(N));const _=Object.keys(Zi).map(N=>Zi[N]),A=Object.keys(Qi).map(N=>Qi[N]);let{onMessage:k}=e;const y=document.querySelector("main");let L,M=!0,B=!0,D=!0,O=!0,P=!1,E=!0,z=!1,R=!1,J=!0,V=!1,Z=null,le=null,te=null,q=null,G=null,T=null,K=null,X=null,be=1,ke=new it(K,X),de=new it(K,X),ae=new ln(Z,le),$=new ln(Z,le),pe,Y,se=!1,ne=!0,W=null,x=null,H="default",ue=!1,Ae="Awesome Tauri Example!",we=[],me,We,Me,Ie,ge,_e,Se,Pe="none",he=0,Le;function oe(){u[s].setTitle(Ae)}function Re(){u[s].hide(),setTimeout(u[s].show,2e3)}function De(){u[s].minimize(),setTimeout(u[s].unminimize,2e3)}function Ee(){if(!L)return;const N=new Dn(L);n(1,u[L]=N,u),N.once("tauri://error",function(){k("Error creating new webview")})}function ce(){u[s].innerSize().then(N=>{n(32,ae=N),n(12,Z=ae.width),n(13,le=ae.height)}),u[s].outerSize().then(N=>{n(33,$=N)})}function F(){u[s].innerPosition().then(N=>{n(30,ke=N)}),u[s].outerPosition().then(N=>{n(31,de=N),n(18,K=de.x),n(19,X=de.y)})}async function ee(N){N&&(pe&&pe(),Y&&Y(),Y=await N.listen("tauri://move",F),pe=await N.listen("tauri://resize",ce))}async function U(){await u[s].minimize(),await u[s].requestUserAttention(Yi.Critical),await new Promise(N=>setTimeout(N,3e3)),await u[s].requestUserAttention(null)}async function Te(){we.includes(me)||n(35,we=[...we,me]);const N={effects:we,state:We,radius:Me};Number.isInteger(Ie)&&Number.isInteger(ge)&&Number.isInteger(_e)&&Number.isInteger(Se)&&(N.color=[Ie,ge,_e,Se]),y.classList.remove("bg-primary"),y.classList.remove("dark:bg-darkPrimary"),await u[s].clearEffects(),await u[s].setEffects(N)}async function Vn(){n(35,we=[]),await u[s].clearEffects(),y.classList.add("bg-primary"),y.classList.add("dark:bg-darkPrimary")}function Fe(){L=this.value,n(28,L)}function qn(){s=En(this),n(0,s),n(1,u)}function Ot(){Le=this.value,n(43,Le)}const Nn=()=>u[s].center();function He(){P=this.checked,n(6,P)}function jn(){M=this.checked,n(2,M)}function lt(){B=this.checked,n(3,B)}function Wt(){D=this.checked,n(4,D)}function Gn(){O=this.checked,n(5,O)}function Ue(){E=this.checked,n(7,E)}function Kn(){z=this.checked,n(8,z)}function It(){R=this.checked,n(9,R)}function Xn(){J=this.checked,n(10,J)}function Be(){V=this.checked,n(11,V)}function Yn(){K=Q(this.value),n(18,K)}function st(){X=Q(this.value),n(19,X)}function Rt(){Z=Q(this.value),n(12,Z)}function Qn(){le=Q(this.value),n(13,le)}function Ge(){te=Q(this.value),n(14,te)}function Jn(){q=Q(this.value),n(15,q)}function Dt(){G=Q(this.value),n(16,G)}function Zn(){T=Q(this.value),n(17,T)}function Ke(){se=this.checked,n(20,se)}function xn(){ne=this.checked,n(21,ne)}function rt(){ue=this.checked,n(25,ue)}function Ft(){H=En(this),n(24,H),n(44,d)}function $n(){W=Q(this.value),n(22,W)}function Ve(){x=Q(this.value),n(23,x)}function ei(){Ae=this.value,n(34,Ae)}function Ht(){Pe=En(this),n(26,Pe),n(49,A)}function ti(){he=Q(this.value),n(27,he)}function qe(){me=En(this),n(36,me),n(47,w)}function hn(){We=En(this),n(37,We),n(48,_)}function fn(){Me=Q(this.value),n(38,Me)}function pn(){Ie=Q(this.value),n(39,Ie)}function ze(){ge=Q(this.value),n(40,ge)}function at(){_e=Q(this.value),n(41,_e)}function Xe(){Se=Q(this.value),n(42,Se)}return t.$$set=N=>{"onMessage"in N&&n(57,k=N.onMessage)},t.$$.update=()=>{var N,mn,kt,gn,yt,Ut,_n,vt,bn,Ct,Bt,wn,Ne,St,kn,Lt,yn,At,Vt,vn,Mt,Cn,Pt,qt;t.$$.dirty[0]&3&&(u[s],F(),ce()),t.$$.dirty[0]&7&&((N=u[s])==null||N.setResizable(M)),t.$$.dirty[0]&11&&((mn=u[s])==null||mn.setMaximizable(B)),t.$$.dirty[0]&19&&((kt=u[s])==null||kt.setMinimizable(D)),t.$$.dirty[0]&35&&((gn=u[s])==null||gn.setClosable(O)),t.$$.dirty[0]&67&&(P?(yt=u[s])==null||yt.maximize():(Ut=u[s])==null||Ut.unmaximize()),t.$$.dirty[0]&131&&((_n=u[s])==null||_n.setDecorations(E)),t.$$.dirty[0]&259&&((vt=u[s])==null||vt.setAlwaysOnTop(z)),t.$$.dirty[0]&515&&((bn=u[s])==null||bn.setAlwaysOnBottom(R)),t.$$.dirty[0]&1027&&((Ct=u[s])==null||Ct.setContentProtected(J)),t.$$.dirty[0]&2051&&((Bt=u[s])==null||Bt.setFullscreen(V)),t.$$.dirty[0]&12291&&Z&&le&&((wn=u[s])==null||wn.setSize(new ln(Z,le))),t.$$.dirty[0]&49155&&(te&&q?(Ne=u[s])==null||Ne.setMinSize(new zl(te,q)):(St=u[s])==null||St.setMinSize(null)),t.$$.dirty[0]&196611&&(G>800&&T>400?(kn=u[s])==null||kn.setMaxSize(new zl(G,T)):(Lt=u[s])==null||Lt.setMaxSize(null)),t.$$.dirty[0]&786435&&K!==null&&X!==null&&((yn=u[s])==null||yn.setPosition(new it(K,X))),t.$$.dirty[0]&3&&((At=u[s])==null||At.scaleFactor().then(ni=>n(29,be=ni))),t.$$.dirty[0]&3&&ee(u[s]),t.$$.dirty[0]&1048579&&((Vt=u[s])==null||Vt.setCursorGrab(se)),t.$$.dirty[0]&2097155&&((vn=u[s])==null||vn.setCursorVisible(ne)),t.$$.dirty[0]&16777219&&((Mt=u[s])==null||Mt.setCursorIcon(H)),t.$$.dirty[0]&12582915&&W!==null&&x!==null&&((Cn=u[s])==null||Cn.setCursorPosition(new it(W,x))),t.$$.dirty[0]&33554435&&((Pt=u[s])==null||Pt.setIgnoreCursorEvents(ue)),t.$$.dirty[0]&201326595&&((qt=u[s])==null||qt.setProgressBar({status:Pe,progress:he}))},[s,u,M,B,D,O,P,E,z,R,J,V,Z,le,te,q,G,T,K,X,se,ne,W,x,H,ue,Pe,he,L,be,ke,de,ae,$,Ae,we,me,We,Me,Ie,ge,_e,Se,Le,d,c,h,w,_,A,oe,Re,De,Ee,U,Te,Vn,k,Fe,qn,Ot,Nn,He,jn,lt,Wt,Gn,Ue,Kn,It,Xn,Be,Yn,st,Rt,Qn,Ge,Jn,Dt,Zn,Ke,xn,rt,Ft,$n,Ve,ei,Ht,ti,qe,hn,fn,pn,ze,at,Xe]}class na extends xe{constructor(e){super(),Ze(this,e,ta,ea,je,{onMessage:57},null,[-1,-1,-1,-1])}}function ia(t){let e;return{c(){e=r("div"),e.innerHTML='
Not available for Linux
',a(e,"class","flex flex-col gap-2")},m(n,l){C(n,e,l)},p:ie,i:ie,o:ie,d(n){n&&v(e)}}}function la(t,e,n){let{onMessage:l}=e;const s=window.constraints={audio:!0,video:!0};function u(o){const c=document.querySelector("video"),h=o.getVideoTracks();l("Got stream with constraints:",s),l(`Using video device: ${h[0].label}`),window.stream=o,c.srcObject=o}function d(o){if(o.name==="ConstraintNotSatisfiedError"){const c=s.video;l(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else o.name==="PermissionDeniedError"&&l("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");l(`getUserMedia error: ${o.name}`,o)}return Ki(async()=>{try{const o=await navigator.mediaDevices.getUserMedia(s);u(o)}catch(o){d(o)}}),ar(()=>{var o;(o=window.stream)==null||o.getTracks().forEach(function(c){c.stop()})}),t.$$set=o=>{"onMessage"in o&&n(0,l=o.onMessage)},[l]}class sa extends xe{constructor(e){super(),Ze(this,e,la,ia,je,{onMessage:0})}}function ra(t){let e,n,l,s,u,d;return{c(){e=r("div"),n=r("button"),n.textContent="Show",l=p(),s=r("button"),s.textContent="Hide",a(n,"class","btn"),a(n,"id","show"),a(n,"title","Hides and shows the app after 2 seconds"),a(s,"class","btn"),a(s,"id","hide")},m(o,c){C(o,e,c),i(e,n),i(e,l),i(e,s),u||(d=[S(n,"click",t[0]),S(s,"click",t[1])],u=!0)},p:ie,i:ie,o:ie,d(o){o&&v(e),u=!1,Ce(d)}}}function aa(t,e,n){let{onMessage:l}=e;function s(){u().then(()=>{setTimeout(()=>{Vr().then(()=>l("Shown app")).catch(l)},2e3)}).catch(l)}function u(){return qr().then(()=>l("Hide app")).catch(l)}return t.$$set=d=>{"onMessage"in d&&n(2,l=d.onMessage)},[s,u,l]}class ua extends xe{constructor(e){super(),Ze(this,e,aa,ra,je,{onMessage:2})}}var ji,Gi;function wr(t){var e;if("items"in t)t.items=(e=t.items)==null?void 0:e.map(n=>"rid"in n?n:wr(n));else if("action"in t&&t.action){const n=new Il;return n.onmessage=t.action,delete t.action,{...t,handler:n}}return t}async function on(t,e){const n=new Il;let l=null;return e&&typeof e=="object"&&("action"in e&&e.action&&(n.onmessage=e.action,delete e.action),"items"in e&&e.items&&(l=e.items.map(s=>"rid"in s?[s.rid,s.kind]:wr(s)))),m("plugin:menu|new",{kind:t,options:e?{...e,items:l}:void 0,handler:n})}class cn extends mr{get id(){return Rn(this,ji,"f")}get kind(){return Rn(this,Gi,"f")}constructor(e,n,l){super(e),ji.set(this,void 0),Gi.set(this,void 0),Xi(this,ji,n,"f"),Xi(this,Gi,l,"f")}}ji=new WeakMap,Gi=new WeakMap;class Fn extends cn{constructor(e,n){super(e,n,"MenuItem")}static async new(e){return on("MenuItem",e).then(([n,l])=>new Fn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}}class dn extends cn{constructor(e,n){super(e,n,"Check")}static async new(e){return on("Check",e).then(([n,l])=>new dn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async isChecked(){return m("plugin:menu|is_checked",{rid:this.rid})}async setChecked(e){return m("plugin:menu|set_checked",{rid:this.rid,checked:e})}}var js;(function(t){t.Add="Add",t.Advanced="Advanced",t.Bluetooth="Bluetooth",t.Bookmarks="Bookmarks",t.Caution="Caution",t.ColorPanel="ColorPanel",t.ColumnView="ColumnView",t.Computer="Computer",t.EnterFullScreen="EnterFullScreen",t.Everyone="Everyone",t.ExitFullScreen="ExitFullScreen",t.FlowView="FlowView",t.Folder="Folder",t.FolderBurnable="FolderBurnable",t.FolderSmart="FolderSmart",t.FollowLinkFreestanding="FollowLinkFreestanding",t.FontPanel="FontPanel",t.GoLeft="GoLeft",t.GoRight="GoRight",t.Home="Home",t.IChatTheater="IChatTheater",t.IconView="IconView",t.Info="Info",t.InvalidDataFreestanding="InvalidDataFreestanding",t.LeftFacingTriangle="LeftFacingTriangle",t.ListView="ListView",t.LockLocked="LockLocked",t.LockUnlocked="LockUnlocked",t.MenuMixedState="MenuMixedState",t.MenuOnState="MenuOnState",t.MobileMe="MobileMe",t.MultipleDocuments="MultipleDocuments",t.Network="Network",t.Path="Path",t.PreferencesGeneral="PreferencesGeneral",t.QuickLook="QuickLook",t.RefreshFreestanding="RefreshFreestanding",t.Refresh="Refresh",t.Remove="Remove",t.RevealFreestanding="RevealFreestanding",t.RightFacingTriangle="RightFacingTriangle",t.Share="Share",t.Slideshow="Slideshow",t.SmartBadge="SmartBadge",t.StatusAvailable="StatusAvailable",t.StatusNone="StatusNone",t.StatusPartiallyAvailable="StatusPartiallyAvailable",t.StatusUnavailable="StatusUnavailable",t.StopProgressFreestanding="StopProgressFreestanding",t.StopProgress="StopProgress",t.TrashEmpty="TrashEmpty",t.TrashFull="TrashFull",t.User="User",t.UserAccounts="UserAccounts",t.UserGroup="UserGroup",t.UserGuest="UserGuest"})(js||(js={}));class Hn extends cn{constructor(e,n){super(e,n,"Icon")}static async new(e){return on("Icon",e).then(([n,l])=>new Hn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async setAccelerator(e){return m("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:e})}async setIcon(e){return m("plugin:menu|set_icon",{rid:this.rid,icon:e})}}class Un extends cn{constructor(e,n){super(e,n,"Predefined")}static async new(e){return on("Predefined",e).then(([n,l])=>new Un(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}}function Ml([t,e,n]){switch(n){case"Submenu":return new Bn(t,e);case"Predefined":return new Un(t,e);case"Check":return new dn(t,e);case"Icon":return new Hn(t,e);case"MenuItem":default:return new Fn(t,e)}}class Bn extends cn{constructor(e,n){super(e,n,"Submenu")}static async new(e){return on("Submenu",e).then(([n,l])=>new Bn(n,l))}async text(){return m("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(e){return m("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:e})}async isEnabled(){return m("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(e){return m("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:e})}async append(e){return m("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(e){return m("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(e,n){return m("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(l=>"rid"in l?[l.rid,l.kind]:l),position:n})}async remove(e){return m("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return m("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(Ml)}async items(){return m("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(e=>e.map(Ml))}async get(e){return m("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then(n=>n?Ml(n):null)}async popup(e,n){let l=null;return e&&(l={type:e instanceof it?"Physical":"Logical",data:e}),m("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(n==null?void 0:n.label)??null,at:l})}async setAsWindowsMenuForNSApp(){return m("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return m("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}}function Pl([t,e,n]){switch(n){case"Submenu":return new Bn(t,e);case"Predefined":return new Un(t,e);case"Check":return new dn(t,e);case"Icon":return new Hn(t,e);case"MenuItem":default:return new Fn(t,e)}}class bt extends cn{constructor(e,n){super(e,n,"Menu")}static async new(e){return on("Menu",e).then(([n,l])=>new bt(n,l))}static async default(){return m("plugin:menu|default").then(([e,n])=>new bt(e,n))}async append(e){return m("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(e){return m("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(e,n){return m("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(e)?e:[e]).map(l=>"rid"in l?[l.rid,l.kind]:l),position:n})}async remove(e){return m("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[e.rid,e.kind]})}async removeAt(e){return m("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:e}).then(Pl)}async items(){return m("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(e=>e.map(Pl))}async get(e){return m("plugin:menu|get",{rid:this.rid,kind:this.kind,id:e}).then(n=>n?Pl(n):null)}async popup(e,n){let l=null;return e&&(l={type:e instanceof it?"Physical":"Logical",data:e}),m("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(n==null?void 0:n.label)??null,at:l})}async setAsAppMenu(){return m("plugin:menu|set_as_app_menu",{rid:this.rid}).then(e=>e?new bt(e[0],e[1]):null)}async setAsWindowMenu(e){return m("plugin:menu|set_as_window_menu",{rid:this.rid,window:(e==null?void 0:e.label)??null}).then(n=>n?new bt(n[0],n[1]):null)}}function Gs(t,e,n){const l=t.slice();return l[16]=e[n],l[17]=e,l[18]=n,l}function Ks(t,e,n){const l=t.slice();return l[19]=e[n],l[20]=e,l[21]=n,l}function Xs(t){let e,n,l,s,u,d,o=t[19]+"",c,h,w,_,A;function k(){t[9].call(n,t[20],t[21])}return{c(){e=r("div"),n=r("input"),u=p(),d=r("label"),c=b(o),w=p(),a(n,"id",l=t[19]+"Input"),n.checked=s=t[0]===t[19],a(n,"type","radio"),a(n,"name","kind"),a(d,"for",h=t[19]+"Input"),a(e,"class","flex gap-1")},m(y,L){C(y,e,L),i(e,n),I(n,t[19]),i(e,u),i(e,d),i(d,c),i(e,w),_||(A=[S(n,"change",t[6]),S(n,"change",k)],_=!0)},p(y,L){t=y,L&16&&l!==(l=t[19]+"Input")&&a(n,"id",l),L&17&&s!==(s=t[0]===t[19])&&(n.checked=s),L&16&&I(n,t[19]),L&16&&o!==(o=t[19]+"")&&re(c,o),L&16&&h!==(h=t[19]+"Input")&&a(d,"for",h)},d(y){y&&v(e),_=!1,Ce(A)}}}function Ys(t){let e,n,l;return{c(){e=r("input"),a(e,"class","input"),a(e,"type","text"),a(e,"placeholder","Text")},m(s,u){C(s,e,u),I(e,t[1]),n||(l=S(e,"input",t[10]),n=!0)},p(s,u){u&2&&e.value!==s[1]&&I(e,s[1])},d(s){s&&v(e),n=!1,l()}}}function oa(t){let e,n=fe(t[5]),l=[];for(let s=0;sl("itemClick",{id:z,text:E})},P=await Fn.new(O);break;case"Icon":O={text:u,icon:d,action:z=>l("itemClick",{id:z,text:E})},P=await Hn.new(O);break;case"Check":O={text:u,checked:c,action:z=>l("itemClick",{id:z,text:E})},P=await dn.new(O);break;case"Predefined":O={item:o},P=await Un.new(O);break}l("new",{item:P,options:O}),n(1,u=""),o=""}function y(O,P){O[P]=this.value,n(4,h)}function L(){u=this.value,n(1,u)}function M(){d=this.value,n(2,d)}function B(){c=this.checked,n(3,c)}function D(O,P){O[P]=this.value,n(5,w)}return[s,u,d,c,h,w,_,A,k,y,L,M,B,D]}class pa extends xe{constructor(e){super(),Ze(this,e,fa,ha,je,{})}}function Js(t,e,n){const l=t.slice();return l[5]=e[n],l}function Zs(t){let e,n,l,s,u,d=xs(t[5])+"",o,c;return{c(){e=r("div"),n=r("div"),s=p(),u=r("p"),o=b(d),c=p(),a(n,"class",l=t[3](t[5])),a(e,"class","flex flex-row gap-1")},m(h,w){C(h,e,w),i(e,n),i(e,s),i(e,u),i(u,o),i(e,c)},p(h,w){w&1&&l!==(l=h[3](h[5]))&&a(n,"class",l),w&1&&d!==(d=xs(h[5])+"")&&re(o,d)},d(h){h&&v(e)}}}function ma(t){let e,n,l,s,u;n=new pa({}),n.$on("new",t[1]),n.$on("itemClick",t[2]);let d=fe(t[0]),o=[];for(let c=0;c{"items"in c&&n(0,l=c.items)},[l,u,d,o]}class kr extends xe{constructor(e){super(),Ze(this,e,ga,ma,je,{items:0})}}function _a(t){let e,n,l,s,u,d,o,c,h,w;function _(k){t[5](k)}let A={};return t[0]!==void 0&&(A.items=t[0]),n=new kr({props:A}),sn.push(()=>fr(n,"items",_)),n.$on("itemClick",t[3]),{c(){e=r("div"),In(n.$$.fragment),s=p(),u=r("button"),u.textContent="Create menu",d=p(),o=r("button"),o.textContent="Popup",a(u,"class","btn"),a(o,"class","btn")},m(k,y){C(k,e,y),an(n,e,null),i(e,s),i(e,u),i(e,d),i(e,o),c=!0,h||(w=[S(u,"click",t[1]),S(o,"click",t[2])],h=!0)},p(k,[y]){const L={};!l&&y&1&&(l=!0,L.items=k[0],dr(()=>l=!1)),n.$set(L)},i(k){c||(rn(n.$$.fragment,k),c=!0)},o(k){Wn(n.$$.fragment,k),c=!1},d(k){k&&v(e),un(n),h=!1,Ce(w)}}}function ba(t,e,n){let{onMessage:l}=e,s=[],u=null,d=null,o=0;const c=navigator.userAgent.includes("Macintosh");async function h(){d=await Bn.new({text:"app",items:s.map(y=>y.item)})}async function w(){await h(),o=s.length,u=await bt.new({items:[d]}),await(c?u.setAsAppMenu():u.setAsWindowMenu())}async function _(){(!d||o!==s.length)&&await h(),(await bt.new({items:[d]})).popup()}function A(y){l(`Item ${y.detail.text} clicked`)}function k(y){s=y,n(0,s)}return t.$$set=y=>{"onMessage"in y&&n(4,l=y.onMessage)},[s,w,_,A,l,k]}class wa extends xe{constructor(e){super(),Ze(this,e,ba,_a,je,{onMessage:4})}}class Dl extends mr{constructor(e,n){super(e),this.id=n}static async new(e){e!=null&&e.menu&&(e.menu=[e.menu.rid,e.menu.kind]),e!=null&&e.icon&&(e.icon=typeof e.icon=="string"?e.icon:Array.from(e.icon));const n=new Il;return e!=null&&e.action&&(n.onmessage=e.action,delete e.action),m("plugin:tray|new",{options:e??{},handler:n}).then(([l,s])=>new Dl(l,s))}async setIcon(e){let n=null;return e&&(n=typeof e=="string"?e:Array.from(e)),m("plugin:tray|set_icon",{rid:this.rid,icon:n})}async setMenu(e){return e&&(e=[e.rid,e.kind]),m("plugin:tray|set_menu",{rid:this.rid,menu:e})}async setTooltip(e){return m("plugin:tray|set_tooltip",{rid:this.rid,tooltip:e})}async setTitle(e){return m("plugin:tray|set_title",{rid:this.rid,title:e})}async setVisible(e){return m("plugin:tray|set_visible",{rid:this.rid,visible:e})}async setTempDirPath(e){return m("plugin:tray|set_temp_dir_path",{rid:this.rid,path:e})}async setIconAsTemplate(e){return m("plugin:tray|set_icon_as_template",{rid:this.rid,asTemplate:e})}async setMenuOnLeftClick(e){return m("plugin:tray|set_show_menu_on_left_click",{rid:this.rid,onLeft:e})}}function ka(t){let e,n,l,s,u,d,o,c,h,w,_,A,k,y,L,M,B,D,O,P,E,z,R,J,V,Z;function le(q){t[14](q)}let te={};return t[5]!==void 0&&(te.items=t[5]),O=new kr({props:te}),sn.push(()=>fr(O,"items",le)),O.$on("itemClick",t[6]),{c(){e=r("div"),n=r("div"),l=r("input"),s=p(),u=r("input"),d=p(),o=r("label"),c=b(`Menu on left click `),h=r("input"),w=p(),_=r("div"),A=r("input"),k=p(),y=r("label"),L=b(`Icon as template `),M=r("input"),B=p(),D=r("div"),In(O.$$.fragment),E=p(),z=r("div"),R=r("button"),R.textContent="Create tray",a(l,"class","input grow"),a(l,"type","text"),a(l,"placeholder","Title"),a(u,"class","input grow"),a(u,"type","text"),a(u,"placeholder","Tooltip"),a(h,"type","checkbox"),a(n,"class","flex gap-1"),a(A,"class","input grow"),a(A,"type","text"),a(A,"placeholder","Icon path"),a(M,"type","checkbox"),a(_,"class","flex gap-1"),a(D,"class","flex children:grow"),a(R,"class","btn"),a(R,"title","Creates the tray icon"),a(z,"class","flex"),a(e,"class","flex flex-col children:grow gap-2")},m(q,G){C(q,e,G),i(e,n),i(n,l),I(l,t[2]),i(n,s),i(n,u),I(u,t[1]),i(n,d),i(n,o),i(o,c),i(o,h),h.checked=t[4],i(e,w),i(e,_),i(_,A),I(A,t[0]),i(_,k),i(_,y),i(y,L),i(y,M),M.checked=t[3],i(e,B),i(e,D),an(O,D,null),i(e,E),i(e,z),i(z,R),J=!0,V||(Z=[S(l,"input",t[9]),S(u,"input",t[10]),S(h,"change",t[11]),S(A,"input",t[12]),S(M,"change",t[13]),S(R,"click",t[7])],V=!0)},p(q,[G]){G&4&&l.value!==q[2]&&I(l,q[2]),G&2&&u.value!==q[1]&&I(u,q[1]),G&16&&(h.checked=q[4]),G&1&&A.value!==q[0]&&I(A,q[0]),G&8&&(M.checked=q[3]);const T={};!P&&G&32&&(P=!0,T.items=q[5],dr(()=>P=!1)),O.$set(T)},i(q){J||(rn(O.$$.fragment,q),J=!0)},o(q){Wn(O.$$.fragment,q),J=!1},d(q){q&&v(e),un(O),V=!1,Ce(Z)}}}function ya(t,e,n){let{onMessage:l}=e,s=null,u=null,d=null,o=!1,c=!0,h=[];function w(D){l(`Item ${D.detail.text} clicked`)}async function _(){Dl.new({icon:s,tooltip:u,title:d,iconAsTemplate:o,menuOnLeftClick:c,menu:await bt.new({items:h.map(D=>D.item)}),action:D=>l(D)}).catch(l)}function A(){d=this.value,n(2,d)}function k(){u=this.value,n(1,u)}function y(){c=this.checked,n(4,c)}function L(){s=this.value,n(0,s)}function M(){o=this.checked,n(3,o)}function B(D){h=D,n(5,h)}return t.$$set=D=>{"onMessage"in D&&n(8,l=D.onMessage)},[s,u,d,o,c,h,w,_,l,A,k,y,L,M,B]}class va extends xe{constructor(e){super(),Ze(this,e,ya,ka,je,{onMessage:8})}}function $s(t,e,n){const l=t.slice();return l[28]=e[n],l}function er(t,e,n){const l=t.slice();return l[31]=e[n],l}function Ca(t){let e;return{c(){e=r("span"),a(e,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,l){C(n,e,l)},d(n){n&&v(e)}}}function Sa(t){let e;return{c(){e=r("span"),a(e,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,l){C(n,e,l)},d(n){n&&v(e)}}}function La(t){let e,n;return{c(){e=b(`Switch to Dark mode `),n=r("div"),a(n,"class","i-ph-moon")},m(l,s){C(l,e,s),C(l,n,s)},d(l){l&&(v(e),v(n))}}}function Aa(t){let e,n;return{c(){e=b(`Switch to Light mode