owncast/static/web/_next/static/chunks/1398.6b5af67ab473a4ee.js
2023-03-13 06:17:27 +00:00

1 line
No EOL
7.8 KiB
JavaScript
Vendored

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1398],{24308:function(e,t,r){"use strict";r.d(t,{c4:function(){return s}});var i=r(4942),n=r(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 r=o[t],i=e.matchHandlers[r];null==i||i.mql.removeListener(null==i?void 0:i.listener)}),a.clear()},register:function(){var e=this;Object.keys(o).forEach(function(t){var r=o[t],s=function(r){var s=r.matches;e.dispatch((0,n.Z)((0,n.Z)({},l),(0,i.Z)({},t,s)))},a=window.matchMedia(r);a.addListener(s),e.matchHandlers[r]={mql:a,listener:s},s(a)})}}},99134:function(e,t,r){"use strict";var i=(0,r(67294).createContext)({});t.Z=i},92820:function(e,t,r){"use strict";var i=r(87462),n=r(4942),s=r(71002),o=r(97685),a=r(94184),c=r.n(a),l=r(67294),u=r(53124),d=r(98082),f=r(24308),h=r(93355),p=r(99134),w=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};function m(e,t){var r=l.useState("string"==typeof e?e:""),i=(0,o.Z)(r,2),n=i[0],a=i[1],c=function(){if("string"==typeof e&&a(e),"object"===(0,s.Z)(e))for(var r=0;r<f.c4.length;r++){var i=f.c4[r];if(t[i]){var n=e[i];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 r,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,N=e.wrap,_=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],k=B[1],P=l.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),A=(0,o.Z)(P,2),L=A[0],R=A[1],T=m(b,L),I=m(v,L),J=(0,d.Z)(),F=l.useRef(j);l.useEffect(function(){var e=f.ZP.subscribe(function(e){R(e);var t=F.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])))&&k(e)});return function(){return f.ZP.unsubscribe(e)}},[]);var H=O("row",h),V=(r=[void 0,void 0],(Array.isArray(j)?j:[j,void 0]).forEach(function(e,t){if("object"===(0,s.Z)(e))for(var i=0;i<f.c4.length;i++){var n=f.c4[i];if(E[n]&&void 0!==e[n]){r[t]=e[n];break}}else r[t]=e}),r),q=c()(H,(a={},(0,n.Z)(a,"".concat(H,"-no-wrap"),!1===N),(0,n.Z)(a,"".concat(H,"-").concat(I),I),(0,n.Z)(a,"".concat(H,"-").concat(T),T),(0,n.Z)(a,"".concat(H,"-rtl"),"rtl"===M),a),x),K={},z=null!=V[0]&&V[0]>0?-(V[0]/2):void 0,G=null!=V[1]&&V[1]>0?-(V[1]/2):void 0;if(z&&(K.marginLeft=z,K.marginRight=z),J){var U=(0,o.Z)(V,2);K.rowGap=U[1]}else G&&(K.marginTop=G,K.marginBottom=G);var W=(0,o.Z)(V,2),D=W[0],Q=W[1],X=l.useMemo(function(){return{gutter:[D,Q],wrap:N,supportFlexGap:J}},[D,Q,N,J]);return l.createElement(p.Z.Provider,{value:X},l.createElement("div",(0,i.Z)({},_,{className:q,style:(0,i.Z)((0,i.Z)({},K),y),ref:t}),g))});t.Z=v},71230:function(e,t,r){"use strict";var i=r(92820);t.Z=i.Z},41398:function(e,t,r){"use strict";r.r(t),r.d(t,{BrowserNotifyModal:function(){return Z}});var i=r(85893),n=r(85818),s=r(71577),o=r(11382),a=r(71230),c=r(67294),l=r(4480),u=r(35800),d=r(44974);async function f(e,t,r){let i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:e,destination:t})};try{await fetch("".concat("/api/notifications/register","?accessToken=").concat(r),i)}catch(e){console.error(e)}}async function h(e){let t=await navigator.serviceWorker.ready,r=await t.pushManager.getSubscription();return r||(r=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),i=window.atob(r),n=new Uint8Array(i.length);for(let e=0;e<i.length;++e)n[e]=i.charCodeAt(e);return n}(e)})),JSON.stringify(r)}var p=r(67940),w=r.n(p),m=r(34148),v=r(69183);let{Title:b}=n.Z,x=()=>(0,i.jsx)("div",{children:"Browser notifications are not supported in your browser."}),y=e=>{let{start:t}=e;return(0,i.jsx)("div",{id:"browser-push-preview-box",className:w().pushPreview,children:(0,i.jsxs)("div",{className:w().inner,children:[(0,i.jsxs)("div",{className:w().title,children:[window.location.toString()," wants to"]}),(0,i.jsxs)("div",{className:w().permissionLine,children:[(0,i.jsx)("svg",{className:w().bell,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.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,i.jsx)("span",{className:w().showNotificationsText,children:"Show notifications"})]}),(0,i.jsxs)("div",{className:w().buttonRow,children:[(0,i.jsx)(s.Z,{type:"primary",onClick:()=>{t()},children:"Allow"}),(0,i.jsx)("button",{type:"button",className:w().disabled,children:"Block"})]})]})})},g=()=>(0,i.jsxs)("div",{children:[(0,i.jsx)(b,{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,i.jsx)("a",{href:"https://owncast.online/docs/notifications",children:" Learn more."})]}),Z=()=>{let[e,t]=(0,c.useState)(null),r=(0,l.sJ)(d.FI),n=(0,l.sJ)(d.g1),[s,p]=(0,c.useState)(!1),b=(0,m.Z)()&&"default"!==Notification.permission,{notifications:Z}=n,{browser:j}=Z,{publicKey:N}=j,_=j.enabled&&(0,m.Z)();if(b)return(0,i.jsx)(g,{});let C=async()=>{if(!(0,m.Z)()||"default"===Notification.permission){p(!0);try{let e=await h(N);f("BROWSER_PUSH_NOTIFICATION",e,r),t(null)}catch(e){t("Error registering for live notifications: ".concat(e.message,". Make sure you're not inside a private browser environment or have previously disabled notifications for this stream."))}p(!1)}};return _?(0,i.jsx)(u.ErrorBoundary,{fallbackRender:e=>{let{error:t,resetErrorBoundary:r}=e;return(0,i.jsx)(v.A,{componentName:"BrowserNotifyModal",message:t.message,retryFunction:r})},children:(0,i.jsxs)(o.Z,{spinning:s,children:[(0,i.jsxs)(a.Z,{className:w().description,children:["Get notified right in the browser each time this stream goes live.",(0,i.jsx)("a",{href:"https://owncast.online/docs/notifications/#browser-notifications",children:"Learn more"}),"\xa0 about Owncast browser notifications."]}),(0,i.jsx)(a.Z,{children:e}),(0,i.jsx)(y,{start:()=>C()})]})}):(0,i.jsx)(x,{})}},67940: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"}}}]);