@delta-comic/ui 2.2.0 → 3.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/core-NNJn692v.js +27 -0
  2. package/dist/core-NNJn692v.js.map +1 -0
  3. package/dist/dist-js-X_dgLCzM.js +12 -0
  4. package/dist/dist-js-X_dgLCzM.js.map +1 -0
  5. package/dist/index.css +2 -2
  6. package/dist/index.d.ts +1557 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +7645 -6764
  9. package/dist/index.js.map +1 -1
  10. package/dist-vite/index.d.mts +7 -0
  11. package/dist-vite/index.mjs +19 -0
  12. package/dist-vite/index.mjs.map +1 -0
  13. package/package.json +40 -41
  14. package/README.md +0 -42
  15. package/dist/index2.js +0 -16
  16. package/dist/index2.js.map +0 -1
  17. package/dist/lib/components/DcAuthorIcon.vue.d.ts +0 -10
  18. package/dist/lib/components/DcAwait.vue.d.ts +0 -26
  19. package/dist/lib/components/DcContent.vue.d.ts +0 -47
  20. package/dist/lib/components/DcFloatPopup.vue.d.ts +0 -39
  21. package/dist/lib/components/DcImage.vue.d.ts +0 -1158
  22. package/dist/lib/components/DcImagedIcon.vue.d.ts +0 -10
  23. package/dist/lib/components/DcList.vue.d.ts +0 -61
  24. package/dist/lib/components/DcLoading.vue.d.ts +0 -18
  25. package/dist/lib/components/DcMarkdown/index.vue.d.ts +0 -14
  26. package/dist/lib/components/DcPopup.vue.d.ts +0 -39
  27. package/dist/lib/components/DcRouterTab.vue.d.ts +0 -33
  28. package/dist/lib/components/DcState.vue.d.ts +0 -27
  29. package/dist/lib/components/DcText.vue.d.ts +0 -8
  30. package/dist/lib/components/DcToggleIcon.vue.d.ts +0 -43
  31. package/dist/lib/components/DcVar.vue.d.ts +0 -23
  32. package/dist/lib/components/DcWaterfall.vue.d.ts +0 -61
  33. package/dist/lib/components/icons.d.ts +0 -6
  34. package/dist/lib/form/components/DcForm.vue.d.ts +0 -40
  35. package/dist/lib/form/components/DcFormCheckbox.vue.d.ts +0 -13
  36. package/dist/lib/form/components/DcFormDate.vue.d.ts +0 -13
  37. package/dist/lib/form/components/DcFormDateRange.vue.d.ts +0 -13
  38. package/dist/lib/form/components/DcFormItem.vue.d.ts +0 -21
  39. package/dist/lib/form/components/DcFormNumber.vue.d.ts +0 -13
  40. package/dist/lib/form/components/DcFormPairs.vue.d.ts +0 -19
  41. package/dist/lib/form/components/DcFormRadio.vue.d.ts +0 -13
  42. package/dist/lib/form/components/DcFormString.vue.d.ts +0 -13
  43. package/dist/lib/form/components/DcFormSwitch.vue.d.ts +0 -13
  44. package/dist/lib/form/functional.d.ts +0 -5
  45. package/dist/lib/form/row.d.ts +0 -73
  46. package/dist/lib/form/type.d.ts +0 -16
  47. package/dist/lib/index.d.ts +0 -45
  48. package/dist/lib/message/dialog.d.ts +0 -9
  49. package/dist/lib/message/download.d.ts +0 -13
  50. package/dist/lib/message/index.d.ts +0 -3
  51. package/dist/lib/message/loading.d.ts +0 -14
  52. package/dist/lib/utils/image.d.ts +0 -5
  53. package/dist/lib/utils/index.d.ts +0 -4
  54. package/dist/lib/utils/layout.d.ts +0 -18
  55. package/dist/lib/utils/type.d.ts +0 -6
  56. package/dist/pack.tgz +0 -0
  57. package/dist/vite/index.d.ts +0 -2
@@ -0,0 +1,27 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, n = /* @__PURE__ */ t({
10
+ SERIALIZE_TO_IPC_FN: () => r,
11
+ invoke: () => a,
12
+ isTauri: () => o,
13
+ transformCallback: () => i
14
+ }), r = "__TAURI_TO_IPC_KEY__";
15
+ function i(e, t = !1) {
16
+ return window.__TAURI_INTERNALS__.transformCallback(e, t);
17
+ }
18
+ async function a(e, t = {}, n) {
19
+ return window.__TAURI_INTERNALS__.invoke(e, t, n);
20
+ }
21
+ function o() {
22
+ return !!(globalThis || window).isTauri;
23
+ }
24
+ //#endregion
25
+ export { t as i, a as n, o as r, n as t };
26
+
27
+ //# sourceMappingURL=core-NNJn692v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-NNJn692v.js","names":[],"sources":["../../../node_modules/.pnpm/@tauri-apps+api@2.11.0/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js","../../../node_modules/.pnpm/@tauri-apps+api@2.11.0/node_modules/@tauri-apps/api/core.js"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nexport { __classPrivateFieldGet, __classPrivateFieldSet };\n","import { __classPrivateFieldSet, __classPrivateFieldGet } from './external/tslib/tslib.es6.js';\n\n// Copyright 2019-2024 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-License-Identifier: MIT\nvar _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid;\n/**\n * Invoke your custom commands.\n *\n * This package is also accessible with `window.__TAURI__.core` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`.\n * @module\n */\n/**\n * A key to be used to implement a special function\n * on your types that define how your type should be serialized\n * when passing across the IPC.\n * @example\n * Given a type in Rust that looks like this\n * ```rs\n * #[derive(serde::Serialize, serde::Deserialize)\n * enum UserId {\n * String(String),\n * Number(u32),\n * }\n * ```\n * `UserId::String(\"id\")` would be serialized into `{ String: \"id\" }`\n * and so we need to pass the same structure back to Rust\n * ```ts\n * import { SERIALIZE_TO_IPC_FN } from \"@tauri-apps/api/core\"\n *\n * class UserIdString {\n * id\n * constructor(id) {\n * this.id = id\n * }\n *\n * [SERIALIZE_TO_IPC_FN]() {\n * return { String: this.id }\n * }\n * }\n *\n * class UserIdNumber {\n * id\n * constructor(id) {\n * this.id = id\n * }\n *\n * [SERIALIZE_TO_IPC_FN]() {\n * return { Number: this.id }\n * }\n * }\n *\n * type UserId = UserIdString | UserIdNumber\n * ```\n *\n */\n// if this value changes, make sure to update it in:\n// 1. ipc.js\n// 2. process-ipc-message-fn.js\nconst SERIALIZE_TO_IPC_FN = '__TAURI_TO_IPC_KEY__';\n/**\n * Stores the callback in a known location, and returns an identifier that can be passed to the backend.\n * The backend uses the identifier to `eval()` the callback.\n *\n * @return An unique identifier associated with the callback function.\n *\n * @since 1.0.0\n */\nfunction transformCallback(\n// TODO: Make this not optional in v3\ncallback, once = false) {\n return window.__TAURI_INTERNALS__.transformCallback(callback, once);\n}\nclass Channel {\n constructor(onmessage) {\n _Channel_onmessage.set(this, void 0);\n // the index is used as a mechanism to preserve message order\n _Channel_nextMessageIndex.set(this, 0);\n _Channel_pendingMessages.set(this, []);\n _Channel_messageEndIndex.set(this, void 0);\n __classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => { }), \"f\");\n this.id = transformCallback((rawMessage) => {\n const index = rawMessage.index;\n if ('end' in rawMessage) {\n if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\")) {\n this.cleanupCallback();\n }\n else {\n __classPrivateFieldSet(this, _Channel_messageEndIndex, index, \"f\");\n }\n return;\n }\n const message = rawMessage.message;\n // Process the message if we're at the right order\n if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\")) {\n __classPrivateFieldGet(this, _Channel_onmessage, \"f\").call(this, message);\n __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\") + 1, \"f\");\n // process pending messages\n while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\") in __classPrivateFieldGet(this, _Channel_pendingMessages, \"f\")) {\n const message = __classPrivateFieldGet(this, _Channel_pendingMessages, \"f\")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\")];\n __classPrivateFieldGet(this, _Channel_onmessage, \"f\").call(this, message);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n delete __classPrivateFieldGet(this, _Channel_pendingMessages, \"f\")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\")];\n __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\") + 1, \"f\");\n }\n if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, \"f\") === __classPrivateFieldGet(this, _Channel_messageEndIndex, \"f\")) {\n this.cleanupCallback();\n }\n }\n // Queue the message if we're not\n else {\n // eslint-disable-next-line security/detect-object-injection\n __classPrivateFieldGet(this, _Channel_pendingMessages, \"f\")[index] = message;\n }\n });\n }\n cleanupCallback() {\n window.__TAURI_INTERNALS__.unregisterCallback(this.id);\n }\n set onmessage(handler) {\n __classPrivateFieldSet(this, _Channel_onmessage, handler, \"f\");\n }\n get onmessage() {\n return __classPrivateFieldGet(this, _Channel_onmessage, \"f\");\n }\n [(_Channel_onmessage = new WeakMap(), _Channel_nextMessageIndex = new WeakMap(), _Channel_pendingMessages = new WeakMap(), _Channel_messageEndIndex = new WeakMap(), SERIALIZE_TO_IPC_FN)]() {\n return `__CHANNEL__:${this.id}`;\n }\n toJSON() {\n // eslint-disable-next-line security/detect-object-injection\n return this[SERIALIZE_TO_IPC_FN]();\n }\n}\nclass PluginListener {\n constructor(plugin, event, channelId) {\n this.plugin = plugin;\n this.event = event;\n this.channelId = channelId;\n }\n async unregister() {\n return invoke(`plugin:${this.plugin}|remove_listener`, {\n event: this.event,\n channelId: this.channelId\n });\n }\n}\n/**\n * Adds a listener to a plugin event.\n *\n * @returns The listener object to stop listening to the events.\n *\n * @since 2.0.0\n */\nasync function addPluginListener(plugin, event, cb) {\n const handler = new Channel(cb);\n try {\n await invoke(`plugin:${plugin}|register_listener`, {\n event,\n handler\n });\n return new PluginListener(plugin, event, handler.id);\n }\n catch {\n // TODO(v3): remove this fallback\n // note: we must try with camelCase here for backwards compatibility\n await invoke(`plugin:${plugin}|registerListener`, { event, handler });\n return new PluginListener(plugin, event, handler.id);\n }\n}\n/**\n * Get permission state for a plugin.\n *\n * This should be used by plugin authors to wrap their actual implementation.\n */\nasync function checkPermissions(plugin) {\n return invoke(`plugin:${plugin}|check_permissions`);\n}\n/**\n * Request permissions.\n *\n * This should be used by plugin authors to wrap their actual implementation.\n */\nasync function requestPermissions(plugin) {\n return invoke(`plugin:${plugin}|request_permissions`);\n}\n/**\n * Sends a message to the backend.\n * @example\n * ```typescript\n * import { invoke } from '@tauri-apps/api/core';\n * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n * ```\n *\n * @param cmd The command name.\n * @param args The optional arguments to pass to the command.\n * @param options The request options.\n * @return A promise resolving or rejecting to the backend response.\n *\n * @since 1.0.0\n */\nasync function invoke(cmd, args = {}, options) {\n return window.__TAURI_INTERNALS__.invoke(cmd, args, options);\n}\n/**\n * Convert a device file path to an URL that can be loaded by the webview.\n * Note that `asset:` and `http://asset.localhost` must be added to [`app.security.csp`](https://v2.tauri.app/reference/config/#csp-1) in `tauri.conf.json`.\n * Example CSP value: `\"csp\": \"default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost\"` to use the asset protocol on image sources.\n *\n * Additionally, `\"enable\" : \"true\"` must be added to [`app.security.assetProtocol`](https://v2.tauri.app/reference/config/#assetprotocolconfig)\n * in `tauri.conf.json` and its access scope must be defined on the `scope` array on the same `assetProtocol` object.\n *\n * @param filePath The file path.\n * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol.\n * @example\n * ```typescript\n * import { appDataDir, join } from '@tauri-apps/api/path';\n * import { convertFileSrc } from '@tauri-apps/api/core';\n * const appDataDirPath = await appDataDir();\n * const filePath = await join(appDataDirPath, 'assets/video.mp4');\n * const assetUrl = convertFileSrc(filePath);\n *\n * const video = document.getElementById('my-video');\n * const source = document.createElement('source');\n * source.type = 'video/mp4';\n * source.src = assetUrl;\n * video.appendChild(source);\n * video.load();\n * ```\n *\n * @return the URL that can be used as source on the webview.\n *\n * @since 1.0.0\n */\nfunction convertFileSrc(filePath, protocol = 'asset') {\n return window.__TAURI_INTERNALS__.convertFileSrc(filePath, protocol);\n}\n/**\n * A rust-backed resource stored through `tauri::Manager::resources_table` API.\n *\n * The resource lives in the main process and does not exist\n * in the Javascript world, and thus will not be cleaned up automatically\n * except on application exit. If you want to clean it up early, call {@linkcode Resource.close}\n *\n * @example\n * ```typescript\n * import { Resource, invoke } from '@tauri-apps/api/core';\n * export class DatabaseHandle extends Resource {\n * static async open(path: string): Promise<DatabaseHandle> {\n * const rid: number = await invoke('open_db', { path });\n * return new DatabaseHandle(rid);\n * }\n *\n * async execute(sql: string): Promise<void> {\n * await invoke('execute_sql', { rid: this.rid, sql });\n * }\n * }\n * ```\n */\nclass Resource {\n get rid() {\n return __classPrivateFieldGet(this, _Resource_rid, \"f\");\n }\n constructor(rid) {\n _Resource_rid.set(this, void 0);\n __classPrivateFieldSet(this, _Resource_rid, rid, \"f\");\n }\n /**\n * Destroys and cleans up this resource from memory.\n * **You should not call any method on this object anymore and should drop any reference to it.**\n */\n async close() {\n return invoke('plugin:resources|close', {\n rid: this.rid\n });\n }\n}\n_Resource_rid = new WeakMap();\nfunction isTauri() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n return !!(globalThis || window).isTauri;\n}\n\nexport { Channel, PluginListener, Resource, SERIALIZE_TO_IPC_FN, addPluginListener, checkPermissions, convertFileSrc, invoke, isTauri, requestPermissions, transformCallback };\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;IC2DM,IAAsB;AAS5B,SAAS,EAET,GAAU,IAAO,IAAO;CACpB,OAAO,OAAO,oBAAoB,kBAAkB,GAAU,CAAI;AACtE;AAgIA,eAAe,EAAO,GAAK,IAAO,CAAC,GAAG,GAAS;CAC3C,OAAO,OAAO,oBAAoB,OAAO,GAAK,GAAM,CAAO;AAC/D;AA2EA,SAAS,IAAU;CAEf,OAAO,CAAC,EAAE,cAAc,OAAA,CAAQ;AACpC"}
@@ -0,0 +1,12 @@
1
+ import { n as e } from "./core-NNJn692v.js";
2
+ //#region ../../node_modules/.pnpm/@tauri-apps+plugin-shell@2.3.5/node_modules/@tauri-apps/plugin-shell/dist-js/index.js
3
+ async function t(t, n) {
4
+ await e("plugin:shell|open", {
5
+ path: t,
6
+ with: n
7
+ });
8
+ }
9
+ //#endregion
10
+ export { t as open };
11
+
12
+ //# sourceMappingURL=dist-js-X_dgLCzM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-js-X_dgLCzM.js","names":[],"sources":["../../../node_modules/.pnpm/@tauri-apps+plugin-shell@2.3.5/node_modules/@tauri-apps/plugin-shell/dist-js/index.js"],"sourcesContent":["import { invoke, Channel } from '@tauri-apps/api/core';\n\n// Copyright 2019-2023 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-License-Identifier: MIT\n/**\n * Access the system shell.\n * Allows you to spawn child processes and manage files and URLs using their default application.\n *\n * ## Security\n *\n * This API has a scope configuration that forces you to restrict the programs and arguments that can be used.\n *\n * ### Restricting access to the {@link open | `open`} API\n *\n * On the configuration object, `open: true` means that the {@link open} API can be used with any URL,\n * as the argument is validated with the `^((mailto:\\w+)|(tel:\\w+)|(https?://\\w+)).+` regex.\n * You can change that regex by changing the boolean value to a string, e.g. `open: ^https://github.com/`.\n *\n * ### Restricting access to the {@link Command | `Command`} APIs\n *\n * The plugin permissions object has a `scope` field that defines an array of CLIs that can be used.\n * Each CLI is a configuration object `{ name: string, cmd: string, sidecar?: bool, args?: boolean | Arg[] }`.\n *\n * - `name`: the unique identifier of the command, passed to the {@link Command.create | Command.create function}.\n * If it's a sidecar, this must be the value defined on `tauri.conf.json > bundle > externalBin`.\n * - `cmd`: the program that is executed on this configuration. If it's a sidecar, this value is ignored.\n * - `sidecar`: whether the object configures a sidecar or a system program.\n * - `args`: the arguments that can be passed to the program. By default no arguments are allowed.\n * - `true` means that any argument list is allowed.\n * - `false` means that no arguments are allowed.\n * - otherwise an array can be configured. Each item is either a string representing the fixed argument value\n * or a `{ validator: string }` that defines a regex validating the argument value.\n *\n * #### Example scope configuration\n *\n * CLI: `git commit -m \"the commit message\"`\n *\n * Capability:\n * ```json\n * {\n * \"permissions\": [\n * {\n * \"identifier\": \"shell:allow-execute\",\n * \"allow\": [\n * {\n * \"name\": \"run-git-commit\",\n * \"cmd\": \"git\",\n * \"args\": [\"commit\", \"-m\", { \"validator\": \"\\\\S+\" }]\n * }\n * ]\n * }\n * ]\n * }\n * ```\n * Usage:\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell'\n * Command.create('run-git-commit', ['commit', '-m', 'the commit message'])\n * ```\n *\n * Trying to execute any API with a program not configured on the scope results in a promise rejection due to denied access.\n *\n * @module\n */\n/**\n * @since 2.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nclass EventEmitter {\n constructor() {\n /** @ignore */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n this.eventListeners = Object.create(null);\n }\n /**\n * Alias for `emitter.on(eventName, listener)`.\n *\n * @since 2.0.0\n */\n addListener(eventName, listener) {\n return this.on(eventName, listener);\n }\n /**\n * Alias for `emitter.off(eventName, listener)`.\n *\n * @since 2.0.0\n */\n removeListener(eventName, listener) {\n return this.off(eventName, listener);\n }\n /**\n * Adds the `listener` function to the end of the listeners array for the\n * event named `eventName`. No checks are made to see if the `listener` has\n * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple\n * times.\n *\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n on(eventName, listener) {\n if (eventName in this.eventListeners) {\n // eslint-disable-next-line security/detect-object-injection\n this.eventListeners[eventName].push(listener);\n }\n else {\n // eslint-disable-next-line security/detect-object-injection\n this.eventListeners[eventName] = [listener];\n }\n return this;\n }\n /**\n * Adds a **one-time**`listener` function for the event named `eventName`. The\n * next time `eventName` is triggered, this listener is removed and then invoked.\n *\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n once(eventName, listener) {\n const wrapper = (arg) => {\n this.removeListener(eventName, wrapper);\n listener(arg);\n };\n return this.addListener(eventName, wrapper);\n }\n /**\n * Removes the all specified listener from the listener array for the event eventName\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n off(eventName, listener) {\n if (eventName in this.eventListeners) {\n // eslint-disable-next-line security/detect-object-injection\n this.eventListeners[eventName] = this.eventListeners[eventName].filter((l) => l !== listener);\n }\n return this;\n }\n /**\n * Removes all listeners, or those of the specified eventName.\n *\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n removeAllListeners(event) {\n if (event) {\n // eslint-disable-next-line security/detect-object-injection\n delete this.eventListeners[event];\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.eventListeners = Object.create(null);\n }\n return this;\n }\n /**\n * @ignore\n * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments\n * to each.\n *\n * @returns `true` if the event had listeners, `false` otherwise.\n *\n * @since 2.0.0\n */\n emit(eventName, arg) {\n if (eventName in this.eventListeners) {\n // eslint-disable-next-line security/detect-object-injection\n const listeners = this.eventListeners[eventName];\n for (const listener of listeners)\n listener(arg);\n return true;\n }\n return false;\n }\n /**\n * Returns the number of listeners listening to the event named `eventName`.\n *\n * @since 2.0.0\n */\n listenerCount(eventName) {\n if (eventName in this.eventListeners)\n // eslint-disable-next-line security/detect-object-injection\n return this.eventListeners[eventName].length;\n return 0;\n }\n /**\n * Adds the `listener` function to the _beginning_ of the listeners array for the\n * event named `eventName`. No checks are made to see if the `listener` has\n * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple\n * times.\n *\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n prependListener(eventName, listener) {\n if (eventName in this.eventListeners) {\n // eslint-disable-next-line security/detect-object-injection\n this.eventListeners[eventName].unshift(listener);\n }\n else {\n // eslint-disable-next-line security/detect-object-injection\n this.eventListeners[eventName] = [listener];\n }\n return this;\n }\n /**\n * Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this\n * listener is removed, and then invoked.\n *\n * Returns a reference to the `EventEmitter`, so that calls can be chained.\n *\n * @since 2.0.0\n */\n prependOnceListener(eventName, listener) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const wrapper = (arg) => {\n this.removeListener(eventName, wrapper);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n listener(arg);\n };\n return this.prependListener(eventName, wrapper);\n }\n}\n/**\n * @since 2.0.0\n */\nclass Child {\n constructor(pid) {\n this.pid = pid;\n }\n /**\n * Writes `data` to the `stdin`.\n *\n * @param data The message to write, either a string or a byte array.\n * @example\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell';\n * const command = Command.create('node');\n * const child = await command.spawn();\n * await child.write('message');\n * await child.write([0, 1, 2, 3, 4, 5]);\n * ```\n *\n * @returns A promise indicating the success or failure of the operation.\n *\n * @since 2.0.0\n */\n async write(data) {\n await invoke('plugin:shell|stdin_write', {\n pid: this.pid,\n buffer: data\n });\n }\n /**\n * Kills the child process.\n *\n * @returns A promise indicating the success or failure of the operation.\n *\n * @since 2.0.0\n */\n async kill() {\n await invoke('plugin:shell|kill', {\n cmd: 'killChild',\n pid: this.pid\n });\n }\n}\n/**\n * The entry point for spawning child processes.\n * It emits the `close` and `error` events.\n * @example\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell';\n * const command = Command.create('node');\n * command.on('close', data => {\n * console.log(`command finished with code ${data.code} and signal ${data.signal}`)\n * });\n * command.on('error', error => console.error(`command error: \"${error}\"`));\n * command.stdout.on('data', line => console.log(`command stdout: \"${line}\"`));\n * command.stderr.on('data', line => console.log(`command stderr: \"${line}\"`));\n *\n * const child = await command.spawn();\n * console.log('pid:', child.pid);\n * ```\n *\n * @since 2.0.0\n *\n */\nclass Command extends EventEmitter {\n /**\n * @ignore\n * Creates a new `Command` instance.\n *\n * @param program The program name to execute.\n * It must be configured in your project's capabilities.\n * @param args Program arguments.\n * @param options Spawn options.\n */\n constructor(program, args = [], options) {\n super();\n /** Event emitter for the `stdout`. Emits the `data` event. */\n this.stdout = new EventEmitter();\n /** Event emitter for the `stderr`. Emits the `data` event. */\n this.stderr = new EventEmitter();\n this.program = program;\n this.args = typeof args === 'string' ? [args] : args;\n this.options = options ?? {};\n }\n /**\n * Creates a command to execute the given program.\n * @example\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell';\n * const command = Command.create('my-app', ['run', 'tauri']);\n * const output = await command.execute();\n * ```\n *\n * @param program The program to execute.\n * It must be configured in your project's capabilities.\n */\n static create(program, args = [], options) {\n return new Command(program, args, options);\n }\n /**\n * Creates a command to execute the given sidecar program.\n * @example\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell';\n * const command = Command.sidecar('my-sidecar');\n * const output = await command.execute();\n * ```\n *\n * @param program The program to execute.\n * It must be configured in your project's capabilities.\n */\n static sidecar(program, args = [], options) {\n const instance = new Command(program, args, options);\n instance.options.sidecar = true;\n return instance;\n }\n /**\n * Executes the command as a child process, returning a handle to it.\n *\n * @returns A promise resolving to the child process handle.\n *\n * @since 2.0.0\n */\n async spawn() {\n const program = this.program;\n const args = this.args;\n const options = this.options;\n if (typeof args === 'object') {\n Object.freeze(args);\n }\n const onEvent = new Channel();\n onEvent.onmessage = (event) => {\n switch (event.event) {\n case 'Error':\n this.emit('error', event.payload);\n break;\n case 'Terminated':\n this.emit('close', event.payload);\n break;\n case 'Stdout':\n this.stdout.emit('data', event.payload);\n break;\n case 'Stderr':\n this.stderr.emit('data', event.payload);\n break;\n }\n };\n return await invoke('plugin:shell|spawn', {\n program,\n args,\n options,\n onEvent\n }).then((pid) => new Child(pid));\n }\n /**\n * Executes the command as a child process, waiting for it to finish and collecting all of its output.\n * @example\n * ```typescript\n * import { Command } from '@tauri-apps/plugin-shell';\n * const output = await Command.create('echo', 'message').execute();\n * assert(output.code === 0);\n * assert(output.signal === null);\n * assert(output.stdout === 'message');\n * assert(output.stderr === '');\n * ```\n *\n * @returns A promise resolving to the child process output.\n *\n * @since 2.0.0\n */\n async execute() {\n const program = this.program;\n const args = this.args;\n const options = this.options;\n if (typeof args === 'object') {\n Object.freeze(args);\n }\n return await invoke('plugin:shell|execute', {\n program,\n args,\n options\n });\n }\n}\n/**\n * Opens a path or URL with the system's default app,\n * or the one specified with `openWith`.\n *\n * The `openWith` value must be one of `firefox`, `google chrome`, `chromium` `safari`,\n * `open`, `start`, `xdg-open`, `gio`, `gnome-open`, `kde-open` or `wslview`.\n *\n * @example\n * ```typescript\n * import { open } from '@tauri-apps/plugin-shell';\n * // opens the given URL on the default browser:\n * await open('https://github.com/tauri-apps/tauri');\n * // opens the given URL using `firefox`:\n * await open('https://github.com/tauri-apps/tauri', 'firefox');\n * // opens a file using the default program:\n * await open('/path/to/file');\n * ```\n *\n * @param path The path or URL to open.\n * This value is matched against the string regex defined on `tauri.conf.json > plugins > shell > open`,\n * which defaults to `^((mailto:\\w+)|(tel:\\w+)|(https?://\\w+)).+`.\n * @param openWith The app to open the file or URL with.\n * Defaults to the system default application for the specified path type.\n *\n * @since 2.0.0\n */\nasync function open(path, openWith) {\n await invoke('plugin:shell|open', {\n path,\n with: openWith\n });\n}\n\nexport { Child, Command, EventEmitter, open };\n"],"x_google_ignoreList":[0],"mappings":";;AAsbA,eAAe,EAAK,GAAM,GAAU;CAChC,MAAM,EAAO,qBAAqB;EAC9B;EACA,MAAM;CACV,CAAC;AACL"}