PageSourceSearch

https://bcrs.sg/static/js/reactPlayerYouTube.b4877fe4.chunk.js

js bcrs.sg collected 2026-10-05 11:01:50 UTC 15,017 bytes, 3 lines download raw bytes

1/*! For license information please see reactPlayerYouTube.b4877fe4.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkbcrs_website=globalThis.webpackChunkbcrs_website||[]).push([[446],{591(e,t,n){function s(e){return class extends e{_playedRanges=[];_currentPlayedRange=null;_RANGE_EPSILON=.5;_seeking=!1;connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.addEventListener("play",(()=>this.onPlaybackStart({time:this.currentTime}))),this.addEventListener("pause",(()=>this.onPlaybackStop({time:this.currentTime}))),this.addEventListener("ended",(()=>this.onPlaybackStop({time:this.currentTime}))),this.addEventListener("seeking",(()=>this.onSeeking())),this.addEventListener("seeked",(()=>this.onSeeked({time:this.currentTime})))}onPlaybackStart(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._seeking=!1;const{time:t}=e,n="number"===typeof t?t:this.currentTime;this._currentPlayedRange||(this._currentPlayedRange={start:n,end:n})}onSeeking(){this._seeking=!0,this._commitCurrentRange()}onSeeked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._seeking=!1;const{time:t}=e,n="number"===typeof t?t:this.currentTime;this._currentPlayedRange={start:n,end:n}}onPlaybackStop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{time:t}=e,n="number"===typeof t?t:this.currentTime;this._commitCurrentRange(n)}_commitCurrentRange(e){if(!this._currentPlayedRange)return;"number"===typeof e&&(this._currentPlayedRange.end=e);const{start:t,end:n}=this._currentPlayedRange;this._currentPlayedRange=null,this.addPlayedRange(t,n)}addPlayedRange(e,t){if(e>=t)return;const n=this._RANGE_EPSILON,s=[...this._playedRanges,{start:e,end:t}];s.sort(((e,t)=>e.start-t.start));const i=[];for(const a of s){if(!i.length){i.push({...a});continue}const e=i[i.length-1];a.start<=e.end+n?(e.start=Math.min(e.start,a.start),e.end=Math.max(e.end,a.end)):i.push({...a})}this._playedRanges=i}get played(){const e=this.currentTime;return this.paused||this._currentPlayedRange||"number"!==typeof e||(this._currentPlayedRange={start:e,end:e}),this._currentPlayedRange&&"number"===typeof e&&(e>this._currentPlayedRange.end&&(this._currentPlayedRange.end=e),this.addPlayedRange(this._currentPlayedRange.start,this._currentPlayedRange.end)),this._playedRanges.length?i(this._playedRanges.map((e=>[e.start,e.end]))):i([[0,0]])}}}function i(e){return Object.defineProperties(e,{start:{value:t=>e[t][0]},end:{value:t=>e[t][1]}}),e}n.d(t,{j:()=>s})},702(e,t,n){n.r(t),n.d(t,{default:()=>P});var s=n(43),i=n(591);const a=/(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})/,r=/(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/.*?[?&]list=)([\w_-]+)/;function o(e){if(!e)return;const t=e.match(/[?&]t=([\dms]+)/i);if(!t)return;const n=t[1].toLowerCase();let s=0,i=!1;const a=n.match(/(\d+)m/);a&&(s+=60*parseInt(a[1],10),i=!0);const r=n.match(/(\d+)s?$/);return r&&(s+=parseInt(r[1],10),i=!0),i?s:void 0}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;const s={src:u(e,t),frameborder:0,width:"100%",height:"100%",allow:"accelerometer; fullscreen; autoplay; encrypted-media; gyroscope; picture-in-picture"};return(null==(n=t.config)?void 0:n.referrerpolicy)&&(s.referrerpolicy=t.config.referrerpolicy),t.config&&(s["data-config"]=JSON.stringify(t.config)),`\n    <style>\n      :host {\n        display: inline-block;\n        line-height: 0;\n        position: relative;\n        min-width: 300px;\n        min-height: 150px;\n      }\n      iframe {\n        position: absolute;\n        top: 0;\n        left: 0;\n      }\n    </style>\n    <iframe${function(e){let t="";for(const n in e){const s=e[n];t+=""===s?` ${c(n)}`:` ${c(n)}="${c(`${s}`)}"`}return t}(s)}></iframe>\n  `}function u(e,t){if(!e.src)return;const n=e.src.includes("-nocookie")?"https://www.youtube-nocookie.com/embed":"https://www.youtube.com/embed",s={controls:""===e.controls?null:0,autoplay:e.autoplay,loop:e.loop,mute:e.muted,playsinline:e.playsinline,preload:e.preload??"metadata",enablejsapi:1,
2cc_load_policy:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1,start:o(e.src),...t.config};if(a.test(e.src)){const t=e.src.match(a);return`${n}/${t&&t[1]}?${h(s)}`}const i=e.src.match(r);return`${n}?${h({listType:"playlist",list:i&&i[1],...s})}`}class d extends((0,i.j)(globalThis.HTMLElement??class{})){static getTemplateHTML=(()=>l)();static shadowRootOptions={mode:"open"};static observedAttributes=["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src"];loadComplete=(()=>new m)();#e;#t;#n=0;#s=!1;#i;isLoaded=!1;#a=null;#r=null;#o=null;#l=1;constructor(){super(),this.#u("config")}get config(){return this.#r}set config(e){this.#r=e}async load(){if(this.#e)return;this.shadowRoot||this.attachShadow({mode:"open"});const e=!this.#t;this.#t&&(this.loadComplete=new m,this.isLoaded=!1),this.#t=!0,await(this.#e=Promise.resolve()),this.#e=null,this.#n=0,this.dispatchEvent(new Event("emptied"));let t=this.api;if(this.api=null,!this.src)return void(null==t||t.destroy());this.#o=document.createElement("video"),this.textTracks=this.#o.textTracks,this.textTracks.addEventListener("change",(()=>{var e;const t=Array.from(this.textTracks).find((e=>"showing"===e.mode));null==(e=this.api)||e.setOption("captions","track",t?{languageCode:t.language}:{})})),this.dispatchEvent(new Event("loadstart"));let n=this.shadowRoot.querySelector("iframe"),s=function(e){let t={};for(let n of e)t[n.name]=n.value;return t}(this.attributes);e&&n&&(this.#r=JSON.parse(n.getAttribute("data-config")||"{}")),(null==n?void 0:n.src)&&n.src===u(s,this)||(this.shadowRoot.innerHTML=l(s,this),n=this.shadowRoot.querySelector("iframe"));const i=await async function(e,t,n){if(p[e])return p[e];if(t&&self[t])return await g(0),self[t];return p[e]=new Promise((function(s,i){const a=document.createElement("script");a.src=e;const r=()=>s(self[t]);n&&(self[n]=r),a.onload=()=>!n&&r(),a.onerror=i,document.head.append(a)}))}("https://www.youtube.com/iframe_api","YT","onYouTubeIframeAPIReady");this.api=new i.Player(n,{events:{onReady:()=>{var e;this.#n=1,this.dispatchEvent(new Event("loadedmetadata")),this.dispatchEvent(new Event("durationchange")),1!==this.#l&&(null==(e=this.api)||e.setVolume(100*this.#l)),this.dispatchEvent(new Event("volumechange")),this.dispatchEvent(new Event("loadcomplete")),this.isLoaded=!0,this.loadComplete.resolve()},onError:e=>{console.error(e),this.#a={code:e.data,message:`YouTube iframe player error #${e.data}; visit https://developers.google.com/youtube/iframe_api_reference#onError for the full error message.`},this.dispatchEvent(new Event("error"))}}});let a=!1;this.api.addEventListener("onStateChange",(e=>{var t;const n=e.data;if(n===i.PlayerState.PLAYING||n===i.PlayerState.BUFFERING){a||(a=!0,this.dispatchEvent(new Event("play")));(this.api.getOption("captions","tracklist")||[]).forEach((e=>{[...this.textTracks].some((t=>t.language===e.languageCode))||this.#o.addTextTrack("subtitles",e.displayName,e.languageCode),this.textTracks=this.#o.textTracks})),this.dispatchEvent(new Event("loadstart"))}if(n===i.PlayerState.PLAYING)this.seeking&&(this.#s=!1,null==(t=this.#i)||t.resolve(),this.dispatchEvent(new Event("seeked"))),this.#n=3,this.dispatchEvent(new Event("playing"));else if(n===i.PlayerState.PAUSED){const e=Math.abs(this.currentTime-o);!this.seeking&&e>.1&&(this.#s=!0,this.dispatchEvent(new Event("seeking"))),a=!1,this.dispatchEvent(new Event("pause"))}n===i.PlayerState.ENDED&&(a=!1,this.dispatchEvent(new Event("pause")),this.dispatchEvent(new Event("ended")),this.loop&&this.play())})),this.api.addEventListener("onPlaybackRateChange",(()=>{this.dispatchEvent(new Event("ratechange"))})),this.api.addEventListener("onVolumeChange",(()=>{var e;const t=(null==(e=this.api)?void 0:e.getVolume())/100;this.#l=t,this.dispatchEvent(new Event("volumechange"))})),this.api.addEventListener("onVideoProgress",(()=>{this.dispatchEvent(new Event("timeupdate"))})),await this.loadComplete;let r,o=0;setInterval((()=>{var e;const t=Math.abs(this.currentTime-o),n=this.buffered.end(this.buffered.length-1);this.seeking&&n>.1?(this.#s=!1,null==(e=this.#i)||e.resolve(),this.dispatchEvent(new Event("seeked"))):!this.seeking&&t>.1&&(this.#s=!0,this.dispatchEvent(new Event("seeking"))),o=this.currentTime}),50);const d=setInterval((()=>{const e=this.buffered.end(this.buffered.length-1);e>=this.duration&&(clearInterval(d),this.#n=4),r!=e&&(r=e,this.dispatchEvent(new Event("progress")))}),100)}async attributeChangedCallback(e,t,n){if(t!==n)switch(e){case"src":case"auto
2play":case"controls":case"loop":case"playsinline":this.load()}}async play(){var e;return this.#i=null,await this.loadComplete,null==(e=this.api)||e.playVideo(),function(e){return(t=(t,n)=>{let s;e.addEventListener(t,s=()=>{e.removeEventListener(t,s),n()})},function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return new Promise((e=>{t(...n,(function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];n.length>1?e(n):e(n[0])}))}))})("playing");var t}(this)}async pause(){var e;return await this.loadComplete,null==(e=this.api)?void 0:e.pauseVideo()}get seeking(){return this.#s}get readyState(){return this.#n}get src(){return this.getAttribute("src")}set src(e){this.src!=e&&this.setAttribute("src",e)}get error(){return this.#a}get paused(){var e,t;return this.isLoaded?[-1,0,2,5].includes(null==(t=null==(e=this.api)?void 0:e.getPlayerState)?void 0:t.call(e)):!this.autoplay}get duration(){var e,t;return(null==(t=null==(e=this.api)?void 0:e.getDuration)?void 0:t.call(e))??NaN}get autoplay(){return this.hasAttribute("autoplay")}set autoplay(e){this.autoplay!=e&&this.toggleAttribute("autoplay",Boolean(e))}get buffered(){var e,t;if(!this.isLoaded)return v();const n=(null==(e=this.api)?void 0:e.getVideoLoadedFraction())*(null==(t=this.api)?void 0:t.getDuration());return n>0?v(0,n):v()}get controls(){return this.hasAttribute("controls")}set controls(e){this.controls!=e&&this.toggleAttribute("controls",Boolean(e))}get currentTime(){var e,t;return(null==(t=null==(e=this.api)?void 0:e.getCurrentTime)?void 0:t.call(e))??0}set currentTime(e){this.currentTime!=e&&(this.#i=new m,this.loadComplete.then((()=>{var t,n;null==(t=this.api)||t.seekTo(e,!0),this.paused&&(null==(n=this.#i)||n.then((()=>{var e;this.#i&&(null==(e=this.api)||e.pauseVideo())})))})))}set defaultMuted(e){this.defaultMuted!=e&&this.toggleAttribute("muted",Boolean(e))}get defaultMuted(){return this.hasAttribute("muted")}get loop(){return this.hasAttribute("loop")}set loop(e){this.loop!=e&&this.toggleAttribute("loop",Boolean(e))}set muted(e){this.muted!=e&&this.loadComplete.then((()=>{var t,n;e?null==(t=this.api)||t.mute():null==(n=this.api)||n.unMute()}))}get muted(){var e,t;return this.isLoaded?null==(t=null==(e=this.api)?void 0:e.isMuted)?void 0:t.call(e):this.defaultMuted}get playbackRate(){var e,t;return(null==(t=null==(e=this.api)?void 0:e.getPlaybackRate)?void 0:t.call(e))??1}set playbackRate(e){this.playbackRate!=e&&this.loadComplete.then((()=>{var t;null==(t=this.api)||t.setPlaybackRate(e)}))}get playsInline(){return this.hasAttribute("playsinline")}set playsInline(e){this.playsInline!=e&&this.toggleAttribute("playsinline",Boolean(e))}get poster(){return this.getAttribute("poster")}set poster(e){this.poster!=e&&this.setAttribute("poster",`${e}`)}set volume(e){this.volume!=e&&(this.#l=e,this.loadComplete.then((()=>{var t;null==(t=this.api)||t.setVolume(100*e)})))}get volume(){var e;return this.isLoaded?(null==(e=this.api)?void 0:e.getVolume())/100:this.#l}#u(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}}}function c(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/`/g,"&#x60;")}function h(e){return String(new URLSearchParams(function(e){let t={};for(let n in e){let s=e[n];!0===s||""===s?t[n]=1:!1===s?t[n]=0:null!=s&&(t[n]=s)}return t}(e)))}const p={};const g=e=>new Promise((t=>setTimeout(t,e)));class m extends Promise{constructor(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>{};super(((s,i)=>{n(s,i),e=s,t=i})),this.resolve=e,this.reject=t}}function v(e,t){return Array.isArray(e)?f(e):f(null==e||null==t||0===e&&0===t?[[0,0]]:[[e,t]])}function f(e){return Object.defineProperties(e,{start:{value:t=>e[t][0]},end:{value:t=>e[t][1]}}),e}globalThis.customElements&&!globalThis.customElements.get("youtube-video")&&globalThis.customElements.define("youtube-video",d);var y=d,b=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),w={className:"class",htmlFor:"for"};function E(e){return e.toLowerCase()}function k(e){return"boolean"===typeof e?e?"":void 0:"function"===typeof e||"object"===typeof e&&null!==e?void 0:e}function T(e,t,n){var s;e[t]=n,null==n&&t in((null==(s=globalThis.HTMLElement)?void 0:s.prototype)??{})&&e.removeAttribute(t)}var P=function(e){let{react:t,tagName:n,elementClass:s,events:i,displayName:a,defaultProps:r,toAttributeName:o=E,toAttributeValue:l=k}=e;const u=Number.parseInt(t.version)>=19,d=t.forwardRef(((e,a)=>{var d,c;const h=t.useRef(null),p=t.useRef(new Map),g={},m={},v={},f={};for(const[t,n]of Object.entries(e)){if(b.has(t)){v[t]=n;continue}const e=o(w[t]??t);if(s.prototype&&t in s.prototype&&!(t in((null==(d=globalThis.HTMLElement)?void 0:d.prototype)??{}))&&!(null==(c=s.observedAttributes)?void 0:c.some((t=>t===e)))){f[t]=n;continue}if(t.startsWith("on")){g[t]=n;continue}const i=l(n);if(e&&null!=i&&(m[e]=String(i),u||(v[e]=i)),e&&u){const t=k(n);v[e]=i!==t?i:n}}if("undefined"!==typeof window){for(const e in g){const n=g[e],s=e.endsWith("Capture"),a=((null==i?void 0:i[e])??e.slice(2).toLowerCase()).slice(0,s?-7:void 0);t.useLayoutEffect((()=>{const e=null==h?void 0:h.current;if(e&&"function"===typeof n)return e.addEventListener(a,n,s),()=>{e.removeEventListener(a,n,s)}}),[null==h?void 0:h.current,n])}t.useLayoutEffect((()=>
2{if(null===h.current)return;const e=new Map;for(const t in f)T(h.current,t,f[t]),p.current.delete(t),e.set(t,f[t]);for(const[t,n]of p.current)T(h.current,t,void 0);p.current=e}))}if("undefined"===typeof window&&(null==s?void 0:s.getTemplateHTML)&&(null==s?void 0:s.shadowRootOptions)){const{mode:n,delegatesFocus:i}=s.shadowRootOptions,a=t.createElement("template",{shadowrootmode:n,shadowrootdelegatesfocus:i,dangerouslySetInnerHTML:{__html:s.getTemplateHTML(m,e)},key:"ce-la-react-ssr-template-shadow-root"});v.children=[a,v.children]}return t.createElement(n,{...r,...v,ref:t.useCallback((e=>{h.current=e,"function"===typeof a?a(e):null!==a&&(a.current=e)}),[a])},v.children)}));return d.displayName=a??s.name,d}({react:s,tagName:"youtube-video",elementClass:y,toAttributeName:e=>"muted"===e?"":"defaultMuted"===e?"muted":E(e)})}}]);
3//# sourceMappingURL=reactPlayerYouTube.b4877fe4.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.