piclaw 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/defult-D5RLDUrI.js +1 -0
- package/.output/public/assets/{dist-D-Hc5HbQ.js → dist-BH_oa-kv.js} +1 -1
- package/.output/public/assets/index-7JvURuHy.js +204 -0
- package/.output/public/assets/index-K43slwjJ.css +1 -0
- package/.output/public/index.html +11 -2
- package/.output/server/_chunks/app.mjs +138 -104
- package/.output/server/_chunks/config.mjs +4 -0
- package/.output/server/_chunks/dummy.mjs +1 -1
- package/.output/server/_chunks/logger.mjs +1 -1
- package/.output/server/_chunks/notes.mjs +1 -3
- package/.output/server/_chunks/renderer-template.mjs +1 -1
- package/.output/server/_chunks/sandbox.mjs +217 -0
- package/.output/server/_chunks/server.mjs +411 -291
- package/.output/server/_chunks/terminal.mjs +47 -8
- package/.output/server/_chunks/virtual.mjs +192 -54
- package/.output/server/_id_.delete.mjs +5 -2
- package/.output/server/_id_2.delete.mjs +8 -0
- package/.output/server/_jid_.delete.mjs +0 -1
- package/.output/server/_jid_.patch.mjs +21 -3
- package/.output/server/_jid_2.delete.mjs +0 -1
- package/.output/server/_libs/@acemir/cssom+[...].mjs +2269 -1137
- package/.output/server/_libs/@google/genai.mjs +348 -284
- package/.output/server/_libs/@mariozechner/pi-agent-core+[...].mjs +381 -2073
- package/.output/server/_libs/@mariozechner/pi-coding-agent+[...].mjs +236 -136
- package/.output/server/_libs/_.mjs +3 -2
- package/.output/server/_libs/_10.mjs +2 -4
- package/.output/server/_libs/_11.mjs +2 -4
- package/.output/server/_libs/_12.mjs +2 -3
- package/.output/server/_libs/_13.mjs +2 -3
- package/.output/server/_libs/_14.mjs +2 -4
- package/.output/server/_libs/_15.mjs +2 -4
- package/.output/server/_libs/_16.mjs +2 -3
- package/.output/server/_libs/_17.mjs +2 -4
- package/.output/server/_libs/_18.mjs +2 -2
- package/.output/server/_libs/_19.mjs +2 -2
- package/.output/server/_libs/_2.mjs +3 -3
- package/.output/server/_libs/_20.mjs +2 -2
- package/.output/server/_libs/_21.mjs +2 -2
- package/.output/server/_libs/_22.mjs +2 -2
- package/.output/server/_libs/_23.mjs +2 -2
- package/.output/server/_libs/_24.mjs +2 -2
- package/.output/server/_libs/_25.mjs +2 -2
- package/.output/server/_libs/_26.mjs +2 -2
- package/.output/server/_libs/_27.mjs +2 -2
- package/.output/server/_libs/_28.mjs +2 -2
- package/.output/server/_libs/_29.mjs +2 -2
- package/.output/server/_libs/_3.mjs +3 -3
- package/.output/server/_libs/_30.mjs +2 -2
- package/.output/server/_libs/_31.mjs +2 -2
- package/.output/server/_libs/_32.mjs +2 -2
- package/.output/server/_libs/_33.mjs +2 -2
- package/.output/server/_libs/_34.mjs +2 -2
- package/.output/server/_libs/_35.mjs +2 -2
- package/.output/server/_libs/_36.mjs +2 -2
- package/.output/server/_libs/_37.mjs +2 -2
- package/.output/server/_libs/_38.mjs +2 -2
- package/.output/server/_libs/_39.mjs +2 -2
- package/.output/server/_libs/_4.mjs +4 -3
- package/.output/server/_libs/_40.mjs +2 -2
- package/.output/server/_libs/_41.mjs +2 -2
- package/.output/server/_libs/_42.mjs +2 -2
- package/.output/server/_libs/_43.mjs +2 -2
- package/.output/server/_libs/_44.mjs +2 -2
- package/.output/server/_libs/_45.mjs +2 -2
- package/.output/server/_libs/_46.mjs +2 -2
- package/.output/server/_libs/_47.mjs +2 -2
- package/.output/server/_libs/_48.mjs +2 -2
- package/.output/server/_libs/_49.mjs +2 -2
- package/.output/server/_libs/_5.mjs +2 -3
- package/.output/server/_libs/_50.mjs +2 -2
- package/.output/server/_libs/_51.mjs +2 -2
- package/.output/server/_libs/_52.mjs +2 -2
- package/.output/server/_libs/_53.mjs +2 -2
- package/.output/server/_libs/_54.mjs +2 -2
- package/.output/server/_libs/_55.mjs +2 -2
- package/.output/server/_libs/_56.mjs +2 -2
- package/.output/server/_libs/_57.mjs +2 -2
- package/.output/server/_libs/_58.mjs +2 -2
- package/.output/server/_libs/_59.mjs +2 -2
- package/.output/server/_libs/_6.mjs +2 -3
- package/.output/server/_libs/_60.mjs +2 -2
- package/.output/server/_libs/_61.mjs +2 -2
- package/.output/server/_libs/_62.mjs +2 -2
- package/.output/server/_libs/_63.mjs +2 -2
- package/.output/server/_libs/_64.mjs +2 -2
- package/.output/server/_libs/_65.mjs +2 -2
- package/.output/server/_libs/_66.mjs +2 -2
- package/.output/server/_libs/_67.mjs +2 -2
- package/.output/server/_libs/_68.mjs +2 -2
- package/.output/server/_libs/_69.mjs +2 -2
- package/.output/server/_libs/_7.mjs +2 -5
- package/.output/server/_libs/_70.mjs +2 -2
- package/.output/server/_libs/_71.mjs +2 -2
- package/.output/server/_libs/_72.mjs +2 -2
- package/.output/server/_libs/_73.mjs +2 -2
- package/.output/server/_libs/_74.mjs +2 -2
- package/.output/server/_libs/_75.mjs +2 -2
- package/.output/server/_libs/_76.mjs +2 -2
- package/.output/server/_libs/_77.mjs +2 -2
- package/.output/server/_libs/_78.mjs +2 -2
- package/.output/server/_libs/_79.mjs +2 -2
- package/.output/server/_libs/_8.mjs +2 -3
- package/.output/server/_libs/_80.mjs +2 -2
- package/.output/server/_libs/_81.mjs +2 -2
- package/.output/server/_libs/_82.mjs +2 -2
- package/.output/server/_libs/_83.mjs +2 -2
- package/.output/server/_libs/_84.mjs +2 -2
- package/.output/server/_libs/_85.mjs +2 -2
- package/.output/server/_libs/_86.mjs +2 -2
- package/.output/server/_libs/_87.mjs +2 -2
- package/.output/server/_libs/_88.mjs +2 -2
- package/.output/server/_libs/_89.mjs +2 -2
- package/.output/server/_libs/_9.mjs +2 -4
- package/.output/server/_libs/_90.mjs +5 -2
- package/.output/server/_libs/_91.mjs +3 -2
- package/.output/server/_libs/_92.mjs +2 -2
- package/.output/server/_libs/_93.mjs +2 -2
- package/.output/server/_libs/_94.mjs +2 -2
- package/.output/server/_libs/agent-base.mjs +1 -1
- package/.output/server/_libs/cheerio+[...].mjs +1 -1
- package/.output/server/_libs/data-uri-to-buffer.mjs +2 -67
- package/.output/server/_libs/data-urls+[...].mjs +1 -1
- package/.output/server/_libs/diff.mjs +1 -1
- package/.output/server/_libs/exodus__bytes.mjs +99 -81
- package/.output/server/_libs/fetch-blob+node-domexception.mjs +1 -1
- package/.output/server/_libs/h3+rou3+srvx.mjs +34 -4
- package/.output/server/_libs/html-encoding-sniffer.mjs +1 -1
- package/.output/server/_libs/https-proxy-agent.mjs +2 -2
- package/.output/server/_libs/jsdom.mjs +1 -1
- package/.output/server/_libs/just-bash+[...].mjs +4676 -3916
- package/.output/server/_libs/mariozechner__jiti.mjs +1 -1
- package/.output/server/_libs/mariozechner__pi-ai.mjs +1472 -0
- package/.output/server/_libs/md4x.mjs +1 -1
- package/.output/server/_libs/node-fetch.mjs +14 -14
- package/.output/server/_libs/node-liblzma.mjs +1 -1
- package/.output/server/_libs/silvia-odwyer__photon-node.mjs +1 -1
- package/.output/server/_routes/api/auth/status.mjs +25 -6
- package/.output/server/_routes/api/config2.mjs +2 -0
- package/.output/server/_routes/api/files/groups.mjs +0 -1
- package/.output/server/_routes/api/groups.mjs +4 -2
- package/.output/server/_routes/api/groups2.mjs +14 -5
- package/.output/server/_routes/api/health.mjs +0 -1
- package/.output/server/_routes/api/pi/apikey.mjs +0 -1
- package/.output/server/_routes/api/pi/apikey_providers.mjs +0 -1
- package/.output/server/_routes/api/pi/commands.mjs +1 -2
- package/.output/server/_routes/api/pi/login/events.mjs +0 -1
- package/.output/server/_routes/api/pi/login/respond.mjs +0 -1
- package/.output/server/_routes/api/pi/login.mjs +0 -1
- package/.output/server/_routes/api/pi/logout.mjs +0 -1
- package/.output/server/_routes/api/pi/models.mjs +0 -1
- package/.output/server/_routes/api/pi/status.mjs +0 -1
- package/.output/server/_routes/api/sandbox.mjs +26 -0
- package/.output/server/_routes/api/sandbox2.mjs +17 -0
- package/.output/server/_routes/api/send.mjs +12 -12
- package/.output/server/_routes/api/status.mjs +0 -1
- package/.output/server/_routes/api/stop.mjs +0 -1
- package/.output/server/_routes/api/tasks2.mjs +0 -1
- package/.output/server/_routes/api/telegram/setup.mjs +0 -1
- package/.output/server/_routes/api/telegram/status.mjs +0 -1
- package/.output/server/_routes/api/terminal2.mjs +2 -1
- package/.output/server/_routes/api/tunnel/setup.mjs +0 -1
- package/.output/server/_runtime.mjs +1 -2
- package/.output/server/index.mjs +1 -1
- package/.output/server/node_modules/amdefine/amdefine.js +301 -0
- package/.output/server/node_modules/amdefine/package.json +16 -0
- package/.output/server/node_modules/compressjs/lib/BWT.js +420 -0
- package/.output/server/node_modules/compressjs/lib/BWTC.js +234 -0
- package/.output/server/node_modules/compressjs/lib/BitStream.js +108 -0
- package/.output/server/node_modules/compressjs/lib/Bzip2.js +936 -0
- package/.output/server/node_modules/compressjs/lib/CRC32.js +105 -0
- package/.output/server/node_modules/compressjs/lib/Context1Model.js +56 -0
- package/.output/server/node_modules/compressjs/lib/DefSumModel.js +152 -0
- package/.output/server/node_modules/compressjs/lib/DeflateDistanceModel.js +55 -0
- package/.output/server/node_modules/compressjs/lib/Dmc.js +197 -0
- package/.output/server/node_modules/compressjs/lib/DummyRangeCoder.js +81 -0
- package/.output/server/node_modules/compressjs/lib/FenwickModel.js +194 -0
- package/.output/server/node_modules/compressjs/lib/Huffman.js +514 -0
- package/.output/server/node_modules/compressjs/lib/HuffmanAllocator.js +227 -0
- package/.output/server/node_modules/compressjs/lib/LogDistanceModel.js +46 -0
- package/.output/server/node_modules/compressjs/lib/Lzjb.js +300 -0
- package/.output/server/node_modules/compressjs/lib/LzjbR.js +241 -0
- package/.output/server/node_modules/compressjs/lib/Lzp3.js +273 -0
- package/.output/server/node_modules/compressjs/lib/MTFModel.js +208 -0
- package/.output/server/node_modules/compressjs/lib/NoModel.js +46 -0
- package/.output/server/node_modules/compressjs/lib/PPM.js +343 -0
- package/.output/server/node_modules/compressjs/lib/RangeCoder.js +238 -0
- package/.output/server/node_modules/compressjs/lib/Simple.js +111 -0
- package/.output/server/node_modules/compressjs/lib/Stream.js +53 -0
- package/.output/server/node_modules/compressjs/lib/Util.js +324 -0
- package/.output/server/node_modules/compressjs/lib/freeze.js +14 -0
- package/.output/server/node_modules/compressjs/main.js +29 -0
- package/.output/server/node_modules/compressjs/package.json +35 -0
- package/.output/server/package.json +2 -1
- package/README.md +10 -1
- package/lib/index.d.mts +1 -0
- package/lib/index.mjs +1 -0
- package/lib/piclaw.mjs +100 -0
- package/lib/utils.mjs +96 -0
- package/package.json +16 -11
- package/.output/public/assets/defult-DtwgaiMA.js +0 -1
- package/.output/public/assets/index-B5n0eraW.css +0 -1
- package/.output/public/assets/index-DUbn6fuj.js +0 -205
- package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +0 -299
- package/.output/server/_libs/@aws-sdk/client-bedrock-runtime+[...].mjs +0 -17828
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +0 -122
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +0 -417
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +0 -54
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +0 -1151
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +0 -50
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +0 -369
- package/.output/server/_libs/@tootallnate/quickjs-emscripten+[...].mjs +0 -3011
- package/.output/server/_libs/_100.mjs +0 -2
- package/.output/server/_libs/_101.mjs +0 -2
- package/.output/server/_libs/_102.mjs +0 -2
- package/.output/server/_libs/_103.mjs +0 -5
- package/.output/server/_libs/_104.mjs +0 -3
- package/.output/server/_libs/_105.mjs +0 -2
- package/.output/server/_libs/_106.mjs +0 -3
- package/.output/server/_libs/_107.mjs +0 -2
- package/.output/server/_libs/_108.mjs +0 -2
- package/.output/server/_libs/_95.mjs +0 -2
- package/.output/server/_libs/_96.mjs +0 -2
- package/.output/server/_libs/_97.mjs +0 -2
- package/.output/server/_libs/_98.mjs +0 -2
- package/.output/server/_libs/_99.mjs +0 -2
- package/.output/server/_libs/amdefine.mjs +0 -188
- package/.output/server/_libs/ast-types.mjs +0 -2270
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +0 -3141
- package/.output/server/_libs/basic-ftp.mjs +0 -1906
- package/.output/server/_libs/compressjs.mjs +0 -50
- package/.output/server/_libs/degenerator+[...].mjs +0 -9964
- package/.output/server/_libs/get-uri.mjs +0 -413
- package/.output/server/_libs/http-proxy-agent.mjs +0 -123
- package/.output/server/_libs/ip-address.mjs +0 -1423
- package/.output/server/_libs/lru-cache.mjs +0 -732
- package/.output/server/_libs/netmask.mjs +0 -139
- package/.output/server/_libs/pac-proxy-agent+[...].mjs +0 -3104
- package/.output/server/_libs/proxy-agent+proxy-from-env.mjs +0 -204
- package/.output/server/_libs/smithy__core.mjs +0 -192
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/bin/piclaw.mjs +0 -195
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function u(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var d={},f=[],p=()=>{},m=()=>!1,h=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),g=e=>e.startsWith(`onUpdate:`),_=Object.assign,v=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},y=Object.prototype.hasOwnProperty,b=(e,t)=>y.call(e,t),x=Array.isArray,S=e=>re(e)===`[object Map]`,C=e=>re(e)===`[object Set]`,ee=e=>re(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,E=e=>typeof e==`symbol`,D=e=>typeof e==`object`&&!!e,te=e=>(D(e)||w(e))&&w(e.then)&&w(e.catch),ne=Object.prototype.toString,re=e=>ne.call(e),ie=e=>re(e).slice(8,-1),O=e=>re(e)===`[object Object]`,ae=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,oe=u(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),se=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ce=/-\w/g,le=se(e=>e.replace(ce,e=>e.slice(1).toUpperCase())),ue=/\B([A-Z])/g,de=se(e=>e.replace(ue,`-$1`).toLowerCase()),fe=se(e=>e.charAt(0).toUpperCase()+e.slice(1)),pe=se(e=>e?`on${fe(e)}`:``),me=(e,t)=>!Object.is(e,t),he=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ge=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},_e=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ve=e=>{let t=T(e)?Number(e):NaN;return isNaN(t)?e:t},ye,be=()=>ye||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function k(e){if(x(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?we(r):k(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(T(e)||D(e))return e}var xe=/;(?![^(]*\))/g,Se=/:([^]+)/,Ce=/\/\*[^]*?\*\//g;function we(e){let t={};return e.replace(Ce,``).split(xe).forEach(e=>{if(e){let n=e.split(Se);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function A(e){let t=``;if(T(e))t=e;else if(x(e))for(let n=0;n<e.length;n++){let r=A(e[n]);r&&(t+=r+` `)}else if(D(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Te=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Ee=u(Te);u(Te+`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);function De(e){return!!e||e===``}function Oe(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ke(e[r],t[r]);return n}function ke(e,t){if(e===t)return!0;let n=ee(e),r=ee(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=E(e),r=E(t),n||r)return e===t;if(n=x(e),r=x(t),n||r)return n&&r?Oe(e,t):!1;if(n=D(e),r=D(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!ke(e[n],t[n]))return!1}}return String(e)===String(t)}function Ae(e,t){return e.findIndex(e=>ke(e,t))}var je=e=>!!(e&&e.__v_isRef===!0),j=e=>T(e)?e:e==null?``:x(e)||D(e)&&(e.toString===ne||!w(e.toString))?je(e)?j(e.value):JSON.stringify(e,Me,2):String(e),Me=(e,t)=>je(t)?Me(e,t.value):S(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ne(t,r)+` =>`]=n,e),{})}:C(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ne(e))}:E(t)?Ne(t):D(t)&&!x(t)&&!O(t)?String(t):t,Ne=(e,t=``)=>E(e)?`Symbol(${e.description??t})`:e,Pe,Fe=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Pe,!e&&Pe&&(this.index=(Pe.scopes||=[]).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=Pe;try{return Pe=this,e()}finally{Pe=t}}}on(){++this._on===1&&(this.prevScope=Pe,Pe=this)}off(){this._on>0&&--this._on===0&&(Pe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Ie(){return Pe}function Le(e,t=!1){Pe&&Pe.cleanups.push(e)}var Re,ze=new WeakSet,Be=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Pe&&Pe.active&&Pe.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ze.has(this)&&(ze.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||We(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,rt(this),qe(this);let e=Re,t=$e;Re=this,$e=!0;try{return this.fn()}finally{Je(this),Re=e,$e=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ze(e);this.deps=this.depsTail=void 0,rt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ze.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ye(this)&&this.run()}get dirty(){return Ye(this)}},Ve=0,He,Ue;function We(e,t=!1){if(e.flags|=8,t){e.next=Ue,Ue=e;return}e.next=He,He=e}function Ge(){Ve++}function Ke(){if(--Ve>0)return;if(Ue){let e=Ue;for(Ue=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;He;){let t=He;for(He=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function qe(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Je(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ze(r),Qe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ye(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===it)||(e.globalVersion=it,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ye(e))))return;e.flags|=2;let t=e.dep,n=Re,r=$e;Re=e,$e=!0;try{qe(e);let n=e.fn(e._value);(t.version===0||me(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Re=n,$e=r,Je(e),e.flags&=-3}}function Ze(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ze(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Qe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var $e=!0,et=[];function tt(){et.push($e),$e=!1}function nt(){let e=et.pop();$e=e===void 0?!0:e}function rt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Re;Re=void 0;try{t()}finally{Re=e}}}var it=0,at=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ot=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Re||!$e||Re===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Re)t=this.activeLink=new at(Re,this),Re.deps?(t.prevDep=Re.depsTail,Re.depsTail.nextDep=t,Re.depsTail=t):Re.deps=Re.depsTail=t,st(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Re.depsTail,t.nextDep=void 0,Re.depsTail.nextDep=t,Re.depsTail=t,Re.deps===t&&(Re.deps=e)}return t}trigger(e){this.version++,it++,this.notify(e)}notify(e){Ge();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ke()}}};function st(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)st(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ct=new WeakMap,lt=Symbol(``),ut=Symbol(``),dt=Symbol(``);function ft(e,t,n){if($e&&Re){let t=ct.get(e);t||ct.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ot),r.map=t,r.key=n),r.track()}}function pt(e,t,n,r,i,a){let o=ct.get(e);if(!o){it++;return}let s=e=>{e&&e.trigger()};if(Ge(),t===`clear`)o.forEach(s);else{let i=x(e),a=i&&ae(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===dt||!E(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(dt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(lt)),S(e)&&s(o.get(ut)));break;case`delete`:i||(s(o.get(lt)),S(e)&&s(o.get(ut)));break;case`set`:S(e)&&s(o.get(lt));break}}Ke()}function mt(e,t){let n=ct.get(e);return n&&n.get(t)}function ht(e){let t=rn(e);return t===e?t:(ft(t,`iterate`,dt),tn(e)?t:t.map(on))}function gt(e){return ft(e=rn(e),`iterate`,dt),e}function _t(e,t){return en(e)?$t(e)?sn(on(t)):sn(t):on(t)}var vt={__proto__:null,[Symbol.iterator](){return yt(this,Symbol.iterator,e=>_t(this,e))},concat(...e){return ht(this).concat(...e.map(e=>x(e)?ht(e):e))},entries(){return yt(this,`entries`,e=>(e[1]=_t(this,e[1]),e))},every(e,t){return xt(this,`every`,e,t,void 0,arguments)},filter(e,t){return xt(this,`filter`,e,t,e=>e.map(e=>_t(this,e)),arguments)},find(e,t){return xt(this,`find`,e,t,e=>_t(this,e),arguments)},findIndex(e,t){return xt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return xt(this,`findLast`,e,t,e=>_t(this,e),arguments)},findLastIndex(e,t){return xt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return xt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return Ct(this,`includes`,e)},indexOf(...e){return Ct(this,`indexOf`,e)},join(e){return ht(this).join(e)},lastIndexOf(...e){return Ct(this,`lastIndexOf`,e)},map(e,t){return xt(this,`map`,e,t,void 0,arguments)},pop(){return wt(this,`pop`)},push(...e){return wt(this,`push`,e)},reduce(e,...t){return St(this,`reduce`,e,t)},reduceRight(e,...t){return St(this,`reduceRight`,e,t)},shift(){return wt(this,`shift`)},some(e,t){return xt(this,`some`,e,t,void 0,arguments)},splice(...e){return wt(this,`splice`,e)},toReversed(){return ht(this).toReversed()},toSorted(e){return ht(this).toSorted(e)},toSpliced(...e){return ht(this).toSpliced(...e)},unshift(...e){return wt(this,`unshift`,e)},values(){return yt(this,`values`,e=>_t(this,e))}};function yt(e,t,n){let r=gt(e),i=r[t]();return r!==e&&!tn(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var bt=Array.prototype;function xt(e,t,n,r,i,a){let o=gt(e),s=o!==e&&!tn(e),c=o[t];if(c!==bt[t]){let t=c.apply(e,a);return s?on(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,_t(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function St(e,t,n,r){let i=gt(e),a=n;return i!==e&&(tn(e)?n.length>3&&(a=function(t,r,i){return n.call(this,t,r,i,e)}):a=function(t,r,i){return n.call(this,t,_t(e,r),i,e)}),i[t](a,...r)}function Ct(e,t,n){let r=rn(e);ft(r,`iterate`,dt);let i=r[t](...n);return(i===-1||i===!1)&&nn(n[0])?(n[0]=rn(n[0]),r[t](...n)):i}function wt(e,t,n=[]){tt(),Ge();let r=rn(e)[t].apply(e,n);return Ke(),nt(),r}var Tt=u(`__proto__,__v_isRef,__isVue`),Et=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(E));function Dt(e){E(e)||(e=String(e));let t=rn(this);return ft(t,`has`,e),t.hasOwnProperty(e)}var Ot=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Kt:Gt:i?Wt:Ut).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=x(e);if(!r){let e;if(a&&(e=vt[t]))return e;if(t===`hasOwnProperty`)return Dt}let o=Reflect.get(e,t,cn(e)?e:n);if((E(t)?Et.has(t):Tt(t))||(r||ft(e,`get`,t),i))return o;if(cn(o)){let e=a&&ae(t)?o:o.value;return r&&D(e)?Zt(e):e}return D(o)?r?Zt(o):Yt(o):o}},kt=class extends Ot{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=x(e)&&ae(t);if(!this._isShallow){let e=en(i);if(!tn(n)&&!en(n)&&(i=rn(i),n=rn(n)),!a&&cn(i)&&!cn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:b(e,t),s=Reflect.set(e,t,n,cn(e)?e:r);return e===rn(r)&&(o?me(n,i)&&pt(e,`set`,t,n,i):pt(e,`add`,t,n)),s}deleteProperty(e,t){let n=b(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&pt(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!E(t)||!Et.has(t))&&ft(e,`has`,t),n}ownKeys(e){return ft(e,`iterate`,x(e)?`length`:lt),Reflect.ownKeys(e)}},At=class extends Ot{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},jt=new kt,Mt=new At,Nt=new kt(!0),Pt=e=>e,Ft=e=>Reflect.getPrototypeOf(e);function It(e,t,n){return function(...r){let i=this.__v_raw,a=rn(i),o=S(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Pt:t?sn:on;return!t&&ft(a,`iterate`,c?ut:lt),_(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Lt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Rt(e,t){let n={get(n){let r=this.__v_raw,i=rn(r),a=rn(n);e||(me(n,a)&&ft(i,`get`,n),ft(i,`get`,a));let{has:o}=Ft(i),s=t?Pt:e?sn:on;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&ft(rn(t),`iterate`,lt),t.size},has(t){let n=this.__v_raw,r=rn(n),i=rn(t);return e||(me(t,i)&&ft(r,`has`,t),ft(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=rn(a),s=t?Pt:e?sn:on;return!e&&ft(o,`iterate`,lt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return _(n,e?{add:Lt(`add`),set:Lt(`set`),delete:Lt(`delete`),clear:Lt(`clear`)}:{add(e){!t&&!tn(e)&&!en(e)&&(e=rn(e));let n=rn(this);return Ft(n).has.call(n,e)||(n.add(e),pt(n,`add`,e,e)),this},set(e,n){!t&&!tn(n)&&!en(n)&&(n=rn(n));let r=rn(this),{has:i,get:a}=Ft(r),o=i.call(r,e);o||=(e=rn(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?me(n,s)&&pt(r,`set`,e,n,s):pt(r,`add`,e,n),this},delete(e){let t=rn(this),{has:n,get:r}=Ft(t),i=n.call(t,e);i||=(e=rn(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&pt(t,`delete`,e,void 0,a),o},clear(){let e=rn(this),t=e.size!==0,n=e.clear();return t&&pt(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=It(r,e,t)}),n}function zt(e,t){let n=Rt(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(b(n,r)&&r in t?n:t,r,i)}var Bt={get:zt(!1,!1)},Vt={get:zt(!1,!0)},Ht={get:zt(!0,!1)},Ut=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap;function qt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Jt(e){return e.__v_skip||!Object.isExtensible(e)?0:qt(ie(e))}function Yt(e){return en(e)?e:Qt(e,!1,jt,Bt,Ut)}function Xt(e){return Qt(e,!1,Nt,Vt,Wt)}function Zt(e){return Qt(e,!0,Mt,Ht,Gt)}function Qt(e,t,n,r,i){if(!D(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=Jt(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function $t(e){return en(e)?$t(e.__v_raw):!!(e&&e.__v_isReactive)}function en(e){return!!(e&&e.__v_isReadonly)}function tn(e){return!!(e&&e.__v_isShallow)}function nn(e){return e?!!e.__v_raw:!1}function rn(e){let t=e&&e.__v_raw;return t?rn(t):e}function an(e){return!b(e,`__v_skip`)&&Object.isExtensible(e)&&ge(e,`__v_skip`,!0),e}var on=e=>D(e)?Yt(e):e,sn=e=>D(e)?Zt(e):e;function cn(e){return e?e.__v_isRef===!0:!1}function M(e){return un(e,!1)}function ln(e){return un(e,!0)}function un(e,t){return cn(e)?e:new dn(e,t)}var dn=class{constructor(e,t){this.dep=new ot,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:rn(e),this._value=t?e:on(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||tn(e)||en(e);e=n?e:rn(e),me(e,t)&&(this._rawValue=e,this._value=n?e:on(e),this.dep.trigger())}};function N(e){return cn(e)?e.value:e}var fn={get:(e,t,n)=>t===`__v_raw`?e:N(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return cn(i)&&!cn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function pn(e){return $t(e)?e:new Proxy(e,fn)}var mn=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new ot,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}};function hn(e){return new mn(e)}var gn=class{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._raw=rn(e);let r=!0,i=e;if(!x(e)||!ae(String(t)))do r=!nn(i)||tn(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=N(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&cn(this._raw[this._key])){let t=this._object[this._key];if(cn(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return mt(this._raw,this._key)}},_n=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}};function vn(e,t,n){return cn(e)?e:w(e)?new _n(e):D(e)&&arguments.length>1?yn(e,t,n):M(e)}function yn(e,t,n){return new gn(e,t,n)}var bn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ot(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=it-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Re!==this)return We(this,!0),!0}get value(){let e=this.dep.track();return Xe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function xn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new bn(r,i,n)}var Sn={},Cn=new WeakMap,wn=void 0;function Tn(e,t=!1,n=wn){if(n){let t=Cn.get(n);t||Cn.set(n,t=[]),t.push(e)}}function En(e,t,n=d){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:tn(e)||i===!1||i===0?Dn(e,1):Dn(e),u,f,m,h,g=!1,_=!1;if(cn(e)?(f=()=>e.value,g=tn(e)):$t(e)?(f=()=>l(e),g=!0):x(e)?(_=!0,g=e.some(e=>$t(e)||tn(e)),f=()=>e.map(e=>{if(cn(e))return e.value;if($t(e))return l(e);if(w(e))return c?c(e,2):e()})):f=w(e)?t?c?()=>c(e,2):e:()=>{if(m){tt();try{m()}finally{nt()}}let t=wn;wn=u;try{return c?c(e,3,[h]):e(h)}finally{wn=t}}:p,t&&i){let e=f,t=i===!0?1/0:i;f=()=>Dn(e(),t)}let y=Ie(),b=()=>{u.stop(),y&&y.active&&v(y.effects,u)};if(a&&t){let e=t;t=(...t)=>{e(...t),b()}}let S=_?Array(e.length).fill(Sn):Sn,C=e=>{if(!(!(u.flags&1)||!u.dirty&&!e))if(t){let e=u.run();if(i||g||(_?e.some((e,t)=>me(e,S[t])):me(e,S))){m&&m();let n=wn;wn=u;try{let n=[e,S===Sn?void 0:_&&S[0]===Sn?[]:S,h];S=e,c?c(t,3,n):t(...n)}finally{wn=n}}}else u.run()};return s&&s(C),u=new Be(f),u.scheduler=o?()=>o(C,!1):C,h=e=>Tn(e,!1,u),m=u.onStop=()=>{let e=Cn.get(u);if(e){if(c)c(e,4);else for(let t of e)t();Cn.delete(u)}},t?r?C(!0):S=u.run():o?o(C.bind(null,!0),!0):u.run(),b.pause=u.pause.bind(u),b.resume=u.resume.bind(u),b.stop=b,b}function Dn(e,t=1/0,n){if(t<=0||!D(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,cn(e))Dn(e.value,t,n);else if(x(e))for(let r=0;r<e.length;r++)Dn(e[r],t,n);else if(C(e)||S(e))e.forEach(e=>{Dn(e,t,n)});else if(O(e)){for(let r in e)Dn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Dn(e[r],t,n)}return e}function On(e,t,n,r){try{return r?e(...r):e()}catch(e){An(e,t,n)}}function kn(e,t,n,r){if(w(e)){let i=On(e,t,n,r);return i&&te(i)&&i.catch(e=>{An(e,t,n)}),i}if(x(e)){let i=[];for(let a=0;a<e.length;a++)i.push(kn(e[a],t,n,r));return i}}function An(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||d;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){tt(),On(a,null,10,[e,i,o]),nt();return}}jn(e,n,i,r,o)}function jn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Mn=[],Nn=-1,Pn=[],Fn=null,In=0,Ln=Promise.resolve(),Rn=null;function zn(e){let t=Rn||Ln;return e?t.then(this?e.bind(this):e):t}function Bn(e){let t=Nn+1,n=Mn.length;for(;t<n;){let r=t+n>>>1,i=Mn[r],a=Kn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Vn(e){if(!(e.flags&1)){let t=Kn(e),n=Mn[Mn.length-1];!n||!(e.flags&2)&&t>=Kn(n)?Mn.push(e):Mn.splice(Bn(t),0,e),e.flags|=1,Hn()}}function Hn(){Rn||=Ln.then(qn)}function Un(e){x(e)?Pn.push(...e):Fn&&e.id===-1?Fn.splice(In+1,0,e):e.flags&1||(Pn.push(e),e.flags|=1),Hn()}function Wn(e,t,n=Nn+1){for(;n<Mn.length;n++){let t=Mn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;Mn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Gn(e){if(Pn.length){let e=[...new Set(Pn)].sort((e,t)=>Kn(e)-Kn(t));if(Pn.length=0,Fn){Fn.push(...e);return}for(Fn=e,In=0;In<Fn.length;In++){let e=Fn[In];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}Fn=null,In=0}}var Kn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function qn(e){try{for(Nn=0;Nn<Mn.length;Nn++){let e=Mn[Nn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),On(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Nn<Mn.length;Nn++){let e=Mn[Nn];e&&(e.flags&=-2)}Nn=-1,Mn.length=0,Gn(e),Rn=null,(Mn.length||Pn.length)&&qn(e)}}var Jn=null,Yn=null;function Xn(e){let t=Jn;return Jn=e,Yn=e&&e.type.__scopeId||null,t}function Zn(e,t=Jn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Ia(-1);let i=Xn(t),a;try{a=e(...n)}finally{Xn(i),r._d&&Ia(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function Qn(e,t){if(Jn===null)return e;let n=_o(Jn),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=d]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&Dn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function $n(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(tt(),kn(c,n,8,[e.el,s,e,t]),nt())}}function er(e,t){if(eo){let n=eo.provides,r=eo.parent&&eo.parent.provides;r===n&&(n=eo.provides=Object.create(r)),n[e]=t}}function tr(e,t,n=!1){let r=to();if(r||Ri){let i=Ri?Ri._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var nr=Symbol.for(`v-scx`),rr=()=>tr(nr);function ir(e,t){return or(e,null,t)}function ar(e,t){return or(e,null,{flush:`sync`})}function P(e,t,n){return or(e,t,n)}function or(e,t,n=d){let{immediate:r,deep:i,flush:a,once:o}=n,s=_({},n),c=t&&r||!t&&a!==`post`,l;if(so){if(a===`sync`){let e=rr();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=p,e.resume=p,e.pause=p,e}}let u=eo;s.call=(e,t,n)=>kn(e,u,t,n);let f=!1;a===`post`?s.scheduler=e=>{ga(e,u&&u.suspense)}:a!==`sync`&&(f=!0,s.scheduler=(e,t)=>{t?e():Vn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),f&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let m=En(e,t,s);return so&&(l?l.push(m):c&&m()),m}function sr(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?cr(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=io(this),s=or(i,a.bind(r),n);return o(),s}function cr(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var lr=Symbol(`_vte`),ur=e=>e.__isTeleport,dr=e=>e&&(e.disabled||e.disabled===``),fr=e=>e&&(e.defer||e.defer===``),pr=e=>typeof SVGElement<`u`&&e instanceof SVGElement,mr=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,hr=(e,t)=>{let n=e&&e.to;return T(n)?t?t(n):null:n},gr={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g}}=l,_=dr(t.props),{shapeFlag:v,children:y,dynamicChildren:b}=t;if(e==null){let e=t.el=h(``),l=t.anchor=h(``);p(e,n,r),p(l,n,r);let d=(e,t)=>{v&16&&u(y,e,t,i,a,o,s,c)},f=()=>{let e=t.target=hr(t.props,m),n=xr(e,t,h,p);e&&(o!==`svg`&&pr(e)?o=`svg`:o!==`mathml`&&mr(e)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(e),_||(d(e,n),br(t,!1)))};_&&(d(n,l),br(t,!0)),fr(t.props)?(t.el.__isMounted=!1,ga(()=>{f(),delete t.el.__isMounted},a)):f()}else{if(fr(t.props)&&e.el.__isMounted===!1){ga(()=>{gr.process(e,t,n,r,i,a,o,s,c,l)},a);return}t.el=e.el,t.targetStart=e.targetStart;let u=t.anchor=e.anchor,p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=dr(e.props),v=g?n:p,y=g?u:h;if(o===`svg`||pr(p)?o=`svg`:(o===`mathml`||mr(p))&&(o=`mathml`),b?(f(e.dynamicChildren,b,v,i,a,o,s),Sa(e,t,!0)):c||d(e,t,v,y,i,a,o,s,!1),_)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):_r(t,n,u,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=hr(t.props,m);e&&_r(t,e,null,l,0)}else g&&_r(t,p,h,l,1);br(t,_)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e;if(d&&(i(l),i(u)),a&&i(c),o&16){let e=a||!dr(f);for(let i=0;i<s.length;i++){let a=s[i];r(a,t,n,e,!!a.dynamicChildren)}}},move:_r,hydrate:vr};function _r(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),(!d||dr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function vr(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=hr(t.props,c),h=dr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||xr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||xr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),br(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var yr=gr;function br(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function xr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[lr]=o,e&&(r(a,e,i),r(o,e,i)),o}var Sr=Symbol(`_leaveCb`),Cr=Symbol(`_enterCb`);function wr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Zr(()=>{e.isMounted=!0}),ei(()=>{e.isUnmounting=!0}),e}var Tr=[Function,Array],Er={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Tr,onEnter:Tr,onAfterEnter:Tr,onEnterCancelled:Tr,onBeforeLeave:Tr,onLeave:Tr,onAfterLeave:Tr,onLeaveCancelled:Tr,onBeforeAppear:Tr,onAppear:Tr,onAfterAppear:Tr,onAppearCancelled:Tr},Dr=e=>{let t=e.subTree;return t.component?Dr(t.component):t},Or={name:`BaseTransition`,props:Er,setup(e,{slots:t}){let n=to(),r=wr();return()=>{let i=t.default&&Ir(t.default(),!0);if(!i||!i.length)return;let a=kr(i),o=rn(e),{mode:s}=o;if(r.isLeaving)return Nr(a);let c=Pr(a);if(!c)return Nr(a);let l=Mr(c,o,r,n,e=>l=e);c.type!==Aa&&Fr(c,l);let u=n.subTree&&Pr(n.subTree);if(u&&u.type!==Aa&&!za(u,c)&&Dr(n).type!==Aa){let e=Mr(u,o,r,n);if(Fr(u,e),s===`out-in`&&c.type!==Aa)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Nr(a);s===`in-out`&&c.type!==Aa?e.delayLeave=(e,t,n)=>{let i=jr(r,u);i[String(u.key)]=u,e[Sr]=()=>{t(),e[Sr]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function kr(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Aa){t=n;break}}return t}var Ar=Or;function jr(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Mr(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:p,onAfterLeave:m,onLeaveCancelled:h,onBeforeAppear:g,onAppear:_,onAfterAppear:v,onAppearCancelled:y}=t,b=String(e.key),S=jr(n,e),C=(e,t)=>{e&&kn(e,r,9,t)},ee=(e,t)=>{let n=t[1];C(e,t),x(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},w={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted)if(a)r=g||c;else return;t[Sr]&&t[Sr](!0);let i=S[b];i&&za(e,i)&&i.el[Sr]&&i.el[Sr](),C(r,[t])},enter(t){if(S[b]===e)return;let r=l,i=u,o=d;if(!n.isMounted)if(a)r=_||l,i=v||u,o=y||d;else return;let s=!1;t[Cr]=e=>{s||(s=!0,C(e?o:i,[t]),w.delayedLeave&&w.delayedLeave(),t[Cr]=void 0)};let c=t[Cr].bind(null,!1);r?ee(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[Cr]&&t[Cr](!0),n.isUnmounting)return r();C(f,[t]);let a=!1;t[Sr]=n=>{a||(a=!0,r(),C(n?h:m,[t]),t[Sr]=void 0,S[i]===e&&delete S[i])};let o=t[Sr].bind(null,!1);S[i]=e,p?ee(p,[t,o]):o()},clone(e){let a=Mr(e,t,n,r,i);return i&&i(a),a}};return w}function Nr(e){if(Ur(e))return e=Wa(e),e.children=null,e}function Pr(e){if(!Ur(e))return ur(e.type)&&e.children?kr(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&w(n.default))return n.default()}}function Fr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Fr(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Ir(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===L?(o.patchFlag&128&&i++,r=r.concat(Ir(o.children,t,s))):(t||o.type!==Aa)&&r.push(s==null?o:Wa(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function F(e,t){return w(e)?_({name:e.name},t,{setup:e}):e}function Lr(e){e.ids=[e.ids[0]+ e.ids[2]+++`-`,0,0]}function Rr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var zr=new WeakMap;function Br(e,t,n,r,i=!1){if(x(e)){e.forEach((e,a)=>Br(e,t&&(x(t)?t[a]:t),n,r,i));return}if(Hr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Br(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?_o(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,u=s.refs===d?s.refs={}:s.refs,f=s.setupState,p=rn(f),h=f===d?m:e=>Rr(u,e)?!1:b(p,e),g=(e,t)=>!(t&&Rr(u,t));if(l!=null&&l!==c){if(Vr(t),T(l))u[l]=null,h(l)&&(f[l]=null);else if(cn(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(w(c))On(c,s,12,[o,u]);else{let t=T(c),r=cn(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:u[c]:g(c)||!e.k?c.value:u[e.k];if(i)x(n)&&v(n,a);else if(x(n))n.includes(a)||n.push(a);else if(t)u[c]=[a],h(c)&&(f[c]=u[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(u[e.k]=t)}}else t?(u[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(u[e.k]=o))};if(o){let t=()=>{s(),zr.delete(e)};t.id=-1,zr.set(e,t),ga(t,n)}else Vr(e),s()}}}function Vr(e){let t=zr.get(e);t&&(t.flags|=8,zr.delete(e))}be().requestIdleCallback,be().cancelIdleCallback;var Hr=e=>!!e.type.__asyncLoader,Ur=e=>e.type.__isKeepAlive;function Wr(e,t){Kr(e,`a`,t)}function Gr(e,t){Kr(e,`da`,t)}function Kr(e,t,n=eo){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Jr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Ur(e.parent.vnode)&&qr(r,t,n,e),e=e.parent}}function qr(e,t,n,r){let i=Jr(t,e,r,!0);ti(()=>{v(r[t],i)},n)}function Jr(e,t,n=eo,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{tt();let i=io(n),a=kn(t,n,e,r);return i(),nt(),a};return r?i.unshift(a):i.push(a),a}}var Yr=e=>(t,n=eo)=>{(!so||e===`sp`)&&Jr(e,(...e)=>t(...e),n)},Xr=Yr(`bm`),Zr=Yr(`m`),Qr=Yr(`bu`),$r=Yr(`u`),ei=Yr(`bum`),ti=Yr(`um`),ni=Yr(`sp`),ri=Yr(`rtg`),ii=Yr(`rtc`);function ai(e,t=eo){Jr(`ec`,e,t)}var oi=`components`;function si(e,t){return ui(oi,e,!0,t)||e}var ci=Symbol.for(`v-ndc`);function li(e){return T(e)?ui(oi,e,!1)||e:e||ci}function ui(e,t,n=!0,r=!1){let i=Jn||eo;if(i){let n=i.type;if(e===oi){let e=vo(n,!1);if(e&&(e===t||e===le(t)||e===fe(le(t))))return n}let a=di(i[e]||n[e],t)||di(i.appContext[e],t);return!a&&r?n:a}}function di(e,t){return e&&(e[t]||e[le(t)]||e[fe(le(t))])}function I(e,t,n,r){let i,a=n&&n[r],o=x(e);if(o||T(e)){let n=o&&$t(e),r=!1,s=!1;n&&(r=!tn(e),s=en(e),e=gt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?sn(on(e[n])):on(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(D(e))if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}else i=[];return n&&(n[r]=i),i}function fi(e,t,n={},r,i){if(Jn.ce||Jn.parent&&Hr(Jn.parent)&&Jn.parent.ce){let e=Object.keys(n).length>0;return t!==`default`&&(n.name=t),R(),B(L,null,[H(`slot`,n,r&&r())],e?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),R();let o=a&&pi(a(n)),s=n.key||o&&o.key,c=B(L,{key:(s&&!E(s)?s:`_${t}`)+(!o&&r?`_fb`:``)},o||(r?r():[]),o&&e._===1?64:-2);return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),a&&a._c&&(a._d=!0),c}function pi(e){return e.some(e=>Ra(e)?!(e.type===Aa||e.type===L&&!pi(e.children)):!0)?e:null}var mi=e=>e?oo(e)?_o(e):mi(e.parent):null,hi=_(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>mi(e.parent),$root:e=>mi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Ti(e),$forceUpdate:e=>e.f||=()=>{Vn(e.update)},$nextTick:e=>e.n||=zn.bind(e.proxy),$watch:e=>sr.bind(e)}),gi=(e,t)=>e!==d&&!e.__isScriptSetup&&b(e,t),_i={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(gi(r,t))return o[t]=1,r[t];else if(i!==d&&b(i,t))return o[t]=2,i[t];else if(b(a,t))return o[t]=3,a[t];else if(n!==d&&b(n,t))return o[t]=4,n[t];else bi&&(o[t]=0)}let l=hi[t],u,f;if(l)return t===`$attrs`&&ft(e.attrs,`get`,``),l(e);if((u=s.__cssModules)&&(u=u[t]))return u;if(n!==d&&b(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,b(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return gi(i,t)?(i[t]=n,!0):r!==d&&b(r,t)?(r[t]=n,!0):b(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==d&&s[0]!==`$`&&b(e,s)||gi(t,s)||b(a,s)||b(r,s)||b(hi,s)||b(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?b(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function vi(e){return x(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function yi(e,t){return!e||!t?e||t:x(e)&&x(t)?e.concat(t):_({},vi(e),vi(t))}var bi=!0;function xi(e){let t=Ti(e),n=e.proxy,r=e.ctx;bi=!1,t.beforeCreate&&Ci(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:f,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:b,unmounted:S,render:C,renderTracked:ee,renderTriggered:T,errorCaptured:E,serverPrefetch:te,expose:ne,inheritAttrs:re,components:ie,directives:O,filters:ae}=t;if(l&&Si(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);D(t)&&(e.data=Yt(t))}if(bi=!0,a)for(let e in a){let t=a[e],i=G({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):p,set:!w(t)&&w(t.set)?t.set.bind(n):p});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)wi(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{er(t,e[t])})}u&&Ci(u,e,`c`);function oe(e,t){x(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(oe(Xr,d),oe(Zr,f),oe(Qr,m),oe($r,h),oe(Wr,g),oe(Gr,_),oe(ai,E),oe(ii,ee),oe(ri,T),oe(ei,y),oe(ti,S),oe(ni,te),x(ne))if(ne.length){let t=e.exposed||={};ne.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};C&&e.render===p&&(e.render=C),re!=null&&(e.inheritAttrs=re),ie&&(e.components=ie),O&&(e.directives=O),te&&Lr(e)}function Si(e,t,n=p){x(e)&&(e=Ai(e));for(let n in e){let r=e[n],i;i=D(r)?`default`in r?tr(r.from||n,r.default,!0):tr(r.from||n):tr(r),cn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Ci(e,t,n){kn(x(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function wi(e,t,n,r){let i=r.includes(`.`)?cr(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&P(i,n)}else if(w(e))P(i,e.bind(n));else if(D(e))if(x(e))e.forEach(e=>wi(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&P(i,r,e)}}function Ti(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>Ei(c,e,o,!0)),Ei(c,t,o)),D(t)&&a.set(t,c),c}function Ei(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&Ei(e,a,n,!0),i&&i.forEach(t=>Ei(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Di[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Di={data:Oi,props:Ni,emits:Ni,methods:Mi,computed:Mi,beforeCreate:ji,created:ji,beforeMount:ji,mounted:ji,beforeUpdate:ji,updated:ji,beforeDestroy:ji,beforeUnmount:ji,destroyed:ji,unmounted:ji,activated:ji,deactivated:ji,errorCaptured:ji,serverPrefetch:ji,components:Mi,directives:Mi,watch:Pi,provide:Oi,inject:ki};function Oi(e,t){return t?e?function(){return _(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function ki(e,t){return Mi(Ai(e),Ai(t))}function Ai(e){if(x(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ji(e,t){return e?[...new Set([].concat(e,t))]:t}function Mi(e,t){return e?_(Object.create(null),e,t):t}function Ni(e,t){return e?x(e)&&x(t)?[...new Set([...e,...t])]:_(Object.create(null),vi(e),vi(t??{})):t}function Pi(e,t){if(!e)return t;if(!t)return e;let n=_(Object.create(null),e);for(let r in t)n[r]=ji(e[r],t[r]);return n}function Fi(){return{app:null,config:{isNativeTag:m,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var Ii=0;function Li(e,t){return function(n,r=null){w(n)||(n=_({},n)),r!=null&&!D(r)&&(r=null);let i=Fi(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Ii++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:xo,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||H(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,_o(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(kn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=Ri;Ri=c;try{return e()}finally{Ri=t}}};return c}}var Ri=null;function zi(e,t,n=d){let r=to(),i=le(t),a=de(t),o=Bi(e,i),s=hn((o,s)=>{let c,l=d,u;return ar(()=>{let t=e[i];me(c,t)&&(c=t,s())}),{get(){return o(),n.get?n.get(c):c},set(e){let o=n.set?n.set(e):e;if(!me(o,c)&&!(l!==d&&me(e,l)))return;let f=r.vnode.props;f&&(t in f||i in f||a in f)&&(`onUpdate:${t}`in f||`onUpdate:${i}`in f||`onUpdate:${a}`in f)||(c=e,s()),r.emit(`update:${t}`,o),me(e,o)&&me(e,l)&&!me(o,u)&&s(),l=e,u=o}}});return s[Symbol.iterator]=()=>{let e=0;return{next(){return e<2?{value:e++?o||d:s,done:!1}:{done:!0}}}},s}var Bi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${le(t)}Modifiers`]||e[`${de(t)}Modifiers`];function Vi(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||d,i=n,a=t.startsWith(`update:`),o=a&&Bi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=n.map(_e)));let s,c=r[s=pe(t)]||r[s=pe(le(t))];!c&&a&&(c=r[s=pe(de(t))]),c&&kn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,kn(l,e,6,i)}}var Hi=new WeakMap;function Ui(e,t,n=!1){let r=n?Hi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=Ui(e,t,!0);n&&(s=!0,_(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(D(e)&&r.set(e,null),null):(x(a)?a.forEach(e=>o[e]=null):_(o,a),D(e)&&r.set(e,o),o)}function Wi(e,t){return!e||!h(t)?!1:(t=t.slice(2).replace(/Once$/,``),b(e,t[0].toLowerCase()+t.slice(1))||b(e,de(t))||b(e,t))}function Gi(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:h}=e,_=Xn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Ka(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=Ka(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:Ki(s)}}catch(t){Ma.length=0,An(t,e,1),v=H(Aa)}let b=v;if(y&&h!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(g)&&(y=qi(y,a)),b=Wa(b,y,!1,!0))}return n.dirs&&(b=Wa(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Fr(b,n.transition),v=b,Xn(_),v}var Ki=e=>{let t;for(let n in e)(n===`class`||n===`style`||h(n))&&((t||={})[n]=e[n]);return t},qi=(e,t)=>{let n={};for(let r in e)(!g(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ji(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Yi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Xi(o,r,n)&&!Wi(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?o?Yi(r,o,l):!0:!!o;return!1}function Yi(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Xi(t,e,a)&&!Wi(n,a))return!0}return!1}function Xi(e,t,n){let r=e[n],i=t[n];return n===`style`&&D(r)&&D(i)?!ke(r,i):r!==i}function Zi({vnode:e,parent:t},n){for(;t;){let r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}var Qi={},$i=()=>Object.create(Qi),ea=e=>Object.getPrototypeOf(e)===Qi;function ta(e,t,n,r=!1){let i={},a=$i();e.propsDefaults=Object.create(null),ra(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:Xt(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function na(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=rn(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(Wi(e.emitsOptions,o))continue;let u=t[o];if(c)if(b(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=le(o);i[t]=ia(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{ra(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!b(t,a)&&((r=de(a))===a||!b(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=ia(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!b(t,e))&&(delete a[e],l=!0)}l&&pt(e.attrs,`set`,``)}function ra(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(oe(c))continue;let l=t[c],u;i&&b(i,u=le(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:Wi(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=rn(n),r=s||d;for(let o=0;o<a.length;o++){let s=a[o];n[s]=ia(i,t,s,r[s],e,!b(r,s))}}return o}function ia(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=b(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=io(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===de(n))&&(r=!0))}return r}var aa=new WeakMap;function oa(e,t,n=!1){let r=n?aa:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=oa(e,t,!0);_(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return D(e)&&r.set(e,f),f;if(x(a))for(let e=0;e<a.length;e++){let t=le(a[e]);sa(t)&&(o[t]=d)}else if(a)for(let e in a){let t=le(e);if(sa(t)){let n=a[e],r=o[t]=x(n)||w(n)?{type:n}:_({},n),i=r.type,c=!1,l=!0;if(x(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}else n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||b(r,`default`))&&s.push(t)}}let l=[o,s];return D(e)&&r.set(e,l),l}function sa(e){return e[0]!==`$`&&!oe(e)}var ca=e=>e===`_`||e===`_ctx`||e===`$stable`,la=e=>x(e)?e.map(Ka):[Ka(e)],ua=(e,t,n)=>{if(t._n)return t;let r=Zn((...e)=>la(t(...e)),n);return r._c=!1,r},da=(e,t,n)=>{let r=e._ctx;for(let n in e){if(ca(n))continue;let i=e[n];if(w(i))t[n]=ua(n,i,r);else if(i!=null){let e=la(i);t[n]=()=>e}}},fa=(e,t)=>{let n=la(t);e.slots.default=()=>n},pa=(e,t,n)=>{for(let r in t)(n||!ca(r))&&(e[r]=t[r])},ma=(e,t,n)=>{let r=e.slots=$i();if(e.vnode.shapeFlag&32){let e=t._;e?(pa(r,t,n),n&&ge(r,`_`,e,!0)):da(t,r)}else t&&fa(e,t)},ha=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=d;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:pa(i,t,n):(a=!t.$stable,da(t,i)),o=t}else t&&(fa(e,t),o={default:1});if(a)for(let e in i)!ca(e)&&o[e]==null&&delete i[e]},ga=Oa;function _a(e){return va(e)}function va(e,t){let n=be();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:u,parentNode:m,nextSibling:h,setScopeId:g=p,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!za(e,t)&&(r=ye(e),pe(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case ka:y(e,t,n,r);break;case Aa:b(e,t,n,r);break;case ja:e??x(t,n,r,o);break;case L:re(e,t,n,r,i,a,o,s,c);break;default:d&1?ee(e,t,n,r,i,a,o,s,c):d&6?ie(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,Se)}u!=null&&i?Br(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&Br(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},ee=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)w(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),D(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},w=(e,t,n,i,s,c,l,d)=>{let f,p,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(f=e.el=o(e.type,c,m&&m.is,m),h&8?u(f,e.children):h&16&&E(e.children,f,null,i,s,ya(e,c),l,d),_&&$n(e,null,i,`created`),T(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!oe(e)&&a(f,e,null,m[e],c,i);`value`in m&&a(f,`value`,null,m.value,c),(p=m.onVnodeBeforeMount)&&Xa(p,i,e)}_&&$n(e,null,i,`beforeMount`);let v=xa(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&ga(()=>{p&&Xa(p,i,e),v&&g.enter(f),_&&$n(e,null,i,`mounted`)},s)},T=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||Da(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;T(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},E=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++)v(null,e[l]=s?qa(e[l]):Ka(e[l]),t,n,r,i,a,o,s)},D=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:f,dirs:p}=t;l|=e.patchFlag&16;let m=e.props||d,h=t.props||d,g;if(n&&ba(n,!1),(g=h.onVnodeBeforeUpdate)&&Xa(g,n,t,e),p&&$n(t,e,n,`beforeUpdate`),n&&ba(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&u(c,``),f?te(e.dynamicChildren,f,c,n,r,ya(t,i),o):s||le(e,t,c,null,n,r,ya(t,i),o,!1),l>0){if(l&16)ne(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&u(c,t.children)}else !s&&f==null&&ne(c,m,h,n,i);((g=h.onVnodeUpdated)||p)&&ga(()=>{g&&Xa(g,n,t,e),p&&$n(t,e,n,`updated`)},r)},te=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s];v(c,l,c.el&&(c.type===L||!za(c,l)||c.shapeFlag&198)?m(c.el):n,null,r,i,a,o,!0)}},ne=(e,t,n,r,i)=>{if(t!==n){if(t!==d)for(let o in t)!oe(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(oe(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},re=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),E(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(te(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Sa(e,t,!0)):le(e,t,n,f,a,o,c,l,u)},ie=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):O(t,n,r,i,a,o,c):ae(e,t,c)},O=(e,t,n,r,i,a,o)=>{let s=e.component=$a(e,r,i);if(Ur(e)&&(s.ctx.renderer=Se),co(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,se,o),!e.el){let r=s.subTree=H(Aa);b(null,r,t,n),e.placeholder=r.el}}else se(s,e,t,n,i,a,o)},ae=(e,t,n)=>{let r=t.component=e.component;if(Ji(e,t,n))if(r.asyncDep&&!r.asyncResolved){ce(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},se=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=wa(e);if(n){t&&(t.el=c.el,ce(e,t,o)),n.asyncDep.then(()=>{ga(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;ba(e,!1),t?(t.el=c.el,ce(e,t,o)):t=c,n&&he(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Xa(d,s,t,c),ba(e,!0);let f=Gi(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),ye(p),e,i,a),t.el=f.el,u===null&&Zi(e,f.el),r&&ga(r,i),(d=t.props&&t.props.onVnodeUpdated)&&ga(()=>Xa(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Hr(t);if(ba(e,!1),l&&he(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Xa(o,d,t),ba(e,!0),s&&we){let t=()=>{e.subTree=Gi(e),we(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p);let o=e.subTree=Gi(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ga(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ga(()=>Xa(o,d,e),i)}(t.shapeFlag&256||d&&Hr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ga(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Be(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Vn(u),ba(e,!0),l()},ce=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,na(e,t.props,r,n),ha(e,t.children,n),tt(),Wn(e),nt()},le=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,d=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(p&128){de(l,f,n,r,i,a,o,s,c);return}else if(p&256){ue(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&ve(l,i,a),f!==l&&u(n,f)):d&16?m&16?de(l,f,n,r,i,a,o,s,c):ve(l,i,a,!0):(d&8&&u(n,``),m&16&&E(f,n,r,i,a,o,s,c))},ue=(e,t,n,r,i,a,o,s,c)=>{e||=f,t||=f;let l=e.length,u=t.length,d=Math.min(l,u),p;for(p=0;p<d;p++){let r=t[p]=c?qa(t[p]):Ka(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?ve(e,i,a,!0,!1,d):E(t,n,r,i,a,o,s,c,d)},de=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,d=e.length-1,p=u-1;for(;l<=d&&l<=p;){let r=e[l],u=t[l]=c?qa(t[l]):Ka(t[l]);if(za(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=d&&l<=p;){let r=e[d],l=t[p]=c?qa(t[p]):Ka(t[p]);if(za(r,l))v(r,l,n,null,i,a,o,s,c);else break;d--,p--}if(l>d){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?qa(t[l]):Ka(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=d;)pe(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?qa(t[l]):Ka(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=d;l++){let r=e[l];if(y>=b){pe(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&za(r,t[_])){u=_;break}u===void 0?pe(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let ee=x?Ca(C):f;for(_=ee.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||Ea(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==ee[_]?fe(d,n,p,2):_--)}}},fe=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){fe(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,Se);return}if(c===L){r(s,t,n);for(let e=0;e<u.length;e++)fe(u[e],t,n,a);r(e.anchor,t,n);return}if(c===ja){S(e,t,n);return}if(a!==2&&d&1&&l)if(a===0)l.beforeEnter(s),r(s,t,n),ga(()=>l.enter(s),o);else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{s._isLeaving&&s[Sr](!0),a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},pe=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p}=e;if(d===-2&&(i=!1),s!=null&&(tt(),Br(s,null,n,e,!0),nt()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let m=u&1&&f,h=!Hr(e),g;if(h&&(g=o&&o.onVnodeBeforeUnmount)&&Xa(g,t,e),u&6)_e(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}m&&$n(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Se,r):l&&!l.hasOnce&&(a!==L||d>0&&d&64)?ve(l,t,n,!1,!0):(a===L&&d&384||!i&&u&16)&&ve(c,t,n),r&&me(e)}(h&&(g=o&&o.onVnodeUnmounted)||m)&&ga(()=>{g&&Xa(g,t,e),m&&$n(e,null,t,`unmounted`)},n)},me=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===L){ge(n,r);return}if(t===ja){C(e);return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},ge=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},_e=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Ta(c),Ta(l),r&&he(r),i.stop(),a&&(a.flags|=8,pe(o,e,t,n)),s&&ga(s,t),ga(()=>{e.isUnmounted=!0},t)},ve=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)pe(e[o],t,n,r,i)},ye=e=>{if(e.shapeFlag&6)return ye(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[lr];return n?h(n):t},k=!1,xe=(e,t,n)=>{let r;e==null?t._vnode&&(pe(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,k||=(k=!0,Wn(r),Gn(),!1)},Se={p:v,um:pe,m:fe,r:me,mt:O,mc:E,pc:le,pbc:te,n:ye,o:e},Ce,we;return t&&([Ce,we]=t(Se)),{render:xe,hydrate:Ce,createApp:Li(xe,Ce)}}function ya({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function ba({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function xa(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Sa(e,t,n=!1){let r=e.children,i=t.children;if(x(r)&&x(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=qa(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Sa(t,a)),a.type===ka&&(a.patchFlag===-1&&(a=i[e]=qa(a)),a.el=t.el),a.type===Aa&&!a.el&&(a.el=t.el)}}function Ca(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-- >0;)n[a]=o,o=t[o];return n}function wa(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:wa(t)}function Ta(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ea(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?Ea(t.subTree):null}var Da=e=>e.__isSuspense;function Oa(e,t){t&&t.pendingBranch?x(e)?t.effects.push(...e):t.effects.push(e):Un(e)}var L=Symbol.for(`v-fgt`),ka=Symbol.for(`v-txt`),Aa=Symbol.for(`v-cmt`),ja=Symbol.for(`v-stc`),Ma=[],Na=null;function R(e=!1){Ma.push(Na=e?null:[])}function Pa(){Ma.pop(),Na=Ma[Ma.length-1]||null}var Fa=1;function Ia(e,t=!1){Fa+=e,e<0&&Na&&t&&(Na.hasOnce=!0)}function La(e){return e.dynamicChildren=Fa>0?Na||f:null,Pa(),Fa>0&&Na&&Na.push(e),e}function z(e,t,n,r,i,a){return La(V(e,t,n,r,i,a,!0))}function B(e,t,n,r,i){return La(H(e,t,n,r,i,!0))}function Ra(e){return e?e.__v_isVNode===!0:!1}function za(e,t){return e.type===t.type&&e.key===t.key}var Ba=({key:e})=>e??null,Va=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||cn(e)||w(e)?{i:Jn,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===L?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ba(t),ref:t&&Va(t),scopeId:Yn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Jn};return s?(Ja(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),Fa>0&&!o&&Na&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Na.push(c),c}var H=Ha;function Ha(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===ci)&&(e=Aa),Ra(e)){let r=Wa(e,t,!0);return n&&Ja(r,n),Fa>0&&!a&&Na&&(r.shapeFlag&6?Na[Na.indexOf(e)]=r:Na.push(r)),r.patchFlag=-2,r}if(yo(e)&&(e=e.__vccOpts),t){t=Ua(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=A(e)),D(n)&&(nn(n)&&!x(n)&&(n=_({},n)),t.style=k(n))}let o=T(e)?1:Da(e)?128:ur(e)?64:D(e)?4:w(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function Ua(e){return e?nn(e)||ea(e)?_({},e):e:null}function Wa(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Ya(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Ba(l),ref:t&&t.ref?n&&a?x(a)?a.concat(Va(t)):[a,Va(t)]:Va(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==L?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Wa(e.ssContent),ssFallback:e.ssFallback&&Wa(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Fr(u,c.clone(u)),u}function U(e=` `,t=0){return H(ka,null,e,t)}function Ga(e,t){let n=H(ja,null,e);return n.staticCount=t,n}function W(e=``,t=!1){return t?(R(),B(Aa,null,e)):H(Aa,null,e)}function Ka(e){return e==null||typeof e==`boolean`?H(Aa):x(e)?H(L,null,e.slice()):Ra(e)?qa(e):H(ka,null,String(e))}function qa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Wa(e)}function Ja(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(x(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),Ja(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!ea(t)?t._ctx=Jn:r===3&&Jn&&(Jn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else w(t)?(t={default:t,_ctx:Jn},n=32):(t=String(t),r&64?(n=16,t=[U(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ya(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=A([t.class,r.class]));else if(e===`style`)t.style=k([t.style,r.style]);else if(h(e)){let n=t[e],i=r[e];i&&n!==i&&!(x(n)&&n.includes(i))&&(t[e]=n?[].concat(n,i):i)}else e!==``&&(t[e]=r[e])}return t}function Xa(e,t,n,r=null){kn(e,t,7,[n,r])}var Za=Fi(),Qa=0;function $a(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||Za,a={uid:Qa++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Fe(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:oa(r,i),emitsOptions:Ui(r,i),emit:null,emitted:null,propsDefaults:d,inheritAttrs:r.inheritAttrs,ctx:d,data:d,props:d,attrs:d,slots:d,refs:d,setupState:d,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=Vi.bind(null,a),e.ce&&e.ce(a),a}var eo=null,to=()=>eo||Jn,no,ro;{let e=be(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};no=t(`__VUE_INSTANCE_SETTERS__`,e=>eo=e),ro=t(`__VUE_SSR_SETTERS__`,e=>so=e)}var io=e=>{let t=eo;return no(e),e.scope.on(),()=>{e.scope.off(),no(t)}},ao=()=>{eo&&eo.scope.off(),no(null)};function oo(e){return e.vnode.shapeFlag&4}var so=!1;function co(e,t=!1,n=!1){t&&ro(t);let{props:r,children:i}=e.vnode,a=oo(e);ta(e,r,a,t),ma(e,i,n||t);let o=a?lo(e,t):void 0;return t&&ro(!1),o}function lo(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,_i);let{setup:r}=n;if(r){tt();let n=e.setupContext=r.length>1?go(e):null,i=io(e),a=On(r,e,0,[e.props,n]),o=te(a);if(nt(),i(),(o||e.sp)&&!Hr(e)&&Lr(e),o){if(a.then(ao,ao),t)return a.then(n=>{uo(e,n,t)}).catch(t=>{An(t,e,0)});e.asyncDep=a}else uo(e,a,t)}else mo(e,t)}function uo(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:D(t)&&(e.setupState=pn(t)),mo(e,n)}var fo,po;function mo(e,t,n){let r=e.type;if(!e.render){if(!t&&fo&&!r.render){let t=r.template||Ti(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=fo(t,_(_({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||p,po&&po(e)}{let t=io(e);tt();try{xi(e)}finally{nt(),t()}}}var ho={get(e,t){return ft(e,`get`,``),e[t]}};function go(e){return{attrs:new Proxy(e.attrs,ho),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function _o(e){return e.exposed?e.exposeProxy||=new Proxy(pn(an(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in hi)return hi[n](e)},has(e,t){return t in e||t in hi}}):e.proxy}function vo(e,t=!0){return w(e)?e.displayName||e.name:e.name||t&&e.__name}function yo(e){return w(e)&&`__vccOpts`in e}var G=(e,t)=>xn(e,t,so);function bo(e,t,n){try{Ia(-1);let r=arguments.length;return r===2?D(t)&&!x(t)?Ra(t)?H(e,null,[t]):H(e,t):H(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ra(n)&&(n=[n]),H(e,t,n))}finally{Ia(1)}}var xo=`3.5.29`,So=void 0,Co=typeof window<`u`&&window.trustedTypes;if(Co)try{So=Co.createPolicy(`vue`,{createHTML:e=>e})}catch{}var wo=So?e=>So.createHTML(e):e=>e,To=`http://www.w3.org/2000/svg`,Eo=`http://www.w3.org/1998/Math/MathML`,Do=typeof document<`u`?document:null,Oo=Do&&Do.createElement(`template`),ko={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?Do.createElementNS(To,e):t===`mathml`?Do.createElementNS(Eo,e):n?Do.createElement(e,{is:n}):Do.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>Do.createTextNode(e),createComment:e=>Do.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Do.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{Oo.innerHTML=wo(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Oo.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ao=`transition`,jo=`animation`,Mo=Symbol(`_vtc`),No={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Po=_({},Er,No),Fo=(e=>(e.displayName=`Transition`,e.props=Po,e))((e,{slots:t})=>bo(Ar,Ro(e),t)),Io=(e,t=[])=>{x(e)?e.forEach(e=>e(...t)):e&&e(...t)},Lo=e=>e?x(e)?e.some(e=>e.length>1):e.length>1:!1;function Ro(e){let t={};for(let n in e)n in No||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=zo(i),h=m&&m[0],g=m&&m[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:x,onLeaveCancelled:S,onBeforeAppear:C=v,onAppear:ee=y,onAppearCancelled:w=b}=t,T=(e,t,n,r)=>{e._enterCancelled=r,Ho(e,t?u:s),Ho(e,t?l:o),n&&n()},E=(e,t)=>{e._isLeaving=!1,Ho(e,d),Ho(e,p),Ho(e,f),t&&t()},D=e=>(t,n)=>{let i=e?ee:y,o=()=>T(t,e,n);Io(i,[t,o]),Uo(()=>{Ho(t,e?c:a),Vo(t,e?u:s),Lo(i)||Go(t,r,h,o)})};return _(t,{onBeforeEnter(e){Io(v,[e]),Vo(e,a),Vo(e,o)},onBeforeAppear(e){Io(C,[e]),Vo(e,c),Vo(e,l)},onEnter:D(!1),onAppear:D(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>E(e,t);Vo(e,d),e._enterCancelled?(Vo(e,f),Yo(e)):(Yo(e),Vo(e,f)),Uo(()=>{e._isLeaving&&(Ho(e,d),Vo(e,p),Lo(x)||Go(e,r,g,n))}),Io(x,[e,n])},onEnterCancelled(e){T(e,!1,void 0,!0),Io(b,[e])},onAppearCancelled(e){T(e,!0,void 0,!0),Io(w,[e])},onLeaveCancelled(e){E(e),Io(S,[e])}})}function zo(e){if(e==null)return null;if(D(e))return[Bo(e.enter),Bo(e.leave)];{let t=Bo(e);return[t,t]}}function Bo(e){return ve(e)}function Vo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[Mo]||(e[Mo]=new Set)).add(t)}function Ho(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[Mo];n&&(n.delete(t),n.size||(e[Mo]=void 0))}function Uo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Wo=0;function Go(e,t,n,r){let i=e._endId=++Wo,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=Ko(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function Ko(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${Ao}Delay`),a=r(`${Ao}Duration`),o=qo(i,a),s=r(`${jo}Delay`),c=r(`${jo}Duration`),l=qo(s,c),u=null,d=0,f=0;t===Ao?o>0&&(u=Ao,d=o,f=a.length):t===jo?l>0&&(u=jo,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?Ao:jo:null,f=u?u===Ao?a.length:c.length:0);let p=u===Ao&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ao}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function qo(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Jo(t)+Jo(e[n])))}function Jo(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Yo(e){return(e?e.ownerDocument:document).body.offsetHeight}function Xo(e,t,n){let r=e[Mo];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Zo=Symbol(`_vod`),Qo=Symbol(`_vsh`),$o={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Zo]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):es(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),es(e,!0),r.enter(e)):r.leave(e,()=>{es(e,!1)}):es(e,t))},beforeUnmount(e,{value:t}){es(e,t)}};function es(e,t){e.style.display=t?e[Zo]:`none`,e[Qo]=!t}var ts=Symbol(``),ns=/(?:^|;)\s*display\s*:/;function rs(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t)if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??as(r,t,``)}else for(let e in t)n[e]??as(r,e,``);for(let e in n)e===`display`&&(a=!0),as(r,e,n[e])}else if(i){if(t!==n){let e=r[ts];e&&(n+=`;`+e),r.cssText=n,a=ns.test(n)}}else t&&e.removeAttribute(`style`);Zo in e&&(e[Zo]=a?r.display:``,e[Qo]&&(r.display=`none`))}var is=/\s*!important$/;function as(e,t,n){if(x(n))n.forEach(n=>as(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=ls(e,t);is.test(n)?e.setProperty(de(r),n.replace(is,``),`important`):e[r]=n}}var ss=[`Webkit`,`Moz`,`ms`],cs={};function ls(e,t){let n=cs[t];if(n)return n;let r=le(t);if(r!==`filter`&&r in e)return cs[t]=r;r=fe(r);for(let n=0;n<ss.length;n++){let i=ss[n]+r;if(i in e)return cs[t]=i}return t}var us=`http://www.w3.org/1999/xlink`;function ds(e,t,n,r,i,a=Ee(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(us,t.slice(6,t.length)):e.setAttributeNS(us,t,n):n==null||a&&!De(n)?e.removeAttribute(t):e.setAttribute(t,a?``:E(n)?String(n):n)}function fs(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?wo(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=De(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function ps(e,t,n,r){e.addEventListener(t,n,r)}function ms(e,t,n,r){e.removeEventListener(t,n,r)}var hs=Symbol(`_vei`);function gs(e,t,n,r,i=null){let a=e[hs]||(e[hs]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=vs(t);r?ps(e,n,a[t]=Ss(r,i),s):o&&(ms(e,n,o,s),a[t]=void 0)}}var _s=/(?:Once|Passive|Capture)$/;function vs(e){let t;if(_s.test(e)){t={};let n;for(;n=e.match(_s);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):de(e.slice(2)),t]}var ys=0,bs=Promise.resolve(),xs=()=>ys||=(bs.then(()=>ys=0),Date.now());function Ss(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;kn(Cs(e,n.value),t,5,[e])};return n.value=e,n.attached=xs(),n}function Cs(e,t){if(x(t)){let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}else return t}var ws=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ts=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Xo(e,r,o):t===`style`?rs(e,n,r):h(t)?g(t)||gs(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):Es(e,t,r,o))?(fs(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&ds(e,t,r,o,a,t!==`value`)):e._isVueCE&&(/[A-Z]/.test(t)||!T(r))?fs(e,le(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),ds(e,t,r,o))};function Es(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&ws(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return ws(t)&&T(n)?!1:t in e}var Ds=new WeakMap,Os=new WeakMap,ks=Symbol(`_moveCb`),As=Symbol(`_enterCb`),js=(e=>(delete e.props.mode,e))({name:`TransitionGroup`,props:_({},Po,{tag:String,moveClass:String}),setup(e,{slots:t}){let n=to(),r=wr(),i,a;return $r(()=>{if(!i.length)return;let t=e.moveClass||`${e.name||`v`}-move`;if(!Is(i[0].el,n.vnode.el,t)){i=[];return}i.forEach(Ms),i.forEach(Ns);let r=i.filter(Ps);Yo(n.vnode.el),r.forEach(e=>{let n=e.el,r=n.style;Vo(n,t),r.transform=r.webkitTransform=r.transitionDuration=``;let i=n[ks]=e=>{e&&e.target!==n||(!e||e.propertyName.endsWith(`transform`))&&(n.removeEventListener(`transitionend`,i),n[ks]=null,Ho(n,t))};n.addEventListener(`transitionend`,i)}),i=[]}),()=>{let o=rn(e),s=Ro(o),c=o.tag||L;if(i=[],a)for(let e=0;e<a.length;e++){let t=a[e];t.el&&t.el instanceof Element&&(i.push(t),Fr(t,Mr(t,s,r,n)),Ds.set(t,Fs(t.el)))}a=t.default?Ir(t.default()):[];for(let e=0;e<a.length;e++){let t=a[e];t.key!=null&&Fr(t,Mr(t,s,r,n))}return H(c,null,a)}}});function Ms(e){let t=e.el;t[ks]&&t[ks](),t[As]&&t[As]()}function Ns(e){Os.set(e,Fs(e.el))}function Ps(e){let t=Ds.get(e),n=Os.get(e),r=t.left-n.left,i=t.top-n.top;if(r||i){let t=e.el,n=t.style,a=t.getBoundingClientRect(),o=1,s=1;return t.offsetWidth&&(o=a.width/t.offsetWidth),t.offsetHeight&&(s=a.height/t.offsetHeight),(!Number.isFinite(o)||o===0)&&(o=1),(!Number.isFinite(s)||s===0)&&(s=1),Math.abs(o-1)<.01&&(o=1),Math.abs(s-1)<.01&&(s=1),n.transform=n.webkitTransform=`translate(${r/o}px,${i/s}px)`,n.transitionDuration=`0s`,e}}function Fs(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function Is(e,t,n){let r=e.cloneNode(),i=e[Mo];i&&i.forEach(e=>{e.split(/\s+/).forEach(e=>e&&r.classList.remove(e))}),n.split(/\s+/).forEach(e=>e&&r.classList.add(e)),r.style.display=`none`;let a=t.nodeType===1?t:t.parentNode;a.appendChild(r);let{hasTransform:o}=Ko(r);return a.removeChild(r),o}var Ls=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return x(t)?e=>he(t,e):t};function Rs(e){e.target.composing=!0}function zs(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var Bs=Symbol(`_assign`);function Vs(e,t,n){return t&&(e=e.trim()),n&&(e=_e(e)),e}var Hs={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[Bs]=Ls(i);let a=r||i.props&&i.props.type===`number`;ps(e,t?`change`:`input`,t=>{t.target.composing||e[Bs](Vs(e.value,n,a))}),(n||a)&&ps(e,`change`,()=>{e.value=Vs(e.value,n,a)}),t||(ps(e,`compositionstart`,Rs),ps(e,`compositionend`,zs),ps(e,`change`,zs))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Bs]=Ls(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?_e(e.value):e.value,c=t??``;s!==c&&(document.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c))}},Us={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let i=C(t);ps(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?_e(Gs(e)):Gs(e));e[Bs](e.multiple?i?new Set(t):t:t[0]),e._assigning=!0,zn(()=>{e._assigning=!1})}),e[Bs]=Ls(r)},mounted(e,{value:t}){Ws(e,t)},beforeUpdate(e,t,n){e[Bs]=Ls(n)},updated(e,{value:t}){e._assigning||Ws(e,t)}};function Ws(e,t){let n=e.multiple,r=x(t);if(!(n&&!r&&!C(t))){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Gs(a);if(n)if(r){let e=typeof o;e===`string`||e===`number`?a.selected=t.some(e=>String(e)===String(o)):a.selected=Ae(t,o)>-1}else a.selected=t.has(o);else if(ke(Gs(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Gs(e){return`_value`in e?e._value:e.value}var Ks=[`ctrl`,`shift`,`alt`,`meta`],qs={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ks.some(n=>e[`${n}Key`]&&!t.includes(n))},Js=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=qs[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Ys={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Xs=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=de(n.key);if(t.some(e=>e===r||Ys[e]===r))return e(n)}))},Zs=_({patchProp:Ts},ko),Qs;function $s(){return Qs||=_a(Zs)}var ec=((...e)=>{let t=$s().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=nc(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,tc(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function tc(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function nc(e){return T(e)?document.querySelector(e):e}var rc=/^[a-z0-9]+(-[a-z0-9]+)*$/,ic=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!ac(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!ac(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!ac(e,n)?null:e}return null},ac=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,oc=Object.freeze({left:0,top:0,width:16,height:16}),sc=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cc=Object.freeze({...oc,...sc}),lc=Object.freeze({...cc,body:``,hidden:!1});function uc(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function dc(e,t){let n=uc(e,t);for(let r in lc)r in sc?r in e&&!(r in n)&&(n[r]=sc[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function fc(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function pc(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=dc(r[e]||i[e],a)}return o(t),n.forEach(o),dc(e,a)}function mc(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=fc(e);for(let i in r){let a=r[i];a&&(t(i,pc(e,i,a)),n.push(i))}return n}var hc={provider:``,aliases:{},not_found:{},...oc};function gc(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function _c(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!gc(e,hc))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!gc(t,lc))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!gc(t,lc))return null}return t}var vc=Object.create(null);function yc(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function bc(e,t){let n=vc[e]||(vc[e]=Object.create(null));return n[t]||(n[t]=yc(e,t))}function xc(e,t){return _c(t)?mc(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function Sc(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var Cc=!1;function wc(e){return typeof e==`boolean`&&(Cc=e),Cc}function Tc(e){let t=typeof e==`string`?ic(e,!0,Cc):e;if(t){let e=bc(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function Ec(e,t){let n=ic(e,!0,Cc);if(!n)return!1;let r=bc(n.provider,n.prefix);return t?Sc(r,n.name,t):(r.missing.add(n.name),!0)}function Dc(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),Cc&&!t&&!e.prefix){let t=!1;return _c(e)&&(e.prefix=``,mc(e,(e,n)=>{Ec(e,n)&&(t=!0)})),t}let n=e.prefix;return ac({prefix:n,name:`a`})?!!xc(bc(t,n),e):!1}var Oc=Object.freeze({width:null,height:null}),kc=Object.freeze({...Oc,...sc}),Ac=/(-?[0-9.]*[0-9]+[0-9.]*)/g,jc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Mc(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(Ac);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=jc.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function Nc(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Pc(e,t){return e?`<defs>`+e+`</defs>`+t:t}function Fc(e,t,n){let r=Nc(e);return Pc(r.defs,t+r.content+n)}var Ic=e=>e===`unset`||e===`undefined`||e===`none`;function Lc(e,t){let n={...cc,...e},r={...kc,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=Fc(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=Mc(d,c/l)):(u=o===`auto`?c:o,d=s===null?Mc(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{Ic(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var Rc=/\sid="(\S+)"/g,zc=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Bc=0;function Vc(e,t=zc){let n=[],r;for(;r=Rc.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(Bc++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var Hc=Object.create(null);function Uc(e,t){Hc[e]=t}function Wc(e){return Hc[e]||Hc[``]}function Gc(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var Kc=Object.create(null),qc=[`https://api.simplesvg.com`,`https://api.unisvg.com`],Jc=[];qc.length>0;)qc.length===1||Math.random()>.5?Jc.push(qc.shift()):Jc.push(qc.pop());Kc[``]=Gc({resources:[`https://api.iconify.design`].concat(Jc)});function Yc(e,t){let n=Gc(t);return n===null?!1:(Kc[e]=n,!0)}function Xc(e){return Kc[e]}var Zc=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Qc(e,t){let n=Xc(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{let n=t;e=Math.max(e,n.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function $c(e){return e===404}var el=(e,t,n)=>{let r=[],i=Qc(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function tl(e){if(typeof e==`string`){let t=Xc(e);if(t)return t.path}return`/`}var nl={prepare:el,send:(e,t,n)=>{if(!Zc){n(`abort`,424);return}let r=tl(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;Zc(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n($c(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function rl(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=bc(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function il(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function al(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||il([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var ol=0;function sl(e,t,n){let r=ol++,i=il.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function cl(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?ic(e,t,n):e;i&&r.push(i)}),r}var ll={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ul(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function dl(e){let t={...ll,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=ul(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function fl(){}var pl=Object.create(null);function ml(e){if(!pl[e]){let t=Xc(e);if(!t)return;pl[e]={config:t,redundancy:dl(t)}}return pl[e]}function hl(e,t,n){let r,i;if(typeof e==`string`){let t=Wc(e);if(!t)return n(void 0,424),fl;i=t.send;let a=ml(e);a&&(r=a.redundancy)}else{let t=Gc(e);if(t){r=dl(t);let n=Wc(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),fl):r.query(t,i,n)().abort}function gl(){}function _l(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,al(e)}))}function vl(e){let t=[],n=[];return e.forEach(e=>{(e.match(rc)?t:n).push(e)}),{valid:t,invalid:n}}function yl(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!xc(e,n).length){r();return}}catch(e){console.error(e)}r(),_l(e)}function bl(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function xl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){bl(e.loadIcons(r,n,t),t=>{yl(e,r,t)});return}if(i){r.forEach(r=>{bl(i(r,n,t),t=>{yl(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=vl(r);if(o.length&&yl(e,o,null),!a.length)return;let s=n.match(rc)?Wc(t):null;if(!s){yl(e,a,null);return}s.prepare(t,n,a).forEach(n=>{hl(t,n,t=>{yl(e,n.icons,t)})})}))}var Sl=(e,t)=>{let n=rl(cl(e,!0,wc()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,gl)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(bc(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=bc(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&xl(e,t)}),t?sl(t,n,i):gl};function Cl(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in Oc?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var wl=/[\s,]+/;function Tl(e,t){t.split(wl).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function El(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function Dl(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Ol(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function kl(e){return`data:image/svg+xml,`+Ol(e)}function Al(e){return`url("`+kl(e)+`")`}var jl={...kc,inline:!1},Ml={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Nl={display:`inline-block`},Pl={backgroundColor:`currentColor`},Fl={backgroundColor:`transparent`},Il={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},Ll={webkitMask:Pl,mask:Pl,background:Fl};for(let e in Ll){let t=Ll[e];for(let n in Il)t[e+n]=Il[n]}var Rl={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;Rl[e+`-flip`]=t,Rl[e.slice(0,1)+`-flip`]=t,Rl[e+`Flip`]=t});function zl(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var Bl=(e,t)=>{let n=Cl(jl,t),r={...Ml},i=t.mode||`svg`,a={},o=t.style,s=typeof o==`object`&&!(o instanceof Array)?o:{};for(let e in t){let i=t[e];if(i!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:n[e]=i===!0||i===`true`||i===1;break;case`flip`:typeof i==`string`&&Tl(n,i);break;case`color`:a.color=i;break;case`rotate`:typeof i==`string`?n[e]=El(i):typeof i==`number`&&(n[e]=i);break;case`ariaHidden`:case`aria-hidden`:i!==!0&&i!==`true`&&delete r[`aria-hidden`];break;default:{let t=Rl[e];t?(i===!0||i===`true`||i===1)&&(n[t]=!0):jl[e]===void 0&&(r[e]=i)}}}let c=Lc(e,n),l=c.attributes;if(n.inline&&(a.verticalAlign=`-0.125em`),i===`svg`){r.style={...a,...s},Object.assign(r,l);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),r.innerHTML=Vc(c.body,n?()=>n+`ID`+ e++:`iconifyVue`),bo(`svg`,r)}let{body:u,width:d,height:f}=e,p=i===`mask`||(i===`bg`?!1:u.indexOf(`currentColor`)!==-1),m=Dl(u,{...l,width:d+``,height:f+``});return r.style={...a,"--svg":Al(m),width:zl(l.width),height:zl(l.height),...Nl,...p?Pl:Fl,...s},bo(`span`,r)};if(wc(!0),Uc(``,nl),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!Dc(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Yc(e,r)||console.error(n)}catch{console.error(n)}}}}var Vl={...cc,body:``},K=F((e,{emit:t})=>{let n=M(null);function r(){n.value&&=(n.value.abort?.(),null)}let i=M(!!e.ssr),a=M(``),o=ln(null);function s(){let i=e.icon;if(typeof i==`object`&&i&&typeof i.body==`string`)return a.value=``,{data:i};let o;if(typeof i!=`string`||(o=ic(i,!1,!0))===null)return null;let s=Tc(o);if(!s){let e=n.value;return(!e||e.name!==i)&&(s===null?n.value={name:i}:n.value={name:i,abort:Sl([o],c)}),null}r(),a.value!==i&&(a.value=i,zn(()=>{t(`load`,i)}));let l=e.customise;if(l){s=Object.assign({},s);let e=l(s.body,o.name,o.prefix,o.provider);typeof e==`string`&&(s.body=e)}let u=[`iconify`];return o.prefix!==``&&u.push(`iconify--`+o.prefix),o.provider!==``&&u.push(`iconify--`+o.provider),{data:s,classes:u}}function c(){let e=s();e?e.data!==o.value?.data&&(o.value=e):o.value=null}return i.value?c():Zr(()=>{i.value=!0,c()}),P(()=>e.icon,c),ti(r),()=>{let t=o.value;if(!t)return Bl(Vl,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),Bl({...cc,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),Hl=F({__name:`ContextMenu`,props:{pos:{},transform:{}},setup(e){return(t,n)=>(R(),B(yr,{to:`body`},[e.pos?(R(),z(`div`,{key:0,class:`ctx-menu fixed z-[1200] min-w-[140px] select-none rounded-lg bg-surface border border-border py-1 overflow-hidden`,style:k({left:`${e.pos.x}px`,top:`${e.pos.y}px`,transform:e.transform})},[fi(t.$slots,`default`)],4)):W(``,!0)]))}}),Ul={class:`h-8 px-3 border-b border-border flex items-center justify-between`},Wl={class:`section-title`},Gl={class:`p-3 overflow-y-auto`,style:{"max-height":`calc(100vh - 64px - 32px)`}},Kl=F({__name:`ModalWindow`,props:{title:{},width:{default:`480px`}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t;function i(e){e.target===e.currentTarget&&r(`close`)}return(e,t)=>(R(),B(yr,{to:`body`},[V(`div`,{class:`fixed inset-0 z-[9999] flex items-center justify-center bg-bg/80`,onMousedown:i},[V(`div`,{class:`border border-border bg-surface rounded shadow-lg`,style:k({width:n.width,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100vh - 64px)`})},[V(`div`,Ul,[V(`span`,Wl,j(n.title),1),V(`button`,{type:`button`,class:`text-[11px] text-muted hover:text-text transition-colors`,onClick:t[0]||=e=>r(`close`)},` x `)]),V(`div`,Gl,[fi(e.$slots,`default`)])],4)],32)]))}}),ql=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,Jl=M(null),Yl=M(!1);function Xl(e){e.preventDefault(),Jl.value=e}function Zl(){Yl.value=!0,Jl.value=null}typeof window<`u`&&(window.addEventListener(`beforeinstallprompt`,Xl),window.addEventListener(`appinstalled`,Zl));var Ql=/Android|iPhone|iPad|iPod/i.test(navigator.userAgent),$l=G(()=>Ql&&!ql&&!Yl.value),eu=/iPad|iPhone|iPod/.test(navigator.userAgent),tu=eu?[{icon:`lucide:share`,text:`tap the share button`},{icon:`lucide:plus-square`,text:`tap "add to home screen"`}]:[{icon:`lucide:ellipsis-vertical`,text:`tap the browser menu`},{icon:`lucide:download`,text:`tap "install app" or "add to home screen"`}];function nu(){let e=M(!1);function t(){Jl.value?(Jl.value.prompt(),Jl.value=null):e.value=!0}return{showInstall:$l,showA2hs:e,handleInstallClick:t,isIos:eu,a2hsSteps:tu}}var ru={key:1,class:`badge-ok`},iu={key:2,class:`fixed bottom-2.5 max-md:bottom-14 right-2.5 z-[10] flex gap-1.5`},au=[`title`],ou={class:`flex flex-col gap-2.5 mb-3`},su={class:`flex items-center justify-center w-6 h-6 rounded-md bg-white/10 shrink-0`},cu={class:`flex justify-end`},lu=F({__name:`FullscreenToggle`,props:{inlineInstall:{type:Boolean,default:!1}},setup(e){let t=e,n=!!document.documentElement.requestFullscreen,r=M(!!document.fullscreenElement);function i(){document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}function a(){r.value=!!document.fullscreenElement}Zr(()=>document.addEventListener(`fullscreenchange`,a)),ti(()=>document.removeEventListener(`fullscreenchange`,a));let{showInstall:o,showA2hs:s,handleInstallClick:c,a2hsSteps:l}=nu();return(e,a)=>(R(),z(L,null,[t.inlineInstall&&N(o)?(R(),z(`button`,{key:0,type:`button`,class:`btn-primary text-[11px] inline-flex items-center gap-1.5`,onClick:a[0]||=e=>N(c)()},[H(N(K),{icon:`lucide:download`,class:`text-[13px]`}),a[5]||=U(` add to home screen `,-1)])):t.inlineInstall?(R(),z(`span`,ru,`already installed`)):!t.inlineInstall&&(n||N(o))?(R(),z(`div`,iu,[N(o)?(R(),z(`button`,{key:0,type:`button`,tabindex:`-1`,class:`p-1 rounded bg-black/30 backdrop-blur-sm text-white/80 hover:text-white hover:bg-black/50 transition-all`,title:`install app`,onClick:a[1]||=e=>N(c)()},[H(N(K),{icon:`lucide:download`,class:`text-base`})])):W(``,!0),n?(R(),z(`button`,{key:1,type:`button`,tabindex:`-1`,class:`p-1 rounded bg-black/30 backdrop-blur-sm text-white/80 hover:text-white hover:bg-black/50 transition-all`,title:r.value?`exit fullscreen`:`enter fullscreen`,onClick:a[2]||=e=>i()},[H(N(K),{icon:r.value?`lucide:minimize`:`lucide:maximize`,class:`text-base`},null,8,[`icon`])],8,au)):W(``,!0)])):W(``,!0),N(s)?(R(),B(Kl,{key:3,title:`install app`,width:`340px`,onClose:a[4]||=e=>s.value=!1},{default:Zn(()=>[a[6]||=V(`p`,{class:`text-[12px] text-text mb-3`},` for the best experience, add this app to your home screen: `,-1),V(`div`,ou,[(R(!0),z(L,null,I(N(l),(e,t)=>(R(),z(`div`,{key:t,class:`flex items-center gap-2.5 text-[12px] text-muted`},[V(`span`,su,[H(N(K),{icon:e.icon,class:`text-sm text-text`},null,8,[`icon`])]),V(`span`,null,j(t+1)+`. `+j(e.text),1)]))),128))]),V(`div`,cu,[V(`button`,{class:`btn-ghost`,onClick:a[3]||=e=>s.value=!1},`close`)])]),_:1})):W(``,!0)],64))}});function uu(){let e=M(null),t;function n(t,n,r){e.value={x:t,y:n,data:r}}function r(){e.value=null}function i(e,t){e.preventDefault(),n(e.clientX,e.clientY,t)}function a(e,r){let{clientX:i,clientY:a}=e.touches[0];t=setTimeout(()=>{e.preventDefault(),n(i,a,r)},500)}function o(){clearTimeout(t)}function s(){e.value&&r()}return Zr(()=>document.addEventListener(`click`,s)),ti(()=>document.removeEventListener(`click`,s)),{menu:e,open:n,close:r,onContext:i,onTouchStart:a,cancelLongPress:o}}var du=`piclaw:settings`,fu=768;function pu(){return window.matchMedia(`(max-width: ${fu-1}px)`).matches}function mu(){return pu()?`small`:`large`}function hu(){return`grid`}const gu={enabled:!1,lang:`en-US`,rate:1.2,pitch:1,volume:1,voiceMatch:`Google | Samantha`};function _u(){return{theme:`system`,wallpaper:``,iconLayout:hu(),dockSize:mu(),showClock:!0,clockFormat:`24h`,showStatus:!0,showFullscreen:!0,showDesktopIcons:!1,pinnedApps:[`chat`,`terminal`,`files`,`notes`,`devices`,`agent`,`settings`,`welcome`],tts:{...gu}}}function vu(){let e=_u();try{let t=localStorage.getItem(du);if(t){let n=JSON.parse(t);return{...e,...n,tts:{...e.tts,...n.tts}}}}catch{}let t={...e},n=localStorage.getItem(`piclaw:desktop-bg`);n&&(t.wallpaper=n,localStorage.removeItem(`piclaw:desktop-bg`));let r=localStorage.getItem(`piclaw:icon-layout`);return(r===`list`||r===`grid`)&&(t.iconLayout=r,localStorage.removeItem(`piclaw:icon-layout`)),localStorage.getItem(`chat-tts`)===`1`&&(t.tts={...t.tts,enabled:!0},localStorage.removeItem(`chat-tts`)),t}var yu=Yt(vu());function bu(){localStorage.setItem(du,JSON.stringify(yu))}P(yu,bu,{deep:!0});function xu(e){window.dispatchEvent(new CustomEvent(`piclaw:settings:${e}`,{detail:yu[e]}))}function Su(){return{settings:yu,set(e){for(let[t,n]of Object.entries(e))yu[t]=n,xu(t)},reset(){Object.assign(yu,_u()),bu()}}}var Cu=window.matchMedia(`(prefers-color-scheme: dark)`);function wu(){let{settings:e}=Su(),t=G(()=>e.theme===`system`?Cu.matches?`dark`:`light`:e.theme);function n(){let e=t.value;e===`dark`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e}return P(t,n,{immediate:!0}),Cu.addEventListener(`change`,n),{effective:t}}const Tu=Symbol(`windowState`),Eu=Symbol(`instanceId`);function Du(e){let t=tr(Tu);if(!t)throw Error(`useWindowState requires windowStateKey to be provided`);let n=tr(Eu),r=G(()=>e??n?.value??``);return{instanceId:r,state:G(()=>t.windowState[r.value]??{}),set:e=>{r.value&&t.setWindowState(r.value,e)},setTitle:e=>{r.value&&t.setWindowTitle(r.value,e)},close:()=>{r.value&&t.closeWindow(r.value)},setWindowState:t.setWindowState,setWindowTitle:t.setWindowTitle,bringToFront:t.bringToFront,openWindow:t.openWindow,closeWindow:t.closeWindow}}var Ou={key:1,class:`fixed bottom-3 max-md:bottom-[3.25rem] right-10 max-md:right-3 z-[1] text-[11px] text-white/70 pointer-events-none select-none`,style:{"text-shadow":`0 1px 3px rgba(0, 0, 0, 0.8)`},"aria-hidden":`true`},ku={key:0,class:`absolute inset-0 flex items-center justify-center pointer-events-none select-none`,"aria-hidden":`true`},Au=[`onClick`],ju=F({__name:`AppDesktop`,props:{apps:{},openInstances:{}},emits:[`launch`,`ctxAction`],setup(e,{expose:t,emit:n}){let r=n,{settings:i,set:a}=Su(),{effective:o}=wu(),s=G(()=>i.wallpaper),c=G(()=>!s.value&&o.value===`light`),l=G(()=>i.iconLayout);function u(){a({iconLayout:i.iconLayout===`list`?`grid`:`list`}),h()}let{menu:d,onContext:f,onTouchStart:p,cancelLongPress:m,close:h}=uu();function g(e){let t=e.target;return t===e.currentTarget||t.closest?.(`button`)===null}function _(e){g(e)&&f(e,void 0)}function v(e){g(e)&&p(e,void 0)}function y(e){h(),r(`ctxAction`,e)}function b(){h(),globalThis.location.reload()}Zr(async()=>{if(!(i.wallpaper||localStorage.getItem(`piclaw:settings`)))try{let e=await(await fetch(`/proxy/wallhaven/search?categories=100&purity=100&sorting=toplist&order=desc&ratios=16x9&per_page=24`)).json();if(e.data?.length){let t=e.data[Math.floor(Math.random()*e.data.length)];a({wallpaper:t.path})}}catch{}}),t({closeCtxMenu:h});let x=F({props:{instanceId:{type:String,required:!0}},setup(e,{slots:t}){return er(Eu,vn(()=>e.instanceId)),()=>t.default?.()}});return(t,n)=>(R(),z(L,null,[s.value?(R(),z(`div`,{key:0,class:`fixed inset-0 bg-cover bg-center pointer-events-none select-none z-0`,style:k({backgroundImage:`url(${s.value})`}),"aria-hidden":`true`},null,4)):W(``,!0),s.value?.includes(`wallhaven.cc`)?(R(),z(`span`,Ou,`wallhaven.cc`)):W(``,!0),V(`div`,{class:`flex-1 min-h-0 p-4 max-md:p-0 relative h-full overflow-hidden select-none`,onContextmenu:_,onTouchstart:v,onTouchend:n[0]||=(...e)=>N(m)&&N(m)(...e),onTouchmove:n[1]||=(...e)=>N(m)&&N(m)(...e)},[s.value?W(``,!0):(R(),z(`div`,ku,[...n[4]||=[V(`svg`,{class:`text-surface w-[min(55vw,55vh)] h-[min(55vw,55vh)]`,viewBox:`0 0 200 200`,fill:`none`,stroke:`currentColor`,"stroke-width":`3.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M 30 55 Q 60 48, 100 50 Q 140 52, 170 47`}),V(`path`,{d:`M 65 50 Q 58 90, 55 120 Q 52 145, 48 170`}),V(`path`,{d:`M 125 50 Q 130 90, 132 120 Q 134 150, 140 175`})],-1)]])),N(i).showDesktopIcons?(R(),z(`div`,{key:1,class:A([`absolute z-[5] pointer-events-none`,l.value===`grid`?`inset-4 grid grid-cols-4 justify-items-center content-start gap-3 md:flex md:flex-wrap md:justify-center`:`top-4 right-4 left-auto flex flex-col gap-1.5 items-end max-md:flex-wrap-reverse max-md:max-h-[calc((theme(spacing.18)+theme(spacing.1.5))*4)] max-md:gap-x-3`])},[(R(!0),z(L,null,I(e.apps.filter(e=>!e.hidden),e=>(R(),z(`button`,{key:`desktop-${e.key}`,type:`button`,tabindex:-1,class:A([`pointer-events-auto px-2 py-2 rounded text-center transition-colors`,[l.value===`grid`?`w-22 text-[12px]`:`w-18 text-[11px]`,c.value?`text-text hover:text-text`:`text-white/90 hover:text-white`]]),onClick:t=>r(`launch`,e.key)},[H(N(K),{icon:e.icon,class:A([`mx-auto`,[l.value===`grid`?`text-2xl`:`text-xl`,c.value?``:`drop-shadow-[0_1px_3px_rgba(0,0,0,0.8)]`]]),style:k({color:c.value&&e.lightColor?e.lightColor:e.color})},null,8,[`icon`,`class`,`style`]),V(`div`,{class:`mt-1 truncate`,style:k(c.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5)`})},j(e.label),5)],10,Au))),128))],2)):W(``,!0),(R(!0),z(L,null,I(e.openInstances,e=>(R(),B(yr,{key:e.id,to:e.mountTarget},[H(N(x),{"instance-id":e.id},{default:Zn(()=>[(R(),B(li(e.app.component)))]),_:2},1032,[`instance-id`])],8,[`to`]))),128))],32),N(i).showFullscreen?(R(),B(lu,{key:2})):W(``,!0),H(Hl,{pos:N(d)??null},{default:Zn(()=>[V(`button`,{type:`button`,class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:n[2]||=e=>b()},` Reload `),N(i).showDesktopIcons?(R(),z(`button`,{key:0,type:`button`,class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:u},j(l.value===`list`?`Grid layout`:`List layout`),1)):W(``,!0),V(`button`,{type:`button`,class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:n[3]||=e=>y(`settings`)},` Settings `)]),_:1},8,[`pos`])],64))}}),Mu=``;async function Nu(e,t){try{let n=await fetch(Mu+e,{...t,credentials:`include`});if(!n.ok)throw Error(await n.text());return await n.json()}catch(e){return console.error(`API error:`,e),null}}async function Pu(e,t){return await Nu(e,t)||null}var Fu=M(`loading`),Iu=M(null),Lu=!1;function Ru(){return Lu||(Lu=!0,zu()),{status:Zt(Fu),device:Zt(Iu),checkAuth:zu,waitForApproval:Bu}}async function zu(){let e=await Pu(`/api/auth/status`);if(!e){Fu.value=`unknown`;return}Iu.value=e.device,Fu.value=e.status,e.status===`pending`&&Bu()}function Bu(){let e=new EventSource(`/api/auth/wait`,{withCredentials:!0});e.addEventListener(`approved`,()=>{Fu.value=`approved`,e.close()}),e.addEventListener(`error`,()=>{})}var Vu={key:0,class:`auth-gate`},Hu={key:1,class:`auth-gate`},Uu={class:`border border-border rounded-lg p-6 max-w-sm w-full text-center`},Wu={key:0,class:`text-[11px] text-muted mb-4 font-mono`},Gu={key:0,class:`ml-2 text-success opacity-80`},Ku={key:3,class:`auth-gate`},qu=F({__name:`AuthGate`,setup(e){let{status:t,device:n}=Ru(),r=M(!1);function i(){n.value&&(navigator.clipboard.writeText(`npx piclaw device approve ${n.value.id}`),r.value=!0,setTimeout(()=>r.value=!1,1500))}return(e,a)=>N(t)===`loading`?(R(),z(`div`,Vu,[...a[0]||=[V(`div`,{class:`text-muted text-[13px]`},`connecting...`,-1)]])):N(t)===`pending`?(R(),z(`div`,Hu,[V(`div`,Uu,[a[2]||=V(`div`,{class:`text-[16px] font-medium text-text mb-2`},`device pending approval`,-1),a[3]||=V(`div`,{class:`text-[12px] text-muted mb-4`},` this device needs to be approved by an existing session or the server console. `,-1),N(n)?(R(),z(`div`,Wu,j(N(n).name)+` · `+j(N(n).id.slice(0,8)),1)):W(``,!0),a[4]||=V(`div`,{class:`flex items-center justify-center gap-2 text-[12px] text-muted mb-3`},[V(`span`,{class:`inline-block w-2 h-2 rounded-full bg-warn animate-pulse`}),U(` waiting for approval... `)],-1),N(n)?(R(),z(`div`,{key:1,class:`bg-[#1a1a1a] border border-border rounded px-3 py-2 font-mono text-[11px] text-muted cursor-pointer select-all hover:border-text/30 transition-colors`,title:`Click to copy`,onClick:i},[a[1]||=V(`span`,{class:`opacity-50`},`$ `,-1),U(`npx piclaw device approve `+j(N(n).id)+` `,1),r.value?(R(),z(`span`,Gu,`copied!`)):W(``,!0)])):W(``,!0)])])):N(t)===`approved`?fi(e.$slots,`default`,{key:2},void 0,!0):(R(),z(`div`,Ku,[...a[5]||=[V(`div`,{class:`text-danger text-[13px]`},`unable to connect. please refresh.`,-1)]]))}}),Ju=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Yu=Ju(qu,[[`__scopeId`,`data-v-8f0a1990`]]),Xu=M();function Zu(){function e(e){return new Promise(t=>{Xu.value={message:e,resolve:t}})}function t(e){return new Promise(t=>{Xu.value={message:e,alertOnly:!0,resolve:()=>t()}})}function n(){Xu.value?.resolve(!0),Xu.value=void 0}function r(){Xu.value?.resolve(!1),Xu.value=void 0}return{state:Xu,confirm:e,alert:t,accept:n,cancel:r}}var Qu={class:`text-[12px] text-text mb-3`},$u={class:`flex gap-2 items-center justify-end`},ed=F({__name:`ConfirmDialog`,setup(e){let{state:t,accept:n,cancel:r}=Zu(),i=M();P(t,async e=>{e&&(await zn(),i.value?.focus())});function a(e){t.value&&(e.key===`Enter`?(e.preventDefault(),n()):e.key===`Escape`&&(e.preventDefault(),r()))}return Zr(()=>window.addEventListener(`keydown`,a)),ti(()=>window.removeEventListener(`keydown`,a)),(e,a)=>N(t)?(R(),B(Kl,{key:0,title:N(t).alertOnly?`notice`:`confirm`,width:`360px`,onClose:N(r)},{default:Zn(()=>[V(`p`,Qu,j(N(t).message),1),V(`div`,$u,[N(t).alertOnly?(R(),z(`button`,{key:0,ref_key:`primaryBtn`,ref:i,type:`button`,class:`btn-primary`,onClick:a[0]||=(...e)=>N(n)&&N(n)(...e)},[...a[3]||=[U(` ok `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]],512)):(R(),z(L,{key:1},[V(`button`,{type:`button`,class:`btn-ghost`,onClick:a[1]||=(...e)=>N(r)&&N(r)(...e)},[...a[4]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]]),V(`button`,{ref_key:`primaryBtn`,ref:i,type:`button`,class:`btn-danger`,onClick:a[2]||=(...e)=>N(n)&&N(n)(...e)},[...a[5]||=[U(` confirm `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]],512)],64))])]),_:1},8,[`title`,`onClose`])):W(``,!0)}}),td={key:0,class:`dock-tooltip`},nd=Ju(F({__name:`DockTooltip`,props:{text:{}},setup(e){let t=e,n=M(!1),r;function i(){r=setTimeout(()=>{n.value=!0},400)}function a(){clearTimeout(r),n.value=!1}return(e,r)=>(R(),z(`div`,{class:`relative inline-flex`,onPointerenter:i,onPointerleave:a},[fi(e.$slots,`default`,{},void 0,!0),H(Fo,{name:`tooltip`},{default:Zn(()=>[n.value?(R(),z(`span`,td,j(t.text),1)):W(``,!0)]),_:1})],32))}}),[[`__scopeId`,`data-v-a1d90d45`]]),rd=768;function id(){let e=M(window.innerWidth<rd),t=window.matchMedia(`(max-width: ${rd-1}px)`),n=t=>{e.value=t.matches};return t.addEventListener(`change`,n),Le(()=>t.removeEventListener(`change`,n)),e}function ad(){let e=window.matchMedia(`(pointer: coarse)`),t=M(e.matches),n=e=>{t.value=e.matches};return e.addEventListener(`change`,n),Le(()=>e.removeEventListener(`change`,n)),t}var od=new Set;function sd(e){for(let t of od)t(e)}function cd(e){return od.add(e),()=>od.delete(e)}function ld(e,t){let n=Array.isArray(e)?e:[e];Zr(()=>t());let r=cd(e=>{n.includes(e.topic)&&t()});function i(){document.visibilityState===`visible`&&t()}document.addEventListener(`visibilitychange`,i),ti(()=>{r(),document.removeEventListener(`visibilitychange`,i)})}var ud=M({connectionId:null,device:null,devices:[],connected:!1,takenOver:!1}),dd,fd=0;function pd(){dd||(dd=new EventSource(`/api/device-events`,{withCredentials:!0}),dd.addEventListener(`snapshot`,e=>{let t=JSON.parse(e.data);ud.value={connectionId:t.connectionId,device:t.device,devices:t.devices,connected:!0,takenOver:!1}}),dd.addEventListener(`device_connected`,e=>{let t=JSON.parse(e.data);ud.value={...ud.value,devices:[...ud.value.devices.filter(e=>e.deviceId!==t.deviceId),{deviceId:t.deviceId,name:t.deviceName,connections:t.connections??1}]}}),dd.addEventListener(`device_disconnected`,e=>{let t=JSON.parse(e.data);ud.value={...ud.value,devices:ud.value.devices.filter(e=>e.deviceId!==t.deviceId)}}),dd.addEventListener(`connection_added`,e=>{let t=JSON.parse(e.data),n=ud.value.device&&t.deviceId===ud.value.device.id,r=t.connectionId&&t.connectionId!==ud.value.connectionId;ud.value={...ud.value,devices:ud.value.devices.map(e=>e.deviceId===t.deviceId?{...e,connections:t.connections}:e),takenOver:n&&r?!0:ud.value.takenOver}}),dd.addEventListener(`connection_removed`,e=>{let t=JSON.parse(e.data);ud.value={...ud.value,devices:ud.value.devices.map(e=>e.deviceId===t.deviceId?{...e,connections:t.connections}:e)}}),dd.addEventListener(`device_event`,e=>{sd(JSON.parse(e.data))}),dd.addEventListener(`error`,()=>{ud.value={...ud.value,connected:!1}}))}function md(){dd?.close(),dd=void 0,ud.value={connectionId:null,device:null,devices:[],connected:!1,takenOver:!1}}function hd(e){if(fd++,e){let t=P(e,e=>{e===`approved`?pd():md()},{immediate:!0});ti(()=>{t(),fd--,fd===0&&md()})}else pd(),ti(()=>{fd--,fd===0&&md()});return{presence:Zt(ud)}}var gd={class:`flex flex-col h-full overflow-y-auto`},_d={class:`p-3`},vd={key:0,class:`text-[12px] text-muted`},yd={key:1,class:`text-[12px] text-muted`},bd={key:2,class:`w-full border-collapse text-[12px]`},xd={class:`py-1.5 px-2 border-b border-border font-medium`},Sd={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},Cd={class:`py-1.5 px-2 border-b border-border`},wd={class:`py-1.5 px-2 border-b border-border text-right`},Td=[`disabled`,`onClick`],Ed=[`disabled`,`onClick`],Dd={class:`px-3 pb-3`},Od={key:0,class:`text-[12px] text-muted`},kd={key:1,class:`w-full border-collapse text-[12px]`},Ad={class:`py-1.5 px-2 border-b border-border font-medium`},jd={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},Md={class:`py-1.5 px-2 border-b border-border`},Nd={class:`py-1.5 px-2 border-b border-border text-right whitespace-nowrap`},Pd=[`disabled`,`onClick`],Fd=[`onClick`],Id=[`onClick`],Ld={key:0,class:`mb-3 text-center`},Rd={key:0,class:`text-[11px] text-muted mb-2`},zd={key:1,class:`text-[11px] text-muted mb-2`},Bd=[`href`],Vd={key:1,class:`mb-3`},Hd={class:`text-[11px] text-muted`},Ud={key:2,class:`mb-3`},Wd={class:`text-[11px] text-muted mb-1`},Gd=[`placeholder`],Kd=[`disabled`],qd={key:3,class:`text-[11px] text-muted`},Jd={key:4,class:`text-[11px] text-ok`},Yd={key:5,class:`text-[11px] text-danger`},Xd={class:`mb-3`},Zd={class:`text-[11px] text-muted mb-1`},Qd={class:`font-medium text-text`},$d={class:`text-[10px] text-muted mb-1`},ef={class:`font-mono text-accent`},tf={key:0,class:`text-[10px] text-muted`},nf={key:0},rf=[`href`],af=[`disabled`],of=F({__name:`AuthTab`,setup(e){let t=M(null),n=M(!1),r=M(null),i=M(null),a=M(null),o=M([]),s=M(!1),c=M(``),l=M(null),u=null,d=M([]),f=M(null),p=M(``),m=M(!1),h=M(null),g=G(()=>t.value?t.value.oauthProviders.map(e=>{let n=t.value.providers.find(t=>t.provider===e.id);return{...e,hasAuth:n?.hasAuth??!1}}):[]),_=G(()=>s.value?null:x(`prompt`)?.prompt??null),v=G(()=>x(`progress`)?.message??null),y=G(()=>s.value?null:x(`auth`)?.authInfo??null),b=G(()=>x(`error`)?.error??null);function x(e){return[...o.value].reverse().find(t=>t.type===e)}let S=G(()=>o.value.some(e=>e.type===`complete`));async function C(){let e=await Pu(`/api/pi/status`);e&&(t.value=e.auth)}async function ee(){let e=await Pu(`/api/pi/apikey-providers`);e&&(d.value=e)}function w(){C(),ee()}ld(`pi_status`,w);async function T(e){te(),i.value=e,o.value=[],s.value=!1,c.value=``,n.value=!0;try{let t=await Nu(`/api/pi/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e})});if(!t?.loginId){o.value.push({type:`error`,error:`Failed to start login`}),s.value=!0;return}a.value=t.loginId,u=new EventSource(`/api/pi/login/events?loginId=${t.loginId}`,{withCredentials:!0}),u.onmessage=e=>{try{let t=JSON.parse(e.data);o.value.push(t),(t.type===`complete`||t.type===`error`)&&(s.value=!0,te(),t.type===`complete`&&w())}catch{}},u.onerror=()=>{s.value||=(o.value.push({type:`error`,error:`Connection lost`}),!0),te()}}catch(e){o.value.push({type:`error`,error:e instanceof Error?e.message:`Login failed`}),s.value=!0}finally{n.value=!1}}async function E(){if(!a.value)return;let e=c.value;c.value=``,await Nu(`/api/pi/login/respond`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginId:a.value,value:e})})}function D(){te(),i.value=null,a.value=null,o.value=[],s.value=!1}function te(){u&&=(u.close(),null)}async function ne(e){r.value=e;try{await Nu(`/api/pi/logout`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}),w()}finally{r.value=null}}function re(e){f.value=e,p.value=``,m.value=!1,zn(()=>h.value?.focus())}function ie(){f.value=null,p.value=``,m.value=!1}async function O(){if(!(!f.value||!p.value.trim())){m.value=!0;try{await Nu(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:f.value.id,key:p.value.trim()})}),ie(),w()}finally{m.value=!1}}}async function ae(e){r.value=e;try{await Nu(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e,key:null})}),w()}finally{r.value=null}}return P(_,e=>{e&&zn(()=>l.value?.focus())}),(e,a)=>(R(),z(L,null,[V(`div`,gd,[V(`div`,_d,[a[2]||=V(`h3`,{class:`section-title mb-2 select-none`},`oauth providers`,-1),t.value?g.value.length===0?(R(),z(`div`,yd,` no oauth providers available `)):(R(),z(`table`,bd,[V(`tbody`,null,[(R(!0),z(L,null,I(g.value,e=>(R(),z(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,xd,j(e.name),1),V(`td`,Sd,j(e.id),1),V(`td`,Cd,[V(`span`,{class:A(e.hasAuth?`badge-ok`:`badge-muted`)},j(e.hasAuth?`connected`:`not connected`),3)]),V(`td`,wd,[e.hasAuth?(R(),z(`button`,{key:0,type:`button`,disabled:r.value===e.id,class:`btn-sm border-danger-dim text-danger bg-danger-dim hover:text-text disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>ne(e.id)},j(r.value===e.id?`...`:`logout`),9,Td)):(R(),z(`button`,{key:1,type:`button`,disabled:n.value&&i.value===e.id,class:`btn-sm border-accent-dim text-accent bg-accent-dim hover:bg-accent-dimmer disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>T(e.id)},j(n.value&&i.value===e.id?`...`:`login`),9,Ed))])]))),128))])])):(R(),z(`div`,vd,`loading...`))]),V(`div`,Dd,[a[3]||=V(`h3`,{class:`section-title mb-2 select-none`},`api keys`,-1),d.value.length===0?(R(),z(`div`,Od,`loading...`)):(R(),z(`table`,kd,[V(`tbody`,null,[(R(!0),z(L,null,I(d.value,e=>(R(),z(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,Ad,j(e.name),1),V(`td`,jd,j(e.envVar),1),V(`td`,Md,[V(`span`,{class:A(e.hasAuth?`badge-ok`:`badge-muted`)},j(e.hasAuth?`configured`:`not set`),3)]),V(`td`,Nd,[e.hasAuth?(R(),z(`button`,{key:0,type:`button`,disabled:r.value===e.id,class:`btn-sm border-danger-dim text-danger bg-danger-dim hover:text-text disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>ae(e.id)},j(r.value===e.id?`...`:`remove`),9,Pd)):W(``,!0),e.hasAuth?W(``,!0):(R(),z(`button`,{key:1,type:`button`,class:`btn-sm border-accent-dim text-accent bg-accent-dim hover:bg-accent-dimmer`,onClick:t=>re(e)},` set key `,8,Fd)),e.hasAuth?(R(),z(`button`,{key:2,type:`button`,class:`ml-1 btn-sm`,onClick:t=>re(e)},` update `,8,Id)):W(``,!0)])]))),128))])]))])]),i.value?(R(),B(Kl,{key:0,title:`login — ${i.value}`,width:`420px`,onClose:D},{default:Zn(()=>[y.value?(R(),z(`div`,Ld,[y.value.instructions?(R(),z(`p`,Rd,j(y.value.instructions),1)):(R(),z(`p`,zd,` open this url in your browser to authenticate: `)),V(`a`,{href:y.value.url,target:`_blank`,rel:`noopener`,class:`btn-primary inline-block text-[11px]`},` open in browser -> `,8,Bd)])):W(``,!0),v.value&&!s.value?(R(),z(`div`,Vd,[V(`p`,Hd,j(v.value),1)])):W(``,!0),_.value?(R(),z(`div`,Ud,[V(`p`,Wd,j(_.value.message),1),V(`form`,{class:`flex gap-2`,onSubmit:Js(E,[`prevent`]),onKeydown:Xs(D,[`escape`])},[Qn(V(`input`,{ref_key:`promptInputEl`,ref:l,"onUpdate:modelValue":a[0]||=e=>c.value=e,placeholder:_.value.placeholder||``,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,8,Gd),[[Hs,c.value]]),V(`button`,{type:`submit`,disabled:!c.value.trim()&&!_.value.allowEmpty,class:`btn-primary text-[11px] disabled:text-muted disabled:bg-surface disabled:border-border`},` submit `,8,Kd)],32)])):W(``,!0),!s.value&&!y.value&&!_.value&&!v.value?(R(),z(`div`,qd,` connecting... `)):W(``,!0),S.value?(R(),z(`div`,Jd,`login successful`)):W(``,!0),b.value?(R(),z(`div`,Yd,j(b.value),1)):W(``,!0)]),_:1},8,[`title`])):W(``,!0),f.value?(R(),B(Kl,{key:1,title:`${f.value.name} — api key`,width:`420px`,onClose:ie},{default:Zn(()=>[V(`div`,Xd,[V(`p`,Zd,[a[4]||=U(` enter your API key for `,-1),V(`span`,Qd,j(f.value.name),1)]),V(`p`,$d,[a[5]||=U(` env: `,-1),V(`code`,ef,j(f.value.envVar),1)]),f.value.url?(R(),z(`p`,tf,[f.value.guide?(R(),z(`span`,nf,j(f.value.guide)+` — `,1)):W(``,!0),V(`a`,{href:f.value.url,target:`_blank`,rel:`noopener`,class:`text-accent hover:underline`},`LINK`,8,rf)])):W(``,!0)]),V(`form`,{class:`flex gap-2`,onSubmit:Js(O,[`prevent`]),onKeydown:Xs(ie,[`escape`])},[Qn(V(`input`,{ref_key:`apiKeyInputEl`,ref:h,"onUpdate:modelValue":a[1]||=e=>p.value=e,type:`password`,placeholder:`sk-...`,autocomplete:`off`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,512),[[Hs,p.value]]),V(`button`,{type:`submit`,disabled:!p.value.trim()||m.value,class:`btn-primary text-[11px] disabled:text-muted disabled:bg-surface disabled:border-border`},j(m.value?`...`:`save`),9,af)],32)]),_:1},8,[`title`])):W(``,!0)],64))}}),sf=0;function cf(){return`node_${++sf}`}function lf(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function uf(e,t,n,r,i){let a=cf(),o=n?`${n}/${e}`:`/${e}`,s=lf(t),c={id:a,key:e,path:o,type:s,value:s===`object`||s===`array`?void 0:t,children:[],parentId:r};if(i.set(a,c),s===`object`&&t!==null){let e=t;c.children=Object.keys(e).map(t=>uf(t,e[t],o,a,i))}else s===`array`&&(c.children=t.map((e,t)=>uf(String(t),e,o,a,i)));return c}function df(e){let t=new Map,n=lf(e),r={id:cf(),key:``,path:`/`,type:n,value:n===`object`||n===`array`?void 0:e,children:[],parentId:null};if(t.set(r.id,r),n===`object`&&e!==null){let n=e;r.children=Object.keys(n).map(e=>uf(e,n[e],``,r.id,t))}else n===`array`&&(r.children=e.map((e,n)=>uf(String(n),e,``,r.id,t)));return{root:r,nodesById:t}}function ff(e){switch(e.type){case`object`:{let t={};for(let n of e.children)t[n.key]=ff(n);return t}case`array`:return e.children.map(e=>ff(e));default:return e.value}}function pf(e,t,n,r){let i=n?`${n}/${t}`:`/${t}`;return{...e,key:t,path:i,parentId:r,children:e.children.map((t,n)=>pf(t,e.type===`array`?String(n):t.key,i,e.id))}}function mf(e,t,n){let r=e.nodesById.get(t);for(;r;){if(r.id===n)return!0;r=r.parentId?e.nodesById.get(r.parentId):void 0}return!1}function hf(e){let t=new Map;function n(e){t.set(e.id,e);for(let t of e.children)n(t)}return n(e),t}function gf(e,t){let n=t?`${t}/${e.key}`:`/${e.key}`;return e.path===n&&e.children.length===0?e:{...e,path:n,children:e.children.map(e=>gf(e,n))}}function _f(e,t,n){let r=[],i=e.nodesById.get(t);for(;i;)r.unshift(i.id),i=i.parentId?e.nodesById.get(i.parentId):void 0;if(r.length===0)return e;function a(e,t){if(t===r.length-1)return n(e);let i=r[t+1];return{...e,children:e.children.map(e=>e.id===i?a(e,t+1):e)}}let o=a(e.root,0);return{root:o,nodesById:hf(o)}}function vf(e){if(e.type!==`array`)return e;let t=e.path===`/`?``:e.path;return{...e,children:e.children.map((e,n)=>{let r=String(n);return e.key===r?e:gf({...e,key:r},t)})}}function yf(e,t,n){if(!e.nodesById.get(t))return e;let r=lf(n);return r!==`object`&&r!==`array`?_f(e,t,e=>({...e,type:r,value:n,children:[]})):_f(e,t,e=>{let t=e.path.split(`/`).slice(0,-1).join(`/`)||``,r=new Map;return{...uf(e.key,n,t,e.parentId,r),id:e.id}})}function bf(e,t,n){let r=e.nodesById.get(t);if(!r||!r.parentId)return e;let i=e.nodesById.get(r.parentId);return!i||i.type!==`object`?e:_f(e,t,e=>{let t=`${i.path===`/`?``:i.path}/${n}`,r={...e,key:n,path:t};return r.children.length>0&&(r.children=r.children.map(e=>gf(e,t))),r})}function xf(e,t,n,r){return e.nodesById.get(t)?_f(e,t,e=>{let t=uf(n,r,e.path===`/`?``:e.path,e.id,new Map);return{...e,children:[...e.children,t]}}):e}function Sf(e,t,n,r){return e.nodesById.get(t)?_f(e,t,e=>{let t=e.path===`/`?``:e.path,i=pf(n,e.type===`array`?String(r):n.key,t,e.id),a=[...e.children];return a.splice(r,0,i),vf({...e,children:a})}):e}function Cf(e,t){let n=e.nodesById.get(t);return!n||!n.parentId?e:_f(e,n.parentId,e=>{let n=e.children.filter(e=>e.id!==t);return vf({...e,children:n})})}function wf(e,t,n,r,i){if(!e.nodesById.get(t))return e;let a=new Set(n);return _f(e,t,e=>{let t=e.children.filter(e=>!a.has(e.id)),o=t.findIndex(e=>e.id===r);if(o===-1)if(a.has(r)){let n=e.children.findIndex(e=>e.id===r),a=new Map(e.children.map((e,t)=>[e.id,t]));i===`after`?(o=t.findIndex(e=>(a.get(e.id)??-1)>n),o===-1&&(o=t.length)):(o=t.findIndex(e=>(a.get(e.id)??-1)>=n),o===-1&&(o=t.length))}else o=i===`after`?t.length:0;else i===`after`&&o++;let s=n.map(t=>e.children.find(e=>e.id===t)).filter(e=>e!==void 0),c=[...t];return c.splice(o,0,...s),vf({...e,children:c})})}function Tf(e,t){switch(t){case`string`:return e==null?``:typeof e==`object`?JSON.stringify(e):String(e);case`number`:{let t=Number(e);return isNaN(t)?0:t}case`boolean`:return!!e;case`null`:return null;case`object`:if(typeof e==`object`&&e&&!Array.isArray(e))return e;if(Array.isArray(e)){let t={};return e.forEach((e,n)=>{t[String(n)]=e}),t}return{};case`array`:return Array.isArray(e)?e:typeof e==`object`&&e?Object.values(e):e==null?[]:[e];default:return e}}function Ef(e,t,n){let r=e.nodesById.get(t);return r?yf(e,t,Tf(ff(r),n)):e}function Df(e,t){let n=e.nodesById.get(t);if(!n||!n.parentId||!e.nodesById.get(n.parentId))return e;let r=ff(n);return _f(e,n.parentId,e=>{let i=e.children.findIndex(e=>e.id===t),a=e.path===`/`?``:e.path,o=uf(e.type===`array`?String(i+1):`${n.key}_copy`,structuredClone(r),a,e.id,new Map),s=[...e.children];return s.splice(i+1,0,o),vf({...e,children:s})})}var Of=100,kf=class{constructor(){this.stack=[],this.cursor=-1}push(e){this.stack=this.stack.slice(0,this.cursor+1),this.stack.push(e),this.stack.length>Of?this.stack.shift():this.cursor++}undo(){return this.canUndo?(this.cursor--,this.stack[this.cursor]):null}redo(){return this.canRedo?(this.cursor++,this.stack[this.cursor]):null}get canUndo(){return this.cursor>0}get canRedo(){return this.cursor<this.stack.length-1}get current(){return this.stack[this.cursor]??null}};function Af(e,t){if(!t.startsWith(`#/`))return;let n=t.slice(2).split(`/`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return r}function jf(e,t,n){let r=n??new Set;if(e.$ref){if(r.has(e.$ref))return e;r.add(e.$ref);let n=Af(t,e.$ref);return n?jf(n,t,r):e}return e.allOf&&e.allOf.length>0?Mf(e,t,r):e}function Mf(e,t,n){let r={...e};delete r.allOf;for(let i of e.allOf){let e=jf(i,t,new Set(n));e.type&&!r.type&&(r.type=e.type),e.properties&&(r.properties={...r.properties,...e.properties}),e.required&&(r.required=[...new Set([...r.required??[],...e.required])]),e.additionalProperties!==void 0&&r.additionalProperties===void 0&&(r.additionalProperties=e.additionalProperties),e.items&&!r.items&&(r.items=e.items),e.description&&!r.description&&(r.description=e.description),e.title&&!r.title&&(r.title=e.title),e.enum&&!r.enum&&(r.enum=e.enum),e.minimum!==void 0&&r.minimum===void 0&&(r.minimum=e.minimum),e.maximum!==void 0&&r.maximum===void 0&&(r.maximum=e.maximum),e.minLength!==void 0&&r.minLength===void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&r.maxLength===void 0&&(r.maxLength=e.maxLength),e.pattern&&!r.pattern&&(r.pattern=e.pattern),e.format&&!r.format&&(r.format=e.format)}return r}function Nf(e,t,n){let r=n??e,i=t.split(`/`).filter(Boolean),a=jf(e,r);for(let e of i){if(!a)return;if(a=jf(a,r),a.properties?.[e]){a=jf(a.properties[e],r);continue}if(a.patternProperties){let t=Object.entries(a.patternProperties).find(([t])=>{try{return new RegExp(t).test(e)}catch{return!1}});if(t){a=jf(t[1],r);continue}}if(a.additionalProperties&&typeof a.additionalProperties==`object`){a=jf(a.additionalProperties,r);continue}if(a.items)if(Array.isArray(a.items)){let t=Number(e);if(!isNaN(t)&&a.items[t]){a=jf(a.items[t],r);continue}}else{a=jf(a.items,r);continue}if(a.anyOf||a.oneOf){let t=a.anyOf??a.oneOf??[],n;for(let i of t)if(n=Nf(jf(i,r),e,r),n)break;if(n){a=n;continue}return}return}return a}function Pf(e,t){if(!t.trim())return[];let n=[],r=t.toLowerCase();function i(e){e.key&&e.key.toLowerCase().includes(r)&&n.push({nodeId:e.id,field:`key`}),e.value!==void 0&&e.value!==null&&String(e.value).toLowerCase().includes(r)&&n.push({nodeId:e.id,field:`value`});for(let t of e.children)i(t)}return i(e.root),n}function Ff(e,t){let n=new Set;for(let r of t){let t=e.nodesById.get(r);for(;t&&t.parentId;)n.add(t.parentId),t=e.nodesById.get(t.parentId)}return n}function If(e,t,n=``){let r=[];if(e===t)return r;if(e===null||t===null||typeof e!=typeof t||Array.isArray(e)!==Array.isArray(t))return n?r.push({path:n,type:`changed`,oldValue:e,newValue:t}):Lf(e,t,n,r),r;if(typeof e!=`object`)return e!==t&&r.push({path:n||`/`,type:`changed`,oldValue:e,newValue:t}),r;if(Array.isArray(e)&&Array.isArray(t)){let i=Math.max(e.length,t.length);for(let a=0;a<i;a++){let i=n?`${n}/${a}`:`/${a}`;a>=e.length?r.push({path:i,type:`added`,newValue:t[a]}):a>=t.length?r.push({path:i,type:`removed`,oldValue:e[a]}):r.push(...If(e[a],t[a],i))}return r}return Lf(e,t,n,r),r}function Lf(e,t,n,r){let i=typeof e==`object`&&e&&!Array.isArray(e)?e:{},a=typeof t==`object`&&t&&!Array.isArray(t)?t:{},o=new Set([...Object.keys(i),...Object.keys(a)]);for(let e of o){let t=n?`${n}/${e}`:`/${e}`,o=e in i,s=e in a;!o&&s?r.push({path:t,type:`added`,newValue:a[e]}):o&&!s?r.push({path:t,type:`removed`,oldValue:i[e]}):r.push(...If(i[e],a[e],t))}}function Rf(e,t){let n=[];function r(e){if(n.push(e),t(e.id)&&(e.type===`object`||e.type===`array`))for(let t of e.children)r(t)}return r(e),n}var zf=[`name`,`type`,`title`,`id`,`label`,`key`];function Bf(e,t){if(e.parentId===null)return`/`;if(t.nodesById.get(e.parentId)?.type!==`array`||e.type!==`object`)return e.key;for(let t of zf){let n=e.children.find(e=>e.key===t);if(n?.value!=null&&n.value!==``)return String(n.value)}return e.key}function Vf(e){let t=[e.id];for(let n of e.children)t.push(...Vf(n));return t}var Hf={"--vj-bg":`#1e1e1e`,"--vj-bg-panel":`#252526`,"--vj-bg-hover":`#2a2d2e`,"--vj-bg-selected":`#2a5a1e`,"--vj-bg-selected-muted":`#2a2d2e`,"--vj-bg-match":`#3a3520`,"--vj-bg-match-active":`#51502b`,"--vj-border":`#333333`,"--vj-border-subtle":`#2a2a2a`,"--vj-text":`#cccccc`,"--vj-text-muted":`#888888`,"--vj-text-dim":`#666666`,"--vj-text-dimmer":`#555555`,"--vj-string":`#ce9178`,"--vj-number":`#b5cea8`,"--vj-boolean":`#569cd6`,"--vj-accent":`#007acc`,"--vj-accent-muted":`#094771`,"--vj-input-bg":`#3c3c3c`,"--vj-input-border":`#555555`,"--vj-error":`#f48771`,"--vj-font":`monospace`,"--vj-input-font-size":`13px`},Uf=Object.freeze(new Set),Wf=()=>({draggedNodeIds:Uf,dropTargetNodeId:null,dropPosition:null});function Gf(e,t){let n=[];function r(e){t.has(e.id)&&n.push(e.id);for(let t of e.children)r(t)}return r(e),n}function Kf(e,t){let{draggedNodeIds:n,dropTargetNodeId:r,dropPosition:i}=t;if(n.size===0||!r||!i)return null;let a=e.nodesById.get(r);if(!a||!a.parentId)return null;for(let t of n)if(mf(e,r,t))return null;let o=a.parentId,s=e.nodesById.get(o);if(!s)return null;let c=s.children.filter(e=>n.has(e.id)).map(e=>e.id);if(c.length===n.size&&[...n].every(t=>e.nodesById.get(t)?.parentId===o))return wf(e,o,c,r,i);let l=Gf(e.root,n),u=l.map(t=>e.nodesById.get(t)).filter(e=>!!e&&e.parentId!==null).map(e=>structuredClone(e)),d=e;for(let e of[...l].reverse())d.nodesById.has(e)&&(d=Cf(d,e));let f=d.nodesById.get(r);if(!f||!f.parentId)return null;let p=d.nodesById.get(f.parentId);if(!p)return null;let m=p.children.findIndex(e=>e.id===r);i===`after`&&m++;for(let e=0;e<u.length;e++)d=Sf(d,p.id,u[e],m+e);return d}function qf(e,t,n){let r=document.createElement(`div`);r.textContent=`${t} selected`;let i=document.querySelector(`[data-form-container], [role='tree']`),a=i?getComputedStyle(i):null,o=a?.getPropertyValue(`--vj-bg-selected`).trim()||Hf[`--vj-bg-selected`],s=a?.getPropertyValue(`--vj-text-selected`).trim()||a?.getPropertyValue(`--vj-text`).trim()||Hf[`--vj-text`],c=a?.getPropertyValue(`--vj-font`).trim()||Hf[`--vj-font`];r.style.cssText=[`position:fixed`,`top:-1000px`,`left:-1000px`,`padding:4px 12px`,`background:${o}`,`color:${s}`,`font-family:${c}`,`font-size:13px`,`border-radius:4px`,`white-space:nowrap`,`pointer-events:none`].join(`;`),document.body.appendChild(r),e.setDragImage(r,0,14),requestAnimationFrame(()=>r.remove())}var Jf={added:{bg:`#1e3a1e`,marker:`+`,label:`#4ec94e`},removed:{bg:`#3a1e1e`,marker:`-`,label:`#f48771`},changed:{bg:`#3a3a1e`,marker:`~`,label:`#dcdcaa`}};function Yf(e){if(e===void 0)return``;if(e===null)return`null`;if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`object`){let t=JSON.stringify(e,null,2);return t.length>80?JSON.stringify(e).slice(0,77)+`...`:t}return String(e)}function Xf(e,t,n){if(!e)return;let r=Nf(e,n,t);if(r)return jf(r,t??e)}function Zf(e){return e.type===`boolean`||e.type===`null`?`var(--vj-boolean, #569cd6)`:e.type===`number`?`var(--vj-number, #b5cea8)`:`var(--vj-string, #ce9178)`}function Qf(e){return e.type===`null`?`null`:e.type===`boolean`?String(e.value):e.value===null||e.value===void 0?``:String(e.value)}function $f(e,t,n){return!t||!e.parentId?!1:(Xf(t,n,e.path.split(`/`).slice(0,-1).join(`/`)||`/`)?.required)?.includes(e.key)??!1}function ep(e,t,n){let r=Array.isArray(t)?t[0]:t;if(r===`boolean`||e===`true`||e===`false`)return e===`true`;if(e===`null`)return null;if(r===`number`||r===`integer`||n===`number`){let t=Number(e);return isNaN(t)?e:t}return e}var tp=Symbol(`StudioContext`);function np(e,t,n){if(!t)return null;let r=e.nodesById.get(t);if(!r)return null;for(;r;){let t=r.parentId?e.nodesById.get(r.parentId):void 0,i=t?t.children:[e.root],a=new Set(i.map(e=>e.id));if(!i.every(e=>n.has(e.id))||!t||!t.parentId)return a;r=t}return null}function rp(e,t,n){let r=e.findIndex(e=>e.id===t),i=e.findIndex(e=>e.id===n);if(r===-1||i===-1)return null;let a=Math.min(r,i),o=Math.max(r,i),s=new Set;for(let t=a;t<=o;t++)s.add(e[t].id);return s}function ip(e,t,n){let r=[...t].filter(n=>{let r=e.nodesById.get(n);if(!r||r.parentId===null)return!1;let i=e.nodesById.get(r.parentId);for(;i;){if(t.has(i.id))return!1;i=i.parentId?e.nodesById.get(i.parentId):void 0}return!0});if(r.length===0)return{newTree:e,nextFocusId:null};let i=n.findIndex(e=>t.has(e.id)),a=e;for(let e of r)a.nodesById.has(e)&&(a=Cf(a,e));let o=null;for(let e=i;e<n.length;e++){let r=n[e].id;if(!t.has(r)&&a.nodesById.has(r)){o=r;break}}if(!o)for(let e=i-1;e>=0;e--){let r=n[e].id;if(!t.has(r)&&a.nodesById.has(r)){o=r;break}}return{newTree:a,nextFocusId:o}}var ap=F({__name:`VisualJson`,props:{value:{type:[String,Number,Boolean,null,Array,Object]},schema:{default:null}},emits:[`change`],setup(e,{emit:t}){let n=e,r=t,i=ln(df(n.value)),a=ln(null),o=ln(new Set),s=ln(null),c=ln(null),l=ln(new Set([i.value.root.id])),u=G(()=>Rf(i.value.root,e=>l.value.has(e))),d=null,f=new kf,p=ln(0),m=G(()=>(p.value,f.canUndo)),h=G(()=>(p.value,f.canRedo)),g=ln(``),_=ln([]),v=ln(0),y=G(()=>new Set(_.value.map(e=>e.nodeId))),b=!1;f.push(i.value);function x(e){a.value=e,o.value=e?new Set([e]):new Set,s.value=e,c.value=e}P(()=>n.value,e=>{if(b){b=!1;return}let t=df(e);i.value=t,l.value=new Set([t.root.id]),x(null),f=new kf,f.push(t),p.value++,g.value=``,_.value=[],v.value=0},{flush:`sync`}),P(i,e=>{if(!g.value.trim())return;let t=Pf(e,g.value);_.value=t,v.value=Math.min(v.value,Math.max(t.length-1,0))},{flush:`sync`});function S(e){i.value=e,f.push(e),p.value++,b=!0,r(`change`,ff(e.root))}function C(){let e=f.undo();e&&(i.value=e,p.value++,b=!0,r(`change`,ff(e.root)))}function ee(){let e=f.redo();e&&(i.value=e,p.value++,b=!0,r(`change`,ff(e.root)))}function w(e){let t=e.metaKey||e.ctrlKey;t&&e.key===`z`&&!e.shiftKey?(e.preventDefault(),C()):(t&&e.key===`z`&&e.shiftKey||t&&e.key===`y`)&&(e.preventDefault(),ee())}return Zr(()=>document.addEventListener(`keydown`,w)),ti(()=>document.removeEventListener(`keydown`,w)),er(tp,{state:{tree:i,focusedNodeId:a,selectedNodeIds:o,anchorNodeId:s,drillDownNodeId:c,expandedNodeIds:l,schema:G(()=>n.schema??null),searchQuery:g,searchMatches:_,searchMatchIndex:v,searchMatchNodeIds:y,canUndo:m,canRedo:h},actions:{setTree:S,selectNode(e){a.value=e,o.value=e?new Set([e]):new Set,s.value=e},selectAndDrillDown:x,toggleNodeSelection(e){let t=new Set(o.value);t.has(e)?t.delete(e):t.add(e),o.value=t,t.size===0?(a.value=null,s.value=null):(a.value=e,s.value=e)},selectNodeRange(e){let t=d??u.value,n=s.value;if(!n){a.value=e,o.value=new Set([e]),s.value=e;return}let r=rp(t,n,e);if(!r){a.value=e,o.value=new Set([e]),s.value=e;return}o.value=r,a.value=e},setSelection(e,t,n){a.value=e,o.value=t,s.value=n},setVisibleNodesOverride(e){d=e},drillDown(e){c.value=e},toggleExpand(e){let t=new Set(l.value);t.has(e)?t.delete(e):t.add(e),l.value=t},expandNode(e){let t=new Set(l.value);t.add(e),l.value=t},collapseNode(e){let t=new Set(l.value);t.delete(e),l.value=t},expandAll(){l.value=new Set(Vf(i.value.root))},collapseAll(){l.value=new Set([i.value.root.id])},undo:C,redo:ee,setSearchQuery(e){if(g.value=e,!e.trim()){_.value=[],v.value=0;return}let t=Pf(i.value,e);if(_.value=t,v.value=0,t.length>0){let e=Ff(i.value,t.map(e=>e.nodeId)),n=new Set(l.value);for(let t of e)n.add(t);l.value=n,x(t[0].nodeId)}},nextSearchMatch(){if(_.value.length===0)return;let e=(v.value+1)%_.value.length;v.value=e,x(_.value[e].nodeId)},prevSearchMatch(){if(_.value.length===0)return;let e=(v.value-1+_.value.length)%_.value.length;v.value=e,x(_.value[e].nodeId)}}}),(e,t)=>fi(e.$slots,`default`)}});function op(){let e=tr(tp);if(!e)throw Error(`useStudio must be used within a <VisualJson> provider`);return e}function sp(e,t){let{state:n,actions:r}=op(),i=ln(Wf());function a(e){let n;n=t.value.size>0&&t.value.has(e)?t.value:new Set([e]),i.value={draggedNodeIds:n,dropTargetNodeId:null,dropPosition:null}}function o(e,t){let r=i.value.draggedNodeIds;for(let t of r)if(e===t||mf(n.tree.value,e,t))return;i.value={...i.value,dropTargetNodeId:e,dropPosition:t}}function s(t,n){if(n===`before`){let n=e.value.findIndex(e=>e.id===t);if(n>0){o(e.value[n-1].id,`after`);return}}o(t,n)}function c(){i.value=Wf()}function l(){let e=Kf(n.tree.value,i.value);e&&r.setTree(e),i.value=Wf()}return{dragState:i,handleDragStart:a,handleDragOver:s,handleDragEnd:c,handleDrop:l}}var cp=[`aria-selected`,`aria-expanded`,`draggable`,`data-node-id`],lp=[`aria-label`],up={key:1,style:{width:`16px`,flexShrink:0}},dp=F({__name:`TreeNodeRow`,props:{node:{},depth:{},dragState:{},showValues:{type:Boolean},showCounts:{type:Boolean},isFocused:{type:Boolean}},emits:[`dragStart`,`dragOver`,`dragEnd`,`drop`,`contextMenu`,`selectRange`],setup(e,{emit:t}){let n=e,r=t,{state:i,actions:a}=op(),o=ln(!1);function s(){return i.selectedNodeIds.value.has(n.node.id)}function c(){return i.expandedNodeIds.value.has(n.node.id)}let l=n.node.type===`object`||n.node.type===`array`,u=n.node.parentId===null;function d(){return i.searchMatchNodeIds.value.has(n.node.id)}function f(){return i.searchMatches.value.length>0&&i.searchMatches.value[i.searchMatchIndex.value]?.nodeId===n.node.id}function p(){return l?n.node.type===`array`?`[${n.node.children.length}]`:`{${n.node.children.length}}`:n.node.value===null?`null`:typeof n.node.value==`string`?n.node.value:String(n.node.value)}function m(e){e.preventDefault();let t=e.currentTarget.getBoundingClientRect(),i=t.top+t.height/2,a=e.clientY<i?`before`:`after`;r(`dragOver`,n.node.id,a)}function h(){return n.dragState.dropTargetNodeId===n.node.id&&n.dragState.dropPosition===`before`?`var(--vj-accent, #007acc)`:`transparent`}function g(){return n.dragState.dropTargetNodeId===n.node.id&&n.dragState.dropPosition===`after`?`var(--vj-accent, #007acc)`:`transparent`}function _(){let e=s(),t=f(),r=d(),i=o.value;return e?n.isFocused?`var(--vj-bg-selected, #2a5a1e)`:`var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))`:t?`var(--vj-bg-match-active, #51502b)`:r?`var(--vj-bg-match, #3a3520)`:i?`var(--vj-bg-hover, #2a2d2e)`:`transparent`}function v(e){e.shiftKey?r(`selectRange`,n.node.id):e.metaKey||e.ctrlKey?a.toggleNodeSelection(n.node.id):a.selectAndDrillDown(n.node.id)}function y(e){e.dataTransfer.effectAllowed=`move`,i.selectedNodeIds.value.size>1&&i.selectedNodeIds.value.has(n.node.id)&&qf(e.dataTransfer,i.selectedNodeIds.value.size),r(`dragStart`,n.node.id)}return(t,n)=>(R(),z(L,null,[V(`div`,{role:`treeitem`,"aria-selected":s(),"aria-expanded":N(l)?c():void 0,draggable:!u,"data-node-id":e.node.id,style:k({display:`flex`,alignItems:`center`,gap:`6px`,padding:`1px 8px`,paddingLeft:8+e.depth*16+`px`,cursor:`pointer`,backgroundColor:_(),minHeight:`28px`,userSelect:`none`,opacity:e.dragState.draggedNodeIds.has(e.node.id)?.4:1,borderTop:`2px solid ${h()}`,borderBottom:`2px solid ${g()}`,boxSizing:`border-box`,color:s()&&e.isFocused?`var(--vj-text-selected, var(--vj-text, #cccccc))`:`var(--vj-text, #cccccc)`}),onClick:v,onMouseenter:n[1]||=()=>o.value=!0,onMouseleave:n[2]||=()=>o.value=!1,onContextmenu:n[3]||=t=>r(`contextMenu`,t,e.node),onDragstart:y,onDragover:m,onDragend:n[4]||=()=>r(`dragEnd`),onDrop:n[5]||=Js(()=>r(`drop`),[`prevent`])},[N(l)?(R(),z(`button`,{key:0,"aria-label":c()?`Collapse`:`Expand`,style:k({background:`none`,border:`none`,color:`inherit`,cursor:`pointer`,padding:0,width:`16px`,fontSize:`9px`,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.15s`,transform:c()?`rotate(90deg)`:`rotate(0deg)`}),onClick:n[0]||=Js(()=>N(a).toggleExpand(e.node.id),[`stop`])},` ▶ `,12,lp)):(R(),z(`span`,up)),V(`span`,{style:k({color:`inherit`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,flexShrink:0,fontWeight:u?600:400})},j(u?`/`:N(Bf)(e.node,N(i).tree.value)),5),!u&&N(l)&&e.showCounts?(R(),z(`span`,{key:2,style:k({color:s()?`inherit`:`var(--vj-text-muted, #888888)`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,whiteSpace:`nowrap`,marginLeft:`auto`})},j(p()),5)):W(``,!0),!u&&!N(l)&&e.showValues?(R(),z(`span`,{key:3,style:k({color:e.node.type===`string`?`var(--vj-string, #ce9178)`:`var(--vj-number, #b5cea8)`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginLeft:`auto`})},j(p()),5)):W(``,!0)],44,cp),c()?(R(!0),z(L,{key:0},I(e.node.children,t=>(R(),B(dp,{key:t.id,node:t,depth:e.depth+1,"drag-state":e.dragState,"show-values":e.showValues,"show-counts":e.showCounts,"is-focused":e.isFocused,onDragStart:n[6]||=e=>r(`dragStart`,e),onDragOver:n[7]||=(e,t)=>r(`dragOver`,e,t),onDragEnd:n[8]||=()=>r(`dragEnd`),onDrop:n[9]||=()=>r(`drop`),onContextMenu:n[10]||=(e,t)=>r(`contextMenu`,e,t),onSelectRange:n[11]||=e=>r(`selectRange`,e)},null,8,[`node`,`depth`,`drag-state`,`show-values`,`show-counts`,`is-focused`]))),128)):W(``,!0)],64))}}),fp={key:0,style:{height:`1px`,backgroundColor:`var(--vj-border, #454545)`,margin:`4px 0`}},pp=[`disabled`,`onClick`,`onMouseenter`],mp=F({__name:`ContextMenu`,props:{x:{},y:{},items:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=ln(null),a=ln({left:n.x,top:n.y});P(()=>[n.x,n.y],async()=>{if(await zn(),!i.value)return;let e=i.value.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;a.value={left:e.right>t?Math.max(0,n.x-e.width):n.x,top:e.bottom>r?Math.max(0,n.y-e.height):n.y}},{immediate:!0});function o(e){i.value&&!i.value.contains(e.target)&&r(`close`)}function s(e){e.key===`Escape`&&r(`close`)}return Zr(async()=>{if(await zn(),i.value){let e=i.value.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;a.value={left:e.right>t?Math.max(0,n.x-e.width):n.x,top:e.bottom>r?Math.max(0,n.y-e.height):n.y}}document.addEventListener(`mousedown`,o),document.addEventListener(`keydown`,s)}),ti(()=>{document.removeEventListener(`mousedown`,o),document.removeEventListener(`keydown`,s)}),(t,n)=>(R(),B(yr,{to:`body`},[V(`div`,{ref_key:`menuRef`,ref:i,style:k({position:`fixed`,left:a.value.left+`px`,top:a.value.top+`px`,zIndex:1e4,backgroundColor:`var(--vj-bg-panel, #252526)`,border:`1px solid var(--vj-border, #454545)`,borderRadius:`4px`,boxShadow:`0 4px 12px rgba(0,0,0,0.5)`,padding:`4px 0`,minWidth:`160px`})},[(R(!0),z(L,null,I(e.items,(e,t)=>(R(),z(L,{key:t},[`separator`in e&&e.separator?(R(),z(`div`,fp)):`label`in e?(R(),z(`button`,{key:1,disabled:e.disabled,style:k({display:`block`,width:`100%`,textAlign:`left`,background:`none`,border:`none`,color:e.disabled?`var(--vj-text-dimmer, #555555)`:`var(--vj-text, #cccccc)`,cursor:e.disabled?`default`:`pointer`,padding:`4px 16px`,fontSize:`12px`,fontFamily:`var(--vj-font, monospace)`}),onClick:()=>{e.disabled||(e.action(),r(`close`))},onMouseenter:t=>{e.disabled||(t.target.style.backgroundColor=`var(--vj-accent-muted, #094771)`)},onMouseleave:n[0]||=e=>{e.target.style.backgroundColor=`transparent`}},j(e.label),45,pp)):W(``,!0)],64))),128))],4)]))}}),hp=F({__name:`TreeView`,props:{class:{},showValues:{type:Boolean,default:!0},showCounts:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,actions:r}=op(),i=ln(null),a=G(()=>Rf(n.tree.value.root,e=>n.expandedNodeIds.value.has(e))),{dragState:o,handleDragStart:s,handleDragOver:c,handleDragEnd:l,handleDrop:u}=sp(a,n.selectedNodeIds),d=ln(null),f=ln(!1);function p(e){r.setVisibleNodesOverride(a.value),r.selectNodeRange(e)}P(()=>n.focusedNodeId.value,e=>{if(e&&i.value){let t=i.value.querySelector(`[data-node-id="${e}"]`);t&&t.scrollIntoView({block:`nearest`})}});function m(e,t){e.preventDefault(),n.selectedNodeIds.value.has(t.id)||r.selectAndDrillDown(t.id),d.value={x:e.clientX,y:e.clientY,node:t}}function h(e){let t=[];if((e.type===`object`||e.type===`array`)&&(t.push({label:`Expand all children`,action:()=>{function t(e){let n=[e.id];for(let r of e.children)n.push(...t(r));return n}for(let n of t(e))r.expandNode(n)}}),t.push({label:`Collapse all children`,action:()=>{function t(e){let n=[];for(let r of e.children)n.push(r.id),n.push(...t(r));return n}for(let n of t(e))r.collapseNode(n)}}),t.push({separator:!0})),t.push({label:`Copy path`,action:()=>navigator.clipboard.writeText(e.path).catch(()=>{})}),t.push({label:`Copy value as JSON`,action:()=>{let t=ff(e),n=typeof t==`string`?t:JSON.stringify(t,null,2);navigator.clipboard.writeText(n).catch(()=>{})}}),e.parentId){t.push({separator:!0}),t.push({label:`Duplicate`,action:()=>{let t=Df(n.tree.value,e.id);r.setTree(t)}});let i=[`string`,`number`,`boolean`,`null`,`object`,`array`].filter(t=>t!==e.type).map(t=>({label:`Change to ${t}`,action:()=>{let i=Ef(n.tree.value,e.id,t);r.setTree(i)}}));t.push({separator:!0}),t.push(...i),t.push({separator:!0}),t.push({label:`Delete`,action:()=>{let{newTree:e,nextFocusId:t}=ip(n.tree.value,n.selectedNodeIds.value,a.value);e!==n.tree.value&&(r.setTree(e),t?r.selectNode(t):r.setSelection(null,new Set,null))}})}return t}function g(e){let t=a.value.findIndex(e=>e.id===n.focusedNodeId.value);switch(e.key){case`ArrowDown`:{e.preventDefault();let n=a.value[t+1];n&&(e.shiftKey?p(n.id):r.selectNode(n.id));break}case`ArrowUp`:{e.preventDefault();let n=a.value[t-1];n&&(e.shiftKey?p(n.id):r.selectNode(n.id));break}case`ArrowRight`:{e.preventDefault();let i=t>=0?a.value[t]:null;i&&(i.type===`object`||i.type===`array`)&&(n.expandedNodeIds.value.has(i.id)?i.children.length>0&&r.selectNode(i.children[0].id):r.expandNode(i.id));break}case`ArrowLeft`:{e.preventDefault();let i=t>=0?a.value[t]:null;if(!i)break;(i.type===`object`||i.type===`array`)&&n.expandedNodeIds.value.has(i.id)?r.collapseNode(i.id):i.parentId&&r.selectNode(i.parentId);break}case`a`:if(e.metaKey||e.ctrlKey){e.preventDefault();let t=np(n.tree.value,n.focusedNodeId.value,n.selectedNodeIds.value);t&&r.setSelection(n.focusedNodeId.value,t,n.focusedNodeId.value)}break;case`Escape`:e.preventDefault(),n.selectedNodeIds.value.size>1&&n.focusedNodeId.value?r.selectNode(n.focusedNodeId.value):r.setSelection(null,new Set,null);break;case`Delete`:case`Backspace`:{e.preventDefault();let{newTree:t,nextFocusId:i}=ip(n.tree.value,n.selectedNodeIds.value,a.value);if(t===n.tree.value)break;r.setTree(t),i?r.selectNode(i):r.setSelection(null,new Set,null);break}}}return(e,r)=>(R(),z(L,null,[V(`div`,{ref_key:`containerRef`,ref:i,role:`tree`,tabindex:`0`,style:{overflow:`auto`,backgroundColor:`var(--vj-bg, #1e1e1e)`,color:`var(--vj-text, #cccccc)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`13px`,outline:`none`,flex:1},onKeydown:g,onFocus:r[0]||=()=>f.value=!0,onBlur:r[1]||=()=>f.value=!1},[H(dp,{node:N(n).tree.value.root,depth:0,"drag-state":N(o),"show-values":t.showValues??!0,"show-counts":t.showCounts??!1,"is-focused":f.value,onDragStart:N(s),onDragOver:N(c),onDragEnd:N(l),onDrop:N(u),onContextMenu:m,onSelectRange:p},null,8,[`node`,`drag-state`,`show-values`,`show-counts`,`is-focused`,`onDragStart`,`onDragOver`,`onDragEnd`,`onDrop`])],544),d.value?(R(),B(mp,{key:0,x:d.value.x,y:d.value.y,items:h(d.value.node),onClose:r[2]||=()=>d.value=null},null,8,[`x`,`y`,`items`])):W(``,!0)],64))}}),gp=Symbol(`FormViewContext`),_p=[`value`],vp=[`onMousedown`,`onMouseenter`],yp=20,bp=200,xp=F({__name:`Breadcrumbs`,props:{class:{}},setup(e){let{state:t,actions:n}=op(),r=G(()=>t.drillDownNodeId.value?t.tree.value.nodesById.get(t.drillDownNodeId.value):null),i=G(()=>r.value?.path??`/`),a=ln(i.value),o=ln(!1),s=ln(0),c=ln(null),l=ln(null),u=ln(null);P(i,e=>{a.value=e});let d=G(()=>{if(!o.value)return[];let e=a.value.toLowerCase(),n=[];for(let[r,i]of t.tree.value.nodesById)if(i.path.toLowerCase().startsWith(e)&&n.push({id:r,path:i.path}),n.length>=yp)break;return n.sort((e,t)=>e.path.localeCompare(t.path)),n});P(d,()=>{s.value=0}),P(()=>[s.value,o.value],([e,t])=>{let n=l.value;!n||!t||n.children[e]?.scrollIntoView({block:`nearest`})});function f(e){var r;for(let[r,i]of t.tree.value.nodesById)if(i.path===e){n.selectAndDrillDown(r);break}o.value=!1,(r=c.value)==null||r.blur()}function p(e){var t;if(!o.value){(e.key===`ArrowDown`||e.key===`Enter`)&&(o.value=!0,e.preventDefault());return}switch(e.key){case`ArrowDown`:e.preventDefault(),s.value=Math.min(s.value+1,d.value.length-1);break;case`ArrowUp`:e.preventDefault(),s.value=Math.max(s.value-1,0);break;case`Enter`:e.preventDefault(),d.value.length>0&&s.value<d.value.length?f(d.value[s.value].path):f(a.value.trim()||`/`);break;case`Escape`:e.preventDefault(),a.value=i.value,o.value=!1,(t=c.value)==null||t.blur();break}}function m(e){u.value&&!u.value.contains(e.target)&&(a.value=i.value,o.value=!1)}return Zr(()=>document.addEventListener(`mousedown`,m)),ti(()=>document.removeEventListener(`mousedown`,m)),(e,t)=>(R(),z(`div`,{ref_key:`wrapperRef`,ref:u,style:{position:`relative`,flex:1,minWidth:0}},[V(`input`,{ref_key:`inputRef`,ref:c,value:a.value,spellcheck:`false`,autocomplete:`off`,style:{width:`100%`,boxSizing:`border-box`,padding:`3px 0`,fontSize:`var(--vj-input-font-size, 13px)`,fontFamily:`var(--vj-font, monospace)`,color:`var(--vj-text-muted, #999999)`,background:`transparent`,border:`none`,outline:`none`},onInput:t[0]||=e=>{a.value=e.target.value,o.value||=!0},onFocus:t[1]||=e=>{e.target.select(),o.value=!0},onKeydown:p},null,40,_p),o.value&&d.value.length>0?(R(),z(`div`,{key:0,ref_key:`listRef`,ref:l,style:k({position:`absolute`,top:`100%`,left:`-12px`,right:`-12px`,zIndex:50,maxHeight:bp+`px`,overflowY:`auto`,backgroundColor:`var(--vj-bg-panel, #252526)`,border:`1px solid var(--vj-border, #333333)`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`})},[(R(!0),z(L,null,I(d.value,(e,t)=>(R(),z(`div`,{key:e.id,style:k({padding:`4px 12px`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,color:t===s.value?`var(--vj-text, #cccccc)`:`var(--vj-text-muted, #888888)`,backgroundColor:t===s.value?`var(--vj-bg-hover, #2a2d2e)`:`transparent`,cursor:`pointer`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`}),onMousedown:Js(()=>f(e.path),[`prevent`]),onMouseenter:()=>s.value=t},j(e.path),45,vp))),128))],4)):W(``,!0)],512))}}),Sp=[`value`],Cp=[`onMousedown`,`onMouseenter`],wp={style:{width:`14px`,flexShrink:0,fontSize:`12px`}},Tp=200,Ep=F({__name:`EnumInput`,props:yi({enumValues:{},value:{},inputStyle:{}},{inputRef:{},inputRefModifiers:{}}),emits:yi([`valueChange`],[`update:inputRef`]),setup(e,{expose:t,emit:n}){let r=e,i=n;zi(e,`inputRef`);let a=ln(r.value),o=ln(!1),s=ln(0),c=ln(null),l=ln(null),u=ln(null);P(()=>r.value,e=>{a.value=e});let d=G(()=>r.enumValues.map(e=>String(e)));P(d,()=>{s.value=0}),P(()=>[s.value,o.value],([e,t])=>{let n=c.value;!n||!t||n.children[e]?.scrollIntoView({block:`nearest`})});function f(e){i(`valueChange`,e),a.value=e,o.value=!1}function p(e){if(!o.value){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),e.stopPropagation(),o.value=!0);return}switch(e.key){case`ArrowDown`:e.preventDefault(),e.stopPropagation(),s.value=Math.min(s.value+1,d.value.length-1);break;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),s.value=Math.max(s.value-1,0);break;case`Enter`:e.preventDefault(),e.stopPropagation(),d.value.length>0&&s.value<d.value.length&&f(d.value[s.value]);break;case`Escape`:e.preventDefault(),e.stopPropagation(),a.value=r.value,o.value=!1;break;case`Tab`:a.value=r.value,o.value=!1;break}}function m(e){l.value&&!l.value.contains(e.target)&&(a.value=r.value,o.value=!1)}return Zr(()=>document.addEventListener(`mousedown`,m)),ti(()=>document.removeEventListener(`mousedown`,m)),t({focus:()=>u.value?.focus()}),(t,n)=>(R(),z(`div`,{ref_key:`wrapperRef`,ref:l,style:{position:`relative`,flex:1,minWidth:0}},[V(`input`,{ref_key:`localInputRef`,ref:u,value:a.value,spellcheck:`false`,autocomplete:`off`,style:k(e.inputStyle),onInput:n[0]||=e=>{a.value=e.target.value,o.value||=!0},onFocus:n[1]||=()=>o.value=!0,onKeydown:p,onClick:n[2]||=Js(()=>{},[`stop`])},null,44,Sp),o.value&&d.value.length>0?(R(),z(`div`,{key:0,ref_key:`listRef`,ref:c,style:k({position:`absolute`,top:`calc(100% + 4px)`,left:`-32px`,right:0,zIndex:50,maxHeight:Tp+`px`,overflowY:`auto`,backgroundColor:`var(--vj-bg-panel, #252526)`,border:`1px solid var(--vj-border, #333333)`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`})},[(R(!0),z(L,null,I(d.value,(t,n)=>(R(),z(`div`,{key:t,style:k({padding:`4px 12px`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,display:`flex`,alignItems:`center`,gap:`6px`,color:n===s.value?`var(--vj-text, #cccccc)`:`var(--vj-text-muted, #888888)`,backgroundColor:n===s.value?`var(--vj-bg-hover, #2a2d2e)`:`transparent`,cursor:`pointer`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`}),onMousedown:Js(()=>f(t),[`prevent`]),onMouseenter:()=>s.value=n},[V(`span`,wp,j(t===e.value?`✓`:``),1),U(` `+j(t),1)],44,Cp))),128))],4)):W(``,!0)],512))}}),Dp={key:0},Op=[`data-form-node-id`,`draggable`],kp=[`value`],Ap={key:2,style:{color:`var(--vj-text-muted, #888888)`,fontSize:`11px`,fontFamily:`var(--vj-font, monospace)`}},jp={key:1},Mp=[`data-form-node-id`,`draggable`],Np=[`value`],Pp={key:2,style:{color:`var(--vj-error, #f48771)`,fontSize:`10px`,fontFamily:`var(--vj-font, monospace)`}},Fp={key:3,style:{flex:1,display:`flex`,alignItems:`center`,gap:`6px`,minWidth:0}},Ip={key:2,style:{color:`var(--vj-boolean, #569cd6)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,fontStyle:`italic`,flex:1}},Lp=[`value`,`placeholder`],Rp=F({__name:`FormField`,props:{node:{},depth:{}},setup(e){let t=e,n=tr(gp),{state:r,actions:i}=op(),a=ln(!1),o=ln(null),s=ln(null);function c(){o.value&&typeof o.value.focus==`function`&&o.value.focus()}let l=G(()=>t.node.type===`object`||t.node.type===`array`),u=G(()=>t.node.parentId===null),d=G(()=>r.selectedNodeIds.value.has(t.node.id)),f=G(()=>n.editingNodeId.value===t.node.id),p=G(()=>n.collapsedIds.value.has(t.node.id)),m=G(()=>t.node.parentId?r.tree.value.nodesById.get(t.node.parentId)?.type===`object`:!1),h=G(()=>Xf(n.schema.value,n.rootSchema.value,t.node.path)),g=G(()=>$f(t.node,n.schema.value,n.rootSchema.value)),_=G(()=>h.value?.description),v=G(()=>h.value?.deprecated),y=G(()=>h.value?.title),b=G(()=>n.dragState.value.dropTargetNodeId===t.node.id),x=G(()=>n.dragState.value.draggedNodeIds.has(t.node.id));function S(){return b.value&&n.dragState.value.dropPosition===`before`?`var(--vj-accent, #007acc)`:`transparent`}function C(){return b.value&&n.dragState.value.dropPosition===`after`?`var(--vj-accent, #007acc)`:`transparent`}function ee(){return d.value?n.isFocused.value?`var(--vj-bg-selected, #2a5a1e)`:`var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))`:a.value?`var(--vj-bg-hover, #2a2d2e)`:`transparent`}function w(){return d.value&&n.isFocused.value?`var(--vj-text-selected, var(--vj-text, #cccccc))`:`var(--vj-text, #cccccc)`}function T(){return Zf(t.node)}function E(){return Qf(t.node)}function D(e){e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),i=r.top+r.height/2;n.onDragOver(t.node.id,e.clientY<i?`before`:`after`)}function te(e){e.dataTransfer.effectAllowed=`move`,r.selectedNodeIds.value.size>1&&r.selectedNodeIds.value.has(t.node.id)&&qf(e.dataTransfer,r.selectedNodeIds.value.size),n.onDragStart(t.node.id)}function ne(e){let n=ep(e,h.value?.type,t.node.type),a=yf(r.tree.value,t.node.id,n);i.setTree(a)}function re(e){let n=bf(r.tree.value,t.node.id,e);i.setTree(n)}function ie(){let e=Cf(r.tree.value,t.node.id);i.setTree(e)}function O(){let e=t.node.type===`array`?String(t.node.children.length):`newKey${t.node.children.length}`,n=xf(r.tree.value,t.node.id,e,``);i.setTree(n)}let ae=G(()=>h.value?.enum&&h.value.enum.length>0),oe=G(()=>`calc(${(n.maxDepth.value-t.depth)*16}px + ${n.maxKeyLength.value}ch)`);return P(f,async e=>{e&&(await zn(),l.value?s.value&&s.value.focus():t.node.value!==null&&t.node.value!==void 0&&t.node.value!==``&&o.value?c():s.value&&s.value.focus())}),(t,i)=>{var b;return l.value?(R(),z(`div`,Dp,[V(`div`,{"data-form-node-id":e.node.id,draggable:!u.value,style:k({display:`flex`,alignItems:`center`,gap:`6px`,padding:`1px 8px`,paddingLeft:8+e.depth*16+`px`,cursor:`pointer`,backgroundColor:ee(),color:w(),height:`28px`,boxSizing:`border-box`,userSelect:`none`,opacity:v.value?.5:x.value?.4:1,borderTop:`2px solid ${S()}`,borderBottom:`2px solid ${C()}`}),onClick:i[3]||=Js(t=>N(n).onSelect(e.node.id,t),[`stop`]),onDblclick:i[4]||=()=>N(n).onToggleCollapse(e.node.id),onMouseenter:i[5]||=()=>a.value=!0,onMouseleave:i[6]||=()=>a.value=!1,onDragstart:te,onDragover:D,onDragend:i[7]||=()=>N(n).onDragEnd(),onDrop:i[8]||=Js(()=>N(n).onDrop(),[`prevent`])},[V(`button`,{style:k({background:`none`,border:`none`,color:`inherit`,cursor:`pointer`,padding:0,width:`16px`,fontSize:`9px`,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.15s`,transform:p.value?`rotate(0deg)`:`rotate(90deg)`}),onClick:i[0]||=Js(()=>N(n).onToggleCollapse(e.node.id),[`stop`])},` ▶ `,4),f.value&&!u.value?(R(),z(`input`,{key:0,ref_key:`keyInputRef`,ref:s,value:e.node.key,style:k({background:`none`,border:`none`,color:`inherit`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,fontWeight:500,padding:0,outline:`none`,flexShrink:0,width:oe.value}),onInput:i[1]||=e=>re(e.target.value),onClick:i[2]||=Js(()=>{},[`stop`])},null,44,kp)):(R(),z(`span`,{key:1,style:k({color:!u.value&&!m.value&&!d.value?`var(--vj-text-muted, #888888)`:`inherit`,fontSize:`var(--vj-input-font-size, 13px)`,fontFamily:`var(--vj-font, monospace)`,fontWeight:500,flexShrink:0,display:`inline-block`,width:oe.value})},j(u.value?`/`:N(Bf)(e.node,N(r).tree.value)),5)),N(n).showDescriptions&&y.value&&!d.value?(R(),z(`span`,Ap,j(y.value),1)):W(``,!0),a.value?(R(),z(`button`,{key:3,style:k({background:`none`,border:`none`,color:d.value?`inherit`:`var(--vj-text-muted, #888888)`,cursor:`pointer`,padding:0,fontSize:`12px`,fontFamily:`var(--vj-font, monospace)`}),onClick:Js(O,[`stop`])},` + Add `+j(e.node.type===`array`?`item`:`property`),5)):W(``,!0),N(n).showCounts?(R(),z(`span`,{key:4,style:k({color:d.value?`inherit`:`var(--vj-text-dim, #666666)`,fontSize:`12px`,fontFamily:`var(--vj-font, monospace)`,marginLeft:`auto`})},j(e.node.type===`array`?`${e.node.children.length} items`:`${e.node.children.length} properties`),5)):W(``,!0),!u.value&&f.value?(R(),z(`button`,{key:5,style:k({background:`none`,border:`none`,color:d.value?`inherit`:`var(--vj-text-muted, #888888)`,cursor:`pointer`,padding:`2px 4px`,fontSize:`14px`,fontFamily:`var(--vj-font, monospace)`,...N(n).showCounts?{}:{marginLeft:`auto`}}),title:`Remove`,onClick:Js(ie,[`stop`])},` × `,4)):W(``,!0)],44,Op),N(n).showDescriptions&&_.value?(R(),z(`div`,{key:0,style:k({padding:`2px 12px 4px`,paddingLeft:8+e.depth*16+22+`px`,fontSize:`11px`,color:`var(--vj-text-dim, #666666)`,fontFamily:`var(--vj-font, monospace)`})},j(_.value),5)):W(``,!0),p.value?W(``,!0):(R(),z(`div`,jp,[(R(!0),z(L,null,I(e.node.children,t=>(R(),B(Rp,{key:t.id,node:t,depth:e.depth+1},null,8,[`node`,`depth`]))),128))]))])):(R(),z(`div`,{key:1,"data-form-node-id":e.node.id,draggable:!u.value,style:k({display:`flex`,alignItems:`center`,gap:`6px`,padding:`1px 8px`,paddingLeft:8+e.depth*16+`px`,cursor:`pointer`,backgroundColor:ee(),color:w(),height:`28px`,boxSizing:`border-box`,userSelect:`none`,opacity:v.value?.5:x.value?.4:1,borderTop:`2px solid ${S()}`,borderBottom:`2px solid ${C()}`}),onClick:i[14]||=Js(t=>N(n).onSelect(e.node.id,t),[`stop`]),onDblclick:i[15]||=()=>N(n).onStartEditing(e.node.id),onMouseenter:i[16]||=()=>a.value=!0,onMouseleave:i[17]||=()=>a.value=!1,onDragstart:te,onDragover:D,onDragend:i[18]||=()=>N(n).onDragEnd(),onDrop:i[19]||=Js(()=>N(n).onDrop(),[`prevent`])},[i[20]||=V(`span`,{style:{width:`16px`,flexShrink:0}},null,-1),f.value&&m.value?(R(),z(`input`,{key:0,ref_key:`keyInputRef`,ref:s,value:e.node.key,style:k({background:`none`,border:`none`,color:`inherit`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:0,flexShrink:0,outline:`none`,width:oe.value}),onInput:i[9]||=e=>re(e.target.value),onClick:i[10]||=Js(()=>{},[`stop`]),onKeydown:i[11]||=e=>{e.key===`Tab`&&!e.shiftKey&&o.value&&(e.preventDefault(),c())}},null,44,Np)):(R(),z(`span`,{key:1,style:k({color:!m.value&&!d.value?`var(--vj-text-muted, #888888)`:`inherit`,fontSize:`var(--vj-input-font-size, 13px)`,fontFamily:`var(--vj-font, monospace)`,flexShrink:0,display:`inline-block`,width:oe.value})},j(N(Bf)(e.node,N(r).tree.value)),5)),g.value&&!d.value?(R(),z(`span`,Pp,` * `)):W(``,!0),f.value?(R(),z(`div`,Fp,[e.node.type===`boolean`?(R(),B(Ep,{key:0,ref_key:`valueInputRef`,ref:o,"enum-values":[`true`,`false`],value:String(e.node.value),"input-style":{background:`none`,border:`none`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:`0`,flex:`1`,outline:`none`,color:T()},onValueChange:ne},null,8,[`value`,`input-style`])):ae.value&&(b=h.value)!=null&&b.enum?(R(),B(Ep,{key:1,ref_key:`valueInputRef`,ref:o,"enum-values":h.value.enum,value:E(),"input-style":{background:`none`,border:`none`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:`0`,flex:`1`,outline:`none`,color:T()},onValueChange:ne},null,8,[`enum-values`,`value`,`input-style`])):e.node.type===`null`?(R(),z(`span`,Ip,` null `)):(R(),z(`input`,{key:3,ref_key:`valueInputRef`,ref:o,value:E(),placeholder:h.value?.default===void 0?`<value>`:String(h.value.default),style:k({background:`none`,border:`none`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:0,flex:1,outline:`none`,color:T()}),onInput:i[12]||=e=>ne(e.target.value),onClick:i[13]||=Js(()=>{},[`stop`])},null,44,Lp))])):(R(),z(`span`,{key:4,style:k({color:T(),fontSize:`var(--vj-input-font-size, 13px)`,fontFamily:`var(--vj-font, monospace)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontStyle:e.node.type===`null`?`italic`:void 0})},j(E()),5)),f.value?(R(),z(`button`,{key:5,style:k({background:`none`,border:`none`,color:d.value?`inherit`:`var(--vj-text-muted, #888888)`,cursor:`pointer`,padding:`2px 4px`,fontSize:`14px`,fontFamily:`var(--vj-font, monospace)`,flexShrink:0}),title:`Remove`,onClick:Js(ie,[`stop`])},` × `,4)):W(``,!0)],44,Mp))}}}),zp={style:{backgroundColor:`var(--vj-bg, #1e1e1e)`,color:`var(--vj-text, #cccccc)`,height:`100%`,fontFamily:`var(--vj-font, monospace)`,display:`flex`,flexDirection:`column`}},Bp={style:{display:`flex`,alignItems:`center`,padding:`4px 8px`,borderBottom:`1px solid var(--vj-border, #333333)`,backgroundColor:`var(--vj-bg, #1e1e1e)`,flexShrink:0}},Vp=F({__name:`FormView`,props:{class:{},showDescriptions:{type:Boolean,default:!1},showCounts:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,actions:r}=op(),i=ln(null),a=ln(!1),o=ln(null),s=ln(new Set),c=n.tree.value,l=G(()=>(n.drillDownNodeId.value?n.tree.value.nodesById.get(n.drillDownNodeId.value):null)??n.tree.value.root);P(()=>l.value.id,()=>{o.value=null,s.value=new Set});let u=G(()=>Rf(l.value,e=>!s.value.has(e))),{dragState:d,handleDragStart:f,handleDragOver:p,handleDragEnd:m,handleDrop:h}=sp(u,n.selectedNodeIds);Zr(()=>{r.setVisibleNodesOverride(u.value)}),ti(()=>{r.setVisibleNodesOverride(null)}),P(u,e=>{r.setVisibleNodesOverride(e)});let g=G(()=>{let e=1,t=0,r=l.value.path===`/`?0:l.value.path.split(`/`).filter(Boolean).length;for(let i of u.value){let a=i.parentId===null?`/`:Bf(i,n.tree.value);a.length>e&&(e=a.length);let o=(i.path===`/`?0:i.path.split(`/`).filter(Boolean).length)-r;o>t&&(t=o)}return{maxKeyLength:e,maxDepth:t}}),_=G(()=>g.value.maxKeyLength),v=G(()=>g.value.maxDepth),y=G(()=>n.schema.value),b=G(()=>n.schema.value??void 0);function x(e,t){o.value=null,t.shiftKey?(r.setVisibleNodesOverride(u.value),r.selectNodeRange(e)):t.metaKey||t.ctrlKey?r.toggleNodeSelection(e):r.selectNode(e)}function S(e){let t=new Set(s.value);t.has(e)?t.delete(e):t.add(e),s.value=t}function C(e){c=n.tree.value,o.value=e}function ee(e){requestAnimationFrame(()=>{(i.value?.querySelector(`[data-form-node-id="${e}"]`))?.scrollIntoView({block:`nearest`})})}function w(e){var t,a;if(o.value){e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),r.setTree(c),o.value=null,(t=i.value)==null||t.focus()):e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o.value=null,(a=i.value)==null||a.focus());return}let l=u.value.findIndex(e=>e.id===n.focusedNodeId.value);switch(l===-1&&u.value.length>0&&(l=0),e.key){case`ArrowDown`:{e.preventDefault();let t=u.value[l+1];t&&(e.shiftKey?(r.setVisibleNodesOverride(u.value),r.selectNodeRange(t.id)):r.selectNode(t.id),ee(t.id));break}case`ArrowUp`:{e.preventDefault();let t=u.value[l-1];t&&(e.shiftKey?(r.setVisibleNodesOverride(u.value),r.selectNodeRange(t.id)):r.selectNode(t.id),ee(t.id));break}case`ArrowRight`:{e.preventDefault();let t=l>=0?u.value[l]:null;if(t&&(t.type===`object`||t.type===`array`))if(s.value.has(t.id)){let e=new Set(s.value);e.delete(t.id),s.value=e}else t.children.length>0&&(r.selectNode(t.children[0].id),ee(t.children[0].id));break}case`ArrowLeft`:{e.preventDefault();let t=l>=0?u.value[l]:null;if(!t)break;if((t.type===`object`||t.type===`array`)&&!s.value.has(t.id)){let e=new Set(s.value);e.add(t.id),s.value=e}else if(t.parentId){let e=u.value.find(e=>e.id===t.parentId);e&&(r.selectNode(e.id),ee(e.id))}break}case`Enter`:e.preventDefault(),n.focusedNodeId.value&&(c=n.tree.value,r.selectNode(n.focusedNodeId.value),o.value=n.focusedNodeId.value);break;case`a`:if(e.metaKey||e.ctrlKey){e.preventDefault();let t=np(n.tree.value,n.focusedNodeId.value,n.selectedNodeIds.value);t&&r.setSelection(n.focusedNodeId.value,t,n.focusedNodeId.value)}break;case`Escape`:e.preventDefault(),n.selectedNodeIds.value.size>1&&n.focusedNodeId.value?r.selectNode(n.focusedNodeId.value):r.setSelection(null,new Set,null);break;case`Delete`:case`Backspace`:{e.preventDefault();let{newTree:t,nextFocusId:i}=ip(n.tree.value,n.selectedNodeIds.value,u.value);if(t===n.tree.value)break;r.setTree(t),i?r.selectNode(i):r.setSelection(null,new Set,null);break}}}return er(gp,{schema:y,rootSchema:b,showDescriptions:t.showDescriptions,showCounts:t.showCounts,editingNodeId:o,collapsedIds:s,maxKeyLength:_,maxDepth:v,isFocused:a,dragState:d,onSelect:x,onToggleCollapse:S,onStartEditing:C,onDragStart:f,onDragOver:p,onDragEnd:m,onDrop:h}),(e,t)=>(R(),z(`div`,zp,[V(`div`,Bp,[H(xp)]),V(`div`,{ref_key:`containerRef`,ref:i,"data-form-container":``,tabindex:`0`,style:{flex:1,overflow:`auto`,outline:`none`},onKeydown:w,onFocus:t[0]||=()=>a.value=!0,onBlur:t[1]||=e=>{e.currentTarget.contains(e.relatedTarget)||(a.value=!1)}},[H(Rp,{node:l.value,depth:0},null,8,[`node`])],544)]))}}),Hp={style:{display:`flex`,alignItems:`center`,gap:`6px`,padding:`4px 8px`,backgroundColor:`var(--vj-bg, #1e1e1e)`,borderBottom:`1px solid var(--vj-border, #333333)`}},Up=[`value`],Wp={style:{display:`flex`,alignItems:`center`,gap:`2px`,flexShrink:0,height:`18px`}},Gp=[`disabled`],Kp=[`disabled`],qp=F({__name:`SearchBar`,props:{class:{}},setup(e){let{state:t,actions:n}=op(),r=ln(null);function i(e){var t;e.key===`Enter`&&(e.preventDefault(),e.shiftKey?n.prevSearchMatch():n.nextSearchMatch()),e.key===`Escape`&&(e.preventDefault(),n.setSearchQuery(``),(t=r.value)==null||t.blur())}function a(e){var t,n;(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),(t=r.value)==null||t.focus(),(n=r.value)==null||n.select())}return Zr(()=>document.addEventListener(`keydown`,a)),ti(()=>document.removeEventListener(`keydown`,a)),(e,a)=>(R(),z(`div`,Hp,[V(`input`,{ref_key:`inputRef`,ref:r,type:`text`,value:N(t).searchQuery.value,placeholder:`Search...`,spellcheck:`false`,autocomplete:`off`,style:{flex:1,background:`none`,border:`none`,borderRadius:`3px`,color:`var(--vj-text, #cccccc)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:`3px 8px`,outline:`none`,minWidth:0},onInput:a[0]||=e=>N(n).setSearchQuery(e.target.value),onKeydown:i},null,40,Up),V(`div`,Wp,[N(t).searchQuery.value?(R(),z(L,{key:0},[V(`span`,{style:k({fontSize:`11px`,lineHeight:1,color:N(t).searchMatches.value.length>0?`var(--vj-text-muted, #999999)`:`var(--vj-error, #f48771)`,fontFamily:`var(--vj-font, monospace)`,whiteSpace:`nowrap`})},j(N(t).searchMatches.value.length>0?`${N(t).searchMatchIndex.value+1}/${N(t).searchMatches.value.length}`:`0/0`),5),V(`button`,{disabled:N(t).searchMatches.value.length===0,"aria-label":`Previous match (Shift+Enter)`,title:`Previous match (Shift+Enter)`,style:k({background:`none`,border:`none`,color:N(t).searchMatches.value.length>0?`var(--vj-text, #cccccc)`:`var(--vj-text-dimmer, #555555)`,cursor:N(t).searchMatches.value.length>0?`pointer`:`default`,padding:0,fontSize:`10px`,lineHeight:1,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`18px`,height:`18px`}),onClick:a[1]||=(...e)=>N(n).prevSearchMatch&&N(n).prevSearchMatch(...e)},` ▲ `,12,Gp),V(`button`,{disabled:N(t).searchMatches.value.length===0,"aria-label":`Next match (Enter)`,title:`Next match (Enter)`,style:k({background:`none`,border:`none`,color:N(t).searchMatches.value.length>0?`var(--vj-text, #cccccc)`:`var(--vj-text-dimmer, #555555)`,cursor:N(t).searchMatches.value.length>0?`pointer`:`default`,padding:0,fontSize:`10px`,lineHeight:1,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`18px`,height:`18px`}),onClick:a[2]||=(...e)=>N(n).nextSearchMatch&&N(n).nextSearchMatch(...e)},` ▼ `,12,Kp),V(`button`,{"aria-label":`Clear search (Esc)`,title:`Clear search (Esc)`,style:{background:`none`,border:`none`,color:`var(--vj-text, #cccccc)`,cursor:`pointer`,padding:0,fontSize:`14px`,lineHeight:1,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`18px`,height:`18px`},onClick:a[3]||=()=>N(n).setSearchQuery(``)},` × `)],64)):(R(),z(L,{key:1},[V(`button`,{"aria-label":`Expand all`,title:`Expand all`,style:{background:`none`,border:`none`,color:`var(--vj-text-muted, #888888)`,cursor:`pointer`,padding:`2px`,fontSize:`12px`,lineHeight:1,display:`inline-flex`,alignItems:`center`},onClick:a[4]||=(...e)=>N(n).expandAll&&N(n).expandAll(...e)},[...a[6]||=[V(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M8 2v4M5 4l3-2 3 2`}),V(`path`,{d:`M8 14v-4M5 12l3 2 3-2`}),V(`path`,{d:`M2 8h12`})],-1)]]),V(`button`,{"aria-label":`Collapse all`,title:`Collapse all`,style:{background:`none`,border:`none`,color:`var(--vj-text-muted, #888888)`,cursor:`pointer`,padding:`2px`,fontSize:`12px`,lineHeight:1,display:`inline-flex`,alignItems:`center`},onClick:a[5]||=(...e)=>N(n).collapseAll&&N(n).collapseAll(...e)},[...a[7]||=[V(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M8 5V1M5 3l3 2 3-2`}),V(`path`,{d:`M8 11v4M5 13l3-2 3 2`}),V(`path`,{d:`M2 8h12`})],-1)]])],64))])]))}}),Jp={key:0,style:{flex:1,minHeight:0}},Yp={style:{display:`flex`,flexShrink:0,borderBottom:`1px solid var(--vj-border, #333333)`,backgroundColor:`var(--vj-bg-panel, #252526)`}},Xp={style:{flex:1,minHeight:0,overflow:`hidden`}},Zp={key:0,style:{display:`flex`,flexDirection:`column`,height:`100%`}},Qp={style:{flex:1,minHeight:0,overflow:`auto`}},$p={key:1,style:{display:`flex`,flexDirection:`column`,height:`100%`}},em={style:{flex:1,minHeight:0}},tm={style:{flex:1,minHeight:0,overflow:`auto`}},nm={key:0,style:{width:`1px`,flexShrink:0,backgroundColor:`var(--vj-border, #333333)`,position:`relative`,transition:`background-color 0.15s`}},rm={style:{display:`flex`,flexDirection:`column`,flex:1,minWidth:0,overflow:`hidden`}},im={style:{flex:1,minHeight:0}},am=F({__name:`JsonEditor`,props:{value:{type:[String,Number,Boolean,null,Array,Object]},defaultValue:{type:[String,Number,Boolean,null,Array,Object]},onChange:{},schema:{default:null},height:{default:`100%`},width:{default:`100%`},class:{},style:{},readOnly:{type:Boolean,default:!1},treeShowValues:{type:Boolean,default:!0},treeShowCounts:{type:Boolean,default:!1},editorShowDescriptions:{type:Boolean,default:!1},editorShowCounts:{type:Boolean,default:!1},sidebarOpen:{type:Boolean,default:!0}},emits:[`change`],setup(e,{emit:t}){let n=e,r=t,i=n.value!==void 0,a=ln(i?n.value:n.defaultValue??{}),o=ln(0);P(()=>n.value,e=>{i&&e!==a.value&&(a.value=e,o.value++)});function s(e){var t;a.value=e,n.readOnly||(r(`change`,e),(t=n.onChange)==null||t.call(n,e))}let c=ln(280),l=ln(!1),u=ln(`tree`),d=ln(null),f=!1,p=0,m=0,h=null;function g(){d.value&&(l.value=d.value.offsetWidth<500)}Zr(()=>{g(),d.value&&(h=new ResizeObserver(g),h.observe(d.value))}),ti(()=>{h?.disconnect()});function _(e){f=!0,p=e.clientX,m=c.value,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;function t(e){if(!f)return;let t=e.clientX-p;c.value=Math.max(180,Math.min(600,m+t))}function n(){f=!1,document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)}document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)}let v=G(()=>({height:typeof n.height==`number`?`${n.height}px`:n.height,width:typeof n.width==`number`?`${n.width}px`:n.width,display:`flex`,flexDirection:`column`,overflow:`hidden`,...Hf,...n.style??{}}));return(e,t)=>(R(),z(`div`,{"data-vj-root":``,style:k(v.value)},[(R(),B(ap,{key:o.value,value:a.value,schema:n.schema,onChange:s},{default:Zn(()=>[l.value?(R(),z(`div`,{key:0,ref_key:`containerRef`,ref:d,style:{display:`flex`,flexDirection:`column`,flex:1,minHeight:0}},[n.sidebarOpen?(R(),z(L,{key:1},[V(`div`,Yp,[V(`button`,{style:k({flex:1,fontSize:`11px`,padding:`4px 0`,cursor:`pointer`,fontFamily:`var(--vj-font, monospace)`,border:`none`,background:u.value===`tree`?`var(--vj-accent-muted, #094771)`:`transparent`,color:u.value===`tree`?`var(--vj-text, #cccccc)`:`var(--vj-text-muted, #999999)`}),onClick:t[0]||=()=>u.value=`tree`},` Tree `,4),V(`button`,{style:k({flex:1,fontSize:`11px`,padding:`4px 0`,cursor:`pointer`,fontFamily:`var(--vj-font, monospace)`,border:`none`,background:u.value===`form`?`var(--vj-accent-muted, #094771)`:`transparent`,color:u.value===`form`?`var(--vj-text, #cccccc)`:`var(--vj-text-muted, #999999)`}),onClick:t[1]||=()=>u.value=`form`},` Form `,4)]),V(`div`,Xp,[u.value===`tree`?(R(),z(`div`,Zp,[H(qp),V(`div`,Qp,[H(hp,{"show-values":n.treeShowValues,"show-counts":n.treeShowCounts},null,8,[`show-values`,`show-counts`])])])):(R(),z(`div`,$p,[V(`div`,em,[H(Vp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])])]))])],64)):(R(),z(`div`,Jp,[H(Vp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])]))],512)):(R(),z(`div`,{key:1,ref_key:`containerRef`,ref:d,style:{display:`flex`,flex:1,minHeight:0}},[V(`div`,{style:k({flexShrink:0,overflow:`hidden`,display:`flex`,flexDirection:`column`,width:n.sidebarOpen?c.value+`px`:`0`,transition:`width 0.2s ease`})},[H(qp),V(`div`,tm,[H(hp,{"show-values":n.treeShowValues,"show-counts":n.treeShowCounts},null,8,[`show-values`,`show-counts`])])],4),n.sidebarOpen?(R(),z(`div`,nm,[V(`div`,{style:{position:`absolute`,top:0,bottom:0,left:`-3px`,width:`7px`,cursor:`col-resize`,zIndex:10},onMousedown:_,onMouseenter:t[2]||=e=>{let t=e.currentTarget.parentElement;t&&(t.style.backgroundColor=`var(--vj-accent, #007acc)`)},onMouseleave:t[3]||=e=>{if(!N(f)){let t=e.currentTarget.parentElement;t&&(t.style.backgroundColor=`var(--vj-border, #333333)`)}}},null,32)])):W(``,!0),V(`div`,rm,[V(`div`,im,[H(Vp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])])])],512))]),_:1},8,[`value`,`schema`]))],4))}}),om={style:{backgroundColor:`var(--vj-bg, #1e1e1e)`,color:`var(--vj-text, #cccccc)`,overflow:`auto`,height:`100%`,display:`flex`,flexDirection:`column`}},sm={style:{display:`flex`,alignItems:`center`,gap:`12px`,padding:`6px 12px`,borderBottom:`1px solid var(--vj-border, #333333)`,backgroundColor:`var(--vj-bg-panel, #252526)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`12px`,flexShrink:0}},cm={style:{color:`var(--vj-text-muted, #999999)`}},lm={key:0,style:{color:`#4ec94e`}},um={key:1,style:{color:`#f48771`}},dm={key:2,style:{color:`#dcdcaa`}},fm={style:{flex:1,overflow:`auto`}},pm={key:0,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`var(--vj-text-dimmer, #555555)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`13px`}},mm={style:{color:`var(--vj-text, #cccccc)`,flexShrink:0,minWidth:`100px`}},hm={style:{flex:1,display:`flex`,gap:`8px`,overflow:`hidden`}},gm={style:{color:`#f48771`,textDecoration:`line-through`}},_m={style:{color:`#4ec94e`}},vm={key:1,style:{color:`#4ec94e`}},ym={key:2,style:{color:`#f48771`,textDecoration:`line-through`}};F({__name:`DiffView`,props:{originalJson:{},currentJson:{},class:{}},setup(e){let t=e,n=G(()=>If(t.originalJson,t.currentJson)),r=G(()=>n.value.filter(e=>e.type===`added`).length),i=G(()=>n.value.filter(e=>e.type===`removed`).length),a=G(()=>n.value.filter(e=>e.type===`changed`).length);function o(e){return Jf[e.type]}return(e,t)=>(R(),z(`div`,om,[V(`div`,sm,[V(`span`,cm,j(n.value.length===0?`No changes`:`${n.value.length} changes`),1),r.value>0?(R(),z(`span`,lm,`+`+j(r.value)+` added`,1)):W(``,!0),i.value>0?(R(),z(`span`,um,`-`+j(i.value)+` removed`,1)):W(``,!0),a.value>0?(R(),z(`span`,dm,`~`+j(a.value)+` modified`,1)):W(``,!0)]),V(`div`,fm,[n.value.length===0?(R(),z(`div`,pm,` No differences detected `)):W(``,!0),(R(!0),z(L,null,I(n.value,(e,n)=>(R(),z(`div`,{key:n,style:k({display:`flex`,alignItems:`flex-start`,padding:`3px 12px`,borderBottom:`1px solid var(--vj-border-subtle, #2a2a2a)`,backgroundColor:o(e).bg,fontFamily:`var(--vj-font, monospace)`,fontSize:`12px`,gap:`8px`})},[V(`span`,{style:k({color:o(e).label,fontWeight:600,width:`14px`,flexShrink:0,textAlign:`center`})},j(o(e).marker),5),V(`span`,mm,j(e.path),1),V(`span`,hm,[e.type===`changed`?(R(),z(L,{key:0},[V(`span`,gm,j(N(Yf)(e.oldValue)),1),t[0]||=V(`span`,{style:{color:`var(--vj-text-dim, #666666)`}},`→`,-1),V(`span`,_m,j(N(Yf)(e.newValue)),1)],64)):e.type===`added`?(R(),z(`span`,vm,j(N(Yf)(e.newValue)),1)):e.type===`removed`?(R(),z(`span`,ym,j(N(Yf)(e.oldValue)),1)):W(``,!0)])],4))),128))])]))}});var bm=`modulepreload`,xm=function(e){return`/`+e},Sm={};const Cm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=xm(t,n),t in Sm)return;Sm[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:bm,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};var wm=F({__name:`CodeEditor`,props:{modelValue:{},language:{default:`plaintext`},readOnly:{type:Boolean,default:!1}},emits:[`update:modelValue`,`save`],setup(e,{expose:t,emit:n}){let r=e,i=n,{effective:a}=wu(),o=M(null),s=null,c=!1;async function l(){if(!o.value||s)return;let{init:e}=await Cm(async()=>{let{init:e}=await import(`./dist-BH_oa-kv.js`);return{init:e}},[]),t=await e();t.editor.defineTheme(`piclaw-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#0a0e14`,"editorGutter.background":`#0a0e14`,"editorLineNumber.foreground":`#5c6773`}}),t.editor.defineTheme(`piclaw-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#ffffff`,"editorGutter.background":`#f5f5f7`,"editorLineNumber.foreground":`#86868b`}});let n=t.editor.createModel(r.modelValue,r.language);s=t.editor.create(o.value,{model:n,theme:a.value===`light`?`piclaw-light`:`piclaw-dark`,readOnly:r.readOnly,minimap:{enabled:!1},fontSize:12,fontFamily:`Geist Mono Variable, monospace`,lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:`on`}),n.onDidChangeContent(()=>{c||i(`update:modelValue`,n.getValue())}),s.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>{i(`save`)})}function u(){s?.dispose(),s=null}function d(){if(!s)return;let e=s.getModel();e&&e.getValue()!==r.modelValue&&(c=!0,e.setValue(r.modelValue),c=!1)}function f(){if(!s)return;let e=s.getModel();e&&Cm(async()=>{let{init:e}=await import(`./dist-BH_oa-kv.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setModelLanguage(e,r.language)}))}return P(()=>r.modelValue,d),P(()=>r.language,f),P(()=>r.readOnly,e=>s?.updateOptions({readOnly:e})),P(a,e=>{s&&Cm(async()=>{let{init:e}=await import(`./dist-BH_oa-kv.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setTheme(e===`light`?`piclaw-light`:`piclaw-dark`)}))}),Zr(l),ti(u),t({editor:()=>s}),(e,t)=>(R(),z(`div`,{ref_key:`el`,ref:o,class:`h-full w-full`},null,512))}}),Tm={class:`relative h-full min-h-0`},Em={class:`absolute top-1 right-5 z-10 flex items-center gap-0.5 bg-bg/80 backdrop-blur rounded px-1 py-0.5`},Dm=`piclaw:json-editor-mode`,Om=F({__name:`JsonEditor`,props:{value:{},readOnly:{type:Boolean,default:!1},schema:{default:null}},emits:[`change`,`validation`],setup(e,{emit:t}){let n=M(localStorage.getItem(Dm)||`visual`);P(n,e=>localStorage.setItem(Dm,e));let r=e,i=t,a=r.value??{},o=M(!0);function s(e){a=e,i(`change`,e)}P(()=>r.value,e=>{a=e??{}},{deep:!0});function c(e){e&&typeof e==`object`&&!Array.isArray(e)&&s(e)}let l={"--vj-bg":`var(--color-bg)`,"--vj-bg-panel":`var(--color-surface)`,"--vj-bg-hover":`var(--color-muted-dim)`,"--vj-bg-selected":`var(--color-accent-dim)`,"--vj-border":`var(--color-border)`,"--vj-text":`var(--color-text)`,"--vj-text-muted":`var(--color-muted)`,"--vj-accent":`var(--color-accent)`,"--vj-string":`var(--color-accent)`,"--vj-number":`var(--color-ok)`,"--vj-font":`var(--font-mono)`},u=M(JSON.stringify(a,null,2));function d(e){u.value=e;try{let t=JSON.parse(e);t&&typeof t==`object`&&!Array.isArray(t)&&s(t),o.value=!0,i(`validation`,{valid:!0})}catch(e){o.value=!1,i(`validation`,{valid:!1,error:e instanceof SyntaxError?e.message:`Invalid JSON`})}}function f(){let e=JSON.stringify(a,null,2);u.value!==e&&(u.value=e)}return P(n,e=>{e===`json`&&f()}),P(()=>[r.value,r.readOnly,r.schema],()=>{n.value===`json`&&f()},{deep:!0}),(e,t)=>(R(),z(`div`,Tm,[V(`div`,Em,[V(`button`,{type:`button`,class:A([`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wider font-medium transition-colors`,n.value===`json`?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:t[0]||=e=>n.value=`json`},` json `,2),V(`button`,{type:`button`,class:A([`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wider font-medium transition-colors`,n.value===`visual`?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:t[1]||=e=>n.value=`visual`},` visual `,2)]),Qn(H(wm,{"model-value":u.value,language:`json`,"read-only":r.readOnly,class:`h-full`,"onUpdate:modelValue":d},null,8,[`model-value`,`read-only`]),[[$o,n.value===`json`]]),n.value===`visual`?(R(),B(N(am),{key:0,value:N(a),schema:r.schema??void 0,"read-only":r.readOnly,"editor-show-descriptions":!!r.schema,height:`100%`,width:`100%`,style:l,onChange:c},null,8,[`value`,`schema`,`read-only`,`editor-show-descriptions`])):W(``,!0)]))}}),km={class:`p-3 h-full min-h-0`},Am=F({__name:`ConfigTab`,setup(e){let t=M(null);return ld(`pi_status`,async()=>{t.value=await Pu(`/api/pi/status`)}),(e,n)=>(R(),z(`div`,km,[H(Om,{value:t.value,"read-only":!0},null,8,[`value`])]))}}),jm={class:`flex flex-col h-full`},Mm={class:`px-3 py-3 border-b border-border bg-surface/40`},Nm={class:`flex flex-wrap items-center gap-4 text-[12px]`},Pm={class:`flex items-center gap-2`},Fm={class:`flex items-center gap-2 min-w-0`},Im={class:`px-3 py-2 flex gap-2 items-center border-b border-border`},Lm=[`value`],Rm={class:`px-3 py-2 text-[11px] text-muted border-b border-border`},zm={class:`overflow-auto flex-1 min-h-0`},Bm={class:`w-full border-collapse text-[12px]`},Vm={key:0},Hm={key:1},Um={class:`py-1.5 px-2 border-b border-border text-muted select-text`},Wm={class:`py-1.5 px-2 border-b border-border font-medium select-text`},Gm={class:`ml-1.5 text-[10px] text-muted`},Km={class:`py-1.5 px-2 border-b border-border text-center`},qm=[`disabled`,`onClick`],Jm={key:1,class:`badge-accent border border-accent`},Ym={class:`py-1.5 px-2 border-b border-border text-[10px] text-muted select-text`},Xm={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Zm={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Qm={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},$m={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},eh={class:`py-1.5 px-2 border-b border-border`},th={key:0,class:`badge-accent mr-1`},nh={key:1,class:`badge-ok`},rh=F({__name:`ModelsTab`,setup(e){let t=M(null),n=M(``),r=M(``),i=M(!1);async function a(){t.value=await Pu(`/api/pi/models`)}ld(`pi_status`,a);let o=G(()=>t.value?[...new Set(t.value.models.map(e=>e.provider))].sort():[]),s=G(()=>{if(!t.value)return{};let e={};for(let n of t.value.models)e[n.provider]=(e[n.provider]||0)+1;return e}),c=G(()=>{if(!t.value)return[];let e=t.value.models;if(r.value&&(e=e.filter(e=>e.provider===r.value)),n.value.trim()){let t=n.value.trim().toLowerCase();e=e.filter(e=>e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.provider.toLowerCase().includes(t))}return e});function l(e){return!!t.value&&t.value.defaultModel===e.id&&t.value.defaultProvider===e.provider}async function u(e){if(!i.value){i.value=!0;try{await Pu(`/api/pi/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaultModel:e.id,defaultProvider:e.provider})}),await a()}finally{i.value=!1}}}function d(e){return e>=1e6?`${(e/1e6).toFixed(0)}m`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}function f(e){return e===0?`0`:e<.01?e.toFixed(3):e<1?e.toFixed(2):e.toFixed(1)}return(e,a)=>(R(),z(`div`,jm,[V(`div`,Mm,[a[4]||=V(`div`,{class:`text-[10px] uppercase tracking-wider text-muted mb-2`},`default model`,-1),V(`div`,Nm,[V(`div`,Pm,[a[2]||=V(`span`,{class:`text-muted`},`provider`,-1),V(`span`,{class:A([`px-2 py-0.5 rounded border border-border font-medium select-text`,t.value?.defaultProvider?`text-accent bg-accent-dim`:`text-muted`])},j(t.value?.defaultProvider||`—`),3)]),V(`div`,Fm,[a[3]||=V(`span`,{class:`text-muted`},`model`,-1),V(`span`,{class:A([`px-2 py-0.5 rounded border border-border font-mono text-[11px] max-w-[60ch] truncate select-text`,t.value?.defaultModel?`text-accent bg-accent-dim`:`text-muted`])},j(t.value?.defaultModel||`—`),3)])])]),V(`div`,Im,[Qn(V(`input`,{"onUpdate:modelValue":a[0]||=e=>n.value=e,placeholder:`search models...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,512),[[Hs,n.value]]),Qn(V(`select`,{"onUpdate:modelValue":a[1]||=e=>r.value=e,class:`bg-bg border border-border rounded text-text px-2 py-1 text-[12px] font-mono outline-none transition-colors focus:border-accent`},[a[5]||=V(`option`,{value:``},`all providers`,-1),(R(!0),z(L,null,I(o.value,e=>(R(),z(`option`,{key:e,value:e},j(e)+` (`+j(s.value[e])+`) `,9,Lm))),128))],512),[[Us,r.value]])]),V(`div`,Rm,j(t.value?c.value.length:`-`)+`/`+j(t.value?.models.length??`-`)+` models `,1),V(`div`,zm,[V(`table`,Bm,[a[8]||=V(`thead`,{class:`sticky top-0 bg-bg z-10`},[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` provider `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` model `),V(`th`,{class:`text-center text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-16`}),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` api `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` ctx `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` max out `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` $/m in `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` $/m out `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` flags `)])],-1),V(`tbody`,null,[t.value?c.value.length===0?(R(),z(`tr`,Hm,[...a[7]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`no models found`,-1)]])):W(``,!0):(R(),z(`tr`,Vm,[...a[6]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`loading...`,-1)]])),(R(!0),z(L,null,I(c.value,e=>(R(),z(`tr`,{key:`${e.provider}/${e.id}`,class:A([`hover:bg-surface`,l(e)?`bg-accent-dim/30`:``])},[V(`td`,Um,j(e.provider),1),V(`td`,Wm,[V(`span`,null,j(e.name),1),V(`span`,Gm,j(e.id),1)]),V(`td`,Km,[l(e)?(R(),z(`span`,Jm,` active `)):(R(),z(`button`,{key:0,type:`button`,class:`btn-sm hover:text-accent hover:border-accent bg-bg disabled:opacity-40`,disabled:i.value,onClick:t=>u(e)},` use `,8,qm))]),V(`td`,Ym,j(e.api),1),V(`td`,Xm,j(d(e.contextWindow)),1),V(`td`,Zm,j(d(e.maxTokens)),1),V(`td`,Qm,j(f(e.cost.input)),1),V(`td`,$m,j(f(e.cost.output)),1),V(`td`,eh,[e.reasoning?(R(),z(`span`,th,`reasoning`)):W(``,!0),e.input.includes(`image`)?(R(),z(`span`,nh,`vision`)):W(``,!0)])],2))),128))])])])]))}}),ih={class:`flex flex-col h-full min-h-0`},ah={class:`px-3 py-2 border-b border-border flex items-center gap-2`},oh=[`onClick`],sh={class:`ml-auto flex items-center gap-2`},ch={key:0,class:`text-[11px] text-err truncate max-w-[200px]`},lh=[`disabled`],uh={key:2,class:`text-[11px] text-muted`},dh={class:`flex-1 min-h-0 p-3`},fh={class:`h-full border border-border`},ph=F({__name:`SettingsTab`,setup(e){let t={settings:{label:`settings.json`,endpoint:`/api/pi/settings`,schemaKey:`settings`},"models-config":{label:`models.json`,endpoint:`/api/pi/models-config`,schemaKey:`modelsConfig`},auth:{label:`auth.json`,endpoint:`/api/pi/auth`}},n=M(`settings`),r=M(null),i=M(null),a=M(!1),o=M(null),s=M(null),c=M(null),l=``,u=M(!1),d=()=>{let e=t[n.value].schemaKey;return!e||!i.value?null:i.value[e]??null};async function f(){i.value=await Pu(`/api/pi/schemas`)}async function p(){s.value=null,c.value=null,u.value=!1,o.value=null,r.value=(await Pu(t[n.value].endpoint))?.data??null,l=JSON.stringify(r.value)}function m(e){o.value=e,u.value=JSON.stringify(e)!==l}function h(e){c.value=e.valid?null:e.error??`Invalid JSON`,e.valid||(u.value=!0)}async function g(){if(o.value){a.value=!0,s.value=null;try{let e=await fetch(t[n.value].endpoint,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o.value)});if(!e.ok){s.value=await e.text();return}r.value=o.value,l=JSON.stringify(r.value),u.value=!1,o.value=null}catch(e){s.value=e instanceof Error?e.message:String(e)}finally{a.value=!1}}}function _(){o.value=null,u.value=!1,c.value=null,r.value=r.value?{...r.value}:null}function v(e){!e.metaKey&&!e.ctrlKey||(e.key===`s`&&u.value&&!c.value&&!a.value?(e.preventDefault(),g()):e.key===`d`&&u.value&&(e.preventDefault(),_()))}return Zr(()=>{f(),window.addEventListener(`keydown`,v)}),ti(()=>window.removeEventListener(`keydown`,v)),P(n,()=>p(),{immediate:!0}),(e,i)=>(R(),z(`div`,ih,[V(`div`,ah,[(R(),z(L,null,I(t,(e,t)=>V(`button`,{key:t,type:`button`,class:A([`px-2.5 py-1 rounded text-[11px] font-mono transition-colors`,n.value===t?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:e=>n.value=t},j(e.label),11,oh)),64)),V(`div`,sh,[s.value||c.value?(R(),z(`span`,ch,j(s.value||c.value),1)):W(``,!0),u.value?(R(),z(L,{key:1},[V(`button`,{type:`button`,class:`px-2.5 py-1 rounded text-[11px] font-medium bg-surface text-muted hover:text-text transition-colors`,title:`⌘D`,onClick:_},[...i[0]||=[U(` discard `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`⌘D`,-1)]]),V(`button`,{type:`button`,class:`px-2.5 py-1 rounded text-[11px] font-medium bg-accent text-bg transition-colors disabled:opacity-50`,disabled:a.value||!!c.value,title:`⌘S`,onClick:g},[a.value?(R(),z(L,{key:0},[U(`saving...`)],64)):(R(),z(L,{key:1},[i[1]||=U(`save `,-1),i[2]||=V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`⌘S`,-1)],64))],8,lh)],64)):(R(),z(`span`,uh,`~/.pi/agent/`+j(t[n.value].label),1))])]),V(`div`,dh,[V(`div`,fh,[(R(),B(Om,{key:n.value,value:r.value,schema:d(),"read-only":!1,onChange:m,onValidation:h},null,8,[`value`,`schema`]))])])]))}}),mh={class:`flex flex-col h-full`},hh={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},gh={key:`agent`,label:`Pi SDK`,icon:`lucide:bot`,color:`#39bae6`,component:F({__name:`window`,setup(e){let t=[`auth`,`models`,`settings`,`status`],{state:n,set:r}=Du(),i=M(t.includes(n.value.tab)?n.value.tab:`auth`);return P(i,e=>r({tab:e})),(e,t)=>(R(),z(`div`,mh,[V(`div`,hh,[V(`button`,{type:`button`,class:A(i.value===`auth`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`auth`},` auth `,2),V(`button`,{type:`button`,class:A(i.value===`models`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`models`},` models `,2),V(`button`,{type:`button`,class:A(i.value===`settings`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>i.value=`settings`},` settings `,2),V(`button`,{type:`button`,class:A(i.value===`status`?`tab-active`:`tab-inactive`),onClick:t[3]||=e=>i.value=`status`},` status `,2)]),i.value===`auth`?(R(),B(of,{key:0})):i.value===`models`?(R(),B(rh,{key:1})):i.value===`settings`?(R(),B(ph,{key:2})):i.value===`status`?(R(),B(Am,{key:3})):W(``,!0)]))}}),window:{width:900,height:520,minwidth:480,minheight:300}},_h={class:`flex flex-col h-full overflow-hidden bg-bg`},vh={class:`shrink-0 flex items-center gap-1.5 px-3 py-1.5 bg-surface border-b border-border`},yh={class:`flex items-center gap-0.5 shrink-0`},bh=[`disabled`],xh={class:`browser-url-bar flex-1`},Sh={key:0,class:`shrink-0 text-muted`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ch={key:1,class:`shrink-0 text-muted`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},wh=[`value`],Th=[`title`],Eh=[`fill`],Dh={key:0,class:`shrink-0 flex items-center gap-1 px-2 py-1 bg-surface border-b border-border min-w-0 overflow-x-auto [scrollbar-width:none]`},Oh=[`onClick`,`onContextmenu`],kh=[`onClick`],Ah={key:0,class:`browser-tab-spinner`},jh={class:`truncate text-[12px]`},Mh={class:`flex-1 min-h-0 relative`},Nh={key:0,class:`absolute inset-0 z-20 flex items-center justify-center`},Ph={class:`grid grid-cols-2 gap-3 p-6 max-w-[320px] w-full`},Fh=[`onClick`],Ih={class:`quick-page-icon`},Lh={key:0,width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Rh={key:1,width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},zh={key:2,width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Bh={key:3,width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Vh={class:`quick-page-label`},Hh=[`src`,`title`,`onLoad`],Uh={key:`browser`,label:`Browser`,icon:`lucide:globe`,color:`#39bae6`,lightColor:`#0077cc`,component:Ju(F({__name:`window`,setup(e){let{state:t,set:n,setTitle:r}=Du(),i=Yt([]),a=M(null),o=0,s,c=null,l=0,u=G(()=>i.find(e=>e.id===a.value)),d=M(``),f=M(null),p=M(!1),m=M(new Map),h=G(()=>{if(p.value)return d.value;try{return new URL(d.value).hostname}catch{return d.value}});function g(e=``){let t=++o,n=Yt({id:t,url:e,title:`new tab`,loading:!1,useProxy:!0});return i.push(n),_(t),e?le():zn(()=>{f.value?.focus(),f.value?.select()}),n}function _(e){a.value=e;let t=i.find(t=>t.id===e);t&&(d.value=t.url,n({activeTab:String(e)}),le())}function v(e){let t=i.findIndex(t=>t.id===e);if(!(t<0)){if(m.value.delete(e),i.splice(t,1),i.length===0){a.value=null,d.value=``,le();return}if(a.value===e){let e=i[Math.min(t,i.length-1)];e&&_(e.id)}le()}}let y=[{url:`https://piclaw.sh`,label:`PiClaw`,icon:`compass`},{url:`https://www.wikipedia.org`,label:`Wikipedia`,icon:`search`},{url:`https://github.com`,label:`GitHub`,icon:`code`},{url:`https://neal.fun`,label:`Neal.fun`,icon:`zap`}];function b(e){let t=u.value;t&&!t.url?(t.url=e,t.loading=!0,d.value=e,le()):g(e)}function x(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w-]+(\.[\w-]+)+/.test(t)?`https://${t}`:`https://html.duckduckgo.com/html?q=${encodeURIComponent(t)}`:``}function S(e){return`/api/proxy?url=${encodeURIComponent(e)}`}function C(e){e?.preventDefault();let t=x(d.value);if(t){if(!u.value){g(t),f.value?.blur();return}u.value.url=t,u.value.loading=!0,d.value=t,f.value?.blur(),le()}}function ee(e){try{return new URL(e).searchParams.get(`url`)||void 0}catch{return}}function w(e){let t=m.value.get(e.id);if(t){try{let n=t.contentWindow?.location.href;if(n&&n!==`about:blank`){let r=(e.useProxy?ee(n):void 0)||e.url;e.url!==r&&(e.url=r,e.id===a.value&&(d.value=r));let i=t.contentDocument?.title;if(i)e.title=i;else try{e.title=new URL(r).hostname}catch{e.title=`page`}return}}catch{}try{e.title=new URL(e.url).hostname}catch{e.title=`page`}}}function T(e){let t=i.find(t=>t.id===e);t&&(t.loading=!1,w(t))}function E(e,t){t?m.value.set(e,t):m.value.delete(e)}let{menu:D,onContext:te,close:ne}=uu();function re(){let e=u.value;e&&ie(e)}function ie(e){e.useProxy=!e.useProxy,e.loading=!0;let t=m.value.get(e.id);t&&(t.src=e.useProxy?S(e.url):e.url)}function O(){let e=u.value;if(!e)return;let t=m.value.get(e.id);t&&(e.loading=!0,t.src=e.useProxy?S(e.url):e.url)}function ae(){p.value=!0,zn(()=>f.value?.select())}function oe(){p.value=!1,u.value&&(d.value=u.value.url)}function se(e){e.key===`Escape`&&f.value?.blur()}function ce(e){(e.metaKey||e.ctrlKey)&&e.key===`t`&&(e.preventDefault(),g()),(e.metaKey||e.ctrlKey)&&e.key===`w`&&(e.preventDefault(),a.value!==null&&v(a.value)),(e.metaKey||e.ctrlKey)&&e.key===`l`&&(e.preventDefault(),f.value?.focus(),f.value?.select()),(e.metaKey||e.ctrlKey)&&e.key===`r`&&(e.preventDefault(),O())}function le(){clearTimeout(s),s=setTimeout(ue,500)}async function ue(e){let t=i.filter(e=>e.url),n={tabs:t.map(e=>({id:e.id,url:e.url})),activeTabId:t.some(e=>e.id===a.value)?a.value:null},r=e?.silent?`/api/browser?silent=1`:`/api/browser`;try{let e=await fetch(r,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});e.ok&&(l=(await e.json()).rev??l)}catch{}}function de(e){if(l=e.rev??0,!e.tabs?.length)return!1;o=Math.max(0,...e.tabs.map(e=>e.id)),i.splice(0,i.length);for(let t of e.tabs)i.push(Yt({id:t.id,url:t.url,title:`loading…`,loading:!!t.url,useProxy:!0}));return e.activeTabId!=null&&i.some(t=>t.id===e.activeTabId)?_(e.activeTabId):i.length&&_(i[0].id),!0}function fe(e){if(e.rev===l)return;l=e.rev;let t=new Set(i.map(e=>e.id)),n=new Set(e.tabs.map(e=>e.id));for(let n of e.tabs)if(!t.has(n.id))o=Math.max(o,n.id),i.push(Yt({id:n.id,url:n.url,title:`loading…`,loading:!!n.url,useProxy:!0}));else{let e=i.find(e=>e.id===n.id);e&&e.url!==n.url&&(e.url=n.url,e.useProxy=!1,e.loading=!!n.url,e.id===a.value&&(d.value=n.url))}for(let e=i.length-1;e>=0;e--)n.has(i[e].id)||(m.value.delete(i[e].id),i.splice(e,1));e.activeTabId!==null&&e.activeTabId!==a.value&&i.some(t=>t.id===e.activeTabId)&&_(e.activeTabId),i.length===0&&(a.value=null,d.value=``)}function pe(){let e=!0;c=new EventSource(`/api/browser`),c.onmessage=n=>{try{let r=JSON.parse(n.data);if(e){if(e=!1,!de(r)){let e=t.value.url;e&&g(e)}return}fe(r)}catch{}}}P(()=>u.value?.title,e=>{r(e?`${e} — browser`:`browser`)});let me;return Zr(()=>{window.addEventListener(`keydown`,ce),pe(),me=setInterval(()=>{for(let e of i)e.url&&w(e)},2e3)}),ti(()=>{window.removeEventListener(`keydown`,ce),clearInterval(me),c?.close(),clearTimeout(s),ue({silent:!0})}),(e,t)=>(R(),z(`div`,_h,[V(`div`,vh,[V(`div`,yh,[t[5]||=Ga(`<button type="button" class="browser-nav-btn" title="back" disabled data-v-d6c96b32><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6c96b32><path d="M15 18l-6-6 6-6" data-v-d6c96b32></path></svg></button><button type="button" class="browser-nav-btn" title="forward" disabled data-v-d6c96b32><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6c96b32><path d="M9 18l6-6-6-6" data-v-d6c96b32></path></svg></button>`,2),V(`button`,{type:`button`,class:`browser-nav-btn`,title:`reload`,disabled:!u.value?.url,onClick:O},[...t[4]||=[V(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`polyline`,{points:`23 4 23 10 17 10`}),V(`path`,{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`})],-1)]],8,bh)]),V(`form`,{class:`flex-1 flex items-center`,onSubmit:Js(C,[`prevent`])},[V(`div`,xh,[u.value?.url&&!p.value?(R(),z(`svg`,Sh,[...t[6]||=[V(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`,ry:`2`},null,-1),V(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`},null,-1)]])):W(``,!0),!u.value?.url&&!p.value?(R(),z(`svg`,Ch,[...t[7]||=[V(`circle`,{cx:`11`,cy:`11`,r:`8`},null,-1),V(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},null,-1)]])):W(``,!0),V(`input`,{ref_key:`urlInputRef`,ref:f,value:p.value?d.value:h.value,type:`text`,class:A([`browser-url-input`,{"text-center":!p.value}]),placeholder:`search or enter url`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,onInput:t[0]||=e=>d.value=e.target.value,onFocus:ae,onBlur:oe,onKeydown:se},null,42,wh)])],32),u.value?.url?(R(),z(`button`,{key:0,type:`button`,class:A([`browser-proxy-btn shrink-0`,u.value?.useProxy?`active`:``]),title:u.value?.useProxy?`proxy enabled — click for direct`:`direct — click to proxy`,onClick:re},[(R(),z(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:u.value?.useProxy?`currentColor`:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...t[8]||=[V(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z`},null,-1)]],8,Eh))],10,Th)):W(``,!0),V(`button`,{type:`button`,class:`browser-nav-btn shrink-0`,title:`new tab`,onClick:t[1]||=e=>g()},[...t[9]||=[V(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),V(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})],-1)]])]),i.length>0?(R(),z(`div`,Dh,[(R(!0),z(L,null,I(i,e=>(R(),z(`button`,{key:e.id,type:`button`,class:A([`browser-tab`,e.id===a.value?`browser-tab-active`:`browser-tab-inactive`]),onClick:t=>_(e.id),onContextmenu:t=>N(te)(t,e.id)},[V(`span`,{class:`browser-tab-close`,onClick:Js(t=>v(e.id),[`stop`])},`×`,8,kh),e.loading?(R(),z(`span`,Ah)):W(``,!0),V(`span`,jh,j(e.url?e.title:`new tab`),1)],42,Oh))),128))])):W(``,!0),H(Hl,{pos:N(D)??null},{default:Zn(()=>[V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:t[2]||=()=>{let e=i.find(e=>e.id===N(D)?.data);e&&ie(e),N(ne)()}},j(i.find(e=>e.id===N(D)?.data)?.useProxy?`Disable Proxy`:`Enable Proxy`),1),V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:t[3]||=()=>{N(D)?.data!=null&&v(N(D).data),N(ne)()}},` Close Tab `)]),_:1},8,[`pos`]),V(`div`,Mh,[i.length===0||!u.value?.url?(R(),z(`div`,Nh,[V(`div`,Ph,[(R(),z(L,null,I(y,e=>V(`button`,{key:e.url,type:`button`,class:`quick-page`,onClick:t=>b(e.url)},[V(`div`,Ih,[e.icon===`compass`?(R(),z(`svg`,Lh,[...t[10]||=[V(`circle`,{cx:`12`,cy:`12`,r:`10`},null,-1),V(`polygon`,{points:`16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76`},null,-1)]])):e.icon===`search`?(R(),z(`svg`,Rh,[...t[11]||=[V(`circle`,{cx:`11`,cy:`11`,r:`8`},null,-1),V(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},null,-1)]])):e.icon===`code`?(R(),z(`svg`,zh,[...t[12]||=[V(`polyline`,{points:`16 18 22 12 16 6`},null,-1),V(`polyline`,{points:`8 6 2 12 8 18`},null,-1)]])):e.icon===`zap`?(R(),z(`svg`,Bh,[...t[13]||=[V(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`},null,-1)]])):W(``,!0)]),V(`span`,Vh,j(e.label),1)],8,Fh)),64))])])):W(``,!0),(R(!0),z(L,null,I(i,e=>(R(),z(`div`,{key:e.id,class:A([`absolute inset-0`,e.id===a.value?`z-10`:`z-0 invisible`])},[e.url?(R(),z(`iframe`,{key:0,ref_for:!0,ref:t=>E(e.id,t),src:e.useProxy?S(e.url):e.url,class:`block w-full h-full border-none bg-white`,title:e.title,onLoad:t=>T(e.id)},null,40,Hh)):W(``,!0)],2))),128))])]))}}),[[`__scopeId`,`data-v-d6c96b32`]]),window:{width:900,height:900,minwidth:480,minheight:360},multi:!1},Wh={text:``,thinking:``,isStreaming:!1,isInitializing:!1,isAgentDone:!1,activeTool:null,tools:[],details:[],error:null};function Gh(e){let t=M({...Wh}),n;function r(e){i(),t.value={...Wh},n=new EventSource(`/api/stream?jid=${encodeURIComponent(e)}`,{withCredentials:!0}),n.addEventListener(`session_init`,()=>{t.value={...Wh,isInitializing:!0}}),n.addEventListener(`text_delta`,e=>{let n=JSON.parse(e.data);t.value={...t.value,text:t.value.text+n.delta,isStreaming:!0,isInitializing:!1}}),n.addEventListener(`text_end`,()=>{t.value={...t.value,isStreaming:!1,activeTool:null}}),n.addEventListener(`thinking_delta`,e=>{let n=JSON.parse(e.data),r=t.value.thinking+n.delta,i=[...t.value.details],a=i[i.length-1];a&&a.type===`thinking`?i[i.length-1]={type:`thinking`,text:a.text+n.delta}:i.push({type:`thinking`,text:n.delta}),t.value={...t.value,thinking:r,details:i,isStreaming:!0}}),n.addEventListener(`thinking_end`,()=>{}),n.addEventListener(`tool_start`,e=>{let n=JSON.parse(e.data),r={name:n.toolName,done:!1};t.value={...t.value,activeTool:n.toolName,isInitializing:!1,tools:[...t.value.tools,r],details:[...t.value.details,{type:`tool`,tool:r}]}}),n.addEventListener(`tool_end`,e=>{let n=JSON.parse(e.data),r=[...t.value.tools],i=[...t.value.details],a={name:n.toolName,done:!0,isError:n.isError,resultPreview:n.resultPreview};for(let e=r.length-1;e>=0;e--)if(r[e].name===n.toolName&&!r[e].done){r[e]=a;break}for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.type===`tool`&&t.tool.name===n.toolName&&!t.tool.done){i[e]={type:`tool`,tool:a};break}}t.value={...t.value,activeTool:null,tools:r,details:i}}),n.addEventListener(`error`,e=>{let n=JSON.parse(e.data);t.value={...t.value,error:n.error||`Unknown error`,isStreaming:!1,isInitializing:!1,activeTool:null}}),n.addEventListener(`agent_end`,()=>{t.value={...t.value,isStreaming:!1,isInitializing:!1,isAgentDone:!0,activeTool:null}})}function i(){n?.close(),n=void 0}P(e,e=>{e?r(e):i()},{immediate:!0});function a(){t.value={...t.value,text:``,thinking:``,details:[]}}function o(){t.value={...Wh}}return ti(i),{streamState:t,clearStreamText:a,clearStream:o}}function Kh(e){if(!e)return``;let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}function qh(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?`just now`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function Jh(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`}function Yh(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}function Xh(e){switch(e){case`active`:return`badge-ok`;case`paused`:return`badge-warn`;case`completed`:return`badge-muted`;case`error`:return`badge-danger`;default:return`badge-muted`}}var Zh;const Qh=M(!1);var $h=(()=>{let e;return()=>e??=Cm(()=>import(`./defult-D5RLDUrI.js`).then(async e=>{await e.init(),Zh=e.parseAST,Qh.value=!0}),[])})();$h();function eg(e){return e.map(e=>typeof e==`string`?e:eg(e.slice(2))).join(``)}function tg(e){if(typeof e==`string`)return e.replace(/(\uFFFAPI_MK_\d+\uFFFA|\uFFFATK_\d+\uFFFA)|([^\uFFFA]+)/g,(e,t,n)=>t||Kh(n));let[t,n,...r]=e,i=()=>r.map(e=>tg(e)).join(``);switch(t){case`p`:return`<p>${i()}</p>`;case`h1`:case`h2`:case`h3`:case`h4`:case`h5`:case`h6`:return`<${t}>${i()}</${t}>`;case`strong`:return`<strong>${i()}</strong>`;case`em`:return`<em>${i()}</em>`;case`u`:return`<u>${i()}</u>`;case`del`:return`<del>${i()}</del>`;case`code`:return`<code>${Kh(eg(r))}</code>`;case`pre`:{let e=r.find(e=>typeof e!=`string`&&e[0]===`code`),t=String(n.language||``),i=eg(e?e.slice(2):r);return`<pre><code${t?` class="language-${Kh(t)}"`:``}>${Kh(i)}</code></pre>`}case`a`:return`<a href="${Kh(String(n.href||``))}" target="_blank" rel="noopener">${i()}</a>`;case`img`:{let e=String(n.src||``),t=String(n.alt||``);return`<img src="${Kh(e)}" alt="${Kh(t)}" />`}case`blockquote`:return`<blockquote>${i()}</blockquote>`;case`ul`:return`<ul>${i()}</ul>`;case`ol`:return`<ol>${i()}</ol>`;case`li`:return`<li>${i()}</li>`;case`hr`:return`<hr />`;case`br`:return`<br />`;case`table`:return`<table>${i()}</table>`;case`thead`:return`<thead>${i()}</thead>`;case`tbody`:return`<tbody>${i()}</tbody>`;case`tr`:return`<tr>${i()}</tr>`;case`th`:return`<th>${i()}</th>`;case`td`:return`<td>${i()}</td>`;default:return i()}}function ng(e){return e.nodes.map(e=>tg(e)).join(``)}function rg(e){return Kh(e).replace(/\*\*(.+?)\*\*/g,`<strong>$1</strong>`).replace(/\*(.+?)\*/g,`<em>$1</em>`).replace(/`(.+?)`/g,`<code>$1</code>`).replace(/\n/g,`<br>`)}function ig(e){return Zh?ng(Zh(e)):rg(e)}function ag(e){if(!e)return``;Zh||$h(),Qh.value;let t=[],n=0,r=e.replace(/<(internal|thinking)>([\s\S]*?)<\/\1>/g,(e,r,i)=>{let a=`\uFFFAPI_MK_${n++}\uFFFA`,o=ig(i);return t.push([a,`<details class="thinking-block"><summary>thinking</summary><div>${o}</div></details>`]),a});r=r.replace(/<details><summary>thinking<\/summary>([\s\S]*?)<\/details>/g,(e,r)=>{let i=`\uFFFAPI_MK_${n++}\uFFFA`,a=r.trim(),o=[],s=0,c=ig(a.replace(/<tool\s+name="([^"]+)"\s+status="([^"]+)"(?:\s+preview="([^"]*)")?\s*\/>/g,(e,t,n,r)=>{let i=`\uFFFATK_${s++}\uFFFA`,a=n===`error`,c=a?`tool-marker tool-error`:`tool-marker`,l=a?`✗`:`✓`,u=r?`<details class="${c}"><summary>${l} ${Kh(t)}</summary><span class="tool-preview">${Kh(r.replaceAll(`"`,`"`))}</span></details>`:`<span class="${c}">${l} ${Kh(t)}</span>`;return o.push([i,u]),i}));for(let[e,t]of o)c=c.replaceAll(e,t);return t.push([i,`<details class="thinking-block"><summary>thinking</summary><div>${c}</div></details>`]),i}),r=r.replace(/<tool\s+name="([^"]+)"\s+status="([^"]+)"(?:\s+preview="([^"]*)")?\s*\/>/g,(e,r,i,a)=>{let o=`\uFFFAPI_MK_${n++}\uFFFA`,s=i===`error`,c=s?`tool-marker tool-error`:`tool-marker`,l=s?`✗`:`✓`;if(a){let e=Kh(a.replaceAll(`"`,`"`));t.push([o,`<details class="${c}"><summary>${l} ${Kh(r)}</summary><span class="tool-preview">${e}</span></details>`])}else t.push([o,`<span class="${c}">${l} ${Kh(r)}</span>`]);return o});let i=ig(r);for(let[e,n]of t)i=i.replaceAll(e,n);return i}var og=globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition;function sg(e,t){let n=M(!1),r=!!og,i,a=!1,o,s=!1;function c(){o&&=(clearTimeout(o),void 0)}function l(){c(),t&&(o=setTimeout(()=>{s&&(s=!1,t())},1500))}function u(){r&&(i=new og,i.continuous=!1,i.interimResults=!1,i.lang=`en-US`,s=!1,i.onresult=t=>{let n=t.results[t.results.length-1];n?.isFinal&&(s=!0,e(n[0].transcript.trim()),l())},i.onend=()=>{n.value&&!a?i.start():(c(),n.value=!1)},i.onerror=e=>{if(e.error===`no-speech`&&n.value&&!a){i.start();return}c(),n.value=!1},i.start(),n.value=!0,a=!1)}function d(){a=!0,c(),i&&i.stop(),n.value=!1}function f(){n.value?d():u()}return ti(d),{listening:n,supported:r,toggle:f,stop:d}}function cg(e){let{settings:t}=Su(),n=M(``),r=M(!1);P(()=>e.value.text,e=>{e&&(n.value=e)}),P(()=>e.value.isStreaming,(e,r)=>{r&&!e&&t.tts.enabled&&n.value&&o(n.value),e||(n.value=``)});function i(){t.tts.enabled=!t.tts.enabled,t.tts.enabled||a()}function a(){speechSynthesis.cancel(),r.value=!1}function o(e){a();let n=e.replace(/<internal>[\s\S]*?<\/internal>/g,``).replace(/```[\s\S]*?```/g,``).replace(/`[^`]+`/g,``).replace(/<[^>]+>/g,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/!\[([^\]]*)\]\([^)]+\)/g,`$1`).replace(/[#*_~>\-|]/g,``).replace(/\p{Emoji_Presentation}/gu,``).replace(/\p{Extended_Pictographic}/gu,``).replace(/\u200D/g,``).replace(/\uFE0F/g,``).replace(/\n+/g,` `).replace(/\s{2,}/g,` `).trim();if(!n)return;let i=new SpeechSynthesisUtterance(n),{tts:o}=t;i.lang=o.lang,i.rate=o.rate,i.pitch=o.pitch,i.volume=o.volume;let s=speechSynthesis.getVoices(),c=o.voiceMatch?new RegExp(o.voiceMatch,`i`):void 0,l=c&&s.find(e=>e.lang===o.lang&&c.test(e.name))||s.find(e=>e.lang===o.lang);l&&(i.voice=l),i.onend=()=>r.value=!1,i.onerror=()=>r.value=!1,r.value=!0,speechSynthesis.speak(i)}return ti(a),{ttsEnabled:G(()=>t.tts.enabled),ttsSpeaking:r,toggleTts:i,cancelTts:a}}var lg={},ug={type:`button`,class:`w-7 h-7 flex items-center justify-center text-muted hover:text-text rounded transition-colors cursor-pointer`,title:`toggle sidebar`};function dg(e,t){return R(),z(`button`,ug,[...t[0]||=[Ga(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><rect x="1.5" y="2.5" width="13" height="11" rx="2"></rect><line x1="5.5" y1="2.5" x2="5.5" y2="13.5"></line><line x1="3" y1="5.5" x2="4" y2="5.5"></line><line x1="3" y1="8" x2="4" y2="8"></line><line x1="3" y1="10.5" x2="4" y2="10.5"></line></svg>`,1)]])}var fg=Ju(lg,[[`render`,dg]]),pg={key:0,class:`flex-1 flex items-center justify-center text-muted text-[13px] font-sans`},mg={key:0,class:`flex justify-center py-2`},hg={class:`bg-surface text-muted text-[10px] font-medium tracking-wide rounded-full px-3 py-1`},gg={key:0,class:`text-[10px] font-medium mb-0.5 px-3 text-ok`},_g={key:1,class:`min-w-0 max-w-full px-4 py-2.5 rounded-2xl rounded-bl-sm text-[13px] font-sans leading-snug break-words bg-surface border border-border select-text`},vg=[`innerHTML`],yg=[`href`],bg=[`src`,`alt`],xg=[`href`],Sg={class:`text-[12px] text-text truncate max-w-[160px]`},Cg={key:2,class:`px-4 py-2.5 rounded-2xl rounded-br-sm text-[13px] font-sans leading-snug whitespace-pre-wrap break-words bg-accent-dimmer text-text border border-accent-dim select-text`},wg=[`href`],Tg=[`src`,`alt`],Eg=[`href`],Dg={class:`text-[12px] text-text truncate max-w-[160px]`},Og={class:`text-[9px] text-muted mt-1 px-3`},kg={key:1,class:`flex flex-col min-w-0 max-w-[70%] max-md:max-w-[80%] self-start items-start`},Ag={class:`min-w-0 max-w-full px-4 py-2.5 rounded-2xl rounded-bl-sm text-[13px] font-sans leading-snug break-words bg-surface border border-border select-text opacity-80`},jg=[`innerHTML`],Mg={class:`flex items-center gap-1.5`},Ng={key:0,class:`inline-block w-2.5 h-2.5 border border-current rounded-full animate-spin border-t-transparent`},Pg={key:1},Fg={key:2,class:`opacity-60`},Ig=[`onClick`],Lg={class:`shrink-0 text-[8px] leading-[14px] select-none`},Rg=[`innerHTML`],zg={key:2,class:`flex flex-col self-start items-start`},Bg={class:`px-4 py-2 rounded-2xl rounded-bl-sm text-[11px] font-mono text-danger bg-surface border border-danger/30`},Vg={key:0,class:`shrink-0 justify-center px-4 py-2.5 bg-bg items-center gap-1.5 flex`},Hg=Ju(F({__name:`ChatMessages`,props:{messages:{},sendingMessage:{type:Boolean},typingVisible:{type:Boolean},streamState:{}},setup(e){let t=e,n=G(()=>t.streamState.text||``),r=G(()=>t.streamState.thinking||``),i=M(new Set);function a(e){i.value.has(e)?i.value.delete(e):i.value.add(e)}let o=M(null),s=M(!1);P(()=>t.messages.length,async(e,n)=>{let r=o.value;if(!r)return;let i=r.scrollHeight-r.scrollTop-r.clientHeight<80,a=e>(n??0);if(await zn(),!s.value){r.scrollTop=r.scrollHeight,s.value=!0;return}(a&&i||t.sendingMessage)&&(r.scrollTop=r.scrollHeight)}),Zr(async()=>{await zn();let e=o.value;e&&(e.scrollTop=e.scrollHeight,s.value=!0)});function c(e){return new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function l(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function u(e){return e===0?!0:c(t.messages[e].timestamp)!==c(t.messages[e-1].timestamp)}return P(()=>n.value.length+r.value.length,async()=>{let e=o.value;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;await zn(),t&&(e.scrollTop=e.scrollHeight)}),(t,s)=>(R(),z(L,null,[V(`div`,{ref_key:`listEl`,ref:o,class:`flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-4 pt-4 pb-8 flex flex-col gap-2 bg-bg overscroll-contain [scrollbar-gutter:stable]`},[e.messages.length===0?(R(),z(`div`,pg,[...s[0]||=[V(`div`,{class:`text-center`},[V(`div`,{class:`text-[28px] text-border mb-3`},`~`),V(`div`,null,`no messages yet`)],-1)]])):W(``,!0),(R(!0),z(L,null,I(e.messages,(e,t)=>(R(),z(L,{key:`${e.timestamp}-${t}`},[u(t)?(R(),z(`div`,mg,[V(`span`,hg,j(c(e.timestamp)),1)])):W(``,!0),V(`div`,{class:A([`flex flex-col min-w-0 max-w-[70%] max-md:max-w-[80%]`,e.is_bot_message?`self-start items-start`:`self-end items-end`])},[e.is_bot_message?(R(),z(`div`,gg,j(e.sender_name),1)):W(``,!0),e.is_bot_message?(R(),z(`div`,_g,[e.content?(R(),z(`div`,{key:0,class:`md-content`,innerHTML:N(ag)(e.content)},null,8,vg)):W(``,!0),e.meta?.attachments?.length?(R(),z(`div`,{key:1,class:A([`flex flex-wrap gap-1.5`,e.content?`mt-2`:``])},[(R(!0),z(L,null,I(e.meta?.attachments,(e,t)=>(R(),z(L,{key:t},[e.mimeType?.startsWith(`image/`)?(R(),z(`a`,{key:0,href:`/api/uploads/${e.path}`,target:`_blank`,class:`block`},[V(`img`,{src:`/api/uploads/${e.path}`,alt:e.name,class:`max-w-[200px] max-h-[200px] rounded-lg object-cover`},null,8,bg)],8,yg)):(R(),z(`a`,{key:1,href:`/api/uploads/${e.path}`,target:`_blank`,class:`flex items-center gap-2 px-3 py-2 rounded-lg bg-bg/50 border border-border hover:bg-bg/80 transition-colors`},[s[1]||=V(`svg`,{class:`w-5 h-5 shrink-0 text-muted`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[V(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z`}),V(`path`,{d:`M14 2v6h6`})],-1),V(`span`,Sg,j(e.name),1)],8,xg))],64))),128))],2)):W(``,!0)])):(R(),z(`div`,Cg,[e.content?(R(),z(L,{key:0},[U(j(e.content),1)],64)):W(``,!0),e.meta?.attachments?.length?(R(),z(`div`,{key:1,class:A([`flex flex-wrap gap-1.5`,e.content?`mt-2`:``])},[(R(!0),z(L,null,I(e.meta?.attachments,(e,t)=>(R(),z(L,{key:t},[e.mimeType?.startsWith(`image/`)?(R(),z(`a`,{key:0,href:`/api/uploads/${e.path}`,target:`_blank`,class:`block`},[V(`img`,{src:`/api/uploads/${e.path}`,alt:e.name,class:`max-w-[200px] max-h-[200px] rounded-lg object-cover`},null,8,Tg)],8,wg)):(R(),z(`a`,{key:1,href:`/api/uploads/${e.path}`,target:`_blank`,class:`flex items-center gap-2 px-3 py-2 rounded-lg bg-bg/50 border border-border hover:bg-bg/80 transition-colors`},[s[2]||=V(`svg`,{class:`w-5 h-5 shrink-0 text-muted`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[V(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z`}),V(`path`,{d:`M14 2v6h6`})],-1),V(`span`,Dg,j(e.name),1)],8,Eg))],64))),128))],2)):W(``,!0)])),V(`div`,Og,j(l(e.timestamp)),1)],2)],64))),128)),n.value||r.value||e.streamState.details.length>0?(R(),z(`div`,kg,[V(`div`,Ag,[r.value||e.streamState.details.length>0?(R(),z(`details`,{key:0,class:A([`thinking-block`,n.value?`mb-1.5`:``]),open:``},[s[3]||=V(`summary`,null,`thinking`,-1),V(`div`,null,[(R(!0),z(L,null,I(e.streamState.details,(e,t)=>(R(),z(L,{key:t},[e.type===`thinking`?(R(),z(`div`,{key:0,class:`md-content`,innerHTML:N(ag)(e.text)},null,8,jg)):(R(),z(`div`,{key:1,class:A([`min-w-0 font-mono text-[11px]`,e.tool.isError?`text-danger`:e.tool.done?`text-muted opacity-50`:`text-muted`])},[V(`div`,Mg,[e.tool.done?e.tool.isError?(R(),z(`span`,Pg,`✗`)):(R(),z(`span`,Fg,`✓`)):(R(),z(`span`,Ng)),U(` `+j(e.tool.name),1)]),e.tool.resultPreview&&e.tool.done?(R(),z(`div`,{key:0,class:`pl-4 text-[10px] opacity-70 cursor-pointer flex items-start gap-1 min-w-0`,onClick:e=>a(`s-${t}`)},[V(`span`,Lg,j(i.value.has(`s-${t}`)?`▶`:`▼`),1),V(`span`,{class:A([`min-w-0`,i.value.has(`s-${t}`)?`truncate`:`whitespace-pre-wrap break-all`])},j(e.tool.resultPreview),3)],8,Ig)):W(``,!0)],2))],64))),128))])],2)):W(``,!0),n.value?(R(),z(`div`,{key:1,class:`md-content`,innerHTML:N(ag)(n.value)},null,8,Rg)):W(``,!0)])])):W(``,!0),e.streamState.error?(R(),z(`div`,zg,[V(`div`,Bg,` error: `+j(e.streamState.error),1)])):W(``,!0)],512),e.typingVisible&&!n.value&&!r.value&&!e.streamState.activeTool&&!e.streamState.isInitializing?(R(),z(`div`,Vg,[...s[4]||=[V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1),V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1),V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1)]])):W(``,!0)],64))}}),[[`__scopeId`,`data-v-663eb2be`]]),Ug={class:`w-[280px] min-w-[280px] max-md:w-full max-md:min-w-0 border-r border-border flex flex-col bg-surface`},Wg={class:`px-3 py-3 border-b border-border flex items-center gap-2`},Gg={class:`flex-1 overflow-y-auto p-1.5`},Kg={key:0,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},qg={key:1,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},Jg=[`onClick`,`onContextmenu`,`onTouchstart`],Yg={class:`flex-1 min-w-0`},Xg={class:`text-[13px] font-medium font-sans truncate`},Zg={class:`text-[11px] text-muted mt-0.5 truncate`},Qg=F({__name:`ChatSidebar`,props:{items:{},loading:{type:Boolean},currentJid:{}},emits:[`select`,`delete`,`settings`,`register`,`toggle`],setup(e,{emit:t}){let n=t,r=[`bg-accent-dim text-accent`,`bg-ok-dim text-ok`,`bg-warn-dim text-warn`,`bg-danger-dim text-danger`];function i(e){let t=0;for(let n of e)t=(t<<5)-t+n.charCodeAt(0)|0;return r[Math.abs(t)%r.length]}function a(e){return(e[0]||`?`).toUpperCase()}let{menu:o,onContext:s,onTouchStart:c,cancelLongPress:l,close:u}=uu();function d(){o.value&&n(`delete`,o.value.data),u()}function f(){o.value&&n(`settings`,o.value.data),u()}return(t,r)=>(R(),z(`div`,Ug,[V(`div`,Wg,[r[5]||=V(`span`,{class:`text-[13px] font-medium text-text font-sans`},`chats`,-1),r[6]||=V(`span`,{class:`flex-1`},null,-1),V(`button`,{type:`button`,class:`h-7 flex items-center justify-center text-[13px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer px-2 gap-1`,onClick:r[0]||=e=>n(`register`)},` + `),H(fg,{onClick:r[1]||=e=>n(`toggle`)})]),V(`div`,Gg,[e.loading?(R(),z(`div`,Kg,[H(N(K),{icon:`lucide:loader`,class:`animate-spin text-[20px] mb-3`}),r[7]||=V(`div`,null,`loading...`,-1)])):e.items.length===0?(R(),z(`div`,qg,[r[8]||=V(`div`,{class:`text-[28px] mb-3 text-border`},`~`,-1),r[9]||=V(`div`,{class:`mb-4`},`no chats yet`,-1),V(`button`,{type:`button`,class:`h-9 flex items-center justify-center text-[16px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer px-3 gap-1`,onClick:r[2]||=e=>n(`register`)},` + `)])):W(``,!0),(R(!0),z(L,null,I(e.items,t=>(R(),z(`button`,{key:t.jid,type:`button`,class:A([`w-full text-left px-2.5 py-2.5 cursor-pointer rounded-lg transition-colors hover:bg-accent-dim/50 flex items-center gap-3`,t.jid===e.currentJid?`bg-accent-dim`:``]),onClick:e=>n(`select`,t.jid),onContextmenu:e=>N(s)(e,t.jid),onTouchstart:e=>N(c)(e,t.jid),onTouchend:r[3]||=(...e)=>N(l)&&N(l)(...e),onTouchmove:r[4]||=(...e)=>N(l)&&N(l)(...e)},[V(`div`,{class:A([`w-9 h-9 rounded-full flex items-center justify-center text-[13px] font-semibold shrink-0`,i(t.name)])},j(a(t.name)),3),V(`div`,Yg,[V(`div`,Xg,j(t.name),1),V(`div`,Zg,j(t.folder?`~/${t.folder}`:t.jid.slice(0,24)),1)])],42,Jg))),128))]),H(Hl,{pos:N(o)??null},{default:Zn(()=>[V(`button`,{type:`button`,class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:f},` Settings `),V(`button`,{type:`button`,class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:d},` Delete `)]),_:1},8,[`pos`])]))}}),$g={key:0,class:`space-y-3`},e_={class:`flex items-center gap-2`},t_={class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},n_=[`value`],r_=[`value`],i_=[`value`],a_=[`value`],o_=[`value`],s_={class:`col-span-2 max-md:col-span-1 flex items-center gap-4`},c_={class:`flex items-center gap-2`},l_={class:`flex items-center gap-2`},u_=[`disabled`],d_={class:`text-[11px] text-muted`},f_={key:0,class:`text-warn`},p_={class:`text-[12px] font-mono text-text truncate`},m_={class:`text-[12px] font-mono text-muted select-all truncate`},h_={class:`col-span-2 max-md:col-span-1`},g_=[`value`],__={class:`pt-1 flex items-center justify-center gap-2`},v_={class:`mb-2`},y_={class:`relative`},b_={key:0,class:`absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted pointer-events-none`},x_={key:0,class:`mb-2`},S_={class:`grid grid-cols-2 gap-2 max-md:grid-cols-1`},C_=[`placeholder`],w_=[`placeholder`],T_=[`placeholder`],E_=[`value`],D_={class:`col-span-2 max-md:col-span-1 flex items-center gap-2`},O_=[`disabled`],k_={class:`text-[11px] text-muted`},A_={key:0,class:`text-warn`},j_={class:`col-span-2 max-md:col-span-1`},M_=F({__name:`ChatModal`,props:{jid:{},group:{},models:{},initialName:{},initialJid:{},sandboxEnforced:{type:Boolean}},emits:[`close`,`registered`,`updated`,`delete`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>!!n.group),a=M(),o=M(n.initialName||``),s=M(``),c=M(n.initialJid||``),l=M(``),u=M(``),d=M(``),f=M(``),p=M(!!n.sandboxEnforced),m=G(()=>Yh(o.value.trim()));P(()=>n.initialName,()=>{i.value||zn(()=>a.value?.focus())},{immediate:!0});async function h(e){await Nu(`/api/groups/${encodeURIComponent(n.jid)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),r(`updated`)}let g;function _(e){clearTimeout(g),g=setTimeout(()=>h({soul:e||null}),600)}function v(){o.value=``,s.value=``,c.value=``,l.value=``,u.value=``,d.value=``,f.value=``,p.value=!1,r(`close`)}async function y(){let e=o.value.trim();if(!e)return;let t=Yh(e),n=c.value.startsWith(`tg:`)&&!t.startsWith(`tg-`)?`tg-${t}`:t,i=s.value.trim()||n,a=c.value.trim()||`${i}:${Math.random().toString(36).slice(2,8)}`;await Nu(`/api/groups`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:a,name:e,folder:i,trigger:l.value.trim(),model:u.value||void 0,thinkingLevel:d.value||void 0,soul:f.value.trim()||void 0,sandbox:p.value||void 0})}),r(`registered`,a),v()}return(t,g)=>(R(),B(Kl,{title:i.value?`chat settings`:`New chat`,width:i.value?`480px`:`420px`,onClose:g[17]||=e=>i.value?r(`close`):v()},{default:Zn(()=>[i.value&&e.group?(R(),z(`div`,$g,[V(`div`,null,[g[18]||=V(`label`,{class:`label`},`status`,-1),V(`div`,e_,[V(`span`,{class:A([`inline-block w-1.5 h-1.5 rounded-full`,e.group?`bg-ok`:`bg-warn`])},null,2),V(`span`,{class:A([`text-[12px] font-mono`,e.group?`text-ok`:`text-warn`])},j(e.group?`registered`:`unmanaged`),3)])]),V(`div`,t_,[V(`div`,null,[g[19]||=V(`label`,{class:`label`},`name`,-1),V(`input`,{value:e.group.name,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:g[0]||=e=>h({name:e.target.value})},null,40,n_)]),V(`div`,null,[g[20]||=V(`label`,{class:`label`},`trigger`,-1),V(`input`,{value:e.group.trigger,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:g[1]||=e=>h({trigger:e.target.value})},null,40,r_)]),V(`div`,null,[g[22]||=V(`label`,{class:`label`},`model`,-1),V(`select`,{value:e.group.model||``,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:g[2]||=e=>h({model:e.target.value||null})},[g[21]||=V(`option`,{value:``},`default`,-1),(R(!0),z(L,null,I(e.models,e=>(R(),z(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},j(e.name),9,a_))),128))],40,i_)]),V(`div`,null,[g[24]||=V(`label`,{class:`label`},`thinking`,-1),V(`select`,{value:e.group.thinkingLevel||`off`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:g[3]||=e=>h({thinkingLevel:e.target.value||null})},[...g[23]||=[V(`option`,{value:`off`},`off`,-1),V(`option`,{value:`minimal`},`minimal`,-1),V(`option`,{value:`low`},`low`,-1),V(`option`,{value:`medium`},`medium`,-1),V(`option`,{value:`high`},`high`,-1),V(`option`,{value:`xhigh`},`xhigh`,-1)]],40,o_)]),V(`div`,s_,[V(`div`,c_,[V(`button`,{class:A([`relative w-8 h-[18px] rounded-full border border-border transition-colors cursor-pointer shrink-0`,e.group.requiresTrigger===!1?`bg-surface`:`bg-accent`]),onClick:g[4]||=t=>h({requiresTrigger:e.group.requiresTrigger===!1?null:!1})},[V(`span`,{class:A([`absolute top-[2px] w-3 h-3 rounded-full bg-text transition-all`,e.group.requiresTrigger===!1?`left-[2px]`:`left-[14px]`])},null,2)],2),g[25]||=V(`label`,{class:`text-[11px] text-muted`},`require trigger`,-1)]),V(`div`,l_,[V(`button`,{class:A([`relative w-8 h-[18px] rounded-full border border-border transition-colors shrink-0`,[e.group.sandbox?`bg-accent`:`bg-surface`,e.group.sandbox===`enforced`?`cursor-not-allowed opacity-70`:`cursor-pointer`]]),disabled:e.group.sandbox===`enforced`,onClick:g[5]||=t=>e.group.sandbox!==`enforced`&&h({sandbox:!e.group.sandbox})},[V(`span`,{class:A([`absolute top-[2px] w-3 h-3 rounded-full bg-text transition-all`,e.group.sandbox?`left-[14px]`:`left-[2px]`])},null,2)],10,u_),V(`label`,d_,[g[26]||=U(` sandbox `,-1),e.group.sandbox===`enforced`?(R(),z(`span`,f_,`(enforced)`)):W(``,!0)])])]),V(`div`,null,[g[27]||=V(`label`,{class:`label`},`folder`,-1),V(`div`,p_,`~/`+j(e.group.folder)+`/`,1)]),V(`div`,null,[g[28]||=V(`label`,{class:`label`},`jid`,-1),V(`div`,m_,j(n.jid),1)]),V(`div`,h_,[g[29]||=V(`label`,{class:`label`},`soul`,-1),V(`textarea`,{value:e.group.soul||``,placeholder:`Custom persona/role (e.g. 'You are a senior Go engineer...')`,rows:`3`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent resize-y`,onInput:g[6]||=e=>_(e.target.value)},null,40,g_),g[30]||=V(`div`,{class:`text-[10px] text-muted mt-0.5`},` e.g. "You are a senior JS engineer who values simplicity and performance." `,-1)])]),V(`div`,__,[V(`button`,{type:`button`,class:`btn-ghost`,onClick:g[7]||=e=>r(`close`)},`close`),V(`button`,{type:`button`,class:`btn-danger`,onClick:g[8]||=e=>{r(`close`),r(`delete`,n.jid)}},` delete chat `)])])):(R(),z(`form`,{key:1,onSubmit:Js(y,[`prevent`]),onKeydown:Xs(v,[`escape`])},[V(`div`,v_,[g[31]||=V(`label`,{class:`label group/label`},[U(` name `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`display name for this chat group`)])],-1),V(`div`,y_,[Qn(V(`input`,{ref_key:`nameInput`,ref:a,"onUpdate:modelValue":g[9]||=e=>o.value=e,placeholder:`My Project`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,o.value]]),m.value?(R(),z(`span`,b_,` @`+j(l.value.trim()||m.value)+` -> ~/`+j(s.value.trim()||m.value)+`/ `,1)):W(``,!0)])]),m.value?(R(),z(`div`,x_,[V(`div`,S_,[V(`div`,null,[g[32]||=V(`label`,{class:`label group/label`},[U(` folder `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`agent working directory name`)])],-1),Qn(V(`input`,{"onUpdate:modelValue":g[10]||=e=>s.value=e,placeholder:m.value||`auto`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,8,C_),[[Hs,s.value]])]),V(`div`,null,[g[33]||=V(`label`,{class:`label group/label`},[U(` jid `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`unique chat identifier`)])],-1),Qn(V(`input`,{"onUpdate:modelValue":g[11]||=e=>c.value=e,placeholder:m.value?`${m.value}:*`:`auto`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,8,w_),[[Hs,c.value]])]),V(`div`,null,[g[34]||=V(`label`,{class:`label group/label`},[U(` trigger `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`word to activate the agent (e.g. @slug)`)])],-1),Qn(V(`input`,{"onUpdate:modelValue":g[12]||=e=>l.value=e,placeholder:m.value?`@${m.value}`:`auto`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,8,T_),[[Hs,l.value]])]),V(`div`,null,[g[36]||=V(`label`,{class:`label group/label`},[U(` model `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`override the global model for this chat`)])],-1),Qn(V(`select`,{"onUpdate:modelValue":g[13]||=e=>u.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[g[35]||=V(`option`,{value:``},`default`,-1),(R(!0),z(L,null,I(e.models,e=>(R(),z(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},j(e.name),9,E_))),128))],512),[[Us,u.value]])]),V(`div`,null,[g[38]||=V(`label`,{class:`label group/label`},[U(` thinking `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`extended thinking level for the agent`)])],-1),Qn(V(`select`,{"onUpdate:modelValue":g[14]||=e=>d.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[...g[37]||=[V(`option`,{value:``},`off`,-1),V(`option`,{value:`minimal`},`minimal`,-1),V(`option`,{value:`low`},`low`,-1),V(`option`,{value:`medium`},`medium`,-1),V(`option`,{value:`high`},`high`,-1),V(`option`,{value:`xhigh`},`xhigh`,-1)]],512),[[Us,d.value]])]),V(`div`,D_,[V(`button`,{type:`button`,class:A([`relative w-8 h-[18px] rounded-full border border-border transition-colors shrink-0`,[p.value?`bg-accent`:`bg-surface`,e.sandboxEnforced?`cursor-not-allowed opacity-70`:`cursor-pointer`]]),disabled:e.sandboxEnforced,onClick:g[15]||=t=>!e.sandboxEnforced&&(p.value=!p.value)},[V(`span`,{class:A([`absolute top-[2px] w-3 h-3 rounded-full bg-text transition-all`,p.value?`left-[14px]`:`left-[2px]`])},null,2)],10,O_),V(`label`,k_,[g[39]||=U(` sandbox `,-1),e.sandboxEnforced?(R(),z(`span`,A_,`(enforced)`)):W(``,!0)])]),V(`div`,j_,[g[40]||=V(`label`,{class:`label group/label`},[U(` soul `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`custom persona/role for the agent`)])],-1),Qn(V(`textarea`,{"onUpdate:modelValue":g[16]||=e=>f.value=e,placeholder:`Custom persona/role (e.g. 'You are a senior Go engineer...')`,rows:`3`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent resize-y`},null,512),[[Hs,f.value]]),g[41]||=V(`div`,{class:`text-[10px] text-muted mt-0.5`},` e.g. "You are a senior JS engineer who values simplicity and performance." `,-1)])])])):W(``,!0),V(`div`,{class:`pt-1 flex items-center justify-center gap-2`},[V(`button`,{type:`button`,class:`btn-ghost`,onClick:v},[...g[42]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]]),g[43]||=V(`button`,{type:`submit`,class:`btn-primary`},[U(` register `),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`)],-1)])],32))]),_:1},8,[`title`,`width`]))}}),N_={key:0,class:`flex-1 flex flex-col text-muted text-[13px] font-sans bg-bg`},P_={key:0,class:`flex shrink-0 px-4 py-3 border-b border-border items-center bg-surface`},F_={class:`flex-1 flex items-center justify-center`},I_={class:`text-center text-muted`},L_={key:1,class:`flex flex-col h-full`},R_={class:`shrink-0 px-4 py-3 border-b border-border flex items-center gap-3 bg-surface`},z_={key:1,class:`shrink-0 flex items-center gap-0.5`},B_=[`title`,`disabled`],V_={class:`flex-1 min-w-0 text-center`},H_={class:`text-[14px] font-medium font-sans truncate`},U_={key:0,class:`shrink-0 mx-4 mt-3 mb-1 px-4 py-3 rounded-2xl bg-surface border border-border flex flex-col items-center gap-2 text-[13px] font-sans text-center`},W_={class:`flex gap-2`},G_={key:1,class:`shrink-0 mx-4 mt-2 px-3 py-1.5 rounded-lg bg-warn/8 border border-warn/20 text-[11px] font-mono text-warn flex items-center gap-1.5`},K_={class:`font-semibold`},q_={key:2,class:`shrink-0 px-3 pt-2 border-t border-border bg-surface flex gap-2 overflow-x-auto`},J_=[`src`,`alt`],Y_=[`title`],X_={class:`text-[8px] text-muted truncate w-full text-center`},Z_=[`onClick`],Q_=[`innerHTML`],$_={class:`relative flex-1`},ev={key:0,class:`absolute bottom-full left-0 right-0 mb-1.5 rounded-xl border border-border bg-surface shadow-lg overflow-hidden z-10`},tv=[`onMousedown`],nv={class:`font-mono font-semibold`},rv=[`onMousedown`],iv={class:`font-mono font-semibold`},av={class:`opacity-50`},ov={class:`absolute left-2 top-[5px] z-10 flex items-center gap-0.5`},sv={class:`absolute right-2 top-[5px] z-10 flex items-center gap-0.5`},cv=[`title`],lv=[`placeholder`,`disabled`],uv=[`disabled`],dv=[`disabled`],fv=Ju(F({__name:`window`,props:{fillHeight:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,set:r,setTitle:i,openWindow:a}=Du(),o=M(n.value.jid||null),s=M([]),c=M([]),l=M([]),u=M(``),d=M(null),f=M(null),p=M([]),m=M(!1),h=M(!1),g=id(),_=ad(),v=M(!1),{confirm:y}=Zu(),b=M([]),x=M(0),S=G(()=>{let e=u.value;if(!e.startsWith(`/`)||e.includes(` `))return[];let t=e.slice(1).toLowerCase();return b.value.filter(e=>e.command.startsWith(t))}),C=G(()=>{let e=u.value;if(!e.startsWith(`/`))return[];let t=e.indexOf(` `);if(t<0)return[];let n=e.slice(1,t).toLowerCase(),r=b.value.find(e=>e.command===n);if(!r?.paramOptions?.length)return[];let i=e.slice(t+1).toLowerCase();return r.paramOptions.filter(e=>e.startsWith(i))}),ee=G(()=>C.value.length>0?C.value:S.value.map(e=>e.command));P(ee,()=>{x.value=0});let w=M(!0),T=M(!1),E=M(null);function D(e){if(!g.value||w.value)return;let t=e.touches[0];t.clientX<24&&(E.value={startX:t.clientX,startY:t.clientY})}function te(e){if(!E.value)return;let t=e.touches[0],n=t.clientX-E.value.startX,r=Math.abs(t.clientY-E.value.startY);n>60&&n>r*1.5&&(w.value=!0,E.value=null)}function ne(){E.value=null}let re=M(!1),ie=M(!1),O=M([]),ae=M(!1),oe=M(``),se=M(``),{streamState:ce,clearStreamText:le,clearStream:ue}=Gh(o),de=G(()=>{let e=ce.value.details;if(!e.length)return``;let t=e[e.length-1];return t.type===`thinking`?t.text:t.type===`tool`?t.tool.done?``:`using ${t.tool.name}…`:``}),{ttsEnabled:fe,ttsSpeaking:pe,toggleTts:me,cancelTts:he}=cg(ce),{listening:ge,supported:_e,toggle:ve}=sg(e=>{!o.value||!e||pe.value||(u.value=e)},()=>{u.value.trim()&&Pe()});function ye(){ge.value||he(),ve()}let be=G(()=>{let e=new Set,t=[];for(let n of s.value)e.add(n.jid),t.push({jid:n.jid,name:n.name,folder:n.folder,registered:!0});for(let n of c.value)e.has(n.jid)||t.push({jid:n.jid,name:n.name||n.jid,registered:!1});return t}),k=G(()=>o.value?s.value.find(e=>e.jid===o.value)?.name||o.value:`-`);P(k,e=>{i(e&&e!==`-`?`Chats — ${e}`:`Chats`)});let xe=G(()=>o.value?s.value.some(e=>e.jid===o.value):!0),Se=G(()=>s.value.find(e=>e.jid===o.value)),Ce=G(()=>h.value||ce.value.isStreaming||ce.value.activeTool!==null);P(()=>ce.value.isStreaming||ce.value.activeTool!==null||ce.value.isInitializing,e=>{e&&(h.value=!1)}),P(l,()=>{l.value.at(-1)?.is_bot_message&&(h.value=!1)});async function we(){let e=await Pu(`/api/pi/models`);e&&(O.value=e.models??[])}async function Te(){let e=await Pu(`/api/pi/commands`);e&&(b.value=e)}async function Ee(){let[e,t]=await Promise.all([Pu(`/api/groups`),Pu(`/api/chats`)]);if(e&&(s.value=e),t&&(c.value=t),re.value=!0,o.value){let e=o.value;s.value.some(t=>t.jid===e)||c.value.some(t=>t.jid===e)||(o.value=null,r({jid:``}),l.value=[])}}async function De(){if(!o.value)return;let e=await Pu(`/api/messages?${new URLSearchParams({jid:o.value,limit:`200`})}`);e&&(l.value=e)}P(()=>ce.value.isStreaming,async(e,t)=>{t&&!e&&(await De(),le())}),P(()=>ce.value.isAgentDone,async e=>{e&&(await De(),ue())});function Oe(e){he(),h.value=!1,o.value=e,r({jid:e}),g.value&&(w.value=!1),l.value=[],De();let t=s.value.find(t=>t.jid===e);u.value=t?.requiresTrigger?`${t.trigger} `:``,_.value||setTimeout(()=>{d.value?.focus()},0)}function ke(e){e.hasParams?(u.value=`/`+e.command+` `,_.value||zn(()=>d.value?.focus())):(u.value=`/`+e.command,Pe())}function Ae(e){let t=u.value,n=t.indexOf(` `);n<0||(u.value=t.slice(0,n+1)+e,Pe())}function je(e){if(C.value.length>0){let t=C.value[e];t&&Ae(t)}else{let t=S.value[e];t&&ke(t)}}function Me(){u.value.startsWith(`/`)?u.value=``:u.value=`/`,zn(()=>d.value?.focus())}function Ne(e){if(ee.value.length>0){if(e.key===`ArrowUp`){e.preventDefault(),x.value=(x.value-1+ee.value.length)%ee.value.length;return}if(e.key===`ArrowDown`){e.preventDefault(),x.value=(x.value+1)%ee.value.length;return}if(e.key===`Tab`||e.key===`Enter`){e.preventDefault(),je(x.value);return}if(e.key===`Escape`){e.preventDefault(),u.value=``;return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Pe())}async function Pe(){if(!o.value)return;let e=u.value.trim(),t=p.value.length?p.value.map(e=>({data:e.data,mimeType:e.mimeType,name:e.name})):void 0;if(!e&&!t)return;ge.value&&ve(),u.value=Se.value?.requiresTrigger?`${Se.value.trigger} `:``,p.value=[],Ke(),m.value=!0;let n=await Pu(`/api/send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:o.value,message:e,attachments:t})});await De(),m.value=!1;let r=e.startsWith(`/`)||e.startsWith(`!`);n?.method===`queued`&&!r&&(h.value=!0),await zn(),_.value||d.value?.focus()}let Fe=M(!1);async function Ie(){if(!(!o.value||Fe.value)){Fe.value=!0;try{await Nu(`/api/stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:o.value})}),h.value=!1}finally{Fe.value=!1}}}let Le=G(()=>Se.value?.sandbox===`enforced`),Re=G(()=>s.value.some(e=>e.sandbox===`enforced`));async function ze(){!o.value||!Se.value||Le.value||(await Nu(`/api/groups/${encodeURIComponent(o.value)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sandbox:!Se.value.sandbox})}),await Ee())}function Be(e){Oe(e),ie.value=!0}async function Ve(e){await y(`delete chat and all messages for ${e}?`)&&(await Nu(`/api/chats/${encodeURIComponent(e)}`,{method:`DELETE`}),o.value===e&&(o.value=null,l.value=[]),await Ee())}function He(){o.value&&(oe.value=c.value.find(e=>e.jid===o.value)?.name||``,se.value=o.value,ae.value=!0)}function Ue(){ae.value=!1,oe.value=``,se.value=``}async function We(e){Ue(),await Ee(),Oe(e)}async function Ge(){if(!Se.value)return;let e=Se.value,t={cols:80,rows:24};e.sandbox?t.sandboxId=`~${e.folder}`:t.cwd=`~/.pi/claw/groups/${e.folder}`;let n=await Pu(`/api/terminal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});n&&a(`terminal`,{connectSession:n.id})}function Ke(){d.value&&(d.value.style.height=`auto`,d.value.style.height=`${Math.min(d.value.scrollHeight,120)}px`)}function qe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=r.result;t({data:n.split(`,`)[1]||``,mimeType:e.type||`application/octet-stream`,name:e.name,preview:n})},r.onerror=n,r.readAsDataURL(e)})}async function Je(e){for(let t of e)!t.type&&!t.name||p.value.push(await qe(t))}function Ye(e){let t=e.target;t.files?.length&&Je(t.files),t.value=``}function Xe(e){let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length&&(e.preventDefault(),Je(n))}function Ze(e){e.preventDefault(),e.dataTransfer?.files?.length&&Je(e.dataTransfer.files)}function Qe(e){e.preventDefault()}function $e(e){p.value.splice(e,1)}ld([`groups`],Ee),ld([`chats`],()=>{Ee(),o.value&&De()});function et(e){if(e.metaKey&&e.key===`j`&&o.value){e.preventDefault(),ie.value=!ie.value;return}!xe.value&&o.value&&(e.key===`Enter`&&!e.metaKey&&!e.ctrlKey&&!v.value?(e.preventDefault(),T.value?(He(),T.value=!1):T.value=!0):e.key===`Escape`&&T.value&&(e.preventDefault(),T.value=!1))}return Zr(()=>{we(),Te(),o.value&&De(),window.addEventListener(`keydown`,et)}),ti(()=>{window.removeEventListener(`keydown`,et),he()}),(e,n)=>(R(),z(`div`,{class:A([`flex overflow-hidden relative`,t.fillHeight?`h-full min-h-0`:`h-[calc(100dvh-140px)]`]),onTouchstart:D,onTouchmove:te,onTouchend:ne},[Qn(H(Qg,{items:be.value,loading:!re.value,"current-jid":o.value,class:`max-md:absolute max-md:inset-y-0 max-md:left-0 max-md:z-20 max-md:w-[280px] max-md:min-w-0 max-md:!bg-surface`,onSelect:Oe,onDelete:Ve,onSettings:Be,onRegister:n[0]||=e=>ae.value=!0,onToggle:n[1]||=e=>w.value=!w.value},null,8,[`items`,`loading`,`current-jid`]),[[$o,w.value]]),ae.value?(R(),B(M_,{key:0,models:O.value,"initial-name":oe.value,"initial-jid":se.value,"sandbox-enforced":Re.value,onClose:Ue,onRegistered:We},null,8,[`models`,`initial-name`,`initial-jid`,`sandbox-enforced`])):W(``,!0),ie.value&&o.value?(R(),B(M_,{key:1,jid:o.value,group:Se.value,models:O.value,onClose:n[2]||=e=>ie.value=!1,onUpdated:Ee,onDelete:n[3]||=e=>{ie.value=!1,Ve(e)}},null,8,[`jid`,`group`,`models`])):W(``,!0),V(`div`,{class:A([`flex-1 flex flex-col min-w-0`,v.value&&N(g)?`max-md:fixed max-md:inset-0 max-md:z-30 max-md:bg-bg`:``]),id:`chat-main`,onDrop:Ze,onDragover:Qe},[o.value?(R(),z(`div`,L_,[V(`div`,R_,[w.value?W(``,!0):(R(),B(fg,{key:0,class:`mr-1`,onClick:n[6]||=e=>w.value=!0})),Se.value?(R(),z(`div`,z_,[V(`button`,{type:`button`,class:A([`transition-colors`,[Se.value.sandbox?`text-accent`:`text-warning hover:text-warning/80`,Le.value?`cursor-not-allowed`:`cursor-pointer`]]),title:Le.value?`sandbox enforced globally`:Se.value.sandbox?`sandbox mode (click to disable)`:`enable sandbox mode`,disabled:Le.value,onClick:ze},[H(N(K),{icon:`lucide:shield`,class:`text-[15px]`})],10,B_),Le.value?(R(),B(N(K),{key:0,icon:`lucide:lock`,class:`text-[11px] text-warn`,title:`sandbox enforced globally`})):W(``,!0)])):W(``,!0),V(`div`,V_,[V(`div`,H_,j(k.value),1)]),Se.value?(R(),z(`button`,{key:2,type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`files`,onClick:n[7]||=e=>N(a)(`files`,{folder:Se.value.folder,path:`.`})},[H(N(K),{icon:`lucide:folder-open`,class:`text-base`})])):W(``,!0),Se.value?(R(),z(`button`,{key:3,type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`agent notes`,onClick:n[8]||=e=>N(a)(`notes`,{activeRef:`~agents/${Se.value.folder}`})},[H(N(K),{icon:`mdi:note-text-outline`,class:`text-base`})])):W(``,!0),Se.value?(R(),z(`button`,{key:4,type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`open terminal in group dir`,onClick:n[9]||=e=>Ge()},[H(N(K),{icon:`lucide:terminal`,class:`text-base`})])):W(``,!0),V(`button`,{type:`button`,class:A([`leading-none transition-colors flex items-center gap-1`,N(fe)?`text-accent hover:text-accent`:`text-muted hover:text-text`]),title:`text-to-speech`,onClick:n[10]||=(...e)=>N(me)&&N(me)(...e)},[H(N(K),{icon:N(fe)?`lucide:volume-2`:`lucide:volume-x`,class:`text-base`},null,8,[`icon`])],2),V(`button`,{type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`chat settings (⌘J)`,onClick:n[11]||=e=>ie.value=!0},[H(N(K),{icon:`lucide:settings`,class:`text-base`})])]),re.value&&!xe.value?(R(),z(`div`,U_,[n[25]||=V(`div`,{class:`text-muted`},`this chat is not registered — messages won't reach the agent`,-1),T.value?(R(),z(L,{key:1},[n[24]||=V(`div`,{class:`text-[11px] text-warn font-semibold`},` only register chats you trust — registered chats get full agent access `,-1),V(`div`,W_,[V(`button`,{type:`button`,class:`px-5 py-2 bg-accent text-bg rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:bg-accent/90`,onClick:n[13]||=e=>{He(),T.value=!1}},[...n[22]||=[U(` confirm `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]]),V(`button`,{type:`button`,class:`px-4 py-2 text-muted rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:text-text`,onClick:n[14]||=e=>T.value=!1},[...n[23]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],64)):(R(),z(`button`,{key:0,type:`button`,class:`px-5 py-2 bg-accent text-bg rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:bg-accent/90`,onClick:n[12]||=e=>T.value=!0},[...n[21]||=[U(` register chat `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]]))])):W(``,!0),Se.value&&Se.value.requiresTrigger?(R(),z(`div`,G_,[n[26]||=V(`span`,{class:`opacity-60`},`trigger:`,-1),V(`span`,K_,j(Se.value.trigger),1),n[27]||=V(`span`,{class:`opacity-50`},`— prefix messages to reach the agent`,-1)])):W(``,!0),H(Hg,{messages:l.value,"stream-state":N(ce),"typing-visible":Ce.value,"sending-message":m.value},null,8,[`messages`,`stream-state`,`typing-visible`,`sending-message`]),V(`input`,{ref_key:`fileInputRef`,ref:f,type:`file`,accept:`*/*`,multiple:``,class:`hidden`,onChange:Ye},null,544),p.value.length?(R(),z(`div`,q_,[(R(!0),z(L,null,I(p.value,(e,t)=>(R(),z(`div`,{key:t,class:`relative shrink-0 w-16 h-16 rounded-lg overflow-hidden border border-border group`},[e.mimeType.startsWith(`image/`)?(R(),z(`img`,{key:0,src:e.preview,alt:e.name,class:`w-full h-full object-cover`},null,8,J_)):(R(),z(`div`,{key:1,class:`w-full h-full flex flex-col items-center justify-center bg-surface-alt gap-0.5 px-1`,title:e.name},[n[28]||=V(`svg`,{class:`w-5 h-5 text-muted`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[V(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z`}),V(`path`,{d:`M14 2v6h6`})],-1),V(`span`,X_,j(e.name.split(`.`).pop()),1)],8,Y_)),V(`button`,{type:`button`,class:`absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-bg/80 text-muted hover:text-danger flex items-center justify-center text-[10px] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer`,onClick:e=>$e(t)},` × `,8,Z_)]))),128))])):W(``,!0),de.value||N(ce).isInitializing&&!N(ce).isStreaming&&!N(ce).activeTool?(R(),z(`div`,{key:3,class:A([`shrink-0 px-4 py-1.5 border-t border-border text-[11px] font-sans text-muted italic opacity-60 truncate status-shimmer`,de.value?`md-content`:``]),innerHTML:de.value?N(ag)(de.value):`initializing session...`},null,10,Q_)):W(``,!0),V(`form`,{autocomplete:`off`,"data-form-type":`other`,class:A([`shrink-0 px-3 py-2.5 flex gap-2 items-center bg-surface`,[v.value&&N(g)?`max-md:absolute max-md:bottom-0 max-md:left-0 max-md:right-0`:``,p.value.length?``:`border-t border-border`]]),onSubmit:Js(Pe,[`prevent`])},[V(`div`,$_,[ee.value.length>0?(R(),z(`div`,ev,[C.value.length>0?(R(!0),z(L,{key:0},I(C.value,(e,t)=>(R(),z(`button`,{key:e,type:`button`,class:A([`w-full px-3 py-1.5 text-left text-[12px] flex items-center gap-2 cursor-pointer transition-colors`,t===x.value?`bg-accent/12 text-accent`:`text-text hover:bg-bg`]),onMousedown:Js(t=>Ae(e),[`prevent`])},[V(`span`,nv,j(e),1)],42,tv))),128)):(R(!0),z(L,{key:1},I(S.value,(e,t)=>(R(),z(`button`,{key:e.command,type:`button`,class:A([`w-full px-3 py-1.5 text-left text-[12px] flex items-center gap-2 cursor-pointer transition-colors`,t===x.value?`bg-accent/12 text-accent`:`text-text hover:bg-bg`]),onMousedown:Js(t=>ke(e),[`prevent`])},[V(`span`,iv,`/`+j(e.command),1),V(`span`,av,j(e.description),1)],42,rv))),128))])):W(``,!0),V(`div`,ov,[V(`button`,{type:`button`,class:`rounded-full w-7 h-7 p-0 flex items-center justify-center text-muted cursor-pointer transition-colors hover:text-accent`,title:`commands`,onMousedown:Js(Me,[`prevent`])},[H(N(K),{icon:`lucide:chevron-right`,class:`text-[15px]`})],32)]),V(`div`,sv,[V(`button`,{type:`button`,class:`rounded-full w-6 h-7 p-0 flex items-center justify-center text-muted cursor-pointer transition-colors hover:text-accent`,title:`attach image`,onMousedown:n[15]||=Js(e=>f.value?.click(),[`prevent`])},[H(N(K),{icon:`lucide:paperclip`,class:`text-[14px]`})],32),N(_e)?(R(),z(`button`,{key:0,type:`button`,class:A([`rounded-full w-7 h-7 p-0 flex items-center justify-center shrink-0 text-sm cursor-pointer transition-colors`,N(ge)?`bg-danger text-bg`:`text-muted hover:text-accent`]),title:N(ge)?`stop listening`:`speech to text`,onMousedown:Js(ye,[`prevent`])},[H(N(K),{icon:N(ge)?`lucide:mic-off`:`lucide:mic`,class:`text-base`},null,8,[`icon`])],42,cv)):W(``,!0)]),Qn(V(`textarea`,{ref_key:`composeRef`,ref:d,"onUpdate:modelValue":n[16]||=e=>u.value=e,name:`message`,placeholder:N(ge)?`listening...`:`message...`,rows:`1`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,enterkeyhint:`send`,class:A([`w-full min-h-[40px] max-h-[120px] resize-none py-2.5 rounded-2xl text-[13px] leading-snug bg-bg border border-border text-text outline-none transition-colors focus:border-accent font-sans overflow-y-auto`,[N(_e)?`pr-[4.25rem]`:`pr-10`,`pl-10`]]),disabled:m.value,onInput:Ke,onKeydown:Ne,onPaste:Xe,onFocus:n[17]||=e=>v.value=!0,onBlur:n[18]||=e=>v.value=!1},null,42,lv),[[Hs,u.value]])]),Ce.value?(R(),z(`button`,{key:0,type:`button`,class:`rounded-full w-9 h-9 p-0 flex items-center justify-center shrink-0 text-sm bg-danger text-bg cursor-pointer transition-colors hover:bg-danger/80 disabled:opacity-50`,disabled:Fe.value,title:`Stop agent`,onClick:Ie},[...n[29]||=[V(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`},[V(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})],-1)]],8,uv)):(R(),z(`button`,{key:1,type:`submit`,class:`rounded-full w-9 h-9 p-0 flex items-center justify-center shrink-0 text-sm bg-accent text-bg cursor-pointer transition-colors hover:bg-accent/90 disabled:text-muted disabled:bg-surface disabled:border-border`,disabled:m.value},[...n[30]||=[V(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M22 2L11 13`}),V(`path`,{d:`M22 2L15 22L11 13L2 9L22 2Z`})],-1)]],8,dv))],34)])):(R(),z(`div`,N_,[w.value?W(``,!0):(R(),z(`div`,P_,[H(fg,{onClick:n[4]||=e=>w.value=!0})])),V(`div`,F_,[V(`div`,I_,[n[19]||=V(`div`,{class:`text-[28px] mb-3 text-border`},`~`,-1),n[20]||=V(`div`,{class:`mb-4`},`no chat selected`,-1),V(`button`,{type:`button`,class:`h-10 flex items-center justify-center text-[18px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer mx-auto px-4 gap-1.5`,onClick:n[5]||=e=>ae.value=!0},` + `)])])]))],34)],34))}}),[[`__scopeId`,`data-v-4ec60685`]]),pv={key:`chat`,label:`Chats`,icon:`lucide:message-circle`,color:`#58a6ff`,component:{name:`ChatContent`,render:()=>bo(fv,{fillHeight:!0})},window:{width:1e3,height:700,minwidth:420,minheight:320}},mv={class:`grid gap-3 p-3`},hv={key:0,class:`text-[11px] text-danger`},gv={key:1,class:`text-[12px] text-muted text-center py-6`},_v={class:`min-w-0`},vv={class:`text-[12px] text-text font-medium flex items-center gap-2`},yv={key:0,class:`text-[10px] px-1.5 py-0.5 rounded-sm font-normal bg-accent/15 text-accent`},bv={class:`text-[11px] text-muted font-mono mt-0.5`},xv={key:0},Sv={class:`text-[10px] text-muted mt-1`},Cv={key:0},wv={class:`flex gap-1.5 shrink-0`},Tv=[`disabled`,`onClick`],Ev=[`disabled`,`onClick`],Dv=[`disabled`,`onClick`],Ov={key:`devices`,label:`Devices`,icon:`lucide:monitor-smartphone`,color:`#39bae6`,component:F({__name:`window`,setup(e){let{device:t}=Ru(),n=M([]),r=M(!1),i=M(``);async function a(){let e=await Pu(`/api/auth/devices`);e&&(n.value=e)}async function o(e){r.value=!0,i.value=``;try{await Nu(`/api/auth/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({deviceId:e})}),await a()}catch(e){i.value=e instanceof Error?e.message:`approve failed`}finally{r.value=!1}}async function s(e,t){r.value=!0,i.value=``;try{await Nu(`/api/auth/revoke`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({deviceId:e,delete:t?.delete})}),await a()}catch(e){i.value=e instanceof Error?e.message:`revoke failed`}finally{r.value=!1}}function c(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}return ld(`devices`,a),(e,a)=>(R(),z(`div`,mv,[i.value?(R(),z(`div`,hv,j(i.value),1)):W(``,!0),n.value.length===0?(R(),z(`div`,gv,` no devices registered `)):W(``,!0),(R(!0),z(L,null,I(n.value,e=>(R(),z(`div`,{key:e.id,class:`border border-border p-3 flex items-start justify-between gap-3`},[V(`div`,_v,[V(`div`,vv,[U(j(e.name)+` `,1),V(`span`,{class:A([`text-[10px] px-1.5 py-0.5 rounded-sm font-normal`,{"bg-ok/15 text-ok":e.status===`approved`,"bg-warn/15 text-warn":e.status===`pending`,"bg-danger/15 text-danger":e.status===`revoked`}])},j(e.status),3),N(t)?.id===e.id?(R(),z(`span`,yv,` this device `)):W(``,!0)]),V(`div`,bv,[U(j(e.id.slice(0,8))+` `,1),e.ip?(R(),z(`span`,xv,` · `+j(e.ip),1)):W(``,!0)]),V(`div`,Sv,[U(` created `+j(c(e.created_at))+` `,1),e.status===`approved`?(R(),z(`span`,Cv,` · last seen `+j(c(e.last_seen)),1)):W(``,!0)])]),V(`div`,wv,[e.status===`pending`?(R(),z(`button`,{key:0,type:`button`,disabled:r.value,class:`btn-sm text-ok border-ok/30 hover:bg-ok/10`,onClick:t=>o(e.id)},` approve `,8,Tv)):W(``,!0),e.status!==`revoked`&&N(t)?.id!==e.id?(R(),z(`button`,{key:1,type:`button`,disabled:r.value,class:`btn-sm text-danger border-danger/30 hover:bg-danger/10`,onClick:t=>s(e.id)},` revoke `,8,Ev)):W(``,!0),e.status===`revoked`?(R(),z(`button`,{key:2,type:`button`,disabled:r.value,class:`btn-sm text-danger border-danger/30 hover:bg-danger/10`,onClick:t=>s(e.id,{delete:!0})},` delete `,8,Dv)):W(``,!0)])]))),128))]))}}),window:{width:480,height:400,minwidth:360,minheight:250,autosize:!0}},kv={"package.json":{icon:`ph:package-fill`,color:`text-ok`},".gitignore":{icon:`ph:git-branch-fill`,color:`text-warn`},".gitattributes":{icon:`ph:git-branch-fill`,color:`text-warn`},dockerfile:{icon:`ph:cube-fill`,color:`text-accent`},license:{icon:`ph:scales-fill`,color:`text-muted`},makefile:{icon:`ph:terminal-fill`,color:`text-muted`}},Av=[{test:e=>e.startsWith(`tsconfig`)&&e.endsWith(`.json`),result:{icon:`ph:gear-fill`,color:`text-accent`}},{test:e=>e.startsWith(`.env`),result:{icon:`ph:lock-simple-fill`,color:`text-warn`}},{test:e=>e.endsWith(`.lock`),result:{icon:`ph:lock-simple-fill`,color:`text-muted`}}],jv={ts:{icon:`ph:file-ts-fill`,color:`text-accent`},tsx:{icon:`ph:file-ts-fill`,color:`text-accent`},js:{icon:`ph:file-js-fill`,color:`text-warn`},jsx:{icon:`ph:file-js-fill`,color:`text-warn`},mjs:{icon:`ph:file-js-fill`,color:`text-warn`},cjs:{icon:`ph:file-js-fill`,color:`text-warn`},vue:{icon:`ph:file-vue-fill`,color:`text-ok`},md:{icon:`ph:file-text-fill`,color:`text-accent`},json:{icon:`ph:brackets-curly-fill`,color:`text-warn`},css:{icon:`ph:file-css-fill`,color:`text-accent`},scss:{icon:`ph:file-css-fill`,color:`text-accent`},yaml:{icon:`ph:file-fill`,color:`text-muted`},yml:{icon:`ph:file-fill`,color:`text-muted`},toml:{icon:`ph:file-fill`,color:`text-muted`},sh:{icon:`ph:terminal-fill`,color:`text-ok`},bash:{icon:`ph:terminal-fill`,color:`text-ok`},zsh:{icon:`ph:terminal-fill`,color:`text-ok`},png:{icon:`ph:file-image-fill`,color:`text-warn`},jpg:{icon:`ph:file-image-fill`,color:`text-warn`},jpeg:{icon:`ph:file-image-fill`,color:`text-warn`},gif:{icon:`ph:file-image-fill`,color:`text-warn`},svg:{icon:`ph:file-image-fill`,color:`text-warn`},webp:{icon:`ph:file-image-fill`,color:`text-warn`},ico:{icon:`ph:file-image-fill`,color:`text-warn`},sql:{icon:`ph:database-fill`,color:`text-accent`},db:{icon:`ph:database-fill`,color:`text-accent`},sqlite:{icon:`ph:database-fill`,color:`text-accent`},txt:{icon:`ph:file-text-fill`,color:`text-muted`},log:{icon:`ph:file-text-fill`,color:`text-muted`},py:{icon:`ph:file-py-fill`,color:`text-ok`},go:{icon:`ph:file-code-fill`,color:`text-accent`},rs:{icon:`ph:file-rs-fill`,color:`text-warn`},html:{icon:`ph:file-html-fill`,color:`text-warn`},htm:{icon:`ph:file-html-fill`,color:`text-warn`},xml:{icon:`ph:file-code-fill`,color:`text-muted`}},Mv={icon:`ph:file-fill`,color:`text-muted`};function Nv(e){let t=e.toLowerCase();if(kv[t])return kv[t];for(let e of Av)if(e.test(t))return e.result;let n=t.split(`.`).pop();return n&&jv[n]?jv[n]:Mv}function Pv(e){return{icon:e?`ph:folder-open-fill`:`ph:folder-fill`,color:`text-accent`}}var Fv=[`onClick`],Iv={key:1,class:`inline-block w-3`},Lv=F({__name:`FileTree`,props:{nodes:{},depth:{},activeFolder:{},activePath:{}},emits:[`toggle`,`select`,`open`],setup(e,{emit:t}){let n=t;return(t,r)=>{let i=si(`FileTree`,!0);return R(!0),z(L,null,I(e.nodes,t=>(R(),z(`div`,{key:t.folder+`/`+t.path},[V(`button`,{type:`button`,class:A([`w-full text-left py-1 text-[11px] font-mono transition-colors block truncate`,t.isFile?`text-muted hover:text-text`:t.folder===e.activeFolder&&t.path===e.activePath?`bg-surface text-text`:`text-muted hover:text-text`]),style:k({paddingLeft:(e.depth??0)*12+8+`px`,paddingRight:`8px`}),onClick:e=>t.isFile?n(`open`,t):(n(`toggle`,t),n(`select`,t))},[t.isFile?(R(),z(L,{key:1},[r[3]||=V(`span`,{class:`inline-block w-3`},null,-1),H(N(K),{icon:N(Nv)(t.name).icon,class:A([N(Nv)(t.name).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)):(R(),z(L,{key:0},[t.children?.length||!t.loaded?(R(),B(N(K),{key:0,icon:t.expanded?`lucide:chevron-down`:`lucide:chevron-right`,class:`inline-block w-3 h-3 align-[-2px] text-muted`},null,8,[`icon`])):(R(),z(`span`,Iv)),H(N(K),{icon:N(Pv)(t.expanded).icon,class:A([N(Pv)(t.expanded).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)),U(` `+j(t.name),1)],14,Fv),!t.isFile&&t.expanded&&t.children&&t.children.length>0?(R(),B(i,{key:0,nodes:t.children,depth:(e.depth??0)+1,"active-folder":e.activeFolder,"active-path":e.activePath,onToggle:r[0]||=e=>n(`toggle`,e),onSelect:r[1]||=e=>n(`select`,e),onOpen:r[2]||=e=>n(`open`,e)},null,8,[`nodes`,`depth`,`active-folder`,`active-path`])):W(``,!0)]))),128)}}}),Rv={class:`flex h-full`},zv={key:0,class:`w-[180px] min-w-[140px] border-r border-border overflow-auto py-2 flex-shrink-0`},Bv={key:0,class:`px-3 py-4 text-[11px] text-muted`},Vv={class:`flex-1 flex flex-col min-w-0`},Hv={class:`px-3 py-3 sm:py-2.5 text-[11px] text-muted flex items-center gap-2 sm:gap-1 border-b border-border`},Uv=[`disabled`],Wv=[`value`],Gv={class:`ml-auto flex items-center gap-2 sm:gap-1 flex-shrink-0`},Kv={key:0,class:`text-center py-8 text-muted text-[12px]`},qv={key:1,class:`grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-1`},Jv=[`onClick`,`onDblclick`],Yv={class:`text-[10px] font-mono text-center w-full truncate text-accent`},Xv={key:2,class:`w-full border-collapse text-[12px]`},Zv={key:1},Qv=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],$v={class:`py-3 sm:py-1.5 px-2 border-b border-border font-mono`},ey={key:0,class:`inline-flex items-center gap-1.5 text-accent`},ty={key:1,class:`inline-flex items-center gap-1.5`},ny={class:`py-3 sm:py-1.5 px-2 border-b border-border text-muted`},ry={class:`py-3 sm:py-1.5 px-2 border-b border-border text-muted`},iy={class:`py-3 sm:py-1.5 px-1 border-b border-border w-[28px]`},ay=[`onClick`],oy={key:1,class:`text-center py-8 text-muted text-[12px]`},sy={class:`grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-1`},cy=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],ly={key:`files`,label:`Files`,icon:`lucide:folder`,color:`#7fd962`,component:F({__name:`window`,setup(e){let{confirm:t}=Zu(),{settings:n,set:r}=Su(),{state:i,set:a,openWindow:o,setTitle:s}=Du(),{menu:c,onContext:l,onTouchStart:u,cancelLongPress:d,close:f}=uu(),p=M([]),m=M([]),h=M(i.value.folder||``),g=M(i.value.path||`.`),_=M([]),v=M(-1),y=M(),b=M(n.filesViewMode??`list`),x=M(window.innerWidth>=640),S=G(()=>h.value?g.value===`.`?`/${h.value}`:`/${h.value}/${g.value}`:`/`),C=M(``),ee=M(!1),w=G(()=>[..._.value].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)),T=G(()=>p.value.find(e=>e.folder===h.value)?.readonly===!0);async function E(){let e=await Pu(`/api/files/groups`);if(!e)return;p.value=e;let t=new Set(m.value.map(e=>e.folder));for(let n of e)t.has(n.folder)||m.value.push({name:n.folder,path:`.`,folder:n.folder,expanded:!1,loaded:!1});m.value=m.value.filter(t=>e.some(e=>e.folder===t.folder)),ie()}async function D(e){let t=await Pu(`/api/files?${new URLSearchParams({folder:e.folder,path:e.path})}`);t&&(e.children=[...t.entries].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1).map(t=>({name:t.name,path:e.path===`.`?t.name:`${e.path}/${t.name}`,folder:e.folder,isFile:t.type===`file`,expanded:!1,loaded:t.type===`file`})),e.loaded=!0)}async function te(e){if(e.expanded){e.expanded=!1;return}e.loaded||await D(e),e.expanded=!0}function ne(e){h.value=e.folder,g.value=e.path}function re(e){h.value=e.folder;let t=e.path.split(`/`);t.pop(),g.value=t.length>0?t.join(`/`):`.`,o(`editor`,{folder:e.folder,path:e.path})}async function ie(){if(!h.value)return;let e=m.value.find(e=>e.folder===h.value&&e.path===`.`);if(!e||(e.expanded=!0,e.loaded||await D(e),g.value===`.`))return;let t=g.value.split(`/`).filter(Boolean),n=e;for(let e of t){if(!n.children)return;let t=n.children.find(t=>t.name===e&&!t.isFile);if(t||=(n.loaded||await D(n),n.children?.find(t=>t.name===e&&!t.isFile)),!t)return;if(t.loaded||await D(t),(t.children?.length??0)>10){n=t;continue}t.expanded=!0,n=t}}async function O(){if(!h.value)return;let e=await Pu(`/api/files?${new URLSearchParams({folder:h.value,path:g.value})}`);e&&(_.value=e.entries),v.value=0}function ae(e){let t=g.value===`.`?e:`${g.value}/${e}`;o(`editor`,{folder:h.value,path:t})}async function oe(e){if(!await t(`delete ${e.name+(e.type===`directory`?`/`:``)}?`))return;let n=g.value===`.`?e.name:`${g.value}/${e.name}`;await Pu(`/api/files/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folder:h.value,path:n})}),await O(),_.value.length===0&&g.value!==`.`?se(`..`):v.value=Math.min(v.value,w.value.length-1)}function se(e){if(e===`..`){if(g.value===`.`){h.value=``,_.value=[];return}let e=g.value.split(`/`);e.pop(),g.value=e.length>0?e.join(`/`):`.`;return}g.value=g.value===`.`?e:`${g.value}/${e}`}function ce(e){h.value=e.folder,g.value=`.`}function le(e){ce(e)}function ue(e,t){v.value=t,!c.value&&(e.type===`directory`?se(e.name):ae(e.name))}function de(){C.value=S.value,ee.value=!0}function fe(){ee.value=!1;let e=C.value.replace(/^\/+/,``).replace(/\/+$/,``);if(!e){h.value=``,g.value=`.`,_.value=[];return}let t=e.split(`/`).filter(Boolean),n=t[0];p.value.some(e=>e.folder===n)&&(h.value=n,g.value=t.length>1?t.slice(1).join(`/`):`.`)}function pe(){ee.value=!1}P(h,e=>a({folder:e})),P(g,e=>a({path:e})),P(b,e=>{a({viewMode:e}),r({filesViewMode:e})}),P(()=>n.filesViewMode,e=>{e&&e!==b.value&&(b.value=e)}),P([h,g],([e,t])=>{if(!e)return s(`Files`);s(`Files — ${t&&t!==`.`?`${e}/${t}`:e}`)});let me;function he(){if(me?.close(),!h.value)return;let e=new URLSearchParams({folder:h.value,path:g.value}),t=new EventSource(`/api/files/watch?${e}`,{withCredentials:!0});t.onmessage=()=>O(),me=t}P([h,g],()=>{O(),he(),ie()},{immediate:!0}),ti(()=>me?.close()),ld(`groups`,E);function ge(){c.value&&oe(c.value.data),f()}function _e(){if(!c.value)return;let e=c.value.data;e.type===`directory`?se(e.name):ae(e.name),f()}function ve(){let e=y.value?.clientWidth??0;return e<=0?1:Math.max(1,Math.floor((e+4)/84))}function ye(e){if(e.key===`Delete`||e.key===`Backspace`||e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`u`){e.preventDefault(),se(`..`);return}let t=w.value;if(!t.length)return;let n=Math.max(v.value,0);if(v.value<0&&(v.value=0),[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)){e.preventDefault();let r=n;if(b.value===`grid`){let t=ve();e.key===`ArrowLeft`?r=n-1:e.key===`ArrowRight`?r=n+1:e.key===`ArrowUp`?r=n-t:e.key===`ArrowDown`&&(r=n+t)}else e.key===`ArrowLeft`||e.key===`ArrowUp`?r=n-1:(e.key===`ArrowRight`||e.key===`ArrowDown`)&&(r=n+1);v.value=Math.max(0,Math.min(r,t.length-1))}else if(e.key===`Enter`){e.preventDefault();let n=t[v.value];n&&(n.type===`directory`?se(n.name):ae(n.name))}}function be(e){return e===void 0?`-`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}return(e,t)=>(R(),z(`div`,Rv,[x.value?(R(),z(`div`,zv,[m.value.length===0?(R(),z(`div`,Bv,`no groups`)):W(``,!0),H(Lv,{nodes:m.value,"active-folder":h.value,"active-path":g.value,onToggle:te,onSelect:ne,onOpen:re},null,8,[`nodes`,`active-folder`,`active-path`])])):W(``,!0),V(`div`,Vv,[V(`div`,Hv,[V(`button`,{type:`button`,class:A([`btn-sm hover:bg-surface mr-1 min-w-[36px] min-h-[36px] sm:min-w-0 sm:min-h-0 flex items-center justify-center`,x.value?`text-text`:``]),onClick:t[0]||=e=>x.value=!x.value},[H(N(K),{icon:`lucide:panel-left`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),V(`button`,{type:`button`,class:A([`btn-sm hover:bg-surface min-w-[36px] min-h-[36px] sm:min-w-0 sm:min-h-0 flex items-center justify-center`,!h.value&&g.value===`.`?`opacity-30`:``]),disabled:!h.value&&g.value===`.`,onClick:t[1]||=e=>se(`..`)},[H(N(K),{icon:`lucide:chevron-left`,class:`w-4 h-4 sm:w-3 sm:h-3`})],10,Uv),ee.value?(R(),z(`input`,{key:0,class:`flex-1 min-w-0 bg-surface text-text text-[11px] font-mono px-2 py-2 sm:py-1 rounded outline-none border border-border focus:border-accent`,value:C.value,onInput:t[2]||=e=>C.value=e.target.value,onKeydown:[Xs(fe,[`enter`]),Xs(pe,[`escape`])],onBlur:fe,onVnodeMounted:t[3]||=e=>e.el.select()},null,40,Wv)):(R(),z(`button`,{key:1,type:`button`,class:`flex-1 min-w-0 text-left text-[11px] font-mono text-text truncate px-2 py-2 sm:py-1 rounded hover:bg-surface transition-colors`,onClick:de},j(S.value),1)),V(`div`,Gv,[V(`button`,{type:`button`,class:A([`btn-sm hover:bg-surface min-w-[36px] min-h-[36px] sm:min-w-0 sm:min-h-0 flex items-center justify-center`,b.value===`list`?`bg-surface text-text`:``]),onClick:t[4]||=e=>b.value=`list`},[H(N(K),{icon:`lucide:list`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),V(`button`,{type:`button`,class:A([`btn-sm hover:bg-surface min-w-[36px] min-h-[36px] sm:min-w-0 sm:min-h-0 flex items-center justify-center`,b.value===`grid`?`bg-surface text-text`:``]),onClick:t[5]||=e=>b.value=`grid`},[H(N(K),{icon:`lucide:layout-grid`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),h.value?(R(),z(`button`,{key:0,type:`button`,class:`btn-sm hover:bg-surface min-w-[36px] min-h-[36px] sm:min-w-0 sm:min-h-0 flex items-center justify-center`,onClick:O},[H(N(K),{icon:`lucide:refresh-cw`,class:`w-4 h-4 sm:w-3 sm:h-3`})])):W(``,!0)])]),V(`div`,{ref_key:`listingEl`,ref:y,class:`flex-1 overflow-auto p-3 outline-none`,tabindex:`0`,onKeydown:ye},[!h.value&&p.value.length===0?(R(),z(`div`,Kv,` no groups `)):h.value?b.value===`list`?(R(),z(`table`,Xv,[t[14]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` name `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[80px]`},` size `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[80px]`},` modified `),V(`th`,{class:`w-[28px] border-b border-border`})])],-1),V(`tbody`,null,[g.value===`.`?W(``,!0):(R(),z(`tr`,{key:0,class:`hover:bg-surface cursor-pointer`,onClick:t[6]||=e=>se(`..`)},[...t[12]||=[V(`td`,{colspan:`4`,class:`py-3 sm:py-1.5 px-2 border-b border-border font-mono text-muted`},` ... `,-1)]])),w.value.length===0?(R(),z(`tr`,Zv,[...t[13]||=[V(`td`,{colspan:`4`,class:`text-center py-8 text-muted text-[12px]`},`empty directory`,-1)]])):W(``,!0),(R(!0),z(L,null,I(w.value,(e,n)=>(R(),z(`tr`,{key:e.name,class:A([`cursor-pointer`,n===v.value?`bg-surface`:`hover:bg-surface`]),onClick:t=>ue(e,n),onDblclick:t=>e.type===`directory`?se(e.name):ae(e.name),onContextmenu:t=>N(l)(t,e),onTouchstart:t=>N(u)(t,e),onTouchend:t[7]||=(...e)=>N(d)&&N(d)(...e),onTouchmove:t[8]||=(...e)=>N(d)&&N(d)(...e)},[V(`td`,$v,[e.type===`directory`?(R(),z(`span`,ey,[H(N(K),{icon:N(Pv)(!1).icon,class:`w-3.5 h-3.5 flex-shrink-0`},null,8,[`icon`]),U(` `+j(e.name)+`/ `,1)])):(R(),z(`span`,ty,[H(N(K),{icon:N(Nv)(e.name).icon,class:A([N(Nv)(e.name).color,`w-3.5 h-3.5 flex-shrink-0`])},null,8,[`icon`,`class`]),U(` `+j(e.name),1)]))]),V(`td`,ny,j(be(e.size)),1),V(`td`,ry,j(N(qh)(e.mtime)),1),V(`td`,iy,[V(`button`,{type:`button`,class:`btn-sm hover:bg-surface text-muted hover:text-text`,onClick:Js(t=>N(l)(t,e),[`stop`])},[H(N(K),{icon:`lucide:ellipsis`,class:`w-3.5 h-3.5`})],8,ay)])],42,Qv))),128))])])):(R(),z(L,{key:3},[g.value===`.`?W(``,!0):(R(),z(`div`,{key:0,class:`flex items-center gap-1.5 px-2 py-1.5 mb-1 font-mono text-[12px] text-muted hover:bg-surface cursor-pointer rounded`,onClick:t[9]||=e=>se(`..`)},` .. `)),w.value.length===0?(R(),z(`div`,oy,` empty directory `)):W(``,!0),V(`div`,sy,[(R(!0),z(L,null,I(w.value,(e,n)=>(R(),z(`div`,{key:e.name,class:A([`flex flex-col items-center gap-1.5 p-3 rounded cursor-pointer select-none`,n===v.value?`bg-surface`:`hover:bg-surface`]),onClick:t=>ue(e,n),onDblclick:t=>e.type===`directory`?se(e.name):ae(e.name),onContextmenu:t=>N(l)(t,e),onTouchstart:t=>N(u)(t,e),onTouchend:t[10]||=(...e)=>N(d)&&N(d)(...e),onTouchmove:t[11]||=(...e)=>N(d)&&N(d)(...e)},[e.type===`directory`?(R(),B(N(K),{key:0,icon:N(Pv)(!1).icon,class:`w-14 h-14 text-accent`},null,8,[`icon`])):(R(),B(N(K),{key:1,icon:N(Nv)(e.name).icon,class:A([N(Nv)(e.name).color,`w-14 h-14`])},null,8,[`icon`,`class`])),V(`span`,{class:A([`text-[10px] font-mono text-center w-full truncate`,e.type===`directory`?`text-accent`:`text-text`])},j(e.name),3)],42,cy))),128))])],64)):(R(),z(`div`,qv,[(R(!0),z(L,null,I(p.value,e=>(R(),z(`div`,{key:e.jid,class:`flex flex-col items-center gap-1.5 p-3 rounded cursor-pointer select-none hover:bg-surface`,onClick:t=>le(e),onDblclick:t=>ce(e)},[H(N(K),{icon:`ph:folder-fill`,class:`w-14 h-14 text-accent`}),V(`span`,Yv,j(e.folder),1)],40,Jv))),128))]))],544)]),H(Hl,{pos:N(c)??null},{default:Zn(()=>[V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-accent-dim hover:text-accent`,onClick:_e},` Open `),T.value?W(``,!0):(R(),z(`button`,{key:0,class:`w-full text-left px-4 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-danger-dim hover:text-danger`,onClick:ge},` Delete `))]),_:1},8,[`pos`])]))}}),window:{width:800,height:520,minwidth:480,minheight:300}},uy={class:`flex flex-col h-full`},dy={class:`flex gap-2 items-center p-3 pb-0`},fy=[`value`],py={class:`flex-1 overflow-auto p-3 pt-2 select-text relative`},my={class:`w-full border-collapse text-[12px] table-fixed`},hy={key:0},gy={colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},_y={key:1},vy={class:`py-1.5 px-2 border-b border-border align-top`},yy={class:`mt-0.5`},by={class:`badge-muted`},xy=[`title`],Sy={class:`badge-muted whitespace-nowrap`},Cy={class:`py-1.5 px-2 border-b border-border font-mono select-text break-all align-top`},wy=[`innerHTML`],Ty={key:`logs`,label:`Logs`,icon:`lucide:scroll-text`,color:`#e5a535`,component:F({__name:`window`,setup(e){let t={10:`debug`,20:`info`,30:`warn`,40:`error`,50:`fatal`},n=M([]),r=M(!0),i=M(``),a=M(``),o=M([]),s;function c(){s?.close(),r.value=!0;let e=new URLSearchParams({limit:`200`});i.value&&e.set(`level`,i.value),a.value&&e.set(`tag`,a.value);let t=new EventSource(`/api/logs?${e}`,{withCredentials:!0});t.onmessage=e=>{try{let t=JSON.parse(e.data);n.value=t,r.value=!1;let i=new Set(t.map(e=>e.tag));for(let e of i)o.value.includes(e)||o.value.push(e);o.value.sort()}catch{}},s=t}Zr(()=>{c()}),ti(()=>{s?.close()}),P([i,a],c);function l(e){return t[e]??String(e)}function u(e){return e>=40?`badge-danger`:e>=30?`badge-warn`:e>=20?`badge-accent`:`badge-muted`}function d(e){return JSON.stringify(e,null,2).replace(/^\{\n/,``).replace(/\n\}$/,``).replace(/^ /gm,``).replace(/("(?:\\.|[^"\\])*")\s*(:)?|(\b(?:true|false|null)\b)|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,(e,t,n,r,i)=>t?n?`<span class="text-accent">${f(t)}</span>:`:`<span class="text-green">${f(t)}</span>`:r?`<span class="text-warn">${e}</span>`:i?`<span class="text-danger">${e}</span>`:e)}function f(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}return(e,t)=>(R(),z(`div`,uy,[V(`div`,dy,[t[4]||=V(`h3`,{class:`section-title`},`system logs`,-1),Qn(V(`select`,{"onUpdate:modelValue":t[0]||=e=>a.value=e,class:`ml-auto bg-bg border border-border rounded text-text px-2 py-1 text-[11px] font-mono outline-none transition-colors focus:border-accent`},[t[2]||=V(`option`,{value:``},`all tags`,-1),(R(!0),z(L,null,I(o.value,e=>(R(),z(`option`,{key:e,value:e},j(e),9,fy))),128))],512),[[Us,a.value]]),Qn(V(`select`,{"onUpdate:modelValue":t[1]||=e=>i.value=e,class:`bg-bg border border-border rounded text-text px-2 py-1 text-[11px] font-mono outline-none transition-colors focus:border-accent`},[...t[3]||=[Ga(`<option value="">all levels</option><option value="10">debug+</option><option value="20">info+</option><option value="30">warn+</option><option value="40">error+</option><option value="50">fatal</option>`,6)]],512),[[Us,i.value]])]),V(`div`,py,[V(`table`,my,[t[7]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[90px]`},` info `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` message `)])],-1),V(`tbody`,null,[r.value?(R(),z(`tr`,hy,[V(`td`,gy,[H(N(K),{icon:`lucide:loader`,class:`inline-block align-[-2px] mr-1 animate-spin`}),t[5]||=U(`loading... `,-1)])])):n.value.length===0?(R(),z(`tr`,_y,[...t[6]||=[V(`td`,{colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},`no logs`,-1)]])):W(``,!0),(R(!0),z(L,null,I(n.value,e=>(R(),z(`tr`,{key:e.timestamp,class:`hover:bg-surface`},[V(`td`,vy,[V(`span`,{class:A(u(e.level))},[H(N(K),{icon:`lucide:signal`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(j(l(e.level)),1)],2),V(`div`,yy,[V(`span`,by,[H(N(K),{icon:`lucide:tag`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(j(e.tag),1)])]),V(`div`,{class:`mt-0.5`,title:e.timestamp},[V(`span`,Sy,[H(N(K),{icon:`lucide:clock`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(j(N(qh)(e.timestamp)),1)])],8,xy)]),V(`td`,Cy,[V(`span`,null,j(e.message),1),e.data?(R(),z(`pre`,{key:0,class:`whitespace-pre-wrap m-0 mt-1 text-muted text-[11px]`,innerHTML:d(e.data)},null,8,wy)):W(``,!0)])]))),128))])])])]))}}),window:{width:800,height:500,minwidth:400,minheight:280}};function Ey(e){this.content=e}Ey.prototype={constructor:Ey,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Ey(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Ey(n)},addToStart:function(e,t){return new Ey([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ey(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Ey(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Ey.from(e),e.size?new Ey(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ey.from(e),e.size?new Ey(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ey.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Ey.from=function(e){if(e instanceof Ey)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ey(t)};function Dy(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Dy(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Oy(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Oy(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var q=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Dy(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Oy(this,e,t,n)}findIndex(e){if(e==0)return Ay(0,e);if(e==this.size)return Ay(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ay(t+1,i):Ay(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};q.empty=new q([],0);var ky={index:0,offset:0};function Ay(e,t){return ky.index=e,ky.offset=t,ky}function jy(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!jy(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!jy(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var My=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&jy(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};My.none=[];var Ny=class extends Error{},J=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Fy(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Py(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(q.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};J.empty=new J(q.empty,0,0);function Py(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Py(a.content,t-i-1,n-i-1)))}function Fy(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=Fy(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Iy(e,t,n){if(n.openStart>e.depth)throw new Ny(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ny(`Inconsistent open depths`);return Ly(e,t,n,0)}function Ly(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Ly(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Hy(a,Wy(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Hy(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Gy(n,e);return Hy(a,Uy(e,i,o,t,r))}}function Ry(e,t){if(!t.type.compatibleContent(e.type))throw new Ny(`Cannot join `+t.type.name+` onto `+e.type.name)}function zy(e,t,n){let r=e.node(n);return Ry(r,t.node(n)),r}function By(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Vy(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(By(e.nodeAfter,r),a++));for(let e=a;e<o;e++)By(i.child(e),r);t&&t.depth==n&&t.textOffset&&By(t.nodeBefore,r)}function Hy(e,t){return e.type.checkContent(t),e.copy(t)}function Uy(e,t,n,r,i){let a=e.depth>i&&zy(e,t,i+1),o=r.depth>i&&zy(n,r,i+1),s=[];return Vy(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ry(a,o),By(Hy(a,Uy(e,t,n,r,i+1)),s)):(a&&By(Hy(a,Wy(e,t,i+1)),s),Vy(t,n,i,s),o&&By(Hy(o,Wy(n,r,i+1)),s)),Vy(r,null,i,s),new q(s)}function Wy(e,t,n){let r=[];return Vy(null,e,n,r),e.depth>n&&By(Hy(zy(e,t,n+1),Wy(e,t,n+1)),r),Vy(t,null,n,r),new q(r)}function Gy(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(q.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ky=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return My.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Xy(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Yy.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Yy.set(t,r=new qy);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Jy,i}},qy=class{constructor(){this.elts=[],this.i=0}},Jy=12,Yy=new WeakMap,Xy=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Zy=Object.create(null),Qy=class e{constructor(e,t,n,r=My.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&jy(this.attrs,t||e.defaultAttrs||Zy)&&My.sameSet(this.marks,n||My.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return J.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new J(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Iy(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ky.resolveCached(this,e)}resolveNoCache(e){return Ky.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),eb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=q.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=My.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!My.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=q.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Qy.prototype.text=void 0;var $y=class e extends Qy{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function eb(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var tb=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new nb(t,n);if(r.next==null)return e.empty;let i=rb(r);r.next&&r.err(`Unexpected trailing text`);let a=pb(ub(i));return mb(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return q.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
|
+
`)}};tb.empty=new tb(!0);var nb=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function rb(e){let t=[];do t.push(ib(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function ib(e){let t=[];do t.push(ab(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ab(e){let t=lb(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=sb(e,t);else break;return t}function ob(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function sb(e,t){let n=ob(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ob(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function cb(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function lb(e){if(e.eat(`(`)){let t=rb(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=cb(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function ub(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function db(e,t){return t-e}function fb(e,t){let n=[];return r(t),n.sort(db);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function pb(e){let t=Object.create(null);return n(fb(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);fb(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new tb(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(db);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function mb(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function hb(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function gb(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function _b(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function vb(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new xb(e,r,t[r]);return n}var yb=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=vb(e,n.attrs),this.defaultAttrs=hb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==tb.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:gb(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Qy(this,this.computeAttrs(e),q.from(t),My.setFrom(n))}createChecked(e=null,t,n){return t=q.from(t),this.checkContent(t),new Qy(this,this.computeAttrs(e),t,My.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=q.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(q.empty,!0);return i?new Qy(this,e,t.append(i),My.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){_b(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:My.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function bb(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var xb=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?bb(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Sb=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=vb(e,r.attrs),this.excluded=null;let i=hb(this.attrs);this.instance=i?new My(this,i):null}create(e=null){return!e&&this.instance?this.instance:new My(this,gb(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){_b(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Cb=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Ey.from(e.nodes),t.marks=Ey.from(e.marks||{}),this.nodes=yb.compile(this.spec.nodes,this),this.marks=Sb.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=tb.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?wb(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:wb(this,n.split(` `))}this.nodeFromJSON=e=>Qy.fromJSON(this,e),this.markFromJSON=e=>My.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof yb))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new $y(n,n.defaultAttrs,e,My.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function wb(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Tb(e){return e.tag!=null}function Eb(e){return e.style!=null}var Db=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Tb(e))this.tags.push(e);else if(Eb(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Ib(this,t,!1);return n.addAll(e,My.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ib(this,t,!0);return n.addAll(e,My.none,t.from,t.to),J.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Rb(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=zb(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=zb(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Ob={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ab={ol:!0,ul:!0},jb=1,Mb=2,Nb=4;function Pb(e,t,n){return t==null?e&&e.whitespace==`pre`?jb|Mb:n&~Nb:(t?jb:0)|(t===`full`?Mb:0)}var Fb=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=My.none,this.match=i||(a&Nb?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(q.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&jb)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=q.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ob.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Ib=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Pb(null,t.preserveWhitespace,0)|(n?Nb:0);i=r?new Fb(r.type,r.attrs,My.none,!0,t.topMatch||r.type.contentMatch,a):n?new Fb(null,null,My.none,!0,null,a):new Fb(e.schema.topNodeType,null,My.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Mb?`full`:this.localPreserveWS||(r.options&jb)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Ab.hasOwnProperty(a)&&this.parser.normalizeLists&&Lb(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:kb.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Ob.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=My.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Bb(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Pb(e,i,a.options);a.options&Nb&&a.content.length==0&&(o|=Nb);let s=My.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Bb(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Fb(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=jb);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Lb(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Ab.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Rb(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function zb(e){let t={};for(let n in e)t[n]=e[n];return t}function Bb(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Vb=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ub(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=qb(Ub(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&qb(Ub(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return qb(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Hb(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Hb(e.marks)}};function Hb(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ub(e){return e.document||window.document}var Wb=new WeakMap;function Gb(e){let t=Wb.get(e);return t===void 0&&Wb.set(e,t=Kb(e)),t}function Kb(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function qb(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Gb(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=qb(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Jb=65535,Yb=2**16;function Xb(e,t){return e+t*Yb}function Zb(e){return e&Jb}function Qb(e){return(e-(e&Jb))/Yb}var $b=1,ex=2,tx=4,nx=8,rx=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&nx)>0}get deletedBefore(){return(this.delInfo&($b|tx))>0}get deletedAfter(){return(this.delInfo&(ex|tx))>0}get deletedAcross(){return(this.delInfo&tx)>0}},ix=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Zb(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Qb(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Xb(o/3,e-s),f=e==s?ex:e==u?$b:tx;return(t<0?e!=s:e!=u)&&(f|=nx),new rx(a,f,d)}r+=l-c}return n?e+r:new rx(e+r,0,null)}touches(e,t){let n=0,r=Zb(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};ix.empty=new ix([]);var ax=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new rx(e,r,null)}},ox=Object.create(null),sx=class{getMap(){return ix.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=ox[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ox)throw RangeError(`Duplicate use of step JSON ID `+e);return ox[e]=t,t.prototype.jsonID=e,t}},cx=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ny)return e.fail(t.message);throw t}}};function lx(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(lx(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return q.fromArray(r)}var ux=class e extends sx{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new J(lx(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return cx.fromReplace(e,this.from,this.to,i)}invert(){return new dx(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};sx.jsonID(`addMark`,ux);var dx=class e extends sx{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new J(lx(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return cx.fromReplace(e,this.from,this.to,n)}invert(){return new ux(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};sx.jsonID(`removeMark`,dx);var fx=class e extends sx{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cx.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cx.fromReplace(e,this.pos,this.pos+1,new J(q.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new px(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};sx.jsonID(`addNodeMark`,fx);var px=class e extends sx{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cx.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cx.fromReplace(e,this.pos,this.pos+1,new J(q.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new fx(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};sx.jsonID(`removeNodeMark`,px);var mx=class e extends sx{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&gx(e,this.from,this.to)?cx.fail(`Structure replace would overwrite content`):cx.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ix([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?J.empty:new J(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?J.empty:new J(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,J.fromJSON(t,n.slice),!!n.structure)}};sx.jsonID(`replace`,mx);var hx=class e extends sx{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(gx(e,this.from,this.gapFrom)||gx(e,this.gapTo,this.to)))return cx.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cx.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?cx.fromReplace(e,this.from,this.to,n):cx.fail(`Content does not fit in gap`)}getMap(){return new ix([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,J.fromJSON(t,n.slice),n.insert,!!n.structure)}};sx.jsonID(`replaceAround`,hx);function gx(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function _x(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new dx(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new ux(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function vx(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Sb){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new dx(t.from,t.to,t.style)))}function yx(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new mx(s,l,J.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new dx(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new J(q.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new mx(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(q.empty,!0);e.replace(s,s,new J(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function bx(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function xx(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!bx(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Sx(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=q.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=q.from(r.node(e).copy(u)),d++):c--;let f=q.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=q.from(i.node(e).copy(f)),p++):l++;e.step(new hx(c,l,o,s,new J(u.append(f),d,p),u.size-d,!0))}function Cx(e,t,n=null,r=e){let i=Tx(e,t),a=i&&Ex(r,t);return a?i.map(wx).concat({type:t,attrs:n}).concat(a.map(wx)):null}function wx(e){return{type:e,attrs:null}}function Tx(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Ex(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Dx(e,t,n){let r=q.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=q.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new hx(i,a,i,a,new J(r,0,0),n.length,!0))}function Ox(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&jx(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Ax(e,t,n,a),yx(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new hx(c,l,c+1,l-1,new J(q.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&kx(e,t,n,a),!1}})}function kx(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Ax(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
5
|
+
`))}})}function jx(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Mx(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new hx(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new J(q.from(o),0,0),1,!0))}function Nx(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Px(e,t,n=1,r){let i=e.doc.resolve(t),a=q.empty,o=q.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=q.from(i.node(e).copy(a));let t=r&&r[s];o=q.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new mx(t,t,new J(a.append(o),n,n),!0))}function Fx(e,t){let n=e.resolve(t),r=n.index();return Lx(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ix(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Lx(e,t){return!!(e&&t&&!e.isLeaf&&Ix(e,t))}function Rx(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Lx(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function zx(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Ax(e,r.node(),r.before(),s)}o.inlineContent&&yx(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new mx(l,c.map(t+n,-1),J.empty,!0)),r===!0){let t=e.doc.resolve(l);kx(e,t.node(),t.before(),e.steps.length)}return e}function Bx(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Vx(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+(n>0?1:0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Hx(e,t,n=t,r=J.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Ux(i,a,r)?new mx(t,n,r):new Wx(i,a,r).fit()}function Ux(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Wx=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=q.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=q.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new J(i,a,o);return e>-1?new hx(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new mx(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=qx(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(q.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=qx(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new J(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=qx(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new J(Gx(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new J(Gx(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Jx(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Kx(this.placed,t,q.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?J.empty:new J(Gx(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new J(Gx(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Yx(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Yx(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Yx(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Kx(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Kx(this.placed,this.depth,q.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(q.empty,!0);e.childCount&&(this.placed=Kx(this.placed,this.frontier.length,e))}};function Gx(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Gx(e.firstChild.content,t-1,n)))}function Kx(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Kx(e.lastChild.content,t-1,n)))}function qx(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Jx(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Jx(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),e.copy(r)}function Yx(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Xx(n,a.content,o)?s:null}function Xx(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Zx(e){return e.spec.defining||e.spec.definingForContent}function Qx(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Ux(i,a,r))return e.step(new mx(t,n,r));let o=nS(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Zx(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new J($x(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function $x(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy($x(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(q.empty,!0))}return e}function eS(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Bx(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new J(q.from(r),0,0))}function tS(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),a=nS(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function nS(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var rS=class e extends sx{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return cx.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return cx.fromReplace(e,this.pos,this.pos+1,new J(q.from(r),0,t.isLeaf?0:1))}getMap(){return ix.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};sx.jsonID(`attr`,rS);var iS=class e extends sx{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return cx.ok(n)}getMap(){return ix.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};sx.jsonID(`docAttr`,iS);var aS=class extends Error{};aS=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},aS.prototype=Object.create(Error.prototype),aS.prototype.constructor=aS,aS.prototype.name=`TransformError`;var oS=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ax}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new aS(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=J.empty){let r=Hx(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new J(q.from(n),0,0))}delete(e,t){return this.replace(e,t,J.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Qx(this,e,t,n),this}replaceRangeWith(e,t,n){return eS(this,e,t,n),this}deleteRange(e,t){return tS(this,e,t),this}lift(e,t){return Sx(this,e,t),this}join(e,t=1){return zx(this,e,t),this}wrap(e,t){return Dx(this,e,t),this}setBlockType(e,t=e,n,r=null){return Ox(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Mx(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new rS(e,t,n)),this}setDocAttribute(e,t){return this.step(new iS(e,t)),this}addNodeMark(e,t){return this.step(new fx(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof My)t.isInSet(n.marks)&&this.step(new px(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new px(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Px(this,e,t,n),this}addMark(e,t,n){return _x(this,e,t,n),this}removeMark(e,t,n){return vx(this,e,t,n),this}clearIncompatible(e,t,n){return yx(this,e,t,n),this}},sS=Object.create(null),cS=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new lS(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=J.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?J.empty:t),o==0&&yS(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),yS(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new fS(e):vS(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?vS(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):vS(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new gS(e.node(0))}static atStart(e){return vS(e,e,0,0,1)||new gS(e)}static atEnd(e){return vS(e,e,e.content.size,e.childCount,-1)||new gS(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=sS[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sS)throw RangeError(`Duplicate use of selection JSON ID `+e);return sS[e]=t,t.prototype.jsonID=e,t}getBookmark(){return fS.between(this.$anchor,this.$head).getBookmark()}};cS.prototype.visible=!0;var lS=class{constructor(e,t){this.$from=e,this.$to=t}},uS=!1;function dS(e){!uS&&!e.parent.inlineContent&&(uS=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var fS=class e extends cS{constructor(e,t=e){dS(e),dS(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return cS.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=J.empty){if(super.replace(e,t),t==J.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new pS(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=cS.findFrom(n,r,!0)||cS.findFrom(n,-r,!0);if(e)n=e.$head;else return cS.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(cS.findFrom(t,-r,!0)||cS.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};cS.jsonID(`text`,fS);var pS=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return fS.between(e.resolve(this.anchor),e.resolve(this.head))}},mS=class e extends cS{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?cS.near(a):new e(a)}content(){return new J(q.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new hS(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};mS.prototype.visible=!1,cS.jsonID(`node`,mS);var hS=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new pS(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&mS.isSelectable(n)?new mS(t):cS.near(t)}},gS=class e extends cS{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=J.empty){if(t==J.empty){e.delete(0,e.doc.content.size);let t=cS.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return _S}};cS.jsonID(`all`,gS);var _S={map(){return this},resolve(e){return new gS(e)}};function vS(e,t,n,r,i,a=!1){if(t.inlineContent)return fS.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=vS(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&mS.isSelectable(r))return mS.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function yS(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof mx||i instanceof hx))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(cS.near(e.doc.resolve(o),n))}var bS=1,xS=2,SS=4,CS=class extends oS{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|bS)&~xS,this.storedMarks=null,this}get selectionSet(){return(this.updated&bS)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xS,this}ensureMarks(e){return My.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xS)>0}addStep(e,t){super.addStep(e,t),this.updated&=~xS,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||My.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(cS.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=SS,this}get scrolledIntoView(){return(this.updated&SS)>0}};function wS(e,t){return!t||!e?e:e.bind(t)}var TS=class{constructor(e,t,n){this.name=e,this.init=wS(t.init,n),this.apply=wS(t.apply,n)}},ES=[new TS(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new TS(`selection`,{init(e,t){return e.selection||cS.atStart(t.doc)},apply(e){return e.selection}}),new TS(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new TS(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],DS=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ES.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new TS(e.key,e.spec.state,e))})}},OS=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new CS(this)}static create(t){let n=new DS(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new DS(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new DS(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Qy.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=cS.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function kS(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=kS(i,t,{})),n[r]=i}return n}var AS=class{constructor(e){this.spec=e,this.props={},e.props&&kS(e.props,this,this.props),this.key=e.key?e.key.key:MS(`plugin`)}getState(e){return e[this.key]}},jS=Object.create(null);function MS(e){return e in jS?e+`$`+ ++jS[e]:(jS[e]=0,e+`$`)}var NS=class{constructor(e=`key`){this.key=MS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},PS=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function FS(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var IS=(e,t,n)=>{let r=FS(e,n);if(!r)return!1;let i=HS(r);if(!i){let n=r.blockRange(),i=n&&xx(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(oC(e,i,t,-1))return!0;if(r.parent.content.size==0&&(BS(a,`end`)||mS.isSelectable(a)))for(let n=r.depth;;n--){let o=Hx(e.doc,r.before(n),r.after(n),J.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(BS(a,`end`)?cS.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):mS.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},LS=(e,t,n)=>{let r=FS(e,n);if(!r)return!1;let i=HS(r);return i?zS(e,i,t):!1},RS=(e,t,n)=>{let r=US(e,n);if(!r)return!1;let i=KS(r);return i?zS(e,i,t):!1};function zS(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Hx(e.doc,i,o,J.empty);if(!s||s.from!=i||s instanceof mx&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(fS.create(t.doc,i)),n(t.scrollIntoView())}return!0}function BS(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var VS=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=HS(r)}let o=a&&a.nodeBefore;return!o||!mS.isSelectable(o)?!1:(t&&t(e.tr.setSelection(mS.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function HS(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function US(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var WS=(e,t,n)=>{let r=US(e,n);if(!r)return!1;let i=KS(r);if(!i)return!1;let a=i.nodeAfter;if(oC(e,i,t,1))return!0;if(r.parent.content.size==0&&(BS(a,`start`)||mS.isSelectable(a))){let n=Hx(e.doc,r.before(),r.after(),J.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(BS(a,`start`)?cS.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):mS.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},GS=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=KS(r)}let o=a&&a.nodeAfter;return!o||!mS.isSelectable(o)?!1:(t&&t(e.tr.setSelection(mS.create(e.doc,a.pos)).scrollIntoView()),!0)};function KS(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var qS=(e,t)=>{let n=e.selection,r=n instanceof mS,i;if(r){if(n.node.isTextblock||!Fx(e.doc,n.from))return!1;i=n.from}else if(i=Rx(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(mS.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},JS=(e,t)=>{let n=e.selection,r;if(n instanceof mS){if(n.node.isTextblock||!Fx(e.doc,n.to))return!1;r=n.to}else if(r=Rx(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},YS=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&xx(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},XS=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
6
|
+
`).scrollIntoView()),!0)};function ZS(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var QS=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=ZS(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(cS.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},$S=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof gS||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=ZS(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(fS.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},eC=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Nx(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&xx(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function tC(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof mS&&t.selection.node.isBlock)return!r.parentOffset||!Nx(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=ZS(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof fS||t.selection instanceof gS)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Nx(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,Nx(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var nC=tC(),rC=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(mS.create(e.doc,i))),!0)},iC=(e,t)=>(t&&t(e.tr.setSelection(new gS(e.doc))),!0);function aC(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Fx(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function oC(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&aC(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=q.empty;for(let e=o.length-1;e>=0;e--)s=q.from(o[e].create(null,s));s=q.from(i.copy(s));let c=e.tr.step(new hx(t.pos-1,r,t.pos,r,new J(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Fx(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:cS.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&xx(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&BS(a,`start`,!0)&&BS(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=q.empty;for(let e=o.length-1;e>=0;e--)r=q.from(o[e].copy(r));n(e.tr.step(new hx(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new J(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function sC(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(fS.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var cC=sC(-1),lC=sC(1);function uC(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Cx(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function dC(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function fC(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var pC=fC(PS,IS,VS),mC=fC(PS,WS,GS),hC={Enter:fC(XS,$S,eC,nC),"Mod-Enter":QS,Backspace:pC,"Mod-Backspace":pC,"Shift-Backspace":pC,Delete:mC,"Mod-Delete":mC,"Mod-a":iC},gC={"Ctrl-h":hC.Backspace,"Alt-Backspace":hC[`Mod-Backspace`],"Ctrl-d":hC.Delete,"Ctrl-Alt-Backspace":hC[`Mod-Delete`],"Alt-Delete":hC[`Mod-Delete`],"Alt-d":hC[`Mod-Delete`],"Ctrl-a":cC,"Ctrl-e":lC};for(let e in hC)gC[e]=hC[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function _C(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return vC(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function vC(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new Xy(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Xy(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Cx(a,n,r,t);return s?(e&&yC(e,t,s,i,n),!0):!1}function yC(e,t,n,r,i){let a=q.empty;for(let e=n.length-1;e>=0;e--)a=q.from(n[e].type.create(n[e].attrs,a));e.step(new hx(t.start-(r?2:0),t.end,t.start,t.end,new J(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Nx(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function bC(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?xC(t,n,e,a):SC(t,n,a):!0:!1}}function xC(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new hx(a-1,o,a,o,new J(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Xy(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=xx(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Fx(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function SC(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+(s?0:1),u+1,o.content.append(c?q.empty:q.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new hx(d-(s?1:0),f+(c?1:0),d+1,f-1,new J((s?q.empty:q.from(i.copy(q.empty))).append(c?q.empty:q.from(i.copy(q.empty))),s?0:1,c?0:1),s?0:1)),t(r.scrollIntoView()),!0}function CC(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=q.from(r?e.create():null),o=new J(q.from(e.create(null,q.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new hx(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var wC=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},TC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},EC=null,DC=function(e,t,n){let r=EC||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},OC=function(){EC=null},kC=function(e,t,n,r){return n&&(jC(e,t,n,r,-1)||jC(e,t,n,r,1))},AC=/^(img|br|input|textarea|hr)$/i;function jC(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:MC(e))){let n=e.parentNode;if(!n||n.nodeType!=1||IC(e)||AC.test(e.nodeName)||e.contentEditable==`false`)return!1;t=wC(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?MC(e):0}else return!1}}function MC(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function NC(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=MC(e)}else if(e.parentNode&&!IC(e))t=wC(e),e=e.parentNode;else return null}}function PC(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!IC(e))t=wC(e)+1,e=e.parentNode;else return null}}function FC(e,t,n){for(let r=t==0,i=t==MC(e);r||i;){if(e==n)return!0;let t=wC(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==MC(e)}}function IC(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var LC=function(e){return e.focusNode&&kC(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function RC(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function zC(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function BC(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(MC(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(MC(r.startContainer),r.startOffset)}}}var VC=typeof navigator<`u`?navigator:null,HC=typeof document<`u`?document:null,UC=VC&&VC.userAgent||``,WC=/Edge\/(\d+)/.exec(UC),GC=/MSIE \d/.exec(UC),KC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(UC),qC=!!(GC||KC||WC),JC=GC?document.documentMode:KC?+KC[1]:WC?+WC[1]:0,YC=!qC&&/gecko\/(\d+)/i.test(UC);YC&&+(/Firefox\/(\d+)/.exec(UC)||[0,0])[1];var XC=!qC&&/Chrome\/(\d+)/.exec(UC),ZC=!!XC,QC=XC?+XC[1]:0,$C=!qC&&!!VC&&/Apple Computer/.test(VC.vendor),ew=$C&&(/Mobile\/\w+/.test(UC)||!!VC&&VC.maxTouchPoints>2),tw=ew||(VC?/Mac/.test(VC.platform):!1),nw=VC?/Win/.test(VC.platform):!1,rw=/Android \d/.test(UC),iw=!!HC&&`webkitFontSmoothing`in HC.documentElement.style,aw=iw?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ow(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function sw(e,t){return typeof e==`number`?e:e[t]}function cw(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function lw(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=TC(o);continue}let e=o,n=e==a.body,s=n?ow(a):cw(e),c=0,l=0;if(t.top<s.top+sw(r,`top`)?l=-(s.top-t.top+sw(i,`top`)):t.bottom>s.bottom-sw(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+sw(i,`top`)-s.top:t.bottom-s.bottom+sw(i,`bottom`)),t.left<s.left+sw(r,`left`)?c=-(s.left-t.left+sw(i,`left`)):t.right>s.right-sw(r,`right`)&&(c=t.right-s.right+sw(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:TC(o)}}function uw(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:dw(e.dom)}}function dw(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=TC(r));return t}function fw({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;pw(n,r==0?0:r-t)}function pw(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var mw=null;function hw(e){if(e.setActive)return e.setActive();if(mw)return e.focus(mw);let t=dw(e);e.focus(mw==null?{get preventScroll(){return mw={preventScroll:!0},!0}}:void 0),mw||(mw=!1,pw(t,0))}function gw(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=DC(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?_w(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:gw(n,i)}function _w(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Tw(r,1);if(n.top!=n.bottom&&vw(t,n)){i={node:e,offset:a+(t.left>=(n.left+n.right)/2?1:0)};break}}return r.detach(),i||{node:e,offset:0}}function vw(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function yw(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function bw(e,t,n){let{node:r,offset:i}=gw(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function xw(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Sw(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(vw(t,i))return Sw(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Cw(e,t){let n=e.dom.ownerDocument,r,i=0,a=BC(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!vw(t,n)||(o=Sw(e.dom,t,n),!o))return null}if($C)for(let e=o;r&&e;e=TC(e))e.draggable&&(r=void 0);if(o=yw(o,t),r){if(YC&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;iw&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=xw(e,r,i,t))}s??=bw(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function ww(e){return e.top<e.bottom||e.left<e.right}function Tw(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(ww(e))return e}return Array.prototype.find.call(n,ww)||e.getBoundingClientRect()}var Ew=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dw(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=iw||YC;if(r.nodeType==3)if(o&&(Ew.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Tw(DC(r,i,i),n);if(YC&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Tw(DC(r,i-1,i-1),-1);if(t.top==e.top){let n=Tw(DC(r,i,i+1),-1);if(n.top!=e.top)return Ow(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Ow(Tw(DC(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==MC(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return kw(e.getBoundingClientRect(),!1)}if(a==null&&i<MC(r)){let e=r.childNodes[i];if(e.nodeType==1)return kw(e.getBoundingClientRect(),!0)}return kw(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==MC(r))){let e=r.childNodes[i-1],t=e.nodeType==3?DC(e,MC(e)-(o?0:1)):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ow(Tw(t,1),!1)}if(a==null&&i<MC(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?DC(e,0,o?0:1):e.nodeType==1?e:null:null;if(t)return Ow(Tw(t,-1),!0)}return Ow(Tw(r.nodeType==3?DC(r):r,-n),n>=0)}function Ow(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function kw(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Aw(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function jw(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Aw(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Dw(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=DC(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Mw=/[\u0590-\u08ac]/;function Nw(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Mw.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Aw(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Pw=null,Fw=null,Iw=!1;function Lw(e,t,n){return Pw==t&&Fw==n?Iw:(Pw=t,Fw=n,Iw=n==`up`||n==`down`?jw(e,t,n):Nw(e,t,n))}var Rw=0,zw=1,Bw=2,Vw=3,Hw=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Rw,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>wC(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Yw){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Uw&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?wC(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?wC(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=wC(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=wC(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((YC||$C)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
7
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:wC(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(YC&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&$C)&&kC(o.node,o.offset,l.anchorNode,l.anchorOffset)&&kC(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&YC)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Bw:zw,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Vw:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Bw:Vw}n=a}this.dirty=Bw}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Bw:zw;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Uw=class extends Hw{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Rw&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Ww=class extends Hw{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Gw=class e extends Hw{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Vb.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Vw||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Vw&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Rw){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Rw}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=fT(a,n,o,r)),t>0&&(a=fT(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Kw=class e extends Hw{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Vb.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=rT(u,r,n),l?c=new Xw(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Jw(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>q.empty)}return e}matchesNode(e,t,n){return this.dirty==Rw&&e.eq(this.node)&&iT(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new oT(this,a&&a.node,e);lT(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?My.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Bw)&&(a&&this.protectLocalComposition(e,a),Zw(this.contentDOM,this.children,e),ew&&uT(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof fS)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=dT(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Ww(this,i,t,r);e.input.compositionNodes.push(a),this.children=fT(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Vw||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Rw}updateOuterDeco(e){if(iT(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=tT(this.dom,this.nodeDOM,eT(this.outerDeco,this.node,t),eT(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function qw(e,t,n,r,i){rT(r,t,e);let a=new Kw(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Jw=class e extends Kw{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Vw||this.dirty!=Rw&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Rw||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Rw,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Vw)}get domAtom(){return!1}isText(e){return this.node.text==e}},Yw=class extends Hw{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rw&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Xw=class extends Kw{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Vw)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Zw(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=aT(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Gw){let t=r?r.previousSibling:e.lastChild;Zw(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=aT(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Qw=function(e){e&&(this.nodeName=e)};Qw.prototype=Object.create(null);var $w=[new Qw];function eT(e,t,n){if(e.length==0)return $w;let r=n?$w[0]:new Qw,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Qw(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Qw(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function tT(e,t,n,r){if(n==$w&&r==$w)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=$w[0],i=t)}nT(i,o||$w[0],a)}return i}function nT(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function rT(e,t,n){return tT(e,e,$w,eT(t,n,e.nodeType!=1))}function iT(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function aT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var oT=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=sT(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Rw,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Gw.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Vw&&a.dom==a.contentDOM&&(a.dirty=Bw),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Kw){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Vw&&iT(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Bw,u.updateChildren(r,a+1),u.dirty=Rw),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!iT(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Kw.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Kw.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Uw(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Gw;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Jw)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&(($C||ZC)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Yw(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function sT(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Gw)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function cT(e,t){return e.type.side-t.type.side}function lT(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(cT);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function uT(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function dT(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function fT(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function pT(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(LC(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&mS.isSelectable(e)&&i.parent&&!(e.isInline&&FC(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new mS(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=wT(e,u,s,n)}return l}function mT(e){return e.editable?e.hasFocus():ET(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function hT(e,t=!1){let n=e.state.selection;if(ST(e,n),mT(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&ZC){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&kC(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)xT(e);else{let{anchor:r,head:i}=n,a,o;gT&&!(n instanceof fS)&&(n.$from.parent.inlineContent||(a=_T(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=_T(e,n.to))),e.docView.setSelection(r,i,e,t),gT&&(a&&yT(a),o&&yT(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&bT(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var gT=$C||ZC&&QC<63;function _T(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if($C&&i&&i.contentEditable==`false`)return vT(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return vT(i);if(a)return vT(a)}}function vT(e){return e.contentEditable=`true`,$C&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function yT(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function bT(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!mT(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function xT(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,wC(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&qC&&JC<=11&&(n.disabled=!0,n.disabled=!1)}function ST(e,t){if(t instanceof mS){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(CT(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else CT(e)}function CT(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function wT(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||fS.between(t,n,r)}function TT(e){return e.editable&&!e.hasFocus()?!1:ET(e)}function ET(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function DT(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return kC(t.node,t.offset,n.anchorNode,n.anchorOffset)}function OT(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&cS.findFrom(a,t)}function kT(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function AT(e,t,n){let r=e.state.selection;if(r instanceof fS){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return kT(e,new fS(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=OT(e.state,t);return n&&n instanceof mS?kT(e,n):!1}else if(!(tw&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?mS.isSelectable(i)?kT(e,new mS(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):iw?kT(e,new fS(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof mS&&r.node.isInline)return kT(e,new fS(t>0?r.$to:r.$from));else{let n=OT(e.state,t);return n?kT(e,n):!1}}function jT(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function MT(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function NT(e,t){return t<0?PT(e):FT(e)}function PT(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(YC&&n.nodeType==1&&r<jT(n)&&MT(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(MT(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(IT(n))break;else{let t=n.previousSibling;for(;t&&MT(t,-1);)i=n.parentNode,a=wC(t),t=t.previousSibling;if(t)n=t,r=jT(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?zT(e,n,r):i&&zT(e,i,a)}function FT(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=jT(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(MT(e,1))a=n,o=++r;else break}else if(IT(n))break;else{let t=n.nextSibling;for(;t&&MT(t,1);)a=t.parentNode,o=wC(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=jT(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&zT(e,a,o)}function IT(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function LT(e,t){for(;e&&t==e.childNodes.length&&!IC(e);)t=wC(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function RT(e,t){for(;e&&!t&&!IC(e);)t=wC(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function zT(e,t,n){if(t.nodeType!=3){let e,r;(r=LT(t,n))?(t=r,n=0):(e=RT(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(LC(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&hT(e)},50)}function BT(e,t){let n=e.state.doc.resolve(t);if(!(ZC||nw)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function VT(e,t,n){let r=e.state.selection;if(r instanceof fS&&!r.empty||n.indexOf(`s`)>-1||tw&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=OT(e.state,t);if(n&&n instanceof mS)return kT(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof gS?cS.near(n,t):cS.findFrom(n,t);return o?kT(e,o):!1}return!1}function HT(e,t){if(!(e.state.selection instanceof fS))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function UT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function WT(e){if(!$C||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;UT(e,n,`true`),setTimeout(()=>UT(e,n,`false`),20)}return!1}function GT(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function KT(e,t){let n=t.keyCode,r=GT(t);if(n==8||tw&&n==72&&r==`c`)return HT(e,-1)||NT(e,-1);if(n==46&&!t.shiftKey||tw&&n==68&&r==`c`)return HT(e,1)||NT(e,1);if(n==13||n==27)return!0;if(n==37||tw&&n==66&&r==`c`){let t=n==37?BT(e,e.state.selection.from)==`ltr`?-1:1:-1;return AT(e,t,r)||NT(e,t)}else if(n==39||tw&&n==70&&r==`c`){let t=n==39?BT(e,e.state.selection.from)==`ltr`?1:-1:1;return AT(e,t,r)||NT(e,t)}else if(n==38||tw&&n==80&&r==`c`)return VT(e,-1,r)||NT(e,-1);else if(n==40||tw&&n==78&&r==`c`)return WT(e)||VT(e,1,r)||NT(e,1);else if(r==(tw?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function qT(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Vb.fromSchema(e.state.schema),s=iE(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=nE[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
8
|
+
|
|
9
|
+
`),slice:t}}function JT(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new J(q.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Vb.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=sE(n),iw&&cE(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Db.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!YT.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=lE(tE(s,+u[1],+u[2]),u[4]);else if(s=J.maxOpen(XT(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=tE(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var YT=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function XT(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&QT(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=$T(a[a.length-1],i.length));let n=ZT(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return q.from(a)}return e}function ZT(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function QT(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=QT(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(q.from(ZT(n,e,i+1))))}}function $T(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,$T(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function eE(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=eE(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function tE(e,t,n){return t<e.openStart&&(e=new J(eE(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new J(eE(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var nE={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},rE=null;function iE(){return rE||=document.implementation.createHTMLDocument(`title`)}var aE=null;function oE(e){let t=window.trustedTypes;return t?(aE||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),aE.createHTML(e)):e}function sE(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=iE().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&nE[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=oE(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function cE(e){let t=e.querySelectorAll(ZC?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function lE(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=q.from(t.create(r[e+1],i)),a++,o++}return new J(i,a,o)}var uE={},dE={},fE={touchstart:!0,touchmove:!0},pE=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function mE(e){for(let t in uE){let n=uE[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{yE(e,t)&&!vE(e,t)&&(e.editable||!(t.type in dE))&&n(e,t)},fE[t]?{passive:!0}:void 0)}$C&&e.dom.addEventListener(`input`,()=>null),_E(e)}function hE(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function gE(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function _E(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>vE(e,t))})}function vE(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function yE(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function bE(e,t){!vE(e,t)&&uE[t.type]&&(e.editable||!(t.type in dE))&&uE[t.type](e,t)}dE.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!PE(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(rw&&ZC&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),ew&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,RC(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||KT(e,n)?n.preventDefault():hE(e,`key`)},dE.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},dE.keypress=(e,t)=>{let n=t;if(PE(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||tw&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof fS)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function xE(e){return{left:e.clientX,top:e.clientY}}function SE(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function CE(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function wE(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function TE(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&mS.isSelectable(r)?(wE(e,new mS(n),`pointer`),!0):!1}function EE(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof mS&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(mS.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(wE(e,mS.create(e.state.doc,i),`pointer`),!0)}function DE(e,t,n,r,i){return CE(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?EE(e,n):TE(e,n))}function OE(e,t,n,r){return CE(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function kE(e,t,n,r){return CE(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||AE(e,n,r)}function AE(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(wE(e,fS.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)wE(e,fS.create(r,a+1,a+1+n.content.size),`pointer`);else if(mS.isSelectable(n))wE(e,mS.create(r,a),`pointer`);else continue;return!0}}function jE(e){return VE(e)}var ME=tw?`metaKey`:`ctrlKey`;uE.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=jE(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&SE(n,e.input.lastClick)&&!n[ME]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(xE(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new NE(e,o,n,!!r)):(a==`doubleClick`?OE:kE)(e,o.pos,o.inside,n)?n.preventDefault():hE(e,`pointer`))};var NE=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ME],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof mS&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&YC&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),hE(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>hT(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(xE(e))),this.updateAllowDefault(e),this.allowDefault||!t?hE(this.view,`pointer`):DE(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$C&&this.mightDrag&&!this.mightDrag.node.isAtom||ZC&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(wE(this.view,cS.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):hE(this.view,`pointer`)}move(e){this.updateAllowDefault(e),hE(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};uE.touchstart=e=>{e.input.lastTouch=Date.now(),jE(e),hE(e,`pointer`)},uE.touchmove=e=>{e.input.lastTouch=Date.now(),hE(e,`pointer`)},uE.contextmenu=e=>jE(e);function PE(e,t){return e.composing?!0:$C&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var FE=rw?5e3:-1;dE.compositionstart=dE.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof fS&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||ZC&&nw&&IE(e)))e.markCursor=e.state.storedMarks||n.marks(),VE(e,!0),e.markCursor=null;else if(VE(e,!t.selection.empty),YC&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}LE(e,FE)};function IE(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}dE.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,LE(e,20))};function LE(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>VE(e),t))}function RE(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=BE());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function zE(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=NC(t.focusNode,t.focusOffset),r=PC(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function BE(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function VE(e,t=!1){if(!(rw&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),RE(e),t||e.docView&&e.docView.dirty){let n=pT(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function HE(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var UE=qC&&JC<15||ew&&aw<604;uE.copy=dE.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=UE?null:n.clipboardData,{dom:o,text:s}=qT(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):HE(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function WE(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function GE(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?KE(e,r.value,null,i,t):KE(e,r.textContent,r.innerHTML,i,t)},50)}function KE(e,t,n,r,i){let a=JT(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||J.empty)))return!0;if(!a)return!1;let o=WE(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function qE(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}dE.paste=(e,t)=>{let n=t;if(e.composing&&!rw)return;let r=UE?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&KE(e,qE(r),r.getData(`text/html`),i,n)?n.preventDefault():GE(e,n)};var JE=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},YE=tw?`altKey`:`ctrlKey`;function XE(e,t){return e.someProp(`dragCopies`,e=>!e(t))??!t[YE]}uE.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(xE(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof mS?i.to-1:i.to))){if(r&&r.mightDrag)o=mS.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=mS.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=qT(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!ZC||QC>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(UE?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,UE||n.dataTransfer.setData(`text/plain`,c),e.dragging=new JE(l,XE(e,n),o)},uE.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},dE.dragover=dE.dragenter=(e,t)=>t.preventDefault(),dE.drop=(e,t)=>{try{ZE(e,t,e.dragging)}finally{e.dragging=null}};function ZE(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(xE(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=JT(e,qE(t.dataTransfer),UE?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&XE(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||J.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Vx(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&mS.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new mS(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(wT(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}uE.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&hT(e)},20))},uE.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},uE.beforeinput=(e,t)=>{if(ZC&&rw&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,RC(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in dE)uE[e]=dE[e];function QE(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var $E=class e{constructor(e,t){this.toDOM=e,this.spec=t||iD,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new nD(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&QE(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},eD=class e{constructor(e,t){this.attrs=e,this.spec=t||iD}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new nD(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&QE(this.attrs,t.attrs)&&QE(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},tD=class e{constructor(e,t){this.attrs=e,this.spec=t||iD}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new nD(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&QE(this.attrs,t.attrs)&&QE(this.spec,t.spec)}destroy(){}},nD=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new $E(n,r))}static inline(t,n,r,i){return new e(t,n,new eD(r,i))}static node(t,n,r,i){return new e(t,n,new tD(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof eD}get widget(){return this.type instanceof $E}},rD=[],iD={},aD=class e{constructor(e,t){this.local=e.length?e:rD,this.children=t.length?t:rD}static create(e,t){return t.length?pD(t,e,0,iD):oD}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==oD||e.maps.length==0?this:this.mapInner(e,t,0,0,n||iD)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?cD(this.children,o||[],t,n,r,i,a):o?new e(o.sort(mD),rD):oD}add(t,n){return n.length?this==oD?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=dD(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,pD(s,e,o+1,iD)),a+=3}});let o=lD(a?fD(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(mD):this.local,i||this.children)}remove(e){return e.length==0||this==oD?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==oD?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):oD}forChild(t,n){if(this==oD)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof eD){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(mD),rD);return r?new sD([t,r]):t}return r||oD}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return hD(this.localsInner(e))}localsInner(e){if(this==oD)return rD;if(e.inlineContent||!this.local.some(eD.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof eD||t.push(this.local[e]);return t}forEachSet(e){e(this)}};aD.empty=new aD([],[]),aD.removeOverlap=hD;var oD=aD.empty,sD=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,iD));return e.from(r)}forChild(t,n){if(n.isLeaf)return aD.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=oD&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?hD(n?t:t.sort(mD)):rD}static from(t){switch(t.length){case 0:return oD;case 1:return t[0];default:return new e(t.every(e=>e instanceof aD)?t:t.reduce((e,t)=>e.concat(t instanceof aD?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function cD(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==oD?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=pD(uD(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new aD(t.sort(mD),s)}function lD(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new nD(i.from+t,i.to+t,i.type))}return n}function uD(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function dD(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function fD(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function pD(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=dD(e,t,o+n);if(s){a=!0;let e=pD(s,t,n+o+1,r);e!=oD&&i.push(o,o+t.nodeSize,e)}});let o=lD(a?fD(e):e,-n).sort(mD);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new aD(o,i):oD}function mD(e,t){return e.from-t.from||e.to-t.to}function hD(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),gD(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),gD(t,i,r.copy(a.from,r.to)));break}}}return t}function gD(e,t,n){for(;t<e.length&&mD(n,e[t])>0;)t++;e.splice(t,0,n)}function _D(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=oD&&t.push(r)}),e.cursorWrapper&&t.push(aD.create(e.state.doc,[e.cursorWrapper.deco])),sD.from(t)}var vD={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yD=qC&&JC<=11,bD=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},xD=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bD,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);qC&&JC<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():$C&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),yD&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,vD)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(TT(this.view)){if(this.suppressingSelectionUpdates)return hT(this.view);if(qC&&JC<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&kC(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=TC(n))t.add(n);for(let r=e.anchorNode;r;r=TC(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&TT(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;t&&t.nodeType==1&&t.contentEditable==`false`&&e.parentNode.removeChild(e)}}else if(YC&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||DD(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&LC(n)&&(c=pT(e))&&c.eq(cS.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hT(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),wD(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,OD(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||hT(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(qC&&JC<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?wC(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?wC(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},SD=new WeakMap,CD=!1;function wD(e){if(!SD.has(e)&&(SD.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=YC,CD)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),CD=!0}}function TD(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return kC(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function ED(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return TD(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?TD(e,n):null}function DD(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function OD(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function kD(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],LC(c)||l.push({node:c.focusNode,offset:c.focusOffset})),ZC&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Db.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:AD,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function AD(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if($C&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||$C&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var jD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function MD(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=pT(e,t);if(n&&!e.state.selection.eq(n)){if(ZC&&rw&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,RC(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=kD(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=LD(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(ew&&e.input.lastIOSEnter>Date.now()-225||rw)&&i.some(e=>e.nodeType==1&&!jD.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,RC(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof fS&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=ND(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof fS&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),qC&&JC<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((ew&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,RC(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&FD(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,RC(8,`Backspace`)))){rw&&ZC&&e.domObserver.suppressSelectionUpdates();return}ZC&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),rw&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,RC(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=ND(e,n.doc,l.sel);t&&!(ZC&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||qC&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){qC&&JC<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>hT(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=PD(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-(g.textOffset?0:1)){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function ND(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:wT(e,t.resolve(n.anchor),t.resolve(n.head))}function PD(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(q.from(l).eq(e))return{mark:s,type:o}}function FD(e,t,n,r,i){if(n-t<=i.pos-r.pos||ID(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(ID(a,!0,!0));return!o.parent.isTextblock||o.pos>n||ID(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ID(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function LD(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&RD(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&RD(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function RD(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var zD=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new pE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(KD),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=HD(this),VD(this),this.nodeViews=WD(this),this.docView=qw(this.state.doc,BD(this),_D(this),this.dom,this),this.domObserver=new xD(this,(e,t,n,r)=>MD(this,e,t,n,r)),this.domObserver.start(),mE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&_E(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(KD),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(RE(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=WD(this);GD(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&_E(this),this.editable=HD(this),VD(this);let o=_D(this),s=BD(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&uw(this);if(i){this.domObserver.stop();let t=l&&(qC||ZC)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&UD(n.selection,e.selection);if(l){let n=ZC?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zE(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=qw(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&DT(this))?hT(this,t):(ST(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&fw(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof mS){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&lw(this,t.getBoundingClientRect(),e)}else lw(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new JE(e.slice,e.move,r<0?void 0:mS.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(qC){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&hw(this.dom),hT(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cw(this,e)}coordsAtPos(e,t=1){return Dw(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Lw(this,t||this.state,e)}pasteHTML(e,t){return KE(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return KE(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return qT(this,e)}destroy(){this.docView&&(gE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],_D(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,OC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bE(this,e)}domSelectionRange(){let e=this.domSelection();return e?$C&&this.root.nodeType===11&&zC(this.dom.ownerDocument)==this.dom&&ED(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};zD.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function BD(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[nD.node(0,e.state.doc.content.size,t)]}function VD(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:nD.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function HD(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function UD(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function WD(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function GD(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function KD(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var qD={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},JD={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},YD=typeof navigator<`u`&&/Mac/.test(navigator.platform),XD=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ZD=0;ZD<10;ZD++)qD[48+ZD]=qD[96+ZD]=String(ZD);for(var ZD=1;ZD<=24;ZD++)qD[ZD+111]=`F`+ZD;for(var ZD=65;ZD<=90;ZD++)qD[ZD]=String.fromCharCode(ZD+32),JD[ZD]=String.fromCharCode(ZD);for(var QD in qD)JD.hasOwnProperty(QD)||(JD[QD]=qD[QD]);function $D(e){var t=!(YD&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||XD&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?JD:qD)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var eO=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),tO=typeof navigator<`u`&&/Win/.test(navigator.platform);function nO(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))eO?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function rO(e){let t=Object.create(null);for(let n in e)t[nO(n)]=e[n];return t}function iO(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function aO(e){return new AS({props:{handleKeyDown:oO(e)}})}function oO(e){let t=rO(e);return function(e,n){let r=$D(n),i,a=t[iO(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[iO(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(tO&&n.ctrlKey&&n.altKey)&&(i=qD[n.keyCode])&&i!=r){let r=t[iO(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var sO=Object.defineProperty,cO=(e,t)=>{for(var n in t)sO(e,n,{get:t[n],enumerable:!0})};function lO(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var uO=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:lO({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},dO={};cO(dO,{blur:()=>fO,clearContent:()=>pO,clearNodes:()=>mO,command:()=>hO,createParagraphNear:()=>gO,cut:()=>_O,deleteCurrentNode:()=>vO,deleteNode:()=>bO,deleteRange:()=>xO,deleteSelection:()=>SO,enter:()=>CO,exitCode:()=>wO,extendMarkRange:()=>jO,first:()=>MO,focus:()=>zO,forEach:()=>BO,insertContent:()=>VO,insertContentAt:()=>qO,joinBackward:()=>XO,joinDown:()=>YO,joinForward:()=>ZO,joinItemBackward:()=>QO,joinItemForward:()=>$O,joinTextblockBackward:()=>ek,joinTextblockForward:()=>tk,joinUp:()=>JO,keyboardShortcut:()=>ik,lift:()=>ok,liftEmptyBlock:()=>sk,liftListItem:()=>ck,newlineInCode:()=>lk,resetAttributes:()=>fk,scrollIntoView:()=>pk,selectAll:()=>mk,selectNodeBackward:()=>hk,selectNodeForward:()=>gk,selectParentNode:()=>_k,selectTextblockEnd:()=>vk,selectTextblockStart:()=>yk,setContent:()=>xk,setMark:()=>gA,setMeta:()=>_A,setNode:()=>vA,setNodeSelection:()=>yA,setTextDirection:()=>bA,setTextSelection:()=>xA,sinkListItem:()=>SA,splitBlock:()=>wA,splitListItem:()=>TA,toggleList:()=>OA,toggleMark:()=>kA,toggleNode:()=>AA,toggleWrap:()=>jA,undoInputRule:()=>MA,unsetAllMarks:()=>NA,unsetMark:()=>PA,unsetTextDirection:()=>FA,updateAttributes:()=>IA,wrapIn:()=>LA,wrapInList:()=>RA});var fO=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),pO=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),mO=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=xx(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},hO=e=>t=>e(t),gO=()=>({state:e,dispatch:t})=>$S(e,t),_O=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new fS(r.doc.resolve(Math.max(o-1,0)))),!0},vO=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function yO(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var bO=e=>({tr:t,state:n,dispatch:r})=>{let i=yO(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},xO=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},SO=()=>({state:e,dispatch:t})=>PS(e,t),CO=()=>({commands:e})=>e.keyboardShortcut(`Enter`),wO=()=>({state:e,dispatch:t})=>QS(e,t);function TO(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function EO(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:TO(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function DO(e,t,n={}){return e.find(e=>e.type===t&&EO(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function OO(e,t,n={}){return!!DO(e,t,n)}function kO(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t)||(n||=r.node.marks[0]?.attrs,!DO([...r.node.marks],t,n)))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&OO([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&OO([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function AO(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var jO=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=AO(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=kO(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=fS.create(o,e.from,e.to);n.setSelection(t)}}return!0},MO=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function NO(e){return e instanceof fS}function PO(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function FO(e,t=null){if(!t)return null;let n=cS.atStart(e),r=cS.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?fS.create(e,PO(0,i,a),PO(e.content.size,i,a)):fS.create(e,PO(t,i,a),PO(t,i,a))}function IO(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function LO(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function RO(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var zO=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(LO()||IO())&&r.dom.focus(),RO()&&!LO()&&!IO()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!NO(n.state.selection))return o(),!0;let s=FO(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},BO=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),VO=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),HO=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&HO(r)}return e};function UO(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return HO(n)}function WO(e,t,n){if(e instanceof Qy||e instanceof q)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return q.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),WO(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Cb({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Db.fromSchema(a).parseSlice(UO(e),n.parseOptions):Db.fromSchema(a).parse(UO(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Db.fromSchema(t);return n.slice?r.parseSlice(UO(e),n.parseOptions).content:r.parse(UO(e),n.parseOptions)}return WO(``,t,n)}function GO(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof mx||i instanceof hx))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(cS.near(e.doc.resolve(o),n))}var KO=e=>!(`type`in e),qO=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{WO(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=WO(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((KO(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof q){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&GO(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},JO=()=>({state:e,dispatch:t})=>qS(e,t),YO=()=>({state:e,dispatch:t})=>JS(e,t),XO=()=>({state:e,dispatch:t})=>IS(e,t),ZO=()=>({state:e,dispatch:t})=>WS(e,t),QO=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Rx(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},$O=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Rx(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ek=()=>({state:e,dispatch:t})=>LS(e,t),tk=()=>({state:e,dispatch:t})=>RS(e,t);function nk(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function rk(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))LO()||nk()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var ik=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=rk(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function ak(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?yO(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>EO(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var ok=(e,t={})=>({state:n,dispatch:r})=>ak(n,yO(e,n.schema),t)?YS(n,r):!1,sk=()=>({state:e,dispatch:t})=>eC(e,t),ck=e=>({state:t,dispatch:n})=>bC(yO(e,t.schema))(t,n),lk=()=>({state:e,dispatch:t})=>XS(e,t);function uk(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function dk(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var fk=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=uk(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yO(e,r.schema)),s===`mark`&&(o=AO(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,dk(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(dk(a.attrs,t))))})})}),c},pk=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),mk=()=>({tr:e,dispatch:t})=>{if(t){let t=new gS(e.doc);e.setSelection(t)}return!0},hk=()=>({state:e,dispatch:t})=>VS(e,t),gk=()=>({state:e,dispatch:t})=>GS(e,t),_k=()=>({state:e,dispatch:t})=>rC(e,t),vk=()=>({state:e,dispatch:t})=>lC(e,t),yk=()=>({state:e,dispatch:t})=>cC(e,t);function bk(e,t,n={},r={}){return WO(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var xk=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=bk(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Sk(e,t){let n=AO(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Ck(e,t){let n=new oS(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function wk(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Tk(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function Ek(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Dk(e){return t=>Ek(t.$from,e)}function Y(e,t,n){return e.config[t]===void 0&&e.parent?Y(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?Y(e.parent,t,n):null}):e.config[t]}function Ok(e){return e.map(e=>{let t=Y(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Ok(t())]:e}).flat(10)}function kk(e,t){let n=Vb.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Ak(e){return typeof e==`function`}function jk(e,t=void 0,...n){return Ak(e)?t?e.bind(t)(...n):e(...n):e}function Mk(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Nk(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function Pk(e){let t=[],{nodeExtensions:n,markExtensions:r}=Nk(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=Y(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=Y(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function Fk(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=t?t.split(`;`).map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(`;`).map(e=>e.trim()).filter(Boolean):[],a=new Map;i.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),n[e]=Array.from(a.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function Ik(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Fk(e,t),{})}function Lk(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function Rk(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Lk(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function zk(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&Mk(t)?!1:t!=null))}function Bk(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Vk(e,t){let n=Pk(e),{nodeExtensions:r,markExtensions:i}=Nk(e);return new Cb({topNode:r.find(e=>Y(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=zk({...e.reduce((e,t)=>{let n=Y(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:jk(Y(r,`content`,a)),marks:jk(Y(r,`marks`,a)),group:jk(Y(r,`group`,a)),inline:jk(Y(r,`inline`,a)),atom:jk(Y(r,`atom`,a)),selectable:jk(Y(r,`selectable`,a)),draggable:jk(Y(r,`draggable`,a)),code:jk(Y(r,`code`,a)),whitespace:jk(Y(r,`whitespace`,a)),linebreakReplacement:jk(Y(r,`linebreakReplacement`,a)),defining:jk(Y(r,`defining`,a)),isolating:jk(Y(r,`isolating`,a)),attrs:Object.fromEntries(i.map(Bk))}),s=jk(Y(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Rk(e,i)));let c=Y(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:Ik(e,i)}));let l=Y(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=zk({...e.reduce((e,t)=>{let n=Y(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:jk(Y(r,`inclusive`,a)),excludes:jk(Y(r,`excludes`,a)),group:jk(Y(r,`group`,a)),spanning:jk(Y(r,`spanning`,a)),code:jk(Y(r,`code`,a)),attrs:Object.fromEntries(i.map(Bk))}),s=jk(Y(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Rk(e,i)));let c=Y(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:Ik(e,i)})),[r.name,o]}))})}function Hk(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function Uk(e){return e.sort((e,t)=>{let n=Y(e,`priority`)||100,r=Y(t,`priority`)||100;return n>r?-1:n<r?1:0})}function Wk(e){let t=Uk(Ok(e)),n=Hk(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Gk(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
11
|
+
|
|
12
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Kk(e,t){return Gk(e,{from:0,to:e.content.size},t)}function qk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Jk(e,t){let n=yO(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function Yk(e,t){let n=uk(typeof t==`string`?t:t.name,e.schema);return n===`node`?Jk(e,t):n===`mark`?Sk(e,t):{}}function Xk(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Zk(e){let t=Xk(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Qk(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Zk(r)}function $k(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=kO(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var eA=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function tA(e,t){return t.nodes[e]||t.marks[e]||null}function nA(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var rA=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function iA(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?AO(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>EO(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>EO(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function aA(e,t,n={}){if(!t)return ak(e,null,n)||iA(e,null,n);let r=uk(t,e.schema);return r===`node`?ak(e,t,n):r===`mark`?iA(e,t,n):!1}var oA=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Dk(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},sA=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function cA(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function lA(e,t){let{nodeExtensions:n}=Nk(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=jk(Y(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function uA(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return/^\s*$/m.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(uA(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function dA(e){return e instanceof mS}var fA=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function pA(e,t){let n=t.mapping.mapResult(e.position);return{position:new fA(n.pos),mapResult:n}}function mA(e){return new fA(e)}function hA(e,t,n){let{selection:r}=t,i=null;if(NO(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var gA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=AO(e,r.schema);if(i)if(o){let e=Sk(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return hA(r,n,c)},_A=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),vA=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=yO(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>dC(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>dC(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},yA=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=PO(e,0,n.content.size),i=mS.create(n,r);t.setSelection(i)}return!0},bA=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},xA=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=fS.atStart(n).from,o=fS.atEnd(n).to,s=PO(r,a,o),c=PO(i,a,o),l=fS.create(n,s,c);t.setSelection(l)}return!0},SA=e=>({state:t,dispatch:n})=>CC(yO(e,t.schema))(t,n);function CA(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var wA=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=nA(l,s.node().type.name,s.node().attrs);if(a instanceof mS&&a.node.isBlock)return!s.parentOffset||!Nx(o,s.pos)?!1:(r&&(e&&CA(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:wk(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Nx(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Nx(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof fS&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&CA(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},TA=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=yO(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=q.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=q.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...nA(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(q.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new J(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(fS.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...nA(d,u.type.name,u.attrs),...t},m={...nA(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Nx(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},EA=(e,t)=>{let n=Dk(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Fx(e.doc,n.pos)&&e.join(n.pos),!0},DA=(e,t)=>{let n=Dk(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Fx(e.doc,r)&&e.join(r),!0},OA=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=yO(e,o.schema),m=yO(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=Dk(e=>lA(e.type.name,d))(h);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===p)return l.liftListItem(m);if(lA(x.node.type.name,d)&&p.validContent(x.node.content)&&s)return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>EA(a,p)).command(()=>DA(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>EA(a,p)).command(()=>DA(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>EA(a,p)).command(()=>DA(a,p)).run()},kA=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=AO(e,r.schema);return iA(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},AA=(e,t,n={})=>({state:r,commands:i})=>{let a=yO(e,r.schema),o=yO(t,r.schema),s=ak(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},jA=(e,t={})=>({state:n,commands:r})=>{let i=yO(e,n.schema);return ak(n,i,t)?r.lift(i):r.wrapIn(i,t)},MA=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},NA=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},PA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=AO(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=kO(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},FA=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},IA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=uk(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yO(e,r.schema)),s===`mark`&&(o=AO(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},LA=(e,t={})=>({state:n,dispatch:r})=>uC(yO(e,n.schema),t)(n,r),RA=(e,t={})=>({state:n,dispatch:r})=>_C(yO(e,n.schema),t)(n,r),zA=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},BA=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},VA=(e,t)=>{if(TO(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function HA(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=rA(c)+i;return a.forEach(e=>{if(l)return;let a=VA(u,e.find);if(!a)return;let c=s.state.tr,d=lO({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new uO({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function UA(e){let{editor:t,rules:n}=e,r=new AS({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:kk(q.from(e),a.schema);let{from:i}=s;HA({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return HA({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&HA({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?HA({editor:t,from:a.pos,to:a.pos,text:`
|
|
13
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function WA(e){return Object.prototype.toString.call(e).slice(8,-1)}function GA(e){return WA(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function KA(e,t){let n={...e};return GA(e)&&GA(t)&&Object.keys(t).forEach(r=>{GA(t[r])&&GA(e[r])?n[r]=KA(e[r],t[r]):n[r]=t[r]}),n}var qA=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...jk(Y(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...jk(Y(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>KA(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},JA=class e extends qA{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function YA(e){return typeof e==`number`}var XA=class{constructor(e){this.find=e.find,this.handler=e.handler}},ZA=(e,t,n)=>{if(TO(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function QA(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new uO({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||ZA(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var $A=null,ej=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function tj(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!QA({editor:t,state:lO({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new AS({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&($A=t)},i=()=>{$A&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=$A;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:kk(q.from(t),r.schema);let{from:n}=d,i=n+t.length,a=ej(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!YA(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var nj=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Wk(e),this.schema=Vk(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=Y(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:tA(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return Uk([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:tA(t.name,this.schema)},r=[],i=Y(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&Y(t,`exitable`,n)&&(a.ArrowRight=()=>JA.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=aO(a);r.push(o);let s=Y(t,`addInputRules`,n);if(cA(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=UA({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=Y(t,`addPasteRules`,n);if(cA(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=tj({editor:e,rules:t});r.push(...n)}}let l=Y(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return Pk(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Nk(this.extensions);return Object.fromEntries(t.filter(e=>!!Y(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Y(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:yO(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:Ik(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Uk([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:tA(n.name,this.schema)},i=Y(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Uk([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:tA(n.name,this.schema)},i=Y(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Nk(this.extensions);return Object.fromEntries(t.filter(e=>!!Y(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Y(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:AO(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=Ik(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Pj(i,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tA(e.name,this.schema)};e.type===`mark`&&(jk(Y(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=Y(e,`onBeforeCreate`,t),r=Y(e,`onCreate`,t),i=Y(e,`onUpdate`,t),a=Y(e,`onSelectionUpdate`,t),o=Y(e,`onTransaction`,t),s=Y(e,`onFocus`,t),c=Y(e,`onBlur`,t),l=Y(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};nj.resolve=Wk,nj.sort=Uk,nj.flatten=Ok;var rj={};cO(rj,{ClipboardTextSerializer:()=>aj,Commands:()=>oj,Delete:()=>sj,Drop:()=>cj,Editable:()=>lj,FocusEvents:()=>dj,Keymap:()=>fj,Paste:()=>pj,Tabindex:()=>mj,TextDirection:()=>hj,focusEventsPluginKey:()=>uj});var ij=class e extends qA{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},aj=ij.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new AS({key:new NS(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=qk(n);return Gk(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),oj=ij.create({name:`commands`,addCommands(){return{...dO}}}),sj=ij.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=Ck(e.before,[e,...t]);Qk(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof dx){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)),u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),cj=ij.create({name:`drop`,addProseMirrorPlugins(){return[new AS({key:new NS(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),lj=ij.create({name:`editable`,addProseMirrorPlugins(){return[new AS({key:new NS(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),uj=new NS(`focusEvents`),dj=ij.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new AS({key:uj,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),fj=ij.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:cS.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return LO()||nk()?i:r},addProseMirrorPlugins(){return[new AS({key:new NS(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=cS.atStart(t.doc).from,l=cS.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!uA(n.doc))return;let u=n.tr,d=lO({state:n,transaction:u}),{commands:f}=new uO({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),pj=ij.create({name:`paste`,addProseMirrorPlugins(){return[new AS({key:new NS(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),mj=ij.create({name:`tabindex`,addProseMirrorPlugins(){return[new AS({key:new NS(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),hj=ij.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Nk(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new AS({key:new NS(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),gj=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},_j=`.ProseMirror {
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ProseMirror {
|
|
18
|
+
word-wrap: break-word;
|
|
19
|
+
white-space: pre-wrap;
|
|
20
|
+
white-space: break-spaces;
|
|
21
|
+
-webkit-font-variant-ligatures: none;
|
|
22
|
+
font-variant-ligatures: none;
|
|
23
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ProseMirror [contenteditable="false"] {
|
|
27
|
+
white-space: normal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ProseMirror pre {
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
img.ProseMirror-separator {
|
|
39
|
+
display: inline !important;
|
|
40
|
+
border: none !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
width: 0 !important;
|
|
43
|
+
height: 0 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ProseMirror-gapcursor {
|
|
47
|
+
display: none;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
position: absolute;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ProseMirror-gapcursor:after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -2px;
|
|
58
|
+
width: 20px;
|
|
59
|
+
border-top: 1px solid black;
|
|
60
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes ProseMirror-cursor-blink {
|
|
64
|
+
to {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ProseMirror-hideselection *::selection {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror-hideselection * {
|
|
78
|
+
caret-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
+
display: block;
|
|
83
|
+
}`;function vj(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var yj=class extends zA{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:pA,createMappablePosition:mA},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=FO(t,this.options.autofocus);this.editorState=OS.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=vj(_j,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Ak(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){this.extensionManager=new nj([...this.options.enableCoreExtensions?[lj,aj.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),oj,dj,fj,mj,cj,pj,sj,hj.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type)),this)}createCommandManager(){this.commandManager=new uO({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=bk(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=bk(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new zD(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Yk(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return aA(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return kk(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
84
|
+
|
|
85
|
+
`,textSerializers:n={}}=e||{};return Kk(this.state.doc,{blockSeparator:t,textSerializers:{...qk(this.schema),...n}})}get isEmpty(){return uA(this.state.doc)}destroy(){this.emit(`destroy`),this.unmount(),this.removeAllListeners()}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new gj(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function bj(e){return new BA({find:e.find,handler:({state:t,range:n,match:r})=>{let i=jk(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if($k(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function xj(e){return new BA({find:e.find,handler:({state:t,range:n,match:r})=>{let i=jk(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function Sj(e){return new BA({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=jk(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Cj(e){return new BA({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=jk(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Cx(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Fx(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function wj(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof mS){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}cO({},{createAtomBlockMarkdownSpec:()=>Dj,createBlockMarkdownSpec:()=>Oj,createInlineMarkdownSpec:()=>jj,parseAttributes:()=>Tj,parseIndentedBlocks:()=>Mj,renderNestedMarkdownContent:()=>Nj,serializeAttributes:()=>Ej});function Tj(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Ej(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function Dj(e){let{nodeName:t,name:n,parseAttributes:r=Tj,serializeAttributes:i=Ej,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function Oj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Tj,serializeAttributes:a=Ej,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
|
|
86
|
+
|
|
87
|
+
${t.renderChildren(e.content||[],`
|
|
88
|
+
|
|
89
|
+
`)}
|
|
90
|
+
|
|
91
|
+
:::`}}}function kj(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function Aj(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function jj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=kj,serializeAttributes:a=Aj,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=s?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=s?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function Mj(e,t,n){let r=e.split(`
|
|
92
|
+
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
|
|
93
|
+
`;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
|
|
94
|
+
`;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
|
|
95
|
+
`,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
|
|
96
|
+
`,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
|
|
97
|
+
`);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function Nj(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=[`${i}${t.renderChildren([a])}`];return o&&o.length>0&&o.forEach(e=>{let n=t.renderChildren([e]);if(n){let e=n.split(`
|
|
98
|
+
`).map(e=>e?t.indent(e):``).join(`
|
|
99
|
+
`);s.push(e)}}),s.join(`
|
|
100
|
+
`)}function Pj(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Fj=class e extends qA{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function Ij(e){return new XA({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=jk(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let r=c.search(/\S/),i=n.from+c.indexOf(s),u=i+s.length;if($k(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;u<n.to&&o.delete(u,n.to),i>n.from&&o.delete(n.from+r,i),l=n.from+r+s.length,o.addMark(n.from+r,l,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function Lj(e){return hn((t,n)=>({get(){return t(),e},set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var Rj=class extends yj{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Lj(this.view.state),this.reactiveExtensionStorage=Lj(this.extensionStorage),this.on(`beforeTransaction`,({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),an(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){let n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){let t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},zj=F({name:`EditorContent`,props:{editor:{default:null,type:Object}},setup(e){let t=M(),n=to();return ir(()=>{let r=e.editor;r&&r.options.element&&t.value&&zn(()=>{if(!t.value||!r.view.dom?.parentNode)return;let e=N(t.value);t.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:e}),r.createNodeViews()})}),ei(()=>{let t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:t}},render(){return bo(`div`,{ref:e=>{this.rootEl=e}})}});F({name:`NodeViewContent`,props:{as:{type:String,default:`div`}},render(){return bo(this.as,{style:{whiteSpace:`pre-wrap`},"data-node-view-content":``})}}),F({name:`NodeViewWrapper`,props:{as:{type:String,default:`div`}},inject:[`onDragStart`,`decorationClasses`],render(){var e;return bo(this.as,{class:this.decorationClasses,style:{whiteSpace:`normal`},"data-node-view-wrapper":``,onDragstart:this.onDragStart},(e=this.$slots).default?.call(e))}});var Bj=(e={})=>{let t=ln();return Zr(()=>{t.value=new Rj(e)}),ei(()=>{var e,n;let r=t.value?.view.dom?.parentNode,i=r?.cloneNode(!0);(e=r?.parentNode)==null||e.replaceChild(i,r),(n=t.value)==null||n.destroy()}),t};F({name:`MarkViewContent`,props:{as:{type:String,default:`span`}},render(){return bo(this.as,{style:{whiteSpace:`inherit`},"data-mark-view-content":``})}});var Vj=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]},Hj=/^\s*>\s$/,Uj=Fj.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Vj(`blockquote`,{...Fk(this.options.HTMLAttributes,e),children:Vj(`slot`,{})})},parseMarkdown:(e,t)=>t.createNode(`blockquote`,void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach(e=>{let r=t.renderChildren([e]).split(`
|
|
101
|
+
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(r.join(`
|
|
102
|
+
`))}),n.join(`
|
|
103
|
+
>
|
|
104
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Cj({find:Hj,type:this.type})]}}),Wj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Gj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Kj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,qj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Jj=JA.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Vj(`strong`,{...Fk(this.options.HTMLAttributes,e),children:Vj(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bj({find:Wj,type:this.type}),bj({find:Kj,type:this.type})]},addPasteRules(){return[Ij({find:Gj,type:this.type}),Ij({find:qj,type:this.type})]}}),Yj=/(^|[^`])`([^`]+)`(?!`)$/,Xj=/(^|[^`])`([^`]+)`(?!`)/g,Zj=JA.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,Fk(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bj({find:Yj,type:this.type})]},addPasteRules(){return[Ij({find:Xj,type:this.type})]}}),Qj=4,$j=/^```([a-z]+)?[\s\n]$/,eM=/^~~~([a-z]+)?[\s\n]$/,tM=Fj.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Qj,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,Fk(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
105
|
+
`):`\`\`\`${r}
|
|
106
|
+
|
|
107
|
+
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??Qj,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
108
|
+
`,`
|
|
109
|
+
`).split(`
|
|
110
|
+
`).map(e=>o+e).join(`
|
|
111
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??Qj,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
112
|
+
`,`
|
|
113
|
+
`).split(`
|
|
114
|
+
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(fS.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
115
|
+
`,`
|
|
116
|
+
`).split(`
|
|
117
|
+
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
118
|
+
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
119
|
+
|
|
120
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(cS.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Sj({find:$j,type:this.type,getAttributes:e=>({language:e[1]})}),Sj({find:eM,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new AS({key:new NS(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
121
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(fS.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),nM=Fj.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
122
|
+
|
|
123
|
+
`):``}),rM=Fj.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,Fk(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
124
|
+
`},renderMarkdown:()=>`
|
|
125
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),iM=Fj.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Fk(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Sj({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),aM=Fj.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,Fk(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!wj(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return dA(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(fS.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(mS.create(t.doc,n.pos)):t.setSelection(fS.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(fS.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xj({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),oM=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sM=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,cM=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lM=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,uM=JA.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,Fk(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bj({find:oM,type:this.type}),bj({find:cM,type:this.type})]},addPasteRules(){return[Ij({find:sM,type:this.type}),Ij({find:lM,type:this.type})]}}),dM=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,fM=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,pM=`numeric`,mM=`ascii`,hM=`alpha`,gM=`asciinumeric`,_M=`alphanumeric`,vM=`domain`,yM=`emoji`,bM=`scheme`,xM=`slashscheme`,SM=`whitespace`;function CM(e,t){return e in t||(t[e]=[]),t[e]}function wM(e,t,n){t[pM]&&(t[gM]=!0,t[_M]=!0),t[mM]&&(t[gM]=!0,t[hM]=!0),t[gM]&&(t[_M]=!0),t[hM]&&(t[_M]=!0),t[_M]&&(t[vM]=!0),t[yM]&&(t[vM]=!0);for(let r in t){let t=CM(r,n);t.indexOf(e)<0&&t.push(e)}}function TM(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function EM(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}EM.groups={},EM.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=EM.groups;let i;return t&&t.j?i=t:(i=new EM(t),n&&r&&wM(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=EM.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new EM,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new EM,a&&(r&&(o.t&&typeof o.t==`string`?wM(a,Object.assign(TM(o.t,r),n),r):n&&wM(a,n,r)),o.t=a),i.j[e]=o,o}};var DM=(e,t,n,r,i)=>e.ta(t,n,r,i),OM=(e,t,n,r,i)=>e.tr(t,n,r,i),kM=(e,t,n,r,i)=>e.ts(t,n,r,i),X=(e,t,n,r,i)=>e.tt(t,n,r,i),AM=`WORD`,jM=`UWORD`,MM=`ASCIINUMERICAL`,NM=`ALPHANUMERICAL`,PM=`LOCALHOST`,FM=`TLD`,IM=`UTLD`,LM=`SCHEME`,RM=`SLASH_SCHEME`,zM=`NUM`,BM=`WS`,VM=`NL`,HM=`OPENBRACE`,UM=`CLOSEBRACE`,WM=`OPENBRACKET`,GM=`CLOSEBRACKET`,KM=`OPENPAREN`,qM=`CLOSEPAREN`,JM=`OPENANGLEBRACKET`,YM=`CLOSEANGLEBRACKET`,XM=`FULLWIDTHLEFTPAREN`,ZM=`FULLWIDTHRIGHTPAREN`,QM=`LEFTCORNERBRACKET`,$M=`RIGHTCORNERBRACKET`,eN=`LEFTWHITECORNERBRACKET`,tN=`RIGHTWHITECORNERBRACKET`,nN=`FULLWIDTHLESSTHAN`,rN=`FULLWIDTHGREATERTHAN`,iN=`AMPERSAND`,aN=`APOSTROPHE`,oN=`ASTERISK`,sN=`AT`,cN=`BACKSLASH`,lN=`BACKTICK`,uN=`CARET`,dN=`COLON`,fN=`COMMA`,pN=`DOLLAR`,mN=`DOT`,hN=`EQUALS`,gN=`EXCLAMATION`,_N=`HYPHEN`,vN=`PERCENT`,yN=`PIPE`,bN=`PLUS`,xN=`POUND`,SN=`QUERY`,CN=`QUOTE`,wN=`FULLWIDTHMIDDLEDOT`,TN=`SEMI`,EN=`SLASH`,DN=`TILDE`,ON=`UNDERSCORE`,kN=`EMOJI`,AN=`SYM`,jN=Object.freeze({__proto__:null,ALPHANUMERICAL:NM,AMPERSAND:iN,APOSTROPHE:aN,ASCIINUMERICAL:MM,ASTERISK:oN,AT:sN,BACKSLASH:cN,BACKTICK:lN,CARET:uN,CLOSEANGLEBRACKET:YM,CLOSEBRACE:UM,CLOSEBRACKET:GM,CLOSEPAREN:qM,COLON:dN,COMMA:fN,DOLLAR:pN,DOT:mN,EMOJI:kN,EQUALS:hN,EXCLAMATION:gN,FULLWIDTHGREATERTHAN:rN,FULLWIDTHLEFTPAREN:XM,FULLWIDTHLESSTHAN:nN,FULLWIDTHMIDDLEDOT:wN,FULLWIDTHRIGHTPAREN:ZM,HYPHEN:_N,LEFTCORNERBRACKET:QM,LEFTWHITECORNERBRACKET:eN,LOCALHOST:PM,NL:VM,NUM:zM,OPENANGLEBRACKET:JM,OPENBRACE:HM,OPENBRACKET:WM,OPENPAREN:KM,PERCENT:vN,PIPE:yN,PLUS:bN,POUND:xN,QUERY:SN,QUOTE:CN,RIGHTCORNERBRACKET:$M,RIGHTWHITECORNERBRACKET:tN,SCHEME:LM,SEMI:TN,SLASH:EN,SLASH_SCHEME:RM,SYM:AN,TILDE:DN,TLD:FM,UNDERSCORE:ON,UTLD:IM,UWORD:jM,WORD:AM,WS:BM}),MN=/[a-z]/,NN=/\p{L}/u,PN=/\p{Emoji}/u,FN=/\d/,IN=/\s/,LN=`\r`,RN=`
|
|
126
|
+
`,zN=`️`,BN=``,VN=``,HN=null,UN=null;function WN(e=[]){let t={};EM.groups=t;let n=new EM;HN??=JN(dM),UN??=JN(fM),X(n,`'`,aN),X(n,`{`,HM),X(n,`}`,UM),X(n,`[`,WM),X(n,`]`,GM),X(n,`(`,KM),X(n,`)`,qM),X(n,`<`,JM),X(n,`>`,YM),X(n,`(`,XM),X(n,`)`,ZM),X(n,`「`,QM),X(n,`」`,$M),X(n,`『`,eN),X(n,`』`,tN),X(n,`<`,nN),X(n,`>`,rN),X(n,`&`,iN),X(n,`*`,oN),X(n,`@`,sN),X(n,"`",lN),X(n,`^`,uN),X(n,`:`,dN),X(n,`,`,fN),X(n,`$`,pN),X(n,`.`,mN),X(n,`=`,hN),X(n,`!`,gN),X(n,`-`,_N),X(n,`%`,vN),X(n,`|`,yN),X(n,`+`,bN),X(n,`#`,xN),X(n,`?`,SN),X(n,`"`,CN),X(n,`/`,EN),X(n,`;`,TN),X(n,`~`,DN),X(n,`_`,ON),X(n,`\\`,cN),X(n,`・`,wN);let r=OM(n,FN,zM,{[pM]:!0});OM(r,FN,r);let i=OM(r,MN,MM,{[gM]:!0}),a=OM(r,NN,NM,{[_M]:!0}),o=OM(n,MN,AM,{[mM]:!0});OM(o,FN,i),OM(o,MN,o),OM(i,FN,i),OM(i,MN,i);let s=OM(n,NN,jM,{[hM]:!0});OM(s,MN),OM(s,FN,a),OM(s,NN,s),OM(a,FN,a),OM(a,MN),OM(a,NN,a);let c=X(n,RN,VM,{[SM]:!0}),l=X(n,LN,BM,{[SM]:!0}),u=OM(n,IN,BM,{[SM]:!0});X(n,VN,u),X(l,RN,c),X(l,VN,u),OM(l,IN,u),X(u,LN),X(u,RN),OM(u,IN,u),X(u,VN,u);let d=OM(n,PN,kN,{[yM]:!0});X(d,`#`),OM(d,PN,d),X(d,zN,d);let f=X(d,BN);X(f,`#`),OM(f,PN,d);let p=[[MN,o],[FN,i]],m=[[MN,null],[NN,s],[FN,a]];for(let e=0;e<HN.length;e++)qN(n,HN[e],FM,AM,p);for(let e=0;e<UN.length;e++)qN(n,UN[e],IM,jM,m);wM(FM,{tld:!0,ascii:!0},t),wM(IM,{utld:!0,alpha:!0},t),qN(n,`file`,LM,AM,p),qN(n,`mailto`,LM,AM,p),qN(n,`http`,RM,AM,p),qN(n,`https`,RM,AM,p),qN(n,`ftp`,RM,AM,p),qN(n,`ftps`,RM,AM,p),wM(LM,{scheme:!0,ascii:!0},t),wM(RM,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[bM]:!0}:{[xM]:!0};r.indexOf(`-`)>=0?i[vM]=!0:MN.test(r)?FN.test(r)?i[gM]=!0:i[mM]=!0:i[pM]=!0,kM(n,r,r,i)}return kM(n,`localhost`,PM,{ascii:!0}),n.jd=new EM(AN),{start:n,tokens:Object.assign({groups:t},jN)}}function GN(e,t){let n=KN(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function KN(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function qN(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new EM(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new EM(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function JN(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var YN={defaultProtocol:`http`,events:null,format:ZN,formatHref:ZN,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function XN(e,t=null){let n=Object.assign({},YN);e&&(n=Object.assign(n,e instanceof XN?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}XN.prototype={o:YN,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:YN[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function ZN(e){return e}function QN(e,t){this.t=`token`,this.v=e,this.tk=t}QN.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=YN.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function $N(e,t){class n extends QN{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var eP=$N(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),tP=$N(`text`),nP=$N(`nl`),rP=$N(`url`,{isLink:!0,toHref(e=YN.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==PM&&e[1].t===dN}}),iP=e=>new EM(e);function aP({groups:e}){let t=e.domain.concat([iN,oN,sN,cN,lN,uN,pN,hN,_N,zM,vN,yN,bN,xN,EN,AN,DN,ON]),n=[aN,dN,fN,mN,gN,vN,SN,CN,TN,JM,YM,HM,UM,GM,WM,KM,qM,XM,ZM,QM,$M,eN,tN,nN,rN],r=[iN,aN,oN,cN,lN,uN,pN,hN,_N,HM,UM,vN,yN,bN,xN,SN,EN,AN,DN,ON],i=iP(),a=X(i,DN);DM(a,r,a),DM(a,e.domain,a);let o=iP(),s=iP(),c=iP();DM(i,e.domain,o),DM(i,e.scheme,s),DM(i,e.slashscheme,c),DM(o,r,a),DM(o,e.domain,o);let l=X(o,sN);X(a,sN,l),X(s,sN,l),X(c,sN,l);let u=X(a,mN);DM(u,r,a),DM(u,e.domain,a);let d=iP();DM(l,e.domain,d),DM(d,e.domain,d);let f=X(d,mN);DM(f,e.domain,d);let p=iP(eP);DM(f,e.tld,p),DM(f,e.utld,p),X(l,PM,p);let m=X(d,_N);X(m,_N,m),DM(m,e.domain,d),DM(p,e.domain,d),X(p,mN,f),X(p,_N,m),DM(X(p,dN),e.numeric,eP);let h=X(o,_N),g=X(o,mN);X(h,_N,h),DM(h,e.domain,o),DM(g,r,a),DM(g,e.domain,o);let _=iP(rP);DM(g,e.tld,_),DM(g,e.utld,_),DM(_,e.domain,o),DM(_,r,a),X(_,mN,g),X(_,_N,h),X(_,sN,l);let v=X(_,dN),y=iP(rP);DM(v,e.numeric,y);let b=iP(rP),x=iP();DM(b,t,b),DM(b,n,x),DM(x,t,b),DM(x,n,x),X(_,EN,b),X(y,EN,b);let S=X(s,dN),C=X(X(X(c,dN),EN),EN);DM(s,e.domain,o),X(s,mN,g),X(s,_N,h),DM(c,e.domain,o),X(c,mN,g),X(c,_N,h),DM(S,e.domain,b),X(S,EN,b),X(S,SN,b),DM(C,e.domain,b),DM(C,t,b),X(C,EN,b);let ee=[[HM,UM],[WM,GM],[KM,qM],[JM,YM],[XM,ZM],[QM,$M],[eN,tN],[nN,rN]];for(let e=0;e<ee.length;e++){let[r,i]=ee[e],a=X(b,r);X(x,r,a),X(a,i,b);let o=iP(rP);DM(a,t,o);let s=iP();DM(a,n),DM(o,t,o),DM(o,n,s),DM(s,t,o),DM(s,n,s),X(o,i,b),X(s,i,b)}return X(i,PM,_),X(i,VM,nP),{start:i,tokens:jN}}function oP(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(sP(tP,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(sP(e,t,r))}}return o.length>0&&a.push(sP(tP,t,o)),a}function sP(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var cP=typeof console<`u`&&console&&console.warn||(()=>{}),lP=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,uP={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dP(){return EM.groups={},uP.scanner=null,uP.parser=null,uP.tokenQueue=[],uP.pluginQueue=[],uP.customSchemes=[],uP.initialized=!1,uP}function fP(e,t=!1){if(uP.initialized&&cP(`linkifyjs: already initialized - will not register custom scheme "${e}" ${lP}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
127
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
128
|
+
2. Cannot start or end with "-"
|
|
129
|
+
3. "-" cannot repeat`);uP.customSchemes.push([e,t])}function pP(){uP.scanner=WN(uP.customSchemes);for(let e=0;e<uP.tokenQueue.length;e++)uP.tokenQueue[e][1]({scanner:uP.scanner});uP.parser=aP(uP.scanner.tokens);for(let e=0;e<uP.pluginQueue.length;e++)uP.pluginQueue[e][1]({scanner:uP.scanner,parser:uP.parser});return uP.initialized=!0,uP}function mP(e){return uP.initialized||pP(),oP(uP.parser.start,e,GN(uP.scanner.start,e))}mP.scan=GN;function hP(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new XN(n),i=mP(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var gP=`[\0- \xA0 -\u2029 ]`,_P=new RegExp(gP),vP=RegExp(`${gP}$`),yP=new RegExp(gP,`g`);function bP(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function xP(e){return new AS({key:new NS(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Qk(Ck(n.doc,[...t])).forEach(({newRange:t})=>{let n=Tk(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!vP.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(_P).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=mP(n).map(t=>t.toObject(e.defaultProtocol));if(!bP(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{$k(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function SP(e){return new AS({key:new NS(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=Yk(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function CP(e){return new AS({key:new NS(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=hP(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function wP(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(yP,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var TP=JA.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){fP(e);return}fP(e.scheme,e.optionalSlashes)})},onDestroy(){dP()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!wP(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!wP(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!wP(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,Fk(this.options.HTMLAttributes,e),0]:[`a`,Fk(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!wP(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!wP(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[Ij({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=hP(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!wP(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(xP({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!wP(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(SP({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(CP({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),EP=Object.defineProperty,DP=(e,t)=>{for(var n in t)EP(e,n,{get:t[n],enumerable:!0})},OP=`listItem`,kP=`textStyle`,AP=/^\s*([-+*])\s$/,jP=Fj.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,Fk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
130
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(OP,this.editor.getAttributes(kP)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Cj({find:AP,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Cj({find:AP,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kP),editor:this.editor})),[e]}}),MP=Fj.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,Fk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>e.type===`paragraph`))n=t.parseChildren(e.tokens);else{let r=e.tokens[0];if(r&&r.type===`text`&&r.tokens&&r.tokens.length>0){if(n=[{type:`paragraph`,content:t.parseInline(r.tokens)}],e.tokens.length>1){let r=e.tokens.slice(1),i=t.parseChildren(r);n.push(...i)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:n}},renderMarkdown:(e,t,n)=>Nj(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});DP({},{findListItemPos:()=>NP,getNextListDepth:()=>PP,handleBackspace:()=>RP,handleDelete:()=>VP,hasListBefore:()=>FP,hasListItemAfter:()=>HP,hasListItemBefore:()=>IP,listItemHasSubList:()=>LP,nextListIsDeeper:()=>zP,nextListIsHigher:()=>BP});var NP=(e,t)=>{let{$from:n}=t.selection,r=yO(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},PP=(e,t)=>{let n=NP(e,t);if(!n)return!1;let[,r]=eA(t,e,n.$pos.pos+4);return r},FP=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},IP=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},LP=(e,t,n)=>{if(!n)return!1;let r=yO(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},RP=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!ak(e.state,t)&&FP(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!ak(e.state,t)||!sA(e.state))return!1;let r=NP(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=LP(t,e.state,i);return IP(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},zP=(e,t)=>{let n=PP(e,t),r=NP(e,t);return!r||!n?!1:n>r.depth},BP=(e,t)=>{let n=PP(e,t),r=NP(e,t);return!r||!n?!1:n<r.depth},VP=(e,t)=>{if(!ak(e.state,t)||!oA(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:zP(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():BP(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},HP=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},UP=ij.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&VP(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&VP(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&RP(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&RP(e,n,r)&&(t=!0)}),t}}}}),WP=/^(\s*)(\d+)\.\s+(.*)$/,GP=/^\s/;function KP(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(WP);if(!a)break;let[,o,s,c]=a,l=o.length,u=c,d=n+1,f=[i];for(;d<e.length;){let t=e[d];if(t.match(WP))break;if(t.trim()===``)f.push(t),u+=`
|
|
131
|
+
`,d+=1;else if(t.match(GP))f.push(t),u+=`
|
|
132
|
+
${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:u.trim(),raw:f.join(`
|
|
133
|
+
`)}),r=d,n=d}return[t,r]}function qP(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let o=a.content.split(`
|
|
134
|
+
`),s=o[0]?.trim()||``,c=[];s&&c.push({type:`paragraph`,raw:s,tokens:n.inlineTokens(s)});let l=o.slice(1).join(`
|
|
135
|
+
`).trim();if(l){let e=n.blockTokens(l);c.push(...e)}let u=i+1,d=[];for(;u<e.length&&e[u].indent>t;)d.push(e[u]),u+=1;if(d.length>0){let e=qP(d,Math.min(...d.map(e=>e.indent)),n);c.push({type:`list`,ordered:!0,start:d[0].number,items:e,raw:d.map(e=>e.raw).join(`
|
|
136
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:c}),i=u}else i+=1}return r}function JP(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var YP=`listItem`,XP=`textStyle`,ZP=/^(\d+)\.\s$/,QP=Fj.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,Fk(this.options.HTMLAttributes,n),0]:[`ol`,Fk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?JP(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
137
|
+
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
138
|
+
`),[i,a]=KP(r);if(i.length===0)return;let o=qP(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
139
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(YP,this.editor.getAttributes(XP)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Cj({find:ZP,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Cj({find:ZP,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(XP)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),$P=/^\s*(\[([( |x])?\])\s$/,eF=Fj.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,Fk(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Nj(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Ik(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Cj({find:$P,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),tF=Fj.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,Fk(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
140
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Mj(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Mj(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ij.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(jP.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(MP.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UP.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(QP.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(eF.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(tF.configure(this.options.taskList)),e}});var nF=` `,rF=`\xA0`,iF=Fj.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,Fk(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return r.length===1&&r[0].type===`text`&&(r[0].text===nF||r[0].text===rF)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t)=>{if(!e)return``;let n=Array.isArray(e.content)?e.content:[];return n.length===0?nF:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),aF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,oF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sF=JA.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,Fk(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bj({find:aF,type:this.type})]},addPasteRules(){return[Ij({find:oF,type:this.type})]}}),cF=Fj.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),lF=JA.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,Fk(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),uF=lF;function dF(e={}){return new AS({view(t){return new fF(t,e)}})}var fF=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Vx(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},pF=class e extends cS{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):cS.near(r)}content(){return J.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new mF(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!gF(e)||!_F(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!mS.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};pF.prototype.visible=!1,pF.findFrom=pF.findGapCursorFrom,cS.jsonID(`gapcursor`,pF);var mF=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return pF.valid(t)?new pF(t):cS.near(t)}};function hF(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function gF(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||hF(e.type))return!0;if(e.inlineContent)return!1}}return!0}function _F(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||hF(e.type))return!0;if(e.inlineContent)return!1}}return!0}function vF(){return new AS({props:{decorations:CF,createSelectionBetween(e,t,n){return t.pos==n.pos&&pF.valid(n)?new pF(n):null},handleClick:xF,handleKeyDown:yF,handleDOMEvents:{beforeinput:SF}}})}var yF=oO({ArrowLeft:bF(`horiz`,-1),ArrowRight:bF(`horiz`,1),ArrowUp:bF(`vert`,-1),ArrowDown:bF(`vert`,1)});function bF(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof fS){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=pF.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new pF(c))),!0):!1}}function xF(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!pF.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&mS.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new pF(r))),!0)}function SF(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof pF))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=q.empty;for(let e=r.length-1;e>=0;e--)i=q.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new J(i,0,0));return a.setSelection(fS.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function CF(e){if(!(e.selection instanceof pF))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,aD.create(e.doc,[nD.widget(e.selection.head,t,{key:`gapcursor`})])}var wF=200,TF=function(){};TF.prototype.append=function(e){return e.length?(e=TF.from(e),!this.length&&e||e.length<wF&&this.leafAppend(e)||this.length<wF&&e.leafPrepend(this)||this.appendInner(e)):this},TF.prototype.prepend=function(e){return e.length?TF.from(e).append(this):this},TF.prototype.appendInner=function(e){return new DF(this,e)},TF.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?TF.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},TF.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},TF.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},TF.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},TF.from=function(e){return e instanceof TF?e:e&&e.length?new EF(e):TF.empty};var EF=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=wF)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=wF)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(TF);TF.empty=new EF([]);var DF=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(TF),OF=500,kF=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new jF(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new jF(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new jF(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>NF&&(s=AF(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new ax;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new jF(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new jF(i,o,l))}else r.push(new jF(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new jF(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>OF&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new jF(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(TF.from(i.reverse()),a)}};kF.empty=new kF(TF.empty,0);function AF(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var jF=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},MF=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},NF=20;function PF(e,t,n,r){let i=n.getMeta(HF),a;if(i)return i.historyState;n.getMeta(UF)&&(e=new MF(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(HF))return o.getMeta(HF).redo?new MF(e.done.addTransform(n,void 0,r,VF(t)),e.undone,IF(n.mapping.maps),e.prevTime,e.prevComposition):new MF(e.done,e.undone.addTransform(n,void 0,r,VF(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!FF(n,e.prevRanges)),s=o?LF(e.prevRanges,n.mapping):IF(n.mapping.maps);return new MF(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,VF(t)),kF.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new MF(e.done.rebased(n,a),e.undone.rebased(n,a),LF(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new MF(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),LF(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function FF(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function IF(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function LF(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function RF(e,t,n){let r=VF(t),i=HF.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new MF(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(HF,{redo:n,historyState:c})}var zF=!1,BF=null;function VF(e){let t=e.plugins;if(BF!=t){zF=!1,BF=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){zF=!0;break}}return zF}var HF=new NS(`history`),UF=new NS(`closeHistory`);function WF(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new AS({key:HF,state:{init(){return new MF(kF.empty,kF.empty,null,0,-1)},apply(t,n,r){return PF(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?KF:n==`historyRedo`?qF:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function GF(e,t){return(n,r)=>{let i=HF.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=RF(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var KF=GF(!1,!0),qF=GF(!0,!0);ij.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new AS({key:new NS(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var JF=ij.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[dF(this.options)]}});ij.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new AS({key:new NS(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return aD.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(nD.node(t,t+e.nodeSize,{class:this.options.className}))}),aD.create(e,a)}}})]}});var YF=ij.create({name:`gapCursor`,addProseMirrorPlugins(){return[vF()]},extendNodeSchema(e){return{allowGapCursor:jk(Y(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),XF=`placeholder`;function ZF(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var QF=ij.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:XF,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${ZF(this.options.dataAttribute)}`:`data-${XF}`;return[new AS({key:new NS(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&uA(t);if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=nD.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),aD.create(t,a)}}})]}});ij.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new AS({key:new NS(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||dA(n.selection)||e.view.dragging?null:aD.create(n.doc,[nD.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function $F({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var eI=ij.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new NS(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new AS({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!$F({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!$F({node:r,types:n})}}})]}}),tI=ij.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>KF(e,t),redo:()=>({state:e,dispatch:t})=>qF(e,t)}},addProseMirrorPlugins(){return[WF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),nI=ij.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(Jj.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Uj.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(jP.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Zj.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(tM.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(nM.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(JF.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(YF.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(rM.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(iM.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(tI.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(aM.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(uM.configure(this.options.italic)),this.options.listItem!==!1&&e.push(MP.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UP.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(TP.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(QP.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(iF.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(sF.configure(this.options.strike)),this.options.text!==!1&&e.push(cF.configure(this.options.text)),this.options.underline!==!1&&e.push(lF.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(eI.configure(this.options?.trailingNode)),e}}),rI=tF,iI=eF,aI=QF,oI={};function sI(e){let t=oI[e];if(t)return t;t=oI[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function cI(e,t){typeof t!=`string`&&(t=cI.defaultChars);let n=sI(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}cI.defaultChars=`;/?:@&=+$,#`,cI.componentChars=``;var lI={};function uI(e){let t=lI[e];if(t)return t;t=lI[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function dI(e,t,n){typeof t!=`string`&&(n=t,t=dI.defaultChars),n===void 0&&(n=!0);let r=uI(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}dI.defaultChars=`;/?:@&=+$,-_.!~*'()#`,dI.componentChars=`-_.!~*'()`;function fI(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function pI(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var mI=/^([a-z0-9.+-]+:)/i,hI=/:[0-9]*$/,gI=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,_I=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
141
|
+
`,` `],vI=[`/`,`?`,`#`],yI=255,bI=/^[+a-z0-9A-Z_-]{0,63}$/,xI=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,SI={javascript:!0,"javascript:":!0},CI={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function wI(e,t){if(e&&e instanceof pI)return e;let n=new pI;return n.parse(e,t),n}pI.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=gI.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=mI.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&SI[o])&&(a=a.substr(2),this.slashes=!0)),!SI[o]&&(i||o&&!CI[o])){let e=-1;for(let t=0;t<vI.length;t++)r=a.indexOf(vI[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<_I.length;t++)r=a.indexOf(_I[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(bI)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(bI)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(xI);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>yI&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),CI[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},pI.prototype.parseHost=function(e){let t=hI.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var TI=s({decode:()=>cI,encode:()=>dI,format:()=>fI,parse:()=>wI}),EI=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,DI=/[\0-\x1F\x7F-\x9F]/,OI=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,kI=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,AI=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,jI=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,MI=s({Any:()=>EI,Cc:()=>DI,Cf:()=>OI,P:()=>kI,S:()=>AI,Z:()=>jI}),NI=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),PI=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),FI=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);const II=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function LI(e){return e>=55296&&e<=57343||e>1114111?65533:FI.get(e)??e}var RI;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(RI||={});var zI=32,BI;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(BI||={});function VI(e){return e>=RI.ZERO&&e<=RI.NINE}function HI(e){return e>=RI.UPPER_A&&e<=RI.UPPER_F||e>=RI.LOWER_A&&e<=RI.LOWER_F}function UI(e){return e>=RI.UPPER_A&&e<=RI.UPPER_Z||e>=RI.LOWER_A&&e<=RI.LOWER_Z||VI(e)}function WI(e){return e===RI.EQUALS||UI(e)}var GI;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(GI||={});var KI;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(KI||={});var qI=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=GI.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=KI.Strict}startEntity(e){this.decodeMode=e,this.state=GI.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case GI.EntityStart:return e.charCodeAt(t)===RI.NUM?(this.state=GI.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=GI.NamedEntity,this.stateNamedEntity(e,t));case GI.NumericStart:return this.stateNumericStart(e,t);case GI.NumericDecimal:return this.stateNumericDecimal(e,t);case GI.NumericHex:return this.stateNumericHex(e,t);case GI.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|zI)===RI.LOWER_X?(this.state=GI.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=GI.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(VI(r)||HI(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(VI(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===RI.SEMI)this.consumed+=1;else if(this.decodeMode===KI.Strict)return 0;return this.emitCodePoint(LI(this.result),this.consumed),this.errors&&(e!==RI.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&BI.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=YI(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===KI.Attribute&&(i===0||WI(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&BI.VALUE_LENGTH)>>14,i!==0){if(a===RI.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==KI.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&BI.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~BI.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case GI.NamedEntity:return this.result!==0&&(this.decodeMode!==KI.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case GI.NumericDecimal:return this.emitNumericEntity(0,2);case GI.NumericHex:return this.emitNumericEntity(0,3);case GI.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case GI.EntityStart:return 0}}};function JI(e){let t=``,n=new qI(e,e=>t+=II(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function YI(e,t,n,r){let i=(t&BI.BRANCH_LENGTH)>>7,a=t&BI.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var XI=JI(NI);JI(PI);function ZI(e,t=KI.Legacy){return XI(e,t)}var QI=s({arrayReplaceAt:()=>iL,assign:()=>rL,escapeHtml:()=>_L,escapeRE:()=>yL,fromCodePoint:()=>oL,has:()=>nL,isMdAsciiPunct:()=>CL,isPunctChar:()=>SL,isSpace:()=>bL,isString:()=>eL,isValidEntityCode:()=>aL,isWhiteSpace:()=>xL,lib:()=>TL,normalizeReference:()=>wL,unescapeAll:()=>fL,unescapeMd:()=>dL});function $I(e){return Object.prototype.toString.call(e)}function eL(e){return $I(e)===`[object String]`}var tL=Object.prototype.hasOwnProperty;function nL(e,t){return tL.call(e,t)}function rL(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function iL(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function aL(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function oL(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var sL=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,cL=RegExp(sL.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),lL=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function uL(e,t){if(t.charCodeAt(0)===35&&lL.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return aL(n)?oL(n):e}let n=ZI(e);return n===e?e:n}function dL(e){return e.indexOf(`\\`)<0?e:e.replace(sL,`$1`)}function fL(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(cL,function(e,t,n){return t||uL(e,n)})}var pL=/[&<>"]/,mL=/[&<>"]/g,hL={"&":`&`,"<":`<`,">":`>`,'"':`"`};function gL(e){return hL[e]}function _L(e){return pL.test(e)?e.replace(mL,gL):e}var vL=/[.?*+^$[\]\\(){}|-]/g;function yL(e){return e.replace(vL,`\\$&`)}function bL(e){switch(e){case 9:case 32:return!0}return!1}function xL(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function SL(e){return kI.test(e)||AI.test(e)}function CL(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function wL(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}var TL={mdurl:TI,ucmicro:MI};function EL(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function DL(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=fL(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=fL(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function OL(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=fL(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=fL(e.slice(t,a)),o}var kL=s({parseLinkDestination:()=>DL,parseLinkLabel:()=>EL,parseLinkTitle:()=>OL}),AL={};AL.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+_L(a.content)+`</code>`},AL.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+_L(e[t].content)+`</code></pre>
|
|
142
|
+
`},AL.fence=function(e,t,n,r,i){let a=e[t],o=a.info?fL(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||_L(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
143
|
+
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},AL.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},AL.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
144
|
+
`:`<br>
|
|
145
|
+
`},AL.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
146
|
+
`:`<br>
|
|
147
|
+
`:`
|
|
148
|
+
`},AL.text=function(e,t){return _L(e[t].content)},AL.html_block=function(e,t){return e[t].content},AL.html_inline=function(e,t){return e[t].content};function jL(){this.rules=rL({},AL)}jL.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+_L(e.attrs[t][0])+`="`+_L(e.attrs[t][1])+`"`;return r},jL.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
|
|
149
|
+
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
|
|
150
|
+
`:`>`,i},jL.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},jL.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
|
|
151
|
+
`;break;default:}return r},jL.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function ML(){this.__rules__=[],this.__cache__=null}ML.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},ML.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},ML.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},ML.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},ML.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},ML.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},ML.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},ML.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},ML.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},ML.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function NL(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}NL.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},NL.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},NL.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},NL.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},NL.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function PL(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}PL.prototype.Token=NL;var FL=/\r\n?|\n/g,IL=/\0/g;function LL(e){let t;t=e.src.replace(FL,`
|
|
152
|
+
`),t=t.replace(IL,`�`),e.src=t}function RL(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function zL(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function BL(e){return/^<a[>\s]/i.test(e)}function VL(e){return/^<\/a\s*>/i.test(e)}function HL(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(BL(o.content)&&i>0&&i--,VL(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=iL(r,a,c)}}}}var UL=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,WL=/\((c|tm|r)\)/i,GL=/\((c|tm|r)\)/gi,KL={c:`©`,r:`®`,tm:`™`};function qL(e,t){return KL[t.toLowerCase()]}function JL(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(GL,qL)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function YL(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&UL.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function XL(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(WL.test(e.tokens[t].content)&&JL(e.tokens[t].children),UL.test(e.tokens[t].content)&&YL(e.tokens[t].children))}var ZL=/['"]/,QL=/['"]/g,$L=`’`;function eR(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function tR(e,t){let n,r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){QL.lastIndex=c;let u=QL.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=i-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=i+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=CL(m)||SL(String.fromCharCode(m)),_=CL(h)||SL(String.fromCharCode(h)),v=xL(m),y=xL(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=eR(a.content,u.index,$L));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=t.md.options.quotes[2],f=t.md.options.quotes[3]):(o=t.md.options.quotes[0],f=t.md.options.quotes[1]),a.content=eR(a.content,u.index,f),e[d.token].content=eR(e[d.token].content,d.pos,o),c+=f.length-1,d.token===i&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:i,pos:u.index,single:p,level:o}):f&&p&&(a.content=eR(a.content,u.index,$L))}}}function nR(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!ZL.test(e.tokens[t].content)||tR(e.tokens[t].children,e)}function rR(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var iR=[[`normalize`,LL],[`block`,RL],[`inline`,zL],[`linkify`,HL],[`replacements`,XL],[`smartquotes`,nR],[`text_join`,rR]];function aR(){this.ruler=new ML;for(let e=0;e<iR.length;e++)this.ruler.push(iR[e][0],iR[e][1])}aR.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},aR.prototype.State=PL;function oR(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(bL(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}oR.prototype.push=function(e,t,n){let r=new NL(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},oR.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},oR.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},oR.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&bL(this.src.charCodeAt(e));e++);return e},oR.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!bL(this.src.charCodeAt(--e)))return e+1;return e},oR.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},oR.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},oR.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(bL(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},oR.prototype.Token=NL;var sR=65536;function cR(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function lR(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function uR(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!bL(s)||o===45&&bL(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!bL(t))return!1;a++}let c=cR(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=cR(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=lR(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=cR(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=lR(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>sR))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function dR(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
|
|
153
|
+
`,a.map=[t,e.line],!0}function fR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+(f?1:0);let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function pR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(bL(t))t===9?o+=4-(o+e.bsCount[m]+(r?1:0))%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+(n?1:0),l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function mR(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!bL(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function hR(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!bL(e.src.charCodeAt(r))?-1:r}function gR(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!bL(a))?-1:i}function _R(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function vR(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=gR(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=hR(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=gR(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=hR(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&_R(e,h),!0}function yR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!bL(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!bL(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&bL(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&bL(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=wL(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var bR=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),xR=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,SR=RegExp(`^(?:`+xR+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),CR=RegExp(`^(?:`+xR+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),wR=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+bR.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(CR.source+`\\s*$`),/^$/,!1]];function TR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<wR.length&&!wR[s][0].test(o);s++);if(s===wR.length)return!1;if(r)return wR[s][2];let c=t+1;if(!wR[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),wR[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function ER(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!bL(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&bL(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=e.src.slice(i,a).trim(),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function DR(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return!1;let c=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function OR(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var kR=[[`table`,uR,[`paragraph`,`reference`]],[`code`,dR],[`fence`,fR,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,pR,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,mR,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,vR,[`paragraph`,`reference`,`blockquote`]],[`reference`,yR],[`html_block`,TR,[`paragraph`,`reference`,`blockquote`]],[`heading`,ER,[`paragraph`,`reference`,`blockquote`]],[`lheading`,DR],[`paragraph`,OR]];function AR(){this.ruler=new ML;for(let e=0;e<kR.length;e++)this.ruler.push(kR[e][0],kR[e][1],{alt:(kR[e][2]||[]).slice()})}AR.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},AR.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},AR.prototype.State=oR;function jR(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}jR.prototype.pushPending=function(){let e=new NL(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},jR.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new NL(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},jR.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32,a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32,c=CL(i)||SL(String.fromCharCode(i)),l=CL(s)||SL(String.fromCharCode(s)),u=xL(i),d=xL(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},jR.prototype.Token=NL;function MR(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function NR(e,t){let n=e.pos;for(;n<e.posMax&&!MR(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var PR=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function FR(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(PR);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function IR(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&bL(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var LR=[];for(let e=0;e<256;e++)LR.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){LR[e.charCodeAt(0)]=1});function RR(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),bL(i));)n++;return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&LR[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function zR(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function BR(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function VR(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function HR(e){let t=e.tokens_meta,n=e.tokens_meta.length;VR(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&VR(e,t[r].delimiters)}var UR={tokenize:BR,postProcess:HR};function WR(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function GR(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function KR(e){let t=e.tokens_meta,n=e.tokens_meta.length;GR(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&GR(e,t[r].delimiters)}var qR={tokenize:WR,postProcess:KR};function JR(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!bL(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!bL(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!bL(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[wL(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function YR(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!bL(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!bL(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!bL(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[wL(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var XR=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,ZR=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function QR(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(ZR.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(XR.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function $R(e){return/^<a[>\s]/i.test(e)}function ez(e){return/^<\/a\s*>/i.test(e)}function tz(e){let t=e|32;return t>=97&&t<=122}function nz(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!tz(i))return!1;let a=e.src.slice(r).match(SR);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],$R(t.content)&&e.linkLevel++,ez(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var rz=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,iz=/^&([a-z][a-z0-9]{1,31});/i;function az(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(rz);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=aL(t)?oL(t):oL(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(iz);if(r){let n=ZI(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function oz(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function sz(e){let t=e.tokens_meta,n=e.tokens_meta.length;oz(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&oz(t[e].delimiters)}function cz(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var lz=[[`text`,NR],[`linkify`,FR],[`newline`,IR],[`escape`,RR],[`backticks`,zR],[`strikethrough`,UR.tokenize],[`emphasis`,qR.tokenize],[`link`,JR],[`image`,YR],[`autolink`,QR],[`html_inline`,nz],[`entity`,az]],uz=[[`balance_pairs`,sz],[`strikethrough`,UR.postProcess],[`emphasis`,qR.postProcess],[`fragments_join`,cz]];function dz(){this.ruler=new ML;for(let e=0;e<lz.length;e++)this.ruler.push(lz[e][0],lz[e][1]);this.ruler2=new ML;for(let e=0;e<uz.length;e++)this.ruler2.push(uz[e][0],uz[e][1])}dz.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},dz.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},dz.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},dz.prototype.State=jR;function fz(e){let t={};e||={},t.src_Any=EI.source,t.src_Cc=DI.source,t.src_Z=jI.source,t.src_P=kI.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!`+(e[`---`]?`-(?!--)|`:`-|`)+`_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|[><|]|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`|$)|;(?!`+t.src_ZCc+`|$)|\\!+(?!`+t.src_ZCc+`|[!]|$)|\\?(?!`+t.src_ZCc+`|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}function pz(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function mz(e){return Object.prototype.toString.call(e)}function hz(e){return mz(e)===`[object String]`}function gz(e){return mz(e)===`[object Object]`}function _z(e){return mz(e)===`[object RegExp]`}function vz(e){return mz(e)===`[object Function]`}function yz(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var bz={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function xz(e){return Object.keys(e||{}).reduce(function(e,t){return e||bz.hasOwnProperty(t)},!1)}var Sz={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Cz=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,wz=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function Tz(e){e.__index__=-1,e.__text_cache__=``}function Ez(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function Dz(){return function(e,t){t.normalize(e)}}function Oz(e){let t=e.re=fz(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(Cz),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,gz(n)){_z(n.validate)?r.validate=Ez(n.validate):vz(n.validate)?r.validate=n.validate:a(t,n),vz(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=Dz();return}if(hz(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:Dz()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(yz).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`ig`),e.re.schema_at_start=RegExp(`^`+e.re.schema_search.source,`i`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),Tz(e)}function kz(e,t){let n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function Az(e,t){let n=new kz(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function jz(e,t){if(!(this instanceof jz))return new jz(e,t);t||xz(e)&&(t=e,e={}),this.__opts__=pz({},bz,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=pz({},Sz,e),this.__compiled__={},this.__tlds__=wz,this.__tlds_replaced__=!1,this.re={},Oz(this)}jz.prototype.add=function(e,t){return this.__schemas__[e]=t,Oz(this),this},jz.prototype.set=function(e){return this.__opts__=pz(this.__opts__,e),this},jz.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},jz.prototype.pretest=function(e){return this.re.pretest.test(e)},jz.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},jz.prototype.match=function(e){let t=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(Az(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(Az(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},jz.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,Az(this,0)):null},jz.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),Oz(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Oz(this),this)},jz.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},jz.prototype.onCompile=function(){};var Mz=2147483647,Nz=36,Pz=1,Fz=26,Iz=38,Lz=700,Rz=72,zz=128,Bz=`-`,Vz=/^xn--/,Hz=/[^\0-\x7F]/,Uz=/[\x2E\u3002\uFF0E\uFF61]/g,Wz={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},Gz=Nz-Pz,Kz=Math.floor,qz=String.fromCharCode;function Jz(e){throw RangeError(Wz[e])}function Yz(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function Xz(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(Uz,`.`);let i=Yz(e.split(`.`),t).join(`.`);return r+i}function Zz(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var Qz=e=>String.fromCodePoint(...e),$z=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Nz},eB=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},tB=function(e,t,n){let r=0;for(e=n?Kz(e/Lz):e>>1,e+=Kz(e/t);e>Gz*Fz>>1;r+=Nz)e=Kz(e/Gz);return Kz(r+(Gz+1)*e/(e+Iz))},nB=function(e){let t=[],n=e.length,r=0,i=zz,a=Rz,o=e.lastIndexOf(Bz);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&Jz(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=Nz;;i+=Nz){s>=n&&Jz(`invalid-input`);let o=$z(e.charCodeAt(s++));o>=Nz&&Jz(`invalid-input`),o>Kz((Mz-r)/t)&&Jz(`overflow`),r+=o*t;let c=i<=a?Pz:i>=a+Fz?Fz:i-a;if(o<c)break;let l=Nz-c;t>Kz(Mz/l)&&Jz(`overflow`),t*=l}let c=t.length+1;a=tB(r-o,c,o==0),Kz(r/c)>Mz-i&&Jz(`overflow`),i+=Kz(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},rB=function(e){let t=[];e=Zz(e);let n=e.length,r=zz,i=0,a=Rz;for(let n of e)n<128&&t.push(qz(n));let o=t.length,s=o;for(o&&t.push(Bz);s<n;){let n=Mz;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>Kz((Mz-i)/c)&&Jz(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>Mz&&Jz(`overflow`),n===r){let e=i;for(let n=Nz;;n+=Nz){let r=n<=a?Pz:n>=a+Fz?Fz:n-a;if(e<r)break;let i=e-r,o=Nz-r;t.push(qz(eB(r+i%o,0))),e=Kz(i/o)}t.push(qz(eB(e,0))),a=tB(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},iB={version:`2.3.1`,ucs2:{decode:Zz,encode:Qz},decode:nB,encode:rB,toASCII:function(e){return Xz(e,function(e){return Hz.test(e)?`xn--`+rB(e):e})},toUnicode:function(e){return Xz(e,function(e){return Vz.test(e)?nB(e.slice(4).toLowerCase()):e})}},aB={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},oB=/^(vbscript|javascript|file|data):/,sB=/^data:image\/(gif|png|jpeg|webp);/;function cB(e){let t=e.trim().toLowerCase();return oB.test(t)?sB.test(t):!0}var lB=[`http:`,`https:`,`mailto:`];function uB(e){let t=wI(e,!0);if(t.hostname&&(!t.protocol||lB.indexOf(t.protocol)>=0))try{t.hostname=iB.toASCII(t.hostname)}catch{}return dI(fI(t))}function dB(e){let t=wI(e,!0);if(t.hostname&&(!t.protocol||lB.indexOf(t.protocol)>=0))try{t.hostname=iB.toUnicode(t.hostname)}catch{}return cI(fI(t),cI.defaultChars+`%`)}function fB(e,t){if(!(this instanceof fB))return new fB(e,t);t||eL(e)||(t=e||{},e=`default`),this.inline=new dz,this.block=new AR,this.core=new aR,this.renderer=new jL,this.linkify=new jz,this.validateLink=cB,this.normalizeLink=uB,this.normalizeLinkText=dB,this.utils=QI,this.helpers=rL({},kL),this.options={},this.configure(e),t&&this.set(t)}fB.prototype.set=function(e){return rL(this.options,e),this},fB.prototype.configure=function(e){let t=this;if(eL(e)){let t=e;if(e=aB[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},fB.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},fB.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},fB.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},fB.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},fB.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},fB.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},fB.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var pB=new Cb({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function mB(e,t){if(e.isText&&t.isText&&My.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var hB=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:My.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=mB(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:My.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function gB(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function _B(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function vB(e){return e[e.length-1]==`
|
|
154
|
+
`?e.slice(0,e.length-1):e}function yB(){}function bB(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);_B(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,gB(i,n,r,a)),e.addText(vB(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,gB(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,gB(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];_B(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(gB(i,n,r,a))),e.addText(vB(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(gB(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)_B(i,r)?n[r]=yB:(n[r+`_open`]=yB,n[r+`_close`]=yB);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var xB=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=bB(e,n)}parse(e,t={}){let n=new hB(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function SB(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new xB(pB,fB(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:SB(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:SB(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var CB={open:``,close:``,mixable:!0},wB=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new DB(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
|
|
155
|
+
`),e.text(t.textContent,!1),e.write(`
|
|
156
|
+
`),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,` `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order||1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
|
|
157
|
+
`);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=EB(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return TB(n.child(r),-1)},close(e,t,n,r){return TB(n.child(r-1),1)},escape:!1}});function TB(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function EB(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var DB=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
|
|
158
|
+
`),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
|
|
159
|
+
`}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=CB}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
|
|
160
|
+
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
|
|
161
|
+
`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
|
|
162
|
+
`)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-(l?1:0);outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},OB=l(o(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),kB=Object.defineProperty,AB=(e,t,n)=>t in e?kB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jB=(e,t,n)=>(AB(e,typeof t==`symbol`?t:t+``,n),n),MB=ij.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),NB=fB();function PB(e,t){return NB.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new NB.inline.State(e,null,null,[]).scanDelims(t,!0)}function FB(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function IB(e,t,n,r){let i=n,a=e;for(;i<r&&!PB(a,i).can_open;)a=FB(a,t,i,1),i++;return{text:a,from:i,to:r}}function LB(e,t,n,r){let i=r,a=e;for(;i>n&&!PB(a,i).can_close;)a=FB(a,t,i,-1),i--;return{text:a,from:n,to:i}}function RB(e,t,n,r){let i={text:e,from:n,to:r};return i=IB(i.text,t,i.from,i.to),i=LB(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var zB=class extends DB{constructor(e,t,n){super(e,t,n??{}),jB(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=RB(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},BB=JA.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?VB(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?VB(t)?.[1]??``:``}},parse:{}}}}});function VB(e){let t=e.type.schema,n=t.text(` `,[e]),r=kk(q.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function HB(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function UB(e){return e?.replace(/</g,`<`).replace(/>/g,`>`)}function WB(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function GB(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var KB=Fj.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(qB(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function qB(e,t){let n=e.type.schema,r=kk(q.from(e),n);return e.isBlock&&(t instanceof q||t.type.name===n.topNodeType.name)?JB(r):r}function JB(e){let t=HB(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
|
|
163
|
+
${t.innerHTML}
|
|
164
|
+
`:`
|
|
165
|
+
`,t.outerHTML}var YB=Fj.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.blockquote,parse:{}}}}}),XB=Fj.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),ZB=Fj.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
|
|
166
|
+
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),QB=Fj.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?KB.storage.markdown.serialize.call(this,e,t,n):`\\
|
|
167
|
+
`);return}},parse:{}}}}}),$B=Fj.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.heading,parse:{}}}}}),eV=Fj.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.horizontal_rule,parse:{}}}}}),tV=Fj.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.image,parse:{}}}}}),nV=Fj.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.list_item,parse:{}}}}}),rV=Fj.create({name:`orderedList`});function iV(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var aV=rV.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=iV(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),oV=Fj.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:wB.nodes.paragraph,parse:{}}}}});function sV(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var cV=Fj.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!uV(t)){KB.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function lV(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function uV(e){let t=sV(e),n=t[0],r=t.slice(1);return!(sV(n).some(e=>e.type.name!==`tableHeader`||lV(e)||e.childCount>1)||r.some(e=>sV(e).some(e=>e.type.name===`tableHeader`||lV(e)||e.childCount>1)))}var dV=[YB,XB,ZB,QB,$B,eV,KB,tV,nV,aV,oV,cV,Fj.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),Fj.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:XB.storage.markdown.serialize,parse:{setup(e){e.use(OB.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),Fj.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(UB(t.text))},parse:{}}}}}),JA.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:wB.marks.strong,parse:{}}}}}),JA.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:wB.marks.code,parse:{}}}}}),BB,JA.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:wB.marks.em,parse:{}}}}}),JA.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:wB.marks.link,parse:{}}}}}),JA.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function fV(e){let t=e.storage?.markdown,n=dV.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var pV=class{constructor(e){jB(this,`editor`,null),this.editor=e}serialize(e){let t=new zB(this.nodes,this.marks,{hardBreakNodeName:QB.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(KB)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(BB)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=fV(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=fV(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},mV=class{constructor(e,t){jB(this,`editor`,null),jB(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(fB({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=fV(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=HB(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=fV(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&WB(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}GB(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
|
|
168
|
+
`?t:t[t.length-1]===`
|
|
169
|
+
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},hV=ij.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new AS({key:new NS(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return Db.fromSchema(this.editor.schema).parseSlice(HB(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),gV=ij.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=rj.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new mV(this.editor,this.options),serializer:new pV(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[MB.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),hV.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),_V={class:`flex flex-col h-full`},vV={key:0,class:`flex items-center gap-0.5 px-2 py-1 border-b border-border bg-surface overflow-x-auto shrink-0`},yV=Ju(F({__name:`MarkdownEditor`,props:{modelValue:{},readOnly:{type:Boolean,default:!1},placeholder:{default:`start writing...`},toolbar:{type:Boolean,default:!0}},emits:[`update:modelValue`,`save`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Bj({extensions:[nI.configure({heading:{levels:[1,2,3]}}),uF,rI,iI.configure({nested:!0}),aI.configure({placeholder:r.placeholder}),gV],editorProps:{attributes:{class:`md-editor`}},editable:!r.readOnly,content:r.modelValue,onUpdate:()=>{i(`update:modelValue`,o())}});function o(){return a.value?a.value.storage.markdown?.getMarkdown()??``:``}let s=G(()=>!a.value||o()===``),c=!1;return P(()=>r.modelValue,e=>{c||!a.value||o()!==e&&(c=!0,a.value.commands.setContent(e),c=!1)}),P(()=>r.readOnly,e=>a.value?.setEditable(!e)),ei(()=>a.value?.destroy()),t({editor:a,getMarkdown:o,isEmpty:s}),(t,n)=>(R(),z(`div`,_V,[e.toolbar&&N(a)&&!e.readOnly?(R(),z(`div`,vV,[V(`button`,{type:`button`,class:A([`md-tb`,{active:N(a).isActive(`bold`)}]),title:`bold`,onClick:n[0]||=e=>N(a).chain().focus().toggleBold().run()},` B `,2),V(`button`,{type:`button`,class:A([`md-tb italic`,{active:N(a).isActive(`italic`)}]),title:`italic`,onClick:n[1]||=e=>N(a).chain().focus().toggleItalic().run()},` I `,2),V(`button`,{type:`button`,class:A([`md-tb underline`,{active:N(a).isActive(`underline`)}]),title:`underline`,onClick:n[2]||=e=>N(a).chain().focus().toggleUnderline().run()},` U `,2),V(`button`,{type:`button`,class:A([`md-tb line-through`,{active:N(a).isActive(`strike`)}]),title:`strikethrough`,onClick:n[3]||=e=>N(a).chain().focus().toggleStrike().run()},` S `,2),n[14]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:A([`md-tb text-[10px] font-bold`,{active:N(a).isActive(`heading`,{level:1})}]),title:`heading 1`,onClick:n[4]||=e=>N(a).chain().focus().toggleHeading({level:1}).run()},` H1 `,2),V(`button`,{type:`button`,class:A([`md-tb text-[10px] font-bold`,{active:N(a).isActive(`heading`,{level:2})}]),title:`heading 2`,onClick:n[5]||=e=>N(a).chain().focus().toggleHeading({level:2}).run()},` H2 `,2),V(`button`,{type:`button`,class:A([`md-tb text-[10px] font-bold`,{active:N(a).isActive(`heading`,{level:3})}]),title:`heading 3`,onClick:n[6]||=e=>N(a).chain().focus().toggleHeading({level:3}).run()},` H3 `,2),n[15]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:A([`md-tb text-[10px]`,{active:N(a).isActive(`bulletList`)}]),title:`bullet list`,onClick:n[7]||=e=>N(a).chain().focus().toggleBulletList().run()},` ::: `,2),V(`button`,{type:`button`,class:A([`md-tb text-[10px]`,{active:N(a).isActive(`orderedList`)}]),title:`ordered list`,onClick:n[8]||=e=>N(a).chain().focus().toggleOrderedList().run()},` 1. `,2),V(`button`,{type:`button`,class:A([`md-tb text-[10px]`,{active:N(a).isActive(`taskList`)}]),title:`task list`,onClick:n[9]||=e=>N(a).chain().focus().toggleTaskList().run()},` [x] `,2),n[16]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:A([`md-tb font-mono text-[10px]`,{active:N(a).isActive(`code`)}]),title:`inline code`,onClick:n[10]||=e=>N(a).chain().focus().toggleCode().run()},` <> `,2),V(`button`,{type:`button`,class:A([`md-tb font-mono text-[10px]`,{active:N(a).isActive(`codeBlock`)}]),title:`code block`,onClick:n[11]||=e=>N(a).chain().focus().toggleCodeBlock().run()},` {..} `,2),V(`button`,{type:`button`,class:A([`md-tb text-[10px]`,{active:N(a).isActive(`blockquote`)}]),title:`blockquote`,onClick:n[12]||=e=>N(a).chain().focus().toggleBlockquote().run()},` > `,2),V(`button`,{type:`button`,class:`md-tb text-[10px]`,title:`horizontal rule`,onClick:n[13]||=e=>N(a).chain().focus().setHorizontalRule().run()},` --- `)])):W(``,!0),H(N(zj),{editor:N(a),class:`flex-1 overflow-y-auto`},null,8,[`editor`])]))}}),[[`__scopeId`,`data-v-7807112a`]]),bV={class:`flex h-full overflow-hidden`},xV={class:`flex items-center gap-1.5 px-2 py-1.5 border-b border-border`},SV={class:`flex-1 min-w-0 relative`},CV={class:`flex-1 overflow-y-auto`},wV={key:0,class:`p-3 text-center text-muted text-[11px]`},TV={class:`px-2 pt-2 pb-0.5 text-[10px] uppercase tracking-wider text-muted font-medium select-none`},EV=[`onClick`,`onContextmenu`],DV={class:`flex-1 flex flex-col min-w-0`},OV={class:`flex items-center justify-between px-3 py-1.5 border-b border-border text-[11px] text-muted`},kV={class:`flex items-center gap-1 truncate`},AV=[`title`],jV={class:`truncate font-mono`},MV={key:0,class:`flex items-center gap-2 shrink-0`},NV={key:0,class:`text-muted`},PV={key:1,class:`text-muted`},FV={key:1,class:`flex-1 flex items-center justify-center text-muted text-[12px]`},IV={id:`note-cats`},LV=[`value`],RV={class:`flex gap-2 justify-end pt-1`},zV=[`disabled`],BV={class:`text-[12px] text-text`},VV={class:`font-mono font-medium`},HV={class:`flex gap-2 justify-end`},UV={key:`notes`,label:`Notes`,icon:`lucide:notebook-pen`,color:`#F5C542`,lightColor:`#D4A017`,component:F({__name:`window`,setup(e){let{state:t,set:n}=Du(),r=M([]),i=M(t.value.activeRef||``),a=M(``),o=M(``),s=M(!1),c=M(!1),l=M(``),u=M(``),d=M(``),f=M(null),p=id(),m=M(p.value?!i.value:!0),h=G(()=>p.value?m.value:m.value||!i.value),g=G(()=>p.value?!m.value&&!!i.value:!0);P(i,e=>n({activeRef:e}));let _;function v(){clearTimeout(_),_=setTimeout(()=>E(),1e3)}function y(e){o.value=e,i.value&&v()}let b=G(()=>o.value!==a.value),x=G(()=>[...new Set(r.value.map(e=>e.category))].sort()),S=G(()=>{let e=d.value.toLowerCase().trim();return e?r.value.filter(t=>t.category.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)):r.value}),C=G(()=>{let e=new Map;for(let t of S.value){let n=e.get(t.category)||[];n.push(t),e.set(t.category,n)}return e});async function ee(){let e=await Pu(`/api/notes`);e&&(r.value=e)}async function w(e){let t=await Pu(`/api/notes/read?ref=${encodeURIComponent(e)}`);t?(a.value=t.content,o.value=t.content):(a.value=``,o.value=``)}async function T(e){clearTimeout(_),b.value&&await E();let t=`${e.category}/${e.id}`;i.value=t,p.value&&(m.value=!1),await w(t)}async function E(){!i.value||!b.value||(s.value=!0,await Nu(`/api/notes/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:i.value,content:o.value})}),a.value=o.value,s.value=!1)}let D=M(null);function te(e){let t=e||i.value||null;t&&(D.value=t)}async function ne(){let e=D.value;e&&(D.value=null,i.value===e&&(i.value=``,a.value=``,o.value=``,m.value=!0),await Nu(`/api/notes/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:e})}),await ee())}function re(){D.value=null}function ie(e,t){e.preventDefault(),f.value={x:e.clientX,y:e.clientY,entry:t}}function O(){if(!f.value)return;let e=`${f.value.entry.category}/${f.value.entry.id}`;f.value=null,te(e)}function ae(){f.value=null}let oe=M(),se=M();function ce(){c.value=!0,l.value=`notes`,u.value=``,zn(()=>se.value?.focus())}async function le(){let e=l.value.trim(),t=u.value.trim();if(!e||!t)return;let n=`${e}/${t}`;await Nu(`/api/notes/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:n,content:``})}),c.value=!1,await ee(),i.value=n,a.value=``,o.value=``}function ue(){c.value=!1}return ei(()=>{clearTimeout(_),b.value&&E()}),ld(`notes`,async()=>{await ee(),i.value&&!b.value&&await w(i.value)}),(e,t)=>(R(),z(`div`,bV,[Qn(V(`div`,{class:A([`shrink-0 border-r border-border flex flex-col bg-surface`,N(p)?`w-full`:`w-[200px]`])},[V(`div`,xV,[V(`div`,SV,[H(N(K),{icon:`lucide:search`,class:`absolute left-1.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted pointer-events-none`}),Qn(V(`input`,{"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`w-full pl-5.5 pr-1.5 py-1 bg-bg/60 rounded-lg text-[11px] text-text outline-none placeholder:text-muted focus:bg-bg transition-colors`,placeholder:`search...`},null,512),[[Hs,d.value]])]),V(`button`,{type:`button`,class:`shrink-0 w-6 h-6 flex items-center justify-center rounded-full bg-accent text-bg hover:opacity-80 active:scale-95 transition-all cursor-pointer`,title:`new note`,onClick:ce},[H(N(K),{icon:`lucide:plus`,class:`w-3.5 h-3.5`})])]),V(`div`,CV,[C.value.size===0&&!d.value?(R(),z(`div`,wV,`no notes yet`)):W(``,!0),(R(!0),z(L,null,I(C.value,([e,t])=>(R(),z(L,{key:e},[V(`div`,TV,j(e),1),(R(!0),z(L,null,I(t,e=>(R(),z(`button`,{key:e.id,type:`button`,class:A([`w-full text-left px-2 py-1.5 text-[12px] truncate transition-colors cursor-pointer rounded-none`,[N(p)&&`px-3 py-3.5`,i.value===`${e.category}/${e.id}`?`bg-accent text-bg font-medium`:`text-text hover:bg-bg`]]),onClick:t=>T(e),onContextmenu:t=>ie(t,e)},j(e.id),43,EV))),128))],64))),128))])],2),[[$o,h.value]]),Qn(V(`div`,DV,[V(`div`,OV,[V(`div`,kV,[V(`button`,{type:`button`,class:`btn-sm shrink-0 mr-0.5`,title:N(p)?`back`:`toggle list`,onClick:t[1]||=e=>m.value=!m.value},[H(N(K),{icon:N(p)?`lucide:chevron-left`:`lucide:panel-left`,class:A([`w-3.5 h-3.5`,!N(p)&&m.value?`text-text`:``])},null,8,[`icon`,`class`])],8,AV),V(`span`,jV,j(i.value||`select a note`),1)]),i.value?(R(),z(`div`,MV,[s.value?(R(),z(`span`,NV,`saving...`)):!b.value&&a.value?(R(),z(`span`,PV,`saved`)):W(``,!0),V(`button`,{type:`button`,class:`btn-sm text-muted hover:text-text`,title:`refresh`,onClick:t[2]||=e=>w(i.value)},[H(N(K),{icon:`lucide:refresh-cw`,class:`w-3 h-3`})]),V(`button`,{type:`button`,class:`btn-sm text-danger`,onClick:t[3]||=e=>te()},`delete`)])):W(``,!0)]),i.value?(R(),B(yV,{key:0,"model-value":o.value,class:`flex-1 overflow-hidden`,"onUpdate:modelValue":y},null,8,[`model-value`])):(R(),z(`div`,FV,` select or create a note to start `))],512),[[$o,g.value]]),c.value?(R(),B(Kl,{key:0,title:`new note`,width:`340px`,onClose:ue},{default:Zn(()=>[V(`form`,{class:`flex flex-col gap-2`,onSubmit:Js(le,[`prevent`])},[Qn(V(`input`,{ref_key:`newIdInput`,ref:se,"onUpdate:modelValue":t[4]||=e=>u.value=e,class:`w-full px-2 py-1.5 bg-bg border border-border rounded text-[12px] text-text font-mono outline-none placeholder:text-muted focus:border-accent`,placeholder:`note id`,onKeydown:Xs(ue,[`escape`])},null,544),[[Hs,u.value]]),Qn(V(`input`,{"onUpdate:modelValue":t[5]||=e=>l.value=e,class:`w-full px-2 py-1.5 bg-bg border border-border rounded text-[12px] text-text font-mono outline-none placeholder:text-muted focus:border-accent`,placeholder:`category`,list:`note-cats`,onKeydown:Xs(ue,[`escape`])},null,544),[[Hs,l.value]]),V(`datalist`,IV,[(R(!0),z(L,null,I(x.value,e=>(R(),z(`option`,{key:e,value:e},null,8,LV))),128))]),V(`div`,RV,[V(`button`,{type:`button`,class:`btn-ghost text-[11px]`,onClick:ue},[...t[7]||=[U(` cancel `,-1),V(`kbd`,{class:`text-[9px] text-muted ml-1`},`esc`,-1)]]),V(`button`,{type:`submit`,class:`btn-primary text-[11px]`,disabled:!l.value.trim()||!u.value.trim()},[...t[8]||=[U(` create `,-1),V(`kbd`,{class:`text-[9px] text-muted ml-1`},`⏎`,-1)]],8,zV)])],32)]),_:1})):W(``,!0),(R(),B(yr,{to:`body`},[f.value?(R(),z(`div`,{key:0,class:`fixed inset-0 z-[9999]`,onClick:ae,onContextmenu:Js(ae,[`prevent`])},[V(`div`,{class:`fixed min-w-[120px] bg-surface border border-border rounded-lg shadow-lg py-1 overflow-hidden`,style:k({left:f.value.x+`px`,top:f.value.y+`px`})},[V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[11px] flex items-center gap-2 text-danger hover:bg-bg transition-colors cursor-pointer`,onClick:Js(O,[`stop`])},[H(N(K),{icon:`lucide:trash-2`,class:`w-3 h-3`}),t[9]||=U(` delete `,-1)])],4)],32)):W(``,!0)])),D.value?(R(),B(Kl,{key:1,title:`delete note`,width:`300px`,onClose:re,onVnodeMounted:t[6]||=e=>zn(()=>oe.value?.focus())},{default:Zn(()=>[V(`div`,{class:`flex flex-col gap-3`,onKeydown:Xs(re,[`escape`])},[V(`p`,BV,[t[10]||=U(` delete `,-1),V(`span`,VV,j(D.value),1),t[11]||=U(`? `,-1)]),V(`div`,HV,[V(`button`,{type:`button`,class:`btn-ghost text-[11px]`,onClick:re},`cancel`),V(`button`,{ref_key:`deleteBtnRef`,ref:oe,type:`button`,class:`btn-primary text-[11px] !bg-danger !text-white`,onClick:ne,onKeydown:Xs(ne,[`enter`])},` delete `,544)])],32)]),_:1},512)):W(``,!0)]))}}),window:{width:720,height:520,minwidth:480,minheight:320}},WV={class:`grid gap-3 p-3`},GV={key:0,class:`border border-border p-3`},KV={class:`w-full border-collapse text-[12px]`},qV={class:`hover:bg-surface`},JV={class:`py-1.5 px-2 border-b border-border font-mono`},YV={class:`hover:bg-surface`},XV={class:`py-1.5 px-2 border-b border-border font-mono`},ZV=[`href`],QV={class:`hover:bg-surface`},$V={class:`py-1.5 px-2`},eH={key:0,class:`badge-ok`},tH={key:1,class:`text-muted`},nH={key:1,class:`border border-border p-3`},rH={key:2,class:`border border-border p-3`},iH={class:`mb-2`},aH={class:`mb-2`},oH={class:`flex gap-1.5`},sH={class:`mb-2`},cH={key:0,class:`text-[11px] text-danger mb-2`},lH=[`disabled`],uH={key:3,class:`border border-border p-3`},dH={key:0,class:`text-[11px] text-danger mb-2`},fH={key:1,class:`text-[11px] text-ok mb-2`},pH={class:`flex gap-2`},mH=[`disabled`],hH=[`disabled`],gH={key:`ntfy`,label:`Notifications`,icon:`lucide:bell-ring`,color:`#4CAF50`,component:F({__name:`window`,setup(e){let t=M(null),n=M(`https://ntfy.sh`),r=M(``),i=M(``),a=M(!1),o=M(``),s=M(``),c=G(()=>t.value?.configured??!1);async function l(){let e=await Pu(`/api/ntfy/status`);e&&(t.value=e)}async function u(){if(r.value.trim()){a.value=!0,o.value=``;try{(await Nu(`/api/ntfy/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`connect`,serverUrl:n.value.trim(),topic:r.value.trim(),token:i.value.trim()||void 0})}))?.ok&&(r.value=``,i.value=``,n.value=`https://ntfy.sh`,await l())}catch(e){o.value=e instanceof Error?e.message:`connection failed`}finally{a.value=!1}}}async function d(){a.value=!0,o.value=``;try{await Nu(`/api/ntfy/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`disconnect`})}),await l()}catch(e){o.value=e instanceof Error?e.message:`disconnect failed`}finally{a.value=!1}}async function f(){a.value=!0,o.value=``,s.value=``;try{s.value=(await Nu(`/api/ntfy/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`test`})}))?.ok?`ok`:`fail`}catch(e){s.value=`fail`,o.value=e instanceof Error?e.message:`test failed`}finally{a.value=!1}}function p(){let e=[`swift`,`calm`,`bold`,`warm`,`cool`,`keen`,`glad`,`cozy`,`wild`,`soft`],t=[`fox`,`owl`,`bee`,`elk`,`jay`,`ram`,`yak`,`ant`,`emu`,`cod`],n=[...crypto.getRandomValues(new Uint8Array(5))],i=e=>e[n.pop()%e.length],a=n.map(e=>e.toString(36)).join(``).slice(0,4);r.value=`${i(e)}-${i(t)}-${a}`}return ld(`ntfy`,l),(e,l)=>(R(),z(`div`,WV,[c.value?(R(),z(`div`,GV,[l[6]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,KV,[V(`tbody`,null,[V(`tr`,qV,[l[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`server`,-1),V(`td`,JV,j(t.value?.serverUrl),1)]),V(`tr`,YV,[l[4]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`topic`,-1),V(`td`,XV,[V(`a`,{href:`${t.value?.serverUrl}/${t.value?.topic}`,target:`_blank`,class:`text-accent hover:underline`},j(t.value?.topic),9,ZV)])]),V(`tr`,QV,[l[5]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`auth`,-1),V(`td`,$V,[t.value?.hasToken?(R(),z(`span`,eH,`token set`)):(R(),z(`span`,tH,`none`))])])])])])):W(``,!0),c.value?W(``,!0):(R(),z(`div`,nH,[...l[7]||=[V(`h3`,{class:`section-title mb-2`},`setup`,-1),V(`ol`,{class:`text-[12px] text-muted list-decimal list-inside grid gap-1.5`},[V(`li`,null,[U(` install `),V(`a`,{href:`https://ntfy.sh`,target:`_blank`,class:`text-accent hover:underline`},`ntfy`),U(` on your phone or use the web app `)]),V(`li`,null,` pick a unique topic name — treat it like a secret, anyone who knows it can read your notifications `),V(`li`,null,`subscribe to the topic in the ntfy app`),V(`li`,null,`enter the details below and connect`)],-1)]])),c.value?W(``,!0):(R(),z(`div`,rH,[l[11]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Js(u,[`prevent`])},[V(`div`,iH,[l[8]||=V(`label`,{class:`label`},`server url`,-1),Qn(V(`input`,{"onUpdate:modelValue":l[0]||=e=>n.value=e,type:`url`,placeholder:`https://ntfy.sh`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,n.value]])]),V(`div`,aH,[l[9]||=V(`label`,{class:`label`},`topic`,-1),V(`div`,oH,[Qn(V(`input`,{"onUpdate:modelValue":l[1]||=e=>r.value=e,type:`text`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,r.value]]),V(`button`,{type:`button`,class:`btn-sm shrink-0`,title:`generate random topic`,onClick:p},` random `)])]),V(`div`,sH,[l[10]||=V(`label`,{class:`label`},`token (optional)`,-1),Qn(V(`input`,{"onUpdate:modelValue":l[2]||=e=>i.value=e,type:`password`,placeholder:`tk_...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,i.value]])]),o.value?(R(),z(`div`,cH,j(o.value),1)):W(``,!0),V(`button`,{type:`submit`,disabled:a.value||!r.value.trim(),class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`},j(a.value?`saving...`:`connect`),9,lH)],32)])),c.value?(R(),z(`div`,uH,[l[12]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),o.value?(R(),z(`div`,dH,j(o.value),1)):W(``,!0),s.value===`ok`?(R(),z(`div`,fH,`test notification sent`)):W(``,!0),V(`div`,pH,[V(`button`,{type:`button`,disabled:a.value,class:`btn-primary`,onClick:f},j(a.value?`sending...`:`send test notification`),9,mH),V(`button`,{type:`button`,disabled:a.value,class:`btn-danger`,onClick:d},` disconnect `,8,hH)])])):W(``,!0)]))}}),window:{width:420,height:500,minwidth:320,minheight:200,autosize:!0}};function _H(e,t){let n;Zr(()=>{e(),n=setInterval(()=>{e()},t)}),ti(()=>{n&&=(clearInterval(n),void 0)})}var vH={class:`flex flex-col h-full`},yH={class:`grid grid-cols-3 gap-2 p-2 border-b border-border`},bH={class:`border border-border p-2`},xH={class:`text-[12px]`},SH={key:0,class:`text-[11px] text-muted`},CH={class:`text-[11px] text-muted`},wH={class:`border border-border p-2`},TH={class:`text-[12px]`},EH={class:`text-muted text-[11px] ml-1`},DH={class:`h-1 bg-surface rounded-sm overflow-hidden mt-1`},OH=[`title`],kH={class:`text-[10px] text-muted`},AH={key:1,class:`text-[12px] text-muted`},jH={class:`border border-border p-2`},MH={class:`text-[12px]`},NH={class:`text-muted text-[11px]`},PH={class:`h-1 bg-surface rounded-sm overflow-hidden mt-1`},FH={class:`text-[10px] text-muted mt-1`},IH={key:0,class:`text-[10px] text-muted`},LH={key:1,class:`text-[12px] text-muted`},RH={class:`px-3 pt-2`},zH={class:`px-3 pt-2 border-b border-border flex items-center gap-2`},BH={key:0,class:`flex flex-col flex-1 overflow-hidden`},VH={class:`overflow-y-auto flex-1`},HH={class:`w-full border-collapse text-[12px]`},UH={class:`sticky top-0 bg-bg`},WH={key:0},GH=[`onContextmenu`,`onTouchstart`],KH={class:`py-1 px-1.5 border-b border-border text-center`},qH=[`onClick`],JH={class:`py-1 px-2 border-b border-border text-muted font-mono text-[11px]`},YH=[`title`],XH={class:`py-1 px-2 border-b border-border text-muted`},ZH={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},QH={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},$H=[`title`],eU={key:1,class:`flex flex-col flex-1 overflow-hidden`},tU={class:`overflow-y-auto flex-1`},nU={class:`w-full border-collapse text-[12px]`},rU={key:0},iU=[`onContextmenu`,`onTouchstart`],aU={class:`py-1 px-1.5 border-b border-border text-center`},oU=[`onClick`],sU={class:`py-1 px-2 border-b border-border text-muted`},cU={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},lU=[`title`],uU={class:`py-1 px-2 border-b border-border text-muted font-mono text-[11px]`},dU=[`title`],fU={key:`resources`,label:`Resources`,icon:`lucide:gauge`,color:`#e5a535`,component:F({__name:`window`,setup(e){let{confirm:t}=Zu(),{menu:n,onContext:r,onTouchStart:i,cancelLongPress:a,close:o}=uu(),{menu:s,onContext:c,onTouchStart:l,cancelLongPress:u,close:d}=uu(),f=[`processes`,`ports`],{state:p,set:m}=Du(),h=M(f.includes(p.value.tab)?p.value.tab:`processes`);P(h,e=>m({tab:e}));let g=M(null),_=M([]),v=M(`cpu`),y=M([]),b=M(``),x=G(()=>{let e=b.value.toLowerCase().trim();return e?_.value.filter(t=>String(t.pid).includes(e)||t.name.toLowerCase().includes(e)||t.user.toLowerCase().includes(e)||t.command.toLowerCase().includes(e)):_.value}),S=G(()=>{let e=b.value.toLowerCase().trim();return e?y.value.filter(t=>String(t.port).includes(e)||t.protocol.toLowerCase().includes(e)||t.address.toLowerCase().includes(e)||String(t.pid).includes(e)||t.process.toLowerCase().includes(e)):y.value});async function C(){let e=await Pu(`/api/resources`);e&&(g.value=e)}async function ee(){let e=await Pu(`/api/resources/processes?sort=${v.value}&limit=50`);e&&(_.value=e)}async function w(){let e=await Pu(`/api/resources/ports`);e&&(y.value=e)}_H(async()=>{let e=h.value===`ports`?w():ee();await Promise.all([C(),e])},3e3),P(h,()=>{h.value===`ports`?w():ee()}),P(v,()=>{h.value===`processes`&&ee()});function T(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(1)} GB`}function E(e){return`${e.toFixed(1)}%`}function D(e){return e>=90?`bg-danger`:e>=80?`bg-warn`:`bg-accent`}function te(e){return e.map(e=>e.toFixed(2)).join(` / `)}async function ne(e){await t(`kill process ${e.pid} (${e.name})?`)&&(await Nu(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await ee())}async function re(e){await t(`kill process ${e.pid} (${e.process}) on port ${e.port}?`)&&(await Nu(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await w())}async function ie(){if(!n.value)return;let e=n.value.data;o(),await t(`kill process ${e.pid} (${e.name})?`)&&(await Nu(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await ee())}async function O(){if(!s.value)return;let e=s.value.data;d(),await t(`kill process ${e.pid} (${e.process}) on port ${e.port}?`)&&(await Nu(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await w())}return(e,t)=>(R(),z(`div`,vH,[V(`div`,yH,[V(`div`,bH,[t[9]||=V(`h3`,{class:`section-title mb-1`},`platform`,-1),V(`div`,xH,j(g.value?g.value.linuxDistro||g.value.os:`-`),1),g.value?.runtime?(R(),z(`div`,SH,j(g.value.runtime),1)):W(``,!0),V(`div`,CH,j(g.value?.arch??`-`),1)]),V(`div`,wH,[t[10]||=V(`h3`,{class:`section-title mb-1`},`cpu`,-1),g.value?(R(),z(L,{key:0},[V(`div`,TH,[U(j(E(g.value.cpu.usage))+` `,1),V(`span`,EH,j(g.value.cpu.count)+` cores`,1)]),V(`div`,DH,[V(`div`,{class:A([`h-full rounded-sm`,D(g.value.cpu.usage)]),style:k({width:E(g.value.cpu.usage)})},null,6)]),V(`div`,{class:`text-[10px] text-muted mt-1 truncate`,title:g.value.cpu.model},j(g.value.cpu.model),9,OH),V(`div`,kH,`load `+j(te(g.value.loadAvg)),1)],64)):(R(),z(`div`,AH,`-`))]),V(`div`,jH,[t[11]||=V(`h3`,{class:`section-title mb-1`},`memory`,-1),g.value?(R(),z(L,{key:0},[V(`div`,MH,[U(j(T(g.value.memory.used))+` `,1),V(`span`,NH,`/ `+j(T(g.value.memory.total)),1)]),V(`div`,PH,[V(`div`,{class:A([`h-full rounded-sm`,D(g.value.memory.usagePercent)]),style:k({width:E(g.value.memory.usagePercent)})},null,6)]),V(`div`,FH,` rss `+j(T(g.value.process.rss))+` · heap `+j(T(g.value.process.heapUsed))+` / `+j(T(g.value.process.heapTotal)),1),g.value.disk?(R(),z(`div`,IH,` disk `+j(T(g.value.disk.total-g.value.disk.free))+` / `+j(T(g.value.disk.total)),1)):W(``,!0)],64)):(R(),z(`div`,LH,`-`))])]),V(`div`,RH,[Qn(V(`input`,{"onUpdate:modelValue":t[0]||=e=>b.value=e,class:`w-full px-2 py-1 bg-surface border border-border rounded text-[12px] text-text outline-none placeholder:text-muted`,placeholder:`filter...`},null,512),[[Hs,b.value]])]),V(`div`,zH,[V(`button`,{type:`button`,class:A(h.value===`processes`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>h.value=`processes`},` processes `,2),V(`button`,{type:`button`,class:A(h.value===`ports`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>h.value=`ports`},` ports `,2)]),h.value===`processes`?(R(),z(`div`,BH,[V(`div`,VH,[V(`table`,HH,[V(`thead`,UH,[V(`tr`,null,[t[12]||=V(`th`,{class:`w-8 border-b border-border`},null,-1),t[13]||=V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` pid `,-1),t[14]||=V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` name `,-1),t[15]||=V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` user `,-1),V(`th`,{class:A([`text-right font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide cursor-pointer select-none`,v.value===`cpu`?`text-accent`:`text-muted`]),onClick:t[3]||=e=>v.value=`cpu`},` cpu%`+j(v.value===`cpu`?` v`:``),3),V(`th`,{class:A([`text-right font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide cursor-pointer select-none`,v.value===`ram`?`text-accent`:`text-muted`]),onClick:t[4]||=e=>v.value=`ram`},` ram`+j(v.value===`ram`?` v`:``),3),t[16]||=V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` command `,-1)])]),V(`tbody`,null,[x.value.length===0?(R(),z(`tr`,WH,[...t[17]||=[V(`td`,{colspan:`7`,class:`text-center py-8 text-muted text-[12px]`},`no processes`,-1)]])):W(``,!0),(R(!0),z(L,null,I(x.value,e=>(R(),z(`tr`,{key:e.pid,class:A(g.value&&e.pid===g.value.process.pid?`bg-accent-dim`:`hover:bg-surface`),onContextmenu:t=>N(r)(t,e),onTouchstart:t=>N(i)(t,e),onTouchend:t[5]||=(...e)=>N(a)&&N(a)(...e),onTouchmove:t[6]||=(...e)=>N(a)&&N(a)(...e)},[V(`td`,KH,[!g.value||e.pid!==g.value.process.pid?(R(),z(`button`,{key:0,type:`button`,class:`btn-sm bg-danger-dim text-danger border-danger-dim hover:bg-danger-dim`,onClick:t=>ne(e)},` x `,8,qH)):W(``,!0)]),V(`td`,JH,j(e.pid),1),V(`td`,{class:`py-1 px-2 border-b border-border max-w-[120px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.name},j(e.name),9,YH),V(`td`,XH,j(e.user),1),V(`td`,ZH,j(e.cpu.toFixed(1)),1),V(`td`,QH,j(T(e.ram*1024)),1),V(`td`,{class:`py-1 px-2 border-b border-border text-muted max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.command},j(e.command),9,$H)],42,GH))),128))])])])])):h.value===`ports`?(R(),z(`div`,eU,[V(`div`,tU,[V(`table`,nU,[t[19]||=V(`thead`,{class:`sticky top-0 bg-bg`},[V(`tr`,null,[V(`th`,{class:`w-8 border-b border-border`}),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` proto `),V(`th`,{class:`text-right text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` port `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` address `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` pid `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` process `)])],-1),V(`tbody`,null,[S.value.length===0?(R(),z(`tr`,rU,[...t[18]||=[V(`td`,{colspan:`6`,class:`text-center py-8 text-muted text-[12px]`},` no listening ports `,-1)]])):W(``,!0),(R(!0),z(L,null,I(S.value,e=>(R(),z(`tr`,{key:`${e.protocol}-${e.port}-${e.address}`,class:A(g.value&&e.pid===g.value.process.pid?`bg-accent-dim`:`hover:bg-surface`),onContextmenu:t=>N(c)(t,e),onTouchstart:t=>N(l)(t,e),onTouchend:t[7]||=(...e)=>N(u)&&N(u)(...e),onTouchmove:t[8]||=(...e)=>N(u)&&N(u)(...e)},[V(`td`,aU,[e.pid&&(!g.value||e.pid!==g.value.process.pid)?(R(),z(`button`,{key:0,type:`button`,class:`btn-sm bg-danger-dim text-danger border-danger-dim hover:bg-danger-dim`,onClick:t=>re(e)},` x `,8,oU)):W(``,!0)]),V(`td`,sU,j(e.protocol),1),V(`td`,cU,j(e.port),1),V(`td`,{class:`py-1 px-2 border-b border-border text-muted font-mono text-[11px] max-w-[120px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.address},j(e.address),9,lU),V(`td`,uU,j(e.pid||`-`),1),V(`td`,{class:`py-1 px-2 border-b border-border max-w-[150px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.process},j(e.process),9,dU)],42,iU))),128))])])])])):W(``,!0),H(Hl,{pos:N(n)&&(!g.value||N(n).data.pid!==g.value.process.pid)?N(n):null},{default:Zn(()=>[V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-danger-dim hover:text-danger`,onClick:ie},` Kill `)]),_:1},8,[`pos`]),H(Hl,{pos:N(s)&&N(s).data.pid?N(s):null},{default:Zn(()=>[V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-danger-dim hover:text-danger`,onClick:O},` Kill `)]),_:1},8,[`pos`])]))}}),window:{width:620,height:650,minwidth:380,minheight:300}},pU={class:`overflow-y-auto p-3`},mU={class:`w-full border-collapse text-[12px]`},hU={class:`py-1.5 px-2 border-b border-border text-muted whitespace-nowrap`},gU={key:0,class:`text-[10px] opacity-50 ml-1`},_U={class:`py-1.5 px-2 border-b border-border`},vU=[`onSubmit`],yU=[`onClick`],bU={class:`group-hover:text-accent`},xU={class:`py-1.5 px-2 border-b border-border`},SU={class:`py-1.5 px-2 border-b border-border text-right`},CU=[`onClick`],wU=F({__name:`ConfigTab`,setup(e){let t=M({}),n=M(null),r=M(``);async function i(){let e=await Pu(`/api/config`);e&&(t.value=e)}i();function a(e){n.value=e;let i=t.value[e]?.value;r.value=i==null?``:String(i)}function o(){n.value=null,r.value=``}async function s(e){let a=t.value[e];if(!a)return;let o=r.value;typeof a.value==`number`&&(o=Number(r.value),!Number.isFinite(o))||(r.value===``&&a.value===void 0&&(o=null),await Nu(`/api/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e,value:o})}),n.value=null,r.value=``,await i())}async function c(e){await Nu(`/api/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e,value:null})}),await i()}let l=/key|token|secret/i;function u(e){return l.test(e)}function d(e,t){if(e==null)return`-`;let n=String(e);return t&&u(t)&&n.length>0?n.length<=4?`****`:n.slice(0,2)+`*`.repeat(n.length-4)+n.slice(-2):n}return(e,i)=>(R(),z(`div`,pU,[V(`table`,mU,[i[2]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left py-1.5 px-2 border-b border-border text-muted font-normal`},`key`),V(`th`,{class:`text-left py-1.5 px-2 border-b border-border text-muted font-normal`},`value`),V(`th`,{class:`text-left py-1.5 px-2 border-b border-border text-muted font-normal`},` source `),V(`th`,{class:`w-16 border-b border-border`})])],-1),V(`tbody`,null,[(R(!0),z(L,null,I(t.value,(e,t)=>(R(),z(`tr`,{key:t,class:`hover:bg-surface`},[V(`td`,hU,[U(j(t)+` `,1),e.env?(R(),z(`span`,gU,j(e.env),1)):W(``,!0)]),V(`td`,_U,[n.value===t?(R(),z(`form`,{key:0,class:`flex gap-1`,onSubmit:Js(e=>s(t),[`prevent`])},[Qn(V(`input`,{"onUpdate:modelValue":i[0]||=e=>r.value=e,type:`text`,class:`bg-surface border border-border px-1.5 py-0.5 text-[12px] w-full min-w-0`,onKeydown:Xs(o,[`escape`])},null,544),[[Hs,r.value]]),i[1]||=V(`button`,{type:`submit`,class:`text-accent text-[11px] shrink-0`},`ok`,-1),V(`button`,{type:`button`,class:`text-muted text-[11px] shrink-0`,onClick:o},` x `)],40,vU)):(R(),z(`span`,{key:1,class:`inline-flex items-center gap-1 cursor-pointer group`,onClick:e=>a(t)},[V(`span`,bU,j(d(e.value,t)),1),H(N(K),{icon:`lucide:pencil`,class:`text-[10px] text-muted/50`})],8,yU))]),V(`td`,xU,[V(`span`,{class:A([`text-[10px] px-1 py-0.5 rounded`,{"bg-accent/20 text-accent":e.source===`db`,"bg-yellow-500/20 text-yellow-400":e.source===`env`,"text-muted":e.source===`default`}])},j(e.source),3)]),V(`td`,SU,[e.source===`db`?(R(),z(`button`,{key:0,class:`text-[10px] text-muted hover:text-red-400`,onClick:e=>c(t)},` reset `,8,CU)):W(``,!0)])]))),128))])])]))}}),TU={class:`grid gap-3 p-3`},EU={class:`border border-border p-3`},DU={class:`flex gap-2`},OU=[`onClick`],kU={class:`border border-border p-3`},AU={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},jU=[`checked`],MU={key:0,class:`ml-5 mt-1.5 grid gap-1.5`},NU={class:`flex gap-2`},PU=[`onClick`],FU={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},IU=[`checked`],LU={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text mt-1.5`},RU=[`checked`],zU=F({__name:`DashTab`,setup(e){let{settings:t,set:n}=Su(),r=[`small`,`medium`,`large`],i=[`12h`,`24h`];return(e,a)=>(R(),z(`div`,TU,[V(`div`,EU,[a[3]||=V(`h3`,{class:`section-title mb-2`},`dock size`,-1),V(`div`,DU,[(R(),z(L,null,I(r,e=>V(`button`,{key:e,type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,N(t).dockSize===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>N(n)({dockSize:e})},j(e),11,OU)),64))])]),V(`div`,kU,[a[7]||=V(`h3`,{class:`section-title mb-2`},`dock`,-1),V(`label`,AU,[V(`input`,{type:`checkbox`,checked:N(t).showClock,class:`accent-accent`,onChange:a[0]||=e=>N(n)({showClock:!N(t).showClock,showStatus:!N(t).showClock})},null,40,jU),a[4]||=U(` show clock `,-1)]),N(t).showClock?(R(),z(`div`,MU,[V(`div`,NU,[(R(),z(L,null,I(i,e=>V(`button`,{key:e,type:`button`,class:A([`px-2 py-1 text-[11px] rounded border transition-colors cursor-pointer`,N(t).clockFormat===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>N(n)({clockFormat:e})},j(e),11,PU)),64))]),V(`label`,FU,[V(`input`,{type:`checkbox`,checked:N(t).showStatus,class:`accent-accent`,onChange:a[1]||=e=>N(n)({showStatus:!N(t).showStatus})},null,40,IU),a[5]||=U(` show status indicator `,-1)])])):W(``,!0),V(`label`,LU,[V(`input`,{type:`checkbox`,checked:N(t).showFullscreen,class:`accent-accent`,onChange:a[2]||=e=>N(n)({showFullscreen:!N(t).showFullscreen})},null,40,RU),a[6]||=U(` show fullscreen button `,-1)])])]))}}),BU={class:`grid gap-3 p-3`},VU={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},HU={class:`border border-border p-3`},UU={class:`flex gap-2`},WU=[`onClick`],GU={class:`border border-border p-3`},KU={class:`flex gap-2`},qU={key:0,class:`mt-2`},JU={class:`flex gap-2`},YU={class:`border border-border p-3`},XU={class:`flex flex-wrap gap-2`},ZU=[`onClick`],QU={class:`border border-border p-3`},$U={class:`flex gap-1.5 mb-2`},eW=[`onClick`],tW={key:0,class:`text-[11px] text-muted`},nW={key:1,class:`grid grid-cols-3 gap-1.5`},rW=[`onClick`],iW=[`src`,`alt`],aW={class:`border border-border p-3`},oW={class:`flex gap-2`},sW=F({__name:`DesktopTab`,setup(e){let{settings:t,set:n}=Su(),r=s4.filter(e=>!e.hidden);function i(e){return t.pinnedApps.includes(e)}function a(e){let r=t.pinnedApps;n({pinnedApps:i(e)?r.filter(t=>t!==e):[...r,e]})}let o=[`dark`,`light`,`system`],s=G(()=>t.iconLayout),c=G(()=>t.wallpaper),l=M(c.value),u=[`general`,`anime`,`people`],d={general:`100`,anime:`010`,people:`001`},f=M(`general`);function p(e){f.value!==e&&(f.value=e,g())}let m=M([]),h=M(!1);async function g(){h.value=!0;try{m.value=(await(await fetch(`/proxy/wallhaven/search?categories=${d[f.value]}&purity=100&sorting=toplist&order=desc&ratios=16x9&per_page=6`)).json()).data.map(e=>({id:e.id,thumb:e.thumbs.small,full:e.path}))}catch{}finally{h.value=!1}}function _(e){l.value=e,n({wallpaper:e})}function v(){_(l.value.trim())}function y(){_(``)}return Zr(g),(e,d)=>(R(),z(`div`,BU,[V(`div`,VU,[V(`div`,HU,[d[4]||=V(`h3`,{class:`section-title mb-2`},`theme`,-1),V(`div`,UU,[(R(),z(L,null,I(o,e=>V(`button`,{key:e,type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,N(t).theme===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>N(n)({theme:e})},j(e),11,WU)),64))])]),V(`div`,GU,[d[6]||=V(`h3`,{class:`section-title mb-2`},`desktop icons`,-1),V(`div`,KU,[V(`button`,{type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,N(t).showDesktopIcons?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:d[0]||=e=>N(n)({showDesktopIcons:!N(t).showDesktopIcons})},j(N(t).showDesktopIcons?`visible`:`hidden`),3)]),N(t).showDesktopIcons?(R(),z(`div`,qU,[d[5]||=V(`p`,{class:`text-[11px] text-muted mb-1.5`},`icon layout`,-1),V(`div`,JU,[V(`button`,{type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,s.value===`list`?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:d[1]||=e=>N(n)({iconLayout:`list`})},` list `,2),V(`button`,{type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,s.value===`grid`?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:d[2]||=e=>N(n)({iconLayout:`grid`})},` grid `,2)])])):W(``,!0)])]),V(`div`,YU,[d[7]||=V(`h3`,{class:`section-title mb-2`},`pinned apps`,-1),d[8]||=V(`p`,{class:`text-[11px] text-muted mb-2`},` pinned apps always appear in the dash dock bar as persistent launchers. `,-1),V(`div`,XU,[(R(!0),z(L,null,I(N(r),e=>(R(),z(`button`,{key:e.key,type:`button`,class:A([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,i(e.key)?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>a(e.key)},j(e.label),11,ZU))),128))])]),V(`div`,QU,[d[9]||=V(`h3`,{class:`section-title mb-2`},[U(` wallpapers `),V(`a`,{href:`https://wallhaven.cc`,target:`_blank`,class:`text-accent hover:underline normal-case tracking-normal`},`wallhaven.cc`)],-1),V(`div`,$U,[(R(),z(L,null,I(u,e=>V(`button`,{key:e,type:`button`,class:A([`px-2 py-1 text-[10px] uppercase tracking-wider rounded border transition-colors cursor-pointer`,f.value===e?`border-accent text-accent bg-accent-dim`:`border-border text-muted hover:border-muted`]),onClick:t=>p(e)},j(e),11,eW)),64))]),h.value?(R(),z(`div`,tW,`loading...`)):(R(),z(`div`,nW,[(R(!0),z(L,null,I(m.value,e=>(R(),z(`button`,{key:e.id,type:`button`,class:A([`relative rounded border cursor-pointer overflow-hidden transition-all aspect-video`,c.value===e.full?`border-accent`:`border-border hover:border-muted`]),onClick:t=>_(e.full)},[V(`img`,{src:e.thumb,alt:`wallpaper ${e.id}`,class:`w-full h-full object-cover`,loading:`lazy`},null,8,iW)],10,rW))),128))]))]),V(`div`,aW,[d[11]||=V(`h3`,{class:`section-title mb-2`},`custom url`,-1),V(`form`,{onSubmit:Js(v,[`prevent`])},[Qn(V(`input`,{"onUpdate:modelValue":d[3]||=e=>l.value=e,type:`text`,placeholder:`https://example.com/bg.jpg`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent mb-2`},null,512),[[Hs,l.value]]),V(`div`,oW,[d[10]||=V(`button`,{type:`submit`,class:`btn-primary`},`apply`,-1),c.value?(R(),z(`button`,{key:0,type:`button`,class:`btn-danger`,onClick:y},`clear`)):W(``,!0)])],32)])]))}}),cW={class:`grid gap-3 p-3 overflow-y-auto`},lW={class:`border border-border p-3`},uW={class:`w-full border-collapse text-[12px]`},dW={class:`hover:bg-surface`},fW={class:`py-1.5 px-2 border-b border-border`},pW={class:`hover:bg-surface`},mW={class:`py-1.5 px-2 border-b border-border`},hW={class:`hover:bg-surface`},gW={class:`py-1.5 px-2 border-b border-border`},_W={key:0,class:`hover:bg-surface`},vW={class:`py-1.5 px-2`},yW={class:`border border-border p-3`},bW={class:`w-full border-collapse text-[12px]`},xW={class:`hover:bg-surface`},SW={class:`py-1.5 px-2 border-b border-border`},CW={key:0,class:`hover:bg-surface`},wW={class:`py-1.5 px-2`},TW=F({__name:`HostTab`,setup(e){let t=M(null);async function n(){let e=await Pu(`/api/status`);e&&(t.value=e)}Zr(n);function r(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(1)} GB`}let i=G(()=>{let e=t.value?.systemInfo;return!e?.totalMemory||e.freeMemory==null?null:`${r(e.totalMemory-e.freeMemory)} / ${r(e.totalMemory)}`}),a=G(()=>{let e=t.value?.systemInfo;if(!e?.os)return null;let n=e.linuxDistro||e.os;return e.arch&&(n+=` (${e.arch})`),e.isDocker&&(n+=` [docker]`),n}),o=G(()=>t.value?.systemInfo?.availableCommands?.length??null);return(e,n)=>(R(),z(`div`,cW,[V(`div`,lW,[n[4]||=V(`h3`,{class:`section-title mb-2`},`platform`,-1),V(`table`,uW,[V(`tbody`,null,[V(`tr`,dW,[n[0]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`os`,-1),V(`td`,fW,j(a.value??`-`),1)]),V(`tr`,pW,[n[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`runtime`,-1),V(`td`,mW,j(t.value?.systemInfo?.runtime??`-`),1)]),V(`tr`,hW,[n[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`os uptime`,-1),V(`td`,gW,j(t.value?.systemInfo?.uptime==null?`-`:N(Jh)(t.value.systemInfo.uptime*1e3)),1)]),o.value==null?W(``,!0):(R(),z(`tr`,_W,[n[3]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`commands`,-1),V(`td`,vW,j(o.value),1)]))])])]),V(`div`,yW,[n[7]||=V(`h3`,{class:`section-title mb-2`},`resources`,-1),V(`table`,bW,[V(`tbody`,null,[V(`tr`,xW,[n[5]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`memory`,-1),V(`td`,SW,j(i.value??`-`),1)]),t.value?.systemInfo?.availableDiskSpace==null?W(``,!0):(R(),z(`tr`,CW,[n[6]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`disk free`,-1),V(`td`,wW,j(r(t.value.systemInfo.availableDiskSpace)),1)]))])])])]))}}),EW={class:`grid gap-3 p-3 overflow-y-auto`},DW={class:`border border-border p-3`},OW={class:`w-full border-collapse text-[12px]`},kW={class:`hover:bg-surface`},AW={class:`py-1.5 px-2 border-b border-border`},jW={class:`hover:bg-surface`},MW={class:`py-1.5 px-2 border-b border-border`},NW={class:`hover:bg-surface`},PW={class:`py-1.5 px-2 border-b border-border`},FW={class:`hover:bg-surface`},IW={class:`py-1.5 px-2 border-b border-border`},LW={class:`hover:bg-surface`},RW={class:`py-1.5 px-2`},zW={class:`border border-border p-3`},BW={class:`w-full border-collapse text-[12px]`},VW={class:`hover:bg-surface`},HW={class:`py-1.5 px-2 border-b border-border`},UW={class:`hover:bg-surface`},WW={class:`py-1.5 px-2 border-b border-border`},GW={class:`hover:bg-surface`},KW={class:`py-1.5 px-2`},qW=F({__name:`ServerTab`,setup(e){let t=M(null);async function n(){let e=await Pu(`/api/status`);e&&(t.value=e)}_H(n,5e3);function r(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(1)} GB`}let i=G(()=>{let e=t.value?.systemInfo?.processMemory;return e==null?null:r(e)});return(e,n)=>(R(),z(`div`,EW,[V(`div`,DW,[n[5]||=V(`h3`,{class:`section-title mb-2`},`system`,-1),V(`table`,OW,[V(`tbody`,null,[V(`tr`,kW,[n[0]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`uptime`,-1),V(`td`,AW,j(t.value?N(Jh)(t.value.uptimeMs):`-`),1)]),V(`tr`,jW,[n[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`agents`,-1),V(`td`,MW,j(t.value?.activeAgents??`-`),1)]),V(`tr`,NW,[n[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`queue`,-1),V(`td`,PW,j(t.value?.queueSize??`-`),1)]),V(`tr`,FW,[n[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`assistant`,-1),V(`td`,IW,j(t.value?.assistantName??`-`),1)]),V(`tr`,LW,[n[4]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`memory`,-1),V(`td`,RW,j(i.value??`-`),1)])])])]),V(`div`,zW,[n[9]||=V(`h3`,{class:`section-title mb-2`},`overview`,-1),V(`table`,BW,[V(`tbody`,null,[V(`tr`,VW,[n[6]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`groups`,-1),V(`td`,HW,j(t.value?.groupCount??`-`),1)]),V(`tr`,UW,[n[7]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`chats`,-1),V(`td`,WW,j(t.value?.chatCount??`-`),1)]),V(`tr`,GW,[n[8]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`tasks`,-1),V(`td`,KW,j(t.value?.activeTaskCount??`-`),1)])])])])]))}}),JW={class:`grid gap-3 p-3`},YW={class:`border border-border p-3`},XW={class:`grid gap-2`},ZW={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},QW=[`checked`],$W={class:`flex items-center gap-2`},eG=[`value`],tG=[`value`],nG={class:`grid gap-1`},rG={class:`flex items-center gap-2`},iG=[`value`],aG={key:0,class:`flex flex-wrap gap-1 pl-14`},oG=[`title`,`onClick`],sG={class:`border border-border p-3`},cG={class:`grid gap-3`},lG={class:`grid gap-1`},uG={class:`text-[11px] text-muted`},dG=[`value`],fG={class:`grid gap-1`},pG={class:`text-[11px] text-muted`},mG=[`value`],hG={class:`grid gap-1`},gG={class:`text-[11px] text-muted`},_G=[`value`],vG=F({__name:`TtsTab`,setup(e){let{settings:t}=Su(),n=G(()=>{let e=new Set,t=[];for(let n of r.value){if(e.has(n.lang))continue;e.add(n.lang);let r=new Intl.DisplayNames([n.lang],{type:`language`}).of(n.lang)??n.lang;t.push({value:n.lang,label:`${r} (${n.lang})`})}return t.sort((e,t)=>e.label.localeCompare(t.label))}),r=M([]);function i(){r.value=speechSynthesis.getVoices()}Zr(()=>{i(),speechSynthesis.addEventListener(`voiceschanged`,i)});let a=G(()=>r.value.filter(e=>e.lang===t.tts.lang)),o=G(()=>{if(!t.tts.voiceMatch)return a.value[0]?.name;try{let e=new RegExp(t.tts.voiceMatch,`i`);return a.value.find(t=>e.test(t.name))?.name}catch{return}});function s(e){t.tts.voiceMatch=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function c(){Object.assign(t.tts,gu)}function l(){speechSynthesis.cancel();let e=new SpeechSynthesisUtterance(`This is a test of text to speech.`);e.lang=t.tts.lang,e.rate=t.tts.rate,e.pitch=t.tts.pitch,e.volume=t.tts.volume;let n=speechSynthesis.getVoices(),r=t.tts.voiceMatch?new RegExp(t.tts.voiceMatch,`i`):void 0,i=r&&n.find(e=>e.lang===t.tts.lang&&r.test(e.name))||n.find(e=>e.lang===t.tts.lang);i&&(e.voice=i),speechSynthesis.speak(e)}return(e,r)=>(R(),z(`div`,JW,[V(`div`,{class:`border border-border p-3 flex gap-2`},[V(`button`,{type:`button`,class:`btn-ghost`,onClick:l},`test voice`),V(`button`,{type:`button`,class:`btn-sm`,onClick:c},`reset defaults`)]),V(`div`,YW,[r[9]||=V(`h3`,{class:`section-title mb-2`},`voice`,-1),V(`div`,XW,[V(`label`,ZW,[V(`input`,{type:`checkbox`,checked:N(t).tts.enabled,class:`accent-accent`,onChange:r[0]||=e=>N(t).tts.enabled=!N(t).tts.enabled},null,40,QW),r[6]||=U(` enable text-to-speech `,-1)]),V(`div`,$W,[r[7]||=V(`span`,{class:`text-[11px] text-muted w-12`},`lang`,-1),V(`select`,{value:N(t).tts.lang,class:`flex-1 bg-surface border border-border rounded px-2 py-1 text-[12px] text-text`,onChange:r[1]||=e=>N(t).tts.lang=e.target.value},[(R(!0),z(L,null,I(n.value,e=>(R(),z(`option`,{key:e.value,value:e.value},j(e.label),9,tG))),128))],40,eG)]),V(`div`,nG,[V(`div`,rG,[r[8]||=V(`span`,{class:`text-[11px] text-muted w-12`},`match`,-1),V(`input`,{value:N(t).tts.voiceMatch??``,placeholder:`e.g. male|daniel`,class:`flex-1 bg-surface border border-border rounded px-2 py-1 text-[12px] text-text placeholder:text-muted`,onInput:r[2]||=e=>N(t).tts.voiceMatch=e.target.value||void 0},null,40,iG)]),a.value.length?(R(),z(`div`,aG,[(R(!0),z(L,null,I(a.value,e=>(R(),z(`button`,{key:e.name,type:`button`,class:A([`px-1.5 py-px text-[10px] rounded border cursor-pointer transition-colors`,o.value===e.name?`border-accent text-accent bg-accent-dim`:`border-border text-muted hover:text-text hover:border-muted`]),title:e.name,onClick:t=>s(e.name)},j(e.name),11,oG))),128))])):W(``,!0)])])]),V(`div`,sG,[r[10]||=V(`h3`,{class:`section-title mb-2`},`tuning`,-1),V(`div`,cG,[V(`label`,lG,[V(`span`,uG,`rate — `+j(N(t).tts.rate.toFixed(1))+`x`,1),V(`input`,{type:`range`,value:N(t).tts.rate,min:`0.5`,max:`3`,step:`0.1`,class:`accent-accent`,onInput:r[3]||=e=>N(t).tts.rate=+e.target.value},null,40,dG)]),V(`label`,fG,[V(`span`,pG,`pitch — `+j(N(t).tts.pitch.toFixed(1)),1),V(`input`,{type:`range`,value:N(t).tts.pitch,min:`0`,max:`2`,step:`0.1`,class:`accent-accent`,onInput:r[4]||=e=>N(t).tts.pitch=+e.target.value},null,40,mG)]),V(`label`,hG,[V(`span`,gG,`volume — `+j(Math.round(N(t).tts.volume*100))+`%`,1),V(`input`,{type:`range`,value:N(t).tts.volume,min:`0`,max:`1`,step:`0.05`,class:`accent-accent`,onInput:r[5]||=e=>N(t).tts.volume=+e.target.value},null,40,_G)])])])]))}}),yG={class:`flex flex-col h-full`},bG={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},xG={key:6,class:`flex-1 flex items-center justify-center p-6`},SG={key:`settings`,label:`Settings`,icon:`lucide:sliders-horizontal`,color:`#c5cdd8`,lightColor:`#6e7681`,component:F({__name:`window`,setup(e){let t=[`desktop`,`dash`,`tts`,`config`,`host`,`server`,`reset`],{state:n,set:r}=Du(),i=M(t.includes(n.value.tab)?n.value.tab:`desktop`);P(i,e=>r({tab:e}));function a(){location.href=`/reset.html`}return(e,t)=>(R(),z(`div`,yG,[V(`div`,bG,[V(`button`,{type:`button`,class:A(i.value===`desktop`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`desktop`},` desktop `,2),V(`button`,{type:`button`,class:A(i.value===`dash`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`dash`},` dash `,2),V(`button`,{type:`button`,class:A(i.value===`tts`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>i.value=`tts`},` tts `,2),V(`button`,{type:`button`,class:A(i.value===`config`?`tab-active`:`tab-inactive`),onClick:t[3]||=e=>i.value=`config`},` config `,2),V(`button`,{type:`button`,class:A(i.value===`host`?`tab-active`:`tab-inactive`),onClick:t[4]||=e=>i.value=`host`},` host `,2),V(`button`,{type:`button`,class:A(i.value===`server`?`tab-active`:`tab-inactive`),onClick:t[5]||=e=>i.value=`server`},` server `,2),V(`button`,{type:`button`,class:A(i.value===`reset`?`tab-active`:`tab-inactive`),onClick:t[6]||=e=>i.value=`reset`},` reset `,2)]),i.value===`desktop`?(R(),B(sW,{key:0})):i.value===`dash`?(R(),B(zU,{key:1})):i.value===`tts`?(R(),B(vG,{key:2})):i.value===`config`?(R(),B(wU,{key:3})):i.value===`host`?(R(),B(TW,{key:4})):i.value===`server`?(R(),B(qW,{key:5})):i.value===`reset`?(R(),z(`div`,xG,[V(`button`,{type:`button`,class:`px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded`,onClick:a},` Reset `)])):W(``,!0)]))}}),window:{width:720,height:560,minwidth:320,minheight:260}},CG={class:`flex flex-col h-full`},wG={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},TG={key:0,class:`flex-1 flex flex-col min-h-0`},EG={class:`p-3 border-b border-border`},DG={key:0,class:`text-[11px] text-muted mt-1.5`},OG={class:`flex-1 overflow-y-auto p-3`},kG={key:0,class:`text-[12px] text-muted`},AG={class:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`},jG=[`href`],MG={key:0,class:`aspect-video overflow-hidden bg-bg`},NG=[`src`],PG={key:1,class:`aspect-video overflow-hidden bg-bg`},FG=[`src`,`alt`],IG={class:`p-2.5 flex flex-col gap-1.5 flex-1`},LG={class:`flex items-start justify-between gap-2`},RG={class:`text-[12px] font-mono font-medium text-text truncate min-w-0`},zG={class:`text-[10px] text-muted shrink-0`},BG={class:`text-[11px] text-muted line-clamp-2 flex-1`},VG={class:`flex items-center justify-between gap-2 mt-auto`},HG={key:0,class:`flex flex-wrap gap-1 min-w-0`},UG={class:`text-[10px] text-muted shrink-0 ml-auto`},WG={key:0},GG={key:1},KG={key:1,class:`flex-1 flex flex-col min-h-0`},qG={class:`p-3 border-b border-border`},JG={class:`flex-1 overflow-y-auto p-3`},YG={key:0,class:`text-[12px] text-muted`},XG={class:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`},ZG=[`href`],QG={class:`text-[12px] font-mono font-medium text-text truncate`},$G={class:`text-[11px] text-muted flex-1`},eK={class:`text-[10px] text-muted`},tK={key:`store`,label:`Store`,icon:`lucide:store`,color:`#8b5cf6`,component:F({__name:`window`,setup(e){function t(e,t,n=300){let r;P(e,()=>{clearTimeout(r),r=setTimeout(t,n)})}let n=[`plugins`,`skills`],{state:r,set:i}=Du(),a=M(n.includes(r.value.tab)?r.value.tab:`plugins`);P(a,e=>i({tab:e}));let o=M(``),s=M([]),c=M(0),l=M(!1);async function u(){l.value=!0;try{let e=new URLSearchParams;o.value.trim()&&e.set(`q`,o.value.trim());let t=await Pu(`/api/store/plugins?${e}`);t&&(s.value=t.plugins,c.value=t.total)}finally{l.value=!1}}let d=M(``),f=M([]),p=M(!1);async function m(){p.value=!0;try{let e=new URLSearchParams;d.value.trim()&&e.set(`q`,d.value.trim());let t=await Pu(`/api/store/skills?${e}`);t&&(f.value=t.skills)}finally{p.value=!1}}function h(e){return e?`/api/proxy?url=${encodeURIComponent(e)}`:null}function g(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}return t(()=>o.value,u),t(()=>d.value,m),P(a,e=>{e===`plugins`&&!s.value.length&&!l.value&&u(),e===`skills`&&!f.value.length&&!p.value&&m()},{immediate:!0}),(e,t)=>(R(),z(`div`,CG,[V(`div`,wG,[V(`button`,{type:`button`,class:A(a.value===`plugins`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>a.value=`plugins`},` plugins `,2),V(`button`,{type:`button`,class:A(a.value===`skills`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>a.value=`skills`},` skills `,2)]),a.value===`plugins`?(R(),z(`div`,TG,[V(`div`,EG,[Qn(V(`input`,{"onUpdate:modelValue":t[2]||=e=>o.value=e,type:`text`,placeholder:`search pi plugins...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onKeydown:t[3]||=Xs(e=>u(),[`enter`])},null,544),[[Hs,o.value]]),c.value?(R(),z(`div`,DG,j(c.value)+` packages `,1)):W(``,!0)]),V(`div`,OG,[l.value&&!s.value.length?(R(),z(`div`,kG,` loading... `)):W(``,!0),V(`div`,AG,[(R(!0),z(L,null,I(s.value,e=>(R(),z(`a`,{key:e.name,href:e.links.npm||e.links.homepage||`https://www.npmjs.com/package/${e.name}`,target:`_blank`,class:`border border-border rounded-lg bg-surface hover:border-accent transition-colors flex flex-col overflow-hidden`},[e.video?(R(),z(`div`,MG,[V(`video`,{src:h(e.video),controls:``,muted:``,playsinline:``,preload:`metadata`,class:`w-full h-full object-cover`},null,8,NG)])):e.image?(R(),z(`div`,PG,[V(`img`,{src:h(e.image),alt:e.name,loading:`lazy`,class:`w-full h-full object-cover`},null,8,FG)])):W(``,!0),V(`div`,IG,[V(`div`,LG,[V(`div`,RG,j(e.name),1),V(`div`,zG,`v`+j(e.version),1)]),V(`div`,BG,j(e.description),1),V(`div`,VG,[e.piLabels?.length?(R(),z(`div`,HG,[(R(!0),z(L,null,I(e.piLabels,e=>(R(),z(`span`,{key:e,class:`text-[10px] px-1.5 py-0.5 rounded bg-bg text-accent`},j(e),1))),128))])):W(``,!0),V(`div`,UG,[e.downloads?.weekly?(R(),z(`span`,WG,j(g(e.downloads.weekly))+`/wk`,1)):W(``,!0),e.author?(R(),z(`span`,GG,` · `+j(e.author),1)):W(``,!0)])])])],8,jG))),128))])])])):W(``,!0),a.value===`skills`?(R(),z(`div`,KG,[V(`div`,qG,[Qn(V(`input`,{"onUpdate:modelValue":t[4]||=e=>d.value=e,type:`text`,placeholder:`search skills...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onKeydown:t[5]||=Xs(e=>m(),[`enter`])},null,544),[[Hs,d.value]])]),V(`div`,JG,[p.value&&!f.value.length?(R(),z(`div`,YG,`loading...`)):W(``,!0),V(`div`,XG,[(R(!0),z(L,null,I(f.value,e=>(R(),z(`a`,{key:e.id,href:`https://skills.sh/${e.id}`,target:`_blank`,class:`border border-border rounded-lg bg-surface p-2.5 hover:border-accent transition-colors flex flex-col gap-1.5`},[V(`div`,QG,j(e.name),1),V(`div`,$G,j(e.source),1),V(`div`,eK,j(g(e.installs))+` installs`,1)],8,ZG))),128))])])])):W(``,!0)]))}}),window:{width:640,height:600,minwidth:380,minheight:320}},nK={class:`p-3`},rK={class:`flex gap-2 items-center mb-2`},iK={class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},aK={class:`mb-2`},oK={class:`mb-2`},sK={class:`mb-2`},cK={class:`mb-2`},lK={class:`mb-2`},uK={class:`w-full border-collapse text-[12px]`},dK={key:0},fK=[`title`],pK={class:`py-1.5 px-2 border-b border-border text-muted`},mK={class:`py-1.5 px-2 border-b border-border text-muted`},hK={class:`py-1.5 px-2 border-b border-border`},gK={class:`py-1.5 px-2 border-b border-border text-muted`},_K=[`title`],vK={class:`py-1.5 px-2 border-b border-border`},yK=[`onClick`],bK=[`onClick`],xK={key:`tasks`,label:`Tasks`,icon:`lucide:list-checks`,color:`#d29922`,component:F({__name:`window`,setup(e){let{alert:t}=Zu(),n=M([]),r=M(!1),i=M(``),a=M(`cron`),o=M(``),s=M(`group`),c=M(``);async function l(){n.value=await Pu(`/api/tasks`)??[]}function u(){r.value=!1,i.value=``,a.value=`cron`,o.value=``,s.value=`group`,c.value=``}async function d(){if(!i.value.trim()||!o.value.trim()||!c.value.trim()){await t(`jid, schedule, and prompt are required`);return}await Nu(`/api/tasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({chatJid:i.value.trim(),scheduleType:a.value,scheduleValue:o.value.trim(),contextMode:s.value,prompt:c.value.trim()})}),u(),await l()}async function f(e,t){await Nu(`/api/tasks/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})}),await l()}return ld(`tasks`,l),(e,t)=>(R(),z(`div`,nK,[V(`div`,rK,[t[6]||=V(`h3`,{class:`section-title`},`tasks`,-1),V(`button`,{type:`button`,class:`ml-auto btn-primary`,onClick:t[0]||=e=>r.value=!0},`+ new task`)]),r.value?(R(),B(Kl,{key:0,title:`new task`,width:`520px`,onClose:u},{default:Zn(()=>[V(`form`,{onSubmit:Js(d,[`prevent`]),onKeydown:Xs(u,[`escape`])},[V(`div`,iK,[V(`div`,aK,[t[7]||=V(`label`,{class:`label`},`chat jid`,-1),Qn(V(`input`,{"onUpdate:modelValue":t[1]||=e=>i.value=e,placeholder:`xxxx@g.us`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,i.value]])]),V(`div`,oK,[t[9]||=V(`label`,{class:`label`},`schedule type`,-1),Qn(V(`select`,{"onUpdate:modelValue":t[2]||=e=>a.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[...t[8]||=[V(`option`,{value:`cron`},`cron`,-1),V(`option`,{value:`interval`},`interval`,-1),V(`option`,{value:`once`},`once`,-1)]],512),[[Us,a.value]])]),V(`div`,sK,[t[10]||=V(`label`,{class:`label`},`schedule value`,-1),Qn(V(`input`,{"onUpdate:modelValue":t[3]||=e=>o.value=e,placeholder:`*/5 * * * * or 300000`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,o.value]])]),V(`div`,cK,[t[12]||=V(`label`,{class:`label`},`context`,-1),Qn(V(`select`,{"onUpdate:modelValue":t[4]||=e=>s.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[...t[11]||=[V(`option`,{value:`group`},`group (shared)`,-1),V(`option`,{value:`isolated`},`isolated`,-1)]],512),[[Us,s.value]])])]),V(`div`,lK,[t[13]||=V(`label`,{class:`label`},`prompt`,-1),Qn(V(`textarea`,{"onUpdate:modelValue":t[5]||=e=>c.value=e,placeholder:`what should the agent do?`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent resize-y min-h-[60px]`},null,512),[[Hs,c.value]])]),V(`div`,{class:`flex gap-2 items-center`},[t[15]||=V(`button`,{type:`submit`,class:`btn-primary`},[U(` create `),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`)],-1),V(`button`,{type:`button`,class:`btn-ghost`,onClick:u},[...t[14]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],32)]),_:1})):W(``,!0),V(`table`,uK,[t[17]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` prompt `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` type `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` value `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` status `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` next run `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` last result `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`})])],-1),V(`tbody`,null,[n.value.length===0?(R(),z(`tr`,dK,[...t[16]||=[V(`td`,{colspan:`7`,class:`text-center py-8 text-muted text-[12px]`},`no scheduled tasks`,-1)]])):W(``,!0),(R(!0),z(L,null,I(n.value,e=>(R(),z(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,{class:`py-1.5 px-2 border-b border-border max-w-[250px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.prompt},j(e.prompt.slice(0,60)),9,fK),V(`td`,pK,j(e.schedule_type),1),V(`td`,mK,j(e.schedule_value),1),V(`td`,hK,[V(`span`,{class:A(N(Xh)(e.status))},j(e.status),3)]),V(`td`,gK,j(N(qh)(e.next_run)),1),V(`td`,{class:`py-1.5 px-2 border-b border-border max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap text-muted`,title:e.last_result||``},j(e.last_result||`-`),9,_K),V(`td`,vK,[e.status===`active`?(R(),z(`button`,{key:0,type:`button`,class:`btn-sm bg-warn-dim text-warn border-warn-dim hover:bg-warn-dim`,onClick:t=>f(e.id,`paused`)},` pause `,8,yK)):e.status===`paused`?(R(),z(`button`,{key:1,type:`button`,class:`btn-sm bg-ok-dim text-ok border-ok-dim hover:bg-ok-dim`,onClick:t=>f(e.id,`active`)},` resume `,8,bK)):W(``,!0)])]))),128))])])]))}}),window:{width:900,height:420,minwidth:420,minheight:240}},SK={class:`grid gap-3 p-3`},CK={key:0,class:`border border-border p-3`},wK={class:`w-full border-collapse text-[12px]`},TK={key:0,class:`hover:bg-surface`},EK={class:`py-1.5 px-2 border-b border-border font-mono`},DK=[`href`],OK={class:`hover:bg-surface`},kK={class:`py-1.5 px-2`},AK={key:0,class:`text-muted`},jK={key:1,class:`text-muted`},MK={key:1,class:`border border-border p-3`},NK={key:2,class:`border border-border p-3`},PK={key:0,class:`text-[11px] text-danger mb-2`},FK=[`disabled`],IK={key:3,class:`border border-border p-3`},LK={class:`mb-2`},RK={key:0,class:`text-[11px] text-danger mb-2`},zK=[`disabled`],BK={key:4,class:`border border-border p-3`},VK=[`disabled`],HK={key:`telegram`,label:`Telegram`,icon:`simple-icons:telegram`,color:`#2AABEE`,component:F({__name:`window`,setup(e){let t=M(null),n=M(``),r=M(!1),i=M(``),a=G(()=>t.value?.connected??!1);async function o(){let e=await Pu(`/api/telegram/status`);e&&(t.value=e)}async function s(){if(n.value.trim()){r.value=!0,i.value=``;try{(await Nu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`connect`,botToken:n.value.trim()})}))?.ok&&(n.value=``,await o())}catch(e){i.value=e instanceof Error?e.message:`connection failed`}finally{r.value=!1}}}async function c(){r.value=!0,i.value=``;try{await Nu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`disconnect`})}),await o()}catch(e){i.value=e instanceof Error?e.message:`disconnect failed`}finally{r.value=!1}}let l=G(()=>!a.value&&(t.value?.configured||t.value?.hasEnvToken));async function u(){r.value=!0,i.value=``;try{await Nu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`reconnect`})}),await o()}catch(e){i.value=e instanceof Error?e.message:`reconnect failed`}finally{r.value=!1}}return ld(`telegram`,o),(e,o)=>(R(),z(`div`,SK,[a.value?(R(),z(`div`,CK,[o[4]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,wK,[V(`tbody`,null,[o[3]||=V(`tr`,{class:`hover:bg-surface`},[V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`connection`),V(`td`,{class:`py-1.5 px-2 border-b border-border`},[V(`span`,{class:`badge-ok`},`connected`)])],-1),t.value?.botUsername?(R(),z(`tr`,TK,[o[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`bot`,-1),V(`td`,EK,[V(`a`,{href:`https://t.me/${t.value.botUsername}?start=help`,target:`_blank`,class:`text-accent hover:underline`},`@`+j(t.value.botUsername),9,DK)])])):W(``,!0),V(`tr`,OK,[o[2]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`source`,-1),V(`td`,kK,[t.value?.hasEnvToken?(R(),z(`span`,AK,`env`)):t.value?.configured?(R(),z(`span`,jK,`saved`)):W(``,!0)])])])])])):W(``,!0),!a.value&&!l.value?(R(),z(`div`,MK,[...o[5]||=[V(`h3`,{class:`section-title mb-2`},`setup`,-1),V(`ol`,{class:`text-[12px] text-muted list-decimal list-inside grid gap-1.5`},[V(`li`,null,[U(` Open `),V(`a`,{href:`https://t.me/BotFather`,target:`_blank`,class:`text-accent hover:underline`},`@BotFather`),U(` on Telegram `)]),V(`li`,null,[U(`Send `),V(`span`,{class:`font-mono text-text`},`/newbot`),U(` and follow the prompts`)]),V(`li`,null,`Copy the bot token and paste it below`)],-1)]])):W(``,!0),l.value?(R(),z(`div`,NK,[o[6]||=V(`h3`,{class:`section-title mb-2`},`reconnect`,-1),o[7]||=V(`p`,{class:`text-[11px] text-muted mb-2`},[U(` Bot is configured but not connected. If you see 409 errors, another instance may be polling the same token or a webhook is set. Use `),V(`span`,{class:`font-mono text-text`},`deleteWebhook`),U(` via Bot API to clear it. `)],-1),i.value?(R(),z(`div`,PK,j(i.value),1)):W(``,!0),V(`button`,{type:`button`,disabled:r.value,class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:u},j(r.value?`reconnecting...`:`reconnect`),9,FK)])):W(``,!0),!a.value&&!l.value?(R(),z(`div`,IK,[o[9]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Js(s,[`prevent`])},[V(`div`,LK,[o[8]||=V(`label`,{class:`label`},`bot token`,-1),Qn(V(`input`,{"onUpdate:modelValue":o[0]||=e=>n.value=e,type:`password`,placeholder:`123456:ABC-DEF...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,n.value]])]),i.value?(R(),z(`div`,RK,j(i.value),1)):W(``,!0),V(`button`,{type:`submit`,disabled:r.value||!n.value.trim(),class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`},j(r.value?`connecting...`:`connect`),9,zK)],32)])):W(``,!0),a.value||l.value?(R(),z(`div`,BK,[o[10]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),V(`button`,{type:`button`,disabled:r.value,class:`btn-danger`,onClick:c},` disconnect `,8,VK)])):W(``,!0)]))}}),window:{width:420,height:420,minwidth:320,minheight:200,autosize:!0}},UK=Object.defineProperty,WK=Object.getOwnPropertyDescriptor,GK=(e,t)=>{for(var n in t)UK(e,n,{get:t[n],enumerable:!0})},KK=(e,t,n,r)=>{for(var i=r>1?void 0:r?WK(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&UK(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),qK=`Terminal input`,JK={get:()=>qK,set:e=>qK=e},YK=`Too much output to announce, navigate to rows manually to read`,XK={get:()=>YK,set:e=>YK=e};function ZK(e){return e.replace(/\r?\n/g,`\r`)}function QK(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function $K(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function eq(e,t,n,r){e.stopPropagation(),e.clipboardData&&tq(e.clipboardData.getData(`text/plain`),t,n,r)}function tq(e,t,n,r){e=ZK(e),e=QK(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function nq(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function rq(e,t,n,r,i){nq(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function iq(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function aq(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var oq=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},sq=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},cq=``,lq=` `,uq=class e{constructor(){this.fg=0,this.bg=0,this.extended=new dq}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},dq=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fq=class e extends uq{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new dq,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?iq(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pq=`di$target`,mq=`di$dependencies`,hq=new Map;function gq(e){return e[mq]||[]}function _q(e){if(hq.has(e))return hq.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);vq(t,e,r)};return t._id=e,hq.set(e,t),t}function vq(e,t,n){t[pq]===t?t[mq].push({id:e,index:n}):(t[mq]=[{id:e,index:n}],t[pq]=t)}var yq=_q(`BufferService`),bq=_q(`CoreMouseService`),xq=_q(`CoreService`),Sq=_q(`CharsetService`),Cq=_q(`InstantiationService`),wq=_q(`LogService`),Tq=_q(`OptionsService`),Eq=_q(`OscLinkService`),Dq=_q(`UnicodeService`),Oq=_q(`DecorationService`),kq=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new fq,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+(!l&&t===o-1?1:0),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Aq(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};kq=KK([Z(0,yq),Z(1,Tq),Z(2,Eq)],kq);function Aq(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
170
|
+
|
|
171
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var jq=_q(`CharSizeService`),Mq=_q(`CoreBrowserService`),Nq=_q(`MouseService`),Pq=_q(`RenderService`),Fq=_q(`SelectionService`),Iq=_q(`CharacterJoinerService`),Lq=_q(`ThemeService`),Rq=_q(`LinkProviderService`),zq=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Gq.isErrorNoTelemetry(e)?new Gq(e.message+`
|
|
172
|
+
|
|
173
|
+
`+e.stack):Error(e.message+`
|
|
174
|
+
|
|
175
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Bq(e){Hq(e)||zq.onUnexpectedError(e)}var Vq=`Canceled`;function Hq(e){return e instanceof Uq?!0:e instanceof Error&&e.name===Vq&&e.message===Vq}var Uq=class extends Error{constructor(){super(Vq),this.name=this.message}};function Wq(e){return e?Error(`Illegal argument: ${e}`):Error(`Illegal argument`)}var Gq=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Kq=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function qq(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var Jq=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=qq(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Jq.assertInvariants=!1;function Yq(e,t=0){return e[e.length-(1+t)]}var Xq;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Xq||={});function Zq(e,t){return(n,r)=>t(e(n),e(r))}var Qq=(e,t)=>e-t,$q=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Xq.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};$q.empty=new $q(e=>{});function eJ(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var tJ=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function nJ(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var rJ;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(rJ||={});var iJ=!1,aJ=null,oJ=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
176
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new tJ;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
177
|
+
`),e)}n.sort(Zq(e=>e.idx,Qq));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
178
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=eJ([...i.get(e.slice(0,t).join(`
|
|
179
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
183
|
+
${s.join(`
|
|
184
|
+
`)}
|
|
185
|
+
============================================================
|
|
186
|
+
|
|
187
|
+
`}return n.length>e&&(a+=`
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
... and ${n.length-e} more leaking disposables
|
|
191
|
+
|
|
192
|
+
`),{leaks:n,details:a}}};oJ.idx=0;function sJ(e){aJ=e}if(iJ){let e=`__is_disposable_tracked__`;sJ(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==vJ.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==vJ.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function cJ(e){return aJ?.trackDisposable(e),e}function lJ(e){aJ?.markAsDisposed(e)}function uJ(e,t){aJ?.setParent(e,t)}function dJ(e,t){if(aJ)for(let n of e)aJ.setParent(n,t)}function fJ(e){return aJ?.markAsSingleton(e),e}function pJ(e){if(rJ.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function mJ(...e){let t=hJ(()=>pJ(e));return dJ(e,t),t}function hJ(e){let t=cJ({dispose:nJ(()=>{lJ(t),e()})});return t}var gJ=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,cJ(this)}dispose(){this._isDisposed||(lJ(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pJ(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return uJ(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),uJ(e,null))}};gJ.DISABLE_DISPOSED_WARNING=!1;var _J=gJ,vJ=class{constructor(){this._store=new _J,cJ(this),uJ(this._store,this)}dispose(){lJ(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};vJ.None=Object.freeze({dispose(){}});var yJ=class{constructor(){this._isDisposed=!1,cJ(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&uJ(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,lJ(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&uJ(e,null),e}},bJ=typeof window==`object`?window:globalThis,xJ=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};xJ.Undefined=new xJ(void 0);var SJ=xJ,CJ=class{constructor(){this._first=SJ.Undefined,this._last=SJ.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===SJ.Undefined}clear(){let e=this._first;for(;e!==SJ.Undefined;){let t=e.next;e.prev=SJ.Undefined,e.next=SJ.Undefined,e=t}this._first=SJ.Undefined,this._last=SJ.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new SJ(e);if(this._first===SJ.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==SJ.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==SJ.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==SJ.Undefined&&e.next!==SJ.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===SJ.Undefined&&e.next===SJ.Undefined?(this._first=SJ.Undefined,this._last=SJ.Undefined):e.next===SJ.Undefined?(this._last=this._last.prev,this._last.next=SJ.Undefined):e.prev===SJ.Undefined&&(this._first=this._first.next,this._first.prev=SJ.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==SJ.Undefined;)yield e.element,e=e.next}},wJ=globalThis.performance&&typeof globalThis.performance.now==`function`,TJ=class e{static create(t){return new e(t)}constructor(e){this._now=wJ&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},EJ=!1,DJ=!1,OJ=!1,kJ;(e=>{e.None=()=>vJ.None;function t(e){if(OJ){let{onDidAddListener:t}=e,n=FJ.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(mJ(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Q(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Q(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new Q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function ee(e,t){return e(e=>t.fire(e))}e.forward=ee;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Q(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof _J?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(kJ||={});var AJ=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new TJ,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};AJ.all=new Set,AJ._idPool=0;var jJ=AJ,MJ=-1,NJ=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new IJ(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};NJ._idPool=1;var PJ=NJ,FJ=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
193
|
+
`).slice(2).join(`
|
|
194
|
+
`))}},IJ=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},LJ=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},RJ=0,zJ=class{constructor(e){this.value=e,this.id=RJ++}},BJ=2,VJ=(e,t)=>{if(e instanceof zJ)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},HJ;if(EJ){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
195
|
+
`)),e.length=0)},3e3),HJ=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=MJ>0||this._options?.leakWarningThreshold?new PJ(e?.onListenerError??Bq,this._options?.leakWarningThreshold??MJ):void 0,this._perfMon=this._options?._profName?new jJ(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(DJ){let e=this._listeners;queueMicrotask(()=>{VJ(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new LJ(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Bq)(n),vJ.None}if(this._disposed)return vJ.None;t&&(e=e.bind(t));let r=new zJ(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=FJ.create(),i=this._leakageMon.check(r.stack,this._size+1)),DJ&&(r.stack=FJ.create()),this._listeners?this._listeners instanceof zJ?(this._deliveryQueue??=new UJ,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=hJ(()=>{HJ?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof _J?n.add(a):Array.isArray(n)&&n.push(a),HJ){let e=Error().stack.split(`
|
|
196
|
+
`).slice(2,3).join(`
|
|
197
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);HJ.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*BJ<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Bq;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof zJ)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},UJ=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},WJ=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};WJ.INSTANCE=new WJ;var GJ=WJ;function KJ(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}GJ.INSTANCE.onDidChangeZoomLevel;function qJ(e){return GJ.INSTANCE.getZoomFactor(e)}GJ.INSTANCE.onDidChangeFullscreen;var JJ=typeof navigator==`object`?navigator.userAgent:``,YJ=JJ.indexOf(`Firefox`)>=0,XJ=JJ.indexOf(`AppleWebKit`)>=0,ZJ=JJ.indexOf(`Chrome`)>=0,QJ=!ZJ&&JJ.indexOf(`Safari`)>=0;JJ.indexOf(`Electron/`),JJ.indexOf(`Android`);var $J=!1;if(typeof bJ.matchMedia==`function`){let e=bJ.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=bJ.matchMedia(`(display-mode: fullscreen)`);$J=e.matches,KJ(bJ,e,({matches:e})=>{$J&&t.matches||($J=e)})}function eY(){return $J}var tY=`en`,nY=!1,rY=!1,iY=!1,aY=!1,oY=!1,sY=tY,cY,lY=globalThis,uY;typeof lY.vscode<`u`&&typeof lY.vscode.process<`u`?uY=lY.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(uY=process);var dY=typeof uY?.versions?.electron==`string`&&uY?.type===`renderer`;if(typeof uY==`object`){nY=uY.platform===`win32`,rY=uY.platform===`darwin`,iY=uY.platform===`linux`,iY&&uY.env.SNAP&&uY.env.SNAP_REVISION,uY.env.CI||uY.env.BUILD_ARTIFACTSTAGINGDIRECTORY,sY=tY;let e=uY.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,sY=t.resolvedLanguage||tY,t.languagePack?.translationsConfigFile}catch{}aY=!0}else typeof navigator==`object`&&!dY?(cY=navigator.userAgent,nY=cY.indexOf(`Windows`)>=0,rY=cY.indexOf(`Macintosh`)>=0,(cY.indexOf(`Macintosh`)>=0||cY.indexOf(`iPad`)>=0||cY.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,iY=cY.indexOf(`Linux`)>=0,cY?.indexOf(`Mobi`),oY=!0,sY=globalThis._VSCODE_NLS_LANGUAGE||tY,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var fY=nY,pY=rY,mY=iY,hY=aY;oY&&typeof lY.importScripts==`function`&&lY.origin;var gY=cY,_Y=sY,vY;(e=>{function t(){return _Y}e.value=t;function n(){return _Y.length===2?_Y===`en`:_Y.length>=3?_Y[0]===`e`&&_Y[1]===`n`&&_Y[2]===`-`:!1}e.isDefaultVariant=n;function r(){return _Y===`en`}e.isDefault=r})(vY||={});var yY=typeof lY.postMessage==`function`&&!lY.importScripts;(()=>{if(yY){let e=[];lY.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),lY.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var bY=!!(gY&&gY.indexOf(`Chrome`)>=0);gY&&gY.indexOf(`Firefox`),!bY&&gY&&gY.indexOf(`Safari`),gY&&gY.indexOf(`Edg/`),gY&&gY.indexOf(`Android`);var xY=typeof navigator==`object`?navigator:{};hY||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||xY&&xY.clipboard&&xY.clipboard.writeText,hY||xY&&xY.clipboard&&xY.clipboard.readText,hY||eY()||xY.keyboard,`ontouchstart`in bJ||xY.maxTouchPoints,bJ.PointerEvent&&(`ontouchstart`in bJ||navigator.maxTouchPoints);var SY=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},CY=new SY,wY=new SY,TY=new SY,EY=Array(230),DY;(e=>{function t(e){return CY.keyCodeToStr(e)}e.toString=t;function n(e){return CY.strToKeyCode(e)}e.fromString=n;function r(e){return wY.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return TY.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return wY.strToKeyCode(e)||TY.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return CY.keyCodeToStr(e)}e.toElectronAccelerator=o})(DY||={});var OY=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new kY([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},kY=class{constructor(e){if(e.length===0)throw Wq(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function AY(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return DY.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(YJ)switch(t){case 59:return 85;case 60:if(mY)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pY)return 57;break}else if(XJ&&(pY&&t===93||!pY&&t===92))return 57;return EY[t]||0}var jY=pY?256:2048,MY=512,NY=1024,PY=pY?2048:256,FY=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=AY(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=jY),this.altKey&&(t|=MY),this.shiftKey&&(t|=NY),this.metaKey&&(t|=PY),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new OY(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},IY=new WeakMap;function LY(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var RY=class{static getSameOriginWindowChain(e){let t=IY.get(e);if(!t){t=[],IY.set(e,t);let n=e,r;do r=LY(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},zY=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=RY.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},BY=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(ZJ){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?YJ&&!pY?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)QJ&&fY?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?YJ&&!pY?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},VY=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),HY;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof UY?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kJ.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:VY})})(HY||={});var UY=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?VY:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},WY=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Kq(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Kq(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},GY=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Kq(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=hJ(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var KY;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(KY||={});var qY=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await kJ.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};qY.EMPTY=qY.fromArray([]);function JY(e){return 55296<=e&&e<=56319}function YY(e){return 56320<=e&&e<=57343}function XY(e,t){return(e-55296<<10)+(t-56320)+65536}function ZY(e){return QY(e,0)}function QY(e,t){switch(typeof e){case`object`:return e===null?$Y(349,t):Array.isArray(e)?nX(e,t):rX(e,t);case`string`:return tX(e,t);case`boolean`:return eX(e,t);case`number`:return $Y(e,t);case`undefined`:return $Y(937,t);default:return $Y(617,t)}}function $Y(e,t){return(t<<5)-t+e|0}function eX(e,t){return $Y(e?433:863,t)}function tX(e,t){t=$Y(149417,t);for(let n=0,r=e.length;n<r;n++)t=$Y(e.charCodeAt(n),t);return t}function nX(e,t){return t=$Y(104579,t),e.reduce((e,t)=>QY(t,e),t)}function rX(e,t){return t=$Y(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=tX(n,t),QY(e[n],t)),t)}function iX(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function aX(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function oX(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function sX(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):oX((e>>>0).toString(16),t/4)}var cX=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(JY(a))if(o+1<t){let t=e.charCodeAt(o+1);YY(t)?(o++,s=XY(a,t)):s=65533}else{i=a;break}else YY(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),sX(this._h0)+sX(this._h1)+sX(this._h2)+sX(this._h3)+sX(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,aX(this._buff,this._buffLen),this._buffLen>56&&(this._step(),aX(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,iX(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=iX(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=iX(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};cX._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:lX,getWindow:uX,getDocument:dX,getWindows:fX,getWindowsCount:pX,getWindowId:mX,getWindowById:hX,hasWindow:gX,onDidRegisterWindow:_X,onWillUnregisterWindow:vX,onDidUnregisterWindow:yX}=function(){let e=new Map,t={window:bJ,disposables:new _J};e.set(bJ.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return vJ.None;let a=new _J,o={window:t,disposables:a.add(new _J)};return e.set(t.vscodeWindowId,o),a.add(hJ(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(xX(t,AX.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:bJ},getDocument(e){return uX(e).document}}}(),bX=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function xX(e,t,n,r){return new bX(e,t,n,r)}function SX(e,t){return function(n){return t(new zY(e,n))}}function CX(e){return function(t){return e(new FY(t))}}var wX=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=SX(uX(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=CX(n)),xX(e,t,i,r)},TX,EX=class extends GY{constructor(e){super(),this.defaultTarget=e&&uX(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},DX=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Bq(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(DX.sort),a.shift().execute();r.set(i,!1)};TX=(t,r,a=0)=>{let o=mX(t),s=new DX(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var OX=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};OX.None=new OX(0,0);function kX(e){let t=e.getBoundingClientRect(),n=uX(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=ZY(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(hJ(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var AX={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:XJ?`webkitAnimationStart`:`animationstart`,ANIMATION_END:XJ?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:XJ?`webkitAnimationIteration`:`animationiteration`},jX=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function MX(e,t,n,...r){let i=jX.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function NX(e,t,...n){return MX(`http://www.w3.org/1999/xhtml`,e,t,...n)}NX.SVG=function(e,t,...n){return MX(`http://www.w3.org/2000/svg`,e,t,...n)};var PX=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=FX(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=FX(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=FX(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=FX(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=FX(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=FX(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=FX(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=FX(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=FX(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=FX(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=FX(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=FX(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=FX(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=FX(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function FX(e){return typeof e==`number`?`${e}px`:e}function IX(e){return new PX(e)}var LX=class{constructor(){this._hooks=new _J,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(hJ(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=uX(e)}this._hooks.add(xX(a,AX.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(xX(a,AX.POINTER_UP,e=>this.stopMonitoring(!0)))}};function RX(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var zX;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(zX||={});var BX=class e extends vJ{constructor(){super(),this.dispatched=!1,this.targets=new CJ,this.ignoreTargets=new CJ,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kJ.runAndSubscribe(_X,({window:e,disposables:t})=>{t.add(xX(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(xX(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(xX(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:bJ,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=fJ(new e),hJ(e.INSTANCE.targets.push(t))):vJ.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=fJ(new e),hJ(e.INSTANCE.ignoreTargets.push(t))):vJ.None}static isTouchDevice(){return`ontouchstart`in bJ||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(zX.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Yq(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yq(s.rollingPageY))<30){let e=this.newGestureEvent(zX.Tap,s.initialTarget);e.pageX=Yq(s.rollingPageX),e.pageY=Yq(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Yq(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yq(s.rollingPageY))<30){let e=this.newGestureEvent(zX.Contextmenu,s.initialTarget);e.pageX=Yq(s.rollingPageX),e.pageY=Yq(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Yq(s.rollingPageX),n=Yq(s.rollingPageY),i=Yq(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(zX.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===zX.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===zX.Change||t.type===zX.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=TX(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(zX.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(zX.Change,i.initialTarget);a.translationX=r.pageX-Yq(i.rollingPageX),a.translationY=r.pageY-Yq(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};BX.SCROLL_FRICTION=-.005,BX.HOLD_DELAY=700,BX.CLEAR_TAP_COUNT_TIME=400,KK([RX],BX,`isTouchDevice`,1);var VX=BX,HX=class extends vJ{onclick(e,t){this._register(xX(e,AX.CLICK,n=>t(new zY(uX(e),n))))}onmousedown(e,t){this._register(xX(e,AX.MOUSE_DOWN,n=>t(new zY(uX(e),n))))}onmouseover(e,t){this._register(xX(e,AX.MOUSE_OVER,n=>t(new zY(uX(e),n))))}onmouseleave(e,t){this._register(xX(e,AX.MOUSE_LEAVE,n=>t(new zY(uX(e),n))))}onkeydown(e,t){this._register(xX(e,AX.KEY_DOWN,e=>t(new FY(e))))}onkeyup(e,t){this._register(xX(e,AX.KEY_UP,e=>t(new FY(e))))}oninput(e,t){this._register(xX(e,AX.INPUT,t))}onblur(e,t){this._register(xX(e,AX.BLUR,t))}onfocus(e,t){this._register(xX(e,AX.FOCUS,t))}onchange(e,t){this._register(xX(e,AX.CHANGE,t))}ignoreGesture(e){return VX.ignoreTarget(e)}},UX=11,WX=class extends HX{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=UX+`px`,this.domNode.style.height=UX+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new LX),this._register(wX(this.bgDomNode,AX.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(wX(this.domNode,AX.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new EX),this._pointerdownScheduleRepeatTimer=this._register(new WY)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,uX(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},GX=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},KX=class extends vJ{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new GX(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new XX(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=XX.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},qX=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function JX(e,t){let n=t-e;return function(t){return e+n*QX(t)}}function YX(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var XX=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),YX(JX(e,r),JX(i,t),.33)}return JX(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new qX(this.scrollLeft(t),this.scrollTop(t),!1):new qX(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){return r+=10,new e(t,n,Date.now()-10,r)}};function ZX(e){return e**3}function QX(e){return 1-ZX(1-e)}var $X=class extends vJ{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new WY)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},eZ=140,tZ=class extends HX{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new $X(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new LX),this._shouldRender=!0,this.domNode=IX(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(xX(this.domNode.domNode,AX.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new WX(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=IX(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(xX(this.slider.domNode,AX.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=kX(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(fY&&a>eZ){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},nZ=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},rZ=class extends tZ{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new nZ(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},iZ=class extends tZ{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new nZ(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},aZ=500,oZ=50,sZ=!0,cZ=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},lZ=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(ZJ){let t=qJ(uX(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new cZ(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};lZ.INSTANCE=new lZ;var uZ=lZ,dZ=class extends HX{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=pZ(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new iZ(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new rZ(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=IX(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=IX(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=IX(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new WY),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=pJ(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,pY&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new BY(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=pJ(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(xX(this._listenOnDomNode,AX.MOUSE_WHEEL,e=>{this._onMouseWheel(new BY(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=uZ.INSTANCE;sZ&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!pY&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=oZ*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=oZ*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(sZ&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),aZ)}},fZ=class extends dZ{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function pZ(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,pY&&(t.className+=` mac`),t}var mZ=class extends vJ{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new KX({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>TX(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new fZ(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(kJ.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(hJ(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(hJ(()=>this._styleElement.remove())),this._register(kJ.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
198
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};mZ=KK([Z(2,yq),Z(3,Mq),Z(4,bq),Z(5,Lq),Z(6,Tq),Z(7,Pq)],mZ);var hZ=class extends vJ{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(hJ(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};hZ=KK([Z(1,yq),Z(2,Mq),Z(3,Oq),Z(4,Pq)],hZ);var gZ=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},_Z={full:0,left:0,center:0,right:0},vZ={full:0,left:0,center:0,right:0},yZ={full:0,left:0,center:0,right:0},bZ=class extends vJ{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new gZ,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(hJ(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);vZ.full=this._canvas.width,vZ.left=e,vZ.center=t,vZ.right=e,this._refreshDrawHeightConstants(),yZ.full=1,yZ.left=1,yZ.center=1+vZ.left,yZ.right=1+vZ.left+vZ.center}_refreshDrawHeightConstants(){_Z.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);_Z.left=t,_Z.center=t,_Z.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_Z.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_Z.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_Z.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_Z.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(yZ[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_Z[e.position||`full`]/2),vZ[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_Z[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};bZ=KK([Z(2,yq),Z(3,Oq),Z(4,Pq),Z(5,Tq),Z(6,Lq),Z(7,Mq)],bZ);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
199
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var xZ;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(xZ||={});var SZ;(e=>e.ST=`${$.ESC}\\`)(SZ||={});var CZ=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};CZ=KK([Z(2,yq),Z(3,Tq),Z(4,xq),Z(5,Pq)],CZ);var wZ=0,TZ=0,EZ=0,DZ=0,OZ={css:`#00000000`,rgba:0},kZ;(e=>{function t(e,t,n,r){return r===void 0?`#${PZ(e)}${PZ(t)}${PZ(n)}`:`#${PZ(e)}${PZ(t)}${PZ(n)}${PZ(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(kZ||={});var AZ;(e=>{function t(e,t){if(DZ=(t.rgba&255)/255,DZ===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return wZ=a+Math.round((n-a)*DZ),TZ=o+Math.round((r-o)*DZ),EZ=s+Math.round((i-s)*DZ),{css:kZ.toCss(wZ,TZ,EZ),rgba:kZ.toRgba(wZ,TZ,EZ)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=NZ.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return kZ.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[wZ,TZ,EZ]=NZ.toChannels(t),{css:kZ.toCss(wZ,TZ,EZ),rgba:t}}e.opaque=i;function a(e,t){return DZ=Math.round(t*255),[wZ,TZ,EZ]=NZ.toChannels(e.rgba),{css:kZ.toCss(wZ,TZ,EZ,DZ),rgba:kZ.toRgba(wZ,TZ,EZ,DZ)}}e.opacity=a;function o(e,t){return DZ=e.rgba&255,a(e,DZ*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(AZ||={});var jZ;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return wZ=parseInt(e.slice(1,2).repeat(2),16),TZ=parseInt(e.slice(2,3).repeat(2),16),EZ=parseInt(e.slice(3,4).repeat(2),16),kZ.toColor(wZ,TZ,EZ);case 5:return wZ=parseInt(e.slice(1,2).repeat(2),16),TZ=parseInt(e.slice(2,3).repeat(2),16),EZ=parseInt(e.slice(3,4).repeat(2),16),DZ=parseInt(e.slice(4,5).repeat(2),16),kZ.toColor(wZ,TZ,EZ,DZ);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return wZ=parseInt(r[1]),TZ=parseInt(r[2]),EZ=parseInt(r[3]),DZ=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),kZ.toColor(wZ,TZ,EZ,DZ);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[wZ,TZ,EZ,DZ]=t.getImageData(0,0,1,1).data,DZ!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:kZ.toRgba(wZ,TZ,EZ,DZ),css:e}}e.toColor=r})(jZ||={});var MZ;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(MZ||={});var NZ;(e=>{function t(e,t){if(DZ=(t&255)/255,DZ===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return wZ=a+Math.round((n-a)*DZ),TZ=o+Math.round((r-o)*DZ),EZ=s+Math.round((i-s)*DZ),kZ.toRgba(wZ,TZ,EZ)}e.blend=t;function n(e,t,n){let a=MZ.relativeLuminance(e>>8),o=MZ.relativeLuminance(t>>8);if(FZ(a,o)<n){if(o<a){let o=r(e,t,n),s=FZ(a,MZ.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>FZ(a,MZ.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=FZ(a,MZ.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>FZ(a,MZ.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=FZ(MZ.relativeLuminance2(o,s,c),MZ.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=FZ(MZ.relativeLuminance2(o,s,c),MZ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=FZ(MZ.relativeLuminance2(o,s,c),MZ.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=FZ(MZ.relativeLuminance2(o,s,c),MZ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(NZ||={});function PZ(e){let t=e.toString(16);return t.length<2?`0`+t:t}function FZ(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var IZ=class extends uq{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},LZ=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new fq}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||lq.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)LZ._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||lq.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};LZ=KK([Z(0,yq)],LZ);function RZ(e){return 57508<=e&&e<=57558}function zZ(e){return 9472<=e&&e<=9631}function BZ(e){return RZ(e)||zZ(e)}function VZ(){return{css:{canvas:HZ(),cell:HZ()},device:{canvas:HZ(),cell:HZ(),char:{width:0,height:0,left:0,top:0}}}}function HZ(){return{width:0,height:0}}var UZ=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new fq,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,ee=!1,w=0,T=0,E=[],D=l!==-1&&u!==-1;for(let te=0;te<m;te++){e.loadCell(te,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ne=!1,re=te>=T,ie=te,O=this._workCell;if(f.length>0&&te===f[0][0]&&re){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)re&&=i===this._isCellInSelection(v,t);re&&=!n||a<r[0]||a>=r[1],re?(ne=!0,O=new IZ(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),ie=r[1]-1,m=O.getWidth()):T=r[1]}let ae=this._isCellInSelection(te,t),oe=n&&te===a,se=D&&te>=l&&te<=u,ce=!1;this._decorationService.forEachDecorationAtCell(te,t,void 0,e=>{ce=!0});let le=O.getChars()||lq;if(le===` `&&(O.isUnderline()||O.isOverline())&&(le=`\xA0`),w=m*s-c.get(le,O.isBold(),O.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(ae&&ee||!ae&&!ee&&O.bg===y)&&(ae&&ee&&p.selectionForeground||O.fg===b)&&O.extended.ext===x&&se===S&&w===C&&!oe&&!ne&&!ce&&re){O.isInvisible()?_+=lq:_+=le,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=O.bg,b=O.fg,x=O.extended.ext,S=se,C=w,ee=ae,ne&&a>=te&&a<=ie&&(a=te),!this._coreService.isCursorHidden&&oe&&this._coreService.isCursorInitialized){if(E.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&E.push(`xterm-cursor-blink`),E.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:E.push(`xterm-cursor-outline`);break;case`block`:E.push(`xterm-cursor-block`);break;case`bar`:E.push(`xterm-cursor-bar`);break;case`underline`:E.push(`xterm-cursor-underline`);break;default:break}}if(O.isBold()&&E.push(`xterm-bold`),O.isItalic()&&E.push(`xterm-italic`),O.isDim()&&E.push(`xterm-dim`),_=O.isInvisible()?lq:O.getChars()||lq,O.isUnderline()&&(E.push(`xterm-underline-${O.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${uq.toColorRGB(O.getUnderlineColor()).join(`,`)})`;else{let e=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}O.isOverline()&&(E.push(`xterm-overline`),_===` `&&(_=`\xA0`)),O.isStrikethrough()&&E.push(`xterm-strikethrough`),se&&(h.style.textDecoration=`underline`);let ue=O.getFgColor(),de=O.getFgColorMode(),fe=O.getBgColor(),pe=O.getBgColorMode(),me=!!O.isInverse();if(me){let e=ue;ue=fe,fe=e;let t=de;de=pe,pe=t}let he,ge,_e=!1;this._decorationService.forEachDecorationAtCell(te,t,void 0,e=>{e.options.layer!==`top`&&_e||(e.backgroundColorRGB&&(pe=50331648,fe=e.backgroundColorRGB.rgba>>8&16777215,he=e.backgroundColorRGB),e.foregroundColorRGB&&(de=50331648,ue=e.foregroundColorRGB.rgba>>8&16777215,ge=e.foregroundColorRGB),_e=e.options.layer===`top`)}),!_e&&ae&&(he=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,fe=he.rgba>>8&16777215,pe=50331648,_e=!0,p.selectionForeground&&(de=50331648,ue=p.selectionForeground.rgba>>8&16777215,ge=p.selectionForeground)),_e&&E.push(`xterm-decoration-top`);let ve;switch(pe){case 16777216:case 33554432:ve=p.ansi[fe],E.push(`xterm-bg-${fe}`);break;case 50331648:ve=kZ.toColor(fe>>16,fe>>8&255,fe&255),this._addStyle(h,`background-color:#${WZ((fe>>>0).toString(16),`0`,6)}`);break;default:me?(ve=p.foreground,E.push(`xterm-bg-257`)):ve=p.background}switch(he||O.isDim()&&(he=AZ.multiplyOpacity(ve,.5)),de){case 16777216:case 33554432:O.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(h,ve,p.ansi[ue],O,he,void 0)||E.push(`xterm-fg-${ue}`);break;case 50331648:let e=kZ.toColor(ue>>16&255,ue>>8&255,ue&255);this._applyMinimumContrast(h,ve,e,O,he,ge)||this._addStyle(h,`color:#${WZ(ue.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ve,p.foreground,O,he,ge)||me&&E.push(`xterm-fg-257`)}E.length&&=(h.className=E.join(` `),0),!oe&&!ne&&!ce&&re?g++:h.textContent=_,w!==this.defaultSpacing&&(h.style.letterSpacing=`${w}px`),d.push(h),te=ie}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||BZ(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=AZ.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};UZ=KK([Z(1,Iq),Z(2,Tq),Z(3,Mq),Z(4,xq),Z(5,Oq),Z(6,Lq)],UZ);function WZ(e,t,n){for(;e.length<n;)e=t+e;return e}var GZ=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},KZ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function qZ(){return new KZ}var JZ=`xterm-dom-renderer-owner-`,YZ=`xterm-rows`,XZ=`xterm-fg-`,ZZ=`xterm-bg-`,QZ=`xterm-focus`,$Z=`xterm-selection`,eQ=1,tQ=class extends vJ{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=eQ++,this._rowElements=[],this._selectionRenderModel=qZ(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(YZ),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add($Z),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=VZ(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(UZ,document),this._element.classList.add(JZ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(hJ(()=>{this._element.classList.remove(JZ+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new GZ(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${YZ} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${YZ} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${YZ} .xterm-dim { color: ${AZ.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${YZ}.${QZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${YZ}.${QZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${YZ}.${QZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${YZ} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${YZ} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${YZ} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${YZ} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${YZ} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${$Z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${$Z} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${$Z} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${XZ}${n} { color: ${r.css}; }${this._terminalSelector} .${XZ}${n}.xterm-dim { color: ${AZ.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${ZZ}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${XZ}257 { color: ${AZ.opaque(e.background).css}; }${this._terminalSelector} .${XZ}257.xterm-dim { color: ${AZ.multiplyOpacity(AZ.opaque(e.background),.5).css}; }${this._terminalSelector} .${ZZ}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(QZ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(QZ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${JZ}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};tQ=KK([Z(7,Cq),Z(8,jq),Z(9,Tq),Z(10,yq),Z(11,xq),Z(12,Mq),Z(13,Lq)],tQ);var nQ=class extends vJ{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new aQ(this._optionsService))}catch{this._measureStrategy=this._register(new iQ(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};nQ=KK([Z(2,Tq)],nQ);var rQ=class extends vJ{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},iQ=class extends rQ{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},aQ=class extends rQ{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},oQ=class extends vJ{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new sQ(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(kJ.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(xX(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(xX(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},sQ=class extends vJ{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new yJ),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(hJ(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=xX(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},cQ=class extends vJ{constructor(){super(),this.linkProviders=[],this._register(hJ(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function lQ(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function uQ(e,t,n,r,i,a,o,s,c){if(!a)return;let l=lQ(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),i),l}var dQ=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return uQ(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=lQ(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};dQ=KK([Z(0,Pq),Z(1,jq)],dQ);var fQ=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},pQ={};GK(pQ,{getSafariVersion:()=>bQ,isChromeOS:()=>EQ,isFirefox:()=>_Q,isIpad:()=>SQ,isIphone:()=>CQ,isLegacyEdge:()=>vQ,isLinux:()=>TQ,isMac:()=>xQ,isNode:()=>mQ,isSafari:()=>yQ,isWindows:()=>wQ});var mQ=typeof process<`u`&&`title`in process,hQ=mQ?`node`:navigator.userAgent,gQ=mQ?`node`:navigator.platform,_Q=hQ.includes(`Firefox`),vQ=hQ.includes(`Edge`),yQ=/^((?!chrome|android).)*safari/i.test(hQ);function bQ(){if(!yQ)return 0;let e=hQ.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var xQ=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(gQ),SQ=gQ===`iPad`,CQ=gQ===`iPhone`,wQ=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(gQ),TQ=gQ.indexOf(`Linux`)>=0,EQ=/\bCrOS\b/.test(hQ),DQ=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},OQ=class extends DQ{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},kQ=class extends DQ{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},AQ=!mQ&&`requestIdleCallback`in window?kQ:OQ,jQ=class{constructor(){this._queue=new AQ}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},MQ=class extends vJ{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new yJ),this._pausedResizeTask=new jQ,this._observerDisposable=this._register(new yJ),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new fQ((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new NQ(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(hJ(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=hJ(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};MQ=KK([Z(2,Tq),Z(3,jq),Z(4,xq),Z(5,Oq),Z(6,yq),Z(7,Mq),Z(8,Lq)],MQ);var NQ=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function PQ(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return LQ(i,a,e,t,n,r)+RQ(a,t,n,r)+zQ(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,KQ(Math.abs(i-e),GQ(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return KQ(IQ(a>t?e:i,n)+(s-1)*n.cols+1+FQ(a>t?i:e,n),GQ(o,r))}function FQ(e,t){return e-1}function IQ(e,t){return t.cols-e}function LQ(e,t,n,r,i,a){return RQ(t,r,i,a).length===0?``:KQ(WQ(e,t,e,t-VQ(t,i),!1,i).length,GQ(`D`,a))}function RQ(e,t,n,r){let i=e-VQ(e,n),a=t-VQ(t,n);return KQ(Math.abs(i-a)-BQ(e,t,n),GQ(UQ(e,t),r))}function zQ(e,t,n,r,i,a){let o;o=RQ(t,r,i,a).length>0?r-VQ(r,i):t;let s=r,c=HQ(e,t,n,r,i,a);return KQ(WQ(e,o,n,s,c===`C`,i).length,GQ(c,a))}function BQ(e,t,n){let r=0,i=e-VQ(e,n),a=t-VQ(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=UQ(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function VQ(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function HQ(e,t,n,r,i,a){let o;return o=RQ(n,r,i,a).length>0?r-VQ(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function UQ(e,t){return e>t?`A`:`B`}function WQ(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function GQ(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function KQ(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var qQ=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function JQ(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var YQ=50,XQ=15,ZQ=50,QQ=500,$Q=RegExp(`\xA0`,`g`),e$=class extends vJ{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new fq,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new qQ(this._bufferService),this._activeSelectionMode=0,this._register(hJ(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace($Q,` `)).join(wQ?`\r
|
|
200
|
+
`:`
|
|
201
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),TQ&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=JQ(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=lQ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-YQ),YQ),t/=YQ,t/Math.abs(t)+Math.round(t*(XQ-1)))}shouldForceSelection(e){return xQ?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),ZQ)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(xQ&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<QQ&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=PQ(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=JQ(n,this._bufferService.cols)}};e$=KK([Z(3,yq),Z(4,xq),Z(5,Nq),Z(6,Tq),Z(7,Pq),Z(8,Mq)],e$);var t$=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},n$=class{constructor(){this._color=new t$,this._css=new t$}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},r$=Object.freeze((()=>{let e=[jZ.toColor(`#2e3436`),jZ.toColor(`#cc0000`),jZ.toColor(`#4e9a06`),jZ.toColor(`#c4a000`),jZ.toColor(`#3465a4`),jZ.toColor(`#75507b`),jZ.toColor(`#06989a`),jZ.toColor(`#d3d7cf`),jZ.toColor(`#555753`),jZ.toColor(`#ef2929`),jZ.toColor(`#8ae234`),jZ.toColor(`#fce94f`),jZ.toColor(`#729fcf`),jZ.toColor(`#ad7fa8`),jZ.toColor(`#34e2e2`),jZ.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:kZ.toCss(r,i,a),rgba:kZ.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:kZ.toCss(n,n,n),rgba:kZ.toRgba(n,n,n)})}return e})()),i$=jZ.toColor(`#ffffff`),a$=jZ.toColor(`#000000`),o$=jZ.toColor(`#ffffff`),s$=a$,c$={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},l$=i$,u$=class extends vJ{constructor(e){super(),this._optionsService=e,this._contrastCache=new n$,this._halfContrastCache=new n$,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i$,background:a$,cursor:o$,cursorAccent:s$,selectionForeground:void 0,selectionBackgroundTransparent:c$,selectionBackgroundOpaque:AZ.blend(a$,c$),selectionInactiveBackgroundTransparent:c$,selectionInactiveBackgroundOpaque:AZ.blend(a$,c$),scrollbarSliderBackground:AZ.opacity(i$,.2),scrollbarSliderHoverBackground:AZ.opacity(i$,.4),scrollbarSliderActiveBackground:AZ.opacity(i$,.5),overviewRulerBorder:i$,ansi:r$.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=d$(e.foreground,i$),t.background=d$(e.background,a$),t.cursor=AZ.blend(t.background,d$(e.cursor,o$)),t.cursorAccent=AZ.blend(t.background,d$(e.cursorAccent,s$)),t.selectionBackgroundTransparent=d$(e.selectionBackground,c$),t.selectionBackgroundOpaque=AZ.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=d$(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=AZ.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?d$(e.selectionForeground,OZ):void 0,t.selectionForeground===OZ&&(t.selectionForeground=void 0),AZ.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=AZ.opacity(t.selectionBackgroundTransparent,.3)),AZ.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=AZ.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=d$(e.scrollbarSliderBackground,AZ.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=d$(e.scrollbarSliderHoverBackground,AZ.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=d$(e.scrollbarSliderActiveBackground,AZ.opacity(t.foreground,.5)),t.overviewRulerBorder=d$(e.overviewRulerBorder,l$),t.ansi=r$.slice(),t.ansi[0]=d$(e.black,r$[0]),t.ansi[1]=d$(e.red,r$[1]),t.ansi[2]=d$(e.green,r$[2]),t.ansi[3]=d$(e.yellow,r$[3]),t.ansi[4]=d$(e.blue,r$[4]),t.ansi[5]=d$(e.magenta,r$[5]),t.ansi[6]=d$(e.cyan,r$[6]),t.ansi[7]=d$(e.white,r$[7]),t.ansi[8]=d$(e.brightBlack,r$[8]),t.ansi[9]=d$(e.brightRed,r$[9]),t.ansi[10]=d$(e.brightGreen,r$[10]),t.ansi[11]=d$(e.brightYellow,r$[11]),t.ansi[12]=d$(e.brightBlue,r$[12]),t.ansi[13]=d$(e.brightMagenta,r$[13]),t.ansi[14]=d$(e.brightCyan,r$[14]),t.ansi[15]=d$(e.brightWhite,r$[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=d$(e.extendedAnsi[r],r$[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};u$=KK([Z(0,Tq)],u$);function d$(e,t){if(e!==void 0)try{return jZ.toColor(e)}catch{}return t}var f$=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},p$=class{constructor(){this._services=new f$,this._services.set(Cq,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=gq(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},m$={trace:0,debug:1,info:2,warn:3,error:4,off:5},h$=`xterm.js: `,g$=class extends vJ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),_$=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=m$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:h$)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};g$=KK([Z(0,Tq)],g$);var _$,v$=class extends vJ{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},y$=3,b$=Object.freeze(new uq),x$=0,S$=2,C$=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*y$);let r=t||fq.fromCharData([0,cq,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*y$+0],n=t&2097151;return[this._data[e*y$+1],t&2097152?this._combined[e]:n?iq(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*y$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*y$+0]=e|2097152|t[2]<<22):this._data[e*y$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*y$+0]>>22}hasWidth(e){return this._data[e*y$+0]&12582912}getFg(e){return this._data[e*y$+1]}getBg(e){return this._data[e*y$+2]}hasContent(e){return this._data[e*y$+0]&4194303}getCodePoint(e){let t=this._data[e*y$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*y$+0]&2097152}getString(e){let t=this._data[e*y$+0];return t&2097152?this._combined[e]:t&2097151?iq(t&2097151):``}isProtected(e){return this._data[e*y$+2]&536870912}loadCell(e,t){return x$=e*y$,t.content=this._data[x$+0],t.fg=this._data[x$+1],t.bg=this._data[x$+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*y$+0]=t.content,this._data[e*y$+1]=t.fg,this._data[e*y$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*y$+0]=t|n<<22,this._data[e*y$+1]=r.fg,this._data[e*y$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*y$+0];r&2097152?this._combined[e]+=iq(t):r&2097151?(this._combined[e]=iq(r&2097151)+iq(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*y$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new fq;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new fq;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*S$<this._data.buffer.byteLength;let n=e*y$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*S$<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*S$<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*y$+0]&4194303)return e+(this._data[e*y$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*y$+0]&4194303||this._data[e*y$+2]&50331648)return e+(this._data[e*y$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<y$;e++)this._data[(n+i)*y$+e]=a[(t+i)*y$+e];a[(t+i)*y$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<y$;e++)this._data[(n+i)*y$+e]=a[(t+i)*y$+e];a[(t+i)*y$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*y$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?iq(n):lq;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function w$(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=O$(u,d,t),p=1,m=0;for(;p<u.length;){let e=O$(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function T$(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function E$(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function D$(e,t,n){let r=[],i=e.map((n,r)=>O$(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=O$(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function O$(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var k$=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),pJ(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};k$._nextId=1;var A$=k$,j$={},M$=j$.B;j$[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},j$.A={"#":`£`},j$.B=void 0,j$[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},j$.C=j$[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},j$.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},j$.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},j$.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},j$.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},j$.E=j$[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},j$.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},j$.H=j$[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},j$[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var N$=4294967295,P$=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b$.clone(),this.savedCharset=M$,this.markers=[],this._nullCell=fq.fromCharData([0,cq,1,0]),this._whitespaceCell=fq.fromCharData([0,lq,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new AQ,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new v$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new dq),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new dq),this._whitespaceCell}getBlankLine(e,t){return new C$(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>N$?N$:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=b$);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new v$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(b$),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new C$(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new C$(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=w$(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(b$),n);if(r.length>0){let n=T$(this.lines,r);E$(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(b$),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new C$(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(b$),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=D$(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(b$,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=O$(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new A$(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},F$=class extends vJ{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new P$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new P$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},I$=2,L$=1,R$=class extends vJ{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,I$),this.rows=Math.max(e.rawOptions.rows||0,L$),this.buffers=this._register(new F$(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};R$=KK([Z(0,Tq)],R$);var z$={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:xQ,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},B$=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],V$=class extends vJ{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...z$};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(hJ(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in z$))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in z$))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=z$[e],!H$(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=z$[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=B$.includes(t)?t:z$[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function H$(e){return e===`block`||e===`underline`||e===`bar`}function U$(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&U$(e[r],t-1);return n}var W$=Object.freeze({insertMode:!1}),G$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),K$=class extends vJ{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=U$(W$),this.decPrivateModes=U$(G$)}reset(){this.modes=U$(W$),this.decPrivateModes=U$(G$)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};K$=KK([Z(0,yq),Z(1,wq),Z(2,Tq)],K$);var q$={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function J$(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Y$=String.fromCharCode,X$={DEFAULT:e=>{let t=[J$(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Y$(t[0])}${Y$(t[1])}${Y$(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${J$(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${J$(e,!0)};${e.x};${e.y}${t}`}},Z$=class extends vJ{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(q$))this.addProtocol(e,q$[e]);for(let e of Object.keys(X$))this.addEncoding(e,X$[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Z$=KK([Z(0,yq),Z(1,xq),Z(2,Tq)],Z$);var Q$=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],$$=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],e1;function t1(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var n1=class{constructor(){if(this.version=`6`,!e1){e1=new Uint8Array(65536),e1.fill(1),e1[0]=0,e1.fill(0,1,32),e1.fill(0,127,160),e1.fill(2,4352,4448),e1[9001]=2,e1[9002]=2,e1.fill(2,11904,42192),e1[12351]=1,e1.fill(2,44032,55204),e1.fill(2,63744,64256),e1.fill(2,65040,65050),e1.fill(2,65072,65136),e1.fill(2,65280,65377),e1.fill(2,65504,65511);for(let e=0;e<Q$.length;++e)e1.fill(0,Q$[e][0],Q$[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?e1[e]:t1(e,$$)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=r1.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return r1.createPropertyValue(0,n,r)}},r1=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new n1;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},i1=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function a1(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var o1=2147483647,s1=256,c1=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>s1)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>o1?o1:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>o1?o1:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,o1):e}},l1=[],u1=class{constructor(){this._state=0,this._active=l1,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l1}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=l1,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l1,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,aq(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=l1,this._id=-1,this._state=0}}},d1=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=aq(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},f1=[],p1=class{constructor(){this._handlers=Object.create(null),this._active=f1,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f1}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=f1,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||f1,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,aq(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=f1,this._ident=0}},m1=new c1;m1.addParam(0);var h1=class{constructor(e){this._handler=e,this._data=``,this._params=m1,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():m1,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=aq(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=m1,this._data=``,this._hitLimit=!1,e));return this._params=m1,this._data=``,this._hitLimit=!1,t}},g1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},_1=160,v1=function(){let e=new g1(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(_1,0,2,0),e.add(_1,8,5,8),e.add(_1,6,0,6),e.add(_1,11,0,11),e.add(_1,13,13,13),e}(),y1=class extends vJ{constructor(e=v1){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(hJ(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new u1),this._dcsParser=this._register(new p1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:_1)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<_1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<_1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<_1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<_1){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<_1){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<_1){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},b1=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,x1=/^[\da-f]+$/;function S1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=b1.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),x1.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function C1(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function w1(e,t=16){let[n,r,i]=e;return`rgb:${C1(n,t)}/${C1(r,t)}/${C1(i,t)}`}var T1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E1=131072,D1=10;function O1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var k1=5e3,A1=0,j1=class extends vJ{constructor(e,t,n,r,i,a,o,s,c=new y1){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new oq,this._utf8Decoder=new sq,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b$.clone(),this._eraseAttrDataInternal=b$.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new M1(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(xZ.IND,()=>this.index()),this._parser.setExecuteHandler(xZ.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(xZ.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new d1(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new d1(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new d1(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new d1(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new d1(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new d1(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new d1(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new d1(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new d1(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new d1(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new d1(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new d1(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in j$)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new h1((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),k1))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${k1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>E1&&(a=this._parseStack.position+E1)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<E1&&(this._parseBuffer=new Uint32Array(Math.min(e.length,E1))),o||this._dirtyRowTracker.clearRange(),e.length>E1)for(let t=a;t<e.length;t+=E1){let a=t+E1<e.length?t+E1:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=r1.extractWidth(t);let n=r1.extractShouldJoin(t),m=n?r1.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(iq(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof C$&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>O1(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new h1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new d1(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(b$));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=r1.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,M$),this._charsetService.setgCharset(1,M$),this._charsetService.setgCharset(2,M$),this._charsetService.setgCharset(3,M$);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=uq.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=b$.fg,e.bg=b$.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=b$.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=b$.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=b$.fg&16777215,r.bg&=-67108864,r.bg|=b$.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b$.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!O1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>D1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>D1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(N1(n))if(r===`?`)t.push({type:0,index:n});else{let e=S1(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=S1(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);N1(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,M$),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(T1[e[0]],j$[e[1]]||M$),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=b$.clone(),this._eraseAttrDataInternal=b$.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new fq;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},M1=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(A1=e,e=t,t=A1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};M1=KK([Z(0,yq)],M1);function N1(e){return 0<=e&&e<256}var P1=5e7,F1=12,I1=50,L1=class extends vJ{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>P1)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=F1?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=F1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>I1&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},R1=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};R1=KK([Z(0,yq)],R1);var z1=!1,B1=class extends vJ{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new yJ),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new p$,this.optionsService=this._register(new V$(e)),this._instantiationService.setService(Tq,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(R$)),this._instantiationService.setService(yq,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(g$)),this._instantiationService.setService(wq,this._logService),this.coreService=this._register(this._instantiationService.createInstance(K$)),this._instantiationService.setService(xq,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Z$)),this._instantiationService.setService(bq,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(r1)),this._instantiationService.setService(Dq,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i1),this._instantiationService.setService(Sq,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R1),this._instantiationService.setService(Eq,this._oscLinkService),this._inputHandler=this._register(new j1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kJ.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kJ.forward(this._bufferService.onResize,this._onResize)),this._register(kJ.forward(this.coreService.onData,this._onData)),this._register(kJ.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new L1((e,t)=>this._inputHandler.parse(e,t))),this._register(kJ.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!z1&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),z1=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,I$),t=Math.max(t,L$),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(a1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(a1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=hJ(()=>{for(let t of e)t.dispose()})}}},V1={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function H1(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`D`:t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`C`:t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`A`:t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`B`:t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:a?i.key=$.ESC+`[3;`+(a+1)+`~`:i.key=$.ESC+`[3~`;break;case 36:a?i.key=$.ESC+`[1;`+(a+1)+`H`:t?i.key=$.ESC+`OH`:i.key=$.ESC+`[H`;break;case 35:a?i.key=$.ESC+`[1;`+(a+1)+`F`:t?i.key=$.ESC+`OF`:i.key=$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=$.ESC+`[5;`+(a+1)+`~`:i.key=$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=$.ESC+`[6;`+(a+1)+`~`:i.key=$.ESC+`[6~`;break;case 112:a?i.key=$.ESC+`[1;`+(a+1)+`P`:i.key=$.ESC+`OP`;break;case 113:a?i.key=$.ESC+`[1;`+(a+1)+`Q`:i.key=$.ESC+`OQ`;break;case 114:a?i.key=$.ESC+`[1;`+(a+1)+`R`:i.key=$.ESC+`OR`;break;case 115:a?i.key=$.ESC+`[1;`+(a+1)+`S`:i.key=$.ESC+`OS`;break;case 116:a?i.key=$.ESC+`[15;`+(a+1)+`~`:i.key=$.ESC+`[15~`;break;case 117:a?i.key=$.ESC+`[17;`+(a+1)+`~`:i.key=$.ESC+`[17~`;break;case 118:a?i.key=$.ESC+`[18;`+(a+1)+`~`:i.key=$.ESC+`[18~`;break;case 119:a?i.key=$.ESC+`[19;`+(a+1)+`~`:i.key=$.ESC+`[19~`;break;case 120:a?i.key=$.ESC+`[20;`+(a+1)+`~`:i.key=$.ESC+`[20~`;break;case 121:a?i.key=$.ESC+`[21;`+(a+1)+`~`:i.key=$.ESC+`[21~`;break;case 122:a?i.key=$.ESC+`[23;`+(a+1)+`~`:i.key=$.ESC+`[23~`;break;case 123:a?i.key=$.ESC+`[24;`+(a+1)+`~`:i.key=$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=V1[e.keyCode]?.[e.shiftKey?1:0];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL));break}return i}var U1=0,W1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new AQ,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new AQ,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(U1=this._search(t),U1===-1)||this._getKey(this._array[U1])!==t)return!1;do if(this._array[U1]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(U1),!0;while(++U1<this._array.length&&this._getKey(this._array[U1])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(U1=this._search(e),!(U1<0||U1>=this._array.length)&&this._getKey(this._array[U1])===e))do yield this._array[U1];while(++U1<this._array.length&&this._getKey(this._array[U1])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(U1=this._search(e),!(U1<0||U1>=this._array.length)&&this._getKey(this._array[U1])===e))do t(this._array[U1]);while(++U1<this._array.length&&this._getKey(this._array[U1])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},G1=0,K1=0,q1=class extends vJ{constructor(){super(),this._decorations=new W1(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(hJ(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new J1(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{G1=t.options.x??0,K1=G1+(t.options.width??1),e>=G1&&e<K1&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},J1=class extends _J{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=jZ.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=jZ.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Y1=1e3,X1=class{constructor(e,t=Y1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Z1=20,Q1=!1,$1=class extends vJ{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new X1(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);Q1?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
202
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(xX(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(hJ(()=>{Q1?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Z1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
203
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Z1+1&&(this._liveRegion.textContent+=XK.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};$1=KK([Z(1,Cq),Z(2,Mq),Z(3,Pq)],$1);var e0=class extends vJ{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(hJ(()=>{pJ(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(xX(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(xX(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(xX(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(xX(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&t0(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,pJ(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};e0=KK([Z(1,Nq),Z(2,Pq),Z(3,yq),Z(4,Rq)],e0);function t0(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var n0=class extends B1{constructor(e={}){super(e),this._linkifier=this._register(new yJ),this.browser=pQ,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new yJ),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(q1),this._instantiationService.setService(Oq,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(cQ),this._instantiationService.setService(Rq,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(kq)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(kJ.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kJ.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kJ.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kJ.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(hJ(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=AZ.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${w1(r)}${SZ.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=kZ.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=kZ.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($1,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(xX(this.element,`copy`,e=>{this.hasSelection()&&$K(e,this._selectionService)}));let e=e=>eq(e,this.textarea,this.coreService,this.optionsService);this._register(xX(this.textarea,`paste`,e)),this._register(xX(this.element,`paste`,e)),_Q?this._register(xX(this.element,`mousedown`,e=>{e.button===2&&rq(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(xX(this.element,`contextmenu`,e=>{rq(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),TQ&&this._register(xX(this.element,`auxclick`,e=>{e.button===1&&nq(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(xX(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(xX(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(xX(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(xX(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(xX(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(xX(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(xX(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(xX(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,JK.get()),EQ||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(oQ,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Mq,this._coreBrowserService),this._register(xX(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(xX(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(nQ,this._document,this._helperContainer),this._instantiationService.setService(jq,this._charSizeService),this._themeService=this._instantiationService.createInstance(u$),this._instantiationService.setService(Lq,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(LZ),this._instantiationService.setService(Iq,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(MQ,this.rows,this.screenElement)),this._instantiationService.setService(Pq,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(CZ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(dQ),this._instantiationService.setService(Nq,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(e0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(mZ,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(e$,this.element,this.screenElement,r)),this._instantiationService.setService(Fq,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(kJ.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(hZ,this.screenElement)),this._register(xX(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($1,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bZ,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bZ,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(tQ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(xX(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(xX(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){tq(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=H1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(r0(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(b$));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function r0(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var i0=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},a0=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new fq)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},o0=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new a0(t)}getNullCell(){return new fq}},s0=class extends vJ{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new o0(this._core.buffers.normal,`normal`),this._alternate=new o0(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},c0=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},l0=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},u0=[`cols`,`rows`],d0=0,f0=class extends vJ{constructor(e){super(),this._core=this._register(new n0(e)),this._addonManager=this._register(new i0),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u0.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c0(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l0(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new s0(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
204
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return JK.get()},set promptLabel(e){JK.set(e)},get tooMuchOutput(){return XK.get()},set tooMuchOutput(e){XK.set(e)}}}_verifyIntegers(...e){for(d0 of e)if(d0===1/0||isNaN(d0)||d0%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(d0 of e)if(d0&&(d0===1/0||isNaN(d0)||d0%1!=0||d0<0))throw Error(`This API only accepts positive integers`)}},p0=2,m0=1,h0=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(p0,Math.floor(u/e.css.cell.width)),rows:Math.max(m0,Math.floor(l/e.css.cell.height))}}},g0={class:`flex flex-col h-full overflow-hidden`},_0={class:`flex items-stretch border-b border-border overflow-x-auto`},v0=[`onClick`],y0=[`onClick`],b0={class:`truncate`},x0={key:0,class:`shrink-0 flex items-center gap-1 px-2 py-1.5 border-b border-border bg-surface w-full max-w-full overflow-x-auto select-none [scrollbar-width:none] [-webkit-overflow-scrolling:touch]`},S0=[`onMousedown`,`onTouchstart`],C0={key:1,class:`px-3 py-1 text-[11px] text-danger bg-danger-dim`},w0={key:`terminal`,label:`Terminal`,icon:`lucide:square-terminal`,color:`#c5cdd8`,lightColor:`#6e7681`,component:F({__name:`window`,setup(e){let t=new Set,{state:n,set:r,setTitle:i,close:a}=Du(),{confirm:o}=Zu(),s=Yt([]),c=M(null),l=M(null),u=M(``),d=null,f=0,p=ad(),m=M(!1),h=M(!1),g=0;function _(){let e=Date.now();e-g<300?(g=0,w(` `,!0)):g=e}P(()=>s.find(e=>e.id===c.value)?.label,e=>{i(e?`Terminal — ${e}`:`Terminal`)});let v={background:`#0a0e14`,foreground:`#c5cdd8`,cursor:`#39bae6`,cursorAccent:`#0a0e14`,selectionBackground:`#112a3a`,black:`#0a0e14`,red:`#e6564d`,green:`#7fd962`,yellow:`#e5a535`,blue:`#39bae6`,magenta:`#c586c0`,cyan:`#39bae6`,white:`#c5cdd8`,brightBlack:`#5c6773`,brightRed:`#e6564d`,brightGreen:`#7fd962`,brightYellow:`#e5a535`,brightBlue:`#39bae6`,brightMagenta:`#c586c0`,brightCyan:`#39bae6`,brightWhite:`#ffffff`},y={background:`#ffffff`,foreground:`#1d1d1f`,cursor:`#0077cc`,cursorAccent:`#ffffff`,selectionBackground:`#ddf4ff`,black:`#1d1d1f`,red:`#d1242f`,green:`#2da44e`,yellow:`#bf8700`,blue:`#0077cc`,magenta:`#8250df`,cyan:`#0077cc`,white:`#f5f5f7`,brightBlack:`#86868b`,brightRed:`#d1242f`,brightGreen:`#2da44e`,brightYellow:`#bf8700`,brightBlue:`#0077cc`,brightMagenta:`#8250df`,brightCyan:`#0077cc`,brightWhite:`#ffffff`},{effective:b}=wu();function x(){return b.value===`light`?y:v}let S={fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:13,lineHeight:1.2,theme:x(),cursorBlink:!0,cursorStyle:`bar`,allowProposedApi:!0};P(b,()=>{let e=x();for(let t of s)t.terminal.options.theme=e});function C(){return s.find(e=>e.id===c.value)}function ee(e,n){if(t.has(e))return;t.add(e);let r=document.createElement(`div`);r.style.cssText=`width:100%;height:100%;display:none;overflow:hidden`;let i=new f0(S),a=new h0;i.loadAddon(a),l.value?.appendChild(r),i.open(r);let o=String(++f),c=Yt({id:o,sessionId:e,label:n,connected:!1,terminal:i,fitAddon:a,eventSource:null,containerEl:r});i.onTitleChange(e=>{let t=e.split(`/`).pop()||e;c.label=t,fetch(`/api/terminal/${c.sessionId}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:t})})}),i.onData(e=>{let t=e;if(m.value&&e.length===1){let n=e.toUpperCase().charCodeAt(0)-64;n>=0&&n<=31&&(t=String.fromCharCode(n)),m.value=!1}else h.value&&e.length===1&&(t=`\x1B`+e,h.value=!1);fetch(`/api/terminal/${c.sessionId}/input`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t})})});let u=new EventSource(`/api/terminal/${e}/stream`,{withCredentials:!0});u.onmessage=e=>{let t=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0));c.terminal.write(t)},u.onopen=()=>{c.connected=!0,zn(()=>re(c))},u.onerror=()=>{u.close(),c.connected=!1,ae(o)},c.eventSource=u,s.push(c),ie(o)}function w(e,t){let n=C();if(!n)return;let r=e;if(!t)if(m.value&&e.length===1){let t=e.toUpperCase().charCodeAt(0)-64;t>=0&&t<=31&&(r=String.fromCharCode(t)),m.value=!1,h.value=!1}else h.value&&e.length===1&&(r=`\x1B`+e,h.value=!1,m.value=!1);fetch(`/api/terminal/${n.sessionId}/input`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:r})})}let T=[{label:`ctrl`,toggle:m},{label:`alt`,toggle:h},{label:`tab`,seq:` `,raw:!0},{label:`esc`,seq:`\x1B`,raw:!0},{label:`←`,seq:`\x1B[D`,raw:!0},{label:`↑`,seq:`\x1B[A`,raw:!0},{label:`↓`,seq:`\x1B[B`,raw:!0},{label:`→`,seq:`\x1B[C`,raw:!0},{label:`|`,seq:`|`},{label:`-`,seq:`-`},{label:`/`,seq:`/`},{label:`~`,seq:`~`}],{menu:E,onContext:D,close:te}=uu();async function ne(e){u.value=``;let t=await Pu(`/api/terminal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:80,rows:24,sandbox:e?.virtual})});if(!t){u.value=`failed to create terminal session`;return}ee(t.id,t.label??`shell`)}function re(e){e.fitAddon.fit(),fetch(`/api/terminal/${e.sessionId}/resize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:e.terminal.cols,rows:e.terminal.rows})}).then(()=>{fetch(`/api/terminal/${e.sessionId}/nudge`,{method:`POST`})})}function ie(e){for(let t of s)t.containerEl.style.display=t.id===e?`block`:`none`;c.value=e;let t=s.find(t=>t.id===e);t&&r({tab:t.sessionId}),zn(()=>{t&&(re(t),t.terminal.focus())})}async function O(e){if(!await o(`Close this terminal session?`))return;let n=s.findIndex(t=>t.id===e);if(n<0)return;let r=s[n];if(r.eventSource?.close(),r.terminal.dispose(),r.containerEl.remove(),t.delete(r.sessionId),fetch(`/api/terminal/${r.sessionId}`,{method:`DELETE`}),s.splice(n,1),s.length===0){a();return}if(c.value===e){let e=s[Math.min(n,s.length-1)];e?ie(e.id):c.value=null}}function ae(e){let n=s.findIndex(t=>t.id===e);if(n<0)return;let r=s[n];if(r.eventSource?.close(),r.terminal.dispose(),r.containerEl.remove(),t.delete(r.sessionId),s.splice(n,1),s.length===0){a();return}if(c.value===e){let e=s[Math.min(n,s.length-1)];e?ie(e.id):c.value=null}}return P(()=>n.value.connectSession,e=>{e&&!t.has(e)&&ee(e,`shell`)}),Zr(async()=>{await zn(),d=new ResizeObserver(()=>{let e=C();e&&re(e)}),l.value&&d.observe(l.value);let e=n.value.tab,r=await Pu(`/api/terminal`);if(r&&r.length>0){let n=r.filter(e=>!t.has(e.id)).sort((e,t)=>e.createdAt-t.createdAt);if(n.length>0){for(let e of n)ee(e.id,e.label);if(e){let t=s.find(t=>t.sessionId===e);t&&ie(t.id)}}else await ne()}else await ne()}),ti(()=>{d?.disconnect();for(let e of s)e.eventSource?.close(),e.terminal.dispose(),t.delete(e.sessionId);s.length=0}),(e,t)=>(R(),z(`div`,g0,[V(`div`,_0,[(R(!0),z(L,null,I(s,e=>(R(),z(`button`,{key:e.id,type:`button`,class:A([`group relative flex-1 min-w-0 flex items-center justify-center gap-1.5 py-2 text-[13px] border-r border-border rounded-none active:transform-none transition-colors`,e.id===c.value?`bg-surface text-text`:`text-muted hover:text-text hover:bg-surface`]),onClick:t=>ie(e.id)},[V(`span`,{class:A([`absolute left-2 w-4 h-4 flex items-center justify-center text-[11px] text-muted group-hover:opacity-100 hover:text-danger! transition-all`,e.id===c.value?`opacity-100`:`opacity-0`]),onClick:Js(t=>O(e.id),[`stop`])},`×`,10,y0),V(`span`,{class:A([`inline-block w-1.5 h-1.5 rounded-full shrink-0`,e.id===c.value?e.connected?`bg-ok`:`bg-danger`:`bg-muted`])},null,2),V(`span`,b0,j(e.label),1)],10,v0))),128)),V(`button`,{type:`button`,class:`shrink-0 px-3 py-2 text-[13px] text-muted hover:text-accent rounded-none active:transform-none transition-colors`,title:`new terminal (right-click for options)`,onClick:t[0]||=e=>ne(),onContextmenu:t[1]||=e=>N(D)(e)},` + `,32)]),H(Hl,{pos:N(E)??null},{default:Zn(()=>[V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:t[2]||=e=>{N(te)(),ne()}},` New Shell `),V(`button`,{class:`w-full text-left px-4 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:t[3]||=e=>{N(te)(),ne({virtual:!0})}},` New Virtual Shell `)]),_:1},8,[`pos`]),N(p)?(R(),z(`div`,x0,[(R(),z(L,null,I(T,(e,t)=>V(`button`,{key:t,type:`button`,class:A([`shrink-0 h-[30px] min-w-[30px] px-1.5 rounded text-[11px] font-mono font-medium border transition-colors active:transform-none`,e.toggle?.value?`bg-accent-dim text-accent border-accent-dim`:`bg-bg text-muted border-border hover:text-text`]),onMousedown:Js(t=>e.toggle?e.toggle.value=!e.toggle.value:w(e.seq,e.raw),[`prevent`]),onTouchstart:Js(t=>e.toggle?e.toggle.value=!e.toggle.value:w(e.seq,e.raw),[`prevent`])},j(e.label),43,S0)),64))])):W(``,!0),u.value?(R(),z(`div`,C0,j(u.value),1)):W(``,!0),V(`div`,{ref_key:`hostRef`,ref:l,class:`flex-1 min-h-0 bg-bg`,onTouchend:_},null,544)]))}}),window:{width:800,height:520,minwidth:480,minheight:300},multi:!1},T0={class:`grid gap-3 p-3`},E0={key:0,class:`border border-border p-3`},D0={class:`w-full border-collapse text-[12px]`},O0={class:`hover:bg-surface`},k0={class:`py-1.5 px-2 border-b border-border font-mono select-text`},A0=[`href`],j0={class:`hover:bg-surface`},M0={class:`py-1.5 px-2 border-b border-border font-mono`},N0={key:0},P0={key:1,class:`text-muted`},F0={class:`hover:bg-surface`},I0={class:`py-1.5 px-2 font-mono select-text`},L0={key:0},R0={key:1,class:`text-muted`},z0={key:1,class:`border border-border p-3`},B0={key:2,class:`border border-border p-3`},V0={class:`mb-2`},H0={key:0,class:`text-[11px] text-danger mb-2`},U0=[`disabled`],W0={key:3,class:`border border-border p-3`},G0={key:0,class:`text-[11px] text-danger mb-2`},K0=[`disabled`],q0={key:4,class:`border border-border p-3 text-[12px] text-muted`},J0={key:`tunnel`,label:`Tunnel`,icon:`lucide:route`,color:`#7C4DFF`,component:F({__name:`window`,setup(e){let{openWindow:t}=Du(),n=M(null),r=M(``),i=M(!1),a=M(``),o=M(null),s=G(()=>n.value?.connected??!1);async function c(){let e=await Pu(`/api/tunnel/status`);if(e)if(n.value=e,e.connected&&!o.value){let e=await Pu(`/api/tunnel/password`);e&&(o.value=e.password)}else e.connected||(o.value=null)}async function l(){i.value=!0,a.value=``;try{(await Nu(`/api/tunnel/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`connect`,subdomain:r.value.trim()||void 0})}))?.ok&&(r.value=``,await c())}catch(e){a.value=e instanceof Error?e.message:`connection failed`}finally{i.value=!1}}async function u(){i.value=!0,a.value=``;try{await Nu(`/api/tunnel/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`disconnect`})}),await c()}catch(e){a.value=e instanceof Error?e.message:`disconnect failed`}finally{i.value=!1}}return ld(`tunnel`,c),(e,c)=>(R(),z(`div`,T0,[s.value?(R(),z(`div`,E0,[c[5]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,D0,[V(`tbody`,null,[V(`tr`,O0,[c[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`url`,-1),V(`td`,k0,[V(`a`,{href:n.value?.url??``,target:`_blank`,class:`text-accent hover:underline`},j(n.value?.url),9,A0)])]),V(`tr`,j0,[c[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`subdomain`,-1),V(`td`,M0,[n.value?.subdomain?(R(),z(`span`,N0,j(n.value.subdomain),1)):(R(),z(`span`,P0,`auto`))])]),V(`tr`,F0,[c[4]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`password`,-1),V(`td`,I0,[o.value?(R(),z(`span`,L0,j(o.value),1)):(R(),z(`span`,R0,`loading...`))])])])])])):W(``,!0),s.value?W(``,!0):(R(),z(`div`,z0,[...c[6]||=[V(`h3`,{class:`section-title mb-2`},`localtunnel`,-1),V(`p`,{class:`text-[12px] text-muted`},[U(` Expose your PiClaw server to the internet via `),V(`a`,{href:`https://theboroer.github.io/localtunnel-www/`,target:`_blank`,class:`text-accent hover:underline`},`localtunnel`),U(`. Useful for webhooks, sharing, or mobile access. `)],-1)]])),s.value?W(``,!0):(R(),z(`div`,B0,[c[8]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Js(l,[`prevent`])},[V(`div`,V0,[c[7]||=V(`label`,{class:`label`},`subdomain (optional)`,-1),Qn(V(`input`,{"onUpdate:modelValue":c[0]||=e=>r.value=e,type:`text`,placeholder:`my-piclaw`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[Hs,r.value]])]),a.value?(R(),z(`div`,H0,j(a.value),1)):W(``,!0),V(`button`,{type:`submit`,disabled:i.value,class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`},j(i.value?`connecting...`:`connect`),9,U0)],32)])),s.value?(R(),z(`div`,W0,[c[9]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),a.value?(R(),z(`div`,G0,j(a.value),1)):W(``,!0),V(`button`,{type:`button`,disabled:i.value,class:`btn-danger`,onClick:u},` disconnect `,8,K0)])):W(``,!0),s.value?(R(),z(`div`,q0,[c[10]||=U(` New devices need approval. `,-1),V(`button`,{type:`button`,class:`text-accent hover:underline`,onClick:c[1]||=e=>N(t)(`devices`)},` Open Devices `)])):W(``,!0)]))}}),window:{width:420,height:360,minwidth:320,minheight:200,autosize:!0}},Y0={class:`flex items-center justify-center h-full bg-bg overflow-auto p-4`},X0=[`src`,`alt`],Z0=[`src`],Q0=[`src`],$0={key:3,class:`text-muted text-[12px]`},e2=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`avif`]),t2=new Set([`mp4`,`webm`,`mov`,`avi`]),n2=new Set([`mp3`,`wav`,`ogg`,`flac`]);const r2=new Set([...e2,...t2,...n2]);var i2=F({__name:`MediaViewer`,props:{folder:{},path:{}},setup(e){let t=e,n=G(()=>`/api/files/raw?${new URLSearchParams({folder:t.folder,path:t.path})}`),r=G(()=>t.path.split(`.`).pop()?.toLowerCase()??``),i=G(()=>e2.has(r.value)?`image`:t2.has(r.value)?`video`:n2.has(r.value)?`audio`:`unknown`);return(t,r)=>(R(),z(`div`,Y0,[i.value===`image`?(R(),z(`img`,{key:0,src:n.value,alt:e.path,class:`max-w-full max-h-full object-contain rounded`},null,8,X0)):i.value===`video`?(R(),z(`video`,{key:1,src:n.value,controls:``,class:`max-w-full max-h-full rounded`},null,8,Z0)):i.value===`audio`?(R(),z(`audio`,{key:2,src:n.value,controls:``,class:`w-full max-w-md`},null,8,Q0)):(R(),z(`div`,$0,`unsupported media format`))]))}}),a2={class:`flex flex-col h-full`},o2={key:0,class:`px-3 py-1.5 border-b border-border flex items-center gap-2 text-[11px]`},s2={class:`text-muted/60 text-[10px] uppercase tracking-wide`},c2={class:`text-muted font-mono truncate`},l2={key:0,class:`text-warn text-[10px]`},u2={class:`ml-auto flex gap-2 flex-shrink-0`},d2=[`disabled`],f2={key:0,class:`text-[9px] opacity-60`},p2={key:4,class:`flex-1 flex flex-col items-center justify-center gap-3 text-muted text-[12px]`},m2={class:`flex items-center gap-1 text-[11px] text-muted mb-2 flex-wrap`},h2={key:0,class:`opacity-40`},g2=[`onClick`],_2={key:0,class:`text-center py-6 text-muted text-[11px]`},v2=[`onClick`],y2={key:0,class:`text-center py-6 text-muted text-[11px]`},b2=[`onClick`],x2={key:`editor`,label:`Editor`,icon:`lucide:file-pen-line`,color:`#39bae6`,component:F({__name:`window`,setup(e){let{confirm:t}=Zu(),{state:n,set:r,setTitle:i}=Du(),a=M(``),o=M(``),s=M(``),c=M(!1),l=M(!1),u=M(!1),d=M([]),f=M(``),p=M(`.`),m=M([]),h=G(()=>[...m.value].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)),g=G(()=>{let e=[`~`];return f.value?(e.push(f.value),p.value!==`.`&&e.push(...p.value.split(`/`)),e):e});async function _(){f.value=``,p.value=`.`,m.value=[],u.value=!0;let e=await Pu(`/api/files/groups`);e&&(d.value=e)}async function v(e){f.value=e.folder,p.value=`.`,await y()}async function y(){let e=await Pu(`/api/files?${new URLSearchParams({folder:f.value,path:p.value})}`);e&&(m.value=e.entries)}async function b(e){if(e===`..`){if(p.value===`.`){f.value=``,m.value=[];return}let e=p.value.split(`/`);e.pop(),p.value=e.length>0?e.join(`/`):`.`}else p.value=p.value===`.`?e:`${p.value}/${e}`;await y()}function x(e){if(e===0){f.value=``,p.value=`.`,m.value=[];return}e===1?p.value=`.`:p.value=p.value.split(`/`).slice(0,e-1).join(`/`),y()}function S(e){let t=p.value===`.`?e:`${p.value}/${e}`;a.value=f.value,o.value=t,r({folder:f.value,path:t}),u.value=!1,T()}function C(e){e.type===`directory`?b(e.name):S(e.name)}let ee=G(()=>{let e=o.value.split(`.`).pop()?.toLowerCase()??``;return r2.has(e)}),w=G(()=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,html:`html`,css:`css`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`,py:`python`,rs:`rust`,go:`go`,sql:`sql`,xml:`xml`})[o.value.split(`.`).pop()?.toLowerCase()??``]??`plaintext`);async function T(){if(!a.value||!o.value)return;if(ee.value){s.value=``,c.value=!1;return}let e=await Pu(`/api/files/read?${new URLSearchParams({folder:a.value,path:o.value})}`);e&&(s.value=e.content,c.value=!1)}async function E(){!o.value||l.value||(l.value=!0,await Nu(`/api/files/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folder:a.value,path:o.value,content:s.value})}),c.value=!1,l.value=!1)}return P(o,e=>{let t=e.split(`/`).pop();i(t?`Editor — ${t}`:`Editor`)}),P(()=>[n.value.folder,n.value.path],async([e,n])=>{if(!(e===a.value&&n===o.value)){if(c.value&&!await t(`discard unsaved changes?`)){r({folder:a.value,path:o.value});return}a.value=e||``,o.value=n||``,await T()}},{immediate:!0}),(e,t)=>(R(),z(`div`,a2,[o.value?(R(),z(`div`,o2,[V(`span`,s2,j(w.value),1),V(`span`,c2,j(a.value)+`/`+j(o.value),1),c.value?(R(),z(`span`,l2,`~`)):W(``,!0),V(`div`,u2,[V(`button`,{type:`button`,class:`btn-sm hover:bg-surface`,onClick:T},[...t[4]||=[U(` refresh `,-1),V(`span`,{class:`text-[9px] opacity-60`},`⌘R`,-1)]]),ee.value?W(``,!0):(R(),z(`button`,{key:0,type:`button`,class:`btn-sm bg-accent-dim text-accent border-accent-dim hover:bg-accent-dimmer`,disabled:l.value,onClick:E},[U(j(l.value?`saving...`:`save`)+` `,1),l.value?W(``,!0):(R(),z(`span`,f2,`⌘S`))],8,d2))])])):W(``,!0),o.value&&ee.value?(R(),B(i2,{key:1,folder:a.value,path:o.value,class:`flex-1`},null,8,[`folder`,`path`])):o.value&&w.value===`markdown`?(R(),B(yV,{key:2,"model-value":s.value,class:`flex-1`,"onUpdate:modelValue":t[0]||=e=>{s.value=e,c.value=!0},onSave:E},null,8,[`model-value`])):o.value?(R(),B(wm,{key:3,"model-value":s.value,language:w.value,class:`flex-1`,"onUpdate:modelValue":t[1]||=e=>{s.value=e,c.value=!0},onSave:E},null,8,[`model-value`,`language`])):(R(),z(`div`,p2,[t[6]||=V(`span`,null,`no file open`,-1),V(`button`,{type:`button`,class:`btn-sm bg-surface hover:bg-accent-dim hover:text-accent`,onClick:_},[H(N(K),{icon:`lucide:folder-open`,class:`w-3 h-3 mr-1 inline-block align-[-2px]`}),t[5]||=U(` browse files `,-1)])])),u.value?(R(),B(Kl,{key:5,title:`open file`,onClose:t[3]||=e=>u.value=!1},{default:Zn(()=>[V(`div`,m2,[(R(!0),z(L,null,I(g.value,(e,t)=>(R(),z(L,{key:t},[t>0?(R(),z(`span`,h2,`/`)):W(``,!0),V(`button`,{type:`button`,class:A([`hover:text-text transition-colors`,t===g.value.length-1?`text-text`:``]),onClick:e=>x(t)},j(t===0?`~/`:e),11,g2)],64))),128))]),f.value?(R(),z(L,{key:1},[V(`div`,{class:`flex items-center gap-1.5 px-2 py-1.5 font-mono text-[12px] text-muted hover:bg-surface cursor-pointer rounded`,onClick:t[2]||=e=>b(`..`)},` .. `),h.value.length===0?(R(),z(`div`,y2,` empty `)):W(``,!0),(R(!0),z(L,null,I(h.value,e=>(R(),z(`div`,{key:e.name,class:A([`flex items-center gap-1.5 px-2 py-1.5 font-mono text-[12px] hover:bg-surface cursor-pointer rounded`,e.type===`directory`?`text-accent`:`text-text`]),onClick:t=>C(e)},[H(N(K),{icon:e.type===`directory`?N(Pv)(!1).icon:N(Nv)(e.name).icon,class:A([e.type===`directory`?`text-accent`:N(Nv)(e.name).color,`w-3.5 h-3.5 flex-shrink-0`])},null,8,[`icon`,`class`]),U(` `+j(e.name)+j(e.type===`directory`?`/`:``),1)],10,b2))),128))],64)):(R(),z(L,{key:0},[d.value.length===0?(R(),z(`div`,_2,` no groups `)):W(``,!0),(R(!0),z(L,null,I(d.value,e=>(R(),z(`div`,{key:e.jid,class:`flex items-center gap-1.5 px-2 py-1.5 font-mono text-[12px] text-accent hover:bg-surface cursor-pointer rounded`,onClick:t=>v(e)},[H(N(K),{icon:`lucide:folder`,class:`w-3.5 h-3.5 flex-shrink-0`}),U(` `+j(e.folder)+`/ `,1)],8,v2))),128))],64))]),_:1})):W(``,!0)]))}}),window:{width:720,height:520,minwidth:400,minheight:300},multi:!0,hidden:!1},S2={class:`sandbox-switch`},C2=[`title`,`onClick`],w2=Ju(F({__name:`SandboxBanner`,setup(e){let t=[{value:`default`,label:`Default`,description:`No override (env/default)`},{value:`false`,label:`Off`,description:`Sandboxes disabled`},{value:`true`,label:`On`,description:`Sandboxes enabled`},{value:`enforced`,label:`Enforced`,description:`Always use sandbox`}],n=M(`default`),r=M(null),i=M(!1),a=G(()=>r.value===`true`||r.value===`enforced`),o=G(()=>r.value===`enforced`);async function s(){let e=await Pu(`/api/config`);e?.sandbox&&(r.value=e.sandbox.value??null,n.value=e.sandbox.source===`db`?e.sandbox.value:`default`,i.value=!0)}async function c(e){await Nu(`/api/config`,{method:`PATCH`,body:JSON.stringify({key:`sandbox`,value:e===`default`?null:e})}),n.value=e,await s()}return ld([`config`,`sandbox`],s),(e,r)=>i.value?(R(),z(`div`,{key:0,class:A([`border rounded-lg p-4 flex flex-col items-center gap-3`,a.value?`border-border bg-surface`:`border-warn-dim bg-warn-dim`])},[H(N(K),{icon:o.value?`lucide:lock`:a.value?`lucide:shield`:`lucide:shield-off`,class:A([`text-[32px]`,a.value?`text-accent`:`text-warn`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[12px] text-center`,a.value?`text-text`:`text-warn`])},[o.value?(R(),z(L,{key:0},[U(`sandbox mode is enforced globally`)],64)):a.value?(R(),z(L,{key:1},[U(`sandbox mode is enabled`)],64)):(R(),z(L,{key:2},[U(`sandbox mode is off`)],64)),r[3]||=U(` — `,-1),a.value?(R(),z(L,{key:3},[r[0]||=U(`agents run in an isolated `,-1),r[1]||=V(`a`,{href:`https://justbash.dev/`,target:`_blank`,class:`text-accent hover:underline`},`just-bash`,-1),r[2]||=U(` environment.`,-1)],64)):(R(),z(L,{key:4},[U(`agents have direct access to your system.`)],64))],2),V(`div`,S2,[(R(),z(L,null,I(t,e=>V(`button`,{key:e.value,type:`button`,class:A([`sandbox-switch-item`,{active:n.value===e.value}]),title:e.description,onClick:t=>c(e.value)},[e.value===`enforced`?(R(),B(N(K),{key:0,icon:`lucide:lock`,class:`text-[11px] mr-1 inline-block align-[-1px]`})):W(``,!0),U(j(e.label),1)],10,C2)),64))])],2)):W(``,!0)}}),[[`__scopeId`,`data-v-2ac9e55f`]]),T2={class:`grid gap-3 p-3`},E2={class:`flex items-center justify-between`},D2={class:`text-[12px] text-muted`},O2={key:0,class:`text-[12px] text-muted text-center py-6`},k2={class:`min-w-0`},A2={class:`text-[12px] text-text font-medium flex items-center gap-2`},j2={key:0,class:`badge-accent`},M2={key:1,class:`badge-muted`},N2={key:2,class:`badge-muted`},P2={key:0,class:`text-[11px] text-muted font-mono mt-0.5`},F2={key:1,class:`text-[10px] text-muted mt-1`},I2={key:0,class:`flex gap-2`},L2=[`onClick`],R2=[`disabled`,`onClick`],z2=[`disabled`],B2={key:`sandboxes`,label:`Sandbox`,icon:`lucide:shield`,color:`#f5a623`,component:F({__name:`window`,setup(e){let{openWindow:t}=Du(),n=M([]),r=M(!1),i=M(!1);async function a(){i.value=!0;try{await Pu(`/api/sandbox`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),await o()}finally{i.value=!1}}async function o(){let e=await Pu(`/api/sandbox`);e&&(n.value=e)}async function s(e){let n=await Pu(`/api/terminal`,{method:`POST`,body:JSON.stringify({sandboxId:e})});n&&t(`terminal`,{connectSession:n.id})}async function c(e){r.value=!0;try{await Nu(`/api/sandbox/${encodeURIComponent(e)}`,{method:`DELETE`}),await o()}finally{r.value=!1}}return ld([`sandbox`,`groups`],o),(e,t)=>(R(),z(`div`,T2,[H(w2),V(`div`,E2,[V(`span`,D2,j(n.value.length)+` sandbox`+j(n.value.length===1?``:`es`),1)]),n.value.length===0?(R(),z(`div`,O2,` no sandboxes `)):W(``,!0),(R(!0),z(L,null,I(n.value,e=>(R(),z(`div`,{key:e.id,class:A([`border border-border p-3 flex items-start justify-between gap-3`,{"opacity-50":!e.active}])},[V(`div`,k2,[V(`div`,A2,[U(j(e.groupName||e.id)+` `,1),e.active&&e.overlay?(R(),z(`span`,j2,`overlay`)):e.active?(R(),z(`span`,M2,`memory`)):(R(),z(`span`,N2,`inactive`))]),e.active?(R(),z(`div`,P2,j(e.cwd),1)):W(``,!0),e.active?(R(),z(`div`,F2,j(e.fileCount)+` file`+j(e.fileCount===1?``:`s`),1)):W(``,!0)]),e.active?(R(),z(`div`,I2,[V(`button`,{type:`button`,class:`w-9 h-9 flex items-center justify-center rounded-xl bg-muted/20 hover:bg-muted/40 text-text transition-colors`,title:`Open terminal`,onClick:t=>s(e.id)},[H(N(K),{icon:`lucide:terminal`,class:`text-base`})],8,L2),V(`button`,{type:`button`,disabled:r.value,class:`w-9 h-9 flex items-center justify-center rounded-xl bg-danger/10 hover:bg-danger/20 text-danger transition-colors`,title:`Destroy sandbox`,onClick:t=>c(e.id)},[H(N(K),{icon:`lucide:trash-2`,class:`text-base`})],8,R2)])):W(``,!0)],2))),128)),V(`button`,{type:`button`,disabled:i.value,class:`btn-primary text-[12px] w-full`,onClick:a},` + new sandbox `,8,z2)]))}}),window:{width:500,height:400,minwidth:380,minheight:250,autosize:!0}},V2={class:`@container flex flex-col h-full p-4 gap-4 overflow-y-auto select-none`},H2={key:0,class:`border border-border rounded-lg p-3 flex items-center justify-between gap-3 bg-surface`},U2={class:`grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 gap-3`},W2={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},G2={class:`flex items-center gap-2`},K2={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},q2={class:`flex items-center gap-2`},J2=[`disabled`],Y2={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},X2={class:`flex items-center gap-2`},Z2=[`disabled`],Q2={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},$2={class:`flex items-center gap-2`},e4={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},t4={class:`flex items-center gap-2`},n4={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},r4={class:`flex items-center gap-2`},i4={class:`grid grid-cols-3 @sm:grid-cols-4 @lg:grid-cols-5 gap-2`},a4=[`onClick`],o4={class:`text-[10px] font-medium`};const s4=[pv,Uh,fU,gh,xK,Ty,HK,UV,gH,Ov,J0,ly,x2,B2,w0,tK,SG,{key:`welcome`,label:`Welcome`,icon:`lucide:sparkles`,color:`#e5a535`,component:F({__name:`window`,setup(e){let t=new Set([`agent`,`telegram`,`ntfy`,`tunnel`,`chat`,`settings`,`welcome`]),n=s4.filter(e=>!e.hidden&&!t.has(e.key)),{openWindow:r}=Du(),{showInstall:i}=nu(),a=M(null),o=M(null),s=M(null),c=M(null),l=M(0);async function u(){let[e,t,n,r,i]=await Promise.all([Pu(`/api/pi/status`),Pu(`/api/telegram/status`),Pu(`/api/ntfy/status`),Pu(`/api/tunnel/status`),Pu(`/api/groups`)]);e&&(a.value=e),t&&(o.value=t),n&&(s.value=n),r&&(c.value=r),i&&(l.value=i.length)}ld([`pi_status`,`telegram`,`ntfy`,`tunnel`,`groups`],u);let d=G(()=>(a.value?.auth.configuredProviders.length??0)>0||a.value?.auth.providers.some(e=>e.hasAuth)),f=G(()=>o.value?.connected??!1),p=G(()=>s.value?.configured??!1),m=G(()=>l.value>0),h=G(()=>c.value?.connected??!1);function g(){r(`agent`,{tab:`auth`})}function _(){r(`telegram`)}function v(){r(`chat`)}function y(){r(`ntfy`)}function b(){r(`settings`,{tab:`wallpaper`})}function x(){r(`tunnel`)}return(e,t)=>(R(),z(`div`,V2,[t[9]||=V(`div`,{class:`text-center`},[V(`div`,{class:`text-[18px] font-medium text-text mb-1`},`welcome to piclaw`),V(`div`,{class:`text-[12px] text-muted`},`follow these steps to get started`)],-1),N(i)?(R(),z(`div`,H2,[t[0]||=V(`div`,{class:`flex flex-col gap-1`},[V(`div`,{class:`text-[12px] text-text`},`for the best experience, install piclaw`)],-1),H(lu,{"inline-install":``})])):W(``,!0),H(w2),V(`div`,U2,[V(`div`,W2,[V(`div`,G2,[H(N(K),{icon:d.value?`lucide:check`:`lucide:cpu`,class:A([`text-[16px] shrink-0`,d.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[13px] font-medium`,d.value?`text-ok`:`text-text`])},` Connect AI provider `,2)]),t[1]||=V(`div`,{class:`text-[11px] text-muted`},` set up a provider (anthropic, openai, etc.) to power your agents `,-1),V(`button`,{type:`button`,class:A([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors`,d.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`]),onClick:g},j(d.value?`connected — manage`:`open agent settings`),3)]),V(`div`,K2,[V(`div`,q2,[H(N(K),{icon:d.value&&m.value?`lucide:check`:`lucide:message-circle`,class:A([`text-[16px] shrink-0`,d.value&&m.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[13px] font-medium`,d.value&&m.value?`text-ok`:`text-text`])},` Start your first chat `,2)]),t[2]||=V(`div`,{class:`text-[11px] text-muted`},`register a group and send your first message`,-1),V(`button`,{type:`button`,class:A([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium transition-colors`,d.value?m.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text cursor-pointer`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer cursor-pointer`:`bg-surface text-muted border border-border cursor-not-allowed opacity-50`]),disabled:!d.value,onClick:v},j(d.value?m.value?`started — open chat`:`open chat`:`connect a provider first`),11,J2)]),V(`div`,Y2,[V(`div`,X2,[H(N(K),{icon:d.value&&f.value?`lucide:check`:`lucide:send`,class:A([`text-[16px] shrink-0`,d.value&&f.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[13px] font-medium`,d.value&&f.value?`text-ok`:`text-text`])},` Connect telegram `,2)]),t[3]||=V(`div`,{class:`text-[11px] text-muted`},`link a telegram bot to chat from telegram`,-1),V(`button`,{type:`button`,class:A([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium transition-colors`,d.value?f.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text cursor-pointer`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer cursor-pointer`:`bg-surface text-muted border border-border cursor-not-allowed opacity-50`]),disabled:!d.value,onClick:_},j(d.value?f.value?`connected — @${o.value?.botUsername}`:`set up telegram bot`:`connect a provider first`),11,Z2)]),V(`div`,Q2,[V(`div`,$2,[H(N(K),{icon:p.value?`lucide:check`:`lucide:bell`,class:A([`text-[16px] shrink-0`,p.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[13px] font-medium`,p.value?`text-ok`:`text-text`])},` Set up notifications `,2)]),t[4]||=V(`div`,{class:`text-[11px] text-muted`},` get push notifications via ntfy when agents respond `,-1),V(`button`,{type:`button`,class:A([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors`,p.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`]),onClick:y},j(p.value?`configured — manage`:`set up ntfy`),3)]),V(`div`,e4,[V(`div`,t4,[H(N(K),{icon:h.value?`lucide:check`:`lucide:globe`,class:A([`text-[16px] shrink-0`,h.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:A([`text-[13px] font-medium`,h.value?`text-ok`:`text-text`])},` Expose via tunnel `,2)]),t[5]||=V(`div`,{class:`text-[11px] text-muted`},`create a public URL to access piclaw from anywhere`,-1),V(`button`,{type:`button`,class:A([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors`,h.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`]),onClick:x},j(h.value?`connected — manage`:`set up tunnel`),3)]),V(`div`,n4,[V(`div`,r4,[H(N(K),{icon:`lucide:palette`,class:`text-[16px] shrink-0 text-muted`}),t[6]||=V(`div`,{class:`text-[13px] font-medium text-text`},`Customize`,-1)]),t[7]||=V(`div`,{class:`text-[11px] text-muted`},`personalize your system`,-1),V(`button`,{type:`button`,class:`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`,onClick:b},` open settings `)])]),V(`div`,null,[t[8]||=V(`div`,{class:`label mb-2`},`discover more`,-1),V(`div`,i4,[(R(!0),z(L,null,I(N(n),e=>(R(),z(`button`,{key:e.key,type:`button`,class:`flex flex-col items-center justify-center gap-1 py-2 rounded-lg border border-border bg-surface cursor-pointer transition-colors hover:border-muted hover:text-text text-muted`,onClick:t=>N(r)(e.key)},[H(N(K),{icon:e.icon,class:`text-[16px]`,style:k({color:e.color})},null,8,[`icon`,`style`]),V(`span`,o4,j(e.label.toLowerCase()),1)],8,a4))),128))])])]))}}),window:{width:650,height:700,minwidth:520,minheight:440}}];var c4={class:`flex justify-center pb-1.5 pt-0.5 sticky bottom-0 z-[1001] pointer-events-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:pb-0 max-md:pt-0`},l4=[`onClick`,`onContextmenu`,`onTouchstart`],u4={key:1,class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},d4=[`onClick`,`onContextmenu`,`onTouchstart`],f4={key:2,class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},p4={key:0,class:`font-pixel text-[13px] select-none leading-none`,style:{color:`var(--dock-text-active)`}},m4=[`title`],h4=[`onClick`],g4={class:`flex items-center justify-center w-14 h-14 sm:w-21 sm:h-21 rounded-2xl bg-surface border border-border shadow-md transition-transform group-hover:scale-110`},_4={key:0,class:`w-1 h-1 rounded-full bg-accent`},v4={key:0,class:`fixed inset-0 z-[1200] flex flex-col items-center justify-center backdrop-blur-xl bg-bg/60 select-none`},y4={class:`flex flex-col items-center gap-4`},b4=8,x4=F({__name:`DashPanel`,props:{openInstances:{},minimized:{},focusedWindow:{}},emits:[`launch`,`focus`,`minimize`,`close`],setup(e,{emit:t}){let n=e,r=t,{settings:i,set:a}=Su(),{effective:o}=wu(),s=G(()=>o.value===`light`),c={small:{bar:40,item:34,icon:16},medium:{bar:48,item:40,icon:20},large:{bar:56,item:46,icon:24}},l=G(()=>{let e=c[i.dockSize]||c.medium;return{"--dock-h":`${e.bar}px`,"--dock-item":`${e.item}px`,"--dock-icon":`${e.icon}px`}});P(()=>i.dockSize,e=>{let t=c[e]||c.medium;document.documentElement.style.setProperty(`--dock-bottom`,`${t.bar+b4}px`)},{immediate:!0});let u=M(!1),d=M(``),f,{menu:p,onContext:m,onTouchStart:h,cancelLongPress:g,close:_}=uu();function v(){p.value?.data.instanceId&&r(`minimize`,p.value.data.instanceId),_()}function y(){p.value?.data.instanceId&&r(`close`,p.value.data.instanceId),_()}let b=G(()=>p.value?i.pinnedApps.includes(p.value.data.appKey):!1);function x(){if(!p.value)return;let e=p.value.data.appKey,t=i.pinnedApps;a({pinnedApps:t.includes(e)?t.filter(t=>t!==e):[...t,e]}),_()}let{menu:S,onContext:C,close:ee}=uu();function w(){ee(),r(`launch`,`settings`,{tab:`dash`})}let T=G(()=>i.pinnedApps.map(e=>s4.find(t=>t.key===e)).filter(Boolean)),E=G(()=>n.openInstances.filter(e=>!i.pinnedApps.includes(e.appKey)));function D(e){return n.openInstances.find(t=>t.appKey===e)}function te(e){let t=D(e);t?r(`focus`,t.id):r(`launch`,e)}let ne=G(()=>new Set(n.openInstances.map(e=>e.appKey))),re=M(``),ie=M(),O=M(!1),ae=id(),oe=ad(),se=G(()=>{let e=re.value.toLowerCase().trim(),t=s4.filter(e=>!e.hidden);return e?t.filter(t=>t.label.toLowerCase().includes(e)):t}),{presence:ce}=hd(),le=G(()=>ce.value.connected),ue=M(!1),de=M(!1),fe=setTimeout(()=>{de.value=!0},3e3);P(le,(e,t)=>{e&&(de.value=!0,clearTimeout(fe)),e&&!t&&(ue.value=!1)});let pe=()=>window.location.reload();function me(){u.value=!u.value,re.value=``,O.value=!1,u.value&&!oe.value&&zn(()=>ie.value?.focus())}function he(){O.value=!0,zn(()=>ie.value?.focus())}function ge(e){e.key===`Enter`&&se.value.length===1&&_e(se.value[0].key)}function _e(e){r(`launch`,e),u.value=!1}function ve(){d.value=new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:i.clockFormat===`12h`})}function ye(e){if(e.key===`Escape`&&p.value){_(),e.preventDefault();return}e.key===`Escape`&&u.value&&(u.value=!1,e.preventDefault()),(e.key===` `||e.key===`k`)&&(e.ctrlKey||e.metaKey)&&(me(),e.preventDefault())}function be(){window.location.reload()}return Zr(()=>{ve(),f=setInterval(ve,1e4),document.addEventListener(`keydown`,ye)}),ti(()=>{clearInterval(f),clearTimeout(fe),document.removeEventListener(`keydown`,ye)}),(t,n)=>(R(),z(L,null,[V(`div`,c4,[V(`div`,{class:`dock-bar pointer-events-auto px-2 rounded-2xl flex items-center gap-1 text-[12px] select-none max-md:w-full max-md:rounded-none`,style:k(l.value),onContextmenu:n[6]||=e=>N(C)(e,void 0)},[V(`button`,{type:`button`,class:A([`dock-item`,{"text-accent":u.value}]),style:k(u.value?{}:{color:`var(--dock-text)`}),title:`Apps (Ctrl+Space / Ctrl+K)`,onClick:me,onContextmenu:n[0]||=e=>N(C)(e,void 0)},[H(N(K),{icon:`lucide:layout-grid`,class:`dock-icon`})],38),T.value.length?(R(),z(L,{key:0},[n[11]||=V(`div`,{class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},null,-1),(R(!0),z(L,null,I(T.value,t=>(R(),B(nd,{key:`pinned-${t.key}`,text:t.label},{default:Zn(()=>[V(`button`,{type:`button`,class:A([`dock-item`,{"opacity-50":D(t.key)&&e.minimized[D(t.key).id]}]),style:k({color:D(t.key)&&e.focusedWindow===D(t.key)?.id?`var(--dock-text-active)`:`var(--dock-text)`}),onClick:e=>te(t.key),onContextmenu:Js(e=>N(m)(e,{instanceId:D(t.key)?.id,appKey:t.key}),[`stop`]),onTouchstart:e=>N(h)(e,{instanceId:D(t.key)?.id,appKey:t.key}),onTouchend:n[1]||=(...e)=>N(g)&&N(g)(...e),onTouchmove:n[2]||=(...e)=>N(g)&&N(g)(...e)},[H(N(K),{icon:t.icon,class:`dock-icon`,"aria-hidden":`true`,style:k({color:s.value&&t.lightColor?t.lightColor:t.color})},null,8,[`icon`,`style`]),D(t.key)?(R(),z(`span`,{key:0,class:A([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,e.focusedWindow===D(t.key)?.id?`bg-accent opacity-100`:`bg-muted opacity-50`])},null,2)):W(``,!0)],46,l4)]),_:2},1032,[`text`]))),128))],64)):W(``,!0),E.value.length?(R(),z(`div`,u4)):W(``,!0),(R(!0),z(L,null,I(E.value,t=>(R(),B(nd,{key:t.id,text:t.app.label},{default:Zn(()=>[V(`button`,{type:`button`,class:A([`dock-item`,{"opacity-50":e.minimized[t.id]}]),style:k({color:e.focusedWindow===t.id?`var(--dock-text-active)`:`var(--dock-text)`}),onClick:e=>r(`focus`,t.id),onContextmenu:Js(e=>N(m)(e,{instanceId:t.id,appKey:t.appKey}),[`stop`]),onTouchstart:e=>N(h)(e,{instanceId:t.id,appKey:t.appKey}),onTouchend:n[3]||=(...e)=>N(g)&&N(g)(...e),onTouchmove:n[4]||=(...e)=>N(g)&&N(g)(...e)},[H(N(K),{icon:t.app.icon,class:`dock-icon`,"aria-hidden":`true`,style:k({color:s.value&&t.app.lightColor?t.app.lightColor:t.app.color})},null,8,[`icon`,`style`]),V(`span`,{class:A([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,e.focusedWindow===t.id?`bg-accent opacity-100`:`bg-muted opacity-50`])},null,2)],46,d4)]),_:2},1032,[`text`]))),128)),n[12]||=V(`div`,{class:`flex-1`},null,-1),e.openInstances.length&&(N(i).showClock||N(i).showStatus)?(R(),z(`div`,f4)):W(``,!0),N(i).showClock||N(i).showStatus?(R(),z(`div`,{key:3,class:`dock-item !cursor-default !w-auto px-1.5 hover:!bg-transparent hover:!transform-none`,style:{color:`var(--dock-text)`},onContextmenu:n[5]||=e=>N(C)(e,void 0)},[N(i).showClock?(R(),z(`span`,p4,j(d.value),1)):W(``,!0),N(i).showStatus?(R(),z(`span`,{key:1,class:A([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,le.value?`bg-ok`:`bg-danger`]),title:le.value?`server healthy`:`server unreachable`},null,10,m4)):W(``,!0)],32)):W(``,!0)],36)]),(R(),B(yr,{to:`body`},[H(Fo,{name:`launchpad`},{default:Zn(()=>[u.value?(R(),z(`div`,{key:0,class:A([`fixed inset-0 z-[1100] flex justify-center backdrop-blur-sm backdrop-saturate-150`,[O.value?`items-start pt-16`:`items-center`,s.value?`bg-white/15`:`bg-black/20`]]),onClick:n[10]||=Js(e=>u.value=!1,[`self`])},[!N(ae)||O.value?Qn((R(),z(`input`,{key:0,ref_key:`searchInput`,ref:ie,"onUpdate:modelValue":n[7]||=e=>re.value=e,class:`absolute left-1/2 -translate-x-1/2 w-48 px-3 py-1.5 bg-surface/90 border border-border rounded-lg text-sm text-text backdrop-blur-md outline-none text-center`,style:{top:`calc(var(--sat) + 1.5rem)`},placeholder:`search apps...`,"aria-label":`Search apps`,onKeydown:ge},null,544)),[[Hs,re.value]]):W(``,!0),V(`button`,{type:`button`,class:A([`absolute left-6 p-2 transition-colors`,s.value?`text-black/40 hover:text-black`:`text-white/50 hover:text-white`]),style:{top:`calc(var(--sat) + 1.5rem)`},title:`close`,onClick:n[8]||=e=>u.value=!1},[H(N(K),{icon:`lucide:x`,class:`text-lg`})],2),V(`button`,{type:`button`,class:A([`absolute right-6 p-2 transition-colors`,s.value?`text-black/40 hover:text-black`:`text-white/50 hover:text-white`]),style:{top:`calc(var(--sat) + 1.5rem)`},title:`restart`,onClick:be},[H(N(K),{icon:`lucide:rotate-cw`,class:`text-lg`})],2),N(ae)&&!O.value?(R(),z(`button`,{key:1,type:`button`,class:`absolute right-6 p-2 bg-surface/80 border border-border rounded-lg text-muted hover:text-text backdrop-blur-md transition-colors`,style:{top:`calc(var(--sat) + 1.5rem)`},onClick:he},[H(N(K),{icon:`lucide:search`,class:`text-base`})])):W(``,!0),V(`div`,{class:`grid grid-cols-3 gap-8 p-8 pt-16 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 max-h-[calc(100vh-6rem)] overflow-y-auto`,onClick:n[9]||=Js(e=>u.value=!1,[`self`])},[(R(!0),z(L,null,I(se.value,e=>(R(),z(`button`,{key:`launcher-${e.key}`,type:`button`,class:`group flex flex-col items-center gap-2 p-4 rounded-xl transition-all`,onClick:t=>_e(e.key)},[V(`span`,g4,[H(N(K),{icon:e.icon,class:`text-2xl sm:text-4xl`,"aria-hidden":`true`,style:k({color:s.value&&e.lightColor?e.lightColor:e.color})},null,8,[`icon`,`style`])]),V(`span`,{class:A([`text-[11px] transition-colors`,s.value?`text-text group-hover:text-text`:`text-white/80 group-hover:text-white`]),style:k(s.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.4)`})},j(e.label),7),ne.value.has(e.key)?(R(),z(`span`,_4)):W(``,!0)],8,h4))),128)),re.value&&!se.value.length?(R(),z(`div`,{key:0,class:A([`col-span-full text-center text-sm py-4`,s.value?`text-text/50`:`text-white/60`]),style:k(s.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.8)`})},` No apps found `,6)):W(``,!0)])],2)):W(``,!0)]),_:1})])),(R(),B(yr,{to:`body`},[H(Fo,{name:`launchpad`},{default:Zn(()=>[!le.value&&!ue.value&&de.value?(R(),z(`div`,v4,[V(`div`,y4,[H(N(K),{icon:`lucide:wifi-off`,class:`w-6 h-6 text-danger animate-pulse`}),n[13]||=V(`p`,{class:`text-muted text-[13px] tracking-wide`},`server unreachable`,-1),V(`button`,{type:`button`,class:`mt-2 px-4 py-1.5 text-[11px] font-medium bg-bg text-muted border border-border rounded hover:text-text transition-colors`,onClick:pe},` reload `)])])):W(``,!0)]),_:1})])),H(Hl,{pos:N(p)??null,transform:`translateY(-100%)`},{default:Zn(()=>[N(p)?.data.instanceId?(R(),z(`button`,{key:0,type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:v},` Minimize `)):W(``,!0),V(`button`,{type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:x},j(b.value?`Unpin from dock`:`Pin to dock`),1),N(p)?.data.instanceId?(R(),z(`button`,{key:1,type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:y},` Close `)):W(``,!0)]),_:1},8,[`pos`]),H(Hl,{pos:N(S)??null,transform:`translateY(-100%)`},{default:Zn(()=>[V(`button`,{type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:w},` Dash settings `)]),_:1},8,[`pos`])],64))}}),S4=0,C4=6e3;const w4=Yt([]);function T4(e){let t=w4.findIndex(t=>t.id===e);t!==-1&&w4.splice(t,1)}function E4(e){let t={...e,id:S4++};w4.push(t),setTimeout(()=>T4(t.id),C4)}function D4(){return cd(e=>{e.topic===`notification`&&e.data&&E4(e.data)})}var O4={class:`fixed top-4 right-4 z-[99998] flex flex-col gap-2 max-w-sm w-full pointer-events-none`},k4=[`onClick`],A4={class:`flex-1 min-w-0`},j4={class:`text-[12px] font-medium text-text leading-snug`},M4={key:0,class:`text-[11px] text-muted mt-0.5 leading-snug whitespace-pre-wrap break-words`},N4=Ju(F({__name:`NotificationToasts`,setup(e){let t={info:`ℹ`,success:`✓`,warning:`⚠`,alert:`!`},n={info:`text-accent border-accent`,success:`text-ok border-ok`,warning:`text-warn border-warn`,alert:`text-danger border-danger`};function r(e){return n[e||`info`]}function i(e){return t[e||`info`]}return(e,t)=>(R(),B(yr,{to:`body`},[V(`div`,O4,[H(js,{name:`toast`},{default:Zn(()=>[(R(!0),z(L,null,I(N(w4),e=>(R(),z(`div`,{key:e.id,class:A([`pointer-events-auto bg-surface border rounded-lg shadow-lg p-3 flex gap-2.5 items-start cursor-pointer`,r(e.type)]),onClick:t=>N(T4)(e.id)},[V(`span`,{class:A([`text-[16px] font-bold leading-none mt-0.5 shrink-0`,r(e.type)])},j(i(e.type)),3),V(`div`,A4,[V(`div`,j4,j(e.title),1),e.description?(R(),z(`div`,M4,j(e.description),1)):W(``,!0)])],10,k4))),128))]),_:1})])]))}}),[[`__scopeId`,`data-v-a6ef1f6e`]]),P4=`#ff5f57`,F4=`#febc2e`,I4=`#28c840`,L4=`var(--color-tl-inactive)`,R4=12,z4=`width 0.2s, height 0.2s, left 0.2s, top 0.2s`,B4=`ease-out`,V4={display:`inline-block`,width:`${R4}px`,height:`${R4}px`,borderRadius:`50%`,cursor:`pointer`,flexShrink:`0`},H4={"wb-n":{top:`-5px`,left:`0`,right:`0`,height:`10px`},"wb-s":{bottom:`-5px`,left:`0`,right:`0`,height:`10px`},"wb-w":{top:`0`,left:`-5px`,bottom:`0`,width:`10px`},"wb-e":{top:`0`,right:`-5px`,bottom:`0`,width:`10px`},"wb-nw":{top:`-5px`,left:`-5px`,width:`15px`,height:`15px`},"wb-ne":{top:`-5px`,right:`-5px`,width:`15px`,height:`15px`},"wb-sw":{bottom:`-5px`,left:`-5px`,width:`15px`,height:`15px`},"wb-se":{bottom:`-5px`,right:`-5px`,width:`15px`,height:`15px`}},U4={"wb-n":`n-resize`,"wb-s":`n-resize`,"wb-w":`w-resize`,"wb-e":`w-resize`,"wb-nw":`nw-resize`,"wb-ne":`ne-resize`,"wb-sw":`ne-resize`,"wb-se":`nw-resize`},W4=Object.keys(H4);function G4(e,t,n,r){e?.addEventListener(t,n,r||!1)}function K4(e,t,n,r){e?.removeEventListener(t,n,r||!1)}function q4(e,t){e.stopPropagation(),t&&e.preventDefault()}function J4(e,t){return e.getElementsByClassName(t)[0]}function Y4(e,t){e.classList.add(t)}function X4(e,t){return e.classList.contains(t)}function Z4(e,t){e.classList.remove(t)}function Q4(e,t,n){let r=e,i=String(n),a=`_s_${t}`;r[a]!==i&&(e.style.setProperty(t,i),r[a]=i)}function $4(e,t){let n=e.firstChild;n?n.nodeValue=t:e.textContent=t}var e3=document.createElement(`div`);e3.innerHTML=`<div class=wb-modal-bg></div><div class=wb-modal-overlay></div><div class=wb-header><div class=wb-control><span class=wb-close></span><span class=wb-min></span><span class=wb-max></span><span class=wb-full></span></div><div class=wb-drag><div class=wb-icon></div><div class=wb-title></div></div></div><div class=wb-body></div><div class=wb-n></div><div class=wb-s></div><div class=wb-w></div><div class=wb-e></div><div class=wb-nw></div><div class=wb-ne></div><div class=wb-se></div><div class=wb-sw></div>`;var t3=[],n3=[],r3={capture:!0,passive:!1},i3={capture:!0,passive:!0},a3,o3=0,s3=10,c3,l3=``,u3=``,d3=0,f3=0,p3=!1,m3=class e{static new(t){return new e(t)}static stack(){return n3}dom;window;body;header;id;title=``;x=0;y=0;width=0;height=0;minwidth=150;minheight=35;maxwidth=0;maxheight=0;top=0;right=0;bottom=0;left=0;index=0;overflow=!1;min=!1;max=!1;full=!1;hidden=!1;focused=!1;snapped=!1;noAnimation=!1;noMove=!1;noMax=!1;_optionHidden=new Set;onclose;onfocus;onblur;onmove;onresize;onfullscreen;onmaximize;onminimize;onrestore;onsnap;onhide;onshow;oncontextmenu;constructor(e,t){a3??E3();let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=!1,y,b,x,S,C,ee,w=!1,T=!1,E=!1,D=!1,te,ne,re,ie,O,ae=null;if(e&&(t&&(o=String(e),e=t),typeof e==`string`?o=e:(n=e.id,r=e.index,i=e.root,a=e.template,o??=e.title,s=e.icon,c=e.mount,l=e.html,u=e.url,d=e.width,f=e.height,p=e.minwidth,m=e.minheight,h=e.maxwidth,g=e.maxheight,_=e.autosize,v=!!e.overflow,w=!!e.min,T=!!e.max,E=!!e.hidden,D=!!e.modal,y=e.x??(D?`center`:0),b=e.y??(D?`center`:0),x=e.top,S=e.left,C=e.bottom,ee=e.right,te=e.background,ne=e.border,re=e.header,ie=e.class,O=e.oncreate,this.onclose=e.onclose,this.onfocus=e.onfocus,this.onblur=e.onblur,this.onmove=e.onmove,this.onresize=e.onresize,this.onfullscreen=e.onfullscreen,this.onmaximize=e.onmaximize,this.onminimize=e.onminimize,this.onrestore=e.onrestore,this.onsnap=e.onsnap,this.onhide=e.onhide,this.onshow=e.onshow,this.oncontextmenu=e.oncontextmenu,ae=e.onload??null)),this.dom=g3(a),this.id=n||`winbox-${++o3}`,this.dom.id=this.id,this.dom.className=`winbox`,this.dom.winbox=this,this.window=this.dom,this.body=J4(this.dom,`wb-body`),this.header=re||35,v3(this.dom),ie){let e=Array.isArray(ie)?ie:ie.split(` `);x3(this,this.dom,e)}if(D&&w3(this.dom,!0),n3.push(this),te&&this.setBackground(te),ne?Q4(this.body,`margin`,`${ne}${Number.isNaN(Number(ne))?``:`px`}`):ne=0,re){let e=J4(this.dom,`wb-header`);Q4(e,`height`,`${re}px`),Q4(e,`line-height`,`${re}px`),Q4(this.body,`top`,`${re}px`)}o&&this.setTitle(o),s&&this.setIcon(s),c?this.mount(c):l?this.body.innerHTML=l:u&&this.setUrl(u,ae);let oe=x?_3(x,f3):0,se=C?_3(C,f3):0,ce=S?_3(S,d3):0,le=ee?_3(ee,d3):0,ue=d3-ce-le,de=f3-oe-se,fe=h?_3(h,ue):ue,pe=g?_3(g,de):de,me=p?_3(p,fe):150,he=m?_3(m,pe):this.header,ge,_e;_?((i||a3).appendChild(this.body),ge=Math.max(Math.min(this.body.clientWidth+Number(ne)*2+1,fe),me),_e=Math.max(Math.min(this.body.clientHeight+this.header+Number(ne)+1,pe),he),this.dom.appendChild(this.body)):(ge=d?_3(d,fe):Math.max(fe/2|0,me),_e=f?_3(f,pe):Math.max(pe/2|0,he));let ve=y===void 0?ce:_3(y,ue,ge),ye=b===void 0?oe:_3(b,de,_e);this.x=ve,this.y=ye,this.width=ge,this.height=_e,this.minwidth=me,this.minheight=he,this.maxwidth=fe,this.maxheight=pe,this.top=oe,this.right=le,this.bottom=se,this.left=ce,this.index=r??this.index,this.overflow=v,E?this.hide():this.focus(),r!==void 0&&(this.index=r,Q4(this.dom,`z-index`,String(r)),r>s3&&(s3=r)),T?this.maximize():w?this.minimize():this.resize().move(),D3(this),(i||a3).appendChild(this.dom),O?.call(this,e)}mount(e){return this.unmount(),e?(e._backstore||=e.parentNode,this.body.textContent=``,this.body.appendChild(e),this):this}unmount(e){let t=this.body.firstChild;return t&&((e??t._backstore)?.appendChild(t),t._backstore=e),this}setTitle(e){return $4(J4(this.dom,`wb-title`),this.title=e),this}setIcon(e){let t=J4(this.dom,`wb-icon`);return Q4(t,`background-image`,`url(${e})`),Q4(t,`display`,`inline-block`),this}setBackground(e){return Q4(this.dom,`background`,e),this}setUrl(e,t){let n=this.body.firstChild;if(n&&n.tagName.toLowerCase()===`iframe`)n.src=e;else{this.body.innerHTML=`<iframe src="${e}"></iframe>`;let n=this.body.firstChild;n&&(Object.assign(n.style,{position:`absolute`,width:`100%`,height:`100%`,border:`0`}),n.onload=t??null)}return this}focus(e){if(e===!1)return this.blur();if(!this.focused){let e=n3.length;if(e>1)for(let t=1;t<=e;t++){let n=n3[e-t];if(n?.focused){n.blur();let e=n3.indexOf(this);e>=0&&n3.push(n3.splice(e,1)[0]);break}}Q4(this.dom,`z-index`,String(++s3)),this.index=s3,this.focused=!0,b3(this.dom,!0),this.onfocus?.()}return this}blur(e){return e===!1?this.focus():(this.focused&&(this.focused=!1,b3(this.dom,!1),this.onblur?.()),this)}hide(e){return e===!1?this.show():(this.hidden||(this.onhide?.(),this.hidden=!0,this.dom.style.display=`none`),this)}show(e){return e===!1?this.hide():(this.hidden&&=(this.onshow?.(),!1),this.dom.style.display=``,this)}minimize(e){if(e===!1)return this.restore();if(c3&&P3(),this.max&&=(S3(this,this.dom,!1),!1),!this.min){t3.push(this),this.dom.title=this.title,C3(this,this.dom,!0),this.min=!0;let e=this.header,t=(d3-200)/2|0,n=f3-e;this.resize(200,e,!0).move(t,n,!0);let r=this.dom,i=()=>{r.removeEventListener(`transitionend`,i),this.min&&(r.style.display=`none`)};r.addEventListener(`transitionend`,i),this.focused&&(this.blur(),M3()),this.onminimize?.()}return this}restore(){return c3&&P3(),this.min&&(this.dom.style.display=``,O3(this),this.resize().move(),this.onrestore?.()),this.max&&(this.max=!1,S3(this,this.dom,!1),this.resize().move(),this.onrestore?.()),this.snapped&&(this.snapped=!1,S3(this,this.dom,!1),this.resize().move(),this.onsnap?.(!1),this.onrestore?.()),this}maximize(e){return e===!1?this.restore():(c3&&P3(),this.min&&O3(this),this.max||(h3(this),S3(this,this.dom,!0),this.resize(d3-this.left-this.right,f3-this.top-this.bottom,!0).move(this.left,this.top,!0),this.max=!0,this.onmaximize?.()),this)}snap(e){if(c3&&P3(),this.min&&O3(this),h3(this),this.max&&(this.max=!1,S3(this,this.dom,!1)),this.snapped===e)return this;this.snapped&&=!1;let t=Math.round((d3-this.left-this.right)/2),n=f3-this.top-this.bottom,r=e===`left`?this.left:this.left+t;return S3(this,this.dom,!0),this.resize(t,n,!0).move(r,this.top,!0),this.snapped=e,this.onsnap?.(e),this}fullscreen(e){if(this.min&&(O3(this),this.resize().move()),!c3||!P3()){let e=this.body,t=e[l3];typeof t==`function`&&t.call(e),c3=this,this.full=!0,this.onfullscreen?.()}else if(e===!1)return this.restore();return this}close(e){if(this.onclose?.(e))return!0;this.min&&O3(this);let t=n3.indexOf(this);t>=0&&n3.splice(t,1),this.unmount(),this.dom.remove(),this.dom.textContent=``,this.dom.winbox=null;let n=this.focused;this.focused=!1,this.body=null,this.dom=null,n&&M3()}move(e,t,n){let r,i;return e===void 0&&e!==0?(r=this.x,i=this.y):n?(r=Number(e??this.x),i=Number(t??this.y)):(r=e?_3(e,d3-this.left-this.right,this.width):0,i=t?_3(t,f3-this.top-this.bottom,this.height):0,this.x=r,this.y=i),Q4(this.dom,`left`,`${r}px`),Q4(this.dom,`top`,`${i}px`),this.onmove?.(r,i),this}resize(e,t,n){let r,i;return e===void 0&&e!==0?(r=this.width,i=this.height):n?(r=Number(e??this.width),i=Number(t??this.height)):(r=e?_3(e,this.maxwidth):0,i=t?_3(t,this.maxheight):0,r=Math.max(r,this.minwidth),i=Math.max(i,this.minheight),this.width=r,this.height=i),Q4(this.dom,`width`,`${r}px`),Q4(this.dom,`height`,`${i}px`),this.onresize?.(r,i),this}addControl(e){let t=e.class,n=e.image,r=e.click,i=e.index,a=document.createElement(`span`),o=J4(this.dom,`wb-control`),s=this;return Object.assign(a.style,V4,{background:L4}),t&&(a.className=t),n&&Q4(a,`background-image`,`url(${n})`),r&&(a.onclick=function(e){r.call(this,e,s)}),o.insertBefore(a,o.childNodes[i||0]??null),this}removeControl(e){return J4(this.dom,e)?.remove(),this}addClass(e){return Y4(this.dom,e),this}removeClass(e){return Z4(this.dom,e),this}hasClass(e){return X4(this.dom,e)}toggleClass(e){return this.hasClass(e)?this.removeClass(e):this.addClass(e)}};function h3(e){let t=getComputedStyle(document.documentElement);e.top=Math.max(e.top,Number.parseFloat(t.getPropertyValue(`--sat`))||0),e.bottom=Math.max(e.bottom,Number.parseFloat(t.getPropertyValue(`--sab`))||0),e.left=Math.max(e.left,Number.parseFloat(t.getPropertyValue(`--sal`))||0),e.right=Math.max(e.right,Number.parseFloat(t.getPropertyValue(`--sar`))||0)}function g3(e){return e?e.cloneNode(!0):e3.cloneNode(!0)}function _3(e,t,n=0){if(typeof e==`string`){if(e===`center`)return(t-n)/2+.5|0;if(e===`right`||e===`bottom`)return t-n;let r=parseFloat(e),i=String(r);return(i===e?``:e.slice(i.length))===`%`?t/100*r+.5|0:r}return e}function v3(e){Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,background:`var(--color-surface)`,border:`1px solid var(--color-border)`,borderRadius:`10px`,boxShadow:`var(--shadow-window)`,transition:z4,transitionTimingFunction:B4,contain:`layout size`,textAlign:`left`,touchAction:`none`});let t=J4(e,`wb-modal-bg`);Object.assign(t.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,right:`0`,bottom:`0`,background:`inherit`,borderRadius:`inherit`});let n=J4(e,`wb-modal-overlay`);Object.assign(n.style,{display:`none`,position:`absolute`,top:`-50vh`,left:`-50vw`,right:`-50vw`,bottom:`-50vh`,background:`var(--color-bg)`,zIndex:`-1`});let r=J4(e,`wb-header`);Object.assign(r.style,{position:`absolute`,left:`0`,top:`0`,width:`100%`,height:`38px`,lineHeight:`38px`,color:`var(--color-muted)`,borderBottom:`1px solid var(--color-border)`,background:`var(--color-surface)`,borderRadius:`10px 10px 0 0`,overflow:`hidden`,zIndex:`1`});let i=J4(e,`wb-body`);Object.assign(i.style,{position:`absolute`,top:`38px`,left:`0`,right:`0`,bottom:`0`,overflow:`auto`,willChange:`contents`,marginTop:`0`,contain:`layout size`,zIndex:`0`,background:`var(--color-bg)`,borderRadius:`0 0 10px 10px`,color:`var(--color-text, inherit)`,textAlign:`initial`,touchAction:`auto`,cursor:`auto`}),i.style.webkitOverflowScrolling=`touch`;let a=J4(e,`wb-control`);Object.assign(a.style,{float:`left`,height:`100%`,display:`flex`,alignItems:`center`,gap:`8px`,paddingLeft:`14px`});let o=J4(e,`wb-drag`);Object.assign(o.style,{height:`100%`,cursor:`default`,overflow:`hidden`});let s=J4(e,`wb-title`);Object.assign(s.style,{fontFamily:`'Geist', 'Geist Variable', sans-serif`,fontSize:`13px`,fontWeight:`500`,letterSpacing:`0`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,textAlign:`center`,paddingRight:`60px`});let c=J4(e,`wb-icon`);Object.assign(c.style,{display:`none`,width:`20px`,height:`100%`,margin:`-1px 8px 0 -3px`,float:`left`,backgroundRepeat:`no-repeat`,backgroundSize:`100%`,backgroundPosition:`center`});let l=J4(e,`wb-close`);Object.assign(l.style,V4,{background:P4});let u=J4(e,`wb-min`);Object.assign(u.style,V4,{background:F4});let d=J4(e,`wb-max`);Object.assign(d.style,V4,{background:I4});let f=J4(e,`wb-full`);Object.assign(f.style,V4,{background:I4,display:`none`}),y3(a,l,u,d,f);for(let t of W4){let n=J4(e,t);n&&Object.assign(n.style,{position:`absolute`,zIndex:`2`},H4[t])}}function y3(e,t,n,r,i){let a=e=>`url("data:image/svg+xml,${encodeURIComponent(e)}")`,o=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><g fill="#460804" fill-rule="evenodd" clip-rule="evenodd"><path d="M22.5 57.8l35.3-35.3c1.4-1.4 3.6-1.4 5 0l.1.1c1.4 1.4 1.4 3.6 0 5L27.6 62.9c-1.4 1.4-3.6 1.4-5 0l-.1-.1c-1.3-1.4-1.3-3.6 0-5z"/><path d="M27.6 22.5l35.3 35.3c1.4 1.4 1.4 3.6 0 5l-.1.1c-1.4 1.4-3.6 1.4-5 0L22.5 27.6c-1.4-1.4-1.4-3.6 0-5l.1-.1c1.4-1.3 3.6-1.3 5 0z"/></g></svg>`),s=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><path fill="#90591d" fill-rule="evenodd" clip-rule="evenodd" d="M17.8 39.1h49.9c1.9 0 3.5 1.6 3.5 3.5v.1c0 1.9-1.6 3.5-3.5 3.5H17.8c-1.9 0-3.5-1.6-3.5-3.5v-.1c0-1.9 1.5-3.5 3.5-3.5z"/></svg>`),c=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><path fill="#006500" fill-rule="evenodd" clip-rule="evenodd" d="M31.2 20.8h26.7c3.6 0 6.5 2.9 6.5 6.5v26.7zm23.2 43.7H27.6c-3.6 0-6.5-2.9-6.5-6.5V31.2z"/></svg>`),l=e=>{t.style.backgroundImage=e?o:`none`,n.style.backgroundImage=e?s:`none`,r.style.backgroundImage=e?c:`none`,i.style.backgroundImage=e?c:`none`;for(let e of[t,n,r,i])e.style.backgroundSize=`100%`,e.style.backgroundPosition=`center`,e.style.backgroundRepeat=`no-repeat`};l(!1),e.addEventListener(`mouseenter`,()=>l(!0)),e.addEventListener(`mouseleave`,()=>l(!1))}function b3(e,t){let n=J4(e,`wb-close`),r=J4(e,`wb-min`),i=J4(e,`wb-max`),a=J4(e,`wb-full`);if(t)n.style.background=P4,r.style.background=F4,i.style.background=I4,a.style.background=I4;else{let e=L4;n.style.background=e,r.style.background=e,i.style.background=e,a.style.background=e}}function x3(e,t,n){for(let r of n)switch(r){case`no-animation`:t.style.transition=`none`,e.noAnimation=!0;break;case`no-shadow`:t.style.boxShadow=`none`;break;case`no-header`:{J4(t,`wb-header`).style.display=`none`;let e=J4(t,`wb-body`);e.style.top=`0`,e.style.borderRadius=`10px`;break}case`no-min`:J4(t,`wb-min`).style.display=`none`,e._optionHidden.add(`wb-min`);break;case`no-max`:J4(t,`wb-max`).style.display=`none`,e._optionHidden.add(`wb-max`),e.noMax=!0;break;case`no-full`:J4(t,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`);break;case`no-close`:J4(t,`wb-close`).style.display=`none`,e._optionHidden.add(`wb-close`);break;case`no-resize`:for(let e of W4)J4(t,e).style.display=`none`;break;case`no-move`:e.noMove=!0;break}}function S3(e,t,n){let r=J4(t,`wb-body`),i=J4(t,`wb-header`);n?(t.style.boxShadow=`none`,t.style.borderRadius=`0`,i.style.borderRadius=`0`,r.style.borderRadius=`0`,r.style.margin=`0`,T3(t,`none`)):(t.style.boxShadow=`var(--shadow-window)`,t.style.borderRadius=`10px`,i.style.borderRadius=`10px 10px 0 0`,r.style.borderRadius=`0 0 10px 10px`,r.style.margin=``,T3(t,``))}function C3(e,t,n){let r=J4(t,`wb-full`),i=J4(t,`wb-min`),a=J4(t,`wb-body`);if(n){r.style.display=`none`,i.style.display=`none`;for(let e of Array.from(a.children))e.style.display=`none`;T3(t,`none`)}else{e._optionHidden.has(`wb-full`)||(r.style.display=``),e._optionHidden.has(`wb-min`)||(i.style.display=``);for(let e of Array.from(a.children))e.style.display=``;T3(t,``)}}function w3(e,t){let n=J4(e,`wb-modal-bg`),r=J4(e,`wb-modal-overlay`),i=J4(e,`wb-drag`),a=J4(e,`wb-min`),o=J4(e,`wb-max`),s=J4(e,`wb-full`);t?(n.style.display=`block`,r.style.display=`block`,r.animate([{opacity:0},{opacity:1}],{duration:200,easing:`ease-out`,fill:`forwards`}),i.style.pointerEvents=`none`,a.style.display=`none`,o.style.display=`none`,s.style.display=`none`,T3(e,`none`)):(n.style.display=`none`,r.style.display=`none`,i.style.pointerEvents=``,a.style.display=``,o.style.display=``,s.style.display=``,T3(e,``))}function T3(e,t){for(let n of W4){let r=J4(e,n);r&&(r.style.pointerEvents=t)}}function E3(){a3=document.body;let e=a3;l3=typeof e.requestFullscreen==`function`?`requestFullscreen`:typeof e.msRequestFullscreen==`function`?`msRequestFullscreen`:typeof e.webkitRequestFullscreen==`function`?`webkitRequestFullscreen`:typeof e.mozRequestFullscreen==`function`?`mozRequestFullscreen`:``,u3=l3?l3.replace(`request`,`exit`).replace(`mozRequest`,`mozCancel`).replace(`Request`,`Exit`):``,G4(window,`resize`,()=>{j3(),k3()}),G4(a3,`mousedown`,()=>{p3=!1},!0),G4(a3,`mousedown`,()=>{if(!p3)for(let e=n3.length-1;e>=0;e--){let t=n3[e];if(t?.focused){t.blur();break}}}),G4(window,`blur`,()=>{setTimeout(()=>{let e=document.activeElement;if(e?.tagName===`IFRAME`){let t=e;for(;t;){if(t.winbox){t.winbox.focus();return}t=t.parentElement}}},0)}),j3()}function D3(e){A3(e,`drag`),A3(e,`n`),A3(e,`s`),A3(e,`w`),A3(e,`e`),A3(e,`nw`),A3(e,`ne`),A3(e,`se`),A3(e,`sw`),G4(J4(e.dom,`wb-min`),`click`,t=>{q4(t),e.min?e.restore().focus():e.minimize()}),G4(J4(e.dom,`wb-max`),`click`,t=>{q4(t),e.max?e.restore().focus():e.maximize().focus()}),l3?G4(J4(e.dom,`wb-full`),`click`,t=>{q4(t),e.fullscreen().focus()}):(J4(e.dom,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`)),G4(J4(e.dom,`wb-close`),`click`,t=>{q4(t),e.close()}),G4(J4(e.dom,`wb-header`),`contextmenu`,t=>{t.preventDefault(),t.stopPropagation();let n=t;e.focus(),e.oncontextmenu?.(n.clientX,n.clientY)}),G4(e.dom,`mousedown`,()=>{p3=!0},!0),G4(e.body,`mousedown`,()=>{e.focus()},!0)}function O3(e){let t=t3.indexOf(e);t>=0&&t3.splice(t,1),k3(),C3(e,e.dom,!1),e.min=!1,e.dom.title=``}function k3(){let e={},t={};for(let n=0;n<t3.length;n++){let r=t3[n],i=`${r.left}:${r.top}`;t[i]?t[i]+=1:(e[i]=0,t[i]=1)}for(let n=0;n<t3.length;n++){let r=t3[n],i=`${r.left}:${r.top}`,a=t[i]||1,o=Math.min((d3-r.left-r.right)/a,250);r.resize(o+1|0,r.header,!0).move(r.left+(e[i]||0)*o|0,f3-r.bottom-r.header,!0),e[i]=(e[i]||0)+1}}function A3(e,t){let n=J4(e.dom,`wb-${t}`);if(!n)return;let r,i=0,a=0,o=!1,s=!1,c=0;G4(n,`mousedown`,u,r3),G4(n,`touchstart`,u,r3);function l(){requestAnimationFrame(l),s&&=(e.resize(),!1),o&&=(e.move(),!1)}function u(o){if(q4(o,!0),e.focus(),t===`drag`){if(e.min){e.restore();return}if(!e.noMax){let t=Date.now(),n=t-c;if(c=t,n<300){e.max?e.restore():e.maximize();return}}}if(!e.min){e.dom.style.willChange=`left, top, width, height`,e.dom.style.transition=`none`;for(let e of document.querySelectorAll(`iframe`))e.style.pointerEvents=`none`;t===`drag`?n.style.cursor=`grabbing`:n.style.cursor=U4[`wb-${t}`]||``;let s=o;r=o.touches?.[0],r?(G4(window,`touchmove`,d,i3),G4(window,`touchend`,f,i3)):(G4(window,`mousemove`,d,i3),G4(window,`mouseup`,f,i3)),i=r?r.pageX:s.pageX,a=r?r.pageY:s.pageY}}function d(n){q4(n);let o=r?n.touches[0]:n;if(!o)return;let s=o.pageX,c=o.pageY,l=s-i,u=c-a,d=e.width,f=e.height,p=e.x,m=e.y,h=!1,g=!1,_=!1,v=!1;if(t===`drag`){if(e.noMove)return;e.x+=l,e.y+=u,_=!0,v=!0}else t===`e`||t===`se`||t===`ne`?(e.width+=l,h=!0):(t===`w`||t===`sw`||t===`nw`)&&(e.x+=l,e.width-=l,h=!0,_=!0),t===`s`||t===`se`||t===`sw`?(e.height+=u,g=!0):(t===`n`||t===`ne`||t===`nw`)&&(e.y+=u,e.height-=u,g=!0,v=!0);h&&=(e.width=Math.max(Math.min(e.width,e.maxwidth,d3-e.x-e.right),e.minwidth),e.width!==d),g&&=(e.height=Math.max(Math.min(e.height,e.maxheight,f3-e.y-e.bottom),e.minheight),e.height!==f),(h||g)&&e.resize(),_&&=((e.max||e.snapped)&&(e.x=(s<d3/3?e.left:s>d3/3*2?d3-e.width-e.right:d3/2-e.width/2)+l),e.x=Math.max(Math.min(e.x,e.overflow?d3-30:d3-e.width-e.right),e.overflow?30-e.width:e.left),e.x!==p),v&&=((e.max||e.snapped)&&(e.y=e.top+u),e.y=Math.max(Math.min(e.y,e.overflow?f3-e.header:f3-e.height-e.bottom),e.top),e.y!==m),(_||v)&&((e.max||e.snapped)&&e.restore(),e.move()),(h||_)&&(i=s),(g||v)&&(a=c)}function f(i){q4(i),e.dom.style.willChange=``,e.noAnimation||(e.dom.style.transition=z4,e.dom.style.transitionTimingFunction=B4);for(let e of document.querySelectorAll(`iframe`))e.style.pointerEvents=``;if(n.style.cursor=``,t===`drag`&&!e.max&&!e.snapped&&!e.noMax){let t=r?i.changedTouches?.[0]:i;if(t){let n=d3<768;!n&&t.pageX<=e.left+8?e.snap(`left`).focus():!n&&t.pageX>=d3-e.right-8?e.snap(`right`).focus():t.pageY<=e.top+8&&e.maximize().focus()}}r?(K4(window,`touchmove`,d,i3),K4(window,`touchend`,f,i3)):(K4(window,`mousemove`,d,i3),K4(window,`mouseup`,f,i3)),r=void 0}}function j3(){let e=document.documentElement;d3=e.clientWidth,f3=e.clientHeight;let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--sat`))||0,r=Number.parseFloat(t.getPropertyValue(`--sab`))||0,i=Number.parseFloat(t.getPropertyValue(`--sal`))||0,a=Number.parseFloat(t.getPropertyValue(`--sar`))||0,o=Number.parseFloat(t.getPropertyValue(`--dock-bottom`))||0;for(let e of n3)if(e.top=Math.max(e.top,n),e.bottom=Math.max(e.bottom,r,o),e.left=Math.max(e.left,i),e.right=Math.max(e.right,a),e.max)e.resize(d3-e.left-e.right,f3-e.top-e.bottom,!0).move(e.left,e.top,!0);else if(e.snapped){let t=Math.round((d3-e.left-e.right)/2),n=f3-e.top-e.bottom,r=e.snapped===`left`?e.left:e.left+t;e.resize(t,n,!0).move(r,e.top,!0)}}function M3(){for(let e=n3.length-1;e>=0;e--){let t=n3[e];if(t&&!t.min){t.focus();break}}}function N3(){let e=document;return!!(e.fullscreen||e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement)}function P3(){if(c3&&(c3.full=!1,N3()&&u3)){let e=document,t=e[u3];if(typeof t==`function`)return t.call(e),!0}}var F3=`piclaw:windows`;function I3(e){let t=new Map,n=null,r=localStorage.getItem(F3);if(!r)return{windows:t,focus:n};try{let i=JSON.parse(r);for(let[n,r]of Object.entries(i)){if(n===`_f`||!Array.isArray(r)||r.length<4)continue;let i=n.includes(`:`)?n.split(`:`)[0]:n;if(!e.has(i))continue;let[a,o,s,c,l,u]=r;if(![a,o,s,c].every(e=>typeof e==`number`&&Number.isFinite(e)))continue;let d={x:a,y:o,w:s,h:c};typeof l==`number`?(d.max=l===1,l===2&&(d.snap=`left`),l===3&&(d.snap=`right`),u&&typeof u==`object`&&!Array.isArray(u)&&(d.state=u)):l&&typeof l==`object`&&!Array.isArray(l)&&(d.state=l),t.set(n,d)}if(typeof i._f==`string`){let r=i._f.includes(`:`)?i._f.split(`:`)[0]:i._f;e.has(r)&&t.has(i._f)&&(n=i._f)}}catch{}return{windows:t,focus:n}}function L3(e,t,n,r){let i={};for(let r of e){let e=t.get(r.id);if(!e)continue;let a=e.snapped===`left`?2:e.snapped===`right`?3:e.max?1:0,o=[Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height),a],s=n[r.id];s&&Object.keys(s).length>0&&o.push(s),i[r.id]=o}r&&t.has(r)&&(i._f=r),Object.keys(i).length>0?localStorage.setItem(F3,JSON.stringify(i)):localStorage.removeItem(F3)}function R3(e){return Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e))||0}function z3(){return Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(`--dock-bottom`))||0}function B3(e){let t=e.indexOf(`:`);return t>=0?e.slice(0,t):e}function V3(e){let t=id(),n=new Map(e.map(e=>[e.key,e])),{windows:r,focus:i}=I3(new Set(e.map(e=>e.key))),a=new Map,o=Yt([]),s=Yt({}),c=M(null),l=Yt({}),u=M(null);function d(){u.value=null}function f(){u.value&&d()}Zr(()=>document.addEventListener(`click`,f)),ti(()=>document.removeEventListener(`click`,f));for(let[e,t]of r)t.state&&(l[e]=t.state);let p=new Map,m;function h(){clearTimeout(m),m=setTimeout(()=>L3(o,p,l,c.value),300)}function g(e,t){let n=p.get(e);n&&n.setTitle(t)}function _(e,t){let n=l[e];n?Object.assign(n,t):l[e]={...t},h()}function v(e){if(!n.get(e)?.multi)return e;let t=(a.get(e)??0)+1;return a.set(e,t),`${e}:${t}`}function y(e){for(let t=o.length-1;t>=0;t--)if(o[t].appKey===e)return o[t].id;return null}function b(e,t){let r=B3(e),i=n.get(r);if(!i||typeof window>`u`)return null;if(!i.multi){let e=y(r);if(e){let n=p.get(e);if(n)return t&&_(e,t),s[e]=!1,n.min&&n.restore(),n.show(),n.focus(),h(),e}}let c=e.includes(`:`)?e:v(r);if(i.multi&&c.includes(`:`)){let e=Number(c.split(`:`)[1]);e>=(a.get(r)??0)&&a.set(r,e)}let u=T(c,i);if(!u)return null;t&&(l[c]={...l[c],...t});let d=Yt({id:c,appKey:r,app:i,mountTarget:u.body});return o.push(d),s[c]=!1,u.show(),u.focus(),h(),c}function x(e){if(p.has(e)){let t=p.get(e);t.min&&(s[e]=!1,t.restore()),t.show(),t.focus();return}let t=B3(e);if(!n.get(t))return;let r=y(t);if(r){let e=p.get(r);e.min&&(s[r]=!1,e.restore()),e.show(),e.focus();return}b(t)}function S(e){let t=p.get(e);t&&!t.min&&t.minimize()}function C(e){let t=p.get(e);if(!t){ee(e);return}t.close()}function ee(e){let t=o.findIndex(t=>t.id===e);t>=0&&o.splice(t,1),delete s[e],delete l[e],p.delete(e),D(),h()}function w(e,t){let n=window.innerWidth,r=window.innerHeight,i=Math.max(32,Math.round((n-e)/2)),a=Math.max(32,Math.round((r-t)/2)),o=[];for(let e of p.values())e.min||o.push({x:e.x+e.width/2,y:e.y+e.height/2});if(o.length===0)return{x:i,y:a};let s=Math.max(32,n-e-32),c=Math.max(32,r-t-32),l={x:i,y:a},u=-1;for(let n=0;n<=12;n++)for(let r=0;r<=10;r++){let i=Math.round(32+(s-32)*n/12),a=Math.round(32+(c-32)*r/10),d=i+e/2,f=a+t/2,p=1/0;for(let e of o)p=Math.min(p,(d-e.x)**2+(f-e.y)**2);p>u&&(u=p,l={x:i,y:a})}return l}function T(e,n){if(typeof window>`u`)return null;let i=n.window,a=r.get(e),o=t.value,l=o?void 0:a?.snap,d=!l&&(a?.max||o),f=a?a.w:Math.min(i.width,window.innerWidth-32),m=a?a.h:Math.min(i.height,window.innerHeight-64),g=a?{x:a.x,y:a.y}:w(f,m),_=R3(`--sat`),v=R3(`--sab`),y=R3(`--sal`),b=R3(`--sar`);g.x=Math.max(g.x,y),g.y=Math.max(g.y,_);let x=new m3({id:`piclaw-${e}`,title:n.label,width:f,height:m,minwidth:i.minwidth,minheight:i.minheight,x:g.x,y:g.y,max:d,top:_,bottom:o?44:Math.max(v,z3()),left:y,right:b,class:`no-full`,header:o?32:38,onfocus:()=>{c.value=e,h()},onblur:()=>{D()},onmove:()=>{h()},onresize:()=>{h()},onminimize:()=>{s[e]=!0,D(),h()},onmaximize:()=>{h()},onrestore:()=>{s[e]=!1,h()},onsnap:()=>{h()},onclose:()=>{ee(e)},oncontextmenu:(t,n)=>{u.value={x:t,y:n,instanceId:e}}});return x.body.style.margin=`0`,l&&x.snap(l),p.set(e,x),x}function E(){if(r.size!==0){for(let[e]of r)b(e,r.get(e)?.state);i&&r.has(i)&&x(i)}}function D(){for(let e=o.length-1;e>=0;e--){let t=o[e];if(!s[t.id]&&p.has(t.id)){c.value=t.id;return}}c.value=null}function te(e=!1){let t=o.filter(e=>!s[e.id]);if(t.length<=1)return;let n=t[(t.findIndex(e=>e.id===c.value)+(e?-1:1)+t.length)%t.length];x(n.id)}function ne(e,t){let n=p.get(e);n&&n.snap(t).focus()}function re(e){let t=p.get(e);t&&(t.max?t.restore().focus():t.maximize().focus())}function ie(e){if(e.altKey&&e.key===`Tab`)e.preventDefault(),te(e.shiftKey);else if(e.altKey&&(e.code===`KeyW`||e.code===`KeyQ`))e.preventDefault(),c.value&&C(c.value);else if(e.altKey&&e.key===`ArrowLeft`)e.preventDefault(),c.value&&!t.value&&ne(c.value,`left`);else if(e.altKey&&e.key===`ArrowRight`)e.preventDefault(),c.value&&!t.value&&ne(c.value,`right`);else if(e.altKey&&e.key===`ArrowUp`)e.preventDefault(),c.value&&re(c.value);else if(e.altKey&&e.key===`ArrowDown`&&(e.preventDefault(),c.value)){let e=p.get(c.value);e&&(e.max||e.snapped)&&e.restore().focus()}}return window.addEventListener(`keydown`,ie),ei(()=>{clearTimeout(m),window.removeEventListener(`keydown`,ie);for(let e of p.values())e.close(!0);p.clear(),o.length=0}),{openInstances:o,minimized:s,focusedWindow:c,windowState:l,setWindowState:_,setWindowTitle:g,openWindow:b,bringToFront:x,minimizeWindow:S,maximizeWindow:re,closeWindow:C,restore:E,headerMenu:u,closeHeaderMenu:d}}var H3={key:0,class:`fixed inset-0 z-[99999] flex items-center justify-center bg-bg/80 backdrop-blur-sm`},U3=F({__name:`App`,setup(e){let{openInstances:t,minimized:n,focusedWindow:r,windowState:i,setWindowState:a,setWindowTitle:o,bringToFront:s,minimizeWindow:c,maximizeWindow:l,openWindow:u,closeWindow:d,restore:f,headerMenu:p,closeHeaderMenu:m}=V3(s4);er(Tu,{windowState:i,setWindowState:a,setWindowTitle:o,bringToFront:s,openWindow:u,closeWindow:d});let{status:h}=Ru(),{presence:g}=hd(h);D4(),cd(e=>{if(e.topic===`terminal`){let t=e.data;t.action===`created`&&t.session&&u(`terminal`,{connectSession:t.session.id})}else e.topic===`browser`&&u(`browser`)});function _(){globalThis.location.reload()}let v=M();function y(e){e.preventDefault()}return ti(()=>window.removeEventListener(`beforeunload`,y)),P(h,e=>{if(e===`approved`)f(),t.length===0&&(localStorage.getItem(`piclaw:visited`)||(localStorage.setItem(`piclaw:visited`,`1`),u(`welcome`)));else for(;t.length>0;)d(t[0].id)}),Zr(async()=>{await zn(),h.value===`approved`&&(f(),t.length===0&&(localStorage.getItem(`piclaw:visited`)||(localStorage.setItem(`piclaw:visited`,`1`),u(`welcome`))))}),(e,i)=>(R(),B(Yu,null,{default:Zn(()=>[V(`div`,{class:`bg-bg text-text font-sans leading-normal flex flex-col relative text-[13px]`,style:{height:`100%`},onContextmenu:i[1]||=Js(()=>{},[`prevent`]),onClick:i[2]||=e=>(v.value?.closeCtxMenu(),N(m)())},[H(ju,{ref_key:`desktop`,ref:v,apps:N(s4),"open-instances":N(t),onLaunch:N(u),onCtxAction:i[0]||=e=>{e===`settings`&&N(u)(`settings`)}},null,8,[`apps`,`open-instances`,`onLaunch`]),H(x4,{"open-instances":N(t),minimized:N(n),"focused-window":N(r),onLaunch:N(u),onFocus:N(s),onMinimize:N(c),onClose:N(d)},null,8,[`open-instances`,`minimized`,`focused-window`,`onLaunch`,`onFocus`,`onMinimize`,`onClose`]),H(ed),H(N4)],32),H(Hl,{pos:N(p)},{default:Zn(()=>[V(`button`,{type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:i[3]||=e=>(N(p)&&N(c)(N(p).instanceId),N(m)())},` Minimize `),V(`button`,{type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:i[4]||=e=>(N(p)&&N(l)(N(p).instanceId),N(m)())},` Maximize `),i[6]||=V(`hr`,{class:`my-0.5 border-border`},null,-1),V(`button`,{type:`button`,class:`w-full px-4 py-1.5 text-left text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:i[5]||=e=>(N(p)&&N(d)(N(p).instanceId),N(m)())},` Close `)]),_:1},8,[`pos`]),N(g).takenOver?(R(),z(`div`,H3,[V(`div`,{class:`border border-border rounded-lg p-6 max-w-sm w-full text-center bg-bg`},[i[7]||=V(`div`,{class:`text-[16px] font-medium text-text mb-2`},`session active in another tab`,-1),i[8]||=V(`div`,{class:`text-[12px] text-muted mb-4`},` another browser tab took over this session. only one active tab per device is supported. `,-1),V(`button`,{type:`button`,class:`px-4 py-1.5 text-[12px] bg-accent text-white rounded hover:opacity-90 transition-opacity cursor-pointer`,onClick:_},` use this tab instead `)])])):W(``,!0)]),_:1}))}});(window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0)&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[href]`);if(!t)return;let n=t.href;if(n){try{if(new URL(n,location.origin).origin===location.origin)return}catch{return}e.preventDefault(),window.open(n,`_blank`,`noopener`)}}),wu(),ec(U3).mount(`#app`);export{Cm as t};
|