5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-07 04:40:05 +08:00
wails/v3/examples/notifications/frontend/dist/assets/index-CS0sRFez.js
2025-02-22 19:05:00 -08:00

7 lines
12 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();let L="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",O=(t=21)=>{let e="",n=t|0;for(;n--;)e+=L[Math.random()*64|0];return e};const _=window.location.origin+"/wails/runtime",h={Call:0,Events:3,ContextMenu:4,Dialog:5,Window:6,Browser:9,CancelCall:10};let k=O();function w(t,e){return function(n,o=null){return W(t,n,e,o)}}async function W(t,e,n,o){let r=new URL(_);t!=null&&r.searchParams.append("object",t),e!=null&&r.searchParams.append("method",e);let s={headers:{}};n&&(s.headers["x-wails-window-name"]=n),o&&r.searchParams.append("args",JSON.stringify(o)),s.headers["x-wails-client-id"]=k;let l=await fetch(r,s);if(!l.ok)throw new Error(await l.text());return l.headers.get("Content-Type")&&l.headers.get("Content-Type").indexOf("application/json")!==-1?l.json():l.text()}const P=(()=>{var t,e,n;try{if((t=window==null?void 0:window.chrome)!=null&&t.webview)return o=>window.chrome.webview.postMessage(o);if((n=(e=window==null?void 0:window.webkit)==null?void 0:e.messageHandlers)!=null&&n.external)return o=>window.webkit.messageHandlers.external.postMessage(o)}catch{console.warn(`
%c⚠ Browser Environment Detected %c
%cOnly UI previews are available in the browser. For full functionality, please run the application in desktop mode.
More information at: https://v3.wails.io/learn/build/#using-a-browser-for-development
`,"background: #ffffff; color: #000000; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 2px solid #000000;","background: transparent;","color: #ffffff; font-style: italic; font-weight: bold;")}return null})();function E(t){if(P)return P(t)}function H(){return window._wails.environment.OS==="windows"}function B(){return window._wails.environment.Debug===!0}window.addEventListener("contextmenu",Y);const U=w(h.ContextMenu,""),$=0;function Z(t,e,n,o){U($,{id:t,x:e,y:n,data:o})}function Y(t){let e=t.target,n=window.getComputedStyle(e).getPropertyValue("--custom-contextmenu");if(n=n?n.trim():"",n){t.preventDefault();let o=window.getComputedStyle(e).getPropertyValue("--custom-contextmenu-data");Z(n,t.clientX,t.clientY,o);return}j(t)}function j(t){if(B())return;const e=t.target;switch(window.getComputedStyle(e).getPropertyValue("--default-contextmenu").trim()){case"show":return;case"hide":t.preventDefault();return;default:if(e.isContentEditable)return;const r=window.getSelection(),s=r.toString().length>0;if(s)for(let l=0;l<r.rangeCount;l++){const c=r.getRangeAt(l).getClientRects();for(let m=0;m<c.length;m++){const M=c[m];if(document.elementFromPoint(M.left,M.top)===e)return}}if((e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&(s||!e.readOnly&&!e.disabled))return;t.preventDefault()}}function x(t){try{return window._wails.flags[t]}catch(e){throw new Error("Unable to retrieve flag '"+t+"': "+e)}}let p=!1,z=!1,S=null,G="auto";window._wails=window._wails||{};window._wails.setResizable=function(t){z=t};window._wails.endDrag=function(){document.body.style.cursor="default",p=!1};window.addEventListener("mousedown",X);window.addEventListener("mousemove",q);window.addEventListener("mouseup",V);function J(t){let e=window.getComputedStyle(t.target).getPropertyValue("--wails-draggable"),n=t.buttons!==void 0?t.buttons:t.which;return!e||e===""||e.trim()!=="drag"||n===0?!1:t.detail===1}function X(t){if(S){E("wails:resize:"+S),t.preventDefault();return}if(J(t)){if(t.offsetX>t.target.clientWidth||t.offsetY>t.target.clientHeight)return;p=!0}else p=!1}function V(){p=!1}function u(t){document.documentElement.style.cursor=t||G,S=t}function q(t){if(p&&(p=!1,(t.buttons!==void 0?t.buttons:t.which)>0)){E("wails:drag");return}if(!z||!H())return;let e=x("system.resizeHandleHeight")||5,n=x("system.resizeHandleWidth")||5,o=x("resizeCornerExtra")||10,r=window.outerWidth-t.clientX<n,s=t.clientX<n,l=t.clientY<e,a=window.outerHeight-t.clientY<e,c=window.outerWidth-t.clientX<n+o,m=t.clientX<n+o,M=t.clientY<e+o,T=window.outerHeight-t.clientY<e+o;!s&&!r&&!l&&!a&&S!==void 0?u():c&&T?u("se-resize"):m&&T?u("sw-resize"):m&&M?u("nw-resize"):M&&c?u("ne-resize"):s?u("w-resize"):l?u("n-resize"):a?u("s-resize"):r&&u("e-resize")}const K=w(h.Browser,""),Q=0;function ee(t){return K(Q,{url:t})}window._wails=window._wails||{};window._wails.callResultHandler=ie;window._wails.callErrorHandler=se;const te=0,ne=w(h.Call,""),oe=w(h.CancelCall,"");let y=new Map;function re(){let t;do t=O();while(y.has(t));return t}function ie(t,e,n){const o=D(t);if(o)if(!e)o.resolve();else if(!n)o.resolve(e);else try{o.resolve(JSON.parse(e))}catch(r){o.reject(new TypeError("could not parse result: "+r.message,{cause:r}))}}function se(t,e,n){const o=D(t);if(o)if(!n)o.reject(new Error(e));else{let r;try{r=JSON.parse(e)}catch(a){o.reject(new TypeError("could not parse error: "+a.message,{cause:a}));return}let s={};r.cause&&(s.cause=r.cause);let l;switch(r.kind){case"ReferenceError":l=new ReferenceError(r.message,s);break;case"TypeError":l=new TypeError(r.message,s);break;case"RuntimeError":l=new le(r.message,s);break;default:l=new Error(r.message,s);break}o.reject(l)}}function D(t){const e=y.get(t);return y.delete(t),e}class le extends Error{constructor(e,...n){super(e,...n),this.name="RuntimeError"}}function ae(t){const e=re(),n=()=>oe(type,{"call-id":e});let o=!1,r=!1,s=new Promise((l,a)=>{t["call-id"]=e,y.set(e,{resolve:l,reject:a}),ne(te,t).then(c=>{if(r=!0,o)return n()}).catch(c=>{a(c),y.delete(e)})});return s.cancel=()=>{if(r)return n();o=!0},s}function R(t,...e){return ae({methodID:t,args:e})}window._wails=window._wails||{};window._wails.dialogErrorCallback=we;window._wails.dialogResultCallback=he;const ce=2,ue=3,de=w(h.Dialog,""),f=new Map;function fe(){let t;do t=O();while(f.has(t));return t}function I(t,e={}){const n=fe();return e["dialog-id"]=n,new Promise((o,r)=>{f.set(n,{resolve:o,reject:r}),de(t,e).catch(s=>{r(s),f.delete(n)})})}function he(t,e,n){let o=f.get(t);o&&(f.delete(t),n?o.resolve(JSON.parse(e)):o.resolve(e))}function we(t,e){let n=f.get(t);n&&(f.delete(t),n.reject(new me(e)))}const me=t=>I(ce,t),ge=t=>I(ue,t);window._wails=window._wails||{};window._wails.dispatchWailsEvent=Ce;const pe=w(h.Events,""),Me=0,d=new Map;class be{constructor(e,n,o){this.eventName=e,this.maxCallbacks=o||-1,this.Callback=r=>(n(r),this.maxCallbacks===-1?!1:(this.maxCallbacks-=1,this.maxCallbacks===0))}}class ye{constructor(e,n=null){this.name=e,this.data=n}}function Ce(t){let e=d.get(t.name);if(e){let n=e.filter(o=>{if(o.Callback(t))return!0});n.length>0&&(e=e.filter(o=>!n.includes(o)),e.length===0?d.delete(t.name):d.set(t.name,e))}}function Ee(t,e,n){let o=d.get(t)||[];const r=new be(t,e,n);return o.push(r),d.set(t,o),()=>Se(r)}function N(t,e){return Ee(t,e,-1)}function Se(t){const e=t.eventName;let n=d.get(e).filter(o=>o!==t);n.length===0?d.delete(e):d.set(e,n)}function ve(t){return pe(Me,t)}const Re=0,xe=1,Oe=2,Te=3,Pe=4,ze=5,De=6,Ie=7,Ne=8,Ae=9,Fe=10,Le=11,_e=12,ke=13,We=14,He=15,Be=16,Ue=17,$e=18,Ze=19,Ye=20,je=21,Ge=22,Je=23,Xe=24,Ve=25,qe=26,Ke=27,Qe=28,et=29,tt=30,nt=31,ot=32,rt=33,it=34,st=35,lt=36,at=37,ct=38,ut=39,dt=40,ft=41,ht=42,wt=43,mt=44,gt=45,pt=46,Mt=47,i=Symbol();class v{constructor(e=""){this[i]=w(h.Window,e);for(const n of Object.getOwnPropertyNames(v.prototype))n!=="constructor"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}Get(e){return new v(e)}Position(){return this[i](Re)}Center(){return this[i](xe)}Close(){return this[i](Oe)}DisableSizeConstraints(){return this[i](Te)}EnableSizeConstraints(){return this[i](Pe)}Focus(){return this[i](ze)}ForceReload(){return this[i](De)}Fullscreen(){return this[i](Ie)}GetScreen(){return this[i](Ne)}GetZoom(){return this[i](Ae)}Height(){return this[i](Fe)}Hide(){return this[i](Le)}IsFocused(){return this[i](_e)}IsFullscreen(){return this[i](ke)}IsMaximised(){return this[i](We)}IsMinimised(){return this[i](He)}Maximise(){return this[i](Be)}Minimise(){return this[i](Ue)}Name(){return this[i]($e)}OpenDevTools(){return this[i](Ze)}RelativePosition(){return this[i](Ye)}Reload(){return this[i](je)}Resizable(){return this[i](Ge)}Restore(){return this[i](Je)}SetPosition(e,n){return this[i](Xe,{x:e,y:n})}SetAlwaysOnTop(e){return this[i](Ve,{alwaysOnTop:e})}SetBackgroundColour(e,n,o,r){return this[i](qe,{r:e,g:n,b:o,a:r})}SetFrameless(e){return this[i](Ke,{frameless:e})}SetFullscreenButtonEnabled(e){return this[i](Qe,{enabled:e})}SetMaxSize(e,n){return this[i](et,{width:e,height:n})}SetMinSize(e,n){return this[i](tt,{width:e,height:n})}SetRelativePosition(e,n){return this[i](nt,{x:e,y:n})}SetResizable(e){return this[i](ot,{resizable:e})}SetSize(e,n){return this[i](rt,{width:e,height:n})}SetTitle(e){return this[i](it,{title:e})}SetZoom(e){return this[i](st,{zoom:e})}Show(){return this[i](lt)}Size(){return this[i](at)}ToggleFullscreen(){return this[i](ct)}ToggleMaximise(){return this[i](ut)}UnFullscreen(){return this[i](dt)}UnMaximise(){return this[i](ft)}UnMinimise(){return this[i](ht)}Width(){return this[i](wt)}Zoom(){return this[i](mt)}ZoomIn(){return this[i](gt)}ZoomOut(){return this[i](pt)}ZoomReset(){return this[i](Mt)}}const bt=new v("");function yt(){if(!EventTarget||!AbortSignal||!AbortController)return!1;let t=!0;const e=new EventTarget,n=new AbortController;return e.addEventListener("test",()=>{t=!1},{signal:n.signal}),n.abort(),e.dispatchEvent(new CustomEvent("test")),t}document.addEventListener("DOMContentLoaded",()=>!0);function Ct(t,e=null){ve(new ye(t,e))}function Et(t,e){const n=bt.Get(t),o=n[e];if(typeof o!="function"){console.error(`Window method '${e}' not found`);return}try{o.call(n)}catch(r){console.error(`Error calling window method '${e}': `,r)}}function St(t){const e=t.currentTarget;function n(r="Yes"){if(r!=="Yes")return;const s=e.getAttribute("data-wml-event"),l=e.getAttribute("data-wml-target-window")||"",a=e.getAttribute("data-wml-window"),c=e.getAttribute("data-wml-openURL");s!==null&&Ct(s),a!==null&&Et(l,a),c!==null&&ee(c)}const o=e.getAttribute("data-wml-confirm");o?ge({Title:"Confirm",Message:o,Detached:!1,Buttons:[{Label:"Yes"},{Label:"No",IsDefault:!0}]}).then(n):n()}const C=Symbol();class vt{constructor(){this[C]=new AbortController}set(e,n){return{signal:this[C].signal}}reset(){this[C].abort(),this[C]=new AbortController}}const b=Symbol(),g=Symbol();class Rt{constructor(){this[b]=new WeakMap,this[g]=0}set(e,n){return this[g]+=!this[b].has(e),this[b].set(e,n),{}}reset(){if(!(this[g]<=0)){for(const e of document.body.querySelectorAll("*")){if(this[g]<=0)break;const n=this[b].get(e);this[g]-=typeof n<"u";for(const o of n||[])e.removeEventListener(o,St)}this[b]=new WeakMap,this[g]=0}}}yt()?new vt:new Rt;window._wails=window._wails||{};let A=!1;function xt(){window._wails.invoke=E,E("wails:runtime:ready"),A=!0}window.addEventListener("load",()=>{A||xt()});function Ot(t){return R(2679064664,t)}function F(){return R(3412125712)}function Tt(t,e,n,o){return R(2246903123,t,e,n,o)}function Pt(t){return R(1615199806,t)}const zt=document.getElementById("time"),Dt=document.getElementById("notifications");window.sendNotification=async()=>{await F()&&await Tt("some-uuid-fronted","Frontend Notificaiton","","Notificaiton sent through JS!")};window.sendComplexNotification=async()=>{await F()&&(await Ot({id:"FRONTEND_NOTIF",actions:[{id:"VIEW_ACTION",title:"View"},{id:"MARK_READ_ACTION",title:"Mark as Read"},{id:"DELETE_ACTION",title:"Delete",destructive:!0}],hasReplyField:!0,replyButtonTitle:"Reply",replyPlaceholder:"Reply to frontend..."}),await Pt({id:"some-uuid-complex",title:"Complex Frontend Notification",subtitle:"From: Jane Doe",body:"Is it rainging today where you are?",categoryId:"FRONTEND_NOTIF",data:{messageId:"msg-456",senderId:"user-456",timestamp:Date.now()}}))};N("time",t=>{zt.innerText=t.data});N("notificationResponse",t=>{Dt.innerText+=JSON.stringify(t.data[0].data)});