You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tauri-plugins-workspace/plugins/camera/dist-js/index.min.js

132 lines
3.3 KiB

var f$1 = Object.defineProperty;
var g = (a, b) => {
for (var c in b) f$1(a, c, {
get: b[c],
enumerable: !0
});
};
var e = (a, b, c) => {
if (!b.has(a)) throw TypeError("Cannot " + c)
};
var h$1 = (a, b, c) => (e(a, b, "read from private field"), c ? c.call(a) : b.get(a)),
i$1 = (a, b, c) => {
if (b.has(a)) throw TypeError("Cannot add the same private member more than once");
b instanceof WeakSet ? b.add(a) : b.set(a, c);
},
j = (a, b, c, d) => (e(a, b, "write to private field"), d ? d.call(a, c) : b.set(a, c), c);
var h = {};
g(h, {
Channel: () => o,
PluginListener: () => a,
addPluginListener: () => m,
convertFileSrc: () => y,
invoke: () => u,
transformCallback: () => s
});
function f() {
return window.crypto.getRandomValues(new Uint32Array(1))[0]
}
function s(n, e = !1) {
let t = f(),
r = `_${t}`;
return Object.defineProperty(window, r, {
value: c => (e && Reflect.deleteProperty(window, r), n ? .(c)),
writable: !1,
configurable: !0
}), t
}
var i, o = class {
constructor() {
this.__TAURI_CHANNEL_MARKER__ = !0;
i$1(this, i, () => {});
this.id = s(e => {
h$1(this, i).call(this, e);
});
}
set onmessage(e) {
j(this, i, e);
}
get onmessage() {
return h$1(this, i)
}
toJSON() {
return `__CHANNEL__:${this.id}`
}
};
i = new WeakMap;
var a = class {
constructor(e, t, r) {
this.plugin = e, this.event = t, this.channelId = r;
}
async unregister() {
return u(`plugin:${this.plugin}|remove_listener`, {
event: this.event,
channelId: this.channelId
})
}
};
async function m(n, e, t) {
let r = new o;
return r.onmessage = t, u(`plugin:${n}|register_listener`, {
event: e,
handler: r
}).then(() => new a(n, e, r.id))
}
async function u(n, e = {}, t) {
return new Promise((r, c) => {
let g = s(d => {
r(d), Reflect.deleteProperty(window, `_${_}`);
}, !0),
_ = s(d => {
c(d), Reflect.deleteProperty(window, `_${g}`);
}, !0);
window.__TAURI_IPC__({
cmd: n,
callback: g,
error: _,
payload: e,
options: t
});
})
}
function y(n, e = "asset") {
return window.__TAURI__.convertFileSrc(n, e)
}
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
var Source;
(function (Source) {
Source["Prompt"] = "PROMPT";
Source["Camera"] = "CAMERA";
Source["Photos"] = "PHOTOS";
})(Source || (Source = {}));
var ResultType;
(function (ResultType) {
ResultType["Uri"] = "uri";
ResultType["Base64"] = "base64";
ResultType["DataUrl"] = "dataUrl";
})(ResultType || (ResultType = {}));
var CameraDirection;
(function (CameraDirection) {
CameraDirection["Rear"] = "REAR";
CameraDirection["Front"] = "FRONT";
})(CameraDirection || (CameraDirection = {}));
async function getPhoto(options) {
return await u("plugin:camera|getPhoto", {
...options
});
}
export {
CameraDirection,
ResultType,
Source,
getPhoto
};
//# sourceMappingURL=index.min.js.map