tcic-electron-sdk 1.7.3421 → 1.7.3426
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/build/class.d.ts.map +1 -1
- package/build/version.d.ts +1 -1
- package/dist/boardRenderer.bundle.js +1 -1
- package/dist/cameraRenderer.bundle.js +1 -1
- package/dist/config.json +3 -3
- package/dist/main.bundle.js +1 -1
- package/dist/mainRenderer.bundle.js +1 -1
- package/dist/resource.zip +0 -0
- package/dist/videoRenderer.bundle.js +1 -1
- package/package.json +1 -1
package/build/class.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../src/class.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../src/class.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAwD/D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,oBAAY,UAAU;IACpB,WAAW,IAAI;IACf,IAAI,IAAI;CACT;AACD,oBAAY,aAAa;IACvB,MAAM,KAAK;IACX,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AACD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,iBAAkB,SAAQ,qBAAqB;IAC1D,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,0BAA0B,CAAgC;IAClE,OAAO,CAAC,0BAA0B,CAAgC;IAClE,OAAO,CAAC,yBAAyB,CAAgC;IACjE,OAAO,CAAC,0BAA0B,CAAgC;IAClE,OAAO,CAAC,2BAA2B,CAAgC;IACnE,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,mBAAmB,CAAwB;IACnD,OAAO,CAAC,0BAA0B,CAAS;IAC3C,OAAO,CAAC,4BAA4B,CAAS;IAC7C,OAAO,CAAC,sCAAsC,CAAS;IACvD,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,oBAAoB,CAAgC;IAC5D,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,mCAAmC,CAAS;IACpD,OAAO,CAAC,kCAAkC,CAAS;IACnD,OAAO,CAAC,+BAA+B,CAAS;IAChD,OAAO,CAAC,yBAAyB,CAAoB;IACrD,OAAO,CAAC,+BAA+B,CAAK;IAC5C,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,8BAA8B,CAAM;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAC1C,OAAO,CAAC,2BAA2B,CAAa;IAChD,OAAO,CAAC,iBAAiB,CAKvB;IACF,OAAO,CAAC,sBAAsB,CAAa;IAC3C,OAAO,CAAC,uBAAuB,CAAa;IAC5C,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,MAAM,CAAM;IAEpB;;;;;OAKG;IACU,UAAU,CAAC,GAAG,EAAE,iBAAiB;IAoN9C;;OAEG;IACI,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO;IA2HxC;;OAEG;IACI,KAAK;IAQZ;;OAEG;IACI,IAAI;IAQJ,cAAc,CAAC,OAAO,EAAE,MAAM;IAIrC,SAAS,CAAC,aAAa,IAAI,MAAM;IAIjC,OAAO,CAAC,2BAA2B;IAenC,OAAO,CAAC,mBAAmB;IA+C3B;;;;OAIG;IACH,OAAO,CAAC,4CAA4C;IA8CpD;;OAEG;IACH,OAAO,CAAC,8CAA8C;IAmBtD;;OAEG;IACH,OAAO,CAAC,+CAA+C;IAmBvD;;OAEG;IACH,OAAO,CAAC,yCAAyC;IA2BjD;;OAEG;IACH,OAAO,CAAC,0CAA0C;IAkBlD;;OAEG;IACH,OAAO,CAAC,sCAAsC;IA2B9C;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuG7B,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,mCAAmC;IA4H3C;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA+F9B;;OAEG;IACH,OAAO,CAAC,mCAAmC;IA8D3C;;OAEG;IACH,OAAO,CAAC,oCAAoC;IAoF5C,OAAO,CAAC,6BAA6B;IAgBrC,OAAO,CAAC,4BAA4B;IAOpC;;OAEG;IACH,OAAO,CAAC,kCAAkC;IAoD1C;;OAEG;IACH,OAAO,CAAC,mCAAmC;IAmF3C,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,2BAA2B;IAOnC;;OAEG;IACH,OAAO,CAAC,sCAAsC;IAkB9C;;OAEG;IACH,OAAO,CAAC,qCAAqC;IAkB7C;;OAEG;IACH,OAAO,CAAC,uCAAuC;IAa/C;;OAEG;IACH,OAAO,CAAC,YAAY;IAwHpB,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,sBAAsB;IAW9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0fxB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,gCAAgC;IAwBxC,OAAO,CAAC,oBAAoB;IAgB5B;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA2BlB;;OAEG;IACH,OAAO,CAAC,eAAe;IA4CvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,eAAe;CAMxB"}
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={761:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(933),a=d(o(280));o(376).initSentry();class i{static setVisibleRect(e){e?(0!==i.screenHeight&&0!==i.screenWidth||(i.screenHeight=screen.height,i.screenWidth=screen.width,i.boardElement.style.width=`${screen.width}px`,i.boardElement.style.height=`${screen.height}px`),i.boardWrapElement.style.width=`${e.width}px`,i.boardWrapElement.style.height=`${e.height}px`,i.boardWrapElement.style.left=`${e.x}px`,i.boardWrapElement.style.top=`${e.y}px`,i.boardWrapElement.style.position="absolute"):(i.boardWrapElement.removeAttribute("style"),i.boardElement.removeAttribute("style"))}static updateCursor(){if(!i.teduBoard)return;const e=i.teduBoard.getToolType(),t=i.teduBoard.getBrushColor();if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_PEN){const o=`data:image/svg+xml;charset=utf-8,${escape(`<?xml version="1.0" encoding="UTF-8"?><svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>mouse_pen</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-89.000000, -268.000000)">\n <g id="mouse_pen" transform="translate(89.000000, 268.000000)">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组-13" transform="translate(8.000000, 3.000000)" fill="${t}" stroke="#182E25">\n <path d="M0.756984031,32.1383216 L3.68816089e-13,26.5292023 L17.8941729,7.81597009e-14 L24.5264735,4.47354323 L6.63230058,31.0027455 L0.756984031,32.1383216 Z" id="形状结合"></path>\n </g>\n </g>\n </g>\n </g>\n </svg>`)}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:o,offsetX:10,offsetY:40})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_LINE){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_line</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-785.000000, -272.000000)">\n <g id="mouse_line" transform="translate(785.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <line x1="28.5" y1="7.5" x2="36.5" y2="7.5" id="直线-6" stroke="${t}" stroke-width="2" stroke-linecap="square"></line>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_RECT){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_rectangle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-551.000000, -272.000000)">\n <g id="mouse_rectangle" transform="translate(551.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <rect id="矩形" stroke="${t}" stroke-width="2" x="28" y="3" width="8" height="8"></rect>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),i.teduBoard.setCursorIcon(i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_SQUARE,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_OVAL){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_circle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-323.000000, -272.000000)">\n <g id="mouse_circle" transform="translate(323.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <circle id="椭圆形" stroke="${t}" stroke-width="2" cx="32" cy="7" r="4"></circle>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),i.teduBoard.setCursorIcon(i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_CIRCLE,{cursor:"url",url:r,offsetX:20,offsetY:20})}i.teduBoard.setToolType(e)}static callBoardMethod(e){console.log("callBoardMethod",i.teduBoard,JSON.stringify(e)),i.teduBoard&&(i.teduBoard[e.method].apply(i.teduBoard,e.params),i.updateCursor())}}i.TEduBoard=window.TEduBoard,i.teduBoard=null,i.boardElement=null,i.boardWrapElement=null,i.screenWidth=0,i.screenHeight=0,i.callMethodCache=[],i.isBoardReady=!1,window.BoardRender=i,s.ipcRenderer.on("initBoard",((e,t)=>{const o=window.BoardRender;if(o.teduBoard)return;const r={id:"board",sdkAppId:t.sdkAppId,classId:t.roomId,userId:t.userId,userSig:t.userSig,ratio:`${screen.width}:${screen.height}`,systemCursorEnable:!1,enableLocalMode:!0,styleConfig:{globalBackgroundColor:"rgba(0, 0, 0, 0.01)",textColor:"#ff0000",selectBoxColor:"#727272",cursorSize:[40,40],brushThin:50,selectAnchorColor:"#006eff"}};o.teduBoard=new o.TEduBoard(r),o.teduBoard.on(o.TEduBoard.EVENT.TEB_ERROR,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_WARNING,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_HISTROYDATA_SYNCCOMPLETED,(()=>{o.teduBoard.setToolType(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_MOUSE),o.teduBoard.setHandwritingEnable(!0),o.teduBoard.setCursorIcon(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_ERASER,{cursor:"url",url:"https://res.qcloudtiw.com/board/icons/xkt/eraser.svg",offsetX:7,offsetY:25}),o.updateCursor(),0===o.callMethodCache.length?o.teduBoard.setToolType(0):(o.callMethodCache.forEach((e=>{o.callBoardMethod(e)})),o.callMethodCache=[]),o.isBoardReady=!0})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_SNAPSHOT,(e=>{s.ipcRenderer.send("onScreenShareSnapshot",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANREDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanRedoChange",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANUNDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanUndoChange",e)})),o.setVisibleRect(t.shareWindowBounds)})),s.ipcRenderer.on("onShareWindowBoundsChanged",((e,t)=>{window.BoardRender.setVisibleRect(t)})),s.ipcRenderer.on("callMethod",((e,t)=>{const o=window.BoardRender;o.isBoardReady?o.callBoardMethod(t):o.callMethodCache.push(t)}));const l=["touchstart","touchend"];s.ipcRenderer.on("enableWatchMouseMoveEvent",((e,t)=>{a.watchEvents(document,l,t)})),window.onload=()=>{i.boardWrapElement=document.getElementById("board-wrap"),i.boardElement=document.getElementById("board")}},280:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.watchEvents=void 0;const r=o(933);o(376).initSentry();const n=e=>{let t,o;if(e instanceof TouchEvent?(t=Math.round(e.changedTouches[0].screenX),o=Math.round(e.changedTouches[0].screenY)):(t=e.screenX,o=e.screenY),0!==t||0!==o){const n={type:e.type,x:t,y:o};r.ipcRenderer.send("onMouseEvent",n),console.log("onMouseEvent",n)}};t.watchEvents=function(e,t,o){t.forEach((t=>{o?e.addEventListener(t,n,{capture:!0,passive:!1}):e.removeEventListener(t,n,{capture:!0})}))}},376:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const s=d(o(933)),a=o(425),i=o(648),l={userId:""};function c(e,t=null){l.userId=e,a.configureScope((e=>{console.log("setReportInfo",i.tcicSdkVersion,l.userId),e.setTag("extra.sdk",i.tcicSdkVersion),e.setUser({id:l.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=c,"renderer"===process.type&&s.ipcRenderer.on("setReportInfo",((e,t)=>{c(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};a.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.421",t.tcicSdkBranch="1.7.3"},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};!function o(r){var n=t[r];if(void 0!==n)return n.exports;var d=t[r]={exports:{}};return e[r].call(d.exports,d,d.exports,o),d.exports}(761)})();
|
|
1
|
+
(()=>{"use strict";var e={761:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(933),a=d(o(280));o(376).initSentry();class i{static setVisibleRect(e){e?(0!==i.screenHeight&&0!==i.screenWidth||(i.screenHeight=screen.height,i.screenWidth=screen.width,i.boardElement.style.width=`${screen.width}px`,i.boardElement.style.height=`${screen.height}px`),i.boardWrapElement.style.width=`${e.width}px`,i.boardWrapElement.style.height=`${e.height}px`,i.boardWrapElement.style.left=`${e.x}px`,i.boardWrapElement.style.top=`${e.y}px`,i.boardWrapElement.style.position="absolute"):(i.boardWrapElement.removeAttribute("style"),i.boardElement.removeAttribute("style"))}static updateCursor(){if(!i.teduBoard)return;const e=i.teduBoard.getToolType(),t=i.teduBoard.getBrushColor();if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_PEN){const o=`data:image/svg+xml;charset=utf-8,${escape(`<?xml version="1.0" encoding="UTF-8"?><svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>mouse_pen</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-89.000000, -268.000000)">\n <g id="mouse_pen" transform="translate(89.000000, 268.000000)">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组-13" transform="translate(8.000000, 3.000000)" fill="${t}" stroke="#182E25">\n <path d="M0.756984031,32.1383216 L3.68816089e-13,26.5292023 L17.8941729,7.81597009e-14 L24.5264735,4.47354323 L6.63230058,31.0027455 L0.756984031,32.1383216 Z" id="形状结合"></path>\n </g>\n </g>\n </g>\n </g>\n </svg>`)}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:o,offsetX:10,offsetY:40})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_LINE){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_line</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-785.000000, -272.000000)">\n <g id="mouse_line" transform="translate(785.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <line x1="28.5" y1="7.5" x2="36.5" y2="7.5" id="直线-6" stroke="${t}" stroke-width="2" stroke-linecap="square"></line>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_RECT){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_rectangle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-551.000000, -272.000000)">\n <g id="mouse_rectangle" transform="translate(551.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <rect id="矩形" stroke="${t}" stroke-width="2" x="28" y="3" width="8" height="8"></rect>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),i.teduBoard.setCursorIcon(i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_SQUARE,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_OVAL){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_circle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-323.000000, -272.000000)">\n <g id="mouse_circle" transform="translate(323.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <circle id="椭圆形" stroke="${t}" stroke-width="2" cx="32" cy="7" r="4"></circle>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;i.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),i.teduBoard.setCursorIcon(i.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_CIRCLE,{cursor:"url",url:r,offsetX:20,offsetY:20})}i.teduBoard.setToolType(e)}static callBoardMethod(e){console.log("callBoardMethod",i.teduBoard,JSON.stringify(e)),i.teduBoard&&(i.teduBoard[e.method].apply(i.teduBoard,e.params),i.updateCursor())}}i.TEduBoard=window.TEduBoard,i.teduBoard=null,i.boardElement=null,i.boardWrapElement=null,i.screenWidth=0,i.screenHeight=0,i.callMethodCache=[],i.isBoardReady=!1,window.BoardRender=i,s.ipcRenderer.on("initBoard",((e,t)=>{const o=window.BoardRender;if(o.teduBoard)return;const r={id:"board",sdkAppId:t.sdkAppId,classId:t.roomId,userId:t.userId,userSig:t.userSig,ratio:`${screen.width}:${screen.height}`,systemCursorEnable:!1,enableLocalMode:!0,styleConfig:{globalBackgroundColor:"rgba(0, 0, 0, 0.01)",textColor:"#ff0000",selectBoxColor:"#727272",cursorSize:[40,40],brushThin:50,selectAnchorColor:"#006eff"}};o.teduBoard=new o.TEduBoard(r),o.teduBoard.on(o.TEduBoard.EVENT.TEB_ERROR,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_WARNING,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_HISTROYDATA_SYNCCOMPLETED,(()=>{o.teduBoard.setToolType(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_MOUSE),o.teduBoard.setHandwritingEnable(!0),o.teduBoard.setCursorIcon(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_ERASER,{cursor:"url",url:"https://res.qcloudtiw.com/board/icons/xkt/eraser.svg",offsetX:7,offsetY:25}),o.updateCursor(),0===o.callMethodCache.length?o.teduBoard.setToolType(0):(o.callMethodCache.forEach((e=>{o.callBoardMethod(e)})),o.callMethodCache=[]),o.isBoardReady=!0})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_SNAPSHOT,(e=>{s.ipcRenderer.send("onScreenShareSnapshot",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANREDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanRedoChange",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANUNDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanUndoChange",e)})),o.setVisibleRect(t.shareWindowBounds)})),s.ipcRenderer.on("onShareWindowBoundsChanged",((e,t)=>{window.BoardRender.setVisibleRect(t)})),s.ipcRenderer.on("callMethod",((e,t)=>{const o=window.BoardRender;o.isBoardReady?o.callBoardMethod(t):o.callMethodCache.push(t)}));const l=["touchstart","touchend"];s.ipcRenderer.on("enableWatchMouseMoveEvent",((e,t)=>{a.watchEvents(document,l,t)})),window.onload=()=>{i.boardWrapElement=document.getElementById("board-wrap"),i.boardElement=document.getElementById("board")}},280:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.watchEvents=void 0;const r=o(933);o(376).initSentry();const n=e=>{let t,o;if(e instanceof TouchEvent?(t=Math.round(e.changedTouches[0].screenX),o=Math.round(e.changedTouches[0].screenY)):(t=e.screenX,o=e.screenY),0!==t||0!==o){const n={type:e.type,x:t,y:o};r.ipcRenderer.send("onMouseEvent",n),console.log("onMouseEvent",n)}};t.watchEvents=function(e,t,o){t.forEach((t=>{o?e.addEventListener(t,n,{capture:!0,passive:!1}):e.removeEventListener(t,n,{capture:!0})}))}},376:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const s=d(o(933)),a=o(425),i=o(648),l={userId:""};function c(e,t=null){l.userId=e,a.configureScope((e=>{console.log("setReportInfo",i.tcicSdkVersion,l.userId),e.setTag("extra.sdk",i.tcicSdkVersion),e.setUser({id:l.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=c,"renderer"===process.type&&s.ipcRenderer.on("setReportInfo",((e,t)=>{c(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};a.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.426",t.tcicSdkBranch="1.7.3"},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};!function o(r){var n=t[r];if(void 0!==n)return n.exports;var d=t[r]={exports:{}};return e[r].call(d.exports,d,d.exports,o),d.exports}(761)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={376:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const o=s(n(933)),d=n(425),c=n(648),a={userId:""};function u(e,t=null){a.userId=e,d.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,a.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:a.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=u,"renderer"===process.type&&o.ipcRenderer.on("setReportInfo",((e,t)=>{u(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};d.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.
|
|
1
|
+
(()=>{"use strict";var e={376:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const o=s(n(933)),d=n(425),c=n(648),a={userId:""};function u(e,t=null){a.userId=e,d.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,a.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:a.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=u,"renderer"===process.type&&o.ipcRenderer.on("setReportInfo",((e,t)=>{u(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};d.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.426",t.tcicSdkBranch="1.7.3"},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}(()=>{const e=n(933);n(376).initSentry();class t{constructor(){this._videoElement=document.getElementById("camera"),this._videoElement.addEventListener("timeupdate",(()=>{})),this._videoElement.addEventListener("durationchange",(()=>{})),this._videoElement.addEventListener("seeked",(()=>{})),this._videoElement.addEventListener("playing",(()=>{e.ipcRenderer.send("playing",{width:this._params.width,height:this._params.height})}))}static get instance(){return null===this._instance&&(this._instance=new t),this._instance}start(e){return new Promise(((t,n)=>{this._params=e,navigator.mediaDevices.enumerateDevices().then((t=>{const i=t.filter((e=>"videoinput"===e.kind));navigator.mediaDevices.getUserMedia({video:{deviceId:i[e.deviceIndex].deviceId,aspectRatio:1.7777777778,width:e.width,height:e.height},audio:!1}).then((e=>{this._videoElement.srcObject=e,this._videoElement.play()})).catch((e=>{n(e)}))}))}))}stop(){this._videoElement.stop()}}t._instance=null,e.ipcRenderer.on("start",((e,n)=>{t.instance.start(n)}))})()})();
|
package/dist/config.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"resources": [
|
|
3
3
|
{
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "250542f768ed0782694ee81ceda4a09c59d1df12",
|
|
5
5
|
"sdkAppId": "0",
|
|
6
6
|
"schoolId": "0",
|
|
7
|
-
"url": "https://class.qcloudclass.com/1.7.3/cache/
|
|
7
|
+
"url": "https://class.qcloudclass.com/1.7.3/cache/offline_250542f768ed0782694ee81ceda4a09c59d1df12.zip",
|
|
8
8
|
"files": {
|
|
9
9
|
},
|
|
10
10
|
"regexes": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"supportFomats": "mp4|rmvb|avi|mov|flv|wmv|m3u8|mpeg|mp3|wav|pcm|aac|ogg"
|
|
26
26
|
},
|
|
27
27
|
"expired": 200,
|
|
28
|
-
"devBuildTime":
|
|
28
|
+
"devBuildTime": 1683877049,
|
|
29
29
|
"domains": {
|
|
30
30
|
"www.xxx.com": [
|
|
31
31
|
"www.aaa.com"
|
package/dist/main.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TCIC=t():e.TCIC=t()}(global,(function(){return(()=>{"use strict";var e={555:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TencentCloudClass=t.TClassSubType=t.TClassType=void 0;const c=a(i(933)),d=a(i(765)),h=a(i(747)),l=a(i(622)),u=s(i(293)),w=s(i(975)),f=i(648),S=i(376),g=i(741),p=s(i(450)),m=s(i(42)),W=a(i(528)),y=a(i(239)),C=i(439),M=i(311);S.initSentry(),g.TIWCacheManager.RegisterAsPrivileged();const b=W.default.use(y.default(((e,t,i)=>{const n=l.default.resolve(__dirname,"..","locales",`${e}.json`);h.default.promises.readFile(n,"utf8").then((e=>{i(null,JSON.parse(e))})).catch((e=>{i(e,null)}))}))).init({lng:"zh",load:"languageOnly",fallbackLng:!1,keySeparator:!1,nsSeparator:!1});let v;if(v="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),h.default.existsSync(v)||h.default.mkdirSync(v,{recursive:!0}),c.default.app.setPath("crashDumps",l.default.join(v,"crash")),"win32"===process.platform){const e=m.getPrimaryDisplaySize();e.width*e.height<=2073600&&(m.getMaxTouches()>1||m.isWin7())&&c.default.app.commandLine.appendSwitch("disable-gpu-compositing"),m.isWin7()&&c.default.app.commandLine.appendSwitch("disable-site-isolation-trials")}const D=new d.default;var I,T;(T=t.TClassType||(t.TClassType={}))[T.Interactive=0]="Interactive",T[T.Live=1]="Live",function(e){e.UnKnow="",e.Interactive="interactive",e.Live="live",e.College="college",e.CoTeaching="coteaching",e.OneOnOne="oneonone",e.RTC="rtc"}(I=t.TClassSubType||(t.TClassSubType={}));class B extends M.TLoggerElectronModule{constructor(){super(...arguments),this.initializeOption=null,this.classUrl="",this.windowTitle="",this.tcicMainView=null,this.tcicBoardView=null,this.isBoardViewLoaded=!1,this.tcicScreenShareVideoWindow=null,this.tcicDefaultEntryMainWindow=null,this.tcicScreenShareMainWindow=null,this.tcicScreenShareBoardWindow=null,this.tcicScreenShareCameraWindow=null,this.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=null,this.videoWindowDevTools=null,this.cameraWindowDevTools=null,this.shouldFullscreen=!1,this.closeAllWindowInvoking=!1,this.callBoardMethodCache=[],this.needToShowTaskbarFix=!1,this.isTaskbarAutoHiddenInDesktopEnabled=!1,this.isTaskbarAutoHiddenInTabletEnabled=!1,this.isShowTaskbarOnMultipleDisplays=!1,this.onAllWindowClosedCallback=null,this.lastSelectedScreenBoardToolType=0,this.ipcListeners=[],this.ipcHandlers=[],this.seriousErrorTimes=0,this.isScreenSharing=!1,this.shareParams=null,this.isMainWindowMaximized=!1,this.mainWindowBoundsBeforeMaximize={},this.gpuInfoWatcher=null,this.checkShareWindowBoundsTimer=null,this.shareWindowBounds={x:0,y:0,width:0,height:0},this.shareMainWindowDisplay=null,this.shareBoardWindowDisplay=null,this.wss=null,this.userId=""}initialize(e){return r(this,void 0,void 0,(function*(){if(this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.url)try{const t=e.url.split("?")[1].split("&");for(const i of t){const t=i.split("=");"schoolid"===t[0]?e.schoolId=parseInt(t[1]):"userid"===t[0]?e.userId=t[1]:"classid"===t[0]?e.classId=parseInt(t[1]):"classtype"===t[0]?e.classType=parseInt(t[1]):"classsubtype"===t[0]?e.classSubType=t[1]:"lng"===t[0]&&(e.lng=t[1])}}catch(t){return console.error("parse url error",e.url),!1}if(e.sign){const t=new Buffer(e.sign.split(".")[1],"base64"),i=JSON.parse(t.toString("utf-8"));e.schoolId=i.school_id,e.classId=i.class_id,e.userId=i.user_id,e.cid=i.cid,e.uid=i.uid,e.scene=i.scene,e.token=e.sign,i.hasOwnProperty("class_type")&&(e.classType=i.class_type),i.hasOwnProperty("class_sub_type")&&(e.classSubType=i.class_sub_type)}this.initializeOption=e,this.userId=e.userId,S.setReportInfo(e.userId);const t=new M.TLoggerConfig;t.sdkAppId=e.schoolId,t.userId=e.userId,t.roomId=e.classId,t.nativeSdkVersion=f.tcicSdkVersion,this._setConfig(t),this._info("Initialize",JSON.stringify(e)),yield b;let i=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}&classtype=${e.classType}&watermark=${e.waterMark?JSON.stringify(e.waterMark):""}`;e.lng&&(i+=`&lng=${e.lng}`,W.default.changeLanguage(e.lng).then()),e.scene&&(i+=`&scene=${e.scene}`),e.classSubType&&(i+=`&classsubtype=${e.classSubType}`),e.debugCss&&(i+=`&debugcss=${e.debugCss}`),e.debugJs&&(i+=`&debugjs=${e.debugJs}`),e.customParams&&(i+=`&${e.customParams}`);let n=e.url;if(!n){const t=f.tcicSdkVersion.split(".");let o=`/${t[0]}.${t[1]}.${t[2]}`;if(f.tcicSdkBranch){const e=f.tcicSdkBranch.match(/^(\d+).(\d+).(\d+).([\w-]+)$/);e&&e[1]===t[0]&&e[2]===t[1]&&e[3]===t[2]&&(o=`/${f.tcicSdkBranch}`)}let s="";e.env&&"prod"!==e.env&&(s=`${e.env}-`),n=`https://${s}class.qcloudclass.com${o}/class.html?${e.env?`env=${e.env}&`:""}${i}`,process.defaultApp&&(process.argv.includes("--local")?n=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${i}`:process.argv.includes("--vm")&&(n=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${i}`))}return this.classUrl=n,this.createAndInitDefaultEntryMainWindow(),c.default.app.whenReady().then((()=>{this.createAndInitWindow()})),c.default.globalShortcut.unregister("CmdOrCtrl+F11"),c.default.globalShortcut.register("CmdOrCtrl+F11",(()=>{this.openDevTools()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+Q"),c.default.globalShortcut.register("CmdOrCtrl+Shift+Q",(()=>{this._info("CmdOrCtrl+Shift+Q"),this.closeAllWindow().then()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+F11"),c.default.globalShortcut.register("CmdOrCtrl+Shift+F11",(()=>{const e={watch_mouse_event:this.watchMouseEventEnabled,touch_optimize_enabled:this.touchScreenOptimizeEnabled,touch_optimize_performed:this.touchScreenOptimizePerformed,gpu_compositing_enabled:c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled"),max_touches:m.getMaxTouches(),primary_screen:m.getPrimaryDisplaySize()||c.default.screen.getPrimaryDisplay().size};"win32"===process.platform&&(e.aero_glass_enabled=c.default.systemPreferences.isAeroGlassEnabled());const t={type:"info",title:W.default.t("系统信息"),message:JSON.stringify(e,null,2),buttons:[W.default.t("关闭"),W.default.t("打开GPU排障页面"),D.get("autoOpenDevTools")?W.default.t("启动时不打开调试工具"):W.default.t("启动时打开调试工具"),D.get("screenShareNotOnTop")?W.default.t("屏幕分享时窗口置顶"):W.default.t("屏幕分享时窗口不置顶"),D.get("screenShareNotSetParent")?W.default.t("屏幕分享时设置父子窗口"):W.default.t("屏幕分享时窗口不设置父子窗口"),D.get("disableCache")?W.default.t("打开本地缓存"):W.default.t("关闭本地缓存"),W.default.t("清除本地记录信息")]};c.default.dialog.showMessageBox(t).then((e=>{switch(e.response){case 1:{const e=new c.default.BrowserWindow({title:W.default.t("GPU排障")});e.setMenu(null),e.loadURL("chrome://gpu"),e.show()}break;case 2:D.set("autoOpenDevTools",!D.get("autoOpenDevTools"));break;case 3:D.set("screenShareNotOnTop",!D.get("screenShareNotOnTop"));break;case 4:D.set("screenShareNotSetParent",!D.get("screenShareNotSetParent"));break;case 5:D.set("disableCache",!D.get("disableCache"));break;case 6:D.clear()}}))})),!0}))}closeAllWindow(e){if(this.closeAllWindowInvoking)return;this._info("CloseAllWindowStart"),this.closeAllWindowInvoking=!0;let t=Promise.resolve();this.tcicMainView&&(this.initializeOption.classSubType===I.College&&this.unInitWSService(),this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),t=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this._info("MainViewDestroyed"),this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let i=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{this._info("BoardViewDestroyed"),this.tcicBoardView=null,this.boardViewDevTools&&this.boardViewDevTools.close(),e()})),this.tcicBoardView.webContents.destroy()})));let o=Promise.resolve();this.tcicScreenShareBoardWindow&&(o=new Promise((e=>{this.tcicScreenShareBoardWindow.once("closed",(()=>{this._info("ShareBoardWindowClosed"),e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{this._info("ShareMainWindowClosed"),e()})),this.tcicScreenShareMainWindow.close()})));let r=Promise.resolve();if(this.tcicScreenShareCameraWindow&&(r=new Promise((e=>{this.tcicScreenShareCameraWindow.once("closed",(()=>{this._info("CameraMainWindowClosed"),e()})),this.tcicScreenShareCameraWindow.close()}))),this.ipcListeners&&(this.ipcListeners.forEach((e=>{c.default.ipcMain.off(e.channel,e.listener)})),this.ipcListeners=[]),this.ipcHandlers&&(this.ipcHandlers.forEach((e=>{c.default.ipcMain.removeHandler(e.channel)})),this.ipcHandlers=[]),this.gpuInfoWatcher&&c.default.app.off("gpu-info-update",this.gpuInfoWatcher),!e){this.tcicDefaultEntryMainWindow&&(i=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this._info("EntryMainWindowClosed"),this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}let a=Promise.resolve();return this.tcicScreenShareVideoWindow&&(a=new Promise((e=>{this.tcicScreenShareVideoWindow.once("closed",(()=>{this._info("ShareVideoWindowClosed"),e()})),this.tcicScreenShareVideoWindow.close()}))),Promise.all([t,i,n,o,s,a,r]).then((()=>{this.closeAllWindowInvoking=!1,this._info("CloseAllWindowFinish")}))}focus(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.focus():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.focus()}show(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()}sendCustomData(e){this.tcicMainView.webContents.send("sendCustomMessage",e)}_getClassName(){return"TencentCloudClass"}closeScreenShareBoardWindow(){this.tcicScreenShareBoardWindow&&(this.tcicScreenShareBoardWindow.getChildWindows().forEach((e=>{e.setParentWindow(null)})),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.getBrowserViews().length>0&&this.tcicScreenShareBoardWindow.removeBrowserView(this.tcicBoardView),this.tcicScreenShareBoardWindow.close())}seriousErrorHandler(e,t=""){this.seriousErrorTimes+=1,this._info("SeriouseError",JSON.stringify({times:this.seriousErrorTimes,reason:e})),console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let i=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=W.default.t("客户端遇到多次异常即将关闭,可从课堂列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:{{reason}} - {{detail}}\n\n用户ID:{{arg_2}}",{reason:e,detail:t,arg_2:this.userId});switch(e){case"clean-exit":case"abnormal-exit":case"killed":i=!1;break;case"oom":n=W.default.t("客户端由于内存不足无法正常工作,请退出其它应用后从课堂列表再次进入\n\n用户ID:{{arg_0}}",{arg_0:this.userId}),i=!1}this.closeAllWindow(i).then((()=>{if(i)this.createAndInitWindow();else{const e={type:"info",title:W.default.t("客户端异常"),message:n,buttons:[W.default.t("退出课堂")]};c.default.dialog.showMessageBox(e).then((()=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,t){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const i=this.tcicScreenShareMainWindow.getPosition(),n=e-i[0],o=t-i[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((e=>{const t=0===e.getBitmap()[3];t!==this.screenShareMainWindowMouseEventIgnored&&(this.screenShareMainWindowMouseEventIgnored=t,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(t,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",t,this.touchScreenOptimizeEnabled),t&&"darwin"===process.platform&&(0===this.lastSelectedScreenBoardToolType||this.tcicScreenShareBoardWindow.isFocused()||this.tcicScreenShareBoardWindow.focus()))}))}enableScreenShareMainWindowTouchScreenOptimize(){!this.touchScreenOptimizePerformed&&this.watchMouseEventEnabled&&this.touchScreenOptimizeEnabled&&(this.touchScreenOptimizePerformed=!0,console.log("enableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!0),this.tcicBoardView&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)))}disableScreenShareMainWindowTouchScreenOptimize(){this.touchScreenOptimizePerformed&&(this.touchScreenOptimizePerformed=!1,console.log("disableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!1),this.tcicScreenShareBoardWindow&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)))}enableScreenShareMainWindowWatchMouseMove(){if(this.watchMouseEventEnabled)return;this.watchMouseEventEnabled=!0,console.log("enableWatchMouseMove");let e=0,t=0;this.watchMouseMoveTimer=setInterval((()=>{const i=c.default.screen.getCursorScreenPoint();i.x===e&&i.y===t||(e=i.x,t=i.y,this.detectScreenShareMainWindowMouseEventIgnored(e,t))}),100),this.enableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow.on("closed",(()=>{this.disableScreenShareMainWindowWatchMouseMove()}))}disableScreenShareMainWindowWatchMouseMove(){this.watchMouseEventEnabled&&(this.watchMouseEventEnabled=!1,console.log("disableWatchMouseMove"),this.watchMouseMoveTimer&&(clearInterval(this.watchMouseMoveTimer),this.watchMouseMoveTimer=null),this.disableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(!1))}patchScreenShareMainWindowClickThrough(){"darwin"===process.platform?this.enableScreenShareMainWindowWatchMouseMove():"win32"===process.platform&&(m.isWin7()||c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")&&(this.enableScreenShareMainWindowWatchMouseMove(),this.gpuInfoWatcher||(this.gpuInfoWatcher=()=>{c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")||this.disableScreenShareMainWindowWatchMouseMove()},c.default.app.on("gpu-info-update",this.gpuInfoWatcher))))}createAndInitMainView(){if(this.tcicMainView)return;this.tcicMainView=new c.default.BrowserView({webPreferences:{preload:l.default.join(__dirname,"mainRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicMainView.webContents.once("dom-ready",(()=>{this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()})),g.TIWCacheManager.EnableWebContentsCache(this.tcicMainView.webContents,!0),this.tcicMainView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),this.tcicMainView.webContents.on("page-title-updated",((e,t,i)=>{i&&(this.windowTitle=t,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(t),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(t))}));const e=`${this.classUrl}&seriousError=${this.seriousErrorTimes}`,t=this.tcicMainView.webContents.loadURL(e);t.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const i=new Promise(((e,t)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{this._info("MainViewDidFinishLoad"),e()})),this.tcicMainView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("MainViewDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));Promise.all([t,i]).then((()=>{this.initializeOption.classSubType===I.College&&this.initWSService(),this._info("MainViewInitFinish"),this.tcicMainView.webContents.focus(),this.tcicMainView.webContents.send("init",JSON.parse(JSON.stringify(this.initializeOption)))})).catch((e=>{this._info("MainViewInitFail",JSON.stringify({error:JSON.stringify(e)}));const t={type:"error",title:"",message:W.default.t("网络异常,课堂加载失败: {{arg_0}}\n\n用户ID:{{arg_1}}",{arg_0:JSON.stringify(e),arg_1:this.userId}),buttons:[W.default.t("退出课堂")]};c.default.dialog.showMessageBox(t).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,t)=>{this._info("MainViewRenderProcessGone",JSON.stringify({reason:t.reason})),this.seriousErrorHandler(t.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this._info("MainViewUnresponsive"),this.seriousErrorHandler("unresponsive")})),this._info("MainViewInit",JSON.stringify({url:e}))}getMainWindowMinSize(e){e||(e="top");const t=c.default.screen.getPrimaryDisplay().workAreaSize;let i=718,n=110+i+45;n>t.height&&(i=Math.ceil(538.5),n=110+i+45,n>t.height&&(i=Math.ceil(359),n=110+i+45));const o=Math.ceil(i/9*16);return{width:Math.max(o,890),height:n}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;this._info("EntryMainWindowInit");const e=this.getMainWindowMinSize();let t=e;if(D.has("MainWindowBounds")&&(t=D.get("MainWindowBounds")),this.initializeOption.classSubType===I.College){const e=c.default.screen.getPrimaryDisplay().workAreaSize,t="win32"===process.platform;this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:e.width,height:e.height,fullscreen:t,resizable:!1,show:!1,frame:!1,maximizable:!1,skipTaskbar:!0,transparent:!0,title:"",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}})}else this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.height,minWidth:e.width,minHeight:e.height,show:!1,frame:!1,maximizable:!1,fullscreen:!1,skipTaskbar:!1,title:this.windowTitle,backgroundColor:"#14181D",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}});this.tcicDefaultEntryMainWindow.setMenu(null);let i=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{if(i&&clearTimeout(i),i=setTimeout((()=>{if(i=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();D.set("MainWindowBounds",e)}}),100),this.tcicScreenShareVideoWindow){const e=this.tcicScreenShareVideoWindow.getBounds();this.resizeScreenShareVideoWindow({width:e.width,height:e.height})}if(this.tcicScreenShareCameraWindow){const e=this.tcicScreenShareCameraWindow.getBounds();this.resizeScreenShareCameraWindow({width:e.width,height:e.height})}})),this.tcicDefaultEntryMainWindow.on("move",(()=>{if(this.tcicScreenShareVideoWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareVideoWindow.setPosition(e[0],e[1])}if(this.tcicScreenShareCameraWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareCameraWindow.setPosition(e[0],e[1])}})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this._info("CloseDefaultEntryMainWindow",JSON.stringify({invoke:this.closeAllWindowInvoking,sharing:this.isScreenSharing})),this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,t){if(!this.tcicBoardView){if(this._info("BoardViewInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(t)})),this.tcicBoardView=new c.default.BrowserView({webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicBoardView.webContents.once("dom-ready",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.show()})),g.TIWCacheManager.EnableWebContentsCache(this.tcicBoardView.webContents,!0),this.tcicBoardView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),t){const i=this.tcicBoardView.webContents.loadFile(l.default.join(__dirname,"board.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{this._info("BoardViewDidFinishLoad"),e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("BoardViewDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));Promise.all([i,n]).then((()=>{this._info("BoardViewInitFinish",JSON.stringify({boardMethodCache:JSON.stringify(this.callBoardMethodCache)})),t.shareWindowBounds={x:this.shareWindowBounds.x-e.bounds.x,y:this.shareWindowBounds.y-e.bounds.y,width:this.shareWindowBounds.width,height:this.shareWindowBounds.height},this.isBoardViewLoaded=!0,this.tcicBoardView.webContents.send("initBoard",t),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{this._info("BoardViewInitFail",JSON.stringify({error:JSON.stringify(e)}))}))}this.tcicBoardView.webContents.on("render-process-gone",((e,t)=>{this._info("BoardViewRenderProcessGone",JSON.stringify({reason:t.reason})),this.seriousErrorHandler(t.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this._info("BoardViewUnResponsive"),this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,t){this._info("BoardWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(t)})),this.tcicScreenShareBoardWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,frame:!1,transparent:!0,hasShadow:!1,skipTaskbar:!1,title:this.windowTitle,minimizable:!0,maximizable:!1,resizable:!1,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareBoardWindow.setMenu(null),this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareBoardWindow.on("restore",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setOpacity(1)})),this.tcicScreenShareBoardWindow.on("closed",(()=>{this.tcicScreenShareBoardWindow=null})),this.tcicScreenShareBoardWindow.on("minimize",(()=>{this.tcicScreenShareMainWindow.restore(),setTimeout((()=>{this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,this.shareParams),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1),console.log("restore board window")}),100)}))}createAndInitScreenShareCameraWindow(e){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null);const t=this.tcicDefaultEntryMainWindow.getBounds();this._info("CameraWindowInit",JSON.stringify({bounds:JSON.stringify(t),params:JSON.stringify(e)})),this.tcicScreenShareCameraWindow=new c.default.BrowserWindow({x:t.x,y:t.y,width:t.width,height:t.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"cameraRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.resizeScreenShareCameraWindow({width:960,height:540}),this.tcicScreenShareCameraWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareCameraWindow.setMenu(null),this.tcicScreenShareCameraWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareCameraWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareCameraWindow.setOpacity(e)}));const i=this.tcicScreenShareCameraWindow.webContents.loadFile(l.default.join(__dirname,"camera.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicScreenShareCameraWindow.webContents.on("did-finish-load",(()=>{this._info("CameraWindowDidFinishLoad"),e()})),this.tcicScreenShareCameraWindow.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("CameraWindowDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));return new Promise(((e,t)=>{Promise.all([i,n]).then((()=>{const t=this.tcicScreenShareCameraWindow.getMediaSourceId().split(":")[1];this._info("CameraWindowInitFinish",JSON.stringify({sourceId:t})),e({sourceId:t})})).catch((e=>{this._info("CameraWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),t(e)}))}))}resizeScreenShareCameraWindow(e){const t=this.tcicDefaultEntryMainWindow.getBounds();e.width>t.width&&(e.height=Math.floor(e.height/e.width*t.width),e.width=t.width),e.height>t.height&&(e.width=Math.floor(e.width/e.height*t.height),e.height=t.height),t.width=e.width,t.height=e.height,this.tcicScreenShareCameraWindow.setBounds(t)}closeScreenShareCameraWindow(){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null)}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(this._info("ShareMainWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height})),this.tcicScreenShareMainWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,transparent:!0,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,resizable:!1,skipTaskbar:!0,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareMainWindow.setMenu(null),this.tcicScreenShareMainWindow.on("close",(e=>{!this.closeAllWindowInvoking&&this.isScreenSharing&&e.preventDefault()})),this.tcicScreenShareMainWindow.on("closed",(()=>{this.tcicScreenShareMainWindow=null})),this.patchScreenShareMainWindowClickThrough())}createAndInitScreenShareVideoWindow(e){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null);const t=this.tcicDefaultEntryMainWindow.getBounds();this._info("VideoWindowInit",JSON.stringify({x:t.x,y:t.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(e)})),this.tcicScreenShareVideoWindow=new c.default.BrowserWindow({x:t.x,y:t.y,width:e.bounds.width,height:e.bounds.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"videoRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareVideoWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareVideoWindow.setMenu(null),this.tcicScreenShareVideoWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareVideoWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}));const i=this.tcicScreenShareVideoWindow.webContents.loadFile(l.default.join(__dirname,"video.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicScreenShareVideoWindow.webContents.on("did-finish-load",(()=>{this._info("VideoWindowDidFinishLoad"),e()})),this.tcicScreenShareVideoWindow.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("VideoWindowDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));return new Promise(((e,t)=>{Promise.all([i,n]).then((()=>{const t=this.tcicScreenShareVideoWindow.getMediaSourceId().split(":")[1];this._info("VideoWindowInitFinish",JSON.stringify({sourceId:t})),e({sourceId:t})})).catch((e=>{this._info("VideoWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),t(e)}))}))}resizeScreenShareVideoWindow(e){const t=this.tcicDefaultEntryMainWindow.getBounds();e.width>t.width&&(e.height=Math.floor(e.height/e.width*t.width),e.width=t.width),e.height>t.height&&(e.width=Math.floor(e.width/e.height*t.height),e.height=t.height),t.width=e.width,t.height=e.height,this.tcicScreenShareVideoWindow.setBounds(t)}closeScreenShareVideoWindow(){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null)}attachMainViewToDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow&&this.tcicMainView){this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.getBrowserViews().length>0&&this.tcicScreenShareMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicDefaultEntryMainWindow.getBrowserViews().length&&this.tcicDefaultEntryMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicDefaultEntryMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachMainViewToScreenShareMainWindow(){if(this.tcicScreenShareMainWindow&&this.tcicMainView){this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicScreenShareMainWindow.getBrowserViews().length&&this.tcicScreenShareMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicScreenShareMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachBoardViewToScreenShareBoardWindow(){if(this.tcicScreenShareBoardWindow&&this.tcicBoardView){this.tcicScreenShareBoardWindow.addBrowserView(this.tcicBoardView);const e=this.tcicScreenShareBoardWindow.getContentBounds();this.tcicBoardView.setBounds({x:0,y:0,width:e.width,height:e.height})}}openDevTools(){const e=c.default.screen.getPrimaryDisplay().size,t=e.width/2,i=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2+t,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 主视图"),webPreferences:{backgroundThrottling:!1}}),this.mainViewDevTools.on("close",(e=>{this.tcicMainView?(e.preventDefault(),this.mainViewDevTools.hide()):this.mainViewDevTools=null})),this.tcicMainView.webContents.setDevToolsWebContents(this.mainViewDevTools.webContents)),this.tcicMainView.webContents.openDevTools({mode:"detach"}),this.mainViewDevTools.show()),this.tcicBoardView&&(this.boardViewDevTools||(this.boardViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 白板"),webPreferences:{backgroundThrottling:!1}}),this.boardViewDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.boardViewDevTools.hide()):this.boardViewDevTools=null})),this.tcicBoardView.webContents.setDevToolsWebContents(this.boardViewDevTools.webContents)),this.tcicBoardView.webContents.openDevTools({mode:"detach"}),this.boardViewDevTools.show()),this.tcicScreenShareVideoWindow&&(this.videoWindowDevTools||(this.videoWindowDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 视频"),webPreferences:{backgroundThrottling:!1}}),this.videoWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.videoWindowDevTools.hide()):this.videoWindowDevTools=null})),this.tcicScreenShareVideoWindow.webContents.setDevToolsWebContents(this.videoWindowDevTools.webContents)),this.tcicScreenShareVideoWindow.webContents.openDevTools({mode:"detach"}),this.videoWindowDevTools.show()),this.tcicScreenShareCameraWindow&&(this.cameraWindowDevTools||(this.cameraWindowDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 辅助摄像头"),webPreferences:{backgroundThrottling:!1}}),this.cameraWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.cameraWindowDevTools.hide()):this.cameraWindowDevTools=null})),this.tcicScreenShareCameraWindow.webContents.setDevToolsWebContents(this.cameraWindowDevTools.webContents)),this.tcicScreenShareCameraWindow.webContents.openDevTools({mode:"detach"}),this.cameraWindowDevTools.show())}callBoardMethod(e){if(this.isBoardViewLoaded){if(this._info("CallBoardMethod",JSON.stringify({params:JSON.stringify(e)})),"board"===e.module){if("setToolType"===e.method){const t=e.params[0];0===t?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=t}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,t){c.default.ipcMain.on(e,t),this.ipcListeners.push({channel:e,listener:t})}addLifecycleIPCHandler(e,t){c.default.ipcMain.handle(e,t),this.ipcHandlers.push({channel:e,handler:t})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,t)=>r(this,void 0,void 0,(function*(){return yield u.get(t)})))),this.addLifecycleIPCListener("callMethod",((e,t)=>{this.callBoardMethod(t)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,t)=>{this.detectScreenShareMainWindowMouseEventIgnored(t.x,t.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,t,i)=>{this.seriousErrorHandler(t,i)})),this.addLifecycleIPCListener("onPageFinished",((e,t)=>{})),this.addLifecycleIPCListener("onCloseWindow",(()=>{this._info("onCloseWindow"),this.closeAllWindow().then()})),this.addLifecycleIPCListener("onMinimizeWindow",(()=>{this.tcicDefaultEntryMainWindow.isMinimized()?(this.tcicDefaultEntryMainWindow.restore(),console.log("TCIC unminimized")):(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.setOpacity(0),this.tcicDefaultEntryMainWindow.minimize(),console.log("TCIC minimized"))})),this.tcicDefaultEntryMainWindow.on("restore",(()=>{if(this.tcicScreenShareVideoWindow){const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}})),this.addLifecycleIPCListener("onMaximizeWindow",(()=>{this.isMainWindowMaximized?(console.log("TCIC unmaximized"),this.isMainWindowMaximized=!1,this.tcicDefaultEntryMainWindow.setResizable(!0),this.tcicDefaultEntryMainWindow.unmaximize(),m.setThickFrame(this.tcicDefaultEntryMainWindow,!0).then((()=>{this.tcicDefaultEntryMainWindow.setBounds(this.mainWindowBoundsBeforeMaximize)}))):(this.mainWindowBoundsBeforeMaximize=this.tcicDefaultEntryMainWindow.getBounds(),m.setThickFrame(this.tcicDefaultEntryMainWindow,!1).then((()=>{console.log("TCIC maximized"),this.isMainWindowMaximized=!0,this.tcicDefaultEntryMainWindow.maximize(),this.tcicDefaultEntryMainWindow.setResizable(!1)})))})),this.addLifecycleIPCListener("onClassLayoutChanged",((e,t)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(t);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const i=this.tcicDefaultEntryMainWindow.getBounds();if(i.width<e.width||i.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height},!0);const t=this.tcicDefaultEntryMainWindow.getBounds();D.set("MainWindowBounds",t),console.log("TCIC resize after layout",t)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,t)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",t)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",t)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",t)})),this.addLifecycleIPCHandler("saveImage",((e,t)=>new Promise(((e,i)=>{const n=i=>{const n=t.base64Data.replace(/^data:image\/\w+;base64,/,""),o=Buffer.from(n,"base64");i?h.default.writeFile(i,o,(i=>{e(i?{snapId:t.snapId,module:"electron",errcode:-5,errmsg:i.message}:{snapId:t.snapId,snapName:t.snapName,totalSlices:1,totalSize:n.length,sliceIndex:0,sliceSize:n.length})})):e({snapId:t.snapId,module:"electron",errcode:0,errmsg:""})};t.dialog?c.default.dialog.showSaveDialog(this.tcicDefaultEntryMainWindow,{defaultPath:t.snapName,title:W.default.t("保存图片"),filters:[{name:"Custom File Type",extensions:["png","jpg"]}]}).then((e=>{n(e.filePath)})):m.getDesktopPath().then((e=>{const i=l.default.join(e,t.snapName);n(i)}))})))),this.addLifecycleIPCHandler("downloadMusic",((e,t)=>new Promise(((e,i)=>{let n;n="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),n=l.default.join(n,"document"),h.default.existsSync(n)||h.default.mkdirSync(n,{recursive:!0});const o=l.default.join(n,`${t.documentId}_${t.url.substring(t.url.lastIndexOf("/")+1)}`);h.default.existsSync(o)?e(o):p.httpRequest(t.url,null,null,o).then((()=>{e(o)})).catch((e=>{i(e)}))})))),this.addLifecycleIPCHandler("loadVideo",((e,t)=>new Promise(((e,i)=>{this.createAndInitScreenShareVideoWindow(t).then((i=>{c.default.ipcMain.once("canplay",((t,n)=>{this.resizeScreenShareVideoWindow(n),e(i)})),this.tcicScreenShareVideoWindow.webContents.send("loadVideo",t.url)}))})))),this.addLifecycleIPCHandler("playVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("playVideo")})),this.addLifecycleIPCHandler("seekVideo",((e,t)=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("seekVideo",t)})),this.addLifecycleIPCHandler("pauseVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("pauseVideo")})),this.addLifecycleIPCHandler("stopVideo",(e=>{this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.webContents.send("stopVideo"),this.closeScreenShareVideoWindow())})),this.addLifecycleIPCHandler("setVideoVolume",((e,t)=>(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("setVideoVolume",t),Promise.resolve()))),this.addLifecycleIPCListener("onVideoTimeSeeked",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeSeeked",t)})),this.addLifecycleIPCListener("onVideoTimeUpdate",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeUpdate",t)})),this.addLifecycleIPCHandler("startSubCamera",((e,t)=>new Promise(((e,i)=>{this.createAndInitScreenShareCameraWindow(t).then((i=>{c.default.ipcMain.once("playing",((t,n)=>{this.resizeScreenShareCameraWindow(n),e(i)})),this.tcicScreenShareCameraWindow.webContents.send("start",t)}))})))),this.addLifecycleIPCHandler("stopSubCamera",((e,t)=>new Promise(((e,t)=>{this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.webContents.send("stop"),this.closeScreenShareCameraWindow()),e()})))),this.addLifecycleIPCHandler("getDeskTopWindows",((e,t)=>new Promise(((e,i)=>{let n=null;"win32"===process.platform?n=m:"darwin"===process.platform&&(n=w),null===n&&i(-2);let o=0;for(const e of t.pptArrName)if(""!==e&&(o=n.getDesktopWindow(e),o>0))break;if(t.bToShare)if(o>0)i(-1);else{for(const e of t.pptArrShareName)if(""!==e&&(o=n.getDesktopWindow(e),o>0))break;o>0?e(o):i(-1)}else o>0?e(o):i(-1)})))),this.addLifecycleIPCHandler("startScreenShare",((e,t,i)=>r(this,void 0,void 0,(function*(){this._info("StartScreenShare",JSON.stringify(t)),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.shareParams=t,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(t);return this.needToShowTaskbarFix="win32"===process.platform&&e.size.width===e.workAreaSize.width&&e.size.height===e.workAreaSize.height,this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled=yield m.isTaskbarAutoHiddenInDesktopEnabled(),this.isTaskbarAutoHiddenInDesktopEnabled&&m.setTaskbarAutoHiddenInDesktopEnabled(!1).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled=yield m.isTaskbarAutoHiddenInTabletEnabled(),this.isTaskbarAutoHiddenInTabletEnabled&&m.setTaskbarAutoHiddenInTabletEnabled(!1).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays=yield m.isShowTaskbarOnMultipleDisplays(),this.isShowTaskbarOnMultipleDisplays||m.setShowTaskbarOnMultipleDisplays(!0).then((()=>{})))),new Promise((e=>{const n=()=>{t.followTarget?(this.shareMainWindowDisplay=this.getDisplay(t),this.shareBoardWindowDisplay=this.shareMainWindowDisplay):(this.shareMainWindowDisplay=this.getCurrentDisplay(),this.shareBoardWindowDisplay=this.getDisplay(t)),i||(this.createAndInitBoardView(this.shareBoardWindowDisplay,t),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,t),this.attachBoardViewToScreenShareBoardWindow(),this.createAndInitScreenShareMainWindow(this.shareMainWindowDisplay),this.attachMainViewToScreenShareMainWindow(),this.tcicScreenShareBoardWindow.hide(),this.tcicScreenShareMainWindow.hide(),setTimeout((()=>{this.tcicScreenShareBoardWindow.show(),this.tcicScreenShareMainWindow.show()}),600)),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.checkShareWindowBoundsTimer=setInterval((()=>{const e=this.getShareWindowBounds(t);if(this.shareWindowBounds.x!==e.x||this.shareWindowBounds.y!==e.y||this.shareWindowBounds.width!==e.width||this.shareWindowBounds.height!==e.height){this.shareWindowBounds=e;const i=this.getDisplay(t);this.shareBoardWindowDisplay.id!==i.id&&(this._info("ShareBoardWindowDisplayChanged",JSON.stringify({from:JSON.stringify(this.shareBoardWindowDisplay.bounds),to:JSON.stringify(i.bounds)})),this.shareBoardWindowDisplay=i,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(i,t),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-i.bounds.x,y:e.y-i.bounds.y,width:e.width,height:e.height})}}),100);const n=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],o=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===t.type?e({excludeShareWindowSourceIds:[n],includeShareWindowSourceIds:[o]}):e({excludeShareWindowSourceIds:[n],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const i=setInterval((()=>{const o=this.getDisplay(t);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(i),n())}),100)}else n()}))})))),this.addLifecycleIPCHandler("hasScreenCapturePermission",(e=>r(this,void 0,void 0,(function*(){return"granted"===c.default.systemPreferences.getMediaAccessStatus("screen")})))),this.addLifecycleIPCHandler("openSystemPreferences",(e=>r(this,void 0,void 0,(function*(){return w.requestScreenCaptureAccess()})))),this.addLifecycleIPCHandler("getExcludeSelectWindows",(e=>r(this,void 0,void 0,(function*(){const e=[];if(this.tcicDefaultEntryMainWindow){const t=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(t)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,t)=>(this._info("StopScreenShare",JSON.stringify(t)),this.isScreenSharing=!1,setTimeout((()=>{this.tcicDefaultEntryMainWindow.show()}),600),this.attachMainViewToDefaultEntryMainWindow(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.close(),this.tcicBoardView&&this.tcicBoardView.webContents.destroy(),this.tcicBoardView=null,this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.close(),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled&&m.setTaskbarAutoHiddenInDesktopEnabled(!0).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled&&m.setTaskbarAutoHiddenInTabletEnabled(!0).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays||m.setShowTaskbarOnMultipleDisplays(!1).then((()=>{})))),Promise.resolve())))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,t){D.get("screenShareNotOnTop")||this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===t.id?D.get("screenShareNotSetParent")?this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"):(this.tcicScreenShareMainWindow.setAlwaysOnTop(!1),this.tcicScreenShareMainWindow.setParentWindow(this.tcicScreenShareBoardWindow),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")):(this.tcicScreenShareMainWindow.setParentWindow(null),this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")))}getShareWindowBounds(e){if(0===e.type){if("win32"===process.platform){const t=m.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,t)}if("darwin"===process.platform)return w.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const t=c.default.screen.getAllDisplays();if(t.length>0){if("win32"===process.platform)return 0===e.type?c.default.screen.getDisplayMatching(m.getWindowBounds(parseInt(e.displayId,10))):c.default.screen.getDisplayMatching(m.getDesktopBounds(parseInt(e.displayId,10)));if("darwin"===process.platform&&0===e.type)return c.default.screen.getDisplayMatching(w.getWindowBounds(parseInt(e.displayId,10)))}for(const i of t)if(i.id.toString()===e.displayId)return i}return this.getCurrentDisplay()}initCacheModule(){return new Promise(((e,t)=>{let i=this.classUrl,n=i.indexOf(".html");-1!==n&&(n=i.length);const o=i.lastIndexOf("/",n);-1===o?c.default.dialog.showErrorBox(W.default.t("出错"),W.default.t("传入非法URL,课堂无法正常初始化: {{arg_0}}",{arg_0:this.classUrl})):i=i.substring(0,o),g.TIWCacheManager.SetCallback((e=>{this.tcicMainView.webContents.send("onVersionUpdate",{force:e})})),g.TIWCacheManager.SetConfig({configUrl:`${i}/cache/tiwcache.json`,configPath:l.default.join(__dirname,"config.json"),resourcePath:l.default.join(__dirname,"resource.zip"),resourceDir:v}).then((()=>{this._info("initCacheModule",JSON.stringify({code:0,error:""})),e()})).catch((t=>{this._info("initCacheModule",JSON.stringify({code:-1,error:JSON.stringify(t)})),e()}))}))}createAndInitWindow(){this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox(W.default.t("出错"),W.default.t("DWM未开启,不支持窗口透明特性"))),this.initCacheModule().then((()=>{g.TIWCacheManager.EnableCache(!D.get("disableCache")),this.createAndInitMainView(),D.get("autoOpenDevTools")&&this.openDevTools(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}initWSService(){this.wss=new C.WebSocketServer({port:18081}),this.wss.on("connection",(e=>{e.on("message",(e=>{try{const t=JSON.parse(e.toString());this.tcicMainView.webContents.send("onReceiveMessage",t)}catch(e){console.error("message format error")}}))})),this.addLifecycleIPCHandler("onReceiveMessage",((e,t)=>new Promise(((e,i)=>{this.wss.clients.forEach((e=>{e.readyState===C.WebSocket.OPEN&&e.send(JSON.stringify(t))})),e()}))))}unInitWSService(){this.wss&&(this.wss.close(),this.wss=null)}}t.TencentCloudClass=B},975:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.requestScreenCaptureAccess=t.macOSVersion=t.getWindowBounds=t.getDesktopWindow=void 0;const a=s(i(124)),c=r(i(420)),d=s(i(728)),h=r(i(451)),l=r(i(747)),u=i(933),w=d.types.void,f=d.types.int,S=d.types.int,g=process.arch.includes("64")?d.types.uint64:d.types.uint32,p=g,m=p,W=p,y=p,C=g,M=d.types.uint32,b=d.types.uint32,v=d.types.int,D=d.types.CString,I=d.types.double,T=h.default({x:I,y:I}),B=h.default({width:I,height:I}),V=h.default({origin:T,size:B}),_=d.refType(V),P=c.default(g),k=134217984;let E,O=null,x=null;if("darwin"===process.platform)try{const e=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");O=a.Library(e,{CGWindowListCopyWindowInfo:[W,[C,M]],CGWindowListCreateDescriptionFromArray:[W,[W]],CGRectMakeWithDictionaryRepresentation:[f,[y,_]],CGWindowListCreateImage:[p,[V,S,S,S]]});const t=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");x=a.Library(t,{CFArrayCreate:[W,[S,P,S,S]],CFStringCreateWithCString:[m,[S,D,b]],CFArrayGetCount:[v,[W]],CFArrayGetValueAtIndex:[p,[W,v]],CFDictionaryGetValue:[p,[y,m]],CFStringGetCString:[f,[m,D,v,b]],CFStringGetCStringPtr:[D,[m,b]],CFStringGetLength:[v,[m]],CFStringGetMaximumSizeForEncoding:[v,[v,b]],CFRelease:[w,[p]]})}catch(e){console.error(e)}function L(){if(!E){const e=(e=>{const t=/<key>ProductVersion<\/key>\s*<string>([\d.]+)<\/string>/.exec(e);if(t)return t[1].replace("10.16","11")})(l.default.readFileSync("/System/Library/CoreServices/SystemVersion.plist","utf8"));if(!e)return;E=(e=>{const{length:t}=e.split(".");return 1===t?`${e}.0.0`:2===t?`${e}.0`:e})(e)}return E}t.getDesktopWindow=function(e){let t=0;if(O&&x){const i=x.CFStringCreateWithCString(0,"kCGWindowName",k),n=O.CGWindowListCopyWindowInfo(1,0),o=x.CFArrayGetCount(n);for(let s=0;s<o;++s){const o=x.CFArrayGetValueAtIndex(n,s),r=x.CFDictionaryGetValue(o,i);let a=x.CFStringGetCStringPtr(r,k);if(null===a&&r>0){const i=x.CFStringGetLength(r),n=x.CFStringGetMaximumSizeForEncoding(i,k)+1,o=new Buffer(n);if(o.type=d.types.CString,x.CFStringGetCString(r,o,n,k)&&(a=o.toString("utf8").replace(/\0/g,"")),a===e){t=1,console.log(`+++++=====${e}++++${a}`);break}}}x.CFRelease(n)}return t},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(O&&x)try{const i=new P(1);i[0]=e;const n=x.CFArrayCreate(0,i,i.length,0),o=O.CGWindowListCreateDescriptionFromArray(n);if(0===o)return t;if(x.CFArrayGetCount(o)>0){const e=x.CFArrayGetValueAtIndex(o,0),i=x.CFStringCreateWithCString(0,"kCGWindowBounds",k),n=x.CFDictionaryGetValue(e,i),s=new V;O.CGRectMakeWithDictionaryRepresentation(n,s.ref()),t.x=s.origin.x,t.y=s.origin.y,t.width=s.size.width,t.height=s.size.height,x.CFRelease(i)}x.CFRelease(o),x.CFRelease(n)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(t)),t},t.macOSVersion=L;let A=!1;t.requestScreenCaptureAccess=function(){if(O&&x)try{const e=L().split(".").map((e=>parseInt(e,10)));if(e[0]<10||10===e[0]&&e[1]<15)return;const t=new V;t.origin.x=0,t.origin.y=0,t.size.width=1,t.size.height=1;const i=O.CGWindowListCreateImage(t,1,0,0);if(x.CFRelease(i),A){const e="security",t="Privacy_ScreenCapture";u.shell.openExternal(`x-apple.systempreferences:com.apple.preference.${e}${t?`?${t}`:""}`)}else A=!0}catch(e){console.error(e)}}},196:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TCIC=void 0;const o=i(555),s=i(648);let r=null;t.TCIC={initialize(e){return n(this,void 0,void 0,(function*(){const t=e.onClose;e.onClose=()=>{t&&t(),r=null},r?this.show():(r=new o.TencentCloudClass,yield r.initialize(e))}))},closeAllWindow(){r&&r.focus()},focus(){r&&r.focus()},show(){r&&r.show()},getVersion:()=>s.tcicSdkVersion},e.exports=t.TCIC},376:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const r=s(i(933)),a=i(425),c=i(648),d={userId:""};function h(e,t=null){d.userId=e,a.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,d.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:d.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=h,"renderer"===process.type&&r.ipcRenderer.on("setReportInfo",((e,t)=>{h(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};a.init(e)}},741:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TIWCacheManager=void 0;const o=n(i(528)),s=i(933),r=n(i(747)),a=n(i(622)),c=n(i(605)),d=n(i(211)),h=n(i(138));var l;!function(e){e[e.None=0]="None",e[e.Downloading=1]="Downloading",e[e.DownloadFailed=2]="DownloadFailed",e[e.DownloadSucc=3]="DownloadSucc"}(l||(l={}));class u{constructor(){this.retentionTime=2592e5,this.url="",this.path="",this.reg="",this.status=l.None,this.createTime=Date.parse((new Date).toString())}}class w{static EnableCache(e){if(w._enabled=e,w._timer&&(clearTimeout(w._timer),w._timer=null),w._enabled&&w._config&&w._serverConfig){const e=()=>{w.RefreshServerConfig().catch((e=>{console.error(e)})),w._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetCallback(e){w._cacheCallback=e}static SetConfig(e){return new Promise(((t,i)=>{w._config=e;const n=w.GetConfigDir(),o=w.GetZipDir(),s=w.GetResourceDir(),a=w.GetDocumentDir(),c=w.GetCourseCacheDir();r.default.existsSync(n)||r.default.mkdirSync(n,{recursive:!0}),r.default.existsSync(o)||r.default.mkdirSync(o,{recursive:!0}),r.default.existsSync(s)||r.default.mkdirSync(s,{recursive:!0}),r.default.existsSync(a)||r.default.mkdirSync(a,{recursive:!0}),c.length>0&&!r.default.existsSync(c)&&r.default.mkdirSync(c,{recursive:!0}),c.length>0&&!w._hadLoadCourseConfig&&(w._hadLoadCourseConfig=!0,w._coursewares.clear(),w.LoadCoursewareConfig());const d=w.GetConfigPath(),l=w.GetZipPath();let u=null;r.default.existsSync(d)&&(u=w.LoadServerConfigFromLocalFile(d),w.IsBundleResourceNew(e.configPath,u)&&(w.RemoveDirSync(s),r.default.promises.unlink(d).then(),r.default.existsSync(l)&&r.default.promises.unlink(l).then(),u=null)),u?(console.info("TIWCacheManager use cache files"),w._serverConfig=u,w.EnableCache(!0),t()):r.default.existsSync(e.configPath)?r.default.existsSync(e.resourcePath)?r.default.promises.copyFile(e.configPath,d).then((()=>{console.info("TIWCacheManager update config file");const n=w.LoadServerConfigFromLocalFile(d);r.default.promises.copyFile(e.resourcePath,l).then((()=>{console.info("TIWCacheManager update resource file");try{w.RemoveDirSync(s),new h.default(l).extractAllTo(s,!0),w._serverConfig=n,w.EnableCache(!0),t()}catch(e){r.default.promises.unlink(d).then(),r.default.promises.unlink(l).then(),console.error("TIWCacheManager resource unzip failed",e),i(e)}})).catch((()=>{i(`TIWCacheManager copyFile file error: ${e.resourcePath}`)}))})).catch((()=>{i(`TIWCacheManager resource file not found: ${e.configPath}`)})):i(`TIWCacheManager resource file not found: ${e.resourcePath}`):i(`TIWCacheManager config file not found: ${e.configPath}`)}))}static PreloadCourseware(e,t=""){if(0===w.GetCourseConfigPath().length)return void Promise.reject("not set courseCacheDir by Call SetConfig");const i=w.GetCoursewarwId(e);if(0===i.length)return void Promise.reject("the zipUrl is not right courseware zip");const n=new u;n.url=e,n.reg=t,n.path=i;let o=!1;if(w._coursewares.hasOwnProperty(i)){const t=w._coursewares.get(i);t.status===l.Downloading&&t.url===e||(w._coursewares.set(i,n),o=!0)}else w._coursewares.set(i,n),o=!0;if(!o)return void Promise.reject("the zipUrl is donwloading");const s=w._coursewares.get(i);s.status=l.Downloading,w.SaveCoursewareConfig();const c=a.default.join(w.GetCourseCacheDir(),i,"/");w.RemoveDirSync(c),r.default.mkdirSync(c);const d=a.default.join(w.GetCourseCacheDir(),n.path,`${Date.parse((new Date).toString())}_tiwcourseware.zip`);return w.HttpRequest(e,null,null,d).then((()=>(new h.default(d).extractAllTo(c,!0),r.default.unlinkSync(d),s.status=l.DownloadSucc,w.SaveCoursewareConfig(),Promise.resolve()))).catch((e=>(r.default.unlinkSync(d),s.status=l.DownloadFailed,w.SaveCoursewareConfig(),Promise.reject("coursezip fetch failed"))))}static RefreshServerConfig(){if(!w._config.configUrl)return Promise.reject(o.default.t("缺少配置文件URL"));if(w._isRefreshing)return Promise.reject(o.default.t("上次刷新未完成"));w._isRefreshing=!0;const e=w.GetConfigPath(!0),t=w._config.configUrl;return w.HttpRequest(t,null,null,e).then((()=>{const t=w.LoadServerConfigFromLocalFile(e),i=w.GetResourceInfo(t);if(!i)return Promise.reject(o.default.t("新配置缺少可用资源信息"));const n=w.GetResourceInfo(w._serverConfig);if(n&&i&&n.version===i.version&&i.devBuildTime<=n.devBuildTime)return Promise.reject(o.default.t("新配置版本低于老配置版本: {{arg_0}} < {{arg_1}}",{arg_0:i.version,arg_1:n.version}));console.log("TIWCacheManager new config fetched",t);const s=w.GetZipPath(!0);return w.HttpRequest(i.url,null,null,s).then((()=>{const i=w.GetResourceDir();w.RemoveDirSync(i),new h.default(s).extractAllTo(i,!0);const n=w.GetConfigPath();r.default.unlinkSync(n),r.default.renameSync(e,n);const o=w.GetZipPath();if(r.default.unlinkSync(o),r.default.renameSync(s,o),w._serverConfig=t,console.log("TIWCacheManager resource prepare done"),w._cacheCallback){const e=w._serverConfig.forceUpdate;w._cacheCallback(e)}return Promise.resolve()})).catch((e=>{r.default.unlinkSync(s),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((t=>{r.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",t)})).finally((()=>{w._isRefreshing=!1}))}static RegisterAsPrivileged(){return s.app.isReady()?(console.error("RegisterAsPrivileged can only be used before the ready event of the app module gets emitted!!!"),!1):(s.protocol.registerSchemesAsPrivileged([{scheme:w.TIWCacheSchemeHttp,privileges:w.TIWCacheSchemePrivileges},{scheme:w.TIWCacheSchemeHttps,privileges:w.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(w._enabled&&w._config&&w._config.resourceDir){const t=w.GetResourceInfo(w._serverConfig);if(t){let i="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(t.files&&t.files.hasOwnProperty(o)){const e=t.files[o];i=e.toLowerCase().startsWith("http")?e:a.default.join(w.GetResourceDir(),e);break}if(!i&&t.regexes)for(const e in t.regexes){let n=t.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const t=new RegExp(`\\$${e}`,"g");n=n.replace(t,s[e])}i=a.default.join(w.GetResourceDir(),n);break}}if(!i&&t.documents)for(const e in t.documents){const n=t.documents[e],s=o.match(e);if(s&&s.length>=3){const e=s[1],t=s[2],c=w.GetDocumentDir();i=o.replace(e,c),r.default.existsSync(i)||w.DownloadDocumentCategory(a.default.join(c,t,n),`${e}/${t}/${n}`);break}}if(!i){const t=w.GetCourseCacheDir();if(t.length>0)for(const[n,o]of w._coursewares)if(0===o.reg.length){const o=e.indexOf(n);if(-1!==o){const s=e.substring(o+n.length+1);i=a.default.join(t,n,s);break}}}}while(0);return r.default.existsSync(i)?console.log("TIWCacheManager GetResourcePath : ==>> Hit :",e,i):i="",i}}return""}static EnableWebContentsCache(e,t){if(t){const t=(e,t)=>{w.TIWCacheFileMap.has(e.url)?(t({path:w.TIWCacheFileMap.get(e.url)}),w.TIWCacheFileMap.delete(e.url)):t({statusCode:404})};e.session.protocol.registerFileProtocol(w.TIWCacheSchemeHttp,t),e.session.protocol.registerFileProtocol(w.TIWCacheSchemeHttps,t),e.session.webRequest.onBeforeRequest(((e,t)=>{let i=e.url;const n=i.indexOf("://"),o=i.substring(0,n).toLowerCase(),s=i.substring(n);if(o===w.TIWCacheSchemeHttp||o===w.TIWCacheSchemeHttps){if(w.TIWCacheFileMap.has(i))return void t({cancel:!1});i=o===w.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void t({cancel:!1});const r=w.GetResourcePath(i);""===r?t({cancel:!1}):r.startsWith("http")?t({cancel:!1,redirectURL:r}):(i="https"===o||o===w.TIWCacheSchemeHttps?w.TIWCacheSchemeHttps+s:w.TIWCacheSchemeHttp+s,w.TIWCacheFileMap.set(i,r),i===e.url?t({cancel:!1}):t({cancel:!1,redirectURL:i}))}))}else e.session.protocol.unregisterProtocol(w.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(w.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,t,i,n){const o=e.toLowerCase().startsWith("https://")?d.default:c.default;return new Promise(((s,a)=>{const c=n?r.default.createWriteStream(n):null,d=i?JSON.stringify(i):null,h=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const l={method:h,headers:t},u=o.request(e,l,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void a(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{s(e)}))}}));i&&u.write(d),c&&(c.on("finish",(()=>s(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>a(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>a(e))):a(e)})),u.end()}))}static GetCoursewarwId(e){const t=new URL(e).pathname;let i=t.lastIndexOf("/");if(-1!==i){const e=t.substring(0,i);if(i=e.lastIndexOf("/"),-1!==i)return e.substring(i+1)}return""}static GetCourseConfigPath(){return void 0!==w._config.courseCacheDir&&w._config.courseCacheDir.length>0?a.default.join(w._config.courseCacheDir,"tiwcache_course_config.json"):""}static LoadServerConfigFromLocalFile(e){const t=r.default.readFileSync(e,"utf8");return JSON.parse(t)}static GetResourceInfo(e){const t=`${w._config.sdkAppId}`,i=`${w._config.schoolId}`;let n=e.resources.find((e=>-1!==t.search(e.sdkAppId)&&-1!==i.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static LoadCoursewareConfig(){const e=w.GetCourseConfigPath();if(r.default.existsSync(e)){w._coursewares.clear();const t=r.default.readFileSync(e,"utf8"),i=JSON.parse(t);for(const e in i)w._coursewares.set(e,i[e]);let n=!1;const o=w.GetCourseCacheDir(),s=Date.parse((new Date).toString());for(const[e,t]of w._coursewares)if(s.valueOf()-t.createTime.valueOf()>t.retentionTime.valueOf()){const i=o+t.path;w.RemoveDirSync(i),w._coursewares.delete(e),n=!0}else t.status!==l.DownloadSucc&&(t.createTime=Date.parse((new Date).toString()),t.status=l.None,n=!0);n&&w.SaveCoursewareConfig()}}static SaveCoursewareConfig(){const e=w.GetCourseConfigPath();r.default.existsSync(e)&&r.default.unlinkSync(e);const t={};for(const[e,i]of w._coursewares)t[e]=i;r.default.writeFileSync(e,JSON.stringify(t))}static GetConfigPath(e){return a.default.join(w.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return a.default.join(w.GetZipDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetLogDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetZipDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetResourceDir(){return a.default.join(w._config.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return a.default.join(w._config.resourceDir,"tiwcache","document")}static GetCourseCacheDir(){return void 0===w._config.courseCacheDir?"":a.default.join(w._config.courseCacheDir,"tiwcache_courseware")}static IsBundleResourceNew(e,t){const i=w.LoadServerConfigFromLocalFile(e),n=w.GetResourceInfo(i),o=w.GetResourceInfo(t);return n&&o&&n.devBuildTime>o.devBuildTime}static DownloadDocumentCategory(e,t){if(r.default.existsSync(e))return w.DownloadDocumentFiles(e,t);if(w._documentState.get(t))return Promise.reject(o.default.t("下载中"));w._documentState.set(t,!0),console.log("TIWCacheManager document downloading",t);const i=a.default.normalize(e.substring(0,e.lastIndexOf(a.default.sep)+1));return r.default.mkdirSync(i),w.HttpRequest(t,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",t,e),w.ClearExpiredDocuments(),w.DownloadDocumentFiles(e,t)))).finally((()=>{w._documentState.set(t,!1)}))}static DownloadDocumentFiles(e,t,i=0){let n=w._documentInfo.get(e);if(!n){if(n=w.LoadDocumentInfoFromLocalFile(e,t),!n)return Promise.reject(o.default.t("课件文件列表解析失败"));n.files.sort(((e,t)=>e.priority-t.priority)),console.log("TIWCacheManager document info",t,n),w._documentInfo.set(e,n)}if(i>=n.files.length)return Promise.resolve();const s=n.files[i];if(!r.default.existsSync(s.path)){const n=s.path.substring(0,s.path.lastIndexOf(a.default.sep)+1);return r.default.mkdirSync(n,{recursive:!0}),console.log("TIWCacheManager document file downloading",t,i),w.HttpRequest(s.url,null,null,s.path).then((()=>(console.log("TIWCacheManager document file downloaded",t,i,s),w.DownloadDocumentFiles(e,t,i+1))))}return w.DownloadDocumentFiles(e,t,i+1)}static LoadDocumentInfoFromLocalFile(e,t){const i=r.default.readFileSync(e,"utf-8"),n=JSON.parse(i);n.path=e,n.url=t;const o=e.substring(0,e.lastIndexOf(a.default.sep)+1),s=t.substring(0,t.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=a.default.join(o,e.name),e.url=`${s}/${e.name}`})),n}static RemoveDirSync(e,t){if(!r.default.existsSync(e))return!0;let i=!0;return r.default.readdirSync(e).forEach((n=>{const o=a.default.join(e,n),s=r.default.statSync(o);!t||t(s)?s.isDirectory()?w.RemoveDirSync(o)||(i=!1):r.default.unlinkSync(o):s.isDirectory()&&w.RemoveDirSync(o,t)||(i=!1)})),!!i&&(r.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;w.RemoveDirSync(w.GetDocumentDir(),(t=>!t.isDirectory()||new Date(t.atime.getTime()+2592e5)<e))}}t.TIWCacheManager=w,w.TIWCacheSchemeHttp="tiw-cache",w.TIWCacheSchemeHttps="tiw-caches",w.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},w.TIWCacheFileMap=new Map,w._enabled=!1,w._timer=null,w._isRefreshing=!1,w._documentState=new Map,w._documentInfo=new Map,w._cacheCallback=null,w._hadLoadCourseConfig=!1,w._coursewares=new Map},450:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.httpRequest=void 0;const o=n(i(211)),s=n(i(605)),r=n(i(747));t.httpRequest=function(e,t,i,n){const a=e.toLowerCase().startsWith("https://")?o.default:s.default;return new Promise(((o,s)=>{const c=n?r.default.createWriteStream(n):null,d=i?JSON.stringify(i):null,h=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const l={method:h,headers:t},u=a.request(e,l,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void s(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{o(e)}))}}));i&&u.write(d),c&&(c.on("finish",(()=>o(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>s(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>s(e))):s(e)})),u.end()}))}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.421",t.tcicSdkBranch="1.7.3"},42:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getDesktopWindow=t.isWin7=t.getDesktopBounds=t.getWindowBounds=t.setThickFrame=t.setShowTaskbarOnMultipleDisplays=t.isShowTaskbarOnMultipleDisplays=t.setTaskbarAutoHiddenInTabletEnabled=t.isTaskbarAutoHiddenInTabletEnabled=t.setTaskbarAutoHiddenInDesktopEnabled=t.isTaskbarAutoHiddenInDesktopEnabled=t.getPrimaryDisplaySize=t.getMaxTouches=t.getDesktopPath=void 0;const c=a(i(124)),d=a(i(747)),h=s(i(87)),l=a(i(622)),u=a(i(728)),w=a(i(451)),f=a(i(26)),S=u.default.types.bool,g=u.default.types.int,p=u.default.types.uint,m=process.arch.includes("64")?u.default.types.uint64:u.default.types.uint32,W=u.default.types.long,y=u.default.types.ulong,C=y,M=process.arch.includes("64")?u.default.types.int64:u.default.types.int32,b=process.arch.includes("64")?u.default.types.ulonglong:y,v=b,D=b,I=b,T=w.default({left:W,top:W,right:W,bottom:W}),B=u.default.refType(T),V=w.default({cbSize:C,hWnd:I,uCallbackMessage:p,uEdge:p,rc:T,lParam:M}),_=u.default.refType(V);let P=null,k=null;if("win32"===process.platform)try{P=c.default.Library("user32",{SendNotifyMessageA:[S,[I,p,m,"string"]],GetSystemMetrics:[g,[g]],FindWindowA:[I,["string",W]],GetWindowLongA:[W,[I,g]],SetWindowLongA:[W,[I,g,W]],GetWindowRect:[S,[I,B]],EnumDisplayMonitors:[S,[D,W,"pointer",M]],FindWindowW:[I,[W,"string"]],FindWindowExW:[I,[W,W,"string","string"]]}),k=c.default.Library("shell32",{SHAppBarMessage:[p,[p,_]]})}catch(e){console.error(e)}const E=function(e){return new Promise(((t,i)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{t(n)})).on("error",(e=>{i(e)}))}))},O=function(e){return new Promise(((t,i)=>{f.default.putValue(e,(e=>{e&&i(e),t()}))}))},x=function(){P&&P.SendNotifyMessageA(65535,26,0,"TraySettings")};t.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=l.default.join(h.homedir(),"Desktop"),t=d.default.existsSync(e);if("win32"===process.platform&&!t){const i="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield E(i).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{t=!0,e=o[i].values.Desktop.value}catch(e){}}return t?e:""}))},t.getMaxTouches=function(){if(P){const e=95;return P.GetSystemMetrics(e)}return 0},t.getPrimaryDisplaySize=function(){if(P){const e=0,t=1;return{width:P.GetSystemMetrics(e),height:P.GetSystemMetrics(t)}}return null},t.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if(k){const e=new V;return e.cbSize=V.size,1===k.SHAppBarMessage(4,e.ref())}return!1}))},t.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if(P&&k){const t=new V;return t.cbSize=V.size,t.hWnd=P.FindWindowA("Shell_TrayWnd",0),t.lParam=e?1:0,k.SHAppBarMessage(10,t.ref()),!0}return!1}))},t.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield E(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},t.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield O(t),x(),!0}catch(e){}return!1}))},t.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield E(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},t.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield O(t),x(),!0}catch(e){}return!1}))},t.setThickFrame=function(e,t){return r(this,void 0,void 0,(function*(){if(P){const i=parseInt(e.getMediaSourceId().split(":")[1],10),n=P.GetWindowLongA(i,-16),o=t?262144|n:-262145&n;return P.SetWindowLongA(i,-16,o),!0}return!1}))},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(P){const i=new T;P.GetWindowRect(e,i.ref())&&(t.x=i.left,t.y=i.top,t.width=i.right-i.left,t.height=i.bottom-i.top)}return t};const L=new Map;t.getDesktopBounds=function(e){let t=L.get(e);if(t)return t;if(t={x:0,y:0,width:0,height:0},P){let i=0;const n=e,o=c.default.Callback(S,[v,D,B,M],((e,o,s,r)=>{if(i+=1,i===n){const e=s.deref();return t.x=e.left,t.y=e.top,t.width=e.right-e.left,t.height=e.bottom-e.top,!1}return!0}));P.EnumDisplayMonitors(0,0,o,0)}return L.set(e,t),t},t.isWin7=function(){const e=h.release().split(".");if(e.length>=3){const t=parseInt(e[0],10),i=parseInt(e[1],10);return!(t>=10||6===t&&i>=2)}return!1},t.getDesktopWindow=function(e){const t=Buffer.from(e,"ucs2"),i=P.FindWindowW(0,t);return console.log(`+++++++++++++++++++++${i}`),i}},425:e=>{e.exports=require("@sentry/electron")},138:e=>{e.exports=require("adm-zip")},933:e=>{e.exports=require("electron")},765:e=>{e.exports=require("electron-store")},124:e=>{e.exports=require("ffi-napi")},747:e=>{e.exports=require("fs")},605:e=>{e.exports=require("http")},211:e=>{e.exports=require("https")},528:e=>{e.exports=require("i18next")},239:e=>{e.exports=require("i18next-resources-to-backend")},87:e=>{e.exports=require("os")},622:e=>{e.exports=require("path")},420:e=>{e.exports=require("ref-array-napi")},728:e=>{e.exports=require("ref-napi")},451:e=>{e.exports=require("ref-struct-napi")},26:e=>{e.exports=require("regedit")},293:e=>{e.exports=require("systeminformation")},311:e=>{e.exports=require("tiw-log")},439:e=>{e.exports=require("ws")}},t={};return function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(196)})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TCIC=t():e.TCIC=t()}(global,(function(){return(()=>{"use strict";var e={555:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TencentCloudClass=t.TClassSubType=t.TClassType=void 0;const c=a(i(933)),d=a(i(765)),h=a(i(747)),l=a(i(622)),u=s(i(293)),w=s(i(975)),f=i(648),S=i(376),g=i(741),p=s(i(450)),m=s(i(42)),W=a(i(528)),y=a(i(239)),C=i(439),M=i(311);let b;if(S.initSentry(),g.TIWCacheManager.RegisterAsPrivileged(),b="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),h.default.existsSync(b)||h.default.mkdirSync(b,{recursive:!0}),c.default.app.setPath("crashDumps",l.default.join(b,"crash")),"win32"===process.platform){const e=m.getPrimaryDisplaySize();e.width*e.height<=2073600&&(m.getMaxTouches()>1||m.isWin7())&&c.default.app.commandLine.appendSwitch("disable-gpu-compositing"),m.isWin7()&&c.default.app.commandLine.appendSwitch("disable-site-isolation-trials")}const v=new d.default;var D,I;(I=t.TClassType||(t.TClassType={}))[I.Interactive=0]="Interactive",I[I.Live=1]="Live",function(e){e.UnKnow="",e.Interactive="interactive",e.Live="live",e.College="college",e.CoTeaching="coteaching",e.OneOnOne="oneonone",e.RTC="rtc"}(D=t.TClassSubType||(t.TClassSubType={}));class T extends M.TLoggerElectronModule{constructor(){super(...arguments),this.initializeOption=null,this.classUrl="",this.windowTitle="",this.tcicMainView=null,this.tcicBoardView=null,this.isBoardViewLoaded=!1,this.tcicScreenShareVideoWindow=null,this.tcicDefaultEntryMainWindow=null,this.tcicScreenShareMainWindow=null,this.tcicScreenShareBoardWindow=null,this.tcicScreenShareCameraWindow=null,this.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=null,this.videoWindowDevTools=null,this.cameraWindowDevTools=null,this.shouldFullscreen=!1,this.closeAllWindowInvoking=!1,this.callBoardMethodCache=[],this.needToShowTaskbarFix=!1,this.isTaskbarAutoHiddenInDesktopEnabled=!1,this.isTaskbarAutoHiddenInTabletEnabled=!1,this.isShowTaskbarOnMultipleDisplays=!1,this.onAllWindowClosedCallback=null,this.lastSelectedScreenBoardToolType=0,this.ipcListeners=[],this.ipcHandlers=[],this.seriousErrorTimes=0,this.isScreenSharing=!1,this.shareParams=null,this.isMainWindowMaximized=!1,this.mainWindowBoundsBeforeMaximize={},this.gpuInfoWatcher=null,this.checkShareWindowBoundsTimer=null,this.shareWindowBounds={x:0,y:0,width:0,height:0},this.shareMainWindowDisplay=null,this.shareBoardWindowDisplay=null,this.wss=null,this.userId=""}initialize(e){return r(this,void 0,void 0,(function*(){if(this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.url)try{const t=e.url.split("?")[1].split("&");for(const i of t){const t=i.split("=");"schoolid"===t[0]?e.schoolId=parseInt(t[1]):"userid"===t[0]?e.userId=t[1]:"classid"===t[0]?e.classId=parseInt(t[1]):"classtype"===t[0]?e.classType=parseInt(t[1]):"classsubtype"===t[0]?e.classSubType=t[1]:"lng"===t[0]&&(e.lng=t[1])}}catch(t){return console.error("parse url error",e.url),!1}if(e.sign){const t=new Buffer(e.sign.split(".")[1],"base64"),i=JSON.parse(t.toString("utf-8"));e.schoolId=i.school_id,e.classId=i.class_id,e.userId=i.user_id,e.cid=i.cid,e.uid=i.uid,e.scene=i.scene,e.token=e.sign,i.hasOwnProperty("class_type")&&(e.classType=i.class_type),i.hasOwnProperty("class_sub_type")&&(e.classSubType=i.class_sub_type)}this.initializeOption=e,this.userId=e.userId,S.setReportInfo(e.userId);const t=new M.TLoggerConfig;t.sdkAppId=e.schoolId,t.userId=e.userId,t.roomId=e.classId,t.nativeSdkVersion=f.tcicSdkVersion,this._setConfig(t),this._info("Initialize",JSON.stringify(e));const i=e.lng||c.default.app.getLocaleCountryCode(),n=/(zh|CN)/g.test(i)?"zh":/jp/g.test(i)?"jp":"en";yield((e="zh")=>W.default.use(y.default(((e,t,i)=>{const n=l.default.resolve(__dirname,"..","locales",`${e}.json`);h.default.promises.readFile(n,"utf8").then((e=>{i(null,JSON.parse(e))})).catch((e=>{i(e,null)}))}))).init({lng:e,load:"languageOnly",fallbackLng:!1,keySeparator:!1,nsSeparator:!1}))(n);let o=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}&classtype=${e.classType}&watermark=${e.waterMark?JSON.stringify(e.waterMark):""}`;e.lng&&(o+=`&lng=${e.lng}`,W.default.changeLanguage(e.lng).then()),e.scene&&(o+=`&scene=${e.scene}`),e.classSubType&&(o+=`&classsubtype=${e.classSubType}`),e.debugCss&&(o+=`&debugcss=${e.debugCss}`),e.debugJs&&(o+=`&debugjs=${e.debugJs}`),e.customParams&&(o+=`&${e.customParams}`);let s=e.url;if(!s){const t=f.tcicSdkVersion.split(".");let i=`/${t[0]}.${t[1]}.${t[2]}`;if(f.tcicSdkBranch){const e=f.tcicSdkBranch.match(/^(\d+).(\d+).(\d+).([\w-]+)$/);e&&e[1]===t[0]&&e[2]===t[1]&&e[3]===t[2]&&(i=`/${f.tcicSdkBranch}`)}let n="";e.env&&"prod"!==e.env&&(n=`${e.env}-`),s=`https://${n}class.qcloudclass.com${i}/class.html?${e.env?`env=${e.env}&`:""}${o}`,process.defaultApp&&(process.argv.includes("--local")?s=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${o}`:process.argv.includes("--vm")&&(s=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${o}`))}return this.classUrl=s,this.createAndInitDefaultEntryMainWindow(),c.default.app.whenReady().then((()=>{this.createAndInitWindow()})),c.default.globalShortcut.unregister("CmdOrCtrl+F11"),c.default.globalShortcut.register("CmdOrCtrl+F11",(()=>{this.openDevTools()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+Q"),c.default.globalShortcut.register("CmdOrCtrl+Shift+Q",(()=>{this._info("CmdOrCtrl+Shift+Q"),this.closeAllWindow().then()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+F11"),c.default.globalShortcut.register("CmdOrCtrl+Shift+F11",(()=>{const e={watch_mouse_event:this.watchMouseEventEnabled,touch_optimize_enabled:this.touchScreenOptimizeEnabled,touch_optimize_performed:this.touchScreenOptimizePerformed,gpu_compositing_enabled:c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled"),max_touches:m.getMaxTouches(),primary_screen:m.getPrimaryDisplaySize()||c.default.screen.getPrimaryDisplay().size};"win32"===process.platform&&(e.aero_glass_enabled=c.default.systemPreferences.isAeroGlassEnabled());const t={type:"info",title:W.default.t("系统信息"),message:JSON.stringify(e,null,2),buttons:[W.default.t("关闭"),W.default.t("打开GPU排障页面"),v.get("autoOpenDevTools")?W.default.t("启动时不打开调试工具"):W.default.t("启动时打开调试工具"),v.get("screenShareNotOnTop")?W.default.t("屏幕分享时窗口置顶"):W.default.t("屏幕分享时窗口不置顶"),v.get("screenShareNotSetParent")?W.default.t("屏幕分享时设置父子窗口"):W.default.t("屏幕分享时窗口不设置父子窗口"),v.get("disableCache")?W.default.t("打开本地缓存"):W.default.t("关闭本地缓存"),W.default.t("清除本地记录信息")]};c.default.dialog.showMessageBox(t).then((e=>{switch(e.response){case 1:{const e=new c.default.BrowserWindow({title:W.default.t("GPU排障")});e.setMenu(null),e.loadURL("chrome://gpu"),e.show()}break;case 2:v.set("autoOpenDevTools",!v.get("autoOpenDevTools"));break;case 3:v.set("screenShareNotOnTop",!v.get("screenShareNotOnTop"));break;case 4:v.set("screenShareNotSetParent",!v.get("screenShareNotSetParent"));break;case 5:v.set("disableCache",!v.get("disableCache"));break;case 6:v.clear()}}))})),!0}))}closeAllWindow(e){if(this.closeAllWindowInvoking)return;this._info("CloseAllWindowStart"),this.closeAllWindowInvoking=!0;let t=Promise.resolve();this.tcicMainView&&(this.initializeOption.classSubType===D.College&&this.unInitWSService(),this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),t=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this._info("MainViewDestroyed"),this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let i=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{this._info("BoardViewDestroyed"),this.tcicBoardView=null,this.boardViewDevTools&&this.boardViewDevTools.close(),e()})),this.tcicBoardView.webContents.destroy()})));let o=Promise.resolve();this.tcicScreenShareBoardWindow&&(o=new Promise((e=>{this.tcicScreenShareBoardWindow.once("closed",(()=>{this._info("ShareBoardWindowClosed"),e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{this._info("ShareMainWindowClosed"),e()})),this.tcicScreenShareMainWindow.close()})));let r=Promise.resolve();if(this.tcicScreenShareCameraWindow&&(r=new Promise((e=>{this.tcicScreenShareCameraWindow.once("closed",(()=>{this._info("CameraMainWindowClosed"),e()})),this.tcicScreenShareCameraWindow.close()}))),this.ipcListeners&&(this.ipcListeners.forEach((e=>{c.default.ipcMain.off(e.channel,e.listener)})),this.ipcListeners=[]),this.ipcHandlers&&(this.ipcHandlers.forEach((e=>{c.default.ipcMain.removeHandler(e.channel)})),this.ipcHandlers=[]),this.gpuInfoWatcher&&c.default.app.off("gpu-info-update",this.gpuInfoWatcher),!e){this.tcicDefaultEntryMainWindow&&(i=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this._info("EntryMainWindowClosed"),this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}let a=Promise.resolve();return this.tcicScreenShareVideoWindow&&(a=new Promise((e=>{this.tcicScreenShareVideoWindow.once("closed",(()=>{this._info("ShareVideoWindowClosed"),e()})),this.tcicScreenShareVideoWindow.close()}))),Promise.all([t,i,n,o,s,a,r]).then((()=>{this.closeAllWindowInvoking=!1,this._info("CloseAllWindowFinish")}))}focus(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.focus():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.focus()}show(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()}sendCustomData(e){this.tcicMainView.webContents.send("sendCustomMessage",e)}_getClassName(){return"TencentCloudClass"}closeScreenShareBoardWindow(){this.tcicScreenShareBoardWindow&&(this.tcicScreenShareBoardWindow.getChildWindows().forEach((e=>{e.setParentWindow(null)})),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.getBrowserViews().length>0&&this.tcicScreenShareBoardWindow.removeBrowserView(this.tcicBoardView),this.tcicScreenShareBoardWindow.close())}seriousErrorHandler(e,t=""){this.seriousErrorTimes+=1,this._info("SeriouseError",JSON.stringify({times:this.seriousErrorTimes,reason:e})),console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let i=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=W.default.t("客户端遇到多次异常即将关闭,可从课堂列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:{{reason}} - {{detail}}\n\n用户ID:{{arg_2}}",{reason:e,detail:t,arg_2:this.userId});switch(e){case"clean-exit":case"abnormal-exit":case"killed":i=!1;break;case"oom":n=W.default.t("客户端由于内存不足无法正常工作,请退出其它应用后从课堂列表再次进入\n\n用户ID:{{arg_0}}",{arg_0:this.userId}),i=!1}this.closeAllWindow(i).then((()=>{if(i)this.createAndInitWindow();else{const e={type:"info",title:W.default.t("客户端异常"),message:n,buttons:[W.default.t("退出课堂")]};c.default.dialog.showMessageBox(e).then((()=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,t){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const i=this.tcicScreenShareMainWindow.getPosition(),n=e-i[0],o=t-i[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((i=>{const n=0===i.getBitmap()[3];if(n!==this.screenShareMainWindowMouseEventIgnored)if(this.screenShareMainWindowMouseEventIgnored=n,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(n,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",n,this.touchScreenOptimizeEnabled),n&&"darwin"===process.platform)0===this.lastSelectedScreenBoardToolType||this.tcicScreenShareBoardWindow.isFocused()||this.tcicScreenShareBoardWindow.focus();else if(n&&"win32"===process.platform&&this.tcicScreenShareBoardWindow&&this.shouldFullscreen){const i=this.shareWindowBounds,n=c.default.screen.getPrimaryDisplay().scaleFactor,o=e/n-i.x,s=t/n-i.y;console.log("should ignore in win board...",this.lastSelectedScreenBoardToolType,o,s,i),0===this.lastSelectedScreenBoardToolType||o<i.width&&s<i.height||this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1)}}))}enableScreenShareMainWindowTouchScreenOptimize(){!this.touchScreenOptimizePerformed&&this.watchMouseEventEnabled&&this.touchScreenOptimizeEnabled&&(this.touchScreenOptimizePerformed=!0,console.log("enableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!0),this.tcicBoardView&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)))}disableScreenShareMainWindowTouchScreenOptimize(){this.touchScreenOptimizePerformed&&(this.touchScreenOptimizePerformed=!1,console.log("disableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!1),this.tcicScreenShareBoardWindow&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)))}enableScreenShareMainWindowWatchMouseMove(){if(this.watchMouseEventEnabled)return;this.watchMouseEventEnabled=!0,console.log("enableWatchMouseMove");let e=0,t=0;this.watchMouseMoveTimer=setInterval((()=>{const i=c.default.screen.getCursorScreenPoint();i.x===e&&i.y===t||(e=i.x,t=i.y,this.detectScreenShareMainWindowMouseEventIgnored(e,t))}),100),this.enableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow.on("closed",(()=>{this.disableScreenShareMainWindowWatchMouseMove()}))}disableScreenShareMainWindowWatchMouseMove(){this.watchMouseEventEnabled&&(this.watchMouseEventEnabled=!1,console.log("disableWatchMouseMove"),this.watchMouseMoveTimer&&(clearInterval(this.watchMouseMoveTimer),this.watchMouseMoveTimer=null),this.disableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(!1))}patchScreenShareMainWindowClickThrough(){"darwin"===process.platform?this.enableScreenShareMainWindowWatchMouseMove():"win32"===process.platform&&(m.isWin7()||c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")&&(this.enableScreenShareMainWindowWatchMouseMove(),this.gpuInfoWatcher||(this.gpuInfoWatcher=()=>{c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")||this.disableScreenShareMainWindowWatchMouseMove()},c.default.app.on("gpu-info-update",this.gpuInfoWatcher))))}createAndInitMainView(){if(this.tcicMainView)return;this.tcicMainView=new c.default.BrowserView({webPreferences:{preload:l.default.join(__dirname,"mainRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicMainView.webContents.once("dom-ready",(()=>{this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()})),g.TIWCacheManager.EnableWebContentsCache(this.tcicMainView.webContents,!0),this.tcicMainView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),this.tcicMainView.webContents.on("page-title-updated",((e,t,i)=>{i&&(this.windowTitle=t,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(t),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(t))}));const e=`${this.classUrl}&seriousError=${this.seriousErrorTimes}`,t=this.tcicMainView.webContents.loadURL(e);t.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const i=new Promise(((e,t)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{this._info("MainViewDidFinishLoad"),e()})),this.tcicMainView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("MainViewDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));Promise.all([t,i]).then((()=>{this.initializeOption.classSubType===D.College&&this.initWSService(),this._info("MainViewInitFinish"),this.tcicMainView.webContents.focus(),this.tcicMainView.webContents.send("init",JSON.parse(JSON.stringify(this.initializeOption)))})).catch((e=>{this._info("MainViewInitFail",JSON.stringify({error:JSON.stringify(e)}));const t={type:"error",title:"",message:W.default.t("网络异常,课堂加载失败: {{arg_0}}\n\n用户ID:{{arg_1}}",{arg_0:JSON.stringify(e),arg_1:this.userId}),buttons:[W.default.t("退出课堂")]};c.default.dialog.showMessageBox(t).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,t)=>{this._info("MainViewRenderProcessGone",JSON.stringify({reason:t.reason})),this.seriousErrorHandler(t.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this._info("MainViewUnresponsive"),this.seriousErrorHandler("unresponsive")})),this._info("MainViewInit",JSON.stringify({url:e}))}getMainWindowMinSize(e){e||(e="top");const t=c.default.screen.getPrimaryDisplay().workAreaSize;let i=718,n=110+i+45;n>t.height&&(i=Math.ceil(538.5),n=110+i+45,n>t.height&&(i=Math.ceil(359),n=110+i+45));const o=Math.ceil(i/9*16);return{width:Math.max(o,890),height:n}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;this._info("EntryMainWindowInit");const e=this.getMainWindowMinSize();let t=e;if(v.has("MainWindowBounds")&&(t=v.get("MainWindowBounds")),this.initializeOption.classSubType===D.College){const e=c.default.screen.getPrimaryDisplay().workAreaSize,t="win32"===process.platform;this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:e.width,height:e.height,fullscreen:t,resizable:!1,show:!1,frame:!1,maximizable:!1,skipTaskbar:!0,transparent:!0,title:"",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}})}else this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.height,minWidth:e.width,minHeight:e.height,show:!1,frame:!1,maximizable:!1,fullscreen:!1,skipTaskbar:!1,title:this.windowTitle,backgroundColor:"#14181D",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}});this.tcicDefaultEntryMainWindow.setMenu(null);let i=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{if(i&&clearTimeout(i),i=setTimeout((()=>{if(i=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();v.set("MainWindowBounds",e)}}),100),this.tcicScreenShareVideoWindow){const e=this.tcicScreenShareVideoWindow.getBounds();this.resizeScreenShareVideoWindow({width:e.width,height:e.height})}if(this.tcicScreenShareCameraWindow){const e=this.tcicScreenShareCameraWindow.getBounds();this.resizeScreenShareCameraWindow({width:e.width,height:e.height})}})),this.tcicDefaultEntryMainWindow.on("move",(()=>{if(this.tcicScreenShareVideoWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareVideoWindow.setPosition(e[0],e[1])}if(this.tcicScreenShareCameraWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareCameraWindow.setPosition(e[0],e[1])}})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this._info("CloseDefaultEntryMainWindow",JSON.stringify({invoke:this.closeAllWindowInvoking,sharing:this.isScreenSharing})),this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,t){if(!this.tcicBoardView){if(this._info("BoardViewInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(t)})),this.tcicBoardView=new c.default.BrowserView({webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicBoardView.webContents.once("dom-ready",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.show()})),g.TIWCacheManager.EnableWebContentsCache(this.tcicBoardView.webContents,!0),this.tcicBoardView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),t){const i=this.tcicBoardView.webContents.loadFile(l.default.join(__dirname,"board.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{this._info("BoardViewDidFinishLoad"),e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("BoardViewDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));Promise.all([i,n]).then((()=>{this._info("BoardViewInitFinish",JSON.stringify({boardMethodCache:JSON.stringify(this.callBoardMethodCache)})),t.shareWindowBounds={x:this.shareWindowBounds.x-e.bounds.x,y:this.shareWindowBounds.y-e.bounds.y,width:this.shareWindowBounds.width,height:this.shareWindowBounds.height},this.isBoardViewLoaded=!0,this.tcicBoardView.webContents.send("initBoard",t),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{this._info("BoardViewInitFail",JSON.stringify({error:JSON.stringify(e)}))}))}this.tcicBoardView.webContents.on("render-process-gone",((e,t)=>{this._info("BoardViewRenderProcessGone",JSON.stringify({reason:t.reason})),this.seriousErrorHandler(t.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this._info("BoardViewUnResponsive"),this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,t){this._info("BoardWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(t)})),this.tcicScreenShareBoardWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,frame:!1,transparent:!0,hasShadow:!1,skipTaskbar:!1,title:this.windowTitle,minimizable:!0,maximizable:!1,resizable:!1,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareBoardWindow.setMenu(null),this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareBoardWindow.on("restore",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setOpacity(1)})),this.tcicScreenShareBoardWindow.on("closed",(()=>{this.tcicScreenShareBoardWindow=null})),this.tcicScreenShareBoardWindow.on("minimize",(()=>{this.tcicScreenShareMainWindow.restore(),setTimeout((()=>{this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,this.shareParams),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1),console.log("restore board window")}),100)}))}createAndInitScreenShareCameraWindow(e){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null);const t=this.tcicDefaultEntryMainWindow.getBounds();this._info("CameraWindowInit",JSON.stringify({bounds:JSON.stringify(t),params:JSON.stringify(e)})),this.tcicScreenShareCameraWindow=new c.default.BrowserWindow({x:t.x,y:t.y,width:t.width,height:t.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"cameraRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.resizeScreenShareCameraWindow({width:960,height:540}),this.tcicScreenShareCameraWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareCameraWindow.setMenu(null),this.tcicScreenShareCameraWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareCameraWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareCameraWindow.setOpacity(e)}));const i=this.tcicScreenShareCameraWindow.webContents.loadFile(l.default.join(__dirname,"camera.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicScreenShareCameraWindow.webContents.on("did-finish-load",(()=>{this._info("CameraWindowDidFinishLoad"),e()})),this.tcicScreenShareCameraWindow.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("CameraWindowDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));return new Promise(((e,t)=>{Promise.all([i,n]).then((()=>{const t=this.tcicScreenShareCameraWindow.getMediaSourceId().split(":")[1];this._info("CameraWindowInitFinish",JSON.stringify({sourceId:t})),e({sourceId:t})})).catch((e=>{this._info("CameraWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),t(e)}))}))}resizeScreenShareCameraWindow(e){const t=this.tcicDefaultEntryMainWindow.getBounds();e.width>t.width&&(e.height=Math.floor(e.height/e.width*t.width),e.width=t.width),e.height>t.height&&(e.width=Math.floor(e.width/e.height*t.height),e.height=t.height),t.width=e.width,t.height=e.height,this.tcicScreenShareCameraWindow.setBounds(t)}closeScreenShareCameraWindow(){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null)}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(this._info("ShareMainWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height})),this.tcicScreenShareMainWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,transparent:!0,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,resizable:!1,skipTaskbar:!0,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareMainWindow.setMenu(null),this.tcicScreenShareMainWindow.on("close",(e=>{!this.closeAllWindowInvoking&&this.isScreenSharing&&e.preventDefault()})),this.tcicScreenShareMainWindow.on("closed",(()=>{this.tcicScreenShareMainWindow=null})),this.patchScreenShareMainWindowClickThrough())}createAndInitScreenShareVideoWindow(e){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null);const t=this.tcicDefaultEntryMainWindow.getBounds();this._info("VideoWindowInit",JSON.stringify({x:t.x,y:t.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(e)})),this.tcicScreenShareVideoWindow=new c.default.BrowserWindow({x:t.x,y:t.y,width:e.bounds.width,height:e.bounds.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"videoRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1,contextIsolation:!1}}),this.tcicScreenShareVideoWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareVideoWindow.setMenu(null),this.tcicScreenShareVideoWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareVideoWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}));const i=this.tcicScreenShareVideoWindow.webContents.loadFile(l.default.join(__dirname,"video.html"));i.then((()=>{S.setReportInfo(this.userId,this.tcicMainView.webContents)}));const n=new Promise(((e,t)=>{this.tcicScreenShareVideoWindow.webContents.on("did-finish-load",(()=>{this._info("VideoWindowDidFinishLoad"),e()})),this.tcicScreenShareVideoWindow.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{this._info("VideoWindowDidFailLoad",JSON.stringify({code:i,desc:n})),t(e)}))}));return new Promise(((e,t)=>{Promise.all([i,n]).then((()=>{const t=this.tcicScreenShareVideoWindow.getMediaSourceId().split(":")[1];this._info("VideoWindowInitFinish",JSON.stringify({sourceId:t})),e({sourceId:t})})).catch((e=>{this._info("VideoWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),t(e)}))}))}resizeScreenShareVideoWindow(e){const t=this.tcicDefaultEntryMainWindow.getBounds();e.width>t.width&&(e.height=Math.floor(e.height/e.width*t.width),e.width=t.width),e.height>t.height&&(e.width=Math.floor(e.width/e.height*t.height),e.height=t.height),t.width=e.width,t.height=e.height,this.tcicScreenShareVideoWindow.setBounds(t)}closeScreenShareVideoWindow(){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null)}attachMainViewToDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow&&this.tcicMainView){this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.getBrowserViews().length>0&&this.tcicScreenShareMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicDefaultEntryMainWindow.getBrowserViews().length&&this.tcicDefaultEntryMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicDefaultEntryMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachMainViewToScreenShareMainWindow(){if(this.tcicScreenShareMainWindow&&this.tcicMainView){this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicScreenShareMainWindow.getBrowserViews().length&&this.tcicScreenShareMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicScreenShareMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachBoardViewToScreenShareBoardWindow(){if(this.tcicScreenShareBoardWindow&&this.tcicBoardView){this.tcicScreenShareBoardWindow.addBrowserView(this.tcicBoardView);const e=this.tcicScreenShareBoardWindow.getContentBounds();this.tcicBoardView.setBounds({x:0,y:0,width:e.width,height:e.height})}}openDevTools(){const e=c.default.screen.getPrimaryDisplay().size,t=e.width/2,i=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2+t,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 主视图"),webPreferences:{backgroundThrottling:!1}}),this.mainViewDevTools.on("close",(e=>{this.tcicMainView?(e.preventDefault(),this.mainViewDevTools.hide()):this.mainViewDevTools=null})),this.tcicMainView.webContents.setDevToolsWebContents(this.mainViewDevTools.webContents)),this.tcicMainView.webContents.openDevTools({mode:"detach"}),this.mainViewDevTools.show()),this.tcicBoardView&&(this.boardViewDevTools||(this.boardViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 白板"),webPreferences:{backgroundThrottling:!1}}),this.boardViewDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.boardViewDevTools.hide()):this.boardViewDevTools=null})),this.tcicBoardView.webContents.setDevToolsWebContents(this.boardViewDevTools.webContents)),this.tcicBoardView.webContents.openDevTools({mode:"detach"}),this.boardViewDevTools.show()),this.tcicScreenShareVideoWindow&&(this.videoWindowDevTools||(this.videoWindowDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 视频"),webPreferences:{backgroundThrottling:!1}}),this.videoWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.videoWindowDevTools.hide()):this.videoWindowDevTools=null})),this.tcicScreenShareVideoWindow.webContents.setDevToolsWebContents(this.videoWindowDevTools.webContents)),this.tcicScreenShareVideoWindow.webContents.openDevTools({mode:"detach"}),this.videoWindowDevTools.show()),this.tcicScreenShareCameraWindow&&(this.cameraWindowDevTools||(this.cameraWindowDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/2,title:W.default.t("开发者调试工具 - 辅助摄像头"),webPreferences:{backgroundThrottling:!1}}),this.cameraWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.cameraWindowDevTools.hide()):this.cameraWindowDevTools=null})),this.tcicScreenShareCameraWindow.webContents.setDevToolsWebContents(this.cameraWindowDevTools.webContents)),this.tcicScreenShareCameraWindow.webContents.openDevTools({mode:"detach"}),this.cameraWindowDevTools.show())}callBoardMethod(e){if(this.isBoardViewLoaded){if(this._info("CallBoardMethod",JSON.stringify({params:JSON.stringify(e)})),"board"===e.module){if("setToolType"===e.method){const t=e.params[0];0===t?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=t}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,t){c.default.ipcMain.on(e,t),this.ipcListeners.push({channel:e,listener:t})}addLifecycleIPCHandler(e,t){c.default.ipcMain.handle(e,t),this.ipcHandlers.push({channel:e,handler:t})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,t)=>r(this,void 0,void 0,(function*(){return yield u.get(t)})))),this.addLifecycleIPCListener("callMethod",((e,t)=>{this.callBoardMethod(t)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,t)=>{this.detectScreenShareMainWindowMouseEventIgnored(t.x,t.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,t,i)=>{this.seriousErrorHandler(t,i)})),this.addLifecycleIPCListener("onPageFinished",((e,t)=>{})),this.addLifecycleIPCListener("onCloseWindow",(()=>{this._info("onCloseWindow"),this.closeAllWindow().then()})),this.addLifecycleIPCListener("onMinimizeWindow",(()=>{this.tcicDefaultEntryMainWindow.isMinimized()?(this.tcicDefaultEntryMainWindow.restore(),console.log("TCIC unminimized")):(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.setOpacity(0),this.tcicDefaultEntryMainWindow.minimize(),console.log("TCIC minimized"))})),this.tcicDefaultEntryMainWindow.on("restore",(()=>{if(this.tcicScreenShareVideoWindow){const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}})),this.addLifecycleIPCListener("onMaximizeWindow",(()=>{this.isMainWindowMaximized?(console.log("TCIC unmaximized"),this.isMainWindowMaximized=!1,this.tcicDefaultEntryMainWindow.setResizable(!0),this.tcicDefaultEntryMainWindow.unmaximize(),m.setThickFrame(this.tcicDefaultEntryMainWindow,!0).then((()=>{this.tcicDefaultEntryMainWindow.setBounds(this.mainWindowBoundsBeforeMaximize)}))):(this.mainWindowBoundsBeforeMaximize=this.tcicDefaultEntryMainWindow.getBounds(),m.setThickFrame(this.tcicDefaultEntryMainWindow,!1).then((()=>{console.log("TCIC maximized"),this.isMainWindowMaximized=!0,this.tcicDefaultEntryMainWindow.maximize(),this.tcicDefaultEntryMainWindow.setResizable(!1)})))})),this.addLifecycleIPCListener("onClassLayoutChanged",((e,t)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(t);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const i=this.tcicDefaultEntryMainWindow.getBounds();if(i.width<e.width||i.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height},!0);const t=this.tcicDefaultEntryMainWindow.getBounds();v.set("MainWindowBounds",t),console.log("TCIC resize after layout",t)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,t)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",t)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",t)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",t)})),this.addLifecycleIPCHandler("saveImage",((e,t)=>new Promise(((e,i)=>{const n=i=>{const n=t.base64Data.replace(/^data:image\/\w+;base64,/,""),o=Buffer.from(n,"base64");i?h.default.writeFile(i,o,(i=>{e(i?{snapId:t.snapId,module:"electron",errcode:-5,errmsg:i.message}:{snapId:t.snapId,snapName:t.snapName,totalSlices:1,totalSize:n.length,sliceIndex:0,sliceSize:n.length})})):e({snapId:t.snapId,module:"electron",errcode:0,errmsg:""})};t.dialog?c.default.dialog.showSaveDialog(this.tcicDefaultEntryMainWindow,{defaultPath:t.snapName,title:W.default.t("保存图片"),filters:[{name:"Custom File Type",extensions:["png","jpg"]}]}).then((e=>{n(e.filePath)})):m.getDesktopPath().then((e=>{const i=l.default.join(e,t.snapName);n(i)}))})))),this.addLifecycleIPCHandler("downloadMusic",((e,t)=>new Promise(((e,i)=>{let n;n="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),n=l.default.join(n,"document"),h.default.existsSync(n)||h.default.mkdirSync(n,{recursive:!0});const o=l.default.join(n,`${t.documentId}_${t.url.substring(t.url.lastIndexOf("/")+1)}`);h.default.existsSync(o)?e(o):p.httpRequest(t.url,null,null,o).then((()=>{e(o)})).catch((e=>{i(e)}))})))),this.addLifecycleIPCHandler("loadVideo",((e,t)=>new Promise(((e,i)=>{this.createAndInitScreenShareVideoWindow(t).then((i=>{c.default.ipcMain.once("canplay",((t,n)=>{this.resizeScreenShareVideoWindow(n),e(i)})),this.tcicScreenShareVideoWindow.webContents.send("loadVideo",t.url)}))})))),this.addLifecycleIPCHandler("playVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("playVideo")})),this.addLifecycleIPCHandler("seekVideo",((e,t)=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("seekVideo",t)})),this.addLifecycleIPCHandler("pauseVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("pauseVideo")})),this.addLifecycleIPCHandler("stopVideo",(e=>{this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.webContents.send("stopVideo"),this.closeScreenShareVideoWindow())})),this.addLifecycleIPCHandler("setVideoVolume",((e,t)=>(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("setVideoVolume",t),Promise.resolve()))),this.addLifecycleIPCListener("onVideoTimeSeeked",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeSeeked",t)})),this.addLifecycleIPCListener("onVideoTimeUpdate",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeUpdate",t)})),this.addLifecycleIPCHandler("startSubCamera",((e,t)=>new Promise(((e,i)=>{this.createAndInitScreenShareCameraWindow(t).then((i=>{c.default.ipcMain.once("playing",((t,n)=>{this.resizeScreenShareCameraWindow(n),e(i)})),this.tcicScreenShareCameraWindow.webContents.send("start",t)}))})))),this.addLifecycleIPCHandler("stopSubCamera",((e,t)=>new Promise(((e,t)=>{this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.webContents.send("stop"),this.closeScreenShareCameraWindow()),e()})))),this.addLifecycleIPCHandler("getDeskTopWindows",((e,t)=>new Promise(((e,i)=>{let n=null;"win32"===process.platform?n=m:"darwin"===process.platform&&(n=w),null===n&&i(-2);let o=0;for(const e of t.pptArrName)if(""!==e&&(o=n.getDesktopWindow(e),o>0))break;if(t.bToShare)if(o>0)i(-1);else{for(const e of t.pptArrShareName)if(""!==e&&(o=n.getDesktopWindow(e),o>0))break;o>0?e(o):i(-1)}else o>0?e(o):i(-1)})))),this.addLifecycleIPCHandler("startScreenShare",((e,t,i)=>r(this,void 0,void 0,(function*(){this._info("StartScreenShare",JSON.stringify(t)),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.shareParams=t,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(t);return this.needToShowTaskbarFix="win32"===process.platform&&e.size.width===e.workAreaSize.width&&e.size.height===e.workAreaSize.height,this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled=yield m.isTaskbarAutoHiddenInDesktopEnabled(),this.isTaskbarAutoHiddenInDesktopEnabled&&m.setTaskbarAutoHiddenInDesktopEnabled(!1).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled=yield m.isTaskbarAutoHiddenInTabletEnabled(),this.isTaskbarAutoHiddenInTabletEnabled&&m.setTaskbarAutoHiddenInTabletEnabled(!1).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays=yield m.isShowTaskbarOnMultipleDisplays(),this.isShowTaskbarOnMultipleDisplays||m.setShowTaskbarOnMultipleDisplays(!0).then((()=>{})))),new Promise((e=>{const n=()=>{t.followTarget?(this.shareMainWindowDisplay=this.getDisplay(t),this.shareBoardWindowDisplay=this.shareMainWindowDisplay):(this.shareMainWindowDisplay=this.getCurrentDisplay(),this.shareBoardWindowDisplay=this.getDisplay(t)),i||(this.createAndInitBoardView(this.shareBoardWindowDisplay,t),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,t),this.attachBoardViewToScreenShareBoardWindow(),this.createAndInitScreenShareMainWindow(this.shareMainWindowDisplay),this.attachMainViewToScreenShareMainWindow(),this.tcicScreenShareBoardWindow.hide(),this.tcicScreenShareMainWindow.hide(),setTimeout((()=>{this.tcicScreenShareBoardWindow.show(),this.tcicScreenShareMainWindow.show()}),600)),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.checkShareWindowBoundsTimer=setInterval((()=>{const e=this.getShareWindowBounds(t);if(this.shareWindowBounds.x!==e.x||this.shareWindowBounds.y!==e.y||this.shareWindowBounds.width!==e.width||this.shareWindowBounds.height!==e.height){this.shareWindowBounds=e;const i=this.getDisplay(t);this.shareBoardWindowDisplay.id!==i.id&&(this._info("ShareBoardWindowDisplayChanged",JSON.stringify({from:JSON.stringify(this.shareBoardWindowDisplay.bounds),to:JSON.stringify(i.bounds)})),this.shareBoardWindowDisplay=i,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(i,t),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-i.bounds.x,y:e.y-i.bounds.y,width:e.width,height:e.height})}}),100);const n=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],o=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===t.type?e({excludeShareWindowSourceIds:[n],includeShareWindowSourceIds:[o]}):e({excludeShareWindowSourceIds:[n],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const i=setInterval((()=>{const o=this.getDisplay(t);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(i),n())}),100)}else n()}))})))),this.addLifecycleIPCHandler("hasScreenCapturePermission",(e=>r(this,void 0,void 0,(function*(){return"granted"===c.default.systemPreferences.getMediaAccessStatus("screen")})))),this.addLifecycleIPCHandler("openSystemPreferences",(e=>r(this,void 0,void 0,(function*(){return w.requestScreenCaptureAccess()})))),this.addLifecycleIPCHandler("getExcludeSelectWindows",(e=>r(this,void 0,void 0,(function*(){const e=[];if(this.tcicDefaultEntryMainWindow){const t=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(t)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,t)=>(this._info("StopScreenShare",JSON.stringify(t)),this.isScreenSharing=!1,setTimeout((()=>{this.tcicDefaultEntryMainWindow.show()}),600),this.attachMainViewToDefaultEntryMainWindow(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.close(),this.tcicBoardView&&this.tcicBoardView.webContents.destroy(),this.tcicBoardView=null,this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.close(),this.screenShareMainWindowMouseEventIgnored=!1,this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled&&m.setTaskbarAutoHiddenInDesktopEnabled(!0).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled&&m.setTaskbarAutoHiddenInTabletEnabled(!0).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays||m.setShowTaskbarOnMultipleDisplays(!1).then((()=>{})))),Promise.resolve())))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,t){v.get("screenShareNotOnTop")||this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===t.id?v.get("screenShareNotSetParent")?this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"):(this.tcicScreenShareMainWindow.setAlwaysOnTop(!1),this.tcicScreenShareMainWindow.setParentWindow(this.tcicScreenShareBoardWindow),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")):(this.tcicScreenShareMainWindow.setParentWindow(null),this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")))}getShareWindowBounds(e){if(0===e.type){if("win32"===process.platform){const t=m.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,t)}if("darwin"===process.platform)return w.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const t=c.default.screen.getAllDisplays();if(t.length>0){if("win32"===process.platform)return 0===e.type?c.default.screen.getDisplayMatching(m.getWindowBounds(parseInt(e.displayId,10))):c.default.screen.getDisplayMatching(m.getDesktopBounds(parseInt(e.displayId,10)));if("darwin"===process.platform&&0===e.type)return c.default.screen.getDisplayMatching(w.getWindowBounds(parseInt(e.displayId,10)))}for(const i of t)if(i.id.toString()===e.displayId)return i}return this.getCurrentDisplay()}initCacheModule(){return new Promise(((e,t)=>{let i=this.classUrl,n=i.indexOf(".html");-1!==n&&(n=i.length);const o=i.lastIndexOf("/",n);-1===o?c.default.dialog.showErrorBox(W.default.t("出错"),W.default.t("传入非法URL,课堂无法正常初始化: {{arg_0}}",{arg_0:this.classUrl})):i=i.substring(0,o),g.TIWCacheManager.SetCallback((e=>{this.tcicMainView.webContents.send("onVersionUpdate",{force:e})})),g.TIWCacheManager.SetConfig({configUrl:`${i}/cache/tiwcache.json`,configPath:l.default.join(__dirname,"config.json"),resourcePath:l.default.join(__dirname,"resource.zip"),resourceDir:b}).then((()=>{this._info("initCacheModule",JSON.stringify({code:0,error:""})),e()})).catch((t=>{this._info("initCacheModule",JSON.stringify({code:-1,error:JSON.stringify(t)})),e()}))}))}createAndInitWindow(){this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox(W.default.t("出错"),W.default.t("DWM未开启,不支持窗口透明特性"))),this.initCacheModule().then((()=>{g.TIWCacheManager.EnableCache(!v.get("disableCache")),this.createAndInitMainView(),v.get("autoOpenDevTools")&&this.openDevTools(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}initWSService(){this.wss=new C.WebSocketServer({port:18081}),this.wss.on("connection",(e=>{e.on("message",(e=>{try{const t=JSON.parse(e.toString());this.tcicMainView.webContents.send("onReceiveMessage",t)}catch(e){console.error("message format error")}}))})),this.addLifecycleIPCHandler("onReceiveMessage",((e,t)=>new Promise(((e,i)=>{this.wss.clients.forEach((e=>{e.readyState===C.WebSocket.OPEN&&e.send(JSON.stringify(t))})),e()}))))}unInitWSService(){this.wss&&(this.wss.close(),this.wss=null)}}t.TencentCloudClass=T},975:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.requestScreenCaptureAccess=t.macOSVersion=t.getWindowBounds=t.getDesktopWindow=void 0;const a=s(i(124)),c=r(i(420)),d=s(i(728)),h=r(i(451)),l=r(i(747)),u=i(933),w=d.types.void,f=d.types.int,S=d.types.int,g=process.arch.includes("64")?d.types.uint64:d.types.uint32,p=g,m=p,W=p,y=p,C=g,M=d.types.uint32,b=d.types.uint32,v=d.types.int,D=d.types.CString,I=d.types.double,T=h.default({x:I,y:I}),B=h.default({width:I,height:I}),V=h.default({origin:T,size:B}),_=d.refType(V),P=c.default(g),k=134217984;let E,O=null,x=null;if("darwin"===process.platform)try{const e=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");O=a.Library(e,{CGWindowListCopyWindowInfo:[W,[C,M]],CGWindowListCreateDescriptionFromArray:[W,[W]],CGRectMakeWithDictionaryRepresentation:[f,[y,_]],CGWindowListCreateImage:[p,[V,S,S,S]]});const t=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");x=a.Library(t,{CFArrayCreate:[W,[S,P,S,S]],CFStringCreateWithCString:[m,[S,D,b]],CFArrayGetCount:[v,[W]],CFArrayGetValueAtIndex:[p,[W,v]],CFDictionaryGetValue:[p,[y,m]],CFStringGetCString:[f,[m,D,v,b]],CFStringGetCStringPtr:[D,[m,b]],CFStringGetLength:[v,[m]],CFStringGetMaximumSizeForEncoding:[v,[v,b]],CFRelease:[w,[p]]})}catch(e){console.error(e)}function L(){if(!E){const e=(e=>{const t=/<key>ProductVersion<\/key>\s*<string>([\d.]+)<\/string>/.exec(e);if(t)return t[1].replace("10.16","11")})(l.default.readFileSync("/System/Library/CoreServices/SystemVersion.plist","utf8"));if(!e)return;E=(e=>{const{length:t}=e.split(".");return 1===t?`${e}.0.0`:2===t?`${e}.0`:e})(e)}return E}t.getDesktopWindow=function(e){let t=0;if(O&&x){const i=x.CFStringCreateWithCString(0,"kCGWindowName",k),n=O.CGWindowListCopyWindowInfo(1,0),o=x.CFArrayGetCount(n);for(let s=0;s<o;++s){const o=x.CFArrayGetValueAtIndex(n,s),r=x.CFDictionaryGetValue(o,i);let a=x.CFStringGetCStringPtr(r,k);if(null===a&&r>0){const i=x.CFStringGetLength(r),n=x.CFStringGetMaximumSizeForEncoding(i,k)+1,o=new Buffer(n);if(o.type=d.types.CString,x.CFStringGetCString(r,o,n,k)&&(a=o.toString("utf8").replace(/\0/g,"")),a===e){t=1,console.log(`+++++=====${e}++++${a}`);break}}}x.CFRelease(n)}return t},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(O&&x)try{const i=new P(1);i[0]=e;const n=x.CFArrayCreate(0,i,i.length,0),o=O.CGWindowListCreateDescriptionFromArray(n);if(0===o)return t;if(x.CFArrayGetCount(o)>0){const e=x.CFArrayGetValueAtIndex(o,0),i=x.CFStringCreateWithCString(0,"kCGWindowBounds",k),n=x.CFDictionaryGetValue(e,i),s=new V;O.CGRectMakeWithDictionaryRepresentation(n,s.ref()),t.x=s.origin.x,t.y=s.origin.y,t.width=s.size.width,t.height=s.size.height,x.CFRelease(i)}x.CFRelease(o),x.CFRelease(n)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(t)),t},t.macOSVersion=L;let F=!1;t.requestScreenCaptureAccess=function(){if(O&&x)try{const e=L().split(".").map((e=>parseInt(e,10)));if(e[0]<10||10===e[0]&&e[1]<15)return;const t=new V;t.origin.x=0,t.origin.y=0,t.size.width=1,t.size.height=1;const i=O.CGWindowListCreateImage(t,1,0,0);if(x.CFRelease(i),F){const e="security",t="Privacy_ScreenCapture";u.shell.openExternal(`x-apple.systempreferences:com.apple.preference.${e}${t?`?${t}`:""}`)}else F=!0}catch(e){console.error(e)}}},196:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TCIC=void 0;const o=i(555),s=i(648);let r=null;t.TCIC={initialize(e){return n(this,void 0,void 0,(function*(){const t=e.onClose;e.onClose=()=>{t&&t(),r=null},r?this.show():(r=new o.TencentCloudClass,yield r.initialize(e))}))},closeAllWindow(){r&&r.focus()},focus(){r&&r.focus()},show(){r&&r.show()},getVersion:()=>s.tcicSdkVersion},e.exports=t.TCIC},376:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const r=s(i(933)),a=i(425),c=i(648),d={userId:""};function h(e,t=null){d.userId=e,a.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,d.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:d.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=h,"renderer"===process.type&&r.ipcRenderer.on("setReportInfo",((e,t)=>{h(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};a.init(e)}},741:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TIWCacheManager=void 0;const o=n(i(528)),s=i(933),r=n(i(747)),a=n(i(622)),c=n(i(605)),d=n(i(211)),h=n(i(138));var l;!function(e){e[e.None=0]="None",e[e.Downloading=1]="Downloading",e[e.DownloadFailed=2]="DownloadFailed",e[e.DownloadSucc=3]="DownloadSucc"}(l||(l={}));class u{constructor(){this.retentionTime=2592e5,this.url="",this.path="",this.reg="",this.status=l.None,this.createTime=Date.parse((new Date).toString())}}class w{static EnableCache(e){if(w._enabled=e,w._timer&&(clearTimeout(w._timer),w._timer=null),w._enabled&&w._config&&w._serverConfig){const e=()=>{w.RefreshServerConfig().catch((e=>{console.error(e)})),w._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetCallback(e){w._cacheCallback=e}static SetConfig(e){return new Promise(((t,i)=>{w._config=e;const n=w.GetConfigDir(),o=w.GetZipDir(),s=w.GetResourceDir(),a=w.GetDocumentDir(),c=w.GetCourseCacheDir();r.default.existsSync(n)||r.default.mkdirSync(n,{recursive:!0}),r.default.existsSync(o)||r.default.mkdirSync(o,{recursive:!0}),r.default.existsSync(s)||r.default.mkdirSync(s,{recursive:!0}),r.default.existsSync(a)||r.default.mkdirSync(a,{recursive:!0}),c.length>0&&!r.default.existsSync(c)&&r.default.mkdirSync(c,{recursive:!0}),c.length>0&&!w._hadLoadCourseConfig&&(w._hadLoadCourseConfig=!0,w._coursewares.clear(),w.LoadCoursewareConfig());const d=w.GetConfigPath(),l=w.GetZipPath();let u=null;r.default.existsSync(d)&&(u=w.LoadServerConfigFromLocalFile(d),w.IsBundleResourceNew(e.configPath,u)&&(w.RemoveDirSync(s),r.default.promises.unlink(d).then(),r.default.existsSync(l)&&r.default.promises.unlink(l).then(),u=null)),u?(console.info("TIWCacheManager use cache files"),w._serverConfig=u,w.EnableCache(!0),t()):r.default.existsSync(e.configPath)?r.default.existsSync(e.resourcePath)?r.default.promises.copyFile(e.configPath,d).then((()=>{console.info("TIWCacheManager update config file");const n=w.LoadServerConfigFromLocalFile(d);r.default.promises.copyFile(e.resourcePath,l).then((()=>{console.info("TIWCacheManager update resource file");try{w.RemoveDirSync(s),new h.default(l).extractAllTo(s,!0),w._serverConfig=n,w.EnableCache(!0),t()}catch(e){r.default.promises.unlink(d).then(),r.default.promises.unlink(l).then(),console.error("TIWCacheManager resource unzip failed",e),i(e)}})).catch((()=>{i(`TIWCacheManager copyFile file error: ${e.resourcePath}`)}))})).catch((()=>{i(`TIWCacheManager resource file not found: ${e.configPath}`)})):i(`TIWCacheManager resource file not found: ${e.resourcePath}`):i(`TIWCacheManager config file not found: ${e.configPath}`)}))}static PreloadCourseware(e,t=""){if(0===w.GetCourseConfigPath().length)return void Promise.reject("not set courseCacheDir by Call SetConfig");const i=w.GetCoursewarwId(e);if(0===i.length)return void Promise.reject("the zipUrl is not right courseware zip");const n=new u;n.url=e,n.reg=t,n.path=i;let o=!1;if(w._coursewares.hasOwnProperty(i)){const t=w._coursewares.get(i);t.status===l.Downloading&&t.url===e||(w._coursewares.set(i,n),o=!0)}else w._coursewares.set(i,n),o=!0;if(!o)return void Promise.reject("the zipUrl is donwloading");const s=w._coursewares.get(i);s.status=l.Downloading,w.SaveCoursewareConfig();const c=a.default.join(w.GetCourseCacheDir(),i,"/");w.RemoveDirSync(c),r.default.mkdirSync(c);const d=a.default.join(w.GetCourseCacheDir(),n.path,`${Date.parse((new Date).toString())}_tiwcourseware.zip`);return w.HttpRequest(e,null,null,d).then((()=>(new h.default(d).extractAllTo(c,!0),r.default.unlinkSync(d),s.status=l.DownloadSucc,w.SaveCoursewareConfig(),Promise.resolve()))).catch((e=>(r.default.unlinkSync(d),s.status=l.DownloadFailed,w.SaveCoursewareConfig(),Promise.reject("coursezip fetch failed"))))}static RefreshServerConfig(){if(!w._config.configUrl)return Promise.reject(o.default.t("缺少配置文件URL"));if(w._isRefreshing)return Promise.reject(o.default.t("上次刷新未完成"));w._isRefreshing=!0;const e=w.GetConfigPath(!0),t=w._config.configUrl;return w.HttpRequest(t,null,null,e).then((()=>{const t=w.LoadServerConfigFromLocalFile(e),i=w.GetResourceInfo(t);if(!i)return Promise.reject(o.default.t("新配置缺少可用资源信息"));const n=w.GetResourceInfo(w._serverConfig);if(n&&i&&n.version===i.version&&i.devBuildTime<=n.devBuildTime)return Promise.reject(o.default.t("新配置版本低于老配置版本: {{arg_0}} < {{arg_1}}",{arg_0:i.version,arg_1:n.version}));console.log("TIWCacheManager new config fetched",t);const s=w.GetZipPath(!0);return w.HttpRequest(i.url,null,null,s).then((()=>{const i=w.GetResourceDir();w.RemoveDirSync(i),new h.default(s).extractAllTo(i,!0);const n=w.GetConfigPath();r.default.unlinkSync(n),r.default.renameSync(e,n);const o=w.GetZipPath();if(r.default.unlinkSync(o),r.default.renameSync(s,o),w._serverConfig=t,console.log("TIWCacheManager resource prepare done"),w._cacheCallback){const e=w._serverConfig.forceUpdate;w._cacheCallback(e)}return Promise.resolve()})).catch((e=>{r.default.unlinkSync(s),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((t=>{r.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",t)})).finally((()=>{w._isRefreshing=!1}))}static RegisterAsPrivileged(){return s.app.isReady()?(console.error("RegisterAsPrivileged can only be used before the ready event of the app module gets emitted!!!"),!1):(s.protocol.registerSchemesAsPrivileged([{scheme:w.TIWCacheSchemeHttp,privileges:w.TIWCacheSchemePrivileges},{scheme:w.TIWCacheSchemeHttps,privileges:w.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(w._enabled&&w._config&&w._config.resourceDir){const t=w.GetResourceInfo(w._serverConfig);if(t){let i="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(t.files&&t.files.hasOwnProperty(o)){const e=t.files[o];i=e.toLowerCase().startsWith("http")?e:a.default.join(w.GetResourceDir(),e);break}if(!i&&t.regexes)for(const e in t.regexes){let n=t.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const t=new RegExp(`\\$${e}`,"g");n=n.replace(t,s[e])}i=a.default.join(w.GetResourceDir(),n);break}}if(!i&&t.documents)for(const e in t.documents){const n=t.documents[e],s=o.match(e);if(s&&s.length>=3){const e=s[1],t=s[2],c=w.GetDocumentDir();i=o.replace(e,c),r.default.existsSync(i)||w.DownloadDocumentCategory(a.default.join(c,t,n),`${e}/${t}/${n}`);break}}if(!i){const t=w.GetCourseCacheDir();if(t.length>0)for(const[n,o]of w._coursewares)if(0===o.reg.length){const o=e.indexOf(n);if(-1!==o){const s=e.substring(o+n.length+1);i=a.default.join(t,n,s);break}}}}while(0);return r.default.existsSync(i)?console.log("TIWCacheManager GetResourcePath : ==>> Hit :",e,i):i="",i}}return""}static EnableWebContentsCache(e,t){if(t){const t=(e,t)=>{w.TIWCacheFileMap.has(e.url)?(t({path:w.TIWCacheFileMap.get(e.url)}),w.TIWCacheFileMap.delete(e.url)):t({statusCode:404})};e.session.protocol.registerFileProtocol(w.TIWCacheSchemeHttp,t),e.session.protocol.registerFileProtocol(w.TIWCacheSchemeHttps,t),e.session.webRequest.onBeforeRequest(((e,t)=>{let i=e.url;const n=i.indexOf("://"),o=i.substring(0,n).toLowerCase(),s=i.substring(n);if(o===w.TIWCacheSchemeHttp||o===w.TIWCacheSchemeHttps){if(w.TIWCacheFileMap.has(i))return void t({cancel:!1});i=o===w.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void t({cancel:!1});const r=w.GetResourcePath(i);""===r?t({cancel:!1}):r.startsWith("http")?t({cancel:!1,redirectURL:r}):(i="https"===o||o===w.TIWCacheSchemeHttps?w.TIWCacheSchemeHttps+s:w.TIWCacheSchemeHttp+s,w.TIWCacheFileMap.set(i,r),i===e.url?t({cancel:!1}):t({cancel:!1,redirectURL:i}))}))}else e.session.protocol.unregisterProtocol(w.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(w.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,t,i,n){const o=e.toLowerCase().startsWith("https://")?d.default:c.default;return new Promise(((s,a)=>{const c=n?r.default.createWriteStream(n):null,d=i?JSON.stringify(i):null,h=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const l={method:h,headers:t},u=o.request(e,l,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void a(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{s(e)}))}}));i&&u.write(d),c&&(c.on("finish",(()=>s(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>a(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>a(e))):a(e)})),u.end()}))}static GetCoursewarwId(e){const t=new URL(e).pathname;let i=t.lastIndexOf("/");if(-1!==i){const e=t.substring(0,i);if(i=e.lastIndexOf("/"),-1!==i)return e.substring(i+1)}return""}static GetCourseConfigPath(){return void 0!==w._config.courseCacheDir&&w._config.courseCacheDir.length>0?a.default.join(w._config.courseCacheDir,"tiwcache_course_config.json"):""}static LoadServerConfigFromLocalFile(e){const t=r.default.readFileSync(e,"utf8");return JSON.parse(t)}static GetResourceInfo(e){const t=`${w._config.sdkAppId}`,i=`${w._config.schoolId}`;let n=e.resources.find((e=>-1!==t.search(e.sdkAppId)&&-1!==i.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static LoadCoursewareConfig(){const e=w.GetCourseConfigPath();if(r.default.existsSync(e)){w._coursewares.clear();const t=r.default.readFileSync(e,"utf8"),i=JSON.parse(t);for(const e in i)w._coursewares.set(e,i[e]);let n=!1;const o=w.GetCourseCacheDir(),s=Date.parse((new Date).toString());for(const[e,t]of w._coursewares)if(s.valueOf()-t.createTime.valueOf()>t.retentionTime.valueOf()){const i=o+t.path;w.RemoveDirSync(i),w._coursewares.delete(e),n=!0}else t.status!==l.DownloadSucc&&(t.createTime=Date.parse((new Date).toString()),t.status=l.None,n=!0);n&&w.SaveCoursewareConfig()}}static SaveCoursewareConfig(){const e=w.GetCourseConfigPath();r.default.existsSync(e)&&r.default.unlinkSync(e);const t={};for(const[e,i]of w._coursewares)t[e]=i;r.default.writeFileSync(e,JSON.stringify(t))}static GetConfigPath(e){return a.default.join(w.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return a.default.join(w.GetZipDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetLogDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetZipDir(){return a.default.join(w._config.resourceDir,"tiwcache")}static GetResourceDir(){return a.default.join(w._config.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return a.default.join(w._config.resourceDir,"tiwcache","document")}static GetCourseCacheDir(){return void 0===w._config.courseCacheDir?"":a.default.join(w._config.courseCacheDir,"tiwcache_courseware")}static IsBundleResourceNew(e,t){const i=w.LoadServerConfigFromLocalFile(e),n=w.GetResourceInfo(i),o=w.GetResourceInfo(t);return n&&o&&n.devBuildTime>o.devBuildTime}static DownloadDocumentCategory(e,t){if(r.default.existsSync(e))return w.DownloadDocumentFiles(e,t);if(w._documentState.get(t))return Promise.reject(o.default.t("下载中"));w._documentState.set(t,!0),console.log("TIWCacheManager document downloading",t);const i=a.default.normalize(e.substring(0,e.lastIndexOf(a.default.sep)+1));return r.default.mkdirSync(i),w.HttpRequest(t,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",t,e),w.ClearExpiredDocuments(),w.DownloadDocumentFiles(e,t)))).finally((()=>{w._documentState.set(t,!1)}))}static DownloadDocumentFiles(e,t,i=0){let n=w._documentInfo.get(e);if(!n){if(n=w.LoadDocumentInfoFromLocalFile(e,t),!n)return Promise.reject(o.default.t("课件文件列表解析失败"));n.files.sort(((e,t)=>e.priority-t.priority)),console.log("TIWCacheManager document info",t,n),w._documentInfo.set(e,n)}if(i>=n.files.length)return Promise.resolve();const s=n.files[i];if(!r.default.existsSync(s.path)){const n=s.path.substring(0,s.path.lastIndexOf(a.default.sep)+1);return r.default.mkdirSync(n,{recursive:!0}),console.log("TIWCacheManager document file downloading",t,i),w.HttpRequest(s.url,null,null,s.path).then((()=>(console.log("TIWCacheManager document file downloaded",t,i,s),w.DownloadDocumentFiles(e,t,i+1))))}return w.DownloadDocumentFiles(e,t,i+1)}static LoadDocumentInfoFromLocalFile(e,t){const i=r.default.readFileSync(e,"utf-8"),n=JSON.parse(i);n.path=e,n.url=t;const o=e.substring(0,e.lastIndexOf(a.default.sep)+1),s=t.substring(0,t.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=a.default.join(o,e.name),e.url=`${s}/${e.name}`})),n}static RemoveDirSync(e,t){if(!r.default.existsSync(e))return!0;let i=!0;return r.default.readdirSync(e).forEach((n=>{const o=a.default.join(e,n),s=r.default.statSync(o);!t||t(s)?s.isDirectory()?w.RemoveDirSync(o)||(i=!1):r.default.unlinkSync(o):s.isDirectory()&&w.RemoveDirSync(o,t)||(i=!1)})),!!i&&(r.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;w.RemoveDirSync(w.GetDocumentDir(),(t=>!t.isDirectory()||new Date(t.atime.getTime()+2592e5)<e))}}t.TIWCacheManager=w,w.TIWCacheSchemeHttp="tiw-cache",w.TIWCacheSchemeHttps="tiw-caches",w.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},w.TIWCacheFileMap=new Map,w._enabled=!1,w._timer=null,w._isRefreshing=!1,w._documentState=new Map,w._documentInfo=new Map,w._cacheCallback=null,w._hadLoadCourseConfig=!1,w._coursewares=new Map},450:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.httpRequest=void 0;const o=n(i(211)),s=n(i(605)),r=n(i(747));t.httpRequest=function(e,t,i,n){const a=e.toLowerCase().startsWith("https://")?o.default:s.default;return new Promise(((o,s)=>{const c=n?r.default.createWriteStream(n):null,d=i?JSON.stringify(i):null,h=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const l={method:h,headers:t},u=a.request(e,l,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void s(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{o(e)}))}}));i&&u.write(d),c&&(c.on("finish",(()=>o(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>s(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>s(e))):s(e)})),u.end()}))}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.426",t.tcicSdkBranch="1.7.3"},42:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getDesktopWindow=t.isWin7=t.getDesktopBounds=t.getWindowBounds=t.setThickFrame=t.setShowTaskbarOnMultipleDisplays=t.isShowTaskbarOnMultipleDisplays=t.setTaskbarAutoHiddenInTabletEnabled=t.isTaskbarAutoHiddenInTabletEnabled=t.setTaskbarAutoHiddenInDesktopEnabled=t.isTaskbarAutoHiddenInDesktopEnabled=t.getPrimaryDisplaySize=t.getMaxTouches=t.getDesktopPath=void 0;const c=a(i(124)),d=a(i(747)),h=s(i(87)),l=a(i(622)),u=a(i(728)),w=a(i(451)),f=a(i(26)),S=u.default.types.bool,g=u.default.types.int,p=u.default.types.uint,m=process.arch.includes("64")?u.default.types.uint64:u.default.types.uint32,W=u.default.types.long,y=u.default.types.ulong,C=y,M=process.arch.includes("64")?u.default.types.int64:u.default.types.int32,b=process.arch.includes("64")?u.default.types.ulonglong:y,v=b,D=b,I=b,T=w.default({left:W,top:W,right:W,bottom:W}),B=u.default.refType(T),V=w.default({cbSize:C,hWnd:I,uCallbackMessage:p,uEdge:p,rc:T,lParam:M}),_=u.default.refType(V);let P=null,k=null;if("win32"===process.platform)try{P=c.default.Library("user32",{SendNotifyMessageA:[S,[I,p,m,"string"]],GetSystemMetrics:[g,[g]],FindWindowA:[I,["string",W]],GetWindowLongA:[W,[I,g]],SetWindowLongA:[W,[I,g,W]],GetWindowRect:[S,[I,B]],EnumDisplayMonitors:[S,[D,W,"pointer",M]],FindWindowW:[I,[W,"string"]],FindWindowExW:[I,[W,W,"string","string"]]}),k=c.default.Library("shell32",{SHAppBarMessage:[p,[p,_]]})}catch(e){console.error(e)}const E=function(e){return new Promise(((t,i)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{t(n)})).on("error",(e=>{i(e)}))}))},O=function(e){return new Promise(((t,i)=>{f.default.putValue(e,(e=>{e&&i(e),t()}))}))},x=function(){P&&P.SendNotifyMessageA(65535,26,0,"TraySettings")};t.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=l.default.join(h.homedir(),"Desktop"),t=d.default.existsSync(e);if("win32"===process.platform&&!t){const i="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield E(i).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{t=!0,e=o[i].values.Desktop.value}catch(e){}}return t?e:""}))},t.getMaxTouches=function(){if(P){const e=95;return P.GetSystemMetrics(e)}return 0},t.getPrimaryDisplaySize=function(){if(P){const e=0,t=1;return{width:P.GetSystemMetrics(e),height:P.GetSystemMetrics(t)}}return null},t.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if(k){const e=new V;return e.cbSize=V.size,1===k.SHAppBarMessage(4,e.ref())}return!1}))},t.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if(P&&k){const t=new V;return t.cbSize=V.size,t.hWnd=P.FindWindowA("Shell_TrayWnd",0),t.lParam=e?1:0,k.SHAppBarMessage(10,t.ref()),!0}return!1}))},t.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield E(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},t.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield O(t),x(),!0}catch(e){}return!1}))},t.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield E(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},t.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield O(t),x(),!0}catch(e){}return!1}))},t.setThickFrame=function(e,t){return r(this,void 0,void 0,(function*(){if(P){const i=parseInt(e.getMediaSourceId().split(":")[1],10),n=P.GetWindowLongA(i,-16),o=t?262144|n:-262145&n;return P.SetWindowLongA(i,-16,o),!0}return!1}))},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(P){const i=new T;P.GetWindowRect(e,i.ref())&&(t.x=i.left,t.y=i.top,t.width=i.right-i.left,t.height=i.bottom-i.top)}return t};const L=new Map;t.getDesktopBounds=function(e){let t=L.get(e);if(t)return t;if(t={x:0,y:0,width:0,height:0},P){let i=0;const n=e,o=c.default.Callback(S,[v,D,B,M],((e,o,s,r)=>{if(i+=1,i===n){const e=s.deref();return t.x=e.left,t.y=e.top,t.width=e.right-e.left,t.height=e.bottom-e.top,!1}return!0}));P.EnumDisplayMonitors(0,0,o,0)}return L.set(e,t),t},t.isWin7=function(){const e=h.release().split(".");if(e.length>=3){const t=parseInt(e[0],10),i=parseInt(e[1],10);return!(t>=10||6===t&&i>=2)}return!1},t.getDesktopWindow=function(e){const t=Buffer.from(e,"ucs2"),i=P.FindWindowW(0,t);return console.log(`+++++++++++++++++++++${i}`),i}},425:e=>{e.exports=require("@sentry/electron")},138:e=>{e.exports=require("adm-zip")},933:e=>{e.exports=require("electron")},765:e=>{e.exports=require("electron-store")},124:e=>{e.exports=require("ffi-napi")},747:e=>{e.exports=require("fs")},605:e=>{e.exports=require("http")},211:e=>{e.exports=require("https")},528:e=>{e.exports=require("i18next")},239:e=>{e.exports=require("i18next-resources-to-backend")},87:e=>{e.exports=require("os")},622:e=>{e.exports=require("path")},420:e=>{e.exports=require("ref-array-napi")},728:e=>{e.exports=require("ref-napi")},451:e=>{e.exports=require("ref-struct-napi")},26:e=>{e.exports=require("regedit")},293:e=>{e.exports=require("systeminformation")},311:e=>{e.exports=require("tiw-log")},439:e=>{e.exports=require("ws")}},t={};return function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(196)})()}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={853:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return r(n,e),n},s=this&&this.__awaiter||function(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function d(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,d)}a((o=o.apply(e,n||[])).next())}))},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const a=i(t(933)),c=d(t(881)),u=d(t(557)),l=i(t(574)),p=i(t(280)),w=t(648);t(376).initSentry();let C=0,S="",h=!1;const f="TStateScreenShareBoardUndo",v="TStateScreenShareBoardRedo";window.TRTCCloud=u.default,window.TRTCDefine=l,window.Electron={getPlatform:()=>process.platform,hasScreenCapturePermission:()=>a.ipcRenderer.invoke("hasScreenCapturePermission"),openSystemPreferences:()=>a.ipcRenderer.invoke("openSystemPreferences"),getExcludeSelectWindows:()=>a.ipcRenderer.invoke("getExcludeSelectWindows"),getClientInfo:()=>({sdkVersion:w.tcicSdkVersion}),getSystemInfo:e=>a.ipcRenderer.invoke("getSystemInfo",e),sendCustomMessage(e){a.ipcRenderer.send("onRecvCustomMessage",e)},reloadWindow(e,n){a.ipcRenderer.send("onReloadWindow",e,n)},onPageFinished(e){a.ipcRenderer.send("onPageFinished",e)},closeWindow(){if(window.TCIC){const e=window.TCIC.SDK.instance.getState(window.TCIC.TMainState.Class_Status),n=T(e);n!==S&&a.ipcRenderer.send(n)}a.ipcRenderer.send("onCloseWindow",0)},minimizeWindow(){a.ipcRenderer.send("onMinimizeWindow",0)},maximizeWindow(){a.ipcRenderer.send("onMaximizeWindow",0)},openUrl(e){a.shell.openExternal(e)},selectScreenCaptureTarget(e){this._selectedSource=e},startScreenShare(e){return s(this,void 0,void 0,(function*(){return this._selectedSource&&(e.type=this._selectedSource.type,e.displayId=this._selectedSource.sourceId),a.ipcRenderer.invoke("startScreenShare",e,h)}))},stopScreenShare:()=>h?Promise.resolve():a.ipcRenderer.invoke("stopScreenShare"),getDesktopWindows:e=>new Promise(((n,t)=>{a.ipcRenderer.invoke("getDeskTopWindows",e).then((e=>{n(e)})).catch((e=>{t(e)}))})),callMethod(e){a.ipcRenderer.send("callMethod",e),"board"===e.module&&"setToolType"===e.method&&(C=e.params[0])},saveSnapshot(e,n,t,o){const r={snapId:e,base64Data:n,snapName:t,dialog:o};return new Promise(((e,n)=>{a.ipcRenderer.invoke("saveImage",r).then((t=>{t.hasOwnProperty("errcode")?n(t):e(t)}))}))},checkDNSParsing:e=>new Promise((n=>{const t=Date.now();c.default.lookup(e,((e,o,r)=>{n({error:e,cost:Date.now()-t,address:o})}))})),loadVideo(e,n){const t=e.getBoundingClientRect(),o={x:t.left,y:t.top,width:t.width,height:t.height};return a.ipcRenderer.invoke("loadVideo",{bounds:o,url:n})},playVideo:()=>a.ipcRenderer.invoke("playVideo"),pauseVideo:()=>a.ipcRenderer.invoke("pauseVideo"),stopVideo:()=>a.ipcRenderer.invoke("stopVideo"),seekVideo:e=>a.ipcRenderer.invoke("seekVideo",e),setVideoVolume:e=>a.ipcRenderer.invoke("setVideoVolume",e),downloadMusic:e=>a.ipcRenderer.invoke("downloadMusic",e),startSubCamera:e=>a.ipcRenderer.invoke("startSubCamera",e),stopSubCamera:()=>a.ipcRenderer.invoke("stopSubCamera"),onReceiveMessage:e=>a.ipcRenderer.invoke("onReceiveMessage",e),getWindowId(){const e=a.remote.getCurrentWindow();let n="";try{n=e.getMediaSourceId().split(":")[1]}catch(e){console.error(e)}finally{return n}}};const T=e=>e===window.TCIC.TClassStatus.Already_Start?"onTCICClassStart":e===window.TCIC.TClassStatus.Has_Ended?"onTCICClassStop":e===window.TCIC.TClassStatus.Has_Expired?"onTCICClassExpired":"onTCICClassInit";new Promise(((e,n)=>{a.ipcRenderer.on("init",((n,t)=>{console.log("init",t),window.TCIC&&(window.TCIC.SDK.instance.registerState(f,"屏幕共享白板撤销状态",!1),window.TCIC.SDK.instance.registerState(v,"屏幕共享白板重做状态",!1),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Layout,(e=>{a.ipcRenderer.send("onClassLayoutChanged",e)})),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Status,(e=>{S=T(e),a.ipcRenderer.send(S)})),window.TCIC.SDK.instance.subscribeState(window.TCICUI.Constant.TStatePassThroughStatus,(e=>{a.remote.getCurrentWindow().setIgnoreMouseEvents(e,{forward:!0})})),window.TCIC.SDK.instance.subscribeState(window.TCICUI.Constant.TStatePPtSharingState,(e=>{h=e}))),e(t)})),a.ipcRenderer.on("onScreenShareSnapshot",((e,n)=>{window.screenShareSnapshotCallback&&window.screenShareSnapshotCallback(n)})),a.ipcRenderer.on("leaveClass",(e=>{window.TCIC?window.TCIC.SDK.instance.leaveClass():window.Electron.closeWindow()})),a.ipcRenderer.on("sendCustomMessage",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Recv_Custom_Msg,n)})),a.ipcRenderer.on("onBoardCanRedoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(v,n)})),a.ipcRenderer.on("onBoardCanUndoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(f,n)})),a.ipcRenderer.on("onVideoTimeUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Update,n)})),a.ipcRenderer.on("onVideoTimeSeeked",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Seeked,n)})),a.ipcRenderer.on("onVersionUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Version_Update,n)})),a.ipcRenderer.on("onReceiveMessage",((e,n)=>{window.TCICUI&&window.TCICUI.onReceiveMessage(n)}))})).then((e=>{setTimeout((()=>{!function(e){const n="touchstart",t=()=>{window.removeEventListener(n,t,!0),a.ipcRenderer.send("enableTouchScreenOptimize");const e=["touchstart","touchmove","touchend","mousedown","mousemove","mouseup"];a.ipcRenderer.on("enableWatchMouseMoveEvent",((n,t)=>{p.watchEvents(window,e,t)}))};window.addEventListener(n,t,!0)}()}),1e3)}))},280:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.watchEvents=void 0;const o=t(933);t(376).initSentry();const r=e=>{let n,t;if(e instanceof TouchEvent?(n=Math.round(e.changedTouches[0].screenX),t=Math.round(e.changedTouches[0].screenY)):(n=e.screenX,t=e.screenY),0!==n||0!==t){const r={type:e.type,x:n,y:t};o.ipcRenderer.send("onMouseEvent",r),console.log("onMouseEvent",r)}};n.watchEvents=function(e,n,t){n.forEach((n=>{t?e.addEventListener(n,r,{capture:!0,passive:!1}):e.removeEventListener(n,r,{capture:!0})}))}},376:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return r(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.initSentry=n.setReportInfo=void 0;const s=i(t(933)),d=t(425),a=t(648),c={userId:""};function u(e,n=null){c.userId=e,d.configureScope((e=>{console.log("setReportInfo",a.tcicSdkVersion,c.userId),e.setTag("extra.sdk",a.tcicSdkVersion),e.setUser({id:c.userId})})),n&&n.send("setReportInfo",e)}n.setReportInfo=u,"renderer"===process.type&&s.ipcRenderer.on("setReportInfo",((e,n)=>{u(n)})),n.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};d.init(e)}},648:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tcicSdkBranch=n.tcicSdkVersion=void 0,n.tcicSdkVersion="1.7.3.
|
|
1
|
+
(()=>{"use strict";var e={853:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return r(n,e),n},s=this&&this.__awaiter||function(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function d(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,d)}a((o=o.apply(e,n||[])).next())}))},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const a=i(t(933)),c=d(t(881)),u=d(t(557)),l=i(t(574)),p=i(t(280)),w=t(648);t(376).initSentry();let C=0,S="",h=!1;const f="TStateScreenShareBoardUndo",v="TStateScreenShareBoardRedo";window.TRTCCloud=u.default,window.TRTCDefine=l,window.Electron={getPlatform:()=>process.platform,hasScreenCapturePermission:()=>a.ipcRenderer.invoke("hasScreenCapturePermission"),openSystemPreferences:()=>a.ipcRenderer.invoke("openSystemPreferences"),getExcludeSelectWindows:()=>a.ipcRenderer.invoke("getExcludeSelectWindows"),getClientInfo:()=>({sdkVersion:w.tcicSdkVersion}),getSystemInfo:e=>a.ipcRenderer.invoke("getSystemInfo",e),sendCustomMessage(e){a.ipcRenderer.send("onRecvCustomMessage",e)},reloadWindow(e,n){a.ipcRenderer.send("onReloadWindow",e,n)},onPageFinished(e){a.ipcRenderer.send("onPageFinished",e)},closeWindow(){if(window.TCIC){const e=window.TCIC.SDK.instance.getState(window.TCIC.TMainState.Class_Status),n=T(e);n!==S&&a.ipcRenderer.send(n)}a.ipcRenderer.send("onCloseWindow",0)},minimizeWindow(){a.ipcRenderer.send("onMinimizeWindow",0)},maximizeWindow(){a.ipcRenderer.send("onMaximizeWindow",0)},openUrl(e){a.shell.openExternal(e)},selectScreenCaptureTarget(e){this._selectedSource=e},startScreenShare(e){return s(this,void 0,void 0,(function*(){return this._selectedSource&&(e.type=this._selectedSource.type,e.displayId=this._selectedSource.sourceId),a.ipcRenderer.invoke("startScreenShare",e,h)}))},stopScreenShare:()=>h?Promise.resolve():a.ipcRenderer.invoke("stopScreenShare"),getDesktopWindows:e=>new Promise(((n,t)=>{a.ipcRenderer.invoke("getDeskTopWindows",e).then((e=>{n(e)})).catch((e=>{t(e)}))})),callMethod(e){a.ipcRenderer.send("callMethod",e),"board"===e.module&&"setToolType"===e.method&&(C=e.params[0])},saveSnapshot(e,n,t,o){const r={snapId:e,base64Data:n,snapName:t,dialog:o};return new Promise(((e,n)=>{a.ipcRenderer.invoke("saveImage",r).then((t=>{t.hasOwnProperty("errcode")?n(t):e(t)}))}))},checkDNSParsing:e=>new Promise((n=>{const t=Date.now();c.default.lookup(e,((e,o,r)=>{n({error:e,cost:Date.now()-t,address:o})}))})),loadVideo(e,n){const t=e.getBoundingClientRect(),o={x:t.left,y:t.top,width:t.width,height:t.height};return a.ipcRenderer.invoke("loadVideo",{bounds:o,url:n})},playVideo:()=>a.ipcRenderer.invoke("playVideo"),pauseVideo:()=>a.ipcRenderer.invoke("pauseVideo"),stopVideo:()=>a.ipcRenderer.invoke("stopVideo"),seekVideo:e=>a.ipcRenderer.invoke("seekVideo",e),setVideoVolume:e=>a.ipcRenderer.invoke("setVideoVolume",e),downloadMusic:e=>a.ipcRenderer.invoke("downloadMusic",e),startSubCamera:e=>a.ipcRenderer.invoke("startSubCamera",e),stopSubCamera:()=>a.ipcRenderer.invoke("stopSubCamera"),onReceiveMessage:e=>a.ipcRenderer.invoke("onReceiveMessage",e),getWindowId(){const e=a.remote.getCurrentWindow();let n="";try{n=e.getMediaSourceId().split(":")[1]}catch(e){console.error(e)}finally{return n}}};const T=e=>e===window.TCIC.TClassStatus.Already_Start?"onTCICClassStart":e===window.TCIC.TClassStatus.Has_Ended?"onTCICClassStop":e===window.TCIC.TClassStatus.Has_Expired?"onTCICClassExpired":"onTCICClassInit";new Promise(((e,n)=>{a.ipcRenderer.on("init",((n,t)=>{console.log("init",t),window.TCIC&&(window.TCIC.SDK.instance.registerState(f,"屏幕共享白板撤销状态",!1),window.TCIC.SDK.instance.registerState(v,"屏幕共享白板重做状态",!1),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Layout,(e=>{a.ipcRenderer.send("onClassLayoutChanged",e)})),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Status,(e=>{S=T(e),a.ipcRenderer.send(S)})),window.TCIC.SDK.instance.subscribeState(window.TCICUI.Constant.TStatePassThroughStatus,(e=>{a.remote.getCurrentWindow().setIgnoreMouseEvents(e,{forward:!0})})),window.TCIC.SDK.instance.subscribeState(window.TCICUI.Constant.TStatePPtSharingState,(e=>{h=e}))),e(t)})),a.ipcRenderer.on("onScreenShareSnapshot",((e,n)=>{window.screenShareSnapshotCallback&&window.screenShareSnapshotCallback(n)})),a.ipcRenderer.on("leaveClass",(e=>{window.TCIC?window.TCIC.SDK.instance.leaveClass():window.Electron.closeWindow()})),a.ipcRenderer.on("sendCustomMessage",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Recv_Custom_Msg,n)})),a.ipcRenderer.on("onBoardCanRedoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(v,n)})),a.ipcRenderer.on("onBoardCanUndoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(f,n)})),a.ipcRenderer.on("onVideoTimeUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Update,n)})),a.ipcRenderer.on("onVideoTimeSeeked",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Seeked,n)})),a.ipcRenderer.on("onVersionUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Version_Update,n)})),a.ipcRenderer.on("onReceiveMessage",((e,n)=>{window.TCICUI&&window.TCICUI.onReceiveMessage(n)}))})).then((e=>{setTimeout((()=>{!function(e){const n="touchstart",t=()=>{window.removeEventListener(n,t,!0),a.ipcRenderer.send("enableTouchScreenOptimize");const e=["touchstart","touchmove","touchend","mousedown","mousemove","mouseup"];a.ipcRenderer.on("enableWatchMouseMoveEvent",((n,t)=>{p.watchEvents(window,e,t)}))};window.addEventListener(n,t,!0)}()}),1e3)}))},280:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.watchEvents=void 0;const o=t(933);t(376).initSentry();const r=e=>{let n,t;if(e instanceof TouchEvent?(n=Math.round(e.changedTouches[0].screenX),t=Math.round(e.changedTouches[0].screenY)):(n=e.screenX,t=e.screenY),0!==n||0!==t){const r={type:e.type,x:n,y:t};o.ipcRenderer.send("onMouseEvent",r),console.log("onMouseEvent",r)}};n.watchEvents=function(e,n,t){n.forEach((n=>{t?e.addEventListener(n,r,{capture:!0,passive:!1}):e.removeEventListener(n,r,{capture:!0})}))}},376:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return r(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.initSentry=n.setReportInfo=void 0;const s=i(t(933)),d=t(425),a=t(648),c={userId:""};function u(e,n=null){c.userId=e,d.configureScope((e=>{console.log("setReportInfo",a.tcicSdkVersion,c.userId),e.setTag("extra.sdk",a.tcicSdkVersion),e.setUser({id:c.userId})})),n&&n.send("setReportInfo",e)}n.setReportInfo=u,"renderer"===process.type&&s.ipcRenderer.on("setReportInfo",((e,n)=>{u(n)})),n.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};d.init(e)}},648:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tcicSdkBranch=n.tcicSdkVersion=void 0,n.tcicSdkVersion="1.7.3.426",n.tcicSdkBranch="1.7.3"},425:e=>{e.exports=require("@sentry/electron")},881:e=>{e.exports=require("dns")},933:e=>{e.exports=require("electron")},557:e=>{e.exports=require("trtc-electron-sdk")},574:e=>{e.exports=require("trtc-electron-sdk/liteav/trtc_define")}},n={};!function t(o){var r=n[o];if(void 0!==r)return r.exports;var i=n[o]={exports:{}};return e[o].call(i.exports,i,i.exports,t),i.exports}(853)})();
|
package/dist/resource.zip
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={376:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const r=d(i(933)),s=i(425),c=i(648),a={userId:""};function l(e,t=null){a.userId=e,s.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,a.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:a.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=l,"renderer"===process.type&&r.ipcRenderer.on("setReportInfo",((e,t)=>{l(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};s.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.
|
|
1
|
+
(()=>{"use strict";var e={376:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.initSentry=t.setReportInfo=void 0;const r=d(i(933)),s=i(425),c=i(648),a={userId:""};function l(e,t=null){a.userId=e,s.configureScope((e=>{console.log("setReportInfo",c.tcicSdkVersion,a.userId),e.setTag("extra.sdk",c.tcicSdkVersion),e.setUser({id:a.userId})})),t&&t.send("setReportInfo",e)}t.setReportInfo=l,"renderer"===process.type&&r.ipcRenderer.on("setReportInfo",((e,t)=>{l(t)})),t.initSentry=function(){const e={appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:"renderer"!==process.type};s.init(e)}},648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tcicSdkBranch=t.tcicSdkVersion=void 0,t.tcicSdkVersion="1.7.3.426",t.tcicSdkBranch="1.7.3"},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var d=t[n]={exports:{}};return e[n].call(d.exports,d,d.exports,i),d.exports}(()=>{const e=i(933);i(376).initSentry();class t{constructor(){this._videoElement=document.getElementById("video"),this._videoElement.addEventListener("timeupdate",(()=>{this.onVideoTimeUpdate()})),this._videoElement.addEventListener("durationchange",(()=>{this.onVideoTimeUpdate()})),this._videoElement.addEventListener("seeked",(()=>{this.onVideoTimeSeeked()})),this._videoElement.addEventListener("canplay",(()=>{e.ipcRenderer.send("canplay",{width:this._videoElement.videoWidth,height:this._videoElement.videoHeight}),this.onVideoTimeUpdate()}))}static get instance(){return null===this._instance&&(this._instance=new t),this._instance}loadVideo(e){this._videoElement.src=e}playVideo(){this._videoElement.play()}pauseVideo(){this._videoElement.pause()}stopVideo(){this._videoElement.stop()}seekVideo(e){this._videoElement.currentTime=e}setVideoVolume(e){this._videoElement.volume=e}onVideoTimeUpdate(){const t=this._videoElement.duration,i=this._videoElement.currentTime;t&&e.ipcRenderer.send("onVideoTimeUpdate",{duration:Math.floor(t),currentTime:Math.floor(i)})}onVideoTimeSeeked(){const t=this._videoElement.duration,i=this._videoElement.currentTime;t&&e.ipcRenderer.send("onVideoTimeSeeked",{duration:Math.floor(t),currentTime:Math.floor(i)})}}t._instance=null,e.ipcRenderer.on("loadVideo",((e,i)=>{t.instance.loadVideo(i)})),e.ipcRenderer.on("playVideo",(e=>{t.instance.playVideo()})),e.ipcRenderer.on("pauseVideo",(e=>{t.instance.pauseVideo()})),e.ipcRenderer.on("stopVideo",(e=>{t.instance.stopVideo()})),e.ipcRenderer.on("seekVideo",((e,i)=>{t.instance.seekVideo(i)})),e.ipcRenderer.on("setVideoVolume",((e,i)=>{t.instance.setVideoVolume(i)}))})()})();
|