comein-player-web 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .comein-web-sdk-layout{background:#000;display:grid;grid-template-columns:minmax(0,1fr) 0;height:100%;min-height:600px;transition:grid-template-columns .18s ease-out,grid-template-rows .18s ease-out;width:100%}.comein-web-sdk-layout.has-interaction{grid-template-columns:minmax(0,1fr) 480px}.comein-web-sdk-player,.comein-web-sdk-player-frame{background:#000;min-height:0;min-width:0}.comein-web-sdk-player-frame{height:100%;position:relative;width:100%}.comein-web-sdk-roadshow-overlay-host{inset:0;min-height:0;min-width:0;position:absolute}.comein-web-sdk-player{height:100%;position:relative;width:100%}.comein-web-sdk-player #player{position:relative}.comein-web-sdk-roadshow-overlay-host{pointer-events:none;z-index:2147483000}.comein-web-sdk-roadshow-preview{align-items:center;background:#000;color:#fff;display:flex;font-family:PingFang SC,Microsoft YaHei,Arial,sans-serif;inset:0;justify-content:center;overflow:hidden;pointer-events:auto;position:absolute}.comein-web-sdk-roadshow-preview.is-fullscreen,.comein-web-sdk-roadshow-preview.is-web-fullscreen{position:fixed;z-index:2147483001}.comein-web-sdk-roadshow-preview-bg,.comein-web-sdk-roadshow-preview-shade{inset:0;position:absolute}.comein-web-sdk-roadshow-preview-bg{background-position:50%;background-repeat:no-repeat;background-size:cover;filter:blur(8px);transform:scale(1.04)}.comein-web-sdk-roadshow-preview-shade{background:rgba(0,0,0,.58)}.comein-web-sdk-roadshow-preview-content{align-items:center;display:flex;flex-direction:column;justify-content:center;max-width:min(92%,640px);min-width:280px;padding:28px 32px;position:relative;text-align:center;z-index:1}.comein-web-sdk-roadshow-preview-title{color:#fff;font-size:24px;font-weight:600;line-height:34px}.comein-web-sdk-roadshow-preview-countdown{align-items:baseline;color:#fff;display:flex;justify-content:center;margin-top:22px;white-space:nowrap}.comein-web-sdk-roadshow-preview-number{color:#fff;font-size:28px;font-weight:600;line-height:40px;margin:0 6px 0 14px}.comein-web-sdk-roadshow-preview-number:first-child{margin-left:0}.comein-web-sdk-roadshow-preview-unit{color:#fff;font-size:16px;font-weight:400;line-height:22px}.comein-web-sdk-roadshow-preview-controls{align-items:center;bottom:16px;display:flex;gap:20px;max-width:calc(100% - 32px);position:absolute;right:16px;z-index:2}.comein-web-sdk-roadshow-preview-control{align-items:center;background:transparent;border:0;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-flex;height:18px;justify-content:center;padding:0;position:relative;user-select:none;width:18px}.comein-web-sdk-roadshow-preview-control.is-active,.comein-web-sdk-roadshow-preview-control:hover{background:transparent}.comein-web-sdk-roadshow-preview-control:after{background:rgba(0,0,0,.78);border-radius:4px;bottom:calc(100% + 8px);box-sizing:border-box;color:#fff;content:attr(data-tooltip);font:12px/18px PingFang SC,Microsoft YaHei,Arial,sans-serif;max-width:min(240px,calc(100vw - 48px));opacity:0;overflow:hidden;padding:5px 8px;pointer-events:none;position:absolute;right:0;text-align:center;text-overflow:ellipsis;transition:opacity .15s ease;white-space:nowrap}.comein-web-sdk-roadshow-preview-control:hover:after{opacity:1}.comein-web-sdk-roadshow-preview-control-icon{color:#fff;display:block;font-size:18px;height:18px;line-height:1;text-align:center;width:18px}.comein-web-sdk-interaction{background:#fff;border-left:1px solid transparent;box-sizing:border-box;display:flex;flex-direction:column;min-height:0;min-width:0;opacity:0;padding:0 12px 12px;pointer-events:none;transform:translateX(12px);transition:opacity .14s ease-out,transform .18s ease-out,border-color .18s ease-out}.comein-web-sdk-layout.has-interaction .comein-web-sdk-interaction{border-left-color:#e5e7eb;opacity:1;pointer-events:auto;transform:translateX(0)}.comein-web-sdk-interaction[hidden]{display:none!important}.comein-web-sdk-tabs{align-items:stretch;background:#fff;border-bottom:1px solid #e5e7eb;display:flex;flex:0 0 44px}.comein-web-sdk-tab{background:transparent;border:0;color:#606266;cursor:pointer;flex:1 1 0;font:14px/1.4 inherit;position:relative}.comein-web-sdk-tab:after{background:transparent;border-radius:2px;bottom:-1px;content:"";height:2px;position:absolute;right:50%;transform:translateX(50%);width:48px}.comein-web-sdk-tab.is-active{color:var(--player-theme-color,#f76a2b);font-weight:600}.comein-web-sdk-tab.is-active:after{background:var(--player-theme-color,#f76a2b)}.comein-web-sdk-panels{display:grid;flex:1 1 auto;min-height:0}.comein-web-sdk-panel{background:#fff;min-height:0;min-width:0;padding-top:12px}.comein-web-sdk-panel[hidden]{display:none!important}@media (max-width:960px){.comein-web-sdk-layout{grid-template-columns:1fr;grid-template-rows:minmax(360px,1fr) 0}.comein-web-sdk-layout.has-interaction{grid-template-rows:minmax(360px,1fr) minmax(320px,42vh)}.comein-web-sdk-interaction{border-left:0;border-top:1px solid transparent;transform:translateY(12px)}.comein-web-sdk-layout.has-interaction .comein-web-sdk-interaction{border-top-color:#e5e7eb;transform:translateY(0)}.comein-web-sdk-roadshow-preview-content{min-width:240px;padding:22px 24px}.comein-web-sdk-roadshow-preview-title{font-size:22px;line-height:32px}.comein-web-sdk-roadshow-preview-countdown{margin-top:18px}.comein-web-sdk-roadshow-preview-number{font-size:26px;line-height:36px;margin-left:10px;margin-right:5px}}
1
+ .comein-web-sdk-layout{background:#000;display:grid;grid-template-columns:minmax(0,1fr) 0;height:100%;min-height:600px;transition:grid-template-columns .18s ease-out,grid-template-rows .18s ease-out;width:100%}.comein-web-sdk-layout.has-interaction{grid-template-columns:minmax(0,1fr) 480px}.comein-web-sdk-player,.comein-web-sdk-player-frame{background:#000;min-height:0;min-width:0}.comein-web-sdk-player-frame{height:100%;position:relative;width:100%}.comein-web-sdk-roadshow-overlay-host{inset:0;min-height:0;min-width:0;position:absolute}.comein-web-sdk-player{height:100%;position:relative;width:100%}.comein-web-sdk-player #player{position:relative}.comein-web-sdk-roadshow-overlay-host{pointer-events:none;z-index:2147483000}.comein-web-sdk-roadshow-preview{align-items:center;background:#000;color:#fff;container-type:inline-size;display:flex;font-family:PingFang SC,Microsoft YaHei,Arial,sans-serif;inset:0;justify-content:center;overflow:hidden;pointer-events:auto;position:absolute}.comein-web-sdk-roadshow-preview.is-fullscreen,.comein-web-sdk-roadshow-preview.is-web-fullscreen{position:fixed;z-index:2147483001}.comein-web-sdk-roadshow-preview-bg,.comein-web-sdk-roadshow-preview-shade{inset:0;position:absolute}.comein-web-sdk-roadshow-preview-bg{background-position:50%;background-repeat:no-repeat;background-size:cover;filter:blur(8px);transform:scale(1.04)}.comein-web-sdk-roadshow-preview-shade{background:rgba(0,0,0,.58)}.comein-web-sdk-roadshow-preview-content{align-items:center;display:flex;flex-direction:column;justify-content:center;max-width:min(92%,640px);min-width:280px;padding:28px 32px;position:relative;text-align:center;z-index:1}.comein-web-sdk-roadshow-preview-title{color:#fff;font-size:24px;font-weight:600;line-height:34px}.comein-web-sdk-roadshow-preview-countdown{align-items:baseline;color:#fff;display:flex;justify-content:center;margin-top:22px;white-space:nowrap}.comein-web-sdk-roadshow-preview-number{color:#fff;font-size:28px;font-weight:600;line-height:40px;margin:0 6px 0 14px}.comein-web-sdk-roadshow-preview-number:first-child{margin-left:0}.comein-web-sdk-roadshow-preview-unit{color:#fff;font-size:16px;font-weight:400;line-height:22px}.comein-web-sdk-roadshow-preview-controls{align-items:center;bottom:16px;display:flex;gap:20px;max-width:calc(100% - 32px);position:absolute;right:16px;z-index:2}.comein-web-sdk-roadshow-preview-control{align-items:center;background:transparent;border:0;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-flex;height:18px;justify-content:center;padding:0;position:relative;user-select:none;width:18px}.comein-web-sdk-roadshow-preview-control.is-active,.comein-web-sdk-roadshow-preview-control:hover{background:transparent}.comein-web-sdk-roadshow-preview-control:after{background:rgba(0,0,0,.78);border-radius:4px;bottom:calc(100% + 8px);box-sizing:border-box;color:#fff;content:attr(data-tooltip);font:12px/18px PingFang SC,Microsoft YaHei,Arial,sans-serif;max-width:min(240px,calc(100vw - 48px));opacity:0;overflow:hidden;padding:5px 8px;pointer-events:none;position:absolute;right:0;text-align:center;text-overflow:ellipsis;transition:opacity .15s ease;white-space:nowrap}.comein-web-sdk-roadshow-preview-control:hover:after{opacity:1}.comein-web-sdk-roadshow-preview-control-icon{color:#fff;display:block;font-size:18px;height:18px;line-height:1;text-align:center;width:18px}.comein-web-sdk-interaction{background:#fff;border-left:1px solid transparent;box-sizing:border-box;display:flex;flex-direction:column;min-height:0;min-width:0;opacity:0;padding:0 12px 12px;pointer-events:none;transform:translateX(12px);transition:opacity .14s ease-out,transform .18s ease-out,border-color .18s ease-out}.comein-web-sdk-layout.has-interaction .comein-web-sdk-interaction{border-left-color:#e5e7eb;opacity:1;pointer-events:auto;transform:translateX(0)}.comein-web-sdk-interaction[hidden]{display:none!important}.comein-web-sdk-tabs{align-items:stretch;background:#fff;border-bottom:1px solid #e5e7eb;display:flex;flex:0 0 44px}.comein-web-sdk-tab{background:transparent;border:0;color:#606266;cursor:pointer;flex:1 1 0;font:14px/1.4 inherit;position:relative}.comein-web-sdk-tab:after{background:transparent;border-radius:2px;bottom:-1px;content:"";height:2px;position:absolute;right:50%;transform:translateX(50%);width:48px}.comein-web-sdk-tab.is-active{color:var(--player-theme-color,#f76a2b);font-weight:600}.comein-web-sdk-tab.is-active:after{background:var(--player-theme-color,#f76a2b)}.comein-web-sdk-panels{display:grid;flex:1 1 auto;min-height:0}.comein-web-sdk-panel{background:#fff;min-height:0;min-width:0;padding-top:12px}.comein-web-sdk-panel[hidden]{display:none!important}@media (max-width:960px){.comein-web-sdk-layout{grid-template-columns:1fr;grid-template-rows:minmax(360px,1fr) 0}.comein-web-sdk-layout.has-interaction{grid-template-rows:minmax(360px,1fr) minmax(320px,42vh)}.comein-web-sdk-interaction{border-left:0;border-top:1px solid transparent;transform:translateY(12px)}.comein-web-sdk-layout.has-interaction .comein-web-sdk-interaction{border-top-color:#e5e7eb;transform:translateY(0)}.comein-web-sdk-roadshow-preview-content{min-width:240px;padding:22px 24px}.comein-web-sdk-roadshow-preview-title{font-size:22px;line-height:32px}.comein-web-sdk-roadshow-preview-countdown{margin-top:18px}.comein-web-sdk-roadshow-preview-number{font-size:26px;line-height:36px;margin-left:10px;margin-right:5px}}@container (max-width: 400px){.comein-web-sdk-roadshow-preview:lang(en) .comein-web-sdk-roadshow-preview-number{font-size:24px;line-height:34px;margin:0 3px 0 4px}.comein-web-sdk-roadshow-preview:lang(en) .comein-web-sdk-roadshow-preview-number:first-child{margin-left:0}.comein-web-sdk-roadshow-preview:lang(en) .comein-web-sdk-roadshow-preview-unit{font-size:14px;line-height:20px}}
package/dist/index.esm.js CHANGED
@@ -749,18 +749,18 @@ const ROADSHOW_PREVIEW_LABELS = {
749
749
  exitFullscreen: '退出全屏',
750
750
  },
751
751
  en: {
752
- title: 'Distance to start',
753
- day: 'day',
754
- hour: 'hour',
755
- minute: 'minute',
756
- second: 'second',
752
+ title: 'Event Starts in',
753
+ day: 'Day',
754
+ hour: 'Hour',
755
+ minute: 'Minute',
756
+ second: 'Second',
757
757
  webFullscreen: 'Web fullscreen',
758
758
  exitWebFullscreen: 'Exit web fullscreen',
759
759
  fullscreen: 'Fullscreen',
760
760
  exitFullscreen: 'Exit fullscreen',
761
761
  },
762
762
  'zh-hant': {
763
- title: '距離開始',
763
+ title: '開播提醒',
764
764
  day: '天',
765
765
  hour: '時',
766
766
  minute: '分',
@@ -771,9 +771,9 @@ const ROADSHOW_PREVIEW_LABELS = {
771
771
  exitFullscreen: '退出全螢幕',
772
772
  },
773
773
  ja: {
774
- title: '開始まで',
774
+ title: '配信開始まで',
775
775
  day: '日',
776
- hour: '時',
776
+ hour: '時間',
777
777
  minute: '分',
778
778
  second: '秒',
779
779
  webFullscreen: 'ページ全画面',
@@ -799,26 +799,31 @@ function padCountdown(value) {
799
799
  return String(Math.max(0, value)).padStart(2, '0');
800
800
  }
801
801
 
802
- function formatRoadshowCountdown(milliseconds, locale = 'zh-cn') {
802
+ function getRoadshowCountdownParts(milliseconds, locale) {
803
803
  const labels = getRoadshowPreviewLabels(locale);
804
+ const isEnglish = normalizePreviewLocale(locale) === 'en';
804
805
  const totalSeconds = Math.max(0, Math.floor(milliseconds / 1000));
805
806
  const days = Math.floor(totalSeconds / 86400);
806
- const hours = Math.floor((totalSeconds % 86400) / 3600);
807
- const minutes = Math.floor((totalSeconds % 3600) / 60);
808
- const seconds = totalSeconds % 60;
809
- const dayText = days > 0 ? `${padCountdown(days)} ${labels.day} ` : '';
810
- return `${dayText}${padCountdown(hours)} ${labels.hour} ${padCountdown(minutes)} ${labels.minute} ${padCountdown(seconds)} ${labels.second}`;
807
+ const parts = [
808
+ ...(days > 0 ? [{ value: days, unit: 'day' }] : []),
809
+ { value: Math.floor((totalSeconds % 86400) / 3600), unit: 'hour' },
810
+ { value: Math.floor((totalSeconds % 3600) / 60), unit: 'minute' },
811
+ { value: totalSeconds % 60, unit: 'second' },
812
+ ];
813
+ return parts.map(part => ({
814
+ value: part.value,
815
+ unit: isEnglish && part.value !== 1 ? `${labels[part.unit]}s` : labels[part.unit],
816
+ }));
817
+ }
818
+
819
+ function formatRoadshowCountdown(milliseconds, locale = 'zh-cn') {
820
+ return getRoadshowCountdownParts(milliseconds, locale)
821
+ .map(part => `${padCountdown(part.value)} ${part.unit}`)
822
+ .join(' ');
811
823
  }
812
824
 
813
825
  function setCountdownText(countdownElement, milliseconds, documentRef, labels) {
814
- const totalSeconds = Math.max(0, Math.floor(milliseconds / 1000));
815
- const days = Math.floor(totalSeconds / 86400);
816
- const parts = [
817
- ...(days > 0 ? [{ value: days, unit: labels.day }] : []),
818
- { value: Math.floor((totalSeconds % 86400) / 3600), unit: labels.hour },
819
- { value: Math.floor((totalSeconds % 3600) / 60), unit: labels.minute },
820
- { value: totalSeconds % 60, unit: labels.second },
821
- ];
826
+ const parts = getRoadshowCountdownParts(milliseconds, labels.locale);
822
827
  const children = [];
823
828
  for (const part of parts) {
824
829
  const numberElement = documentRef.createElement('span');
@@ -891,6 +896,7 @@ function createRoadshowPreviewOverlay(host, player, payload, dependencies = {})
891
896
  let destroyed = false;
892
897
 
893
898
  overlay.className = 'comein-web-sdk-roadshow-preview';
899
+ overlay.lang = labels.locale;
894
900
  background.className = 'comein-web-sdk-roadshow-preview-bg';
895
901
  shade.className = 'comein-web-sdk-roadshow-preview-shade';
896
902
  content.className = 'comein-web-sdk-roadshow-preview-content';
@@ -32056,20 +32062,12 @@ var _cof = function (it) {
32056
32062
  return toString$3.call(it).slice(8, -1);
32057
32063
  };
32058
32064
 
32059
- var _iobject;
32060
- var hasRequired_iobject;
32061
-
32062
- function require_iobject () {
32063
- if (hasRequired_iobject) return _iobject;
32064
- hasRequired_iobject = 1;
32065
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
32066
- var cof = _cof;
32067
- // eslint-disable-next-line no-prototype-builtins
32068
- _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
32069
- return cof(it) == 'String' ? it.split('') : Object(it);
32070
- };
32071
- return _iobject;
32072
- }
32065
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
32066
+ var cof$1 = _cof;
32067
+ // eslint-disable-next-line no-prototype-builtins
32068
+ var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
32069
+ return cof$1(it) == 'String' ? it.split('') : Object(it);
32070
+ };
32073
32071
 
32074
32072
  // 7.2.1 RequireObjectCoercible(argument)
32075
32073
  var _defined = function (it) {
@@ -32078,7 +32076,7 @@ var _defined = function (it) {
32078
32076
  };
32079
32077
 
32080
32078
  // to indexed object, toObject with fallback for non-array-like ES3 strings
32081
- var IObject = require_iobject();
32079
+ var IObject = _iobject;
32082
32080
  var defined$2 = _defined;
32083
32081
  var _toIobject = function (it) {
32084
32082
  return IObject(defined$2(it));
@@ -32233,7 +32231,7 @@ function require_objectAssign () {
32233
32231
  var gOPS = _objectGops;
32234
32232
  var pIE = require_objectPie();
32235
32233
  var toObject = _toObject;
32236
- var IObject = require_iobject();
32234
+ var IObject = _iobject;
32237
32235
  var $assign = Object.assign;
32238
32236
 
32239
32237
  // should work with symbols and should have deterministic property order (V8 bug)
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ComeinRoadshowWebSDK={})}(this,function(exports){"use strict";function _mergeNamespaces(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})}),Object.freeze(e)}const DEFAULT_LOCALE="zh-cn",TEST_UC="fd88e7ff-d7de-45ae-ae2a-9a77906c00d3",PROD_UC="88093483-da5c-44b2-a8ed-1d2413eef57a";function resolveUc(e=!1){return!0===e?PROD_UC:TEST_UC}const DEFAULT_BRIDGE={isThirdParty:!0,isElectron:!1,comein_channel:"zjhw",institute:"zjhw",uc:TEST_UC,hasHome:!1,hideHeader:!0,hideRoadshowDetail:!0,hideAppointment:!0,hideQuestionCollect:!0,hideScreenShot:!0,hideRecommand:!0,hideLiveDocument:!0,hideQuestionMark:!0,hideChat:!1,hideRaise:!1,i18n:!0,hasSubtitle:!0,hideModeSwitch:!0,subtitleMode:"originalLang",enlargeSubtitle:!1,webRtcAutoplay:!0,aliplayerDebugger:!1,player:{skipAuthor:!1,hasSubtitle:!0,hideModeSwitch:!0,hideAppointment:!0,hideQuestionCollect:!0,hideScreenShot:!0,hideRecommand:!0,hideWebFullscreen:!0,hideFullscreen:!1,subtitleMode:"originalLang",enlargeSubtitle:!1,subtitleSkin:"compact",noPermissionText:"无观看权限",ignoreLowDelayTip:!0}};function normalizeOptions(e={}){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("options must be an object");const t="string"==typeof e.roadshowId?e.roadshowId.trim():"",i="string"==typeof e.userInfo?e.userInfo.trim():e.userInfo;if(!t)throw new TypeError("roadshowId is required");if(!i)throw new TypeError("userInfo is required");const n={env:"web",isBuild:!0===e.isBuild,locale:e.locale||DEFAULT_LOCALE,page:"room"};t&&(n.roadshowId=t),void 0!==e.playerType&&(n.playerType=e.playerType),void 0!==e.data&&(n.data=e.data),void 0!==e.axios&&(n.axios=e.axios),n.userInfo=i;const r={...DEFAULT_BRIDGE,...e.bridge||{},isThirdParty:DEFAULT_BRIDGE.isThirdParty,isElectron:DEFAULT_BRIDGE.isElectron,comein_channel:DEFAULT_BRIDGE.comein_channel,institute:DEFAULT_BRIDGE.institute,uc:resolveUc(n.isBuild),hideAppointment:DEFAULT_BRIDGE.hideAppointment,hideQuestionCollect:DEFAULT_BRIDGE.hideQuestionCollect,hideScreenShot:DEFAULT_BRIDGE.hideScreenShot,hideRecommand:DEFAULT_BRIDGE.hideRecommand,player:{...DEFAULT_BRIDGE.player,...e.bridge&&e.bridge.player||{},...e.player||{},hideAppointment:DEFAULT_BRIDGE.player.hideAppointment,hideQuestionCollect:DEFAULT_BRIDGE.player.hideQuestionCollect,hideScreenShot:DEFAULT_BRIDGE.player.hideScreenShot,hideRecommand:DEFAULT_BRIDGE.player.hideRecommand}};return"boolean"==typeof e.hideWebFullscreen&&(r.player.hideWebFullscreen=e.hideWebFullscreen),"boolean"==typeof e.hideFullscreen&&(r.player.hideFullscreen=e.hideFullscreen),n.bridge=r,n}function installRuntime({Vue:e,ElementUI:t,logger:i},n={}){if(!e||!t||!i)throw new TypeError("Vue, ElementUI and logger are required");e.use(t,{size:"small"}),e.use(i,{isBuild:!0===n.isBuild,logstore:n.logstore||"web-sdk",getUserInfo:n.getUserInfo||(()=>n.userInfo||null)})}async function loadRuntime(e={}){const[t,i,n]=await Promise.all([Promise.resolve().then(function(){return vue_runtime_esm}),Promise.resolve().then(function(){return elementUi_common}),Promise.resolve().then(function(){return index_esm$1})]);installRuntime({Vue:t.default||t,ElementUI:i.default||i,logger:n.default||n},e)}const USER_SAVE_KEY="usersave",USER_INFO_KEY="userinfo";function getBrowserStorage(e){return e&&(e.localStorage||e.sessionStorage)?e:"undefined"==typeof globalThis?{}:{localStorage:globalThis.localStorage,sessionStorage:globalThis.sessionStorage}}function encode$2(e){const t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return"function"==typeof btoa?btoa(t):"undefined"!=typeof Buffer?Buffer.from(t,"binary").toString("base64"):e}function saveSession(e,t){if(!e)return clearSession(t),null;const i=getBrowserStorage(t);try{i.localStorage&&(i.localStorage.setItem(USER_SAVE_KEY,"1"),i.localStorage.setItem(USER_INFO_KEY,encode$2(JSON.stringify(e))))}catch(e){}return e}function clearSession(e){const t=getBrowserStorage(e);try{t.localStorage?.removeItem(USER_SAVE_KEY),t.localStorage?.removeItem(USER_INFO_KEY),t.sessionStorage?.removeItem(USER_INFO_KEY)}catch(e){}}const AUTH_ENDPOINTS={channelLogin:"json_user_webchannellogin"},FORMAL_BASE_URL="https://server.comein.cn/comein",TEST_BASE_URL="https://testserver.comein.cn/comein";class WebSdkAuthError extends Error{constructor(e,t="WEB_SDK_AUTH_FAILED"){super(e),this.name="WebSdkAuthError",this.code=t}}function isStandardUserInfo(e){return Boolean(e&&"object"==typeof e&&(e.token||e.webtoken))}function isBuildEnvironment(e){return"boolean"==typeof e.isBuild&&e.isBuild}function getApiBaseUrl(e){return e.apiBaseUrl||(isBuildEnvironment(e)?FORMAL_BASE_URL:TEST_BASE_URL)}function unwrapResponse(e){const t=Number(e?.errorcode??e?.code??0);if(0!==t)throw new WebSdkAuthError(e?.msg||e?.message||"登录失败",t);return e?.data&&"object"==typeof e.data?e.data:e}async function defaultRequest({endpoint:e,body:t,headers:i},n){if("function"!=typeof fetch)throw new WebSdkAuthError("当前环境不支持登录请求","FETCH_UNAVAILABLE");const r=isBuildEnvironment(n),o=resolveUc(r),a=e.split("_"),s=3===a.length?{app:a[0],mod:a[1],act:a[2]}:{},l=3===a.length&&r?"index.php":e,c=await fetch(`${getApiBaseUrl(n).replace(/\/$/,"")}/${l}`,{method:"POST",headers:{"Content-Type":"application/json;charset=utf-8",...s,os:"web",c:"pc",webenv:"comein",uc:o,...i},body:JSON.stringify(t||{})});let d=null;try{d=await c.json()}catch(e){throw new WebSdkAuthError("登录接口返回格式错误","INVALID_AUTH_RESPONSE")}if(!c.ok)throw new WebSdkAuthError(d?.msg||"登录接口请求失败",c.status);return unwrapResponse(d)}async function authenticate(e={},t={}){if(!1===e.auth)return e.userInfo||null;if(isStandardUserInfo(e.userInfo))return saveSession(e.userInfo,t.storage),e.userInfo;const i="string"==typeof e.userInfo?e.userInfo.trim():"";if(!i)throw new WebSdkAuthError("userInfo is required","USER_INFO_REQUIRED");const n=t.request||(t=>defaultRequest(t,e)),r=resolveUc(isBuildEnvironment(e)),o=await n({endpoint:AUTH_ENDPOINTS.channelLogin,body:{uc:r,userinfo:i},headers:{uc:r}});if(!isStandardUserInfo(o))throw new WebSdkAuthError("登录接口未返回有效用户态","INVALID_AUTH_RESPONSE");const a={...o,comein_channel:DEFAULT_BRIDGE.comein_channel,bridge:DEFAULT_BRIDGE};return saveSession(a,t.storage),a}const PUBLIC_TO_RAW={joinSuccess:"onJoinSuccess",joinError:"onJoinError",logout:"onLogout",exitRoom:"onExitRoom",ready:"onReady",canplay:"onCanplay",play:"onPlay",playing:"onPlaying",waiting:"onWaiting",seeking:"onSeeking",seeked:"onSeeked",timeupdate:"onTimeupdate",ended:"onEnded",volume:"onVolume",speed:"onSpeed",error:"onError",fullscreen:"onFullscreen",reload:"reload",dotClick:"dotClick",screenshot:"screenshot",recommendRoadshow:"recommendRoadshow",aiTranslationConfirmed:"onAiTranslationConfirmed",resize:"onResize",modeChange:"modeChange",jumpToHome:"jumpToHome",appointment:"appointed",questionCollect:"questionCollect",benefitRequired:"benefitRequired",webPayDialog:"webPayDialog",visibleFeedback:"visibleFeedback"},RAW_TO_PUBLIC=Object.fromEntries(Object.entries(PUBLIC_TO_RAW).map(([e,t])=>[t,e]));function normalizeEventName(e){return PUBLIC_TO_RAW[e]?e:RAW_TO_PUBLIC[e]||e}function createEventBridge(e){const t=new Map,i=new Map,n=(e,i)=>{const n=t.get(e)||[];for(const e of[...n])e(i)},r={on:(o,a)=>{if("function"!=typeof a)throw new TypeError("event handler must be a function");if(RAW_TO_PUBLIC[o])return e.on(o,a),r;const s=normalizeEventName(o),l=PUBLIC_TO_RAW[s];if(!l)return e.on(o,a),r;if(!t.has(s)){t.set(s,[]);const r=e=>n(s,e);i.set(s,r),e.on(l,r)}return t.get(s).push(a),r},off:(n,o)=>{if(RAW_TO_PUBLIC[n])return e.off(n,o),r;const a=normalizeEventName(n),s=PUBLIC_TO_RAW[a];if(!s)return e.off(n,o),r;const l=t.get(a)||[],c=o?l.filter(e=>e!==o):[];return c.length?t.set(a,c):(e.off(s,i.get(a)),t.delete(a),i.delete(a)),r},emit:n,destroy:()=>{for(const[t,n]of i)e.off(PUBLIC_TO_RAW[t],n);t.clear(),i.clear()}};return r}const PLAYER_LICENSES={"www.uat.rs.cicc.com":{domain:"cicc.com",key:"8P7c84nqEaRF34Tuh19b6aeef7b824558a856ae4327925227"}},LOCAL_HOSTS=new Set(["localhost","127.0.0.1","::1"]);function normalizeHostname(e=""){const t=String(e||"").trim();if(!t)return"";try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname.toLowerCase().replace(/\.$/,"")}catch(e){return t.split("/")[0].split(":")[0].toLowerCase().replace(/\.$/,"")}}function resolvePlayerLicense(e=globalThis.location?.hostname){const t=normalizeHostname(e);if(LOCAL_HOSTS.has(t))return{...PLAYER_LICENSES["www.uat.rs.cicc.com"]};const i=PLAYER_LICENSES[t];return i?{...i}:void 0}async function loadPlayerClass(){const e=await Promise.resolve().then(function(){return index_esm});return e.default||e.ComeinPlayer}const ROADSHOW_PREVIEW_END_HIDE_DELAY=300,ROADSHOW_LIVE_WATCH_INTERVAL=300;function assertContainer(e){if(!("string"==typeof e&&e.trim())&&!(e&&"object"==typeof e))throw new TypeError("player container is required")}function resolveContainer(e,t=globalThis.document){if("string"!=typeof e)return e;const i=t?.querySelector?.(e);if(!i)throw new TypeError(`player container not found: ${e}`);return i}function clearContainer(e){"function"!=typeof e.replaceChildren?(e.textContent="",Array.isArray(e.children)&&(e.children.length=0)):e.replaceChildren()}function setActiveTab(e,t){for(const i of t){const t=i.name===e;i.button.classList?.[t?"add":"remove"]?.("is-active"),i.panel.classList?.[t?"add":"remove"]?.("is-active"),i.panel.hidden=!t}}const TAB_LABELS={"zh-cn":{chat:"互动",question:"问答"},en:{chat:"Interaction",question:"Q&A"},"zh-hant":{chat:"互動",question:"問答"},ja:{chat:"チャット",question:"質疑応答"}};function getTabLabels(e="zh-cn"){return TAB_LABELS[e]||TAB_LABELS["zh-cn"]}function createInteractiveLayout(e,t="zh-cn",i=globalThis.document){const n=resolveContainer(e,i),r=i.createElement("div"),o=i.createElement("div"),a=i.createElement("div"),s=i.createElement("div"),l=i.createElement("aside"),c=i.createElement("div"),d=i.createElement("div"),u=i.createElement("button"),h=i.createElement("button"),p=i.createElement("div"),f=i.createElement("div");r.className="comein-web-sdk-layout",o.className="comein-web-sdk-player-frame",a.className="comein-web-sdk-player",s.className="comein-web-sdk-roadshow-overlay-host",l.className="comein-web-sdk-interaction",c.className="comein-web-sdk-tabs",d.className="comein-web-sdk-panels",u.className="comein-web-sdk-tab is-active",h.className="comein-web-sdk-tab",p.className="comein-web-sdk-panel is-active",f.className="comein-web-sdk-panel",f.hidden=!0,u.type="button",h.type="button";const m=e=>{const t=getTabLabels(e);u.textContent=t.chat,h.textContent=t.question};m(t);const g=[{name:"chat",button:u,panel:p},{name:"question",button:h,panel:f}];u.addEventListener?.("click",()=>setActiveTab("chat",g)),h.addEventListener?.("click",()=>setActiveTab("question",g)),c.append(u,h),d.append(p,f),l.append(c,d),o.append(a,s),r.append(o,l),clearContainer(n),n.appendChild(r),l.hidden=!0;let v,A,_,y=!1;const b=()=>{_&&v?.off?.("changeTab",_),v?.destroy?.(),A?.destroy?.(),_=void 0,v=void 0,A=void 0,y=!1,clearContainer(p),clearContainer(f),setActiveTab("chat",g)};let E;return{playerElement:a,overlayHost:s,getOverlayHost:()=>{const e=a.querySelector?.("#player")||i.getElementById?.("player");return e?.appendChild&&s.parentNode!==e&&e.appendChild(s),s},mountPanels:e=>!!y||!e.isAccessWaitingRoom&&(("function"==typeof e.createChat||"function"==typeof e.createQuestion)&&(y=!0,v=e.createChat?.(p),A=e.createQuestion?.(f),"function"==typeof v?.on&&(_=e=>{"question"===e&&(setActiveTab("question",g),A?.activeMyQuestion?.()),"chat"===e&&setActiveTab("chat",g)},v.on("changeTab",_)),!0)),destroyPanels:b,setInteractionVisible:e=>{if(E&&(globalThis.clearTimeout?.(E),E=void 0),e)return l.hidden=!1,l.offsetWidth,void r.classList?.add?.("has-interaction");r.classList?.remove?.("has-interaction"),E=globalThis.setTimeout?.(()=>{l.hidden=!0,E=void 0},190)},setLocale:m,destroy(){E&&globalThis.clearTimeout?.(E),b(),clearContainer(n)}}}function resolveRoadshowPreviewData(e={},t={}){return e.roadshowData||e.data?.roadshowData||e.initData?.roadshowData||e.store?.state?.roadshowData||(void 0!==e.status||void 0!==e.stime?e:null)||t.roadshowData||t.data?.roadshowData||t.initData?.roadshowData||t.store?.state?.roadshowData||{}}function resolveRoadshowPreviewAuth(e={},t={},i={}){return e.roadshowAuth||e.data?.roadshowAuth||e.initData?.roadshowAuth||e.store?.state?.roadshowAuth||(void 0!==i.code?i:null)||t.roadshowAuth||t.data?.roadshowAuth||t.initData?.roadshowAuth||t.store?.state?.roadshowAuth||{}}const ROADSHOW_STATUS={PREVIEW:0,BLANK:2,PLAYBACK:3,FINISH:-2};function isRoadshowStatus(e,t){return String(e)===String(t)}function isRoadshowPreviewStatus(e){return isRoadshowStatus(e,ROADSHOW_STATUS.PREVIEW)}function isRoadshowEndStatus(e){return isRoadshowStatus(e,ROADSHOW_STATUS.BLANK)||isRoadshowStatus(e,ROADSHOW_STATUS.PLAYBACK)||isRoadshowStatus(e,ROADSHOW_STATUS.FINISH)}function resolveRoadshowPreviewStartTime(e){const t=e?.stime;if(null==t||""===t)return 0;if("number"==typeof t)return t<1e11?1e3*t:t;if(/^\d+$/.test(String(t))){const e=Number(t);return e<1e11?1e3*e:e}const i=Date.parse(t);return Number.isNaN(i)?0:i}function getRoadshowPreviewPayload(e={},t={},i={}){const n=resolveRoadshowPreviewData(e,t);return{roadshowData:n,roadshowAuth:resolveRoadshowPreviewAuth(e,t,i),authPassedByJoinSuccess:!0,cover:n?.logowall169||n?.logo||"",startTime:resolveRoadshowPreviewStartTime(n)}}function shouldShowRoadshowPreviewOverlay(e,t,i={}){const n=e?.roadshowAuth?.code;return(0===n||"0"===n||void 0===n&&!0===e?.authPassedByJoinSuccess)&&isRoadshowPreviewStatus(e?.roadshowData?.status??t?.status)&&!0!==t?.isLive&&!0!==i.previewCountdownEnded}function shouldShowInteractionPanels(e,t,i={}){return!0===e&&!0===t?.isLive&&!0!==i.isAccessWaitingRoom&&!isRoadshowEndStatus(i.status??t?.status)&&!0!==i.hasLiveEnded}const ROADSHOW_PREVIEW_LABELS={"zh-cn":{title:"开播提醒",day:"天",hour:"时",minute:"分",second:"秒",webFullscreen:"网页全屏",exitWebFullscreen:"退出网页全屏",fullscreen:"全屏",exitFullscreen:"退出全屏"},en:{title:"Distance to start",day:"day",hour:"hour",minute:"minute",second:"second",webFullscreen:"Web fullscreen",exitWebFullscreen:"Exit web fullscreen",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},"zh-hant":{title:"距離開始",day:"天",hour:"時",minute:"分",second:"秒",webFullscreen:"網頁全螢幕",exitWebFullscreen:"退出網頁全螢幕",fullscreen:"全螢幕",exitFullscreen:"退出全螢幕"},ja:{title:"開始まで",day:"日",hour:"時",minute:"分",second:"秒",webFullscreen:"ページ全画面",exitWebFullscreen:"ページ全画面を終了",fullscreen:"全画面",exitFullscreen:"全画面を終了"}};function normalizePreviewLocale(e="zh-cn"){const t=String(e||"zh-cn").toLowerCase();return"zh-tw"===t||"zh-hk"===t?"zh-hant":t.startsWith("en")?"en":t.startsWith("ja")?"ja":ROADSHOW_PREVIEW_LABELS[t]?t:"zh-cn"}function getRoadshowPreviewLabels(e="zh-cn"){return ROADSHOW_PREVIEW_LABELS[normalizePreviewLocale(e)]}function padCountdown(e){return String(Math.max(0,e)).padStart(2,"0")}function formatRoadshowCountdown(e,t="zh-cn"){const i=getRoadshowPreviewLabels(t),n=Math.max(0,Math.floor(e/1e3)),r=Math.floor(n/86400),o=Math.floor(n%86400/3600),a=Math.floor(n%3600/60),s=n%60;return`${r>0?`${padCountdown(r)} ${i.day} `:""}${padCountdown(o)} ${i.hour} ${padCountdown(a)} ${i.minute} ${padCountdown(s)} ${i.second}`}function setCountdownText(e,t,i,n){const r=Math.max(0,Math.floor(t/1e3)),o=Math.floor(r/86400),a=[...o>0?[{value:o,unit:n.day}]:[],{value:Math.floor(r%86400/3600),unit:n.hour},{value:Math.floor(r%3600/60),unit:n.minute},{value:r%60,unit:n.second}],s=[];for(const e of a){const t=i.createElement("span"),n=i.createElement("span");t.className="comein-web-sdk-roadshow-preview-number",n.className="comein-web-sdk-roadshow-preview-unit",t.textContent=padCountdown(e.value),n.textContent=e.unit,s.push(t,n)}e.textContent=formatRoadshowCountdown(t,n.locale),e.replaceChildren?.(...s)}function toggleClass(e,t,i){if(!e)return;if(e.classList?.add&&e.classList?.remove)return void e.classList[i?"add":"remove"](t);const n=new Set(String(e.className||"").split(/\s+/).filter(Boolean));i?n.add(t):n.delete(t),e.className=[...n].join(" ")}function createRoadshowPreviewFullscreenButton(e,t,i,n,r,o){const a=e.createElement("button"),s=e.createElement("span");return a.type="button",a.className=`comein-web-sdk-roadshow-preview-control ${t}`,s.className=`comein-web-sdk-roadshow-preview-control-icon icon-player ${n}`,a._comeinInactiveIconClass=n,a._comeinActiveIconClass=r,a._comeinIconElement=s,a.setAttribute?.("aria-label",i),a.setAttribute?.("aria-pressed","false"),a.setAttribute?.("data-tooltip",i),a.addEventListener?.("click",e=>{e?.stopPropagation?.(),o()}),a.appendChild(s),a}function createRoadshowPreviewOverlay(e,t,i,n={}){const r=n.document||globalThis.document,o=n.now||(()=>Date.now()),a=n.setInterval||globalThis.setInterval.bind(globalThis),s=n.clearInterval||globalThis.clearInterval.bind(globalThis),l=n.setTimeout||globalThis.setTimeout.bind(globalThis),c=n.clearTimeout||globalThis.clearTimeout.bind(globalThis),d={...getRoadshowPreviewLabels(n.locale||i.locale),locale:normalizePreviewLocale(n.locale||i.locale)},u=r.createElement("div"),h=r.createElement("div"),p=r.createElement("div"),f=r.createElement("div"),m=r.createElement("div"),g=r.createElement("div"),v=r.createElement("div");let A=null,_=null,y=null,b=!1,E=!1,w=!1;u.className="comein-web-sdk-roadshow-preview",h.className="comein-web-sdk-roadshow-preview-bg",p.className="comein-web-sdk-roadshow-preview-shade",f.className="comein-web-sdk-roadshow-preview-content",m.className="comein-web-sdk-roadshow-preview-title",g.className="comein-web-sdk-roadshow-preview-countdown",v.className="comein-web-sdk-roadshow-preview-controls",i.cover&&(h.style.backgroundImage=`url("${i.cover}")`),m.textContent=d.title;const S=(e,t,i)=>{if(!e)return;e.setAttribute?.("aria-pressed",t?"true":"false"),e.setAttribute?.("aria-label",i),e.setAttribute?.("data-tooltip",i),toggleClass(e,"is-active",t);const n=t?e._comeinActiveIconClass:e._comeinInactiveIconClass;e._comeinIconElement&&n&&(e._comeinIconElement.className=`comein-web-sdk-roadshow-preview-control-icon icon-player ${n}`)},C=()=>{const t=n.syncOverlayHost?.()||e;t?.appendChild&&u.parentNode!==t&&(t.replaceChildren?.(),t.appendChild(u))};let T,I;!0!==n.hideWebFullscreen&&(T=createRoadshowPreviewFullscreenButton(r,"comein-web-sdk-roadshow-preview-web-fullscreen",d.webFullscreen,"icon-player-GWpingmuquanping","icon-player-GWshouqipingmuquanping",()=>{const e=!b;C(),b=!0===e,S(T,b,b?d.exitWebFullscreen:d.webFullscreen),toggleClass(u,"is-web-fullscreen",b),t?.setWebFullscreen?.(e)}),v.appendChild(T)),!0!==n.hideFullscreen&&(I=createRoadshowPreviewFullscreenButton(r,"comein-web-sdk-roadshow-preview-fullscreen",d.fullscreen,"icon-player-GWquanping","icon-player-GWshouqiquanping",()=>{const e=!E;C(),E=!0===e,S(I,E,E?d.exitFullscreen:d.fullscreen),toggleClass(u,"is-fullscreen",E),t?.setFullscreen?.(e)}),v.appendChild(I));const x=()=>{w||(w=!0,A&&s(A),_&&s(_),y&&c(y),A=null,_=null,y=null,u.remove?.())},B=()=>{const e=i.startTime-o();setCountdownText(g,e,r,d),!0!==t?.isLive?e<=0&&(n.onCountdownEnd?.(),y||w||(y=l(()=>{y=null,x()},ROADSHOW_PREVIEW_END_HIDE_DELAY))):x()},R=()=>{!0===t?.isLive&&x()};return f.append(m,g),u.append(h,p,f),v.children?.length&&u.appendChild(v),e.replaceChildren?.(),e.appendChild(u),C(),B(),w||(A=a(B,1e3),_=a(R,1e3)),{destroy:x}}const WEB_PLAYER_INTERNALS=new WeakMap;function getInternalPlayer(e){return WEB_PLAYER_INTERNALS.get(e).player}class WebPlayer{constructor(e,t,i=()=>{},n={destroy(){}}){WEB_PLAYER_INTERNALS.set(this,{player:e,events:t,cleanup:i,layout:n})}on(e,t){return WEB_PLAYER_INTERNALS.get(this).events.on(e,t),this}off(e,t){return WEB_PLAYER_INTERNALS.get(this).events.off(e,t),this}play(...e){return getInternalPlayer(this).play?.(...e)}pause(...e){return getInternalPlayer(this).pause?.(...e)}seek(...e){return getInternalPlayer(this).seek?.(...e)}setMode(...e){return getInternalPlayer(this).setMode?.(...e)}setLocale(...e){const{player:t,layout:i}=WEB_PLAYER_INTERNALS.get(this),n=t.setLocale?.(...e);return i.setLocale?.(e[0]),n}changePage(...e){return getInternalPlayer(this).changePage?.(...e)}setVolume(...e){return getInternalPlayer(this).setVolume?.(...e)}resize(...e){return getInternalPlayer(this).resize?.(...e)}setDotList(...e){return getInternalPlayer(this).setDotList?.(...e)}setOnlyPlayList(...e){return getInternalPlayer(this).setOnlyPlayList?.(...e)}createChat(...e){return getInternalPlayer(this).createChat?.(...e)}createQuestion(...e){return getInternalPlayer(this).createQuestion?.(...e)}destroy(){const{player:e,events:t,cleanup:i,layout:n}=WEB_PLAYER_INTERNALS.get(this);t.destroy(),i(),e.destroy?.(),n.destroy()}get options(){return getInternalPlayer(this).options}get socket(){return getInternalPlayer(this).socket}get verify(){return getInternalPlayer(this).verify}get isTrailer(){return getInternalPlayer(this).isTrailer}get isLive(){return getInternalPlayer(this).isLive}get liveStatus(){return getInternalPlayer(this).liveStatus}get isAccessWaitingRoom(){return getInternalPlayer(this).isAccessWaitingRoom}get status(){return getInternalPlayer(this).status}get isLiveRoadshow(){return getInternalPlayer(this).isLiveRoadshow}get liveMode(){return getInternalPlayer(this).liveMode}get mode(){return getInternalPlayer(this).mode}get locale(){return getInternalPlayer(this).locale}get volume(){return getInternalPlayer(this).volume}get roadshowId(){return getInternalPlayer(this).roadshowId}get user(){return getInternalPlayer(this).user}get hasPlayback(){return getInternalPlayer(this).hasPlayback}get pdfData(){return getInternalPlayer(this).pdfData}get raiseStatus(){return getInternalPlayer(this).raiseStatus}}async function createWebPlayer(e,t={},i={}){assertContainer(e),normalizeOptions(t);const n=await(i.authenticate||authenticate)(t,i),r={...t};n&&(r.userInfo=n);const o=normalizeOptions(r),a=createInteractiveLayout(e,o.locale,i.document);let s,l,c=()=>{};const d=[],u=i.setInterval||globalThis.setInterval.bind(globalThis),h=i.clearInterval||globalThis.clearInterval.bind(globalThis),p=i.setTimeout||globalThis.setTimeout.bind(globalThis),f=i.clearTimeout||globalThis.clearTimeout.bind(globalThis),m=i.requestAnimationFrame||globalThis.requestAnimationFrame?.bind(globalThis)||(e=>globalThis.setTimeout(e,0));try{i.bootstrap?await i.bootstrap(o):i.PlayerClass||await loadRuntime(o);const e=i.PlayerClass||await loadPlayerClass(),t=(i.resolvePlayerLicense||resolvePlayerLicense)(i.hostname||globalThis.location?.hostname);if(t&&(o.license=t),s=new e(a.playerElement,o),l=createEventBridge(s),"function"==typeof s.on){let e,t,n,r=!1,l=null,c=!1,g=!1,v=!1,A="";const _=(e,t)=>{},y=()=>!0===s.isAccessWaitingRoom||!0===n?.isAccessWaitingRoom,b=(e,t,i={})=>{const o={reason:e,action:t,hasJoinSuccess:r,playerStatus:s.status,roadshowDataStatus:n?.status,isLive:s.isLive,liveStatus:s.liveStatus,playerIsAccessWaitingRoom:s.isAccessWaitingRoom,roadshowDataIsAccessWaitingRoom:n?.isAccessWaitingRoom,isAccessWaitingRoom:y(),hasLiveEnded:v,interactionVisible:c,previewCountdownEnded:g,...i},a=JSON.stringify(o);a!==A&&(A=a,_("判断互动/预告状态",o))},E=()=>{e?.destroy?.(),e=void 0},w=()=>{l&&h(l),l=null},S=()=>{s.resize?.(),m(()=>{s.resize?.()}),p(()=>{s.resize?.()},190)},C=e=>{c!==e&&(c=e,a.setInteractionVisible?.(e),S())},T=()=>{C(!1),a.destroyPanels?.()},I=(e="watch")=>{const i=s.isLive,o=s.liveStatus,l=s.status??n?.status,c=isRoadshowEndStatus(l),d=y();if(!0===t&&!1===o&&(v=!0),!0===o&&(v=!1),t=o,c)return b(e,"hide-interaction:end-status",{isEndStatus:c}),E(),T(),void w();if(!0===i&&E(),shouldShowInteractionPanels(r,s,{hasLiveEnded:v,isAccessWaitingRoom:d,status:l})){C(!0);const t=a.mountPanels?.(s);return!0!==t&&C(!1),void b(e,!0===t?"show-interaction":"hide-interaction:mount-failed",{isEndStatus:c,mounted:t})}b(e,"hide-interaction:condition-false",{isEndStatus:c}),T()},x=()=>{w(),l=u(I,ROADSHOW_LIVE_WATCH_INTERVAL)},B=()=>{r=!1,g=!1,t=void 0,v=!1,n=void 0,A="",E(),T(),w()},R=()=>{clearSession(i.storage),B()},k=(t,l)=>{r=!0;const c=getRoadshowPreviewPayload(t,s,l);n=c.roadshowData,_("onJoinSuccess roadshowData",{roadshowData:n,roadshowAuth:c.roadshowAuth,playerStatus:s.status,isLive:s.isLive,liveStatus:s.liveStatus,playerIsAccessWaitingRoom:s.isAccessWaitingRoom}),shouldShowRoadshowPreviewOverlay(c,s,{previewCountdownEnded:g})?(C(!1),E(),e=createRoadshowPreviewOverlay(a.getOverlayHost?.()||a.overlayHost,s,c,{document:i.document,now:i.now,setInterval:u,clearInterval:h,setTimeout:p,clearTimeout:f,locale:o.locale,hideWebFullscreen:!0,hideFullscreen:!0,syncOverlayHost:a.getOverlayHost,onCountdownEnd:()=>{g=!0}})):E(),I("onJoinSuccess"),x()};s.on("onLogout",R),s.on("onJoinSuccess",k),s.on("onJoinError",B),s.on("onError",B),s.on("onExitRoom",B);const F={play:()=>{I("player-play-event")}};s.addListener?.(F),d.push(()=>{s.off?.("onLogout",R),s.off?.("onJoinSuccess",k),s.off?.("onJoinError",B),s.off?.("onError",B),s.off?.("onExitRoom",B),s.removeListener?.(F),B()})}return c=()=>{for(const e of d)e()},new WebPlayer(s,l,c,a)}catch(e){throw l?.destroy(),s?.destroy?.(),c(),a.destroy(),e}}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ComeinRoadshowWebSDK={})}(this,function(exports){"use strict";function _mergeNamespaces(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})}),Object.freeze(e)}const DEFAULT_LOCALE="zh-cn",TEST_UC="fd88e7ff-d7de-45ae-ae2a-9a77906c00d3",PROD_UC="88093483-da5c-44b2-a8ed-1d2413eef57a";function resolveUc(e=!1){return!0===e?PROD_UC:TEST_UC}const DEFAULT_BRIDGE={isThirdParty:!0,isElectron:!1,comein_channel:"zjhw",institute:"zjhw",uc:TEST_UC,hasHome:!1,hideHeader:!0,hideRoadshowDetail:!0,hideAppointment:!0,hideQuestionCollect:!0,hideScreenShot:!0,hideRecommand:!0,hideLiveDocument:!0,hideQuestionMark:!0,hideChat:!1,hideRaise:!1,i18n:!0,hasSubtitle:!0,hideModeSwitch:!0,subtitleMode:"originalLang",enlargeSubtitle:!1,webRtcAutoplay:!0,aliplayerDebugger:!1,player:{skipAuthor:!1,hasSubtitle:!0,hideModeSwitch:!0,hideAppointment:!0,hideQuestionCollect:!0,hideScreenShot:!0,hideRecommand:!0,hideWebFullscreen:!0,hideFullscreen:!1,subtitleMode:"originalLang",enlargeSubtitle:!1,subtitleSkin:"compact",noPermissionText:"无观看权限",ignoreLowDelayTip:!0}};function normalizeOptions(e={}){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("options must be an object");const t="string"==typeof e.roadshowId?e.roadshowId.trim():"",i="string"==typeof e.userInfo?e.userInfo.trim():e.userInfo;if(!t)throw new TypeError("roadshowId is required");if(!i)throw new TypeError("userInfo is required");const n={env:"web",isBuild:!0===e.isBuild,locale:e.locale||DEFAULT_LOCALE,page:"room"};t&&(n.roadshowId=t),void 0!==e.playerType&&(n.playerType=e.playerType),void 0!==e.data&&(n.data=e.data),void 0!==e.axios&&(n.axios=e.axios),n.userInfo=i;const r={...DEFAULT_BRIDGE,...e.bridge||{},isThirdParty:DEFAULT_BRIDGE.isThirdParty,isElectron:DEFAULT_BRIDGE.isElectron,comein_channel:DEFAULT_BRIDGE.comein_channel,institute:DEFAULT_BRIDGE.institute,uc:resolveUc(n.isBuild),hideAppointment:DEFAULT_BRIDGE.hideAppointment,hideQuestionCollect:DEFAULT_BRIDGE.hideQuestionCollect,hideScreenShot:DEFAULT_BRIDGE.hideScreenShot,hideRecommand:DEFAULT_BRIDGE.hideRecommand,player:{...DEFAULT_BRIDGE.player,...e.bridge&&e.bridge.player||{},...e.player||{},hideAppointment:DEFAULT_BRIDGE.player.hideAppointment,hideQuestionCollect:DEFAULT_BRIDGE.player.hideQuestionCollect,hideScreenShot:DEFAULT_BRIDGE.player.hideScreenShot,hideRecommand:DEFAULT_BRIDGE.player.hideRecommand}};return"boolean"==typeof e.hideWebFullscreen&&(r.player.hideWebFullscreen=e.hideWebFullscreen),"boolean"==typeof e.hideFullscreen&&(r.player.hideFullscreen=e.hideFullscreen),n.bridge=r,n}function installRuntime({Vue:e,ElementUI:t,logger:i},n={}){if(!e||!t||!i)throw new TypeError("Vue, ElementUI and logger are required");e.use(t,{size:"small"}),e.use(i,{isBuild:!0===n.isBuild,logstore:n.logstore||"web-sdk",getUserInfo:n.getUserInfo||(()=>n.userInfo||null)})}async function loadRuntime(e={}){const[t,i,n]=await Promise.all([Promise.resolve().then(function(){return vue_runtime_esm}),Promise.resolve().then(function(){return elementUi_common}),Promise.resolve().then(function(){return index_esm$1})]);installRuntime({Vue:t.default||t,ElementUI:i.default||i,logger:n.default||n},e)}const USER_SAVE_KEY="usersave",USER_INFO_KEY="userinfo";function getBrowserStorage(e){return e&&(e.localStorage||e.sessionStorage)?e:"undefined"==typeof globalThis?{}:{localStorage:globalThis.localStorage,sessionStorage:globalThis.sessionStorage}}function encode$2(e){const t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return"function"==typeof btoa?btoa(t):"undefined"!=typeof Buffer?Buffer.from(t,"binary").toString("base64"):e}function saveSession(e,t){if(!e)return clearSession(t),null;const i=getBrowserStorage(t);try{i.localStorage&&(i.localStorage.setItem(USER_SAVE_KEY,"1"),i.localStorage.setItem(USER_INFO_KEY,encode$2(JSON.stringify(e))))}catch(e){}return e}function clearSession(e){const t=getBrowserStorage(e);try{t.localStorage?.removeItem(USER_SAVE_KEY),t.localStorage?.removeItem(USER_INFO_KEY),t.sessionStorage?.removeItem(USER_INFO_KEY)}catch(e){}}const AUTH_ENDPOINTS={channelLogin:"json_user_webchannellogin"},FORMAL_BASE_URL="https://server.comein.cn/comein",TEST_BASE_URL="https://testserver.comein.cn/comein";class WebSdkAuthError extends Error{constructor(e,t="WEB_SDK_AUTH_FAILED"){super(e),this.name="WebSdkAuthError",this.code=t}}function isStandardUserInfo(e){return Boolean(e&&"object"==typeof e&&(e.token||e.webtoken))}function isBuildEnvironment(e){return"boolean"==typeof e.isBuild&&e.isBuild}function getApiBaseUrl(e){return e.apiBaseUrl||(isBuildEnvironment(e)?FORMAL_BASE_URL:TEST_BASE_URL)}function unwrapResponse(e){const t=Number(e?.errorcode??e?.code??0);if(0!==t)throw new WebSdkAuthError(e?.msg||e?.message||"登录失败",t);return e?.data&&"object"==typeof e.data?e.data:e}async function defaultRequest({endpoint:e,body:t,headers:i},n){if("function"!=typeof fetch)throw new WebSdkAuthError("当前环境不支持登录请求","FETCH_UNAVAILABLE");const r=isBuildEnvironment(n),o=resolveUc(r),a=e.split("_"),s=3===a.length?{app:a[0],mod:a[1],act:a[2]}:{},l=3===a.length&&r?"index.php":e,c=await fetch(`${getApiBaseUrl(n).replace(/\/$/,"")}/${l}`,{method:"POST",headers:{"Content-Type":"application/json;charset=utf-8",...s,os:"web",c:"pc",webenv:"comein",uc:o,...i},body:JSON.stringify(t||{})});let d=null;try{d=await c.json()}catch(e){throw new WebSdkAuthError("登录接口返回格式错误","INVALID_AUTH_RESPONSE")}if(!c.ok)throw new WebSdkAuthError(d?.msg||"登录接口请求失败",c.status);return unwrapResponse(d)}async function authenticate(e={},t={}){if(!1===e.auth)return e.userInfo||null;if(isStandardUserInfo(e.userInfo))return saveSession(e.userInfo,t.storage),e.userInfo;const i="string"==typeof e.userInfo?e.userInfo.trim():"";if(!i)throw new WebSdkAuthError("userInfo is required","USER_INFO_REQUIRED");const n=t.request||(t=>defaultRequest(t,e)),r=resolveUc(isBuildEnvironment(e)),o=await n({endpoint:AUTH_ENDPOINTS.channelLogin,body:{uc:r,userinfo:i},headers:{uc:r}});if(!isStandardUserInfo(o))throw new WebSdkAuthError("登录接口未返回有效用户态","INVALID_AUTH_RESPONSE");const a={...o,comein_channel:DEFAULT_BRIDGE.comein_channel,bridge:DEFAULT_BRIDGE};return saveSession(a,t.storage),a}const PUBLIC_TO_RAW={joinSuccess:"onJoinSuccess",joinError:"onJoinError",logout:"onLogout",exitRoom:"onExitRoom",ready:"onReady",canplay:"onCanplay",play:"onPlay",playing:"onPlaying",waiting:"onWaiting",seeking:"onSeeking",seeked:"onSeeked",timeupdate:"onTimeupdate",ended:"onEnded",volume:"onVolume",speed:"onSpeed",error:"onError",fullscreen:"onFullscreen",reload:"reload",dotClick:"dotClick",screenshot:"screenshot",recommendRoadshow:"recommendRoadshow",aiTranslationConfirmed:"onAiTranslationConfirmed",resize:"onResize",modeChange:"modeChange",jumpToHome:"jumpToHome",appointment:"appointed",questionCollect:"questionCollect",benefitRequired:"benefitRequired",webPayDialog:"webPayDialog",visibleFeedback:"visibleFeedback"},RAW_TO_PUBLIC=Object.fromEntries(Object.entries(PUBLIC_TO_RAW).map(([e,t])=>[t,e]));function normalizeEventName(e){return PUBLIC_TO_RAW[e]?e:RAW_TO_PUBLIC[e]||e}function createEventBridge(e){const t=new Map,i=new Map,n=(e,i)=>{const n=t.get(e)||[];for(const e of[...n])e(i)},r={on:(o,a)=>{if("function"!=typeof a)throw new TypeError("event handler must be a function");if(RAW_TO_PUBLIC[o])return e.on(o,a),r;const s=normalizeEventName(o),l=PUBLIC_TO_RAW[s];if(!l)return e.on(o,a),r;if(!t.has(s)){t.set(s,[]);const r=e=>n(s,e);i.set(s,r),e.on(l,r)}return t.get(s).push(a),r},off:(n,o)=>{if(RAW_TO_PUBLIC[n])return e.off(n,o),r;const a=normalizeEventName(n),s=PUBLIC_TO_RAW[a];if(!s)return e.off(n,o),r;const l=t.get(a)||[],c=o?l.filter(e=>e!==o):[];return c.length?t.set(a,c):(e.off(s,i.get(a)),t.delete(a),i.delete(a)),r},emit:n,destroy:()=>{for(const[t,n]of i)e.off(PUBLIC_TO_RAW[t],n);t.clear(),i.clear()}};return r}const PLAYER_LICENSES={"www.uat.rs.cicc.com":{domain:"cicc.com",key:"8P7c84nqEaRF34Tuh19b6aeef7b824558a856ae4327925227"}},LOCAL_HOSTS=new Set(["localhost","127.0.0.1","::1"]);function normalizeHostname(e=""){const t=String(e||"").trim();if(!t)return"";try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname.toLowerCase().replace(/\.$/,"")}catch(e){return t.split("/")[0].split(":")[0].toLowerCase().replace(/\.$/,"")}}function resolvePlayerLicense(e=globalThis.location?.hostname){const t=normalizeHostname(e);if(LOCAL_HOSTS.has(t))return{...PLAYER_LICENSES["www.uat.rs.cicc.com"]};const i=PLAYER_LICENSES[t];return i?{...i}:void 0}async function loadPlayerClass(){const e=await Promise.resolve().then(function(){return index_esm});return e.default||e.ComeinPlayer}const ROADSHOW_PREVIEW_END_HIDE_DELAY=300,ROADSHOW_LIVE_WATCH_INTERVAL=300;function assertContainer(e){if(!("string"==typeof e&&e.trim())&&!(e&&"object"==typeof e))throw new TypeError("player container is required")}function resolveContainer(e,t=globalThis.document){if("string"!=typeof e)return e;const i=t?.querySelector?.(e);if(!i)throw new TypeError(`player container not found: ${e}`);return i}function clearContainer(e){"function"!=typeof e.replaceChildren?(e.textContent="",Array.isArray(e.children)&&(e.children.length=0)):e.replaceChildren()}function setActiveTab(e,t){for(const i of t){const t=i.name===e;i.button.classList?.[t?"add":"remove"]?.("is-active"),i.panel.classList?.[t?"add":"remove"]?.("is-active"),i.panel.hidden=!t}}const TAB_LABELS={"zh-cn":{chat:"互动",question:"问答"},en:{chat:"Interaction",question:"Q&A"},"zh-hant":{chat:"互動",question:"問答"},ja:{chat:"チャット",question:"質疑応答"}};function getTabLabels(e="zh-cn"){return TAB_LABELS[e]||TAB_LABELS["zh-cn"]}function createInteractiveLayout(e,t="zh-cn",i=globalThis.document){const n=resolveContainer(e,i),r=i.createElement("div"),o=i.createElement("div"),a=i.createElement("div"),s=i.createElement("div"),l=i.createElement("aside"),c=i.createElement("div"),d=i.createElement("div"),u=i.createElement("button"),h=i.createElement("button"),p=i.createElement("div"),f=i.createElement("div");r.className="comein-web-sdk-layout",o.className="comein-web-sdk-player-frame",a.className="comein-web-sdk-player",s.className="comein-web-sdk-roadshow-overlay-host",l.className="comein-web-sdk-interaction",c.className="comein-web-sdk-tabs",d.className="comein-web-sdk-panels",u.className="comein-web-sdk-tab is-active",h.className="comein-web-sdk-tab",p.className="comein-web-sdk-panel is-active",f.className="comein-web-sdk-panel",f.hidden=!0,u.type="button",h.type="button";const m=e=>{const t=getTabLabels(e);u.textContent=t.chat,h.textContent=t.question};m(t);const g=[{name:"chat",button:u,panel:p},{name:"question",button:h,panel:f}];u.addEventListener?.("click",()=>setActiveTab("chat",g)),h.addEventListener?.("click",()=>setActiveTab("question",g)),c.append(u,h),d.append(p,f),l.append(c,d),o.append(a,s),r.append(o,l),clearContainer(n),n.appendChild(r),l.hidden=!0;let v,A,_,y=!1;const b=()=>{_&&v?.off?.("changeTab",_),v?.destroy?.(),A?.destroy?.(),_=void 0,v=void 0,A=void 0,y=!1,clearContainer(p),clearContainer(f),setActiveTab("chat",g)};let E;return{playerElement:a,overlayHost:s,getOverlayHost:()=>{const e=a.querySelector?.("#player")||i.getElementById?.("player");return e?.appendChild&&s.parentNode!==e&&e.appendChild(s),s},mountPanels:e=>!!y||!e.isAccessWaitingRoom&&(("function"==typeof e.createChat||"function"==typeof e.createQuestion)&&(y=!0,v=e.createChat?.(p),A=e.createQuestion?.(f),"function"==typeof v?.on&&(_=e=>{"question"===e&&(setActiveTab("question",g),A?.activeMyQuestion?.()),"chat"===e&&setActiveTab("chat",g)},v.on("changeTab",_)),!0)),destroyPanels:b,setInteractionVisible:e=>{if(E&&(globalThis.clearTimeout?.(E),E=void 0),e)return l.hidden=!1,l.offsetWidth,void r.classList?.add?.("has-interaction");r.classList?.remove?.("has-interaction"),E=globalThis.setTimeout?.(()=>{l.hidden=!0,E=void 0},190)},setLocale:m,destroy(){E&&globalThis.clearTimeout?.(E),b(),clearContainer(n)}}}function resolveRoadshowPreviewData(e={},t={}){return e.roadshowData||e.data?.roadshowData||e.initData?.roadshowData||e.store?.state?.roadshowData||(void 0!==e.status||void 0!==e.stime?e:null)||t.roadshowData||t.data?.roadshowData||t.initData?.roadshowData||t.store?.state?.roadshowData||{}}function resolveRoadshowPreviewAuth(e={},t={},i={}){return e.roadshowAuth||e.data?.roadshowAuth||e.initData?.roadshowAuth||e.store?.state?.roadshowAuth||(void 0!==i.code?i:null)||t.roadshowAuth||t.data?.roadshowAuth||t.initData?.roadshowAuth||t.store?.state?.roadshowAuth||{}}const ROADSHOW_STATUS={PREVIEW:0,BLANK:2,PLAYBACK:3,FINISH:-2};function isRoadshowStatus(e,t){return String(e)===String(t)}function isRoadshowPreviewStatus(e){return isRoadshowStatus(e,ROADSHOW_STATUS.PREVIEW)}function isRoadshowEndStatus(e){return isRoadshowStatus(e,ROADSHOW_STATUS.BLANK)||isRoadshowStatus(e,ROADSHOW_STATUS.PLAYBACK)||isRoadshowStatus(e,ROADSHOW_STATUS.FINISH)}function resolveRoadshowPreviewStartTime(e){const t=e?.stime;if(null==t||""===t)return 0;if("number"==typeof t)return t<1e11?1e3*t:t;if(/^\d+$/.test(String(t))){const e=Number(t);return e<1e11?1e3*e:e}const i=Date.parse(t);return Number.isNaN(i)?0:i}function getRoadshowPreviewPayload(e={},t={},i={}){const n=resolveRoadshowPreviewData(e,t);return{roadshowData:n,roadshowAuth:resolveRoadshowPreviewAuth(e,t,i),authPassedByJoinSuccess:!0,cover:n?.logowall169||n?.logo||"",startTime:resolveRoadshowPreviewStartTime(n)}}function shouldShowRoadshowPreviewOverlay(e,t,i={}){const n=e?.roadshowAuth?.code;return(0===n||"0"===n||void 0===n&&!0===e?.authPassedByJoinSuccess)&&isRoadshowPreviewStatus(e?.roadshowData?.status??t?.status)&&!0!==t?.isLive&&!0!==i.previewCountdownEnded}function shouldShowInteractionPanels(e,t,i={}){return!0===e&&!0===t?.isLive&&!0!==i.isAccessWaitingRoom&&!isRoadshowEndStatus(i.status??t?.status)&&!0!==i.hasLiveEnded}const ROADSHOW_PREVIEW_LABELS={"zh-cn":{title:"开播提醒",day:"天",hour:"时",minute:"分",second:"秒",webFullscreen:"网页全屏",exitWebFullscreen:"退出网页全屏",fullscreen:"全屏",exitFullscreen:"退出全屏"},en:{title:"Event Starts in",day:"Day",hour:"Hour",minute:"Minute",second:"Second",webFullscreen:"Web fullscreen",exitWebFullscreen:"Exit web fullscreen",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},"zh-hant":{title:"開播提醒",day:"天",hour:"時",minute:"分",second:"秒",webFullscreen:"網頁全螢幕",exitWebFullscreen:"退出網頁全螢幕",fullscreen:"全螢幕",exitFullscreen:"退出全螢幕"},ja:{title:"配信開始まで",day:"日",hour:"時間",minute:"分",second:"秒",webFullscreen:"ページ全画面",exitWebFullscreen:"ページ全画面を終了",fullscreen:"全画面",exitFullscreen:"全画面を終了"}};function normalizePreviewLocale(e="zh-cn"){const t=String(e||"zh-cn").toLowerCase();return"zh-tw"===t||"zh-hk"===t?"zh-hant":t.startsWith("en")?"en":t.startsWith("ja")?"ja":ROADSHOW_PREVIEW_LABELS[t]?t:"zh-cn"}function getRoadshowPreviewLabels(e="zh-cn"){return ROADSHOW_PREVIEW_LABELS[normalizePreviewLocale(e)]}function padCountdown(e){return String(Math.max(0,e)).padStart(2,"0")}function getRoadshowCountdownParts(e,t){const i=getRoadshowPreviewLabels(t),n="en"===normalizePreviewLocale(t),r=Math.max(0,Math.floor(e/1e3)),o=Math.floor(r/86400);return[...o>0?[{value:o,unit:"day"}]:[],{value:Math.floor(r%86400/3600),unit:"hour"},{value:Math.floor(r%3600/60),unit:"minute"},{value:r%60,unit:"second"}].map(e=>({value:e.value,unit:n&&1!==e.value?`${i[e.unit]}s`:i[e.unit]}))}function formatRoadshowCountdown(e,t="zh-cn"){return getRoadshowCountdownParts(e,t).map(e=>`${padCountdown(e.value)} ${e.unit}`).join(" ")}function setCountdownText(e,t,i,n){const r=getRoadshowCountdownParts(t,n.locale),o=[];for(const e of r){const t=i.createElement("span"),n=i.createElement("span");t.className="comein-web-sdk-roadshow-preview-number",n.className="comein-web-sdk-roadshow-preview-unit",t.textContent=padCountdown(e.value),n.textContent=e.unit,o.push(t,n)}e.textContent=formatRoadshowCountdown(t,n.locale),e.replaceChildren?.(...o)}function toggleClass(e,t,i){if(!e)return;if(e.classList?.add&&e.classList?.remove)return void e.classList[i?"add":"remove"](t);const n=new Set(String(e.className||"").split(/\s+/).filter(Boolean));i?n.add(t):n.delete(t),e.className=[...n].join(" ")}function createRoadshowPreviewFullscreenButton(e,t,i,n,r,o){const a=e.createElement("button"),s=e.createElement("span");return a.type="button",a.className=`comein-web-sdk-roadshow-preview-control ${t}`,s.className=`comein-web-sdk-roadshow-preview-control-icon icon-player ${n}`,a._comeinInactiveIconClass=n,a._comeinActiveIconClass=r,a._comeinIconElement=s,a.setAttribute?.("aria-label",i),a.setAttribute?.("aria-pressed","false"),a.setAttribute?.("data-tooltip",i),a.addEventListener?.("click",e=>{e?.stopPropagation?.(),o()}),a.appendChild(s),a}function createRoadshowPreviewOverlay(e,t,i,n={}){const r=n.document||globalThis.document,o=n.now||(()=>Date.now()),a=n.setInterval||globalThis.setInterval.bind(globalThis),s=n.clearInterval||globalThis.clearInterval.bind(globalThis),l=n.setTimeout||globalThis.setTimeout.bind(globalThis),c=n.clearTimeout||globalThis.clearTimeout.bind(globalThis),d={...getRoadshowPreviewLabels(n.locale||i.locale),locale:normalizePreviewLocale(n.locale||i.locale)},u=r.createElement("div"),h=r.createElement("div"),p=r.createElement("div"),f=r.createElement("div"),m=r.createElement("div"),g=r.createElement("div"),v=r.createElement("div");let A=null,_=null,y=null,b=!1,E=!1,w=!1;u.className="comein-web-sdk-roadshow-preview",u.lang=d.locale,h.className="comein-web-sdk-roadshow-preview-bg",p.className="comein-web-sdk-roadshow-preview-shade",f.className="comein-web-sdk-roadshow-preview-content",m.className="comein-web-sdk-roadshow-preview-title",g.className="comein-web-sdk-roadshow-preview-countdown",v.className="comein-web-sdk-roadshow-preview-controls",i.cover&&(h.style.backgroundImage=`url("${i.cover}")`),m.textContent=d.title;const S=(e,t,i)=>{if(!e)return;e.setAttribute?.("aria-pressed",t?"true":"false"),e.setAttribute?.("aria-label",i),e.setAttribute?.("data-tooltip",i),toggleClass(e,"is-active",t);const n=t?e._comeinActiveIconClass:e._comeinInactiveIconClass;e._comeinIconElement&&n&&(e._comeinIconElement.className=`comein-web-sdk-roadshow-preview-control-icon icon-player ${n}`)},C=()=>{const t=n.syncOverlayHost?.()||e;t?.appendChild&&u.parentNode!==t&&(t.replaceChildren?.(),t.appendChild(u))};let T,I;!0!==n.hideWebFullscreen&&(T=createRoadshowPreviewFullscreenButton(r,"comein-web-sdk-roadshow-preview-web-fullscreen",d.webFullscreen,"icon-player-GWpingmuquanping","icon-player-GWshouqipingmuquanping",()=>{const e=!b;C(),b=!0===e,S(T,b,b?d.exitWebFullscreen:d.webFullscreen),toggleClass(u,"is-web-fullscreen",b),t?.setWebFullscreen?.(e)}),v.appendChild(T)),!0!==n.hideFullscreen&&(I=createRoadshowPreviewFullscreenButton(r,"comein-web-sdk-roadshow-preview-fullscreen",d.fullscreen,"icon-player-GWquanping","icon-player-GWshouqiquanping",()=>{const e=!E;C(),E=!0===e,S(I,E,E?d.exitFullscreen:d.fullscreen),toggleClass(u,"is-fullscreen",E),t?.setFullscreen?.(e)}),v.appendChild(I));const x=()=>{w||(w=!0,A&&s(A),_&&s(_),y&&c(y),A=null,_=null,y=null,u.remove?.())},B=()=>{const e=i.startTime-o();setCountdownText(g,e,r,d),!0!==t?.isLive?e<=0&&(n.onCountdownEnd?.(),y||w||(y=l(()=>{y=null,x()},ROADSHOW_PREVIEW_END_HIDE_DELAY))):x()},R=()=>{!0===t?.isLive&&x()};return f.append(m,g),u.append(h,p,f),v.children?.length&&u.appendChild(v),e.replaceChildren?.(),e.appendChild(u),C(),B(),w||(A=a(B,1e3),_=a(R,1e3)),{destroy:x}}const WEB_PLAYER_INTERNALS=new WeakMap;function getInternalPlayer(e){return WEB_PLAYER_INTERNALS.get(e).player}class WebPlayer{constructor(e,t,i=()=>{},n={destroy(){}}){WEB_PLAYER_INTERNALS.set(this,{player:e,events:t,cleanup:i,layout:n})}on(e,t){return WEB_PLAYER_INTERNALS.get(this).events.on(e,t),this}off(e,t){return WEB_PLAYER_INTERNALS.get(this).events.off(e,t),this}play(...e){return getInternalPlayer(this).play?.(...e)}pause(...e){return getInternalPlayer(this).pause?.(...e)}seek(...e){return getInternalPlayer(this).seek?.(...e)}setMode(...e){return getInternalPlayer(this).setMode?.(...e)}setLocale(...e){const{player:t,layout:i}=WEB_PLAYER_INTERNALS.get(this),n=t.setLocale?.(...e);return i.setLocale?.(e[0]),n}changePage(...e){return getInternalPlayer(this).changePage?.(...e)}setVolume(...e){return getInternalPlayer(this).setVolume?.(...e)}resize(...e){return getInternalPlayer(this).resize?.(...e)}setDotList(...e){return getInternalPlayer(this).setDotList?.(...e)}setOnlyPlayList(...e){return getInternalPlayer(this).setOnlyPlayList?.(...e)}createChat(...e){return getInternalPlayer(this).createChat?.(...e)}createQuestion(...e){return getInternalPlayer(this).createQuestion?.(...e)}destroy(){const{player:e,events:t,cleanup:i,layout:n}=WEB_PLAYER_INTERNALS.get(this);t.destroy(),i(),e.destroy?.(),n.destroy()}get options(){return getInternalPlayer(this).options}get socket(){return getInternalPlayer(this).socket}get verify(){return getInternalPlayer(this).verify}get isTrailer(){return getInternalPlayer(this).isTrailer}get isLive(){return getInternalPlayer(this).isLive}get liveStatus(){return getInternalPlayer(this).liveStatus}get isAccessWaitingRoom(){return getInternalPlayer(this).isAccessWaitingRoom}get status(){return getInternalPlayer(this).status}get isLiveRoadshow(){return getInternalPlayer(this).isLiveRoadshow}get liveMode(){return getInternalPlayer(this).liveMode}get mode(){return getInternalPlayer(this).mode}get locale(){return getInternalPlayer(this).locale}get volume(){return getInternalPlayer(this).volume}get roadshowId(){return getInternalPlayer(this).roadshowId}get user(){return getInternalPlayer(this).user}get hasPlayback(){return getInternalPlayer(this).hasPlayback}get pdfData(){return getInternalPlayer(this).pdfData}get raiseStatus(){return getInternalPlayer(this).raiseStatus}}async function createWebPlayer(e,t={},i={}){assertContainer(e),normalizeOptions(t);const n=await(i.authenticate||authenticate)(t,i),r={...t};n&&(r.userInfo=n);const o=normalizeOptions(r),a=createInteractiveLayout(e,o.locale,i.document);let s,l,c=()=>{};const d=[],u=i.setInterval||globalThis.setInterval.bind(globalThis),h=i.clearInterval||globalThis.clearInterval.bind(globalThis),p=i.setTimeout||globalThis.setTimeout.bind(globalThis),f=i.clearTimeout||globalThis.clearTimeout.bind(globalThis),m=i.requestAnimationFrame||globalThis.requestAnimationFrame?.bind(globalThis)||(e=>globalThis.setTimeout(e,0));try{i.bootstrap?await i.bootstrap(o):i.PlayerClass||await loadRuntime(o);const e=i.PlayerClass||await loadPlayerClass(),t=(i.resolvePlayerLicense||resolvePlayerLicense)(i.hostname||globalThis.location?.hostname);if(t&&(o.license=t),s=new e(a.playerElement,o),l=createEventBridge(s),"function"==typeof s.on){let e,t,n,r=!1,l=null,c=!1,g=!1,v=!1,A="";const _=(e,t)=>{},y=()=>!0===s.isAccessWaitingRoom||!0===n?.isAccessWaitingRoom,b=(e,t,i={})=>{const o={reason:e,action:t,hasJoinSuccess:r,playerStatus:s.status,roadshowDataStatus:n?.status,isLive:s.isLive,liveStatus:s.liveStatus,playerIsAccessWaitingRoom:s.isAccessWaitingRoom,roadshowDataIsAccessWaitingRoom:n?.isAccessWaitingRoom,isAccessWaitingRoom:y(),hasLiveEnded:v,interactionVisible:c,previewCountdownEnded:g,...i},a=JSON.stringify(o);a!==A&&(A=a,_("判断互动/预告状态",o))},E=()=>{e?.destroy?.(),e=void 0},w=()=>{l&&h(l),l=null},S=()=>{s.resize?.(),m(()=>{s.resize?.()}),p(()=>{s.resize?.()},190)},C=e=>{c!==e&&(c=e,a.setInteractionVisible?.(e),S())},T=()=>{C(!1),a.destroyPanels?.()},I=(e="watch")=>{const i=s.isLive,o=s.liveStatus,l=s.status??n?.status,c=isRoadshowEndStatus(l),d=y();if(!0===t&&!1===o&&(v=!0),!0===o&&(v=!1),t=o,c)return b(e,"hide-interaction:end-status",{isEndStatus:c}),E(),T(),void w();if(!0===i&&E(),shouldShowInteractionPanels(r,s,{hasLiveEnded:v,isAccessWaitingRoom:d,status:l})){C(!0);const t=a.mountPanels?.(s);return!0!==t&&C(!1),void b(e,!0===t?"show-interaction":"hide-interaction:mount-failed",{isEndStatus:c,mounted:t})}b(e,"hide-interaction:condition-false",{isEndStatus:c}),T()},x=()=>{w(),l=u(I,ROADSHOW_LIVE_WATCH_INTERVAL)},B=()=>{r=!1,g=!1,t=void 0,v=!1,n=void 0,A="",E(),T(),w()},R=()=>{clearSession(i.storage),B()},k=(t,l)=>{r=!0;const c=getRoadshowPreviewPayload(t,s,l);n=c.roadshowData,_("onJoinSuccess roadshowData",{roadshowData:n,roadshowAuth:c.roadshowAuth,playerStatus:s.status,isLive:s.isLive,liveStatus:s.liveStatus,playerIsAccessWaitingRoom:s.isAccessWaitingRoom}),shouldShowRoadshowPreviewOverlay(c,s,{previewCountdownEnded:g})?(C(!1),E(),e=createRoadshowPreviewOverlay(a.getOverlayHost?.()||a.overlayHost,s,c,{document:i.document,now:i.now,setInterval:u,clearInterval:h,setTimeout:p,clearTimeout:f,locale:o.locale,hideWebFullscreen:!0,hideFullscreen:!0,syncOverlayHost:a.getOverlayHost,onCountdownEnd:()=>{g=!0}})):E(),I("onJoinSuccess"),x()};s.on("onLogout",R),s.on("onJoinSuccess",k),s.on("onJoinError",B),s.on("onError",B),s.on("onExitRoom",B);const F={play:()=>{I("player-play-event")}};s.addListener?.(F),d.push(()=>{s.off?.("onLogout",R),s.off?.("onJoinSuccess",k),s.off?.("onJoinError",B),s.off?.("onError",B),s.off?.("onExitRoom",B),s.removeListener?.(F),B()})}return c=()=>{for(const e of d)e()},new WebPlayer(s,l,c,a)}catch(e){throw l?.destroy(),s?.destroy?.(),c(),a.destroy(),e}}
2
2
  /*!
3
3
  * Vue.js v2.7.16
4
4
  * (c) 2014-2023 Evan You
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comein-player-web",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Customer-facing Web SDK built on top of the Comein player SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",