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/src/api-iife.js

2 lines
2.1 KiB

if("__TAURI__"in window){var __TAURI_CAMERA__=function(e){"use strict";var t=Object.defineProperty,r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},n=(e,t,n)=>(r(e,t,"read from private field"),n?n.call(e):t.get(e)),i=(e,t,n,i)=>(r(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function a(e,t=!1){let r=window.crypto.getRandomValues(new Uint32Array(1))[0],n=`_${r}`;return Object.defineProperty(window,n,{value:r=>(t&&Reflect.deleteProperty(window,n),e?.(r)),writable:!1,configurable:!0}),r}((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})({},{Channel:()=>s,PluginListener:()=>d,addPluginListener:()=>u,convertFileSrc:()=>w,invoke:()=>h,transformCallback:()=>a});var o,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)})(this,o,(()=>{})),this.id=a((e=>{n(this,o).call(this,e)}))}set onmessage(e){i(this,o,e)}get onmessage(){return n(this,o)}toJSON(){return`__CHANNEL__:${this.id}`}};o=new WeakMap;var l,c,_,d=class{constructor(e,t,r){this.plugin=e,this.event=t,this.channelId=r}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function u(e,t,r){let n=new s;return n.onmessage=r,h(`plugin:${e}|register_listener`,{event:t,handler:n}).then((()=>new d(e,t,n.id)))}async function h(e,t={},r){return new Promise(((n,i)=>{let o=a((e=>{n(e),Reflect.deleteProperty(window,`_${s}`)}),!0),s=a((e=>{i(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:s,payload:t,options:r})}))}function w(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}return e.Source=void 0,(l=e.Source||(e.Source={})).Prompt="PROMPT",l.Camera="CAMERA",l.Photos="PHOTOS",e.ResultType=void 0,(c=e.ResultType||(e.ResultType={})).Uri="uri",c.Base64="base64",c.DataUrl="dataUrl",e.CameraDirection=void 0,(_=e.CameraDirection||(e.CameraDirection={})).Rear="REAR",_.Front="FRONT",e.getPhoto=async function(e){return await h("plugin:camera|getPhoto",{...e})},e}({});Object.defineProperty(window.__TAURI__,"camera",{value:__TAURI_CAMERA__})}