piclaw 0.0.19 → 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-CMBqBOCp.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/_...path_.get.mjs +16 -0
- package/.output/server/_chunks/app.mjs +261 -181
- package/.output/server/_chunks/browser.mjs +4 -1
- package/.output/server/_chunks/config.mjs +4 -0
- package/.output/server/_chunks/db.mjs +32 -28
- package/.output/server/_chunks/device-bus.mjs +123 -0
- package/.output/server/_chunks/dummy.mjs +1 -1
- package/.output/server/_chunks/logger.mjs +23 -0
- package/.output/server/_chunks/login.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 +2302 -122
- package/.output/server/_chunks/terminal.mjs +63 -8
- package/.output/server/_chunks/uploads.mjs +60 -0
- package/.output/server/_chunks/virtual.mjs +192 -54
- package/.output/server/_id_.delete.mjs +5 -2
- package/.output/server/_id_.patch.mjs +2 -0
- package/.output/server/_id_2.delete.mjs +8 -0
- package/.output/server/_jid_.delete.mjs +5 -2
- package/.output/server/_jid_.patch.mjs +37 -4
- package/.output/server/_jid_2.delete.mjs +5 -2
- package/.output/server/_libs/@acemir/cssom+[...].mjs +2269 -1137
- package/.output/server/_libs/@google/genai.mjs +337 -273
- package/.output/server/_libs/@mariozechner/pi-agent-core+[...].mjs +381 -2073
- package/.output/server/_libs/@mariozechner/pi-coding-agent+[...].mjs +231 -131
- 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/mime.mjs +838 -1
- package/.output/server/_libs/node-fetch.mjs +4 -4
- 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/approve.mjs +2 -0
- package/.output/server/_routes/api/auth/revoke.mjs +2 -0
- package/.output/server/_routes/api/auth/status.mjs +25 -6
- package/.output/server/_routes/api/browser2.mjs +1 -1
- package/.output/server/_routes/api/config2.mjs +2 -0
- package/.output/server/_routes/api/device_events.mjs +36 -0
- package/.output/server/_routes/api/files/groups.mjs +1 -2
- package/.output/server/_routes/api/files/raw.mjs +1 -1
- package/.output/server/_routes/api/groups.mjs +5 -3
- package/.output/server/_routes/api/groups2.mjs +18 -6
- package/.output/server/_routes/api/health.mjs +1 -2
- package/.output/server/_routes/api/messages.mjs +7 -1
- package/.output/server/_routes/api/notes/delete.mjs +4 -1
- package/.output/server/_routes/api/notes/write.mjs +2 -0
- package/.output/server/_routes/api/ntfy/setup.mjs +8 -0
- package/.output/server/_routes/api/pi/apikey.mjs +3 -2
- package/.output/server/_routes/api/pi/apikey_providers.mjs +1 -2
- package/.output/server/_routes/api/pi/commands.mjs +13 -3
- package/.output/server/_routes/api/pi/login/events.mjs +0 -1
- package/.output/server/_routes/api/pi/login/respond.mjs +2 -1
- package/.output/server/_routes/api/pi/login.mjs +1 -2
- package/.output/server/_routes/api/pi/logout.mjs +2 -1
- package/.output/server/_routes/api/pi/models.mjs +1 -2
- package/.output/server/_routes/api/pi/models_config2.mjs +2 -0
- package/.output/server/_routes/api/pi/settings2.mjs +2 -0
- package/.output/server/_routes/api/pi/status.mjs +1 -2
- package/.output/server/_routes/api/proxy.mjs +19 -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 +26 -18
- package/.output/server/_routes/api/status.mjs +1 -3
- package/.output/server/_routes/api/stop.mjs +11 -0
- package/.output/server/_routes/api/store/plugins.mjs +75 -0
- package/.output/server/_routes/api/store/skills.mjs +11 -0
- package/.output/server/_routes/api/tasks2.mjs +3 -2
- package/.output/server/_routes/api/telegram/setup.mjs +5 -2
- package/.output/server/_routes/api/telegram/status.mjs +1 -2
- package/.output/server/_routes/api/terminal2.mjs +2 -1
- package/.output/server/_routes/api/tunnel/setup.mjs +4 -2
- package/.output/server/_runtime.mjs +1 -2
- package/.output/server/_utils.mjs +10 -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-CMO6TZ5a.js +0 -1
- package/.output/public/assets/index-jdnbJw-M.js +0 -204
- package/.output/public/assets/index-ooXrRwgl.css +0 -1
- package/.output/server/_chunks/commands.mjs +0 -282
- package/.output/server/_chunks/pi.mjs +0 -202
- package/.output/server/_chunks/session.mjs +0 -1114
- 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 -5
- package/.output/server/_libs/_103.mjs +0 -3
- package/.output/server/_libs/_104.mjs +0 -2
- package/.output/server/_libs/_105.mjs +0 -3
- package/.output/server/_libs/_106.mjs +0 -2
- package/.output/server/_libs/_107.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
|
@@ -1,204 +0,0 @@
|
|
|
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=>ne(e)===`[object Map]`,C=e=>ne(e)===`[object Set]`,w=e=>ne(e)===`[object Date]`,T=e=>typeof e==`function`,E=e=>typeof e==`string`,D=e=>typeof e==`symbol`,O=e=>typeof e==`object`&&!!e,ee=e=>(O(e)||T(e))&&T(e.then)&&T(e.catch),te=Object.prototype.toString,ne=e=>te.call(e),re=e=>ne(e).slice(8,-1),k=e=>ne(e)===`[object Object]`,ie=e=>E(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ae=u(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),oe=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},se=/-\w/g,ce=oe(e=>e.replace(se,e=>e.slice(1).toUpperCase())),le=/\B([A-Z])/g,ue=oe(e=>e.replace(le,`-$1`).toLowerCase()),de=oe(e=>e.charAt(0).toUpperCase()+e.slice(1)),fe=oe(e=>e?`on${de(e)}`:``),pe=(e,t)=>!Object.is(e,t),me=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},he=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ge=e=>{let t=parseFloat(e);return isNaN(t)?e:t},_e=e=>{let t=E(e)?Number(e):NaN;return isNaN(t)?e:t},ve,ye=()=>ve||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function A(e){if(x(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=E(r)?Ce(r):A(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(E(e)||O(e))return e}var be=/;(?![^(]*\))/g,xe=/:([^]+)/,Se=/\/\*[^]*?\*\//g;function Ce(e){let t={};return e.replace(Se,``).split(be).forEach(e=>{if(e){let n=e.split(xe);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function j(e){let t=``;if(E(e))t=e;else if(x(e))for(let n=0;n<e.length;n++){let r=j(e[n]);r&&(t+=r+` `)}else if(O(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var we=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Te=u(we);u(we+`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);function Ee(e){return!!e||e===``}function De(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Oe(e[r],t[r]);return n}function Oe(e,t){if(e===t)return!0;let n=w(e),r=w(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=D(e),r=D(t),n||r)return e===t;if(n=x(e),r=x(t),n||r)return n&&r?De(e,t):!1;if(n=O(e),r=O(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||!Oe(e[n],t[n]))return!1}}return String(e)===String(t)}function ke(e,t){return e.findIndex(e=>Oe(e,t))}var Ae=e=>!!(e&&e.__v_isRef===!0),M=e=>E(e)?e:e==null?``:x(e)||O(e)&&(e.toString===te||!T(e.toString))?Ae(e)?M(e.value):JSON.stringify(e,je,2):String(e),je=(e,t)=>Ae(t)?je(e,t.value):S(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Me(t,r)+` =>`]=n,e),{})}:C(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Me(e))}:D(t)?Me(t):O(t)&&!x(t)&&!k(t)?String(t):t,Me=(e,t=``)=>D(e)?`Symbol(${e.description??t})`:e,Ne,Pe=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=Ne,!e&&Ne&&(this.index=(Ne.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=Ne;try{return Ne=this,e()}finally{Ne=t}}}on(){++this._on===1&&(this.prevScope=Ne,Ne=this)}off(){this._on>0&&--this._on===0&&(Ne=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 Fe(){return Ne}function Ie(e,t=!1){Ne&&Ne.cleanups.push(e)}var Le,Re=new WeakSet,ze=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,Ne&&Ne.active&&Ne.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Re.has(this)&&(Re.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ue(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nt(this),Ke(this);let e=Le,t=Qe;Le=this,Qe=!0;try{return this.fn()}finally{qe(this),Le=e,Qe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Xe(e);this.deps=this.depsTail=void 0,nt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Re.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Je(this)&&this.run()}get dirty(){return Je(this)}},Be=0,Ve,He;function Ue(e,t=!1){if(e.flags|=8,t){e.next=He,He=e;return}e.next=Ve,Ve=e}function We(){Be++}function Ge(){if(--Be>0)return;if(He){let e=He;for(He=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ve;){let t=Ve;for(Ve=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 Ke(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function qe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Xe(r),Ze(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Je(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ye(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ye(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===rt)||(e.globalVersion=rt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Je(e))))return;e.flags|=2;let t=e.dep,n=Le,r=Qe;Le=e,Qe=!0;try{Ke(e);let n=e.fn(e._value);(t.version===0||pe(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Le=n,Qe=r,qe(e),e.flags&=-3}}function Xe(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)Xe(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ze(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Qe=!0,$e=[];function et(){$e.push(Qe),Qe=!1}function tt(){let e=$e.pop();Qe=e===void 0?!0:e}function nt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Le;Le=void 0;try{t()}finally{Le=e}}}var rt=0,it=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}},at=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(!Le||!Qe||Le===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Le)t=this.activeLink=new it(Le,this),Le.deps?(t.prevDep=Le.depsTail,Le.depsTail.nextDep=t,Le.depsTail=t):Le.deps=Le.depsTail=t,ot(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=Le.depsTail,t.nextDep=void 0,Le.depsTail.nextDep=t,Le.depsTail=t,Le.deps===t&&(Le.deps=e)}return t}trigger(e){this.version++,rt++,this.notify(e)}notify(e){We();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ge()}}};function ot(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)ot(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var st=new WeakMap,ct=Symbol(``),lt=Symbol(``),ut=Symbol(``);function dt(e,t,n){if(Qe&&Le){let t=st.get(e);t||st.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new at),r.map=t,r.key=n),r.track()}}function ft(e,t,n,r,i,a){let o=st.get(e);if(!o){rt++;return}let s=e=>{e&&e.trigger()};if(We(),t===`clear`)o.forEach(s);else{let i=x(e),a=i&&ie(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ut||!D(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ut)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(ct)),S(e)&&s(o.get(lt)));break;case`delete`:i||(s(o.get(ct)),S(e)&&s(o.get(lt)));break;case`set`:S(e)&&s(o.get(ct));break}}Ge()}function pt(e,t){let n=st.get(e);return n&&n.get(t)}function mt(e){let t=nn(e);return t===e?t:(dt(t,`iterate`,ut),en(e)?t:t.map(an))}function ht(e){return dt(e=nn(e),`iterate`,ut),e}function gt(e,t){return $t(e)?Qt(e)?on(an(t)):on(t):an(t)}var _t={__proto__:null,[Symbol.iterator](){return vt(this,Symbol.iterator,e=>gt(this,e))},concat(...e){return mt(this).concat(...e.map(e=>x(e)?mt(e):e))},entries(){return vt(this,`entries`,e=>(e[1]=gt(this,e[1]),e))},every(e,t){return bt(this,`every`,e,t,void 0,arguments)},filter(e,t){return bt(this,`filter`,e,t,e=>e.map(e=>gt(this,e)),arguments)},find(e,t){return bt(this,`find`,e,t,e=>gt(this,e),arguments)},findIndex(e,t){return bt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return bt(this,`findLast`,e,t,e=>gt(this,e),arguments)},findLastIndex(e,t){return bt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return bt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return St(this,`includes`,e)},indexOf(...e){return St(this,`indexOf`,e)},join(e){return mt(this).join(e)},lastIndexOf(...e){return St(this,`lastIndexOf`,e)},map(e,t){return bt(this,`map`,e,t,void 0,arguments)},pop(){return Ct(this,`pop`)},push(...e){return Ct(this,`push`,e)},reduce(e,...t){return xt(this,`reduce`,e,t)},reduceRight(e,...t){return xt(this,`reduceRight`,e,t)},shift(){return Ct(this,`shift`)},some(e,t){return bt(this,`some`,e,t,void 0,arguments)},splice(...e){return Ct(this,`splice`,e)},toReversed(){return mt(this).toReversed()},toSorted(e){return mt(this).toSorted(e)},toSpliced(...e){return mt(this).toSpliced(...e)},unshift(...e){return Ct(this,`unshift`,e)},values(){return vt(this,`values`,e=>gt(this,e))}};function vt(e,t,n){let r=ht(e),i=r[t]();return r!==e&&!en(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var yt=Array.prototype;function bt(e,t,n,r,i,a){let o=ht(e),s=o!==e&&!en(e),c=o[t];if(c!==yt[t]){let t=c.apply(e,a);return s?an(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,gt(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 xt(e,t,n,r){let i=ht(e),a=n;return i!==e&&(en(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,gt(e,r),i,e)}),i[t](a,...r)}function St(e,t,n){let r=nn(e);dt(r,`iterate`,ut);let i=r[t](...n);return(i===-1||i===!1)&&tn(n[0])?(n[0]=nn(n[0]),r[t](...n)):i}function Ct(e,t,n=[]){et(),We();let r=nn(e)[t].apply(e,n);return Ge(),tt(),r}var wt=u(`__proto__,__v_isRef,__isVue`),Tt=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(D));function Et(e){D(e)||(e=String(e));let t=nn(this);return dt(t,`has`,e),t.hasOwnProperty(e)}var Dt=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?Gt:Wt:i?Ut:Ht).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=x(e);if(!r){let e;if(a&&(e=_t[t]))return e;if(t===`hasOwnProperty`)return Et}let o=Reflect.get(e,t,sn(e)?e:n);if((D(t)?Tt.has(t):wt(t))||(r||dt(e,`get`,t),i))return o;if(sn(o)){let e=a&&ie(t)?o:o.value;return r&&O(e)?Xt(e):e}return O(o)?r?Xt(o):Jt(o):o}},Ot=class extends Dt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=x(e)&&ie(t);if(!this._isShallow){let e=$t(i);if(!en(n)&&!$t(n)&&(i=nn(i),n=nn(n)),!a&&sn(i)&&!sn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:b(e,t),s=Reflect.set(e,t,n,sn(e)?e:r);return e===nn(r)&&(o?pe(n,i)&&ft(e,`set`,t,n,i):ft(e,`add`,t,n)),s}deleteProperty(e,t){let n=b(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ft(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!D(t)||!Tt.has(t))&&dt(e,`has`,t),n}ownKeys(e){return dt(e,`iterate`,x(e)?`length`:ct),Reflect.ownKeys(e)}},kt=class extends Dt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},At=new Ot,jt=new kt,Mt=new Ot(!0),Nt=e=>e,Pt=e=>Reflect.getPrototypeOf(e);function Ft(e,t,n){return function(...r){let i=this.__v_raw,a=nn(i),o=S(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Nt:t?on:an;return!t&&dt(a,`iterate`,c?lt:ct),_(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 It(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Lt(e,t){let n={get(n){let r=this.__v_raw,i=nn(r),a=nn(n);e||(pe(n,a)&&dt(i,`get`,n),dt(i,`get`,a));let{has:o}=Pt(i),s=t?Nt:e?on:an;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&&dt(nn(t),`iterate`,ct),t.size},has(t){let n=this.__v_raw,r=nn(n),i=nn(t);return e||(pe(t,i)&&dt(r,`has`,t),dt(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=nn(a),s=t?Nt:e?on:an;return!e&&dt(o,`iterate`,ct),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return _(n,e?{add:It(`add`),set:It(`set`),delete:It(`delete`),clear:It(`clear`)}:{add(e){!t&&!en(e)&&!$t(e)&&(e=nn(e));let n=nn(this);return Pt(n).has.call(n,e)||(n.add(e),ft(n,`add`,e,e)),this},set(e,n){!t&&!en(n)&&!$t(n)&&(n=nn(n));let r=nn(this),{has:i,get:a}=Pt(r),o=i.call(r,e);o||=(e=nn(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?pe(n,s)&&ft(r,`set`,e,n,s):ft(r,`add`,e,n),this},delete(e){let t=nn(this),{has:n,get:r}=Pt(t),i=n.call(t,e);i||=(e=nn(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ft(t,`delete`,e,void 0,a),o},clear(){let e=nn(this),t=e.size!==0,n=e.clear();return t&&ft(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Ft(r,e,t)}),n}function Rt(e,t){let n=Lt(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 zt={get:Rt(!1,!1)},Bt={get:Rt(!1,!0)},Vt={get:Rt(!0,!1)},Ht=new WeakMap,Ut=new WeakMap,Wt=new WeakMap,Gt=new WeakMap;function Kt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function qt(e){return e.__v_skip||!Object.isExtensible(e)?0:Kt(re(e))}function Jt(e){return $t(e)?e:Zt(e,!1,At,zt,Ht)}function Yt(e){return Zt(e,!1,Mt,Bt,Ut)}function Xt(e){return Zt(e,!0,jt,Vt,Wt)}function Zt(e,t,n,r,i){if(!O(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=qt(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 Qt(e){return $t(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function $t(e){return!!(e&&e.__v_isReadonly)}function en(e){return!!(e&&e.__v_isShallow)}function tn(e){return e?!!e.__v_raw:!1}function nn(e){let t=e&&e.__v_raw;return t?nn(t):e}function rn(e){return!b(e,`__v_skip`)&&Object.isExtensible(e)&&he(e,`__v_skip`,!0),e}var an=e=>O(e)?Jt(e):e,on=e=>O(e)?Xt(e):e;function sn(e){return e?e.__v_isRef===!0:!1}function N(e){return ln(e,!1)}function cn(e){return ln(e,!0)}function ln(e,t){return sn(e)?e:new un(e,t)}var un=class{constructor(e,t){this.dep=new at,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:nn(e),this._value=t?e:an(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||en(e)||$t(e);e=n?e:nn(e),pe(e,t)&&(this._rawValue=e,this._value=n?e:an(e),this.dep.trigger())}};function P(e){return sn(e)?e.value:e}var dn={get:(e,t,n)=>t===`__v_raw`?e:P(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return sn(i)&&!sn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function fn(e){return Qt(e)?e:new Proxy(e,dn)}var pn=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new at,{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 mn(e){return new pn(e)}var hn=class{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._raw=nn(e);let r=!0,i=e;if(!x(e)||!ie(String(t)))do r=!tn(i)||en(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=P(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&sn(this._raw[this._key])){let t=this._object[this._key];if(sn(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return pt(this._raw,this._key)}},gn=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 _n(e,t,n){return sn(e)?e:T(e)?new gn(e):O(e)&&arguments.length>1?vn(e,t,n):N(e)}function vn(e,t,n){return new hn(e,t,n)}var yn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new at(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Le!==this)return Ue(this,!0),!0}get value(){let e=this.dep.track();return Ye(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function bn(e,t,n=!1){let r,i;return T(e)?r=e:(r=e.get,i=e.set),new yn(r,i,n)}var xn={},Sn=new WeakMap,Cn=void 0;function wn(e,t=!1,n=Cn){if(n){let t=Sn.get(n);t||Sn.set(n,t=[]),t.push(e)}}function Tn(e,t,n=d){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:en(e)||i===!1||i===0?En(e,1):En(e),u,f,m,h,g=!1,_=!1;if(sn(e)?(f=()=>e.value,g=en(e)):Qt(e)?(f=()=>l(e),g=!0):x(e)?(_=!0,g=e.some(e=>Qt(e)||en(e)),f=()=>e.map(e=>{if(sn(e))return e.value;if(Qt(e))return l(e);if(T(e))return c?c(e,2):e()})):f=T(e)?t?c?()=>c(e,2):e:()=>{if(m){et();try{m()}finally{tt()}}let t=Cn;Cn=u;try{return c?c(e,3,[h]):e(h)}finally{Cn=t}}:p,t&&i){let e=f,t=i===!0?1/0:i;f=()=>En(e(),t)}let y=Fe(),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(xn):xn,C=e=>{if(!(!(u.flags&1)||!u.dirty&&!e))if(t){let e=u.run();if(i||g||(_?e.some((e,t)=>pe(e,S[t])):pe(e,S))){m&&m();let n=Cn;Cn=u;try{let n=[e,S===xn?void 0:_&&S[0]===xn?[]:S,h];S=e,c?c(t,3,n):t(...n)}finally{Cn=n}}}else u.run()};return s&&s(C),u=new ze(f),u.scheduler=o?()=>o(C,!1):C,h=e=>wn(e,!1,u),m=u.onStop=()=>{let e=Sn.get(u);if(e){if(c)c(e,4);else for(let t of e)t();Sn.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 En(e,t=1/0,n){if(t<=0||!O(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sn(e))En(e.value,t,n);else if(x(e))for(let r=0;r<e.length;r++)En(e[r],t,n);else if(C(e)||S(e))e.forEach(e=>{En(e,t,n)});else if(k(e)){for(let r in e)En(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&En(e[r],t,n)}return e}function Dn(e,t,n,r){try{return r?e(...r):e()}catch(e){kn(e,t,n)}}function On(e,t,n,r){if(T(e)){let i=Dn(e,t,n,r);return i&&ee(i)&&i.catch(e=>{kn(e,t,n)}),i}if(x(e)){let i=[];for(let a=0;a<e.length;a++)i.push(On(e[a],t,n,r));return i}}function kn(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){et(),Dn(a,null,10,[e,i,o]),tt();return}}An(e,n,i,r,o)}function An(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var jn=[],Mn=-1,Nn=[],Pn=null,Fn=0,In=Promise.resolve(),Ln=null;function Rn(e){let t=Ln||In;return e?t.then(this?e.bind(this):e):t}function zn(e){let t=Mn+1,n=jn.length;for(;t<n;){let r=t+n>>>1,i=jn[r],a=Gn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Bn(e){if(!(e.flags&1)){let t=Gn(e),n=jn[jn.length-1];!n||!(e.flags&2)&&t>=Gn(n)?jn.push(e):jn.splice(zn(t),0,e),e.flags|=1,Vn()}}function Vn(){Ln||=In.then(Kn)}function Hn(e){x(e)?Nn.push(...e):Pn&&e.id===-1?Pn.splice(Fn+1,0,e):e.flags&1||(Nn.push(e),e.flags|=1),Vn()}function Un(e,t,n=Mn+1){for(;n<jn.length;n++){let t=jn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;jn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Wn(e){if(Nn.length){let e=[...new Set(Nn)].sort((e,t)=>Gn(e)-Gn(t));if(Nn.length=0,Pn){Pn.push(...e);return}for(Pn=e,Fn=0;Fn<Pn.length;Fn++){let e=Pn[Fn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}Pn=null,Fn=0}}var Gn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Kn(e){try{for(Mn=0;Mn<jn.length;Mn++){let e=jn[Mn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Dn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Mn<jn.length;Mn++){let e=jn[Mn];e&&(e.flags&=-2)}Mn=-1,jn.length=0,Wn(e),Ln=null,(jn.length||Nn.length)&&Kn(e)}}var qn=null,Jn=null;function Yn(e){let t=qn;return qn=e,Jn=e&&e.type.__scopeId||null,t}function Xn(e,t=qn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Fa(-1);let i=Yn(t),a;try{a=e(...n)}finally{Yn(i),r._d&&Fa(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function Zn(e,t){if(qn===null)return e;let n=_o(qn),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=d]=t[e];i&&(T(i)&&(i={mounted:i,updated:i}),i.deep&&En(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Qn(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&&(et(),On(c,n,8,[e.el,s,e,t]),tt())}}function $n(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 er(e,t,n=!1){let r=to();if(r||Li){let i=Li?Li._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&&T(t)?t.call(r&&r.proxy):t}}var tr=Symbol.for(`v-scx`),nr=()=>er(tr);function rr(e,t){return ar(e,null,t)}function ir(e,t){return ar(e,null,{flush:`sync`})}function F(e,t,n){return ar(e,t,n)}function ar(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=nr();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)=>On(e,u,t,n);let f=!1;a===`post`?s.scheduler=e=>{ha(e,u&&u.suspense)}:a!==`sync`&&(f=!0,s.scheduler=(e,t)=>{t?e():Bn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),f&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let m=Tn(e,t,s);return so&&(l?l.push(m):c&&m()),m}function or(e,t,n){let r=this.proxy,i=E(e)?e.includes(`.`)?sr(r,e):()=>r[e]:e.bind(r,r),a;T(t)?a=t:(a=t.handler,n=t);let o=io(this),s=ar(i,a.bind(r),n);return o(),s}function sr(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 cr=Symbol(`_vte`),lr=e=>e.__isTeleport,ur=e=>e&&(e.disabled||e.disabled===``),dr=e=>e&&(e.defer||e.defer===``),fr=e=>typeof SVGElement<`u`&&e instanceof SVGElement,pr=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,mr=(e,t)=>{let n=e&&e.to;return E(n)?t?t(n):null:n},hr={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,_=ur(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=mr(t.props,m),n=br(e,t,h,p);e&&(o!==`svg`&&fr(e)?o=`svg`:o!==`mathml`&&pr(e)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(e),_||(d(e,n),yr(t,!1)))};_&&(d(n,l),yr(t,!0)),dr(t.props)?(t.el.__isMounted=!1,ha(()=>{f(),delete t.el.__isMounted},a)):f()}else{if(dr(t.props)&&e.el.__isMounted===!1){ha(()=>{hr.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=ur(e.props),v=g?n:p,y=g?u:h;if(o===`svg`||fr(p)?o=`svg`:(o===`mathml`||pr(p))&&(o=`mathml`),b?(f(e.dynamicChildren,b,v,i,a,o,s),xa(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):gr(t,n,u,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=mr(t.props,m);e&&gr(t,e,null,l,0)}else g&&gr(t,p,h,l,1);yr(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||!ur(f);for(let i=0;i<s.length;i++){let a=s[i];r(a,t,n,e,!!a.dynamicChildren)}}},move:gr,hydrate:_r};function gr(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||ur(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function _r(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=mr(t.props,c),h=ur(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||br(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||br(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),yr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var vr=hr;function yr(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 br(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[cr]=o,e&&(r(a,e,i),r(o,e,i)),o}var xr=Symbol(`_leaveCb`),Sr=Symbol(`_enterCb`);function Cr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Xr(()=>{e.isMounted=!0}),$r(()=>{e.isUnmounting=!0}),e}var wr=[Function,Array],Tr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:wr,onEnter:wr,onAfterEnter:wr,onEnterCancelled:wr,onBeforeLeave:wr,onLeave:wr,onAfterLeave:wr,onLeaveCancelled:wr,onBeforeAppear:wr,onAppear:wr,onAfterAppear:wr,onAppearCancelled:wr},Er=e=>{let t=e.subTree;return t.component?Er(t.component):t},Dr={name:`BaseTransition`,props:Tr,setup(e,{slots:t}){let n=to(),r=Cr();return()=>{let i=t.default&&Fr(t.default(),!0);if(!i||!i.length)return;let a=Or(i),o=nn(e),{mode:s}=o;if(r.isLeaving)return Mr(a);let c=Nr(a);if(!c)return Mr(a);let l=jr(c,o,r,n,e=>l=e);c.type!==ka&&Pr(c,l);let u=n.subTree&&Nr(n.subTree);if(u&&u.type!==ka&&!za(u,c)&&Er(n).type!==ka){let e=jr(u,o,r,n);if(Pr(u,e),s===`out-in`&&c.type!==ka)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Mr(a);s===`in-out`&&c.type!==ka?e.delayLeave=(e,t,n)=>{let i=Ar(r,u);i[String(u.key)]=u,e[xr]=()=>{t(),e[xr]=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 Or(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==ka){t=n;break}}return t}var kr=Dr;function Ar(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function jr(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=Ar(n,e),C=(e,t)=>{e&&On(e,r,9,t)},w=(e,t)=>{let n=t[1];C(e,t),x(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},T={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted)if(a)r=g||c;else return;t[xr]&&t[xr](!0);let i=S[b];i&&za(e,i)&&i.el[xr]&&i.el[xr](),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[Sr]=e=>{s||(s=!0,C(e?o:i,[t]),T.delayedLeave&&T.delayedLeave(),t[Sr]=void 0)};let c=t[Sr].bind(null,!1);r?w(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[Sr]&&t[Sr](!0),n.isUnmounting)return r();C(f,[t]);let a=!1;t[xr]=n=>{a||(a=!0,r(),C(n?h:m,[t]),t[xr]=void 0,S[i]===e&&delete S[i])};let o=t[xr].bind(null,!1);S[i]=e,p?w(p,[t,o]):o()},clone(e){let a=jr(e,t,n,r,i);return i&&i(a),a}};return T}function Mr(e){if(Hr(e))return e=Wa(e),e.children=null,e}function Nr(e){if(!Hr(e))return lr(e.type)&&e.children?Or(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&&T(n.default))return n.default()}}function Pr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Pr(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 Fr(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===R?(o.patchFlag&128&&i++,r=r.concat(Fr(o.children,t,s))):(t||o.type!==ka)&&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 I(e,t){return T(e)?_({name:e.name},t,{setup:e}):e}function Ir(e){e.ids=[e.ids[0]+ e.ids[2]+++`-`,0,0]}function Lr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var Rr=new WeakMap;function zr(e,t,n,r,i=!1){if(x(e)){e.forEach((e,a)=>zr(e,t&&(x(t)?t[a]:t),n,r,i));return}if(Vr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&zr(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=nn(f),h=f===d?m:e=>Lr(u,e)?!1:b(p,e),g=(e,t)=>!(t&&Lr(u,t));if(l!=null&&l!==c){if(Br(t),E(l))u[l]=null,h(l)&&(f[l]=null);else if(sn(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(T(c))Dn(c,s,12,[o,u]);else{let t=E(c),r=sn(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(),Rr.delete(e)};t.id=-1,Rr.set(e,t),ha(t,n)}else Br(e),s()}}}function Br(e){let t=Rr.get(e);t&&(t.flags|=8,Rr.delete(e))}ye().requestIdleCallback,ye().cancelIdleCallback;var Vr=e=>!!e.type.__asyncLoader,Hr=e=>e.type.__isKeepAlive;function Ur(e,t){Gr(e,`a`,t)}function Wr(e,t){Gr(e,`da`,t)}function Gr(e,t,n=eo){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(qr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Hr(e.parent.vnode)&&Kr(r,t,n,e),e=e.parent}}function Kr(e,t,n,r){let i=qr(t,e,r,!0);ei(()=>{v(r[t],i)},n)}function qr(e,t,n=eo,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{et();let i=io(n),a=On(t,n,e,r);return i(),tt(),a};return r?i.unshift(a):i.push(a),a}}var Jr=e=>(t,n=eo)=>{(!so||e===`sp`)&&qr(e,(...e)=>t(...e),n)},Yr=Jr(`bm`),Xr=Jr(`m`),Zr=Jr(`bu`),Qr=Jr(`u`),$r=Jr(`bum`),ei=Jr(`um`),ti=Jr(`sp`),ni=Jr(`rtg`),ri=Jr(`rtc`);function ii(e,t=eo){qr(`ec`,e,t)}var ai=`components`;function oi(e,t){return li(ai,e,!0,t)||e}var si=Symbol.for(`v-ndc`);function ci(e){return E(e)?li(ai,e,!1)||e:e||si}function li(e,t,n=!0,r=!1){let i=qn||eo;if(i){let n=i.type;if(e===ai){let e=vo(n,!1);if(e&&(e===t||e===ce(t)||e===de(ce(t))))return n}let a=ui(i[e]||n[e],t)||ui(i.appContext[e],t);return!a&&r?n:a}}function ui(e,t){return e&&(e[t]||e[ce(t)]||e[de(ce(t))])}function L(e,t,n,r){let i,a=n&&n[r],o=x(e);if(o||E(e)){let n=o&&Qt(e),r=!1,s=!1;n&&(r=!en(e),s=$t(e),e=ht(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?on(an(e[n])):an(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(O(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 di(e,t,n={},r,i){if(qn.ce||qn.parent&&Vr(qn.parent)&&qn.parent.ce){let e=Object.keys(n).length>0;return t!==`default`&&(n.name=t),z(),La(R,null,[H(`slot`,n,r&&r())],e?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),z();let o=a&&fi(a(n)),s=n.key||o&&o.key,c=La(R,{key:(s&&!D(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 fi(e){return e.some(e=>Ra(e)?!(e.type===ka||e.type===R&&!fi(e.children)):!0)?e:null}var pi=e=>e?oo(e)?_o(e):pi(e.parent):null,mi=_(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=>pi(e.parent),$root:e=>pi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>wi(e),$forceUpdate:e=>e.f||=()=>{Bn(e.update)},$nextTick:e=>e.n||=Rn.bind(e.proxy),$watch:e=>or.bind(e)}),hi=(e,t)=>e!==d&&!e.__isScriptSetup&&b(e,t),gi={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(hi(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 yi&&(o[t]=0)}let l=mi[t],u,f;if(l)return t===`$attrs`&&dt(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 hi(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)||hi(t,s)||b(a,s)||b(r,s)||b(mi,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 _i(e){return x(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function vi(e,t){return!e||!t?e||t:x(e)&&x(t)?e.concat(t):_({},_i(e),_i(t))}var yi=!0;function bi(e){let t=wi(e),n=e.proxy,r=e.ctx;yi=!1,t.beforeCreate&&Si(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:w,renderTriggered:E,errorCaptured:D,serverPrefetch:ee,expose:te,inheritAttrs:ne,components:re,directives:k,filters:ie}=t;if(l&&xi(l,r,null),o)for(let e in o){let t=o[e];T(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);O(t)&&(e.data=Jt(t))}if(yi=!0,a)for(let e in a){let t=a[e],i=G({get:T(t)?t.bind(n,n):T(t.get)?t.get.bind(n,n):p,set:!T(t)&&T(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)Ci(s[e],r,n,e);if(c){let e=T(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{$n(t,e[t])})}u&&Si(u,e,`c`);function ae(e,t){x(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(ae(Yr,d),ae(Xr,f),ae(Zr,m),ae(Qr,h),ae(Ur,g),ae(Wr,_),ae(ii,D),ae(ri,w),ae(ni,E),ae($r,y),ae(ei,S),ae(ti,ee),x(te))if(te.length){let t=e.exposed||={};te.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),ne!=null&&(e.inheritAttrs=ne),re&&(e.components=re),k&&(e.directives=k),ee&&Ir(e)}function xi(e,t,n=p){x(e)&&(e=ki(e));for(let n in e){let r=e[n],i;i=O(r)?`default`in r?er(r.from||n,r.default,!0):er(r.from||n):er(r),sn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Si(e,t,n){On(x(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Ci(e,t,n,r){let i=r.includes(`.`)?sr(n,r):()=>n[r];if(E(e)){let n=t[e];T(n)&&F(i,n)}else if(T(e))F(i,e.bind(n));else if(O(e))if(x(e))e.forEach(e=>Ci(e,t,n,r));else{let r=T(e.handler)?e.handler.bind(n):t[e.handler];T(r)&&F(i,r,e)}}function wi(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=>Ti(c,e,o,!0)),Ti(c,t,o)),O(t)&&a.set(t,c),c}function Ti(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&Ti(e,a,n,!0),i&&i.forEach(t=>Ti(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Ei[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Ei={data:Di,props:Mi,emits:Mi,methods:ji,computed:ji,beforeCreate:Ai,created:Ai,beforeMount:Ai,mounted:Ai,beforeUpdate:Ai,updated:Ai,beforeDestroy:Ai,beforeUnmount:Ai,destroyed:Ai,unmounted:Ai,activated:Ai,deactivated:Ai,errorCaptured:Ai,serverPrefetch:Ai,components:ji,directives:ji,watch:Ni,provide:Di,inject:Oi};function Di(e,t){return t?e?function(){return _(T(e)?e.call(this,this):e,T(t)?t.call(this,this):t)}:t:e}function Oi(e,t){return ji(ki(e),ki(t))}function ki(e){if(x(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ai(e,t){return e?[...new Set([].concat(e,t))]:t}function ji(e,t){return e?_(Object.create(null),e,t):t}function Mi(e,t){return e?x(e)&&x(t)?[...new Set([...e,...t])]:_(Object.create(null),_i(e),_i(t??{})):t}function Ni(e,t){if(!e)return t;if(!t)return e;let n=_(Object.create(null),e);for(let r in t)n[r]=Ai(e[r],t[r]);return n}function Pi(){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 Fi=0;function Ii(e,t){return function(n,r=null){T(n)||(n=_({},n)),r!=null&&!O(r)&&(r=null);let i=Pi(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Fi++,_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&&T(e.install)?(a.add(e),e.install(c,...t)):T(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&&(On(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=Li;Li=c;try{return e()}finally{Li=t}}};return c}}var Li=null;function Ri(e,t,n=d){let r=to(),i=ce(t),a=ue(t),o=zi(e,i),s=mn((o,s)=>{let c,l=d,u;return ir(()=>{let t=e[i];pe(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(!pe(o,c)&&!(l!==d&&pe(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),pe(e,o)&&pe(e,l)&&!pe(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 zi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ce(t)}Modifiers`]||e[`${ue(t)}Modifiers`];function Bi(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||d,i=n,a=t.startsWith(`update:`),o=a&&zi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>E(e)?e.trim():e)),o.number&&(i=n.map(ge)));let s,c=r[s=fe(t)]||r[s=fe(ce(t))];!c&&a&&(c=r[s=fe(ue(t))]),c&&On(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,On(l,e,6,i)}}var Vi=new WeakMap;function Hi(e,t,n=!1){let r=n?Vi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!T(e)){let r=e=>{let n=Hi(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?(O(e)&&r.set(e,null),null):(x(a)?a.forEach(e=>o[e]=null):_(o,a),O(e)&&r.set(e,o),o)}function Ui(e,t){return!e||!h(t)?!1:(t=t.slice(2).replace(/Once$/,``),b(e,t[0].toLowerCase()+t.slice(1))||b(e,ue(t))||b(e,t))}function Wi(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,_=Yn(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:Gi(s)}}catch(t){ja.length=0,kn(t,e,1),v=H(ka)}let b=v;if(y&&h!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(g)&&(y=Ki(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&&Pr(b,n.transition),v=b,Yn(_),v}var Gi=e=>{let t;for(let n in e)(n===`class`||n===`style`||h(n))&&((t||={})[n]=e[n]);return t},Ki=(e,t)=>{let n={};for(let r in e)(!g(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function qi(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?Ji(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Yi(o,r,n)&&!Ui(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?o?Ji(r,o,l):!0:!!o;return!1}function Ji(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(Yi(t,e,a)&&!Ui(n,a))return!0}return!1}function Yi(e,t,n){let r=e[n],i=t[n];return n===`style`&&O(r)&&O(i)?!Oe(r,i):r!==i}function Xi({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 Zi={},Qi=()=>Object.create(Zi),$i=e=>Object.getPrototypeOf(e)===Zi;function ea(e,t,n,r=!1){let i={},a=Qi();e.propsDefaults=Object.create(null),na(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:Yt(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function ta(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=nn(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(Ui(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=ce(o);i[t]=ra(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{na(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!b(t,a)&&((r=ue(a))===a||!b(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=ra(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&&ft(e.attrs,`set`,``)}function na(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(ae(c))continue;let l=t[c],u;i&&b(i,u=ce(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:Ui(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=nn(n),r=s||d;for(let o=0;o<a.length;o++){let s=a[o];n[s]=ra(i,t,s,r[s],e,!b(r,s))}}return o}function ra(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&&T(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===ue(n))&&(r=!0))}return r}var ia=new WeakMap;function aa(e,t,n=!1){let r=n?ia:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!T(e)){let r=e=>{c=!0;let[n,r]=aa(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 O(e)&&r.set(e,f),f;if(x(a))for(let e=0;e<a.length;e++){let t=ce(a[e]);oa(t)&&(o[t]=d)}else if(a)for(let e in a){let t=ce(e);if(oa(t)){let n=a[e],r=o[t]=x(n)||T(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=T(t)&&t.name;if(n===`Boolean`){c=!0;break}else n===`String`&&(l=!1)}else c=T(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||b(r,`default`))&&s.push(t)}}let l=[o,s];return O(e)&&r.set(e,l),l}function oa(e){return e[0]!==`$`&&!ae(e)}var sa=e=>e===`_`||e===`_ctx`||e===`$stable`,ca=e=>x(e)?e.map(Ka):[Ka(e)],la=(e,t,n)=>{if(t._n)return t;let r=Xn((...e)=>ca(t(...e)),n);return r._c=!1,r},ua=(e,t,n)=>{let r=e._ctx;for(let n in e){if(sa(n))continue;let i=e[n];if(T(i))t[n]=la(n,i,r);else if(i!=null){let e=ca(i);t[n]=()=>e}}},da=(e,t)=>{let n=ca(t);e.slots.default=()=>n},fa=(e,t,n)=>{for(let r in t)(n||!sa(r))&&(e[r]=t[r])},pa=(e,t,n)=>{let r=e.slots=Qi();if(e.vnode.shapeFlag&32){let e=t._;e?(fa(r,t,n),n&&he(r,`_`,e,!0)):ua(t,r)}else t&&da(e,t)},ma=(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:fa(i,t,n):(a=!t.$stable,ua(t,i)),o=t}else t&&(da(e,t),o={default:1});if(a)for(let e in i)!sa(e)&&o[e]==null&&delete i[e]},ha=Da;function ga(e){return _a(e)}function _a(e,t){let n=ye();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=ve(e),fe(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 Oa:y(e,t,n,r);break;case ka:b(e,t,n,r);break;case Aa:e??x(t,n,r,o);break;case R:ne(e,t,n,r,i,a,o,s,c);break;default:d&1?w(e,t,n,r,i,a,o,s,c):d&6?re(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,xe)}u!=null&&i?zr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&zr(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)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),O(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(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&&D(e.children,f,null,i,s,va(e,c),l,d),_&&Qn(e,null,i,`created`),E(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!ae(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)}_&&Qn(e,null,i,`beforeMount`);let v=ba(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&ha(()=>{p&&Xa(p,i,e),v&&g.enter(f),_&&Qn(e,null,i,`mounted`)},s)},E=(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||Ea(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;E(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},D=(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)},O=(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&&ya(n,!1),(g=h.onVnodeBeforeUpdate)&&Xa(g,n,t,e),p&&Qn(t,e,n,`beforeUpdate`),n&&ya(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&u(c,``),f?ee(e.dynamicChildren,f,c,n,r,va(t,i),o):s||ce(e,t,c,null,n,r,va(t,i),o,!1),l>0){if(l&16)te(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&&te(c,m,h,n,i);((g=h.onVnodeUpdated)||p)&&ha(()=>{g&&Xa(g,n,t,e),p&&Qn(t,e,n,`updated`)},r)},ee=(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===R||!za(c,l)||c.shapeFlag&198)?m(c.el):n,null,r,i,a,o,!0)}},te=(e,t,n,r,i)=>{if(t!==n){if(t!==d)for(let o in t)!ae(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(ae(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)}},ne=(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),D(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ee(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&xa(e,t,!0)):ce(e,t,n,f,a,o,c,l,u)},re=(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):k(t,n,r,i,a,o,c):ie(e,t,c)},k=(e,t,n,r,i,a,o)=>{let s=e.component=$a(e,r,i);if(Hr(e)&&(s.ctx.renderer=xe),co(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,oe,o),!e.el){let r=s.subTree=H(ka);b(null,r,t,n),e.placeholder=r.el}}else oe(s,e,t,n,i,a,o)},ie=(e,t,n)=>{let r=t.component=e.component;if(qi(e,t,n))if(r.asyncDep&&!r.asyncResolved){se(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},oe=(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=Ca(e);if(n){t&&(t.el=c.el,se(e,t,o)),n.asyncDep.then(()=>{ha(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;ya(e,!1),t?(t.el=c.el,se(e,t,o)):t=c,n&&me(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Xa(d,s,t,c),ya(e,!0);let f=Wi(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),ve(p),e,i,a),t.el=f.el,u===null&&Xi(e,f.el),r&&ha(r,i),(d=t.props&&t.props.onVnodeUpdated)&&ha(()=>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=Vr(t);if(ya(e,!1),l&&me(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Xa(o,d,t),ya(e,!0),s&&Ce){let t=()=>{e.subTree=Wi(e),Ce(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=Wi(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ha(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ha(()=>Xa(o,d,e),i)}(t.shapeFlag&256||d&&Vr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ha(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new ze(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=()=>Bn(u),ya(e,!0),l()},se=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,ta(e,t.props,r,n),ma(e,t.children,n),et(),Un(e),tt()},ce=(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){ue(l,f,n,r,i,a,o,s,c);return}else if(p&256){le(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&_e(l,i,a),f!==l&&u(n,f)):d&16?m&16?ue(l,f,n,r,i,a,o,s,c):_e(l,i,a,!0):(d&8&&u(n,``),m&16&&D(f,n,r,i,a,o,s,c))},le=(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?_e(e,i,a,!0,!1,d):D(t,n,r,i,a,o,s,c,d)},ue=(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;)fe(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){fe(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?fe(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 w=x?Sa(C):f;for(_=w.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||Ta(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?de(d,n,p,2):_--)}}},de=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){de(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,xe);return}if(c===R){r(s,t,n);for(let e=0;e<u.length;e++)de(u[e],t,n,a);r(e.anchor,t,n);return}if(c===Aa){S(e,t,n);return}if(a!==2&&d&1&&l)if(a===0)l.beforeEnter(s),r(s,t,n),ha(()=>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[xr](!0),a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},fe=(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&&(et(),zr(s,null,n,e,!0),tt()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let m=u&1&&f,h=!Vr(e),g;if(h&&(g=o&&o.onVnodeBeforeUnmount)&&Xa(g,t,e),u&6)ge(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}m&&Qn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,xe,r):l&&!l.hasOnce&&(a!==R||d>0&&d&64)?_e(l,t,n,!1,!0):(a===R&&d&384||!i&&u&16)&&_e(c,t,n),r&&pe(e)}(h&&(g=o&&o.onVnodeUnmounted)||m)&&ha(()=>{g&&Xa(g,t,e),m&&Qn(e,null,t,`unmounted`)},n)},pe=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===R){he(n,r);return}if(t===Aa){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()},he=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},ge=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;wa(c),wa(l),r&&me(r),i.stop(),a&&(a.flags|=8,fe(o,e,t,n)),s&&ha(s,t),ha(()=>{e.isUnmounted=!0},t)},_e=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)fe(e[o],t,n,r,i)},ve=e=>{if(e.shapeFlag&6)return ve(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[cr];return n?h(n):t},A=!1,be=(e,t,n)=>{let r;e==null?t._vnode&&(fe(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,A||=(A=!0,Un(r),Wn(),!1)},xe={p:v,um:fe,m:de,r:pe,mt:k,mc:D,pc:ce,pbc:ee,n:ve,o:e},Se,Ce;return t&&([Se,Ce]=t(xe)),{render:be,hydrate:Se,createApp:Ii(be,Se)}}function va({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 ya({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ba(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function xa(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&&xa(t,a)),a.type===Oa&&(a.patchFlag===-1&&(a=i[e]=qa(a)),a.el=t.el),a.type===ka&&!a.el&&(a.el=t.el)}}function Sa(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 Ca(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ca(t)}function wa(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ta(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?Ta(t.subTree):null}var Ea=e=>e.__isSuspense;function Da(e,t){t&&t.pendingBranch?x(e)?t.effects.push(...e):t.effects.push(e):Hn(e)}var R=Symbol.for(`v-fgt`),Oa=Symbol.for(`v-txt`),ka=Symbol.for(`v-cmt`),Aa=Symbol.for(`v-stc`),ja=[],Ma=null;function z(e=!1){ja.push(Ma=e?null:[])}function Na(){ja.pop(),Ma=ja[ja.length-1]||null}var Pa=1;function Fa(e,t=!1){Pa+=e,e<0&&Ma&&t&&(Ma.hasOnce=!0)}function Ia(e){return e.dynamicChildren=Pa>0?Ma||f:null,Na(),Pa>0&&Ma&&Ma.push(e),e}function B(e,t,n,r,i,a){return Ia(V(e,t,n,r,i,a,!0))}function La(e,t,n,r,i){return Ia(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:E(e)||sn(e)||T(e)?{i:qn,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===R?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:Jn,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:qn};return s?(Ja(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=E(n)?8:16),Pa>0&&!o&&Ma&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Ma.push(c),c}var H=Ha;function Ha(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===si)&&(e=ka),Ra(e)){let r=Wa(e,t,!0);return n&&Ja(r,n),Pa>0&&!a&&Ma&&(r.shapeFlag&6?Ma[Ma.indexOf(e)]=r:Ma.push(r)),r.patchFlag=-2,r}if(yo(e)&&(e=e.__vccOpts),t){t=Ua(t);let{class:e,style:n}=t;e&&!E(e)&&(t.class=j(e)),O(n)&&(tn(n)&&!x(n)&&(n=_({},n)),t.style=A(n))}let o=E(e)?1:Ea(e)?128:lr(e)?64:O(e)?4:T(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function Ua(e){return e?tn(e)||$i(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!==R?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&&Pr(u,c.clone(u)),u}function U(e=` `,t=0){return H(Oa,null,e,t)}function Ga(e,t){let n=H(Aa,null,e);return n.staticCount=t,n}function W(e=``,t=!1){return t?(z(),La(ka,null,e)):H(ka,null,e)}function Ka(e){return e==null||typeof e==`boolean`?H(ka):x(e)?H(R,null,e.slice()):Ra(e)?qa(e):H(Oa,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&&!$i(t)?t._ctx=qn:r===3&&qn&&(qn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else T(t)?(t={default:t,_ctx:qn},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=j([t.class,r.class]));else if(e===`style`)t.style=A([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){On(e,t,7,[n,r])}var Za=Pi(),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 Pe(!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:aa(r,i),emitsOptions:Hi(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=Bi.bind(null,a),e.ce&&e.ce(a),a}var eo=null,to=()=>eo||qn,no,ro;{let e=ye(),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);ea(e,r,a,t),pa(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,gi);let{setup:r}=n;if(r){et();let n=e.setupContext=r.length>1?go(e):null,i=io(e),a=Dn(r,e,0,[e.props,n]),o=ee(a);if(tt(),i(),(o||e.sp)&&!Vr(e)&&Ir(e),o){if(a.then(ao,ao),t)return a.then(n=>{uo(e,n,t)}).catch(t=>{kn(t,e,0)});e.asyncDep=a}else uo(e,a,t)}else mo(e,t)}function uo(e,t,n){T(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:O(t)&&(e.setupState=fn(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||wi(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);et();try{bi(e)}finally{tt(),t()}}}var ho={get(e,t){return dt(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(fn(rn(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in mi)return mi[n](e)},has(e,t){return t in e||t in mi}}):e.proxy}function vo(e,t=!0){return T(e)?e.displayName||e.name:e.name||t&&e.__name}function yo(e){return T(e)&&`__vccOpts`in e}var G=(e,t)=>bn(e,t,so);function bo(e,t,n){try{Fa(-1);let r=arguments.length;return r===2?O(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{Fa(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=_({},Tr,No),Fo=(e=>(e.displayName=`Transition`,e.props=Po,e))((e,{slots:t})=>bo(kr,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:w=y,onAppearCancelled:T=b}=t,E=(e,t,n,r)=>{e._enterCancelled=r,Ho(e,t?u:s),Ho(e,t?l:o),n&&n()},D=(e,t)=>{e._isLeaving=!1,Ho(e,d),Ho(e,p),Ho(e,f),t&&t()},O=e=>(t,n)=>{let i=e?w:y,o=()=>E(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:O(!1),onAppear:O(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>D(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){E(e,!1,void 0,!0),Io(b,[e])},onAppearCancelled(e){E(e,!0,void 0,!0),Io(T,[e])},onLeaveCancelled(e){D(e),Io(S,[e])}})}function zo(e){if(e==null)return null;if(O(e))return[Bo(e.enter),Bo(e.leave)];{let t=Bo(e);return[t,t]}}function Bo(e){return _e(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=E(n),a=!1;if(n&&!i){if(t)if(E(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(ue(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=ce(t);if(r!==`filter`&&r in e)return cs[t]=r;r=de(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=Te(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(us,t.slice(6,t.length)):e.setAttributeNS(us,t,n):n==null||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?``:D(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=Ee(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):ue(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;On(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)||!E(r))?fs(e,ce(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)&&T(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)&&E(n)?!1:t in e}var Ds=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return x(t)?e=>me(t,e):t};function Os(e){e.target.composing=!0}function ks(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var As=Symbol(`_assign`);function js(e,t,n){return t&&(e=e.trim()),n&&(e=ge(e)),e}var Ms={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[As]=Ds(i);let a=r||i.props&&i.props.type===`number`;ps(e,t?`change`:`input`,t=>{t.target.composing||e[As](js(e.value,n,a))}),(n||a)&&ps(e,`change`,()=>{e.value=js(e.value,n,a)}),t||(ps(e,`compositionstart`,Os),ps(e,`compositionend`,ks),ps(e,`change`,ks))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[As]=Ds(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ge(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))}},Ns={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?ge(Fs(e)):Fs(e));e[As](e.multiple?i?new Set(t):t:t[0]),e._assigning=!0,Rn(()=>{e._assigning=!1})}),e[As]=Ds(r)},mounted(e,{value:t}){Ps(e,t)},beforeUpdate(e,t,n){e[As]=Ds(n)},updated(e,{value:t}){e._assigning||Ps(e,t)}};function Ps(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=Fs(a);if(n)if(r){let e=typeof o;e===`string`||e===`number`?a.selected=t.some(e=>String(e)===String(o)):a.selected=ke(t,o)>-1}else a.selected=t.has(o);else if(Oe(Fs(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fs(e){return`_value`in e?e._value:e.value}var Is=[`ctrl`,`shift`,`alt`,`meta`],Ls={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)=>Is.some(n=>e[`${n}Key`]&&!t.includes(n))},Rs=(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=Ls[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},zs={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Bs=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ue(n.key);if(t.some(e=>e===r||zs[e]===r))return e(n)}))},Vs=_({patchProp:Ts},ko),Hs;function Us(){return Hs||=ga(Vs)}var Ws=((...e)=>{let t=Us().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Ks(e);if(!r)return;let i=t._component;!T(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Gs(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Gs(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Ks(e){return E(e)?document.querySelector(e):e}var qs=/^[a-z0-9]+(-[a-z0-9]+)*$/,Js=(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&&!Ys(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&&!Ys(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!Ys(e,n)?null:e}return null},Ys=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,Xs=Object.freeze({left:0,top:0,width:16,height:16}),Zs=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Qs=Object.freeze({...Xs,...Zs}),$s=Object.freeze({...Qs,body:``,hidden:!1});function ec(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 tc(e,t){let n=ec(e,t);for(let r in $s)r in Zs?r in e&&!(r in n)&&(n[r]=Zs[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function nc(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 rc(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=tc(r[e]||i[e],a)}return o(t),n.forEach(o),tc(e,a)}function ic(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=nc(e);for(let i in r){let a=r[i];a&&(t(i,rc(e,i,a)),n.push(i))}return n}var ac={provider:``,aliases:{},not_found:{},...Xs};function oc(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function sc(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!oc(e,ac))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!oc(t,$s))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]||!oc(t,$s))return null}return t}var cc=Object.create(null);function lc(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function uc(e,t){let n=cc[e]||(cc[e]=Object.create(null));return n[t]||(n[t]=lc(e,t))}function dc(e,t){return sc(t)?ic(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function fc(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var pc=!1;function mc(e){return typeof e==`boolean`&&(pc=e),pc}function hc(e){let t=typeof e==`string`?Js(e,!0,pc):e;if(t){let e=uc(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function gc(e,t){let n=Js(e,!0,pc);if(!n)return!1;let r=uc(n.provider,n.prefix);return t?fc(r,n.name,t):(r.missing.add(n.name),!0)}function _c(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),pc&&!t&&!e.prefix){let t=!1;return sc(e)&&(e.prefix=``,ic(e,(e,n)=>{gc(e,n)&&(t=!0)})),t}let n=e.prefix;return Ys({prefix:n,name:`a`})?!!dc(uc(t,n),e):!1}var vc=Object.freeze({width:null,height:null}),yc=Object.freeze({...vc,...Zs}),bc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,xc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Sc(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(bc);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=xc.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 Cc(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 wc(e,t){return e?`<defs>`+e+`</defs>`+t:t}function Tc(e,t,n){let r=Cc(e);return wc(r.defs,t+r.content+n)}var Ec=e=>e===`unset`||e===`undefined`||e===`none`;function Dc(e,t){let n={...Qs,...e},r={...yc,...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=Tc(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=Sc(d,c/l)):(u=o===`auto`?c:o,d=s===null?Sc(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{Ec(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 Oc=/\sid="(\S+)"/g,kc=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Ac=0;function jc(e,t=kc){let n=[],r;for(;r=Oc.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+(Ac++).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 Mc=Object.create(null);function Nc(e,t){Mc[e]=t}function Pc(e){return Mc[e]||Mc[``]}function Fc(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 Ic=Object.create(null),Lc=[`https://api.simplesvg.com`,`https://api.unisvg.com`],Rc=[];Lc.length>0;)Lc.length===1||Math.random()>.5?Rc.push(Lc.shift()):Rc.push(Lc.pop());Ic[``]=Fc({resources:[`https://api.iconify.design`].concat(Rc)});function zc(e,t){let n=Fc(t);return n===null?!1:(Ic[e]=n,!0)}function Bc(e){return Ic[e]}var Vc=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Hc(e,t){let n=Bc(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 Uc(e){return e===404}var Wc=(e,t,n)=>{let r=[],i=Hc(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 Gc(e){if(typeof e==`string`){let t=Bc(e);if(t)return t.path}return`/`}var Kc={prepare:Wc,send:(e,t,n)=>{if(!Vc){n(`abort`,424);return}let r=Gc(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;Vc(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Uc(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 qc(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]=uc(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 Jc(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Yc(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||Jc([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Xc=0;function Zc(e,t,n){let r=Xc++,i=Jc.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 Qc(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?Js(e,t,n):e;i&&r.push(i)}),r}var $c={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function el(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 tl(e){let t={...$c,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=el(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 nl(){}var rl=Object.create(null);function il(e){if(!rl[e]){let t=Bc(e);if(!t)return;rl[e]={config:t,redundancy:tl(t)}}return rl[e]}function al(e,t,n){let r,i;if(typeof e==`string`){let t=Pc(e);if(!t)return n(void 0,424),nl;i=t.send;let a=il(e);a&&(r=a.redundancy)}else{let t=Fc(e);if(t){r=tl(t);let n=Pc(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),nl):r.query(t,i,n)().abort}function ol(){}function sl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Yc(e)}))}function cl(e){let t=[],n=[];return e.forEach(e=>{(e.match(qs)?t:n).push(e)}),{valid:t,invalid:n}}function ll(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(!dc(e,n).length){r();return}}catch(e){console.error(e)}r(),sl(e)}function ul(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function dl(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)){ul(e.loadIcons(r,n,t),t=>{ll(e,r,t)});return}if(i){r.forEach(r=>{ul(i(r,n,t),t=>{ll(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=cl(r);if(o.length&&ll(e,o,null),!a.length)return;let s=n.match(qs)?Pc(t):null;if(!s){ll(e,a,null);return}s.prepare(t,n,a).forEach(n=>{al(t,n,t=>{ll(e,n.icons,t)})})}))}var fl=(e,t)=>{let n=qc(Qc(e,!0,mc()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,ol)}),()=>{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(uc(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=uc(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&&dl(e,t)}),t?Zc(t,n,i):ol};function pl(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in vc?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var ml=/[\s,]+/;function hl(e,t){t.split(ml).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function gl(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 _l(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 vl(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function yl(e){return`data:image/svg+xml,`+vl(e)}function bl(e){return`url("`+yl(e)+`")`}var xl={...yc,inline:!1},Sl={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Cl={display:`inline-block`},wl={backgroundColor:`currentColor`},Tl={backgroundColor:`transparent`},El={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},Dl={webkitMask:wl,mask:wl,background:Tl};for(let e in Dl){let t=Dl[e];for(let n in El)t[e+n]=El[n]}var Ol={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;Ol[e+`-flip`]=t,Ol[e.slice(0,1)+`-flip`]=t,Ol[e+`Flip`]=t});function kl(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var Al=(e,t)=>{let n=pl(xl,t),r={...Sl},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`&&hl(n,i);break;case`color`:a.color=i;break;case`rotate`:typeof i==`string`?n[e]=gl(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=Ol[e];t?(i===!0||i===`true`||i===1)&&(n[t]=!0):xl[e]===void 0&&(r[e]=i)}}}let c=Dc(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=jc(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=_l(u,{...l,width:d+``,height:f+``});return r.style={...a,"--svg":bl(m),width:kl(l.width),height:kl(l.height),...Cl,...p?wl:Tl,...s},bo(`span`,r)};if(mc(!0),Nc(``,Kc),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`||!_c(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;zc(e,r)||console.error(n)}catch{console.error(n)}}}}var jl={...Qs,body:``},K=I((e,{emit:t})=>{let n=N(null);function r(){n.value&&=(n.value.abort?.(),null)}let i=N(!!e.ssr),a=N(``),o=cn(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=Js(i,!1,!0))===null)return null;let s=hc(o);if(!s){let e=n.value;return(!e||e.name!==i)&&(s===null?n.value={name:i}:n.value={name:i,abort:fl([o],c)}),null}r(),a.value!==i&&(a.value=i,Rn(()=>{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():Xr(()=>{i.value=!0,c()}),F(()=>e.icon,c),ei(r),()=>{let t=o.value;if(!t)return Al(jl,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),Al({...Qs,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),Ml=I({__name:`ContextMenu`,props:{pos:{},transform:{}},setup(e){return(t,n)=>(z(),La(vr,{to:`body`},[e.pos?(z(),B(`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:A({left:`${e.pos.x}px`,top:`${e.pos.y}px`,transform:e.transform})},[di(t.$slots,`default`)],4)):W(``,!0)]))}}),Nl={class:`h-8 px-3 border-b border-border flex items-center justify-between`},Pl={class:`section-title`},Fl={class:`p-3 overflow-y-auto`,style:{"max-height":`calc(100vh - 64px - 32px)`}},Il=I({__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)=>(z(),La(vr,{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:A({width:n.width,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100vh - 64px)`})},[V(`div`,Nl,[V(`span`,Pl,M(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`,Fl,[di(e.$slots,`default`)])],4)],32)]))}}),Ll=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,Rl=N(null),zl=N(!1);function Bl(e){e.preventDefault(),Rl.value=e}function Vl(){zl.value=!0,Rl.value=null}typeof window<`u`&&(window.addEventListener(`beforeinstallprompt`,Bl),window.addEventListener(`appinstalled`,Vl));var Hl=G(()=>!Ll&&!zl.value),Ul=/iPad|iPhone|iPod/.test(navigator.userAgent),Wl=Ul?[{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 Gl(){let e=N(!1);function t(){Rl.value?(Rl.value.prompt(),Rl.value=null):e.value=!0}return{showInstall:Hl,showA2hs:e,handleInstallClick:t,isIos:Ul,a2hsSteps:Wl}}var Kl={key:1,class:`badge-ok`},ql={key:2,class:`fixed bottom-2.5 max-md:bottom-14 right-2.5 z-[10] flex gap-1.5`},Jl=[`title`],Yl={class:`flex flex-col gap-2.5 mb-3`},Xl={class:`flex items-center justify-center w-6 h-6 rounded-md bg-white/10 shrink-0`},Zl={class:`flex justify-end`},Ql=I({__name:`FullscreenToggle`,props:{inlineInstall:{type:Boolean,default:!1}},setup(e){let t=e,n=!!document.documentElement.requestFullscreen,r=N(!!document.fullscreenElement);function i(){document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}function a(){r.value=!!document.fullscreenElement}Xr(()=>document.addEventListener(`fullscreenchange`,a)),ei(()=>document.removeEventListener(`fullscreenchange`,a));let{showInstall:o,showA2hs:s,handleInstallClick:c,a2hsSteps:l}=Gl();return(e,a)=>(z(),B(R,null,[t.inlineInstall&&P(o)?(z(),B(`button`,{key:0,type:`button`,class:`btn-primary text-[11px] inline-flex items-center gap-1.5`,onClick:a[0]||=e=>P(c)()},[H(P(K),{icon:`lucide:download`,class:`text-[13px]`}),a[5]||=U(` add to home screen `,-1)])):t.inlineInstall?(z(),B(`span`,Kl,`already installed`)):!t.inlineInstall&&(n||P(o))?(z(),B(`div`,ql,[P(o)?(z(),B(`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=>P(c)()},[H(P(K),{icon:`lucide:download`,class:`text-base`})])):W(``,!0),n?(z(),B(`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(P(K),{icon:r.value?`lucide:minimize`:`lucide:maximize`,class:`text-base`},null,8,[`icon`])],8,Jl)):W(``,!0)])):W(``,!0),P(s)?(z(),La(Il,{key:3,title:`install app`,width:`340px`,onClose:a[4]||=e=>s.value=!1},{default:Xn(()=>[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`,Yl,[(z(!0),B(R,null,L(P(l),(e,t)=>(z(),B(`div`,{key:t,class:`flex items-center gap-2.5 text-[12px] text-muted`},[V(`span`,Xl,[H(P(K),{icon:e.icon,class:`text-sm text-text`},null,8,[`icon`])]),V(`span`,null,M(t+1)+`. `+M(e.text),1)]))),128))]),V(`div`,Zl,[V(`button`,{class:`btn-ghost`,onClick:a[3]||=e=>s.value=!1},`close`)])]),_:1})):W(``,!0)],64))}});function $l(){let e=N(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 Xr(()=>document.addEventListener(`click`,s)),ei(()=>document.removeEventListener(`click`,s)),{menu:e,open:n,close:r,onContext:i,onTouchStart:a,cancelLongPress:o}}var eu=`piclaw:settings`,tu=768;function nu(){return window.matchMedia(`(max-width: ${tu-1}px)`).matches}function ru(){return nu()?`small`:`large`}function iu(){return`grid`}const au={enabled:!0,lang:`en-US`,rate:1.2,pitch:1,volume:1,voiceMatch:`Google | Samantha | Daniel`};function ou(){return{theme:`system`,wallpaper:``,iconLayout:iu(),dockSize:ru(),showClock:!0,clockFormat:`24h`,showStatus:!0,showFullscreen:!0,showDesktopIcons:!1,pinnedApps:[`chat`,`notes`,`files`,`terminal`,...nu()?[]:[`devices`,`browser`,`agent`,`welcome`,`settings`]],tts:{...au}}}function su(){let e=ou();try{let t=localStorage.getItem(eu);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 cu=Jt(su());function lu(){localStorage.setItem(eu,JSON.stringify(cu))}F(cu,lu,{deep:!0});function uu(e){window.dispatchEvent(new CustomEvent(`piclaw:settings:${e}`,{detail:cu[e]}))}function du(){return{settings:cu,set(e){for(let[t,n]of Object.entries(e))cu[t]=n,uu(t)},reset(){Object.assign(cu,ou()),lu()}}}var fu=window.matchMedia(`(prefers-color-scheme: dark)`);function pu(){let{settings:e}=du(),t=G(()=>e.theme===`system`?fu.matches?`dark`:`light`:e.theme);function n(){let e=t.value;e===`dark`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e}return F(t,n,{immediate:!0}),fu.addEventListener(`change`,n),{effective:t}}const mu=Symbol(`windowState`),hu=Symbol(`instanceId`);function gu(e){let t=er(mu);if(!t)throw Error(`useWindowState requires windowStateKey to be provided`);let n=er(hu),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 _u={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`},vu={key:0,class:`absolute inset-0 flex items-center justify-center pointer-events-none select-none`,"aria-hidden":`true`},yu=[`onClick`],bu=I({__name:`AppDesktop`,props:{apps:{},openInstances:{}},emits:[`launch`,`ctxAction`],setup(e,{expose:t,emit:n}){let r=n,{settings:i,set:a}=du(),{effective:o}=pu(),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}=$l();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()}Xr(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=I({props:{instanceId:{type:String,required:!0}},setup(e,{slots:t}){return $n(hu,_n(()=>e.instanceId)),()=>t.default?.()}});return(t,n)=>(z(),B(R,null,[s.value?(z(),B(`div`,{key:0,class:`fixed inset-0 bg-cover bg-center pointer-events-none select-none z-0`,style:A({backgroundImage:`url(${s.value})`}),"aria-hidden":`true`},null,4)):W(``,!0),s.value?.includes(`wallhaven.cc`)?(z(),B(`span`,_u,`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)=>P(m)&&P(m)(...e),onTouchmove:n[1]||=(...e)=>P(m)&&P(m)(...e)},[s.value?W(``,!0):(z(),B(`div`,vu,[...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)]])),P(i).showDesktopIcons?(z(),B(`div`,{key:1,class:j([`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`])},[(z(!0),B(R,null,L(e.apps.filter(e=>!e.hidden),e=>(z(),B(`button`,{key:`desktop-${e.key}`,type:`button`,tabindex:-1,class:j([`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(P(K),{icon:e.icon,class:j([`mx-auto`,[l.value===`grid`?`text-2xl`:`text-xl`,c.value?``:`drop-shadow-[0_1px_3px_rgba(0,0,0,0.8)]`]]),style:A({color:c.value&&e.lightColor?e.lightColor:e.color})},null,8,[`icon`,`class`,`style`]),V(`div`,{class:`mt-1 truncate`,style:A(c.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5)`})},M(e.label),5)],10,yu))),128))],2)):W(``,!0),(z(!0),B(R,null,L(e.openInstances,e=>(z(),La(vr,{key:e.id,to:e.mountTarget},[H(P(x),{"instance-id":e.id},{default:Xn(()=>[(z(),La(ci(e.app.component)))]),_:2},1032,[`instance-id`])],8,[`to`]))),128))],32),P(i).showFullscreen?(z(),La(Ql,{key:2})):W(``,!0),H(Ml,{pos:P(d)??null},{default:Xn(()=>[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 `),P(i).showDesktopIcons?(z(),B(`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},M(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))}}),xu=``;async function Su(e,t){try{let n=await fetch(xu+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 Cu(e,t){return await Su(e,t)||null}var wu=N(`loading`),Tu=N(null),Eu=!1;function Du(){return Eu||(Eu=!0,Ou()),{status:Xt(wu),device:Xt(Tu),checkAuth:Ou,waitForApproval:ku}}async function Ou(){let e=await Cu(`/api/auth/status`);if(!e){wu.value=`unknown`;return}Tu.value=e.device,wu.value=e.status,e.status===`pending`&&ku()}function ku(){let e=new EventSource(`/api/auth/wait`,{withCredentials:!0});e.addEventListener(`approved`,()=>{wu.value=`approved`,e.close()}),e.addEventListener(`error`,()=>{})}var Au={key:0,class:`auth-gate`},ju={key:1,class:`auth-gate`},Mu={class:`border border-border rounded-lg p-6 max-w-sm w-full text-center`},Nu={key:0,class:`text-[11px] text-muted mb-4 font-mono`},Pu={key:0,class:`ml-2 text-success opacity-80`},Fu={key:3,class:`auth-gate`},Iu=I({__name:`AuthGate`,setup(e){let{status:t,device:n}=Du(),r=N(!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)=>P(t)===`loading`?(z(),B(`div`,Au,[...a[0]||=[V(`div`,{class:`text-muted text-[13px]`},`connecting...`,-1)]])):P(t)===`pending`?(z(),B(`div`,ju,[V(`div`,Mu,[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),P(n)?(z(),B(`div`,Nu,M(P(n).name)+` · `+M(P(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),P(n)?(z(),B(`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 `+M(P(n).id)+` `,1),r.value?(z(),B(`span`,Pu,`copied!`)):W(``,!0)])):W(``,!0)])])):P(t)===`approved`?di(e.$slots,`default`,{key:2},void 0,!0):(z(),B(`div`,Fu,[...a[5]||=[V(`div`,{class:`text-danger text-[13px]`},`unable to connect. please refresh.`,-1)]]))}}),Lu=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ru=Lu(Iu,[[`__scopeId`,`data-v-8f0a1990`]]),zu=N();function Bu(){function e(e){return new Promise(t=>{zu.value={message:e,resolve:t}})}function t(e){return new Promise(t=>{zu.value={message:e,alertOnly:!0,resolve:()=>t()}})}function n(){zu.value?.resolve(!0),zu.value=void 0}function r(){zu.value?.resolve(!1),zu.value=void 0}return{state:zu,confirm:e,alert:t,accept:n,cancel:r}}var Vu={class:`text-[12px] text-text mb-3`},Hu={class:`flex gap-2 items-center justify-end`},Uu=I({__name:`ConfirmDialog`,setup(e){let{state:t,accept:n,cancel:r}=Bu(),i=N();F(t,async e=>{e&&(await Rn(),i.value?.focus())});function a(e){t.value&&(e.key===`Enter`?(e.preventDefault(),n()):e.key===`Escape`&&(e.preventDefault(),r()))}return Xr(()=>window.addEventListener(`keydown`,a)),ei(()=>window.removeEventListener(`keydown`,a)),(e,a)=>P(t)?(z(),La(Il,{key:0,title:P(t).alertOnly?`notice`:`confirm`,width:`360px`,onClose:P(r)},{default:Xn(()=>[V(`p`,Vu,M(P(t).message),1),V(`div`,Hu,[P(t).alertOnly?(z(),B(`button`,{key:0,ref_key:`primaryBtn`,ref:i,type:`button`,class:`btn-primary`,onClick:a[0]||=(...e)=>P(n)&&P(n)(...e)},[...a[3]||=[U(` ok `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]],512)):(z(),B(R,{key:1},[V(`button`,{type:`button`,class:`btn-ghost`,onClick:a[1]||=(...e)=>P(r)&&P(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)=>P(n)&&P(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)}}),Wu=768;function Gu(){let e=N(window.innerWidth<Wu),t=window.matchMedia(`(max-width: ${Wu-1}px)`),n=t=>{e.value=t.matches};return t.addEventListener(`change`,n),Ie(()=>t.removeEventListener(`change`,n)),e}function Ku(){let e=window.matchMedia(`(pointer: coarse)`),t=N(e.matches),n=e=>{t.value=e.matches};return e.addEventListener(`change`,n),Ie(()=>e.removeEventListener(`change`,n)),t}function qu(e,t){let n;Xr(()=>{e(),n=setInterval(()=>{e()},t)}),ei(()=>{n&&=(clearInterval(n),void 0)})}var Ju={class:`flex flex-col h-full overflow-y-auto`},Yu={class:`p-3`},Xu={key:0,class:`text-[12px] text-muted`},Zu={key:1,class:`text-[12px] text-muted`},Qu={key:2,class:`w-full border-collapse text-[12px]`},$u={class:`py-1.5 px-2 border-b border-border font-medium`},ed={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},td={class:`py-1.5 px-2 border-b border-border`},nd={class:`py-1.5 px-2 border-b border-border text-right`},rd=[`disabled`,`onClick`],id=[`disabled`,`onClick`],ad={class:`px-3 pb-3`},od={key:0,class:`text-[12px] text-muted`},sd={key:1,class:`w-full border-collapse text-[12px]`},cd={class:`py-1.5 px-2 border-b border-border font-medium`},ld={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},ud={class:`py-1.5 px-2 border-b border-border`},dd={class:`py-1.5 px-2 border-b border-border text-right whitespace-nowrap`},fd=[`disabled`,`onClick`],pd=[`onClick`],md=[`onClick`],hd={key:0,class:`mb-3 text-center`},gd={key:0,class:`text-[11px] text-muted mb-2`},_d={key:1,class:`text-[11px] text-muted mb-2`},vd=[`href`],yd={key:1,class:`mb-3`},bd={class:`text-[11px] text-muted`},xd={key:2,class:`mb-3`},Sd={class:`text-[11px] text-muted mb-1`},Cd=[`placeholder`],wd=[`disabled`],Td={key:3,class:`text-[11px] text-muted`},Ed={key:4,class:`text-[11px] text-ok`},Dd={key:5,class:`text-[11px] text-danger`},Od={class:`mb-3`},kd={class:`text-[11px] text-muted mb-1`},Ad={class:`font-medium text-text`},jd={class:`text-[10px] text-muted mb-1`},Md={class:`font-mono text-accent`},Nd={key:0,class:`text-[10px] text-muted`},Pd={key:0},Fd=[`href`],Id=[`disabled`],Ld=I({__name:`AuthTab`,setup(e){let t=N(null),n=N(!1),r=N(null),i=N(null),a=N(null),o=N([]),s=N(!1),c=N(``),l=N(null),u=null,d=N([]),f=N(null),p=N(``),m=N(!1),h=N(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 Cu(`/api/pi/status`);e&&(t.value=e.auth)}async function w(){let e=await Cu(`/api/pi/apikey-providers`);e&&(d.value=e)}function T(){C(),w()}qu(T,1e4);async function E(e){ee(),i.value=e,o.value=[],s.value=!1,c.value=``,n.value=!0;try{let t=await Su(`/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,ee(),t.type===`complete`&&T())}catch{}},u.onerror=()=>{s.value||=(o.value.push({type:`error`,error:`Connection lost`}),!0),ee()}}catch(e){o.value.push({type:`error`,error:e instanceof Error?e.message:`Login failed`}),s.value=!0}finally{n.value=!1}}async function D(){if(!a.value)return;let e=c.value;c.value=``,await Su(`/api/pi/login/respond`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginId:a.value,value:e})})}function O(){ee(),i.value=null,a.value=null,o.value=[],s.value=!1}function ee(){u&&=(u.close(),null)}async function te(e){r.value=e;try{await Su(`/api/pi/logout`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}),T()}finally{r.value=null}}function ne(e){f.value=e,p.value=``,m.value=!1,Rn(()=>h.value?.focus())}function re(){f.value=null,p.value=``,m.value=!1}async function k(){if(!(!f.value||!p.value.trim())){m.value=!0;try{await Su(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:f.value.id,key:p.value.trim()})}),re(),T()}finally{m.value=!1}}}async function ie(e){r.value=e;try{await Su(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e,key:null})}),T()}finally{r.value=null}}return F(_,e=>{e&&Rn(()=>l.value?.focus())}),(e,a)=>(z(),B(R,null,[V(`div`,Ju,[V(`div`,Yu,[a[2]||=V(`h3`,{class:`section-title mb-2 select-none`},`oauth providers`,-1),t.value?g.value.length===0?(z(),B(`div`,Zu,` no oauth providers available `)):(z(),B(`table`,Qu,[V(`tbody`,null,[(z(!0),B(R,null,L(g.value,e=>(z(),B(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,$u,M(e.name),1),V(`td`,ed,M(e.id),1),V(`td`,td,[V(`span`,{class:j(e.hasAuth?`badge-ok`:`badge-muted`)},M(e.hasAuth?`connected`:`not connected`),3)]),V(`td`,nd,[e.hasAuth?(z(),B(`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=>te(e.id)},M(r.value===e.id?`...`:`logout`),9,rd)):(z(),B(`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=>E(e.id)},M(n.value&&i.value===e.id?`...`:`login`),9,id))])]))),128))])])):(z(),B(`div`,Xu,`loading...`))]),V(`div`,ad,[a[3]||=V(`h3`,{class:`section-title mb-2 select-none`},`api keys`,-1),d.value.length===0?(z(),B(`div`,od,`loading...`)):(z(),B(`table`,sd,[V(`tbody`,null,[(z(!0),B(R,null,L(d.value,e=>(z(),B(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,cd,M(e.name),1),V(`td`,ld,M(e.envVar),1),V(`td`,ud,[V(`span`,{class:j(e.hasAuth?`badge-ok`:`badge-muted`)},M(e.hasAuth?`configured`:`not set`),3)]),V(`td`,dd,[e.hasAuth?(z(),B(`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=>ie(e.id)},M(r.value===e.id?`...`:`remove`),9,fd)):W(``,!0),e.hasAuth?W(``,!0):(z(),B(`button`,{key:1,type:`button`,class:`btn-sm border-accent-dim text-accent bg-accent-dim hover:bg-accent-dimmer`,onClick:t=>ne(e)},` set key `,8,pd)),e.hasAuth?(z(),B(`button`,{key:2,type:`button`,class:`ml-1 btn-sm`,onClick:t=>ne(e)},` update `,8,md)):W(``,!0)])]))),128))])]))])]),i.value?(z(),La(Il,{key:0,title:`login — ${i.value}`,width:`420px`,onClose:O},{default:Xn(()=>[y.value?(z(),B(`div`,hd,[y.value.instructions?(z(),B(`p`,gd,M(y.value.instructions),1)):(z(),B(`p`,_d,` 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,vd)])):W(``,!0),v.value&&!s.value?(z(),B(`div`,yd,[V(`p`,bd,M(v.value),1)])):W(``,!0),_.value?(z(),B(`div`,xd,[V(`p`,Sd,M(_.value.message),1),V(`form`,{class:`flex gap-2`,onSubmit:Rs(D,[`prevent`]),onKeydown:Bs(O,[`escape`])},[Zn(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,Cd),[[Ms,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,wd)],32)])):W(``,!0),!s.value&&!y.value&&!_.value&&!v.value?(z(),B(`div`,Td,` connecting... `)):W(``,!0),S.value?(z(),B(`div`,Ed,`login successful`)):W(``,!0),b.value?(z(),B(`div`,Dd,M(b.value),1)):W(``,!0)]),_:1},8,[`title`])):W(``,!0),f.value?(z(),La(Il,{key:1,title:`${f.value.name} — api key`,width:`420px`,onClose:re},{default:Xn(()=>[V(`div`,Od,[V(`p`,kd,[a[4]||=U(` enter your API key for `,-1),V(`span`,Ad,M(f.value.name),1)]),V(`p`,jd,[a[5]||=U(` env: `,-1),V(`code`,Md,M(f.value.envVar),1)]),f.value.url?(z(),B(`p`,Nd,[f.value.guide?(z(),B(`span`,Pd,M(f.value.guide)+` — `,1)):W(``,!0),V(`a`,{href:f.value.url,target:`_blank`,rel:`noopener`,class:`text-accent hover:underline`},`LINK`,8,Fd)])):W(``,!0)]),V(`form`,{class:`flex gap-2`,onSubmit:Rs(k,[`prevent`]),onKeydown:Bs(re,[`escape`])},[Zn(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),[[Ms,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`},M(m.value?`...`:`save`),9,Id)],32)]),_:1},8,[`title`])):W(``,!0)],64))}}),Rd=0;function zd(){return`node_${++Rd}`}function Bd(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function Vd(e,t,n,r,i){let a=zd(),o=n?`${n}/${e}`:`/${e}`,s=Bd(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=>Vd(t,e[t],o,a,i))}else s===`array`&&(c.children=t.map((e,t)=>Vd(String(t),e,o,a,i)));return c}function Hd(e){let t=new Map,n=Bd(e),r={id:zd(),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=>Vd(e,n[e],``,r.id,t))}else n===`array`&&(r.children=e.map((e,n)=>Vd(String(n),e,``,r.id,t)));return{root:r,nodesById:t}}function Ud(e){switch(e.type){case`object`:{let t={};for(let n of e.children)t[n.key]=Ud(n);return t}case`array`:return e.children.map(e=>Ud(e));default:return e.value}}function Wd(e,t,n,r){let i=n?`${n}/${t}`:`/${t}`;return{...e,key:t,path:i,parentId:r,children:e.children.map((t,n)=>Wd(t,e.type===`array`?String(n):t.key,i,e.id))}}function Gd(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 Kd(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 qd(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=>qd(e,n))}}function Jd(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:Kd(o)}}function Yd(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:qd({...e,key:r},t)})}}function Xd(e,t,n){if(!e.nodesById.get(t))return e;let r=Bd(n);return r!==`object`&&r!==`array`?Jd(e,t,e=>({...e,type:r,value:n,children:[]})):Jd(e,t,e=>{let t=e.path.split(`/`).slice(0,-1).join(`/`)||``,r=new Map;return{...Vd(e.key,n,t,e.parentId,r),id:e.id}})}function Zd(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:Jd(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=>qd(e,t))),r})}function Qd(e,t,n,r){return e.nodesById.get(t)?Jd(e,t,e=>{let t=Vd(n,r,e.path===`/`?``:e.path,e.id,new Map);return{...e,children:[...e.children,t]}}):e}function $d(e,t,n,r){return e.nodesById.get(t)?Jd(e,t,e=>{let t=e.path===`/`?``:e.path,i=Wd(n,e.type===`array`?String(r):n.key,t,e.id),a=[...e.children];return a.splice(r,0,i),Yd({...e,children:a})}):e}function ef(e,t){let n=e.nodesById.get(t);return!n||!n.parentId?e:Jd(e,n.parentId,e=>{let n=e.children.filter(e=>e.id!==t);return Yd({...e,children:n})})}function tf(e,t,n,r,i){if(!e.nodesById.get(t))return e;let a=new Set(n);return Jd(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),Yd({...e,children:c})})}function nf(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 rf(e,t,n){let r=e.nodesById.get(t);return r?Xd(e,t,nf(Ud(r),n)):e}function af(e,t){let n=e.nodesById.get(t);if(!n||!n.parentId||!e.nodesById.get(n.parentId))return e;let r=Ud(n);return Jd(e,n.parentId,e=>{let i=e.children.findIndex(e=>e.id===t),a=e.path===`/`?``:e.path,o=Vd(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),Yd({...e,children:s})})}var of=100,sf=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 cf(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 lf(e,t,n){let r=n??new Set;if(e.$ref){if(r.has(e.$ref))return e;r.add(e.$ref);let n=cf(t,e.$ref);return n?lf(n,t,r):e}return e.allOf&&e.allOf.length>0?uf(e,t,r):e}function uf(e,t,n){let r={...e};delete r.allOf;for(let i of e.allOf){let e=lf(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 df(e,t,n){let r=n??e,i=t.split(`/`).filter(Boolean),a=lf(e,r);for(let e of i){if(!a)return;if(a=lf(a,r),a.properties?.[e]){a=lf(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=lf(t[1],r);continue}}if(a.additionalProperties&&typeof a.additionalProperties==`object`){a=lf(a.additionalProperties,r);continue}if(a.items)if(Array.isArray(a.items)){let t=Number(e);if(!isNaN(t)&&a.items[t]){a=lf(a.items[t],r);continue}}else{a=lf(a.items,r);continue}if(a.anyOf||a.oneOf){let t=a.anyOf??a.oneOf??[],n;for(let i of t)if(n=df(lf(i,r),e,r),n)break;if(n){a=n;continue}return}return}return a}function ff(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 pf(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 mf(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}):hf(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(...mf(e[a],t[a],i))}return r}return hf(e,t,n,r),r}function hf(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(...mf(i[e],a[e],t))}}function gf(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 _f=[`name`,`type`,`title`,`id`,`label`,`key`];function vf(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 _f){let n=e.children.find(e=>e.key===t);if(n?.value!=null&&n.value!==``)return String(n.value)}return e.key}function yf(e){let t=[e.id];for(let n of e.children)t.push(...yf(n));return t}var bf={"--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`},xf=Object.freeze(new Set),Sf=()=>({draggedNodeIds:xf,dropTargetNodeId:null,dropPosition:null});function Cf(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 wf(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(Gd(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 tf(e,o,c,r,i);let l=Cf(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=ef(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=$d(d,p.id,u[e],m+e);return d}function Tf(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()||bf[`--vj-bg-selected`],s=a?.getPropertyValue(`--vj-text-selected`).trim()||a?.getPropertyValue(`--vj-text`).trim()||bf[`--vj-text`],c=a?.getPropertyValue(`--vj-font`).trim()||bf[`--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 Ef={added:{bg:`#1e3a1e`,marker:`+`,label:`#4ec94e`},removed:{bg:`#3a1e1e`,marker:`-`,label:`#f48771`},changed:{bg:`#3a3a1e`,marker:`~`,label:`#dcdcaa`}};function Df(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 Of(e,t,n){if(!e)return;let r=df(e,n,t);if(r)return lf(r,t??e)}function kf(e){return e.type===`boolean`||e.type===`null`?`var(--vj-boolean, #569cd6)`:e.type===`number`?`var(--vj-number, #b5cea8)`:`var(--vj-string, #ce9178)`}function Af(e){return e.type===`null`?`null`:e.type===`boolean`?String(e.value):e.value===null||e.value===void 0?``:String(e.value)}function jf(e,t,n){return!t||!e.parentId?!1:(Of(t,n,e.path.split(`/`).slice(0,-1).join(`/`)||`/`)?.required)?.includes(e.key)??!1}function Mf(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 Nf=Symbol(`StudioContext`);function Pf(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 Ff(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 If(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=ef(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 Lf=I({__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=cn(Hd(n.value)),a=cn(null),o=cn(new Set),s=cn(null),c=cn(null),l=cn(new Set([i.value.root.id])),u=G(()=>gf(i.value.root,e=>l.value.has(e))),d=null,f=new sf,p=cn(0),m=G(()=>(p.value,f.canUndo)),h=G(()=>(p.value,f.canRedo)),g=cn(``),_=cn([]),v=cn(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}F(()=>n.value,e=>{if(b){b=!1;return}let t=Hd(e);i.value=t,l.value=new Set([t.root.id]),x(null),f=new sf,f.push(t),p.value++,g.value=``,_.value=[],v.value=0},{flush:`sync`}),F(i,e=>{if(!g.value.trim())return;let t=ff(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`,Ud(e.root))}function C(){let e=f.undo();e&&(i.value=e,p.value++,b=!0,r(`change`,Ud(e.root)))}function w(){let e=f.redo();e&&(i.value=e,p.value++,b=!0,r(`change`,Ud(e.root)))}function T(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(),w())}return Xr(()=>document.addEventListener(`keydown`,T)),ei(()=>document.removeEventListener(`keydown`,T)),$n(Nf,{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=Ff(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(yf(i.value.root))},collapseAll(){l.value=new Set([i.value.root.id])},undo:C,redo:w,setSearchQuery(e){if(g.value=e,!e.trim()){_.value=[],v.value=0;return}let t=ff(i.value,e);if(_.value=t,v.value=0,t.length>0){let e=pf(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)=>di(e.$slots,`default`)}});function Rf(){let e=er(Nf);if(!e)throw Error(`useStudio must be used within a <VisualJson> provider`);return e}function zf(e,t){let{state:n,actions:r}=Rf(),i=cn(Sf());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||Gd(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=Sf()}function l(){let e=wf(n.tree.value,i.value);e&&r.setTree(e),i.value=Sf()}return{dragState:i,handleDragStart:a,handleDragOver:s,handleDragEnd:c,handleDrop:l}}var Bf=[`aria-selected`,`aria-expanded`,`draggable`,`data-node-id`],Vf=[`aria-label`],Hf={key:1,style:{width:`16px`,flexShrink:0}},Uf=I({__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}=Rf(),o=cn(!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)&&Tf(e.dataTransfer,i.selectedNodeIds.value.size),r(`dragStart`,n.node.id)}return(t,n)=>(z(),B(R,null,[V(`div`,{role:`treeitem`,"aria-selected":s(),"aria-expanded":P(l)?c():void 0,draggable:!u,"data-node-id":e.node.id,style:A({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]||=Rs(()=>r(`drop`),[`prevent`])},[P(l)?(z(),B(`button`,{key:0,"aria-label":c()?`Collapse`:`Expand`,style:A({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]||=Rs(()=>P(a).toggleExpand(e.node.id),[`stop`])},` ▶ `,12,Vf)):(z(),B(`span`,Hf)),V(`span`,{style:A({color:`inherit`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,flexShrink:0,fontWeight:u?600:400})},M(u?`/`:P(vf)(e.node,P(i).tree.value)),5),!u&&P(l)&&e.showCounts?(z(),B(`span`,{key:2,style:A({color:s()?`inherit`:`var(--vj-text-muted, #888888)`,fontSize:`13px`,fontFamily:`var(--vj-font, monospace)`,whiteSpace:`nowrap`,marginLeft:`auto`})},M(p()),5)):W(``,!0),!u&&!P(l)&&e.showValues?(z(),B(`span`,{key:3,style:A({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`})},M(p()),5)):W(``,!0)],44,Bf),c()?(z(!0),B(R,{key:0},L(e.node.children,t=>(z(),La(Uf,{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))}}),Wf={key:0,style:{height:`1px`,backgroundColor:`var(--vj-border, #454545)`,margin:`4px 0`}},Gf=[`disabled`,`onClick`,`onMouseenter`],Kf=I({__name:`ContextMenu`,props:{x:{},y:{},items:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=cn(null),a=cn({left:n.x,top:n.y});F(()=>[n.x,n.y],async()=>{if(await Rn(),!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 Xr(async()=>{if(await Rn(),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)}),ei(()=>{document.removeEventListener(`mousedown`,o),document.removeEventListener(`keydown`,s)}),(t,n)=>(z(),La(vr,{to:`body`},[V(`div`,{ref_key:`menuRef`,ref:i,style:A({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`})},[(z(!0),B(R,null,L(e.items,(e,t)=>(z(),B(R,{key:t},[`separator`in e&&e.separator?(z(),B(`div`,Wf)):`label`in e?(z(),B(`button`,{key:1,disabled:e.disabled,style:A({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`}},M(e.label),45,Gf)):W(``,!0)],64))),128))],4)]))}}),qf=I({__name:`TreeView`,props:{class:{},showValues:{type:Boolean,default:!0},showCounts:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,actions:r}=Rf(),i=cn(null),a=G(()=>gf(n.tree.value.root,e=>n.expandedNodeIds.value.has(e))),{dragState:o,handleDragStart:s,handleDragOver:c,handleDragEnd:l,handleDrop:u}=zf(a,n.selectedNodeIds),d=cn(null),f=cn(!1);function p(e){r.setVisibleNodesOverride(a.value),r.selectNodeRange(e)}F(()=>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=Ud(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=af(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=rf(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}=If(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=Pf(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}=If(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)=>(z(),B(R,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(Uf,{node:P(n).tree.value.root,depth:0,"drag-state":P(o),"show-values":t.showValues??!0,"show-counts":t.showCounts??!1,"is-focused":f.value,onDragStart:P(s),onDragOver:P(c),onDragEnd:P(l),onDrop:P(u),onContextMenu:m,onSelectRange:p},null,8,[`node`,`drag-state`,`show-values`,`show-counts`,`is-focused`,`onDragStart`,`onDragOver`,`onDragEnd`,`onDrop`])],544),d.value?(z(),La(Kf,{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))}}),Jf=Symbol(`FormViewContext`),Yf=[`value`],Xf=[`onMousedown`,`onMouseenter`],Zf=20,Qf=200,$f=I({__name:`Breadcrumbs`,props:{class:{}},setup(e){let{state:t,actions:n}=Rf(),r=G(()=>t.drillDownNodeId.value?t.tree.value.nodesById.get(t.drillDownNodeId.value):null),i=G(()=>r.value?.path??`/`),a=cn(i.value),o=cn(!1),s=cn(0),c=cn(null),l=cn(null),u=cn(null);F(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>=Zf)break;return n.sort((e,t)=>e.path.localeCompare(t.path)),n});F(d,()=>{s.value=0}),F(()=>[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 Xr(()=>document.addEventListener(`mousedown`,m)),ei(()=>document.removeEventListener(`mousedown`,m)),(e,t)=>(z(),B(`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,Yf),o.value&&d.value.length>0?(z(),B(`div`,{key:0,ref_key:`listRef`,ref:l,style:A({position:`absolute`,top:`100%`,left:`-12px`,right:`-12px`,zIndex:50,maxHeight:Qf+`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)`})},[(z(!0),B(R,null,L(d.value,(e,t)=>(z(),B(`div`,{key:e.id,style:A({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:Rs(()=>f(e.path),[`prevent`]),onMouseenter:()=>s.value=t},M(e.path),45,Xf))),128))],4)):W(``,!0)],512))}}),ep=[`value`],tp=[`onMousedown`,`onMouseenter`],np={style:{width:`14px`,flexShrink:0,fontSize:`12px`}},rp=200,ip=I({__name:`EnumInput`,props:vi({enumValues:{},value:{},inputStyle:{}},{inputRef:{},inputRefModifiers:{}}),emits:vi([`valueChange`],[`update:inputRef`]),setup(e,{expose:t,emit:n}){let r=e,i=n;Ri(e,`inputRef`);let a=cn(r.value),o=cn(!1),s=cn(0),c=cn(null),l=cn(null),u=cn(null);F(()=>r.value,e=>{a.value=e});let d=G(()=>r.enumValues.map(e=>String(e)));F(d,()=>{s.value=0}),F(()=>[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 Xr(()=>document.addEventListener(`mousedown`,m)),ei(()=>document.removeEventListener(`mousedown`,m)),t({focus:()=>u.value?.focus()}),(t,n)=>(z(),B(`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:A(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]||=Rs(()=>{},[`stop`])},null,44,ep),o.value&&d.value.length>0?(z(),B(`div`,{key:0,ref_key:`listRef`,ref:c,style:A({position:`absolute`,top:`calc(100% + 4px)`,left:`-32px`,right:0,zIndex:50,maxHeight:rp+`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)`})},[(z(!0),B(R,null,L(d.value,(t,n)=>(z(),B(`div`,{key:t,style:A({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:Rs(()=>f(t),[`prevent`]),onMouseenter:()=>s.value=n},[V(`span`,np,M(t===e.value?`✓`:``),1),U(` `+M(t),1)],44,tp))),128))],4)):W(``,!0)],512))}}),ap={key:0},op=[`data-form-node-id`,`draggable`],sp=[`value`],cp={key:2,style:{color:`var(--vj-text-muted, #888888)`,fontSize:`11px`,fontFamily:`var(--vj-font, monospace)`}},lp={key:1},up=[`data-form-node-id`,`draggable`],dp=[`value`],fp={key:2,style:{color:`var(--vj-error, #f48771)`,fontSize:`10px`,fontFamily:`var(--vj-font, monospace)`}},pp={key:3,style:{flex:1,display:`flex`,alignItems:`center`,gap:`6px`,minWidth:0}},mp={key:2,style:{color:`var(--vj-boolean, #569cd6)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,fontStyle:`italic`,flex:1}},hp=[`value`,`placeholder`],gp=I({__name:`FormField`,props:{node:{},depth:{}},setup(e){let t=e,n=er(Jf),{state:r,actions:i}=Rf(),a=cn(!1),o=cn(null),s=cn(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(()=>Of(n.schema.value,n.rootSchema.value,t.node.path)),g=G(()=>jf(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 w(){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 T(){return d.value&&n.isFocused.value?`var(--vj-text-selected, var(--vj-text, #cccccc))`:`var(--vj-text, #cccccc)`}function E(){return kf(t.node)}function D(){return Af(t.node)}function O(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 ee(e){e.dataTransfer.effectAllowed=`move`,r.selectedNodeIds.value.size>1&&r.selectedNodeIds.value.has(t.node.id)&&Tf(e.dataTransfer,r.selectedNodeIds.value.size),n.onDragStart(t.node.id)}function te(e){let n=Mf(e,h.value?.type,t.node.type),a=Xd(r.tree.value,t.node.id,n);i.setTree(a)}function ne(e){let n=Zd(r.tree.value,t.node.id,e);i.setTree(n)}function re(){let e=ef(r.tree.value,t.node.id);i.setTree(e)}function k(){let e=t.node.type===`array`?String(t.node.children.length):`newKey${t.node.children.length}`,n=Qd(r.tree.value,t.node.id,e,``);i.setTree(n)}let ie=G(()=>h.value?.enum&&h.value.enum.length>0),ae=G(()=>`calc(${(n.maxDepth.value-t.depth)*16}px + ${n.maxKeyLength.value}ch)`);return F(f,async e=>{e&&(await Rn(),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?(z(),B(`div`,ap,[V(`div`,{"data-form-node-id":e.node.id,draggable:!u.value,style:A({display:`flex`,alignItems:`center`,gap:`6px`,padding:`1px 8px`,paddingLeft:8+e.depth*16+`px`,cursor:`pointer`,backgroundColor:w(),color:T(),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]||=Rs(t=>P(n).onSelect(e.node.id,t),[`stop`]),onDblclick:i[4]||=()=>P(n).onToggleCollapse(e.node.id),onMouseenter:i[5]||=()=>a.value=!0,onMouseleave:i[6]||=()=>a.value=!1,onDragstart:ee,onDragover:O,onDragend:i[7]||=()=>P(n).onDragEnd(),onDrop:i[8]||=Rs(()=>P(n).onDrop(),[`prevent`])},[V(`button`,{style:A({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]||=Rs(()=>P(n).onToggleCollapse(e.node.id),[`stop`])},` ▶ `,4),f.value&&!u.value?(z(),B(`input`,{key:0,ref_key:`keyInputRef`,ref:s,value:e.node.key,style:A({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:ae.value}),onInput:i[1]||=e=>ne(e.target.value),onClick:i[2]||=Rs(()=>{},[`stop`])},null,44,sp)):(z(),B(`span`,{key:1,style:A({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:ae.value})},M(u.value?`/`:P(vf)(e.node,P(r).tree.value)),5)),P(n).showDescriptions&&y.value&&!d.value?(z(),B(`span`,cp,M(y.value),1)):W(``,!0),a.value?(z(),B(`button`,{key:3,style:A({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:Rs(k,[`stop`])},` + Add `+M(e.node.type===`array`?`item`:`property`),5)):W(``,!0),P(n).showCounts?(z(),B(`span`,{key:4,style:A({color:d.value?`inherit`:`var(--vj-text-dim, #666666)`,fontSize:`12px`,fontFamily:`var(--vj-font, monospace)`,marginLeft:`auto`})},M(e.node.type===`array`?`${e.node.children.length} items`:`${e.node.children.length} properties`),5)):W(``,!0),!u.value&&f.value?(z(),B(`button`,{key:5,style:A({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)`,...P(n).showCounts?{}:{marginLeft:`auto`}}),title:`Remove`,onClick:Rs(re,[`stop`])},` × `,4)):W(``,!0)],44,op),P(n).showDescriptions&&_.value?(z(),B(`div`,{key:0,style:A({padding:`2px 12px 4px`,paddingLeft:8+e.depth*16+22+`px`,fontSize:`11px`,color:`var(--vj-text-dim, #666666)`,fontFamily:`var(--vj-font, monospace)`})},M(_.value),5)):W(``,!0),p.value?W(``,!0):(z(),B(`div`,lp,[(z(!0),B(R,null,L(e.node.children,t=>(z(),La(gp,{key:t.id,node:t,depth:e.depth+1},null,8,[`node`,`depth`]))),128))]))])):(z(),B(`div`,{key:1,"data-form-node-id":e.node.id,draggable:!u.value,style:A({display:`flex`,alignItems:`center`,gap:`6px`,padding:`1px 8px`,paddingLeft:8+e.depth*16+`px`,cursor:`pointer`,backgroundColor:w(),color:T(),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]||=Rs(t=>P(n).onSelect(e.node.id,t),[`stop`]),onDblclick:i[15]||=()=>P(n).onStartEditing(e.node.id),onMouseenter:i[16]||=()=>a.value=!0,onMouseleave:i[17]||=()=>a.value=!1,onDragstart:ee,onDragover:O,onDragend:i[18]||=()=>P(n).onDragEnd(),onDrop:i[19]||=Rs(()=>P(n).onDrop(),[`prevent`])},[i[20]||=V(`span`,{style:{width:`16px`,flexShrink:0}},null,-1),f.value&&m.value?(z(),B(`input`,{key:0,ref_key:`keyInputRef`,ref:s,value:e.node.key,style:A({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:ae.value}),onInput:i[9]||=e=>ne(e.target.value),onClick:i[10]||=Rs(()=>{},[`stop`]),onKeydown:i[11]||=e=>{e.key===`Tab`&&!e.shiftKey&&o.value&&(e.preventDefault(),c())}},null,44,dp)):(z(),B(`span`,{key:1,style:A({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:ae.value})},M(P(vf)(e.node,P(r).tree.value)),5)),g.value&&!d.value?(z(),B(`span`,fp,` * `)):W(``,!0),f.value?(z(),B(`div`,pp,[e.node.type===`boolean`?(z(),La(ip,{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:E()},onValueChange:te},null,8,[`value`,`input-style`])):ie.value&&(b=h.value)!=null&&b.enum?(z(),La(ip,{key:1,ref_key:`valueInputRef`,ref:o,"enum-values":h.value.enum,value:D(),"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:E()},onValueChange:te},null,8,[`enum-values`,`value`,`input-style`])):e.node.type===`null`?(z(),B(`span`,mp,` null `)):(z(),B(`input`,{key:3,ref_key:`valueInputRef`,ref:o,value:D(),placeholder:h.value?.default===void 0?`<value>`:String(h.value.default),style:A({background:`none`,border:`none`,fontFamily:`var(--vj-font, monospace)`,fontSize:`var(--vj-input-font-size, 13px)`,padding:0,flex:1,outline:`none`,color:E()}),onInput:i[12]||=e=>te(e.target.value),onClick:i[13]||=Rs(()=>{},[`stop`])},null,44,hp))])):(z(),B(`span`,{key:4,style:A({color:E(),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})},M(D()),5)),f.value?(z(),B(`button`,{key:5,style:A({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:Rs(re,[`stop`])},` × `,4)):W(``,!0)],44,up))}}}),_p={style:{backgroundColor:`var(--vj-bg, #1e1e1e)`,color:`var(--vj-text, #cccccc)`,height:`100%`,fontFamily:`var(--vj-font, monospace)`,display:`flex`,flexDirection:`column`}},vp={style:{display:`flex`,alignItems:`center`,padding:`4px 8px`,borderBottom:`1px solid var(--vj-border, #333333)`,backgroundColor:`var(--vj-bg, #1e1e1e)`,flexShrink:0}},yp=I({__name:`FormView`,props:{class:{},showDescriptions:{type:Boolean,default:!1},showCounts:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,actions:r}=Rf(),i=cn(null),a=cn(!1),o=cn(null),s=cn(new Set),c=n.tree.value,l=G(()=>(n.drillDownNodeId.value?n.tree.value.nodesById.get(n.drillDownNodeId.value):null)??n.tree.value.root);F(()=>l.value.id,()=>{o.value=null,s.value=new Set});let u=G(()=>gf(l.value,e=>!s.value.has(e))),{dragState:d,handleDragStart:f,handleDragOver:p,handleDragEnd:m,handleDrop:h}=zf(u,n.selectedNodeIds);Xr(()=>{r.setVisibleNodesOverride(u.value)}),ei(()=>{r.setVisibleNodesOverride(null)}),F(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?`/`:vf(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 w(e){requestAnimationFrame(()=>{(i.value?.querySelector(`[data-form-node-id="${e}"]`))?.scrollIntoView({block:`nearest`})})}function T(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),w(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),w(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),w(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),w(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=Pf(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}=If(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 $n(Jf,{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)=>(z(),B(`div`,_p,[V(`div`,vp,[H($f)]),V(`div`,{ref_key:`containerRef`,ref:i,"data-form-container":``,tabindex:`0`,style:{flex:1,overflow:`auto`,outline:`none`},onKeydown:T,onFocus:t[0]||=()=>a.value=!0,onBlur:t[1]||=e=>{e.currentTarget.contains(e.relatedTarget)||(a.value=!1)}},[H(gp,{node:l.value,depth:0},null,8,[`node`])],544)]))}}),bp={style:{display:`flex`,alignItems:`center`,gap:`6px`,padding:`4px 8px`,backgroundColor:`var(--vj-bg, #1e1e1e)`,borderBottom:`1px solid var(--vj-border, #333333)`}},xp=[`value`],Sp={style:{display:`flex`,alignItems:`center`,gap:`2px`,flexShrink:0,height:`18px`}},Cp=[`disabled`],wp=[`disabled`],Tp=I({__name:`SearchBar`,props:{class:{}},setup(e){let{state:t,actions:n}=Rf(),r=cn(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 Xr(()=>document.addEventListener(`keydown`,a)),ei(()=>document.removeEventListener(`keydown`,a)),(e,a)=>(z(),B(`div`,bp,[V(`input`,{ref_key:`inputRef`,ref:r,type:`text`,value:P(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=>P(n).setSearchQuery(e.target.value),onKeydown:i},null,40,xp),V(`div`,Sp,[P(t).searchQuery.value?(z(),B(R,{key:0},[V(`span`,{style:A({fontSize:`11px`,lineHeight:1,color:P(t).searchMatches.value.length>0?`var(--vj-text-muted, #999999)`:`var(--vj-error, #f48771)`,fontFamily:`var(--vj-font, monospace)`,whiteSpace:`nowrap`})},M(P(t).searchMatches.value.length>0?`${P(t).searchMatchIndex.value+1}/${P(t).searchMatches.value.length}`:`0/0`),5),V(`button`,{disabled:P(t).searchMatches.value.length===0,"aria-label":`Previous match (Shift+Enter)`,title:`Previous match (Shift+Enter)`,style:A({background:`none`,border:`none`,color:P(t).searchMatches.value.length>0?`var(--vj-text, #cccccc)`:`var(--vj-text-dimmer, #555555)`,cursor:P(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)=>P(n).prevSearchMatch&&P(n).prevSearchMatch(...e)},` ▲ `,12,Cp),V(`button`,{disabled:P(t).searchMatches.value.length===0,"aria-label":`Next match (Enter)`,title:`Next match (Enter)`,style:A({background:`none`,border:`none`,color:P(t).searchMatches.value.length>0?`var(--vj-text, #cccccc)`:`var(--vj-text-dimmer, #555555)`,cursor:P(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)=>P(n).nextSearchMatch&&P(n).nextSearchMatch(...e)},` ▼ `,12,wp),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]||=()=>P(n).setSearchQuery(``)},` × `)],64)):(z(),B(R,{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)=>P(n).expandAll&&P(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)=>P(n).collapseAll&&P(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))])]))}}),Ep={key:0,style:{flex:1,minHeight:0}},Dp={style:{display:`flex`,flexShrink:0,borderBottom:`1px solid var(--vj-border, #333333)`,backgroundColor:`var(--vj-bg-panel, #252526)`}},Op={style:{flex:1,minHeight:0,overflow:`hidden`}},kp={key:0,style:{display:`flex`,flexDirection:`column`,height:`100%`}},Ap={style:{flex:1,minHeight:0,overflow:`auto`}},jp={key:1,style:{display:`flex`,flexDirection:`column`,height:`100%`}},Mp={style:{flex:1,minHeight:0}},Np={style:{flex:1,minHeight:0,overflow:`auto`}},Pp={key:0,style:{width:`1px`,flexShrink:0,backgroundColor:`var(--vj-border, #333333)`,position:`relative`,transition:`background-color 0.15s`}},Fp={style:{display:`flex`,flexDirection:`column`,flex:1,minWidth:0,overflow:`hidden`}},Ip={style:{flex:1,minHeight:0}},Lp=I({__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=cn(i?n.value:n.defaultValue??{}),o=cn(0);F(()=>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=cn(280),l=cn(!1),u=cn(`tree`),d=cn(null),f=!1,p=0,m=0,h=null;function g(){d.value&&(l.value=d.value.offsetWidth<500)}Xr(()=>{g(),d.value&&(h=new ResizeObserver(g),h.observe(d.value))}),ei(()=>{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`,...bf,...n.style??{}}));return(e,t)=>(z(),B(`div`,{"data-vj-root":``,style:A(v.value)},[(z(),La(Lf,{key:o.value,value:a.value,schema:n.schema,onChange:s},{default:Xn(()=>[l.value?(z(),B(`div`,{key:0,ref_key:`containerRef`,ref:d,style:{display:`flex`,flexDirection:`column`,flex:1,minHeight:0}},[n.sidebarOpen?(z(),B(R,{key:1},[V(`div`,Dp,[V(`button`,{style:A({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:A({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`,Op,[u.value===`tree`?(z(),B(`div`,kp,[H(Tp),V(`div`,Ap,[H(qf,{"show-values":n.treeShowValues,"show-counts":n.treeShowCounts},null,8,[`show-values`,`show-counts`])])])):(z(),B(`div`,jp,[V(`div`,Mp,[H(yp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])])]))])],64)):(z(),B(`div`,Ep,[H(yp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])]))],512)):(z(),B(`div`,{key:1,ref_key:`containerRef`,ref:d,style:{display:`flex`,flex:1,minHeight:0}},[V(`div`,{style:A({flexShrink:0,overflow:`hidden`,display:`flex`,flexDirection:`column`,width:n.sidebarOpen?c.value+`px`:`0`,transition:`width 0.2s ease`})},[H(Tp),V(`div`,Np,[H(qf,{"show-values":n.treeShowValues,"show-counts":n.treeShowCounts},null,8,[`show-values`,`show-counts`])])],4),n.sidebarOpen?(z(),B(`div`,Pp,[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(!P(f)){let t=e.currentTarget.parentElement;t&&(t.style.backgroundColor=`var(--vj-border, #333333)`)}}},null,32)])):W(``,!0),V(`div`,Fp,[V(`div`,Ip,[H(yp,{"show-descriptions":n.editorShowDescriptions,"show-counts":n.editorShowCounts},null,8,[`show-descriptions`,`show-counts`])])])],512))]),_:1},8,[`value`,`schema`]))],4))}}),Rp={style:{backgroundColor:`var(--vj-bg, #1e1e1e)`,color:`var(--vj-text, #cccccc)`,overflow:`auto`,height:`100%`,display:`flex`,flexDirection:`column`}},zp={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}},Bp={style:{color:`var(--vj-text-muted, #999999)`}},Vp={key:0,style:{color:`#4ec94e`}},Hp={key:1,style:{color:`#f48771`}},Up={key:2,style:{color:`#dcdcaa`}},Wp={style:{flex:1,overflow:`auto`}},Gp={key:0,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`var(--vj-text-dimmer, #555555)`,fontFamily:`var(--vj-font, monospace)`,fontSize:`13px`}},Kp={style:{color:`var(--vj-text, #cccccc)`,flexShrink:0,minWidth:`100px`}},qp={style:{flex:1,display:`flex`,gap:`8px`,overflow:`hidden`}},Jp={style:{color:`#f48771`,textDecoration:`line-through`}},Yp={style:{color:`#4ec94e`}},Xp={key:1,style:{color:`#4ec94e`}},Zp={key:2,style:{color:`#f48771`,textDecoration:`line-through`}};I({__name:`DiffView`,props:{originalJson:{},currentJson:{},class:{}},setup(e){let t=e,n=G(()=>mf(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 Ef[e.type]}return(e,t)=>(z(),B(`div`,Rp,[V(`div`,zp,[V(`span`,Bp,M(n.value.length===0?`No changes`:`${n.value.length} changes`),1),r.value>0?(z(),B(`span`,Vp,`+`+M(r.value)+` added`,1)):W(``,!0),i.value>0?(z(),B(`span`,Hp,`-`+M(i.value)+` removed`,1)):W(``,!0),a.value>0?(z(),B(`span`,Up,`~`+M(a.value)+` modified`,1)):W(``,!0)]),V(`div`,Wp,[n.value.length===0?(z(),B(`div`,Gp,` No differences detected `)):W(``,!0),(z(!0),B(R,null,L(n.value,(e,n)=>(z(),B(`div`,{key:n,style:A({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:A({color:o(e).label,fontWeight:600,width:`14px`,flexShrink:0,textAlign:`center`})},M(o(e).marker),5),V(`span`,Kp,M(e.path),1),V(`span`,qp,[e.type===`changed`?(z(),B(R,{key:0},[V(`span`,Jp,M(P(Df)(e.oldValue)),1),t[0]||=V(`span`,{style:{color:`var(--vj-text-dim, #666666)`}},`→`,-1),V(`span`,Yp,M(P(Df)(e.newValue)),1)],64)):e.type===`added`?(z(),B(`span`,Xp,M(P(Df)(e.newValue)),1)):e.type===`removed`?(z(),B(`span`,Zp,M(P(Df)(e.oldValue)),1)):W(``,!0)])],4))),128))])]))}});var Qp=`modulepreload`,$p=function(e){return`/`+e},em={};const tm=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=$p(t,n),t in em)return;em[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`:Qp,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 nm=I({__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}=pu(),o=N(null),s=null,c=!1;async function l(){if(!o.value||s)return;let{init:e}=await tm(async()=>{let{init:e}=await import(`./dist-CMBqBOCp.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&&tm(async()=>{let{init:e}=await import(`./dist-CMBqBOCp.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setModelLanguage(e,r.language)}))}return F(()=>r.modelValue,d),F(()=>r.language,f),F(()=>r.readOnly,e=>s?.updateOptions({readOnly:e})),F(a,e=>{s&&tm(async()=>{let{init:e}=await import(`./dist-CMBqBOCp.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setTheme(e===`light`?`piclaw-light`:`piclaw-dark`)}))}),Xr(l),ei(u),t({editor:()=>s}),(e,t)=>(z(),B(`div`,{ref_key:`el`,ref:o,class:`h-full w-full`},null,512))}}),rm={class:`relative h-full min-h-0`},im={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`},am=`piclaw:json-editor-mode`,om=I({__name:`JsonEditor`,props:{value:{},readOnly:{type:Boolean,default:!1},schema:{default:null}},emits:[`change`,`validation`],setup(e,{emit:t}){let n=N(localStorage.getItem(am)||`visual`);F(n,e=>localStorage.setItem(am,e));let r=e,i=t,a=r.value??{},o=N(!0);function s(e){a=e,i(`change`,e)}F(()=>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=N(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 F(n,e=>{e===`json`&&f()}),F(()=>[r.value,r.readOnly,r.schema],()=>{n.value===`json`&&f()},{deep:!0}),(e,t)=>(z(),B(`div`,rm,[V(`div`,im,[V(`button`,{type:`button`,class:j([`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:j([`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)]),Zn(H(nm,{"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`?(z(),La(P(Lp),{key:0,value:P(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)]))}}),sm={class:`p-3 h-full min-h-0`},cm=I({__name:`ConfigTab`,setup(e){let t=N(null);return qu(async()=>{t.value=await Cu(`/api/pi/status`)},3e4),(e,n)=>(z(),B(`div`,sm,[H(om,{value:t.value,"read-only":!0},null,8,[`value`])]))}}),lm={class:`flex flex-col h-full`},um={class:`px-3 py-3 border-b border-border bg-surface/40`},dm={class:`flex flex-wrap items-center gap-4 text-[12px]`},fm={class:`flex items-center gap-2`},pm={class:`flex items-center gap-2 min-w-0`},mm={class:`px-3 py-2 flex gap-2 items-center border-b border-border`},hm=[`value`],gm={class:`px-3 py-2 text-[11px] text-muted border-b border-border`},_m={class:`overflow-auto flex-1 min-h-0`},vm={class:`w-full border-collapse text-[12px]`},ym={key:0},bm={key:1},xm={class:`py-1.5 px-2 border-b border-border text-muted select-text`},Sm={class:`py-1.5 px-2 border-b border-border font-medium select-text`},Cm={class:`ml-1.5 text-[10px] text-muted`},wm={class:`py-1.5 px-2 border-b border-border text-center`},Tm=[`disabled`,`onClick`],Em={key:1,class:`badge-accent border border-accent`},Dm={class:`py-1.5 px-2 border-b border-border text-[10px] text-muted select-text`},Om={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},km={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Am={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},jm={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Mm={class:`py-1.5 px-2 border-b border-border`},Nm={key:0,class:`badge-accent mr-1`},Pm={key:1,class:`badge-ok`},Fm=I({__name:`ModelsTab`,setup(e){let t=N(null),n=N(``),r=N(``),i=N(!1);async function a(){t.value=await Cu(`/api/pi/models`)}qu(a,3e4);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 Cu(`/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)=>(z(),B(`div`,lm,[V(`div`,um,[a[4]||=V(`div`,{class:`text-[10px] uppercase tracking-wider text-muted mb-2`},`default model`,-1),V(`div`,dm,[V(`div`,fm,[a[2]||=V(`span`,{class:`text-muted`},`provider`,-1),V(`span`,{class:j([`px-2 py-0.5 rounded border border-border font-medium select-text`,t.value?.defaultProvider?`text-accent bg-accent-dim`:`text-muted`])},M(t.value?.defaultProvider||`—`),3)]),V(`div`,pm,[a[3]||=V(`span`,{class:`text-muted`},`model`,-1),V(`span`,{class:j([`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`])},M(t.value?.defaultModel||`—`),3)])])]),V(`div`,mm,[Zn(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),[[Ms,n.value]]),Zn(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),(z(!0),B(R,null,L(o.value,e=>(z(),B(`option`,{key:e,value:e},M(e)+` (`+M(s.value[e])+`) `,9,hm))),128))],512),[[Ns,r.value]])]),V(`div`,gm,M(t.value?c.value.length:`-`)+`/`+M(t.value?.models.length??`-`)+` models `,1),V(`div`,_m,[V(`table`,vm,[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?(z(),B(`tr`,bm,[...a[7]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`no models found`,-1)]])):W(``,!0):(z(),B(`tr`,ym,[...a[6]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`loading...`,-1)]])),(z(!0),B(R,null,L(c.value,e=>(z(),B(`tr`,{key:`${e.provider}/${e.id}`,class:j([`hover:bg-surface`,l(e)?`bg-accent-dim/30`:``])},[V(`td`,xm,M(e.provider),1),V(`td`,Sm,[V(`span`,null,M(e.name),1),V(`span`,Cm,M(e.id),1)]),V(`td`,wm,[l(e)?(z(),B(`span`,Em,` active `)):(z(),B(`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,Tm))]),V(`td`,Dm,M(e.api),1),V(`td`,Om,M(d(e.contextWindow)),1),V(`td`,km,M(d(e.maxTokens)),1),V(`td`,Am,M(f(e.cost.input)),1),V(`td`,jm,M(f(e.cost.output)),1),V(`td`,Mm,[e.reasoning?(z(),B(`span`,Nm,`reasoning`)):W(``,!0),e.input.includes(`image`)?(z(),B(`span`,Pm,`vision`)):W(``,!0)])],2))),128))])])])]))}}),Im={class:`flex flex-col h-full min-h-0`},Lm={class:`px-3 py-2 border-b border-border flex items-center gap-2`},Rm=[`onClick`],zm={class:`ml-auto flex items-center gap-2`},Bm={key:0,class:`text-[11px] text-err truncate max-w-[200px]`},Vm=[`disabled`],Hm={key:2,class:`text-[11px] text-muted`},Um={class:`flex-1 min-h-0 p-3`},Wm={class:`h-full border border-border`},Gm=I({__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=N(`settings`),r=N(null),i=N(null),a=N(!1),o=N(null),s=N(null),c=N(null),l=``,u=N(!1),d=()=>{let e=t[n.value].schemaKey;return!e||!i.value?null:i.value[e]??null};async function f(){i.value=await Cu(`/api/pi/schemas`)}async function p(){s.value=null,c.value=null,u.value=!1,o.value=null,r.value=(await Cu(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 Xr(()=>{f(),window.addEventListener(`keydown`,v)}),ei(()=>window.removeEventListener(`keydown`,v)),F(n,()=>p(),{immediate:!0}),(e,i)=>(z(),B(`div`,Im,[V(`div`,Lm,[(z(),B(R,null,L(t,(e,t)=>V(`button`,{key:t,type:`button`,class:j([`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},M(e.label),11,Rm)),64)),V(`div`,zm,[s.value||c.value?(z(),B(`span`,Bm,M(s.value||c.value),1)):W(``,!0),u.value?(z(),B(R,{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?(z(),B(R,{key:0},[U(`saving...`)],64)):(z(),B(R,{key:1},[i[1]||=U(`save `,-1),i[2]||=V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`⌘S`,-1)],64))],8,Vm)],64)):(z(),B(`span`,Hm,`~/.pi/agent/`+M(t[n.value].label),1))])]),V(`div`,Um,[V(`div`,Wm,[(z(),La(om,{key:n.value,value:r.value,schema:d(),"read-only":!1,onChange:m,onValidation:h},null,8,[`value`,`schema`]))])])]))}}),Km={class:`flex flex-col h-full`},qm={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},Jm={key:`agent`,label:`Pi Agent`,icon:`lucide:bot`,color:`#39bae6`,component:I({__name:`window`,setup(e){let t=[`auth`,`models`,`settings`,`status`],{state:n,set:r}=gu(),i=N(t.includes(n.value.tab)?n.value.tab:`auth`);return F(i,e=>r({tab:e})),(e,t)=>(z(),B(`div`,Km,[V(`div`,qm,[V(`button`,{type:`button`,class:j(i.value===`auth`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`auth`},` auth `,2),V(`button`,{type:`button`,class:j(i.value===`models`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`models`},` models `,2),V(`button`,{type:`button`,class:j(i.value===`settings`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>i.value=`settings`},` settings `,2),V(`button`,{type:`button`,class:j(i.value===`status`?`tab-active`:`tab-inactive`),onClick:t[3]||=e=>i.value=`status`},` status `,2)]),i.value===`auth`?(z(),La(Ld,{key:0})):i.value===`models`?(z(),La(Fm,{key:1})):i.value===`settings`?(z(),La(Gm,{key:2})):i.value===`status`?(z(),La(cm,{key:3})):W(``,!0)]))}}),window:{width:900,height:520,minwidth:480,minheight:300}},Ym={class:`flex flex-col h-full overflow-hidden bg-bg`},Xm={class:`shrink-0 flex items-center gap-1.5 px-3 py-1.5 bg-surface border-b border-border`},Zm={class:`flex items-center gap-0.5 shrink-0`},Qm=[`disabled`],$m={class:`browser-url-bar flex-1`},eh={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`},th={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`},nh=[`value`],rh=[`title`],ih=[`fill`],ah={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`],sh=[`onClick`],ch={key:1,class:`browser-tab-spinner`},lh={class:`truncate text-[12px]`},uh={class:`flex-1 min-h-0 relative`},dh={key:0,class:`h-full flex items-center justify-center text-muted text-[13px]`},fh=[`src`,`title`,`onLoad`],ph={key:`browser`,label:`Browser`,icon:`lucide:globe`,color:`#39bae6`,lightColor:`#0077cc`,component:Lu(I({__name:`window`,setup(e){let{state:t,set:n,setTitle:r}=gu(),i=Jt([]),a=N(null),o=0,s,c=null,l=0,u=G(()=>i.find(e=>e.id===a.value)),d=N(``),f=N(null),p=N(!1),m=N(new Map),h=G(()=>{if(p.value)return d.value;try{return new URL(d.value).hostname}catch{return d.value}});function g(e=`https://piclaw.sh`){let t=++o,n=Jt({id:t,url:e,title:`new tab`,loading:!1,useProxy:!0});return i.push(n),_(t),e||Rn(()=>{f.value?.focus(),f.value?.select()}),oe(),n}function _(e){a.value=e;let t=i.find(t=>t.id===e);t&&(d.value=t.url,n({activeTab:String(e)}),oe())}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){g();return}if(a.value===e){let e=i[Math.min(t,i.length-1)];e&&_(e.id)}oe()}}function y(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w-]+(\.[\w-]+)+/.test(t)?`https://${t}`:`https://duckduckgo.com/?q=${encodeURIComponent(t)}`:``}function b(e){return`/api/proxy?url=${encodeURIComponent(e)}`}function x(e){e?.preventDefault();let t=u.value;if(!t)return;let n=y(d.value);n&&(t.url=n,t.loading=!0,d.value=n,f.value?.blur(),oe())}function S(e){try{return new URL(e).searchParams.get(`url`)||void 0}catch{return}}function C(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?S(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 w(e){let t=i.find(t=>t.id===e);t&&(t.loading=!1,C(t))}function T(e,t){t?m.value.set(e,t):m.value.delete(e)}let{menu:E,onContext:D,close:O}=$l();function ee(){let e=u.value;e&&te(e)}function te(e){e.useProxy=!e.useProxy,e.loading=!0;let t=m.value.get(e.id);t&&(t.src=e.useProxy?b(e.url):e.url)}function ne(){let e=u.value;if(!e)return;let t=m.value.get(e.id);t&&(e.loading=!0,t.src=e.useProxy?b(e.url):e.url)}function re(){p.value=!0,Rn(()=>f.value?.select())}function k(){p.value=!1,u.value&&(d.value=u.value.url)}function ie(e){e.key===`Escape`&&f.value?.blur()}function ae(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(),ne())}function oe(){clearTimeout(s),s=setTimeout(se,500)}async function se(){let e={tabs:i.map(e=>({id:e.id,url:e.url})),activeTabId:a.value};try{let t=await fetch(`/api/browser`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});t.ok&&(l=(await t.json()).rev??l)}catch{}}function ce(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(Jt({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 le(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(Jt({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&&g()}function ue(){let e=!0;c=new EventSource(`/api/browser`),c.onmessage=n=>{try{let r=JSON.parse(n.data);if(e){if(e=!1,!ce(r)){let e=t.value.url;g(e||``)}return}le(r)}catch{}}}F(()=>u.value?.title,e=>{r(e?`${e} — browser`:`browser`)});let de;return Xr(()=>{window.addEventListener(`keydown`,ae),ue(),de=setInterval(()=>{for(let e of i)e.url&&C(e)},2e3)}),ei(()=>{window.removeEventListener(`keydown`,ae),clearInterval(de),c?.close(),clearTimeout(s),se()}),(e,t)=>(z(),B(`div`,Ym,[V(`div`,Xm,[V(`div`,Zm,[t[5]||=Ga(`<button type="button" class="browser-nav-btn" title="back" disabled data-v-05b21206><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-05b21206><path d="M15 18l-6-6 6-6" data-v-05b21206></path></svg></button><button type="button" class="browser-nav-btn" title="forward" disabled data-v-05b21206><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-05b21206><path d="M9 18l6-6-6-6" data-v-05b21206></path></svg></button>`,2),V(`button`,{type:`button`,class:`browser-nav-btn`,title:`reload`,disabled:!u.value?.url,onClick:ne},[...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,Qm)]),V(`form`,{class:`flex-1 flex items-center`,onSubmit:Rs(x,[`prevent`])},[V(`div`,$m,[u.value?.url&&!p.value?(z(),B(`svg`,eh,[...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?(z(),B(`svg`,th,[...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:j([`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:re,onBlur:k,onKeydown:ie},null,42,nh)])],32),u.value?.url?(z(),B(`button`,{key:0,type:`button`,class:j([`browser-proxy-btn shrink-0`,u.value?.useProxy?`active`:``]),title:u.value?.useProxy?`proxy enabled — click for direct`:`direct — click to proxy`,onClick:ee},[(z(),B(`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,ih))],10,rh)):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>1?(z(),B(`div`,ah,[(z(!0),B(R,null,L(i,e=>(z(),B(`button`,{key:e.id,type:`button`,class:j([`browser-tab`,e.id===a.value?`browser-tab-active`:`browser-tab-inactive`]),onClick:t=>_(e.id),onContextmenu:t=>P(D)(t,e.id)},[i.length>1?(z(),B(`span`,{key:0,class:`browser-tab-close`,onClick:Rs(t=>v(e.id),[`stop`])},`×`,8,sh)):W(``,!0),e.loading?(z(),B(`span`,ch)):W(``,!0),V(`span`,lh,M(e.url?e.title:`new tab`),1)],42,oh))),128))])):W(``,!0),H(Ml,{pos:P(E)??null},{default:Xn(()=>[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===P(E)?.data);e&&te(e),P(O)()}},M(i.find(e=>e.id===P(E)?.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]||=()=>{P(E)?.data!=null&&v(P(E).data),P(O)()}},` Close Tab `)]),_:1},8,[`pos`]),V(`div`,uh,[(z(!0),B(R,null,L(i,e=>(z(),B(`div`,{key:e.id,class:j([`absolute inset-0`,e.id===a.value?`z-10`:`z-0 invisible`])},[e.url?(z(),B(`iframe`,{key:1,ref_for:!0,ref:t=>T(e.id,t),src:e.useProxy?b(e.url):e.url,class:`block w-full h-full border-none bg-white`,title:e.title,onLoad:t=>w(e.id)},null,40,fh)):(z(),B(`div`,dh,[...t[10]||=[V(`div`,{class:`text-center`},[V(`div`,{class:`text-[28px] mb-3 text-border`},`~`),V(`div`,null,`enter a url or search term`)],-1)]]))],2))),128))])]))}}),[[`__scopeId`,`data-v-05b21206`]]),window:{width:900,height:640,minwidth:480,minheight:360},multi:!1},mh={text:``,thinking:``,isStreaming:!1,activeTool:null};function hh(e){let t=N({...mh}),n;function r(e){i(),t.value={...mh},n=new EventSource(`/api/stream?jid=${encodeURIComponent(e)}`,{withCredentials:!0}),n.addEventListener(`text_delta`,e=>{let n=JSON.parse(e.data);t.value={...t.value,text:t.value.text+n.delta,isStreaming:!0}}),n.addEventListener(`text_end`,()=>{t.value={...mh}}),n.addEventListener(`thinking_delta`,e=>{let n=JSON.parse(e.data);t.value={...t.value,thinking:t.value.thinking+n.delta,isStreaming:!0}}),n.addEventListener(`thinking_end`,()=>{}),n.addEventListener(`tool_start`,e=>{let n=JSON.parse(e.data);t.value={...t.value,activeTool:n.toolName}}),n.addEventListener(`tool_end`,()=>{t.value={...t.value,activeTool:null}}),n.addEventListener(`agent_end`,()=>{t.value={...mh}})}function i(){n?.close(),n=void 0}return F(e,e=>{e?r(e):i()},{immediate:!0}),ei(i),{streamState:t}}var gh=globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition;function _h(e,t){let n=N(!1),r=!!gh,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 gh,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 ei(d),{listening:n,supported:r,toggle:f,stop:d}}function vh(e){let{settings:t}=du(),n=N(``),r=N(!1);F(()=>e.value.text,e=>{e&&(n.value=e)}),F(()=>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 ei(a),{ttsEnabled:G(()=>t.tts.enabled),ttsSpeaking:r,toggleTts:i,cancelTts:a}}function yh(e){if(!e)return``;let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}function bh(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 xh(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 Sh(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}function Ch(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 wh={},Th={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 Eh(e,t){return z(),B(`button`,Th,[...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 Dh=Lu(wh,[[`render`,Eh]]),Oh;const kh=N(!1);var Ah=(()=>{let e;return()=>e??=tm(()=>import(`./defult-CMO6TZ5a.js`).then(async e=>{await e.init(),Oh=e.renderToHtml,kh.value=!0}),[])})();function jh(e){if(!e)return``;Oh||Ah(),kh.value;let t=[],n=0,r=e.replace(/<(internal|thinking)>([\s\S]*?)<\/\1>/g,(e,r,i)=>{let a=`<!--PI_MK_${n++}-->`,o=Oh?Oh(i):yh(i);return t.push([a,`<blockquote class="thinking-block">${o}</blockquote>`]),a}),i=Oh?Oh(r):yh(r);for(let[e,n]of t)i=i.replaceAll(e,n);return i}var Mh={key:0,class:`flex-1 flex items-center justify-center text-muted text-[13px] font-sans`},Nh={key:0,class:`flex justify-center py-2`},Ph={class:`bg-surface text-muted text-[10px] font-medium tracking-wide rounded-full px-3 py-1`},Fh={key:0,class:`text-[10px] font-medium mb-0.5 px-3 text-ok`},Ih=[`innerHTML`],Lh={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`},Rh={class:`text-[9px] text-muted mt-1 px-3`},zh={key:1,class:`flex flex-col min-w-0 max-w-[70%] max-md:max-w-[80%] self-start items-start`},Bh={class:`min-w-0 max-w-full px-4 py-2 rounded-2xl rounded-bl-sm text-[11px] font-sans leading-snug whitespace-pre-wrap break-words bg-surface border border-border select-text text-muted italic opacity-60`},Vh={key:2,class:`flex flex-col min-w-0 max-w-[70%] max-md:max-w-[80%] self-start items-start`},Hh=[`innerHTML`],Uh={key:3,class:`flex flex-col self-start items-start`},Wh={class:`px-4 py-2 rounded-2xl rounded-bl-sm text-[11px] font-mono text-muted bg-surface border border-border`},Gh={key:0,class:`shrink-0 justify-center px-4 py-2.5 bg-bg items-center gap-1.5 flex`},Kh=Lu(I({__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=N(null),a=N(!1);F(()=>t.messages.length,async(e,n)=>{let r=i.value;if(!r)return;let o=r.scrollHeight-r.scrollTop-r.clientHeight<80,s=e>(n??0);if(await Rn(),!a.value){r.scrollTop=r.scrollHeight,a.value=!0;return}(s&&o||t.sendingMessage)&&(r.scrollTop=r.scrollHeight)}),Xr(async()=>{await Rn();let e=i.value;e&&(e.scrollTop=e.scrollHeight,a.value=!0)});function o(e){return new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function s(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function c(e){return e===0?!0:o(t.messages[e].timestamp)!==o(t.messages[e-1].timestamp)}return F(()=>n.value.length+r.value.length,async()=>{let e=i.value;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;await Rn(),t&&(e.scrollTop=e.scrollHeight)}),(t,a)=>(z(),B(R,null,[V(`div`,{ref_key:`listEl`,ref:i,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?(z(),B(`div`,Mh,[...a[0]||=[V(`div`,{class:`text-center`},[V(`div`,{class:`text-[28px] text-border mb-3`},`~`),V(`div`,null,`no messages yet`)],-1)]])):W(``,!0),(z(!0),B(R,null,L(e.messages,(e,t)=>(z(),B(R,{key:`${e.timestamp}-${t}`},[c(t)?(z(),B(`div`,Nh,[V(`span`,Ph,M(o(e.timestamp)),1)])):W(``,!0),V(`div`,{class:j([`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?(z(),B(`div`,Fh,M(e.sender_name),1)):W(``,!0),e.is_bot_message?(z(),B(`div`,{key:1,class:`md-content 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`,innerHTML:P(jh)(e.content)},null,8,Ih)):(z(),B(`div`,Lh,M(e.content),1)),V(`div`,Rh,M(s(e.timestamp)),1)],2)],64))),128)),r.value?(z(),B(`div`,zh,[V(`div`,Bh,M(r.value),1)])):W(``,!0),n.value?(z(),B(`div`,Vh,[V(`div`,{class:`md-content 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`,innerHTML:P(jh)(n.value)},null,8,Hh)])):W(``,!0),e.streamState.activeTool&&!n.value?(z(),B(`div`,Uh,[V(`div`,Wh,` using `+M(e.streamState.activeTool)+`... `,1)])):W(``,!0)],512),e.typingVisible&&!n.value&&!r.value&&!e.streamState.activeTool?(z(),B(`div`,Gh,[...a[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),V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1)]])):W(``,!0)],64))}}),[[`__scopeId`,`data-v-788fca44`]]),qh={class:`w-[280px] min-w-[280px] max-md:w-full max-md:min-w-0 border-r border-border flex flex-col bg-surface`},Jh={class:`px-3 py-3 border-b border-border flex items-center gap-2`},Yh={class:`flex-1 overflow-y-auto p-1.5`},Xh={key:0,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},Zh={key:1,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},Qh=[`onClick`,`onContextmenu`,`onTouchstart`],$h={class:`flex-1 min-w-0`},eg={class:`text-[13px] font-medium font-sans truncate`},tg={class:`text-[11px] text-muted mt-0.5 truncate`},ng=I({__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}=$l();function d(){o.value&&n(`delete`,o.value.data),u()}function f(){o.value&&n(`settings`,o.value.data),u()}return(t,r)=>(z(),B(`div`,qh,[V(`div`,Jh,[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(Dh,{onClick:r[1]||=e=>n(`toggle`)})]),V(`div`,Yh,[e.loading?(z(),B(`div`,Xh,[H(P(K),{icon:`lucide:loader`,class:`animate-spin text-[20px] mb-3`}),r[7]||=V(`div`,null,`loading...`,-1)])):e.items.length===0?(z(),B(`div`,Zh,[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),(z(!0),B(R,null,L(e.items,t=>(z(),B(`button`,{key:t.jid,type:`button`,class:j([`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=>P(s)(e,t.jid),onTouchstart:e=>P(c)(e,t.jid),onTouchend:r[3]||=(...e)=>P(l)&&P(l)(...e),onTouchmove:r[4]||=(...e)=>P(l)&&P(l)(...e)},[V(`div`,{class:j([`w-9 h-9 rounded-full flex items-center justify-center text-[13px] font-semibold shrink-0`,i(t.name)])},M(a(t.name)),3),V(`div`,$h,[V(`div`,eg,M(t.name),1),V(`div`,tg,M(t.folder?`~/${t.folder}`:t.jid.slice(0,24)),1)])],42,Qh))),128))]),H(Ml,{pos:P(o)??null},{default:Xn(()=>[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`])]))}}),rg={class:`mb-2`},ig={key:0,class:`text-[10px] text-muted mb-2`},ag={key:1,class:`mb-2`},og={class:`grid grid-cols-2 gap-2 max-md:grid-cols-1`},sg=[`value`],cg={class:`space-y-3`},lg={class:`flex items-center gap-2`},ug={key:0,class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},dg=[`value`],fg=[`value`],pg=[`value`],mg=[`value`],hg=[`value`],gg=[`value`],_g={class:`col-span-2 max-md:col-span-1`},vg={class:`text-[12px] font-mono text-text`},yg={class:`pt-1 flex items-center justify-between`},bg={key:0,class:`flex-1 flex flex-col text-muted text-[13px] font-sans bg-bg`},xg={key:0,class:`flex shrink-0 px-4 py-3 border-b border-border items-center bg-surface`},Sg={class:`flex-1 flex items-center justify-center`},Cg={class:`text-center text-muted`},wg={key:1,class:`flex flex-col h-full`},Tg={class:`shrink-0 px-4 py-3 border-b border-border flex items-center gap-3 bg-surface`},Eg={class:`w-8 h-8 rounded-full bg-accent-dim text-accent flex items-center justify-center text-[13px] font-semibold shrink-0`},Dg={class:`flex-1 min-w-0 text-center`},Og={class:`text-[14px] font-medium font-sans truncate`},kg={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`},Ag={class:`flex gap-2`},jg={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`},Mg={class:`font-semibold`},Ng={class:`relative self-center -mr-1`,"data-command-menu":``},Pg={key:0,class:`absolute bottom-full left-0 mb-1.5 rounded-xl border border-border bg-surface shadow-lg overflow-hidden z-10 min-w-[180px]`},Fg=[`onMousedown`],Ig={class:`font-mono font-semibold`},Lg={class:`text-muted`},Rg={class:`relative flex-1`},zg={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`},Bg=[`onMousedown`],Vg={class:`font-mono font-semibold`},Hg={class:`opacity-50`},Ug=[`placeholder`,`disabled`],Wg=[`title`],Gg=[`disabled`],Kg=I({__name:`window`,props:{fillHeight:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,set:r,setTitle:i,openWindow:a}=gu(),o=N(n.value.jid||null),s=N([]),c=N([]),l=N([]),u=N(``),d=N(null),f=N(!1),p=N(!1),m=Gu(),h=Ku(),g=N(!1),{confirm:_}=Bu(),v=N([]),y=N(0),b=G(()=>{let e=u.value;if(!e.startsWith(`/`)||e.includes(` `))return[];let t=e.slice(1).toLowerCase();return v.value.filter(e=>e.command.startsWith(t))});F(b,()=>{y.value=0});let x=N(!1),S=N(!0),C=N(!1),w=N(null);function T(e){if(!m.value||S.value)return;let t=e.touches[0];t.clientX<24&&(w.value={startX:t.clientX,startY:t.clientY})}function E(e){if(!w.value)return;let t=e.touches[0],n=t.clientX-w.value.startX,r=Math.abs(t.clientY-w.value.startY);n>60&&n>r*1.5&&(S.value=!0,w.value=null)}function D(){w.value=null}let O=N(!1),ee=N(!1),te=N([]),ne=N(!1),re=N(),k=N(``);F(ne,e=>{e&&Rn(()=>re.value?.focus())});let ie=N(``),ae=N(``),oe=N(``),se=N(``),ce=N(``),le=G(()=>Sh(k.value.trim())),{streamState:ue}=hh(o),{ttsEnabled:de,ttsSpeaking:fe,toggleTts:pe,cancelTts:me}=vh(ue),{listening:he,supported:ge,toggle:_e}=_h(e=>{!o.value||!e||fe.value||(u.value=e)},()=>{u.value.trim()&&je()});function ve(){he.value||me(),_e()}let ye=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}),A=G(()=>o.value?s.value.find(e=>e.jid===o.value)?.name||o.value:`-`);F(A,e=>{i(e&&e!==`-`?`Chats — ${e}`:`Chats`)});let be=G(()=>o.value?s.value.some(e=>e.jid===o.value):!0),xe=G(()=>s.value.find(e=>e.jid===o.value)),Se=G(()=>p.value||ue.value.isStreaming||ue.value.activeTool!==null);F(()=>ue.value.isStreaming||ue.value.activeTool!==null,e=>{e&&(p.value=!1)});async function Ce(){let e=await Cu(`/api/pi/models`);e&&(te.value=e.models??[])}async function we(){let e=await Cu(`/api/pi/commands`);e&&(v.value=e)}async function Te(){let[e,t]=await Promise.all([Cu(`/api/groups`),Cu(`/api/chats`)]);if(e&&(s.value=e),t&&(c.value=t),O.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 Ee(){if(!o.value)return;let e=await Cu(`/api/messages?${new URLSearchParams({jid:o.value,limit:`200`})}`);e&&(l.value=e)}F(()=>ue.value.isStreaming,(e,t)=>{t&&!e&&Ee()});function De(e){me(),p.value=!1,o.value=e,r({jid:e}),m.value&&(S.value=!1),l.value=[],Ee();let t=s.value.find(t=>t.jid===e);u.value=t?.requiresTrigger?`${t.trigger} `:``,h.value||setTimeout(()=>{d.value?.focus()},0)}function Oe(e){u.value=`/`+e+` `,h.value||Rn(()=>d.value?.focus())}function ke(e){x.value=!1,o.value&&(u.value=`/`+e,je())}function Ae(e){if(b.value.length>0){if(e.key===`ArrowUp`){e.preventDefault(),y.value=(y.value-1+b.value.length)%b.value.length;return}if(e.key===`ArrowDown`){e.preventDefault(),y.value=(y.value+1)%b.value.length;return}if(e.key===`Tab`||e.key===`Enter`){e.preventDefault();let t=b.value[y.value];t&&Oe(t.command);return}if(e.key===`Escape`){e.preventDefault(),u.value=``;return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),je())}async function je(){if(!o.value)return;let e=u.value.trim();e&&(he.value&&_e(),u.value=xe.value?.requiresTrigger?`${xe.value.trigger} `:``,ze(),f.value=!0,await Su(`/api/send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:o.value,message:e})}),await Ee(),f.value=!1,p.value=!0,await Rn(),h.value||d.value?.focus())}function Me(e){De(e),ee.value=!0}async function Ne(e){await _(`delete chat and all messages for ${e}?`)&&(await Su(`/api/chats/${encodeURIComponent(e)}`,{method:`DELETE`}),o.value===e&&(o.value=null,l.value=[]),await Te())}function Pe(){o.value&&(k.value=c.value.find(e=>e.jid===o.value)?.name||``,ae.value=o.value,ie.value=``,oe.value=``,se.value=``,ce.value=``,ne.value=!0)}function Fe(){ne.value=!1,k.value=``,ie.value=``,ae.value=``,oe.value=``,se.value=``,ce.value=``}async function Ie(){let e=k.value.trim();if(!e)return;let t=Sh(e),n=ae.value.startsWith(`tg:`)&&!t.startsWith(`tg-`)?`tg-${t}`:t,r=ie.value.trim()||n,i=ae.value.trim()||`${r}@admin`;await Su(`/api/groups`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:i,name:e,folder:r,trigger:oe.value.trim(),model:se.value||void 0,thinkingLevel:ce.value||void 0})});let a=i;Fe(),await Te(),De(a)}async function Le(e,t){await Su(`/api/groups/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),await Te()}async function Re(){if(!xe.value)return;let e=`~/.pi/claw/groups/${xe.value.folder}`,t=await Cu(`/api/terminal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:80,rows:24,cwd:e})});t&&a(`terminal`,{connectSession:t.id})}function ze(){d.value&&(d.value.style.height=`auto`,d.value.style.height=`${Math.min(d.value.scrollHeight,120)}px`)}qu(Te,3e4);function Be(e){x.value&&(e.target.closest(`[data-command-menu]`)||(x.value=!1))}function Ve(e){if(e.metaKey&&e.key===`j`&&o.value){e.preventDefault(),ee.value=!ee.value;return}!be.value&&o.value&&(e.key===`Enter`&&!e.metaKey&&!e.ctrlKey&&!g.value?(e.preventDefault(),C.value?(Pe(),C.value=!1):C.value=!0):e.key===`Escape`&&C.value&&(e.preventDefault(),C.value=!1))}return Xr(()=>{Ce(),we(),o.value&&Ee(),window.addEventListener(`keydown`,Ve),window.addEventListener(`click`,Be)}),ei(()=>{window.removeEventListener(`keydown`,Ve),window.removeEventListener(`click`,Be),me()}),(e,n)=>(z(),B(`div`,{class:j([`flex overflow-hidden relative`,t.fillHeight?`h-full min-h-0`:`h-[calc(100dvh-140px)]`]),onTouchstart:T,onTouchmove:E,onTouchend:D},[Zn(H(ng,{items:ye.value,loading:!O.value,"current-jid":o.value,class:`max-md:absolute max-md:inset-y-0 max-md:left-0 max-md:z-10 max-md:w-[280px] max-md:min-w-0 max-md:!bg-surface`,onSelect:De,onDelete:Ne,onSettings:Me,onRegister:n[0]||=e=>ne.value=!0,onToggle:n[1]||=e=>S.value=!S.value},null,8,[`items`,`loading`,`current-jid`]),[[$o,S.value]]),ne.value?(z(),La(Il,{key:0,title:`New chat`,width:`420px`,onClose:Fe},{default:Xn(()=>[V(`form`,{onSubmit:Rs(Ie,[`prevent`]),onKeydown:Bs(Fe,[`escape`])},[V(`div`,rg,[n[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),Zn(V(`input`,{ref_key:`regNameInput`,ref:re,"onUpdate:modelValue":n[2]||=e=>k.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),[[Ms,k.value]])]),le.value?(z(),B(`div`,ig,` -> ~/`+M(le.value)+`/ · `+M(le.value)+`@admin `,1)):W(``,!0),le.value?(z(),B(`div`,ag,[V(`div`,og,[V(`div`,null,[n[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),Zn(V(`input`,{"onUpdate:modelValue":n[3]||=e=>ie.value=e,placeholder:`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,512),[[Ms,ie.value]])]),V(`div`,null,[n[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),Zn(V(`input`,{"onUpdate:modelValue":n[4]||=e=>ae.value=e,placeholder:`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,512),[[Ms,ae.value]])]),V(`div`,null,[n[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. @pi)`)])],-1),Zn(V(`input`,{"onUpdate:modelValue":n[5]||=e=>oe.value=e,placeholder:`default`,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),[[Ms,oe.value]])]),V(`div`,null,[n[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),Zn(V(`select`,{"onUpdate:modelValue":n[6]||=e=>se.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`},[n[35]||=V(`option`,{value:``},`default`,-1),(z(!0),B(R,null,L(te.value,e=>(z(),B(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},M(e.name),9,sg))),128))],512),[[Ns,se.value]])]),V(`div`,null,[n[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),Zn(V(`select`,{"onUpdate:modelValue":n[7]||=e=>ce.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`},[...n[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),[[Ns,ce.value]])])])])):W(``,!0),V(`div`,{class:`flex gap-2 items-center`},[n[40]||=V(`button`,{type:`submit`,class:`btn-primary`},[U(` register `),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`)],-1),V(`button`,{type:`button`,class:`btn-ghost`,onClick:Fe},[...n[39]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],32)]),_:1})):W(``,!0),ee.value&&o.value?(z(),La(Il,{key:1,title:`chat settings`,width:`360px`,onClose:n[15]||=e=>ee.value=!1},{default:Xn(()=>[V(`div`,cg,[V(`div`,null,[n[41]||=V(`label`,{class:`label`},`status`,-1),V(`div`,lg,[V(`span`,{class:j([`inline-block w-1.5 h-1.5 rounded-full`,xe.value?`bg-ok`:`bg-warn`])},null,2),V(`span`,{class:j([`text-[12px] font-mono`,xe.value?`text-ok`:`text-warn`])},M(xe.value?`registered`:`unmanaged`),3)])]),xe.value?(z(),B(`div`,ug,[V(`div`,null,[n[42]||=V(`label`,{class:`label`},`name`,-1),V(`input`,{value:xe.value.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:n[8]||=e=>Le(o.value,{name:e.target.value})},null,40,dg)]),V(`div`,null,[n[43]||=V(`label`,{class:`label`},`trigger`,-1),V(`input`,{value:xe.value.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:n[9]||=e=>Le(o.value,{trigger:e.target.value})},null,40,fg)]),V(`div`,null,[n[45]||=V(`label`,{class:`label`},`model`,-1),V(`select`,{value:xe.value.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:n[10]||=e=>Le(o.value,{model:e.target.value||null})},[n[44]||=V(`option`,{value:``},`default`,-1),(z(!0),B(R,null,L(te.value,e=>(z(),B(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},M(e.name),9,mg))),128))],40,pg)]),V(`div`,null,[n[47]||=V(`label`,{class:`label`},`thinking`,-1),V(`select`,{value:xe.value.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:n[11]||=e=>Le(o.value,{thinkingLevel:e.target.value||null})},[...n[46]||=[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,hg)]),V(`div`,null,[n[49]||=V(`label`,{class:`label`},`require trigger`,-1),V(`select`,{value:xe.value.requiresTrigger===!1?`false`:`true`,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:n[12]||=e=>Le(o.value,{requiresTrigger:e.target.value===`true`?null:!1})},[...n[48]||=[V(`option`,{value:`true`},`yes`,-1),V(`option`,{value:`false`},`no (all messages)`,-1)]],40,gg)]),V(`div`,_g,[n[50]||=V(`label`,{class:`label`},`folder`,-1),V(`div`,vg,`~/`+M(xe.value.folder)+`/`,1)])])):W(``,!0),V(`div`,yg,[V(`button`,{type:`button`,class:`btn-ghost`,onClick:n[13]||=e=>ee.value=!1},[...n[51]||=[U(` close `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]]),V(`button`,{type:`button`,class:`btn-danger`,onClick:n[14]||=e=>{ee.value=!1,Ne(o.value)}},` delete chat `)])])]),_:1})):W(``,!0),V(`div`,{class:j([`flex-1 flex flex-col min-w-0`,g.value&&P(m)?`max-md:fixed max-md:inset-0 max-md:z-20 max-md:bg-bg`:``]),id:`chat-main`},[o.value?(z(),B(`div`,wg,[V(`div`,Tg,[S.value?W(``,!0):(z(),La(Dh,{key:0,class:`mr-1`,onClick:n[18]||=e=>S.value=!0})),V(`div`,Eg,M((A.value[0]||`?`).toUpperCase()),1),V(`div`,Dg,[V(`div`,Og,M(A.value),1)]),xe.value?(z(),B(`button`,{key:1,type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`files`,onClick:n[19]||=e=>P(a)(`files`,{folder:xe.value.folder,path:`.`})},[H(P(K),{icon:`lucide:folder-open`,class:`text-base`})])):W(``,!0),xe.value?(z(),B(`button`,{key:2,type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`agent notes`,onClick:n[20]||=e=>P(a)(`notes`,{activeRef:`~agents/${xe.value.folder}`})},[H(P(K),{icon:`mdi:note-text-outline`,class:`text-base`})])):W(``,!0),xe.value?(z(),B(`button`,{key:3,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[21]||=e=>Re()},[H(P(K),{icon:`lucide:terminal`,class:`text-base`})])):W(``,!0),V(`button`,{type:`button`,class:j([`leading-none transition-colors flex items-center gap-1`,P(de)?`text-accent hover:text-accent`:`text-muted hover:text-text`]),title:`text-to-speech`,onClick:n[22]||=(...e)=>P(pe)&&P(pe)(...e)},[H(P(K),{icon:P(de)?`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[23]||=e=>ee.value=!0},[H(P(K),{icon:`lucide:settings`,class:`text-base`})])]),O.value&&!be.value?(z(),B(`div`,kg,[n[58]||=V(`div`,{class:`text-muted`},`this chat is not registered — messages won't reach the agent`,-1),C.value?(z(),B(R,{key:1},[n[57]||=V(`div`,{class:`text-[11px] text-warn font-semibold`},` only register chats you trust — registered chats get full agent access `,-1),V(`div`,Ag,[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[25]||=e=>{Pe(),C.value=!1}},[...n[55]||=[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[26]||=e=>C.value=!1},[...n[56]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],64)):(z(),B(`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[24]||=e=>C.value=!0},[...n[54]||=[U(` register chat `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]]))])):W(``,!0),xe.value&&xe.value.requiresTrigger?(z(),B(`div`,jg,[n[59]||=V(`span`,{class:`opacity-60`},`trigger:`,-1),V(`span`,Mg,M(xe.value.trigger),1),n[60]||=V(`span`,{class:`opacity-50`},`— prefix messages to reach the agent`,-1)])):W(``,!0),H(Kh,{messages:l.value,"stream-state":P(ue),"typing-visible":Se.value,"sending-message":f.value},null,8,[`messages`,`stream-state`,`typing-visible`,`sending-message`]),V(`form`,{autocomplete:`off`,"data-form-type":`other`,class:j([`shrink-0 px-3 py-2.5 border-t border-border flex gap-2 items-end bg-surface`,g.value&&P(m)?`max-md:absolute max-md:bottom-0 max-md:left-0 max-md:right-0`:``]),onSubmit:Rs(je,[`prevent`])},[V(`div`,Ng,[V(`button`,{type:`button`,class:`w-6 h-6 p-0 flex items-center justify-center shrink-0 text-[13px] font-mono font-bold text-muted cursor-pointer transition-colors hover:text-accent`,title:`commands`,onClick:n[27]||=e=>x.value=!x.value},` / `),x.value?(z(),B(`div`,Pg,[(z(!0),B(R,null,L(v.value,e=>(z(),B(`button`,{key:e.command,type:`button`,class:`w-full px-3 py-1.5 text-left text-[12px] flex items-center gap-2 cursor-pointer transition-colors text-text hover:bg-accent-dim hover:text-accent`,onMousedown:Rs(t=>ke(e.command),[`prevent`])},[V(`span`,Ig,`/`+M(e.command),1),V(`span`,Lg,M(e.description),1)],40,Fg))),128))])):W(``,!0)]),V(`div`,Rg,[b.value.length>0?(z(),B(`div`,zg,[(z(!0),B(R,null,L(b.value,(e,t)=>(z(),B(`button`,{key:e.command,type:`button`,class:j([`w-full px-3 py-1.5 text-left text-[12px] flex items-center gap-2 cursor-pointer transition-colors`,t===y.value?`bg-accent/12 text-accent`:`text-text hover:bg-bg`]),onMousedown:Rs(t=>Oe(e.command),[`prevent`])},[V(`span`,Vg,`/`+M(e.command),1),V(`span`,Hg,M(e.description),1)],42,Bg))),128))])):W(``,!0),Zn(V(`textarea`,{ref_key:`composeRef`,ref:d,"onUpdate:modelValue":n[28]||=e=>u.value=e,name:`message`,placeholder:P(he)?`listening...`:`message...`,rows:`1`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,enterkeyhint:`send`,class:`w-full min-h-[38px] max-h-[120px] resize-none px-4 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`,disabled:f.value,onInput:ze,onKeydown:Ae,onFocus:n[29]||=e=>g.value=!0,onBlur:n[30]||=e=>g.value=!1},null,40,Ug),[[Ms,u.value]])]),P(ge)?(z(),B(`button`,{key:0,type:`button`,class:j([`rounded-full w-9 h-9 p-0 flex items-center justify-center shrink-0 text-sm cursor-pointer transition-colors`,P(he)?`bg-danger text-bg`:`text-muted hover:text-accent`]),title:P(he)?`stop listening`:`speech to text`,onClick:ve},[H(P(K),{icon:P(he)?`lucide:mic-off`:`lucide:mic`,class:`text-base`},null,8,[`icon`])],10,Wg)):W(``,!0),V(`button`,{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:f.value},[...n[61]||=[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,Gg)],34)])):(z(),B(`div`,bg,[S.value?W(``,!0):(z(),B(`div`,xg,[H(Dh,{onClick:n[16]||=e=>S.value=!0})])),V(`div`,Sg,[V(`div`,Cg,[n[52]||=V(`div`,{class:`text-[28px] mb-3 text-border`},`~`,-1),n[53]||=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[17]||=e=>ne.value=!0},` + `)])])]))],2)],34))}}),qg={key:`chat`,label:`Chats`,icon:`lucide:message-circle`,color:`#58a6ff`,component:{name:`ChatContent`,render:()=>bo(Kg,{fillHeight:!0})},window:{width:1e3,height:700,minwidth:420,minheight:320}},Jg={class:`grid gap-3 p-3`},Yg={key:0,class:`text-[11px] text-danger`},Xg={key:1,class:`text-[12px] text-muted text-center py-6`},Zg={class:`min-w-0`},Qg={class:`text-[12px] text-text font-medium flex items-center gap-2`},$g={key:0,class:`text-[10px] px-1.5 py-0.5 rounded-sm font-normal bg-accent/15 text-accent`},e_={class:`text-[11px] text-muted font-mono mt-0.5`},t_={key:0},n_={class:`text-[10px] text-muted mt-1`},r_={key:0},i_={class:`flex gap-1.5 shrink-0`},a_=[`disabled`,`onClick`],o_=[`disabled`,`onClick`],s_=[`disabled`,`onClick`],c_={key:`devices`,label:`Devices`,icon:`lucide:monitor-smartphone`,color:`#39bae6`,component:I({__name:`window`,setup(e){let{device:t}=Du(),n=N([]),r=N(!1),i=N(``);async function a(){let e=await Cu(`/api/auth/devices`);e&&(n.value=e)}async function o(e){r.value=!0,i.value=``;try{await Su(`/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 Su(`/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 qu(a,3e3),(e,a)=>(z(),B(`div`,Jg,[i.value?(z(),B(`div`,Yg,M(i.value),1)):W(``,!0),n.value.length===0?(z(),B(`div`,Xg,` no devices registered `)):W(``,!0),(z(!0),B(R,null,L(n.value,e=>(z(),B(`div`,{key:e.id,class:`border border-border p-3 flex items-start justify-between gap-3`},[V(`div`,Zg,[V(`div`,Qg,[U(M(e.name)+` `,1),V(`span`,{class:j([`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`}])},M(e.status),3),P(t)?.id===e.id?(z(),B(`span`,$g,` this device `)):W(``,!0)]),V(`div`,e_,[U(M(e.id.slice(0,8))+` `,1),e.ip?(z(),B(`span`,t_,` · `+M(e.ip),1)):W(``,!0)]),V(`div`,n_,[U(` created `+M(c(e.created_at))+` `,1),e.status===`approved`?(z(),B(`span`,r_,` · last seen `+M(c(e.last_seen)),1)):W(``,!0)])]),V(`div`,i_,[e.status===`pending`?(z(),B(`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,a_)):W(``,!0),e.status!==`revoked`&&P(t)?.id!==e.id?(z(),B(`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,o_)):W(``,!0),e.status===`revoked`?(z(),B(`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,s_)):W(``,!0)])]))),128))]))}}),window:{width:480,height:400,minwidth:360,minheight:250,autosize:!0}},l_={"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`}},u_=[{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`}}],d_={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`}},f_={icon:`ph:file-fill`,color:`text-muted`};function p_(e){let t=e.toLowerCase();if(l_[t])return l_[t];for(let e of u_)if(e.test(t))return e.result;let n=t.split(`.`).pop();return n&&d_[n]?d_[n]:f_}function m_(e){return{icon:e?`ph:folder-open-fill`:`ph:folder-fill`,color:`text-accent`}}var h_=[`onClick`],g_={key:1,class:`inline-block w-3`},__=I({__name:`FileTree`,props:{nodes:{},depth:{},activeFolder:{},activePath:{}},emits:[`toggle`,`select`,`open`],setup(e,{emit:t}){let n=t;return(t,r)=>{let i=oi(`FileTree`,!0);return z(!0),B(R,null,L(e.nodes,t=>(z(),B(`div`,{key:t.folder+`/`+t.path},[V(`button`,{type:`button`,class:j([`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:A({paddingLeft:(e.depth??0)*12+8+`px`,paddingRight:`8px`}),onClick:e=>t.isFile?n(`open`,t):(n(`toggle`,t),n(`select`,t))},[t.isFile?(z(),B(R,{key:1},[r[3]||=V(`span`,{class:`inline-block w-3`},null,-1),H(P(K),{icon:P(p_)(t.name).icon,class:j([P(p_)(t.name).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)):(z(),B(R,{key:0},[t.children?.length||!t.loaded?(z(),La(P(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`])):(z(),B(`span`,g_)),H(P(K),{icon:P(m_)(t.expanded).icon,class:j([P(m_)(t.expanded).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)),U(` `+M(t.name),1)],14,h_),!t.isFile&&t.expanded&&t.children&&t.children.length>0?(z(),La(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)}}}),v_={class:`flex h-full`},y_={key:0,class:`w-[180px] min-w-[140px] border-r border-border overflow-auto py-2 flex-shrink-0`},b_={key:0,class:`px-3 py-4 text-[11px] text-muted`},x_={class:`flex-1 flex flex-col min-w-0`},S_={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`},C_=[`disabled`],w_=[`value`],T_={class:`ml-auto flex items-center gap-2 sm:gap-1 flex-shrink-0`},E_={key:0,class:`text-center py-8 text-muted text-[12px]`},D_={key:1,class:`grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-1`},O_=[`onClick`,`onDblclick`],k_={class:`text-[10px] font-mono text-center w-full truncate text-accent`},A_={key:2,class:`w-full border-collapse text-[12px]`},j_={key:1},M_=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],N_={class:`py-3 sm:py-1.5 px-2 border-b border-border font-mono`},P_={key:0,class:`inline-flex items-center gap-1.5 text-accent`},F_={key:1,class:`inline-flex items-center gap-1.5`},I_={class:`py-3 sm:py-1.5 px-2 border-b border-border text-muted`},L_={class:`py-3 sm:py-1.5 px-2 border-b border-border text-muted`},R_={class:`py-3 sm:py-1.5 px-1 border-b border-border w-[28px]`},z_=[`onClick`],B_={key:1,class:`text-center py-8 text-muted text-[12px]`},V_={class:`grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-1`},H_=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],U_={key:`files`,label:`Files`,icon:`lucide:folder`,color:`#7fd962`,component:I({__name:`window`,setup(e){let{confirm:t}=Bu(),{settings:n,set:r}=du(),{state:i,set:a,openWindow:o,setTitle:s}=gu(),{menu:c,onContext:l,onTouchStart:u,cancelLongPress:d,close:f}=$l(),p=N([]),m=N([]),h=N(i.value.folder||``),g=N(i.value.path||`.`),_=N([]),v=N(-1),y=N(),b=N(n.filesViewMode??`list`),x=N(window.innerWidth>=640),S=G(()=>h.value?g.value===`.`?`/${h.value}`:`/${h.value}/${g.value}`:`/`),C=N(``),w=N(!1),T=G(()=>[..._.value].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)),E=G(()=>p.value.find(e=>e.folder===h.value)?.readonly===!0);async function D(){let e=await Cu(`/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)),re()}async function O(e){let t=await Cu(`/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 ee(e){if(e.expanded){e.expanded=!1;return}e.loaded||await O(e),e.expanded=!0}function te(e){h.value=e.folder,g.value=e.path}function ne(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 re(){if(!h.value)return;let e=m.value.find(e=>e.folder===h.value&&e.path===`.`);if(!e||(e.expanded=!0,e.loaded||await O(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 O(n),n.children?.find(t=>t.name===e&&!t.isFile)),!t)return;if(t.loaded||await O(t),(t.children?.length??0)>10){n=t;continue}t.expanded=!0,n=t}}async function k(){if(!h.value)return;let e=await Cu(`/api/files?${new URLSearchParams({folder:h.value,path:g.value})}`);e&&(_.value=e.entries),v.value=0}function ie(e){let t=g.value===`.`?e:`${g.value}/${e}`;o(`editor`,{folder:h.value,path:t})}async function ae(e){if(!await t(`delete ${e.name+(e.type===`directory`?`/`:``)}?`))return;let n=g.value===`.`?e.name:`${g.value}/${e.name}`;await Cu(`/api/files/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folder:h.value,path:n})}),await k(),_.value.length===0&&g.value!==`.`?oe(`..`):v.value=Math.min(v.value,T.value.length-1)}function oe(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 se(e){h.value=e.folder,g.value=`.`}function ce(e){se(e)}function le(e,t){v.value=t,!c.value&&(e.type===`directory`?oe(e.name):ie(e.name))}function ue(){C.value=S.value,w.value=!0}function de(){w.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 fe(){w.value=!1}F(h,e=>a({folder:e})),F(g,e=>a({path:e})),F(b,e=>{a({viewMode:e}),r({filesViewMode:e})}),F(()=>n.filesViewMode,e=>{e&&e!==b.value&&(b.value=e)}),F([h,g],([e,t])=>{if(!e)return s(`Files`);s(`Files — ${t&&t!==`.`?`${e}/${t}`:e}`)});let pe;function me(){if(pe?.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=()=>k(),pe=t}F([h,g],()=>{k(),me(),re()},{immediate:!0}),ei(()=>pe?.close()),qu(D,1e4);function he(){c.value&&ae(c.value.data),f()}function ge(){if(!c.value)return;let e=c.value.data;e.type===`directory`?oe(e.name):ie(e.name),f()}function _e(){let e=y.value?.clientWidth??0;return e<=0?1:Math.max(1,Math.floor((e+4)/84))}function ve(e){if(e.key===`Delete`||e.key===`Backspace`||e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`u`){e.preventDefault(),oe(`..`);return}let t=T.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=_e();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`?oe(n.name):ie(n.name))}}function ye(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)=>(z(),B(`div`,v_,[x.value?(z(),B(`div`,y_,[m.value.length===0?(z(),B(`div`,b_,`no groups`)):W(``,!0),H(__,{nodes:m.value,"active-folder":h.value,"active-path":g.value,onToggle:ee,onSelect:te,onOpen:ne},null,8,[`nodes`,`active-folder`,`active-path`])])):W(``,!0),V(`div`,x_,[V(`div`,S_,[V(`button`,{type:`button`,class:j([`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(P(K),{icon:`lucide:panel-left`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),V(`button`,{type:`button`,class:j([`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=>oe(`..`)},[H(P(K),{icon:`lucide:chevron-left`,class:`w-4 h-4 sm:w-3 sm:h-3`})],10,C_),w.value?(z(),B(`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:[Bs(de,[`enter`]),Bs(fe,[`escape`])],onBlur:de,onVnodeMounted:t[3]||=e=>e.el.select()},null,40,w_)):(z(),B(`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:ue},M(S.value),1)),V(`div`,T_,[V(`button`,{type:`button`,class:j([`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(P(K),{icon:`lucide:list`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),V(`button`,{type:`button`,class:j([`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(P(K),{icon:`lucide:layout-grid`,class:`w-4 h-4 sm:w-3 sm:h-3`})],2),h.value?(z(),B(`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:k},[H(P(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:ve},[!h.value&&p.value.length===0?(z(),B(`div`,E_,` no groups `)):h.value?b.value===`list`?(z(),B(`table`,A_,[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):(z(),B(`tr`,{key:0,class:`hover:bg-surface cursor-pointer`,onClick:t[6]||=e=>oe(`..`)},[...t[12]||=[V(`td`,{colspan:`4`,class:`py-3 sm:py-1.5 px-2 border-b border-border font-mono text-muted`},` ... `,-1)]])),T.value.length===0?(z(),B(`tr`,j_,[...t[13]||=[V(`td`,{colspan:`4`,class:`text-center py-8 text-muted text-[12px]`},`empty directory`,-1)]])):W(``,!0),(z(!0),B(R,null,L(T.value,(e,n)=>(z(),B(`tr`,{key:e.name,class:j([`cursor-pointer`,n===v.value?`bg-surface`:`hover:bg-surface`]),onClick:t=>le(e,n),onDblclick:t=>e.type===`directory`?oe(e.name):ie(e.name),onContextmenu:t=>P(l)(t,e),onTouchstart:t=>P(u)(t,e),onTouchend:t[7]||=(...e)=>P(d)&&P(d)(...e),onTouchmove:t[8]||=(...e)=>P(d)&&P(d)(...e)},[V(`td`,N_,[e.type===`directory`?(z(),B(`span`,P_,[H(P(K),{icon:P(m_)(!1).icon,class:`w-3.5 h-3.5 flex-shrink-0`},null,8,[`icon`]),U(` `+M(e.name)+`/ `,1)])):(z(),B(`span`,F_,[H(P(K),{icon:P(p_)(e.name).icon,class:j([P(p_)(e.name).color,`w-3.5 h-3.5 flex-shrink-0`])},null,8,[`icon`,`class`]),U(` `+M(e.name),1)]))]),V(`td`,I_,M(ye(e.size)),1),V(`td`,L_,M(P(bh)(e.mtime)),1),V(`td`,R_,[V(`button`,{type:`button`,class:`btn-sm hover:bg-surface text-muted hover:text-text`,onClick:Rs(t=>P(l)(t,e),[`stop`])},[H(P(K),{icon:`lucide:ellipsis`,class:`w-3.5 h-3.5`})],8,z_)])],42,M_))),128))])])):(z(),B(R,{key:3},[g.value===`.`?W(``,!0):(z(),B(`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=>oe(`..`)},` .. `)),T.value.length===0?(z(),B(`div`,B_,` empty directory `)):W(``,!0),V(`div`,V_,[(z(!0),B(R,null,L(T.value,(e,n)=>(z(),B(`div`,{key:e.name,class:j([`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=>le(e,n),onDblclick:t=>e.type===`directory`?oe(e.name):ie(e.name),onContextmenu:t=>P(l)(t,e),onTouchstart:t=>P(u)(t,e),onTouchend:t[10]||=(...e)=>P(d)&&P(d)(...e),onTouchmove:t[11]||=(...e)=>P(d)&&P(d)(...e)},[e.type===`directory`?(z(),La(P(K),{key:0,icon:P(m_)(!1).icon,class:`w-14 h-14 text-accent`},null,8,[`icon`])):(z(),La(P(K),{key:1,icon:P(p_)(e.name).icon,class:j([P(p_)(e.name).color,`w-14 h-14`])},null,8,[`icon`,`class`])),V(`span`,{class:j([`text-[10px] font-mono text-center w-full truncate`,e.type===`directory`?`text-accent`:`text-text`])},M(e.name),3)],42,H_))),128))])],64)):(z(),B(`div`,D_,[(z(!0),B(R,null,L(p.value,e=>(z(),B(`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=>ce(e),onDblclick:t=>se(e)},[H(P(K),{icon:`ph:folder-fill`,class:`w-14 h-14 text-accent`}),V(`span`,k_,M(e.folder),1)],40,O_))),128))]))],544)]),H(Ml,{pos:P(c)??null},{default:Xn(()=>[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:ge},` Open `),E.value?W(``,!0):(z(),B(`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:he},` Delete `))]),_:1},8,[`pos`])]))}}),window:{width:800,height:520,minwidth:480,minheight:300}},W_={class:`flex flex-col h-full`},G_={class:`flex gap-2 items-center p-3 pb-0`},K_=[`value`],q_={class:`flex-1 overflow-auto p-3 pt-2 select-text relative`},J_={class:`w-full border-collapse text-[12px] table-fixed`},Y_={key:0},X_={colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},Z_={key:1},Q_={class:`py-1.5 px-2 border-b border-border align-top`},$_={class:`mt-0.5`},ev={class:`badge-muted`},tv=[`title`],nv={class:`badge-muted whitespace-nowrap`},rv={class:`py-1.5 px-2 border-b border-border font-mono select-text break-all align-top`},iv=[`innerHTML`],av={key:`logs`,label:`Logs`,icon:`lucide:scroll-text`,color:`#e5a535`,component:I({__name:`window`,setup(e){let t={10:`debug`,20:`info`,30:`warn`,40:`error`,50:`fatal`},n=N([]),r=N(!0),i=N(``),a=N(``),o=N([]),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}Xr(()=>{c()}),ei(()=>{s?.close()}),F([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)=>(z(),B(`div`,W_,[V(`div`,G_,[t[4]||=V(`h3`,{class:`section-title`},`system logs`,-1),Zn(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),(z(!0),B(R,null,L(o.value,e=>(z(),B(`option`,{key:e,value:e},M(e),9,K_))),128))],512),[[Ns,a.value]]),Zn(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),[[Ns,i.value]])]),V(`div`,q_,[V(`table`,J_,[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?(z(),B(`tr`,Y_,[V(`td`,X_,[H(P(K),{icon:`lucide:loader`,class:`inline-block align-[-2px] mr-1 animate-spin`}),t[5]||=U(`loading... `,-1)])])):n.value.length===0?(z(),B(`tr`,Z_,[...t[6]||=[V(`td`,{colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},`no logs`,-1)]])):W(``,!0),(z(!0),B(R,null,L(n.value,e=>(z(),B(`tr`,{key:e.timestamp,class:`hover:bg-surface`},[V(`td`,Q_,[V(`span`,{class:j(u(e.level))},[H(P(K),{icon:`lucide:signal`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(M(l(e.level)),1)],2),V(`div`,$_,[V(`span`,ev,[H(P(K),{icon:`lucide:tag`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(M(e.tag),1)])]),V(`div`,{class:`mt-0.5`,title:e.timestamp},[V(`span`,nv,[H(P(K),{icon:`lucide:clock`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(M(P(bh)(e.timestamp)),1)])],8,tv)]),V(`td`,rv,[V(`span`,null,M(e.message),1),e.data?(z(),B(`pre`,{key:0,class:`whitespace-pre-wrap m-0 mt-1 text-muted text-[11px]`,innerHTML:d(e.data)},null,8,iv)):W(``,!0)])]))),128))])])])]))}}),window:{width:800,height:500,minwidth:400,minheight:280}};function ov(e){this.content=e}ov.prototype={constructor:ov,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 ov(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 ov(n)},addToStart:function(e,t){return new ov([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ov(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 ov(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=ov.from(e),e.size?new ov(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ov.from(e),e.size?new ov(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ov.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}},ov.from=function(e){if(e instanceof ov)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ov(t)};function sv(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=sv(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function cv(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=cv(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 sv(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return cv(this,e,t,n)}findIndex(e){if(e==0)return uv(0,e);if(e==this.size)return uv(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?uv(t+1,i):uv(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 lv={index:0,offset:0};function uv(e,t){return lv.index=e,lv.offset=t,lv}function dv(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(!dv(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!dv(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var fv=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&&dv(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}};fv.none=[];var pv=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=hv(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(mv(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 mv(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(mv(a.content,t-i-1,n-i-1)))}function hv(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=hv(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function gv(e,t,n){if(n.openStart>e.depth)throw new pv(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new pv(`Inconsistent open depths`);return _v(e,t,n,0)}function _v(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=_v(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Sv(a,wv(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Sv(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Tv(n,e);return Sv(a,Cv(e,i,o,t,r))}}function vv(e,t){if(!t.type.compatibleContent(e.type))throw new pv(`Cannot join `+t.type.name+` onto `+e.type.name)}function yv(e,t,n){let r=e.node(n);return vv(r,t.node(n)),r}function bv(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 xv(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&&(bv(e.nodeAfter,r),a++));for(let e=a;e<o;e++)bv(i.child(e),r);t&&t.depth==n&&t.textOffset&&bv(t.nodeBefore,r)}function Sv(e,t){return e.type.checkContent(t),e.copy(t)}function Cv(e,t,n,r,i){let a=e.depth>i&&yv(e,t,i+1),o=r.depth>i&&yv(n,r,i+1),s=[];return xv(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(vv(a,o),bv(Sv(a,Cv(e,t,n,r,i+1)),s)):(a&&bv(Sv(a,wv(e,t,i+1)),s),xv(t,n,i,s),o&&bv(Sv(o,wv(n,r,i+1)),s)),xv(r,null,i,s),new q(s)}function wv(e,t,n){let r=[];return xv(null,e,n,r),e.depth>n&&bv(Sv(yv(e,t,n+1),wv(e,t,n+1)),r),xv(t,null,n,r),new q(r)}function Tv(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 Ev=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 fv.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 Av(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=kv.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 kv.set(t,r=new Dv);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ov,i}},Dv=class{constructor(){this.elts=[],this.i=0}},Ov=12,kv=new WeakMap,Av=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)}},jv=Object.create(null),Mv=class e{constructor(e,t,n,r=fv.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&&dv(this.attrs,t||e.defaultAttrs||jv)&&fv.sameSet(this.marks,n||fv.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 gv(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 Ev.resolveCached(this,e)}resolveNoCache(e){return Ev.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()+`)`),Pv(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=fv.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(!fv.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}};Mv.prototype.text=void 0;var Nv=class e extends Mv{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):Pv(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 Pv(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Fv=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Iv(t,n);if(r.next==null)return e.empty;let i=Lv(r);r.next&&r.err(`Unexpected trailing text`);let a=qv(Wv(i));return Jv(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
|
-
`)}};Fv.empty=new Fv(!0);var Iv=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 Lv(e){let t=[];do t.push(Rv(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Rv(e){let t=[];do t.push(zv(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function zv(e){let t=Uv(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=Vv(e,t);else break;return t}function Bv(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Vv(e,t){let n=Bv(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Bv(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Hv(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 Uv(e){if(e.eat(`(`)){let t=Lv(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=Hv(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 Wv(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 Gv(e,t){return t-e}function Kv(e,t){let n=[];return r(t),n.sort(Gv);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 qv(e){let t=Object.create(null);return n(Kv(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]);Kv(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Fv(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Gv);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Jv(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 Yv(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 Xv(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 Zv(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 Qv(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ty(e,r,t[r]);return n}var $v=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=Qv(e,n.attrs),this.defaultAttrs=Yv(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==Fv.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:Xv(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Mv(this,this.computeAttrs(e),q.from(t),fv.setFrom(n))}createChecked(e=null,t,n){return t=q.from(t),this.checkContent(t),new Mv(this,this.computeAttrs(e),t,fv.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 Mv(this,e,t.append(i),fv.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){Zv(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:fv.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 ey(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 ty=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ey(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ny=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Qv(e,r.attrs),this.excluded=null;let i=Yv(this.attrs);this.instance=i?new fv(this,i):null}create(e=null){return!e&&this.instance?this.instance:new fv(this,Xv(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){Zv(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ry=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=ov.from(e.nodes),t.marks=ov.from(e.marks||{}),this.nodes=$v.compile(this.spec.nodes,this),this.marks=ny.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]=Fv.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?iy(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==``?[]:iy(this,n.split(` `))}this.nodeFromJSON=e=>Mv.fromJSON(this,e),this.markFromJSON=e=>fv.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 $v))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 Nv(n,n.defaultAttrs,e,fv.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 iy(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 ay(e){return e.tag!=null}function oy(e){return e.style!=null}var sy=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ay(e))this.tags.push(e);else if(oy(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 gy(this,t,!1);return n.addAll(e,fv.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new gy(this,t,!0);return n.addAll(e,fv.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(vy(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=yy(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=yy(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)))}},cy={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},ly={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},uy={ol:!0,ul:!0},dy=1,fy=2,py=4;function my(e,t,n){return t==null?e&&e.whitespace==`pre`?dy|fy:n&~py:(t?dy:0)|(t===`full`?fy:0)}var hy=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=fv.none,this.match=i||(a&py?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&dy)){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&&!cy.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},gy=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=my(null,t.preserveWhitespace,0)|(n?py:0);i=r?new hy(r.type,r.attrs,fv.none,!0,t.topMatch||r.type.contentMatch,a):n?new hy(null,null,fv.none,!0,null,a):new hy(e.schema.topNodeType,null,fv.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&fy?`full`:this.localPreserveWS||(r.options&dy)>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;uy.hasOwnProperty(a)&&this.parser.normalizeLists&&_y(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ly.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(cy.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=fv.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):by(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=my(e,i,a.options);a.options&py&&a.content.length==0&&(o|=py);let s=fv.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):by(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new hy(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|=dy);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 _y(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&uy.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function vy(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function yy(e){let t={};for(let n in e)t[n]=e[n];return t}function by(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 xy=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Cy(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}=Dy(Cy(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&&Dy(Cy(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Dy(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=Sy(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Sy(e.marks)}};function Sy(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Cy(e){return e.document||window.document}var wy=new WeakMap;function Ty(e){let t=wy.get(e);return t===void 0&&wy.set(e,t=Ey(e)),t}function Ey(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 Dy(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=Ty(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}=Dy(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Oy=65535,ky=2**16;function Ay(e,t){return e+t*ky}function jy(e){return e&Oy}function My(e){return(e-(e&Oy))/ky}var Ny=1,Py=2,Fy=4,Iy=8,Ly=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Iy)>0}get deletedBefore(){return(this.delInfo&(Ny|Fy))>0}get deletedAfter(){return(this.delInfo&(Py|Fy))>0}get deletedAcross(){return(this.delInfo&Fy)>0}},Ry=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=jy(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+My(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:Ay(o/3,e-s),f=e==s?Py:e==u?Ny:Fy;return(t<0?e!=s:e!=u)&&(f|=Iy),new Ly(a,f,d)}r+=l-c}return n?e+r:new Ly(e+r,0,null)}touches(e,t){let n=0,r=jy(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])}};Ry.empty=new Ry([]);var zy=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 Ly(e,r,null)}},By=Object.create(null),Vy=class{getMap(){return Ry.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=By[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in By)throw RangeError(`Duplicate use of step JSON ID `+e);return By[e]=t,t.prototype.jsonID=e,t}},Hy=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 pv)return e.fail(t.message);throw t}}};function Uy(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Uy(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return q.fromArray(r)}var Wy=class e extends Vy{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(Uy(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 Hy.fromReplace(e,this.from,this.to,i)}invert(){return new Gy(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))}};Vy.jsonID(`addMark`,Wy);var Gy=class e extends Vy{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(Uy(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Hy.fromReplace(e,this.from,this.to,n)}invert(){return new Wy(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))}};Vy.jsonID(`removeMark`,Gy);var Ky=class e extends Vy{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hy.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Hy.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 qy(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))}};Vy.jsonID(`addNodeMark`,Ky);var qy=class e extends Vy{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hy.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Hy.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 Ky(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))}};Vy.jsonID(`removeNodeMark`,qy);var Jy=class e extends Vy{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Xy(e,this.from,this.to)?Hy.fail(`Structure replace would overwrite content`):Hy.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ry([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)}};Vy.jsonID(`replace`,Jy);var Yy=class e extends Vy{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&&(Xy(e,this.from,this.gapFrom)||Xy(e,this.gapTo,this.to)))return Hy.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Hy.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Hy.fromReplace(e,this.from,this.to,n):Hy.fail(`Content does not fit in gap`)}getMap(){return new Ry([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)}};Vy.jsonID(`replaceAround`,Yy);function Xy(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 Zy(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 Gy(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Wy(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Qy(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 ny){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 Gy(t.from,t.to,t.style)))}function $y(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 Jy(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 Gy(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 Jy(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 eb(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function tb(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||!eb(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function nb(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 Yy(c,l,o,s,new J(u.append(f),d,p),u.size-d,!0))}function rb(e,t,n=null,r=e){let i=ab(e,t),a=i&&ob(r,t);return a?i.map(ib).concat({type:t,attrs:n}).concat(a.map(ib)):null}function ib(e){return{type:e,attrs:null}}function ab(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 ob(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 sb(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 Yy(i,a,i,a,new J(r,0,0),n.length,!0))}function cb(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)&&db(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&&ub(e,t,n,a),$y(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 Yy(c,l,c+1,l-1,new J(q.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&lb(e,t,n,a),!1}})}function lb(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 ub(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 db(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function fb(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 Yy(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new J(q.from(o),0,0),1,!0))}function pb(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 mb(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 Jy(t,t,new J(a.append(o),n,n),!0))}function hb(e,t){let n=e.resolve(t),r=n.index();return _b(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function gb(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 _b(e,t){return!!(e&&t&&!e.isLeaf&&gb(e,t))}function vb(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&&_b(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 yb(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);ub(e,r.node(),r.before(),s)}o.inlineContent&&$y(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 Jy(l,c.map(t+n,-1),J.empty,!0)),r===!0){let t=e.doc.resolve(l);lb(e,t.node(),t.before(),e.steps.length)}return e}function bb(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 xb(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 Sb(e,t,n=t,r=J.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Cb(i,a,r)?new Jy(t,n,r):new wb(i,a,r).fit()}function Cb(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var wb=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 Yy(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Jy(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=Db(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=Db(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=Db(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new J(Tb(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new J(Tb(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(Ob(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=Eb(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(Tb(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new J(Tb(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||!kb(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=kb(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=kb(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=Eb(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=Eb(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=Eb(this.placed,this.frontier.length,e))}};function Tb(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Tb(e.firstChild.content,t-1,n)))}function Eb(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Eb(e.lastChild.content,t-1,n)))}function Db(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Ob(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Ob(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 kb(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&&!Ab(n,a.content,o)?s:null}function Ab(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function jb(e){return e.spec.defining||e.spec.definingForContent}function Mb(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Cb(i,a,r))return e.step(new Jy(t,n,r));let o=Ib(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=jb(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(Nb(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 Nb(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Nb(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 Pb(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=bb(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new J(q.from(r),0,0))}function Fb(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),a=Ib(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 Ib(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 Lb=class e extends Vy{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 Hy.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 Hy.fromReplace(e,this.pos,this.pos+1,new J(q.from(r),0,t.isLeaf?0:1))}getMap(){return Ry.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)}};Vy.jsonID(`attr`,Lb);var Rb=class e extends Vy{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 Hy.ok(n)}getMap(){return Ry.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)}};Vy.jsonID(`docAttr`,Rb);var zb=class extends Error{};zb=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},zb.prototype=Object.create(Error.prototype),zb.prototype.constructor=zb,zb.prototype.name=`TransformError`;var Bb=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zy}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new zb(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=Sb(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 Mb(this,e,t,n),this}replaceRangeWith(e,t,n){return Pb(this,e,t,n),this}deleteRange(e,t){return Fb(this,e,t),this}lift(e,t){return nb(this,e,t),this}join(e,t=1){return yb(this,e,t),this}wrap(e,t){return sb(this,e,t),this}setBlockType(e,t=e,n,r=null){return cb(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return fb(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Lb(e,t,n)),this}setDocAttribute(e,t){return this.step(new Rb(e,t)),this}addNodeMark(e,t){return this.step(new Ky(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof fv)t.isInSet(n.marks)&&this.step(new qy(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new qy(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 mb(this,e,t,n),this}addMark(e,t,n){return Zy(this,e,t,n),this}removeMark(e,t,n){return Qy(this,e,t,n),this}clearIncompatible(e,t,n){return $y(this,e,t,n),this}},Vb=Object.create(null),Hb=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ub(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&&$b(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),$b(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Kb(e):Qb(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?Qb(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Qb(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 Xb(e.node(0))}static atStart(e){return Qb(e,e,0,0,1)||new Xb(e)}static atEnd(e){return Qb(e,e,e.content.size,e.childCount,-1)||new Xb(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=Vb[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Vb)throw RangeError(`Duplicate use of selection JSON ID `+e);return Vb[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Kb.between(this.$anchor,this.$head).getBookmark()}};Hb.prototype.visible=!0;var Ub=class{constructor(e,t){this.$from=e,this.$to=t}},Wb=!1;function Gb(e){!Wb&&!e.parent.inlineContent&&(Wb=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Kb=class e extends Hb{constructor(e,t=e){Gb(e),Gb(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 Hb.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 qb(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=Hb.findFrom(n,r,!0)||Hb.findFrom(n,-r,!0);if(e)n=e.$head;else return Hb.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Hb.findFrom(t,-r,!0)||Hb.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};Hb.jsonID(`text`,Kb);var qb=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 Kb.between(e.resolve(this.anchor),e.resolve(this.head))}},Jb=class e extends Hb{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?Hb.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 Yb(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}};Jb.prototype.visible=!1,Hb.jsonID(`node`,Jb);var Yb=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new qb(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Jb.isSelectable(n)?new Jb(t):Hb.near(t)}},Xb=class e extends Hb{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=Hb.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 Zb}};Hb.jsonID(`all`,Xb);var Zb={map(){return this},resolve(e){return new Xb(e)}};function Qb(e,t,n,r,i,a=!1){if(t.inlineContent)return Kb.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=Qb(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&Jb.isSelectable(r))return Jb.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function $b(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Jy||i instanceof Yy))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(Hb.near(e.doc.resolve(o),n))}var ex=1,tx=2,nx=4,rx=class extends Bb{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|ex)&~tx,this.storedMarks=null,this}get selectionSet(){return(this.updated&ex)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=tx,this}ensureMarks(e){return fv.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&tx)>0}addStep(e,t){super.addStep(e,t),this.updated&=~tx,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)||fv.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(Hb.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|=nx,this}get scrolledIntoView(){return(this.updated&nx)>0}};function ix(e,t){return!t||!e?e:e.bind(t)}var ax=class{constructor(e,t,n){this.name=e,this.init=ix(t.init,n),this.apply=ix(t.apply,n)}},ox=[new ax(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new ax(`selection`,{init(e,t){return e.selection||Hb.atStart(t.doc)},apply(e){return e.selection}}),new ax(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new ax(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],sx=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ox.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 ax(e.key,e.spec.state,e))})}},cx=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 rx(this)}static create(t){let n=new sx(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 sx(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 sx(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Mv.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=Hb.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 lx(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=lx(i,t,{})),n[r]=i}return n}var ux=class{constructor(e){this.spec=e,this.props={},e.props&&lx(e.props,this,this.props),this.key=e.key?e.key.key:fx(`plugin`)}getState(e){return e[this.key]}},dx=Object.create(null);function fx(e){return e in dx?e+`$`+ ++dx[e]:(dx[e]=0,e+`$`)}var px=class{constructor(e=`key`){this.key=fx(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},mx=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function hx(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var gx=(e,t,n)=>{let r=hx(e,n);if(!r)return!1;let i=Sx(r);if(!i){let n=r.blockRange(),i=n&&tb(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(Bx(e,i,t,-1))return!0;if(r.parent.content.size==0&&(bx(a,`end`)||Jb.isSelectable(a)))for(let n=r.depth;;n--){let o=Sb(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(bx(a,`end`)?Hb.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):Jb.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},_x=(e,t,n)=>{let r=hx(e,n);if(!r)return!1;let i=Sx(r);return i?yx(e,i,t):!1},vx=(e,t,n)=>{let r=Cx(e,n);if(!r)return!1;let i=Ex(r);return i?yx(e,i,t):!1};function yx(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=Sb(e.doc,i,o,J.empty);if(!s||s.from!=i||s instanceof Jy&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(Kb.create(t.doc,i)),n(t.scrollIntoView())}return!0}function bx(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 xx=(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=Sx(r)}let o=a&&a.nodeBefore;return!o||!Jb.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Jb.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Sx(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 Cx(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var wx=(e,t,n)=>{let r=Cx(e,n);if(!r)return!1;let i=Ex(r);if(!i)return!1;let a=i.nodeAfter;if(Bx(e,i,t,1))return!0;if(r.parent.content.size==0&&(bx(a,`start`)||Jb.isSelectable(a))){let n=Sb(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(bx(a,`start`)?Hb.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):Jb.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},Tx=(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=Ex(r)}let o=a&&a.nodeAfter;return!o||!Jb.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Jb.create(e.doc,a.pos)).scrollIntoView()),!0)};function Ex(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 Dx=(e,t)=>{let n=e.selection,r=n instanceof Jb,i;if(r){if(n.node.isTextblock||!hb(e.doc,n.from))return!1;i=n.from}else if(i=vb(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(Jb.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Ox=(e,t)=>{let n=e.selection,r;if(n instanceof Jb){if(n.node.isTextblock||!hb(e.doc,n.to))return!1;r=n.to}else if(r=vb(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},kx=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&tb(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Ax=(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 jx(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 Mx=(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=jx(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(Hb.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Nx=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Xb||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=jx(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(Kb.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},Px=(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(pb(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&tb(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Fx(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof Jb&&t.selection.node.isBlock)return!r.parentOffset||!pb(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=jx(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 Kb||t.selection instanceof Xb)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=pb(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,pb(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 Ix=Fx(),Lx=(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(Jb.create(e.doc,i))),!0)},Rx=(e,t)=>(t&&t(e.tr.setSelection(new Xb(e.doc))),!0);function zx(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||hb(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Bx(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&zx(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 Yy(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&&hb(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:Hb.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&tb(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&bx(a,`start`,!0)&&bx(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 Yy(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 Vx(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(Kb.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var Hx=Vx(-1),Ux=Vx(1);function Wx(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&rb(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function Gx(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 Kx(...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 qx=Kx(mx,gx,xx),Jx=Kx(mx,wx,Tx),Yx={Enter:Kx(Ax,Nx,Px,Ix),"Mod-Enter":Mx,Backspace:qx,"Mod-Backspace":qx,"Shift-Backspace":qx,Delete:Jx,"Mod-Delete":Jx,"Mod-a":Rx},Xx={"Ctrl-h":Yx.Backspace,"Alt-Backspace":Yx[`Mod-Backspace`],"Ctrl-d":Yx.Delete,"Ctrl-Alt-Backspace":Yx[`Mod-Delete`],"Alt-Delete":Yx[`Mod-Delete`],"Alt-d":Yx[`Mod-Delete`],"Ctrl-a":Hx,"Ctrl-e":Ux};for(let e in Yx)Xx[e]=Yx[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function Zx(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 Qx(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Qx(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 Av(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Av(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=rb(a,n,r,t);return s?(e&&$x(e,t,s,i,n),!0):!1}function $x(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 Yy(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&&pb(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function eS(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?tS(t,n,e,a):nS(t,n,a):!0:!1}}function tS(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Yy(a-1,o,a,o,new J(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Av(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=tb(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return hb(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function nS(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 Yy(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 rS(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 Yy(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var iS=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},aS=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},oS=null,sS=function(e,t,n){let r=oS||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},cS=function(){oS=null},lS=function(e,t,n,r){return n&&(dS(e,t,n,r,-1)||dS(e,t,n,r,1))},uS=/^(img|br|input|textarea|hr)$/i;function dS(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:fS(e))){let n=e.parentNode;if(!n||n.nodeType!=1||gS(e)||uS.test(e.nodeName)||e.contentEditable==`false`)return!1;t=iS(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?fS(e):0}else return!1}}function fS(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function pS(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=fS(e)}else if(e.parentNode&&!gS(e))t=iS(e),e=e.parentNode;else return null}}function mS(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&&!gS(e))t=iS(e)+1,e=e.parentNode;else return null}}function hS(e,t,n){for(let r=t==0,i=t==fS(e);r||i;){if(e==n)return!0;let t=iS(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==fS(e)}}function gS(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 _S=function(e){return e.focusNode&&lS(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function vS(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function yS(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function bS(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(fS(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(fS(r.startContainer),r.startOffset)}}}var xS=typeof navigator<`u`?navigator:null,SS=typeof document<`u`?document:null,CS=xS&&xS.userAgent||``,wS=/Edge\/(\d+)/.exec(CS),TS=/MSIE \d/.exec(CS),ES=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(CS),DS=!!(TS||ES||wS),OS=TS?document.documentMode:ES?+ES[1]:wS?+wS[1]:0,kS=!DS&&/gecko\/(\d+)/i.test(CS);kS&&+(/Firefox\/(\d+)/.exec(CS)||[0,0])[1];var AS=!DS&&/Chrome\/(\d+)/.exec(CS),jS=!!AS,MS=AS?+AS[1]:0,NS=!DS&&!!xS&&/Apple Computer/.test(xS.vendor),PS=NS&&(/Mobile\/\w+/.test(CS)||!!xS&&xS.maxTouchPoints>2),FS=PS||(xS?/Mac/.test(xS.platform):!1),IS=xS?/Win/.test(xS.platform):!1,LS=/Android \d/.test(CS),RS=!!SS&&`webkitFontSmoothing`in SS.documentElement.style,zS=RS?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BS(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 VS(e,t){return typeof e==`number`?e:e[t]}function HS(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 US(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=aS(o);continue}let e=o,n=e==a.body,s=n?BS(a):HS(e),c=0,l=0;if(t.top<s.top+VS(r,`top`)?l=-(s.top-t.top+VS(i,`top`)):t.bottom>s.bottom-VS(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+VS(i,`top`)-s.top:t.bottom-s.bottom+VS(i,`bottom`)),t.left<s.left+VS(r,`left`)?c=-(s.left-t.left+VS(i,`left`)):t.right>s.right-VS(r,`right`)&&(c=t.right-s.right+VS(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:aS(o)}}function WS(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:GS(e.dom)}}function GS(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=aS(r));return t}function KS({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;qS(n,r==0?0:r-t)}function qS(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 JS=null;function YS(e){if(e.setActive)return e.setActive();if(JS)return e.focus(JS);let t=GS(e);e.focus(JS==null?{get preventScroll(){return JS={preventScroll:!0},!0}}:void 0),JS||(JS=!1,qS(t,0))}function XS(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=sS(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?ZS(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:XS(n,i)}function ZS(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=aC(r,1);if(n.top!=n.bottom&&QS(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 QS(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function $S(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function eC(e,t,n){let{node:r,offset:i}=XS(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 tC(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 nC(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(QS(t,i))return nC(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function rC(e,t){let n=e.dom.ownerDocument,r,i=0,a=bS(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(!QS(t,n)||(o=nC(e.dom,t,n),!o))return null}if(NS)for(let e=o;r&&e;e=aS(e))e.draggable&&(r=void 0);if(o=$S(o,t),r){if(kS&&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;RS&&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=tC(e,r,i,t))}s??=eC(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function iC(e){return e.top<e.bottom||e.left<e.right}function aC(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(iC(e))return e}return Array.prototype.find.call(n,iC)||e.getBoundingClientRect()}var oC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sC(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=RS||kS;if(r.nodeType==3)if(o&&(oC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=aC(sS(r,i,i),n);if(kS&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=aC(sS(r,i-1,i-1),-1);if(t.top==e.top){let n=aC(sS(r,i,i+1),-1);if(n.top!=e.top)return cC(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++,cC(aC(sS(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==fS(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return lC(e.getBoundingClientRect(),!1)}if(a==null&&i<fS(r)){let e=r.childNodes[i];if(e.nodeType==1)return lC(e.getBoundingClientRect(),!0)}return lC(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==fS(r))){let e=r.childNodes[i-1],t=e.nodeType==3?sS(e,fS(e)-(o?0:1)):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return cC(aC(t,1),!1)}if(a==null&&i<fS(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?sS(e,0,o?0:1):e.nodeType==1?e:null:null;if(t)return cC(aC(t,-1),!0)}return cC(aC(r.nodeType==3?sS(r):r,-n),n>=0)}function cC(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 lC(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 uC(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 dC(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return uC(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=sC(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=sS(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 fC=/[\u0590-\u08ac]/;function pC(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?!fC.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:uC(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 mC=null,hC=null,gC=!1;function _C(e,t,n){return mC==t&&hC==n?gC:(mC=t,hC=n,gC=n==`up`||n==`down`?dC(e,t,n):pC(e,t,n))}var vC=0,yC=1,bC=2,xC=3,SC=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=vC,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>iS(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 kC){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 CC&&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?iS(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?iS(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=iS(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=iS(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((kS||NS)&&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:iS(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(kS&&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&&NS)&&lS(o.node,o.offset,l.anchorNode,l.anchorOffset)&&lS(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&kS)){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?bC:yC,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=xC:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?bC:xC}n=a}this.dirty=bC}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?bC:yC;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},CC=class extends SC{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==vC&&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}},wC=class extends SC{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}},TC=class e extends SC{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=xy.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&xC||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xC&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=vC){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=vC}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=KC(a,n,o,r)),t>0&&(a=KC(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()}},EC=class e extends SC{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=xy.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=LC(u,r,n),l?c=new AC(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new OC(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==vC&&e.eq(this.node)&&RC(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 BC(this,a&&a.node,e);UC(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?fv.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==bC)&&(a&&this.protectLocalComposition(e,a),jC(this.contentDOM,this.children,e),PS&&WC(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Kb)||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=GC(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 wC(this,i,t,r);e.input.compositionNodes.push(a),this.children=KC(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==xC||!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=vC}updateOuterDeco(e){if(RC(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=FC(this.dom,this.nodeDOM,PC(this.outerDeco,this.node,t),PC(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 DC(e,t,n,r,i){LC(r,t,e);let a=new EC(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var OC=class e extends EC{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==xC||this.dirty!=vC&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=vC||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=vC,!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=xC)}get domAtom(){return!1}isText(e){return this.node.text==e}},kC=class extends SC{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==vC&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},AC=class extends EC{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==xC)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 jC(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=zC(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof TC){let t=r?r.previousSibling:e.lastChild;jC(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=zC(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var MC=function(e){e&&(this.nodeName=e)};MC.prototype=Object.create(null);var NC=[new MC];function PC(e,t,n){if(e.length==0)return NC;let r=n?NC[0]:new MC,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new MC(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new MC(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 FC(e,t,n,r){if(n==NC&&r==NC)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=NC[0],i=t)}IC(i,o||NC[0],a)}return i}function IC(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 LC(e,t,n){return FC(e,e,NC,PC(t,n,e.nodeType!=1))}function RC(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 zC(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var BC=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=VC(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=vC,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=TC.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==xC&&a.dom==a.contentDOM&&(a.dirty=bC),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 EC){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!=xC&&RC(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=bC,u.updateChildren(r,a+1),u.dirty=vC),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)||!RC(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=EC.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=EC.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 CC(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 TC;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof OC)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((NS||jS)&&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 kC(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 VC(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 TC)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 HC(e,t){return e.type.side-t.type.side}function UC(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(HC);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 WC(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 GC(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 KC(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 qC(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(_S(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&Jb.isSelectable(e)&&i.parent&&!(e.isInline&&hS(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new Jb(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=iw(e,u,s,n)}return l}function JC(e){return e.editable?e.hasFocus():ow(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function YC(e,t=!1){let n=e.state.selection;if(nw(e,n),JC(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&jS){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&lS(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)tw(e);else{let{anchor:r,head:i}=n,a,o;XC&&!(n instanceof Kb)&&(n.$from.parent.inlineContent||(a=ZC(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ZC(e,n.to))),e.docView.setSelection(r,i,e,t),XC&&(a&&$C(a),o&&$C(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&ew(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var XC=NS||jS&&MS<63;function ZC(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(NS&&i&&i.contentEditable==`false`)return QC(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return QC(i);if(a)return QC(a)}}function QC(e){return e.contentEditable=`true`,NS&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function $C(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function ew(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(()=>{(!JC(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function tw(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,iS(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&DS&&OS<=11&&(n.disabled=!0,n.disabled=!1)}function nw(e,t){if(t instanceof Jb){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(rw(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else rw(e)}function rw(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function iw(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||Kb.between(t,n,r)}function aw(e){return e.editable&&!e.hasFocus()?!1:ow(e)}function ow(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 sw(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return lS(t.node,t.offset,n.anchorNode,n.anchorOffset)}function cw(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&&Hb.findFrom(a,t)}function lw(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function uw(e,t,n){let r=e.state.selection;if(r instanceof Kb){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 lw(e,new Kb(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=cw(e.state,t);return n&&n instanceof Jb?lw(e,n):!1}else if(!(FS&&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?Jb.isSelectable(i)?lw(e,new Jb(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):RS?lw(e,new Kb(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof Jb&&r.node.isInline)return lw(e,new Kb(t>0?r.$to:r.$from));else{let n=cw(e.state,t);return n?lw(e,n):!1}}function dw(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function fw(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function pw(e,t){return t<0?mw(e):hw(e)}function mw(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(kS&&n.nodeType==1&&r<dw(n)&&fw(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(fw(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(gw(n))break;else{let t=n.previousSibling;for(;t&&fw(t,-1);)i=n.parentNode,a=iS(t),t=t.previousSibling;if(t)n=t,r=dw(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?yw(e,n,r):i&&yw(e,i,a)}function hw(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=dw(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(fw(e,1))a=n,o=++r;else break}else if(gw(n))break;else{let t=n.nextSibling;for(;t&&fw(t,1);)a=t.parentNode,o=iS(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=dw(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&yw(e,a,o)}function gw(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function _w(e,t){for(;e&&t==e.childNodes.length&&!gS(e);)t=iS(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 vw(e,t){for(;e&&!t&&!gS(e);)t=iS(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 yw(e,t,n){if(t.nodeType!=3){let e,r;(r=_w(t,n))?(t=r,n=0):(e=vw(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(_S(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&&YC(e)},50)}function bw(e,t){let n=e.state.doc.resolve(t);if(!(jS||IS)&&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 xw(e,t,n){let r=e.state.selection;if(r instanceof Kb&&!r.empty||n.indexOf(`s`)>-1||FS&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=cw(e.state,t);if(n&&n instanceof Jb)return lw(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Xb?Hb.near(n,t):Hb.findFrom(n,t);return o?lw(e,o):!1}return!1}function Sw(e,t){if(!(e.state.selection instanceof Kb))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 Cw(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ww(e){if(!NS||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;Cw(e,n,`true`),setTimeout(()=>Cw(e,n,`false`),20)}return!1}function Tw(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Ew(e,t){let n=t.keyCode,r=Tw(t);if(n==8||FS&&n==72&&r==`c`)return Sw(e,-1)||pw(e,-1);if(n==46&&!t.shiftKey||FS&&n==68&&r==`c`)return Sw(e,1)||pw(e,1);if(n==13||n==27)return!0;if(n==37||FS&&n==66&&r==`c`){let t=n==37?bw(e,e.state.selection.from)==`ltr`?-1:1:-1;return uw(e,t,r)||pw(e,t)}else if(n==39||FS&&n==70&&r==`c`){let t=n==39?bw(e,e.state.selection.from)==`ltr`?1:-1:1;return uw(e,t,r)||pw(e,t)}else if(n==38||FS&&n==80&&r==`c`)return xw(e,-1,r)||pw(e,-1);else if(n==40||FS&&n==78&&r==`c`)return ww(e)||xw(e,1,r)||pw(e,1);else if(r==(FS?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Dw(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`)||xy.fromSchema(e.state.schema),s=Rw(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=Iw[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 Ow(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=xy.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=Vw(n),RS&&Hw(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`)||sy.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!kw.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=Uw(Fw(s,+u[1],+u[2]),u[4]);else if(s=J.maxOpen(Aw(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=Fw(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var kw=/^(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 Aw(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&&Mw(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=Nw(a[a.length-1],i.length));let n=jw(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return q.from(a)}return e}function jw(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function Mw(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=Mw(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(jw(n,e,i+1))))}}function Nw(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,Nw(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function Pw(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=Pw(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 Fw(e,t,n){return t<e.openStart&&(e=new J(Pw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new J(Pw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var Iw={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},Lw=null;function Rw(){return Lw||=document.implementation.createHTMLDocument(`title`)}var zw=null;function Bw(e){let t=window.trustedTypes;return t?(zw||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),zw.createHTML(e)):e}function Vw(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Rw().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&Iw[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=Bw(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function Hw(e){let t=e.querySelectorAll(jS?`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 Uw(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 Ww={},Gw={},Kw={touchstart:!0,touchmove:!0},qw=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 Jw(e){for(let t in Ww){let n=Ww[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{$w(e,t)&&!Qw(e,t)&&(e.editable||!(t.type in Gw))&&n(e,t)},Kw[t]?{passive:!0}:void 0)}NS&&e.dom.addEventListener(`input`,()=>null),Zw(e)}function Yw(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Xw(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 Zw(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Qw(e,t))})}function Qw(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function $w(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 eT(e,t){!Qw(e,t)&&Ww[t.type]&&(e.editable||!(t.type in Gw))&&Ww[t.type](e,t)}Gw.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!mT(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(LS&&jS&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),PS&&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,vS(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Ew(e,n)?n.preventDefault():Yw(e,`key`)},Gw.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Gw.keypress=(e,t)=>{let n=t;if(mT(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||FS&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Kb)||!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 tT(e){return{left:e.clientX,top:e.clientY}}function nT(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function rT(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 iT(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 aT(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Jb.isSelectable(r)?(iT(e,new Jb(n),`pointer`),!0):!1}function oT(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof Jb&&(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(Jb.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:(iT(e,Jb.create(e.state.doc,i),`pointer`),!0)}function sT(e,t,n,r,i){return rT(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?oT(e,n):aT(e,n))}function cT(e,t,n,r){return rT(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function lT(e,t,n,r){return rT(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||uT(e,n,r)}function uT(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(iT(e,Kb.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)iT(e,Kb.create(r,a+1,a+1+n.content.size),`pointer`);else if(Jb.isSelectable(n))iT(e,Jb.create(r,a),`pointer`);else continue;return!0}}function dT(e){return xT(e)}var fT=FS?`metaKey`:`ctrlKey`;Ww.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=dT(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&nT(n,e.input.lastClick)&&!n[fT]&&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(tT(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new pT(e,o,n,!!r)):(a==`doubleClick`?cT:lT)(e,o.pos,o.inside,n)?n.preventDefault():Yw(e,`pointer`))};var pT=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[fT],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 Jb&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&kS&&!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)),Yw(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(()=>YC(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(tT(e))),this.updateAllowDefault(e),this.allowDefault||!t?Yw(this.view,`pointer`):sT(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||NS&&this.mightDrag&&!this.mightDrag.node.isAtom||jS&&!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)?(iT(this.view,Hb.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):Yw(this.view,`pointer`)}move(e){this.updateAllowDefault(e),Yw(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)}};Ww.touchstart=e=>{e.input.lastTouch=Date.now(),dT(e),Yw(e,`pointer`)},Ww.touchmove=e=>{e.input.lastTouch=Date.now(),Yw(e,`pointer`)},Ww.contextmenu=e=>dT(e);function mT(e,t){return e.composing?!0:NS&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var hT=LS?5e3:-1;Gw.compositionstart=Gw.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Kb&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||jS&&IS&&gT(e)))e.markCursor=e.state.storedMarks||n.marks(),xT(e,!0),e.markCursor=null;else if(xT(e,!t.selection.empty),kS&&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}_T(e,hT)};function gT(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`}Gw.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++,_T(e,20))};function _T(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>xT(e),t))}function vT(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=bT());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yT(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=pS(t.focusNode,t.focusOffset),r=mS(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 bT(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function xT(e,t=!1){if(!(LS&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),vT(e),t||e.docView&&e.docView.dirty){let n=qC(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 ST(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 CT=DS&&OS<15||PS&&zS<604;Ww.copy=Gw.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=CT?null:n.clipboardData,{dom:o,text:s}=Dw(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):ST(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function wT(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function TT(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?ET(e,r.value,null,i,t):ET(e,r.textContent,r.innerHTML,i,t)},50)}function ET(e,t,n,r,i){let a=Ow(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=wT(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 DT(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,` `):``}Gw.paste=(e,t)=>{let n=t;if(e.composing&&!LS)return;let r=CT?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&ET(e,DT(r),r.getData(`text/html`),i,n)?n.preventDefault():TT(e,n)};var OT=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},kT=FS?`altKey`:`ctrlKey`;function AT(e,t){return e.someProp(`dragCopies`,e=>!e(t))??!t[kT]}Ww.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(tT(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof Jb?i.to-1:i.to))){if(r&&r.mightDrag)o=Jb.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=Jb.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Dw(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!jS||MS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(CT?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,CT||n.dataTransfer.setData(`text/plain`,c),e.dragging=new OT(l,AT(e,n),o)},Ww.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Gw.dragover=Gw.dragenter=(e,t)=>t.preventDefault(),Gw.drop=(e,t)=>{try{jT(e,t,e.dragging)}finally{e.dragging=null}};function jT(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(tT(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=Ow(e,DT(t.dataTransfer),CT?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&AT(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?xb(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&&Jb.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new Jb(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(iw(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}Ww.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())&&YC(e)},20))},Ww.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)},Ww.beforeinput=(e,t)=>{if(jS&&LS&&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,vS(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 Gw)Ww[e]=Gw[e];function MT(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 NT=class e{constructor(e,t){this.toDOM=e,this.spec=t||RT,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 IT(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&&MT(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},PT=class e{constructor(e,t){this.attrs=e,this.spec=t||RT}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 IT(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&MT(this.attrs,t.attrs)&&MT(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},FT=class e{constructor(e,t){this.attrs=e,this.spec=t||RT}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 IT(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&&MT(this.attrs,t.attrs)&&MT(this.spec,t.spec)}destroy(){}},IT=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 NT(n,r))}static inline(t,n,r,i){return new e(t,n,new PT(r,i))}static node(t,n,r,i){return new e(t,n,new FT(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof PT}get widget(){return this.type instanceof NT}},LT=[],RT={},zT=class e{constructor(e,t){this.local=e.length?e:LT,this.children=t.length?t:LT}static create(e,t){return t.length?qT(t,e,0,RT):BT}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==BT||e.maps.length==0?this:this.mapInner(e,t,0,0,n||RT)}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?HT(this.children,o||[],t,n,r,i,a):o?new e(o.sort(JT),LT):BT}add(t,n){return n.length?this==BT?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=GT(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,qT(s,e,o+1,RT)),a+=3}});let o=UT(a?KT(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(JT):this.local,i||this.children)}remove(e){return e.length==0||this==BT?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==BT?(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):BT}forChild(t,n){if(this==BT)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 PT){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(JT),LT);return r?new VT([t,r]):t}return r||BT}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 YT(this.localsInner(e))}localsInner(e){if(this==BT)return LT;if(e.inlineContent||!this.local.some(PT.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof PT||t.push(this.local[e]);return t}forEachSet(e){e(this)}};zT.empty=new zT([],[]),zT.removeOverlap=YT;var BT=zT.empty,VT=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,RT));return e.from(r)}forChild(t,n){if(n.isLeaf)return zT.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=BT&&(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?YT(n?t:t.sort(JT)):LT}static from(t){switch(t.length){case 0:return BT;case 1:return t[0];default:return new e(t.every(e=>e instanceof zT)?t:t.reduce((e,t)=>e.concat(t instanceof zT?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function HT(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==BT?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=qT(WT(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 zT(t.sort(JT),s)}function UT(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 IT(i.from+t,i.to+t,i.type))}return n}function WT(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 GT(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 KT(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function qT(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=GT(e,t,o+n);if(s){a=!0;let e=qT(s,t,n+o+1,r);e!=BT&&i.push(o,o+t.nodeSize,e)}});let o=UT(a?KT(e):e,-n).sort(JT);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 zT(o,i):BT}function JT(e,t){return e.from-t.from||e.to-t.to}function YT(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),XT(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),XT(t,i,r.copy(a.from,r.to)));break}}}return t}function XT(e,t,n){for(;t<e.length&&JT(n,e[t])>0;)t++;e.splice(t,0,n)}function ZT(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=BT&&t.push(r)}),e.cursorWrapper&&t.push(zT.create(e.state.doc,[e.cursorWrapper.deco])),VT.from(t)}var QT={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$T=DS&&OS<=11,eE=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}},tE=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new eE,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]);DS&&OS<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():NS&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),$T&&(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,QT)),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(aw(this.view)){if(this.suppressingSelectionUpdates)return YC(this.view);if(DS&&OS<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&lS(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=aS(n))t.add(n);for(let r=e.anchorNode;r;r=aS(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)&&aw(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(kS&&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||sE(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&&_S(n)&&(c=qC(e))&&c.eq(Hb.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,YC(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),iE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,cE(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||YC(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(DS&&OS<=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?iS(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?iS(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}}},nE=new WeakMap,rE=!1;function iE(e){if(!nE.has(e)&&(nE.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=kS,rE)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.`),rE=!0}}function aE(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return lS(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function oE(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return aE(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?aE(e,n):null}function sE(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 cE(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 lE(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}],_S(c)||l.push({node:c.focusNode,offset:c.focusOffset})),jS&&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`)||sy.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:uE,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 uE(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(NS&&/^(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||NS&&/^(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 dE=/^(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 fE(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=qC(e,t);if(n&&!e.state.selection.eq(n)){if(jS&&LS&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,vS(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=lE(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=_E(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(PS&&e.input.lastIOSEnter>Date.now()-225||LS)&&i.some(e=>e.nodeType==1&&!dE.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,vS(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof Kb&&!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=pE(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 Kb&&(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)),DS&&OS<=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((PS&&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,vS(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&hE(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,vS(8,`Backspace`)))){LS&&jS&&e.domObserver.suppressSelectionUpdates();return}jS&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),LS&&!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,vS(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=pE(e,n.doc,l.sel);t&&!(jS&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||DS&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){DS&&OS<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>YC(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=mE(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 pE(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:iw(e,t.resolve(n.anchor),t.resolve(n.head))}function mE(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 hE(e,t,n,r,i){if(n-t<=i.pos-r.pos||gE(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(gE(a,!0,!0));return!o.parent.isTextblock||o.pos>n||gE(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function gE(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 _E(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&&vE(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&&vE(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function vE(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 yE=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 qw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(EE),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=SE(this),xE(this),this.nodeViews=wE(this),this.docView=DC(this.state.doc,bE(this),ZT(this),this.dom,this),this.domObserver=new tE(this,(e,t,n,r)=>fE(this,e,t,n,r)),this.domObserver.start(),Jw(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&&Zw(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(EE),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&&(vT(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=wE(this);TE(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Zw(this),this.editable=SE(this),xE(this);let o=ZT(this),s=bE(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&&WS(this);if(i){this.domObserver.stop();let t=l&&(DS||jS)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&CE(n.selection,e.selection);if(l){let n=jS?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yT(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=DC(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())&&sw(this))?YC(this,t):(nw(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&&KS(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 Jb){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&US(this,t.getBoundingClientRect(),e)}else US(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 OT(e.slice,e.move,r<0?void 0:Jb.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(DS){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&&YS(this.dom),YC(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 rC(this,e)}coordsAtPos(e,t=1){return sC(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 _C(this,t||this.state,e)}pasteHTML(e,t){return ET(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return ET(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Dw(this,e)}destroy(){this.docView&&(Xw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ZT(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cS())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return eT(this,e)}domSelectionRange(){let e=this.domSelection();return e?NS&&this.root.nodeType===11&&yS(this.dom.ownerDocument)==this.dom&&oE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};yE.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function bE(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`,[IT.node(0,e.state.doc.content.size,t)]}function xE(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:IT.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function SE(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function CE(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 wE(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 TE(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 EE(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 DE={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:`'`},OE={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},kE=typeof navigator<`u`&&/Mac/.test(navigator.platform),AE=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),jE=0;jE<10;jE++)DE[48+jE]=DE[96+jE]=String(jE);for(var jE=1;jE<=24;jE++)DE[jE+111]=`F`+jE;for(var jE=65;jE<=90;jE++)DE[jE]=String.fromCharCode(jE+32),OE[jE]=String.fromCharCode(jE);for(var ME in DE)OE.hasOwnProperty(ME)||(OE[ME]=DE[ME]);function NE(e){var t=!(kE&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||AE&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?OE:DE)[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 PE=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),FE=typeof navigator<`u`&&/Win/.test(navigator.platform);function IE(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))PE?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 LE(e){let t=Object.create(null);for(let n in e)t[IE(n)]=e[n];return t}function RE(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 zE(e){return new ux({props:{handleKeyDown:BE(e)}})}function BE(e){let t=LE(e);return function(e,n){let r=NE(n),i,a=t[RE(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[RE(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(FE&&n.ctrlKey&&n.altKey)&&(i=DE[n.keyCode])&&i!=r){let r=t[RE(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var VE=Object.defineProperty,HE=(e,t)=>{for(var n in t)VE(e,n,{get:t[n],enumerable:!0})};function UE(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 WE=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:UE({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}},GE={};HE(GE,{blur:()=>KE,clearContent:()=>qE,clearNodes:()=>JE,command:()=>YE,createParagraphNear:()=>XE,cut:()=>ZE,deleteCurrentNode:()=>QE,deleteNode:()=>eD,deleteRange:()=>tD,deleteSelection:()=>nD,enter:()=>rD,exitCode:()=>iD,extendMarkRange:()=>dD,first:()=>fD,focus:()=>yD,forEach:()=>bD,insertContent:()=>xD,insertContentAt:()=>DD,joinBackward:()=>AD,joinDown:()=>kD,joinForward:()=>jD,joinItemBackward:()=>MD,joinItemForward:()=>ND,joinTextblockBackward:()=>PD,joinTextblockForward:()=>FD,joinUp:()=>OD,keyboardShortcut:()=>RD,lift:()=>BD,liftEmptyBlock:()=>VD,liftListItem:()=>HD,newlineInCode:()=>UD,resetAttributes:()=>KD,scrollIntoView:()=>qD,selectAll:()=>JD,selectNodeBackward:()=>YD,selectNodeForward:()=>XD,selectParentNode:()=>ZD,selectTextblockEnd:()=>QD,selectTextblockStart:()=>$D,setContent:()=>tO,setMark:()=>XO,setMeta:()=>ZO,setNode:()=>QO,setNodeSelection:()=>$O,setTextDirection:()=>ek,setTextSelection:()=>tk,sinkListItem:()=>nk,splitBlock:()=>ik,splitListItem:()=>ak,toggleList:()=>ck,toggleMark:()=>lk,toggleNode:()=>uk,toggleWrap:()=>dk,undoInputRule:()=>fk,unsetAllMarks:()=>pk,unsetMark:()=>mk,unsetTextDirection:()=>hk,updateAttributes:()=>gk,wrapIn:()=>_k,wrapInList:()=>vk});var KE=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),qE=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),JE=()=>({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=tb(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},YE=e=>t=>e(t),XE=()=>({state:e,dispatch:t})=>Nx(e,t),ZE=(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 Kb(r.doc.resolve(Math.max(o-1,0)))),!0},QE=()=>({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 $E(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 eD=e=>({tr:t,state:n,dispatch:r})=>{let i=$E(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},tD=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},nD=()=>({state:e,dispatch:t})=>mx(e,t),rD=()=>({commands:e})=>e.keyboardShortcut(`Enter`),iD=()=>({state:e,dispatch:t})=>Mx(e,t);function aD(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function oD(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:aD(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function sD(e,t,n={}){return e.find(e=>e.type===t&&oD(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function cD(e,t,n={}){return!!sD(e,t,n)}function lD(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,!sD([...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&&cD([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&cD([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function uD(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 dD=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=uD(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=lD(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=Kb.create(o,e.from,e.to);n.setSelection(t)}}return!0},fD=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 pD(e){return e instanceof Kb}function mD(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function hD(e,t=null){if(!t)return null;let n=Hb.atStart(e),r=Hb.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?Kb.create(e,mD(0,i,a),mD(e.content.size,i,a)):Kb.create(e,mD(t,i,a),mD(t,i,a))}function gD(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function _D(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function vD(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var yD=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(_D()||gD())&&r.dom.focus(),vD()&&!_D()&&!gD()&&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&&!pD(n.state.selection))return o(),!0;let s=hD(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},bD=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),xD=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),SD=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&&SD(r)}return e};function CD(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 SD(n)}function wD(e,t,n){if(e instanceof Mv||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),wD(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new ry({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?sy.fromSchema(a).parseSlice(CD(e),n.parseOptions):sy.fromSchema(a).parse(CD(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=sy.fromSchema(t);return n.slice?r.parseSlice(CD(e),n.parseOptions).content:r.parse(CD(e),n.parseOptions)}return wD(``,t,n)}function TD(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Jy||i instanceof Yy))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(Hb.near(e.doc.resolve(o),n))}var ED=e=>!(`type`in e),DD=(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{wD(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=wD(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((ED(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&&TD(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},OD=()=>({state:e,dispatch:t})=>Dx(e,t),kD=()=>({state:e,dispatch:t})=>Ox(e,t),AD=()=>({state:e,dispatch:t})=>gx(e,t),jD=()=>({state:e,dispatch:t})=>wx(e,t),MD=()=>({state:e,dispatch:t,tr:n})=>{try{let r=vb(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ND=()=>({state:e,dispatch:t,tr:n})=>{try{let r=vb(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},PD=()=>({state:e,dispatch:t})=>_x(e,t),FD=()=>({state:e,dispatch:t})=>vx(e,t);function ID(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function LD(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))_D()||ID()?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 RD=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=LD(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 zD(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?$E(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=>oD(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var BD=(e,t={})=>({state:n,dispatch:r})=>zD(n,$E(e,n.schema),t)?kx(n,r):!1,VD=()=>({state:e,dispatch:t})=>Px(e,t),HD=e=>({state:t,dispatch:n})=>eS($E(e,t.schema))(t,n),UD=()=>({state:e,dispatch:t})=>Ax(e,t);function WD(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function GD(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 KD=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=WD(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=$E(e,r.schema)),s===`mark`&&(o=uD(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,GD(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(GD(a.attrs,t))))})})}),c},qD=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),JD=()=>({tr:e,dispatch:t})=>{if(t){let t=new Xb(e.doc);e.setSelection(t)}return!0},YD=()=>({state:e,dispatch:t})=>xx(e,t),XD=()=>({state:e,dispatch:t})=>Tx(e,t),ZD=()=>({state:e,dispatch:t})=>Lx(e,t),QD=()=>({state:e,dispatch:t})=>Ux(e,t),$D=()=>({state:e,dispatch:t})=>Hx(e,t);function eO(e,t,n={},r={}){return wD(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var tO=(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=eO(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 nO(e,t){let n=uD(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 rO(e,t){let n=new Bb(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function iO(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 aO(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function oO(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 sO(e){return t=>oO(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 cO(e){return e.map(e=>{let t=Y(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...cO(t())]:e}).flat(10)}function lO(e,t){let n=xy.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function uO(e){return typeof e==`function`}function dO(e,t=void 0,...n){return uO(e)?t?e.bind(t)(...n):e(...n):e}function fO(e={}){return Object.keys(e).length===0&&e.constructor===Object}function pO(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function mO(e){let t=[],{nodeExtensions:n,markExtensions:r}=pO(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 hO(...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 gO(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)=>hO(e,t),{})}function _O(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function vO(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):_O(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function yO(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&fO(t)?!1:t!=null))}function bO(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 xO(e,t){let n=mO(e),{nodeExtensions:r,markExtensions:i}=pO(e);return new ry({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=yO({...e.reduce((e,t)=>{let n=Y(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:dO(Y(r,`content`,a)),marks:dO(Y(r,`marks`,a)),group:dO(Y(r,`group`,a)),inline:dO(Y(r,`inline`,a)),atom:dO(Y(r,`atom`,a)),selectable:dO(Y(r,`selectable`,a)),draggable:dO(Y(r,`draggable`,a)),code:dO(Y(r,`code`,a)),whitespace:dO(Y(r,`whitespace`,a)),linebreakReplacement:dO(Y(r,`linebreakReplacement`,a)),defining:dO(Y(r,`defining`,a)),isolating:dO(Y(r,`isolating`,a)),attrs:Object.fromEntries(i.map(bO))}),s=dO(Y(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>vO(e,i)));let c=Y(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:gO(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=yO({...e.reduce((e,t)=>{let n=Y(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:dO(Y(r,`inclusive`,a)),excludes:dO(Y(r,`excludes`,a)),group:dO(Y(r,`group`,a)),spanning:dO(Y(r,`spanning`,a)),code:dO(Y(r,`code`,a)),attrs:Object.fromEntries(i.map(bO))}),s=dO(Y(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>vO(e,i)));let c=Y(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:gO(e,i)})),[r.name,o]}))})}function SO(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function CO(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 wO(e){let t=CO(cO(e)),n=SO(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 TO(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 EO(e,t){return TO(e,{from:0,to:e.content.size},t)}function DO(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function OO(e,t){let n=$E(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 kO(e,t){let n=WD(typeof t==`string`?t:t.name,e.schema);return n===`node`?OO(e,t):n===`mark`?nO(e,t):{}}function AO(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 jO(e){let t=AO(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 MO(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}})})}),jO(r)}function NO(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=lD(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 PO=(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 FO(e,t){return t.nodes[e]||t.marks[e]||null}function IO(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 LO=(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 RO(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?uD(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>oD(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=>oD(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 zO(e,t,n={}){if(!t)return zD(e,null,n)||RO(e,null,n);let r=WD(t,e.schema);return r===`node`?zD(e,t,n):r===`mark`?RO(e,t,n):!1}var BO=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=sO(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)},VO=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function HO(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function UO(e,t){let{nodeExtensions:n}=pO(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=dO(Y(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function WO(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&&(WO(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function GO(e){return e instanceof Jb}var KO=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function qO(e,t){let n=t.mapping.mapResult(e.position);return{position:new KO(n.pos),mapResult:n}}function JO(e){return new KO(e)}function YO(e,t,n){let{selection:r}=t,i=null;if(pD(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 XO=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=uD(e,r.schema);if(i)if(o){let e=nO(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 YO(r,n,c)},ZO=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),QO=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=$E(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>Gx(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>Gx(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},$O=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=mD(e,0,n.content.size),i=Jb.create(n,r);t.setSelection(i)}return!0},ek=(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},tk=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=Kb.atStart(n).from,o=Kb.atEnd(n).to,s=mD(r,a,o),c=mD(i,a,o),l=Kb.create(n,s,c);t.setSelection(l)}return!0},nk=e=>({state:t,dispatch:n})=>rS($E(e,t.schema))(t,n);function rk(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 ik=({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=IO(l,s.node().type.name,s.node().attrs);if(a instanceof Jb&&a.node.isBlock)return!s.parentOffset||!pb(o,s.pos)?!1:(r&&(e&&rk(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:iO(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=pb(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&pb(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 Kb&&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&&rk(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},ak=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=$E(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={...IO(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(Kb.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...IO(d,u.type.name,u.attrs),...t},m={...IO(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(!pb(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},ok=(e,t)=>{let n=sO(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&&hb(e.doc,n.pos)&&e.join(n.pos),!0},sk=(e,t)=>{let n=sO(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&&hb(e.doc,r)&&e.join(r),!0},ck=(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=$E(e,o.schema),m=$E(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=sO(e=>UO(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(UO(x.node.type.name,d)&&p.validContent(x.node.content)&&s)return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>ok(a,p)).command(()=>sk(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>ok(a,p)).command(()=>sk(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(()=>ok(a,p)).command(()=>sk(a,p)).run()},lk=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=uD(e,r.schema);return RO(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},uk=(e,t,n={})=>({state:r,commands:i})=>{let a=$E(e,r.schema),o=$E(t,r.schema),s=zD(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})},dk=(e,t={})=>({state:n,commands:r})=>{let i=$E(e,n.schema);return zD(n,i,t)?r.lift(i):r.wrapIn(i,t)},fk=()=>({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},pk=()=>({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},mk=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=uD(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=lD(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},hk=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},gk=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=WD(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=$E(e,r.schema)),s===`mark`&&(o=uD(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},_k=(e,t={})=>({state:n,dispatch:r})=>Wx($E(e,n.schema),t)(n,r),vk=(e,t={})=>({state:n,dispatch:r})=>Zx($E(e,n.schema),t)(n,r),yk=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={}}},bk=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},xk=(e,t)=>{if(aD(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 Sk(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=LO(c)+i;return a.forEach(e=>{if(l)return;let a=xk(u,e.find);if(!a)return;let c=s.state.tr,d=UE({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new WE({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 Ck(e){let{editor:t,rules:n}=e,r=new ux({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:lO(q.from(e),a.schema);let{from:i}=s;Sk({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 Sk({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Sk({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?Sk({editor:t,from:a.pos,to:a.pos,text:`
|
|
13
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function wk(e){return Object.prototype.toString.call(e).slice(8,-1)}function Tk(e){return wk(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function Ek(e,t){let n={...e};return Tk(e)&&Tk(t)&&Object.keys(t).forEach(r=>{Tk(t[r])&&Tk(e[r])?n[r]=Ek(e[r],t[r]):n[r]=t[r]}),n}var Dk=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{...dO(Y(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...dO(Y(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Ek(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}},Ok=class e extends Dk{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 kk(e){return typeof e==`number`}var Ak=class{constructor(e){this.find=e.find,this.handler=e.handler}},jk=(e,t,n)=>{if(aD(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 Mk(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new WE({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||jk(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 Nk=null,Pk=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Fk(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(!(!Mk({editor:t,state:UE({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 ux({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Nk=t)},i=()=>{Nk&&=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=Nk;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:lO(q.from(t),r.schema);let{from:n}=d,i=n+t.length,a=Pk(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(!(!kk(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var Ik=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=wO(e),this.schema=xO(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:FO(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return CO([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:FO(t.name,this.schema)},r=[],i=Y(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&Y(t,`exitable`,n)&&(a.ArrowRight=()=>Ok.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=zE(a);r.push(o);let s=Y(t,`addInputRules`,n);if(HO(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Ck({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=Y(t,`addPasteRules`,n);if(HO(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=Fk({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 mO(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=pO(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:$E(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:gO(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return CO([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:FO(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 CO([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:FO(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}=pO(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:uD(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=gO(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{mA(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:FO(e.name,this.schema)};e.type===`mark`&&(dO(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)})}};Ik.resolve=wO,Ik.sort=CO,Ik.flatten=cO;var Lk={};HE(Lk,{ClipboardTextSerializer:()=>zk,Commands:()=>Bk,Delete:()=>Vk,Drop:()=>Hk,Editable:()=>Uk,FocusEvents:()=>Gk,Keymap:()=>Kk,Paste:()=>qk,Tabindex:()=>Jk,TextDirection:()=>Yk,focusEventsPluginKey:()=>Wk});var Rk=class e extends Dk{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)}},zk=Rk.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ux({key:new px(`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=DO(n);return TO(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),Bk=Rk.create({name:`commands`,addCommands(){return{...GE}}}),Vk=Rk.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=rO(e.before,[e,...t]);MO(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 Gy){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()}}),Hk=Rk.create({name:`drop`,addProseMirrorPlugins(){return[new ux({key:new px(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Uk=Rk.create({name:`editable`,addProseMirrorPlugins(){return[new ux({key:new px(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Wk=new px(`focusEvents`),Gk=Rk.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new ux({key:Wk,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}}}})]}}),Kk=Rk.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:Hb.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 _D()||ID()?i:r},addProseMirrorPlugins(){return[new ux({key:new px(`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=Hb.atStart(t.doc).from,l=Hb.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!WO(n.doc))return;let u=n.tr,d=UE({state:n,transaction:u}),{commands:f}=new WE({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),qk=Rk.create({name:`paste`,addProseMirrorPlugins(){return[new ux({key:new px(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Jk=Rk.create({name:`tabindex`,addProseMirrorPlugins(){return[new ux({key:new px(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),Yk=Rk.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=pO(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 ux({key:new px(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Xk=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)}},Zk=`.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 Qk(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 $k=class extends yk{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:qO,createMappablePosition:JO},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=hD(t,this.options.autofocus);this.editorState=cx.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=Qk(Zk,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=uO(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 Ik([...this.options.enableCoreExtensions?[Uk,zk.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),Bk,Gk,Kk,Jk,Hk,qk,Vk,Yk.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 WE({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=eO(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=eO(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 yE(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 kO(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return zO(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return lO(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
84
|
-
|
|
85
|
-
`,textSerializers:n={}}=e||{};return EO(this.state.doc,{blockSeparator:t,textSerializers:{...DO(this.schema),...n}})}get isEmpty(){return WO(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 Xk(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function eA(e){return new bk({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dO(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(NO(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 tA(e){return new bk({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dO(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 nA(e){return new bk({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=dO(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 rA(e){return new bk({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=dO(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&rb(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&&hb(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function iA(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof Jb){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}HE({},{createAtomBlockMarkdownSpec:()=>sA,createBlockMarkdownSpec:()=>cA,createInlineMarkdownSpec:()=>dA,parseAttributes:()=>aA,parseIndentedBlocks:()=>fA,renderNestedMarkdownContent:()=>pA,serializeAttributes:()=>oA});function aA(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 oA(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 sA(e){let{nodeName:t,name:n,parseAttributes:r=aA,serializeAttributes:i=oA,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 cA(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=aA,serializeAttributes:a=oA,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 lA(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 uA(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function dA(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=lA,serializeAttributes:a=uA,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 fA(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 pA(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 mA(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 hA=class e extends Dk{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 gA(e){return new Ak({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=dO(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(NO(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 _A(e){return mn((t,n)=>({get(){return t(),e},set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var vA=class extends $k{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=_A(this.view.state),this.reactiveExtensionStorage=_A(this.extensionStorage),this.on(`beforeTransaction`,({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),rn(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}},yA=I({name:`EditorContent`,props:{editor:{default:null,type:Object}},setup(e){let t=N(),n=to();return rr(()=>{let r=e.editor;r&&r.options.element&&t.value&&Rn(()=>{if(!t.value||!r.view.dom?.parentNode)return;let e=P(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()})}),$r(()=>{let t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:t}},render(){return bo(`div`,{ref:e=>{this.rootEl=e}})}});I({name:`NodeViewContent`,props:{as:{type:String,default:`div`}},render(){return bo(this.as,{style:{whiteSpace:`pre-wrap`},"data-node-view-content":``})}}),I({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 bA=(e={})=>{let t=cn();return Xr(()=>{t.value=new vA(e)}),$r(()=>{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};I({name:`MarkViewContent`,props:{as:{type:String,default:`span`}},render(){return bo(this.as,{style:{whiteSpace:`inherit`},"data-mark-view-content":``})}});var xA=(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]},SA=/^\s*>\s$/,CA=hA.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return xA(`blockquote`,{...hO(this.options.HTMLAttributes,e),children:xA(`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[rA({find:SA,type:this.type})]}}),wA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,TA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,EA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,DA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,OA=Ok.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 xA(`strong`,{...hO(this.options.HTMLAttributes,e),children:xA(`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[eA({find:wA,type:this.type}),eA({find:EA,type:this.type})]},addPasteRules(){return[gA({find:TA,type:this.type}),gA({find:DA,type:this.type})]}}),kA=/(^|[^`])`([^`]+)`(?!`)$/,AA=/(^|[^`])`([^`]+)`(?!`)/g,jA=Ok.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,hO(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[eA({find:kA,type:this.type})]},addPasteRules(){return[gA({find:AA,type:this.type})]}}),MA=4,NA=/^```([a-z]+)?[\s\n]$/,PA=/^~~~([a-z]+)?[\s\n]$/,FA=hA.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:MA,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`,hO(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??MA,{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??MA,{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(Kb.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(Hb.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[nA({find:NA,type:this.type,getAttributes:e=>({language:e[1]})}),nA({find:PA,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new ux({key:new px(`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(Kb.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),IA=hA.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
122
|
-
|
|
123
|
-
`):``}),LA=hA.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`,hO(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()}}}),RA=hA.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]}`,hO(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=>nA({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),zA=hA.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,hO(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!iA(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return GO(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(Kb.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Jb.create(t.doc,n.pos)):t.setSelection(Kb.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(Kb.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tA({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),BA=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,VA=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,HA=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,UA=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,WA=Ok.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`,hO(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[eA({find:BA,type:this.type}),eA({find:HA,type:this.type})]},addPasteRules(){return[gA({find:VA,type:this.type}),gA({find:UA,type:this.type})]}}),GA=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,KA=`ελ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`,qA=`numeric`,JA=`ascii`,YA=`alpha`,XA=`asciinumeric`,ZA=`alphanumeric`,QA=`domain`,$A=`emoji`,ej=`scheme`,tj=`slashscheme`,nj=`whitespace`;function rj(e,t){return e in t||(t[e]=[]),t[e]}function ij(e,t,n){t[qA]&&(t[XA]=!0,t[ZA]=!0),t[JA]&&(t[XA]=!0,t[YA]=!0),t[XA]&&(t[ZA]=!0),t[YA]&&(t[ZA]=!0),t[ZA]&&(t[QA]=!0),t[$A]&&(t[QA]=!0);for(let r in t){let t=rj(r,n);t.indexOf(e)<0&&t.push(e)}}function aj(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function oj(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}oj.groups={},oj.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||=oj.groups;let i;return t&&t.j?i=t:(i=new oj(t),n&&r&&ij(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||=oj.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 oj,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new oj,a&&(r&&(o.t&&typeof o.t==`string`?ij(a,Object.assign(aj(o.t,r),n),r):n&&ij(a,n,r)),o.t=a),i.j[e]=o,o}};var sj=(e,t,n,r,i)=>e.ta(t,n,r,i),cj=(e,t,n,r,i)=>e.tr(t,n,r,i),lj=(e,t,n,r,i)=>e.ts(t,n,r,i),X=(e,t,n,r,i)=>e.tt(t,n,r,i),uj=`WORD`,dj=`UWORD`,fj=`ASCIINUMERICAL`,pj=`ALPHANUMERICAL`,mj=`LOCALHOST`,hj=`TLD`,gj=`UTLD`,_j=`SCHEME`,vj=`SLASH_SCHEME`,yj=`NUM`,bj=`WS`,xj=`NL`,Sj=`OPENBRACE`,Cj=`CLOSEBRACE`,wj=`OPENBRACKET`,Tj=`CLOSEBRACKET`,Ej=`OPENPAREN`,Dj=`CLOSEPAREN`,Oj=`OPENANGLEBRACKET`,kj=`CLOSEANGLEBRACKET`,Aj=`FULLWIDTHLEFTPAREN`,jj=`FULLWIDTHRIGHTPAREN`,Mj=`LEFTCORNERBRACKET`,Nj=`RIGHTCORNERBRACKET`,Pj=`LEFTWHITECORNERBRACKET`,Fj=`RIGHTWHITECORNERBRACKET`,Ij=`FULLWIDTHLESSTHAN`,Lj=`FULLWIDTHGREATERTHAN`,Rj=`AMPERSAND`,zj=`APOSTROPHE`,Bj=`ASTERISK`,Vj=`AT`,Hj=`BACKSLASH`,Uj=`BACKTICK`,Wj=`CARET`,Gj=`COLON`,Kj=`COMMA`,qj=`DOLLAR`,Jj=`DOT`,Yj=`EQUALS`,Xj=`EXCLAMATION`,Zj=`HYPHEN`,Qj=`PERCENT`,$j=`PIPE`,eM=`PLUS`,tM=`POUND`,nM=`QUERY`,rM=`QUOTE`,iM=`FULLWIDTHMIDDLEDOT`,aM=`SEMI`,oM=`SLASH`,sM=`TILDE`,cM=`UNDERSCORE`,lM=`EMOJI`,uM=`SYM`,dM=Object.freeze({__proto__:null,ALPHANUMERICAL:pj,AMPERSAND:Rj,APOSTROPHE:zj,ASCIINUMERICAL:fj,ASTERISK:Bj,AT:Vj,BACKSLASH:Hj,BACKTICK:Uj,CARET:Wj,CLOSEANGLEBRACKET:kj,CLOSEBRACE:Cj,CLOSEBRACKET:Tj,CLOSEPAREN:Dj,COLON:Gj,COMMA:Kj,DOLLAR:qj,DOT:Jj,EMOJI:lM,EQUALS:Yj,EXCLAMATION:Xj,FULLWIDTHGREATERTHAN:Lj,FULLWIDTHLEFTPAREN:Aj,FULLWIDTHLESSTHAN:Ij,FULLWIDTHMIDDLEDOT:iM,FULLWIDTHRIGHTPAREN:jj,HYPHEN:Zj,LEFTCORNERBRACKET:Mj,LEFTWHITECORNERBRACKET:Pj,LOCALHOST:mj,NL:xj,NUM:yj,OPENANGLEBRACKET:Oj,OPENBRACE:Sj,OPENBRACKET:wj,OPENPAREN:Ej,PERCENT:Qj,PIPE:$j,PLUS:eM,POUND:tM,QUERY:nM,QUOTE:rM,RIGHTCORNERBRACKET:Nj,RIGHTWHITECORNERBRACKET:Fj,SCHEME:_j,SEMI:aM,SLASH:oM,SLASH_SCHEME:vj,SYM:uM,TILDE:sM,TLD:hj,UNDERSCORE:cM,UTLD:gj,UWORD:dj,WORD:uj,WS:bj}),fM=/[a-z]/,pM=/\p{L}/u,mM=/\p{Emoji}/u,hM=/\d/,gM=/\s/,_M=`\r`,vM=`
|
|
126
|
-
`,yM=`️`,bM=``,xM=``,SM=null,CM=null;function wM(e=[]){let t={};oj.groups=t;let n=new oj;SM??=OM(GA),CM??=OM(KA),X(n,`'`,zj),X(n,`{`,Sj),X(n,`}`,Cj),X(n,`[`,wj),X(n,`]`,Tj),X(n,`(`,Ej),X(n,`)`,Dj),X(n,`<`,Oj),X(n,`>`,kj),X(n,`(`,Aj),X(n,`)`,jj),X(n,`「`,Mj),X(n,`」`,Nj),X(n,`『`,Pj),X(n,`』`,Fj),X(n,`<`,Ij),X(n,`>`,Lj),X(n,`&`,Rj),X(n,`*`,Bj),X(n,`@`,Vj),X(n,"`",Uj),X(n,`^`,Wj),X(n,`:`,Gj),X(n,`,`,Kj),X(n,`$`,qj),X(n,`.`,Jj),X(n,`=`,Yj),X(n,`!`,Xj),X(n,`-`,Zj),X(n,`%`,Qj),X(n,`|`,$j),X(n,`+`,eM),X(n,`#`,tM),X(n,`?`,nM),X(n,`"`,rM),X(n,`/`,oM),X(n,`;`,aM),X(n,`~`,sM),X(n,`_`,cM),X(n,`\\`,Hj),X(n,`・`,iM);let r=cj(n,hM,yj,{[qA]:!0});cj(r,hM,r);let i=cj(r,fM,fj,{[XA]:!0}),a=cj(r,pM,pj,{[ZA]:!0}),o=cj(n,fM,uj,{[JA]:!0});cj(o,hM,i),cj(o,fM,o),cj(i,hM,i),cj(i,fM,i);let s=cj(n,pM,dj,{[YA]:!0});cj(s,fM),cj(s,hM,a),cj(s,pM,s),cj(a,hM,a),cj(a,fM),cj(a,pM,a);let c=X(n,vM,xj,{[nj]:!0}),l=X(n,_M,bj,{[nj]:!0}),u=cj(n,gM,bj,{[nj]:!0});X(n,xM,u),X(l,vM,c),X(l,xM,u),cj(l,gM,u),X(u,_M),X(u,vM),cj(u,gM,u),X(u,xM,u);let d=cj(n,mM,lM,{[$A]:!0});X(d,`#`),cj(d,mM,d),X(d,yM,d);let f=X(d,bM);X(f,`#`),cj(f,mM,d);let p=[[fM,o],[hM,i]],m=[[fM,null],[pM,s],[hM,a]];for(let e=0;e<SM.length;e++)DM(n,SM[e],hj,uj,p);for(let e=0;e<CM.length;e++)DM(n,CM[e],gj,dj,m);ij(hj,{tld:!0,ascii:!0},t),ij(gj,{utld:!0,alpha:!0},t),DM(n,`file`,_j,uj,p),DM(n,`mailto`,_j,uj,p),DM(n,`http`,vj,uj,p),DM(n,`https`,vj,uj,p),DM(n,`ftp`,vj,uj,p),DM(n,`ftps`,vj,uj,p),ij(_j,{scheme:!0,ascii:!0},t),ij(vj,{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]?{[ej]:!0}:{[tj]:!0};r.indexOf(`-`)>=0?i[QA]=!0:fM.test(r)?hM.test(r)?i[XA]=!0:i[JA]=!0:i[qA]=!0,lj(n,r,r,i)}return lj(n,`localhost`,mj,{ascii:!0}),n.jd=new oj(uM),{start:n,tokens:Object.assign({groups:t},dM)}}function TM(e,t){let n=EM(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 EM(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 DM(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 oj(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new oj(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function OM(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 kM={defaultProtocol:`http`,events:null,format:jM,formatHref:jM,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function AM(e,t=null){let n=Object.assign({},kM);e&&(n=Object.assign(n,e instanceof AM?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}AM.prototype={o:kM,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]:kM[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 jM(e){return e}function MM(e,t){this.t=`token`,this.v=e,this.tk=t}MM.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=kM.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 NM(e,t){class n extends MM{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 PM=NM(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),FM=NM(`text`),IM=NM(`nl`),LM=NM(`url`,{isLink:!0,toHref(e=kM.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==mj&&e[1].t===Gj}}),RM=e=>new oj(e);function zM({groups:e}){let t=e.domain.concat([Rj,Bj,Vj,Hj,Uj,Wj,qj,Yj,Zj,yj,Qj,$j,eM,tM,oM,uM,sM,cM]),n=[zj,Gj,Kj,Jj,Xj,Qj,nM,rM,aM,Oj,kj,Sj,Cj,Tj,wj,Ej,Dj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj],r=[Rj,zj,Bj,Hj,Uj,Wj,qj,Yj,Zj,Sj,Cj,Qj,$j,eM,tM,nM,oM,uM,sM,cM],i=RM(),a=X(i,sM);sj(a,r,a),sj(a,e.domain,a);let o=RM(),s=RM(),c=RM();sj(i,e.domain,o),sj(i,e.scheme,s),sj(i,e.slashscheme,c),sj(o,r,a),sj(o,e.domain,o);let l=X(o,Vj);X(a,Vj,l),X(s,Vj,l),X(c,Vj,l);let u=X(a,Jj);sj(u,r,a),sj(u,e.domain,a);let d=RM();sj(l,e.domain,d),sj(d,e.domain,d);let f=X(d,Jj);sj(f,e.domain,d);let p=RM(PM);sj(f,e.tld,p),sj(f,e.utld,p),X(l,mj,p);let m=X(d,Zj);X(m,Zj,m),sj(m,e.domain,d),sj(p,e.domain,d),X(p,Jj,f),X(p,Zj,m),sj(X(p,Gj),e.numeric,PM);let h=X(o,Zj),g=X(o,Jj);X(h,Zj,h),sj(h,e.domain,o),sj(g,r,a),sj(g,e.domain,o);let _=RM(LM);sj(g,e.tld,_),sj(g,e.utld,_),sj(_,e.domain,o),sj(_,r,a),X(_,Jj,g),X(_,Zj,h),X(_,Vj,l);let v=X(_,Gj),y=RM(LM);sj(v,e.numeric,y);let b=RM(LM),x=RM();sj(b,t,b),sj(b,n,x),sj(x,t,b),sj(x,n,x),X(_,oM,b),X(y,oM,b);let S=X(s,Gj),C=X(X(X(c,Gj),oM),oM);sj(s,e.domain,o),X(s,Jj,g),X(s,Zj,h),sj(c,e.domain,o),X(c,Jj,g),X(c,Zj,h),sj(S,e.domain,b),X(S,oM,b),X(S,nM,b),sj(C,e.domain,b),sj(C,t,b),X(C,oM,b);let w=[[Sj,Cj],[wj,Tj],[Ej,Dj],[Oj,kj],[Aj,jj],[Mj,Nj],[Pj,Fj],[Ij,Lj]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=X(b,r);X(x,r,a),X(a,i,b);let o=RM(LM);sj(a,t,o);let s=RM();sj(a,n),sj(o,t,o),sj(o,n,s),sj(s,t,o),sj(s,n,s),X(o,i,b),X(s,i,b)}return X(i,mj,_),X(i,xj,IM),{start:i,tokens:dM}}function BM(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(VM(FM,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(VM(e,t,r))}}return o.length>0&&a.push(VM(FM,t,o)),a}function VM(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var HM=typeof console<`u`&&console&&console.warn||(()=>{}),UM=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,WM={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function GM(){return oj.groups={},WM.scanner=null,WM.parser=null,WM.tokenQueue=[],WM.pluginQueue=[],WM.customSchemes=[],WM.initialized=!1,WM}function KM(e,t=!1){if(WM.initialized&&HM(`linkifyjs: already initialized - will not register custom scheme "${e}" ${UM}`),!/^[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`);WM.customSchemes.push([e,t])}function qM(){WM.scanner=wM(WM.customSchemes);for(let e=0;e<WM.tokenQueue.length;e++)WM.tokenQueue[e][1]({scanner:WM.scanner});WM.parser=zM(WM.scanner.tokens);for(let e=0;e<WM.pluginQueue.length;e++)WM.pluginQueue[e][1]({scanner:WM.scanner,parser:WM.parser});return WM.initialized=!0,WM}function JM(e){return WM.initialized||qM(),BM(WM.parser.start,e,TM(WM.scanner.start,e))}JM.scan=TM;function YM(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 AM(n),i=JM(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 XM=`[\0- \xA0 -\u2029 ]`,ZM=new RegExp(XM),QM=RegExp(`${XM}$`),$M=new RegExp(XM,`g`);function eN(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function tN(e){return new ux({key:new px(`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(MO(rO(n.doc,[...t])).forEach(({newRange:t})=>{let n=aO(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(!QM.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(ZM).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=JM(n).map(t=>t.toObject(e.defaultProtocol));if(!eN(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=>{NO(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 nN(e){return new ux({key:new px(`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=kO(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 rN(e){return new ux({key:new px(`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=YM(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 iN(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($M,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var aN=Ok.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`){KM(e);return}KM(e.scheme,e.optionalSlashes)})},onDestroy(){GM()},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)=>!!iN(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=>!!iN(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=>!!iN(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,hO(this.options.HTMLAttributes,e),0]:[`a`,hO(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=>!!iN(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=>!!iN(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[gA({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=YM(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!iN(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(tN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!iN(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(nN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(rN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),oN=Object.defineProperty,sN=(e,t)=>{for(var n in t)oN(e,n,{get:t[n],enumerable:!0})},cN=`listItem`,lN=`textStyle`,uN=/^\s*([-+*])\s$/,dN=hA.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`,hO(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(cN,this.editor.getAttributes(lN)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=rA({find:uN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=rA({find:uN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lN),editor:this.editor})),[e]}}),fN=hA.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,hO(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)=>pA(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)}}});sN({},{findListItemPos:()=>pN,getNextListDepth:()=>mN,handleBackspace:()=>vN,handleDelete:()=>xN,hasListBefore:()=>hN,hasListItemAfter:()=>SN,hasListItemBefore:()=>gN,listItemHasSubList:()=>_N,nextListIsDeeper:()=>yN,nextListIsHigher:()=>bN});var pN=(e,t)=>{let{$from:n}=t.selection,r=$E(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}},mN=(e,t)=>{let n=pN(e,t);if(!n)return!1;let[,r]=PO(t,e,n.$pos.pos+4);return r},hN=(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))},gN=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},_N=(e,t,n)=>{if(!n)return!1;let r=$E(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},vN=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!zD(e.state,t)&&hN(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(!zD(e.state,t)||!VO(e.state))return!1;let r=pN(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=_N(t,e.state,i);return gN(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},yN=(e,t)=>{let n=mN(e,t),r=pN(e,t);return!r||!n?!1:n>r.depth},bN=(e,t)=>{let n=mN(e,t),r=pN(e,t);return!r||!n?!1:n<r.depth},xN=(e,t)=>{if(!zD(e.state,t)||!BO(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:yN(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():bN(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},SN=(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)},CN=Rk.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&&xN(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&&xN(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&&vN(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&&vN(e,n,r)&&(t=!0)}),t}}}}),wN=/^(\s*)(\d+)\.\s+(.*)$/,TN=/^\s/;function EN(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(wN);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(wN))break;if(t.trim()===``)f.push(t),u+=`
|
|
131
|
-
`,d+=1;else if(t.match(TN))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 DN(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=DN(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 ON(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 kN=`listItem`,AN=`textStyle`,jN=/^(\d+)\.\s$/,MN=hA.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`,hO(this.options.HTMLAttributes,n),0]:[`ol`,hO(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?ON(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]=EN(r);if(i.length===0)return;let o=DN(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(kN,this.editor.getAttributes(AN)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=rA({find:jN,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=rA({find:jN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(AN)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),NN=/^\s*(\[([( |x])?\])\s$/,PN=hA.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`,hO(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)=>pA(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=gO(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[rA({find:NN,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),FN=hA.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`,hO(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=fA(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=fA(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()}}});Rk.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(dN.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(fN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(CN.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(MN.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(PN.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(FN.configure(this.options.taskList)),e}});var IN=` `,LN=`\xA0`,RN=hA.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,hO(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===IN||r[0].text===LN)?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?IN:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,BN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,VN=Ok.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`,hO(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[eA({find:zN,type:this.type})]},addPasteRules(){return[gA({find:BN,type:this.type})]}}),HN=hA.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),UN=Ok.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`,hO(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()}}}),WN=UN;function GN(e={}){return new ux({view(t){return new KN(t,e)}})}var KN=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=xb(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)}},qN=class e extends Hb{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):Hb.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 JN(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!XN(e)||!ZN(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&&!Jb.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}}};qN.prototype.visible=!1,qN.findFrom=qN.findGapCursorFrom,Hb.jsonID(`gapcursor`,qN);var JN=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 qN.valid(t)?new qN(t):Hb.near(t)}};function YN(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function XN(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||YN(e.type))return!0;if(e.inlineContent)return!1}}return!0}function ZN(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||YN(e.type))return!0;if(e.inlineContent)return!1}}return!0}function QN(){return new ux({props:{decorations:rP,createSelectionBetween(e,t,n){return t.pos==n.pos&&qN.valid(n)?new qN(n):null},handleClick:tP,handleKeyDown:$N,handleDOMEvents:{beforeinput:nP}}})}var $N=BE({ArrowLeft:eP(`horiz`,-1),ArrowRight:eP(`horiz`,1),ArrowUp:eP(`vert`,-1),ArrowDown:eP(`vert`,1)});function eP(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 Kb){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=qN.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new qN(c))),!0):!1}}function tP(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!qN.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Jb.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new qN(r))),!0)}function nP(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof qN))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(Kb.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function rP(e){if(!(e.selection instanceof qN))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,zT.create(e.doc,[IT.widget(e.selection.head,t,{key:`gapcursor`})])}var iP=200,aP=function(){};aP.prototype.append=function(e){return e.length?(e=aP.from(e),!this.length&&e||e.length<iP&&this.leafAppend(e)||this.length<iP&&e.leafPrepend(this)||this.appendInner(e)):this},aP.prototype.prepend=function(e){return e.length?aP.from(e).append(this):this},aP.prototype.appendInner=function(e){return new sP(this,e)},aP.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?aP.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},aP.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},aP.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)},aP.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},aP.from=function(e){return e instanceof aP?e:e&&e.length?new oP(e):aP.empty};var oP=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<=iP)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=iP)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}(aP);aP.empty=new oP([]);var sP=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}(aP),cP=500,lP=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 dP(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 dP(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 dP(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>pP&&(s=uP(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new zy;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 dP(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 dP(i,o,l))}else r.push(new dP(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new dP(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>cP&&(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 dP(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(aP.from(i.reverse()),a)}};lP.empty=new lP(aP.empty,0);function uP(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var dP=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)}}},fP=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},pP=20;function mP(e,t,n,r){let i=n.getMeta(SP),a;if(i)return i.historyState;n.getMeta(CP)&&(e=new fP(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(SP))return o.getMeta(SP).redo?new fP(e.done.addTransform(n,void 0,r,xP(t)),e.undone,gP(n.mapping.maps),e.prevTime,e.prevComposition):new fP(e.done,e.undone.addTransform(n,void 0,r,xP(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||!hP(n,e.prevRanges)),s=o?_P(e.prevRanges,n.mapping):gP(n.mapping.maps);return new fP(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,xP(t)),lP.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new fP(e.done.rebased(n,a),e.undone.rebased(n,a),_P(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new fP(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),_P(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function hP(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 gP(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 _P(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 vP(e,t,n){let r=xP(t),i=SP.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 fP(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(SP,{redo:n,historyState:c})}var yP=!1,bP=null;function xP(e){let t=e.plugins;if(bP!=t){yP=!1,bP=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){yP=!0;break}}return yP}var SP=new px(`history`),CP=new px(`closeHistory`);function wP(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ux({key:SP,state:{init(){return new fP(lP.empty,lP.empty,null,0,-1)},apply(t,n,r){return mP(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?EP:n==`historyRedo`?DP:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function TP(e,t){return(n,r)=>{let i=SP.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=vP(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var EP=TP(!1,!0),DP=TP(!0,!0);Rk.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 ux({key:new px(`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 OP=Rk.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[GN(this.options)]}});Rk.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new ux({key:new px(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return zT.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(IT.node(t,t+e.nodeSize,{class:this.options.className}))}),zT.create(e,a)}}})]}});var kP=Rk.create({name:`gapCursor`,addProseMirrorPlugins(){return[QN()]},extendNodeSchema(e){return{allowGapCursor:dO(Y(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),AP=`placeholder`;function jP(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var MP=Rk.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:AP,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${jP(this.options.dataAttribute)}`:`data-${AP}`;return[new ux({key:new px(`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&&WO(t);if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=IT.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}),zT.create(t,a)}}})]}});Rk.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new ux({key:new px(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||GO(n.selection)||e.view.dragging?null:zT.create(n.doc,[IT.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function NP({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var PP=Rk.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new px(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 ux({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!NP({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!NP({node:r,types:n})}}})]}}),FP=Rk.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>EP(e,t),redo:()=>({state:e,dispatch:t})=>DP(e,t)}},addProseMirrorPlugins(){return[wP(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()}}}),IP=Rk.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(OA.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(CA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(dN.configure(this.options.bulletList)),this.options.code!==!1&&e.push(jA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(FA.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(IA.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(OP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(kP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(LA.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(RA.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(FP.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(zA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WA.configure(this.options.italic)),this.options.listItem!==!1&&e.push(fN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(CN.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(aN.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(MN.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(RN.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(VN.configure(this.options.strike)),this.options.text!==!1&&e.push(HN.configure(this.options.text)),this.options.underline!==!1&&e.push(UN.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(PP.configure(this.options?.trailingNode)),e}}),LP=FN,RP=PN,zP=MP,BP={};function VP(e){let t=BP[e];if(t)return t;t=BP[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 HP(e,t){typeof t!=`string`&&(t=HP.defaultChars);let n=VP(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})}HP.defaultChars=`;/?:@&=+$,#`,HP.componentChars=``;var UP={};function WP(e){let t=UP[e];if(t)return t;t=UP[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 GP(e,t,n){typeof t!=`string`&&(n=t,t=GP.defaultChars),n===void 0&&(n=!0);let r=WP(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}GP.defaultChars=`;/?:@&=+$,-_.!~*'()#`,GP.componentChars=`-_.!~*'()`;function KP(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 qP(){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 JP=/^([a-z0-9.+-]+:)/i,YP=/:[0-9]*$/,XP=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ZP=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
141
|
-
`,` `],QP=[`/`,`?`,`#`],$P=255,eF=/^[+a-z0-9A-Z_-]{0,63}$/,tF=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,nF={javascript:!0,"javascript:":!0},rF={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function iF(e,t){if(e&&e instanceof qP)return e;let n=new qP;return n.parse(e,t),n}qP.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=XP.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=JP.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&&nF[o])&&(a=a.substr(2),this.slashes=!0)),!nF[o]&&(i||o&&!rF[o])){let e=-1;for(let t=0;t<QP.length;t++)r=a.indexOf(QP[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<ZP.length;t++)r=a.indexOf(ZP[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(eF)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(eF)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(tF);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>$P&&(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),rF[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},qP.prototype.parseHost=function(e){let t=YP.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 aF=s({decode:()=>HP,encode:()=>GP,format:()=>KP,parse:()=>iF}),oF=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,sF=/[\0-\x1F\x7F-\x9F]/,cF=/[\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]/,lF=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,uF=/[\$\+<->\^`\|~\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]/,dF=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,fF=s({Any:()=>oF,Cc:()=>sF,Cf:()=>cF,P:()=>lF,S:()=>uF,Z:()=>dF}),pF=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))),mF=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),hF=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 gF=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 _F(e){return e>=55296&&e<=57343||e>1114111?65533:hF.get(e)??e}var vF;(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`})(vF||={});var yF=32,bF;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(bF||={});function xF(e){return e>=vF.ZERO&&e<=vF.NINE}function SF(e){return e>=vF.UPPER_A&&e<=vF.UPPER_F||e>=vF.LOWER_A&&e<=vF.LOWER_F}function CF(e){return e>=vF.UPPER_A&&e<=vF.UPPER_Z||e>=vF.LOWER_A&&e<=vF.LOWER_Z||xF(e)}function wF(e){return e===vF.EQUALS||CF(e)}var TF;(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`})(TF||={});var EF;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(EF||={});var DF=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=TF.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=EF.Strict}startEntity(e){this.decodeMode=e,this.state=TF.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case TF.EntityStart:return e.charCodeAt(t)===vF.NUM?(this.state=TF.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=TF.NamedEntity,this.stateNamedEntity(e,t));case TF.NumericStart:return this.stateNumericStart(e,t);case TF.NumericDecimal:return this.stateNumericDecimal(e,t);case TF.NumericHex:return this.stateNumericHex(e,t);case TF.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|yF)===vF.LOWER_X?(this.state=TF.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=TF.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(xF(r)||SF(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(xF(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===vF.SEMI)this.consumed+=1;else if(this.decodeMode===EF.Strict)return 0;return this.emitCodePoint(_F(this.result),this.consumed),this.errors&&(e!==vF.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&bF.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=kF(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===EF.Attribute&&(i===0||wF(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&bF.VALUE_LENGTH)>>14,i!==0){if(a===vF.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==EF.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]&bF.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]&~bF.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case TF.NamedEntity:return this.result!==0&&(this.decodeMode!==EF.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case TF.NumericDecimal:return this.emitNumericEntity(0,2);case TF.NumericHex:return this.emitNumericEntity(0,3);case TF.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case TF.EntityStart:return 0}}};function OF(e){let t=``,n=new DF(e,e=>t+=gF(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 kF(e,t,n,r){let i=(t&bF.BRANCH_LENGTH)>>7,a=t&bF.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 AF=OF(pF);OF(mF);function jF(e,t=EF.Legacy){return AF(e,t)}var MF=s({arrayReplaceAt:()=>RF,assign:()=>LF,escapeHtml:()=>ZF,escapeRE:()=>$F,fromCodePoint:()=>BF,has:()=>IF,isMdAsciiPunct:()=>rI,isPunctChar:()=>nI,isSpace:()=>eI,isString:()=>PF,isValidEntityCode:()=>zF,isWhiteSpace:()=>tI,lib:()=>aI,normalizeReference:()=>iI,unescapeAll:()=>KF,unescapeMd:()=>GF});function NF(e){return Object.prototype.toString.call(e)}function PF(e){return NF(e)===`[object String]`}var FF=Object.prototype.hasOwnProperty;function IF(e,t){return FF.call(e,t)}function LF(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 RF(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function zF(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 BF(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 VF=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,HF=RegExp(VF.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),UF=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function WF(e,t){if(t.charCodeAt(0)===35&&UF.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return zF(n)?BF(n):e}let n=jF(e);return n===e?e:n}function GF(e){return e.indexOf(`\\`)<0?e:e.replace(VF,`$1`)}function KF(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(HF,function(e,t,n){return t||WF(e,n)})}var qF=/[&<>"]/,JF=/[&<>"]/g,YF={"&":`&`,"<":`<`,">":`>`,'"':`"`};function XF(e){return YF[e]}function ZF(e){return qF.test(e)?e.replace(JF,XF):e}var QF=/[.?*+^$[\]\\(){}|-]/g;function $F(e){return e.replace(QF,`\\$&`)}function eI(e){switch(e){case 9:case 32:return!0}return!1}function tI(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 nI(e){return lF.test(e)||uF.test(e)}function rI(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 iI(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}var aI={mdurl:aF,ucmicro:fF};function oI(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 sI(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=KF(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=KF(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function cI(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+=KF(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+=KF(e.slice(t,a)),o}var lI=s({parseLinkDestination:()=>sI,parseLinkLabel:()=>oI,parseLinkTitle:()=>cI}),uI={};uI.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+ZF(a.content)+`</code>`},uI.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+ZF(e[t].content)+`</code></pre>
|
|
142
|
-
`},uI.fence=function(e,t,n,r,i){let a=e[t],o=a.info?KF(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)||ZF(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`},uI.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)},uI.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
144
|
-
`:`<br>
|
|
145
|
-
`},uI.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
146
|
-
`:`<br>
|
|
147
|
-
`:`
|
|
148
|
-
`},uI.text=function(e,t){return ZF(e[t].content)},uI.html_block=function(e,t){return e[t].content},uI.html_inline=function(e,t){return e[t].content};function dI(){this.rules=LF({},uI)}dI.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+ZF(e.attrs[t][0])+`="`+ZF(e.attrs[t][1])+`"`;return r},dI.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},dI.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},dI.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},dI.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 fI(){this.__rules__=[],this.__cache__=null}fI.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},fI.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))})})},fI.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},fI.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},fI.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},fI.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},fI.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},fI.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},fI.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},fI.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function pI(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}pI.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},pI.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},pI.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},pI.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},pI.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 mI(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}mI.prototype.Token=pI;var hI=/\r\n?|\n/g,gI=/\0/g;function _I(e){let t;t=e.src.replace(hI,`
|
|
152
|
-
`),t=t.replace(gI,`�`),e.src=t}function vI(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 yI(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 bI(e){return/^<a[>\s]/i.test(e)}function xI(e){return/^<\/a\s*>/i.test(e)}function SI(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`&&(bI(o.content)&&i>0&&i--,xI(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=RF(r,a,c)}}}}var CI=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,wI=/\((c|tm|r)\)/i,TI=/\((c|tm|r)\)/gi,EI={c:`©`,r:`®`,tm:`™`};function DI(e,t){return EI[t.toLowerCase()]}function OI(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(TI,DI)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function kI(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&CI.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 AI(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(wI.test(e.tokens[t].content)&&OI(e.tokens[t].children),CI.test(e.tokens[t].content)&&kI(e.tokens[t].children))}var jI=/['"]/,MI=/['"]/g,NI=`’`;function PI(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function FI(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;){MI.lastIndex=c;let u=MI.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=rI(m)||nI(String.fromCharCode(m)),_=rI(h)||nI(String.fromCharCode(h)),v=tI(m),y=tI(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=PI(a.content,u.index,NI));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=PI(a.content,u.index,f),e[d.token].content=PI(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=PI(a.content,u.index,NI))}}}function II(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!jI.test(e.tokens[t].content)||FI(e.tokens[t].children,e)}function LI(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 RI=[[`normalize`,_I],[`block`,vI],[`inline`,yI],[`linkify`,SI],[`replacements`,AI],[`smartquotes`,II],[`text_join`,LI]];function zI(){this.ruler=new fI;for(let e=0;e<RI.length;e++)this.ruler.push(RI[e][0],RI[e][1])}zI.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},zI.prototype.State=mI;function BI(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(eI(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}BI.prototype.push=function(e,t,n){let r=new pI(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},BI.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},BI.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},BI.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&eI(this.src.charCodeAt(e));e++);return e},BI.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!eI(this.src.charCodeAt(--e)))return e+1;return e},BI.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},BI.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},BI.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(eI(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(``)},BI.prototype.Token=pI;var VI=65536;function HI(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function UI(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 WI(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&&!eI(s)||o===45&&eI(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!eI(t))return!1;a++}let c=HI(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=HI(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=UI(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=HI(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=UI(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>VI))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 GI(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 KI(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 qI(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(eI(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 JI(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&&!eI(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 YI(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&&!eI(e.src.charCodeAt(r))?-1:r}function XI(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),!eI(a))?-1:i}function ZI(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 QI(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=XI(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=YI(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=XI(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=YI(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&&ZI(e,h),!0}function $I(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(!eI(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(!eI(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&&eI(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&eI(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=iI(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 eL=`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(`.`),tL=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,nL=RegExp(`^(?:`+tL+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),rL=RegExp(`^(?:`+tL+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),iL=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+eL.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(rL.source+`\\s*$`),/^$/,!1]];function aL(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<iL.length&&!iL[s][0].test(o);s++);if(s===iL.length)return!1;if(r)return iL[s][2];let c=t+1;if(!iL[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),iL[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 oL(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&&!eI(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&eI(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 sL(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 cL(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 lL=[[`table`,WI,[`paragraph`,`reference`]],[`code`,GI],[`fence`,KI,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,qI,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,JI,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,QI,[`paragraph`,`reference`,`blockquote`]],[`reference`,$I],[`html_block`,aL,[`paragraph`,`reference`,`blockquote`]],[`heading`,oL,[`paragraph`,`reference`,`blockquote`]],[`lheading`,sL],[`paragraph`,cL]];function uL(){this.ruler=new fI;for(let e=0;e<lL.length;e++)this.ruler.push(lL[e][0],lL[e][1],{alt:(lL[e][2]||[]).slice()})}uL.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)}},uL.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)},uL.prototype.State=BI;function dL(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}dL.prototype.pushPending=function(){let e=new pI(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},dL.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new pI(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},dL.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=rI(i)||nI(String.fromCharCode(i)),l=rI(s)||nI(String.fromCharCode(s)),u=tI(i),d=tI(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}},dL.prototype.Token=pI;function fL(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 pL(e,t){let n=e.pos;for(;n<e.posMax&&!fL(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var mL=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function hL(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(mL);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 gL(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&&eI(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var _L=[];for(let e=0;e<256;e++)_L.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){_L[e.charCodeAt(0)]=1});function vL(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),eI(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&&_L[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function yL(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 bL(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 xL(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 SL(e){let t=e.tokens_meta,n=e.tokens_meta.length;xL(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&xL(e,t[r].delimiters)}var CL={tokenize:bL,postProcess:SL};function wL(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 TL(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 EL(e){let t=e.tokens_meta,n=e.tokens_meta.length;TL(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&TL(e,t[r].delimiters)}var DL={tokenize:wL,postProcess:EL};function OL(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),!(!eI(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),!(!eI(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),!(!eI(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[iI(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 kL(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),!(!eI(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),!(!eI(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),!(!eI(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[iI(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 AL=/^([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])?)*)$/,jL=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ML(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(jL.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(AL.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 NL(e){return/^<a[>\s]/i.test(e)}function PL(e){return/^<\/a\s*>/i.test(e)}function FL(e){let t=e|32;return t>=97&&t<=122}function IL(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&&!FL(i))return!1;let a=e.src.slice(r).match(nL);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],NL(t.content)&&e.linkLevel++,PL(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var LL=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,RL=/^&([a-z][a-z0-9]{1,31});/i;function zL(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(LL);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=zF(t)?BF(t):BF(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(RL);if(r){let n=jF(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 BL(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 VL(e){let t=e.tokens_meta,n=e.tokens_meta.length;BL(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&BL(t[e].delimiters)}function HL(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 UL=[[`text`,pL],[`linkify`,hL],[`newline`,gL],[`escape`,vL],[`backticks`,yL],[`strikethrough`,CL.tokenize],[`emphasis`,DL.tokenize],[`link`,OL],[`image`,kL],[`autolink`,ML],[`html_inline`,IL],[`entity`,zL]],WL=[[`balance_pairs`,VL],[`strikethrough`,CL.postProcess],[`emphasis`,DL.postProcess],[`fragments_join`,HL]];function GL(){this.ruler=new fI;for(let e=0;e<UL.length;e++)this.ruler.push(UL[e][0],UL[e][1]);this.ruler2=new fI;for(let e=0;e<WL.length;e++)this.ruler2.push(WL[e][0],WL[e][1])}GL.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},GL.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()},GL.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)},GL.prototype.State=dL;function KL(e){let t={};e||={},t.src_Any=oF.source,t.src_Cc=sF.source,t.src_Z=dF.source,t.src_P=lF.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 qL(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function JL(e){return Object.prototype.toString.call(e)}function YL(e){return JL(e)===`[object String]`}function XL(e){return JL(e)===`[object Object]`}function ZL(e){return JL(e)===`[object RegExp]`}function QL(e){return JL(e)===`[object Function]`}function $L(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var eR={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function tR(e){return Object.keys(e||{}).reduce(function(e,t){return e||eR.hasOwnProperty(t)},!1)}var nR={"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}}},rR=`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]`,iR=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function aR(e){e.__index__=-1,e.__text_cache__=``}function oR(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function sR(){return function(e,t){t.normalize(e)}}function cR(e){let t=e.re=KL(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(rR),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,XL(n)){ZL(n.validate)?r.validate=oR(n.validate):QL(n.validate)?r.validate=n.validate:a(t,n),QL(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=sR();return}if(YL(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:sR()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map($L).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`),aR(e)}function lR(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 uR(e,t){let n=new lR(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function dR(e,t){if(!(this instanceof dR))return new dR(e,t);t||tR(e)&&(t=e,e={}),this.__opts__=qL({},eR,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=qL({},nR,e),this.__compiled__={},this.__tlds__=iR,this.__tlds_replaced__=!1,this.re={},cR(this)}dR.prototype.add=function(e,t){return this.__schemas__[e]=t,cR(this),this},dR.prototype.set=function(e){return this.__opts__=qL(this.__opts__,e),this},dR.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},dR.prototype.pretest=function(e){return this.re.pretest.test(e)},dR.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},dR.prototype.match=function(e){let t=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(uR(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(uR(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},dR.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,uR(this,0)):null},dR.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(),cR(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,cR(this),this)},dR.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},dR.prototype.onCompile=function(){};var fR=2147483647,pR=36,mR=1,hR=26,gR=38,_R=700,vR=72,yR=128,bR=`-`,xR=/^xn--/,SR=/[^\0-\x7F]/,CR=/[\x2E\u3002\uFF0E\uFF61]/g,wR={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},TR=pR-mR,ER=Math.floor,DR=String.fromCharCode;function OR(e){throw RangeError(wR[e])}function kR(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function AR(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(CR,`.`);let i=kR(e.split(`.`),t).join(`.`);return r+i}function jR(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 MR=e=>String.fromCodePoint(...e),NR=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:pR},PR=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},FR=function(e,t,n){let r=0;for(e=n?ER(e/_R):e>>1,e+=ER(e/t);e>TR*hR>>1;r+=pR)e=ER(e/TR);return ER(r+(TR+1)*e/(e+gR))},IR=function(e){let t=[],n=e.length,r=0,i=yR,a=vR,o=e.lastIndexOf(bR);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&OR(`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=pR;;i+=pR){s>=n&&OR(`invalid-input`);let o=NR(e.charCodeAt(s++));o>=pR&&OR(`invalid-input`),o>ER((fR-r)/t)&&OR(`overflow`),r+=o*t;let c=i<=a?mR:i>=a+hR?hR:i-a;if(o<c)break;let l=pR-c;t>ER(fR/l)&&OR(`overflow`),t*=l}let c=t.length+1;a=FR(r-o,c,o==0),ER(r/c)>fR-i&&OR(`overflow`),i+=ER(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},LR=function(e){let t=[];e=jR(e);let n=e.length,r=yR,i=0,a=vR;for(let n of e)n<128&&t.push(DR(n));let o=t.length,s=o;for(o&&t.push(bR);s<n;){let n=fR;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>ER((fR-i)/c)&&OR(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>fR&&OR(`overflow`),n===r){let e=i;for(let n=pR;;n+=pR){let r=n<=a?mR:n>=a+hR?hR:n-a;if(e<r)break;let i=e-r,o=pR-r;t.push(DR(PR(r+i%o,0))),e=ER(i/o)}t.push(DR(PR(e,0))),a=FR(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},RR={version:`2.3.1`,ucs2:{decode:jR,encode:MR},decode:IR,encode:LR,toASCII:function(e){return AR(e,function(e){return SR.test(e)?`xn--`+LR(e):e})},toUnicode:function(e){return AR(e,function(e){return xR.test(e)?IR(e.slice(4).toLowerCase()):e})}},zR={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`]}}}},BR=/^(vbscript|javascript|file|data):/,VR=/^data:image\/(gif|png|jpeg|webp);/;function HR(e){let t=e.trim().toLowerCase();return BR.test(t)?VR.test(t):!0}var UR=[`http:`,`https:`,`mailto:`];function WR(e){let t=iF(e,!0);if(t.hostname&&(!t.protocol||UR.indexOf(t.protocol)>=0))try{t.hostname=RR.toASCII(t.hostname)}catch{}return GP(KP(t))}function GR(e){let t=iF(e,!0);if(t.hostname&&(!t.protocol||UR.indexOf(t.protocol)>=0))try{t.hostname=RR.toUnicode(t.hostname)}catch{}return HP(KP(t),HP.defaultChars+`%`)}function KR(e,t){if(!(this instanceof KR))return new KR(e,t);t||PF(e)||(t=e||{},e=`default`),this.inline=new GL,this.block=new uL,this.core=new zI,this.renderer=new dI,this.linkify=new dR,this.validateLink=HR,this.normalizeLink=WR,this.normalizeLinkText=GR,this.utils=MF,this.helpers=LF({},lI),this.options={},this.configure(e),t&&this.set(t)}KR.prototype.set=function(e){return LF(this.options,e),this},KR.prototype.configure=function(e){let t=this;if(PF(e)){let t=e;if(e=zR[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},KR.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},KR.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},KR.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},KR.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},KR.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},KR.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},KR.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var qR=new ry({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 JR(e,t){if(e.isText&&t.isText&&fv.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var YR=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:fv.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=JR(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:fv.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function XR(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function ZR(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function QR(e){return e[e.length-1]==`
|
|
154
|
-
`?e.slice(0,e.length-1):e}function $R(){}function ez(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);ZR(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,XR(i,n,r,a)),e.addText(QR(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,XR(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,XR(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];ZR(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(XR(i,n,r,a))),e.addText(QR(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(XR(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)ZR(i,r)?n[r]=$R:(n[r+`_open`]=$R,n[r+`_close`]=$R);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 tz=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=ez(e,n)}parse(e,t={}){let n=new YR(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 nz(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new tz(qR,KR(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:nz(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:nz(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 rz={open:``,close:``,mixable:!0},iz=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 sz(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=oz(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 az(n.child(r),-1)},close(e,t,n,r){return az(n.child(r-1),1)},escape:!1}});function az(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 oz(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 sz=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=rz}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++}}},cz=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),lz=Object.defineProperty,uz=(e,t,n)=>t in e?lz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dz=(e,t,n)=>(uz(e,typeof t==`symbol`?t:t+``,n),n),fz=Rk.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))}}}}}),pz=KR();function mz(e,t){return pz.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new pz.inline.State(e,null,null,[]).scanDelims(t,!0)}function hz(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 gz(e,t,n,r){let i=n,a=e;for(;i<r&&!mz(a,i).can_open;)a=hz(a,t,i,1),i++;return{text:a,from:i,to:r}}function _z(e,t,n,r){let i=r,a=e;for(;i>n&&!mz(a,i).can_close;)a=hz(a,t,i,-1),i--;return{text:a,from:n,to:i}}function vz(e,t,n,r){let i={text:e,from:n,to:r};return i=gz(i.text,t,i.from,i.to),i=_z(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 yz=class extends sz{constructor(e,t,n){super(e,t,n??{}),dz(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=vz(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}}},bz=Ok.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?xz(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?xz(t)?.[1]??``:``}},parse:{}}}}});function xz(e){let t=e.type.schema,n=t.text(` `,[e]),r=lO(q.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function Sz(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function Cz(e){return e?.replace(/</g,`<`).replace(/>/g,`>`)}function wz(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 Tz(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var Ez=hA.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(Dz(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 Dz(e,t){let n=e.type.schema,r=lO(q.from(e),n);return e.isBlock&&(t instanceof q||t.type.name===n.topNodeType.name)?Oz(r):r}function Oz(e){let t=Sz(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
|
|
163
|
-
${t.innerHTML}
|
|
164
|
-
`:`
|
|
165
|
-
`,t.outerHTML}var kz=hA.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.blockquote,parse:{}}}}}),Az=hA.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),jz=hA.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>`)}}}}}}),Mz=hA.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?Ez.storage.markdown.serialize.call(this,e,t,n):`\\
|
|
167
|
-
`);return}},parse:{}}}}}),Nz=hA.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.heading,parse:{}}}}}),Pz=hA.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.horizontal_rule,parse:{}}}}}),Fz=hA.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.image,parse:{}}}}}),Iz=hA.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.list_item,parse:{}}}}}),Lz=hA.create({name:`orderedList`});function Rz(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var zz=Lz.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=Rz(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),Bz=hA.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:iz.nodes.paragraph,parse:{}}}}});function Vz(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var Hz=hA.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!Wz(t)){Ez.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 Uz(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function Wz(e){let t=Vz(e),n=t[0],r=t.slice(1);return!(Vz(n).some(e=>e.type.name!==`tableHeader`||Uz(e)||e.childCount>1)||r.some(e=>Vz(e).some(e=>e.type.name===`tableHeader`||Uz(e)||e.childCount>1)))}var Gz=[kz,Az,jz,Mz,Nz,Pz,Ez,Fz,Iz,zz,Bz,Hz,hA.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())})}}}}}}),hA.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:Az.storage.markdown.serialize,parse:{setup(e){e.use(cz.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),hA.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(Cz(t.text))},parse:{}}}}}),Ok.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:iz.marks.strong,parse:{}}}}}),Ok.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:iz.marks.code,parse:{}}}}}),bz,Ok.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:iz.marks.em,parse:{}}}}}),Ok.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:iz.marks.link,parse:{}}}}}),Ok.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function Kz(e){let t=e.storage?.markdown,n=Gz.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var qz=class{constructor(e){dz(this,`editor`,null),this.editor=e}serialize(e){let t=new yz(this.nodes,this.marks,{hardBreakNodeName:Mz.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(Ez)])),...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(bz)])),...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=Kz(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=Kz(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}},Jz=class{constructor(e,t){dz(this,`editor`,null),dz(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(KR({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=Kz(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=Sz(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=Kz(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`)&&wz(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}Tz(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}},Yz=Rk.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new ux({key:new px(`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 sy.fromSchema(this.editor.schema).parseSlice(Sz(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),Xz=Rk.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=Lk.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 Jz(this.editor,this.options),serializer:new qz(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[fz.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Yz.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),Zz={class:`flex h-full overflow-hidden`},Qz={class:`flex items-center gap-1.5 px-2 py-1.5 border-b border-border`},$z={class:`flex-1 min-w-0 relative`},eB={class:`flex-1 overflow-y-auto`},tB={key:0,class:`p-3 text-center text-muted text-[11px]`},nB={class:`px-2 pt-2 pb-0.5 text-[10px] uppercase tracking-wider text-muted font-medium select-none`},rB=[`onClick`,`onContextmenu`],iB={class:`flex-1 flex flex-col min-w-0`},aB={class:`flex items-center justify-between px-3 py-1.5 border-b border-border text-[11px] text-muted`},oB={class:`flex items-center gap-1 truncate`},sB=[`title`],cB={class:`truncate font-mono`},lB={key:0,class:`flex items-center gap-2 shrink-0`},uB={key:0,class:`text-muted`},dB={key:1,class:`text-muted`},fB={key:0,class:`flex items-center gap-0.5 px-2 py-1 border-b border-border bg-surface overflow-x-auto`},pB={key:2,class:`flex-1 flex items-center justify-center text-muted text-[12px]`},mB={id:`note-cats`},hB=[`value`],gB={class:`flex gap-2 justify-end pt-1`},_B=[`disabled`],vB=[`disabled`],yB={class:`text-[12px] text-text`},bB={class:`font-mono font-medium`},xB={class:`flex gap-2 justify-end`},SB={key:`notes`,label:`Notes`,icon:`lucide:notebook-pen`,color:`#F5C542`,lightColor:`#D4A017`,component:Lu(I({__name:`window`,setup(e){let{state:t,set:n}=gu(),r=N([]),i=N(t.value.activeRef||``),a=N(``),o=N(!1),s=N(!1),c=N(``),l=N(``),u=N(``),d=N(null),f=Gu(),p=N(f.value?!i.value:!0),m=G(()=>f.value?p.value:p.value||!i.value),h=G(()=>f.value?!p.value&&!!i.value:!0);F(i,e=>n({activeRef:e}));let g;function _(){clearTimeout(g),g=setTimeout(()=>D(),1e3)}let v=bA({extensions:[IP.configure({heading:{levels:[1,2,3]}}),WN,LP,RP.configure({nested:!0}),zP.configure({placeholder:`start writing...`}),Xz],editorProps:{attributes:{class:`notes-editor`}},onUpdate:()=>{i.value&&_()}}),y=G(()=>v.value?b()!==a.value:!1);function b(){return v.value?v.value.storage.markdown?.getMarkdown()??``:``}let x=G(()=>[...new Set(r.value.map(e=>e.category))].sort()),S=G(()=>{let e=u.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 w(){let e=await Cu(`/api/notes`);e&&(r.value=e)}async function T(e){let t=await Cu(`/api/notes/read?ref=${encodeURIComponent(e)}`);t?(a.value=t.content,v.value?.commands.setContent(t.content)):(a.value=``,v.value?.commands.setContent(``))}async function E(e){clearTimeout(g),y.value&&await D();let t=`${e.category}/${e.id}`;i.value=t,f.value&&(p.value=!1),await T(t)}async function D(){if(!i.value||!y.value)return;o.value=!0;let e=b();await Su(`/api/notes/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:i.value,content:e})}),a.value=e,o.value=!1}let O=N(null);function ee(e){return e.startsWith(`~`)}function te(e){let t=e||i.value||null;!t||ee(t)||(O.value=t)}async function ne(){let e=O.value;e&&(O.value=null,i.value===e&&(i.value=``,a.value=``,v.value?.commands.setContent(``),p.value=!0),await Su(`/api/notes/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:e})}),await w())}function re(){O.value=null}function k(e,t){e.preventDefault(),d.value={x:e.clientX,y:e.clientY,entry:t}}function ie(){if(!d.value)return;let e=`${d.value.entry.category}/${d.value.entry.id}`;d.value=null,te(e)}function ae(){d.value=null}let oe=N(),se=N();function ce(){s.value=!0,c.value=`notes`,l.value=``,Rn(()=>se.value?.focus())}async function le(){let e=c.value.trim(),t=l.value.trim();if(!e||!t)return;let n=`${e}/${t}`;await Su(`/api/notes/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ref:n,content:``})}),s.value=!1,await w(),i.value=n,a.value=``,v.value?.commands.setContent(``)}function ue(){s.value=!1}return $r(()=>{clearTimeout(g),y.value&&D(),v.value?.destroy()}),qu(async()=>{await w(),i.value&&!a.value&&!b()&&await T(i.value)},1e4),(e,t)=>(z(),B(`div`,Zz,[Zn(V(`div`,{class:j([`shrink-0 border-r border-border flex flex-col bg-surface`,P(f)?`w-full`:`w-[200px]`])},[V(`div`,Qz,[V(`div`,$z,[H(P(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`}),Zn(V(`input`,{"onUpdate:modelValue":t[0]||=e=>u.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),[[Ms,u.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(P(K),{icon:`lucide:plus`,class:`w-3.5 h-3.5`})])]),V(`div`,eB,[C.value.size===0&&!u.value?(z(),B(`div`,tB,`no notes yet`)):W(``,!0),(z(!0),B(R,null,L(C.value,([e,t])=>(z(),B(R,{key:e},[V(`div`,nB,M(e),1),(z(!0),B(R,null,L(t,e=>(z(),B(`button`,{key:e.id,type:`button`,class:j([`w-full text-left px-2 py-1.5 text-[12px] truncate transition-colors cursor-pointer rounded-none`,[P(f)&&`px-3 py-3.5`,i.value===`${e.category}/${e.id}`?`bg-accent text-bg font-medium`:`text-text hover:bg-bg`]]),onClick:t=>E(e),onContextmenu:t=>k(t,e)},M(e.id),43,rB))),128))],64))),128))])],2),[[$o,m.value]]),Zn(V(`div`,iB,[V(`div`,aB,[V(`div`,oB,[V(`button`,{type:`button`,class:`btn-sm shrink-0 mr-0.5`,title:P(f)?`back`:`toggle list`,onClick:t[1]||=e=>p.value=!p.value},[H(P(K),{icon:P(f)?`lucide:chevron-left`:`lucide:panel-left`,class:j([`w-3.5 h-3.5`,!P(f)&&p.value?`text-text`:``])},null,8,[`icon`,`class`])],8,sB),V(`span`,cB,M(i.value||`select a note`),1)]),i.value?(z(),B(`div`,lB,[o.value?(z(),B(`span`,uB,`saving...`)):!y.value&&a.value?(z(),B(`span`,dB,`saved`)):W(``,!0),ee(i.value)?W(``,!0):(z(),B(`button`,{key:2,type:`button`,class:`btn-sm text-danger`,onClick:t[2]||=e=>te()},` delete `))])):W(``,!0)]),i.value&&P(v)?(z(),B(`div`,fB,[V(`button`,{type:`button`,class:j([`notes-tb`,{active:P(v).isActive(`bold`)}]),title:`bold`,onClick:t[3]||=e=>P(v).chain().focus().toggleBold().run()},` B `,2),V(`button`,{type:`button`,class:j([`notes-tb italic`,{active:P(v).isActive(`italic`)}]),title:`italic`,onClick:t[4]||=e=>P(v).chain().focus().toggleItalic().run()},` I `,2),V(`button`,{type:`button`,class:j([`notes-tb underline`,{active:P(v).isActive(`underline`)}]),title:`underline`,onClick:t[5]||=e=>P(v).chain().focus().toggleUnderline().run()},` U `,2),V(`button`,{type:`button`,class:j([`notes-tb line-through`,{active:P(v).isActive(`strike`)}]),title:`strikethrough`,onClick:t[6]||=e=>P(v).chain().focus().toggleStrike().run()},` S `,2),t[20]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:j([`notes-tb text-[10px] font-bold`,{active:P(v).isActive(`heading`,{level:1})}]),title:`heading 1`,onClick:t[7]||=e=>P(v).chain().focus().toggleHeading({level:1}).run()},` H1 `,2),V(`button`,{type:`button`,class:j([`notes-tb text-[10px] font-bold`,{active:P(v).isActive(`heading`,{level:2})}]),title:`heading 2`,onClick:t[8]||=e=>P(v).chain().focus().toggleHeading({level:2}).run()},` H2 `,2),V(`button`,{type:`button`,class:j([`notes-tb text-[10px] font-bold`,{active:P(v).isActive(`heading`,{level:3})}]),title:`heading 3`,onClick:t[9]||=e=>P(v).chain().focus().toggleHeading({level:3}).run()},` H3 `,2),t[21]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:j([`notes-tb text-[10px]`,{active:P(v).isActive(`bulletList`)}]),title:`bullet list`,onClick:t[10]||=e=>P(v).chain().focus().toggleBulletList().run()},` ::: `,2),V(`button`,{type:`button`,class:j([`notes-tb text-[10px]`,{active:P(v).isActive(`orderedList`)}]),title:`ordered list`,onClick:t[11]||=e=>P(v).chain().focus().toggleOrderedList().run()},` 1. `,2),V(`button`,{type:`button`,class:j([`notes-tb text-[10px]`,{active:P(v).isActive(`taskList`)}]),title:`task list`,onClick:t[12]||=e=>P(v).chain().focus().toggleTaskList().run()},` [x] `,2),t[22]||=V(`span`,{class:`w-px h-4 bg-border mx-1`},null,-1),V(`button`,{type:`button`,class:j([`notes-tb font-mono text-[10px]`,{active:P(v).isActive(`code`)}]),title:`inline code`,onClick:t[13]||=e=>P(v).chain().focus().toggleCode().run()},` <> `,2),V(`button`,{type:`button`,class:j([`notes-tb font-mono text-[10px]`,{active:P(v).isActive(`codeBlock`)}]),title:`code block`,onClick:t[14]||=e=>P(v).chain().focus().toggleCodeBlock().run()},` {..} `,2),V(`button`,{type:`button`,class:j([`notes-tb text-[10px]`,{active:P(v).isActive(`blockquote`)}]),title:`blockquote`,onClick:t[15]||=e=>P(v).chain().focus().toggleBlockquote().run()},` > `,2),V(`button`,{type:`button`,class:`notes-tb text-[10px]`,title:`horizontal rule`,onClick:t[16]||=e=>P(v).chain().focus().setHorizontalRule().run()},` --- `)])):W(``,!0),i.value?(z(),La(P(yA),{key:1,editor:P(v),class:`flex-1 overflow-y-auto`},null,8,[`editor`])):(z(),B(`div`,pB,` select or create a note to start `))],512),[[$o,h.value]]),s.value?(z(),La(Il,{key:0,title:`new note`,width:`340px`,onClose:ue},{default:Xn(()=>[V(`form`,{class:`flex flex-col gap-2`,onSubmit:Rs(le,[`prevent`])},[Zn(V(`input`,{ref_key:`newIdInput`,ref:se,"onUpdate:modelValue":t[17]||=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:`note id`,onKeydown:Bs(ue,[`escape`])},null,544),[[Ms,l.value]]),Zn(V(`input`,{"onUpdate:modelValue":t[18]||=e=>c.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:Bs(ue,[`escape`])},null,544),[[Ms,c.value]]),V(`datalist`,mB,[(z(!0),B(R,null,L(x.value,e=>(z(),B(`option`,{key:e,value:e},null,8,hB))),128))]),V(`div`,gB,[V(`button`,{type:`button`,class:`btn-ghost text-[11px]`,onClick:ue},[...t[23]||=[U(` cancel `,-1),V(`kbd`,{class:`text-[9px] text-muted ml-1`},`esc`,-1)]]),V(`button`,{type:`submit`,class:`btn-primary text-[11px]`,disabled:!c.value.trim()||!l.value.trim()},[...t[24]||=[U(` create `,-1),V(`kbd`,{class:`text-[9px] text-muted ml-1`},`⏎`,-1)]],8,_B)])],32)]),_:1})):W(``,!0),(z(),La(vr,{to:`body`},[d.value?(z(),B(`div`,{key:0,class:`fixed inset-0 z-[9999]`,onClick:ae,onContextmenu:Rs(ae,[`prevent`])},[V(`div`,{class:`fixed min-w-[120px] bg-surface border border-border rounded-lg shadow-lg py-1 overflow-hidden`,style:A({left:d.value.x+`px`,top:d.value.y+`px`})},[V(`button`,{type:`button`,class:j([`w-full text-left px-3 py-1.5 text-[11px] flex items-center gap-2`,ee(`${d.value.entry.category}/${d.value.entry.id}`)?`text-muted cursor-default`:`text-danger hover:bg-bg transition-colors cursor-pointer`]),disabled:ee(`${d.value.entry.category}/${d.value.entry.id}`),onClick:Rs(ie,[`stop`])},[H(P(K),{icon:`lucide:trash-2`,class:`w-3 h-3`}),t[25]||=U(` delete `,-1)],10,vB)],4)],32)):W(``,!0)])),O.value?(z(),La(Il,{key:1,title:`delete note`,width:`300px`,onClose:re,onVnodeMounted:t[19]||=e=>Rn(()=>oe.value?.focus())},{default:Xn(()=>[V(`div`,{class:`flex flex-col gap-3`,onKeydown:Bs(re,[`escape`])},[V(`p`,yB,[t[26]||=U(` delete `,-1),V(`span`,bB,M(O.value),1),t[27]||=U(`? `,-1)]),V(`div`,xB,[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:Bs(ne,[`enter`])},` delete `,544)])],32)]),_:1},512)):W(``,!0)]))}}),[[`__scopeId`,`data-v-58dc5c01`]]),window:{width:720,height:520,minwidth:480,minheight:320}},CB={class:`grid gap-3 p-3`},wB={key:0,class:`border border-border p-3`},TB={class:`w-full border-collapse text-[12px]`},EB={class:`hover:bg-surface`},DB={class:`py-1.5 px-2 border-b border-border font-mono`},OB={class:`hover:bg-surface`},kB={class:`py-1.5 px-2 border-b border-border font-mono`},AB=[`href`],jB={class:`hover:bg-surface`},MB={class:`py-1.5 px-2`},NB={key:0,class:`badge-ok`},PB={key:1,class:`text-muted`},FB={key:1,class:`border border-border p-3`},IB={key:2,class:`border border-border p-3`},LB={class:`mb-2`},RB={class:`mb-2`},zB={class:`flex gap-1.5`},BB={class:`mb-2`},VB={key:0,class:`text-[11px] text-danger mb-2`},HB=[`disabled`],UB={key:3,class:`border border-border p-3`},WB={key:0,class:`text-[11px] text-danger mb-2`},GB={key:1,class:`text-[11px] text-ok mb-2`},KB={class:`flex gap-2`},qB=[`disabled`],JB=[`disabled`],YB={key:`ntfy`,label:`Notifications`,icon:`lucide:bell-ring`,color:`#4CAF50`,component:I({__name:`window`,setup(e){let t=N(null),n=N(`https://ntfy.sh`),r=N(``),i=N(``),a=N(!1),o=N(``),s=N(``),c=G(()=>t.value?.configured??!1);async function l(){let e=await Cu(`/api/ntfy/status`);e&&(t.value=e)}async function u(){if(r.value.trim()){a.value=!0,o.value=``;try{(await Su(`/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 Su(`/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 Su(`/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 qu(l,5e3),(e,l)=>(z(),B(`div`,CB,[c.value?(z(),B(`div`,wB,[l[6]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,TB,[V(`tbody`,null,[V(`tr`,EB,[l[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`server`,-1),V(`td`,DB,M(t.value?.serverUrl),1)]),V(`tr`,OB,[l[4]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`topic`,-1),V(`td`,kB,[V(`a`,{href:`${t.value?.serverUrl}/${t.value?.topic}`,target:`_blank`,class:`text-accent hover:underline`},M(t.value?.topic),9,AB)])]),V(`tr`,jB,[l[5]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`auth`,-1),V(`td`,MB,[t.value?.hasToken?(z(),B(`span`,NB,`token set`)):(z(),B(`span`,PB,`none`))])])])])])):W(``,!0),c.value?W(``,!0):(z(),B(`div`,FB,[...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):(z(),B(`div`,IB,[l[11]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Rs(u,[`prevent`])},[V(`div`,LB,[l[8]||=V(`label`,{class:`label`},`server url`,-1),Zn(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),[[Ms,n.value]])]),V(`div`,RB,[l[9]||=V(`label`,{class:`label`},`topic`,-1),V(`div`,zB,[Zn(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),[[Ms,r.value]]),V(`button`,{type:`button`,class:`btn-sm shrink-0`,title:`generate random topic`,onClick:p},` random `)])]),V(`div`,BB,[l[10]||=V(`label`,{class:`label`},`token (optional)`,-1),Zn(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),[[Ms,i.value]])]),o.value?(z(),B(`div`,VB,M(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`},M(a.value?`saving...`:`connect`),9,HB)],32)])),c.value?(z(),B(`div`,UB,[l[12]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),o.value?(z(),B(`div`,WB,M(o.value),1)):W(``,!0),s.value===`ok`?(z(),B(`div`,GB,`test notification sent`)):W(``,!0),V(`div`,KB,[V(`button`,{type:`button`,disabled:a.value,class:`btn-primary`,onClick:f},M(a.value?`sending...`:`send test notification`),9,qB),V(`button`,{type:`button`,disabled:a.value,class:`btn-danger`,onClick:d},` disconnect `,8,JB)])])):W(``,!0)]))}}),window:{width:420,height:500,minwidth:320,minheight:200,autosize:!0}},XB={class:`flex flex-col h-full`},ZB={class:`grid grid-cols-3 gap-2 p-2 border-b border-border`},QB={class:`border border-border p-2`},$B={class:`text-[12px]`},eV={key:0,class:`text-[11px] text-muted`},tV={class:`text-[11px] text-muted`},nV={class:`border border-border p-2`},rV={class:`text-[12px]`},iV={class:`text-muted text-[11px] ml-1`},aV={class:`h-1 bg-surface rounded-sm overflow-hidden mt-1`},oV=[`title`],sV={class:`text-[10px] text-muted`},cV={key:1,class:`text-[12px] text-muted`},lV={class:`border border-border p-2`},uV={class:`text-[12px]`},dV={class:`text-muted text-[11px]`},fV={class:`h-1 bg-surface rounded-sm overflow-hidden mt-1`},pV={class:`text-[10px] text-muted mt-1`},mV={key:0,class:`text-[10px] text-muted`},hV={key:1,class:`text-[12px] text-muted`},gV={class:`px-3 pt-2`},_V={class:`px-3 pt-2 border-b border-border flex items-center gap-2`},vV={key:0,class:`flex flex-col flex-1 overflow-hidden`},yV={class:`overflow-y-auto flex-1`},bV={class:`w-full border-collapse text-[12px]`},xV={class:`sticky top-0 bg-bg`},SV={key:0},CV=[`onContextmenu`,`onTouchstart`],wV={class:`py-1 px-1.5 border-b border-border text-center`},TV=[`onClick`],EV={class:`py-1 px-2 border-b border-border text-muted font-mono text-[11px]`},DV=[`title`],OV={class:`py-1 px-2 border-b border-border text-muted`},kV={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},AV={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},jV=[`title`],MV={key:1,class:`flex flex-col flex-1 overflow-hidden`},NV={class:`overflow-y-auto flex-1`},PV={class:`w-full border-collapse text-[12px]`},FV={key:0},IV=[`onContextmenu`,`onTouchstart`],LV={class:`py-1 px-1.5 border-b border-border text-center`},RV=[`onClick`],zV={class:`py-1 px-2 border-b border-border text-muted`},BV={class:`py-1 px-2 border-b border-border text-right font-mono text-[11px]`},VV=[`title`],HV={class:`py-1 px-2 border-b border-border text-muted font-mono text-[11px]`},UV=[`title`],WV={key:`resources`,label:`Resources`,icon:`lucide:gauge`,color:`#e5a535`,component:I({__name:`window`,setup(e){let{confirm:t}=Bu(),{menu:n,onContext:r,onTouchStart:i,cancelLongPress:a,close:o}=$l(),{menu:s,onContext:c,onTouchStart:l,cancelLongPress:u,close:d}=$l(),f=[`processes`,`ports`],{state:p,set:m}=gu(),h=N(f.includes(p.value.tab)?p.value.tab:`processes`);F(h,e=>m({tab:e}));let g=N(null),_=N([]),v=N(`cpu`),y=N([]),b=N(``),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 Cu(`/api/resources`);e&&(g.value=e)}async function w(){let e=await Cu(`/api/resources/processes?sort=${v.value}&limit=50`);e&&(_.value=e)}async function T(){let e=await Cu(`/api/resources/ports`);e&&(y.value=e)}qu(async()=>{let e=h.value===`ports`?T():w();await Promise.all([C(),e])},3e3),F(h,()=>{h.value===`ports`?T():w()}),F(v,()=>{h.value===`processes`&&w()});function E(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 D(e){return`${e.toFixed(1)}%`}function O(e){return e>=90?`bg-danger`:e>=80?`bg-warn`:`bg-accent`}function ee(e){return e.map(e=>e.toFixed(2)).join(` / `)}async function te(e){await t(`kill process ${e.pid} (${e.name})?`)&&(await Su(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await w())}async function ne(e){await t(`kill process ${e.pid} (${e.process}) on port ${e.port}?`)&&(await Su(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await T())}async function re(){if(!n.value)return;let e=n.value.data;o(),await t(`kill process ${e.pid} (${e.name})?`)&&(await Su(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await w())}async function k(){if(!s.value)return;let e=s.value.data;d(),await t(`kill process ${e.pid} (${e.process}) on port ${e.port}?`)&&(await Su(`/api/resources/kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pid:e.pid})}),await T())}return(e,t)=>(z(),B(`div`,XB,[V(`div`,ZB,[V(`div`,QB,[t[9]||=V(`h3`,{class:`section-title mb-1`},`platform`,-1),V(`div`,$B,M(g.value?g.value.linuxDistro||g.value.os:`-`),1),g.value?.runtime?(z(),B(`div`,eV,M(g.value.runtime),1)):W(``,!0),V(`div`,tV,M(g.value?.arch??`-`),1)]),V(`div`,nV,[t[10]||=V(`h3`,{class:`section-title mb-1`},`cpu`,-1),g.value?(z(),B(R,{key:0},[V(`div`,rV,[U(M(D(g.value.cpu.usage))+` `,1),V(`span`,iV,M(g.value.cpu.count)+` cores`,1)]),V(`div`,aV,[V(`div`,{class:j([`h-full rounded-sm`,O(g.value.cpu.usage)]),style:A({width:D(g.value.cpu.usage)})},null,6)]),V(`div`,{class:`text-[10px] text-muted mt-1 truncate`,title:g.value.cpu.model},M(g.value.cpu.model),9,oV),V(`div`,sV,`load `+M(ee(g.value.loadAvg)),1)],64)):(z(),B(`div`,cV,`-`))]),V(`div`,lV,[t[11]||=V(`h3`,{class:`section-title mb-1`},`memory`,-1),g.value?(z(),B(R,{key:0},[V(`div`,uV,[U(M(E(g.value.memory.used))+` `,1),V(`span`,dV,`/ `+M(E(g.value.memory.total)),1)]),V(`div`,fV,[V(`div`,{class:j([`h-full rounded-sm`,O(g.value.memory.usagePercent)]),style:A({width:D(g.value.memory.usagePercent)})},null,6)]),V(`div`,pV,` rss `+M(E(g.value.process.rss))+` · heap `+M(E(g.value.process.heapUsed))+` / `+M(E(g.value.process.heapTotal)),1),g.value.disk?(z(),B(`div`,mV,` disk `+M(E(g.value.disk.total-g.value.disk.free))+` / `+M(E(g.value.disk.total)),1)):W(``,!0)],64)):(z(),B(`div`,hV,`-`))])]),V(`div`,gV,[Zn(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),[[Ms,b.value]])]),V(`div`,_V,[V(`button`,{type:`button`,class:j(h.value===`processes`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>h.value=`processes`},` processes `,2),V(`button`,{type:`button`,class:j(h.value===`ports`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>h.value=`ports`},` ports `,2)]),h.value===`processes`?(z(),B(`div`,vV,[V(`div`,yV,[V(`table`,bV,[V(`thead`,xV,[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:j([`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%`+M(v.value===`cpu`?` v`:``),3),V(`th`,{class:j([`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`+M(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?(z(),B(`tr`,SV,[...t[17]||=[V(`td`,{colspan:`7`,class:`text-center py-8 text-muted text-[12px]`},`no processes`,-1)]])):W(``,!0),(z(!0),B(R,null,L(x.value,e=>(z(),B(`tr`,{key:e.pid,class:j(g.value&&e.pid===g.value.process.pid?`bg-accent-dim`:`hover:bg-surface`),onContextmenu:t=>P(r)(t,e),onTouchstart:t=>P(i)(t,e),onTouchend:t[5]||=(...e)=>P(a)&&P(a)(...e),onTouchmove:t[6]||=(...e)=>P(a)&&P(a)(...e)},[V(`td`,wV,[!g.value||e.pid!==g.value.process.pid?(z(),B(`button`,{key:0,type:`button`,class:`btn-sm bg-danger-dim text-danger border-danger-dim hover:bg-danger-dim`,onClick:t=>te(e)},` x `,8,TV)):W(``,!0)]),V(`td`,EV,M(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},M(e.name),9,DV),V(`td`,OV,M(e.user),1),V(`td`,kV,M(e.cpu.toFixed(1)),1),V(`td`,AV,M(E(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},M(e.command),9,jV)],42,CV))),128))])])])])):h.value===`ports`?(z(),B(`div`,MV,[V(`div`,NV,[V(`table`,PV,[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?(z(),B(`tr`,FV,[...t[18]||=[V(`td`,{colspan:`6`,class:`text-center py-8 text-muted text-[12px]`},` no listening ports `,-1)]])):W(``,!0),(z(!0),B(R,null,L(S.value,e=>(z(),B(`tr`,{key:`${e.protocol}-${e.port}-${e.address}`,class:j(g.value&&e.pid===g.value.process.pid?`bg-accent-dim`:`hover:bg-surface`),onContextmenu:t=>P(c)(t,e),onTouchstart:t=>P(l)(t,e),onTouchend:t[7]||=(...e)=>P(u)&&P(u)(...e),onTouchmove:t[8]||=(...e)=>P(u)&&P(u)(...e)},[V(`td`,LV,[e.pid&&(!g.value||e.pid!==g.value.process.pid)?(z(),B(`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,RV)):W(``,!0)]),V(`td`,zV,M(e.protocol),1),V(`td`,BV,M(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},M(e.address),9,VV),V(`td`,HV,M(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},M(e.process),9,UV)],42,IV))),128))])])])])):W(``,!0),H(Ml,{pos:P(n)&&(!g.value||P(n).data.pid!==g.value.process.pid)?P(n):null},{default:Xn(()=>[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:re},` Kill `)]),_:1},8,[`pos`]),H(Ml,{pos:P(s)&&P(s).data.pid?P(s):null},{default:Xn(()=>[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:k},` Kill `)]),_:1},8,[`pos`])]))}}),window:{width:620,height:650,minwidth:380,minheight:300}},GV={class:`overflow-y-auto p-3`},KV={class:`w-full border-collapse text-[12px]`},qV={class:`py-1.5 px-2 border-b border-border text-muted whitespace-nowrap`},JV={key:0,class:`text-[10px] opacity-50 ml-1`},YV={class:`py-1.5 px-2 border-b border-border`},XV=[`onSubmit`],ZV=[`onClick`],QV={class:`group-hover:text-accent`},$V={class:`py-1.5 px-2 border-b border-border`},eH={class:`py-1.5 px-2 border-b border-border text-right`},tH=[`onClick`],nH=I({__name:`ConfigTab`,setup(e){let t=N({}),n=N(null),r=N(``);async function i(){let e=await Cu(`/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 Su(`/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 Su(`/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)=>(z(),B(`div`,GV,[V(`table`,KV,[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,[(z(!0),B(R,null,L(t.value,(e,t)=>(z(),B(`tr`,{key:t,class:`hover:bg-surface`},[V(`td`,qV,[U(M(t)+` `,1),e.env?(z(),B(`span`,JV,M(e.env),1)):W(``,!0)]),V(`td`,YV,[n.value===t?(z(),B(`form`,{key:0,class:`flex gap-1`,onSubmit:Rs(e=>s(t),[`prevent`])},[Zn(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:Bs(o,[`escape`])},null,544),[[Ms,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,XV)):(z(),B(`span`,{key:1,class:`inline-flex items-center gap-1 cursor-pointer group`,onClick:e=>a(t)},[V(`span`,QV,M(d(e.value,t)),1),H(P(K),{icon:`lucide:pencil`,class:`text-[10px] text-muted/50`})],8,ZV))]),V(`td`,$V,[V(`span`,{class:j([`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`}])},M(e.source),3)]),V(`td`,eH,[e.source===`db`?(z(),B(`button`,{key:0,class:`text-[10px] text-muted hover:text-red-400`,onClick:e=>c(t)},` reset `,8,tH)):W(``,!0)])]))),128))])])]))}}),rH={class:`grid gap-3 p-3`},iH={class:`border border-border p-3`},aH={class:`flex gap-2`},oH=[`onClick`],sH={class:`border border-border p-3`},cH={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},lH=[`checked`],uH={key:0,class:`ml-5 mt-1.5 grid gap-1.5`},dH={class:`flex gap-2`},fH=[`onClick`],pH={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},mH=[`checked`],hH={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text mt-1.5`},gH=[`checked`],_H=I({__name:`DashTab`,setup(e){let{settings:t,set:n}=du(),r=[`small`,`medium`,`large`],i=[`12h`,`24h`];return(e,a)=>(z(),B(`div`,rH,[V(`div`,iH,[a[3]||=V(`h3`,{class:`section-title mb-2`},`dock size`,-1),V(`div`,aH,[(z(),B(R,null,L(r,e=>V(`button`,{key:e,type:`button`,class:j([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,P(t).dockSize===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>P(n)({dockSize:e})},M(e),11,oH)),64))])]),V(`div`,sH,[a[7]||=V(`h3`,{class:`section-title mb-2`},`dock`,-1),V(`label`,cH,[V(`input`,{type:`checkbox`,checked:P(t).showClock,class:`accent-accent`,onChange:a[0]||=e=>P(n)({showClock:!P(t).showClock,showStatus:!P(t).showClock})},null,40,lH),a[4]||=U(` show clock `,-1)]),P(t).showClock?(z(),B(`div`,uH,[V(`div`,dH,[(z(),B(R,null,L(i,e=>V(`button`,{key:e,type:`button`,class:j([`px-2 py-1 text-[11px] rounded border transition-colors cursor-pointer`,P(t).clockFormat===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>P(n)({clockFormat:e})},M(e),11,fH)),64))]),V(`label`,pH,[V(`input`,{type:`checkbox`,checked:P(t).showStatus,class:`accent-accent`,onChange:a[1]||=e=>P(n)({showStatus:!P(t).showStatus})},null,40,mH),a[5]||=U(` show status indicator `,-1)])])):W(``,!0),V(`label`,hH,[V(`input`,{type:`checkbox`,checked:P(t).showFullscreen,class:`accent-accent`,onChange:a[2]||=e=>P(n)({showFullscreen:!P(t).showFullscreen})},null,40,gH),a[6]||=U(` show fullscreen button `,-1)])])]))}}),vH={class:`grid gap-3 p-3`},yH={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},bH={class:`border border-border p-3`},xH={class:`flex gap-2`},SH=[`onClick`],CH={class:`border border-border p-3`},wH={class:`flex gap-2`},TH={key:0,class:`mt-2`},EH={class:`flex gap-2`},DH={class:`border border-border p-3`},OH={class:`flex flex-wrap gap-2`},kH=[`onClick`],AH={class:`border border-border p-3`},jH={class:`flex gap-1.5 mb-2`},MH=[`onClick`],NH={key:0,class:`text-[11px] text-muted`},PH={key:1,class:`grid grid-cols-3 gap-1.5`},FH=[`onClick`],IH=[`src`,`alt`],LH={class:`border border-border p-3`},RH={class:`flex gap-2`},zH=I({__name:`DesktopTab`,setup(e){let{settings:t,set:n}=du(),r=V1.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=N(c.value),u=[`general`,`anime`,`people`],d={general:`100`,anime:`010`,people:`001`},f=N(`general`);function p(e){f.value!==e&&(f.value=e,g())}let m=N([]),h=N(!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 Xr(g),(e,d)=>(z(),B(`div`,vH,[V(`div`,yH,[V(`div`,bH,[d[4]||=V(`h3`,{class:`section-title mb-2`},`theme`,-1),V(`div`,xH,[(z(),B(R,null,L(o,e=>V(`button`,{key:e,type:`button`,class:j([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,P(t).theme===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>P(n)({theme:e})},M(e),11,SH)),64))])]),V(`div`,CH,[d[6]||=V(`h3`,{class:`section-title mb-2`},`desktop icons`,-1),V(`div`,wH,[V(`button`,{type:`button`,class:j([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,P(t).showDesktopIcons?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:d[0]||=e=>P(n)({showDesktopIcons:!P(t).showDesktopIcons})},M(P(t).showDesktopIcons?`visible`:`hidden`),3)]),P(t).showDesktopIcons?(z(),B(`div`,TH,[d[5]||=V(`p`,{class:`text-[11px] text-muted mb-1.5`},`icon layout`,-1),V(`div`,EH,[V(`button`,{type:`button`,class:j([`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=>P(n)({iconLayout:`list`})},` list `,2),V(`button`,{type:`button`,class:j([`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=>P(n)({iconLayout:`grid`})},` grid `,2)])])):W(``,!0)])]),V(`div`,DH,[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`,OH,[(z(!0),B(R,null,L(P(r),e=>(z(),B(`button`,{key:e.key,type:`button`,class:j([`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)},M(e.label),11,kH))),128))])]),V(`div`,AH,[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`,jH,[(z(),B(R,null,L(u,e=>V(`button`,{key:e,type:`button`,class:j([`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)},M(e),11,MH)),64))]),h.value?(z(),B(`div`,NH,`loading...`)):(z(),B(`div`,PH,[(z(!0),B(R,null,L(m.value,e=>(z(),B(`button`,{key:e.id,type:`button`,class:j([`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,IH)],10,FH))),128))]))]),V(`div`,LH,[d[11]||=V(`h3`,{class:`section-title mb-2`},`custom url`,-1),V(`form`,{onSubmit:Rs(v,[`prevent`])},[Zn(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),[[Ms,l.value]]),V(`div`,RH,[d[10]||=V(`button`,{type:`submit`,class:`btn-primary`},`apply`,-1),c.value?(z(),B(`button`,{key:0,type:`button`,class:`btn-danger`,onClick:y},`clear`)):W(``,!0)])],32)])]))}}),BH={class:`grid gap-3 p-3 overflow-y-auto`},VH={class:`border border-border p-3`},HH={class:`w-full border-collapse text-[12px]`},UH={class:`hover:bg-surface`},WH={class:`py-1.5 px-2 border-b border-border`},GH={class:`hover:bg-surface`},KH={class:`py-1.5 px-2 border-b border-border`},qH={class:`hover:bg-surface`},JH={class:`py-1.5 px-2 border-b border-border`},YH={key:0,class:`hover:bg-surface`},XH={class:`py-1.5 px-2`},ZH={class:`border border-border p-3`},QH={class:`w-full border-collapse text-[12px]`},$H={class:`hover:bg-surface`},eU={class:`py-1.5 px-2 border-b border-border`},tU={key:0,class:`hover:bg-surface`},nU={class:`py-1.5 px-2`},rU=I({__name:`HostTab`,setup(e){let t=N(null);async function n(){let e=await Cu(`/api/status`);e&&(t.value=e)}qu(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;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)=>(z(),B(`div`,BH,[V(`div`,VH,[n[4]||=V(`h3`,{class:`section-title mb-2`},`platform`,-1),V(`table`,HH,[V(`tbody`,null,[V(`tr`,UH,[n[0]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`os`,-1),V(`td`,WH,M(a.value??`-`),1)]),V(`tr`,GH,[n[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`runtime`,-1),V(`td`,KH,M(t.value?.systemInfo?.runtime??`-`),1)]),V(`tr`,qH,[n[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`os uptime`,-1),V(`td`,JH,M(t.value?.systemInfo?.uptime==null?`-`:P(xh)(t.value.systemInfo.uptime*1e3)),1)]),o.value==null?W(``,!0):(z(),B(`tr`,YH,[n[3]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`commands`,-1),V(`td`,XH,M(o.value),1)]))])])]),V(`div`,ZH,[n[7]||=V(`h3`,{class:`section-title mb-2`},`resources`,-1),V(`table`,QH,[V(`tbody`,null,[V(`tr`,$H,[n[5]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`memory`,-1),V(`td`,eU,M(i.value??`-`),1)]),t.value?.systemInfo?.availableDiskSpace==null?W(``,!0):(z(),B(`tr`,tU,[n[6]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`disk free`,-1),V(`td`,nU,M(r(t.value.systemInfo.availableDiskSpace)),1)]))])])])]))}}),iU={class:`grid gap-3 p-3 overflow-y-auto`},aU={class:`border border-border p-3`},oU={class:`w-full border-collapse text-[12px]`},sU={class:`hover:bg-surface`},cU={class:`py-1.5 px-2 border-b border-border`},lU={class:`hover:bg-surface`},uU={class:`py-1.5 px-2 border-b border-border`},dU={class:`hover:bg-surface`},fU={class:`py-1.5 px-2 border-b border-border`},pU={class:`hover:bg-surface`},mU={class:`py-1.5 px-2 border-b border-border`},hU={class:`hover:bg-surface`},gU={class:`py-1.5 px-2`},_U={class:`border border-border p-3`},vU={class:`w-full border-collapse text-[12px]`},yU={class:`hover:bg-surface`},bU={class:`py-1.5 px-2 border-b border-border`},xU={class:`hover:bg-surface`},SU={class:`py-1.5 px-2 border-b border-border`},CU={class:`hover:bg-surface`},wU={class:`py-1.5 px-2`},TU=I({__name:`ServerTab`,setup(e){let t=N(null);async function n(){let e=await Cu(`/api/status`);e&&(t.value=e)}qu(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)=>(z(),B(`div`,iU,[V(`div`,aU,[n[5]||=V(`h3`,{class:`section-title mb-2`},`system`,-1),V(`table`,oU,[V(`tbody`,null,[V(`tr`,sU,[n[0]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`uptime`,-1),V(`td`,cU,M(t.value?P(xh)(t.value.uptimeMs):`-`),1)]),V(`tr`,lU,[n[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`agents`,-1),V(`td`,uU,M(t.value?.activeAgents??`-`),1)]),V(`tr`,dU,[n[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`queue`,-1),V(`td`,fU,M(t.value?.queueSize??`-`),1)]),V(`tr`,pU,[n[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`assistant`,-1),V(`td`,mU,M(t.value?.assistantName??`-`),1)]),V(`tr`,hU,[n[4]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`memory`,-1),V(`td`,gU,M(i.value??`-`),1)])])])]),V(`div`,_U,[n[9]||=V(`h3`,{class:`section-title mb-2`},`overview`,-1),V(`table`,vU,[V(`tbody`,null,[V(`tr`,yU,[n[6]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`groups`,-1),V(`td`,bU,M(t.value?.groupCount??`-`),1)]),V(`tr`,xU,[n[7]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`chats`,-1),V(`td`,SU,M(t.value?.chatCount??`-`),1)]),V(`tr`,CU,[n[8]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`tasks`,-1),V(`td`,wU,M(t.value?.activeTaskCount??`-`),1)])])])])]))}}),EU={class:`grid gap-3 p-3`},DU={class:`border border-border p-3`},OU={class:`grid gap-2`},kU={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},AU=[`checked`],jU={class:`flex items-center gap-2`},MU=[`value`],NU=[`value`],PU={class:`grid gap-1`},FU={class:`flex items-center gap-2`},IU=[`value`],LU={key:0,class:`flex flex-wrap gap-1 pl-14`},RU=[`title`,`onClick`],zU={class:`border border-border p-3`},BU={class:`grid gap-3`},VU={class:`grid gap-1`},HU={class:`text-[11px] text-muted`},UU=[`value`],WU={class:`grid gap-1`},GU={class:`text-[11px] text-muted`},KU=[`value`],qU={class:`grid gap-1`},JU={class:`text-[11px] text-muted`},YU=[`value`],XU=I({__name:`TtsTab`,setup(e){let{settings:t}=du(),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=N([]);function i(){r.value=speechSynthesis.getVoices()}Xr(()=>{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,au)}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)=>(z(),B(`div`,EU,[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`,DU,[r[9]||=V(`h3`,{class:`section-title mb-2`},`voice`,-1),V(`div`,OU,[V(`label`,kU,[V(`input`,{type:`checkbox`,checked:P(t).tts.enabled,class:`accent-accent`,onChange:r[0]||=e=>P(t).tts.enabled=!P(t).tts.enabled},null,40,AU),r[6]||=U(` enable text-to-speech `,-1)]),V(`div`,jU,[r[7]||=V(`span`,{class:`text-[11px] text-muted w-12`},`lang`,-1),V(`select`,{value:P(t).tts.lang,class:`flex-1 bg-surface border border-border rounded px-2 py-1 text-[12px] text-text`,onChange:r[1]||=e=>P(t).tts.lang=e.target.value},[(z(!0),B(R,null,L(n.value,e=>(z(),B(`option`,{key:e.value,value:e.value},M(e.label),9,NU))),128))],40,MU)]),V(`div`,PU,[V(`div`,FU,[r[8]||=V(`span`,{class:`text-[11px] text-muted w-12`},`match`,-1),V(`input`,{value:P(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=>P(t).tts.voiceMatch=e.target.value||void 0},null,40,IU)]),a.value.length?(z(),B(`div`,LU,[(z(!0),B(R,null,L(a.value,e=>(z(),B(`button`,{key:e.name,type:`button`,class:j([`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)},M(e.name),11,RU))),128))])):W(``,!0)])])]),V(`div`,zU,[r[10]||=V(`h3`,{class:`section-title mb-2`},`tuning`,-1),V(`div`,BU,[V(`label`,VU,[V(`span`,HU,`rate — `+M(P(t).tts.rate.toFixed(1))+`x`,1),V(`input`,{type:`range`,value:P(t).tts.rate,min:`0.5`,max:`3`,step:`0.1`,class:`accent-accent`,onInput:r[3]||=e=>P(t).tts.rate=+e.target.value},null,40,UU)]),V(`label`,WU,[V(`span`,GU,`pitch — `+M(P(t).tts.pitch.toFixed(1)),1),V(`input`,{type:`range`,value:P(t).tts.pitch,min:`0`,max:`2`,step:`0.1`,class:`accent-accent`,onInput:r[4]||=e=>P(t).tts.pitch=+e.target.value},null,40,KU)]),V(`label`,qU,[V(`span`,JU,`volume — `+M(Math.round(P(t).tts.volume*100))+`%`,1),V(`input`,{type:`range`,value:P(t).tts.volume,min:`0`,max:`1`,step:`0.05`,class:`accent-accent`,onInput:r[5]||=e=>P(t).tts.volume=+e.target.value},null,40,YU)])])])]))}}),ZU={class:`flex flex-col h-full`},QU={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},$U={key:6,class:`flex-1 flex items-center justify-center p-6`},eW={key:`settings`,label:`Settings`,icon:`lucide:sliders-horizontal`,color:`#c5cdd8`,lightColor:`#6e7681`,component:I({__name:`window`,setup(e){let t=[`desktop`,`dash`,`tts`,`config`,`host`,`server`,`reset`],{state:n,set:r}=gu(),i=N(t.includes(n.value.tab)?n.value.tab:`desktop`);F(i,e=>r({tab:e}));function a(){location.href=`/reset.html`}return(e,t)=>(z(),B(`div`,ZU,[V(`div`,QU,[V(`button`,{type:`button`,class:j(i.value===`desktop`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`desktop`},` desktop `,2),V(`button`,{type:`button`,class:j(i.value===`dash`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`dash`},` dash `,2),V(`button`,{type:`button`,class:j(i.value===`tts`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>i.value=`tts`},` tts `,2),V(`button`,{type:`button`,class:j(i.value===`config`?`tab-active`:`tab-inactive`),onClick:t[3]||=e=>i.value=`config`},` config `,2),V(`button`,{type:`button`,class:j(i.value===`host`?`tab-active`:`tab-inactive`),onClick:t[4]||=e=>i.value=`host`},` host `,2),V(`button`,{type:`button`,class:j(i.value===`server`?`tab-active`:`tab-inactive`),onClick:t[5]||=e=>i.value=`server`},` server `,2),V(`button`,{type:`button`,class:j(i.value===`reset`?`tab-active`:`tab-inactive`),onClick:t[6]||=e=>i.value=`reset`},` reset `,2)]),i.value===`desktop`?(z(),La(zH,{key:0})):i.value===`dash`?(z(),La(_H,{key:1})):i.value===`tts`?(z(),La(XU,{key:2})):i.value===`config`?(z(),La(nH,{key:3})):i.value===`host`?(z(),La(rU,{key:4})):i.value===`server`?(z(),La(TU,{key:5})):i.value===`reset`?(z(),B(`div`,$U,[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}},tW={class:`p-3`},nW={class:`flex gap-2 items-center mb-2`},rW={class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},iW={class:`mb-2`},aW={class:`mb-2`},oW={class:`mb-2`},sW={class:`mb-2`},cW={class:`mb-2`},lW={class:`w-full border-collapse text-[12px]`},uW={key:0},dW=[`title`],fW={class:`py-1.5 px-2 border-b border-border text-muted`},pW={class:`py-1.5 px-2 border-b border-border text-muted`},mW={class:`py-1.5 px-2 border-b border-border`},hW={class:`py-1.5 px-2 border-b border-border text-muted`},gW=[`title`],_W={class:`py-1.5 px-2 border-b border-border`},vW=[`onClick`],yW=[`onClick`],bW={key:`tasks`,label:`Tasks`,icon:`lucide:list-checks`,color:`#d29922`,component:I({__name:`window`,setup(e){let{alert:t}=Bu(),n=N([]),r=N(!1),i=N(``),a=N(`cron`),o=N(``),s=N(`group`),c=N(``);async function l(){n.value=await Cu(`/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 Su(`/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 Su(`/api/tasks/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})}),await l()}return qu(l,5e3),(e,t)=>(z(),B(`div`,tW,[V(`div`,nW,[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?(z(),La(Il,{key:0,title:`new task`,width:`520px`,onClose:u},{default:Xn(()=>[V(`form`,{onSubmit:Rs(d,[`prevent`]),onKeydown:Bs(u,[`escape`])},[V(`div`,rW,[V(`div`,iW,[t[7]||=V(`label`,{class:`label`},`chat jid`,-1),Zn(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),[[Ms,i.value]])]),V(`div`,aW,[t[9]||=V(`label`,{class:`label`},`schedule type`,-1),Zn(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),[[Ns,a.value]])]),V(`div`,oW,[t[10]||=V(`label`,{class:`label`},`schedule value`,-1),Zn(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),[[Ms,o.value]])]),V(`div`,sW,[t[12]||=V(`label`,{class:`label`},`context`,-1),Zn(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),[[Ns,s.value]])])]),V(`div`,cW,[t[13]||=V(`label`,{class:`label`},`prompt`,-1),Zn(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),[[Ms,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`,lW,[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?(z(),B(`tr`,uW,[...t[16]||=[V(`td`,{colspan:`7`,class:`text-center py-8 text-muted text-[12px]`},`no scheduled tasks`,-1)]])):W(``,!0),(z(!0),B(R,null,L(n.value,e=>(z(),B(`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},M(e.prompt.slice(0,60)),9,dW),V(`td`,fW,M(e.schedule_type),1),V(`td`,pW,M(e.schedule_value),1),V(`td`,mW,[V(`span`,{class:j(P(Ch)(e.status))},M(e.status),3)]),V(`td`,hW,M(P(bh)(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||``},M(e.last_result||`-`),9,gW),V(`td`,_W,[e.status===`active`?(z(),B(`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,vW)):e.status===`paused`?(z(),B(`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,yW)):W(``,!0)])]))),128))])])]))}}),window:{width:900,height:420,minwidth:420,minheight:240}},xW={class:`grid gap-3 p-3`},SW={key:0,class:`border border-border p-3`},CW={class:`w-full border-collapse text-[12px]`},wW={key:0,class:`hover:bg-surface`},TW={class:`py-1.5 px-2 border-b border-border font-mono`},EW=[`href`],DW={class:`hover:bg-surface`},OW={class:`py-1.5 px-2`},kW={key:0,class:`text-muted`},AW={key:1,class:`text-muted`},jW={key:1,class:`border border-border p-3`},MW={key:2,class:`border border-border p-3`},NW={key:0,class:`text-[11px] text-danger mb-2`},PW=[`disabled`],FW={key:3,class:`border border-border p-3`},IW={class:`mb-2`},LW={key:0,class:`text-[11px] text-danger mb-2`},RW=[`disabled`],zW={key:4,class:`border border-border p-3`},BW=[`disabled`],VW={key:`telegram`,label:`Telegram`,icon:`simple-icons:telegram`,color:`#2AABEE`,component:I({__name:`window`,setup(e){let t=N(null),n=N(``),r=N(!1),i=N(``),a=G(()=>t.value?.connected??!1);async function o(){let e=await Cu(`/api/telegram/status`);e&&(t.value=e)}async function s(){if(n.value.trim()){r.value=!0,i.value=``;try{(await Su(`/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 Su(`/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 Su(`/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 qu(o,5e3),(e,o)=>(z(),B(`div`,xW,[a.value?(z(),B(`div`,SW,[o[4]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,CW,[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?(z(),B(`tr`,wW,[o[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`bot`,-1),V(`td`,TW,[V(`a`,{href:`https://t.me/${t.value.botUsername}?start=help`,target:`_blank`,class:`text-accent hover:underline`},`@`+M(t.value.botUsername),9,EW)])])):W(``,!0),V(`tr`,DW,[o[2]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`source`,-1),V(`td`,OW,[t.value?.hasEnvToken?(z(),B(`span`,kW,`env`)):t.value?.configured?(z(),B(`span`,AW,`saved`)):W(``,!0)])])])])])):W(``,!0),!a.value&&!l.value?(z(),B(`div`,jW,[...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?(z(),B(`div`,MW,[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?(z(),B(`div`,NW,M(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},M(r.value?`reconnecting...`:`reconnect`),9,PW)])):W(``,!0),!a.value&&!l.value?(z(),B(`div`,FW,[o[9]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Rs(s,[`prevent`])},[V(`div`,IW,[o[8]||=V(`label`,{class:`label`},`bot token`,-1),Zn(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),[[Ms,n.value]])]),i.value?(z(),B(`div`,LW,M(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`},M(r.value?`connecting...`:`connect`),9,RW)],32)])):W(``,!0),a.value||l.value?(z(),B(`div`,zW,[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,BW)])):W(``,!0)]))}}),window:{width:420,height:420,minwidth:320,minheight:200,autosize:!0}},HW=Object.defineProperty,UW=Object.getOwnPropertyDescriptor,WW=(e,t)=>{for(var n in t)HW(e,n,{get:t[n],enumerable:!0})},GW=(e,t,n,r)=>{for(var i=r>1?void 0:r?UW(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&&HW(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),KW=`Terminal input`,qW={get:()=>KW,set:e=>KW=e},JW=`Too much output to announce, navigate to rows manually to read`,YW={get:()=>JW,set:e=>JW=e};function XW(e){return e.replace(/\r?\n/g,`\r`)}function ZW(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function QW(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function $W(e,t,n,r){e.stopPropagation(),e.clipboardData&&eG(e.clipboardData.getData(`text/plain`),t,n,r)}function eG(e,t,n,r){e=XW(e),e=ZW(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function tG(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 nG(e,t,n,r,i){tG(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function rG(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function iG(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 aG=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}},oG=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}},sG=``,cG=` `,lG=class e{constructor(){this.fg=0,this.bg=0,this.extended=new uG}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}},uG=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}},dG=class e extends lG{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new uG,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?rG(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()]}},fG=`di$target`,pG=`di$dependencies`,mG=new Map;function hG(e){return e[pG]||[]}function gG(e){if(mG.has(e))return mG.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);_G(t,e,r)};return t._id=e,mG.set(e,t),t}function _G(e,t,n){t[fG]===t?t[pG].push({id:e,index:n}):(t[pG]=[{id:e,index:n}],t[fG]=t)}var vG=gG(`BufferService`),yG=gG(`CoreMouseService`),bG=gG(`CoreService`),xG=gG(`CharsetService`),SG=gG(`InstantiationService`),CG=gG(`LogService`),wG=gG(`OptionsService`),TG=gG(`OscLinkService`),EG=gG(`UnicodeService`),DG=gG(`DecorationService`),OG=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 dG,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):kG(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)}};OG=GW([Z(0,vG),Z(1,wG),Z(2,TG)],OG);function kG(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 AG=gG(`CharSizeService`),jG=gG(`CoreBrowserService`),MG=gG(`MouseService`),NG=gG(`RenderService`),PG=gG(`SelectionService`),FG=gG(`CharacterJoinerService`),IG=gG(`ThemeService`),LG=gG(`LinkProviderService`),RG=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?WG.isErrorNoTelemetry(e)?new WG(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 zG(e){VG(e)||RG.onUnexpectedError(e)}var BG=`Canceled`;function VG(e){return e instanceof HG?!0:e instanceof Error&&e.name===BG&&e.message===BG}var HG=class extends Error{constructor(){super(BG),this.name=this.message}};function UG(e){return e?Error(`Illegal argument: ${e}`):Error(`Illegal argument`)}var WG=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`}},GG=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function KG(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 qG=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=KG(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};qG.assertInvariants=!1;function JG(e,t=0){return e[e.length-(1+t)]}var YG;(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})(YG||={});function XG(e,t){return(n,r)=>t(e(n),e(r))}var ZG=(e,t)=>e-t,QG=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||YG.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};QG.empty=new QG(e=>{});function $G(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 eK=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 tK(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 nK;(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})(nK||={});var rK=!1,iK=null,aK=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 eK;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(XG(e=>e.idx,ZG));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=$G([...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}}};aK.idx=0;function oK(e){iK=e}if(rK){let e=`__is_disposable_tracked__`;oK(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==_K.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==_K.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function sK(e){return iK?.trackDisposable(e),e}function cK(e){iK?.markAsDisposed(e)}function lK(e,t){iK?.setParent(e,t)}function uK(e,t){if(iK)for(let n of e)iK.setParent(n,t)}function dK(e){return iK?.markAsSingleton(e),e}function fK(e){if(nK.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 pK(...e){let t=mK(()=>fK(e));return uK(e,t),t}function mK(e){let t=sK({dispose:tK(()=>{cK(t),e()})});return t}var hK=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,sK(this)}dispose(){this._isDisposed||(cK(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fK(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return lK(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),lK(e,null))}};hK.DISABLE_DISPOSED_WARNING=!1;var gK=hK,_K=class{constructor(){this._store=new gK,sK(this),lK(this._store,this)}dispose(){cK(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};_K.None=Object.freeze({dispose(){}});var vK=class{constructor(){this._isDisposed=!1,sK(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&lK(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,cK(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&lK(e,null),e}},yK=typeof window==`object`?window:globalThis,bK=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};bK.Undefined=new bK(void 0);var xK=bK,SK=class{constructor(){this._first=xK.Undefined,this._last=xK.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===xK.Undefined}clear(){let e=this._first;for(;e!==xK.Undefined;){let t=e.next;e.prev=xK.Undefined,e.next=xK.Undefined,e=t}this._first=xK.Undefined,this._last=xK.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new xK(e);if(this._first===xK.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!==xK.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==xK.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==xK.Undefined&&e.next!==xK.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===xK.Undefined&&e.next===xK.Undefined?(this._first=xK.Undefined,this._last=xK.Undefined):e.next===xK.Undefined?(this._last=this._last.prev,this._last.next=xK.Undefined):e.prev===xK.Undefined&&(this._first=this._first.next,this._first.prev=xK.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==xK.Undefined;)yield e.element,e=e.next}},CK=globalThis.performance&&typeof globalThis.performance.now==`function`,wK=class e{static create(t){return new e(t)}constructor(e){this._now=CK&&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}},TK=!1,EK=!1,DK=!1,OK;(e=>{e.None=()=>_K.None;function t(e){if(DK){let{onDidAddListener:t}=e,n=PK.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(pK(...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 w(e,t){return e(e=>t.fire(e))}e.forward=w;function T(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=T;class E{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 D(e,t){return new E(e,t).emitter.event}e.fromObservable=D;function O(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 gK?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=O})(OK||={});var kK=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 wK,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}}};kK.all=new Set,kK._idPool=0;var AK=kK,jK=-1,MK=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 FK(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}};MK._idPool=1;var NK=MK,PK=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
|
-
`))}},FK=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},IK=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},LK=0,RK=class{constructor(e){this.value=e,this.id=LK++}},zK=2,BK=(e,t)=>{if(e instanceof RK)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},VK;if(TK){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),VK=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=jK>0||this._options?.leakWarningThreshold?new NK(e?.onListenerError??zG,this._options?.leakWarningThreshold??jK):void 0,this._perfMon=this._options?._profName?new AK(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(EK){let e=this._listeners;queueMicrotask(()=>{BK(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 IK(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||zG)(n),_K.None}if(this._disposed)return _K.None;t&&(e=e.bind(t));let r=new RK(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=PK.create(),i=this._leakageMon.check(r.stack,this._size+1)),EK&&(r.stack=PK.create()),this._listeners?this._listeners instanceof RK?(this._deliveryQueue??=new HK,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=mK(()=>{VK?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof gK?n.add(a):Array.isArray(n)&&n.push(a),VK){let e=Error().stack.split(`
|
|
196
|
-
`).slice(2,3).join(`
|
|
197
|
-
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);VK.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*zK<=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||zG;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 RK)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}},HK=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}},UK=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}};UK.INSTANCE=new UK;var WK=UK;function GK(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}WK.INSTANCE.onDidChangeZoomLevel;function KK(e){return WK.INSTANCE.getZoomFactor(e)}WK.INSTANCE.onDidChangeFullscreen;var qK=typeof navigator==`object`?navigator.userAgent:``,JK=qK.indexOf(`Firefox`)>=0,YK=qK.indexOf(`AppleWebKit`)>=0,XK=qK.indexOf(`Chrome`)>=0,ZK=!XK&&qK.indexOf(`Safari`)>=0;qK.indexOf(`Electron/`),qK.indexOf(`Android`);var QK=!1;if(typeof yK.matchMedia==`function`){let e=yK.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=yK.matchMedia(`(display-mode: fullscreen)`);QK=e.matches,GK(yK,e,({matches:e})=>{QK&&t.matches||(QK=e)})}function $K(){return QK}var eq=`en`,tq=!1,nq=!1,rq=!1,iq=!1,aq=!1,oq=eq,sq,cq=globalThis,lq;typeof cq.vscode<`u`&&typeof cq.vscode.process<`u`?lq=cq.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(lq=process);var uq=typeof lq?.versions?.electron==`string`&&lq?.type===`renderer`;if(typeof lq==`object`){tq=lq.platform===`win32`,nq=lq.platform===`darwin`,rq=lq.platform===`linux`,rq&&lq.env.SNAP&&lq.env.SNAP_REVISION,lq.env.CI||lq.env.BUILD_ARTIFACTSTAGINGDIRECTORY,oq=eq;let e=lq.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,oq=t.resolvedLanguage||eq,t.languagePack?.translationsConfigFile}catch{}iq=!0}else typeof navigator==`object`&&!uq?(sq=navigator.userAgent,tq=sq.indexOf(`Windows`)>=0,nq=sq.indexOf(`Macintosh`)>=0,(sq.indexOf(`Macintosh`)>=0||sq.indexOf(`iPad`)>=0||sq.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,rq=sq.indexOf(`Linux`)>=0,sq?.indexOf(`Mobi`),aq=!0,oq=globalThis._VSCODE_NLS_LANGUAGE||eq,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var dq=tq,fq=nq,pq=rq,mq=iq;aq&&typeof cq.importScripts==`function`&&cq.origin;var hq=sq,gq=oq,_q;(e=>{function t(){return gq}e.value=t;function n(){return gq.length===2?gq===`en`:gq.length>=3?gq[0]===`e`&&gq[1]===`n`&&gq[2]===`-`:!1}e.isDefaultVariant=n;function r(){return gq===`en`}e.isDefault=r})(_q||={});var vq=typeof cq.postMessage==`function`&&!cq.importScripts;(()=>{if(vq){let e=[];cq.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}),cq.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var yq=!!(hq&&hq.indexOf(`Chrome`)>=0);hq&&hq.indexOf(`Firefox`),!yq&&hq&&hq.indexOf(`Safari`),hq&&hq.indexOf(`Edg/`),hq&&hq.indexOf(`Android`);var bq=typeof navigator==`object`?navigator:{};mq||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||bq&&bq.clipboard&&bq.clipboard.writeText,mq||bq&&bq.clipboard&&bq.clipboard.readText,mq||$K()||bq.keyboard,`ontouchstart`in yK||bq.maxTouchPoints,yK.PointerEvent&&(`ontouchstart`in yK||navigator.maxTouchPoints);var xq=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}},Sq=new xq,Cq=new xq,wq=new xq,Tq=Array(230),Eq;(e=>{function t(e){return Sq.keyCodeToStr(e)}e.toString=t;function n(e){return Sq.strToKeyCode(e)}e.fromString=n;function r(e){return Cq.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return wq.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Cq.strToKeyCode(e)||wq.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 Sq.keyCodeToStr(e)}e.toElectronAccelerator=o})(Eq||={});var Dq=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 Oq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Oq=class{constructor(e){if(e.length===0)throw UG(`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 kq(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Eq.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(JK)switch(t){case 59:return 85;case 60:if(pq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fq)return 57;break}else if(YK&&(fq&&t===93||!fq&&t===92))return 57;return Tq[t]||0}var Aq=fq?256:2048,jq=512,Mq=1024,Nq=fq?2048:256,Pq=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=kq(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|=Aq),this.altKey&&(t|=jq),this.shiftKey&&(t|=Mq),this.metaKey&&(t|=Nq),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Dq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Fq=new WeakMap;function Iq(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 Lq=class{static getSameOriginWindowChain(e){let t=Fq.get(e);if(!t){t=[],Fq.set(e,t);let n=e,r;do r=Iq(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}}},Rq=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=Lq.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},zq=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(XK){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?JK&&!fq?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)ZK&&dq?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?JK&&!fq?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()}},Bq=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Vq;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Hq?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:OK.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Bq})})(Vq||={});var Hq=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?Bq:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Uq=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 GG(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new GG(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Wq=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 GG(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=mK(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Gq;(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})(Gq||={});var Kq=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 OK.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())}};Kq.EMPTY=Kq.fromArray([]);function qq(e){return 55296<=e&&e<=56319}function Jq(e){return 56320<=e&&e<=57343}function Yq(e,t){return(e-55296<<10)+(t-56320)+65536}function Xq(e){return Zq(e,0)}function Zq(e,t){switch(typeof e){case`object`:return e===null?Qq(349,t):Array.isArray(e)?tJ(e,t):nJ(e,t);case`string`:return eJ(e,t);case`boolean`:return $q(e,t);case`number`:return Qq(e,t);case`undefined`:return Qq(937,t);default:return Qq(617,t)}}function Qq(e,t){return(t<<5)-t+e|0}function $q(e,t){return Qq(e?433:863,t)}function eJ(e,t){t=Qq(149417,t);for(let n=0,r=e.length;n<r;n++)t=Qq(e.charCodeAt(n),t);return t}function tJ(e,t){return t=Qq(104579,t),e.reduce((e,t)=>Zq(t,e),t)}function nJ(e,t){return t=Qq(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=eJ(n,t),Zq(e[n],t)),t)}function rJ(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function iJ(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function aJ(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function oJ(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):aJ((e>>>0).toString(16),t/4)}var sJ=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(qq(a))if(o+1<t){let t=e.charCodeAt(o+1);Jq(t)?(o++,s=Yq(a,t)):s=65533}else{i=a;break}else Jq(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()),oJ(this._h0)+oJ(this._h1)+oJ(this._h2)+oJ(this._h3)+oJ(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,iJ(this._buff,this._buffLen),this._buffLen>56&&(this._step(),iJ(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,rJ(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=rJ(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=rJ(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}};sJ._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:cJ,getWindow:lJ,getDocument:uJ,getWindows:dJ,getWindowsCount:fJ,getWindowId:pJ,getWindowById:mJ,hasWindow:hJ,onDidRegisterWindow:gJ,onWillUnregisterWindow:_J,onDidUnregisterWindow:vJ}=function(){let e=new Map,t={window:yK,disposables:new gK};e.set(yK.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 _K.None;let a=new gK,o={window:t,disposables:a.add(new gK)};return e.set(t.vscodeWindowId,o),a.add(mK(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(bJ(t,kJ.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:yK},getDocument(e){return lJ(e).document}}}(),yJ=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 bJ(e,t,n,r){return new yJ(e,t,n,r)}function xJ(e,t){return function(n){return t(new Rq(e,n))}}function SJ(e){return function(t){return e(new Pq(t))}}var CJ=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=xJ(lJ(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=SJ(n)),bJ(e,t,i,r)},wJ,TJ=class extends Wq{constructor(e){super(),this.defaultTarget=e&&lJ(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},EJ=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){zG(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(EJ.sort),a.shift().execute();r.set(i,!1)};wJ=(t,r,a=0)=>{let o=pJ(t),s=new EJ(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 DJ=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}};DJ.None=new DJ(0,0);function OJ(e){let t=e.getBoundingClientRect(),n=lJ(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=Xq(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(mK(()=>{--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 kJ={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:YK?`webkitAnimationStart`:`animationstart`,ANIMATION_END:YK?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:YK?`webkitAnimationIteration`:`animationiteration`},AJ=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function jJ(e,t,n,...r){let i=AJ.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 MJ(e,t,...n){return jJ(`http://www.w3.org/1999/xhtml`,e,t,...n)}MJ.SVG=function(e,t,...n){return jJ(`http://www.w3.org/2000/svg`,e,t,...n)};var NJ=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=PJ(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=PJ(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=PJ(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=PJ(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=PJ(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=PJ(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=PJ(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=PJ(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=PJ(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=PJ(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=PJ(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=PJ(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=PJ(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=PJ(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 PJ(e){return typeof e==`number`?`${e}px`:e}function FJ(e){return new NJ(e)}var IJ=class{constructor(){this._hooks=new gK,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(mK(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=lJ(e)}this._hooks.add(bJ(a,kJ.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(bJ(a,kJ.POINTER_UP,e=>this.stopMonitoring(!0)))}};function LJ(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 RJ;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(RJ||={});var zJ=class e extends _K{constructor(){super(),this.dispatched=!1,this.targets=new SK,this.ignoreTargets=new SK,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(OK.runAndSubscribe(gJ,({window:e,disposables:t})=>{t.add(bJ(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(bJ(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(bJ(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:yK,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=dK(new e),mK(e.INSTANCE.targets.push(t))):_K.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=dK(new e),mK(e.INSTANCE.ignoreTargets.push(t))):_K.None}static isTouchDevice(){return`ontouchstart`in yK||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(RJ.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-JG(s.rollingPageX))<30&&Math.abs(s.initialPageY-JG(s.rollingPageY))<30){let e=this.newGestureEvent(RJ.Tap,s.initialTarget);e.pageX=JG(s.rollingPageX),e.pageY=JG(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-JG(s.rollingPageX))<30&&Math.abs(s.initialPageY-JG(s.rollingPageY))<30){let e=this.newGestureEvent(RJ.Contextmenu,s.initialTarget);e.pageX=JG(s.rollingPageX),e.pageY=JG(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=JG(s.rollingPageX),n=JG(s.rollingPageY),i=JG(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(RJ.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===RJ.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===RJ.Change||t.type===RJ.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=wJ(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(RJ.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(RJ.Change,i.initialTarget);a.translationX=r.pageX-JG(i.rollingPageX),a.translationY=r.pageY-JG(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)}};zJ.SCROLL_FRICTION=-.005,zJ.HOLD_DELAY=700,zJ.CLEAR_TAP_COUNT_TIME=400,GW([LJ],zJ,`isTouchDevice`,1);var BJ=zJ,VJ=class extends _K{onclick(e,t){this._register(bJ(e,kJ.CLICK,n=>t(new Rq(lJ(e),n))))}onmousedown(e,t){this._register(bJ(e,kJ.MOUSE_DOWN,n=>t(new Rq(lJ(e),n))))}onmouseover(e,t){this._register(bJ(e,kJ.MOUSE_OVER,n=>t(new Rq(lJ(e),n))))}onmouseleave(e,t){this._register(bJ(e,kJ.MOUSE_LEAVE,n=>t(new Rq(lJ(e),n))))}onkeydown(e,t){this._register(bJ(e,kJ.KEY_DOWN,e=>t(new Pq(e))))}onkeyup(e,t){this._register(bJ(e,kJ.KEY_UP,e=>t(new Pq(e))))}oninput(e,t){this._register(bJ(e,kJ.INPUT,t))}onblur(e,t){this._register(bJ(e,kJ.BLUR,t))}onfocus(e,t){this._register(bJ(e,kJ.FOCUS,t))}onchange(e,t){this._register(bJ(e,kJ.CHANGE,t))}ignoreGesture(e){return BJ.ignoreTarget(e)}},HJ=11,UJ=class extends VJ{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=HJ+`px`,this.domNode.style.height=HJ+`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 IJ),this._register(CJ(this.bgDomNode,kJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(CJ(this.domNode,kJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new TJ),this._pointerdownScheduleRepeatTimer=this._register(new Uq)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,lJ(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},WJ=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}}},GJ=class extends _K{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 WJ(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 YJ(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=YJ.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)))}},KJ=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function qJ(e,t){let n=t-e;return function(t){return e+n*ZJ(t)}}function JJ(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var YJ=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),JJ(qJ(e,r),qJ(i,t),.33)}return qJ(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 KJ(this.scrollLeft(t),this.scrollTop(t),!1):new KJ(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 XJ(e){return e**3}function ZJ(e){return 1-XJ(1-e)}var QJ=class extends _K{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 Uq)}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`:``)))}},$J=140,eY=class extends VJ{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 QJ(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new IJ),this._shouldRender=!0,this.domNode=FJ(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(bJ(this.domNode.domNode,kJ.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new UJ(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=FJ(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(bJ(this.slider.domNode,kJ.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=OJ(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(dq&&a>$J){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()}},tY=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)}},nY=class extends eY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tY(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}},rY=class extends eY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tY(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}},iY=500,aY=50,oY=!0,sY=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},cY=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(XK){let t=KK(lJ(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 sY(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}};cY.INSTANCE=new cY;var lY=cY,uY=class extends VJ{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=fY(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 rY(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new nY(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=FJ(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=FJ(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=FJ(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 Uq),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=fK(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,fq&&(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 zq(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=fK(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(bJ(this._listenOnDomNode,kJ.MOUSE_WHEEL,e=>{this._onMouseWheel(new zq(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=lY.INSTANCE;oY&&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=!fq&&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=aY*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=aY*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)&&(oY&&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(),iY)}},dY=class extends uY{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 fY(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,fq&&(t.className+=` mac`),t}var pY=class extends _K{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 GJ({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>wJ(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new dY(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(OK.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(mK(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(mK(()=>this._styleElement.remove())),this._register(OK.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}};pY=GW([Z(2,vG),Z(3,jG),Z(4,yG),Z(5,IG),Z(6,wG),Z(7,NG)],pY);var mY=class extends _K{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(mK(()=>{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()}};mY=GW([Z(1,vG),Z(2,jG),Z(3,DG),Z(4,NG)],mY);var hY=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)}},gY={full:0,left:0,center:0,right:0},_Y={full:0,left:0,center:0,right:0},vY={full:0,left:0,center:0,right:0},yY=class extends _K{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 hY,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(mK(()=>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);_Y.full=this._canvas.width,_Y.left=e,_Y.center=t,_Y.right=e,this._refreshDrawHeightConstants(),vY.full=1,vY.left=1,vY.center=1+_Y.left,vY.right=1+_Y.left+_Y.center}_refreshDrawHeightConstants(){gY.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);gY.left=t,gY.center=t,gY.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gY.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gY.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gY.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gY.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(vY[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-gY[e.position||`full`]/2),_Y[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+gY[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}))}};yY=GW([Z(2,vG),Z(3,DG),Z(4,NG),Z(5,wG),Z(6,IG),Z(7,jG)],yY);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 bY;(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=``))(bY||={});var xY;(e=>e.ST=`${$.ESC}\\`)(xY||={});var SY=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)}}};SY=GW([Z(2,vG),Z(3,wG),Z(4,bG),Z(5,NG)],SY);var CY=0,wY=0,TY=0,EY=0,DY={css:`#00000000`,rgba:0},OY;(e=>{function t(e,t,n,r){return r===void 0?`#${NY(e)}${NY(t)}${NY(n)}`:`#${NY(e)}${NY(t)}${NY(n)}${NY(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})(OY||={});var kY;(e=>{function t(e,t){if(EY=(t.rgba&255)/255,EY===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 CY=a+Math.round((n-a)*EY),wY=o+Math.round((r-o)*EY),TY=s+Math.round((i-s)*EY),{css:OY.toCss(CY,wY,TY),rgba:OY.toRgba(CY,wY,TY)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=MY.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return OY.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[CY,wY,TY]=MY.toChannels(t),{css:OY.toCss(CY,wY,TY),rgba:t}}e.opaque=i;function a(e,t){return EY=Math.round(t*255),[CY,wY,TY]=MY.toChannels(e.rgba),{css:OY.toCss(CY,wY,TY,EY),rgba:OY.toRgba(CY,wY,TY,EY)}}e.opacity=a;function o(e,t){return EY=e.rgba&255,a(e,EY*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(kY||={});var AY;(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 CY=parseInt(e.slice(1,2).repeat(2),16),wY=parseInt(e.slice(2,3).repeat(2),16),TY=parseInt(e.slice(3,4).repeat(2),16),OY.toColor(CY,wY,TY);case 5:return CY=parseInt(e.slice(1,2).repeat(2),16),wY=parseInt(e.slice(2,3).repeat(2),16),TY=parseInt(e.slice(3,4).repeat(2),16),EY=parseInt(e.slice(4,5).repeat(2),16),OY.toColor(CY,wY,TY,EY);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 CY=parseInt(r[1]),wY=parseInt(r[2]),TY=parseInt(r[3]),EY=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),OY.toColor(CY,wY,TY,EY);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[CY,wY,TY,EY]=t.getImageData(0,0,1,1).data,EY!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:OY.toRgba(CY,wY,TY,EY),css:e}}e.toColor=r})(AY||={});var jY;(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})(jY||={});var MY;(e=>{function t(e,t){if(EY=(t&255)/255,EY===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 CY=a+Math.round((n-a)*EY),wY=o+Math.round((r-o)*EY),TY=s+Math.round((i-s)*EY),OY.toRgba(CY,wY,TY)}e.blend=t;function n(e,t,n){let a=jY.relativeLuminance(e>>8),o=jY.relativeLuminance(t>>8);if(PY(a,o)<n){if(o<a){let o=r(e,t,n),s=PY(a,jY.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>PY(a,jY.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=PY(a,jY.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>PY(a,jY.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=PY(jY.relativeLuminance2(o,s,c),jY.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=PY(jY.relativeLuminance2(o,s,c),jY.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=PY(jY.relativeLuminance2(o,s,c),jY.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=PY(jY.relativeLuminance2(o,s,c),jY.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})(MY||={});function NY(e){let t=e.toString(16);return t.length<2?`0`+t:t}function PY(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FY=class extends lG{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()]}},IY=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new dG}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||cG.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++)IY._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||cG.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}};IY=GW([Z(0,vG)],IY);function LY(e){return 57508<=e&&e<=57558}function RY(e){return 9472<=e&&e<=9631}function zY(e){return LY(e)||RY(e)}function BY(){return{css:{canvas:VY(),cell:VY()},device:{canvas:VY(),cell:VY(),char:{width:0,height:0,left:0,top:0}}}}function VY(){return{width:0,height:0}}var HY=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 dG,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,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let ee=0;ee<m;ee++){e.loadCell(ee,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let te=!1,ne=ee>=E,re=ee,k=this._workCell;if(f.length>0&&ee===f[0][0]&&ne){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)ne&&=i===this._isCellInSelection(v,t);ne&&=!n||a<r[0]||a>=r[1],ne?(te=!0,k=new FY(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),re=r[1]-1,m=k.getWidth()):E=r[1]}let ie=this._isCellInSelection(ee,t),ae=n&&ee===a,oe=O&&ee>=l&&ee<=u,se=!1;this._decorationService.forEachDecorationAtCell(ee,t,void 0,e=>{se=!0});let ce=k.getChars()||cG;if(ce===` `&&(k.isUnderline()||k.isOverline())&&(ce=`\xA0`),T=m*s-c.get(ce,k.isBold(),k.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(ie&&w||!ie&&!w&&k.bg===y)&&(ie&&w&&p.selectionForeground||k.fg===b)&&k.extended.ext===x&&oe===S&&T===C&&!ae&&!te&&!se&&ne){k.isInvisible()?_+=cG:_+=ce,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=k.bg,b=k.fg,x=k.extended.ext,S=oe,C=T,w=ie,te&&a>=ee&&a<=re&&(a=ee),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(k.isBold()&&D.push(`xterm-bold`),k.isItalic()&&D.push(`xterm-italic`),k.isDim()&&D.push(`xterm-dim`),_=k.isInvisible()?cG:k.getChars()||cG,k.isUnderline()&&(D.push(`xterm-underline-${k.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!k.isUnderlineColorDefault()))if(k.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${lG.toColorRGB(k.getUnderlineColor()).join(`,`)})`;else{let e=k.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&k.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}k.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),k.isStrikethrough()&&D.push(`xterm-strikethrough`),oe&&(h.style.textDecoration=`underline`);let le=k.getFgColor(),ue=k.getFgColorMode(),de=k.getBgColor(),fe=k.getBgColorMode(),pe=!!k.isInverse();if(pe){let e=le;le=de,de=e;let t=ue;ue=fe,fe=t}let me,he,ge=!1;this._decorationService.forEachDecorationAtCell(ee,t,void 0,e=>{e.options.layer!==`top`&&ge||(e.backgroundColorRGB&&(fe=50331648,de=e.backgroundColorRGB.rgba>>8&16777215,me=e.backgroundColorRGB),e.foregroundColorRGB&&(ue=50331648,le=e.foregroundColorRGB.rgba>>8&16777215,he=e.foregroundColorRGB),ge=e.options.layer===`top`)}),!ge&&ie&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,de=me.rgba>>8&16777215,fe=50331648,ge=!0,p.selectionForeground&&(ue=50331648,le=p.selectionForeground.rgba>>8&16777215,he=p.selectionForeground)),ge&&D.push(`xterm-decoration-top`);let _e;switch(fe){case 16777216:case 33554432:_e=p.ansi[de],D.push(`xterm-bg-${de}`);break;case 50331648:_e=OY.toColor(de>>16,de>>8&255,de&255),this._addStyle(h,`background-color:#${UY((de>>>0).toString(16),`0`,6)}`);break;default:pe?(_e=p.foreground,D.push(`xterm-bg-257`)):_e=p.background}switch(me||k.isDim()&&(me=kY.multiplyOpacity(_e,.5)),ue){case 16777216:case 33554432:k.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(h,_e,p.ansi[le],k,me,void 0)||D.push(`xterm-fg-${le}`);break;case 50331648:let e=OY.toColor(le>>16&255,le>>8&255,le&255);this._applyMinimumContrast(h,_e,e,k,me,he)||this._addStyle(h,`color:#${UY(le.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,_e,p.foreground,k,me,he)||pe&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!ae&&!te&&!se&&ne?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),ee=re}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||zY(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=kY.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]}};HY=GW([Z(1,FG),Z(2,wG),Z(3,jG),Z(4,bG),Z(5,DG),Z(6,IG)],HY);function UY(e,t,n){for(;e.length<n;)e=t+e;return e}var WY=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}},GY=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 KY(){return new GY}var qY=`xterm-dom-renderer-owner-`,JY=`xterm-rows`,YY=`xterm-fg-`,XY=`xterm-bg-`,ZY=`xterm-focus`,QY=`xterm-selection`,$Y=1,eX=class extends _K{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=$Y++,this._rowElements=[],this._selectionRenderModel=KY(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(JY),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(QY),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=BY(),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(HY,document),this._element.classList.add(qY+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(mK(()=>{this._element.classList.remove(qY+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new WY(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} .${JY} 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} .${JY} { 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} .${JY} .xterm-dim { color: ${kY.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} .${JY}.${ZY} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${JY}.${ZY} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${JY}.${ZY} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${JY} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${JY} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${JY} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${JY} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${JY} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${QY} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${QY} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${QY} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${YY}${n} { color: ${r.css}; }${this._terminalSelector} .${YY}${n}.xterm-dim { color: ${kY.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${XY}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${YY}257 { color: ${kY.opaque(e.background).css}; }${this._terminalSelector} .${YY}257.xterm-dim { color: ${kY.multiplyOpacity(kY.opaque(e.background),.5).css}; }${this._terminalSelector} .${XY}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(ZY),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ZY),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`.${qY}${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))}}};eX=GW([Z(7,SG),Z(8,AG),Z(9,wG),Z(10,vG),Z(11,bG),Z(12,jG),Z(13,IG)],eX);var tX=class extends _K{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 iX(this._optionsService))}catch{this._measureStrategy=this._register(new rX(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())}};tX=GW([Z(2,wG)],tX);var nX=class extends _K{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)}},rX=class extends nX{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}},iX=class extends nX{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}},aX=class extends _K{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 oX(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(OK.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(bJ(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(bJ(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}},oX=class extends _K{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new vK),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(mK(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=bJ(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)}},sX=class extends _K{constructor(){super(),this.linkProviders=[],this._register(mK(()=>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 cX(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 lX(e,t,n,r,i,a,o,s,c){if(!a)return;let l=cX(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 uX=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return lX(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=cX(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])}}};uX=GW([Z(0,NG),Z(1,AG)],uX);var dX=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=[]}},fX={};WW(fX,{getSafariVersion:()=>yX,isChromeOS:()=>TX,isFirefox:()=>gX,isIpad:()=>xX,isIphone:()=>SX,isLegacyEdge:()=>_X,isLinux:()=>wX,isMac:()=>bX,isNode:()=>pX,isSafari:()=>vX,isWindows:()=>CX});var pX=typeof process<`u`&&`title`in process,mX=pX?`node`:navigator.userAgent,hX=pX?`node`:navigator.platform,gX=mX.includes(`Firefox`),_X=mX.includes(`Edge`),vX=/^((?!chrome|android).)*safari/i.test(mX);function yX(){if(!vX)return 0;let e=mX.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var bX=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(hX),xX=hX===`iPad`,SX=hX===`iPhone`,CX=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(hX),wX=hX.indexOf(`Linux`)>=0,TX=/\bCrOS\b/.test(mX),EX=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()}},DX=class extends EX{_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())}}},OX=class extends EX{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},kX=!pX&&`requestIdleCallback`in window?OX:DX,AX=class{constructor(){this._queue=new kX}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},jX=class extends _K{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 vK),this._pausedResizeTask=new AX,this._observerDisposable=this._register(new vK),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 dX((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new MX(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(mK(()=>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=mK(()=>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()}};jX=GW([Z(2,wG),Z(3,AG),Z(4,bG),Z(5,DG),Z(6,vG),Z(7,jG),Z(8,IG)],jX);var MX=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 NX(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return IX(i,a,e,t,n,r)+LX(a,t,n,r)+RX(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,GX(Math.abs(i-e),WX(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return GX(FX(a>t?e:i,n)+(s-1)*n.cols+1+PX(a>t?i:e,n),WX(o,r))}function PX(e,t){return e-1}function FX(e,t){return t.cols-e}function IX(e,t,n,r,i,a){return LX(t,r,i,a).length===0?``:GX(UX(e,t,e,t-BX(t,i),!1,i).length,WX(`D`,a))}function LX(e,t,n,r){let i=e-BX(e,n),a=t-BX(t,n);return GX(Math.abs(i-a)-zX(e,t,n),WX(HX(e,t),r))}function RX(e,t,n,r,i,a){let o;o=LX(t,r,i,a).length>0?r-BX(r,i):t;let s=r,c=VX(e,t,n,r,i,a);return GX(UX(e,o,n,s,c===`C`,i).length,WX(c,a))}function zX(e,t,n){let r=0,i=e-BX(e,n),a=t-BX(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=HX(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function BX(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 VX(e,t,n,r,i,a){let o;return o=LX(n,r,i,a).length>0?r-BX(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function HX(e,t){return e>t?`A`:`B`}function UX(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 WX(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function GX(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var KX=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 qX(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 JX=50,YX=15,XX=50,ZX=500,QX=RegExp(`\xA0`,`g`),$X=class extends _K{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 dG,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 KX(this._bufferService),this._activeSelectionMode=0,this._register(mK(()=>{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(QX,` `)).join(CX?`\r
|
|
200
|
-
`:`
|
|
201
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),wX&&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=qX(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=cX(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,-JX),JX),t/=JX,t/Math.abs(t)+Math.round(t*(YX-1)))}shouldForceSelection(e){return bX?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(),XX)}_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&&!(bX&&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<ZX&&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=NX(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=qX(n,this._bufferService.cols)}};$X=GW([Z(3,vG),Z(4,bG),Z(5,MG),Z(6,wG),Z(7,NG),Z(8,jG)],$X);var eZ=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={}}},tZ=class{constructor(){this._color=new eZ,this._css=new eZ}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()}},nZ=Object.freeze((()=>{let e=[AY.toColor(`#2e3436`),AY.toColor(`#cc0000`),AY.toColor(`#4e9a06`),AY.toColor(`#c4a000`),AY.toColor(`#3465a4`),AY.toColor(`#75507b`),AY.toColor(`#06989a`),AY.toColor(`#d3d7cf`),AY.toColor(`#555753`),AY.toColor(`#ef2929`),AY.toColor(`#8ae234`),AY.toColor(`#fce94f`),AY.toColor(`#729fcf`),AY.toColor(`#ad7fa8`),AY.toColor(`#34e2e2`),AY.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:OY.toCss(r,i,a),rgba:OY.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:OY.toCss(n,n,n),rgba:OY.toRgba(n,n,n)})}return e})()),rZ=AY.toColor(`#ffffff`),iZ=AY.toColor(`#000000`),aZ=AY.toColor(`#ffffff`),oZ=iZ,sZ={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},cZ=rZ,lZ=class extends _K{constructor(e){super(),this._optionsService=e,this._contrastCache=new tZ,this._halfContrastCache=new tZ,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:rZ,background:iZ,cursor:aZ,cursorAccent:oZ,selectionForeground:void 0,selectionBackgroundTransparent:sZ,selectionBackgroundOpaque:kY.blend(iZ,sZ),selectionInactiveBackgroundTransparent:sZ,selectionInactiveBackgroundOpaque:kY.blend(iZ,sZ),scrollbarSliderBackground:kY.opacity(rZ,.2),scrollbarSliderHoverBackground:kY.opacity(rZ,.4),scrollbarSliderActiveBackground:kY.opacity(rZ,.5),overviewRulerBorder:rZ,ansi:nZ.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=uZ(e.foreground,rZ),t.background=uZ(e.background,iZ),t.cursor=kY.blend(t.background,uZ(e.cursor,aZ)),t.cursorAccent=kY.blend(t.background,uZ(e.cursorAccent,oZ)),t.selectionBackgroundTransparent=uZ(e.selectionBackground,sZ),t.selectionBackgroundOpaque=kY.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=uZ(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=kY.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?uZ(e.selectionForeground,DY):void 0,t.selectionForeground===DY&&(t.selectionForeground=void 0),kY.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=kY.opacity(t.selectionBackgroundTransparent,.3)),kY.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=kY.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=uZ(e.scrollbarSliderBackground,kY.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=uZ(e.scrollbarSliderHoverBackground,kY.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=uZ(e.scrollbarSliderActiveBackground,kY.opacity(t.foreground,.5)),t.overviewRulerBorder=uZ(e.overviewRulerBorder,cZ),t.ansi=nZ.slice(),t.ansi[0]=uZ(e.black,nZ[0]),t.ansi[1]=uZ(e.red,nZ[1]),t.ansi[2]=uZ(e.green,nZ[2]),t.ansi[3]=uZ(e.yellow,nZ[3]),t.ansi[4]=uZ(e.blue,nZ[4]),t.ansi[5]=uZ(e.magenta,nZ[5]),t.ansi[6]=uZ(e.cyan,nZ[6]),t.ansi[7]=uZ(e.white,nZ[7]),t.ansi[8]=uZ(e.brightBlack,nZ[8]),t.ansi[9]=uZ(e.brightRed,nZ[9]),t.ansi[10]=uZ(e.brightGreen,nZ[10]),t.ansi[11]=uZ(e.brightYellow,nZ[11]),t.ansi[12]=uZ(e.brightBlue,nZ[12]),t.ansi[13]=uZ(e.brightMagenta,nZ[13]),t.ansi[14]=uZ(e.brightCyan,nZ[14]),t.ansi[15]=uZ(e.brightWhite,nZ[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]=uZ(e.extendedAnsi[r],nZ[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()}}};lZ=GW([Z(0,wG)],lZ);function uZ(e,t){if(e!==void 0)try{return AY.toColor(e)}catch{}return t}var dZ=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)}},fZ=class{constructor(){this._services=new dZ,this._services.set(SG,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=hG(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)}},pZ={trace:0,debug:1,info:2,warn:3,error:4,off:5},mZ=`xterm.js: `,hZ=class extends _K{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),gZ=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=pZ[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?``:mZ)+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)}};hZ=GW([Z(0,wG)],hZ);var gZ,_Z=class extends _K{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}},vZ=3,yZ=Object.freeze(new lG),bZ=0,xZ=2,SZ=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*vZ);let r=t||dG.fromCharData([0,sG,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*vZ+0],n=t&2097151;return[this._data[e*vZ+1],t&2097152?this._combined[e]:n?rG(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*vZ+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*vZ+0]=e|2097152|t[2]<<22):this._data[e*vZ+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*vZ+0]>>22}hasWidth(e){return this._data[e*vZ+0]&12582912}getFg(e){return this._data[e*vZ+1]}getBg(e){return this._data[e*vZ+2]}hasContent(e){return this._data[e*vZ+0]&4194303}getCodePoint(e){let t=this._data[e*vZ+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*vZ+0]&2097152}getString(e){let t=this._data[e*vZ+0];return t&2097152?this._combined[e]:t&2097151?rG(t&2097151):``}isProtected(e){return this._data[e*vZ+2]&536870912}loadCell(e,t){return bZ=e*vZ,t.content=this._data[bZ+0],t.fg=this._data[bZ+1],t.bg=this._data[bZ+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*vZ+0]=t.content,this._data[e*vZ+1]=t.fg,this._data[e*vZ+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*vZ+0]=t|n<<22,this._data[e*vZ+1]=r.fg,this._data[e*vZ+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*vZ+0];r&2097152?this._combined[e]+=rG(t):r&2097151?(this._combined[e]=rG(r&2097151)+rG(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*vZ+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 dG;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 dG;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*xZ<this._data.buffer.byteLength;let n=e*vZ;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*xZ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*xZ<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*vZ+0]&4194303)return e+(this._data[e*vZ+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*vZ+0]&4194303||this._data[e*vZ+2]&50331648)return e+(this._data[e*vZ+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<vZ;e++)this._data[(n+i)*vZ+e]=a[(t+i)*vZ+e];a[(t+i)*vZ+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<vZ;e++)this._data[(n+i)*vZ+e]=a[(t+i)*vZ+e];a[(t+i)*vZ+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*vZ+0],n=e&2097151,a=e&2097152?this._combined[t]:n?rG(n):cG;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 CZ(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=DZ(u,d,t),p=1,m=0;for(;p<u.length;){let e=DZ(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 wZ(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 TZ(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 EZ(e,t,n){let r=[],i=e.map((n,r)=>DZ(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=DZ(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 DZ(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 OZ=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(),fK(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};OZ._nextId=1;var kZ=OZ,AZ={},jZ=AZ.B;AZ[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},AZ.A={"#":`£`},AZ.B=void 0,AZ[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},AZ.C=AZ[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},AZ.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},AZ.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},AZ.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},AZ.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},AZ.E=AZ[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},AZ.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},AZ.H=AZ[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},AZ[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var MZ=4294967295,NZ=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=yZ.clone(),this.savedCharset=jZ,this.markers=[],this._nullCell=dG.fromCharData([0,sG,1,0]),this._whitespaceCell=dG.fromCharData([0,cG,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new kX,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _Z(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 uG),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 uG),this._whitespaceCell}getBlankLine(e,t){return new SZ(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>MZ?MZ:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=yZ);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 _Z(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(yZ),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 SZ(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 SZ(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=CZ(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(yZ),n);if(r.length>0){let n=wZ(this.lines,r);TZ(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(yZ),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new SZ(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(yZ),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=EZ(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(yZ,!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--,_=DZ(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 kZ(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)}},PZ=class extends _K{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 NZ(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new NZ(!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)}},FZ=2,IZ=1,LZ=class extends _K{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,FZ),this.rows=Math.max(e.rawOptions.rows||0,IZ),this.buffers=this._register(new PZ(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))}};LZ=GW([Z(0,wG)],LZ);var RZ={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:bX,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},zZ=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],BZ=class extends _K{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...RZ};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(mK(()=>{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 RZ))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in RZ))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||=RZ[e],!VZ(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=RZ[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=zZ.includes(t)?t:RZ[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 VZ(e){return e===`block`||e===`underline`||e===`bar`}function HZ(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]&&HZ(e[r],t-1);return n}var UZ=Object.freeze({insertMode:!1}),WZ=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),GZ=class extends _K{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=HZ(UZ),this.decPrivateModes=HZ(WZ)}reset(){this.modes=HZ(UZ),this.decPrivateModes=HZ(WZ)}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))}};GZ=GW([Z(0,vG),Z(1,CG),Z(2,wG)],GZ);var KZ={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 qZ(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 JZ=String.fromCharCode,YZ={DEFAULT:e=>{let t=[qZ(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${JZ(t[0])}${JZ(t[1])}${JZ(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${qZ(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${qZ(e,!0)};${e.x};${e.y}${t}`}},XZ=class extends _K{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(KZ))this.addProtocol(e,KZ[e]);for(let e of Object.keys(YZ))this.addEncoding(e,YZ[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)}};XZ=GW([Z(0,vG),Z(1,bG),Z(2,wG)],XZ);var ZZ=[[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]],QZ=[[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]],$Z;function eQ(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 tQ=class{constructor(){if(this.version=`6`,!$Z){$Z=new Uint8Array(65536),$Z.fill(1),$Z[0]=0,$Z.fill(0,1,32),$Z.fill(0,127,160),$Z.fill(2,4352,4448),$Z[9001]=2,$Z[9002]=2,$Z.fill(2,11904,42192),$Z[12351]=1,$Z.fill(2,44032,55204),$Z.fill(2,63744,64256),$Z.fill(2,65040,65050),$Z.fill(2,65072,65136),$Z.fill(2,65280,65377),$Z.fill(2,65504,65511);for(let e=0;e<ZZ.length;++e)$Z.fill(0,ZZ[e][0],ZZ[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$Z[e]:eQ(e,QZ)?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=nQ.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return nQ.createPropertyValue(0,n,r)}},nQ=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new tQ;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)}},rQ=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 iQ(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 aQ=2147483647,oQ=256,sQ=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>oQ)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>aQ?aQ: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>aQ?aQ: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,aQ):e}},cQ=[],lQ=class{constructor(){this._state=0,this._active=cQ,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=cQ}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=cQ,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||cQ,!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`,iG(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=cQ,this._id=-1,this._state=0}}},uQ=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+=iG(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}},dQ=[],fQ=class{constructor(){this._handlers=Object.create(null),this._active=dQ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dQ}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=dQ,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||dQ,!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`,iG(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=dQ,this._ident=0}},pQ=new sQ;pQ.addParam(0);var mQ=class{constructor(e){this._handler=e,this._data=``,this._params=pQ,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():pQ,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=iG(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=pQ,this._data=``,this._hitLimit=!1,e));return this._params=pQ,this._data=``,this._hitLimit=!1,t}},hQ=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}},gQ=160,_Q=function(){let e=new hQ(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(gQ,0,2,0),e.add(gQ,8,5,8),e.add(gQ,6,0,6),e.add(gQ,11,0,11),e.add(gQ,13,13,13),e}(),vQ=class extends _K{constructor(e=_Q){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 sQ,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(mK(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new lQ),this._dcsParser=this._register(new fQ),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:gQ)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<gQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gQ){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<gQ){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<gQ){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}}},yQ=/^([\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})$/,bQ=/^[\da-f]+$/;function xQ(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=yQ.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),bQ.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 SQ(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 CQ(e,t=16){let[n,r,i]=e;return`rgb:${SQ(n,t)}/${SQ(r,t)}/${SQ(i,t)}`}var wQ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},TQ=131072,EQ=10;function DQ(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 OQ=5e3,kQ=0,AQ=class extends _K{constructor(e,t,n,r,i,a,o,s,c=new vQ){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 aG,this._utf8Decoder=new oG,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=yZ.clone(),this._eraseAttrDataInternal=yZ.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 jQ(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(bY.IND,()=>this.index()),this._parser.setExecuteHandler(bY.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bY.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new uQ(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new uQ(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new uQ(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new uQ(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new uQ(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new uQ(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new uQ(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new uQ(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new uQ(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new uQ(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new uQ(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new uQ(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 AZ)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 mQ((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`),OQ))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${OQ} 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>TQ&&(a=this._parseStack.position+TQ)}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<TQ&&(this._parseBuffer=new Uint32Array(Math.min(e.length,TQ))),o||this._dirtyRowTracker.clearRange(),e.length>TQ)for(let t=a;t<e.length;t+=TQ){let a=t+TQ<e.length?t+TQ: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=nQ.extractWidth(t);let n=nQ.extractShouldJoin(t),m=n?nQ.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(rG(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 SZ&&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=>DQ(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new mQ(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new uQ(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(yZ));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=nQ.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,jZ),this._charsetService.setgCharset(1,jZ),this._charsetService.setgCharset(2,jZ),this._charsetService.setgCharset(3,jZ);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|=lG.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=yZ.fg,e.bg=yZ.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|=yZ.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=yZ.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|=yZ.fg&16777215,r.bg&=-67108864,r.bg|=yZ.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=yZ.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(!DQ(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>EQ&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>EQ&&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(MQ(n))if(r===`?`)t.push({type:0,index:n});else{let e=xQ(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=xQ(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]);MQ(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,jZ),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(wQ[e[0]],AZ[e[1]]||jZ),!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=yZ.clone(),this._eraseAttrDataInternal=yZ.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 dG;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)}},jQ=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&&(kQ=e,e=t,t=kQ),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};jQ=GW([Z(0,vG)],jQ);function MQ(e){return 0<=e&&e<256}var NQ=5e7,PQ=12,FQ=50,IQ=class extends _K{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>NQ)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>=PQ?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>=PQ)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>FQ&&(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()}},LQ=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)))}};LQ=GW([Z(0,vG)],LQ);var RQ=!1,zQ=class extends _K{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new vK),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 fZ,this.optionsService=this._register(new BZ(e)),this._instantiationService.setService(wG,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(LZ)),this._instantiationService.setService(vG,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(hZ)),this._instantiationService.setService(CG,this._logService),this.coreService=this._register(this._instantiationService.createInstance(GZ)),this._instantiationService.setService(bG,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(XZ)),this._instantiationService.setService(yG,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nQ)),this._instantiationService.setService(EG,this.unicodeService),this._charsetService=this._instantiationService.createInstance(rQ),this._instantiationService.setService(xG,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(LQ),this._instantiationService.setService(TG,this._oscLinkService),this._inputHandler=this._register(new AQ(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(OK.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(OK.forward(this._bufferService.onResize,this._onResize)),this._register(OK.forward(this.coreService.onData,this._onData)),this._register(OK.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 IQ((e,t)=>this._inputHandler.parse(e,t))),this._register(OK.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&&!RQ&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),RQ=!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,FZ),t=Math.max(t,IZ),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(iQ.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(iQ(this._bufferService),!1))),this._windowsWrappingHeuristics.value=mK(()=>{for(let t of e)t.dispose()})}}},BQ={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 VQ(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=BQ[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 HQ=0,UQ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new kX,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new kX,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||(HQ=this._search(t),HQ===-1)||this._getKey(this._array[HQ])!==t)return!1;do if(this._array[HQ]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(HQ),!0;while(++HQ<this._array.length&&this._getKey(this._array[HQ])===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&&(HQ=this._search(e),!(HQ<0||HQ>=this._array.length)&&this._getKey(this._array[HQ])===e))do yield this._array[HQ];while(++HQ<this._array.length&&this._getKey(this._array[HQ])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(HQ=this._search(e),!(HQ<0||HQ>=this._array.length)&&this._getKey(this._array[HQ])===e))do t(this._array[HQ]);while(++HQ<this._array.length&&this._getKey(this._array[HQ])===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}},WQ=0,GQ=0,KQ=class extends _K{constructor(){super(),this._decorations=new UQ(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(mK(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new qQ(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=>{WQ=t.options.x??0,GQ=WQ+(t.options.width??1),e>=WQ&&e<GQ&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},qQ=class extends gK{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=AY.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=AY.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},JQ=1e3,YQ=class{constructor(e,t=JQ){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)}},XQ=20,ZQ=!1,QQ=class extends _K{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 YQ(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);ZQ?(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(bJ(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(mK(()=>{ZQ?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<XQ+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
203
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===XQ+1&&(this._liveRegion.textContent+=YW.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})`}};QQ=GW([Z(1,SG),Z(2,jG),Z(3,NG)],QQ);var $Q=class extends _K{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(mK(()=>{fK(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(bJ(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(bJ(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(bJ(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(bJ(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&&e$(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,fK(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}}};$Q=GW([Z(1,MG),Z(2,NG),Z(3,vG),Z(4,LG)],$Q);function e$(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 t$=class extends zQ{constructor(e={}){super(e),this._linkifier=this._register(new vK),this.browser=fX,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new vK),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(KQ),this._instantiationService.setService(DG,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(sX),this._instantiationService.setService(LG,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OG)),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(OK.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(OK.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(OK.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(OK.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(mK(()=>{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=kY.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${CQ(r)}${xY.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=OY.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=OY.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(QQ,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(bJ(this.element,`copy`,e=>{this.hasSelection()&&QW(e,this._selectionService)}));let e=e=>$W(e,this.textarea,this.coreService,this.optionsService);this._register(bJ(this.textarea,`paste`,e)),this._register(bJ(this.element,`paste`,e)),gX?this._register(bJ(this.element,`mousedown`,e=>{e.button===2&&nG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(bJ(this.element,`contextmenu`,e=>{nG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wX&&this._register(bJ(this.element,`auxclick`,e=>{e.button===1&&tG(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(bJ(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(bJ(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(bJ(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(bJ(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(bJ(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(bJ(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(bJ(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(bJ(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`,qW.get()),TX||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(aX,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(jG,this._coreBrowserService),this._register(bJ(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(bJ(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(tX,this._document,this._helperContainer),this._instantiationService.setService(AG,this._charSizeService),this._themeService=this._instantiationService.createInstance(lZ),this._instantiationService.setService(IG,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(IY),this._instantiationService.setService(FG,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(jX,this.rows,this.screenElement)),this._instantiationService.setService(NG,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(SY,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(uX),this._instantiationService.setService(MG,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance($Q,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(pY,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($X,this.element,this.screenElement,r)),this._instantiationService.setService(PG,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(OK.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(mY,this.screenElement)),this._register(bJ(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(QQ,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yY,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yY,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(eX,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(bJ(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(bJ(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){eG(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=VQ(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)&&(n$(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(yZ));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 n$(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var r$=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)}},i$=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 dG)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},a$=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 i$(t)}getNullCell(){return new dG}},o$=class extends _K{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new a$(this._core.buffers.normal,`normal`),this._alternate=new a$(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)}},s$=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)}},c$=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}},l$=[`cols`,`rows`],u$=0,d$=class extends _K{constructor(e){super(),this._core=this._register(new t$(e)),this._addonManager=this._register(new r$),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(l$.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 s$(this._core),this._parser}get unicode(){return this._checkProposedApi(),new c$(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 o$(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 qW.get()},set promptLabel(e){qW.set(e)},get tooMuchOutput(){return YW.get()},set tooMuchOutput(e){YW.set(e)}}}_verifyIntegers(...e){for(u$ of e)if(u$===1/0||isNaN(u$)||u$%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(u$ of e)if(u$&&(u$===1/0||isNaN(u$)||u$%1!=0||u$<0))throw Error(`This API only accepts positive integers`)}},f$=2,p$=1,m$=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(f$,Math.floor(u/e.css.cell.width)),rows:Math.max(p$,Math.floor(l/e.css.cell.height))}}},h$={class:`flex flex-col h-full overflow-hidden`},g$={class:`flex items-stretch border-b border-border overflow-x-auto`},_$=[`onClick`],v$=[`onClick`],y$={class:`truncate`},b$={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]`},x$=[`onMousedown`,`onTouchstart`],S$={key:1,class:`px-3 py-1 text-[11px] text-danger bg-danger-dim`},C$={key:`terminal`,label:`Terminal`,icon:`lucide:square-terminal`,color:`#c5cdd8`,lightColor:`#6e7681`,component:I({__name:`window`,setup(e){let t=new Set,{state:n,set:r,setTitle:i,close:a}=gu(),{confirm:o}=Bu(),s=Jt([]),c=N(null),l=N(null),u=N(``),d=null,f=0,p=Ku(),m=N(!1),h=N(!1),g=0;function _(){let e=Date.now();e-g<300?(g=0,T(` `,!0)):g=e}F(()=>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}=pu();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};F(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 w(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 d$(S),a=new m$;i.loadAddon(a),l.value?.appendChild(r),i.open(r);let o=String(++f),c=Jt({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,Rn(()=>ne(c))},u.onerror=()=>{u.close(),c.connected=!1,ie(o)},c.eventSource=u,s.push(c),re(o)}function T(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 E=[{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:D,onContext:O,close:ee}=$l();async function te(e){u.value=``;let t=await Cu(`/api/terminal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:80,rows:24,...e})});if(!t){u.value=`failed to create terminal session`;return}w(t.id,t.label??`shell`)}function ne(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 re(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}),Rn(()=>{t&&(ne(t),t.terminal.focus())})}async function k(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?re(e.id):c.value=null}}function ie(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?re(e.id):c.value=null}}return F(()=>n.value.connectSession,e=>{e&&!t.has(e)&&w(e,`shell`)}),Xr(async()=>{await Rn(),d=new ResizeObserver(()=>{let e=C();e&&ne(e)}),l.value&&d.observe(l.value);let e=n.value.tab,r=await Cu(`/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)w(e.id,e.label);if(e){let t=s.find(t=>t.sessionId===e);t&&re(t.id)}}else await te()}else await te()}),ei(()=>{d?.disconnect();for(let e of s)e.eventSource?.close(),e.terminal.dispose(),t.delete(e.sessionId);s.length=0}),(e,t)=>(z(),B(`div`,h$,[V(`div`,g$,[(z(!0),B(R,null,L(s,e=>(z(),B(`button`,{key:e.id,type:`button`,class:j([`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=>re(e.id)},[V(`span`,{class:j([`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:Rs(t=>k(e.id),[`stop`])},`×`,10,v$),V(`span`,{class:j([`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`,y$,M(e.label),1)],10,_$))),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=>te(),onContextmenu:t[1]||=e=>P(O)(e)},` + `,32)]),H(Ml,{pos:P(D)??null},{default:Xn(()=>[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=>{P(ee)(),te()}},` 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=>{P(ee)(),te({virtual:!0})}},` New Virtual Shell `)]),_:1},8,[`pos`]),P(p)?(z(),B(`div`,b$,[(z(),B(R,null,L(E,(e,t)=>V(`button`,{key:t,type:`button`,class:j([`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:Rs(t=>e.toggle?e.toggle.value=!e.toggle.value:T(e.seq,e.raw),[`prevent`]),onTouchstart:Rs(t=>e.toggle?e.toggle.value=!e.toggle.value:T(e.seq,e.raw),[`prevent`])},M(e.label),43,x$)),64))])):W(``,!0),u.value?(z(),B(`div`,S$,M(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},w$={class:`grid gap-3 p-3`},T$={key:0,class:`border border-border p-3`},E$={class:`w-full border-collapse text-[12px]`},D$={class:`hover:bg-surface`},O$={class:`py-1.5 px-2 border-b border-border font-mono select-text`},k$=[`href`],A$={class:`hover:bg-surface`},j$={class:`py-1.5 px-2 border-b border-border font-mono`},M$={key:0},N$={key:1,class:`text-muted`},P$={class:`hover:bg-surface`},F$={class:`py-1.5 px-2 font-mono select-text`},I$={key:0},L$={key:1,class:`text-muted`},R$={key:1,class:`border border-border p-3`},z$={key:2,class:`border border-border p-3`},B$={class:`mb-2`},V$={key:0,class:`text-[11px] text-danger mb-2`},H$=[`disabled`],U$={key:3,class:`border border-border p-3`},W$={key:0,class:`text-[11px] text-danger mb-2`},G$=[`disabled`],K$={key:4,class:`border border-border p-3 text-[12px] text-muted`},q$={key:`tunnel`,label:`Tunnel`,icon:`lucide:route`,color:`#7C4DFF`,component:I({__name:`window`,setup(e){let{openWindow:t}=gu(),n=N(null),r=N(``),i=N(!1),a=N(``),o=N(null),s=G(()=>n.value?.connected??!1);async function c(){let e=await Cu(`/api/tunnel/status`);if(e)if(n.value=e,e.connected&&!o.value){let e=await Cu(`/api/tunnel/password`);e&&(o.value=e.password)}else e.connected||(o.value=null)}async function l(){i.value=!0,a.value=``;try{(await Su(`/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 Su(`/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 qu(c,5e3),(e,c)=>(z(),B(`div`,w$,[s.value?(z(),B(`div`,T$,[c[5]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,E$,[V(`tbody`,null,[V(`tr`,D$,[c[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`url`,-1),V(`td`,O$,[V(`a`,{href:n.value?.url??``,target:`_blank`,class:`text-accent hover:underline`},M(n.value?.url),9,k$)])]),V(`tr`,A$,[c[3]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`subdomain`,-1),V(`td`,j$,[n.value?.subdomain?(z(),B(`span`,M$,M(n.value.subdomain),1)):(z(),B(`span`,N$,`auto`))])]),V(`tr`,P$,[c[4]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`password`,-1),V(`td`,F$,[o.value?(z(),B(`span`,I$,M(o.value),1)):(z(),B(`span`,L$,`loading...`))])])])])])):W(``,!0),s.value?W(``,!0):(z(),B(`div`,R$,[...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):(z(),B(`div`,z$,[c[8]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:Rs(l,[`prevent`])},[V(`div`,B$,[c[7]||=V(`label`,{class:`label`},`subdomain (optional)`,-1),Zn(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),[[Ms,r.value]])]),a.value?(z(),B(`div`,V$,M(a.value),1)):W(``,!0),V(`button`,{type:`submit`,disabled:i.value,class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`},M(i.value?`connecting...`:`connect`),9,H$)],32)])),s.value?(z(),B(`div`,U$,[c[9]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),a.value?(z(),B(`div`,W$,M(a.value),1)):W(``,!0),V(`button`,{type:`button`,disabled:i.value,class:`btn-danger`,onClick:u},` disconnect `,8,G$)])):W(``,!0),s.value?(z(),B(`div`,K$,[c[10]||=U(` New devices need approval. `,-1),V(`button`,{type:`button`,class:`text-accent hover:underline`,onClick:c[1]||=e=>P(t)(`devices`)},` Open Devices `)])):W(``,!0)]))}}),window:{width:420,height:360,minwidth:320,minheight:200,autosize:!0}},J$={class:`flex items-center justify-center h-full bg-bg overflow-auto p-4`},Y$=[`src`,`alt`],X$=[`src`],Z$=[`src`],Q$={key:3,class:`text-muted text-[12px]`},$$=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`avif`]),e1=new Set([`mp4`,`webm`,`mov`,`avi`]),t1=new Set([`mp3`,`wav`,`ogg`,`flac`]);const n1=new Set([...$$,...e1,...t1]);var r1=I({__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(()=>$$.has(r.value)?`image`:e1.has(r.value)?`video`:t1.has(r.value)?`audio`:`unknown`);return(t,r)=>(z(),B(`div`,J$,[i.value===`image`?(z(),B(`img`,{key:0,src:n.value,alt:e.path,class:`max-w-full max-h-full object-contain rounded`},null,8,Y$)):i.value===`video`?(z(),B(`video`,{key:1,src:n.value,controls:``,class:`max-w-full max-h-full rounded`},null,8,X$)):i.value===`audio`?(z(),B(`audio`,{key:2,src:n.value,controls:``,class:`w-full max-w-md`},null,8,Z$)):(z(),B(`div`,Q$,`unsupported media format`))]))}}),i1={class:`flex flex-col h-full`},a1={key:0,class:`px-3 py-1.5 border-b border-border flex items-center gap-2 text-[11px]`},o1={class:`text-muted/60 text-[10px] uppercase tracking-wide`},s1={class:`text-muted font-mono truncate`},c1={key:0,class:`text-warn text-[10px]`},l1={class:`ml-auto flex gap-2 flex-shrink-0`},u1=[`disabled`],d1={key:0,class:`text-[9px] opacity-60`},f1={key:3,class:`flex-1 flex flex-col items-center justify-center gap-3 text-muted text-[12px]`},p1={class:`flex items-center gap-1 text-[11px] text-muted mb-2 flex-wrap`},m1={key:0,class:`opacity-40`},h1=[`onClick`],g1={key:0,class:`text-center py-6 text-muted text-[11px]`},_1=[`onClick`],v1={key:0,class:`text-center py-6 text-muted text-[11px]`},y1=[`onClick`],b1={key:`editor`,label:`Editor`,icon:`lucide:file-pen-line`,color:`#39bae6`,component:I({__name:`window`,setup(e){let{confirm:t}=Bu(),{state:n,set:r,setTitle:i}=gu(),a=N(``),o=N(``),s=N(``),c=N(!1),l=N(!1),u=N(!1),d=N([]),f=N(``),p=N(`.`),m=N([]),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 Cu(`/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 Cu(`/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,E()}function C(e){e.type===`directory`?b(e.name):S(e.name)}let w=G(()=>{let e=o.value.split(`.`).pop()?.toLowerCase()??``;return n1.has(e)}),T=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 E(){if(!a.value||!o.value)return;if(w.value){s.value=``,c.value=!1;return}let e=await Cu(`/api/files/read?${new URLSearchParams({folder:a.value,path:o.value})}`);e&&(s.value=e.content,c.value=!1)}async function D(){!o.value||l.value||(l.value=!0,await Su(`/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 F(o,e=>{let t=e.split(`/`).pop();i(t?`Editor — ${t}`:`Editor`)}),F(()=>[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 E()}},{immediate:!0}),(e,t)=>(z(),B(`div`,i1,[o.value?(z(),B(`div`,a1,[V(`span`,o1,M(T.value),1),V(`span`,s1,M(a.value)+`/`+M(o.value),1),c.value?(z(),B(`span`,c1,`~`)):W(``,!0),V(`div`,l1,[V(`button`,{type:`button`,class:`btn-sm hover:bg-surface`,onClick:E},[...t[3]||=[U(` refresh `,-1),V(`span`,{class:`text-[9px] opacity-60`},`⌘R`,-1)]]),w.value?W(``,!0):(z(),B(`button`,{key:0,type:`button`,class:`btn-sm bg-accent-dim text-accent border-accent-dim hover:bg-accent-dimmer`,disabled:l.value,onClick:D},[U(M(l.value?`saving...`:`save`)+` `,1),l.value?W(``,!0):(z(),B(`span`,d1,`⌘S`))],8,u1))])])):W(``,!0),o.value&&w.value?(z(),La(r1,{key:1,folder:a.value,path:o.value,class:`flex-1`},null,8,[`folder`,`path`])):o.value?(z(),La(nm,{key:2,"model-value":s.value,language:T.value,class:`flex-1`,"onUpdate:modelValue":t[0]||=e=>{s.value=e,c.value=!0},onSave:D},null,8,[`model-value`,`language`])):(z(),B(`div`,f1,[t[5]||=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(P(K),{icon:`lucide:folder-open`,class:`w-3 h-3 mr-1 inline-block align-[-2px]`}),t[4]||=U(` browse files `,-1)])])),u.value?(z(),La(Il,{key:4,title:`open file`,onClose:t[2]||=e=>u.value=!1},{default:Xn(()=>[V(`div`,p1,[(z(!0),B(R,null,L(g.value,(e,t)=>(z(),B(R,{key:t},[t>0?(z(),B(`span`,m1,`/`)):W(``,!0),V(`button`,{type:`button`,class:j([`hover:text-text transition-colors`,t===g.value.length-1?`text-text`:``]),onClick:e=>x(t)},M(t===0?`~/`:e),11,h1)],64))),128))]),f.value?(z(),B(R,{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[1]||=e=>b(`..`)},` .. `),h.value.length===0?(z(),B(`div`,v1,` empty `)):W(``,!0),(z(!0),B(R,null,L(h.value,e=>(z(),B(`div`,{key:e.name,class:j([`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(P(K),{icon:e.type===`directory`?P(m_)(!1).icon:P(p_)(e.name).icon,class:j([e.type===`directory`?`text-accent`:P(p_)(e.name).color,`w-3.5 h-3.5 flex-shrink-0`])},null,8,[`icon`,`class`]),U(` `+M(e.name)+M(e.type===`directory`?`/`:``),1)],10,y1))),128))],64)):(z(),B(R,{key:0},[d.value.length===0?(z(),B(`div`,g1,` no groups `)):W(``,!0),(z(!0),B(R,null,L(d.value,e=>(z(),B(`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(P(K),{icon:`lucide:folder`,class:`w-3.5 h-3.5 flex-shrink-0`}),U(` `+M(e.folder)+`/ `,1)],8,_1))),128))],64))]),_:1})):W(``,!0)]))}}),window:{width:720,height:520,minwidth:400,minheight:300},multi:!0,hidden:!1},x1={class:`@container flex flex-col h-full p-4 gap-4 overflow-y-auto select-none`},S1={key:0,class:`border border-border rounded-lg p-3 flex items-center justify-between gap-3 bg-surface`},C1={class:`grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 gap-3`},w1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},T1={class:`flex items-center gap-2`},E1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},D1={class:`flex items-center gap-2`},O1=[`disabled`],k1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},A1={class:`flex items-center gap-2`},j1=[`disabled`],M1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},N1={class:`flex items-center gap-2`},P1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},F1={class:`flex items-center gap-2`},I1={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},L1={class:`flex items-center gap-2`},R1={class:`grid grid-cols-3 @sm:grid-cols-4 @lg:grid-cols-5 gap-2`},z1=[`onClick`],B1={class:`text-[10px] font-medium`};const V1=[qg,ph,WV,Jm,bW,av,VW,SB,YB,c_,q$,U_,b1,C$,eW,{key:`welcome`,label:`Welcome`,icon:`lucide:sparkles`,color:`#e5a535`,component:I({__name:`window`,setup(e){let t=new Set([`agent`,`telegram`,`ntfy`,`tunnel`,`chat`,`settings`,`welcome`]),n=V1.filter(e=>!e.hidden&&!t.has(e.key)),{openWindow:r}=gu(),{showInstall:i}=Gl(),a=N(null),o=N(null),s=N(null),c=N(null),l=N(0);async function u(){let[e,t,n,r,i]=await Promise.all([Cu(`/api/pi/status`),Cu(`/api/telegram/status`),Cu(`/api/ntfy/status`),Cu(`/api/tunnel/status`),Cu(`/api/groups`)]);e&&(a.value=e),t&&(o.value=t),n&&(s.value=n),r&&(c.value=r),i&&(l.value=i.length)}qu(u,5e3);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)=>(z(),B(`div`,x1,[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),P(i)?(z(),B(`div`,S1,[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(Ql,{"inline-install":``})])):W(``,!0),V(`div`,C1,[V(`div`,w1,[V(`div`,T1,[H(P(K),{icon:d.value?`lucide:check`:`lucide:cpu`,class:j([`text-[16px] shrink-0`,d.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:j([`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:j([`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},M(d.value?`connected — manage`:`open agent settings`),3)]),V(`div`,E1,[V(`div`,D1,[H(P(K),{icon:d.value&&m.value?`lucide:check`:`lucide:message-circle`,class:j([`text-[16px] shrink-0`,d.value&&m.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:j([`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:j([`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},M(d.value?m.value?`started — open chat`:`open chat`:`connect a provider first`),11,O1)]),V(`div`,k1,[V(`div`,A1,[H(P(K),{icon:d.value&&f.value?`lucide:check`:`lucide:send`,class:j([`text-[16px] shrink-0`,d.value&&f.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:j([`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:j([`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:_},M(d.value?f.value?`connected — @${o.value?.botUsername}`:`set up telegram bot`:`connect a provider first`),11,j1)]),V(`div`,M1,[V(`div`,N1,[H(P(K),{icon:p.value?`lucide:check`:`lucide:bell`,class:j([`text-[16px] shrink-0`,p.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:j([`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:j([`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},M(p.value?`configured — manage`:`set up ntfy`),3)]),V(`div`,P1,[V(`div`,F1,[H(P(K),{icon:h.value?`lucide:check`:`lucide:globe`,class:j([`text-[16px] shrink-0`,h.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:j([`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:j([`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},M(h.value?`connected — manage`:`set up tunnel`),3)]),V(`div`,I1,[V(`div`,L1,[H(P(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`,R1,[(z(!0),B(R,null,L(P(n),e=>(z(),B(`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=>P(r)(e.key)},[H(P(K),{icon:e.icon,class:`text-[16px]`,style:A({color:e.color})},null,8,[`icon`,`style`]),V(`span`,B1,M(e.label.toLowerCase()),1)],8,z1))),128))])])]))}}),window:{width:650,height:650,minwidth:520,minheight:440}}];var H1={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`},U1=[`title`,`onClick`,`onContextmenu`,`onTouchstart`],W1={key:1,class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},G1=[`title`,`onClick`,`onContextmenu`,`onTouchstart`],K1={key:2,class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},q1={key:0,class:`font-pixel text-[13px] select-none leading-none`,style:{color:`var(--dock-text-active)`}},J1=[`title`],Y1=[`onClick`],X1={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`},Z1={key:0,class:`w-1 h-1 rounded-full bg-accent`},Q1={key:0,class:`fixed inset-0 z-[1200] flex flex-col items-center justify-center backdrop-blur-xl bg-bg/60 select-none`},$1={class:`flex flex-col items-center gap-4`},e0=I({__name:`DashPanel`,props:{openInstances:{},minimized:{},focusedWindow:{}},emits:[`launch`,`focus`,`minimize`,`close`],setup(e,{emit:t}){let n=e,r=t,{settings:i,set:a}=du(),{effective:o}=pu(),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`}}),u=N(!1),d=N(``),f,{menu:p,onContext:m,onTouchStart:h,cancelLongPress:g,close:_}=$l();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:w}=$l();function T(){w(),r(`launch`,`settings`,{tab:`dash`})}let E=G(()=>i.pinnedApps.map(e=>V1.find(t=>t.key===e)).filter(Boolean)),D=G(()=>n.openInstances.filter(e=>!i.pinnedApps.includes(e.appKey)));function O(e){return n.openInstances.find(t=>t.appKey===e)}function ee(e){let t=O(e);t?r(`focus`,t.id):r(`launch`,e)}let te=G(()=>new Set(n.openInstances.map(e=>e.appKey))),ne=N(``),re=N(),k=N(!1),ie=Gu(),ae=Ku(),oe=G(()=>{let e=ne.value.toLowerCase().trim(),t=V1.filter(e=>!e.hidden);return e?t.filter(t=>t.label.toLowerCase().includes(e)):t}),se=N(!0),ce=N(!1);qu(async()=>{let e=!se.value;se.value=await Su(`/api/health`)!==null,e&&se.value&&(ce.value=!1)},15e3);let le=()=>window.location.reload();function ue(){u.value=!u.value,ne.value=``,k.value=!1,u.value&&!ae.value&&Rn(()=>re.value?.focus())}function de(){k.value=!0,Rn(()=>re.value?.focus())}function fe(e){e.key===`Enter`&&oe.value.length===1&&pe(oe.value[0].key)}function pe(e){r(`launch`,e),u.value=!1}function me(){d.value=new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:i.clockFormat===`12h`})}function he(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)&&(ue(),e.preventDefault())}function ge(){window.location.reload()}return Xr(()=>{me(),f=setInterval(me,1e4),document.addEventListener(`keydown`,he)}),ei(()=>{clearInterval(f),document.removeEventListener(`keydown`,he)}),(t,n)=>(z(),B(R,null,[V(`div`,H1,[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:A(l.value),onContextmenu:n[6]||=e=>P(C)(e,void 0)},[V(`button`,{type:`button`,class:j([`dock-item`,{"text-accent":u.value}]),style:A(u.value?{}:{color:`var(--dock-text)`}),title:`Apps (Ctrl+Space / Ctrl+K)`,onClick:ue,onContextmenu:n[0]||=e=>P(C)(e,void 0)},[H(P(K),{icon:`lucide:layout-grid`,class:`dock-icon`})],38),E.value.length?(z(),B(R,{key:0},[n[11]||=V(`div`,{class:`w-px h-5 mx-0.5`,style:{background:`var(--dock-divider)`}},null,-1),(z(!0),B(R,null,L(E.value,t=>(z(),B(`button`,{key:`pinned-${t.key}`,type:`button`,class:j([`dock-item`,{"opacity-50":O(t.key)&&e.minimized[O(t.key).id]}]),style:A({color:O(t.key)&&e.focusedWindow===O(t.key)?.id?`var(--dock-text-active)`:`var(--dock-text)`}),title:t.label.toLowerCase(),onClick:e=>ee(t.key),onContextmenu:Rs(e=>P(m)(e,{instanceId:O(t.key)?.id,appKey:t.key}),[`stop`]),onTouchstart:e=>P(h)(e,{instanceId:O(t.key)?.id,appKey:t.key}),onTouchend:n[1]||=(...e)=>P(g)&&P(g)(...e),onTouchmove:n[2]||=(...e)=>P(g)&&P(g)(...e)},[H(P(K),{icon:t.icon,class:`dock-icon`,"aria-hidden":`true`,style:A({color:s.value&&t.lightColor?t.lightColor:t.color})},null,8,[`icon`,`style`]),O(t.key)?(z(),B(`span`,{key:0,class:j([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,e.focusedWindow===O(t.key)?.id?`bg-accent opacity-100`:`bg-muted opacity-50`])},null,2)):W(``,!0)],46,U1))),128))],64)):W(``,!0),D.value.length?(z(),B(`div`,W1)):W(``,!0),(z(!0),B(R,null,L(D.value,t=>(z(),B(`button`,{key:t.id,type:`button`,class:j([`dock-item`,{"opacity-50":e.minimized[t.id]}]),style:A({color:e.focusedWindow===t.id?`var(--dock-text-active)`:`var(--dock-text)`}),title:t.app.label.toLowerCase(),onClick:e=>r(`focus`,t.id),onContextmenu:Rs(e=>P(m)(e,{instanceId:t.id,appKey:t.appKey}),[`stop`]),onTouchstart:e=>P(h)(e,{instanceId:t.id,appKey:t.appKey}),onTouchend:n[3]||=(...e)=>P(g)&&P(g)(...e),onTouchmove:n[4]||=(...e)=>P(g)&&P(g)(...e)},[H(P(K),{icon:t.app.icon,class:`dock-icon`,"aria-hidden":`true`,style:A({color:s.value&&t.app.lightColor?t.app.lightColor:t.app.color})},null,8,[`icon`,`style`]),V(`span`,{class:j([`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,G1))),128)),n[12]||=V(`div`,{class:`flex-1`},null,-1),e.openInstances.length&&(P(i).showClock||P(i).showStatus)?(z(),B(`div`,K1)):W(``,!0),P(i).showClock||P(i).showStatus?(z(),B(`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=>P(C)(e,void 0)},[P(i).showClock?(z(),B(`span`,q1,M(d.value),1)):W(``,!0),P(i).showStatus?(z(),B(`span`,{key:1,class:j([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,se.value?`bg-ok`:`bg-danger`]),title:se.value?`server healthy`:`server unreachable`},null,10,J1)):W(``,!0)],32)):W(``,!0)],36)]),(z(),La(vr,{to:`body`},[H(Fo,{name:`launchpad`},{default:Xn(()=>[u.value?(z(),B(`div`,{key:0,class:j([`fixed inset-0 z-[1100] flex justify-center backdrop-blur-sm backdrop-saturate-150`,[k.value?`items-start pt-16`:`items-center`,s.value?`bg-white/15`:`bg-black/20`]]),onClick:n[10]||=Rs(e=>u.value=!1,[`self`])},[!P(ie)||k.value?Zn((z(),B(`input`,{key:0,ref_key:`searchInput`,ref:re,"onUpdate:modelValue":n[7]||=e=>ne.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:fe},null,544)),[[Ms,ne.value]]):W(``,!0),V(`button`,{type:`button`,class:j([`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(P(K),{icon:`lucide:x`,class:`text-lg`})],2),V(`button`,{type:`button`,class:j([`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:ge},[H(P(K),{icon:`lucide:rotate-cw`,class:`text-lg`})],2),P(ie)&&!k.value?(z(),B(`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:de},[H(P(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]||=Rs(e=>u.value=!1,[`self`])},[(z(!0),B(R,null,L(oe.value,e=>(z(),B(`button`,{key:`launcher-${e.key}`,type:`button`,class:`group flex flex-col items-center gap-2 p-4 rounded-xl transition-all`,onClick:t=>pe(e.key)},[V(`span`,X1,[H(P(K),{icon:e.icon,class:`text-2xl sm:text-4xl`,"aria-hidden":`true`,style:A({color:s.value&&e.lightColor?e.lightColor:e.color})},null,8,[`icon`,`style`])]),V(`span`,{class:j([`text-[11px] transition-colors`,s.value?`text-text group-hover:text-text`:`text-white/80 group-hover:text-white`]),style:A(s.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.4)`})},M(e.label),7),te.value.has(e.key)?(z(),B(`span`,Z1)):W(``,!0)],8,Y1))),128)),ne.value&&!oe.value.length?(z(),B(`div`,{key:0,class:j([`col-span-full text-center text-sm py-4`,s.value?`text-text/50`:`text-white/60`]),style:A(s.value?{}:{textShadow:`0 1px 3px rgba(0,0,0,0.8)`})},` No apps found `,6)):W(``,!0)])],2)):W(``,!0)]),_:1})])),(z(),La(vr,{to:`body`},[H(Fo,{name:`launchpad`},{default:Xn(()=>[!se.value&&!ce.value?(z(),B(`div`,Q1,[V(`div`,$1,[H(P(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:le},` reload `)])])):W(``,!0)]),_:1})])),H(Ml,{pos:P(p)??null,transform:`translateY(-100%)`},{default:Xn(()=>[P(p)?.data.instanceId?(z(),B(`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},M(b.value?`Unpin from dock`:`Pin to dock`),1),P(p)?.data.instanceId?(z(),B(`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(Ml,{pos:P(S)??null,transform:`translateY(-100%)`},{default:Xn(()=>[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:T},` Dash settings `)]),_:1},8,[`pos`])],64))}}),t0=`#ff5f57`,n0=`#febc2e`,r0=`#28c840`,i0=`var(--color-tl-inactive)`,a0=12,o0=`width 0.2s, height 0.2s, left 0.2s, top 0.2s`,s0=`ease-out`,c0={display:`inline-block`,width:`${a0}px`,height:`${a0}px`,borderRadius:`50%`,cursor:`pointer`,flexShrink:`0`},l0={"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`}},u0={"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`},d0=Object.keys(l0);function f0(e,t,n,r){e?.addEventListener(t,n,r||!1)}function p0(e,t,n,r){e?.removeEventListener(t,n,r||!1)}function m0(e,t){e.stopPropagation(),t&&e.preventDefault()}function h0(e,t){return e.getElementsByClassName(t)[0]}function g0(e,t){e.classList.add(t)}function _0(e,t){return e.classList.contains(t)}function v0(e,t){e.classList.remove(t)}function y0(e,t,n){let r=e,i=String(n),a=`_s_${t}`;r[a]!==i&&(e.style.setProperty(t,i),r[a]=i)}function b0(e,t){let n=e.firstChild;n?n.nodeValue=t:e.textContent=t}var x0=document.createElement(`div`);x0.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 S0=[],C0=[],w0={capture:!0,passive:!1},T0={capture:!0,passive:!0},E0,D0=0,O0=10,k0,A0=``,j0=``,M0=0,N0=0,P0=!1,F0=class e{static new(t){return new e(t)}static stack(){return C0}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){E0??q0();let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=!1,y,b,x,S,C,w,T=!1,E=!1,D=!1,O=!1,ee,te,ne,re,k,ie=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,T=!!e.min,E=!!e.max,D=!!e.hidden,O=!!e.modal,y=e.x??(O?`center`:0),b=e.y??(O?`center`:0),x=e.top,S=e.left,C=e.bottom,w=e.right,ee=e.background,te=e.border,ne=e.header,re=e.class,k=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,ie=e.onload??null)),this.dom=L0(a),this.id=n||`winbox-${++D0}`,this.dom.id=this.id,this.dom.className=`winbox`,this.dom.winbox=this,this.window=this.dom,this.body=h0(this.dom,`wb-body`),this.header=ne||35,z0(this.dom),re){let e=Array.isArray(re)?re:re.split(` `);H0(this,this.dom,e)}if(O&&G0(this.dom,!0),C0.push(this),ee&&this.setBackground(ee),te?y0(this.body,`margin`,`${te}${Number.isNaN(Number(te))?``:`px`}`):te=0,ne){let e=h0(this.dom,`wb-header`);y0(e,`height`,`${ne}px`),y0(e,`line-height`,`${ne}px`),y0(this.body,`top`,`${ne}px`)}o&&this.setTitle(o),s&&this.setIcon(s),c?this.mount(c):l?this.body.innerHTML=l:u&&this.setUrl(u,ie);let ae=x?R0(x,N0):0,oe=C?R0(C,N0):0,se=S?R0(S,M0):0,ce=w?R0(w,M0):0,le=M0-se-ce,ue=N0-ae-oe,de=h?R0(h,le):le,fe=g?R0(g,ue):ue,pe=p?R0(p,de):150,me=m?R0(m,fe):this.header,he,ge;_?((i||E0).appendChild(this.body),he=Math.max(Math.min(this.body.clientWidth+Number(te)*2+1,de),pe),ge=Math.max(Math.min(this.body.clientHeight+this.header+Number(te)+1,fe),me),this.dom.appendChild(this.body)):(he=d?R0(d,de):Math.max(de/2|0,pe),ge=f?R0(f,fe):Math.max(fe/2|0,me));let _e=y===void 0?se:R0(y,le,he),ve=b===void 0?ae:R0(b,ue,ge);this.x=_e,this.y=ve,this.width=he,this.height=ge,this.minwidth=pe,this.minheight=me,this.maxwidth=de,this.maxheight=fe,this.top=ae,this.right=ce,this.bottom=oe,this.left=se,this.index=r??this.index,this.overflow=v,D?this.hide():this.focus(),r!==void 0&&(this.index=r,y0(this.dom,`z-index`,String(r)),r>O0&&(O0=r)),E?this.maximize():T?this.minimize():this.resize().move(),J0(this),(i||E0).appendChild(this.dom),k?.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 b0(h0(this.dom,`wb-title`),this.title=e),this}setIcon(e){let t=h0(this.dom,`wb-icon`);return y0(t,`background-image`,`url(${e})`),y0(t,`display`,`inline-block`),this}setBackground(e){return y0(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=C0.length;if(e>1)for(let t=1;t<=e;t++){let n=C0[e-t];if(n?.focused){n.blur();let e=C0.indexOf(this);e>=0&&C0.push(C0.splice(e,1)[0]);break}}y0(this.dom,`z-index`,String(++O0)),this.index=O0,this.focused=!0,V0(this.dom,!0),this.onfocus?.()}return this}blur(e){return e===!1?this.focus():(this.focused&&(this.focused=!1,V0(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(k0&&t2(),this.max&&=(U0(this,this.dom,!1),!1),!this.min){S0.push(this),this.dom.title=this.title,W0(this,this.dom,!0),this.min=!0;let e=this.header,t=(M0-200)/2|0,n=N0-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(),$0()),this.onminimize?.()}return this}restore(){return k0&&t2(),this.min&&(this.dom.style.display=``,Y0(this),this.resize().move(),this.onrestore?.()),this.max&&(this.max=!1,U0(this,this.dom,!1),this.resize().move(),this.onrestore?.()),this.snapped&&(this.snapped=!1,U0(this,this.dom,!1),this.resize().move(),this.onsnap?.(!1),this.onrestore?.()),this}maximize(e){return e===!1?this.restore():(k0&&t2(),this.min&&Y0(this),this.max||(I0(this),U0(this,this.dom,!0),this.resize(M0-this.left-this.right,N0-this.top-this.bottom,!0).move(this.left,this.top,!0),this.max=!0,this.onmaximize?.()),this)}snap(e){if(k0&&t2(),this.min&&Y0(this),I0(this),this.max&&(this.max=!1,U0(this,this.dom,!1)),this.snapped===e)return this;this.snapped&&=!1;let t=Math.round((M0-this.left-this.right)/2),n=N0-this.top-this.bottom,r=e===`left`?this.left:this.left+t;return U0(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&&(Y0(this),this.resize().move()),!k0||!t2()){let e=this.body,t=e[A0];typeof t==`function`&&t.call(e),k0=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&&Y0(this);let t=C0.indexOf(this);t>=0&&C0.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&&$0()}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?R0(e,M0-this.left-this.right,this.width):0,i=t?R0(t,N0-this.top-this.bottom,this.height):0,this.x=r,this.y=i),y0(this.dom,`left`,`${r}px`),y0(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?R0(e,this.maxwidth):0,i=t?R0(t,this.maxheight):0,r=Math.max(r,this.minwidth),i=Math.max(i,this.minheight),this.width=r,this.height=i),y0(this.dom,`width`,`${r}px`),y0(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=h0(this.dom,`wb-control`),s=this;return Object.assign(a.style,c0,{background:i0}),t&&(a.className=t),n&&y0(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 h0(this.dom,e)?.remove(),this}addClass(e){return g0(this.dom,e),this}removeClass(e){return v0(this.dom,e),this}hasClass(e){return _0(this.dom,e)}toggleClass(e){return this.hasClass(e)?this.removeClass(e):this.addClass(e)}};function I0(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 L0(e){return e?e.cloneNode(!0):x0.cloneNode(!0)}function R0(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 z0(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:o0,transitionTimingFunction:s0,contain:`layout size`,textAlign:`left`,touchAction:`none`});let t=h0(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=h0(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=h0(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=h0(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=h0(e,`wb-control`);Object.assign(a.style,{float:`left`,height:`100%`,display:`flex`,alignItems:`center`,gap:`8px`,paddingLeft:`14px`});let o=h0(e,`wb-drag`);Object.assign(o.style,{height:`100%`,cursor:`default`,overflow:`hidden`});let s=h0(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=h0(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=h0(e,`wb-close`);Object.assign(l.style,c0,{background:t0});let u=h0(e,`wb-min`);Object.assign(u.style,c0,{background:n0});let d=h0(e,`wb-max`);Object.assign(d.style,c0,{background:r0});let f=h0(e,`wb-full`);Object.assign(f.style,c0,{background:r0,display:`none`}),B0(a,l,u,d,f);for(let t of d0){let n=h0(e,t);n&&Object.assign(n.style,{position:`absolute`,zIndex:`2`},l0[t])}}function B0(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 V0(e,t){let n=h0(e,`wb-close`),r=h0(e,`wb-min`),i=h0(e,`wb-max`),a=h0(e,`wb-full`);if(t)n.style.background=t0,r.style.background=n0,i.style.background=r0,a.style.background=r0;else{let e=i0;n.style.background=e,r.style.background=e,i.style.background=e,a.style.background=e}}function H0(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`:{h0(t,`wb-header`).style.display=`none`;let e=h0(t,`wb-body`);e.style.top=`0`,e.style.borderRadius=`10px`;break}case`no-min`:h0(t,`wb-min`).style.display=`none`,e._optionHidden.add(`wb-min`);break;case`no-max`:h0(t,`wb-max`).style.display=`none`,e._optionHidden.add(`wb-max`),e.noMax=!0;break;case`no-full`:h0(t,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`);break;case`no-close`:h0(t,`wb-close`).style.display=`none`,e._optionHidden.add(`wb-close`);break;case`no-resize`:for(let e of d0)h0(t,e).style.display=`none`;break;case`no-move`:e.noMove=!0;break}}function U0(e,t,n){let r=h0(t,`wb-body`),i=h0(t,`wb-header`);n?(t.style.boxShadow=`none`,t.style.borderRadius=`0`,i.style.borderRadius=`0`,r.style.borderRadius=`0`,r.style.margin=`0`,K0(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=``,K0(t,``))}function W0(e,t,n){let r=h0(t,`wb-full`),i=h0(t,`wb-min`),a=h0(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`;K0(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=``;K0(t,``)}}function G0(e,t){let n=h0(e,`wb-modal-bg`),r=h0(e,`wb-modal-overlay`),i=h0(e,`wb-drag`),a=h0(e,`wb-min`),o=h0(e,`wb-max`),s=h0(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`,K0(e,`none`)):(n.style.display=`none`,r.style.display=`none`,i.style.pointerEvents=``,a.style.display=``,o.style.display=``,s.style.display=``,K0(e,``))}function K0(e,t){for(let n of d0){let r=h0(e,n);r&&(r.style.pointerEvents=t)}}function q0(){E0=document.body;let e=E0;A0=typeof e.requestFullscreen==`function`?`requestFullscreen`:typeof e.msRequestFullscreen==`function`?`msRequestFullscreen`:typeof e.webkitRequestFullscreen==`function`?`webkitRequestFullscreen`:typeof e.mozRequestFullscreen==`function`?`mozRequestFullscreen`:``,j0=A0?A0.replace(`request`,`exit`).replace(`mozRequest`,`mozCancel`).replace(`Request`,`Exit`):``,f0(window,`resize`,()=>{Q0(),X0()}),f0(E0,`mousedown`,()=>{P0=!1},!0),f0(E0,`mousedown`,()=>{if(!P0)for(let e=C0.length-1;e>=0;e--){let t=C0[e];if(t?.focused){t.blur();break}}}),f0(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)}),Q0()}function J0(e){Z0(e,`drag`),Z0(e,`n`),Z0(e,`s`),Z0(e,`w`),Z0(e,`e`),Z0(e,`nw`),Z0(e,`ne`),Z0(e,`se`),Z0(e,`sw`),f0(h0(e.dom,`wb-min`),`click`,t=>{m0(t),e.min?e.restore().focus():e.minimize()}),f0(h0(e.dom,`wb-max`),`click`,t=>{m0(t),e.max?e.restore().focus():e.maximize().focus()}),A0?f0(h0(e.dom,`wb-full`),`click`,t=>{m0(t),e.fullscreen().focus()}):(h0(e.dom,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`)),f0(h0(e.dom,`wb-close`),`click`,t=>{m0(t),e.close()}),f0(h0(e.dom,`wb-header`),`contextmenu`,t=>{t.preventDefault(),t.stopPropagation();let n=t;e.focus(),e.oncontextmenu?.(n.clientX,n.clientY)}),f0(e.dom,`mousedown`,()=>{P0=!0},!0),f0(e.body,`mousedown`,()=>{e.focus()},!0)}function Y0(e){let t=S0.indexOf(e);t>=0&&S0.splice(t,1),X0(),W0(e,e.dom,!1),e.min=!1,e.dom.title=``}function X0(){let e={},t={};for(let n=0;n<S0.length;n++){let r=S0[n],i=`${r.left}:${r.top}`;t[i]?t[i]+=1:(e[i]=0,t[i]=1)}for(let n=0;n<S0.length;n++){let r=S0[n],i=`${r.left}:${r.top}`,a=t[i]||1,o=Math.min((M0-r.left-r.right)/a,250);r.resize(o+1|0,r.header,!0).move(r.left+(e[i]||0)*o|0,N0-r.bottom-r.header,!0),e[i]=(e[i]||0)+1}}function Z0(e,t){let n=h0(e.dom,`wb-${t}`);if(!n)return;let r,i=0,a=0,o=!1,s=!1,c=0;f0(n,`mousedown`,u,w0),f0(n,`touchstart`,u,w0);function l(){requestAnimationFrame(l),s&&=(e.resize(),!1),o&&=(e.move(),!1)}function u(o){if(m0(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=u0[`wb-${t}`]||``;let s=o;r=o.touches?.[0],r?(f0(window,`touchmove`,d,T0),f0(window,`touchend`,f,T0)):(f0(window,`mousemove`,d,T0),f0(window,`mouseup`,f,T0)),i=r?r.pageX:s.pageX,a=r?r.pageY:s.pageY}}function d(n){m0(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,M0-e.x-e.right),e.minwidth),e.width!==d),g&&=(e.height=Math.max(Math.min(e.height,e.maxheight,N0-e.y-e.bottom),e.minheight),e.height!==f),(h||g)&&e.resize(),_&&=((e.max||e.snapped)&&(e.x=(s<M0/3?e.left:s>M0/3*2?M0-e.width-e.right:M0/2-e.width/2)+l),e.x=Math.max(Math.min(e.x,e.overflow?M0-30:M0-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?N0-e.header:N0-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){m0(i),e.dom.style.willChange=``,e.noAnimation||(e.dom.style.transition=o0,e.dom.style.transitionTimingFunction=s0);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=M0<768;!n&&t.pageX<=e.left+8?e.snap(`left`).focus():!n&&t.pageX>=M0-e.right-8?e.snap(`right`).focus():t.pageY<=e.top+8&&e.maximize().focus()}}r?(p0(window,`touchmove`,d,T0),p0(window,`touchend`,f,T0)):(p0(window,`mousemove`,d,T0),p0(window,`mouseup`,f,T0)),r=void 0}}function Q0(){let e=document.documentElement;M0=e.clientWidth,N0=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;for(let e of C0)if(e.top=Math.max(e.top,n),e.bottom=Math.max(e.bottom,r),e.left=Math.max(e.left,i),e.right=Math.max(e.right,a),e.max)e.resize(M0-e.left-e.right,N0-e.top-e.bottom,!0).move(e.left,e.top,!0);else if(e.snapped){let t=Math.round((M0-e.left-e.right)/2),n=N0-e.top-e.bottom,r=e.snapped===`left`?e.left:e.left+t;e.resize(t,n,!0).move(r,e.top,!0)}}function $0(){for(let e=C0.length-1;e>=0;e--){let t=C0[e];if(t&&!t.min){t.focus();break}}}function e2(){let e=document;return!!(e.fullscreen||e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement)}function t2(){if(k0&&(k0.full=!1,e2()&&j0)){let e=document,t=e[j0];if(typeof t==`function`)return t.call(e),!0}}var n2=`piclaw:windows`;function r2(e){let t=new Map,n=null,r=localStorage.getItem(n2);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 i2(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(n2,JSON.stringify(i)):localStorage.removeItem(n2)}function a2(e){return Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e))||0}function o2(e){let t=e.indexOf(`:`);return t>=0?e.slice(0,t):e}function s2(e){let t=Gu(),n=new Map(e.map(e=>[e.key,e])),{windows:r,focus:i}=r2(new Set(e.map(e=>e.key))),a=new Map,o=Jt([]),s=Jt({}),c=N(null),l=Jt({}),u=N(null);function d(){u.value=null}function f(){u.value&&d()}Xr(()=>document.addEventListener(`click`,f)),ei(()=>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(()=>i2(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=o2(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=E(c,i);if(!u)return null;t&&(l[c]={...l[c],...t});let d=Jt({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=o2(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){w(e);return}t.close()}function w(e){let t=o.findIndex(t=>t.id===e);t>=0&&o.splice(t,1),delete s[e],delete l[e],p.delete(e),O(),h()}function T(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 E(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}:T(f,m),_=a2(`--sat`),v=a2(`--sab`),y=a2(`--sal`),b=a2(`--sar`);g.x=Math.max(g.x,y),g.y=Math.max(g.y,_);let x=new F0({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:v,left:y,right:b,class:`no-full`,header:o?32:38,onfocus:()=>{c.value=e,h()},onblur:()=>{O()},onmove:()=>{h()},onresize:()=>{h()},onminimize:()=>{s[e]=!0,O(),h()},onmaximize:()=>{h()},onrestore:()=>{s[e]=!1,h()},onsnap:()=>{h()},onclose:()=>{w(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 D(){if(r.size!==0){for(let[e]of r)b(e,r.get(e)?.state);i&&r.has(i)&&x(i)}}function O(){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 ee(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 te(e,t){let n=p.get(e);n&&n.snap(t).focus()}function ne(e){let t=p.get(e);t&&(t.max?t.restore().focus():t.maximize().focus())}function re(e){if(e.altKey&&e.key===`Tab`)e.preventDefault(),ee(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&&te(c.value,`left`);else if(e.altKey&&e.key===`ArrowRight`)e.preventDefault(),c.value&&!t.value&&te(c.value,`right`);else if(e.altKey&&e.key===`ArrowUp`)e.preventDefault(),c.value&&ne(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`,re),$r(()=>{clearTimeout(m),window.removeEventListener(`keydown`,re);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:ne,closeWindow:C,restore:D,headerMenu:u,closeHeaderMenu:d}}var c2=I({__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}=s2(V1);$n(mu,{windowState:i,setWindowState:a,setWindowTitle:o,bringToFront:s,openWindow:u,closeWindow:d});let{status:h}=Du(),g=N();function _(e){e.preventDefault()}return ei(()=>window.removeEventListener(`beforeunload`,_)),F(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)}),Xr(async()=>{await Rn(),h.value===`approved`&&(f(),t.length===0&&(localStorage.getItem(`piclaw:visited`)||(localStorage.setItem(`piclaw:visited`,`1`),u(`welcome`))))}),(e,i)=>(z(),La(Ru,null,{default:Xn(()=>[V(`div`,{class:`bg-bg text-text font-sans leading-normal flex flex-col relative text-[13px]`,style:{height:`100%`},onContextmenu:i[1]||=Rs(()=>{},[`prevent`]),onClick:i[2]||=e=>(g.value?.closeCtxMenu(),P(m)())},[H(bu,{ref_key:`desktop`,ref:g,apps:P(V1),"open-instances":P(t),onLaunch:P(u),onCtxAction:i[0]||=e=>{e===`settings`&&P(u)(`settings`)}},null,8,[`apps`,`open-instances`,`onLaunch`]),H(e0,{"open-instances":P(t),minimized:P(n),"focused-window":P(r),onLaunch:P(u),onFocus:P(s),onMinimize:P(c),onClose:P(d)},null,8,[`open-instances`,`minimized`,`focused-window`,`onLaunch`,`onFocus`,`onMinimize`,`onClose`]),H(Uu)],32),H(Ml,{pos:P(p)},{default:Xn(()=>[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=>(P(p)&&P(c)(P(p).instanceId),P(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=>(P(p)&&P(l)(P(p).instanceId),P(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=>(P(p)&&P(d)(P(p).instanceId),P(m)())},` Close `)]),_:1},8,[`pos`])]),_:1}))}});pu(),Ws(c2).mount(`#app`);export{tm as t};
|