driver/codeMirror/index.js000644 0000036273 14371605320012765 0ustar00000000 000000 exports.default=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function u(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}c((r=r.apply(e,t||[])).next())}))};let i;Object.defineProperty(t,"__esModule",{value:!0});class o{constructor(e,t){this.context=e,this.cm=t,this.currentLine=null,this.doc=this.cm.getDoc(),this.ws=i,this.init()}init(){return r(this,void 0,void 0,(function*(){if(!this.ws){const e=yield this.context.postMessage({event:"queryWsPort"});if(!e)return void setTimeout(this.init.bind(this),500);this.ws=i=new WebSocket("ws://127.0.0.1:"+e)}this.ws.onmessage=e=>r(this,void 0,void 0,(function*(){const t=JSON.parse(yield e.data.text());this.handleWsMessage(t)}))}))}handleWsMessage(e){if("cm"!==e.from)switch(e.event){case"moveCursor":return this.moveCursorToLine(e.payload.line);case"select":return this.selectText(e.payload.from,e.payload.to)}}reportSelection(e,t){var n;const r=t.ranges[0];null===(n=this.ws)||void 0===n||n.send(JSON.stringify({from:"cm",event:"select",payload:{from:r.from(),to:r.to()}}))}updateCursorLine(){const e=this.doc.getCursor().line+1;e!==this.currentLine&&(this.currentLine=e,this.ws.send(JSON.stringify({from:"cm",event:"updateCurrentLine",payload:{line:e}})))}selectText(e,t){console.log(e,t),this.doc.setSelection({line:e.line-1,ch:e.ch},{line:t.line-1,ch:t.ch}),this.cm.focus()}moveCursorToLine(e){this.doc.setCursor({line:e-1,ch:0}),this.cm.focus(),this.updateCursorLine()}}t.default=function(e){return{plugin:function(t){t.defineOption("updateCurrentLine",!1,t=>{const n=new o(e,t);t.on("cursorActivity",n.updateCursorLine.bind(n))})},codeMirrorOptions:{updateCurrentLine:!0}}}}]).default; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9kZWZhdWx0L3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL2RlZmF1bHQvLi9zcmMvZHJpdmVyL2NvZGVNaXJyb3IvaW5kZXgudHMiXSwibmFtZXMiOlsiaW5zdGFsbGVkTW9kdWxlcyIsIl9fd2VicGFja19yZXF1aXJlX18iLCJtb2R1bGVJZCIsImV4cG9ydHMiLCJtb2R1bGUiLCJpIiwibCIsIm1vZHVsZXMiLCJjYWxsIiwibSIsImMiLCJkIiwibmFtZSIsImdldHRlciIsIm8iLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImVudW1lcmFibGUiLCJnZXQiLCJyIiwiU3ltYm9sIiwidG9TdHJpbmdUYWciLCJ2YWx1ZSIsInQiLCJtb2RlIiwiX19lc01vZHVsZSIsIm5zIiwiY3JlYXRlIiwia2V5IiwiYmluZCIsIm4iLCJvYmplY3QiLCJwcm9wZXJ0eSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5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IGN1cnNvci51cGRhdGVDdXJzb3JMaW5lLmJpbmQoY3Vyc29yKSk7XG4gICAgICAgIC8vIGNtLm9uKCdiZWZvcmVTZWxlY3Rpb25DaGFuZ2UnLCBjdXJzb3IucmVwb3J0U2VsZWN0aW9uLmJpbmQoY3Vyc29yKSk7XG4gICAgICB9KTtcbiAgICB9LFxuICAgIGNvZGVNaXJyb3JPcHRpb25zOiB7XG4gICAgICB1cGRhdGVDdXJyZW50TGluZTogdHJ1ZSxcbiAgICB9LFxuICB9O1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==driver/markdownViewer/index.js000644 0000024103 14371605320013651 0ustar00000000 000000 exports.default=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e){const t=["paragraph_open","heading_open","image","code_block","fence","blockquote_open","list_item_open"];for(const n of t){const t=e.renderer.rules[n],r=(e,n,r,o,u)=>{const i=e[n];return i.map&&i.map.length&&i.attrSet("data-source-line",String(i.map[0]+1)),t?t(e,n,r,o,u):u.renderToken(e,n,r)};e.renderer.rules[n]=r}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{plugin:r,assets:function(){return[{name:"webview/index.js"},{name:"webview/style.css"}]}}}}]).default; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9kZWZhdWx0L3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL2RlZmF1bHQvLi9zcmMvZHJpdmVyL21hcmtkb3duVmlld2VyL2luZGV4LnRzIl0sIm5hbWVzIjpbImluc3RhbGxlZE1vZHVsZXMiLCJfX3dlYnBhY2tfcmVxdWlyZV9fIiwibW9kdWxlSWQiLCJleHBvcnRzIiwibW9kdWxlIiwiaSIsImwiLCJtb2R1bGVzIiwiY2FsbCIsIm0iLCJjIiwiZCIsIm5hbWUiLCJnZXR0ZXIiLCJvIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJlbnVtZXJhYmxlIiwiZ2V0IiwiciIsIlN5bWJvbCIsInRvU3RyaW5nVGFnIiwidmFsdWUiLCJ0IiwibW9kZSIsIl9fZXNNb2R1bGUiLCJucyIsImNyZWF0ZSIsImtleSIsImJpbmQiLCJuIiwib2JqZWN0IiwicHJvcGVydHkiLCJwcm90b3R5cGUiLCJoYXNPd25Qcm9wZXJ0eSIsInAiLCJzIiwic291cmNlTWFwIiwibWQiLCJydWxlcyIsInJ1bGUiLCJvcmlnaW5hbCIsInJlbmRlcmVyIiwibmV3UnVsZSIsInRva2VucyIsImlkeCIsIm9wdGlvbnMiLCJlbnYiLCJzZWxmIiwidG9rZW4iLCJtYXAiLCJsZW5ndGgiLCJhdHRyU2V0IiwiU3RyaW5nIiwicmVuZGVyVG9rZW4iLCJwbHVnaW4iLCJhc3NldHMiXSwibWFwcGluZ3MiOiI0QkFDRSxJQUFJQSxFQUFtQixHQUd2QixTQUFTQyxFQUFvQkMsR0FHNUIsR0FBR0YsRUFBaUJFLEdBQ25CLE9BQU9GLEVBQWlCRSxHQUFVQyxRQUdu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G4gICAgfTtcblxuICAgIG1kLnJlbmRlcmVyLnJ1bGVzW3J1bGVdID0gbmV3UnVsZTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiAoKSB7XG4gIHJldHVybiB7XG4gICAgcGx1Z2luOiBzb3VyY2VNYXAsXG4gICAgYXNzZXRzOiBmdW5jdGlvbiAoKSB7XG4gICAgICByZXR1cm4gW3sgbmFtZTogJ3dlYnZpZXcvaW5kZXguanMnIH0sIHsgbmFtZTogJ3dlYnZpZXcvc3R5bGUuY3NzJyB9XTtcbiAgICB9LFxuICB9O1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==driver/markdownViewer/webview/index.js000644 0000057235 14371605320015335 0ustar00000000 000000 !function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=t.PORT=t.BEHAVIOR_IN_VIEW_MODE=t.SECTION_NAME=t.CODE_MIRROR_SCRIPT_ID=t.MARKDOWN_SCRIPT_ID=void 0,t.MARKDOWN_SCRIPT_ID="ylc395.betterMarkdownViewer.contentScriptMarkdownIt",t.CODE_MIRROR_SCRIPT_ID="ylc395.betterMarkdownViewer.contentScriptCodeMirror",t.SECTION_NAME="Cursor Sync",t.BEHAVIOR_IN_VIEW_MODE="behaviorInViewMode",t.PORT="port",t.DEFAULT_PORT=3e3},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function c(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(0),o=n(2),s="better-markdown-viewer-highlight-line";new class{constructor(){this.selection=document.getSelection(),this.initWs(),this.monitorDblclick(),(0,o.isDarkTheme)().then(e=>this.isDarkTheme=e)}initWs(){return i(this,void 0,void 0,(function*(){const e=yield webviewApi.postMessage(r.MARKDOWN_SCRIPT_ID,{event:"queryWsPort"});this.ws=new WebSocket("ws://127.0.0.1:"+e),this.ws.addEventListener("message",e=>i(this,void 0,void 0,(function*(){const t=JSON.parse(yield e.data.text());this.handleWsMessage(t)})))}))}highlightLine(e){const t=document.querySelectorAll("."+s);for(const e of t)e.classList.remove(s),e.classList.remove("better-markdown-viewer-highlight-line-dark");const n=(0,o.getLineEl)(e);n&&(n.classList.add(s),this.isDarkTheme&&n.classList.add("better-markdown-viewer-highlight-line-dark"))}monitorDblclick(){document.addEventListener("dblclick",e=>{var t;const n=(0,o.getLine)(e.target);n&&(null===(t=this.ws)||void 0===t||t.send(JSON.stringify({from:"md",event:"moveCursor",payload:{line:n}})))})}monitorSelect(){document.addEventListener("selectionchange",()=>{var e;const{anchorNode:t,focusNode:n}=this.selection,i=(0,o.getLineOfNode)(t),r=(0,o.getLineOfNode)(n);i&&r&&(null===(e=this.ws)||void 0===e||e.send(JSON.stringify({from:"md",event:"select",payload:{from:{line:i,ch:this.selection.anchorOffset},to:{line:r,ch:this.selection.focusOffset}}})))})}selectText(e,t){const n=document.createRange(),i=(0,o.getLineEl)(e.line+1),r=(0,o.getLineEl)(t.line+1);i&&r&&(n.setStart(i,e.ch),n.setEnd(r,t.ch),this.selection.addRange(n))}handleWsMessage(e){if("md"!==e.from)switch(e.event){case"updateCurrentLine":return this.highlightLine(e.payload.line)}}}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function c(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isDarkTheme=t.getLineOfNode=t.getLineEl=t.getLine=void 0;const r=n(0);function o(e){return e?e.dataset.sourceLine?Number(e.dataset.sourceLine):e.parentElement?o(e.parentElement):null:null}t.getLine=o,t.getLineEl=function(e){for(let t=e;t>=1;t--){const e=document.querySelector(`[data-source-line="${t}"]`);if(e)return"CODE"===e.tagName&&e.parentElement&&"PRE"===e.parentElement.tagName?e.parentElement:e}return null},t.getLineOfNode=function(e){return e&&e.nodeType===Node.TEXT_NODE?o(e.parentElement):null},t.isDarkTheme=function(){return i(this,void 0,void 0,(function*(){const e=yield webviewApi.postMessage(r.MARKDOWN_SCRIPT_ID,{event:"querySetting",payload:{key:"theme",isGlobal:!0}}),t=yield webviewApi.postMessage(r.MARKDOWN_SCRIPT_ID,{event:"querySetting",payload:{key:"themeAutoDetect",isGlobal:!0}}),n=yield webviewApi.postMessage(r.MARKDOWN_SCRIPT_ID,{event:"querySetting",payload:{key:"preferredDarkTheme",isGlobal:!0}}),i=[2,22,4,5,6,7],o=i.includes(e),s=i.includes(n);return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&t?s:o}))}}]); //# sourceMappingURL=data:application/json;charset=ut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mxjbGljaycsIChlKSA9PiB7XG4gICAgICBjb25zdCBsaW5lID0gZ2V0TGluZShlLnRhcmdldCBhcyBIVE1MRWxlbWVudCk7XG5cbiAgICAgIGlmICghbGluZSkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIHRoaXMud3M/LnNlbmQoXG4gICAgICAgIEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICBmcm9tOiAnbWQnLFxuICAgICAgICAgIGV2ZW50OiAnbW92ZUN1cnNvcicsXG4gICAgICAgICAgcGF5bG9hZDogeyBsaW5lIH0sXG4gICAgICAgIH0pLFxuICAgICAgKTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgbW9uaXRvclNlbGVjdCgpIHtcbiAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCdzZWxlY3Rpb25jaGFuZ2UnLCAoKSA9PiB7XG4gICAgICBjb25zdCB7IGFuY2hvck5vZGUsIGZvY3VzTm9kZSB9ID0gdGhpcy5zZWxlY3Rpb247XG4gICAgICBjb25zdCBzdGFydExpbmUgPSBnZXRMaW5lT2ZOb2RlKGFuY2hvck5vZGUpO1xuICAgICAgY29uc3QgZW5kTGluZSA9IGdldExpbmVPZk5vZGUoZm9jdXNOb2RlKTtcblxuICAgICAgaWYgKCFzdGFydExpbmUgfHwgIWVuZExpbmUpIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuXG4gICAgICB0aGlzLndzPy5zZW5kKFxuICAgICAgICBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgZnJvbTogJ21kJyxcbiAgICAgICAgICBldmVudDogJ3NlbGVjdCcsXG4gICAgICAgICAgcGF5bG9hZDoge1xuICAgICAgICAgICAgZnJvbTogeyBsaW5lOiBzdGFydExpbmUsIGNoOiB0aGlzLnNlbGVjdGlvbi5hbmNob3JPZmZzZXQgfSxcbiAgICAgICAgICAgIHRvOiB7IGxpbmU6IGVuZExpbmUsIGNoOiB0aGlzLnNlbGV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000 000000 .better-markdown-viewer-highlight-line { background-color: #fdffbc; } .better-markdown-viewer-highlight-line-dark { background-color: rgb(78, 78, 78); } index.js000644 0001171765 14371605314007377 0ustar00000000 000000 !function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=18)}([function(e,t,i){"use strict";e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},function(e,t){e.exports=require("net")},function(e,t,i){"use strict";const r=i(24),n=i(3),o=i(25),{kStatusCode:s}=i(0),a=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),l=Symbol("total-length"),h=Symbol("callback"),d=Symbol("buffers"),u=Symbol("error");let f;function _(e){this[d].push(e),this[l]+=e.length}function p(e){this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload?this[d].push(e):(this[u]=new RangeError("Max payload size exceeded"),this[u].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[u][s]=1009,this.removeListener("data",p),this.reset())}function m(e){this[c]._inflate=null,e[s]=1007,this[h](e)}e.exports=class{constructor(e,t,i){if(this._maxPayload=0|i,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!f){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;f=new o(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[h];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,i=e.find(e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(i.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?i.client_max_window_bits=t.clientMaxWindowBits:!0!==i.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete i.client_max_window_bits,i}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let i=e[t];if(i.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(i=i[0],"client_max_window_bits"===t){if(!0!==i){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}else if("server_max_window_bits"===t){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==i)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}e[t]=i})}),e}decompress(e,t,i){f.add(r=>{this._decompress(e,t,(e,t)=>{r(),i(e,t)})})}compress(e,t,i){f.add(r=>{this._compress(e,t,(e,t)=>{r(),i(e,t)})})}_decompress(e,t,i){const o=this._isServer?"client":"server";if(!this._inflate){const e=o+"_max_window_bits",t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on("error",m),this._inflate.on("data",p)}this._inflate[h]=i,this._inflate.write(e),t&&this._inflate.write(a),this._inflate.flush(()=>{const e=this._inflate[u];if(e)return this._inflate.close(),this._inflate=null,void i(e);const r=n.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[o+"_no_context_takeover"]&&this._inflate.reset()),i(null,r)})}_compress(e,t,i){const o=this._isServer?"server":"client";if(!this._deflate){const e=o+"_max_window_bits",t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on("data",_)}this._deflate[h]=i,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=n.concat(this._deflate[d],this._deflate[l]);t&&(e=e.slice(0,e.length-4)),this._deflate[h]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[o+"_no_context_takeover"]&&this._deflate.reset(),i(null,e)})}}},function(e,t,i){"use strict";const{EMPTY_BUFFER:r}=i(0);function n(e,t){if(0===e.length)return r;if(1===e.length)return e[0];const i=Buffer.allocUnsafe(t);let n=0;for(let t=0;t=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function o(e){const t=e.length;let i=0;for(;i=t||128!=(192&e[i+1])||128!=(192&e[i+2])||224===e[i]&&128==(224&e[i+1])||237===e[i]&&160==(224&e[i+1]))return!1;i+=3}else{if(240!=(248&e[i]))return!1;if(i+3>=t||128!=(192&e[i+1])||128!=(192&e[i+2])||128!=(192&e[i+3])||240===e[i]&&128==(240&e[i+1])||244===e[i]&&e[i+1]>143||e[i]>244)return!1;i+=4}return!0}try{const t=i(!function(){var e=new Error("Cannot find module 'utf-8-validate'");throw e.code="MODULE_NOT_FOUND",e}());e.exports={isValidStatusCode:n,isValidUTF8:e=>e.length<150?o(e):t(e),tokenChars:r}}catch(t){e.exports={isValidStatusCode:n,isValidUTF8:o,tokenChars:r}}},function(e,t){e.exports=require("tls")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("stream")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=joplin},function(e,t,i){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ContentScriptType=t.SettingStorage=t.AppType=t.SettingItemType=t.ToolbarButtonLocation=t.isContextMenuItemLocation=t.MenuItemLocation=t.ImportModuleOutputFormat=t.FileSystemItem=void 0,function(e){e.File="file",e.Directory="directory"}(t.FileSystemItem||(t.FileSystemItem={})),function(e){e.Markdown="md",e.Html="html"}(t.ImportModuleOutputFormat||(t.ImportModuleOutputFormat={})),function(e){e.File="file",e.Edit="edit",e.View="view",e.Note="note",e.Tools="tools",e.Help="help",e.Context="context",e.NoteListContextMenu="noteListContextMenu",e.EditorContextMenu="editorContextMenu",e.FolderContextMenu="folderContextMenu",e.TagContextMenu="tagContextMenu"}(r=t.MenuItemLocation||(t.MenuItemLocation={})),t.isContextMenuItemLocation=function(e){return[r.Context,r.NoteListContextMenu,r.EditorContextMenu,r.FolderContextMenu,r.TagContextMenu].includes(e)},function(e){e.NoteToolbar="noteToolbar",e.EditorToolbar="editorToolbar"}(t.ToolbarButtonLocation||(t.ToolbarButtonLocation={})),function(e){e[e.Int=1]="Int",e[e.String=2]="String",e[e.Bool=3]="Bool",e[e.Array=4]="Array",e[e.Object=5]="Object",e[e.Button=6]="Button"}(t.SettingItemType||(t.SettingItemType={})),function(e){e.Desktop="desktop",e.Mobile="mobile",e.Cli="cli"}(t.AppType||(t.AppType={})),function(e){e[e.Database=1]="Database",e[e.File=2]="File"}(t.SettingStorage||(t.SettingStorage={})),function(e){e.MarkdownItPlugin="markdownItPlugin",e.CodeMirrorPlugin="codeMirrorPlugin"}(t.ContentScriptType||(t.ContentScriptType={}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=t.PORT=t.BEHAVIOR_IN_VIEW_MODE=t.SECTION_NAME=t.CODE_MIRROR_SCRIPT_ID=t.MARKDOWN_SCRIPT_ID=void 0,t.MARKDOWN_SCRIPT_ID="ylc395.betterMarkdownViewer.contentScriptMarkdownIt",t.CODE_MIRROR_SCRIPT_ID="ylc395.betterMarkdownViewer.contentScriptCodeMirror",t.SECTION_NAME="Cursor Sync",t.BEHAVIOR_IN_VIEW_MODE="behaviorInViewMode",t.PORT="port",t.DEFAULT_PORT=3e3},function(e,t,i){"use strict";const r=i(12),n=i(13),o=i(14),s=i(1),a=i(5),{randomBytes:c,createHash:l}=i(6),{Readable:h}=i(7),{URL:d}=i(23),u=i(2),f=i(15),_=i(16),{BINARY_TYPES:p,EMPTY_BUFFER:m,GUID:y,kForOnEventAttribute:g,kListener:v,kStatusCode:b,kWebSocket:S,NOOP:w}=i(0),{EventTarget:{addEventListener:E,removeEventListener:x}}=i(26),{format:k,parse:O}=i(17),{toBuffer:T}=i(3),C=["CONNECTING","OPEN","CLOSING","CLOSED"],N=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,P=[8,13];class I extends r{constructor(e,t,i){super(),this._binaryType=p[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=m,this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=I.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(i=t,t=[]):t=[t]),function e(t,i,r,s){const a={protocolVersion:P[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!P.includes(a.protocolVersion))throw new RangeError(`Unsupported protocol version: ${a.protocolVersion} (supported versions: ${P.join(", ")})`);let h;if(i instanceof d)h=i,t._url=i.href;else{try{h=new d(i)}catch(e){throw new SyntaxError("Invalid URL: "+i)}t._url=i}const f="wss:"===h.protocol,_="ws+unix:"===h.protocol;if("ws:"!==h.protocol&&!f&&!_)throw new SyntaxError('The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"');if(_&&!h.pathname)throw new SyntaxError("The URL's pathname is empty");if(h.hash)throw new SyntaxError("The URL contains a fragment identifier");const p=f?443:80,m=c(16).toString("base64"),g=f?n.get:o.get,v=new Set;let b;a.createConnection=f?R:L,a.defaultPort=a.defaultPort||p,a.port=h.port||p,a.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,a.headers={"Sec-WebSocket-Version":a.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket",...a.headers},a.path=h.pathname+h.search,a.timeout=a.handshakeTimeout,a.perMessageDeflate&&(b=new u(!0!==a.perMessageDeflate?a.perMessageDeflate:{},!1,a.maxPayload),a.headers["Sec-WebSocket-Extensions"]=k({[u.extensionName]:b.offer()}));if(r.length){for(const e of r){if("string"!=typeof e||!N.test(e)||v.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(e)}a.headers["Sec-WebSocket-Protocol"]=r.join(",")}a.origin&&(a.protocolVersion<13?a.headers["Sec-WebSocket-Origin"]=a.origin:a.headers.Origin=a.origin);(h.username||h.password)&&(a.auth=`${h.username}:${h.password}`);if(_){const e=a.path.split(":");a.socketPath=e[0],a.path=e[1]}let S=t._req=g(a);a.timeout&&S.on("timeout",()=>{M(t,S,"Opening handshake has timed out")});S.on("error",e=>{null===S||S.aborted||(S=t._req=null,t._readyState=I.CLOSING,t.emit("error",e),t.emitClose())}),S.on("response",n=>{const o=n.headers.location,c=n.statusCode;if(o&&a.followRedirects&&c>=300&&c<400){if(++t._redirects>a.maxRedirects)return void M(t,S,"Maximum redirects exceeded");S.abort();const n=new d(o,i);e(t,n,r,s)}else t.emit("unexpected-response",S,n)||M(t,S,"Unexpected server response: "+n.statusCode)}),S.on("upgrade",(e,i,r)=>{if(t.emit("upgrade",e),t.readyState!==I.CONNECTING)return;S=t._req=null;const n=l("sha1").update(m+y).digest("base64");if(e.headers["sec-websocket-accept"]!==n)return void M(t,i,"Invalid Sec-WebSocket-Accept header");const o=e.headers["sec-websocket-protocol"];let s;if(void 0!==o?v.size?v.has(o)||(s="Server sent an invalid subprotocol"):s="Server sent a subprotocol but none was requested":v.size&&(s="Server sent no subprotocol"),s)return void M(t,i,s);o&&(t._protocol=o);const c=e.headers["sec-websocket-extensions"];if(void 0!==c){if(!b){return void M(t,i,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=O(c)}catch(e){return void M(t,i,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==u.extensionName){return void M(t,i,"Server indicated an extension that was not requested")}try{b.accept(e[u.extensionName])}catch(e){return void M(t,i,"Invalid Sec-WebSocket-Extensions header")}t._extensions[u.extensionName]=b}t.setSocket(i,r,{maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation})})}(this,e,t,i)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){p.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,i){const r=new f({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});this._sender=new _(e,this._extensions),this._receiver=r,this._socket=e,r[S]=this,e[S]=this,r.on("conclude",U),r.on("drain",B),r.on("error",A),r.on("message",F),r.on("ping",V),r.on("pong",j),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",q),e.on("data",$),e.on("end",H),e.on("error",z),this._readyState=I.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=I.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=I.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==I.CLOSED){if(this.readyState===I.CONNECTING){const e="WebSocket was closed before the connection was established";return M(this,this._req,e)}this.readyState!==I.CLOSING?(this._readyState=I.CLOSING,this._sender.close(e,t,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}ping(e,t,i){if(this.readyState===I.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(i=e,e=t=void 0):"function"==typeof t&&(i=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===I.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||m,t,i)):D(this,e,i)}pong(e,t,i){if(this.readyState===I.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(i=e,e=t=void 0):"function"==typeof t&&(i=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===I.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||m,t,i)):D(this,e,i)}send(e,t,i){if(this.readyState===I.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(i=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==I.OPEN)return void D(this,e,i);const r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(e||m,r,i)}terminate(){if(this.readyState!==I.CLOSED){if(this.readyState===I.CONNECTING){const e="WebSocket was closed before the connection was established";return M(this,this._req,e)}this._socket&&(this._readyState=I.CLOSING,this._socket.destroy())}}}function L(e){return e.path=e.socketPath,s.connect(e)}function R(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=s.isIP(e.host)?"":e.host),a.connect(e)}function M(e,t,i){e._readyState=I.CLOSING;const r=new Error(i);Error.captureStackTrace(r,M),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function D(e,t,i){if(t){const i=T(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(i){i(new Error(`WebSocket is not open: readyState ${e.readyState} (${C[e.readyState]})`))}}function U(e,t){const i=this[S];i._closeFrameReceived=!0,i._closeMessage=t,i._closeCode=e,void 0!==i._socket[S]&&(i._socket.removeListener("data",$),process.nextTick(G,i._socket),1005===e?i.close():i.close(e,t))}function B(){this[S]._socket.resume()}function A(e){const t=this[S];void 0!==t._socket[S]&&(t._socket.removeListener("data",$),process.nextTick(G,t._socket),t.close(e[b])),t.emit("error",e)}function W(){this[S].emitClose()}function F(e,t){this[S].emit("message",e,t)}function V(e){const t=this[S];t.pong(e,!t._isServer,w),t.emit("ping",e)}function j(e){this[S].emit("pong",e)}function G(e){e.resume()}function q(){const e=this[S];let t;this.removeListener("close",q),this.removeListener("data",$),this.removeListener("end",H),e._readyState=I.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[S]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",W),e._receiver.on("finish",W))}function $(e){this[S]._receiver.write(e)||this.pause()}function H(){const e=this[S];e._readyState=I.CLOSING,e._receiver.end(),this.end()}function z(){const e=this[S];this.removeListener("error",z),this.on("error",w),e&&(e._readyState=I.CLOSING,this.destroy())}Object.defineProperty(I,"CONNECTING",{enumerable:!0,value:C.indexOf("CONNECTING")}),Object.defineProperty(I.prototype,"CONNECTING",{enumerable:!0,value:C.indexOf("CONNECTING")}),Object.defineProperty(I,"OPEN",{enumerable:!0,value:C.indexOf("OPEN")}),Object.defineProperty(I.prototype,"OPEN",{enumerable:!0,value:C.indexOf("OPEN")}),Object.defineProperty(I,"CLOSING",{enumerable:!0,value:C.indexOf("CLOSING")}),Object.defineProperty(I.prototype,"CLOSING",{enumerable:!0,value:C.indexOf("CLOSING")}),Object.defineProperty(I,"CLOSED",{enumerable:!0,value:C.indexOf("CLOSED")}),Object.defineProperty(I.prototype,"CLOSED",{enumerable:!0,value:C.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach(e=>{Object.defineProperty(I.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(I.prototype,"on"+e,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[g])return t[v];return null},set(t){for(const t of this.listeners(e))if(t[g]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[g]:!0})}})}),I.prototype.addEventListener=E,I.prototype.removeEventListener=x,e.exports=I},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("http")},function(e,t,i){"use strict";const{Writable:r}=i(7),n=i(2),{BINARY_TYPES:o,EMPTY_BUFFER:s,kStatusCode:a,kWebSocket:c}=i(0),{concat:l,toArrayBuffer:h,unmask:d}=i(3),{isValidStatusCode:u,isValidUTF8:f}=i(4);function _(e,t,i,r,n){const o=new e(i?"Invalid WebSocket frame: "+t:t);return Error.captureStackTrace(o,_),o.code=n,o[a]=r,o}e.exports=class extends r{constructor(e={}){super(),this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,i){if(8===this._opcode&&0==this._state)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e=i.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),r),this._buffers[0]=i.slice(e)),e-=i.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,_(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[n.extensionName])return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,_(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,_(RangeError,"invalid opcode "+this._opcode,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,_(RangeError,"invalid opcode "+this._opcode,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,_(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,_(RangeError,"invalid payload length "+this._payloadLength,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,_(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,_(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,_(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=s;if(this._payloadLength){if(this._bufferedBytes7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[n.extensionName].decompress(e,this._fin,(e,i)=>{if(e)return t(e);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(i)}const r=this.dataMessage();if(r)return t(r);this.startLoop(t)})}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let i;i="nodebuffer"===this._binaryType?l(t,e):"arraybuffer"===this._binaryType?h(l(t,e)):t,this.emit("message",i,!0)}else{const i=l(t,e);if(!this._skipUTF8Validation&&!f(i))return this._loop=!1,_(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",i,!1)}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,s),this.end();else{if(1===e.length)return _(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!u(t))return _(RangeError,"invalid status code "+t,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const i=e.slice(2);if(!this._skipUTF8Validation&&!f(i))return _(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,i),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},function(e,t,i){"use strict";i(1),i(5);const{randomFillSync:r}=i(6),n=i(2),{EMPTY_BUFFER:o}=i(0),{isValidStatusCode:s}=i(4),{mask:a,toBuffer:c}=i(3),l=Buffer.alloc(4);class h{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){const i=t.mask&&t.readOnly;let n=t.mask?6:2,o=e.length;e.length>=65536?(n+=8,o=127):e.length>125&&(n+=2,o=126);const s=Buffer.allocUnsafe(i?e.length+n:n);return s[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(s[0]|=64),s[1]=o,126===o?s.writeUInt16BE(e.length,2):127===o&&(s.writeUInt32BE(0,2),s.writeUInt32BE(e.length,6)),t.mask?(r(l,0,4),s[1]|=128,s[n-4]=l[0],s[n-3]=l[1],s[n-2]=l[2],s[n-1]=l[3],i?(a(e,l,s,n,e.length),[s]):(a(e,l,e,0,e.length),[s,e])):[s,e]}close(e,t,i,r){let n;if(void 0===e)n=o;else{if("number"!=typeof e||!s(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const i=Buffer.byteLength(t);if(i>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+i),n.writeUInt16BE(e,0),"string"==typeof t?n.write(t,2):n.set(t,2)}else n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0)}this._deflating?this.enqueue([this.doClose,n,i,r]):this.doClose(n,i,r)}doClose(e,t,i){this.sendFrame(h.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),i)}ping(e,t,i){const r=c(e);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,r,t,c.readOnly,i]):this.doPing(r,t,c.readOnly,i)}doPing(e,t,i,r){this.sendFrame(h.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:i}),r)}pong(e,t,i){const r=c(e);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,r,t,c.readOnly,i]):this.doPong(r,t,c.readOnly,i)}doPong(e,t,i,r){this.sendFrame(h.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:i}),r)}send(e,t,i){const r=c(e),o=this._extensions[n.extensionName];let s=t.binary?2:1,a=t.compress;if(this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=r.length>=o._threshold),this._compress=a):(a=!1,s=0),t.fin&&(this._firstFragment=!0),o){const e={fin:t.fin,rsv1:a,opcode:s,mask:t.mask,readOnly:c.readOnly};this._deflating?this.enqueue([this.dispatch,r,this._compress,e,i]):this.dispatch(r,this._compress,e,i)}else this.sendFrame(h.frame(r,{fin:t.fin,rsv1:!1,opcode:s,mask:t.mask,readOnly:c.readOnly}),i)}dispatch(e,t,i,r){if(!t)return void this.sendFrame(h.frame(e,i),r);const o=this._extensions[n.extensionName];this._bufferedBytes+=e.length,this._deflating=!0,o.compress(e,i.fin,(t,n)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof r&&r(e);for(let t=0;t{let i=e[t];return Array.isArray(i)||(i=[i]),i.map(e=>[t].concat(Object.keys(e).map(t=>{let i=e[t];return Array.isArray(i)||(i=[i]),i.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){const t=Object.create(null);let i,o,s=Object.create(null),a=!1,c=!1,l=!1,h=-1,d=-1,u=-1,f=0;for(;f{e.on("message",e=>{t.clients.forEach(t=>{t.readyState===f.OPEN&&t.send(e)});const i=JSON.parse(e.toString());"md"===i.from&&"moveCursor"===i.event&&this.toggleEditorOut()})})}))}init(){return s(this,void 0,void 0,(function*(){yield this.setupSetting(),yield this.startWs(),yield this.setupCodeMirror(),yield this.setupMarkdownViewer()}))}setupMarkdownViewer(){return s(this,void 0,void 0,(function*(){yield c.default.contentScripts.register(l.ContentScriptType.MarkdownItPlugin,h.MARKDOWN_SCRIPT_ID,"./driver/markdownViewer/index.js"),yield c.default.contentScripts.onMessage(h.MARKDOWN_SCRIPT_ID,this.handleRequest.bind(this))}))}setupCodeMirror(){return s(this,void 0,void 0,(function*(){yield c.default.contentScripts.register(l.ContentScriptType.CodeMirrorPlugin,h.CODE_MIRROR_SCRIPT_ID,"./driver/codeMirror/index.js"),yield c.default.contentScripts.onMessage(h.CODE_MIRROR_SCRIPT_ID,this.handleRequest.bind(this))}))}setupSetting(){return s(this,void 0,void 0,(function*(){yield c.default.settings.registerSection(h.SECTION_NAME,{label:"Cursor Sync"}),yield c.default.settings.registerSettings(d.default)}))}handleRequest(e){switch(e.event){case"queryWsPort":return this.port;case"querySetting":return e.payload.isGlobal?c.default.settings.globalValue(e.payload.key):c.default.settings.value(e.payload.key)}}toggleEditorOut(){return s(this,void 0,void 0,(function*(){let e=yield c.default.settings.globalValue("noteVisiblePanes"),t=yield c.default.settings.globalValue("layoutButtonSequence");const i=yield c.default.settings.value(h.BEHAVIOR_IN_VIEW_MODE);if(!(1===e.length&&"viewer"===e[0]))return;const r={[d.Behaviors.None]:()=>!0,[d.Behaviors.Editor]:()=>3===t&&2===e.length||1===e.length&&"editor"===e[0],[d.Behaviors.EditorView]:()=>1===t&&1===e.length&&"editor"===e[0]||2===e.length}[i];for(;!r();)yield c.default.commands.execute("toggleVisiblePanes"),e=yield c.default.settings.globalValue("noteVisiblePanes")}))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Behaviors=void 0;const r=i(9),n=i(10);var o;!function(e){e[e.None=0]="None",e[e.Editor=1]="Editor",e[e.EditorView=2]="EditorView"}(o=t.Behaviors||(t.Behaviors={}));const s={[n.BEHAVIOR_IN_VIEW_MODE]:{label:"What happen when double clicking In View-only layout",isEnum:!0,options:{[o.None]:"Nothing happens",[o.Editor]:"Toggle out Editor",[o.EditorView]:"Toggle out Editor-View"},type:r.SettingItemType.Int,public:!0,value:o.EditorView,section:n.SECTION_NAME,description:"Actual Effect depends on your layout button sequence setting"},[n.PORT]:{label:"Port",type:r.SettingItemType.Int,public:!0,value:n.DEFAULT_PORT,section:n.SECTION_NAME,description:"This plugin will open a port to enable the communication between editor and previewer. Restart Joplin to take effect."}};t.default=s},function(e,t,i){var r=function(){for(var e=[],t=0;t65534?i:(i.length65535)r([e,t,!1]);else{var o=n.createServer();o.on("error",(function(){return r([e,t,!1])})),o.listen(e,t),o.on("listening",(function(){o.close(),o.unref()})),o.on("close",(function(){return r([e,t,!0])}))}}))};t.isFreePort=s,t.getFreePorts=function(e,t,i){return void 0===e&&(e=1),void 0===t&&(t="0.0.0.0"),void 0===i&&(i=[]),new Promise((function(o){var a=n(e),c=i.slice(),l=[];a.forEach((function(e){l.push(s(e,t))})),Promise.all(l).then((function(t){t.filter((function(e){return!1!==e[2]})).map((function(e){return e[0]})).forEach((function(t){c.length{this.pending--,this[n]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[n]()}[n](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[r])}}}},function(e,t,i){"use strict";const{kForOnEventAttribute:r,kListener:n}=i(0),o=Symbol("kCode"),s=Symbol("kData"),a=Symbol("kError"),c=Symbol("kMessage"),l=Symbol("kReason"),h=Symbol("kTarget"),d=Symbol("kType"),u=Symbol("kWasClean");class f{constructor(e){this[h]=null,this[d]=e}get target(){return this[h]}get type(){return this[d]}}Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});class _ extends f{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[l]=void 0===t.reason?"":t.reason,this[u]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[l]}get wasClean(){return this[u]}}Object.defineProperty(_.prototype,"code",{enumerable:!0}),Object.defineProperty(_.prototype,"reason",{enumerable:!0}),Object.defineProperty(_.prototype,"wasClean",{enumerable:!0});class p extends f{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[c]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class m extends f{constructor(e,t={}){super(e),this[s]=void 0===t.data?null:t.data}get data(){return this[s]}}Object.defineProperty(m.prototype,"data",{enumerable:!0});const y={addEventListener(e,t,i={}){let o;if("message"===e)o=function(e,i){const r=new m("message",{data:i?e:e.toString()});r[h]=this,t.call(this,r)};else if("close"===e)o=function(e,i){const r=new _("close",{code:e,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[h]=this,t.call(this,r)};else if("error"===e)o=function(e){const i=new p("error",{error:e,message:e.message});i[h]=this,t.call(this,i)};else{if("open"!==e)return;o=function(){const e=new f("open");e[h]=this,t.call(this,e)}}o[r]=!!i[r],o[n]=t,i.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(const i of this.listeners(e))if(i[n]===t&&!i[r]){this.removeListener(e,i);break}}};e.exports={CloseEvent:_,ErrorEvent:p,Event:f,EventTarget:y,MessageEvent:m}},function(e,t,i){"use strict";const{Duplex:r}=i(7);function n(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function s(e){this.removeListener("error",s),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let i=!0,a=!0;function c(){i&&e._socket.resume()}e.readyState===e.CONNECTING?e.once("open",(function(){e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c)})):(e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c));const l=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,r){const n=!r&&l._readableState.objectMode?t.toString():t;l.push(n)||(i=!1,e._socket.pause())})),e.once("error",(function(e){l.destroyed||(a=!1,l.destroy(e))})),e.once("close",(function(){l.destroyed||l.push(null)})),l._destroy=function(t,i){if(e.readyState===e.CLOSED)return i(t),void process.nextTick(n,l);let r=!1;e.once("error",(function(e){r=!0,i(e)})),e.once("close",(function(){r||i(t),process.nextTick(n,l)})),a&&e.terminate()},l._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),l._readableState.endEmitted&&l.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){l._final(t)}))},l._read=function(){e.readyState!==e.OPEN||i||(i=!0,e._receiver._writableState.needDrain||e._socket.resume())},l._write=function(t,i,r){e.readyState!==e.CONNECTING?e.send(t,r):e.once("open",(function(){l._write(t,i,r)}))},l.on("end",o),l.on("error",s),l}},function(e,t,i){"use strict";const r=i(12),n=i(14),{createHash:o}=(i(13),i(1),i(5),i(6)),s=i(17),a=i(2),c=i(29),l=i(11),{GUID:h,kWebSocket:d}=i(0),u=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function _(){this.destroy()}function p(e,t,i,r){e.writable&&(i=i||n.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...r},e.write(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+i)),e.removeListener("error",_),e.destroy()}e.exports=class extends r{constructor(e,t){if(super(),null==(e={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=n.createServer((e,t)=>{const i=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),t.end(i)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const i of Object.keys(t))e.on(i,t[i]);return function(){for(const i of Object.keys(t))e.removeListener(i,t[i])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,i,r)=>{this.handleUpgrade(t,i,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",()=>{e(new Error("The server is not running"))}),void process.nextTick(f,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(f,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{f(this)})}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,i,r){t.on("error",_);const n=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!n||!u.test(n)||8!==o&&13!==o||!this.shouldHandle(e))return p(t,400);const l=e.headers["sec-websocket-protocol"];let h=new Set;if(void 0!==l)try{h=c.parse(l)}catch(e){return p(t,400)}const d=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&void 0!==d){const e=new a(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=s.parse(d);t[a.extensionName]&&(e.accept(t[a.extensionName]),f[a.extensionName]=e)}catch(e){return p(t,400)}}if(this.options.verifyClient){const s={origin:e.headers[""+(8===o?"sec-websocket-origin":"origin")],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(s,(o,s,a,c)=>{if(!o)return p(t,s||401,a,c);this.completeUpgrade(f,n,h,e,t,i,r)});if(!this.options.verifyClient(s))return p(t,401)}this.completeUpgrade(f,n,h,e,t,i,r)}completeUpgrade(e,t,i,r,n,c,u){if(!n.readable||!n.writable)return n.destroy();if(n[d])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return p(n,503);const m=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade","Sec-WebSocket-Accept: "+o("sha1").update(t+h).digest("base64")],y=new l(null);if(i.size){const e=this.options.handleProtocols?this.options.handleProtocols(i,r):i.values().next().value;e&&(m.push("Sec-WebSocket-Protocol: "+e),y._protocol=e)}if(e[a.extensionName]){const t=e[a.extensionName].params,i=s.format({[a.extensionName]:[t]});m.push("Sec-WebSocket-Extensions: "+i),y._extensions=e}this.emit("headers",m,r),n.write(m.concat("\r\n").join("\r\n")),n.removeListener("error",_),y.setSocket(n,c,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(f,this)})),u(y,r)}}},function(e,t,i){"use strict";const{tokenChars:r}=i(4);e.exports={parse:function(e){const t=new Set;let i=-1,n=-1,o=0;for(;o