owncast/static/web/_next/static/chunks/7423-09d0caf0464c43f7.js
2023-11-24 06:25:00 +00:00

1 line
No EOL
13 KiB
JavaScript
Vendored

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7423],{34744:function(e,t,r){r.r(t),r.d(t,{Circle:function(){return es_Circle},Line:function(){return es_Line},default:function(){return k}});var n=r(87462),a=r(1413),o=r(45987),i=r(67294),s=r(94184),c=r.n(s),l={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},useTransitionDuration=function(){var e=(0,i.useRef)([]),t=(0,i.useRef)(null);return(0,i.useEffect)(function(){var r=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var a=e.style;a.transitionDuration=".3s, .3s, .3s, .06s",t.current&&r-t.current<100&&(a.transitionDuration="0s, 0s")}}),n&&(t.current=Date.now())}),e.current},u=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"],es_Line=function(e){var t=(0,a.Z)((0,a.Z)({},l),e),r=t.className,s=t.percent,p=t.prefixCls,f=t.strokeColor,d=t.strokeLinecap,h=t.strokeWidth,y=t.style,v=t.trailColor,k=t.trailWidth,m=t.transition,b=(0,o.Z)(t,u);delete b.gapPosition;var g=Array.isArray(s)?s:[s],C=Array.isArray(f)?f:[f],E=useTransitionDuration(),x=h/2,Z="M ".concat("round"===d?x:0,",").concat(x,"\n L ").concat("round"===d?100-h/2:100,",").concat(x),w=0;return i.createElement("svg",(0,n.Z)({className:c()("".concat(p,"-line"),r),viewBox:"0 0 100 ".concat(h),preserveAspectRatio:"none",style:y},b),i.createElement("path",{className:"".concat(p,"-line-trail"),d:Z,strokeLinecap:d,stroke:v,strokeWidth:k||h,fillOpacity:"0"}),g.map(function(e,t){var r=1;switch(d){case"round":r=1-h/100;break;case"square":r=1-h/2/100;break;default:r=1}var n={strokeDasharray:"".concat(e*r,"px, 100px"),strokeDashoffset:"-".concat(w,"px"),transition:m||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},a=C[t]||C[C.length-1];return w+=e,i.createElement("path",{key:t,className:"".concat(p,"-line-path"),d:Z,strokeLinecap:d,stroke:a,strokeWidth:h,fillOpacity:"0",ref:function(e){E[t]=e},style:n})}))},p=r(71002),f=r(97685),d=r(98924),h=0,y=(0,d.Z)();function getUUID(){var e;return y?(e=h,h+=1):e="TEST_OR_SSR",e}var useId=function(e){var t=i.useState(),r=(0,f.Z)(t,2),n=r[0],a=r[1];return i.useEffect(function(){a("rc_progress_".concat(getUUID()))},[]),e||n},v=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function stripPercentToNumber(e){return+e.replace("%","")}function toArray(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}var getCircleStyle=function(e,t,r,n,a,o,i,s,c,l){var u=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,p=(100-n)/100*t;return"round"===c&&100!==n&&(p+=l/2)>=t&&(p=t-.01),{stroke:"string"==typeof s?s:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:p+u,transform:"rotate(".concat(a+r/100*360*((360-o)/360)+(0===o?0:({bottom:0,top:180,left:90,right:-90})[i]),"deg)"),transformOrigin:"0 0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},es_Circle=function(e){var t,r,s,u,f=(0,a.Z)((0,a.Z)({},l),e),d=f.id,h=f.prefixCls,y=f.steps,k=f.strokeWidth,m=f.trailWidth,b=f.gapDegree,g=void 0===b?0:b,C=f.gapPosition,E=f.trailColor,x=f.strokeLinecap,Z=f.style,w=f.className,D=f.strokeColor,F=f.percent,_=(0,o.Z)(f,v),A=useId(d),P="".concat(A,"-gradient"),L=50-k/2,U=2*Math.PI*L,j=g>0?90+g/2:-90,N=U*((360-g)/360),S="object"===(0,p.Z)(y)?y:{count:y,space:2},W=S.count,q=S.space,R=getCircleStyle(U,N,0,100,j,g,C,E,x,k),T=toArray(F),M=toArray(D),O=M.find(function(e){return e&&"object"===(0,p.Z)(e)}),I=useTransitionDuration();return i.createElement("svg",(0,n.Z)({className:c()("".concat(h,"-circle"),w),viewBox:"".concat(-50," ").concat(-50," ").concat(100," ").concat(100),style:Z,id:d,role:"presentation"},_),O&&i.createElement("defs",null,i.createElement("linearGradient",{id:P,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(O).sort(function(e,t){return stripPercentToNumber(e)-stripPercentToNumber(t)}).map(function(e,t){return i.createElement("stop",{key:t,offset:e,stopColor:O[e]})}))),!W&&i.createElement("circle",{className:"".concat(h,"-circle-trail"),r:L,cx:0,cy:0,stroke:E,strokeLinecap:x,strokeWidth:m||k,style:R}),W?(t=Math.round(W*(T[0]/100)),r=100/W,s=0,Array(W).fill(null).map(function(e,n){var a=n<=t-1?M[0]:E,o=a&&"object"===(0,p.Z)(a)?"url(#".concat(P,")"):void 0,c=getCircleStyle(U,N,s,r,j,g,C,a,"butt",k,q);return s+=(N-c.strokeDashoffset+q)*100/N,i.createElement("circle",{key:n,className:"".concat(h,"-circle-path"),r:L,cx:0,cy:0,stroke:o,strokeWidth:k,opacity:1,style:c,ref:function(e){I[n]=e}})})):(u=0,T.map(function(e,t){var r=M[t]||M[M.length-1],n=r&&"object"===(0,p.Z)(r)?"url(#".concat(P,")"):void 0,a=getCircleStyle(U,N,u,e,j,g,C,r,x,k);return u+=e,i.createElement("circle",{key:t,className:"".concat(h,"-circle-path"),r:L,cx:0,cy:0,stroke:n,strokeLinecap:x,strokeWidth:k,opacity:0===e?0:1,style:a,ref:function(e){I[t]=e}})}).reverse()))},k={Line:es_Line,Circle:es_Circle}},36356:function(e,t,r){r.r(t),r.d(t,{default:function(){return Z}});var n=r(87462),a=r(15671),o=r(43144),i=r(32531),s=r(73568),c=r(67294),l=r(4942),u=r(45987),p=r(74165),f=r(71002),d=r(15861),h=r(74902),y=r(94184),v=r.n(y),k=r(64217);function getError(e,t){var r=Error("cannot ".concat(e.method," ").concat(e.action," ").concat(t.status,"'"));return r.status=t.status,r.method=e.method,r.url=e.action,r}function getBody(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function upload(e){var t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t)});var r=new FormData;e.data&&Object.keys(e.data).forEach(function(t){var n=e.data[t];if(Array.isArray(n)){n.forEach(function(e){r.append("".concat(t,"[]"),e)});return}r.append(t,n)}),e.file instanceof Blob?r.append(e.filename,e.file,e.file.name):r.append(e.filename,e.file),t.onerror=function(t){e.onError(t)},t.onload=function(){return t.status<200||t.status>=300?e.onError(getError(e,t),getBody(t)):e.onSuccess(getBody(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var n=e.headers||{};return null!==n["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(n).forEach(function(e){null!==n[e]&&t.setRequestHeader(e,n[e])}),t.send(r),{abort:function(){t.abort()}}}var m=+new Date,b=0;function uid(){return"rc-upload-".concat(m,"-").concat(++b)}var g=r(80334),attr_accept=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(","),n=e.name||"",a=e.type||"",o=a.replace(/\/.*$/,"");return r.some(function(e){var t=e.trim();if(/^\*(\/\*)?$/.test(e))return!0;if("."===t.charAt(0)){var r=n.toLowerCase(),i=t.toLowerCase(),s=[i];return(".jpg"===i||".jpeg"===i)&&(s=[".jpg",".jpeg"]),s.some(function(e){return r.endsWith(e)})}return/\/\*$/.test(t)?o===t.replace(/\/.*$/,""):a===t||!!/^\w+$/.test(t)&&((0,g.ZP)(!1,"Upload takes an invalidate 'accept' type '".concat(t,"'.Skip for check.")),!0)})}return!0};function loopFiles(e,t){var r=e.createReader(),n=[];function sequence(){r.readEntries(function(e){var r=Array.prototype.slice.apply(e);n=n.concat(r),r.length?sequence():t(n)})}sequence()}var es_traverseFileTree=function(e,t,r){var _traverseFileTree=function _traverseFileTree(e,n){e&&(e.path=n||"",e.isFile?e.file(function(n){r(n)&&(e.fullPath&&!n.webkitRelativePath&&(Object.defineProperties(n,{webkitRelativePath:{writable:!0}}),n.webkitRelativePath=e.fullPath.replace(/^\//,""),Object.defineProperties(n,{webkitRelativePath:{writable:!1}})),t([n]))}):e.isDirectory&&loopFiles(e,function(t){t.forEach(function(t){_traverseFileTree(t,"".concat(n).concat(e.name,"/"))})}))};e.forEach(function(e){_traverseFileTree(e.webkitGetAsEntry())})},C=["component","prefixCls","className","disabled","id","style","multiple","accept","capture","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"],E=function(e){(0,i.Z)(AjaxUploader,e);var t=(0,s.Z)(AjaxUploader);function AjaxUploader(){(0,a.Z)(this,AjaxUploader);for(var e,r,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))).state={uid:uid()},e.reqs={},e.fileInput=void 0,e._isMounted=void 0,e.onChange=function(t){var r=e.props,n=r.accept,a=r.directory,o=t.target.files,i=(0,h.Z)(o).filter(function(e){return!a||attr_accept(e,n)});e.uploadFiles(i),e.reset()},e.onClick=function(t){var r=e.fileInput;if(r){var n=e.props,a=n.children,o=n.onClick;if(a&&"button"===a.type){var i=r.parentNode;i.focus(),i.querySelector("button").blur()}r.click(),o&&o(t)}},e.onKeyDown=function(t){"Enter"===t.key&&e.onClick(t)},e.onFileDrop=function(t){var r=e.props.multiple;if(t.preventDefault(),"dragover"!==t.type){if(e.props.directory)es_traverseFileTree(Array.prototype.slice.call(t.dataTransfer.items),e.uploadFiles,function(t){return attr_accept(t,e.props.accept)});else{var n=(0,h.Z)(t.dataTransfer.files).filter(function(t){return attr_accept(t,e.props.accept)});!1===r&&(n=n.slice(0,1)),e.uploadFiles(n)}}},e.uploadFiles=function(t){var r=(0,h.Z)(t);Promise.all(r.map(function(t){return t.uid=uid(),e.processFile(t,r)})).then(function(t){var r=e.props.onBatchStart;null==r||r(t.map(function(e){return{file:e.origin,parsedFile:e.parsedFile}})),t.filter(function(e){return null!==e.parsedFile}).forEach(function(t){e.post(t)})})},e.processFile=(r=(0,d.Z)((0,p.Z)().mark(function _callee(t,r){var n,a,o,i,s,c,l,u;return(0,p.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(n=e.props.beforeUpload,a=t,!n){p.next=14;break}return p.prev=3,p.next=6,n(t,r);case 6:a=p.sent,p.next=12;break;case 9:p.prev=9,p.t0=p.catch(3),a=!1;case 12:if(!1!==a){p.next=14;break}return p.abrupt("return",{origin:t,parsedFile:null,action:null,data:null});case 14:if("function"!=typeof(o=e.props.action)){p.next=21;break}return p.next=18,o(t);case 18:i=p.sent,p.next=22;break;case 21:i=o;case 22:if("function"!=typeof(s=e.props.data)){p.next=29;break}return p.next=26,s(t);case 26:c=p.sent,p.next=30;break;case 29:c=s;case 30:return(u=(l=("object"===(0,f.Z)(a)||"string"==typeof a)&&a?a:t)instanceof File?l:new File([l],t.name,{type:t.type})).uid=t.uid,p.abrupt("return",{origin:t,data:c,parsedFile:u,action:i});case 35:case"end":return p.stop()}},_callee,null,[[3,9]])})),function(e,t){return r.apply(this,arguments)}),e.saveFileInput=function(t){e.fileInput=t},e}return(0,o.Z)(AjaxUploader,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"post",value:function(e){var t=this,r=e.data,n=e.origin,a=e.action,o=e.parsedFile;if(this._isMounted){var i=this.props,s=i.onStart,c=i.customRequest,l=i.name,u=i.headers,p=i.withCredentials,f=i.method,d=n.uid;s(n),this.reqs[d]=(c||upload)({action:a,filename:l,data:r,file:o,headers:u,withCredentials:p,method:f||"post",onProgress:function(e){var r=t.props.onProgress;null==r||r(e,o)},onSuccess:function(e,r){var n=t.props.onSuccess;null==n||n(e,o,r),delete t.reqs[d]},onError:function(e,r){var n=t.props.onError;null==n||n(e,r,o),delete t.reqs[d]}})}}},{key:"reset",value:function(){this.setState({uid:uid()})}},{key:"abort",value:function(e){var t=this.reqs;if(e){var r=e.uid?e.uid:e;t[r]&&t[r].abort&&t[r].abort(),delete t[r]}else Object.keys(t).forEach(function(e){t[e]&&t[e].abort&&t[e].abort(),delete t[e]})}},{key:"render",value:function(){var e,t=this.props,r=t.component,a=t.prefixCls,o=t.className,i=t.disabled,s=t.id,p=t.style,f=t.multiple,d=t.accept,h=t.capture,y=t.children,m=t.directory,b=t.openFileDialogOnClick,g=t.onMouseEnter,E=t.onMouseLeave,x=(0,u.Z)(t,C),Z=v()((e={},(0,l.Z)(e,a,!0),(0,l.Z)(e,"".concat(a,"-disabled"),i),(0,l.Z)(e,o,o),e)),w=i?{}:{onClick:b?this.onClick:function(){},onKeyDown:b?this.onKeyDown:function(){},onMouseEnter:g,onMouseLeave:E,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return c.createElement(r,(0,n.Z)({},w,{className:Z,role:"button",style:p}),c.createElement("input",(0,n.Z)({},(0,k.Z)(x,{aria:!0,data:!0}),{id:s,disabled:i,type:"file",ref:this.saveFileInput,onClick:function(e){return e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:d},m?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},{multiple:f,onChange:this.onChange},null!=h?{capture:h}:{})),y)}}]),AjaxUploader}(c.Component);function empty(){}var x=function(e){(0,i.Z)(Upload,e);var t=(0,s.Z)(Upload);function Upload(){var e;(0,a.Z)(this,Upload);for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))).uploader=void 0,e.saveUploader=function(t){e.uploader=t},e}return(0,o.Z)(Upload,[{key:"abort",value:function(e){this.uploader.abort(e)}},{key:"render",value:function(){return c.createElement(E,(0,n.Z)({},this.props,{ref:this.saveUploader}))}}]),Upload}(c.Component);x.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:empty,onError:empty,onSuccess:empty,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var Z=x}}]);