25 lines
2 MiB
JavaScript
25 lines
2 MiB
JavaScript
|
|
"use strict";var obsidian=require("obsidian");var LZString=function(){function o(o,r){if(!t[o]){t[o]={};for(var n=0;n<o.length;n++)t[o][o.charAt(n)]=n}return t[o][r]}var r=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",t={},i={compressToBase64:function(o){if(null==o)return"";var r=i._compress(o,6,function(o){return n.charAt(o)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(e){return o(n,r.charAt(e))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:i._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=i.compress(o),n=new Uint8Array(2*r.length),e=0,t=r.length;t>e;e++){var s=r.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null===o||void 0===o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;t>e;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":i._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(n){return o(e,r.charAt(n))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(o,r,n){if(null==o)return"";var e,t,i,s={},p={},u="",c="",a="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<o.length;i+=1)if(u=o.charAt(i),Object.prototype.hasOwnProperty.call(s,u)||(s[u]=f++,p[u]=!0),c=a+u,Object.prototype.hasOwnProperty.call(s,c))a=c;else{if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++),s[c]=f++,a=String(u)}if(""!==a){if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(n(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:i._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(o,n,e){var t,i,s,p,u,c,a,l,f=[],h=4,d=4,m=3,v="",w=[],A={val:e(0),position:n,index:1};for(i=0;3>i;i+=1)f[i]=i;for(p=0,c=Math.pow(2,2),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(t=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 2:return""}for(f[3]=l,s=l,w.push(l);;){if(A.index>o)return"";for(p=0,c=Math.pow(2,m),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(l=p){case 0:for(p
|
||
|
|
const EXCALIDRAW_PACKAGES = "PQKhAIAEBsEsGMCmA7Azo8AlRBDeAXcANwEYB2AOgAYKAmAKHAgCdcCKAHZgewBMBXArG7IKAW1iiAVqkYg54AMLcOAT2awA5gAtCACngBKcADE8iAEbduAawA04AJLJ4FcDmS9wsfKncAzf1g4HHxEVAo5BQAVbVg/VG5+ZiRweD4MePA4JDREL35PRGZwfG0MAFlHaOyEFHRwfyTPb2RS8oUAGUdFAFEAOQBlXsbgzLayjB5uQl5YVgJuZlVwbn92rMTk1PxWREimYHo9f0KhET1DAG8Acn4G1F2EfBuAbhOz/GFkAzsAD2uACJuBYpIgCICALzQ/CqDiINbgRB/DhLXwAMnRgMKvEQQWQ+UBAEIYXCEesxHx+NBEAB+P56ZGo5i+QwALkBpxcXxEUNJ8MRuPxiExQsk+xwYl4tLFBL0AG1AUy0ahAQBdf7sgyQ+AAH116Gg/n+Bgo2Dw+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ymgdkVhNhVAZArhBiGgBAFQGQ3hthAAHK4UnEEDSJtE4SQAACy742COE+EACctiKRJAthdgYgmRJA0srggw9w8IeQoRJAxiu+yAeRAArHYNwHkS4aAT/FQe2OAIMKoFUgEpiO0Z0dABQA5HZpEj0VYH0Q5K8JYbwG4muOwCkogHZF8q8CMpCJMYCNMfgJwGiH5Asa4O4ZpF4SsWsf0R4fMfRIUU8EESEQcTxCHucfgOPJSLiNsRQFEWMJtFcRaBNGsK8QsckcsVMdcRlNZJeAsfQn8asdcbNIVAsbkWCYcQ5OFMwLwKJv4E8UUagCUegLCdcdhuifUIgAsVUViR8SBJSAsfUUSewPQgXqoF8taMdDmLOM0TItQcMV0eiKyX0ZWAQUsHYKoNmPOjGJ8Xoi3JTDT
|
||
|
|
/*!
|
||
|
|
* html2canvas 1.4.0 <https://html2canvas.hertzen.com>
|
||
|
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
||
|
|
* Released under MIT License
|
||
|
|
*/html2canvas$1.exports=function(){
|
||
|
|
/*! *****************************************************************************
|
||
|
|
Copyright (c) Microsoft Corporation.
|
||
|
|
|
||
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
|
purpose with or without fee is hereby granted.
|
||
|
|
|
||
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
|
***************************************************************************** */
|
||
|
|
var A=function(e,t){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(A[t]=e[t])},A(e,t)};function e(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}A(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var t=function(){return t=Object.assign||function(A){for(var e,t=1,i=arguments.length;t<i;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(A[n]=e[n]);return A},t.apply(this,arguments)};function i(A,e,t,i){return new(t||(t=Promise))((function(n,a){function r(A){try{o(i.next(A))}catch(A){a(A)}}function s(A){try{o(i.throw(A))}catch(A){a(A)}}function o(A){var e;A.done?n(A.value):(e=A.value,e instanceof t?e:new t((function(A){A(e)}))).then(r,s)}o((i=i.apply(A,e||[])).next())}))}function n(A,e){var t,i,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((n=(n=r.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=e.call(A,r)}catch(A){a=[6,A],i=0}finally{t=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function a(A,e,t){if(t||2===arguments.length)for(var i,n=0,a=e.length;n<a;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return A.concat(i||e)}for(var r=function(){function A(A,e,t,i){this.left=A,this.top=e,this.width=t,this.height=i}return A.prototype.add=function(e,t,i,n){return new A(this.left+e,this.top+t,this.width+i,this.height+n)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var i=Array.from(t).find((function(A){return 0!==A.width}));return i?new A(i.x+e.windowBounds.left,i.y+e.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A}(),s=function(A,e){return r.fromClientRect(A,e.getBoundingClientRect())},o=function(A){for(var e=[],t=0,i=A.length;t<i;){var n=A.charCodeAt(t++);if(n>=55296&&n<=56319&&t<i){var a=A.charCodeAt(t++);56320==(64512&a)?e.push(((1023&n)<<10)+(1023&a)+65536):(e.push(n),t--)}else e.push(n)}return e},l=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],n=-1,a="";++n<t;){var r=A[n];r<=65535?i.push(r):(r-=65536,i.push(55296+(r>>10),r%1024+56320)),(n+1===t||i.length>16384)&&(a+=String.fromCharCode.apply(String,i),i.length=0)}return a},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),h=0;h<c.length;h++)d[c.charCodeAt(h)]=h;var g=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},u=function(){function A(A,e,t,i,n,a){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=a}return A.prototype.get=function(A){var e;if(A>=0){if(A<55296||A>56319&&A<=65535)return e=((e=this.index[A>>5])<<2)+(31&A),this.data[e];if(A<=65535)return e=((e=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[e];if(A<this.highStart)return e=2080+(A>>11),e=this.index[e],e+=A>>5&63,e=((e=this.index[e])<<2)+(31&A),this.data[e];
|
||
|
|
//![[link|alias]] [alias](link){num}
|
||
|
|
EXPR:/(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g,getRes:A=>A.matchAll(REGEX_LINK.EXPR),isTransclusion:A=>!!A.value[1],getLink:A=>A.value[3]?A.value[3]:A.value[6],isWikiLink:A=>!!A.value[3],getAliasOrLink:A=>REGEX_LINK.isWikiLink(A)?A.value[4]?A.value[4]:A.value[3]:A.value[5]?A.value[5]:A.value[6],getWrapLength:(A,e)=>{const t=parseInt(A.value[8]);return isNaN(t)?e>0?e:null:t}},DRAWING_REG=/\n# Drawing\n[^`]*(```json\n)([\s\S]*?)```\n/gm,DRAWING_REG_FALLBACK=/\n# Drawing\n(```json\n)?(.*)(```)?(%%)?/gm,DRAWING_COMPRESSED_REG=/(\n# Drawing\n[^`]*(?:```compressed\-json\n))([\s\S]*?)(```\n)/gm,DRAWING_COMPRESSED_REG_FALLBACK=/(\n# Drawing\n(?:```compressed\-json\n)?)(.*)((```)?(%%)?)/gm,REG_LINKINDEX_HYPERLINK=/^\w+:\/\//,isCompressedMD=A=>null!==A.match(/```compressed\-json\n/gm),getDecompressedScene=A=>{let e,t=A.matchAll(DRAWING_COMPRESSED_REG);return e=t.next(),e.done&&(t=A.matchAll(DRAWING_COMPRESSED_REG_FALLBACK),e=t.next()),e.value&&e.value.length>1?[decompress(e.value[2]),e]:[null,e]},changeThemeOfExcalidrawMD=A=>{const e=isCompressedMD(A);let t=e?getDecompressedScene(A)[0]:A;return t?(isObsidianThemeDark?1===(t.match(/"theme"\s*:\s*"light"\s*,/g)||[]).length&&(t=t.replace(/"theme"\s*:\s*"light"\s*,/,'"theme": "dark",')):1===(t.match(/"theme"\s*:\s*"dark"\s*,/g)||[]).length&&(t=t.replace(/"theme"\s*:\s*"dark"\s*,/,'"theme": "light",')),e?A.replace(DRAWING_COMPRESSED_REG,`$1${compress(t)}$3`):t):A};function getJSON(A){let e,t;if(isCompressedMD(A)){const[e,t]=getDecompressedScene(A);return e?{scene:e.substring(0,e.lastIndexOf("}")+1),pos:t.value.index}:{scene:A,pos:t.value?t.value.index:0}}if(e=A.matchAll(DRAWING_REG),t=e.next(),t.done&&(e=A.matchAll(DRAWING_REG_FALLBACK),t=e.next()),t.value&&t.value.length>1){const A=t.value[2];return{scene:A.substr(0,A.lastIndexOf("}")+1),pos:t.value.index}}return{scene:A,pos:t.value?t.value.index:0}}function getMarkdownDrawingSection(A,e){return e?`%%\n# Drawing\n\`\`\`compressed-json\n${compress(A)}\n\`\`\`\n%%`:`%%\n# Drawing\n\`\`\`json\n${A}\n\`\`\`\n%%`}const estimateMaxLineLen=(A,e)=>{if(!e||!A)return null;if(A===e)return null;let t=0;const i=A.split("\n");if(1===i.length)return null;for(const A of i)A.length>t&&(t=A.length);return t},wrap=(A,e)=>e?wrapText(A,e,!1,0):A;class ExcalidrawData{constructor(A){this.plugin=A,this.textElements=null,this.elementLinks=null,this.scene=null,this.deletedElements=[],this.file=null,this.autoexportPreference=AutoexportPreference.inherit,this.textMode=TextMode.raw,this.loaded=!1,this.files=null,this.equations=null,this.compatibilityMode=!1,this.selectedElementIds={},this.disableCompression=!1,this.app=A.app,this.files=new Map,this.equations=new Map}initializeNonInitializedFields(){var A,e;if(!this.scene||!this.scene.elements)return;const t=this.scene.elements;for(const i of t){if(i.boundElements){const A=new Map;i.boundElements.forEach((e=>{A.set(e.id,e.type)}));const e=Array.from(A,(([A,e])=>({id:A,type:e})));e.length!==i.boundElements.length&&(i.boundElements=e)}i.boundElementIds&&(i.boundElements||(i.boundElements=[]),i.boundElements=i.boundElements.concat(i.boundElementIds.map((A=>({type:"arrow",id:A})))),delete i.boundElementIds),"text"!==i.type||i.containerId||(i.containerId=null),null===i.x&&(i.x=0),null===i.y&&(i.y=0),null===(null===(A=i.startBinding)||void 0===A?void 0:A.focus)&&(i.startBinding.focus=0),null===(null===(e=i.endBinding)||void 0===e?void 0:e.focus)&&(i.endBinding.focus=0),null===i.fontSize&&(i.fontSize=20)}try{t.filter((A=>"text"===A.type&&A.containerId&&t.some((e=>e.id===A.containerId&&e.boundElements.length>0&&e.boundElements.some((e=>"text"===e.type&&e.id!==A.id&&e.id.length>8)))))).forEach((A=>{try{const e=t.filter((e=>e.id===A.containerId))[0],i=e.boundElements.filter((A=>!("text"===A.type&&!t.some((e=>e.id===A.id)))));e.boundElements=[{id:A.id,type:"text"}].concat(i)}catch(A){}})),t.filter((A=>A.boundElements&&A.boundElements.length>0)).forEach((A=>{const e=A.boundElements.filter((A=>t.some((e=>e.id===A.id))));e.length!==A.boundElements.length&&(A.boundElements=e)})),t.filter((A=>"text"
|