md2x 0.7.2 → 0.7.4
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/README.md +6 -2
- package/dist/chunks/chunk-FXZD57XY.js +532 -0
- package/dist/index.js +1 -1
- package/dist/md2x.js +7 -5
- package/dist/renderer/live-runtime-canvas.js +24 -0
- package/dist/renderer/live-runtime-core.js +14 -0
- package/dist/renderer/live-runtime-dot.js +27 -0
- package/dist/renderer/live-runtime-html.js +14 -0
- package/dist/renderer/live-runtime-infographic.js +593 -0
- package/dist/renderer/live-runtime-md2x.js +24 -0
- package/dist/renderer/live-runtime-mermaid.js +14 -0
- package/dist/renderer/live-runtime-svg.js +14 -0
- package/dist/renderer/live-runtime-vega.js +218 -0
- package/dist/renderer/puppeteer-render.html +9 -1
- package/dist/renderer/puppeteer-runtime-core.js +14 -0
- package/dist/types/node/src/host/index.d.ts +2 -0
- package/dist/types/node/src/host/node-exporter.d.ts +16 -10
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/render.d.ts +12 -0
- package/package.json +1 -1
- package/dist/chunks/chunk-ZHNRMGGC.js +0 -1391
- package/dist/renderer/puppeteer-render-worker.js +0 -829
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";(()=>{var Ze=Object.create;var Be=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var tt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var nt=(r,e)=>()=>(r&&(e=r(r=0)),e);var le=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var it=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of et(e))!rt.call(r,i)&&i!==t&&Be(r,i,{get:()=>e[i],enumerable:!(n=Qe(e,i))||n.enumerable});return r};var ot=(r,e,t)=>(t=r!=null?Ze(tt(r)):{},it(e||!r||!r.__esModule?Be(t,"default",{value:r,enumerable:!0}):t,r));var Se=le(ee=>{"use strict";x();ee.byteLength=at;ee.toByteArray=ct;ee.fromByteArray=ft;var _=[],L=[],st=typeof Uint8Array<"u"?Uint8Array:Array,ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(j=0,Te=ce.length;j<Te;++j)_[j]=ce[j],L[ce.charCodeAt(j)]=j;var j,Te;L[45]=62;L[95]=63;function Re(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function at(r){var e=Re(r),t=e[0],n=e[1];return(t+n)*3/4-n}function lt(r,e,t){return(e+t)*3/4-t}function ct(r){var e,t=Re(r),n=t[0],i=t[1],o=new st(lt(r,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=L[r.charCodeAt(c)]<<18|L[r.charCodeAt(c+1)]<<12|L[r.charCodeAt(c+2)]<<6|L[r.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=L[r.charCodeAt(c)]<<2|L[r.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=L[r.charCodeAt(c)]<<10|L[r.charCodeAt(c+1)]<<4|L[r.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function ut(r){return _[r>>18&63]+_[r>>12&63]+_[r>>6&63]+_[r&63]}function pt(r,e,t){for(var n,i=[],o=e;o<t;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),i.push(ut(n));return i.join("")}function ft(r){for(var e,t=r.length,n=t%3,i=[],o=16383,s=0,a=t-n;s<a;s+=o)i.push(pt(r,s,s+o>a?a:s+o));return n===1?(e=r[t-1],i.push(_[e>>2]+_[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(_[e>>10]+_[e>>4&63]+_[e<<2&63]+"=")),i.join("")}});var ve=le(ue=>{x();ue.read=function(r,e,t,n,i){var o,s,a=i*8-n-1,c=(1<<a)-1,u=c>>1,p=-7,f=t?i-1:0,h=t?-1:1,d=r[e+f];for(f+=h,o=d&(1<<-p)-1,d>>=-p,p+=a;p>0;o=o*256+r[e+f],f+=h,p-=8);for(s=o&(1<<-p)-1,o>>=-p,p+=n;p>0;s=s*256+r[e+f],f+=h,p-=8);if(o===0)o=1-u;else{if(o===c)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-u}return(d?-1:1)*s*Math.pow(2,o-n)};ue.write=function(r,e,t,n,i,o){var s,a,c,u=o*8-i-1,p=(1<<u)-1,f=p>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,w=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?e+=h/c:e+=h*Math.pow(2,1-f),e*c>=2&&(s++,c/=2),s+f>=p?(a=0,s=p):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s=s+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;r[t+d]=a&255,d+=w,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;r[t+d]=s&255,d+=w,s/=256,u-=8);r[t+d-w]|=m*128}});var We=le(V=>{"use strict";x();var pe=Se(),z=ve(),Ce=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;V.Buffer=l;V.SlowBuffer=wt;V.INSPECT_MAX_BYTES=50;var te=2147483647;V.kMaxLength=te;l.TYPED_ARRAY_SUPPORT=dt();!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function dt(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}});Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function $(r){if(r>te)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,l.prototype),e}function l(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return me(r)}return Ue(r,e,t)}l.poolSize=8192;function Ue(r,e,t){if(typeof r=="string")return mt(r,e);if(ArrayBuffer.isView(r))return yt(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(k(r,ArrayBuffer)||r&&k(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(k(r,SharedArrayBuffer)||r&&k(r.buffer,SharedArrayBuffer)))return de(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return l.from(n,e,t);let i=gt(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return l.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}l.from=function(r,e,t){return Ue(r,e,t)};Object.setPrototypeOf(l.prototype,Uint8Array.prototype);Object.setPrototypeOf(l,Uint8Array);function Me(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function ht(r,e,t){return Me(r),r<=0?$(r):e!==void 0?typeof t=="string"?$(r).fill(e,t):$(r).fill(e):$(r)}l.alloc=function(r,e,t){return ht(r,e,t)};function me(r){return Me(r),$(r<0?0:ye(r)|0)}l.allocUnsafe=function(r){return me(r)};l.allocUnsafeSlow=function(r){return me(r)};function mt(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Le(r,e)|0,n=$(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function fe(r){let e=r.length<0?0:ye(r.length)|0,t=$(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function yt(r){if(k(r,Uint8Array)){let e=new Uint8Array(r);return de(e.buffer,e.byteOffset,e.byteLength)}return fe(r)}function de(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,l.prototype),n}function gt(r){if(l.isBuffer(r)){let e=ye(r.length)|0,t=$(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||we(r.length)?$(0):fe(r);if(r.type==="Buffer"&&Array.isArray(r.data))return fe(r.data)}function ye(r){if(r>=te)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+te.toString(16)+" bytes");return r|0}function wt(r){return+r!=r&&(r=0),l.alloc(+r)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype};l.compare=function(e,t){if(k(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),k(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==t[o]){n=e[o],i=t[o];break}return n<i?-1:i<n?1:0};l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=l.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){let s=e[n];if(k(s,Uint8Array))o+s.length>i.length?(l.isBuffer(s)||(s=l.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(l.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Le(r,e){if(l.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||k(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return he(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Oe(r).length;default:if(i)return n?-1:he(r).length;e=(""+e).toLowerCase(),i=!0}}l.byteLength=Le;function xt(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return It(this,e,t);case"utf8":case"utf-8":return ke(this,e,t);case"ascii":return Ct(this,e,t);case"latin1":case"binary":return At(this,e,t);case"base64":return St(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ft(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}l.prototype._isBuffer=!0;function H(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}l.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)H(this,t,t+1);return this};l.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)H(this,t,t+3),H(this,t+1,t+2);return this};l.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)H(this,t,t+7),H(this,t+1,t+6),H(this,t+2,t+5),H(this,t+3,t+4);return this};l.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ke(this,0,e):xt.apply(this,arguments)};l.prototype.toLocaleString=l.prototype.toString;l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:l.compare(this,e)===0};l.prototype.inspect=function(){let e="",t=V.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Ce&&(l.prototype[Ce]=l.prototype.inspect);l.prototype.compare=function(e,t,n,i,o){if(k(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-t,c=Math.min(s,a),u=this.slice(i,o),p=e.slice(t,n);for(let f=0;f<c;++f)if(u[f]!==p[f]){s=u[f],a=p[f];break}return s<a?-1:a<s?1:0};function _e(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,we(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=l.from(e,n)),l.isBuffer(e))return e.length===0?-1:Ae(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ae(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Ae(r,e,t,n,i){let o=1,s=r.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,s/=2,a/=2,t/=2}function c(p,f){return o===1?p[f]:p.readUInt16BE(f*o)}let u;if(i){let p=-1;for(u=t;u<s;u++)if(c(r,u)===c(e,p===-1?0:u-p)){if(p===-1&&(p=u),u-p+1===a)return p*o}else p!==-1&&(u-=u-p),p=-1}else for(t+a>s&&(t=s-a),u=t;u>=0;u--){let p=!0;for(let f=0;f<a;f++)if(c(r,u+f)!==c(e,f)){p=!1;break}if(p)return u}return-1}l.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};l.prototype.indexOf=function(e,t,n){return _e(this,e,t,n,!0)};l.prototype.lastIndexOf=function(e,t,n){return _e(this,e,t,n,!1)};function Et(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(e.substr(s*2,2),16);if(we(a))return s;r[t+s]=a}return s}function bt(r,e,t,n){return re(he(e,r.length-t),r,t,n)}function Bt(r,e,t,n){return re(_t(e),r,t,n)}function Tt(r,e,t,n){return re(Oe(e),r,t,n)}function Rt(r,e,t,n){return re(kt(e,r.length-t),r,t,n)}l.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return Et(this,e,t,n);case"utf8":case"utf-8":return bt(this,e,t,n);case"ascii":case"latin1":case"binary":return Bt(this,e,t,n);case"base64":return Tt(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rt(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function St(r,e,t){return e===0&&t===r.length?pe.fromByteArray(r):pe.fromByteArray(r.slice(e,t))}function ke(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let o=r[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=t){let c,u,p,f;switch(a){case 1:o<128&&(s=o);break;case 2:c=r[i+1],(c&192)===128&&(f=(o&31)<<6|c&63,f>127&&(s=f));break;case 3:c=r[i+1],u=r[i+2],(c&192)===128&&(u&192)===128&&(f=(o&15)<<12|(c&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:c=r[i+1],u=r[i+2],p=r[i+3],(c&192)===128&&(u&192)===128&&(p&192)===128&&(f=(o&15)<<18|(c&63)<<12|(u&63)<<6|p&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return vt(n)}var Ie=4096;function vt(r){let e=r.length;if(e<=Ie)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Ie));return t}function Ct(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function At(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function It(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let o=e;o<t;++o)i+=Pt[r[o]];return i}function Ft(r,e,t){let n=r.slice(e,t),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}l.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i};function C(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||C(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return i};l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||C(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i};l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e=e>>>0,t||C(e,1,this.length),this[e]};l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||C(e,2,this.length),this[e]|this[e+1]<<8};l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||C(e,2,this.length),this[e]<<8|this[e+1]};l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||C(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};l.prototype.readBigUInt64LE=D(function(e){e=e>>>0,q(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});l.prototype.readBigUInt64BE=D(function(e){e=e>>>0,q(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});l.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||C(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};l.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||C(e,t,this.length);let i=t,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};l.prototype.readInt8=function(e,t){return e=e>>>0,t||C(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};l.prototype.readInt16LE=function(e,t){e=e>>>0,t||C(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};l.prototype.readInt16BE=function(e,t){e=e>>>0,t||C(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};l.prototype.readInt32LE=function(e,t){return e=e>>>0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};l.prototype.readInt32BE=function(e,t){return e=e>>>0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};l.prototype.readBigInt64LE=D(function(e){e=e>>>0,q(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});l.prototype.readBigInt64BE=D(function(e){e=e>>>0,q(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});l.prototype.readFloatLE=function(e,t){return e=e>>>0,t||C(e,4,this.length),z.read(this,e,!0,23,4)};l.prototype.readFloatBE=function(e,t){return e=e>>>0,t||C(e,4,this.length),z.read(this,e,!1,23,4)};l.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||C(e,8,this.length),z.read(this,e,!0,52,8)};l.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||C(e,8,this.length),z.read(this,e,!1,52,8)};function U(r,e,t,n,i,o){if(!l.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;U(this,e,t,n,a,0)}let o=1,s=0;for(this[t]=e&255;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n};l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;U(this,e,t,n,a,0)}let o=n-1,s=1;for(this[t+o]=e&255;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n};l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,1,255,0),this[t]=e&255,t+1};l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Pe(r,e,t,n,i){He(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,t}function $e(r,e,t,n,i){He(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=s,s=s>>8,r[t+2]=s,s=s>>8,r[t+1]=s,s=s>>8,r[t]=s,t+8}l.prototype.writeBigUInt64LE=D(function(e,t=0){return Pe(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});l.prototype.writeBigUInt64BE=D(function(e,t=0){return $e(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);U(this,e,t,n,c-1,-c)}let o=0,s=1,a=0;for(this[t]=e&255;++o<n&&(s*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n};l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);U(this,e,t,n,c-1,-c)}let o=n-1,s=1,a=0;for(this[t+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n};l.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};l.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};l.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};l.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};l.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};l.prototype.writeBigInt64LE=D(function(e,t=0){return Pe(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});l.prototype.writeBigInt64BE=D(function(e,t=0){return $e(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function De(r,e,t,n,i,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ne(r,e,t,n,i){return e=+e,t=t>>>0,i||De(r,e,t,4,34028234663852886e22,-34028234663852886e22),z.write(r,e,t,n,23,4),t+4}l.prototype.writeFloatLE=function(e,t,n){return Ne(this,e,t,!0,n)};l.prototype.writeFloatBE=function(e,t,n){return Ne(this,e,t,!1,n)};function je(r,e,t,n,i){return e=+e,t=t>>>0,i||De(r,e,t,8,17976931348623157e292,-17976931348623157e292),z.write(r,e,t,n,52,8),t+8}l.prototype.writeDoubleLE=function(e,t,n){return je(this,e,t,!0,n)};l.prototype.writeDoubleBE=function(e,t,n){return je(this,e,t,!1,n)};l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),o};l.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{let s=l.isBuffer(e)?e:l.from(e,i),a=s.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var W={};function ge(r,e,t){W[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}ge("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ge("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);ge("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Fe(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Fe(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Fe(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Ut(r,e,t){q(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&K(e,r.length-(t+1))}function He(r,e,t,n,i,o){if(r>t||r<e){let s=typeof e=="bigint"?"n":"",a;throw o>3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${t}${s}`,new W.ERR_OUT_OF_RANGE("value",a,r)}Ut(n,i,o)}function q(r,e){if(typeof r!="number")throw new W.ERR_INVALID_ARG_TYPE(e,"number",r)}function K(r,e,t){throw Math.floor(r)!==r?(q(r,t),new W.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Mt=/[^+/0-9A-Za-z-_]/g;function Lt(r){if(r=r.split("=")[0],r=r.trim().replace(Mt,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function he(r,e){e=e||1/0;let t,n=r.length,i=null,o=[];for(let s=0;s<n;++s){if(t=r.charCodeAt(s),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function _t(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function kt(r,e){let t,n,i,o=[];for(let s=0;s<r.length&&!((e-=2)<0);++s)t=r.charCodeAt(s),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function Oe(r){return pe.toByteArray(Lt(r))}function re(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function k(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function we(r){return r!==r}var Pt=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e})();function D(r){return typeof BigInt>"u"?$t:r}function $t(){throw new Error("BigInt not supported")}});var ze,x=nt(()=>{"use strict";ze=ot(We(),1);globalThis.Buffer=ze.Buffer});x();x();x();x();var G=class{constructor(e){this._initialized=!1;this.type=e}createContainer(){let e=document.createElement("div");return e.id="render-container-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),e.style.cssText="position: absolute; left: -9999px; top: -9999px;",document.body.appendChild(e),e}removeContainer(e){e&&e.parentNode&&e.parentNode.removeChild(e)}async initialize(e=null){this._initialized=!0}isInitialized(){return this._initialized}async render(e,t){throw new Error("render() must be implemented by subclass")}async mountToDom(e,t,n){let i=await this.render(e,t);if(!i||!i.base64){let s=document.createElement("div");return s.textContent=`Renderer returned empty result: ${this.type}`,n.appendChild(s),{root:s,cleanup:()=>{try{s.remove()}catch{}}}}let o=document.createElement("img");return o.style.maxWidth="100%",o.style.height="auto",o.alt=`${this.type} diagram`,o.src=`data:image/${i.format};base64,${i.base64}`,n.appendChild(o),{root:o,cleanup:()=>{try{o.remove()}catch{}}}}validateInput(e){if(!e||typeof e=="string"&&e.trim()==="")throw new Error(`Empty ${this.type} input provided`)}preprocessInput(e){return e}calculateCanvasScale(e){let n=e?.fontSize||12;return 14/16*(n/12)*4}async renderSvgToCanvas(e,t,n,i=null){return e=e.replace(/<style>/,"<style>foreignObject { overflow: visible; }"),new Promise((o,s)=>{let a=new Image;a.crossOrigin="Anonymous";let c=btoa(unescape(encodeURIComponent(e)));a.src=`data:image/svg+xml;base64,${c}`,a.onload=()=>{let u=document.createElement("canvas");u.width=t,u.height=n;let p=u.getContext("2d");i&&(p.font=`14px ${i}`),p.drawImage(a,0,0,t,n),o(u)},a.onerror=u=>{s(new Error("Failed to load SVG into image for rendering"))}})}};x();x();function qe(r){if(typeof document>"u")return Nt(r);try{let e=document.createElement("template");return e.innerHTML=r,Dt(e.content),e.innerHTML}catch{return r}}function Dt(r){let e=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","AUDIO","VIDEO"]),t=[];for(Array.from(r.childNodes).forEach(n=>{n.nodeType===Node.ELEMENT_NODE?t.push(n):n.nodeType===Node.COMMENT_NODE&&n.remove()});t.length>0;){let n=t.pop();if(e.has(n.tagName)){n.remove();continue}let i=Array.from(n.attributes||[]);for(let o of i)(o.name.startsWith("on")||o.name==="href"&&o.value.trim().toLowerCase().startsWith("javascript:"))&&n.removeAttribute(o.name);Array.from(n.childNodes).forEach(o=>{o.nodeType===Node.ELEMENT_NODE?t.push(o):o.nodeType===Node.COMMENT_NODE&&o.remove()})}}function Ve(r){if(typeof document>"u")return jt(r);let e=document.createElement("div");return e.innerHTML=r,e.textContent.trim().length>0||e.querySelector("*")!==null}function Nt(r){let e=r;return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<iframe\b[\s\S]*?<\/iframe>/gi,"").replace(/<object\b[\s\S]*?<\/object>/gi,"").replace(/<embed\b[\s\S]*?<\/embed>/gi,"").replace(/<audio\b[\s\S]*?<\/audio>/gi,"").replace(/<video\b[\s\S]*?<\/video>/gi,""),e=e.replace(/\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),e=e.replace(/\shref\s*=\s*(["'])\s*javascript:[\s\S]*?\1/gi,' href="#"'),e}function jt(r){let e=(r||"").replace(/<!--[\s\S]*?-->/g,"").replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").trim();return e?!!(e.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim().length>0||/<(img|svg|table|pre|code|hr|br|math|canvas|iframe|object|embed)\b/i.test(e)):!1}x();var Ge=null;function Je(){return Ge?.fetch?Ge.fetch:{fetchAsDataUrl:async()=>null}}var ne=class extends G{constructor(){super("html")}async render(e,t){return this.validateInput(e),await this.renderHtmlToPng(e,t)}async convertRemoteImagesToBase64(e){let t=Je(),n=e.querySelectorAll("img[src]"),i=Array.from(n).map(async o=>{let s=o.getAttribute("src");if(!s||s.startsWith("data:")||s.startsWith("blob:")||!s.startsWith("http://")&&!s.startsWith("https://"))return;let a=await t.fetchAsDataUrl(s);a&&o.setAttribute("src",a)});await Promise.all(i)}async renderHtmlToPng(e,t){let n=qe(e);if(!Ve(n))return null;let i=t?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",o=this.calculateCanvasScale(t),s="http://www.w3.org/2000/svg",a=2e3*o,c=2e3*o,u=document.createElementNS(s,"svg");u.setAttribute("xmlns",s),u.setAttribute("width",String(a)),u.setAttribute("height",String(c));let p=document.createElementNS(s,"foreignObject");p.setAttribute("width",String(a)),p.setAttribute("height",String(c));let f=document.createElement("div");f.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),f.style.cssText=`display: inline-block; overflow: hidden; outline: 1px solid #ff0000; outline-offset: 0; transform: scale(${o}); transform-origin: top left;`;let h=document.createElement("div");h.style.cssText=`display: inline-block; font-family: ${i};`,h.innerHTML=n,await this.convertRemoteImagesToBase64(h),f.appendChild(h),p.appendChild(f),u.appendChild(p);let d=new XMLSerializer().serializeToString(u),w="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(d),m=new Image;m.src=w,await m.decode();let T=document.createElement("canvas");T.width=m.naturalWidth,T.height=m.naturalHeight;let E=T.getContext("2d",{willReadFrequently:!0});if(!E)throw new Error("Failed to get canvas 2D context");E.drawImage(m,0,0);let y=T.width,b=T.height,R=E.getImageData(0,0,y,1).data,S=1;for(let M=y-1;M>=0;M--){let N=M*4;if(R[N]>200&&R[N+1]<50&&R[N+2]<50){S=M;break}}let A=E.getImageData(0,0,1,b).data,g=1;for(let M=b-1;M>=0;M--){let N=M*4;if(A[N]>200&&A[N+1]<50&&A[N+2]<50){g=M;break}}let v=Math.ceil(o),I=Math.max(1,S-v),Y=Math.max(1,g-v),B=document.createElement("canvas");B.width=I,B.height=Y;let F=B.getContext("2d");if(!F)throw new Error("Failed to get canvas 2D context");return F.drawImage(T,0,0,I,Y,0,0,I,Y),{base64:B.toDataURL("image/png").replace(/^data:image\/png;base64,/,""),width:B.width,height:B.height,format:"png"}}};async function J(r){return await import(r)}function Ht(r){let e=String(r||"").trim();return e&&(e.endsWith("/")?e:`${e}/`)}function se(r){let e=String(r||"").trim();return e&&(e.endsWith("/")?e.slice(0,-1):e)}function Ee(r,e){let t=Ht(e);if(!t)return r;let n=c=>{try{return new URL(c,t).href}catch{return t+c}},i=t.includes("esm.sh/"),o=se(t),s={svelte:i?o:n("src/runtime/index.js"),"svelte/internal":n(i?"internal":"src/runtime/internal/index.js"),"svelte/internal/client":n(i?"internal/client":"src/runtime/internal/client/index.js"),"svelte/internal/server":n(i?"internal/server":"src/runtime/internal/server/index.js"),"svelte/internal/disclose-version":n(i?"internal/disclose-version":"src/runtime/internal/disclose-version/index.js"),"svelte/store":n(i?"store":"src/runtime/store/index.js"),"svelte/animate":n(i?"animate":"src/runtime/animate/index.js"),"svelte/easing":n(i?"easing":"src/runtime/easing/index.js"),"svelte/motion":n(i?"motion":"src/runtime/motion/index.js"),"svelte/transition":n(i?"transition":"src/runtime/transition/index.js")},a=String(r||"");for(let[c,u]of Object.entries(s))a=a.split(`'${c}'`).join(`'${u}'`),a=a.split(`"${c}"`).join(`"${u}"`);return i&&o&&(a=a.split("'svelte/").join(`'${o}/`),a=a.split('"svelte/').join(`"${o}/`)),a}function Ot(r,e){let t=String(r||"").trim().toLowerCase(),n=String(e||"").trim();return!t||!n||n.includes("/")||n.includes("\\")||n.includes("://")||n.startsWith("file://")?n:`${t}/${n}`}function Ye(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function Wt(r){let e=String(r||"");return!/<span\b/i.test(e)&&!/\bhljs\b/i.test(e)?e:e.replace(/<[^>]*>/g,"")}function zt(r){let e="",t=!1,n=!1,i=!1,o=u=>/[A-Za-z_$]/.test(u),s=u=>/[A-Za-z0-9_$-]/.test(u),a=u=>{for(let p=u.length-1;p>=0;p--){let f=u[p];if(!/\s/.test(f))return f}return""},c=u=>{let p=u;for(;p<r.length&&/\s/.test(r[p]);)p++;let f=r[p];if(!f||!o(f))return!1;let h=p+1;for(;h<r.length&&s(r[h]);)h++;for(;h<r.length&&/\s/.test(r[h]);)h++;return r[h]===":"};for(let u=0;u<r.length;u++){let p=r[u];if(i){e+=p,i=!1;continue}if(p==="\\"){e+=p,i=!0;continue}if(!n&&p==="'"){t=!t,e+=p;continue}if(!t&&p==='"'){n=!n,e+=p;continue}if(!t&&!n){let f=p==="\r"&&r[u+1]===`
|
|
2
|
+
`;if(p===`
|
|
3
|
+
`||p==="\r"){let d=a(e);d&&!"{[,:".includes(d)&&c(u+1)&&(e+=","),e+=p,f&&(e+=`
|
|
4
|
+
`,u++);continue}}e+=p}return e}function qt(r){let e="",t=!1,n=!1,i=!1;for(let o=0;o<r.length;o++){let s=r[o];if(i){e+=s,i=!1;continue}if(s==="\\\\"){e+=s,i=!0;continue}if(!n&&s==="'"){t=!t,e+=s;continue}if(!t&&s==='"'){n=!n,e+=s;continue}if(!t&&!n&&s===","){let a=o+1;for(;a<r.length&&/\s/.test(r[a]);)a++;let c=r[a];if(c==="}"||c==="]")continue}e+=s}return e}function Vt(r){let e="",t=!1,n=!1,i=!1;for(let o=0;o<r.length;o++){let s=r[o];if(i){e+=s,i=!1;continue}if(s==="\\\\"){e+=s,i=!0;continue}if(!n&&s==="'"){t=!t,e+='"';continue}if(!t&&s==='"'){n=!n,e+=s;continue}if(t&&s==='"'){e+='\\\\"';continue}e+=s}return e}function Gt(r){let e="",t=0,n=!1,i=!1,o=!1,s=c=>/[A-Za-z_$]/.test(c),a=c=>/[A-Za-z0-9_$-]/.test(c);for(;t<r.length;){let c=r[t];if(o){e+=c,o=!1,t++;continue}if(c==="\\\\"){e+=c,o=!0,t++;continue}if(!i&&c==="'"){n=!n,e+=c,t++;continue}if(!n&&c==='"'){i=!i,e+=c,t++;continue}if(!n&&!i){let u=e.length-1;for(;u>=0&&/\s/.test(e[u]);)u--;let p=u>=0?e[u]:"";if((p==="{"||p===","||p==="")&&s(c)){let h=t+1;for(;h<r.length&&a(r[h]);)h++;let d=h;for(;d<r.length&&/\s/.test(r[d]);)d++;if(r[d]===":"){let w=r.slice(t,h);e+=`"${w}"`,t=h;continue}}}e+=c,t++}return e}function be(r){let e=Wt(String(r||"").trim());if(!e)throw new Error("Empty md2x block");let t=zt(e.trim().startsWith("{")?e:`{${e}
|
|
5
|
+
}`);try{let u=JSON.parse(t);if(!Ye(u))throw new Error("md2x config must be an object");let p=String(u.type||"").trim(),f=String(u.template||"").trim();if(!p||p!=="vue"&&p!=="html"&&p!=="svelte")throw new Error('md2x.type must be "vue", "html", or "svelte"');if(!f)throw new Error("md2x.template is required");let h=typeof u.allowTemplateAssets=="boolean"?u.allowTemplateAssets:typeof u.allowCdn=="boolean"?u.allowCdn:void 0,d=typeof u.allowScripts=="boolean"?u.allowScripts:void 0;return{type:p,template:f,data:u.data,allowTemplateAssets:h,allowScripts:d}}catch{}let n=qt(Gt(Vt(t))),i;try{i=JSON.parse(n)}catch(u){throw new Error(`Invalid md2x config (expected object literal): ${u.message}`)}if(!Ye(i))throw new Error("md2x config must be an object");let o=String(i.type||"").trim(),s=String(i.template||"").trim();if(!o||o!=="vue"&&o!=="html"&&o!=="svelte")throw new Error('md2x.type must be "vue", "html", or "svelte"');if(!s)throw new Error("md2x.template is required");let a=typeof i.allowTemplateAssets=="boolean"?i.allowTemplateAssets:typeof i.allowCdn=="boolean"?i.allowCdn:void 0,c=typeof i.allowScripts=="boolean"?i.allowScripts:void 0;return{type:o,template:s,data:i.data,allowTemplateAssets:a,allowScripts:c}}function Jt(r){return JSON.stringify(r).replace(/</g,"\\u003c")}function O(r,e){let t=Jt(e??null);return String(r||"").split("templateData").join(`(${t})`)}function ie(r){if(!Array.isArray(r))return[];let e=[],t=new Set;for(let n of r){if(typeof n!="string")continue;let i=n.trim();i&&(t.has(i)||(t.add(i),e.push(i)))}return e}function Yt(r){if(!r||typeof r!="object")return null;let e=r.assets;if(!e||typeof e!="object")return null;let t=ie(e.scripts),n=ie(e.styles);return!t.length&&!n.length?null:{assets:{scripts:t,styles:n}}}function X(r){let e=String(r||"");if(!e)return{source:e,templateConfig:null};let t=0;for(e.charCodeAt(0)===65279&&(t=1);t<e.length&&/\s/.test(e[t]);)t++;if(e.slice(t,t+4)!=="<!--")return{source:e,templateConfig:null};let n=e.indexOf("-->",t+4);if(n===-1)return{source:e,templateConfig:null};let i=e.slice(t+4,n).trim(),o="TemplateConfig:";if(!i.startsWith(o))return{source:e,templateConfig:null};let s=i.slice(o.length).trim(),a=e.slice(n+3);a.startsWith(`\r
|
|
6
|
+
`)?a=a.slice(2):(a.startsWith(`
|
|
7
|
+
`)||a.startsWith("\r"))&&(a=a.slice(1));let c=e.slice(0,t)+a;if(!s)return{source:c,templateConfig:null};try{let u=JSON.parse(s);return{source:c,templateConfig:Yt(u)}}catch(u){return{source:c,templateConfig:null,error:u.message}}}function Ke(r){let e=String(r||"").trim();if(!e)return e;try{return new URL(e,document.baseURI).href}catch{return e}}async function Kt(r){let e=Ke(r);if(!e)return;let t=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"');document.querySelector(`link[rel="stylesheet"][href="${t}"]`)||await new Promise(i=>{let o=document.createElement("link");o.rel="stylesheet",o.href=e,o.onload=()=>i(),o.onerror=()=>i(),document.head.appendChild(o)})}async function Z(r){let e=ie(r?.assets?.scripts),t=ie(r?.assets?.styles);for(let n of t)await Kt(n);for(let n of e)await xe(Ke(n))}async function xe(r,e){if(e&&globalThis[e])return;let t=globalThis.CSS?.escape?globalThis.CSS.escape(r):r.replace(/"/g,'\\"'),n=document.querySelector(`script[src="${t}"]`);if(n){if(n.__md2xLoaded)return;await new Promise((i,o)=>{n.addEventListener("load",()=>i(),{once:!0}),n.addEventListener("error",()=>o(new Error("Failed to load script: "+r)),{once:!0})}),n.__md2xLoaded=!0;return}await new Promise((i,o)=>{let s=document.createElement("script");s.src=r,s.async=!1,s.onload=()=>{s.__md2xLoaded=!0,i()},s.onerror=()=>{s.__md2xLoaded=!0,o(new Error("Failed to load script: "+r))},document.head.appendChild(s)})}var oe=class extends G{constructor(){super("md2x");this.htmlRenderer=new ne;this.vueReady=null;this.svelteCompilerReady=null}getTemplateSource(t,n,i){let o=String(i||"").trim(),s=Ot(n,o),a=t??{},c=[];s&&c.push(s),o&&o!==s&&c.push(o);try{s&&c.push(new URL(s,document.baseURI).href)}catch{}try{o&&c.push(new URL(o,document.baseURI).href)}catch{}for(let u of c){let p=a[u];if(typeof p=="string")return{templateRef:s||o,source:p}}return{templateRef:s||o,source:null}}async ensureVueRuntime(t){if(this.vueReady)return this.vueReady;let n=t?.vue||"https://unpkg.com/vue@3/dist/vue.global.js",i=t?.vueSfcLoader||"https://cdn.jsdelivr.net/npm/vue3-sfc-loader/dist/vue3-sfc-loader.js";return this.vueReady=(async()=>{await xe(n,"Vue"),await xe(i,"vue3-sfc-loader")})(),this.vueReady}async ensureSvelteCompiler(t){if(this.svelteCompilerReady)return this.svelteCompilerReady;let n=t?.svelteCompiler||"https://esm.sh/svelte@5/compiler";return this.svelteCompilerReady=(async()=>await J(n))(),this.svelteCompilerReady}async renderAsErrorPng(t,n){let i=`<div style="font-family: sans-serif; font-size: 12px; color: #b00020;">
|
|
8
|
+
<div style="font-weight: 600; margin-bottom: 6px;">md2x render error</div>
|
|
9
|
+
<pre style="white-space: pre-wrap; margin: 0;">${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>
|
|
10
|
+
</div>`;return await this.htmlRenderer.render(i,n)}async runHtmlTemplateScripts(t,n){let i=n??{},o=Array.from(t.querySelectorAll("script")),s=a=>{let c=String(a||"").trim();if(!c)return null;if(typeof i[c]=="string")return i[c];try{let u=new URL(c,document.baseURI).href;if(typeof i[u]=="string")return i[u]}catch{}return null};for(let a of o){let c=a.parentNode;if(!c)continue;if(String(a.getAttribute("type")||"").trim().toLowerCase()==="module")throw new Error('md2x html template: <script type="module"> is not supported for PNG rendering');let p=a.getAttribute("src");if(p){let h=s(p);if(h==null)throw new Error(`md2x html template: external <script src="${p}"> is not supported unless it is provided via templateFiles`);let d=document.createElement("script");for(let w of Array.from(a.attributes||[])){let m=String(w?.name||"");if(m&&!(m==="src"||m==="async"||m==="defer"))try{d.setAttribute(m,w.value)}catch{}}d.textContent=String(h||""),c.replaceChild(d,a);continue}let f=document.createElement("script");for(let h of Array.from(a.attributes||[])){let d=String(h?.name||"");if(d&&!(d==="async"||d==="defer"))try{f.setAttribute(d,h.value)}catch{}}f.textContent=a.textContent||"",c.replaceChild(f,a)}}async renderHtmlTemplate(t,n,i){let{templateRef:o,source:s}=this.getTemplateSource(n,t.type,t.template);if(!s)return await this.renderAsErrorPng(`Missing md2x template: ${o||t.template}`,i);let a=X(s);if(t.allowTemplateAssets){if(a.error)return await this.renderAsErrorPng(`Invalid TemplateConfig JSON: ${a.error}`,i);try{await Z(a.templateConfig)}catch(f){return await this.renderAsErrorPng(`Failed to load TemplateConfig assets: ${f.message}`,i)}}let c=O(a.source,t.data);if(!t.allowScripts)return await this.htmlRenderer.render(c,i);let u=this.createContainer();u.style.cssText="position: absolute; left: -9999px; top: -9999px; display: inline-block; background: transparent; padding: 0; margin: 0;";let p=document.createElement("div");p.style.cssText="display: inline-block;",u.appendChild(p);try{p.innerHTML=c,await this.runHtmlTemplateScripts(p,n);for(let f of Array.from(p.querySelectorAll("script")))try{f.remove()}catch{}try{typeof globalThis.requestAnimationFrame=="function"&&await new Promise(f=>globalThis.requestAnimationFrame(()=>f()))}catch{}try{document.fonts?.ready&&await document.fonts.ready}catch{}return await this.htmlRenderer.render(p.innerHTML,i)}finally{this.removeContainer(u)}}async renderSvelteTemplate(t,n,i,o){let{templateRef:s,source:a}=this.getTemplateSource(n,t.type,t.template);if(!a)return await this.renderAsErrorPng(`Missing md2x template: ${s||t.template}`,o);let c=X(a);if(t.allowTemplateAssets){if(c.error)return await this.renderAsErrorPng(`Invalid TemplateConfig JSON: ${c.error}`,o);try{await Z(c.templateConfig)}catch(A){return await this.renderAsErrorPng(`Failed to load TemplateConfig assets: ${A.message}`,o)}}let u;try{u=await this.ensureSvelteCompiler(i)}catch(A){return await this.renderAsErrorPng(`Svelte compiler unavailable: ${A.message}`,o)}let p=u?.compile||u?.default?.compile||u?.svelte?.compile;if(typeof p!="function")return await this.renderAsErrorPng("Svelte compiler not available (missing compile())",o);let f=O(c.source,t.data),h;try{try{h=p(f,{filename:s||t.template||"md2x.svelte",generate:"client"})}catch{h=p(f,{filename:s||t.template||"md2x.svelte",generate:"dom"})}}catch(A){return await this.renderAsErrorPng(`Failed to compile Svelte template: ${A.message}`,o)}let d=String(h?.js?.code||""),w=String(h?.css?.code||"");if(!d.trim())return await this.renderAsErrorPng("Svelte compile returned no JS output",o);let m=i?.svelteBase||"https://esm.sh/svelte@5/",T=Ee(d,m),E=this.createContainer();E.style.cssText="position: absolute; left: -9999px; top: -9999px; display: inline-block; background: transparent; padding: 0; margin: 0;";let y=document.createElement("div");y.style.cssText="display: inline-block;",E.appendChild(y);let b=null,R=null,S=null;try{try{S=URL.createObjectURL(new Blob([T],{type:"text/javascript"}))}catch(F){throw new Error("Unable to create Blob URL for compiled Svelte module: "+F.message)}let g=(await J(S))?.default;if(typeof g!="function")throw new Error("Compiled Svelte module has no default component export");let v=await J(se(m)),I=v?.mount;if(R=typeof v?.unmount=="function"?v.unmount:null,typeof I!="function")throw new Error("Svelte runtime mount() not available");b=I(g,{target:y});try{typeof globalThis.requestAnimationFrame=="function"&&await new Promise(F=>globalThis.requestAnimationFrame(()=>F()))}catch{}try{document.fonts?.ready&&await document.fonts.ready}catch{}let B=(w.trim()?`<style>${w}</style>`:"")+y.innerHTML;return await this.htmlRenderer.render(B,o)}catch(A){return await this.renderAsErrorPng(`Failed to render Svelte template: ${A.message}`,o)}finally{try{b&&R&&R(b)}catch{}try{S&&URL.revokeObjectURL(S)}catch{}this.removeContainer(E)}}async renderVueTemplate(t,n,i,o){let{templateRef:s,source:a}=this.getTemplateSource(n,t.type,t.template);if(!a)return await this.renderAsErrorPng(`Missing md2x template: ${s||t.template}`,o);let c=X(a);try{await this.ensureVueRuntime(i)}catch(y){return await this.renderAsErrorPng(`Vue runtime unavailable: ${y.message}`,o)}if(t.allowTemplateAssets){if(c.error)return await this.renderAsErrorPng(`Invalid TemplateConfig JSON: ${c.error}`,o);try{await Z(c.templateConfig)}catch(y){return await this.renderAsErrorPng(`Failed to load TemplateConfig assets: ${y.message}`,o)}}let u=globalThis.Vue,p=globalThis["vue3-sfc-loader"];if(!u||!p||typeof p.loadModule!="function")return await this.renderAsErrorPng("Vue runtime not available (missing Vue / vue3-sfc-loader)",o);let f=[],h=O(c.source,t.data),d=s||t.template,w={moduleCache:{vue:u},getFile:async y=>{if(y===d||y.endsWith("/"+d)||y.endsWith("\\"+d))return h;let b=n??{};if(typeof b[y]=="string")return b[y];try{let R=new URL(y,document.baseURI).href;if(typeof b[R]=="string")return b[R]}catch{}return null},addStyle:y=>{typeof y=="string"&&y.trim()&&f.push(y)}},m=this.createContainer();m.style.cssText="position: absolute; left: -9999px; top: -9999px; display: inline-block; background: transparent; padding: 0; margin: 0;";let T=document.createElement("div");T.style.cssText="display: inline-block;",m.appendChild(T);let E=null;try{let y=await p.loadModule(d,w);E=u.createApp({render:()=>u.h(y)}),E.mount(T);try{await u.nextTick()}catch{}try{document.fonts?.ready&&await document.fonts.ready}catch{}let R=(f.length?`<style>${f.join("\\n")}</style>`:"")+T.innerHTML;return await this.htmlRenderer.render(R,o)}finally{try{E&&typeof E.unmount=="function"&&E.unmount()}catch{}this.removeContainer(m)}}async render(t,n){let i=typeof t=="string"?t:t.code;this.validateInput(i);let o=be(i),s=typeof t=="string"?void 0:t.templateFiles,a=typeof t=="string"?void 0:t.cdn;return o.type==="html"?await this.renderHtmlTemplate(o,s,n):o.type==="vue"?await this.renderVueTemplate(o,s,a,n):o.type==="svelte"?await this.renderSvelteTemplate(o,s,a,n):await this.renderAsErrorPng(`Unsupported md2x type: ${o.type}`,n)}};var ae=class extends oe{async mountToDom(e,t,n){let i=typeof e=="string"?e:e.code;this.validateInput(i);let o=be(i),s=typeof e=="string"?void 0:e.templateFiles,a=typeof e=="string"?void 0:e.cdn,{templateRef:c,source:u}=this.getTemplateSource(s,o.type,o.template);if(!u){let d=document.createElement("div");return d.textContent=`Missing md2x template: ${c||o.template}`,{root:d,cleanup:()=>{}}}let p=X(u);if(o.allowTemplateAssets){if(p.error){let d=document.createElement("div");return d.textContent=`Invalid TemplateConfig JSON: ${p.error}`,{root:d,cleanup:()=>{}}}await Z(p.templateConfig)}let f=n??(()=>{let d=document.createElement("div");return d.style.cssText="position: absolute; left: 0; top: 0; display: inline-block; background: transparent; padding: 0; margin: 0;",document.body.appendChild(d),d})();try{f.innerHTML=""}catch{}if(o.type==="html"){let d=document.createElement("div");d.style.cssText="display: inline-block;",f.appendChild(d);let w=O(p.source,o.data);d.innerHTML=w;let m=()=>{try{d.remove()}catch{}n||this.removeContainer(f)};return o.allowScripts&&await this.runHtmlTemplateScripts(d,s),{root:f,cleanup:m}}if(o.type==="vue"){try{await this.ensureVueRuntime(a)}catch(g){let v=document.createElement("div");return v.textContent=`Vue runtime unavailable: ${g.message}`,{root:v,cleanup:()=>{}}}let d=globalThis.Vue,w=globalThis["vue3-sfc-loader"];if(!d||!w||typeof w.loadModule!="function"){let g=document.createElement("div");return g.textContent="Vue runtime not available (missing Vue / vue3-sfc-loader)",{root:g,cleanup:()=>{}}}let m=[],T=O(p.source,o.data),E=c||o.template,y={moduleCache:{vue:d},getFile:async g=>{if(g===E||g.endsWith("/"+E)||g.endsWith("\\"+E))return T;let v=s??{};if(typeof v[g]=="string")return v[g];try{let I=new URL(g,document.baseURI).href;if(typeof v[I]=="string")return v[I]}catch{}return null},addStyle:g=>{typeof g=="string"&&g.trim()&&m.push(g)}},b=document.createElement("div");b.style.cssText="display: inline-block;",f.appendChild(b);let R=null,S=null;try{let g=await w.loadModule(E,y);R=d.createApp({render:()=>d.h(g)}),R.mount(b);try{await d.nextTick()}catch{}try{document.fonts?.ready&&await document.fonts.ready}catch{}m.length&&(S=document.createElement("style"),S.textContent=m.join(`
|
|
11
|
+
`),document.head.appendChild(S))}catch(g){try{b.textContent=`Failed to mount Vue template: ${g.message}`}catch{}}return{root:f,cleanup:()=>{try{R&&typeof R.unmount=="function"&&R.unmount()}catch{}try{b.remove()}catch{}try{S&&S.remove()}catch{}n||this.removeContainer(f)}}}if(o.type==="svelte"){let d;try{d=await this.ensureSvelteCompiler(a)}catch(B){let F=document.createElement("div");return F.textContent=`Svelte compiler unavailable: ${B.message}`,{root:F,cleanup:()=>{}}}let w=d?.compile||d?.default?.compile||d?.svelte?.compile;if(typeof w!="function"){let B=document.createElement("div");return B.textContent="Svelte compiler not available (missing compile())",{root:B,cleanup:()=>{}}}let m=O(p.source,o.data),T;try{try{T=w(m,{filename:c||o.template||"md2x.svelte",generate:"client"})}catch{T=w(m,{filename:c||o.template||"md2x.svelte",generate:"dom"})}}catch(B){let F=document.createElement("div");return F.textContent=`Failed to compile Svelte template: ${B.message}`,{root:F,cleanup:()=>{}}}let E=String(T?.js?.code||""),y=String(T?.css?.code||"");if(!E.trim()){let B=document.createElement("div");return B.textContent="Svelte compile returned no JS output",{root:B,cleanup:()=>{}}}let b=a?.svelteBase||"https://esm.sh/svelte@5/",R=Ee(E,b),S=document.createElement("div");S.style.cssText="display: inline-block;",f.appendChild(S);let A=null,g=null,v=null,I=null;try{v=URL.createObjectURL(new Blob([R],{type:"text/javascript"}));let F=(await J(v))?.default;if(typeof F!="function")throw new Error("Compiled Svelte module has no default component export");let Q=await J(se(b)),M=Q?.mount;if(g=typeof Q?.unmount=="function"?Q.unmount:null,typeof M!="function")throw new Error("Svelte runtime mount() not available");A=M(F,{target:S}),y.trim()&&(I=document.createElement("style"),I.textContent=y,document.head.appendChild(I))}catch(B){try{S.textContent=`Failed to mount Svelte template: ${B.message}`}catch{}}return{root:f,cleanup:()=>{try{A&&g&&g(A)}catch{}try{v&&URL.revokeObjectURL(v)}catch{}try{S.remove()}catch{}try{I&&I.remove()}catch{}n||this.removeContainer(f)}}}let h=document.createElement("div");return h.textContent=`Unsupported md2x type: ${o.type}`,{root:h,cleanup:()=>{}}}};x();function Xt(){return globalThis}function Zt(){let r=Xt();return r.__md2x_renderer_registry__||(r.__md2x_renderer_registry__=new Map),r.__md2x_renderer_registry__}function Xe(r){Zt().set(r.type,r)}Xe(new ae);})();
|
|
12
|
+
/*! Bundled license information:
|
|
13
|
+
|
|
14
|
+
ieee754/index.js:
|
|
15
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
16
|
+
|
|
17
|
+
buffer/index.js:
|
|
18
|
+
(*!
|
|
19
|
+
* The buffer module from node.js, for the browser.
|
|
20
|
+
*
|
|
21
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
22
|
+
* @license MIT
|
|
23
|
+
*)
|
|
24
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";(()=>{var $e=Object.create;var Jt=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var qe=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var He=(n,t)=>()=>(n&&(t=n(n=0)),t);var Mt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var je=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of We(t))!Ve.call(n,i)&&i!==e&&Jt(n,i,{get:()=>t[i],enumerable:!(r=ze(t,i))||r.enumerable});return n};var Ze=(n,t,e)=>(e=n!=null?$e(qe(n)):{},je(t||!n||!n.__esModule?Jt(e,"default",{value:n,enumerable:!0}):e,n));var ee=Mt(at=>{"use strict";k();at.byteLength=Qe;at.toByteArray=Je;at.fromByteArray=er;var O=[],_=[],Ye=typeof Uint8Array<"u"?Uint8Array:Array,kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(q=0,Kt=kt.length;q<Kt;++q)O[q]=kt[q],_[kt.charCodeAt(q)]=q;var q,Kt;_[45]=62;_[95]=63;function te(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=t);var r=e===t?0:4-e%4;return[e,r]}function Qe(n){var t=te(n),e=t[0],r=t[1];return(e+r)*3/4-r}function Xe(n,t,e){return(t+e)*3/4-e}function Je(n){var t,e=te(n),r=e[0],i=e[1],o=new Ye(Xe(n,r,i)),s=0,a=i>0?r-4:r,h;for(h=0;h<a;h+=4)t=_[n.charCodeAt(h)]<<18|_[n.charCodeAt(h+1)]<<12|_[n.charCodeAt(h+2)]<<6|_[n.charCodeAt(h+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=_[n.charCodeAt(h)]<<2|_[n.charCodeAt(h+1)]>>4,o[s++]=t&255),i===1&&(t=_[n.charCodeAt(h)]<<10|_[n.charCodeAt(h+1)]<<4|_[n.charCodeAt(h+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function Ke(n){return O[n>>18&63]+O[n>>12&63]+O[n>>6&63]+O[n&63]}function tr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(Ke(r));return i.join("")}function er(n){for(var t,e=n.length,r=e%3,i=[],o=16383,s=0,a=e-r;s<a;s+=o)i.push(tr(n,s,s+o>a?a:s+o));return r===1?(t=n[e-1],i.push(O[t>>2]+O[t<<4&63]+"==")):r===2&&(t=(n[e-2]<<8)+n[e-1],i.push(O[t>>10]+O[t>>4&63]+O[t<<2&63]+"=")),i.join("")}});var re=Mt(Bt=>{k();Bt.read=function(n,t,e,r,i){var o,s,a=i*8-r-1,h=(1<<a)-1,l=h>>1,c=-7,u=e?i-1:0,p=e?-1:1,f=n[t+u];for(u+=p,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=o*256+n[t+u],u+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+n[t+u],u+=p,c-=8);if(o===0)o=1-l;else{if(o===h)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-l}return(f?-1:1)*s*Math.pow(2,o-r)};Bt.write=function(n,t,e,r,i,o){var s,a,h,l=o*8-i-1,c=(1<<l)-1,u=c>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,g=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-s))<1&&(s--,h*=2),s+u>=1?t+=p/h:t+=p*Math.pow(2,1-u),t*h>=2&&(s++,h/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(t*h-1)*Math.pow(2,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;n[e+f]=a&255,f+=g,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;n[e+f]=s&255,f+=g,s/=256,l-=8);n[e+f-g]|=m*128}});var xe=Mt(J=>{"use strict";k();var It=ee(),Q=re(),ne=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;J.Buffer=d;J.SlowBuffer=ar;J.INSPECT_MAX_BYTES=50;var ht=2147483647;J.kMaxLength=ht;d.TYPED_ARRAY_SUPPORT=rr();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function rr(){try{let n=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(n,t),n.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function G(n){if(n>ht)throw new RangeError('The value "'+n+'" is invalid for option "size"');let t=new Uint8Array(n);return Object.setPrototypeOf(t,d.prototype),t}function d(n,t,e){if(typeof n=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Tt(n)}return ae(n,t,e)}d.poolSize=8192;function ae(n,t,e){if(typeof n=="string")return ir(n,t);if(ArrayBuffer.isView(n))return or(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(v(n,ArrayBuffer)||n&&v(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(v(n,SharedArrayBuffer)||n&&v(n.buffer,SharedArrayBuffer)))return At(n,t,e);if(typeof n=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=n.valueOf&&n.valueOf();if(r!=null&&r!==n)return d.from(r,t,e);let i=sr(n);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return d.from(n[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}d.from=function(n,t,e){return ae(n,t,e)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function he(n){if(typeof n!="number")throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}function nr(n,t,e){return he(n),n<=0?G(n):t!==void 0?typeof e=="string"?G(n).fill(t,e):G(n).fill(t):G(n)}d.alloc=function(n,t,e){return nr(n,t,e)};function Tt(n){return he(n),G(n<0?0:Rt(n)|0)}d.allocUnsafe=function(n){return Tt(n)};d.allocUnsafeSlow=function(n){return Tt(n)};function ir(n,t){if((typeof t!="string"||t==="")&&(t="utf8"),!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=ue(n,t)|0,r=G(e),i=r.write(n,t);return i!==e&&(r=r.slice(0,i)),r}function St(n){let t=n.length<0?0:Rt(n.length)|0,e=G(t);for(let r=0;r<t;r+=1)e[r]=n[r]&255;return e}function or(n){if(v(n,Uint8Array)){let t=new Uint8Array(n);return At(t.buffer,t.byteOffset,t.byteLength)}return St(n)}function At(n,t,e){if(t<0||n.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let r;return t===void 0&&e===void 0?r=new Uint8Array(n):e===void 0?r=new Uint8Array(n,t):r=new Uint8Array(n,t,e),Object.setPrototypeOf(r,d.prototype),r}function sr(n){if(d.isBuffer(n)){let t=Rt(n.length)|0,e=G(t);return e.length===0||n.copy(e,0,0,t),e}if(n.length!==void 0)return typeof n.length!="number"||Pt(n.length)?G(0):St(n);if(n.type==="Buffer"&&Array.isArray(n.data))return St(n.data)}function Rt(n){if(n>=ht)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ht.toString(16)+" bytes");return n|0}function ar(n){return+n!=n&&(n=0),d.alloc(+n)}d.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==d.prototype};d.compare=function(t,e){if(v(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),v(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(t)||!d.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};d.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return d.alloc(0);let r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;let i=d.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){let s=t[r];if(v(s,Uint8Array))o+s.length>i.length?(d.isBuffer(s)||(s=d.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(d.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function ue(n,t){if(d.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||v(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);let e=n.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Ft(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return we(n).length;default:if(i)return r?-1:Ft(n).length;t=(""+t).toLowerCase(),i=!0}}d.byteLength=ue;function hr(n,t,e){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return wr(this,t,e);case"utf8":case"utf-8":return le(this,t,e);case"ascii":return mr(this,t,e);case"latin1":case"binary":return yr(this,t,e);case"base64":return dr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function V(n,t,e){let r=n[t];n[t]=n[e],n[e]=r}d.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)V(this,e,e+1);return this};d.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)V(this,e,e+3),V(this,e+1,e+2);return this};d.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)V(this,e,e+7),V(this,e+1,e+6),V(this,e+2,e+5),V(this,e+3,e+4);return this};d.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?le(this,0,t):hr.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(t){if(!d.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:d.compare(this,t)===0};d.prototype.inspect=function(){let t="",e=J.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};ne&&(d.prototype[ne]=d.prototype.inspect);d.prototype.compare=function(t,e,r,i,o){if(v(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,a=r-e,h=Math.min(s,a),l=this.slice(i,o),c=t.slice(e,r);for(let u=0;u<h;++u)if(l[u]!==c[u]){s=l[u],a=c[u];break}return s<a?-1:a<s?1:0};function ce(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Pt(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:ie(n,t,e,r,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):ie(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function ie(n,t,e,r,i){let o=1,s=n.length,a=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,a/=2,e/=2}function h(c,u){return o===1?c[u]:c.readUInt16BE(u*o)}let l;if(i){let c=-1;for(l=e;l<s;l++)if(h(n,l)===h(t,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===a)return c*o}else c!==-1&&(l-=l-c),c=-1}else for(e+a>s&&(e=s-a),l=e;l>=0;l--){let c=!0;for(let u=0;u<a;u++)if(h(n,l+u)!==h(t,u)){c=!1;break}if(c)return l}return-1}d.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};d.prototype.indexOf=function(t,e,r){return ce(this,t,e,r,!0)};d.prototype.lastIndexOf=function(t,e,r){return ce(this,t,e,r,!1)};function ur(n,t,e,r){e=Number(e)||0;let i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;let o=t.length;r>o/2&&(r=o/2);let s;for(s=0;s<r;++s){let a=parseInt(t.substr(s*2,2),16);if(Pt(a))return s;n[e+s]=a}return s}function cr(n,t,e,r){return ut(Ft(t,n.length-e),n,e,r)}function lr(n,t,e,r){return ut(kr(t),n,e,r)}function fr(n,t,e,r){return ut(we(t),n,e,r)}function pr(n,t,e,r){return ut(Br(t,n.length-e),n,e,r)}d.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return ur(this,t,e,r);case"utf8":case"utf-8":return cr(this,t,e,r);case"ascii":case"latin1":case"binary":return lr(this,t,e,r);case"base64":return fr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dr(n,t,e){return t===0&&e===n.length?It.fromByteArray(n):It.fromByteArray(n.slice(t,e))}function le(n,t,e){e=Math.min(n.length,e);let r=[],i=t;for(;i<e;){let o=n[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=e){let h,l,c,u;switch(a){case 1:o<128&&(s=o);break;case 2:h=n[i+1],(h&192)===128&&(u=(o&31)<<6|h&63,u>127&&(s=u));break;case 3:h=n[i+1],l=n[i+2],(h&192)===128&&(l&192)===128&&(u=(o&15)<<12|(h&63)<<6|l&63,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:h=n[i+1],l=n[i+2],c=n[i+3],(h&192)===128&&(l&192)===128&&(c&192)===128&&(u=(o&15)<<18|(h&63)<<12|(l&63)<<6|c&63,u>65535&&u<1114112&&(s=u))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=a}return gr(r)}var oe=4096;function gr(n){let t=n.length;if(t<=oe)return String.fromCharCode.apply(String,n);let e="",r=0;for(;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=oe));return e}function mr(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function yr(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function wr(n,t,e){let r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);let i="";for(let o=t;o<e;++o)i+=Ir[n[o]];return i}function xr(n,t,e){let r=n.slice(t,e),i="";for(let o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}d.prototype.slice=function(t,e){let r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,d.prototype),i};function A(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(t,e,r){t=t>>>0,e=e>>>0,r||A(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return i};d.prototype.readUintBE=d.prototype.readUIntBE=function(t,e,r){t=t>>>0,e=e>>>0,r||A(t,e,this.length);let i=this[t+--e],o=1;for(;e>0&&(o*=256);)i+=this[t+--e]*o;return i};d.prototype.readUint8=d.prototype.readUInt8=function(t,e){return t=t>>>0,e||A(t,1,this.length),this[t]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||A(t,2,this.length),this[t]|this[t+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||A(t,2,this.length),this[t]<<8|this[t+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||A(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};d.prototype.readBigUInt64LE=$(function(t){t=t>>>0,X(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&et(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+r*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});d.prototype.readBigUInt64BE=$(function(t){t=t>>>0,X(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&et(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r;return(BigInt(i)<<BigInt(32))+BigInt(o)});d.prototype.readIntLE=function(t,e,r){t=t>>>0,e=e>>>0,r||A(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};d.prototype.readIntBE=function(t,e,r){t=t>>>0,e=e>>>0,r||A(t,e,this.length);let i=e,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};d.prototype.readInt8=function(t,e){return t=t>>>0,e||A(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};d.prototype.readInt16LE=function(t,e){t=t>>>0,e||A(t,2,this.length);let r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};d.prototype.readInt16BE=function(t,e){t=t>>>0,e||A(t,2,this.length);let r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};d.prototype.readInt32LE=function(t,e){return t=t>>>0,e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};d.prototype.readInt32BE=function(t,e){return t=t>>>0,e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};d.prototype.readBigInt64LE=$(function(t){t=t>>>0,X(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&et(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});d.prototype.readBigInt64BE=$(function(t){t=t>>>0,X(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&et(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r)});d.prototype.readFloatLE=function(t,e){return t=t>>>0,e||A(t,4,this.length),Q.read(this,t,!0,23,4)};d.prototype.readFloatBE=function(t,e){return t=t>>>0,e||A(t,4,this.length),Q.read(this,t,!1,23,4)};d.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||A(t,8,this.length),Q.read(this,t,!0,52,8)};d.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||A(t,8,this.length),Q.read(this,t,!1,52,8)};function F(n,t,e,r,i,o){if(!d.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;F(this,t,e,r,a,0)}let o=1,s=0;for(this[e]=t&255;++s<r&&(o*=256);)this[e+s]=t/o&255;return e+r};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;F(this,t,e,r,a,0)}let o=r-1,s=1;for(this[e+o]=t&255;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+r};d.prototype.writeUint8=d.prototype.writeUInt8=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,1,255,0),this[e]=t&255,e+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function fe(n,t,e,r,i){ye(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e++]=o,o=o>>8,n[e++]=o,o=o>>8,n[e++]=o,o=o>>8,n[e++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s,e}function pe(n,t,e,r,i){ye(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e+7]=o,o=o>>8,n[e+6]=o,o=o>>8,n[e+5]=o,o=o>>8,n[e+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return n[e+3]=s,s=s>>8,n[e+2]=s,s=s>>8,n[e+1]=s,s=s>>8,n[e]=s,e+8}d.prototype.writeBigUInt64LE=$(function(t,e=0){return fe(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=$(function(t,e=0){return pe(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let h=Math.pow(2,8*r-1);F(this,t,e,r,h-1,-h)}let o=0,s=1,a=0;for(this[e]=t&255;++o<r&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r};d.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let h=Math.pow(2,8*r-1);F(this,t,e,r,h-1,-h)}let o=r-1,s=1,a=0;for(this[e+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r};d.prototype.writeInt8=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};d.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};d.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};d.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};d.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};d.prototype.writeBigInt64LE=$(function(t,e=0){return fe(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=$(function(t,e=0){return pe(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function de(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ge(n,t,e,r,i){return t=+t,e=e>>>0,i||de(n,t,e,4,34028234663852886e22,-34028234663852886e22),Q.write(n,t,e,r,23,4),e+4}d.prototype.writeFloatLE=function(t,e,r){return ge(this,t,e,!0,r)};d.prototype.writeFloatBE=function(t,e,r){return ge(this,t,e,!1,r)};function me(n,t,e,r,i){return t=+t,e=e>>>0,i||de(n,t,e,8,17976931348623157e292,-17976931348623157e292),Q.write(n,t,e,r,52,8),e+8}d.prototype.writeDoubleLE=function(t,e,r){return me(this,t,e,!0,r)};d.prototype.writeDoubleBE=function(t,e,r){return me(this,t,e,!1,r)};d.prototype.copy=function(t,e,r,i){if(!d.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let o=i-r;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),o};d.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!d.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);let o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{let s=d.isBuffer(t)?t:d.from(t,i),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var Y={};function Ct(n,t,e){Y[n]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${n}]`,this.stack,delete this.name}get code(){return n}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${n}]: ${this.message}`}}}Ct("ERR_BUFFER_OUT_OF_BOUNDS",function(n){return n?`${n} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ct("ERR_INVALID_ARG_TYPE",function(n,t){return`The "${n}" argument must be of type number. Received type ${typeof t}`},TypeError);Ct("ERR_OUT_OF_RANGE",function(n,t,e){let r=`The value of "${n}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=se(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=se(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);function se(n){let t="",e=n.length,r=n[0]==="-"?1:0;for(;e>=r+4;e-=3)t=`_${n.slice(e-3,e)}${t}`;return`${n.slice(0,e)}${t}`}function br(n,t,e){X(t,"offset"),(n[t]===void 0||n[t+e]===void 0)&&et(t,n.length-(e+1))}function ye(n,t,e,r,i,o){if(n>e||n<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${e}${s}`,new Y.ERR_OUT_OF_RANGE("value",a,n)}br(r,i,o)}function X(n,t){if(typeof n!="number")throw new Y.ERR_INVALID_ARG_TYPE(t,"number",n)}function et(n,t,e){throw Math.floor(n)!==n?(X(n,e),new Y.ERR_OUT_OF_RANGE(e||"offset","an integer",n)):t<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,n)}var Er=/[^+/0-9A-Za-z-_]/g;function Mr(n){if(n=n.split("=")[0],n=n.trim().replace(Er,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ft(n,t){t=t||1/0;let e,r=n.length,i=null,o=[];for(let s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function kr(n){let t=[];for(let e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Br(n,t){let e,r,i,o=[];for(let s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function we(n){return It.toByteArray(Mr(n))}function ut(n,t,e,r){let i;for(i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function v(n,t){return n instanceof t||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===t.name}function Pt(n){return n!==n}var Ir=(function(){let n="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let r=e*16;for(let i=0;i<16;++i)t[r+i]=n[e]+n[i]}return t})();function $(n){return typeof BigInt>"u"?Sr:n}function Sr(){throw new Error("BigInt not supported")}});var be,k=He(()=>{"use strict";be=Ze(xe(),1);globalThis.Buffer=be.Buffer});k();k();k();k();var ct=class{constructor(t){this._initialized=!1;this.type=t}createContainer(){let t=document.createElement("div");return t.id="render-container-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),t.style.cssText="position: absolute; left: -9999px; top: -9999px;",document.body.appendChild(t),t}removeContainer(t){t&&t.parentNode&&t.parentNode.removeChild(t)}async initialize(t=null){this._initialized=!0}isInitialized(){return this._initialized}async render(t,e){throw new Error("render() must be implemented by subclass")}async mountToDom(t,e,r){let i=await this.render(t,e);if(!i||!i.base64){let s=document.createElement("div");return s.textContent=`Renderer returned empty result: ${this.type}`,r.appendChild(s),{root:s,cleanup:()=>{try{s.remove()}catch{}}}}let o=document.createElement("img");return o.style.maxWidth="100%",o.style.height="auto",o.alt=`${this.type} diagram`,o.src=`data:image/${i.format};base64,${i.base64}`,r.appendChild(o),{root:o,cleanup:()=>{try{o.remove()}catch{}}}}validateInput(t){if(!t||typeof t=="string"&&t.trim()==="")throw new Error(`Empty ${this.type} input provided`)}preprocessInput(t){return t}calculateCanvasScale(t){let r=t?.fontSize||12;return 14/16*(r/12)*4}async renderSvgToCanvas(t,e,r,i=null){return t=t.replace(/<style>/,"<style>foreignObject { overflow: visible; }"),new Promise((o,s)=>{let a=new Image;a.crossOrigin="Anonymous";let h=btoa(unescape(encodeURIComponent(t)));a.src=`data:image/svg+xml;base64,${h}`,a.onload=()=>{let l=document.createElement("canvas");l.width=e,l.height=r;let c=l.getContext("2d");i&&(c.font=`14px ${i}`),c.drawImage(a,0,0,e,r),o(l)},a.onerror=l=>{s(new Error("Failed to load SVG into image for rendering"))}})}};k();k();function _t(n,t,e){if(n&&n.length){let[r,i]=t,o=Math.PI/180*e,s=Math.cos(o),a=Math.sin(o);for(let h of n){let[l,c]=h;h[0]=(l-r)*s-(c-i)*a+r,h[1]=(l-r)*a+(c-i)*s+i}}}function Ar(n,t){return n[0]===t[0]&&n[1]===t[1]}function Fr(n,t,e,r=1){let i=e,o=Math.max(t,.1),s=n[0]&&n[0][0]&&typeof n[0][0]=="number"?[n]:n,a=[0,0];if(i)for(let l of s)_t(l,a,i);let h=(function(l,c,u){let p=[];for(let x of l){let b=[...x];Ar(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&p.push(b)}let f=[];c=Math.max(c,.1);let g=[];for(let x of p)for(let b=0;b<x.length-1;b++){let B=x[b],I=x[b+1];if(B[1]!==I[1]){let M=Math.min(B[1],I[1]);g.push({ymin:M,ymax:Math.max(B[1],I[1]),x:M===B[1]?B[0]:I[0],islope:(I[0]-B[0])/(I[1]-B[1])})}}if(g.sort(((x,b)=>x.ymin<b.ymin?-1:x.ymin>b.ymin?1:x.x<b.x?-1:x.x>b.x?1:x.ymax===b.ymax?0:(x.ymax-b.ymax)/Math.abs(x.ymax-b.ymax))),!g.length)return f;let m=[],y=g[0].ymin,w=0;for(;m.length||g.length;){if(g.length){let x=-1;for(let b=0;b<g.length&&!(g[b].ymin>y);b++)x=b;g.splice(0,x+1).forEach((b=>{m.push({s:y,edge:b})}))}if(m=m.filter((x=>!(x.edge.ymax<=y))),m.sort(((x,b)=>x.edge.x===b.edge.x?0:(x.edge.x-b.edge.x)/Math.abs(x.edge.x-b.edge.x))),(u!==1||w%c==0)&&m.length>1)for(let x=0;x<m.length;x+=2){let b=x+1;if(b>=m.length)break;let B=m[x].edge,I=m[b].edge;f.push([[Math.round(B.x),y],[Math.round(I.x),y]])}y+=u,m.forEach((x=>{x.edge.x=x.edge.x+u*x.edge.islope})),w++}return f})(s,o,r);if(i){for(let l of s)_t(l,a,-i);(function(l,c,u){let p=[];l.forEach((f=>p.push(...f))),_t(p,c,u)})(h,a,-i)}return h}function ot(n,t){var e;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=4*t.strokeWidth),i=Math.round(Math.max(i,.1));let o=1;return t.roughness>=1&&(((e=t.randomizer)===null||e===void 0?void 0:e.next())||Math.random())>.7&&(o=i),Fr(n,i,r,o||1)}var it=class{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){let r=ot(t,e);return{type:"fillSketch",ops:this.renderLines(r,e)}}renderLines(t,e){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],e));return r}};function xt(n){let t=n[0],e=n[1];return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}var vt=class extends it{fillPolygons(t,e){let r=e.hachureGap;r<0&&(r=4*e.strokeWidth),r=Math.max(r,.1);let i=ot(t,Object.assign({},e,{hachureGap:r})),o=Math.PI/180*e.hachureAngle,s=[],a=.5*r*Math.cos(o),h=.5*r*Math.sin(o);for(let[l,c]of i)xt([l,c])&&s.push([[l[0]-a,l[1]+h],[...c]],[[l[0]+a,l[1]-h],[...c]]);return{type:"fillSketch",ops:this.renderLines(s,e)}}},Gt=class extends it{fillPolygons(t,e){let r=this._fillPolygons(t,e),i=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}},Nt=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=ot(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(r,e)}dotsOnLines(t,e){let r=[],i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);let o=e.fillWeight;o<0&&(o=e.strokeWidth/2);let s=i/4;for(let a of t){let h=xt(a),l=h/i,c=Math.ceil(l)-1,u=h-c*i,p=(a[0][0]+a[1][0])/2-i/4,f=Math.min(a[0][1],a[1][1]);for(let g=0;g<c;g++){let m=f+u+g*i,y=p-s+2*Math.random()*s,w=m-s+2*Math.random()*s,x=this.helper.ellipse(y,w,o,o,e);r.push(...x.ops)}}return{type:"fillSketch",ops:r}}},$t=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=ot(t,e);return{type:"fillSketch",ops:this.dashedLine(r,e)}}dashedLine(t,e){let r=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,i=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,o=[];return t.forEach((s=>{let a=xt(s),h=Math.floor(a/(r+i)),l=(a+i-h*(r+i))/2,c=s[0],u=s[1];c[0]>u[0]&&(c=s[1],u=s[0]);let p=Math.atan((u[1]-c[1])/(u[0]-c[0]));for(let f=0;f<h;f++){let g=f*(r+i),m=g+r,y=[c[0]+g*Math.cos(p)+l*Math.cos(p),c[1]+g*Math.sin(p)+l*Math.sin(p)],w=[c[0]+m*Math.cos(p)+l*Math.cos(p),c[1]+m*Math.sin(p)+l*Math.sin(p)];o.push(...this.helper.doubleLineOps(y[0],y[1],w[0],w[1],e))}})),o}},zt=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,i=e.zigzagOffset<0?r:e.zigzagOffset,o=ot(t,e=Object.assign({},e,{hachureGap:r+i}));return{type:"fillSketch",ops:this.zigzagLines(o,i,e)}}zigzagLines(t,e,r){let i=[];return t.forEach((o=>{let s=xt(o),a=Math.round(s/(2*e)),h=o[0],l=o[1];h[0]>l[0]&&(h=o[1],l=o[0]);let c=Math.atan((l[1]-h[1])/(l[0]-h[0]));for(let u=0;u<a;u++){let p=2*u*e,f=2*(u+1)*e,g=Math.sqrt(2*Math.pow(e,2)),m=[h[0]+p*Math.cos(c),h[1]+p*Math.sin(c)],y=[h[0]+f*Math.cos(c),h[1]+f*Math.sin(c)],w=[m[0]+g*Math.cos(c+Math.PI/4),m[1]+g*Math.sin(c+Math.PI/4)];i.push(...this.helper.doubleLineOps(m[0],m[1],w[0],w[1],r),...this.helper.doubleLineOps(w[0],w[1],y[0],y[1],r))}})),i}},T={},Wt=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Tr=0,Ut=1,Ee=2,lt={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Lt(n,t){return n.type===t}function Yt(n){let t=[],e=(function(s){let a=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))a[a.length]={type:Tr,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];a[a.length]={type:Ut,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return a[a.length]={type:Ee,text:""},a})(n),r="BOD",i=0,o=e[i];for(;!Lt(o,Ee);){let s=0,a=[];if(r==="BOD"){if(o.text!=="M"&&o.text!=="m")return Yt("M0,0"+n);i++,s=lt[o.text],r=o.text}else Lt(o,Ut)?s=lt[r]:(i++,s=lt[o.text],r=o.text);if(!(i+s<e.length))throw new Error("Path data ended short");for(let h=i;h<i+s;h++){let l=e[h];if(!Lt(l,Ut))throw new Error("Param not a number: "+r+","+l.text);a[a.length]=+l.text}if(typeof lt[r]!="number")throw new Error("Bad segment: "+r);{let h={key:r,data:a};t.push(h),i+=s,o=e[i],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}function Te(n){let t=0,e=0,r=0,i=0,o=[];for(let{key:s,data:a}of n)switch(s){case"M":o.push({key:"M",data:[...a]}),[t,e]=a,[r,i]=a;break;case"m":t+=a[0],e+=a[1],o.push({key:"M",data:[t,e]}),r=t,i=e;break;case"L":o.push({key:"L",data:[...a]}),[t,e]=a;break;case"l":t+=a[0],e+=a[1],o.push({key:"L",data:[t,e]});break;case"C":o.push({key:"C",data:[...a]}),t=a[4],e=a[5];break;case"c":{let h=a.map(((l,c)=>c%2?l+e:l+t));o.push({key:"C",data:h}),t=h[4],e=h[5];break}case"Q":o.push({key:"Q",data:[...a]}),t=a[2],e=a[3];break;case"q":{let h=a.map(((l,c)=>c%2?l+e:l+t));o.push({key:"Q",data:h}),t=h[2],e=h[3];break}case"A":o.push({key:"A",data:[...a]}),t=a[5],e=a[6];break;case"a":t+=a[5],e+=a[6],o.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,e]});break;case"H":o.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...a]}),e=a[0];break;case"v":e+=a[0],o.push({key:"V",data:[e]});break;case"S":o.push({key:"S",data:[...a]}),t=a[2],e=a[3];break;case"s":{let h=a.map(((l,c)=>c%2?l+e:l+t));o.push({key:"S",data:h}),t=h[2],e=h[3];break}case"T":o.push({key:"T",data:[...a]}),t=a[0],e=a[1];break;case"t":t+=a[0],e+=a[1],o.push({key:"T",data:[t,e]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,e=i}return o}function Re(n){let t=[],e="",r=0,i=0,o=0,s=0,a=0,h=0;for(let{key:l,data:c}of n){switch(l){case"M":t.push({key:"M",data:[...c]}),[r,i]=c,[o,s]=c;break;case"C":t.push({key:"C",data:[...c]}),r=c[4],i=c[5],a=c[2],h=c[3];break;case"L":t.push({key:"L",data:[...c]}),[r,i]=c;break;case"H":r=c[0],t.push({key:"L",data:[r,i]});break;case"V":i=c[0],t.push({key:"L",data:[r,i]});break;case"S":{let u=0,p=0;e==="C"||e==="S"?(u=r+(r-a),p=i+(i-h)):(u=r,p=i),t.push({key:"C",data:[u,p,...c]}),a=c[0],h=c[1],r=c[2],i=c[3];break}case"T":{let[u,p]=c,f=0,g=0;e==="Q"||e==="T"?(f=r+(r-a),g=i+(i-h)):(f=r,g=i);let m=r+2*(f-r)/3,y=i+2*(g-i)/3,w=u+2*(f-u)/3,x=p+2*(g-p)/3;t.push({key:"C",data:[m,y,w,x,u,p]}),a=f,h=g,r=u,i=p;break}case"Q":{let[u,p,f,g]=c,m=r+2*(u-r)/3,y=i+2*(p-i)/3,w=f+2*(u-f)/3,x=g+2*(p-g)/3;t.push({key:"C",data:[m,y,w,x,f,g]}),a=u,h=p,r=f,i=g;break}case"A":{let u=Math.abs(c[0]),p=Math.abs(c[1]),f=c[2],g=c[3],m=c[4],y=c[5],w=c[6];u===0||p===0?(t.push({key:"C",data:[r,i,y,w,y,w]}),r=y,i=w):(r!==y||i!==w)&&(Ce(r,i,y,w,u,p,f,g,m).forEach((function(x){t.push({key:"C",data:x})})),r=y,i=w);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=s}e=l}return t}function rt(n,t,e){return[n*Math.cos(e)-t*Math.sin(e),n*Math.sin(e)+t*Math.cos(e)]}function Ce(n,t,e,r,i,o,s,a,h,l){let c=(u=s,Math.PI*u/180);var u;let p=[],f=0,g=0,m=0,y=0;if(l)[f,g,m,y]=l;else{[n,t]=rt(n,t,-c),[e,r]=rt(e,r,-c);let P=(n-e)/2,S=(t-r)/2,D=P*P/(i*i)+S*S/(o*o);D>1&&(D=Math.sqrt(D),i*=D,o*=D);let j=i*i,Z=o*o,Ge=j*Z-j*S*S-Z*P*P,Ne=j*S*S+Z*P*P,Xt=(a===h?-1:1)*Math.sqrt(Math.abs(Ge/Ne));m=Xt*i*S/o+(n+e)/2,y=Xt*-o*P/i+(t+r)/2,f=Math.asin(parseFloat(((t-y)/o).toFixed(9))),g=Math.asin(parseFloat(((r-y)/o).toFixed(9))),n<m&&(f=Math.PI-f),e<m&&(g=Math.PI-g),f<0&&(f=2*Math.PI+f),g<0&&(g=2*Math.PI+g),h&&f>g&&(f-=2*Math.PI),!h&&g>f&&(g-=2*Math.PI)}let w=g-f;if(Math.abs(w)>120*Math.PI/180){let P=g,S=e,D=r;g=h&&g>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=Ce(e=m+i*Math.cos(g),r=y+o*Math.sin(g),S,D,i,o,s,0,h,[g,P,m,y])}w=g-f;let x=Math.cos(f),b=Math.sin(f),B=Math.cos(g),I=Math.sin(g),M=Math.tan(w/4),C=4/3*i*M,L=4/3*o*M,st=[n,t],U=[n+C*b,t-L*x],W=[e+C*I,r-L*B],Qt=[e,r];if(U[0]=2*st[0]-U[0],U[1]=2*st[1]-U[1],l)return[U,W,Qt].concat(p);{p=[U,W,Qt].concat(p);let P=[];for(let S=0;S<p.length;S+=3){let D=rt(p[S][0],p[S][1],c),j=rt(p[S+1][0],p[S+1][1],c),Z=rt(p[S+2][0],p[S+2][1],c);P.push([D[0],D[1],j[0],j[1],Z[0],Z[1]])}return P}}var Rr={randOffset:function(n,t){return E(n,t)},randOffsetWithRange:function(n,t,e){return mt(n,t,e)},ellipse:function(n,t,e,r,i){let o=_e(e,r,i);return qt(n,t,i,o).opset},doubleLineOps:function(n,t,e,r,i){return z(n,t,e,r,i,!0)}};function Pe(n,t,e,r,i){return{type:"path",ops:z(n,t,e,r,i)}}function dt(n,t,e){let r=(n||[]).length;if(r>2){let i=[];for(let o=0;o<r-1;o++)i.push(...z(n[o][0],n[o][1],n[o+1][0],n[o+1][1],e));return t&&i.push(...z(n[r-1][0],n[r-1][1],n[0][0],n[0][1],e)),{type:"path",ops:i}}return r===2?Pe(n[0][0],n[0][1],n[1][0],n[1][1],e):{type:"path",ops:[]}}function Cr(n,t,e,r,i){return(function(o,s){return dt(o,!0,s)})([[n,t],[n+e,t],[n+e,t+r],[n,t+r]],i)}function Me(n,t){if(n.length){let e=typeof n[0][0]=="number"?[n]:n,r=ft(e[0],1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:ft(e[0],1.5*(1+.22*t.roughness),Ie(t));for(let o=1;o<e.length;o++){let s=e[o];if(s.length){let a=ft(s,1*(1+.2*t.roughness),t),h=t.disableMultiStroke?[]:ft(s,1.5*(1+.22*t.roughness),Ie(t));for(let l of a)l.op!=="move"&&r.push(l);for(let l of h)l.op!=="move"&&i.push(l)}}return{type:"path",ops:r.concat(i)}}return{type:"path",ops:[]}}function _e(n,t,e){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(n/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(e.curveStepCount,e.curveStepCount/Math.sqrt(200)*r)),o=2*Math.PI/i,s=Math.abs(n/2),a=Math.abs(t/2),h=1-e.curveFitting;return s+=E(s*h,e),a+=E(a*h,e),{increment:o,rx:s,ry:a}}function qt(n,t,e,r){let[i,o]=Se(r.increment,n,t,r.rx,r.ry,1,r.increment*mt(.1,mt(.4,1,e),e),e),s=yt(i,null,e);if(!e.disableMultiStroke&&e.roughness!==0){let[a]=Se(r.increment,n,t,r.rx,r.ry,1.5,0,e),h=yt(a,null,e);s=s.concat(h)}return{estimatedPoints:o,opset:{type:"path",ops:s}}}function ke(n,t,e,r,i,o,s,a,h){let l=n,c=t,u=Math.abs(e/2),p=Math.abs(r/2);u+=E(.01*u,h),p+=E(.01*p,h);let f=i,g=o;for(;f<0;)f+=2*Math.PI,g+=2*Math.PI;g-f>2*Math.PI&&(f=0,g=2*Math.PI);let m=2*Math.PI/h.curveStepCount,y=Math.min(m/2,(g-f)/2),w=Ae(y,l,c,u,p,f,g,1,h);if(!h.disableMultiStroke){let x=Ae(y,l,c,u,p,f,g,1.5,h);w.push(...x)}return s&&(a?w.push(...z(l,c,l+u*Math.cos(f),c+p*Math.sin(f),h),...z(l,c,l+u*Math.cos(g),c+p*Math.sin(g),h)):w.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+u*Math.cos(f),c+p*Math.sin(f)]})),{type:"path",ops:w}}function Be(n,t){let e=Re(Te(Yt(n))),r=[],i=[0,0],o=[0,0];for(let{key:s,data:a}of e)switch(s){case"M":o=[a[0],a[1]],i=[a[0],a[1]];break;case"L":r.push(...z(o[0],o[1],a[0],a[1],t)),o=[a[0],a[1]];break;case"C":{let[h,l,c,u,p,f]=a;r.push(...Pr(h,l,c,u,p,f,o,t)),o=[p,f];break}case"Z":r.push(...z(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]]}return{type:"path",ops:r}}function Dt(n,t){let e=[];for(let r of n)if(r.length){let i=t.maxRandomnessOffset||0,o=r.length;if(o>2){e.push({op:"move",data:[r[0][0]+E(i,t),r[0][1]+E(i,t)]});for(let s=1;s<o;s++)e.push({op:"lineTo",data:[r[s][0]+E(i,t),r[s][1]+E(i,t)]})}}return{type:"fillPath",ops:e}}function K(n,t){return(function(e,r){let i=e.fillStyle||"hachure";if(!T[i])switch(i){case"zigzag":T[i]||(T[i]=new vt(r));break;case"cross-hatch":T[i]||(T[i]=new Gt(r));break;case"dots":T[i]||(T[i]=new Nt(r));break;case"dashed":T[i]||(T[i]=new $t(r));break;case"zigzag-line":T[i]||(T[i]=new zt(r));break;default:i="hachure",T[i]||(T[i]=new it(r))}return T[i]})(t,Rr).fillPolygons(n,t)}function Ie(n){let t=Object.assign({},n);return t.randomizer=void 0,n.seed&&(t.seed=n.seed+1),t}function Ue(n){return n.randomizer||(n.randomizer=new Wt(n.seed||0)),n.randomizer.next()}function mt(n,t,e,r=1){return e.roughness*r*(Ue(e)*(t-n)+n)}function E(n,t,e=1){return mt(-n,n,t,e)}function z(n,t,e,r,i,o=!1){let s=o?i.disableMultiStrokeFill:i.disableMultiStroke,a=Vt(n,t,e,r,i,!0,!1);if(s)return a;let h=Vt(n,t,e,r,i,!0,!0);return a.concat(h)}function Vt(n,t,e,r,i,o,s){let a=Math.pow(n-e,2)+Math.pow(t-r,2),h=Math.sqrt(a),l=1;l=h<200?1:h>500?.4:-.0016668*h+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>a&&(c=h/10);let u=c/2,p=.2+.2*Ue(i),f=i.bowing*i.maxRandomnessOffset*(r-t)/200,g=i.bowing*i.maxRandomnessOffset*(n-e)/200;f=E(f,i,l),g=E(g,i,l);let m=[],y=()=>E(u,i,l),w=()=>E(c,i,l),x=i.preserveVertices;return o&&(s?m.push({op:"move",data:[n+(x?0:y()),t+(x?0:y())]}):m.push({op:"move",data:[n+(x?0:E(c,i,l)),t+(x?0:E(c,i,l))]})),s?m.push({op:"bcurveTo",data:[f+n+(e-n)*p+y(),g+t+(r-t)*p+y(),f+n+2*(e-n)*p+y(),g+t+2*(r-t)*p+y(),e+(x?0:y()),r+(x?0:y())]}):m.push({op:"bcurveTo",data:[f+n+(e-n)*p+w(),g+t+(r-t)*p+w(),f+n+2*(e-n)*p+w(),g+t+2*(r-t)*p+w(),e+(x?0:w()),r+(x?0:w())]}),m}function ft(n,t,e){if(!n.length)return[];let r=[];r.push([n[0][0]+E(t,e),n[0][1]+E(t,e)]),r.push([n[0][0]+E(t,e),n[0][1]+E(t,e)]);for(let i=1;i<n.length;i++)r.push([n[i][0]+E(t,e),n[i][1]+E(t,e)]),i===n.length-1&&r.push([n[i][0]+E(t,e),n[i][1]+E(t,e)]);return yt(r,null,e)}function yt(n,t,e){let r=n.length,i=[];if(r>3){let o=[],s=1-e.curveTightness;i.push({op:"move",data:[n[1][0],n[1][1]]});for(let a=1;a+2<r;a++){let h=n[a];o[0]=[h[0],h[1]],o[1]=[h[0]+(s*n[a+1][0]-s*n[a-1][0])/6,h[1]+(s*n[a+1][1]-s*n[a-1][1])/6],o[2]=[n[a+1][0]+(s*n[a][0]-s*n[a+2][0])/6,n[a+1][1]+(s*n[a][1]-s*n[a+2][1])/6],o[3]=[n[a+1][0],n[a+1][1]],i.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[3][0],o[3][1]]})}if(t&&t.length===2){let a=e.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+E(a,e),t[1]+E(a,e)]})}}else r===3?(i.push({op:"move",data:[n[1][0],n[1][1]]}),i.push({op:"bcurveTo",data:[n[1][0],n[1][1],n[2][0],n[2][1],n[2][0],n[2][1]]})):r===2&&i.push(...Vt(n[0][0],n[0][1],n[1][0],n[1][1],e,!0,!0));return i}function Se(n,t,e,r,i,o,s,a){let h=[],l=[];if(a.roughness===0){n/=4,l.push([t+r*Math.cos(-n),e+i*Math.sin(-n)]);for(let c=0;c<=2*Math.PI;c+=n){let u=[t+r*Math.cos(c),e+i*Math.sin(c)];h.push(u),l.push(u)}l.push([t+r*Math.cos(0),e+i*Math.sin(0)]),l.push([t+r*Math.cos(n),e+i*Math.sin(n)])}else{let c=E(.5,a)-Math.PI/2;l.push([E(o,a)+t+.9*r*Math.cos(c-n),E(o,a)+e+.9*i*Math.sin(c-n)]);let u=2*Math.PI+c-.01;for(let p=c;p<u;p+=n){let f=[E(o,a)+t+r*Math.cos(p),E(o,a)+e+i*Math.sin(p)];h.push(f),l.push(f)}l.push([E(o,a)+t+r*Math.cos(c+2*Math.PI+.5*s),E(o,a)+e+i*Math.sin(c+2*Math.PI+.5*s)]),l.push([E(o,a)+t+.98*r*Math.cos(c+s),E(o,a)+e+.98*i*Math.sin(c+s)]),l.push([E(o,a)+t+.9*r*Math.cos(c+.5*s),E(o,a)+e+.9*i*Math.sin(c+.5*s)])}return[l,h]}function Ae(n,t,e,r,i,o,s,a,h){let l=o+E(.1,h),c=[];c.push([E(a,h)+t+.9*r*Math.cos(l-n),E(a,h)+e+.9*i*Math.sin(l-n)]);for(let u=l;u<=s;u+=n)c.push([E(a,h)+t+r*Math.cos(u),E(a,h)+e+i*Math.sin(u)]);return c.push([t+r*Math.cos(s),e+i*Math.sin(s)]),c.push([t+r*Math.cos(s),e+i*Math.sin(s)]),yt(c,null,h)}function Pr(n,t,e,r,i,o,s,a){let h=[],l=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3],c=[0,0],u=a.disableMultiStroke?1:2,p=a.preserveVertices;for(let f=0;f<u;f++)f===0?h.push({op:"move",data:[s[0],s[1]]}):h.push({op:"move",data:[s[0]+(p?0:E(l[0],a)),s[1]+(p?0:E(l[0],a))]}),c=p?[i,o]:[i+E(l[f],a),o+E(l[f],a)],h.push({op:"bcurveTo",data:[n+E(l[f],a),t+E(l[f],a),e+E(l[f],a),r+E(l[f],a),c[0],c[1]]});return h}function nt(n){return[...n]}function Fe(n,t=0){let e=n.length;if(e<3)throw new Error("A curve must have at least three points.");let r=[];if(e===3)r.push(nt(n[0]),nt(n[1]),nt(n[2]),nt(n[2]));else{let i=[];i.push(n[0],n[0]);for(let a=1;a<n.length;a++)i.push(n[a]),a===n.length-1&&i.push(n[a]);let o=[],s=1-t;r.push(nt(i[0]));for(let a=1;a+2<i.length;a++){let h=i[a];o[0]=[h[0],h[1]],o[1]=[h[0]+(s*i[a+1][0]-s*i[a-1][0])/6,h[1]+(s*i[a+1][1]-s*i[a-1][1])/6],o[2]=[i[a+1][0]+(s*i[a][0]-s*i[a+2][0])/6,i[a+1][1]+(s*i[a][1]-s*i[a+2][1])/6],o[3]=[i[a+1][0],i[a+1][1]],r.push(o[1],o[2],o[3])}}return r}function gt(n,t){return Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)}function _r(n,t,e){let r=gt(t,e);if(r===0)return gt(n,t);let i=((n[0]-t[0])*(e[0]-t[0])+(n[1]-t[1])*(e[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),gt(n,H(t,e,i))}function H(n,t,e){return[n[0]+(t[0]-n[0])*e,n[1]+(t[1]-n[1])*e]}function Ht(n,t,e,r){let i=r||[];if((function(a,h){let l=a[h+0],c=a[h+1],u=a[h+2],p=a[h+3],f=3*c[0]-2*l[0]-p[0];f*=f;let g=3*c[1]-2*l[1]-p[1];g*=g;let m=3*u[0]-2*p[0]-l[0];m*=m;let y=3*u[1]-2*p[1]-l[1];return y*=y,f<m&&(f=m),g<y&&(g=y),f+g})(n,t)<e){let a=n[t+0];i.length?(o=i[i.length-1],s=a,Math.sqrt(gt(o,s))>1&&i.push(a)):i.push(a),i.push(n[t+3])}else{let h=n[t+0],l=n[t+1],c=n[t+2],u=n[t+3],p=H(h,l,.5),f=H(l,c,.5),g=H(c,u,.5),m=H(p,f,.5),y=H(f,g,.5),w=H(m,y,.5);Ht([h,p,m,w],0,e,i),Ht([w,y,g,u],0,e,i)}var o,s;return i}function Ur(n,t){return wt(n,0,n.length,t)}function wt(n,t,e,r,i){let o=i||[],s=n[t],a=n[e-1],h=0,l=1;for(let c=t+1;c<e-1;++c){let u=_r(n[c],s,a);u>h&&(h=u,l=c)}return Math.sqrt(h)>r?(wt(n,t,l+1,r,o),wt(n,l,e,r,o)):(o.length||o.push(s),o.push(a)),o}function Ot(n,t=.15,e){let r=[],i=(n.length-1)/3;for(let o=0;o<i;o++)Ht(n,3*o,t,r);return e&&e>0?wt(r,0,r.length,e):r}var R="none",tt=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,r){return{shape:t,sets:e||[],options:r||this.defaultOptions}}line(t,e,r,i,o){let s=this._o(o);return this._d("line",[Pe(t,e,r,i,s)],s)}rectangle(t,e,r,i,o){let s=this._o(o),a=[],h=Cr(t,e,r,i,s);if(s.fill){let l=[[t,e],[t+r,e],[t+r,e+i],[t,e+i]];s.fillStyle==="solid"?a.push(Dt([l],s)):a.push(K([l],s))}return s.stroke!==R&&a.push(h),this._d("rectangle",a,s)}ellipse(t,e,r,i,o){let s=this._o(o),a=[],h=_e(r,i,s),l=qt(t,e,s,h);if(s.fill)if(s.fillStyle==="solid"){let c=qt(t,e,s,h).opset;c.type="fillPath",a.push(c)}else a.push(K([l.estimatedPoints],s));return s.stroke!==R&&a.push(l.opset),this._d("ellipse",a,s)}circle(t,e,r,i){let o=this.ellipse(t,e,r,r,i);return o.shape="circle",o}linearPath(t,e){let r=this._o(e);return this._d("linearPath",[dt(t,!1,r)],r)}arc(t,e,r,i,o,s,a=!1,h){let l=this._o(h),c=[],u=ke(t,e,r,i,o,s,a,!0,l);if(a&&l.fill)if(l.fillStyle==="solid"){let p=Object.assign({},l);p.disableMultiStroke=!0;let f=ke(t,e,r,i,o,s,!0,!1,p);f.type="fillPath",c.push(f)}else c.push((function(p,f,g,m,y,w,x){let b=p,B=f,I=Math.abs(g/2),M=Math.abs(m/2);I+=E(.01*I,x),M+=E(.01*M,x);let C=y,L=w;for(;C<0;)C+=2*Math.PI,L+=2*Math.PI;L-C>2*Math.PI&&(C=0,L=2*Math.PI);let st=(L-C)/x.curveStepCount,U=[];for(let W=C;W<=L;W+=st)U.push([b+I*Math.cos(W),B+M*Math.sin(W)]);return U.push([b+I*Math.cos(L),B+M*Math.sin(L)]),U.push([b,B]),K([U],x)})(t,e,r,i,o,s,l));return l.stroke!==R&&c.push(u),this._d("arc",c,l)}curve(t,e){let r=this._o(e),i=[],o=Me(t,r);if(r.fill&&r.fill!==R)if(r.fillStyle==="solid"){let s=Me(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],a=t;if(a.length){let h=typeof a[0][0]=="number"?[a]:a;for(let l of h)l.length<3?s.push(...l):l.length===3?s.push(...Ot(Fe([l[0],l[0],l[1],l[2]]),10,(1+r.roughness)/2)):s.push(...Ot(Fe(l),10,(1+r.roughness)/2))}s.length&&i.push(K([s],r))}return r.stroke!==R&&i.push(o),this._d("curve",i,r)}polygon(t,e){let r=this._o(e),i=[],o=dt(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(Dt([t],r)):i.push(K([t],r))),r.stroke!==R&&i.push(o),this._d("polygon",i,r)}path(t,e){let r=this._o(e),i=[];if(!t)return this._d("path",i,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=r.fill&&r.fill!=="transparent"&&r.fill!==R,s=r.stroke!==R,a=!!(r.simplification&&r.simplification<1),h=(function(c,u,p){let f=Re(Te(Yt(c))),g=[],m=[],y=[0,0],w=[],x=()=>{w.length>=4&&m.push(...Ot(w,u)),w=[]},b=()=>{x(),m.length&&(g.push(m),m=[])};for(let{key:I,data:M}of f)switch(I){case"M":b(),y=[M[0],M[1]],m.push(y);break;case"L":x(),m.push([M[0],M[1]]);break;case"C":if(!w.length){let C=m.length?m[m.length-1]:y;w.push([C[0],C[1]])}w.push([M[0],M[1]]),w.push([M[2],M[3]]),w.push([M[4],M[5]]);break;case"Z":x(),m.push([y[0],y[1]])}if(b(),!p)return g;let B=[];for(let I of g){let M=Ur(I,p);M.length&&B.push(M)}return B})(t,1,a?4-4*(r.simplification||1):(1+r.roughness)/2),l=Be(t,r);if(o)if(r.fillStyle==="solid")if(h.length===1){let c=Be(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else i.push(Dt(h,r));else i.push(K(h,r));return s&&(a?h.forEach((c=>{i.push(dt(c,!1,r))})):i.push(l)),this._d("path",i,r)}opsToPath(t,e){let r="";for(let i of t.ops){let o=typeof e=="number"&&e>=0?i.data.map((s=>+s.toFixed(e))):i.data;switch(i.op){case"move":r+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":r+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":r+=`L${o[0]} ${o[1]} `}}return r.trim()}toPaths(t){let e=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let o of e){let s=null;switch(o.type){case"path":s={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:R};break;case"fillPath":s={d:this.opsToPath(o),stroke:R,strokeWidth:0,fill:r.fill||R};break;case"fillSketch":s=this.fillSketch(o,r)}s&&i.push(s)}return i}fillSketch(t,e){let r=e.fillWeight;return r<0&&(r=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||R,strokeWidth:r,fill:R}}_mergedShape(t){return t.filter(((e,r)=>r===0||e.op!=="move"))}},jt=class{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new tt(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let s of e)switch(s.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,s,o),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";let a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,o,a),i.restore();break}case"fillSketch":this.fillSketch(i,s,r)}}fillSketch(t,e,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=i,this._drawToContext(t,e,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,r,i="nonzero"){t.beginPath();for(let o of e.ops){let s=typeof r=="number"&&r>=0?o.data.map((a=>+a.toFixed(r))):o.data;switch(o.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}e.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,r,i,o){let s=this.gen.line(t,e,r,i,o);return this.draw(s),s}rectangle(t,e,r,i,o){let s=this.gen.rectangle(t,e,r,i,o);return this.draw(s),s}ellipse(t,e,r,i,o){let s=this.gen.ellipse(t,e,r,i,o);return this.draw(s),s}circle(t,e,r,i){let o=this.gen.circle(t,e,r,i);return this.draw(o),o}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r),r}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r),r}arc(t,e,r,i,o,s,a=!1,h){let l=this.gen.arc(t,e,r,i,o,s,a,h);return this.draw(l),l}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r),r}path(t,e){let r=this.gen.path(t,e);return this.draw(r),r}},pt="http://www.w3.org/2000/svg",Zt=class{constructor(t,e){this.svg=t,this.gen=new tt(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,o=i.createElementNS(pt,"g"),s=t.options.fixedDecimalPlaceDigits;for(let a of e){let h=null;switch(a.type){case"path":h=i.createElementNS(pt,"path"),h.setAttribute("d",this.opsToPath(a,s)),h.setAttribute("stroke",r.stroke),h.setAttribute("stroke-width",r.strokeWidth+""),h.setAttribute("fill","none"),r.strokeLineDash&&h.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&h.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":h=i.createElementNS(pt,"path"),h.setAttribute("d",this.opsToPath(a,s)),h.setAttribute("stroke","none"),h.setAttribute("stroke-width","0"),h.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||h.setAttribute("fill-rule","evenodd");break;case"fillSketch":h=this.fillSketch(i,a,r)}h&&o.appendChild(h)}return o}fillSketch(t,e,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let o=t.createElementNS(pt,"path");return o.setAttribute("d",this.opsToPath(e,r.fixedDecimalPlaceDigits)),o.setAttribute("stroke",r.fill||""),o.setAttribute("stroke-width",i+""),o.setAttribute("fill","none"),r.fillLineDash&&o.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,e){return this.gen.opsToPath(t,e)}line(t,e,r,i,o){let s=this.gen.line(t,e,r,i,o);return this.draw(s)}rectangle(t,e,r,i,o){let s=this.gen.rectangle(t,e,r,i,o);return this.draw(s)}ellipse(t,e,r,i,o){let s=this.gen.ellipse(t,e,r,i,o);return this.draw(s)}circle(t,e,r,i){let o=this.gen.circle(t,e,r,i);return this.draw(o)}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r)}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r)}arc(t,e,r,i,o,s,a=!1,h){let l=this.gen.arc(t,e,r,i,o,s,a,h);return this.draw(l)}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r)}path(t,e){let r=this.gen.path(t,e);return this.draw(r)}},Le={canvas:(n,t)=>new jt(n,t),svg:(n,t)=>new Zt(n,t),generator:n=>new tt(n),newSeed:()=>tt.newSeed()};var Lr={roughness:.5,bowing:.5,fillStyle:"hachure",fillWeight:.5,hachureGap:4,defaultBorderColor:"#333"};function De(n,t={}){let e={...Lr,...t},r={roughness:e.roughness,bowing:e.bowing},i=document.createElement("div");i.style.cssText="position: absolute; left: -9999px; top: -9999px;",i.innerHTML=n,document.body.appendChild(i);let o=i.querySelector("svg");if(!o)return document.body.removeChild(i),n;let s=Le.svg(o),a=u=>{let p=u.getAttribute("stroke");if(p&&p!=="none")return p;let f=window.getComputedStyle(u).stroke;return f&&f!=="none"&&f!==""?f:null},h=u=>{let p=u.getAttribute("fill");if(p&&p!=="none")return p;let f=window.getComputedStyle(u).fill;return f&&f!=="none"&&f!==""?f:null},l=u=>{u.setAttribute("stroke","none"),u.style.stroke="none"},c=u=>{let p=u.parentElement;for(;p;){let f=p.tagName.toLowerCase();if(f==="defs"||f==="marker")return!0;p=p.parentElement}return!1};return o.querySelectorAll("rect").forEach(u=>{if(c(u))return;let p=a(u),f=h(u);if(!p&&!f)return;let g=parseFloat(u.getAttribute("x")||"0"),m=parseFloat(u.getAttribute("y")||"0"),y=parseFloat(u.getAttribute("width")||"0"),w=parseFloat(u.getAttribute("height")||"0");if(y<=0||w<=0)return;let x=p||e.defaultBorderColor,b=s.rectangle(g,m,y,w,{...r,stroke:x,fill:f||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(b,u),u.remove()}),o.querySelectorAll("circle").forEach(u=>{if(c(u))return;let p=a(u),f=h(u);if(!p&&!f)return;let g=parseFloat(u.getAttribute("cx")||"0"),m=parseFloat(u.getAttribute("cy")||"0"),y=parseFloat(u.getAttribute("r")||"0");if(y<=0)return;let w=p||e.defaultBorderColor,x=s.circle(g,m,y*2,{...r,stroke:w,fill:f||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(x,u),u.remove()}),o.querySelectorAll("ellipse").forEach(u=>{if(c(u))return;let p=a(u),f=h(u);if(!p&&!f)return;let g=parseFloat(u.getAttribute("cx")||"0"),m=parseFloat(u.getAttribute("cy")||"0"),y=parseFloat(u.getAttribute("rx")||"0"),w=parseFloat(u.getAttribute("ry")||"0");if(y<=0||w<=0)return;let x=p||e.defaultBorderColor,b=s.ellipse(g,m,y*2,w*2,{...r,stroke:x,fill:f||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(b,u),u.remove()}),o.querySelectorAll("polygon").forEach(u=>{if(c(u))return;let p=a(u),f=h(u);if(!p&&!f)return;let m=(u.getAttribute("points")||"").trim().split(/\s+/).map(x=>{let[b,B]=x.split(",").map(Number);return[b,B]});if(m.length<3)return;let y=p||e.defaultBorderColor,w=s.polygon(m,{...r,stroke:y,fill:f||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(w,u),u.remove()}),o.querySelectorAll("line").forEach(u=>{if(c(u))return;let p=a(u);if(!p)return;let f=parseFloat(u.getAttribute("x1")||"0"),g=parseFloat(u.getAttribute("y1")||"0"),m=parseFloat(u.getAttribute("x2")||"0"),y=parseFloat(u.getAttribute("y2")||"0"),w=s.line(f,g,m,y,{...r,stroke:p}),x=u.getAttribute("marker-end"),b=u.getAttribute("marker-start");x||b?(l(u),u.parentNode?.insertBefore(w,u)):u.parentNode?.replaceChild(w,u)}),o.querySelectorAll("path").forEach(u=>{if(c(u))return;let p=a(u),f=h(u),g=u.getAttribute("d");if(!p||!g||f&&f!=="rgb(0, 0, 0)")return;let m=s.path(g,{...r,stroke:p,fill:"none"}),y=u.getAttribute("marker-end"),w=u.getAttribute("marker-start");y||w?(l(u),u.parentNode?.insertBefore(m,u)):u.parentNode?.replaceChild(m,u)}),document.body.removeChild(i),new XMLSerializer().serializeToString(o)}function Oe(){let n=window.mermaid;if(!n)throw new Error("Mermaid library not loaded. Ensure lib-mermaid.js is loaded before render-worker.js");return n}var bt=class extends ct{constructor(){super("mermaid");this.roughOptions={roughness:.5,bowing:.5}}async initialize(e=null){this.applyThemeConfig(e),this._initialized=!0}applyThemeConfig(e=null){let r=e?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",i=e?.diagramStyle==="handDrawn";Oe().initialize({startOnLoad:!1,securityLevel:"loose",look:i?"handDrawn":"classic",themeVariables:{fontFamily:r,background:"transparent"},flowchart:{htmlLabels:!0,curve:"basis"}})}isSequenceDiagram(e){return e.trim().toLowerCase().startsWith("sequencediagram")}preprocessCode(e){return e.replace(/\\n/g,"<br>")}applyRoughEffectToSvg(e,r){return r?.diagramStyle==="handDrawn"?De(e,this.roughOptions):e}async render(e,r){this._initialized||await this.initialize(r),this.validateInput(e),e=this.preprocessCode(e),this.applyThemeConfig(r);let i=this.createContainer();i.style.cssText="position: absolute; left: -9999px; top: -9999px; display: inline-block; background: transparent; padding: 0; margin: 0;";let o="mermaid-diagram-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),{svg:s}=await Oe().render(o,e);if(!s||s.length<100)throw new Error("Generated SVG is too small or empty");if(!s.includes("<svg")||!s.includes("</svg>"))throw new Error("Generated content is not valid SVG");i.innerHTML=s;let a=i.querySelector("svg");if(!a)throw new Error("SVG element not found in rendered content");i.offsetHeight,a.getBoundingClientRect(),await new Promise(w=>setTimeout(w,100)),document.fonts&&document.fonts.ready&&await document.fonts.ready,i.offsetHeight,a.getBoundingClientRect(),await new Promise(w=>setTimeout(w,50));let h=a.getAttribute("viewBox"),l,c;if(h){let w=h.split(/\s+/);l=Math.ceil(parseFloat(w[2])),c=Math.ceil(parseFloat(w[3]))}else l=Math.ceil(parseFloat(a.getAttribute("width")||"800")),c=Math.ceil(parseFloat(a.getAttribute("height")||"600"));let u=r?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",p=this.calculateCanvasScale(r),f=this.isSequenceDiagram(e)?this.applyRoughEffectToSvg(s,r):s,g=await this.renderSvgToCanvas(f,l*p,c*p,u),y=g.toDataURL("image/png",1).replace(/^data:image\/png;base64,/,"");return this.removeContainer(i),{base64:y,width:g.width,height:g.height,format:"png"}}};function Dr(){let n=window.mermaid;if(!n)throw new Error("Mermaid library not loaded.");return n}var Et=class extends bt{async mountToDom(t,e,r){if(this._initialized||await this.initialize(e),typeof t!="string")throw new Error("Mermaid input must be a string");let i=t;this.validateInput(i);let o=this.preprocessCode(i);this.applyThemeConfig(e);let s="mermaid-diagram-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),{svg:a}=await Dr().render(s,o),h=this.isSequenceDiagram(o)?this.applyRoughEffectToSvg(a,e):a;r.innerHTML=h;let c=r.querySelector("svg")||r,u=(async()=>{try{document.fonts?.ready&&await document.fonts.ready}catch{}try{typeof globalThis.requestAnimationFrame=="function"&&(await new Promise(p=>globalThis.requestAnimationFrame(()=>p())),await new Promise(p=>globalThis.requestAnimationFrame(()=>p())))}catch{}})();return{root:c,cleanup:()=>{try{r.innerHTML=""}catch{}},done:u}}};k();function Or(){return globalThis}function vr(){let n=Or();return n.__md2x_renderer_registry__||(n.__md2x_renderer_registry__=new Map),n.__md2x_renderer_registry__}function ve(n){vr().set(n.type,n)}ve(new Et);})();
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
ieee754/index.js:
|
|
5
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
6
|
+
|
|
7
|
+
buffer/index.js:
|
|
8
|
+
(*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*)
|
|
14
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";(()=>{var Br=Object.create;var J=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Ir=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Ar=Object.prototype.hasOwnProperty;var Ur=(e,r)=>()=>(e&&(r=e(e=0)),r);var P=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Rr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Ir(r))!Ar.call(e,i)&&i!==t&&J(e,i,{get:()=>r[i],enumerable:!(n=Er(r,i))||n.enumerable});return e};var Tr=(e,r,t)=>(t=e!=null?Br(Fr(e)):{},Rr(r||!e||!e.__esModule?J(t,"default",{value:e,enumerable:!0}):t,e));var Q=P(S=>{"use strict";y();S.byteLength=br;S.toByteArray=Sr;S.fromByteArray=Dr;var m=[],x=[],Cr=typeof Uint8Array<"u"?Uint8Array:Array,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(F=0,K=O.length;F<K;++F)m[F]=O[F],x[O.charCodeAt(F)]=F;var F,K;x[45]=62;x[95]=63;function Z(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function br(e){var r=Z(e),t=r[0],n=r[1];return(t+n)*3/4-n}function _r(e,r,t){return(r+t)*3/4-t}function Sr(e){var r,t=Z(e),n=t[0],i=t[1],o=new Cr(_r(e,n,i)),u=0,c=i>0?n-4:n,h;for(h=0;h<c;h+=4)r=x[e.charCodeAt(h)]<<18|x[e.charCodeAt(h+1)]<<12|x[e.charCodeAt(h+2)]<<6|x[e.charCodeAt(h+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return i===2&&(r=x[e.charCodeAt(h)]<<2|x[e.charCodeAt(h+1)]>>4,o[u++]=r&255),i===1&&(r=x[e.charCodeAt(h)]<<10|x[e.charCodeAt(h+1)]<<4|x[e.charCodeAt(h+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Mr(e){return m[e>>18&63]+m[e>>12&63]+m[e>>6&63]+m[e&63]}function Lr(e,r,t){for(var n,i=[],o=r;o<t;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(Mr(n));return i.join("")}function Dr(e){for(var r,t=e.length,n=t%3,i=[],o=16383,u=0,c=t-n;u<c;u+=o)i.push(Lr(e,u,u+o>c?c:u+o));return n===1?(r=e[t-1],i.push(m[r>>2]+m[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(m[r>>10]+m[r>>4&63]+m[r<<2&63]+"=")),i.join("")}});var v=P(G=>{y();G.read=function(e,r,t,n,i){var o,u,c=i*8-n-1,h=(1<<c)-1,a=h>>1,f=-7,p=t?i-1:0,I=t?-1:1,d=e[r+p];for(p+=I,o=d&(1<<-f)-1,d>>=-f,f+=c;f>0;o=o*256+e[r+p],p+=I,f-=8);for(u=o&(1<<-f)-1,o>>=-f,f+=n;f>0;u=u*256+e[r+p],p+=I,f-=8);if(o===0)o=1-a;else{if(o===h)return u?NaN:(d?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-a}return(d?-1:1)*u*Math.pow(2,o-n)};G.write=function(e,r,t,n,i,o){var u,c,h,a=o*8-i-1,f=(1<<a)-1,p=f>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,$=n?1:-1,gr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,u=f):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+p>=1?r+=I/h:r+=I*Math.pow(2,1-p),r*h>=2&&(u++,h/=2),u+p>=f?(c=0,u=f):u+p>=1?(c=(r*h-1)*Math.pow(2,i),u=u+p):(c=r*Math.pow(2,p-1)*Math.pow(2,i),u=0));i>=8;e[t+d]=c&255,d+=$,c/=256,i-=8);for(u=u<<i|c,a+=i;a>0;e[t+d]=u&255,d+=$,u/=256,a-=8);e[t+d-$]|=gr*128}});var dr=P(b=>{"use strict";y();var H=Q(),T=v(),rr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;b.Buffer=s;b.SlowBuffer=Gr;b.INSPECT_MAX_BYTES=50;var M=2147483647;b.kMaxLength=M;s.TYPED_ARRAY_SUPPORT=Nr();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Nr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function B(e){if(e>M)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return V(e)}return ir(e,r,t)}s.poolSize=8192;function ir(e,r,t){if(typeof e=="string")return $r(e,r);if(ArrayBuffer.isView(e))return Pr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(g(e,ArrayBuffer)||e&&g(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(g(e,SharedArrayBuffer)||e&&g(e.buffer,SharedArrayBuffer)))return j(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return s.from(n,r,t);let i=Or(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,t){return ir(e,r,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function or(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function kr(e,r,t){return or(e),e<=0?B(e):r!==void 0?typeof t=="string"?B(e).fill(r,t):B(e).fill(r):B(e)}s.alloc=function(e,r,t){return kr(e,r,t)};function V(e){return or(e),B(e<0?0:W(e)|0)}s.allocUnsafe=function(e){return V(e)};s.allocUnsafeSlow=function(e){return V(e)};function $r(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=ur(e,r)|0,n=B(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function z(e){let r=e.length<0?0:W(e.length)|0,t=B(r);for(let n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Pr(e){if(g(e,Uint8Array)){let r=new Uint8Array(e);return j(r.buffer,r.byteOffset,r.byteLength)}return z(e)}function j(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,s.prototype),n}function Or(e){if(s.isBuffer(e)){let r=W(e.length)|0,t=B(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||X(e.length)?B(0):z(e);if(e.type==="Buffer"&&Array.isArray(e.data))return z(e.data)}function W(e){if(e>=M)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M.toString(16)+" bytes");return e|0}function Gr(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype};s.compare=function(r,t){if(g(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),g(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(r)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,i=t.length;for(let o=0,u=Math.min(n,i);o<u;++o)if(r[o]!==t[o]){n=r[o],i=t[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let i=s.allocUnsafe(t),o=0;for(n=0;n<r.length;++n){let u=r[n];if(g(u,Uint8Array))o+u.length>i.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(i,o)):Uint8Array.prototype.set.call(i,u,o);else if(s.isBuffer(u))u.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return i};function ur(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||g(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return wr(e).length;default:if(i)return n?-1:q(e).length;r=(""+r).toLowerCase(),i=!0}}s.byteLength=ur;function Hr(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return Zr(this,r,t);case"utf8":case"utf-8":return cr(this,r,t);case"ascii":return Jr(this,r,t);case"latin1":case"binary":return Kr(this,r,t);case"base64":return Yr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qr(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function A(e,r,t){let n=e[r];e[r]=e[t],e[t]=n}s.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)A(this,t,t+1);return this};s.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)A(this,t,t+3),A(this,t+1,t+2);return this};s.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)A(this,t,t+7),A(this,t+1,t+6),A(this,t+2,t+5),A(this,t+3,t+4);return this};s.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?cr(this,0,r):Hr.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.inspect=function(){let r="",t=b.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};rr&&(s.prototype[rr]=s.prototype.inspect);s.prototype.compare=function(r,t,n,i,o){if(g(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;let u=o-i,c=n-t,h=Math.min(u,c),a=this.slice(i,o),f=r.slice(t,n);for(let p=0;p<h;++p)if(a[p]!==f[p]){u=a[p],c=f[p];break}return u<c?-1:c<u?1:0};function sr(e,r,t,n,i){if(e.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,X(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),s.isBuffer(r))return r.length===0?-1:tr(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):tr(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function tr(e,r,t,n,i){let o=1,u=e.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,c/=2,t/=2}function h(f,p){return o===1?f[p]:f.readUInt16BE(p*o)}let a;if(i){let f=-1;for(a=t;a<u;a++)if(h(e,a)===h(r,f===-1?0:a-f)){if(f===-1&&(f=a),a-f+1===c)return f*o}else f!==-1&&(a-=a-f),f=-1}else for(t+c>u&&(t=u-c),a=t;a>=0;a--){let f=!0;for(let p=0;p<c;p++)if(h(e,a+p)!==h(r,p)){f=!1;break}if(f)return a}return-1}s.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1};s.prototype.indexOf=function(r,t,n){return sr(this,r,t,n,!0)};s.prototype.lastIndexOf=function(r,t,n){return sr(this,r,t,n,!1)};function zr(e,r,t,n){t=Number(t)||0;let i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let o=r.length;n>o/2&&(n=o/2);let u;for(u=0;u<n;++u){let c=parseInt(r.substr(u*2,2),16);if(X(c))return u;e[t+u]=c}return u}function jr(e,r,t,n){return L(q(r,e.length-t),e,t,n)}function qr(e,r,t,n){return L(et(r),e,t,n)}function Vr(e,r,t,n){return L(wr(r),e,t,n)}function Wr(e,r,t,n){return L(nt(r,e.length-t),e,t,n)}s.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let u=!1;for(;;)switch(i){case"hex":return zr(this,r,t,n);case"utf8":case"utf-8":return jr(this,r,t,n);case"ascii":case"latin1":case"binary":return qr(this,r,t,n);case"base64":return Vr(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,r,t,n);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Yr(e,r,t){return r===0&&t===e.length?H.fromByteArray(e):H.fromByteArray(e.slice(r,t))}function cr(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i<t;){let o=e[i],u=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=t){let h,a,f,p;switch(c){case 1:o<128&&(u=o);break;case 2:h=e[i+1],(h&192)===128&&(p=(o&31)<<6|h&63,p>127&&(u=p));break;case 3:h=e[i+1],a=e[i+2],(h&192)===128&&(a&192)===128&&(p=(o&15)<<12|(h&63)<<6|a&63,p>2047&&(p<55296||p>57343)&&(u=p));break;case 4:h=e[i+1],a=e[i+2],f=e[i+3],(h&192)===128&&(a&192)===128&&(f&192)===128&&(p=(o&15)<<18|(h&63)<<12|(a&63)<<6|f&63,p>65535&&p<1114112&&(u=p))}}u===null?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),i+=c}return Xr(n)}var er=4096;function Xr(e){let r=e.length;if(r<=er)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=er));return t}function Jr(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function Kr(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function Zr(e,r,t){let n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let i="";for(let o=r;o<t;++o)i+=it[e[o]];return i}function Qr(e,r,t){let n=e.slice(r,t),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let i=this.subarray(r,t);return Object.setPrototypeOf(i,s.prototype),i};function l(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||l(r,t,this.length);let i=this[r],o=1,u=0;for(;++u<t&&(o*=256);)i+=this[r+u]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||l(r,t,this.length);let i=this[r+--t],o=1;for(;t>0&&(o*=256);)i+=this[r+--t]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(r,t){return r=r>>>0,t||l(r,1,this.length),this[r]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||l(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||l(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||l(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||l(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readBigUInt64LE=E(function(r){r=r>>>0,C(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&_(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=E(function(r){r=r>>>0,C(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&_(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||l(r,t,this.length);let i=this[r],o=1,u=0;for(;++u<t&&(o*=256);)i+=this[r+u]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};s.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||l(r,t,this.length);let i=t,o=1,u=this[r+--i];for(;i>0&&(o*=256);)u+=this[r+--i]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};s.prototype.readInt8=function(r,t){return r=r>>>0,t||l(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,t){r=r>>>0,t||l(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,t){r=r>>>0,t||l(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,t){return r=r>>>0,t||l(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,t){return r=r>>>0,t||l(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readBigInt64LE=E(function(r){r=r>>>0,C(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&_(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)});s.prototype.readBigInt64BE=E(function(r){r=r>>>0,C(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&_(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)});s.prototype.readFloatLE=function(r,t){return r=r>>>0,t||l(r,4,this.length),T.read(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,t){return r=r>>>0,t||l(r,4,this.length),T.read(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||l(r,8,this.length),T.read(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||l(r,8,this.length),T.read(this,r,!1,52,8)};function w(e,r,t,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(t+n>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;w(this,r,t,n,c,0)}let o=1,u=0;for(this[t]=r&255;++u<n&&(o*=256);)this[t+u]=r/o&255;return t+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;w(this,r,t,n,c,0)}let o=n-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,1,255,0),this[t]=r&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function hr(e,r,t,n,i){yr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function fr(e,r,t,n,i){yr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}s.prototype.writeBigUInt64LE=E(function(r,t=0){return hr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=E(function(r,t=0){return fr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let h=Math.pow(2,8*n-1);w(this,r,t,n,h-1,-h)}let o=0,u=1,c=0;for(this[t]=r&255;++o<n&&(u*=256);)r<0&&c===0&&this[t+o-1]!==0&&(c=1),this[t+o]=(r/u>>0)-c&255;return t+n};s.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let h=Math.pow(2,8*n-1);w(this,r,t,n,h-1,-h)}let o=n-1,u=1,c=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(r/u>>0)-c&255;return t+n};s.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};s.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};s.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};s.prototype.writeBigInt64LE=E(function(r,t=0){return hr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=E(function(r,t=0){return fr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pr(e,r,t,n,i,o){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function ar(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,4,34028234663852886e22,-34028234663852886e22),T.write(e,r,t,n,23,4),t+4}s.prototype.writeFloatLE=function(r,t,n){return ar(this,r,t,!0,n)};s.prototype.writeFloatBE=function(r,t,n){return ar(this,r,t,!1,n)};function lr(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,8,17976931348623157e292,-17976931348623157e292),T.write(e,r,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(r,t,n){return lr(this,r,t,!0,n)};s.prototype.writeDoubleBE=function(r,t,n){return lr(this,r,t,!1,n)};s.prototype.copy=function(r,t,n,i){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);let o=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),o};s.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){let u=r.charCodeAt(0);(i==="utf8"&&u<128||i==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o<n;++o)this[o]=r;else{let u=s.isBuffer(r)?r:s.from(r,i),c=u.length;if(c===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=u[o%c]}return this};var R={};function Y(e,r,t){R[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Y("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Y("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError);Y("ERR_OUT_OF_RANGE",function(e,r,t){let n=`The value of "${e}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=nr(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=nr(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function nr(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function vr(e,r,t){C(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&_(r,e.length-(t+1))}function yr(e,r,t,n,i,o){if(e>t||e<r){let u=typeof r=="bigint"?"n":"",c;throw o>3?r===0||r===BigInt(0)?c=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:c=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:c=`>= ${r}${u} and <= ${t}${u}`,new R.ERR_OUT_OF_RANGE("value",c,e)}vr(n,i,o)}function C(e,r){if(typeof e!="number")throw new R.ERR_INVALID_ARG_TYPE(r,"number",e)}function _(e,r,t){throw Math.floor(e)!==e?(C(e,t),new R.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var rt=/[^+/0-9A-Za-z-_]/g;function tt(e){if(e=e.split("=")[0],e=e.trim().replace(rt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function q(e,r){r=r||1/0;let t,n=e.length,i=null,o=[];for(let u=0;u<n;++u){if(t=e.charCodeAt(u),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function et(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function nt(e,r){let t,n,i,o=[];for(let u=0;u<e.length&&!((r-=2)<0);++u)t=e.charCodeAt(u),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function wr(e){return H.toByteArray(tt(e))}function L(e,r,t,n){let i;for(i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function g(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function X(e){return e!==e}var it=(function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i]}return r})();function E(e){return typeof BigInt>"u"?ot:e}function ot(){throw new Error("BigInt not supported")}});var xr,y=Ur(()=>{"use strict";xr=Tr(dr(),1);globalThis.Buffer=xr.Buffer});y();y();y();y();var D=class{constructor(r){this._initialized=!1;this.type=r}createContainer(){let r=document.createElement("div");return r.id="render-container-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),r.style.cssText="position: absolute; left: -9999px; top: -9999px;",document.body.appendChild(r),r}removeContainer(r){r&&r.parentNode&&r.parentNode.removeChild(r)}async initialize(r=null){this._initialized=!0}isInitialized(){return this._initialized}async render(r,t){throw new Error("render() must be implemented by subclass")}async mountToDom(r,t,n){let i=await this.render(r,t);if(!i||!i.base64){let u=document.createElement("div");return u.textContent=`Renderer returned empty result: ${this.type}`,n.appendChild(u),{root:u,cleanup:()=>{try{u.remove()}catch{}}}}let o=document.createElement("img");return o.style.maxWidth="100%",o.style.height="auto",o.alt=`${this.type} diagram`,o.src=`data:image/${i.format};base64,${i.base64}`,n.appendChild(o),{root:o,cleanup:()=>{try{o.remove()}catch{}}}}validateInput(r){if(!r||typeof r=="string"&&r.trim()==="")throw new Error(`Empty ${this.type} input provided`)}preprocessInput(r){return r}calculateCanvasScale(r){let n=r?.fontSize||12;return 14/16*(n/12)*4}async renderSvgToCanvas(r,t,n,i=null){return r=r.replace(/<style>/,"<style>foreignObject { overflow: visible; }"),new Promise((o,u)=>{let c=new Image;c.crossOrigin="Anonymous";let h=btoa(unescape(encodeURIComponent(r)));c.src=`data:image/svg+xml;base64,${h}`,c.onload=()=>{let a=document.createElement("canvas");a.width=t,a.height=n;let f=a.getContext("2d");i&&(f.font=`14px ${i}`),f.drawImage(c,0,0,t,n),o(a)},c.onerror=a=>{u(new Error("Failed to load SVG into image for rendering"))}})}};var N=class extends D{constructor(){super("svg")}validateInput(r){if(!r||typeof r!="string")throw new Error("SVG input must be a non-empty string");if(!r.includes("<svg"))throw new Error("Invalid SVG: missing <svg> tag");return!0}async render(r,t){this.validateInput(r);let o=new DOMParser().parseFromString(r,"image/svg+xml").querySelector("svg");if(!o)throw new Error("No SVG element found in input");let u=o.getAttribute("viewBox"),c,h;if(u){let d=u.split(/\s+/);c=Math.ceil(parseFloat(d[2])),h=Math.ceil(parseFloat(d[3]))}else c=Math.ceil(parseFloat(o.getAttribute("width")||"800")),h=Math.ceil(parseFloat(o.getAttribute("height")||"600"));let a=this.calculateCanvasScale(t),f=await this.renderSvgToCanvas(r,c*a,h*a);return{base64:f.toDataURL("image/png",1).replace(/^data:image\/png;base64,/,""),width:f.width,height:f.height,format:"png"}}};var k=class extends N{async mountToDom(r,t,n){if(typeof r!="string")throw new Error("SVG input must be a string");let i=r;return this.validateInput(i),n.innerHTML=i,{root:n.querySelector("svg")||n,cleanup:()=>{try{n.innerHTML=""}catch{}}}}};y();function ut(){return globalThis}function st(){let e=ut();return e.__md2x_renderer_registry__||(e.__md2x_renderer_registry__=new Map),e.__md2x_renderer_registry__}function mr(e){st().set(e.type,e)}mr(new k);})();
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
ieee754/index.js:
|
|
5
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
6
|
+
|
|
7
|
+
buffer/index.js:
|
|
8
|
+
(*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*)
|
|
14
|
+
*/
|