tauri/examples/api/dist/assets/index.js

10 lines
19 KiB
JavaScript
Raw Normal View History

(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const m of a.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function E(){}function st(e){return e()}function Xe(){return Object.create(null)}function F(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return E;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function s(e,t){e.appendChild(t)}function w(e,t,n){e.insertBefore(t,n||null)}function y(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function d(e){return document.createElement(e)}function Et(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Q(e){return document.createTextNode(e)}function g(){return Q(" ")}function lt(){return Q("")}function q(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=d(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n<this.n.length;n+=1)w(this.t,this.n[n],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(y)}}let de;function ue(e){de=e}function ct(){if(!de)throw new Error("Function called outside component initialization");return de}function xe(e){ct().$$.on_mount.push(e)}function at(e){ct().$$.on_destroy.push(e)}const ce=[],Ne=[],$e=[],Ke=[],St=Promise.resolve();let Ie=!1;function Ot(){Ie||(Ie=!0,St.then(ut))}function We(e){$e.push(e)}const De=new Set;let Ee=0;function ut(){const e=de;do{for(;Ee<ce.length;){const t=ce[Ee];Ee++,ue(t),Tt(t.$$)}for(ue(null),ce.length=0,Ee=0;Ne.length;)Ne.pop()();for(let t=0;t<$e.length;t+=1){const n=$e[t];De.has(n)||(De.add(n),n())}$e.length=0}while(ce.length);for(;Ke.length;)Ke.pop()();Ie=!1,De.clear(),ue(e)}function Tt(e){if(e.fragment!==null){e.update(),F(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(We)}}const Le=new Set;let U;function Ct(){U={r:0,c:[],p:U}}function Dt(){U.r||F(U.c),U=U.p}function Me(e,t){e&&e.i&&(Le.delete(e),e.i(t))}function Je(e,t,n,i){if(e&&e.o){if(Le.has(e))return;Le.add(e),U.c.push(()=>{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Re(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:m,after_update:o}=e.$$;r&&r.m(t,n),i||We(()=>{const f=a.map(st).filter(vt);m?m.push(...f):F(f),e.$$.on_mount=[]}),o.forEach(We)}function Ae(e,t){const n=e.$$;n.fragment!==null&&(F(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Se(e,t,n,i,r,a,m,o=[-1]){const f=de;ue(e);const u=e.$$={fragment:null,ctx:null,props:a,update:E,not_equal:r,bound:Xe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:Xe(),dirty:o,sk
development process. In the future, this app will be used on Tauri&#39;s integration
tests.`,i=g(),r=d("button"),r.textContent="Context menu",c(r,"class","btn")},m(o,f){w(o,t,f),s(t,n),s(t,i),s(t,r),a||(m=q(r,"click",e[0]),a=!0)},p:E,i:E,o:E,d(o){o&&y(t),a=!1,m()}}}function Ut(e){function t(){W("popup_context_menu")}return[t]}class Ft extends Oe{constructor(t){super(),Se(this,t,Ut,qt,he,{})}}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Vt});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await W("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return W("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Vt(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await W("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Bt(e){let t,n,i,r,a,m,o,f;return{c(){t=d("div"),n=d("button"),n.textContent="Call Log API",i=g(),r=d("button"),r.textContent="Call Request (async) API",a=g(),m=d("button"),m.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(m,"class","btn"),c(m,"id","event")},m(u,T){w(u,t,T),s(t,n),s(t,i),s(t,r),s(t,a),s(t,m),o||(f=[q(n,"click",e[0]),q(r,"click",e[1]),q(m,"click",e[2])],o=!0)},p:E,i:E,o:E,d(u){u&&y(t),o=!1,F(f)}}}function Gt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){W("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function m(){W("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function o(){_t("js-event","this is the payload string")}return e.$$set=f=>{"onMessage"in f&&n(3,i=f.onMessage)},[a,m,o,i]}class Xt extends Oe{constructor(t){super(),Se(this,t,Gt,Bt,he,{onMessage:3})}}function Yt(e){let t;return{c(){t=d("div"),t.innerHTML=`<div class="note-red grow">Not available for Linux</div>
<video id="localVideo" autoplay="" playsinline=""><track kind="captions"/></video>`,c(t,"class","flex flex-col gap-2")},m(n,i){w(n,t,i)},p:E,i:E,o:E,d(n){n&&y(t)}}}function Kt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(o){const f=document.querySelector("video"),u=o.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${u[0].label}`),window.stream=o,f.srcObject=o}function m(o){if(o.name==="ConstraintNotSatisfiedError"){const f=r.video;i(`The resolution ${f.width.exact}x${f.height.exact} px is not supported by your device.`)}else o.name==="PermissionDeniedError"&&i("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.");i(`getUserMedia error: ${o.name}`,o)}return xe(async()=>{try{const o=await navigator.mediaDevices.getUserMedia(r);a(o)}catch(o){m(o)}}),at(()=>{window.stream.getTracks().forEach(function(o){o.stop()})}),e.$$set=o=>{"onMessage"in o&&n(0,i=o.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Kt,Yt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[23]=t[n],i}function tt(e,t,n){const i=e.slice();return i[26]=t[n],i}function Qt(e){let t;return{c(){t=d("span"),c(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){w(n,t,i)},d(n){n&&y(t)}}}function Zt(e){let t;return{c(){t=d("span"),c(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){w(n,t,i)},d(n){n&&y(t)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Dark mode
`),n=d("div"),c(n,"class","i-ph-moon")},m(i,r){w(i,t,r),w(i,n,r)},d(i){i&&y(t),i&&y(n)}}}function tn(e){let t,n;return{c(){t=Q(`Switch to Light mode
`),n=d("div"),c(n,"class","i-ph-sun")},m(i,r){w(i,t,r),w(i,n,r)},d(i){i&&y(t),i&&y(n)}}}function nn(e){let t,n,i,r,a=e[26].label+"",m,o,f,u;function T(){return e[14](e[26])}return{c(){t=d("a"),n=d("div"),i=g(),r=d("p"),m=Q(a),c(n,"class",e[26].icon+" mr-2"),c(t,"href","##"),c(t,"class",o="nv "+(e[1]===e[26]?"nv_selected":""))},m(_,S){w(_,t,S),s(t,n),s(t,i),s(t,r),s(r,m),f||(u=q(t,"click",T),f=!0)},p(_,S){e=_,S&2&&o!==(o="nv "+(e[1]===e[26]?"nv_selected":""))&&c(t,"class",o)},d(_){_&&y(t),f=!1,u()}}}function nt(e){let t,n=e[26]&&nn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),w(i,t,r)},p(i,r){i[26]&&n.p(i,r)},d(i){n&&n.d(i),i&&y(t)}}}function it(e){let t,n=e[23].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),w(r,i,a)},p(r,a){a&16&&n!==(n=r[23].html+"")&&t.p(n)},d(r){r&&y(i),r&&t.d()}}}function rn(e){let t,n,i,r,a,m,o,f,u,T,_,S,O,M,Z,R,k,C,z,D,V,ee,me,te,pe,h,b,x,ne,A,P,B,ge=e[1].label+"",Te,He,_e,ie,v,je,I,ve,qe,G,be,Ue,re,Fe,oe,se,Ce,ze;function Ve(l,N){return l[0]?Zt:Qt}let ye=Ve(e),H=ye(e);function Be(l,N){return l[2]?tn:en}let we=Be(e),j=we(e),X=e[5],$=[];for(let l=0;l<X.length;l+=1)$[l]=nt(tt(e,X,l));var Y=e[1].component;function Ge(l){return{props:{onMessage:l[9],insecureRenderHtml:l[10]}}}Y&&(v=new Y(Ge(e)));let K=e[4],L=[];for(let l=0;l<K.length;l+=1)L[l]=it(et(e,K,l));return{c(){t=d("div"),H.c(),n=g(),i=d("div"),r=d("aside"),a=d("img"),o=g(),f=d("a"),j.c(),u=g(),T=d("br"),_=g(),S=d("div"),O=g(),M=d("br"),Z=g(),R=d("a"),R.innerHTML=`Documentation
<span class="i-codicon-link-external"></span>`,k=g(),C=d("a"),C.innerHTML=`GitHub
<span class="i-codicon-link-external"></span>`,z=g(),D=d("a"),D.innerHTML=`Source
<span class="i-codicon-link-external"></span>`,V=g(),ee=d("br"),me=g(),te=d("div"),pe=g(),h=d("br"),b=g(),x=d("div");for(let l=0;l<$.length;l+=1)$[l].c();ne=g(),A=d("main"),P=d("div"),B=d("h1"),Te=Q(ge),He=g(),_e=d("div"),ie=d("div"),v&&Qe(v.$$.fragment),je=g(),I=d("div"),ve=d("div"),qe=g(),G=d("div"),be=d("p"),be.textContent="Console",Ue=g(),re=d("div"),re.innerHTML='<div class="i-codicon-clear-all"></div>',Fe=g(),oe=d("div");for(let l=0;l<L.length;l+=1)L[l].c();c(t,"id","sidebarToggle"),c(t,"class","z-2000 display-none lt-sm:flex justify-center items-center absolute top-2 left-2 w-8 h-8 rd-8 bg-accent dark:bg-darkAccent active:bg-accentDark dark:active:bg-darkAccentDark"),c(a,"class","self-center p-7 cursor-pointer"),bt(a.src,m="tauri_logo.png")||c(a,"src",m),c(a,"alt","Tauri logo"),c(f,"href","##"),c(f,"class","nv justify-between h-8"),c(S,"class","bg-white/5 h-2px"),c(R,"class","nv justify-between h-8"),c(R,"target","_blank"),c(R,"href","https://tauri.app/v1/guides/"),c(C,"class","nv justify-between h-8"),c(C,"target","_blank"),c(C,"href","https://github.com/tauri-apps/tauri"),c(D,"class","nv justify-between h-8"),c(D,"target","_blank"),c(D,"href","https://github.com/tauri-apps/tauri/tree/dev/examples/api"),c(te,"class","bg-white/5 h-2px"),c(x,"class","flex flex-col overflow-y-auto children-h-10 children-flex-none gap-1"),c(r,"id","sidebar"),c(r,"class","lt-sm:h-screen lt-sm:shadow-lg lt-sm:shadow lt-sm:transition-transform lt-sm:absolute lt-sm:z-1999 bg-darkPrimaryLighter transition-colors-250 overflow-hidden grid grid-rows-[min-content_auto] select-none px-2"),c(ie,"class","mr-2"),c(_e,"class","overflow-y-auto"),c(P,"class","px-5 overflow-hidden grid grid-rows-[auto_1fr]"),c(ve,"class","bg-black/20 h-2px cursor-ns-resize"),c(be,"class","font-semibold"),c(re,"class","cursor-pointer h-85% rd-1 p-1 flex justify-center items-center hover:bg-hoverOverlay dark:hover:bg-darkHoverOverlay active:bg-hoverOverlay/25 dark:active:bg-darkHoverOverlay/25 "),c(G,"class","flex justify-between items-center px-2"),c(oe,"class","px-2 overflow-y-auto all:font-mono code-block all:text-xs"),c(I,"id","console"),c(I,"class","select-none h-15rem grid grid-rows-[2px_2rem_1fr] gap-1 overflow-hidden"),c(A,"class","flex-1 bg-primary dark:bg-darkPrimary transition-transform transition-colors-250 grid grid-rows-[2fr_auto]"),c(i,"class","flex h-screen w-screen overflow-hidden children-pt8 children-pb-2 text-primaryText dark:text-darkPrimaryText")},m(l,N){w(l,t,N),H.m(t,null),w(l,n,N),w(l,i,N),s(i,r),s(r,a),s(r,o),s(r,f),j.m(f,null),s(r,u),s(r,T),s(r,_),s(r,S),s(r,O),s(r,M),s(r,Z),s(r,R),s(r,k),s(r,C),s(r,z),s(r,D),s(r,V),s(r,ee),s(r,me),s(r,te),s(r,pe),s(r,h),s(r,b),s(r,x);for(let p=0;p<$.length;p+=1)$[p].m(x,null);s(i,ne),s(i,A),s(A,P),s(P,B),s(B,Te),s(P,He),s(P,_e),s(_e,ie),v&&Re(v,ie,null),s(A,je),s(A,I),s(I,ve),s(I,qe),s(I,G),s(G,be),s(G,Ue),s(G,re),s(I,Fe),s(I,oe);for(let p=0;p<L.length;p+=1)L[p].m(oe,null);e[15](I),se=!0,Ce||(ze=[q(f,"click",e[7]),q(ve,"mousedown",e[12]),q(re,"click",e[11])],Ce=!0)},p(l,[N]){if(ye!==(ye=Ve(l))&&(H.d(1),H=ye(l),H&&(H.c(),H.m(t,null))),we!==(we=Be(l))&&(j.d(1),j=we(l),j&&(j.c(),j.m(f,null))),N&99){X=l[5];let p;for(p=0;p<X.length;p+=1){const le=tt(l,X,p);$[p]?$[p].p(le,N):($[p]=nt(le),$[p].c(),$[p].m(x,null))}for(;p<$.length;p+=1)$[p].d(1);$.length=X.length}if((!se||N&2)&&ge!==(ge=l[1].label+"")&&Lt(Te,ge),Y!==(Y=l[1].component)){if(v){Ct();const p=v;Je(p.$$.fragment,1,0,()=>{Ae(p,1)}),Dt()}Y?(v=new Y(Ge(l)),Qe(v.$$.fragment),Me(v.$$.fragment,1),Re(v,ie,null)):v=null}if(N&16){K=l[4];let p;for(p=0;p<K.length;p+=1){const le=et(l,K,p);L[p]?L[p].p(le,N):(L[p]=it(le),L[p].c(),L[p].m(oe,null))}for(;p<L.length;p+=1)L[p].d(1);L.length=K.length}},i(l){se||(v&&Me(v.$$.fragment,l),se=!0)},o(l){v&&Je(v.$$.fragment,l),se=!1},d(l){l&&y(t),H.d(),l&&y(n),l&&y(i),j.d(),Ye($,l),v&&Ae(v),Ye(L,l),e[15](null),Ce=!1,F(ze)}}}let rt=50;function ot(e){const t=document.querySelector("html");e?t.classList.add("dark"):t.classList.remove("dark"),localStorage&&localStorage.setItem("theme",e?"dark":"")}function on(e,t){e.style.setProp