Files
Synapse/resources/js/lsplugin.user.js
Dasemu 40631362b3 Initial import of LogDarioSeq baseline
Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 15:32:15 +02:00

2 lines
108 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see lsplugin.user.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LSPluginEntry=t():e.LSPluginEntry=t()}(self,()=>(()=>{var e={221(e,t,n){var r=n(558);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(156)(t);const{formatters:o}=e.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},156(e,t,n){e.exports=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}return n}),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function o(e,t){let n=0,r=0,o=-1,i=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(o=r,i=n,r++):(n++,r++);else{if(-1===o)return!1;r=o+1,i++,n=i}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(o(e,n))return!1;for(const n of t.names)if(o(e,n))return!0;return!1},t.humanize=n(49),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},314(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function s(e,t){try{return t in e}catch(e){return!1}}function a(e,t,n){var o={};return n.isMergeableObject(e)&&i(e).forEach(function(t){o[t]=r(e[t],n)}),i(t).forEach(function(i){(function(e,t){return s(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(s(e,i)&&n.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(i,n)(e[i],t[i],n):o[i]=r(t[i],n))}),o}function l(e,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||t,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(e)?s?i.arrayMerge(e,n,i):a(e,n,i):r(n,i)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})};var c=l;e.exports=c},138(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o<i;o++)s[o]=r[o].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,s){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,o),!0;case 5:return u.fn.call(u.context,t,r,o,i),!0;case 6:return u.fn.call(u.context,t,r,o,i,s),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,o);break;default:if(!l)for(f=1,l=new Array(h-1);f<h;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||s(this,i);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||o&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[i]=1===c.length?c[0]:c:s(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},543(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},49(e){var t=1e3,n=60*t,r=60*n,o=24*r,i=7*o,s=365.25*o;function a(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,l){l=l||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*s;case"weeks":case"week":case"w":return l*i;case"days":case"day":case"d":return l*o;case"hours":case"hour":case"hrs":case"hr":case"h":return l*r;case"minutes":case"minute":case"mins":case"min":case"m":return l*n;case"seconds":case"second":case"secs":case"sec":case"s":return l*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(e);if("number"===c&&isFinite(e))return l.long?function(e){var i=Math.abs(e);if(i>=o)return a(e,i,o,"day");if(i>=r)return a(e,i,r,"hour");if(i>=n)return a(e,i,n,"minute");if(i>=t)return a(e,i,t,"second");return e+" ms"}(e):function(e){var i=Math.abs(e);if(i>=o)return Math.round(e/o)+"d";if(i>=r)return Math.round(e/r)+"h";if(i>=n)return Math.round(e/n)+"m";if(i>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},528(e,t,n){"use strict";var r=n(558),o="win32"===r.platform,i=n(496);function s(e,t){for(var n=[],r=0;r<e.length;r++){var o=e[r];o&&"."!==o&&(".."===o?n.length&&".."!==n[n.length-1]?n.pop():t&&n.push(".."):n.push(o))}return n}function a(e){for(var t=e.length-1,n=0;n<=t&&!e[n];n++);for(var r=t;r>=0&&!e[r];r--);return 0===n&&r===t?e:n>r?[]:e.slice(n,r+1)}var l=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,c=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,u={};function h(e){var t=l.exec(e),n=(t[1]||"")+(t[2]||""),r=t[3]||"",o=c.exec(r);return[n,o[1],o[2],o[3]]}function f(e){var t=l.exec(e),n=t[1]||"",r=!!n&&":"!==n[1];return{device:n,isUnc:r,isAbsolute:r||!!t[2],tail:t[3]}}function d(e){return"\\\\"+e.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\")}u.resolve=function(){for(var e="",t="",n=!1,o=arguments.length-1;o>=-1;o--){var a;if(o>=0?a=arguments[o]:e?(a=r.env["="+e])&&a.substr(0,3).toLowerCase()===e.toLowerCase()+"\\"||(a=e+"\\"):a=r.cwd(),!i.isString(a))throw new TypeError("Arguments to path.resolve must be strings");if(a){var l=f(a),c=l.device,u=l.isUnc,h=l.isAbsolute,p=l.tail;if((!c||!e||c.toLowerCase()===e.toLowerCase())&&(e||(e=c),n||(t=p+"\\"+t,n=h),e&&n))break}}return u&&(e=d(e)),e+(n?"\\":"")+(t=s(t.split(/[\\\/]+/),!n).join("\\"))||"."},u.normalize=function(e){var t=f(e),n=t.device,r=t.isUnc,o=t.isAbsolute,i=t.tail,a=/[\\\/]$/.test(i);return(i=s(i.split(/[\\\/]+/),!o).join("\\"))||o||(i="."),i&&a&&(i+="\\"),r&&(n=d(n)),n+(o?"\\":"")+i},u.isAbsolute=function(e){return f(e).isAbsolute},u.join=function(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(!i.isString(n))throw new TypeError("Arguments to path.join must be strings");n&&e.push(n)}var r=e.join("\\");return/^[\\\/]{2}[^\\\/]/.test(e[0])||(r=r.replace(/^[\\\/]{2,}/,"\\")),u.normalize(r)},u.relative=function(e,t){e=u.resolve(e),t=u.resolve(t);for(var n=e.toLowerCase(),r=t.toLowerCase(),o=a(t.split("\\")),i=a(n.split("\\")),s=a(r.split("\\")),l=Math.min(i.length,s.length),c=l,h=0;h<l;h++)if(i[h]!==s[h]){c=h;break}if(0==c)return t;var f=[];for(h=c;h<i.length;h++)f.push("..");return(f=f.concat(o.slice(c))).join("\\")},u._makeLong=function(e){if(!i.isString(e))return e;if(!e)return"";var t=u.resolve(e);return/^[a-zA-Z]\:\\/.test(t)?"\\\\?\\"+t:/^\\\\[^?.]/.test(t)?"\\\\?\\UNC\\"+t.substring(2):e},u.dirname=function(e){var t=h(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},u.basename=function(e,t){var n=h(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},u.extname=function(e){return h(e)[3]},u.format=function(e){if(!i.isObject(e))throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);var t=e.root||"";if(!i.isString(t))throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);var n=e.dir,r=e.base||"";return n?n[n.length-1]===u.sep?n+r:n+u.sep+r:r},u.parse=function(e){if(!i.isString(e))throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e);var t=h(e);if(!t||4!==t.length)throw new TypeError("Invalid path '"+e+"'");return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}},u.sep="\\",u.delimiter=";";var p=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,m={};function g(e){return p.exec(e).slice(1)}m.resolve=function(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var o=n>=0?arguments[n]:r.cwd();if(!i.isString(o))throw new TypeError("Arguments to path.resolve must be strings");o&&(e=o+"/"+e,t="/"===o[0])}return(t?"/":"")+(e=s(e.split("/"),!t).join("/"))||"."},m.normalize=function(e){var t=m.isAbsolute(e),n=e&&"/"===e[e.length-1];return(e=s(e.split("/"),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},m.isAbsolute=function(e){return"/"===e.charAt(0)},m.join=function(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];if(!i.isString(n))throw new TypeError("Arguments to path.join must be strings");n&&(e+=e?"/"+n:n)}return m.normalize(e)},m.relative=function(e,t){e=m.resolve(e).substr(1),t=m.resolve(t).substr(1);for(var n=a(e.split("/")),r=a(t.split("/")),o=Math.min(n.length,r.length),i=o,s=0;s<o;s++)if(n[s]!==r[s]){i=s;break}var l=[];for(s=i;s<n.length;s++)l.push("..");return(l=l.concat(r.slice(i))).join("/")},m._makeLong=function(e){return e},m.dirname=function(e){var t=g(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},m.basename=function(e,t){var n=g(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},m.extname=function(e){return g(e)[3]},m.format=function(e){if(!i.isObject(e))throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);var t=e.root||"";if(!i.isString(t))throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);return(e.dir?e.dir+m.sep:"")+(e.base||"")},m.parse=function(e){if(!i.isString(e))throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e);var t=g(e);if(!t||4!==t.length)throw new TypeError("Invalid path '"+e+"'");return t[1]=t[1]||"",t[2]=t[2]||"",t[3]=t[3]||"",{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}},m.sep="/",m.delimiter=":",e.exports=o?u:m,e.exports.posix=m,e.exports.win32=u},558(e){var t,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,l=[],c=!1,u=-1;function h(){c&&a&&(c=!1,a.length?l=a.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=s(h);c=!0;for(var t=l.length;t;){for(a=l,l=[];++u<t;)a&&a[u].run();u=-1,t=l.length}a=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new d(e,t)),1!==l.length||c||s(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},80(e){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},496(e,t,n){var r=n(558),o=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(e).replace(o,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),l=r[n];n<i;l=r[++n])m(l)||!_(l)?s+=" "+l:s+=" "+a(l);return s},t.deprecate=function(e,o){if(v(n.g.process))return function(){return t.deprecate(e,o).apply(this,arguments)};if(!0===r.noDeprecation)return e;var i=!1;return function(){if(!i){if(r.throwDeprecation)throw new Error(o);r.traceDeprecation?console.trace(o):console.error(o),i=!0}return e.apply(this,arguments)}};var i,s={};function a(e,n){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),u(r,e,r.depth)}function l(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function c(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return y(o)||(o=u(e,o,r)),o}var i=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,n);if(i)return i;var s=Object.keys(n),a=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),x(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(C(n)){var l=n.name?": "+n.name:"";return e.stylize("[Function"+l+"]","special")}if(b(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(x(n))return h(n)}var c,_="",S=!1,T=["{","}"];(d(n)&&(S=!0,T=["[","]"]),C(n))&&(_=" [Function"+(n.name?": "+n.name:"")+"]");return b(n)&&(_=" "+RegExp.prototype.toString.call(n)),w(n)&&(_=" "+Date.prototype.toUTCString.call(n)),x(n)&&(_=" "+h(n)),0!==s.length||S&&0!=n.length?r<0?b(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=S?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s<a;++s)A(t,String(s))?i.push(f(e,t,n,r,String(s),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(f(e,t,n,r,o,!0))}),i}(e,n,r,a,s):s.map(function(t){return f(e,n,r,a,t,S)}),e.seen.pop(),function(e,t,n){var r=e.reduce(function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(r>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,_,T)):T[0]+_+T[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,o,i){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),A(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(l.value)<0?(a=m(n)?u(e,l.value,null):u(e,l.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),v(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function y(e){return"string"==typeof e}function v(e){return void 0===e}function b(e){return _(e)&&"[object RegExp]"===S(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===S(e)}function x(e){return _(e)&&("[object Error]"===S(e)||e instanceof Error)}function C(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(v(i)&&(i=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(i)){var n=r.pid;s[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else s[e]=function(){};return s[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=b,t.isObject=_,t.isDate=w,t.isError=x,t.isFunction=C,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(80);var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":"),[e.getDate(),E[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(543),t._extend=function(e,t){if(!t||!_(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{LSPluginUser:()=>wi,setupPluginUserInstance:()=>xi});var e=n(528);const{entries:t,setPrototypeOf:o,isFrozen:i,getPrototypeOf:s,getOwnPropertyDescriptor:a}=Object;let{freeze:l,seal:c,create:u}=Object,{apply:h,construct:f}="undefined"!=typeof Reflect&&Reflect;l||(l=function(e){return e}),c||(c=function(e){return e}),h||(h=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),f||(f=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const d=k(Array.prototype.forEach),p=k(Array.prototype.lastIndexOf),m=k(Array.prototype.pop),g=k(Array.prototype.push),y=k(Array.prototype.splice),v=k(String.prototype.toLowerCase),b=k(String.prototype.toString),_=k(String.prototype.match),w=k(String.prototype.replace),x=k(String.prototype.indexOf),C=k(String.prototype.trim),S=k(Object.prototype.hasOwnProperty),T=k(RegExp.prototype.test),E=(A=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(A,t)});var A;function k(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return h(e,t,r)}}function O(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v;o&&o(e,null);let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(i(t)||(t[r]=e),o=e)}e[o]=!0}return e}function j(e){for(let t=0;t<e.length;t++){S(e,t)||(e[t]=null)}return e}function P(e){const n=u(null);for(const[r,o]of t(e)){S(e,r)&&(Array.isArray(o)?n[r]=j(o):o&&"object"==typeof o&&o.constructor===Object?n[r]=P(o):n[r]=o)}return n}function L(e,t){for(;null!==e;){const n=a(e,t);if(n){if(n.get)return k(n.get);if("function"==typeof n.value)return k(n.value)}e=s(e)}return function(){return null}}const M=l(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),I=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),R=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),F=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),D=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),U=l(["#text"]),z=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),$=l(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=l(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W=c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),q=c(/<%[\w\W]*|[\w\W]*%>/gm),G=c(/\$\{[\w\W]*/gm),J=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),Y=c(/^aria-[\-\w]+$/),K=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=c(/^(?:\w+script|data):/i),X=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=c(/^html$/i),Q=c(/^[a-z][.\w]*(-[.\w]+)+$/i);var ee=Object.freeze({__proto__:null,ARIA_ATTR:Y,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:Q,DATA_ATTR:J,DOCTYPE_NAME:Z,ERB_EXPR:q,IS_ALLOWED_URI:K,IS_SCRIPT_OR_DATA:V,MUSTACHE_EXPR:W,TMPLIT_EXPR:G});const te=1,ne=3,re=7,oe=8,ie=9,se=function(){return"undefined"==typeof window?null:window};(function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se();const r=t=>e(t);if(r.version="3.3.3",r.removed=[],!n||!n.document||n.document.nodeType!==ie||!n.Element)return r.isSupported=!1,r;let{document:o}=n;const i=o,s=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:c,Node:h,Element:f,NodeFilter:A,NamedNodeMap:k=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:j,DOMParser:W,trustedTypes:q}=n,G=f.prototype,J=L(G,"cloneNode"),Y=L(G,"remove"),V=L(G,"nextSibling"),X=L(G,"childNodes"),Q=L(G,"parentNode");if("function"==typeof c){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let ae,le="";const{implementation:ce,createNodeIterator:ue,createDocumentFragment:he,getElementsByTagName:fe}=o,{importNode:de}=i;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof t&&"function"==typeof Q&&ce&&void 0!==ce.createHTMLDocument;const{MUSTACHE_EXPR:me,ERB_EXPR:ge,TMPLIT_EXPR:ye,DATA_ATTR:ve,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:_e,ATTR_WHITESPACE:we,CUSTOM_ELEMENT:xe}=ee;let{IS_ALLOWED_URI:Ce}=ee,Se=null;const Te=O({},[...M,...I,...N,...F,...U]);let Ee=null;const Ae=O({},[...z,...$,...H,...B]);let ke=Object.seal(u(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Oe=null,je=null;const Pe=Object.seal(u(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,Me=!0,Ie=!1,Ne=!0,Re=!1,Fe=!0,De=!1,Ue=!1,ze=!1,$e=!1,He=!1,Be=!1,We=!0,qe=!1,Ge=!0,Je=!1,Ye={},Ke=null;const Ve=O({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Xe=null;const Ze=O({},["audio","video","img","source","image","track"]);let Qe=null;const et=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let ot=rt,it=!1,st=null;const at=O({},[tt,nt,rt],b);let lt=O({},["mi","mo","mn","ms","mtext"]),ct=O({},["annotation-xml"]);const ut=O({},["title","style","font","a","script"]);let ht=null;const ft=["application/xhtml+xml","text/html"];let dt=null,pt=null;const mt=o.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=P(e),ht=-1===ft.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,dt="application/xhtml+xml"===ht?b:v,Se=S(e,"ALLOWED_TAGS")?O({},e.ALLOWED_TAGS,dt):Te,Ee=S(e,"ALLOWED_ATTR")?O({},e.ALLOWED_ATTR,dt):Ae,st=S(e,"ALLOWED_NAMESPACES")?O({},e.ALLOWED_NAMESPACES,b):at,Qe=S(e,"ADD_URI_SAFE_ATTR")?O(P(et),e.ADD_URI_SAFE_ATTR,dt):et,Xe=S(e,"ADD_DATA_URI_TAGS")?O(P(Ze),e.ADD_DATA_URI_TAGS,dt):Ze,Ke=S(e,"FORBID_CONTENTS")?O({},e.FORBID_CONTENTS,dt):Ve,Oe=S(e,"FORBID_TAGS")?O({},e.FORBID_TAGS,dt):P({}),je=S(e,"FORBID_ATTR")?O({},e.FORBID_ATTR,dt):P({}),Ye=!!S(e,"USE_PROFILES")&&e.USE_PROFILES,Le=!1!==e.ALLOW_ARIA_ATTR,Me=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Re=e.SAFE_FOR_TEMPLATES||!1,Fe=!1!==e.SAFE_FOR_XML,De=e.WHOLE_DOCUMENT||!1,$e=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,qe=e.SANITIZE_NAMED_PROPS||!1,Ge=!1!==e.KEEP_CONTENT,Je=e.IN_PLACE||!1,Ce=e.ALLOWED_URI_REGEXP||K,ot=e.NAMESPACE||rt,lt=e.MATHML_TEXT_INTEGRATION_POINTS||lt,ct=e.HTML_INTEGRATION_POINTS||ct,ke=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ke.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ke.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(ke.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Re&&(Me=!1),He&&($e=!0),Ye&&(Se=O({},U),Ee=u(null),!0===Ye.html&&(O(Se,M),O(Ee,z)),!0===Ye.svg&&(O(Se,I),O(Ee,$),O(Ee,B)),!0===Ye.svgFilters&&(O(Se,N),O(Ee,$),O(Ee,B)),!0===Ye.mathMl&&(O(Se,F),O(Ee,H),O(Ee,B))),S(e,"ADD_TAGS")||(Pe.tagCheck=null),S(e,"ADD_ATTR")||(Pe.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Pe.tagCheck=e.ADD_TAGS:(Se===Te&&(Se=P(Se)),O(Se,e.ADD_TAGS,dt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Pe.attributeCheck=e.ADD_ATTR:(Ee===Ae&&(Ee=P(Ee)),O(Ee,e.ADD_ATTR,dt))),e.ADD_URI_SAFE_ATTR&&O(Qe,e.ADD_URI_SAFE_ATTR,dt),e.FORBID_CONTENTS&&(Ke===Ve&&(Ke=P(Ke)),O(Ke,e.FORBID_CONTENTS,dt)),e.ADD_FORBID_CONTENTS&&(Ke===Ve&&(Ke=P(Ke)),O(Ke,e.ADD_FORBID_CONTENTS,dt)),Ge&&(Se["#text"]=!0),De&&O(Se,["html","head","body"]),Se.table&&(O(Se,["tbody"]),delete Oe.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw E('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw E('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ae=e.TRUSTED_TYPES_POLICY,le=ae.createHTML("")}else void 0===ae&&(ae=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(q,s)),null!==ae&&"string"==typeof le&&(le=ae.createHTML(""));l&&l(e),pt=e}},vt=O({},[...I,...N,...R]),bt=O({},[...F,...D]),_t=function(e){g(r.removed,{element:e});try{Q(e).removeChild(e)}catch(t){Y(e)}},wt=function(e,t){try{g(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if($e||He)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},xt=function(e){let t=null,n=null;if(ze)e="<remove></remove>"+e;else{const t=_(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ht&&ot===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=ae?ae.createHTML(e):e;if(ot===rt)try{t=(new W).parseFromString(r,ht)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(ot,"template",null);try{t.documentElement.innerHTML=it?le:r}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),ot===rt?fe.call(t,De?"html":"body")[0]:De?t.documentElement:i},Ct=function(e){return ue.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)},St=function(e){return e instanceof j&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof k)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Tt=function(e){return"function"==typeof h&&e instanceof h};function Et(e,t,n){d(e,e=>{e.call(r,t,n,pt)})}const At=function(e){let t=null;if(Et(pe.beforeSanitizeElements,e,null),St(e))return _t(e),!0;const n=dt(e.nodeName);if(Et(pe.uponSanitizeElement,e,{tagName:n,allowedTags:Se}),Fe&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&T(/<[/\w!]/g,e.innerHTML)&&T(/<[/\w!]/g,e.textContent))return _t(e),!0;if(e.nodeType===re)return _t(e),!0;if(Fe&&e.nodeType===oe&&T(/<[/\w]/g,e.data))return _t(e),!0;if(!(Pe.tagCheck instanceof Function&&Pe.tagCheck(n))&&(!Se[n]||Oe[n])){if(!Oe[n]&&Ot(n)){if(ke.tagNameCheck instanceof RegExp&&T(ke.tagNameCheck,n))return!1;if(ke.tagNameCheck instanceof Function&&ke.tagNameCheck(n))return!1}if(Ge&&!Ke[n]){const t=Q(e)||e.parentNode,n=X(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=J(n[r],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,V(e))}}}return _t(e),!0}return e instanceof f&&!function(e){let t=Q(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=v(e.tagName),r=v(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||lt[r]):Boolean(vt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(bt[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!lt[r])&&!bt[n]&&(ut[n]||!vt[n]):!("application/xhtml+xml"!==ht||!st[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!T(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re&&e.nodeType===ne&&(t=e.textContent,d([me,ge,ye],e=>{t=w(t,e," ")}),e.textContent!==t&&(g(r.removed,{element:e.cloneNode()}),e.textContent=t)),Et(pe.afterSanitizeElements,e,null),!1):(_t(e),!0)},kt=function(e,t,n){if(je[t])return!1;if(We&&("id"===t||"name"===t)&&(n in o||n in mt))return!1;if(Me&&!je[t]&&T(ve,t));else if(Le&&T(be,t));else if(Pe.attributeCheck instanceof Function&&Pe.attributeCheck(t,e));else if(!Ee[t]||je[t]){if(!(Ot(e)&&(ke.tagNameCheck instanceof RegExp&&T(ke.tagNameCheck,e)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(e))&&(ke.attributeNameCheck instanceof RegExp&&T(ke.attributeNameCheck,t)||ke.attributeNameCheck instanceof Function&&ke.attributeNameCheck(t,e))||"is"===t&&ke.allowCustomizedBuiltInElements&&(ke.tagNameCheck instanceof RegExp&&T(ke.tagNameCheck,n)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(n))))return!1}else if(Qe[t]);else if(T(Ce,w(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Xe[e]){if(Ie&&!T(_e,w(n,we,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&_(e,xe)},jt=function(e){Et(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||St(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:s,namespaceURI:a,value:l}=i,c=dt(s),u=l;let h="value"===s?u:C(u);if(n.attrName=c,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,Et(pe.uponSanitizeAttribute,e,n),h=n.attrValue,!qe||"id"!==c&&"name"!==c||(wt(s,e),h="user-content-"+h),Fe&&T(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)){wt(s,e);continue}if("attributename"===c&&_(h,"href")){wt(s,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){wt(s,e);continue}if(!Ne&&T(/\/>/i,h)){wt(s,e);continue}Re&&d([me,ge,ye],e=>{h=w(h,e," ")});const f=dt(e.nodeName);if(kt(f,c,h)){if(ae&&"object"==typeof q&&"function"==typeof q.getAttributeType)if(a);else switch(q.getAttributeType(f,c)){case"TrustedHTML":h=ae.createHTML(h);break;case"TrustedScriptURL":h=ae.createScriptURL(h)}if(h!==u)try{a?e.setAttributeNS(a,s,h):e.setAttribute(s,h),St(e)?_t(e):m(r.removed)}catch(t){wt(s,e)}}else wt(s,e)}Et(pe.afterSanitizeAttributes,e,null)},Pt=function e(t){let n=null;const r=Ct(t);for(Et(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Et(pe.uponSanitizeShadowNode,n,null),At(n),jt(n),n.content instanceof a&&e(n.content);Et(pe.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,o=null,s=null,l=null;if(it=!e,it&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Tt(e)){if("function"!=typeof e.toString)throw E("toString is not a function");if("string"!=typeof(e=e.toString()))throw E("dirty is not a string, aborting")}if(!r.isSupported)return e;if(Ue||yt(t),r.removed=[],"string"==typeof e&&(Je=!1),Je){if(e.nodeName){const t=dt(e.nodeName);if(!Se[t]||Oe[t])throw E("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof h)n=xt("\x3c!----\x3e"),o=n.ownerDocument.importNode(e,!0),o.nodeType===te&&"BODY"===o.nodeName||"HTML"===o.nodeName?n=o:n.appendChild(o);else{if(!$e&&!Re&&!De&&-1===e.indexOf("<"))return ae&&Be?ae.createHTML(e):e;if(n=xt(e),!n)return $e?null:Be?le:""}n&&ze&&_t(n.firstChild);const c=Ct(Je?e:n);for(;s=c.nextNode();)At(s),jt(s),s.content instanceof a&&Pt(s.content);if(Je)return e;if($e){if(He)for(l=he.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(Ee.shadowroot||Ee.shadowrootmode)&&(l=de.call(i,l,!0)),l}let u=De?n.outerHTML:n.innerHTML;return De&&Se["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&T(Z,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),Re&&d([me,ge,ye],e=>{u=w(u,e," ")}),ae&&Be?ae.createHTML(u):u},r.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ue=!0},r.clearConfig=function(){pt=null,Ue=!1},r.isValidAttribute=function(e,t,n){pt||yt({});const r=dt(e),o=dt(t);return kt(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&g(pe[e],t)},r.removeHook=function(e,t){if(void 0!==t){const n=p(pe[e],t);return-1===n?void 0:y(pe[e],n,1)[0]}return m(pe[e])},r.removeHooks=function(e){pe[e]=[]},r.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r})();var ae=n(314),le=n.n(ae);const ce=/([\p{Ll}\d])(\p{Lu})/gu,ue=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,he=/(\d)\p{Ll}|(\p{L})\d/u,fe=/[^\p{L}\d]+/giu,de="$1\0$2";function pe(e){let t=e.trim();t=t.replace(ce,de).replace(ue,de),t=t.replace(fe,"\0");let n=0,r=t.length;for(;"\0"===t.charAt(n);)n++;if(n===r)return[];for(;"\0"===t.charAt(r-1);)r--;return t.slice(n,r).split(/\0/g)}function me(e){const t=pe(e);for(let e=0;e<t.length;e++){const n=t[e],r=he.exec(n);if(r){const o=r.index+(r[1]??r[2]).length;t.splice(e,1,n.slice(0,o),n.slice(o))}}return t}function ge(e,t){const[n,r,o]=ve(e,t);return n+r.map(ye(t?.locale)).join(t?.delimiter??" ")+o}function ye(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function ve(e,t={}){const n=t.split??(t.separateNumbers?me:pe),r=t.prefixCharacters??"",o=t.suffixCharacters??"";let i=0,s=e.length;for(;i<e.length;){const t=e.charAt(i);if(!r.includes(t))break;i++}for(;s>i;){const t=s-1,n=e.charAt(t);if(!o.includes(n))break;s=t}return[e.slice(0,i),n(e.slice(i,s)),e.slice(s)]}const be=n(138);function _e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const we="win32"===navigator.platform.toLowerCase()?e.win32:e.posix;const xe=function(e,t){return ge(e,{delimiter:"_",...t})};const Ce={DEBUG:10,INFO:20,WARN:30,ERROR:40};function Se(e){if(null==e)return String(e);if(e instanceof Error)return`${e.message}${e.stack?"\n"+e.stack:""}`;if("string"==typeof e)return e;if("object"==typeof e)try{const t=new WeakSet;return JSON.stringify(e,(e,n)=>{if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular]";t.add(n)}return n})}catch(t){try{return String(e)}catch(e){return"[Unserializable]"}}try{return String(e)}catch(e){return"[Unserializable]"}}function Te(e,...t){try{const n=new URL(e);if(!n.origin)throw new Error(null);const r=we.join(e.substr(n.origin.length),...t);return n.origin+r}catch(n){return we.join(e,...t)}}function Ee(e,t){let n,r,o=!1;const i=t=>n=>{e&&clearTimeout(e),t(n),o=!0},s=new Promise((o,s)=>{n=i(o),r=i(s),e&&(e=setTimeout(()=>r(new Error(`[deferred timeout] ${t}`)),e))});return{created:Date.now(),setTag:e=>t=e,resolve:n,reject:r,promise:s,get settled(){return o}}}const Ae=new Map;function ke(e){if("string"==typeof e)return e.trim().replace(/\s/g,"_").toLowerCase()}window.__injectedUIEffects=Ae;var Oe=n(221),je=n.n(Oe);function Pe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Le="application/x-postmate-v1+json";let Me=0;const Ie={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},Ne=(e,t)=>("string"!=typeof t||"*"===t||e.origin===t)&&(!!e.data&&(("object"!=typeof e.data||"postmate"in e.data)&&(e.data.type===Le&&!!Ie[e.data.postmate])));class Re{addTransportListener(e){var t,n;this.messagePort?(console.debug("[DEBUG] Using MessagePort for communication:",this.frame.src),this.messagePort.addEventListener("message",e),null===(t=(n=this.messagePort).start)||void 0===t||t.call(n)):(console.debug("[DEBUG] Using postMessage for communication:",this.frame.src),this.parent.addEventListener("message",e,!1))}removeTransportListener(e){this.messagePort?this.messagePort.removeEventListener("message",e):this.parent.removeEventListener("message",e,!1)}postToChild(e){this.messagePort?this.messagePort.postMessage(e):this.child.postMessage(e,this.childOrigin)}constructor(e){Pe(this,"parent",void 0),Pe(this,"frame",void 0),Pe(this,"child",void 0),Pe(this,"events",{}),Pe(this,"childOrigin",void 0),Pe(this,"listener",void 0),Pe(this,"messagePort",void 0),this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.messagePort=e.messagePort,this.listener=e=>{if(this.messagePort){if(null==e||!e.data)return!1;if("object"==typeof e.data&&!("postmate"in e.data))return!1;if(e.data.type!==Le)return!1;if(!Ie[e.data.postmate])return!1}else if(!Ne(e,this.childOrigin))return!1;const{data:t,name:n}=((e||{}).data||{}).value||{};"emit"===e.data.postmate&&n in this.events&&this.events[n].forEach(e=>{e.call(this,t)})},this.addTransportListener(this.listener)}get(e,...t){return new Promise((n,r)=>{const o=++Me,i="number"==typeof De.requestTimeout?De.requestTimeout:1e4;let s;const a=e=>{var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.uid)===o&&"reply"===e.data.postmate&&(this.removeTransportListener(a),s&&clearTimeout(s),e.data.error?r(e.data.error):n(e.data.value))};this.addTransportListener(a),i>0&&(s=setTimeout(()=>{this.removeTransportListener(a),r(new Error(`Postmate: request timeout (${i}ms)`))},i)),this.postToChild({postmate:"request",type:Le,property:e,args:t,uid:o})})}call(e,t){this.postToChild({postmate:"call",type:Le,property:e,data:t})}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}destroy(){this.removeTransportListener(this.listener);try{var e;null===(e=this.messagePort)||void 0===e||e.close()}catch(e){}this.frame.parentNode.removeChild(this.frame)}}class Fe{addTransportListener(e){var t,n;this.messagePort?(this.messagePort.addEventListener("message",e),null===(t=(n=this.messagePort).start)||void 0===t||t.call(n)):this.child.addEventListener("message",e,!1)}postToParent(e,t){if(this.messagePort)this.messagePort.postMessage(e);else if(null!=t&&t.source){const n="null"===t.origin?"*":t.origin;t.source.postMessage(e,n)}else this.parent.postMessage(e,this.parentOrigin)}constructor(e){if(Pe(this,"model",void 0),Pe(this,"parent",void 0),Pe(this,"parentOrigin",void 0),Pe(this,"child",void 0),Pe(this,"messagePort",void 0),Pe(this,"listener",void 0),this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.messagePort=e.messagePort,this.listener=e=>{if(this.messagePort){if(null==e||!e.data)return;if("object"==typeof e.data&&!("postmate"in e.data))return;if(e.data.type!==Le)return;if(!Ie[e.data.postmate])return}else if(!Ne(e,this.parentOrigin))return;const{property:t,uid:n,data:r,args:o}=e.data;"call"!==e.data.postmate?((e,t,n)=>{const r="function"==typeof e[t]?e[t].apply(null,n):e[t];return Promise.resolve(r)})(this.model,t,o).then(r=>{this.postToParent({property:t,postmate:"reply",type:Le,uid:n,value:r},e)}).catch(r=>{this.postToParent({property:t,postmate:"reply",type:Le,uid:n,error:r},e)}):t in this.model&&"function"==typeof this.model[t]&&this.model[t](r)},this.addTransportListener(this.listener),!this.messagePort){const e=t=>{var n;const r=null===(n=t.detail)||void 0===n?void 0:n.port;var o,i;r&&(this.child.removeEventListener("message",this.listener,!1),this.messagePort=r,this.messagePort.addEventListener("message",this.listener),null===(o=(i=this.messagePort).start)||void 0===o||o.call(i),this.child.removeEventListener("postmate:channel-ready",e))};this.child.addEventListener("postmate:channel-ready",e)}}emit(e,t){this.postToParent({postmate:"emit",type:Le,value:{name:e,data:t}})}}class De{constructor(e){Pe(this,"container",void 0),Pe(this,"parent",void 0),Pe(this,"frame",void 0),Pe(this,"child",void 0),Pe(this,"childOrigin",void 0),Pe(this,"url",void 0),Pe(this,"model",void 0),Pe(this,"messagePort",void 0),Pe(this,"enableMessageChannel",void 0),this.container=e.container,this.url=e.url,this.parent=window,this.frame=document.createElement("iframe"),e.id&&(this.frame.id=e.id),e.name&&(this.frame.name=e.name),e.allow&&(this.frame.allow=e.allow),this.frame.classList.add.apply(this.frame.classList,e.classListArray||[]),this.container.appendChild(this.frame),this.child=this.frame.contentWindow,this.model=e.model||{},this.enableMessageChannel=!!e.enableMessageChannel}sendHandshake(e){const t=(e=>{const t=document.createElement("a");if(t.href=e,"file:"===t.protocol)return"*";const n=t.protocol.length>4?t.protocol:window.location.protocol,r=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host;return t.origin||`${n}//${r}`})(e=e||this.url);let n,r=0;return new Promise((o,i)=>{const s="undefined"!=typeof MessageChannel&&"function"==typeof MessageChannel,a=this.enableMessageChannel&&s,l=e=>{if(!Ne(e,t))return!1;if("handshake-reply"===e.data.postmate){var r;if(clearInterval(n),this.parent.removeEventListener("message",l,!1),this.childOrigin=e.origin,a)if(null!=e&&null!==(r=e.ports)&&void 0!==r&&r.length){const t=e.ports[0];var s,c;if(t)this.messagePort=t,null===(s=(c=this.messagePort).start)||void 0===s||s.call(c)}else if(e.data.acceptsMessageChannel){var u,h;const e=new MessageChannel;this.messagePort=e.port1,null===(u=(h=this.messagePort).start)||void 0===u||u.call(h),this.child.postMessage({postmate:"setup-channel",type:Le},t,[e.port2])}return o(new Re(this))}return i("Failed handshake")};this.parent.addEventListener("message",l,!1);const c=()=>{r++;const e={postmate:"handshake",type:Le,model:this.model,enableMessageChannel:a?1:0};this.child.postMessage(e,t),5===r&&clearInterval(n)};this.frame.addEventListener("load",()=>{c(),n=setInterval(c,500)}),this.frame.src=e})}destroy(){try{var e;null===(e=this.messagePort)||void 0===e||e.close()}catch(e){}this.frame.parentNode.removeChild(this.frame)}}Pe(De,"debug",!1),Pe(De,"requestTimeout",1e4),Pe(De,"Model",void 0);class Ue{constructor(e){Pe(this,"child",void 0),Pe(this,"model",void 0),Pe(this,"parent",void 0),Pe(this,"parentOrigin",void 0),Pe(this,"messagePort",void 0),Pe(this,"enableMessageChannel",void 0),this.child=window,this.model=e,this.parent=this.child.parent,this.enableMessageChannel=!1}sendHandshakeReply(){return new Promise((e,t)=>{const n=r=>{if(r.data.postmate){if("handshake"===r.data.postmate){var o;0,this.child.removeEventListener("message",n,!1),this.enableMessageChannel=!(null===(o=r.data)||void 0===o||!o.enableMessageChannel),this.parentOrigin=r.origin;const t="undefined"!=typeof MessageChannel&&"function"==typeof MessageChannel;r.source.postMessage({postmate:"handshake-reply",type:Le,acceptsMessageChannel:this.enableMessageChannel&&t?1:0},"null"===r.origin?"*":r.origin);const i=r.data.model;if(i&&Object.keys(i).forEach(e=>{this.model[e]=i[e]}),this.enableMessageChannel&&t){const e=t=>{var n,r;if("setup-channel"===(null===(n=t.data)||void 0===n?void 0:n.postmate)&&(null===(r=t.data)||void 0===r?void 0:r.type)===Le&&t.origin===this.parentOrigin){var o;const n=null==t||null===(o=t.ports)||void 0===o?void 0:o[0];var i,s;if(n)this.messagePort=n,null===(i=(s=this.messagePort).start)||void 0===i||i.call(s),this.child.dispatchEvent(new CustomEvent("postmate:channel-ready",{detail:{port:this.messagePort}}));this.child.removeEventListener("message",e,!1)}};this.child.addEventListener("message",e,!1)}return e(new Fe(this))}return t("Handshake Reply Failed")}};this.child.addEventListener("message",n,!1)})}}function ze(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{importHTML:$e,createSandboxContainer:He}=window.QSandbox||{};function Be(e,t){return e.startsWith("http")?fetch(e,t):(e=e.replace("file://",""),new Promise(async(t,n)=>{try{const n=await window.apis.doAction(["readFile",e]);t({text:()=>n})}catch(e){console.error(e),n(e)}}))}class We extends be{constructor(e){super(),ze(this,"_pluginLocal",void 0),ze(this,"_frame",void 0),ze(this,"_root",void 0),ze(this,"_loaded",!1),ze(this,"_unmountFns",[]),this._pluginLocal=e,e._dispose(()=>{this._unmount()})}async load(){const{name:e,entry:t}=this._pluginLocal.options;if(this.loaded||!t)return;const{template:n,execScripts:r}=await $e(t,{fetch:Be});this._mount(n,document.body);const o=He(e,{elementGetter:()=>{var e;return null===(e=this._root)||void 0===e?void 0:e.firstChild}}).instance.proxy;o.__shadow_mode__=!0,o.LSPluginLocal=this._pluginLocal,o.LSPluginShadow=this,o.LSPluginUser=o.logseq=new wi(this._pluginLocal.toJSON(),this._pluginLocal.caller);const i=await r(o,!0);this._unmountFns.push(i.unmount),this._loaded=!0}_mount(e,t){const n=this._frame=document.createElement("div");n.classList.add("lsp-shadow-sandbox"),n.id=this._pluginLocal.id,this._root=n.attachShadow({mode:"open"}),this._root.innerHTML=`<div>${e}</div>`,t.appendChild(n),this.emit("mounted")}_unmount(){for(const e of this._unmountFns)e&&e.call(null)}destroy(){var e;null===(e=this.frame)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(this.frame)}get loaded(){return this._loaded}get document(){var e;return null===(e=this._root)||void 0===e?void 0:e.firstChild}get frame(){return this._frame}}function qe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ge=je()("LSPlugin:caller"),Je="#await#response#",Ye="#lspmsg#",Ke="#lspmsg#error#",Ve="#lspmsg#settings#",Xe="#lspmsg#beforeunload#",Ze="#lspmsg#reply#",Qe="#lspmsg#ready#",et=e=>`${Ye}${e}`;class tt extends be{constructor(e){super(),qe(this,"_pluginLocal",void 0),qe(this,"_connected",!1),qe(this,"_parent",void 0),qe(this,"_child",void 0),qe(this,"_shadow",void 0),qe(this,"_status",void 0),qe(this,"_userModel",{}),qe(this,"_syncGCTimer",null),qe(this,"_call",void 0),qe(this,"_callUserModel",void 0),qe(this,"_debugTag",""),this._pluginLocal=e,e&&(this._debugTag=e.debugTag)}async connectToChild(){if(this._connected)return;const{shadow:e}=this._pluginLocal;e?await this._setupShadowSandbox():await this._setupIframeSandbox()}async connectToParent(e={}){if(this._connected)return;const t=this,n=null!=this._pluginLocal;let r=0;const o=new Map,i=Ee(6e4),s=this._extendUserModel({[Qe]:async e=>{s[et(null==e?void 0:e.pid)]=({type:e,payload:n})=>{Ge(`[host (_call) -> *user] ${this._debugTag}`,e,n),t.emit(e,n)},await i.resolve()},[Xe]:async e=>{const n=Ee(1e4);t.emit("beforeunload",Object.assign({actor:n},e)),await n.promise},[Ve]:async({payload:e})=>{t.emit("settings:changed",e)},[Ye]:async({ns:e,type:n,payload:r})=>{Ge(`[host (async) -> *user] ${this._debugTag} ns=${e} type=${n}`,r),e&&e.startsWith("hook")?t.emit(`${e}:${n}`,r):t.emit(n,r)},[Ze]:({_sync:e,result:t})=>{if(Ge(`[sync host -> *user] #${e}`,t),o.has(e)){const n=o.get(e);n&&(null!=t&&t.hasOwnProperty(Ke)?n.reject(t[Ke]):n.resolve(t),o.delete(e))}},...e});var a;if(n)return await i.promise,JSON.parse(JSON.stringify(null===(a=this._pluginLocal)||void 0===a?void 0:a.toJSON()));const l=new Ue(s).sendHandshakeReply();return this._status="pending",await l.then(e=>{this._child=e,this._connected=!0,this._call=async(t,n={},i)=>{if(i){const e=++r;o.set(e,i),n._sync=e,i.setTag(`async call #${e}`),Ge(`async call #${e}`)}return e.emit(et(s.baseInfo.id),{type:t,payload:n}),null==i?void 0:i.promise},this._callUserModel=async(e,t)=>{try{s[e](t)}catch(t){Ge(`call user model(${e}) not exist. #${this._debugTag}`)}},this._syncGCTimer=setInterval(()=>{if(o.size>100)for(const[e,t]of o)t.settled&&o.delete(e)},18e5)}).finally(()=>{this._status=void 0}),await i.promise,s.baseInfo}async call(e,t={}){var n;return null===(n=this._call)||void 0===n?void 0:n.call(this,e,t)}async callAsync(e,t={}){var n;const r=Ee(1e4);return null===(n=this._call)||void 0===n?void 0:n.call(this,e,t,r)}async callUserModel(e,...t){var n;return null===(n=this._callUserModel)||void 0===n?void 0:n.apply(this,[e,...t])}async callUserModelAsync(e,...t){var n;return e=`${Je}${e}`,null===(n=this._callUserModel)||void 0===n?void 0:n.apply(this,[e,...t])}_calcLayoutPosition(e,t,n=0){const r=Math.max(e,n);return"number"==typeof t?`${Math.min(100*r/t,99)}%`:`${r}px`}async _applyContainerLayout(e){var t,n;const r=null===(t=await(null===(n=this._pluginLocal)||void 0===n?void 0:n._loadLayoutsData()))||void 0===t?void 0:t.$$0;if(!r)return;const{width:o,height:i,left:s,top:a,vw:l,vh:c}=r;e.dataset.inited_layout="true",Object.assign(e.style,{width:`${o}px`,height:`${i}px`,left:this._calcLayoutPosition(s,l),top:this._calcLayoutPosition(a,c,45)})}async _setupIframeSandbox(){var e;const t=this._pluginLocal,n=t.id,r=`${n}_lsp_main`,o=new URL(t.options.entry);o.searchParams.set("__v__",t.options.version),null===(e=document.querySelector(`#${r}`))||void 0===e||e.remove();const i=document.createElement("div");i.classList.add("lsp-iframe-sandbox-container"),i.id=r,i.dataset.pid=n;try{await this._applyContainerLayout(i)}catch(e){console.error("[Restore Layout Error]",e)}document.body.appendChild(i);const s=new De({id:n+"_iframe",container:i,url:o.href,classListArray:["lsp-iframe-sandbox"],model:{baseInfo:JSON.parse(JSON.stringify(t.toJSON()))},allow:t.options.allow,enableMessageChannel:!0});this._status="pending";let a;const l=new Promise((e,t)=>{a=setTimeout(()=>{s.destroy(),t(new Error("handshake Timeout"))},8e3)});try{const e=await Promise.race([s.sendHandshake(),l]);this._parent=e,this._connected=!0,this.emit("connected"),e.on(et(t.id),({type:e,payload:t})=>{var n,r;Ge("[user -> *host] ",e,t),null===(n=this._pluginLocal)||void 0===n||n.emit(e,t||{}),null===(r=this._pluginLocal)||void 0===r||r.caller.emit(e,t||{})}),this._call=async(...n)=>{e.call(et(t.id),{type:n[0],payload:Object.assign(n[1]||{},{$$pid:t.id})})},this._callUserModel=async(t,...n)=>{if(t.startsWith(Je))return await e.get(t.replace(Je,""),...n);e.call(t,null==n?void 0:n[0])}}catch(e){throw Ge("[iframe sandbox] error",e),e}finally{clearTimeout(a),this._status=void 0}}async _setupShadowSandbox(){const e=this._pluginLocal,t=this._shadow=new We(e);try{this._status="pending",await t.load(),this._connected=!0,this.emit("connected"),this._call=async(t,n={},r)=>{var o;return r&&(n.actor=r),null===(o=this._pluginLocal)||void 0===o||o.emit(t,Object.assign(n,{$$pid:e.id})),null==r?void 0:r.promise},this._callUserModel=async(...e)=>{var t;let n=e[0];null!==(t=n)&&void 0!==t&&t.startsWith(Je)&&(n=n.replace(Je,""));const r=e[1]||{},o=this._userModel[n];"function"==typeof o&&await o.call(null,r)}}catch(e){throw Ge("[shadow sandbox] error",e),e}finally{this._status=void 0}}_extendUserModel(e){return Object.assign(this._userModel,e)}_getSandboxIframeContainer(){var e;return null===(e=this._parent)||void 0===e?void 0:e.frame.parentNode}_getSandboxShadowContainer(){var e;return null===(e=this._shadow)||void 0===e?void 0:e.frame}_getSandboxIframeRoot(){var e;return null===(e=this._parent)||void 0===e?void 0:e.frame}_getSandboxShadowRoot(){var e;return null===(e=this._shadow)||void 0===e?void 0:e.frame}set debugTag(e){this._debugTag=e}async destroy(){var e;let t=null;this._parent&&(t=this._getSandboxIframeContainer(),this._parent.destroy()),this._shadow&&(t=this._getSandboxShadowContainer(),this._shadow.destroy()),null===(e=t)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(t),this._syncGCTimer&&(clearInterval(this._syncGCTimer),this._syncGCTimer=null),this._connected=!1,this._parent=void 0,this._child=void 0,this._shadow=void 0,this._call=void 0,this._callUserModel=void 0,this._status=void 0}}function nt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class rt{constructor(e,t){nt(this,"ctx",void 0),nt(this,"opts",void 0),this.ctx=e,this.opts=t}get ctxId(){return this.ctx.baseInfo.id}setItem(e,t){var n;return this.ctx.caller.callAsync("api:call",{method:"write-plugin-storage-file",args:[this.ctxId,e,t,null===(n=this.opts)||void 0===n?void 0:n.assets]})}getItem(e){var t;return this.ctx.caller.callAsync("api:call",{method:"read-plugin-storage-file",args:[this.ctxId,e,null===(t=this.opts)||void 0===t?void 0:t.assets]})}removeItem(e){var t;return this.ctx.caller.callAsync("api:call",{method:"unlink-plugin-storage-file",args:[this.ctxId,e,null===(t=this.opts)||void 0===t?void 0:t.assets]})}allKeys(){var e;return this.ctx.caller.callAsync("api:call",{method:"list-plugin-storage-files",args:[this.ctxId,null===(e=this.opts)||void 0===e?void 0:e.assets]})}clear(){var e;return this.ctx.caller.callAsync("api:call",{method:"clear-plugin-storage-files",args:[this.ctxId,null===(e=this.opts)||void 0===e?void 0:e.assets]})}hasItem(e){var t;return this.ctx.caller.callAsync("api:call",{method:"exist-plugin-storage-file",args:[this.ctxId,e,null===(t=this.opts)||void 0===t?void 0:t.assets]})}}function ot(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class it{constructor(e){ot(this,"ctx",void 0),this.ctx=e}get React(){return this.ensureHostScope().React}get ReactDOM(){return this.ensureHostScope().ReactDOM}get Components(){return{Editor:this.ensureHostScope().logseq.sdk.experiments.cp_page_editor}}get Utils(){const e=this.ensureHostScope().logseq.sdk.utils,t=t=>e[xe(t)];return{toClj:t("toClj"),jsxToClj:t("jsxToClj"),toJs:t("toJs"),toKeyword:t("toKeyword"),toSymbol:t("toSymbol")}}get pluginLocal(){return this.ensureHostScope().LSPluginCore.ensurePlugin(this.ctx.baseInfo.id)}invokeExperMethod(e,...t){var n;const r=this.ensureHostScope();e=null===(n=xe(e))||void 0===n?void 0:n.toLowerCase();const o=r.logseq.api["exper_"+e]||r.logseq.sdk.experiments[e];return null==o?void 0:o.apply(r,t)}async loadScripts(...e){(e=e.map(e=>null!=e&&e.startsWith("http")?e:this.ctx.resolveResourceFullUrl(e))).unshift(this.ctx.baseInfo.id),await this.invokeExperMethod("loadScripts",...e)}registerFencedCodeRenderer(e,t){return this.invokeExperMethod("registerFencedCodeRenderer",this.ctx.baseInfo.id,e,t)}registerDaemonRenderer(e,t){return this.invokeExperMethod("registerDaemonRenderer",this.ctx.baseInfo.id,e,t)}registerHostedRenderer(e,t){return this.invokeExperMethod("registerHostedRenderer",this.ctx.baseInfo.id,e,t)}registerSidebarRenderer(e,t){return e=`_sidebar.${e}`,t.type="sidebar",this.registerHostedRenderer(e,t)}registerRouteRenderer(e,t){return this.invokeExperMethod("registerRouteRenderer",this.ctx.baseInfo.id,e,t)}registerBlockPropertiesRenderer(e,t){return this.invokeExperMethod("registerBlockPropertiesRenderer",this.ctx.baseInfo.id,e,t)}registerBlockRenderer(e,t){return this.invokeExperMethod("registerBlockRenderer",this.ctx.baseInfo.id,e,t)}registerExtensionsEnhancer(e,t){const n=this.ensureHostScope();if("katex"===e)n.katex&&t(n.katex).catch(console.error);return this.invokeExperMethod("registerExtensionsEnhancer",this.ctx.baseInfo.id,e,t)}ensureHostScope(){try{var e;null===(e=window.top)||void 0===e||e.document}catch(e){console.error("Can not access host scope!")}return window.top}}function st(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const at=e=>`task_callback_${e}`;function lt(){const e=new Error("The request was aborted");return e.name="AbortError",e}function ct(e){return new Promise(t=>setTimeout(t,e))}function ut(e){return(new TextEncoder).encode(e).buffer}function ht(e){return(new TextDecoder).decode(e)}function ft(e){const t={};return e.forEach((e,n)=>{t[n]=e}),t}function dt(e){if(null!=e)return"string"==typeof e||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:JSON.stringify(e)}class pt{constructor(e,t){st(this,"_payload",void 0),st(this,"_responseType",void 0),this._payload=e,this._responseType=t}get status(){return this._payload.status}get statusText(){return this._payload.statusText}get ok(){return this._payload.ok}get url(){return this._payload.url}get headers(){return this._payload.headers}get body(){return this._payload.body}async json(){const{body:e}=this._payload;return"json"===this._responseType?e:"string"==typeof e?JSON.parse(e):e instanceof ArrayBuffer?JSON.parse(ht(e)):e}async text(){const{body:e}=this._payload;return"string"==typeof e?e:e instanceof ArrayBuffer?ht(e):JSON.stringify(e)}async arrayBuffer(){const{body:e}=this._payload;return e instanceof ArrayBuffer?e:"base64"===this._responseType&&"string"==typeof e?function(e){const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}(e):ut("string"==typeof e?e:JSON.stringify(e))}clone(){return new pt({status:(e=this).status,statusText:e.statusText,ok:e.ok,url:e.url,headers:{...e.headers},body:e.body},this._responseType);var e}}class mt extends Error{constructor(e){super(`HTTP request failed with status ${e.status} ${e.statusText}`.trim()),st(this,"response",void 0),this.response=e,this.name="LSPluginNetError"}get status(){return this.response.status}get statusText(){return this.response.statusText}get url(){return this.response.url}get headers(){return this.response.headers}get body(){return this.response.body}}function gt(e){if(e.status>=200&&e.status<300)return e.body;throw new mt(e)}class yt{constructor(e){st(this,"_ctx",void 0),st(this,"_cache",new Map),st(this,"_events",new EventTarget),this._ctx=e,this._ctx.caller.on("#lsp#request#callback",e=>{const t=null==e?void 0:e.requestId;t&&this._events.dispatchEvent(new CustomEvent(at(t),{detail:null==e?void 0:e.payload}))})}async request(e){const t=(e.method||"GET").toUpperCase(),n="arrayBuffer"===(r=e.responseType)?"arraybuffer":r||"json";var r;const o=this.normalizeRetry(e.retry),i=this.getCacheKey(e,t,n);if(i){const e=this._cache.get(i);if(e&&e.expires>Date.now())return this._cache.delete(i),this._cache.set(i,e),e.response.clone();e&&this._cache.delete(i)}let s=0;for(;;)try{const r=await this.performRequest(e,t,n);if(s<o.retries&&this.shouldRetry(o,r)){await ct(o.delay*Math.pow(o.factor,s++));continue}return i&&(this.pruneCache(this.getCacheMaxEntries(e.cache)),this._cache.set(i,{expires:Date.now()+this.getCacheTTL(e.cache),response:r.clone()})),r}catch(t){var a;if(null!==(a=e.signal)&&void 0!==a&&a.aborted||s>=o.retries||!this.shouldRetry(o,t))throw t;await ct(o.delay*Math.pow(o.factor,s++))}}get(e,t){return this.requestWithMethod("GET",e,t)}head(e,t){return this.requestWithMethod("HEAD",e,t)}post(e,t,n){return this.requestWithBody("POST",e,t,n)}put(e,t,n){return this.requestWithBody("PUT",e,t,n)}patch(e,t,n){return this.requestWithBody("PATCH",e,t,n)}delete(e,t){return this.requestWithMethod("DELETE",e,t)}requestWithMethod(e,t,n={}){return this.request({...n,url:t,method:e}).then(gt)}requestWithBody(e,t,n,r={}){const o=void 0===n?r.body:n;return this.request({...r,url:t,method:e,body:o}).then(gt)}async performRequest(e,t,n){if(this.shouldUseFetchFallback())return this.performFetchRequest(e,t,n);try{return await this.performProxyRequest(e,t,n)}catch(r){if(this.shouldFallbackAfterProxyError(r))return this.performFetchRequest(e,t,n);throw r}}async performProxyRequest(e,t,n){var r,o,i;if(null!==(r=e.signal)&&void 0!==r&&r.aborted)throw lt();const s=Boolean(e.abortable||e.signal),a=await this._ctx._execCallableAPIAsync("exper_request",this._ctx.baseInfo.id,{url:e.url,method:t,headers:e.headers,data:null!==(o=e.body)&&void 0!==o?o:e.data,timeout:e.timeout,returnType:n,abortable:s,includeResponse:!0});if(!a)throw new Error("Host HTTP request proxy is not available");const l=at(a),c=new Promise((e,t)=>{const n=r=>{const o=r.detail;this._events.removeEventListener(l,n),o&&o instanceof Error?t(o):e(o)};this._events.addEventListener(l,n,{once:!0})}),u=()=>this.abortProxyRequest(a,s);null===(i=e.signal)||void 0===i||i.addEventListener("abort",u,{once:!0});try{const e=await c;return new pt(e,n)}finally{var h;null===(h=e.signal)||void 0===h||h.removeEventListener("abort",u)}}abortProxyRequest(e,t){t&&this._ctx._execCallableAPI("http_request_abort",e)}async performFetchRequest(e,t,n){var r,o;if("function"!=typeof fetch)throw new Error("Browser fetch is not available");if(null!==(r=e.signal)&&void 0!==r&&r.aborted)throw lt();const i="number"==typeof e.timeout&&e.timeout>0?e.timeout:void 0,s=i||e.signal?new AbortController:null,a=()=>null==s?void 0:s.abort(),l=i?setTimeout(a,i):null;null===(o=e.signal)||void 0===o||o.addEventListener("abort",a,{once:!0});try{var c;const r=await fetch(e.url,{method:t,headers:e.headers,body:["GET","HEAD"].includes(t)?void 0:dt(null!==(c=e.body)&&void 0!==c?c:e.data),signal:(null==s?void 0:s.signal)||e.signal}),o=await this.readFetchBody(r,t,n);return new pt({status:r.status,statusText:r.statusText,ok:r.ok,url:r.url,headers:ft(r.headers),body:o},n)}finally{var u;l&&clearTimeout(l),null===(u=e.signal)||void 0===u||u.removeEventListener("abort",a)}}async readFetchBody(e,t,n){if("HEAD"===t||204===e.status||205===e.status)return null;switch(n){case"json":return await e.json();case"text":return await e.text();case"arraybuffer":return await e.arrayBuffer();case"base64":return function(e){const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}(await e.arrayBuffer())}}shouldUseFetchFallback(){var e;return Boolean(null===(e=this._ctx.baseInfo)||void 0===e?void 0:e.webMode)}shouldFallbackAfterProxyError(e){return null==e&&"function"==typeof fetch}normalizeRetry(e){return"number"==typeof e?{retries:Math.max(0,e),delay:300,factor:2}:{retries:Math.max(0,(null==e?void 0:e.retries)||0),delay:(null==e?void 0:e.delay)||300,factor:(null==e?void 0:e.factor)||2,retryOn:null==e?void 0:e.retryOn}}shouldRetry(e,t){const{retryOn:n}=e;return"function"==typeof n?n(t):!(t instanceof pt)||(Array.isArray(n)?n.includes(t.status):429===t.status||t.status>=500)}getCacheKey(e,t,n){return e.cache&&["GET","HEAD"].includes(t)?"object"==typeof e.cache&&e.cache.key?e.cache.key:JSON.stringify({method:t,url:e.url,headers:e.headers||{},responseType:n}):null}getCacheTTL(e){return"object"==typeof e&&"number"==typeof e.ttl?Math.max(0,e.ttl):3e5}getCacheMaxEntries(e){return"object"==typeof e&&"number"==typeof e.maxEntries?Math.max(1,e.maxEntries):100}pruneCache(e){for(;this._cache.size>=e;){const e=this._cache.keys().next().value;if(!e)return;this._cache.delete(e)}}get ctx(){return this._ctx}}const vt=Array.isArray;const bt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;var _t="object"==typeof self&&self&&self.Object===Object&&self;const wt=bt||_t||Function("return this")();const xt=wt.Symbol;var Ct=Object.prototype,St=Ct.hasOwnProperty,Tt=Ct.toString,Et=xt?xt.toStringTag:void 0;const At=function(e){var t=St.call(e,Et),n=e[Et];try{e[Et]=void 0;var r=!0}catch(e){}var o=Tt.call(e);return r&&(t?e[Et]=n:delete e[Et]),o};var kt=Object.prototype.toString;const Ot=function(e){return kt.call(e)};var jt=xt?xt.toStringTag:void 0;const Pt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":jt&&jt in Object(e)?At(e):Ot(e)};const Lt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const Mt=function(e){if(!Lt(e))return!1;var t=Pt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const It=wt["__core-js_shared__"];var Nt,Rt=(Nt=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||""))?"Symbol(src)_1."+Nt:"";const Ft=function(e){return!!Rt&&Rt in e};var Dt=Function.prototype.toString;const Ut=function(e){if(null!=e){try{return Dt.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var zt=/^\[object .+?Constructor\]$/,$t=Function.prototype,Ht=Object.prototype,Bt=$t.toString,Wt=Ht.hasOwnProperty,qt=RegExp("^"+Bt.call(Wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Gt=function(e){return!(!Lt(e)||Ft(e))&&(Mt(e)?qt:zt).test(Ut(e))};const Jt=function(e,t){return null==e?void 0:e[t]};const Yt=function(e,t){var n=Jt(e,t);return Gt(n)?n:void 0};const Kt=function(){try{var e=Yt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const Vt=function(e,t,n){"__proto__"==t&&Kt?Kt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};const Xt=function(e){return function(t,n,r){for(var o=-1,i=Object(t),s=r(t),a=s.length;a--;){var l=s[e?a:++o];if(!1===n(i[l],l,i))break}return t}}();const Zt=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};const Qt=function(e){return null!=e&&"object"==typeof e};const en=function(e){return Qt(e)&&"[object Arguments]"==Pt(e)};var tn=Object.prototype,nn=tn.hasOwnProperty,rn=tn.propertyIsEnumerable;const on=en(function(){return arguments}())?en:function(e){return Qt(e)&&nn.call(e,"callee")&&!rn.call(e,"callee")};const sn=function(){return!1};var an="object"==typeof exports&&exports&&!exports.nodeType&&exports,ln=an&&"object"==typeof module&&module&&!module.nodeType&&module,cn=ln&&ln.exports===an?wt.Buffer:void 0;const un=(cn?cn.isBuffer:void 0)||sn;var hn=/^(?:0|[1-9]\d*)$/;const fn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&hn.test(e))&&e>-1&&e%1==0&&e<t};const dn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var pn={};pn["[object Float32Array]"]=pn["[object Float64Array]"]=pn["[object Int8Array]"]=pn["[object Int16Array]"]=pn["[object Int32Array]"]=pn["[object Uint8Array]"]=pn["[object Uint8ClampedArray]"]=pn["[object Uint16Array]"]=pn["[object Uint32Array]"]=!0,pn["[object Arguments]"]=pn["[object Array]"]=pn["[object ArrayBuffer]"]=pn["[object Boolean]"]=pn["[object DataView]"]=pn["[object Date]"]=pn["[object Error]"]=pn["[object Function]"]=pn["[object Map]"]=pn["[object Number]"]=pn["[object Object]"]=pn["[object RegExp]"]=pn["[object Set]"]=pn["[object String]"]=pn["[object WeakMap]"]=!1;const mn=function(e){return Qt(e)&&dn(e.length)&&!!pn[Pt(e)]};const gn=function(e){return function(t){return e(t)}};var yn="object"==typeof exports&&exports&&!exports.nodeType&&exports,vn=yn&&"object"==typeof module&&module&&!module.nodeType&&module,bn=vn&&vn.exports===yn&&bt.process,_n=function(){try{var e=vn&&vn.require&&vn.require("util").types;return e||bn&&bn.binding&&bn.binding("util")}catch(e){}}();var wn=_n&&_n.isTypedArray;const xn=wn?gn(wn):mn;var Cn=Object.prototype.hasOwnProperty;const Sn=function(e,t){var n=vt(e),r=!n&&on(e),o=!n&&!r&&un(e),i=!n&&!r&&!o&&xn(e),s=n||r||o||i,a=s?Zt(e.length,String):[],l=a.length;for(var c in e)!t&&!Cn.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||fn(c,l))||a.push(c);return a};var Tn=Object.prototype;const En=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Tn)};const An=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var kn=Object.prototype.hasOwnProperty;const On=function(e){if(!En(e))return An(e);var t=[];for(var n in Object(e))kn.call(e,n)&&"constructor"!=n&&t.push(n);return t};const jn=function(e){return null!=e&&dn(e.length)&&!Mt(e)};const Pn=function(e){return jn(e)?Sn(e):On(e)};const Ln=function(e,t){return e&&Xt(e,t,Pn)};const Mn=function(){this.__data__=[],this.size=0};const In=function(e,t){return e===t||e!=e&&t!=t};const Nn=function(e,t){for(var n=e.length;n--;)if(In(e[n][0],t))return n;return-1};var Rn=Array.prototype.splice;const Fn=function(e){var t=this.__data__,n=Nn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Rn.call(t,n,1),--this.size,!0)};const Dn=function(e){var t=this.__data__,n=Nn(t,e);return n<0?void 0:t[n][1]};const Un=function(e){return Nn(this.__data__,e)>-1};const zn=function(e,t){var n=this.__data__,r=Nn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$n.prototype.clear=Mn,$n.prototype.delete=Fn,$n.prototype.get=Dn,$n.prototype.has=Un,$n.prototype.set=zn;const Hn=$n;const Bn=function(){this.__data__=new Hn,this.size=0};const Wn=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const qn=function(e){return this.__data__.get(e)};const Gn=function(e){return this.__data__.has(e)};const Jn=Yt(wt,"Map");const Yn=Yt(Object,"create");const Kn=function(){this.__data__=Yn?Yn(null):{},this.size=0};const Vn=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Xn=Object.prototype.hasOwnProperty;const Zn=function(e){var t=this.__data__;if(Yn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Xn.call(t,e)?t[e]:void 0};var Qn=Object.prototype.hasOwnProperty;const er=function(e){var t=this.__data__;return Yn?void 0!==t[e]:Qn.call(t,e)};const tr=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Yn&&void 0===t?"__lodash_hash_undefined__":t,this};function nr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}nr.prototype.clear=Kn,nr.prototype.delete=Vn,nr.prototype.get=Zn,nr.prototype.has=er,nr.prototype.set=tr;const rr=nr;const or=function(){this.size=0,this.__data__={hash:new rr,map:new(Jn||Hn),string:new rr}};const ir=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const sr=function(e,t){var n=e.__data__;return ir(t)?n["string"==typeof t?"string":"hash"]:n.map};const ar=function(e){var t=sr(this,e).delete(e);return this.size-=t?1:0,t};const lr=function(e){return sr(this,e).get(e)};const cr=function(e){return sr(this,e).has(e)};const ur=function(e,t){var n=sr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function hr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}hr.prototype.clear=or,hr.prototype.delete=ar,hr.prototype.get=lr,hr.prototype.has=cr,hr.prototype.set=ur;const fr=hr;const dr=function(e,t){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!Jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fr(r)}return n.set(e,t),this.size=n.size,this};function pr(e){var t=this.__data__=new Hn(e);this.size=t.size}pr.prototype.clear=Bn,pr.prototype.delete=Wn,pr.prototype.get=qn,pr.prototype.has=Gn,pr.prototype.set=dr;const mr=pr;const gr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const yr=function(e){return this.__data__.has(e)};function vr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fr;++t<n;)this.add(e[t])}vr.prototype.add=vr.prototype.push=gr,vr.prototype.has=yr;const br=vr;const _r=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};const wr=function(e,t){return e.has(t)};const xr=function(e,t,n,r,o,i){var s=1&n,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var h=-1,f=!0,d=2&n?new br:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var p=e[h],m=t[h];if(r)var g=s?r(m,p,h,t,e,i):r(p,m,h,e,t,i);if(void 0!==g){if(g)continue;f=!1;break}if(d){if(!_r(t,function(e,t){if(!wr(d,t)&&(p===e||o(p,e,n,r,i)))return d.push(t)})){f=!1;break}}else if(p!==m&&!o(p,m,n,r,i)){f=!1;break}}return i.delete(e),i.delete(t),f};const Cr=wt.Uint8Array;const Sr=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n};const Tr=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n};var Er=xt?xt.prototype:void 0,Ar=Er?Er.valueOf:void 0;const kr=function(e,t,n,r,o,i,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Cr(e),new Cr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return In(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Sr;case"[object Set]":var l=1&r;if(a||(a=Tr),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var u=xr(a(e),a(t),r,o,i,s);return s.delete(e),u;case"[object Symbol]":if(Ar)return Ar.call(e)==Ar.call(t)}return!1};const Or=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e};const jr=function(e,t,n){var r=t(e);return vt(e)?r:Or(r,n(e))};const Pr=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i};const Lr=function(){return[]};var Mr=Object.prototype.propertyIsEnumerable,Ir=Object.getOwnPropertySymbols;const Nr=Ir?function(e){return null==e?[]:(e=Object(e),Pr(Ir(e),function(t){return Mr.call(e,t)}))}:Lr;const Rr=function(e){return jr(e,Pn,Nr)};var Fr=Object.prototype.hasOwnProperty;const Dr=function(e,t,n,r,o,i){var s=1&n,a=Rr(e),l=a.length;if(l!=Rr(t).length&&!s)return!1;for(var c=l;c--;){var u=a[c];if(!(s?u in t:Fr.call(t,u)))return!1}var h=i.get(e),f=i.get(t);if(h&&f)return h==t&&f==e;var d=!0;i.set(e,t),i.set(t,e);for(var p=s;++c<l;){var m=e[u=a[c]],g=t[u];if(r)var y=s?r(g,m,u,t,e,i):r(m,g,u,e,t,i);if(!(void 0===y?m===g||o(m,g,n,r,i):y)){d=!1;break}p||(p="constructor"==u)}if(d&&!p){var v=e.constructor,b=t.constructor;v==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(d=!1)}return i.delete(e),i.delete(t),d};const Ur=Yt(wt,"DataView");const zr=Yt(wt,"Promise");const $r=Yt(wt,"Set");const Hr=Yt(wt,"WeakMap");var Br="[object Map]",Wr="[object Promise]",qr="[object Set]",Gr="[object WeakMap]",Jr="[object DataView]",Yr=Ut(Ur),Kr=Ut(Jn),Vr=Ut(zr),Xr=Ut($r),Zr=Ut(Hr),Qr=Pt;(Ur&&Qr(new Ur(new ArrayBuffer(1)))!=Jr||Jn&&Qr(new Jn)!=Br||zr&&Qr(zr.resolve())!=Wr||$r&&Qr(new $r)!=qr||Hr&&Qr(new Hr)!=Gr)&&(Qr=function(e){var t=Pt(e),n="[object Object]"==t?e.constructor:void 0,r=n?Ut(n):"";if(r)switch(r){case Yr:return Jr;case Kr:return Br;case Vr:return Wr;case Xr:return qr;case Zr:return Gr}return t});const eo=Qr;var to="[object Arguments]",no="[object Array]",ro="[object Object]",oo=Object.prototype.hasOwnProperty;const io=function(e,t,n,r,o,i){var s=vt(e),a=vt(t),l=s?no:eo(e),c=a?no:eo(t),u=(l=l==to?ro:l)==ro,h=(c=c==to?ro:c)==ro,f=l==c;if(f&&un(e)){if(!un(t))return!1;s=!0,u=!1}if(f&&!u)return i||(i=new mr),s||xn(e)?xr(e,t,n,r,o,i):kr(e,t,l,n,r,o,i);if(!(1&n)){var d=u&&oo.call(e,"__wrapped__"),p=h&&oo.call(t,"__wrapped__");if(d||p){var m=d?e.value():e,g=p?t.value():t;return i||(i=new mr),o(m,g,n,r,i)}}return!!f&&(i||(i=new mr),Dr(e,t,n,r,o,i))};const so=function e(t,n,r,o,i){return t===n||(null==t||null==n||!Qt(t)&&!Qt(n)?t!=t&&n!=n:io(t,n,r,o,e,i))};const ao=function(e,t,n,r){var o=n.length,i=o,s=!r;if(null==e)return!i;for(e=Object(e);o--;){var a=n[o];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++o<i;){var l=(a=n[o])[0],c=e[l],u=a[1];if(s&&a[2]){if(void 0===c&&!(l in e))return!1}else{var h=new mr;if(r)var f=r(c,u,l,e,t,h);if(!(void 0===f?so(u,c,3,r,h):f))return!1}}return!0};const lo=function(e){return e==e&&!Lt(e)};const co=function(e){for(var t=Pn(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,lo(o)]}return t};const uo=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}};const ho=function(e){var t=co(e);return 1==t.length&&t[0][2]?uo(t[0][0],t[0][1]):function(n){return n===e||ao(n,e,t)}};const fo=function(e){return"symbol"==typeof e||Qt(e)&&"[object Symbol]"==Pt(e)};var po=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mo=/^\w*$/;const go=function(e,t){if(vt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!fo(e))||(mo.test(e)||!po.test(e)||null!=t&&e in Object(t))};function yo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(yo.Cache||fr),n}yo.Cache=fr;const vo=yo;var bo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_o=/\\(\\)?/g;const wo=function(e){var t=vo(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(bo,function(e,n,r,o){t.push(r?o.replace(_o,"$1"):n||e)}),t});const xo=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o};var Co=xt?xt.prototype:void 0,So=Co?Co.toString:void 0;const To=function e(t){if("string"==typeof t)return t;if(vt(t))return xo(t,e)+"";if(fo(t))return So?So.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};const Eo=function(e){return null==e?"":To(e)};const Ao=function(e,t){return vt(e)?e:go(e,t)?[e]:wo(Eo(e))};const ko=function(e){if("string"==typeof e||fo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};const Oo=function(e,t){for(var n=0,r=(t=Ao(t,e)).length;null!=e&&n<r;)e=e[ko(t[n++])];return n&&n==r?e:void 0};const jo=function(e,t,n){var r=null==e?void 0:Oo(e,t);return void 0===r?n:r};const Po=function(e,t){return null!=e&&t in Object(e)};const Lo=function(e,t,n){for(var r=-1,o=(t=Ao(t,e)).length,i=!1;++r<o;){var s=ko(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&dn(o)&&fn(s,o)&&(vt(e)||on(e))};const Mo=function(e,t){return null!=e&&Lo(e,t,Po)};const Io=function(e,t){return go(e)&&lo(t)?uo(ko(e),t):function(n){var r=jo(n,e);return void 0===r&&r===t?Mo(n,e):so(t,r,3)}};const No=function(e){return e};const Ro=function(e){return function(t){return null==t?void 0:t[e]}};const Fo=function(e){return function(t){return Oo(t,e)}};const Do=function(e){return go(e)?Ro(ko(e)):Fo(e)};const Uo=function(e){return"function"==typeof e?e:null==e?No:"object"==typeof e?vt(e)?Io(e[0],e[1]):ho(e):Do(e)};const zo=function(e,t){var n={};return t=Uo(t,3),Ln(e,function(e,r,o){Vt(n,t(e,r,o),e)}),n};function $o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ho{constructor(e,t){$o(this,"ctx",void 0),$o(this,"serviceHooks",void 0),this.ctx=e,this.serviceHooks=t,e._execCallableAPI("register-search-service",e.baseInfo.id,t.name,t.options);Object.entries({query:{f:"onQuery",args:["graph","q",!0],reply:!0,transformOutput:e=>(vt(null==e?void 0:e.blocks)&&(e.blocks=e.blocks.map(e=>e&&zo(e,(e,t)=>`block/${t}`))),e)},rebuildBlocksIndice:{f:"onIndiceInit",args:["graph","blocks"]},transactBlocks:{f:"onBlocksChanged",args:["graph","data"]},truncateBlocks:{f:"onIndiceReset",args:["graph"]},removeDb:{f:"onGraph",args:["graph"]}}).forEach(([n,r])=>{const o=(e=>`service:search:${e}:${t.name}`)(n);e.caller.on(o,async n=>{if(Mt(null==t?void 0:t[r.f])){let i=null;try{i=await t[r.f].apply(t,(r.args||[]).map(e=>{if(n){if(!0===e)return n;if(n.hasOwnProperty(e)){const t=n[e];return delete n[e],t}}})),r.transformOutput&&(i=r.transformOutput(i))}catch(e){console.error("[SearchService] ",e),i=e}finally{r.reply&&e.caller.call(`${o}:reply`,i)}}})})}}function Bo(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function Wo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qo(e,t,n){return e.set(Jo(e,t),n),n}function Go(e,t){return e.get(Jo(e,t))}function Jo(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const Yo=Symbol.for("proxy-continue"),Ko=je()("LSPlugin:user"),Vo=new class extends be{constructor(e,t){var n,r;super(),_e(this,"_tag",void 0),_e(this,"_opts",void 0),_e(this,"_logs",[]),_e(this,"_maxSize",void 0),_e(this,"_level",void 0),this._tag=e,this._opts=t,this._maxSize=Math.max(50,null!==(n=null==t?void 0:t.maxSize)&&void 0!==n?n:500),this._level=null!==(r=null==t?void 0:t.level)&&void 0!==r?r:"DEBUG"}write(e,t,n){var r;Array.isArray(t)&&t.length&&!0===t[t.length-1]&&(n=!0,t=t.slice(0,-1));const o="string"==typeof e?e.toUpperCase():e,i=o in Ce?o:"INFO";if(Ce[i]<Ce[this._level])return;const s=(t||[]).map(Se).join(" "),a={ts:Date.now(),level:i,tag:this._tag||"",message:s};if(this._logs.push(a),this._logs.length>this._maxSize&&this._logs.splice(0,this._logs.length-this._maxSize),n||null!==(r=this._opts)&&void 0!==r&&r.console){const e="ERROR"===i?"error":"WARN"===i?"warn":"DEBUG"===i?"debug":"info";try{console[e](`[${a.tag}][${new Date(a.ts).toLocaleTimeString()}] ${i}: ${s}`)}catch(e){}}this.emit("append",a),this.emit("change")}clear(){this._logs=[],this.emit("clear"),this.emit("change")}debug(...e){this.write("DEBUG",e)}info(...e){this.write("INFO",e)}warn(...e){this.write("WARN",e)}error(...e){this.write("ERROR",e)}setTag(e){this._tag=e}getTag(){return this._tag}setLevel(e){e in Ce&&(this._level=e)}getLevel(){return this._level}setMaxSize(e){this._maxSize=Math.max(50,0|e),this._logs.length>this._maxSize&&(this._logs.splice(0,this._logs.length-this._maxSize),this.emit("change"))}getEntries(){return this._logs.slice()}toJSON(){return this._logs.map(e=>[e.level,`[${e.tag}][${new Date(e.ts).toLocaleTimeString()}] ${e.message}`])}}("",{console:!0});function Xo(e){let t=!1;return()=>{t||(t=!0,e())}}function Zo(e,t,n){var r;const{key:o,label:i,desc:s,palette:a,keybinding:l,extras:c}=t;if("function"!=typeof n)return this.logger.error(`${o||i}: command action should be function.`),!1;const u=ke(o);if(!u)return this.logger.error(`${i}: command key is required.`),!1;const h=`SimpleCommandHook${u}${++li}`;return this.Editor["on"+h](n),null===(r=this.caller)||void 0===r||r.call("api:call",{method:"register-plugin-simple-command",args:[this.baseInfo.id,[{key:u,label:i,type:e,desc:s,keybinding:l,extras:c},["editor/hook",h]],a]}),Xo(()=>{this.Editor["off"+h](n),this._execCallableAPI("unregister_plugin_simple_command",this.baseInfo.id,u)})}function Qo(e){return"string"==typeof e?{mode:"global",binding:e}:e}function ei(e,t){var n;Ko("Register slash command #",this.baseInfo.id,e,t);const r=[];return"function"==typeof t&&(t=[["editor/clear-current-slash",!1],["editor/restore-saved-cursor"],["editor/hook",t]]),t=t.map(e=>{const[t,...n]=e;if("editor/hook"===t){let o=n[0],i=()=>{var e;null===(e=this.caller)||void 0===e||e.callUserModel(o)};"function"==typeof o&&(i=o);const s=`SlashCommandHook${t}${++li}`;e[1]=s,r.push(this.Editor["on"+s](i))}return e}),null===(n=this.caller)||void 0===n||n.call("api:call",{method:"register-plugin-slash-command",args:[this.baseInfo.id,[e,t]]}),Xo(()=>{r.forEach(e=>e()),this._execCallableAPI("unregister_plugin_slash_command",this.baseInfo.id,e)})}function ti(e,t={},n){if(!(n=n||t.handler))return this.logger.error(`${e}: command handler is required.`),!1;const r=t.key||e,o=t.label||t.title||e,i=Qo(t.keybinding),s=function(e){return void 0===e.when?e.extras:{...e.extras||{},when:e.when}}(t),a=function(e){return Array.isArray(e.placements)&&e.placements.length?e.placements:e.placement?[e.placement]:e.palette?["palette"]:e.keybinding?["shortcut"]:["simple"]}(t).map(e=>{switch(e){case"palette":return Zo.call(this,"$palette$",{key:r,label:o,desc:t.desc,palette:!0,keybinding:i,extras:s},n);case"shortcut":{var a;const e="$shortcut$",l=r||e+xe(null==i||null===(a=i.binding)||void 0===a?void 0:a.toString());return Zo.call(this,e,{key:l,label:o,desc:t.desc,palette:!1,keybinding:i,extras:s},n)}case"slash":return ei.call(this,o,n);case"block-context-menu":return Zo.call(this,"block-context-menu-item",{key:r,label:o,desc:t.desc,extras:s},n);case"highlight-context-menu":return Zo.call(this,"highlight-context-menu-item",{key:r,label:o,desc:t.desc,extras:s},n);case"page-menu":return Zo.call(this,"page-menu-item",{key:r,label:o,desc:t.desc,extras:s},n);default:return Zo.call(this,t.type||"$commands$",{key:r,label:o,desc:t.desc,palette:t.palette,keybinding:i,extras:s},n)}});return Xo(()=>{a.forEach(e=>{"function"==typeof e&&e()})})}function ni(e){var t;return null===(t=ke(e))||void 0===t?void 0:t.replace(/:/g,"-").replace(/^([0-9])/,"_$1")}function ri(e){return!("string"!=typeof(t=e)||36!==t.length||!/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(t))||(Vo.error(`#${e} is not a valid UUID string.`),!1);var t}let oi=null,ii=new Map;const si={async getInfo(e){return oi||(oi=await this._execCallableAPIAsync("get-app-info")),"string"==typeof e?oi[e]:oi},registerCommand(e,t,n){return ti.call(this,t.key,{...t,type:e,placement:"simple"},n)},registerSearchService(e){if(ii.has(e.name))throw new Error(`SearchService: #${e.name} has registered!`);ii.set(e.name,new Ho(this,e))},registerCommandPalette(e,t){return ti.call(this,e.key,{...e,placement:"palette"},t)},registerCommandShortcut(e,t,n={}){e=Qo(e);const{binding:r}=e,o=n.key||"$shortcut$"+xe(null==r?void 0:r.toString());return ti.call(this,o,{...n,key:o,placement:"shortcut",keybinding:e},t)},registerUIItem(e,t){var n;const r=this.baseInfo.id;null===(n=this.caller)||void 0===n||n.call("api:call",{method:"register-plugin-ui-item",args:[r,e,t]})},registerPageMenuItem(e,t){if("function"!=typeof t)return!1;const n=e+"_"+this.baseInfo.id,r=e;ti.call(this,n,{key:n,label:r,placement:"page-menu"},t)},onBlockRendererSlotted(e,t){if(!ri(e))return;const n=this.baseInfo.id,r=`hook:editor:${xe(`slot:${e}`)}`;return this.caller.on(r,t),this.App._installPluginHook(n,r),()=>{this.caller.off(r,t),this.App._uninstallPluginHook(n,r)}},invokeExternalPlugin(e,...t){var n;if(!(e=null===(n=e)||void 0===n?void 0:n.trim()))return;let[r,o]=e.split(".");if(!["models","commands"].includes(null==o?void 0:o.toLowerCase()))throw new Error("Type only support '.models' or '.commands' currently.");const i=e.replace(`${r}.${o}.`,"");if(!r||!o||!i)throw new Error(`Illegal type of #${e} to invoke external plugin.`);return this._execCallableAPIAsync("invoke_external_plugin_cmd",r,o.toLowerCase(),i,t)},setFullScreen(e){const t=(...e)=>this._callWin("setFullScreen",...e);"toggle"===e?this._callWin("isFullScreen").then(e=>{e?t():t(!0)}):e?t(!0):t()}},ai={register:ti,execute:function(e,...t){var n;if(!(e=null===(n=e)||void 0===n?void 0:n.trim()))return;if(e.startsWith("logseq."))return this.App.invokeExternalCommand(e,...t);const r=e.match(/^([^.]+)\.commands\.(.+)$/);if(r){const[,e,n]=r,o=ni(n);return this._execCallableAPIAsync("invoke_external_plugin_cmd",e,"commands",o,t)}const o=e.indexOf("/");return o>0?this._execCallableAPIAsync("invoke_external_plugin_cmd",e.slice(0,o),"commands",ni(e.slice(o+1)),t):this._execCallableAPIAsync("invoke_external_plugin_cmd",this.baseInfo.id,"commands",ni(e),t)}};let li=0;const ci={newBlockUUID(){return this._execCallableAPIAsync("new_block_uuid")},isPageBlock:e=>e.uuid&&e.hasOwnProperty("name"),registerSlashCommand(e,t){return ti.call(this,e,{title:e,placement:"slash"},t)},registerBlockContextMenuItem(e,t){if("function"!=typeof t)return!1;const n=e+"_"+this.baseInfo.id;ti.call(this,n,{key:n,label:e,placement:"block-context-menu"},t)},registerHighlightContextMenuItem(e,t,n){if("function"!=typeof t)return!1;const r=e+"_"+this.baseInfo.id;ti.call(this,r,{key:r,label:e,placement:"highlight-context-menu",extras:n},t)},scrollToBlockInPage(e,t,n){const r="block-content-"+t;null!=n&&n.replaceState?this.App.replaceState("page",{name:e},{anchor:r}):this.App.pushState("page",{name:e},{anchor:r})}},ui={onBlockChanged(e,t){if(!ri(e))return;const n=this.baseInfo.id,r=`hook:db:${xe(`block:${e}`)}`,o=({block:n,txData:r,txMeta:o})=>{n.uuid===e&&t(n,r,o)};return this.caller.on(r,o),this.App._installPluginHook(n,r),()=>{this.caller.off(r,o),this.App._uninstallPluginHook(n,r)}},datascriptQuery(e,...t){if(t.pop(),null!=t&&t.some(e=>"function"==typeof e)){return this.Experiments.ensureHostScope().logseq.api.datascript_query(e,...t)}return this._execCallableAPIAsync("datascript_query",e,...t)}},hi={},fi={},di={},pi={makeSandboxStorage(){return new rt(this,{assets:!0})}};var mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,vi=new WeakMap,bi=new WeakMap,_i=new WeakMap;class wi extends be{constructor(e,t){super(),Wo(this,"_baseInfo",void 0),Wo(this,"_caller",void 0),Wo(this,"_version","0.3.3"),Wo(this,"_debugTag",""),Wo(this,"_settingsSchema",void 0),Wo(this,"_connected",!1),Wo(this,"_ui",new Map),Wo(this,"_mFileStorage",void 0),Wo(this,"_mNet",void 0),Wo(this,"_mExperiments",void 0),Wo(this,"_beforeunloadCallback",void 0),Bo(this,mi,void 0),Bo(this,gi,void 0),Bo(this,yi,void 0),Bo(this,vi,void 0),Bo(this,bi,void 0),Bo(this,_i,void 0),this._baseInfo=e,this._caller=t,t.on("sys:ui:visible",e=>{null!=e&&e.toggle&&this.toggleMainUI()}),t.on("settings:changed",e=>{const t={...this.settings||{}},n={...e||{}};this._baseInfo={...this._baseInfo,settings:n},this.emit("settings:changed",n,t)}),t.on("beforeunload",async e=>{const{actor:t,...n}=e,r=this._beforeunloadCallback;try{r&&await r(n),null==t||t.resolve(null)}catch(e){this.logger.error("[beforeunload] ",e),null==t||t.reject(e)}})}async ready(e,t){var n,r;if(!this._connected)try{var o,i;"function"==typeof e&&(t=e,e={});let s=await this._caller.connectToParent(e);const a=null===(o=s)||void 0===o?void 0:o.settings;this._connected=!0,n=this._baseInfo,r=s,s=le()(n,r,{arrayMerge:(e,t)=>t}),void 0!==a&&(s.settings=a),this._baseInfo=s,null!==(i=s)&&void 0!==i&&i.id&&(this._debugTag=this._caller.debugTag=`#${s.id} [${s.name}]`,this.logger.setTag(this._debugTag)),this._settingsSchema&&(s.settings=function(e,t){const n=(t||[]).reduce((e,t)=>("default"in t&&(e[t.key]=t.default),e),{});return Object.assign(n,e)}(s.settings,this._settingsSchema),await this.useSettingsSchema(this._settingsSchema));try{await this._execCallableAPIAsync("setSDKMetadata",{version:this._version,runtime:"js"})}catch(e){console.warn(e)}t&&t.call(this,s)}catch(e){console.error(`${this._debugTag} [Ready Error]`,e)}}ensureConnected(){if(!this._connected)throw new Error("not connected")}beforeunload(e){"function"==typeof e&&(this._beforeunloadCallback=e)}provideModel(e){return this.caller._extendUserModel(e),this}provideTheme(e){return this.caller.call("provider:theme",e),this}provideStyle(e){return this.caller.call("provider:style",e),this}provideUI(e){return this.caller.call("provider:ui",e),this}useSettingsSchema(e){return this.connected&&this.caller.call("settings:schema",{schema:e,isSync:!0}),this._settingsSchema=e,this}updateSettings(e){this.caller.call("settings:update",e)}onSettingsChanged(e){const t="settings:changed";return this.on(t,e),()=>this.off(t,e)}showSettingsUI(){this.caller.call("settings:visible:changed",{visible:!0})}hideSettingsUI(){this.caller.call("settings:visible:changed",{visible:!1})}setMainUIAttrs(e){this.caller.call("main-ui:attrs",e)}setMainUIInlineStyle(e){this.caller.call("main-ui:style",e)}hideMainUI(e){const t={key:0,visible:!1,cursor:null==e?void 0:e.restoreEditingCursor};this.caller.call("main-ui:visible",t),this.emit("ui:visible:changed",t),this._ui.set(t.key,t)}showMainUI(e){const t={key:0,visible:!0,autoFocus:null==e?void 0:e.autoFocus};this.caller.call("main-ui:visible",t),this.emit("ui:visible:changed",t),this._ui.set(t.key,t)}toggleMainUI(){const e=0,t=this._ui.get(e);t&&t.visible?this.hideMainUI():this.showMainUI()}get version(){return this._version}get isMainUIVisible(){const e=this._ui.get(0);return Boolean(e&&e.visible)}get connected(){return this._connected}get baseInfo(){return this._baseInfo}get effect(){return(e=this)&&((null===(t=e.baseInfo)||void 0===t?void 0:t.effect)||!(null!==(n=e.baseInfo)&&void 0!==n&&n.iir));var e,t,n}get logger(){return Vo}get settings(){var e;return null===(e=this.baseInfo)||void 0===e?void 0:e.settings}get caller(){return this._caller}resolveResourceFullUrl(e){if(this.ensureConnected(),e)return e=e.replace(/^[.\\/]+/,""),Te(this._baseInfo.lsr,e)}_makeUserProxy(e,t){const n=this,r=this.caller;return new Proxy(e,{get(e,o,i){const s=e[o];return function(...e){if(s){0!==(null==e?void 0:e.length)&&e.push(t);const r=s.apply(n,e);if(r!==Yo)return r}if(t){const i=o.toString().match(/^(once|off|on)/i);if(null!=i){const o=i[0].toLowerCase(),s=i.input,a="off"===o,l=n.baseInfo.id;let c=s.slice(o.length),u=e[0],h=e[1];"string"==typeof u&&"function"==typeof h&&(u=u.replace(/^logseq./,":"),c=`${c}${u}`,u=h,h=e[2]),c=`hook:${t}:${xe(c)}`,r[o](c,u);const f=()=>{r.off(c,u),r.listenerCount(c)||n.App._uninstallPluginHook(l,c)};return a?void f():(n.App._installPluginHook(l,c,h),f)}}let i=o;return["git","ui","assets","utils"].includes(t)&&(i=t+"_"+i),r.callAsync("api:call",{tag:t,method:i,args:e})}}})}_execCallableAPIAsync(e,...t){return this._caller.callAsync("api:call",{method:e,args:t})}_execCallableAPI(e,...t){this._caller.call("api:call",{method:e,args:t})}_callWin(...e){return this._execCallableAPIAsync("_callMainWin",...e)}get App(){return Go(mi,this)?Go(mi,this):qo(mi,this,this._makeUserProxy(si,"app"))}get Commands(){return Go(gi,this)?Go(gi,this):qo(gi,this,this._makeUserProxy(ai,"commands"))}get Editor(){return Go(yi,this)?Go(yi,this):qo(yi,this,this._makeUserProxy(ci,"editor"))}get DB(){return Go(vi,this)?Go(vi,this):qo(vi,this,this._makeUserProxy(ui,"db"))}get UI(){return Go(bi,this)?Go(bi,this):qo(bi,this,this._makeUserProxy(fi,"ui"))}get Utils(){return Go(_i,this)?Go(_i,this):qo(_i,this,this._makeUserProxy(di,"utils"))}get Git(){return this._makeUserProxy(hi,"git")}get Assets(){return this._makeUserProxy(pi,"assets")}get FileStorage(){let e=this._mFileStorage;return e||(e=this._mFileStorage=new rt(this)),e}get Net(){let e=this._mNet;return e||(e=this._mNet=new yt(this)),e}get Experiments(){let e=this._mExperiments;return e||(e=this._mExperiments=new it(this)),e}}function xi(e,t){return new wi(e,t)}if(null==window.__LSP__HOST__){const e=new tt(null);window.logseq=xi({},e)}})(),r})());