2 lines
7.6 KiB
JavaScript
2 lines
7.6 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1424],{24308:function(e,t,i){"use strict";i.d(t,{c4:function(){return s}});var r=i(4942),n=i(87462),s=["xxl","xl","lg","md","sm","xs"],o={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)"},a=new Map,c=-1,l={};t.ZP={matchHandlers:{},dispatch:function(e){return l=e,a.forEach(function(e){return e(l)}),a.size>=1},subscribe:function(e){return a.size||this.register(),c+=1,a.set(c,e),e(l),c},unsubscribe:function(e){a.delete(e),a.size||this.unregister()},unregister:function(){var e=this;Object.keys(o).forEach(function(t){var i=o[t],r=e.matchHandlers[i];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),a.clear()},register:function(){var e=this;Object.keys(o).forEach(function(t){var i=o[t],s=function(i){var s=i.matches;e.dispatch((0,n.Z)((0,n.Z)({},l),(0,r.Z)({},t,s)))},a=window.matchMedia(i);a.addListener(s),e.matchHandlers[i]={mql:a,listener:s},s(a)})}}},99134:function(e,t,i){"use strict";var r=(0,i(67294).createContext)({});t.Z=r},92820:function(e,t,i){"use strict";var r=i(87462),n=i(4942),s=i(71002),o=i(97685),a=i(94184),c=i.n(a),l=i(67294),u=i(53124),d=i(98082),f=i(24308),h=i(93355),p=i(99134),w=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)0>t.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};function m(e,t){var i=l.useState("string"==typeof e?e:""),r=(0,o.Z)(i,2),n=r[0],a=r[1],c=function(){if("object"===(0,s.Z)(e))for(var i=0;i<f.c4.length;i++){var r=f.c4[i];if(t[r]){var n=e[r];if(void 0!==n){a(n);return}}}};return l.useEffect(function(){c()},[JSON.stringify(e),t]),n}(0,h.b)("top","middle","bottom","stretch"),(0,h.b)("start","end","center","space-around","space-between","space-evenly");var v=l.forwardRef(function(e,t){var i,a,h=e.prefixCls,v=e.justify,b=e.align,x=e.className,y=e.style,g=e.children,Z=e.gutter,j=void 0===Z?0:Z,_=e.wrap,N=w(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),C=l.useContext(u.E_),O=C.getPrefixCls,M=C.direction,S=l.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),B=(0,o.Z)(S,2),E=B[0],P=B[1],k=l.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),L=(0,o.Z)(k,2),A=L[0],R=L[1],T=m(b,A),I=m(v,A),J=(0,d.Z)(),H=l.useRef(j);l.useEffect(function(){var e=f.ZP.subscribe(function(e){R(e);var t=H.current||0;(!Array.isArray(t)&&"object"===(0,s.Z)(t)||Array.isArray(t)&&("object"===(0,s.Z)(t[0])||"object"===(0,s.Z)(t[1])))&&P(e)});return function(){return f.ZP.unsubscribe(e)}},[]);var V=O("row",h),q=(i=[void 0,void 0],(Array.isArray(j)?j:[j,void 0]).forEach(function(e,t){if("object"===(0,s.Z)(e))for(var r=0;r<f.c4.length;r++){var n=f.c4[r];if(E[n]&&void 0!==e[n]){i[t]=e[n];break}}else i[t]=e}),i),F=c()(V,(a={},(0,n.Z)(a,"".concat(V,"-no-wrap"),!1===_),(0,n.Z)(a,"".concat(V,"-").concat(I),I),(0,n.Z)(a,"".concat(V,"-").concat(T),T),(0,n.Z)(a,"".concat(V,"-rtl"),"rtl"===M),a),x),K={},z=null!=q[0]&&q[0]>0?-(q[0]/2):void 0,G=null!=q[1]&&q[1]>0?-(q[1]/2):void 0;if(z&&(K.marginLeft=z,K.marginRight=z),J){var U=(0,o.Z)(q,2);K.rowGap=U[1]}else G&&(K.marginTop=G,K.marginBottom=G);var W=(0,o.Z)(q,2),D=W[0],Q=W[1],X=l.useMemo(function(){return{gutter:[D,Q],wrap:_,supportFlexGap:J}},[D,Q,_,J]);return l.createElement(p.Z.Provider,{value:X},l.createElement("div",(0,r.Z)({},N,{className:F,style:(0,r.Z)((0,r.Z)({},K),y),ref:t}),g))});t.Z=v},71230:function(e,t,i){"use strict";var r=i(92820);t.Z=r.Z},11424:function(e,t,i){"use strict";i.r(t),i.d(t,{BrowserNotifyModal:function(){return y}});var r=i(85893),n=i(6880),s=i(71577),o=i(11382),a=i(71230),c=i(67294),l=i(4480),u=i(77466);async function d(e,t,i){let r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:e,destination:t})};try{await fetch("".concat("/api/notifications/register","?accessToken=").concat(i),r)}catch(n){console.error(n)}}async function f(e){let t=await navigator.serviceWorker.ready,i=await t.pushManager.getSubscription();return i||(i=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),i=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(i),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}(e)})),JSON.stringify(i)}var h=i(38851),p=i.n(h),w=i(83469);let{Title:m}=n.Z,v=()=>(0,r.jsx)("div",{children:"Browser notifications are not supported in your browser."}),b=e=>{let{start:t}=e;return(0,r.jsx)("div",{id:"browser-push-preview-box",className:p().pushPreview,children:(0,r.jsxs)("div",{className:p().inner,children:[(0,r.jsxs)("div",{className:p().title,children:[window.location.toString()," wants to"]}),(0,r.jsxs)("div",{className:p().permissionLine,children:[(0,r.jsx)("svg",{className:p().bell,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M14 12.3333V13H2V12.3333L3.33333 11V7C3.33333 4.93333 4.68667 3.11333 6.66667 2.52667C6.66667 2.46 6.66667 2.4 6.66667 2.33333C6.66667 1.97971 6.80714 1.64057 7.05719 1.39052C7.30724 1.14048 7.64638 1 8 1C8.35362 1 8.69276 1.14048 8.94281 1.39052C9.19286 1.64057 9.33333 1.97971 9.33333 2.33333C9.33333 2.4 9.33333 2.46 9.33333 2.52667C11.3133 3.11333 12.6667 4.93333 12.6667 7V11L14 12.3333ZM9.33333 13.6667C9.33333 14.0203 9.19286 14.3594 8.94281 14.6095C8.69276 14.8595 8.35362 15 8 15C7.64638 15 7.30724 14.8595 7.05719 14.6095C6.80714 14.3594 6.66667 14.0203 6.66667 13.6667",fill:"#676670"})}),(0,r.jsx)("span",{className:p().showNotificationsText,children:"Show notifications"})]}),(0,r.jsxs)("div",{className:p().buttonRow,children:[(0,r.jsx)(s.Z,{type:"primary",onClick:()=>{t()},children:"Allow"}),(0,r.jsx)("button",{type:"button",className:p().disabled,children:"Block"})]})]})})},x=()=>(0,r.jsxs)("div",{children:[(0,r.jsx)(m,{children:"Notifications are enabled"}),"To disable push notifications from ",window.location.hostname.toString()," access your browser permissions for this site and turn off notifications.",(0,r.jsx)("a",{href:"https://owncast.online/docs/notifications",children:" Learn more."})]}),y=()=>{let[e,t]=(0,c.useState)(null),i=(0,l.sJ)(u.FI),n=(0,l.sJ)(u.g1),[s,h]=(0,c.useState)(!1),m=(0,w.Z)()&&"default"!==Notification.permission,{notifications:y}=n,{browser:g}=y,{publicKey:Z}=g,j=g.enabled&&(0,w.Z)();if(m)return(0,r.jsx)(x,{});let _=async()=>{if(!(0,w.Z)()||"default"===Notification.permission){h(!0);try{let e=await f(Z);d("BROWSER_PUSH_NOTIFICATION",e,i),t(null)}catch(r){t("Error registering for live notifications: ".concat(r.message,". Make sure you're not inside a private browser environment or have previously disabled notifications for this stream."))}h(!1)}};return j?(0,r.jsxs)(o.Z,{spinning:s,children:[(0,r.jsxs)(a.Z,{className:p().description,children:["Get notified right in the browser each time this stream goes live.",(0,r.jsx)("a",{href:"https://owncast.online/docs/notifications/#browser-notifications",children:"Learn more"}),"\xa0 about Owncast browser notifications."]}),(0,r.jsx)(a.Z,{children:e}),(0,r.jsx)(b,{start:()=>_()})]}):(0,r.jsx)(v,{})}},38851:function(e){e.exports={description:"BrowserNotifyModal_description__tMKKq",pushPreview:"BrowserNotifyModal_pushPreview__4Og4q",inner:"BrowserNotifyModal_inner__uhFDw",title:"BrowserNotifyModal_title__dd_Lh",permissionLine:"BrowserNotifyModal_permissionLine__K8nyJ",bell:"BrowserNotifyModal_bell__9mIeI",buttonRow:"BrowserNotifyModal_buttonRow__oxJUg",disabled:"BrowserNotifyModal_disabled__v88lb"}}}]);
|
|
//# sourceMappingURL=1424.29ed4c2cba6fad21.js.map
|