@wecode-team/we0-cms 1.0.29 → 1.0.31

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/dist/index.esm.js CHANGED
@@ -1,11 +1,16 @@
1
- import*as e from"react";import t,{forwardRef as n,createElement as r,useState as a,useLayoutEffect as o,useMemo as i,useEffect as s}from"react";import{jsx as l,Fragment as c,jsxs as u}from"react/jsx-runtime";import*as d from"react-dom";import f from"react-dom";import{createRoot as m}from"react-dom/client";import{parse as p,format as h,printParseErrorCode as v}from"jsonc-parser";import g from"@uiw/react-codemirror";import{json as b}from"@codemirror/lang-json";import y from"dayjs";function w(e,t){this.v=e,this.k=t}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E(e){var t={},n=!1;function r(t,r){return n=!0,r=new Promise(function(n){n(e[t](r))}),{done:!1,value:new w(r,1)}}return t["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(e){return n?(n=!1,e):r("next",e)},"function"==typeof e.throw&&(t.throw=function(e){if(n)throw n=!1,e;return r("throw",e)}),"function"==typeof e.return&&(t.return=function(e){return n?(n=!1,e):r("return",e)}),t}function N(e){var t,n,r,a=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);a--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new k(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function k(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return k=function(e){this.s=e,this.n=e.next},k.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new k(e)}function S(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function O(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){S(o,r,a,i,s,"next",e)}function s(e){S(o,r,a,i,s,"throw",e)}i(void 0)})}}function C(e){return new w(e,0)}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,B(r.key),r)}}function T(e,t,n){return t&&j(e.prototype,t),n&&j(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=U(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function A(e,t,n){return(t=B(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(){
1
+ import*as e from"react";import t,{forwardRef as n,createElement as r,useState as i,useLayoutEffect as o,useMemo as s,useEffect as a,useRef as l,useImperativeHandle as c,useCallback as h}from"react";import{jsx as u,jsxs as d,Fragment as f}from"react/jsx-runtime";import*as p from"react-dom";import m from"react-dom";import{createRoot as g}from"react-dom/client";import v from"dayjs";function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){y(o,r,i,s,a,"next",e)}function a(e){y(o,r,i,s,a,"throw",e)}s(void 0)})}}function x(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=N(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function k(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return L(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(L(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,L(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,L(d,"constructor",c),L(c,"constructor",l),l.displayName="GeneratorFunction",L(c,a,"GeneratorFunction"),L(d),L(d,a,"Generator"),L(d,r,function(){return this}),L(d,"toString",function(){return"[object Generator]"}),(M=function(){return{w:o,m:f}})()}function L(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}L=function(e,t,n,r){function o(t,n){L(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},L(e,t,n,r)}function I(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||U(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function U(e,t){if(e){if("string"==typeof e)return x(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}function H(e){return function(){return new W(e.apply(this,arguments))}}function W(e){var t,n;function r(t,n){try{var o=e[t](n),i=o.value,s=i instanceof w;Promise.resolve(s?i.v:i).then(function(n){if(s){var l="return"===t?"return":"next";if(!i.k||n.done)return r(l,n);n=e[l](n).value}a(o.done?"return":"normal",n)},function(e){r("throw",e)})}catch(e){a("throw",e)}}function a(e,a){switch(e){case"return":t.resolve({value:a,done:!0});break;case"throw":t.reject(a);break;default:t.resolve({value:a,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,a){return new Promise(function(o,i){var s={key:e,arg:a,resolve:o,reject:i,next:null};n?n=n.next=s:(t=n=s,r(e,a))})},"function"!=typeof e.return&&(this.return=void 0)}W.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},W.prototype.next=function(e){return this._invoke("next",e)},W.prototype.throw=function(e){return this._invoke("throw",e)},W.prototype.return=function(e){return this._invoke("return",e)};
3
+ var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof a?r:a,c=Object.create(l.prototype);return E(c,"_invoke",function(n,r,i){var o,a,l,c=0,h=i||[],u=!1,d={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,a=0,l=e,d.n=n,s}};function f(n,r){for(a=n,l=r,t=0;!u&&c&&!i&&t<h.length;t++){var i,o=h[t],f=d.p,p=o[2];n>3?(i=p===r)&&(l=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(a=0,d.v=r,d.n=o[1]):f<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,a=0))}if(i||n>1)return s;throw u=!0,r}return function(i,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),a=h,l=p;(t=a<2?e:l)||!u;){o||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(c=2,o){if(a||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=e}else if((t=(u=d.n<0)?l:n.call(r,d))!==s)break}catch(t){o=e,a=1,l=t}finally{c=1}}return{value:t,done:u}}}(n,i,o),!0),c}var s={};function a(){}function l(){}function c(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(E(t={},r,function(){return this}),t),u=c.prototype=a.prototype=Object.create(h);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,E(e,i,"GeneratorFunction")),e.prototype=Object.create(u),e}return l.prototype=c,E(u,"constructor",c),E(c,"constructor",l),l.displayName="GeneratorFunction",E(c,i,"GeneratorFunction"),E(u),E(u,i,"Generator"),E(u,r,function(){return this}),E(u,"toString",function(){return"[object Generator]"}),(S=function(){return{w:o,m:d}})()}function E(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}E=function(e,t,n,r){function o(t,n){E(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},E(e,t,n,r)}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||N(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||N(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}
4
4
  /**
5
5
  * @license lucide-react v0.344.0 - ISC
6
6
  *
7
7
  * This source code is licensed under the ISC license.
8
8
  * See the LICENSE file in the root directory of this source tree.
9
- */
10
- var V={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},$=["color","size","strokeWidth","absoluteStrokeWidth","className","children"],K=function(e,t){var a=n(function(n,a){var o,i=n.color,s=void 0===i?"currentColor":i,l=n.size,c=void 0===l?24:l,u=n.strokeWidth,d=void 0===u?2:u,f=n.absoluteStrokeWidth,m=n.className,p=void 0===m?"":m,h=n.children,v=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(n,$);return r("svg",D(D({ref:a},V),{},{width:c,height:c,stroke:s,strokeWidth:f?24*Number(d)/Number(c):d,className:["lucide","lucide-".concat((o=e,o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim())),p].join(" ")},v),[].concat(z(t.map(function(e){var t=F(e,2),n=t[0],a=t[1];return r(n,a)})),z(Array.isArray(h)?h:[h])))});return a.displayName="".concat(e),a},Y=K("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),J=K("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),G=K("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),X=K("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Z=K("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Q=K("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ee=K("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),te=K("Crown",[["path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14",key:"zkxr6b"}]]),ne=K("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),re=K("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),ae=K("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),oe=K("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),ie=K("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),se=K("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),le=K("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),ce=K("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),ue=K("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),de=K("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),fe=K("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),me=K("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),pe=K("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),he=K("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]),ve=K("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),ge=K("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),be=K("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),ye=K("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),we=K("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xe=function(){return xe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},xe.apply(this,arguments)};function Ee(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function Ne(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Ne(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ke(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Ne(e))&&(r&&(r+=" "),r+=t);return r}"function"==typeof SuppressedError&&SuppressedError;const Se=e=>{const t=je(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),Oe(n,t)||Re(e)},getConflictingClassGroupIds:(e,t)=>{const a=n[e]||[];return t&&r[e]?[...a,...r[e]]:a}}},Oe=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?Oe(e.slice(1),r):void 0;if(a)return a;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},Ce=/^\[(.+)\]$/,Re=e=>{if(Ce.test(e)){const t=Ce.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},je=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Pe(Object.entries(e.classGroups),n).forEach(([e,n])=>{Te(n,r,e,t)}),r},Te=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:_e(t,e)).classGroupId=n)}if("function"==typeof e)return Ae(e)?void Te(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,a])=>{Te(a,_e(t,e),n,r)})})},_e=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Ae=e=>e.isThemeGetter,Pe=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,De=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(a(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):a(e,t)}}},Me=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,a=t[0],o=t.length,i=e=>{const n=[];let i,s=0,l=0;for(let c=0;c<e.length;c++){let u=e[c];if(0===s){if(u===a&&(r||e.slice(c,c+o)===t)){n.push(e.slice(l,c)),l=c+o;continue}if("/"===u){i=c;continue}}"["===u?s++:"]"===u&&s--}const c=0===n.length?e:e.substring(l),u=c.startsWith("!");return{modifiers:n,hasImportantModifier:u,baseClassName:u?c.substring(1):c,maybePostfixModifierPosition:i&&i>l?i-l:void 0}};return n?e=>n({className:e,parseClassName:i}):i},Le=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},Ie=/\s+/;function Fe(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ze(e))&&(r&&(r+=" "),r+=t);return r}const ze=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=ze(e[r]))&&(n&&(n+=" "),n+=t);return n};function Be(e,...t){let n,r,a,o=function(s){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:De(e.cacheSize),parseClassName:Me(e),...Se(e)}))(l),r=n.cache.get,a=n.cache.set,o=i,i(s)};function i(e){const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,o=[],i=e.trim().split(Ie);let s="";for(let e=i.length-1;e>=0;e-=1){const t=i[e],{modifiers:l,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(t);let f=Boolean(d),m=r(f?u.substring(0,d):u);if(!m){if(!f){s=t+(s.length>0?" "+s:s);continue}if(m=r(u),!m){s=t+(s.length>0?" "+s:s);continue}f=!1}const p=Le(l).join(":"),h=c?p+"!":p,v=h+m;if(o.includes(v))continue;o.push(v);const g=a(m,f);for(let e=0;e<g.length;++e){const t=g[e];o.push(h+t)}s=t+(s.length>0?" "+s:s)}return s})(e,n);return a(e,o),o}return function(){return o(Fe.apply(null,arguments))}}const qe=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Ue=/^\[(?:([a-z-]+):)?(.+)\]$/i,He=/^\d+\/\d+$/,We=new Set(["px","full","screen"]),Ve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ke=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Ye=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Je=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ge=e=>Ze(e)||We.has(e)||He.test(e),Xe=e=>dt(e,"length",ft),Ze=e=>Boolean(e)&&!Number.isNaN(Number(e)),Qe=e=>dt(e,"number",Ze),et=e=>Boolean(e)&&Number.isInteger(Number(e)),tt=e=>e.endsWith("%")&&Ze(e.slice(0,-1)),nt=e=>Ue.test(e),rt=e=>Ve.test(e),at=new Set(["length","size","percentage"]),ot=e=>dt(e,at,mt),it=e=>dt(e,"position",mt),st=new Set(["image","url"]),lt=e=>dt(e,st,ht),ct=e=>dt(e,"",pt),ut=()=>!0,dt=(e,t,n)=>{const r=Ue.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},ft=e=>$e.test(e)&&!Ke.test(e),mt=()=>!1,pt=e=>Ye.test(e),ht=e=>Je.test(e),vt=Be(()=>{const e=qe("colors"),t=qe("spacing"),n=qe("blur"),r=qe("brightness"),a=qe("borderColor"),o=qe("borderRadius"),i=qe("borderSpacing"),s=qe("borderWidth"),l=qe("contrast"),c=qe("grayscale"),u=qe("hueRotate"),d=qe("invert"),f=qe("gap"),m=qe("gradientColorStops"),p=qe("gradientColorStopPositions"),h=qe("inset"),v=qe("margin"),g=qe("opacity"),b=qe("padding"),y=qe("saturate"),w=qe("scale"),x=qe("sepia"),E=qe("skew"),N=qe("space"),k=qe("translate"),S=()=>["auto",nt,t],O=()=>[nt,t],C=()=>["",Ge,Xe],R=()=>["auto",Ze,nt],j=()=>["","0",nt],T=()=>[Ze,nt];return{cacheSize:500,separator:":",theme:{colors:[ut],spacing:[Ge,Xe],blur:["none","",rt,nt],brightness:T(),borderColor:[e],borderRadius:["none","","full",rt,nt],borderSpacing:O(),borderWidth:C(),contrast:T(),grayscale:j(),hueRotate:T(),invert:j(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[tt,Xe],inset:S(),margin:S(),opacity:T(),padding:O(),saturate:T(),scale:T(),sepia:j(),skew:T(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",nt]}],container:["container"],columns:[{columns:[rt]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",nt]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",et,nt]}],basis:[{basis:S()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",nt]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",et,nt]}],"grid-cols":[{"grid-cols":[ut]}],"col-start-end":[{col:["auto",{span:["full",et,nt]},nt]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[ut]}],"row-start-end":[{row:["auto",{span:[et,nt]},nt]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",nt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",nt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",nt,t]}],"min-w":[{"min-w":[nt,t,"min","max","fit"]}],"max-w":[{"max-w":[nt,t,"none","full","min","max","fit","prose",{screen:[rt]},rt]}],h:[{h:[nt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[nt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[nt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[nt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",rt,Xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qe]}],"font-family":[{font:[ut]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",nt]}],"line-clamp":[{"line-clamp":["none",Ze,Qe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ge,nt]}],"list-image":[{"list-image":["none",nt]}],"list-style-type":[{list:["none","disc","decimal",nt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ge,Xe]}],"underline-offset":[{"underline-offset":["auto",Ge,nt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",nt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",it]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ot]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},lt]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[Ge,nt]}],"outline-w":[{outline:[Ge,Xe]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:C()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Ge,Xe]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",rt,ct]}],"shadow-color":[{shadow:[ut]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",rt,nt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",nt]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",nt]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",nt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[et,nt]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",nt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",nt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",nt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ge,Xe,Qe]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function gt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return vt(ke(t))}function bt(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("animate-pulse rounded-md bg-muted",n)},r))}function yt(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function wt(...e){return t=>{let n=!1;const r=e.map(e=>{const r=yt(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():yt(e[t],null)}}}}function xt(...t){return e.useCallback(wt(...t),t)}var Et=Symbol.for("react.lazy"),Nt=e[" use ".trim().toString()];function kt(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Et&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function St(t){const n=Ct(t),r=e.forwardRef((t,r)=>{let{children:a,...o}=t;kt(a)&&"function"==typeof Nt&&(a=Nt(a._payload));const i=e.Children.toArray(a),s=i.find(jt);if(s){const t=s.props.children,a=i.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return l(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return l(n,{...o,ref:r,children:a})});return r.displayName=`${t}.Slot`,r}var Ot=St("Slot");function Ct(t){const n=e.forwardRef((t,n)=>{let{children:r,...a}=t;if(kt(r)&&"function"==typeof Nt&&(r=Nt(r._payload)),e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}(a,r.props);return r.type!==e.Fragment&&(o.ref=n?wt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Rt=Symbol("radix.slottable");function jt(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Rt}const Tt=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,_t=ke,At=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return _t(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;const i=Tt(t)||Tt(r);return a[e][i]}),s=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...s}[t]):{...o,...s}[t]===n})?[...e,n,r]:e},[]);return _t(e,i,l,null==n?void 0:n.class,null==n?void 0:n.className)};var Pt=At("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Dt=e.forwardRef(function(t,n){var r=t.className,a=t.variant,o=t.size,i=t.asChild,s=void 0!==i&&i,l=Ee(t,["className","variant","size","asChild"]),c=s?Ot:"button";return e.createElement(c,Object.assign({className:gt(Pt({variant:a,size:o,className:r})),ref:n},l))});Dt.displayName="Button";var Mt=e.forwardRef(function(t,n){var r=t.className,a=t.type,o=Ee(t,["className","type"]);return e.createElement("input",Object.assign({type:a,className:gt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:n},o))});Mt.displayName="Input";var Lt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=St(`Primitive.${n}`),a=e.forwardRef((e,t)=>{const{asChild:a,...o}=e,i=a?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),l(i,{...o,ref:t})});return a.displayName=`Primitive.${n}`,{...t,[n]:a}},{}),It="horizontal",Ft=["horizontal","vertical"],zt=e.forwardRef((e,t)=>{const{decorative:n,orientation:r=It,...a}=e,o=function(e){return Ft.includes(e)}(r)?r:It,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return l(Lt.div,{"data-orientation":o,...i,...a,ref:t})});zt.displayName="Separator";var Bt=zt;function qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Ut(t,n=[]){let r=[];const a=()=>{const n=r.map(t=>e.createContext(t));return function(r){const a=r?.[t]||n;return e.useMemo(()=>({[`__scope${t}`]:{...r,[t]:a}}),[r,a])}};return a.scopeName=t,[function(n,a){const o=e.createContext(a),i=r.length;r=[...r,a];const s=n=>{const{scope:r,children:a,...s}=n,c=r?.[t]?.[i]||o,u=e.useMemo(()=>s,Object.values(s));return l(c.Provider,{value:u,children:a})};return s.displayName=n+"Provider",[s,function(r,s){const l=s?.[t]?.[i]||o,c=e.useContext(l);if(c)return c;if(void 0!==a)return a;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},Ht(a,...n)]}function Ht(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const a=r.reduce((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]}),{});return e.useMemo(()=>({[`__scope${n.scopeName}`]:a}),[a])}};return r.scopeName=n.scopeName,r}e.forwardRef(function(t,n){var r=t.className,a=t.orientation,o=void 0===a?"horizontal":a,i=t.decorative,s=void 0===i||i,l=Ee(t,["className","orientation","decorative"]);return e.createElement(Bt,Object.assign({ref:n,decorative:s,orientation:o,className:gt("shrink-0 bg-border","horizontal"===o?"h-[1px] w-full":"h-full w-[1px]",r)},l))}).displayName=Bt.displayName;var Wt=globalThis?.document?e.useLayoutEffect:()=>{},Vt=e[" useId ".trim().toString()]||(()=>{}),$t=0;function Kt(t){const[n,r]=e.useState(Vt());return Wt(()=>{t||r(e=>e??String($t++))},[t]),t||(n?`radix-${n}`:"")}var Yt=e[" useInsertionEffect ".trim().toString()]||Wt;function Jt({prop:t,defaultProp:n,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:t,onChange:n}){const[r,a]=e.useState(t),o=e.useRef(r),i=e.useRef(n);return Yt(()=>{i.current=n},[n]),e.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:n,onChange:r}),l=void 0!==t,c=l?t:o;{const n=e.useRef(void 0!==t);e.useEffect(()=>{const e=n.current;if(e!==l){}n.current=l},[l,a])}const u=e.useCallback(e=>{if(l){const n=function(e){return"function"==typeof e}(e)?e(t):e;n!==t&&s.current?.(n)}else i(e)},[l,t,i,s]);return[c,u]}function Gt(t){const n=Xt(t),r=e.forwardRef((t,r)=>{const{children:a,...o}=t,i=e.Children.toArray(a),s=i.find(Qt);if(s){const t=s.props.children,a=i.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return l(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return l(n,{...o,ref:r,children:a})});return r.displayName=`${t}.Slot`,r}function Xt(t){const n=e.forwardRef((t,n)=>{const{children:r,...a}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}(a,r.props);return r.type!==e.Fragment&&(o.ref=n?wt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Zt=Symbol("radix.slottable");function Qt(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Zt}var en=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=Gt(`Primitive.${n}`),a=e.forwardRef((e,t)=>{const{asChild:a,...o}=e,i=a?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),l(i,{...o,ref:t})});return a.displayName=`Primitive.${n}`,{...t,[n]:a}},{});function tn(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>n.current?.(...e),[])}var nn,rn="dismissableLayer.update",an="dismissableLayer.pointerDownOutside",on="dismissableLayer.focusOutside",sn=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ln=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:c,...u}=t,d=e.useContext(sn),[f,m]=e.useState(null),p=f?.ownerDocument??globalThis?.document,[,h]=e.useState({}),v=xt(n,e=>m(e)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),w=f?g.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,N=function(t,n=globalThis?.document){const r=tn(t),a=e.useRef(!1),o=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let t=function(){un(an,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=t,n.addEventListener("click",o.current,{once:!0})):t()}else n.removeEventListener("click",o.current);a.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}},[n,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));E&&!n&&(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),k=function(t,n=globalThis?.document){const r=tn(t),a=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!a.current){un(on,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(i?.(e),s?.(e),e.defaultPrevented||c?.())},p);return function(t,n=globalThis?.document){const r=tn(t);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})},[r,n])}(e=>{w===d.layers.size-1&&(a?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),e.useEffect(()=>{if(f)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(nn=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),cn(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=nn)}},[f,p,r,d]),e.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),cn())},[f,d]),e.useEffect(()=>{const e=()=>h({});return document.addEventListener(rn,e),()=>document.removeEventListener(rn,e)},[]),l(en.div,{...u,ref:v,style:{pointerEvents:x?E?"auto":"none":void 0,...t.style},onFocusCapture:qt(t.onFocusCapture,k.onFocusCapture),onBlurCapture:qt(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:qt(t.onPointerDownCapture,N.onPointerDownCapture)})});ln.displayName="DismissableLayer";function cn(){const e=new CustomEvent(rn);document.dispatchEvent(e)}function un(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?function(e,t){e&&d.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}e.forwardRef((t,n)=>{const r=e.useContext(sn),a=e.useRef(null),o=xt(n,a);return e.useEffect(()=>{const e=a.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),l(en.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var dn="focusScope.autoFocusOnMount",fn="focusScope.autoFocusOnUnmount",mn={bubbles:!1,cancelable:!0},pn=e.forwardRef((t,n)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[c,u]=e.useState(null),d=tn(o),f=tn(i),m=e.useRef(null),p=xt(n,e=>u(e)),h=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect(()=>{if(a){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?m.current=t:bn(m.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||bn(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&bn(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[a,c,h.paused]),e.useEffect(()=>{if(c){yn.add(h);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(dn,mn);c.addEventListener(dn,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(bn(r,{select:t}),document.activeElement!==n)return}((e=hn(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&bn(c))}return()=>{c.removeEventListener(dn,d),setTimeout(()=>{const e=new CustomEvent(fn,mn);c.addEventListener(fn,f),c.dispatchEvent(e),e.defaultPrevented||bn(t??document.body,{select:!0}),c.removeEventListener(fn,f),yn.remove(h)},0)}}var e},[c,d,f,h]);const v=e.useCallback(e=>{if(!r&&!a)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[a,o]=function(e){const t=hn(e),n=vn(t,e),r=vn(t.reverse(),e);return[n,r]}(t);a&&o?e.shiftKey||n!==o?e.shiftKey&&n===a&&(e.preventDefault(),r&&bn(o,{select:!0})):(e.preventDefault(),r&&bn(a,{select:!0})):n===t&&e.preventDefault()}},[r,a,h.paused]);return l(en.div,{tabIndex:-1,...s,ref:p,onKeyDown:v})});function hn(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vn(e,t){for(const n of e)if(!gn(n,{upTo:t}))return n}function gn(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function bn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}pn.displayName="FocusScope";var yn=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=wn(e,t),e.unshift(t)},remove(t){e=wn(e,t),e[0]?.resume()}}}();function wn(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var xn=e.forwardRef((t,n)=>{const{container:r,...a}=t,[o,i]=e.useState(!1);Wt(()=>i(!0),[]);const s=r||o&&globalThis?.document?.body;return s?f.createPortal(l(en.div,{...a,ref:n}),s):null});xn.displayName="Portal";var En=t=>{const{present:n,children:r}=t,a=function(t){const[n,r]=e.useState(),a=e.useRef(null),o=e.useRef(t),i=e.useRef("none"),s=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=Nn(a.current);i.current="mounted"===l?e:"none"},[l]),Wt(()=>{const e=a.current,n=o.current;if(n!==t){const r=i.current,a=Nn(e);if(t)c("MOUNT");else if("none"===a||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=t}},[t,c]),Wt(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const i=Nn(a.current).includes(CSS.escape(r.animationName));if(r.target===n&&i&&(c("ANIMATION_END"),!o.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},s=e=>{e.target===n&&(i.current=Nn(a.current))};return n.addEventListener("animationstart",s),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",s),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(n),o="function"==typeof r?r({present:a.isPresent}):e.Children.only(r),i=xt(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?e.cloneElement(o,{ref:i}):null};function Nn(e){return e?.animationName||"none"}En.displayName="Presence";var kn=0;function Sn(){e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??On()),document.body.insertAdjacentElement("beforeend",e[1]??On()),kn++,()=>{1===kn&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),kn--}},[])}function On(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Cn="right-scroll-bar-position",Rn="width-before-scroll-bar";function jn(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Tn="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,_n=new WeakMap;function An(e,t){var n,r,o,i=(n=t||null,r=function(t){return e.forEach(function(e){return jn(e,t)})},(o=a(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return Tn(function(){var t=_n.get(i);if(t){var n=new Set(t),r=new Set(e),a=i.current;n.forEach(function(e){r.has(e)||jn(e,null)}),r.forEach(function(e){n.has(e)||jn(e,a)})}_n.set(i,e)},[e]),i}function Pn(e){return e}var Dn=function(t){var n=t.sideCar,r=Ee(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=n.read();if(!a)throw new Error("Sidecar medium not found");return e.createElement(a,xe({},r))};Dn.isSideCarExport=!0;var Mn=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Pn);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var a=t(e,r);return n.push(a),function(){n=n.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var a=n;n=[],a.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=xe({async:!0,ssr:!1},e),t}(),Ln=function(){},In=e.forwardRef(function(t,n){var r=e.useRef(null),a=e.useState({onScrollCapture:Ln,onWheelCapture:Ln,onTouchMoveCapture:Ln}),o=a[0],i=a[1],s=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,m=t.sideCar,p=t.noRelative,h=t.noIsolation,v=t.inert,g=t.allowPinchZoom,b=t.as,y=void 0===b?"div":b,w=t.gapMode,x=Ee(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,N=An([r,n]),k=xe(xe({},x),o);return e.createElement(e.Fragment,null,d&&e.createElement(E,{sideCar:Mn,removeScrollBar:u,shards:f,noRelative:p,noIsolation:h,inert:v,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:w}),s?e.cloneElement(e.Children.only(l),xe(xe({},k),{ref:N})):e.createElement(y,xe({},k,{className:c,ref:N}),l))});In.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},In.classNames={fullWidth:Rn,zeroRight:Cn};function Fn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var zn=function(){var e=0,t=null;return{add:function(n){var r,a;0==e&&(t=Fn())&&(a=n,(r=t).styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bn=function(){var t,n=(t=zn(),function(n,r){e.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},qn={left:0,top:0,right:0,gap:0},Un=function(e){return parseInt(e||"",10)||0},Hn=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return qn;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Un(n),Un(r),Un(a)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Wn=Bn(),Vn="data-scroll-locked",$n=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(Vn,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Cn," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Rn," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Cn," .").concat(Cn," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Rn," .").concat(Rn," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Vn,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Kn=function(){var e=parseInt(document.body.getAttribute(Vn)||"0",10);return isFinite(e)?e:0},Yn=function(t){var n=t.noRelative,r=t.noImportant,a=t.gapMode,o=void 0===a?"margin":a;e.useEffect(function(){return document.body.setAttribute(Vn,(Kn()+1).toString()),function(){var e=Kn()-1;e<=0?document.body.removeAttribute(Vn):document.body.setAttribute(Vn,e.toString())}},[]);var i=e.useMemo(function(){return Hn(o)},[o]);return e.createElement(Wn,{styles:$n(i,!n,o,r?"":"!important")})},Jn=!1;if("undefined"!=typeof window)try{var Gn=Object.defineProperty({},"passive",{get:function(){return Jn=!0,!0}});window.addEventListener("test",Gn,Gn),window.removeEventListener("test",Gn,Gn)}catch(e){Jn=!1}var Xn=!!Jn&&{passive:!1},Zn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Qn=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),er(e,r)){var a=tr(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},er=function(e,t){return"v"===e?function(e){return Zn(e,"overflowY")}(t):function(e){return Zn(e,"overflowX")}(t)},tr=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},nr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rr=function(e){return[e.deltaX,e.deltaY]},ar=function(e){return e&&"current"in e?e.current:e},or=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},ir=0,sr=[];function lr(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var cr,ur=(cr=function(t){var n=e.useRef([]),r=e.useRef([0,0]),a=e.useRef(),o=e.useState(ir++)[0],i=e.useState(Bn)[0],s=e.useRef(t);e.useEffect(function(){s.current=t},[t]),e.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var e=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}([t.lockRef.current],(t.shards||[]).map(ar),!0).filter(Boolean);return e.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),e.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=nr(e),i=r.current,l="deltaX"in e?e.deltaX:i[0]-o[0],c="deltaY"in e?e.deltaY:i[1]-o[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=window.getSelection(),m=f&&f.anchorNode;if(m&&(m===u||m.contains(u)))return!1;var p=Qn(d,u);if(!p)return!0;if(p?n=d:(n="v"===d?"h":"v",p=Qn(d,u)),!p)return!1;if(!a.current&&"changedTouches"in e&&(l||c)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,n,r,a){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,f=0;do{if(!s)break;var m=tr(e,s),p=m[0],h=m[1]-m[2]-o*p;(p||h)&&er(e,s)&&(d+=h,f+=p);var v=s.parentNode;s=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(a&&Math.abs(d)<1||!a&&i>d)||!u&&(a&&Math.abs(f)<1||!a&&-i>f))&&(c=!0),c}(h,t,e,"h"===h?l:c,!0)},[]),c=e.useCallback(function(e){var t=e;if(sr.length&&sr[sr.length-1]===i){var r="deltaY"in t?rr(t):nr(t),a=n.current.filter(function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&(n=e.delta,a=r,n[0]===a[0]&&n[1]===a[1]);var n,a})[0];if(a&&a.should)t.cancelable&&t.preventDefault();else if(!a){var o=(s.current.shards||[]).map(ar).filter(Boolean).filter(function(e){return e.contains(t.target)});(o.length>0?l(t,o[0]):!s.current.noIsolation)&&t.cancelable&&t.preventDefault()}}},[]),u=e.useCallback(function(e,t,r,a){var o={name:e,delta:t,target:r,should:a,shadowParent:lr(r)};n.current.push(o),setTimeout(function(){n.current=n.current.filter(function(e){return e!==o})},1)},[]),d=e.useCallback(function(e){r.current=nr(e),a.current=void 0},[]),f=e.useCallback(function(e){u(e.type,rr(e),e.target,l(e,t.lockRef.current))},[]),m=e.useCallback(function(e){u(e.type,nr(e),e.target,l(e,t.lockRef.current))},[]);e.useEffect(function(){return sr.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Xn),document.addEventListener("touchmove",c,Xn),document.addEventListener("touchstart",d,Xn),function(){sr=sr.filter(function(e){return e!==i}),document.removeEventListener("wheel",c,Xn),document.removeEventListener("touchmove",c,Xn),document.removeEventListener("touchstart",d,Xn)}},[]);var p=t.removeScrollBar,h=t.inert;return e.createElement(e.Fragment,null,h?e.createElement(i,{styles:or(o)}):null,p?e.createElement(Yn,{noRelative:t.noRelative,gapMode:t.gapMode}):null)},Mn.useMedium(cr),Dn),dr=e.forwardRef(function(t,n){return e.createElement(In,xe({},t,{ref:n,sideCar:ur}))});dr.classNames=In.classNames;var fr=dr,mr=new WeakMap,pr=new WeakMap,hr={},vr=0,gr=function(e){return e&&(e.host||gr(e.parentNode))},br=function(e,t,n,r){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=gr(t);return n&&e.contains(n)?n:null}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);hr[n]||(hr[n]=new WeakMap);var o=hr[n],i=[],s=new Set,l=new Set(a),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,l=(mr.get(e)||0)+1,c=(o.get(e)||0)+1;mr.set(e,l),o.set(e,c),i.push(e),1===l&&a&&pr.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(e){}})};return u(t),s.clear(),vr++,function(){i.forEach(function(e){var t=mr.get(e)-1,a=o.get(e)-1;mr.set(e,t),o.set(e,a),t||(pr.has(e)||e.removeAttribute(r),pr.delete(e)),a||e.removeAttribute(n)}),--vr||(mr=new WeakMap,mr=new WeakMap,pr=new WeakMap,hr={})}},yr=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),br(r,a,n,"aria-hidden")):function(){return null}},wr="Dialog",[xr,Er]=Ut(wr),[Nr,kr]=xr(wr),Sr=t=>{const{__scopeDialog:n,children:r,open:a,defaultOpen:o,onOpenChange:i,modal:s=!0}=t,c=e.useRef(null),u=e.useRef(null),[d,f]=Jt({prop:a,defaultProp:o??!1,onChange:i,caller:wr});return l(Nr,{scope:n,triggerRef:c,contentRef:u,contentId:Kt(),titleId:Kt(),descriptionId:Kt(),open:d,onOpenChange:f,onOpenToggle:e.useCallback(()=>f(e=>!e),[f]),modal:s,children:r})};Sr.displayName=wr;var Or="DialogTrigger",Cr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=kr(Or,n),o=xt(t,a.triggerRef);return l(en.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Kr(a.open),...r,ref:o,onClick:qt(e.onClick,a.onOpenToggle)})});Cr.displayName=Or;var Rr="DialogPortal",[jr,Tr]=xr(Rr,{forceMount:void 0}),_r=t=>{const{__scopeDialog:n,forceMount:r,children:a,container:o}=t,i=kr(Rr,n);return l(jr,{scope:n,forceMount:r,children:e.Children.map(a,e=>l(En,{present:r||i.open,children:l(xn,{asChild:!0,container:o,children:e})}))})};_r.displayName=Rr;var Ar="DialogOverlay",Pr=e.forwardRef((e,t)=>{const n=Tr(Ar,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=kr(Ar,e.__scopeDialog);return o.modal?l(En,{present:r||o.open,children:l(Mr,{...a,ref:t})}):null});Pr.displayName=Ar;var Dr=Gt("DialogOverlay.RemoveScroll"),Mr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=kr(Ar,n);return l(fr,{as:Dr,allowPinchZoom:!0,shards:[a.contentRef],children:l(en.div,{"data-state":Kr(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Lr="DialogContent",Ir=e.forwardRef((e,t)=>{const n=Tr(Lr,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=kr(Lr,e.__scopeDialog);return l(En,{present:r||o.open,children:o.modal?l(Fr,{...a,ref:t}):l(zr,{...a,ref:t})})});Ir.displayName=Lr;var Fr=e.forwardRef((t,n)=>{const r=kr(Lr,t.__scopeDialog),a=e.useRef(null),o=xt(n,r.contentRef,a);return e.useEffect(()=>{const e=a.current;if(e)return yr(e)},[]),l(Br,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qt(t.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:qt(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:qt(t.onFocusOutside,e=>e.preventDefault())})}),zr=e.forwardRef((t,n)=>{const r=kr(Lr,t.__scopeDialog),a=e.useRef(!1),o=e.useRef(!1);return l(Br,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(a.current||r.triggerRef.current?.focus(),e.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(a.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const n=e.target,i=r.triggerRef.current?.contains(n);i&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Br=e.forwardRef((t,n)=>{const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=t,d=kr(Lr,r),f=e.useRef(null),m=xt(n,f);return Sn(),u(c,{children:[l(pn,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:l(ln,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Kr(d.open),...s,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),u(c,{children:[l(Xr,{titleId:d.titleId}),l(Zr,{contentRef:f,descriptionId:d.descriptionId})]})]})}),qr="DialogTitle",Ur=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=kr(qr,n);return l(en.h2,{id:a.titleId,...r,ref:t})});Ur.displayName=qr;var Hr="DialogDescription",Wr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=kr(Hr,n);return l(en.p,{id:a.descriptionId,...r,ref:t})});Wr.displayName=Hr;var Vr="DialogClose",$r=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=kr(Vr,n);return l(en.button,{type:"button",...r,ref:t,onClick:qt(e.onClick,()=>a.onOpenChange(!1))})});function Kr(e){return e?"open":"closed"}$r.displayName=Vr;var Yr="DialogTitleWarning",[Jr,Gr]=function(t,n){const r=e.createContext(n),a=t=>{const{children:n,...a}=t,o=e.useMemo(()=>a,Object.values(a));return l(r.Provider,{value:o,children:n})};return a.displayName=t+"Provider",[a,function(a){const o=e.useContext(r);if(o)return o;if(void 0!==n)return n;throw new Error(`\`${a}\` must be used within \`${t}\``)}]}(Yr,{contentName:Lr,titleName:qr,docsSlug:"dialog"}),Xr=({titleId:t})=>{const n=Gr(Yr),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)}},[r,t]),null},Zr=({contentRef:t,descriptionId:n})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Gr("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(n&&e){document.getElementById(n)}},[r,t,n]),null},Qr=Sr,ea=Cr,ta=_r,na=Pr,ra=Ir,aa=Ur,oa=Wr,ia=$r,sa=Qr,la=ta,ca=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(na,Object.assign({className:gt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r)},a,{ref:n}))});ca.displayName=na.displayName;var ua=At("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),da=e.forwardRef(function(t,n){var r=t.side,a=void 0===r?"right":r,o=t.className,i=t.children,s=Ee(t,["side","className","children"]);return e.createElement(la,null,e.createElement(ca,null),e.createElement(ra,Object.assign({ref:n,className:gt(ua({side:a}),o)},s),i,e.createElement(ia,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"},e.createElement(we,{className:"h-4 w-4"}),e.createElement("span",{className:"sr-only"},"Close"))))});da.displayName=ra.displayName;var fa=function(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex flex-col space-y-2 text-center sm:text-left",n)},r))};fa.displayName="SheetHeader";var ma=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(aa,Object.assign({ref:n,className:gt("text-lg font-semibold text-foreground",r)},a))});ma.displayName=aa.displayName;var pa=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(oa,Object.assign({ref:n,className:gt("text-sm text-muted-foreground",r)},a))});pa.displayName=oa.displayName;const ha=["top","right","bottom","left"],va=Math.min,ga=Math.max,ba=Math.round,ya=Math.floor,wa=e=>({x:e,y:e}),xa={left:"right",right:"left",bottom:"top",top:"bottom"},Ea={start:"end",end:"start"};function Na(e,t,n){return ga(e,va(t,n))}function ka(e,t){return"function"==typeof e?e(t):e}function Sa(e){return e.split("-")[0]}function Oa(e){return e.split("-")[1]}function Ca(e){return"x"===e?"y":"x"}function Ra(e){return"y"===e?"height":"width"}const ja=new Set(["top","bottom"]);function Ta(e){return ja.has(Sa(e))?"y":"x"}function _a(e){return Ca(Ta(e))}function Aa(e){return e.replace(/start|end/g,e=>Ea[e])}const Pa=["left","right"],Da=["right","left"],Ma=["top","bottom"],La=["bottom","top"];function Ia(e,t,n,r){const a=Oa(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Da:Pa:t?Pa:Da;case"left":case"right":return t?Ma:La;default:return[]}}(Sa(e),"start"===n,r);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Aa)))),o}function Fa(e){return e.replace(/left|right|bottom|top/g,e=>xa[e])}function za(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ba(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function qa(e,t,n){let{reference:r,floating:a}=e;const o=Ta(t),i=_a(t),s=Ra(i),l=Sa(t),c="y"===o,u=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,f=r[s]/2-a[s]/2;let m;switch(l){case"top":m={x:u,y:r.y-a.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-a.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Oa(t)){case"start":m[i]-=f*(n&&c?-1:1);break;case"end":m[i]+=f*(n&&c?-1:1)}return m}async function Ua(e,t){var n;void 0===t&&(t={});const{x:r,y:a,platform:o,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=ka(t,e),p=za(m),h=s[f?"floating"===d?"reference":"floating":d],v=Ba(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(h)))||n?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),g="floating"===d?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},w=Ba(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:b,strategy:l}):g);return{top:(v.top-w.top+p.top)/y.y,bottom:(w.bottom-v.bottom+p.bottom)/y.y,left:(v.left-w.left+p.left)/y.x,right:(w.right-v.right+p.right)/y.x}}function Ha(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wa(e){return ha.some(t=>e[t]>=0)}const Va=new Set(["left","top"]);function $a(){return"undefined"!=typeof window}function Ka(e){return Ga(e)?(e.nodeName||"").toLowerCase():"#document"}function Ya(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ja(e){var t;return null==(t=(Ga(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Ga(e){return!!$a()&&(e instanceof Node||e instanceof Ya(e).Node)}function Xa(e){return!!$a()&&(e instanceof Element||e instanceof Ya(e).Element)}function Za(e){return!!$a()&&(e instanceof HTMLElement||e instanceof Ya(e).HTMLElement)}function Qa(e){return!(!$a()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Ya(e).ShadowRoot)}const eo=new Set(["inline","contents"]);function to(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=po(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!eo.has(a)}const no=new Set(["table","td","th"]);function ro(e){return no.has(Ka(e))}const ao=[":popover-open",":modal"];function oo(e){return ao.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const io=["transform","translate","scale","rotate","perspective"],so=["transform","translate","scale","rotate","perspective","filter"],lo=["paint","layout","strict","content"];function co(e){const t=uo(),n=Xa(e)?po(e):e;return io.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||so.some(e=>(n.willChange||"").includes(e))||lo.some(e=>(n.contain||"").includes(e))}function uo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const fo=new Set(["html","body","#document"]);function mo(e){return fo.has(Ka(e))}function po(e){return Ya(e).getComputedStyle(e)}function ho(e){return Xa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vo(e){if("html"===Ka(e))return e;const t=e.assignedSlot||e.parentNode||Qa(e)&&e.host||Ja(e);return Qa(t)?t.host:t}function go(e){const t=vo(e);return mo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Za(t)&&to(t)?t:go(t)}function bo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const a=go(e),o=a===(null==(r=e.ownerDocument)?void 0:r.body),i=Ya(a);if(o){const e=yo(i);return t.concat(i,i.visualViewport||[],to(a)?a:[],e&&n?bo(e):[])}return t.concat(a,bo(a,[],n))}function yo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wo(e){const t=po(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Za(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,s=ba(n)!==o||ba(r)!==i;return s&&(n=o,r=i),{width:n,height:r,$:s}}function xo(e){return Xa(e)?e:e.contextElement}function Eo(e){const t=xo(e);if(!Za(t))return wa(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=wo(t);let i=(o?ba(n.width):n.width)/r,s=(o?ba(n.height):n.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const No=wa(0);function ko(e){const t=Ya(e);return uo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:No}function So(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const a=e.getBoundingClientRect(),o=xo(e);let i=wa(1);t&&(r?Xa(r)&&(i=Eo(r)):i=Eo(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ya(e))&&t}(o,n,r)?ko(o):wa(0);let l=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,u=a.width/i.x,d=a.height/i.y;if(o){const e=Ya(o),t=r&&Xa(r)?Ya(r):r;let n=e,a=yo(n);for(;a&&r&&t!==n;){const e=Eo(a),t=a.getBoundingClientRect(),r=po(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=i,n=Ya(a),a=yo(n)}}return Ba({width:u,height:d,x:l,y:c})}function Oo(e,t){const n=ho(e).scrollLeft;return t?t.left+n:So(Ja(e)).left+n}function Co(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Oo(e,n),y:n.top+t.scrollTop}}const Ro=new Set(["absolute","fixed"]);function jo(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ya(e),r=Ja(e),a=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,s=0,l=0;if(a){o=a.width,i=a.height;const e=uo();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const c=Oo(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(r.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else c<=25&&(o+=c);return{width:o,height:i,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ja(e),n=ho(e),r=e.ownerDocument.body,a=ga(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ga(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Oo(e);const s=-n.scrollTop;return"rtl"===po(r).direction&&(i+=ga(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Ja(e));else if(Xa(t))r=function(e,t){const n=So(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Za(e)?Eo(e):wa(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:r*o.y}}(t,n);else{const n=ko(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ba(r)}function To(e,t){const n=vo(e);return!(n===t||!Xa(n)||mo(n))&&("fixed"===po(n).position||To(n,t))}function _o(e,t,n){const r=Za(t),a=Ja(t),o="fixed"===n,i=So(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=wa(0);function c(){l.x=Oo(a)}if(r||!r&&!o)if(("body"!==Ka(t)||to(a))&&(s=ho(t)),r){const e=So(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();o&&!r&&a&&c();const u=!a||r||o?wa(0):Co(a,s);return{x:i.left+s.scrollLeft-l.x-u.x,y:i.top+s.scrollTop-l.y-u.y,width:i.width,height:i.height}}function Ao(e){return"static"===po(e).position}function Po(e,t){if(!Za(e)||"fixed"===po(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ja(e)===n&&(n=n.ownerDocument.body),n}function Do(e,t){const n=Ya(e);if(oo(e))return n;if(!Za(e)){let t=vo(e);for(;t&&!mo(t);){if(Xa(t)&&!Ao(t))return t;t=vo(t)}return n}let r=Po(e,t);for(;r&&ro(r)&&Ao(r);)r=Po(r,t);return r&&mo(r)&&Ao(r)&&!co(r)?n:r||function(e){let t=vo(e);for(;Za(t)&&!mo(t);){if(co(t))return t;if(oo(t))return null;t=vo(t)}return null}(e)||n}const Mo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o="fixed"===a,i=Ja(r),s=!!t&&oo(t.floating);if(r===i||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=wa(1);const u=wa(0),d=Za(r);if((d||!d&&!o)&&(("body"!==Ka(r)||to(i))&&(l=ho(r)),Za(r))){const e=So(r);c=Eo(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||d||o?wa(0):Co(i,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:Ja,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const o=[..."clippingAncestors"===n?oo(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=bo(e,[],!1).filter(e=>Xa(e)&&"body"!==Ka(e)),a=null;const o="fixed"===po(e).position;let i=o?vo(e):e;for(;Xa(i)&&!mo(i);){const t=po(i),n=co(i);n||"fixed"!==t.position||(a=null),(o?!n&&!a:!n&&"static"===t.position&&a&&Ro.has(a.position)||to(i)&&!n&&To(e,i))?r=r.filter(e=>e!==i):a=t,i=vo(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=o[0],s=o.reduce((e,n)=>{const r=jo(t,n,a);return e.top=ga(r.top,e.top),e.right=va(r.right,e.right),e.bottom=va(r.bottom,e.bottom),e.left=ga(r.left,e.left),e},jo(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Do,getElementRects:async function(e){const t=this.getOffsetParent||Do,n=this.getDimensions,r=await n(e.floating);return{reference:_o(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=wo(e);return{width:t,height:n}},getScale:Eo,isElement:Xa,isRTL:function(e){return"rtl"===po(e).direction}};function Lo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Io(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=xo(e),u=a||o?[...c?bo(c):[],...bo(t)]:[];u.forEach(e=>{a&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,r=null;const a=Ja(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=c;if(s||t(),!f||!m)return;const p={rootMargin:-ya(d)+"px "+-ya(a.clientWidth-(u+f))+"px "+-ya(a.clientHeight-(d+m))+"px "+-ya(u)+"px",threshold:ga(0,va(1,l))||1};let h=!0;function v(t){const r=t[0].intersectionRatio;if(r!==l){if(!h)return i();r?i(!1,r):n=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==r||Lo(c,e.getBoundingClientRect())||i(),h=!1}try{r=new IntersectionObserver(v,{...p,root:a.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),o}(c,n):null;let f,m=-1,p=null;i&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let h=l?So(e):null;return l&&function t(){const r=So(e);h&&!Lo(h,r)&&n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{a&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const Fo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:i,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:a}=e,o=await(null==r.isRTL?void 0:r.isRTL(a.floating)),i=Sa(n),s=Oa(n),l="y"===Ta(n),c=Va.has(i)?-1:1,u=o&&l?-1:1,d=ka(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}(t,e);return i===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},zo=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ka(e,t),c={x:n,y:r},u=await Ua(t,l),d=Ta(Sa(a)),f=Ca(d);let m=c[f],p=c[d];if(o){const e="y"===f?"bottom":"right";m=Na(m+u["y"===f?"top":"left"],m,m-u[e])}if(i){const e="y"===d?"bottom":"right";p=Na(p+u["y"===d?"top":"left"],p,p-u[e])}const h=s.fn({...t,[f]:m,[d]:p});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:o,[d]:i}}}}}},Bo=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...v}=ka(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const g=Sa(a),b=Ta(s),y=Sa(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(y||!h?[Fa(s)]:function(e){const t=Fa(e);return[Aa(e),t,Aa(t)]}(s)),E="none"!==p;!f&&E&&x.push(...Ia(s,h,p,w));const N=[s,...x],k=await Ua(t,v),S=[];let O=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&S.push(k[g]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Oa(e),a=_a(e),o=Ra(a);let i="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Fa(i)),[i,Fa(i)]}(a,i,w);S.push(k[e[0]],k[e[1]])}if(O=[...O,{placement:a,overflows:S}],!S.every(e=>e<=0)){var C,R;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=N[e];if(t){if(!("alignment"===d&&b!==Ta(t))||O.every(e=>Ta(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:O},reset:{placement:t}}}let n=null==(R=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:R.placement;if(!n)switch(m){case"bestFit":{var j;const e=null==(j=O.filter(e=>{if(E){const t=Ta(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=s}if(a!==n)return{reset:{placement:n}}}return{}}}},qo=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:l=()=>{},...c}=ka(e,t),u=await Ua(t,c),d=Sa(a),f=Oa(a),m="y"===Ta(a),{width:p,height:h}=o.floating;let v,g;"top"===d||"bottom"===d?(v=d,g=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,v="end"===f?"top":"bottom");const b=h-u.top-u.bottom,y=p-u.left-u.right,w=va(h-u[v],b),x=va(p-u[g],y),E=!t.middlewareData.shift;let N=w,k=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(k=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(N=b),E&&!f){const e=ga(u.left,0),t=ga(u.right,0),n=ga(u.top,0),r=ga(u.bottom,0);m?k=p-2*(0!==e||0!==t?e+t:ga(u.left,u.right)):N=h-2*(0!==n||0!==r?n+r:ga(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:N});const S=await i.getDimensions(s.floating);return p!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},Uo=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=ka(e,t);switch(r){case"referenceHidden":{const e=Ha(await Ua(t,{...a,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Wa(e)}}}case"escaped":{const e=Ha(await Ua(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Wa(e)}}}default:return{}}}}},Ho=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=ka(e,t)||{};if(null==c)return{};const d=za(u),f={x:n,y:r},m=_a(a),p=Ra(m),h=await i.getDimensions(c),v="y"===m,g=v?"top":"left",b=v?"bottom":"right",y=v?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[m]-f[m]-o.floating[p],x=f[m]-o.reference[m],E=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c));let N=E?E[y]:0;N&&await(null==i.isElement?void 0:i.isElement(E))||(N=s.floating[y]||o.floating[p]);const k=w/2-x/2,S=N/2-h[p]/2-1,O=va(d[g],S),C=va(d[b],S),R=O,j=N-h[p]-C,T=N/2-h[p]/2+k,_=Na(R,T,j),A=!l.arrow&&null!=Oa(a)&&T!==_&&o.reference[p]/2-(T<R?O:C)-h[p]/2<0,P=A?T<R?T-R:T-j:0;return{[m]:f[m]+P,data:{[m]:_,centerOffset:T-_-P,...A&&{alignmentOffset:P}},reset:A}}}),Wo=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=ka(e,t),u={x:n,y:r},d=Ta(a),f=Ca(d);let m=u[f],p=u[d];const h=ka(s,t),v="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+v.mainAxis,n=o.reference[f]+o.reference[e]-v.mainAxis;m<t?m=t:m>n&&(m=n)}if(c){var g,b;const e="y"===f?"width":"height",t=Va.has(Sa(a)),n=o.reference[d]-o.floating[e]+(t&&(null==(g=i.offset)?void 0:g[d])||0)+(t?0:v.crossAxis),r=o.reference[d]+o.reference[e]+(t?0:(null==(b=i.offset)?void 0:b[d])||0)-(t?v.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[f]:m,[d]:p}}}},Vo=(e,t,n)=>{const r=new Map,a={platform:Mo,...n},o={...a.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,s=o.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=qa(c,r,l),f=r,m={},p=0;for(let n=0;n<s.length;n++){const{name:o,fn:h}=s[n],{x:v,y:g,data:b,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:a,middlewareData:m,rects:c,platform:i,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=g?g:d,m={...m,[o]:{...m[o],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:u,y:d}=qa(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:a,middlewareData:m}})(e,t,{...a,platform:o})};var $o="undefined"!=typeof document?o:function(){};function Ko(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Ko(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!==r--;){const n=a[r];if(("_owner"!==n||!e.$$typeof)&&!Ko(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Yo(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jo(e,t){const n=Yo(e);return Math.round(t*n)/n}function Go(t){const n=e.useRef(t);return $o(()=>{n.current=t}),n}const Xo=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(a=n,{}.hasOwnProperty.call(a,"current"))?null!=n.current?Ho({element:n.current,padding:r}).fn(t):{}:n?Ho({element:n,padding:r}).fn(t):{};var a}}),Zo=(e,t)=>({...Fo(e),options:[e,t]}),Qo=(e,t)=>({...zo(e),options:[e,t]}),ei=(e,t)=>({...Wo(e),options:[e,t]}),ti=(e,t)=>({...Bo(e),options:[e,t]}),ni=(e,t)=>({...qo(e),options:[e,t]}),ri=(e,t)=>({...Uo(e),options:[e,t]}),ai=(e,t)=>({...Xo(e),options:[e,t]});var oi=e.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...o}=e;return l(en.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l("polygon",{points:"0,0 30,0 15,10"})})});oi.displayName="Arrow";var ii=oi;function si(t){const[n,r]=e.useState(void 0);return Wt(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=t.offsetWidth,o=t.offsetHeight;r({width:a,height:o})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)},[t]),n}var li="Popper",[ci,ui]=Ut(li),[di,fi]=ci(li),mi=t=>{const{__scopePopper:n,children:r}=t,[a,o]=e.useState(null);return l(di,{scope:n,anchor:a,onAnchorChange:o,children:r})};mi.displayName=li;var pi="PopperAnchor",hi=e.forwardRef((t,n)=>{const{__scopePopper:r,virtualRef:a,...o}=t,i=fi(pi,r),s=e.useRef(null),c=xt(n,s),u=e.useRef(null);return e.useEffect(()=>{const e=u.current;u.current=a?.current||s.current,e!==u.current&&i.onAnchorChange(u.current)}),a?null:l(en.div,{...o,ref:c})});hi.displayName=pi;var vi="PopperContent",[gi,bi]=ci(vi),yi=e.forwardRef((t,n)=>{const{__scopePopper:r,side:a="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:g,...b}=t,y=fi(vi,r),[w,x]=e.useState(null),E=xt(n,e=>x(e)),[N,k]=e.useState(null),S=si(N),O=S?.width??0,C=S?.height??0,R=a+("center"!==i?"-"+i:""),j="number"==typeof m?m:{top:0,right:0,bottom:0,left:0,...m},T=Array.isArray(f)?f:[f],_=T.length>0,A={padding:j,boundary:T.filter(Ni),altBoundary:_},{refs:P,floatingStyles:D,placement:M,isPositioned:L,middlewareData:I}=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[f,m]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=e.useState(a);Ko(p,a)||h(a);const[v,g]=e.useState(null),[b,y]=e.useState(null),w=e.useCallback(e=>{e!==k.current&&(k.current=e,g(e))},[]),x=e.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),E=i||v,N=s||b,k=e.useRef(null),S=e.useRef(null),O=e.useRef(f),C=null!=c,R=Go(c),j=Go(o),T=Go(u),_=e.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:n,strategy:r,middleware:p};j.current&&(e.platform=j.current),Vo(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};A.current&&!Ko(O.current,t)&&(O.current=t,d.flushSync(()=>{m(t)}))})},[p,n,r,j,T]);$o(()=>{!1===u&&O.current.isPositioned&&(O.current.isPositioned=!1,m(e=>({...e,isPositioned:!1})))},[u]);const A=e.useRef(!1);$o(()=>(A.current=!0,()=>{A.current=!1}),[]),$o(()=>{if(E&&(k.current=E),N&&(S.current=N),E&&N){if(R.current)return R.current(E,N,_);_()}},[E,N,_,R,C]);const P=e.useMemo(()=>({reference:k,floating:S,setReference:w,setFloating:x}),[w,x]),D=e.useMemo(()=>({reference:E,floating:N}),[E,N]),M=e.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=Jo(D.floating,f.x),n=Jo(D.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Yo(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,D.floating,f.x,f.y]);return e.useMemo(()=>({...f,update:_,refs:P,elements:D,floatingStyles:M}),[f,_,P,D,M])}({strategy:"fixed",placement:R,whileElementsMounted:(...e)=>Io(...e,{animationFrame:"always"===v}),elements:{reference:y.anchor},middleware:[Zo({mainAxis:o+C,alignmentAxis:s}),u&&Qo({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?ei():void 0,...A}),u&&ti({...A}),ni({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${n}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),N&&ai({element:N,padding:c}),ki({arrowWidth:O,arrowHeight:C}),h&&ri({strategy:"referenceHidden",...A})]}),[F,z]=Si(M),B=tn(g);Wt(()=>{L&&B?.()},[L,B]);const q=I.arrow?.x,U=I.arrow?.y,H=0!==I.arrow?.centerOffset,[W,V]=e.useState();return Wt(()=>{w&&V(window.getComputedStyle(w).zIndex)},[w]),l("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:L?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l(gi,{scope:r,placedSide:F,onArrowChange:k,arrowX:q,arrowY:U,shouldHideArrow:H,children:l(en.div,{"data-side":F,"data-align":z,...b,ref:E,style:{...b.style,animation:L?void 0:"none"}})})})});yi.displayName=vi;var wi="PopperArrow",xi={top:"bottom",right:"left",bottom:"top",left:"right"},Ei=e.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,a=bi(wi,n),o=xi[a.placedSide];return l("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:l(ii,{...r,ref:t,style:{...r.style,display:"block"}})})});function Ni(e){return null!==e}Ei.displayName=wi;var ki=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[l,c]=Si(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let m="",p="";return"bottom"===l?(m=o?u:`${d}px`,p=-s+"px"):"top"===l?(m=o?u:`${d}px`,p=`${r.floating.height+s}px`):"right"===l?(m=-s+"px",p=o?u:`${f}px`):"left"===l&&(m=`${r.floating.width+s}px`,p=o?u:`${f}px`),{data:{x:m,y:p}}}});function Si(e){const[t,n="center"]=e.split("-");return[t,n]}var Oi=mi,Ci=hi,Ri=yi,ji=Ei,Ti=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),_i=e.forwardRef((e,t)=>l(en.span,{...e,ref:t,style:{...Ti,...e.style}}));_i.displayName="VisuallyHidden";var Ai=_i,[Pi,Di]=Ut("Tooltip",[ui]),Mi=ui(),Li="TooltipProvider",Ii=700,Fi="tooltip.open",[zi,Bi]=Pi(Li),qi=t=>{const{__scopeTooltip:n,delayDuration:r=Ii,skipDelayDuration:a=300,disableHoverableContent:o=!1,children:i}=t,s=e.useRef(!0),c=e.useRef(!1),u=e.useRef(0);return e.useEffect(()=>{const e=u.current;return()=>window.clearTimeout(e)},[]),l(zi,{scope:n,isOpenDelayedRef:s,delayDuration:r,onOpen:e.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:e.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:e.useCallback(e=>{c.current=e},[]),disableHoverableContent:o,children:i})};qi.displayName=Li;var Ui="Tooltip",[Hi,Wi]=Pi(Ui),Vi=t=>{const{__scopeTooltip:n,children:r,open:a,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=t,u=Bi(Ui,t.__scopeTooltip),d=Mi(n),[f,m]=e.useState(null),p=Kt(),h=e.useRef(0),v=s??u.disableHoverableContent,g=c??u.delayDuration,b=e.useRef(!1),[y,w]=Jt({prop:a,defaultProp:o??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(Fi))):u.onClose(),i?.(e)},caller:Ui}),x=e.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),E=e.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b.current=!1,w(!0)},[w]),N=e.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),k=e.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{b.current=!0,w(!0),h.current=0},g)},[g,w]);return e.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),l(Oi,{...d,children:l(Hi,{scope:n,contentId:p,open:y,stateAttribute:x,trigger:f,onTriggerChange:m,onTriggerEnter:e.useCallback(()=>{u.isOpenDelayedRef.current?k():E()},[u.isOpenDelayedRef,k,E]),onTriggerLeave:e.useCallback(()=>{v?N():(window.clearTimeout(h.current),h.current=0)},[N,v]),onOpen:E,onClose:N,disableHoverableContent:v,children:r})})};Vi.displayName=Ui;var $i="TooltipTrigger",Ki=e.forwardRef((t,n)=>{const{__scopeTooltip:r,...a}=t,o=Wi($i,r),i=Bi($i,r),s=Mi(r),c=xt(n,e.useRef(null),o.onTriggerChange),u=e.useRef(!1),d=e.useRef(!1),f=e.useCallback(()=>u.current=!1,[]);return e.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l(Ci,{asChild:!0,...s,children:l(en.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...a,ref:c,onPointerMove:qt(t.onPointerMove,e=>{"touch"!==e.pointerType&&(d.current||i.isPointerInTransitRef.current||(o.onTriggerEnter(),d.current=!0))}),onPointerLeave:qt(t.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:qt(t.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:qt(t.onFocus,()=>{u.current||o.onOpen()}),onBlur:qt(t.onBlur,o.onClose),onClick:qt(t.onClick,o.onClose)})})});Ki.displayName=$i;var[Yi,Ji]=Pi("TooltipPortal",{forceMount:void 0}),Gi="TooltipContent",Xi=e.forwardRef((e,t)=>{const n=Ji(Gi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=e,i=Wi(Gi,e.__scopeTooltip);return l(En,{present:r||i.open,children:i.disableHoverableContent?l(ns,{side:a,...o,ref:t}):l(Zi,{side:a,...o,ref:t})})}),Zi=e.forwardRef((t,n)=>{const r=Wi(Gi,t.__scopeTooltip),a=Bi(Gi,t.__scopeTooltip),o=e.useRef(null),i=xt(n,o),[s,c]=e.useState(null),{trigger:u,onClose:d}=r,f=o.current,{onPointerInTransitChange:m}=a,p=e.useCallback(()=>{c(null),m(!1)},[m]),h=e.useCallback((e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},a=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(r,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(r,n.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const r=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const r=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x)))break;n.pop()}n.push(r)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...a,...function(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}(t.getBoundingClientRect())]);c(o),m(!0)},[m]);return e.useEffect(()=>()=>p(),[p]),e.useEffect(()=>{if(u&&f){const e=e=>h(e,f),t=e=>h(e,u);return u.addEventListener("pointerleave",e),f.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),f.removeEventListener("pointerleave",t)}}},[u,f,h,p]),e.useEffect(()=>{if(s){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||f?.contains(t),a=!function(e,t){const{x:n,y:r}=e;let a=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){const i=t[e],s=t[o],l=i.x,c=i.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(a=!a)}return a}(n,s);r?p():a&&(p(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[u,f,s,d,p]),l(ns,{...t,ref:i})}),[Qi,es]=Pi(Ui,{isInside:!1}),ts=function(e){const t=({children:e})=>l(c,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Zt,t}("TooltipContent"),ns=e.forwardRef((t,n)=>{const{__scopeTooltip:r,children:a,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=t,d=Wi(Gi,r),f=Mi(r),{onClose:m}=d;return e.useEffect(()=>(document.addEventListener(Fi,m),()=>document.removeEventListener(Fi,m)),[m]),e.useEffect(()=>{if(d.trigger){const e=e=>{const t=e.target;t?.contains(d.trigger)&&m()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[d.trigger,m]),l(ln,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:m,children:u(Ri,{"data-state":d.stateAttribute,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l(ts,{children:a}),l(Qi,{scope:r,isInside:!0,children:l(Ai,{id:d.contentId,role:"tooltip",children:o||a})})]})})});Xi.displayName=Gi;var rs="TooltipArrow";e.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Mi(n);return es(rs,n).isInside?null:l(ji,{...a,...r,ref:t})}).displayName=rs;var as=Xi,os=qi,is=Vi,ss=Ki,ls=e.forwardRef(function(t,n){var r=t.className,a=t.sideOffset,o=void 0===a?4:a,i=Ee(t,["className","sideOffset"]);return e.createElement(as,Object.assign({ref:n,sideOffset:o,className:gt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",r)},i))});ls.displayName=as.displayName;var cs=e.createContext(null);function us(){var t=e.useContext(cs);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function ds(t){var n=t.defaultOpen,r=void 0===n||n,a=t.open,o=t.onOpenChange,i=t.className,s=t.style,l=t.children,c=Ee(t,["defaultOpen","open","onOpenChange","className","style","children"]),u=function(){var t=F(e.useState(void 0),2),n=t[0],r=t[1];return e.useEffect(function(){var e=window.matchMedia("(max-width: ".concat(767,"px)")),t=function(){r(window.innerWidth<768)};return e.addEventListener("change",t),r(window.innerWidth<768),function(){return e.removeEventListener("change",t)}},[]),!!n}(),d=F(e.useState(!1),2),f=d[0],m=d[1],p=F(e.useState(r),2),h=p[0],v=p[1],g=null!=a?a:h,b=e.useCallback(function(e){var t="function"==typeof e?e(g):e;o?o(t):v(t),document.cookie="".concat("sidebar_state","=").concat(t,"; path=/; max-age=").concat(604800)},[o,g]),y=e.useCallback(function(){return u?m(function(e){return!e}):b(function(e){return!e})},[u,b,m]);e.useEffect(function(){var e=function(e){"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[y]);var w=g?"expanded":"collapsed",x=e.useMemo(function(){return{state:w,open:g,setOpen:b,isMobile:u,openMobile:f,setOpenMobile:m,toggleSidebar:y}},[w,g,b,u,f,m,y]);return e.createElement(cs.Provider,{value:x},e.createElement(os,{delayDuration:0},e.createElement("div",Object.assign({style:Object.assign({"--sidebar-width":"16rem","--sidebar-width-icon":"3rem"},s),className:gt("group/sidebar-wrapper flex min-h-svh w-full",i)},c),l)))}function fs(t){var n=t.side,r=void 0===n?"left":n,a=t.variant,o=void 0===a?"sidebar":a,i=t.collapsible,s=void 0===i?"offcanvas":i,l=t.className,c=t.children,u=Ee(t,["side","variant","collapsible","className","children"]),d=us(),f=d.isMobile,m=d.state,p=d.openMobile,h=d.setOpenMobile;return"none"===s?e.createElement("div",Object.assign({className:gt("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",l)},u),c):f?e.createElement(sa,Object.assign({open:p,onOpenChange:h},u),e.createElement(da,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:r},e.createElement(fa,{className:"sr-only"},e.createElement(ma,null,"Sidebar"),e.createElement(pa,null,"Displays the mobile sidebar.")),e.createElement("div",{className:"flex h-full w-full flex-col"},c))):e.createElement("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":"collapsed"===m?s:"","data-variant":o,"data-side":r},e.createElement("div",{className:gt("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","floating"===o||"inset"===o?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),e.createElement("div",Object.assign({className:gt("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===r?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===o||"inset"===o?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",l)},u),e.createElement("div",{className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"},c)))}function ms(t){var n=t.className,r=t.onClick,a=Ee(t,["className","onClick"]),o=us().toggleSidebar;return e.createElement(Dt,Object.assign({variant:"ghost",size:"icon",className:gt("h-7 w-7",n),onClick:function(e){null==r||r(e),o()}},a),e.createElement(de,null),e.createElement("span",{className:"sr-only"},"Toggle Sidebar"))}function ps(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("main",Object.assign({className:gt("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",n)},r))}function hs(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex flex-col gap-2 p-2",n)},r))}function vs(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex flex-col gap-2 p-2",n)},r))}function gs(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",n)},r))}function bs(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("relative flex w-full min-w-0 flex-col p-2",n)},r))}function ys(t){var n=t.className,r=t.asChild,a=void 0!==r&&r,o=Ee(t,["className","asChild"]),i=a?Ot:"div";return e.createElement(i,Object.assign({className:gt("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",n)},o))}function ws(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("w-full text-sm",n)},r))}function xs(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("ul",Object.assign({className:gt("flex w-full min-w-0 flex-col gap-1",n)},r))}function Es(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("li",Object.assign({className:gt("group/menu-item relative",n)},r))}var Ns=At("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function ks(t){var n=t.asChild,r=void 0!==n&&n,a=t.isActive,o=void 0!==a&&a,i=t.variant,s=void 0===i?"default":i,l=t.size,c=void 0===l?"default":l,u=t.tooltip,d=t.className,f=Ee(t,["asChild","isActive","variant","size","tooltip","className"]),m=r?Ot:"button",p=us(),h=p.isMobile,v=p.state,g=e.createElement(m,Object.assign({"data-size":c,"data-active":o,className:gt(Ns({variant:s,size:c}),d)},f));return u?("string"==typeof u&&(u={children:u}),e.createElement(is,null,e.createElement(ss,{asChild:!0},g),e.createElement(ls,Object.assign({side:"right",align:"center",hidden:"collapsed"!==v||h},u)))):g}var Ss=e.forwardRef((e,t)=>l(Lt.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Ss.displayName="Label";var Os=Ss,Cs=At("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Rs=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(Os,Object.assign({ref:n,className:gt(Cs(),r)},a))});Rs.displayName=Os.displayName;var js=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("rounded-lg border bg-card text-card-foreground shadow-sm",r)},a))});js.displayName="Card";var Ts=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("flex flex-col space-y-1.5 p-6",r)},a))});Ts.displayName="CardHeader";var _s=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("text-2xl font-semibold leading-none tracking-tight",r)},a))});_s.displayName="CardTitle";var As=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("text-sm text-muted-foreground",r)},a))});As.displayName="CardDescription";var Ps=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("p-6 pt-0",r)},a))});Ps.displayName="CardContent",e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:gt("flex items-center p-6 pt-0",r)},a))}).displayName="CardFooter";var Ds={items:[],config:Object.assign({},{top:24,duration:3,maxCount:5})},Ms=new Set;function Ls(){Ms.forEach(function(e){return e(Ds.items.slice())})}function Is(e){switch(e){case"success":return t.createElement(J,null);case"error":return t.createElement(ye,null);case"warning":return t.createElement(Y,null);case"loading":return t.createElement(se,{className:"animate-spin"});default:return t.createElement(ie,null)}}function Fs(e){var t,n,r;Us();var a=Date.now(),o=null!==(t=e.key)&&void 0!==t?t:"msg_".concat(a,"_").concat(Math.random().toString(36).slice(2)),i=Ds.items.findIndex(function(e){return e.key===o}),s={key:o,content:e.content,duration:null!==(n=e.duration)&&void 0!==n?n:Ds.config.duration,type:e.type,onClose:e.onClose,icon:null!==(r=e.icon)&&void 0!==r?r:Is(e.type),className:e.className,createdAt:a};return i>=0?Ds.items[i]=Object.assign({},Ds.items[i],s):(Ds.items.length>=Ds.config.maxCount&&Ds.items.shift(),Ds.items.push(s)),Ls(),s.duration>0&&"loading"!==s.type&&window.setTimeout(function(){zs(o)},1e3*s.duration),{close:function(){return zs(o)}}}function zs(e){var t;if(void 0===e)return Ds.items.forEach(function(e){var t;return null===(t=e.onClose)||void 0===t?void 0:t.call(e)}),Ds.items=[],void Ls();var n=Ds.items.findIndex(function(t){return t.key===e});if(n>=0){var r=F(Ds.items.splice(n,1),1)[0];null===(t=null==r?void 0:r.onClose)||void 0===t||t.call(r),Ls()}}var Bs=null,qs=null;function Us(){"undefined"!=typeof window&&(qs||((qs=document.createElement("div")).setAttribute("data-custom-message-holder",""),document.body.appendChild(qs)),Bs||(Bs=m(qs)).render(t.createElement(Hs,null)))}function Hs(){var e=function(){var e=F(a(Ds.items),2),t=e[0],n=e[1];return s(function(){var e=n;return Ms.add(e),function(){Ms.delete(e)}},[]),t}(),n=Ds.config.top;return t.createElement("div",{className:"fixed left-1/2 -translate-x-1/2 z-[1000] w-80 pointer-events-none",style:{top:n}},t.createElement("div",{className:"mx-auto flex w-full max-w-xl flex-col items-center gap-2 px-4"},e.map(function(e){var n,r,a=function(e){switch(e){case"success":return{container:"border-green-200 bg-green-50/90 text-green-800 border-l-4 border-l-green-500",icon:"text-green-500",text:"text-green-800"};case"error":return{container:"border-red-200 bg-red-50/90 text-red-800 border-l-4 border-l-red-500",icon:"text-red-500",text:"text-red-800"};case"warning":return{container:"border-yellow-200 bg-yellow-50/90 text-yellow-800 border-l-4 border-l-yellow-500",icon:"text-yellow-500",text:"text-yellow-800"};default:return{container:"border-blue-200 bg-blue-50/90 text-blue-800 border-l-4 border-l-blue-500",icon:"text-blue-500",text:"text-blue-800"}}}(e.type);return t.createElement("div",{key:e.key,className:"pointer-events-auto flex w-full items-center gap-2 rounded-md border px-3 py-2 backdrop-blur ".concat(a.container," ").concat(null!==(n=e.className)&&void 0!==n?n:"")},t.createElement("span",{className:"text-[18px] leading-none ".concat(a.icon)},null!==(r=e.icon)&&void 0!==r?r:Is(e.type)),t.createElement("div",{className:"min-w-0 flex-1 text-[14px] leading-normal ".concat(a.text)},"string"==typeof e.content?t.createElement("span",{className:"break-words align-middle"},e.content):e.content))})))}function Ws(e,n,r,a){if(t.isValidElement(n)||"string"==typeof n||"number"==typeof n)return{type:e,content:n,duration:r,onClose:a};var o=n;return Object.assign({},o,{type:e})}var Vs,$s,Ks=($s={open:function(e){var t;return Fs(Object.assign({},e,{type:null!==(t=e.type)&&void 0!==t?t:"info"}))},info:function(e,t,n){return Fs(Ws("info",e,t,n))},success:function(e,t,n){return Fs(Ws("success",e,t,n))},error:function(e,t,n){return Fs(Ws("error",e,t,n))},warning:function(e,t,n){return Fs(Ws("warning",e,t,n))},loading:function(e,t,n){return Fs(Ws("loading",e,null!=t?t:0,n))},destroy:function(e){return zs(e)},config:function(e){return t=e,Ds.config=Object.assign({},Ds.config,t),void Ls();var t},useMessage:function(){var e=i(function(){return"undefined"!=typeof window&&Us(),t.createElement(t.Fragment,null)},[]);return[Vs.current,e]}},(Vs={}).current=$s,$s);function Ys(e,t){return function(){return e.apply(t,arguments)}}var Js,Gs=Object.prototype.toString,Xs=Object.getPrototypeOf,Zs=Symbol.iterator,Qs=Symbol.toStringTag,el=(Js=Object.create(null),function(e){var t=Gs.call(e);return Js[t]||(Js[t]=t.slice(8,-1).toLowerCase())}),tl=function(e){return e=e.toLowerCase(),function(t){return el(t)===e}},nl=function(e){return function(t){return q(t)===e}},rl=Array.isArray,al=nl("undefined");function ol(e){return null!==e&&!al(e)&&null!==e.constructor&&!al(e.constructor)&&ll(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var il=tl("ArrayBuffer");var sl=nl("string"),ll=nl("function"),cl=nl("number"),ul=function(e){return null!==e&&"object"===q(e)},dl=function(e){if("object"!==el(e))return!1;var t=Xs(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Qs in e||Zs in e)},fl=tl("Date"),ml=tl("File"),pl=tl("Blob"),hl=tl("FileList"),vl=tl("URLSearchParams"),gl=F(["ReadableStream","Request","Response","Headers"].map(tl),4),bl=gl[0],yl=gl[1],wl=gl[2],xl=gl[3];function El(e,t){var n,r,a=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,o=void 0!==a&&a;if(null!=e)if("object"!==q(e)&&(e=[e]),rl(e))for(n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else{if(ol(e))return;var i,s=o?Object.getOwnPropertyNames(e):Object.keys(e),l=s.length;for(n=0;n<l;n++)i=s[n],t.call(null,e[i],i,e)}}function Nl(e,t){if(ol(e))return null;t=t.toLowerCase();for(var n,r=Object.keys(e),a=r.length;a-- >0;)if(t===(n=r[a]).toLowerCase())return n;return null}var kl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Sl=function(e){return!al(e)&&e!==kl};var Ol,Cl=(Ol="undefined"!=typeof Uint8Array&&Xs(Uint8Array),function(e){return Ol&&e instanceof Ol}),Rl=tl("HTMLFormElement"),jl=function(){var e=Object.prototype.hasOwnProperty;return function(t,n){return e.call(t,n)}}(),Tl=tl("RegExp"),_l=function(e,t){var n=Object.getOwnPropertyDescriptors(e),r={};El(n,function(n,a){var o;!1!==(o=t(n,a,e))&&(r[a]=o||n)}),Object.defineProperties(e,r)};var Al,Pl,Dl,Ml,Ll=tl("AsyncFunction"),Il=(Al="function"==typeof setImmediate,Pl=ll(kl.postMessage),Al?setImmediate:Pl?(Dl="axios@".concat(Math.random()),Ml=[],kl.addEventListener("message",function(e){var t=e.source,n=e.data;t===kl&&n===Dl&&Ml.length&&Ml.shift()()},!1),function(e){Ml.push(e),kl.postMessage(Dl,"*")}):function(e){return setTimeout(e)}),Fl="undefined"!=typeof queueMicrotask?queueMicrotask.bind(kl):"undefined"!=typeof process&&process.nextTick||Il,zl={isArray:rl,isArrayBuffer:il,isBuffer:ol,isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||ll(e.append)&&("formdata"===(t=el(e))||"object"===t&&ll(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&il(e.buffer)},isString:sl,isNumber:cl,isBoolean:function(e){return!0===e||!1===e},isObject:ul,isPlainObject:dl,isEmptyObject:function(e){if(!ul(e)||ol(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:bl,isRequest:yl,isResponse:wl,isHeaders:xl,isUndefined:al,isDate:fl,isFile:ml,isBlob:pl,isRegExp:Tl,isFunction:ll,isStream:function(e){return ul(e)&&ll(e.pipe)},isURLSearchParams:vl,isTypedArray:Cl,isFileList:hl,forEach:El,merge:function e(){for(var t=Sl(this)&&this||{},n=t.caseless,r=t.skipUndefined,a={},o=function(t,o){var i=n&&Nl(a,o)||o;dl(a[i])&&dl(t)?a[i]=e(a[i],t):dl(t)?a[i]=e({},t):rl(t)?a[i]=t.slice():r&&al(t)||(a[i]=t)},i=0,s=arguments.length;i<s;i++)arguments[i]&&El(arguments[i],o);return a},extend:function(e,t,n){return El(t,function(t,r){n&&ll(t)?e[r]=Ys(t,n):e[r]=t},{allOwnKeys:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var a,o,i,s={};if(t=t||{},null==e)return t;do{for(o=(a=Object.getOwnPropertyNames(e)).length;o-- >0;)i=a[o],r&&!r(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==n&&Xs(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:el,kindOfTest:tl,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(rl(e))return e;var t=e.length;if(!cl(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},forEachEntry:function(e,t){for(var n,r=(e&&e[Zs]).call(e);(n=r.next())&&!n.done;){var a=n.value;t.call(e,a[0],a[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Rl,hasOwnProperty:jl,hasOwnProp:jl,reduceDescriptors:_l,freezeMethods:function(e){_l(e,function(t,n){if(ll(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;var r=e[n];ll(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:function(e,t){var n={},r=function(e){e.forEach(function(e){n[e]=!0})};return rl(e)?r(e):r(String(e).split(t)),n},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:Nl,global:kl,isContextDefined:Sl,isSpecCompliantForm:function(e){return!!(e&&ll(e.append)&&"FormData"===e[Qs]&&e[Zs])},toJSONObject:function(e){var t=new Array(10),n=function(e,r){if(ul(e)){if(t.indexOf(e)>=0)return;if(ol(e))return e;if(!("toJSON"in e)){t[r]=e;var a=rl(e)?[]:{};return El(e,function(e,t){var o=n(e,r+1);!al(o)&&(a[t]=o)}),t[r]=void 0,a}}return e};return n(e,0)},isAsyncFn:Ll,isThenable:function(e){return e&&(ul(e)||ll(e))&&ll(e.then)&&ll(e.catch)},setImmediate:Il,asap:Fl,isIterable:function(e){return null!=e&&ll(e[Zs])}};function Bl(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}zl.inherits(Bl,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:zl.toJSONObject(this.config),code:this.code,status:this.status}}});var ql=Bl.prototype,Ul={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(e){Ul[e]={value:e}}),Object.defineProperties(Bl,Ul),Object.defineProperty(ql,"isAxiosError",{value:!0}),Bl.from=function(e,t,n,r,a,o){var i=Object.create(ql);zl.toFlatObject(e,i,function(e){return e!==Error.prototype},function(e){return"isAxiosError"!==e});var s=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Bl.call(i,s,l,n,r,a),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function Hl(e){return zl.isPlainObject(e)||zl.isArray(e)}function Wl(e){return zl.endsWith(e,"[]")?e.slice(0,-2):e}function Vl(e,t,n){return e?e.concat(t).map(function(e,t){return e=Wl(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}var $l=zl.toFlatObject(zl,{},null,function(e){return/^is[A-Z]/.test(e)});function Kl(e,t,n){if(!zl.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var r=(n=zl.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!zl.isUndefined(t[e])})).metaTokens,a=n.visitor||c,o=n.dots,i=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&zl.isSpecCompliantForm(t);if(!zl.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(zl.isDate(e))return e.toISOString();if(zl.isBoolean(e))return e.toString();if(!s&&zl.isBlob(e))throw new Bl("Blob is not supported. Use a Buffer instead.");return zl.isArrayBuffer(e)||zl.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,a){var s=e;if(e&&!a&&"object"===q(e))if(zl.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(zl.isArray(e)&&function(e){return zl.isArray(e)&&!e.some(Hl)}(e)||(zl.isFileList(e)||zl.endsWith(n,"[]"))&&(s=zl.toArray(e)))return n=Wl(n),s.forEach(function(e,r){!zl.isUndefined(e)&&null!==e&&t.append(!0===i?Vl([n],r,o):null===i?n:n+"[]",l(e))}),!1;return!!Hl(e)||(t.append(Vl(a,n,o),l(e)),!1)}var u=[],d=Object.assign($l,{defaultVisitor:c,convertValue:l,isVisitable:Hl});if(!zl.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!zl.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),zl.forEach(n,function(n,o){!0===(!(zl.isUndefined(n)||null===n)&&a.call(t,n,zl.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Yl(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Jl(e,t){this._pairs=[],e&&Kl(e,this,t)}var Gl=Jl.prototype;function Xl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Zl(e,t,n){if(!t)return e;var r=n&&n.encode||Xl;zl.isFunction(n)&&(n={serialize:n});var a,o=n&&n.serialize;if(a=o?o(t,n):zl.isURLSearchParams(t)?t.toString():new Jl(t,n).toString(r)){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Gl.append=function(e,t){this._pairs.push([e,t])},Gl.toString=function(e){var t=e?function(t){return e.call(this,t,Yl)}:Yl;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Ql=function(){return T(function e(){R(this,e),this.handlers=[]},[{key:"use",value:function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){zl.forEach(this.handlers,function(t){null!==t&&e(t)})}}])}(),ec=Ql,tc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nc={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Jl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},rc="undefined"!=typeof window&&"undefined"!=typeof document,ac="object"===("undefined"==typeof navigator?"undefined":q(navigator))&&navigator||void 0,oc=rc&&(!ac||["ReactNative","NativeScript","NS"].indexOf(ac.product)<0),ic="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,sc=rc&&window.location.href||"http://localhost",lc=D(D({},Object.freeze({__proto__:null,hasBrowserEnv:rc,hasStandardBrowserEnv:oc,hasStandardBrowserWebWorkerEnv:ic,navigator:ac,origin:sc})),nc);function cc(e){function t(e,n,r,a){var o=e[a++];if("__proto__"===o)return!0;var i=Number.isFinite(+o),s=a>=e.length;return o=!o&&zl.isArray(r)?r.length:o,s?(zl.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i):(r[o]&&zl.isObject(r[o])||(r[o]=[]),t(e,n,r[o],a)&&zl.isArray(r[o])&&(r[o]=function(e){var t,n,r={},a=Object.keys(e),o=a.length;for(t=0;t<o;t++)r[n=a[t]]=e[n];return r}(r[o])),!i)}if(zl.isFormData(e)&&zl.isFunction(e.entries)){var n={};return zl.forEachEntry(e,function(e,r){t(function(e){return zl.matchAll(/\w+|\[(\w*)]/g,e).map(function(e){return"[]"===e[0]?"":e[1]||e[0]})}(e),r,n,0)}),n}return null}var uc={transitional:tc,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){var n,r=t.getContentType()||"",a=r.indexOf("application/json")>-1,o=zl.isObject(e);if(o&&zl.isHTMLForm(e)&&(e=new FormData(e)),zl.isFormData(e))return a?JSON.stringify(cc(e)):e;if(zl.isArrayBuffer(e)||zl.isBuffer(e)||zl.isStream(e)||zl.isFile(e)||zl.isBlob(e)||zl.isReadableStream(e))return e;if(zl.isArrayBufferView(e))return e.buffer;if(zl.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Kl(e,new lc.classes.URLSearchParams,D({visitor:function(e,t,n,r){return lc.isNode&&zl.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=zl.isFileList(e))||r.indexOf("multipart/form-data")>-1){var i=this.env&&this.env.FormData;return Kl(n?{"files[]":e}:e,i&&new i,this.formSerializer)}}return o||a?(t.setContentType("application/json",!1),function(e,t,n){if(zl.isString(e))try{return(t||JSON.parse)(e),zl.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||uc.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(zl.isResponse(e)||zl.isReadableStream(e))return e;if(e&&zl.isString(e)&&(n&&!this.responseType||r)){var a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(a){if("SyntaxError"===e.name)throw Bl.from(e,Bl.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lc.classes.FormData,Blob:lc.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};zl.forEach(["delete","get","head","post","put","patch"],function(e){uc.headers[e]={}});var dc=uc,fc=zl.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mc=Symbol("internals");function pc(e){return e&&String(e).trim().toLowerCase()}function hc(e){return!1===e||null==e?e:zl.isArray(e)?e.map(hc):String(e)}function vc(e,t,n,r,a){return zl.isFunction(r)?r.call(this,t,n):(a&&(t=n),zl.isString(t)?zl.isString(r)?-1!==t.indexOf(r):zl.isRegExp(r)?r.test(t):void 0:void 0)}var gc=function(){return T(function e(t){R(this,e),t&&this.set(t)},[{key:"set",value:function(e,t,n){var r=this;function a(e,t,n){var a=pc(t);if(!a)throw new Error("header name must be a non-empty string");var o=zl.findKey(r,a);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=hc(e))}var o=function(e,t){return zl.forEach(e,function(e,n){return a(e,n,t)})};if(zl.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(zl.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o(function(e){var t,n,r,a={};return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),t=e.substring(0,r).trim().toLowerCase(),n=e.substring(r+1).trim(),!t||a[t]&&fc[t]||("set-cookie"===t?a[t]?a[t].push(n):a[t]=[n]:a[t]=a[t]?a[t]+", "+n:n)}),a}(e),t);else if(zl.isObject(e)&&zl.isIterable(e)){var i,s,l,c={},u=_(e);try{for(u.s();!(l=u.n()).done;){var d=l.value;if(!zl.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[s=d[0]]=(i=c[s])?zl.isArray(i)?[].concat(z(i),[d[1]]):[i,d[1]]:d[1]}}catch(e){u.e(e)}finally{u.f()}o(c,t)}else null!=e&&a(t,e,n);return this}},{key:"get",value:function(e,t){if(e=pc(e)){var n=zl.findKey(this,e);if(n){var r=this[n];if(!t)return r;if(!0===t)return function(e){for(var t,n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=r.exec(e);)n[t[1]]=t[2];return n}(r);if(zl.isFunction(t))return t.call(this,r,n);if(zl.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=pc(e)){var n=zl.findKey(this,e);return!(!n||void 0===this[n]||t&&!vc(0,this[n],n,t))}return!1}},{key:"delete",value:function(e,t){var n=this,r=!1;function a(e){if(e=pc(e)){var a=zl.findKey(n,e);!a||t&&!vc(0,n[a],a,t)||(delete n[a],r=!0)}}return zl.isArray(e)?e.forEach(a):a(e),r}},{key:"clear",value:function(e){for(var t=Object.keys(this),n=t.length,r=!1;n--;){var a=t[n];e&&!vc(0,this[a],a,e,!0)||(delete this[a],r=!0)}return r}},{key:"normalize",value:function(e){var t=this,n={};return zl.forEach(this,function(r,a){var o=zl.findKey(n,a);if(o)return t[o]=hc(r),void delete t[a];var i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})}(a):String(a).trim();i!==a&&delete t[a],t[i]=hc(r),n[i]=!0}),this}},{key:"concat",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=this.constructor).concat.apply(e,[this].concat(n))}},{key:"toJSON",value:function(e){var t=Object.create(null);return zl.forEach(this,function(n,r){null!=n&&!1!==n&&(t[r]=e&&zl.isArray(n)?n.join(", "):n)}),t}},{key:Symbol.iterator,value:function(){return Object.entries(this.toJSON())[Symbol.iterator]()}},{key:"toString",value:function(){return Object.entries(this.toJSON()).map(function(e){var t=F(e,2);return t[0]+": "+t[1]}).join("\n")}},{key:"getSetCookie",value:function(){return this.get("set-cookie")||[]}},{key:Symbol.toStringTag,get:function(){return"AxiosHeaders"}}],[{key:"from",value:function(e){return e instanceof this?e:new this(e)}},{key:"concat",value:function(e){for(var t=new this(e),n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.forEach(function(e){return t.set(e)}),t}},{key:"accessor",value:function(e){var t=(this[mc]=this[mc]={accessors:{}}).accessors,n=this.prototype;function r(e){var r=pc(e);t[r]||(!function(e,t){var n=zl.toCamelCase(" "+t);["get","set","has"].forEach(function(r){Object.defineProperty(e,r+n,{value:function(e,n,a){return this[r].call(this,t,e,n,a)},configurable:!0})})}(n,e),t[r]=!0)}return zl.isArray(e)?e.forEach(r):r(e),this}}])}();gc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),zl.reduceDescriptors(gc.prototype,function(e,t){var n=e.value,r=t[0].toUpperCase()+t.slice(1);return{get:function(){return n},set:function(e){this[r]=e}}}),zl.freezeMethods(gc);var bc=gc;function yc(e,t){var n=this||dc,r=t||n,a=bc.from(r.headers),o=r.data;return zl.forEach(e,function(e){o=e.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function wc(e){return!(!e||!e.__CANCEL__)}function xc(e,t,n){Bl.call(this,null==e?"canceled":e,Bl.ERR_CANCELED,t,n),this.name="CanceledError"}function Ec(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Bl("Request failed with status code "+n.status,[Bl.ERR_BAD_REQUEST,Bl.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}zl.inherits(xc,Bl,{__CANCEL__:!0});var Nc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=0,a=function(e,t){e=e||10;var n,r=new Array(e),a=new Array(e),o=0,i=0;return t=void 0!==t?t:1e3,function(s){var l=Date.now(),c=a[i];n||(n=l),r[o]=s,a[o]=l;for(var u=i,d=0;u!==o;)d+=r[u++],u%=e;if((o=(o+1)%e)===i&&(i=(i+1)%e),!(l-n<t)){var f=c&&l-c;return f?Math.round(1e3*d/f):void 0}}}(50,250);return function(e,t){var n,r,a=0,o=1e3/t,i=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();a=o,n=null,r&&(clearTimeout(r),r=null),e.apply(void 0,z(t))};return[function(){for(var e=Date.now(),t=e-a,s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];t>=o?i(l,e):(n=l,r||(r=setTimeout(function(){r=null,i(n)},o-t)))},function(){return n&&i(n)}]}(function(n){var o=n.loaded,i=n.lengthComputable?n.total:void 0,s=o-r,l=a(s);r=o;var c=A({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:l||void 0,estimated:l&&i&&o<=i?(i-o)/l:void 0,event:n,lengthComputable:null!=i},t?"download":"upload",!0);e(c)},n)},kc=function(e,t){var n=null!=e;return[function(r){return t[0]({lengthComputable:n,total:e,loaded:r})},t[1]]},Sc=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return zl.asap(function(){return e.apply(void 0,n)})}},Oc=lc.hasStandardBrowserEnv?function(e,t){return function(n){return n=new URL(n,lc.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)}}(new URL(lc.origin),lc.navigator&&/(msie|trident)/i.test(lc.navigator.userAgent)):function(){return!0},Cc=lc.hasStandardBrowserEnv?{write:function(e,t,n,r,a,o,i){if("undefined"!=typeof document){var s=["".concat(e,"=").concat(encodeURIComponent(t))];zl.isNumber(n)&&s.push("expires=".concat(new Date(n).toUTCString())),zl.isString(r)&&s.push("path=".concat(r)),zl.isString(a)&&s.push("domain=".concat(a)),!0===o&&s.push("secure"),zl.isString(i)&&s.push("SameSite=".concat(i)),document.cookie=s.join("; ")}},read:function(e){if("undefined"==typeof document)return null;var t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove:function(e){this.write(e,"",Date.now()-864e5,"/")}}:{write:function(){},read:function(){return null},remove:function(){}};function Rc(e,t,n){var r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var jc=function(e){return e instanceof bc?D({},e):e};function Tc(e,t){t=t||{};var n={};function r(e,t,n,r){return zl.isPlainObject(e)&&zl.isPlainObject(t)?zl.merge.call({caseless:r},e,t):zl.isPlainObject(t)?zl.merge({},t):zl.isArray(t)?t.slice():t}function a(e,t,n,a){return zl.isUndefined(t)?zl.isUndefined(e)?void 0:r(void 0,e,0,a):r(e,t,0,a)}function o(e,t){if(!zl.isUndefined(t))return r(void 0,t)}function i(e,t){return zl.isUndefined(t)?zl.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,a,o){return o in t?r(n,a):o in e?r(void 0,n):void 0}var l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:function(e,t,n){return a(jc(e),jc(t),0,!0)}};return zl.forEach(Object.keys(D(D({},e),t)),function(r){var o=l[r]||a,i=o(e[r],t[r],r);zl.isUndefined(i)&&o!==s||(n[r]=i)}),n}var _c,Ac=function(e){var t=Tc({},e),n=t.data,r=t.withXSRFToken,a=t.xsrfHeaderName,o=t.xsrfCookieName,i=t.headers,s=t.auth;if(t.headers=i=bc.from(i),t.url=Zl(Rc(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),zl.isFormData(n))if(lc.hasStandardBrowserEnv||lc.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(zl.isFunction(n.getHeaders)){var l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(function(e){var t=F(e,2),n=t[0],r=t[1];c.includes(n.toLowerCase())&&i.set(n,r)})}if(lc.hasStandardBrowserEnv&&(r&&zl.isFunction(r)&&(r=r(t)),r||!1!==r&&Oc(t.url))){var u=a&&o&&Cc.read(o);u&&i.set(a,u)}return t},Pc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){var r,a,o,i,s,l=Ac(e),c=l.data,u=bc.from(l.headers).normalize(),d=l.responseType,f=l.onUploadProgress,m=l.onDownloadProgress;function p(){i&&i(),s&&s(),l.cancelToken&&l.cancelToken.unsubscribe(r),l.signal&&l.signal.removeEventListener("abort",r)}var h=new XMLHttpRequest;function v(){if(h){var r=bc.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Ec(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}}if(h.open(l.method.toUpperCase(),l.url,!0),h.timeout=l.timeout,"onloadend"in h?h.onloadend=v:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(v)},h.onabort=function(){h&&(n(new Bl("Request aborted",Bl.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){var r=new Bl(t&&t.message?t.message:"Network Error",Bl.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){var t=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",r=l.transitional||tc;l.timeoutErrorMessage&&(t=l.timeoutErrorMessage),n(new Bl(t,r.clarifyTimeoutError?Bl.ETIMEDOUT:Bl.ECONNABORTED,e,h)),h=null},void 0===c&&u.setContentType(null),"setRequestHeader"in h&&zl.forEach(u.toJSON(),function(e,t){h.setRequestHeader(t,e)}),zl.isUndefined(l.withCredentials)||(h.withCredentials=!!l.withCredentials),d&&"json"!==d&&(h.responseType=l.responseType),m){var g=F(Nc(m,!0),2);o=g[0],s=g[1],h.addEventListener("progress",o)}if(f&&h.upload){var b=F(Nc(f),2);a=b[0],i=b[1],h.upload.addEventListener("progress",a),h.upload.addEventListener("loadend",i)}(l.cancelToken||l.signal)&&(r=function(t){h&&(n(!t||t.type?new xc(null,e,h):t),h.abort(),h=null)},l.cancelToken&&l.cancelToken.subscribe(r),l.signal&&(l.signal.aborted?r():l.signal.addEventListener("abort",r)));var y,w,x=(y=l.url,(w=/^([-+\w]{1,25})(:?\/\/|:)/.exec(y))&&w[1]||"");x&&-1===lc.protocols.indexOf(x)?n(new Bl("Unsupported protocol "+x+":",Bl.ERR_BAD_REQUEST,e)):h.send(c||null)})},Dc=function(e,t){var n=(e=e?e.filter(Boolean):[]).length;if(t||n){var r,a=new AbortController,o=function(e){if(!r){r=!0,s();var t=e instanceof Error?e:this.reason;a.abort(t instanceof Bl?t:new xc(t instanceof Error?t.message:t))}},i=t&&setTimeout(function(){i=null,o(new Bl("timeout ".concat(t," of ms exceeded"),Bl.ETIMEDOUT))},t),s=function(){e&&(i&&clearTimeout(i),i=null,e.forEach(function(e){e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(function(e){return e.addEventListener("abort",o)});var l=a.signal;return l.unsubscribe=function(){return zl.asap(s)},l}},Mc=M().m(function e(t,n){var r,a,o;return M().w(function(e){for(;;)switch(e.n){case 0:if(r=t.byteLength,n&&!(r<n)){e.n=2;break}return e.n=1,t;case 1:return e.a(2);case 2:a=0;case 3:if(!(a<r)){e.n=5;break}return o=a+n,e.n=4,t.slice(a,o);case 4:a=o,e.n=3;break;case 5:return e.a(2)}},e)}),Lc=function(){var e=H(M().m(function e(t,n){var r,a,o,i,s,l,c;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:r=!1,a=!1,e.p=1,i=N(Ic(t));case 2:return e.n=3,C(i.next());case 3:if(!(r=!(s=e.v).done)){e.n=5;break}return l=s.value,e.d(I(E(N(Mc(l,n)))),4);case 4:r=!1,e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,c=e.v,a=!0,o=c;case 7:if(e.p=7,e.p=8,!r||null==i.return){e.n=9;break}return e.n=9,C(i.return());case 9:if(e.p=9,!a){e.n=10;break}throw o;case 10:return e.f(9);case 11:return e.f(7);case 12:return e.a(2)}},e,null,[[8,,9,11],[1,6,7,12]])}));return function(t,n){return e.apply(this,arguments)}}(),Ic=function(){var e=H(M().m(function e(t){var n,r,a,o;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t[Symbol.asyncIterator]){e.n=2;break}return e.d(I(E(N(t))),1);case 1:return e.a(2);case 2:n=t.getReader(),e.p=3;case 4:return e.n=5,C(n.read());case 5:if(r=e.v,a=r.done,o=r.value,!a){e.n=6;break}return e.a(3,8);case 6:return e.n=7,o;case 7:e.n=4;break;case 8:return e.p=8,e.n=9,C(n.cancel());case 9:return e.f(8);case 10:return e.a(2)}},e,null,[[3,,8,10]])}));return function(t){return e.apply(this,arguments)}}(),Fc=function(e,t,n,r){var a,o=Lc(e,t),i=0,s=function(e){a||(a=!0,r&&r(e))};return new ReadableStream({pull:function(e){return O(M().m(function t(){var r,a,l,c,u,d;return M().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,o.next();case 1:if(r=t.v,a=r.done,l=r.value,!a){t.n=2;break}return s(),e.close(),t.a(2);case 2:c=l.byteLength,n&&(u=i+=c,n(u)),e.enqueue(new Uint8Array(l)),t.n=4;break;case 3:throw t.p=3,d=t.v,s(d),d;case 4:return t.a(2)}},t,null,[[0,3]])}))()},cancel:function(e){return s(e),o.return()}},{highWaterMark:2})},zc=zl.isFunction,Bc={Request:(_c=zl.global).Request,Response:_c.Response},qc=zl.global,Uc=qc.ReadableStream,Hc=qc.TextEncoder,Wc=function(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return!!e.apply(void 0,n)}catch(e){return!1}},Vc=function(e){var t=e=zl.merge.call({skipUndefined:!0},Bc,e),n=t.fetch,r=t.Request,a=t.Response,o=n?zc(n):"function"==typeof fetch,i=zc(r),s=zc(a);if(!o)return!1;var l,c=o&&zc(Uc),u=o&&("function"==typeof Hc?(l=new Hc,function(e){return l.encode(e)}):function(){var e=O(M().m(function e(t){var n,a;return M().w(function(e){for(;;)switch(e.n){case 0:return n=Uint8Array,e.n=1,new r(t).arrayBuffer();case 1:return a=e.v,e.a(2,new n(a))}},e)}));return function(t){return e.apply(this,arguments)}}()),d=i&&c&&Wc(function(){var e=!1,t=new r(lc.origin,{body:new Uc,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),f=s&&c&&Wc(function(){return zl.isReadableStream(new a("").body)}),m={stream:f&&function(e){return e.body}};o&&["text","arrayBuffer","blob","formData","stream"].forEach(function(e){!m[e]&&(m[e]=function(t,n){var r=t&&t[e];if(r)return r.call(t);throw new Bl("Response type '".concat(e,"' is not supported"),Bl.ERR_NOT_SUPPORT,n)})});var p=function(){var e=O(M().m(function e(t){var n;return M().w(function(e){for(;;)switch(e.n){case 0:if(null!=t){e.n=1;break}return e.a(2,0);case 1:if(!zl.isBlob(t)){e.n=2;break}return e.a(2,t.size);case 2:if(!zl.isSpecCompliantForm(t)){e.n=4;break}return n=new r(lc.origin,{method:"POST",body:t}),e.n=3,n.arrayBuffer();case 3:case 6:return e.a(2,e.v.byteLength);case 4:if(!zl.isArrayBufferView(t)&&!zl.isArrayBuffer(t)){e.n=5;break}return e.a(2,t.byteLength);case 5:if(zl.isURLSearchParams(t)&&(t+=""),!zl.isString(t)){e.n=7;break}return e.n=6,u(t);case 7:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=O(M().m(function e(t,n){var r;return M().w(function(e){for(;;)if(0===e.n)return r=zl.toFiniteNumber(t.getContentLength()),e.a(2,null==r?p(n):r)},e)}));return function(t,n){return e.apply(this,arguments)}}();return function(){var e=O(M().m(function e(t){var o,s,l,c,u,p,v,g,b,y,w,x,E,N,k,S,O,C,R,j,T,_,A,P,L,I,z,B,q,U,H,W,V,$,K,Y,J,G,X;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=Ac(t),s=o.url,l=o.method,c=o.data,u=o.signal,p=o.cancelToken,v=o.timeout,g=o.onDownloadProgress,b=o.onUploadProgress,y=o.responseType,w=o.headers,x=o.withCredentials,E=void 0===x?"same-origin":x,N=o.fetchOptions,k=n||fetch,y=y?(y+"").toLowerCase():"text",S=Dc([u,p&&p.toAbortSignal()],v),O=null,C=S&&S.unsubscribe&&function(){S.unsubscribe()},e.p=1,!(J=b&&d&&"get"!==l&&"head"!==l)){e.n=3;break}return e.n=2,h(w,c);case 2:G=R=e.v,J=0!==G;case 3:if(!J){e.n=4;break}j=new r(s,{method:"POST",body:c,duplex:"half"}),zl.isFormData(c)&&(T=j.headers.get("content-type"))&&w.setContentType(T),j.body&&(_=kc(R,Nc(Sc(b))),A=F(_,2),P=A[0],L=A[1],c=Fc(j.body,65536,P,L));case 4:return zl.isString(E)||(E=E?"include":"omit"),I=i&&"credentials"in r.prototype,z=D(D({},N),{},{signal:S,method:l.toUpperCase(),headers:w.normalize().toJSON(),body:c,duplex:"half",credentials:I?E:void 0}),O=i&&new r(s,z),e.n=5,i?k(O,N):k(s,z);case 5:return B=e.v,q=f&&("stream"===y||"response"===y),f&&(g||q&&C)&&(U={},["status","statusText","headers"].forEach(function(e){U[e]=B[e]}),H=zl.toFiniteNumber(B.headers.get("content-length")),W=g&&kc(H,Nc(Sc(g),!0))||[],V=F(W,2),$=V[0],K=V[1],B=new a(Fc(B.body,65536,$,function(){K&&K(),C&&C()}),U)),y=y||"text",e.n=6,m[zl.findKey(m,y)||"text"](B,t);case 6:return Y=e.v,!q&&C&&C(),e.n=7,new Promise(function(e,n){Ec(e,n,{data:Y,headers:bc.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:O})});case 7:return e.a(2,e.v);case 8:if(e.p=8,X=e.v,C&&C(),!X||"TypeError"!==X.name||!/Load failed|fetch/i.test(X.message)){e.n=9;break}throw Object.assign(new Bl("Network Error",Bl.ERR_NETWORK,t,O),{cause:X.cause||X});case 9:throw Bl.from(X,X&&X.code,t,O);case 10:return e.a(2)}},e,null,[[1,8]])}));return function(t){return e.apply(this,arguments)}}()},$c=new Map,Kc=function(e){for(var t,n,r=e&&e.env||{},a=r.fetch,o=[r.Request,r.Response,a],i=o.length,s=$c;i--;)t=o[i],void 0===(n=s.get(t))&&s.set(t,n=i?new Map:Vc(r)),s=n;return n};Kc();var Yc={http:null,xhr:Pc,fetch:{get:Kc}};zl.forEach(Yc,function(e,t){if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});var Jc=function(e){return"- ".concat(e)},Gc=function(e){return zl.isFunction(e)||null===e||!1===e};var Xc={getAdapter:function(e,t){for(var n,r,a=(e=zl.isArray(e)?e:[e]).length,o={},i=0;i<a;i++){var s=void 0;if(r=n=e[i],!Gc(n)&&void 0===(r=Yc[(s=String(n)).toLowerCase()]))throw new Bl("Unknown adapter '".concat(s,"'"));if(r&&(zl.isFunction(r)||(r=r.get(t))))break;o[s||"#"+i]=r}if(!r){var l=Object.entries(o).map(function(e){var t=F(e,2),n=t[0],r=t[1];return"adapter ".concat(n," ")+(!1===r?"is not supported by the environment":"is not available in the build")});throw new Bl("There is no suitable adapter to dispatch the request "+(a?l.length>1?"since :\n"+l.map(Jc).join("\n"):" "+Jc(l[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r},adapters:Yc};function Zc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xc(null,e)}function Qc(e){return Zc(e),e.headers=bc.from(e.headers),e.data=yc.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Xc.getAdapter(e.adapter||dc.adapter,e)(e).then(function(t){return Zc(e),t.data=yc.call(e,e.transformResponse,t),t.headers=bc.from(t.headers),t},function(t){return wc(t)||(Zc(e),t&&t.response&&(t.response.data=yc.call(e,e.transformResponse,t.response),t.response.headers=bc.from(t.response.headers))),Promise.reject(t)})}var eu="1.13.2",tu={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){tu[e]=function(n){return q(n)===e||"a"+(t<1?"n ":" ")+e}});var nu={};tu.transitional=function(e,t,n){return function(r,a,o){if(!1===e)throw new Bl(function(e,t){return"[Axios v"+eu+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}(a," has been removed"+(t?" in "+t:"")),Bl.ERR_DEPRECATED);return t&&!nu[a]&&(nu[a]=!0),!e||e(r,a,o)}},tu.spelling=function(e){return function(e,t){return!0}};var ru={assertOptions:function(e,t,n){if("object"!==q(e))throw new Bl("options must be an object",Bl.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),a=r.length;a-- >0;){var o=r[a],i=t[o];if(i){var s=e[o],l=void 0===s||i(s,o,e);if(!0!==l)throw new Bl("option "+o+" must be "+l,Bl.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Bl("Unknown option "+o,Bl.ERR_BAD_OPTION)}},validators:tu},au=ru.validators,ou=function(){return T(function e(t){R(this,e),this.defaults=t||{},this.interceptors={request:new ec,response:new ec}},[{key:"request",value:(e=O(M().m(function e(t,n){var r,a,o;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request(t,n);case 1:return e.a(2,e.v);case 2:if(e.p=2,(o=e.v)instanceof Error){r={},Error.captureStackTrace?Error.captureStackTrace(r):r=new Error,a=r.stack?r.stack.replace(/^.+\n/,""):"";try{o.stack?a&&!String(o.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(o.stack+="\n"+a):o.stack=a}catch(e){}}throw o;case 3:return e.a(2)}},e,this,[[0,2]])})),function(t,n){return e.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var n=t=Tc(this.defaults,t),r=n.transitional,a=n.paramsSerializer,o=n.headers;void 0!==r&&ru.assertOptions(r,{silentJSONParsing:au.transitional(au.boolean),forcedJSONParsing:au.transitional(au.boolean),clarifyTimeoutError:au.transitional(au.boolean)},!1),null!=a&&(zl.isFunction(a)?t.paramsSerializer={serialize:a}:ru.assertOptions(a,{encode:au.function,serialize:au.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ru.assertOptions(t,{baseUrl:au.spelling("baseURL"),withXsrfToken:au.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var i=o&&zl.merge(o.common,o[t.method]);o&&zl.forEach(["delete","get","head","post","put","patch","common"],function(e){delete o[e]}),t.headers=bc.concat(i,o);var s=[],l=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(l=l&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});var c,u=[];this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});var d,f=0;if(!l){var m=[Qc.bind(this),void 0];for(m.unshift.apply(m,s),m.push.apply(m,u),d=m.length,c=Promise.resolve(t);f<d;)c=c.then(m[f++],m[f++]);return c}d=s.length;for(var p=t;f<d;){var h=s[f++],v=s[f++];try{p=h(p)}catch(e){v.call(this,e);break}}try{c=Qc.call(this,p)}catch(e){return Promise.reject(e)}for(f=0,d=u.length;f<d;)c=c.then(u[f++],u[f++]);return c}},{key:"getUri",value:function(e){return Zl(Rc((e=Tc(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}]);var e}();zl.forEach(["delete","get","head","options"],function(e){ou.prototype[e]=function(t,n){return this.request(Tc(n||{},{method:e,url:t,data:(n||{}).data}))}}),zl.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,a){return this.request(Tc(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ou.prototype[e]=t(),ou.prototype[e+"Form"]=t(!0)});var iu=ou,su=function(){function e(t){if(R(this,e),"function"!=typeof t)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var r=this;this.promise.then(function(e){if(r._listeners){for(var t=r._listeners.length;t-- >0;)r._listeners[t](e);r._listeners=null}}),this.promise.then=function(e){var t,n=new Promise(function(e){r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},t(function(e,t,a){r.reason||(r.reason=new xc(e,t,a),n(r.reason))})}return T(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,n=function(e){t.abort(e)};return this.subscribe(n),t.signal.unsubscribe=function(){return e.unsubscribe(n)},t.signal}}],[{key:"source",value:function(){var t;return{token:new e(function(e){t=e}),cancel:t}}}])}(),lu=su;var cu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(cu).forEach(function(e){var t=F(e,2),n=t[0],r=t[1];cu[r]=n});var uu=cu;var du=function e(t){var n=new iu(t),r=Ys(iu.prototype.request,n);return zl.extend(r,iu.prototype,n,{allOwnKeys:!0}),zl.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Tc(t,n))},r}(dc);du.Axios=iu,du.CanceledError=xc,du.CancelToken=lu,du.isCancel=wc,du.VERSION=eu,du.toFormData=Kl,du.AxiosError=Bl,du.Cancel=du.CanceledError,du.all=function(e){return Promise.all(e)},du.spread=function(e){return function(t){return e.apply(null,t)}},du.isAxiosError=function(e){return zl.isObject(e)&&!0===e.isAxiosError},du.mergeConfig=Tc,du.AxiosHeaders=bc,du.formToJSON=function(e){return cc(zl.isHTMLForm(e)?new FormData(e):e)},du.getAdapter=Xc.getAdapter,du.HttpStatusCode=uu,du.default=du;var fu=du;fu.Axios,fu.AxiosError,fu.CanceledError,fu.isCancel,fu.CancelToken,fu.VERSION,fu.all,fu.Cancel,fu.isAxiosError,fu.spread,fu.toFormData,fu.AxiosHeaders,fu.HttpStatusCode,fu.formToJSON,fu.getAdapter,fu.mergeConfig;var mu=fu.create({baseURL:"/api/cms",timeout:1e4,headers:{"Content-Type":"application/json"}});mu.interceptors.request.use(function(e){e.url&&e.url.startsWith("http")&&(e.baseURL="");var t=localStorage.getItem("cms_token");return t&&(e.headers.Authorization="Bearer ".concat(t)),e},function(e){return Promise.reject(e)}),mu.interceptors.response.use(function(e){return e},function(e){var t="请求错误",n=!1;if(e.response){var r=e.response.status,a=e.response.data;401===r?"登录已过期,请重新登录"===(null==a?void 0:a.message)?(t="登录已过期,请重新登录",n=!0):"认证信息无效"===(null==a?void 0:a.message)?(t="认证信息无效,请重新登录",n=!0):(t="认证失败,请登录",n=!0):t=(null==a?void 0:a.message)||"HTTP ".concat(r,": ").concat(e.response.statusText)}else t=e.request?"网络连接失败,请检查网络状态":e.message||"请求错误";return n?(localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),"/login"!==window.location.pathname&&"/"!==window.location.pathname&&(Ks.error(t),setTimeout(function(){window.location.reload()},1e3))):Ks.error(t),Promise.reject(e)});var pu,hu=function(e,t,n){if(t){var r=new URLSearchParams(t).toString();e=e+(e.includes("?")?"&":"?")+r}return mu.get(e,n).then(function(e){return e.data})},vu=function(e,t,n){return mu.post(e,t,n).then(function(e){return e.data})},gu=function(e,t,n){return mu.put(e,t,n).then(function(e){return e.data})},bu=function(e,t){return mu.delete(e,t).then(function(e){return e.data})};try{var yu=localStorage.getItem("cms_session_id")||void 0;pu=yu}catch(e){}function wu(e){pu=e;try{localStorage.setItem("cms_session_id",e)}catch(e){}}var xu=function(){return hu("/models")},Eu=function(e){return vu("/auth/login/".concat(pu?pu+"_":"","cms_users"),e)},Nu=function(){return vu("/auth/verify/".concat(pu?pu+"_":"","cms_users"))},ku=function(){return hu("/auth/user/".concat(pu?pu+"_":"","cms_users"))},Su=function(){localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user")},Ou=function(){return localStorage.getItem("cms_token")},Cu=function(){var e=localStorage.getItem("cms_user");return e?JSON.parse(e):null},Ru=function(e,t){var n=t?Object.assign({},t):void 0;return(null==n?void 0:n.filters)&&Array.isArray(n.filters)&&(n.filters=JSON.stringify(n.filters)),hu("/data/".concat(pu?pu+"_":"").concat(e),n)},ju=function(e,t){return hu("/relation/".concat(pu?pu+"_":"").concat(e,"/options"),t)},Tu=function(e,t){return vu("/data/".concat(pu?pu+"_":"").concat(e),t)},_u=function(e,t){return gu("/data/".concat(pu?pu+"_":"").concat(e),t)},Au=function(e,t){return bu("/data/".concat(pu?pu+"_":"").concat(e,"?id=").concat(t))};function Pu(e){var n=e.onLoginSuccess,r=F(a(""),2),o=r[0],i=r[1],l=F(a(""),2),c=l[0],u=l[1],d=F(a(!1),2),f=d[0],m=d[1];s(function(){var e=Ou();if(e){var t=function(){var t=O(M().m(function t(){var r;return M().w(function(t){for(;;)switch(t.p=t.n){case 0:return m(!0),t.p=1,t.n=2,Nu();case 2:if(t.v.success){t.n=3;break}throw new Error("token验证失败");case 3:return t.n=4,ku();case 4:if(!(r=t.v).success||!r.data){t.n=5;break}localStorage.setItem("cms_user",JSON.stringify(r.data)),null==n||n(e,r.data),t.n=6;break;case 5:throw new Error("获取用户信息失败");case 6:t.n=8;break;case 7:t.p=7,t.v,Su();case 8:return t.p=8,m(!1),t.f(8);case 9:return t.a(2)}},t,null,[[1,7,8,9]])}));return function(){return t.apply(this,arguments)}}();t()}},[n]);var p=function(){var e=O(M().m(function e(t){var r,a,i;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),o&&c){e.n=1;break}return Ks.error("请完善登录信息"),e.a(2);case 1:return m(!0),e.p=2,e.n=3,Eu({username:o,password:c});case 3:if((a=e.v).success&&(null===(r=a.data)||void 0===r?void 0:r.token)){e.n=4;break}return Ks.error(a.message||"登录失败"),e.a(2);case 4:localStorage.setItem("cms_token",a.data.token),localStorage.setItem("cms_user",JSON.stringify(a.data.user)),null==n||n(a.data.token,a.data.user),e.n=6;break;case 5:e.p=5,i=e.v,Ks.error("登陆失败,".concat(i.message||"网络错误,请稍后重试"));case 6:return e.p=6,m(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}();return t.createElement("div",{className:"min-h-screen flex relative overflow-hidden bg-white"},t.createElement("div",{className:"pointer-events-none absolute inset-0"},t.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(110deg,#ffffff_0%,#f7fbff_40%,#edf6ff_70%,#eaf3ff_100%)]"}),t.createElement("div",{className:"absolute inset-0 bg-[radial-gradient(1200px_600px_at_-10%_-10%,rgba(59,130,246,0.12),transparent),radial-gradient(900px_500px_at_110%_20%,rgba(147,51,234,0.10),transparent),radial-gradient(700px_400px_at_60%_120%,rgba(99,102,241,0.10),transparent)]"}),t.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(115deg,rgba(255,255,255,0.6)_0%,rgba(255,255,255,0.15)_32%,transparent_32%,transparent_68%,rgba(255,255,255,0.15)_68%,rgba(255,255,255,0.6)_100%)]"})),t.createElement("div",{className:"flex-1 relative flex items-center justify-center"},t.createElement("div",{className:"relative z-10 max-w-4xl w-full px-16 text-left"},t.createElement("div",{className:"mb-12"},t.createElement("div",{className:"inline-flex items-center rounded-2xl px-4 py-2 bg-white/70 backdrop-blur border border-white/60"},t.createElement("span",{className:"text-2xl font-semibold tracking-tight text-gray-900"},"CMS 管理后台")),t.createElement("h1",{className:"mt-8 text-5xl md:text-6xl font-extrabold leading-tight text-gray-900"},"内容管理平台"),t.createElement("p",{className:"mt-6 text-2xl text-gray-600"},"一站式管理、协作与发布")),t.createElement("div",{className:"mt-8 flex items-center text-gray-500 gap-6"},t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-blue-500"}),"多角色权限"),t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-violet-500"}),"结构化内容"),t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-indigo-500"}),"可扩展 API")))),t.createElement("div",{className:"w-[480px] min-w-[380px] flex items-center justify-center p-8 mt-30"},t.createElement("div",{className:"w-full max-w-sm"},f?t.createElement(js,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},t.createElement(Ps,{className:"p-8"},t.createElement("div",{className:"space-y-4"},t.createElement(bt,{className:"h-12 w-48"}),t.createElement(bt,{className:"h-4 w-64"}),t.createElement(bt,{className:"h-10 w-full"}),t.createElement(bt,{className:"h-10 w-full"})))):t.createElement(js,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},t.createElement(Ts,{className:"p-8 pb-6"},t.createElement(_s,{className:"text-center text-2xl mb-2 text-gray-800"},"欢迎使用 CMS 管理后台"),t.createElement(As,{className:"text-center text-gray-500"},"请输入账号和密码登录")),t.createElement(Ps,{className:"p-8 pt-0"},t.createElement("form",{onSubmit:p,className:"space-y-6"},t.createElement("div",{className:"space-y-2"},t.createElement(Rs,{htmlFor:"username"},"账号/邮箱"),t.createElement("div",{className:"relative"},t.createElement(be,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.createElement(Mt,{id:"username",type:"text",placeholder:"邮箱",value:o,onChange:function(e){return i(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:2}))),t.createElement("div",{className:"space-y-2"},t.createElement(Rs,{htmlFor:"password"},"密码"),t.createElement("div",{className:"relative"},t.createElement(le,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.createElement(Mt,{id:"password",type:"password",placeholder:"密码",value:c,onChange:function(e){return u(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:6}))),t.createElement(Dt,{type:"submit",className:"w-full h-12 rounded-xl transition-all duration-200 font-semibold text-base shadow-lg hover:brightness-[1.03] active:scale-[0.99]",style:{backgroundImage:"linear-gradient(135deg, rgba(236, 248, 255, 0.78) 0%, rgba(221, 238, 255, 0.78) 100%)",color:"rgba(0, 0, 0, 0.7)",border:"none",boxShadow:"0 6px 24px rgba(37, 99, 235, 0.12)"},disabled:f},t.createElement(ce,{className:"h-4 w-4 mr-2"}),f?"登录中...":"登录")))))))}function Du(e,[t,n]){return Math.min(n,Math.max(t,e))}var Mu=e.createContext(void 0);function Lu(t){const n=e.useRef({value:t,previous:t});return e.useMemo(()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous),[t])}var Iu=[" ","Enter","ArrowUp","ArrowDown"],Fu=[" ","Enter"],zu="Select",[Bu,qu,Uu]=function(e){const n=e+"CollectionProvider",[r,a]=Ut(n),[o,i]=r(n,{collectionRef:{current:null},itemMap:new Map}),s=e=>{const{scope:n,children:r}=e,a=t.useRef(null),i=t.useRef(new Map).current;return l(o,{scope:n,itemMap:i,collectionRef:a,children:r})};s.displayName=n;const c=e+"CollectionSlot",u=Gt(c),d=t.forwardRef((e,t)=>{const{scope:n,children:r}=e,a=xt(t,i(c,n).collectionRef);return l(u,{ref:a,children:r})});d.displayName=c;const f=e+"CollectionItemSlot",m="data-radix-collection-item",p=Gt(f),h=t.forwardRef((e,n)=>{const{scope:r,children:a,...o}=e,s=t.useRef(null),c=xt(n,s),u=i(f,r);return t.useEffect(()=>(u.itemMap.set(s,{ref:s,...o}),()=>{u.itemMap.delete(s)})),l(p,{[m]:"",ref:c,children:a})});return h.displayName=f,[{Provider:s,Slot:d,ItemSlot:h},function(n){const r=i(e+"CollectionConsumer",n);return t.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},a]}(zu),[Hu,Wu]=Ut(zu,[Uu,ui]),Vu=ui(),[$u,Ku]=Hu(zu),[Yu,Ju]=Hu(zu),Gu=t=>{const{__scopeSelect:n,children:r,open:a,defaultOpen:o,onOpenChange:i,value:s,defaultValue:c,onValueChange:d,dir:f,name:m,autoComplete:p,disabled:h,required:v,form:g}=t,b=Vu(n),[y,w]=e.useState(null),[x,E]=e.useState(null),[N,k]=e.useState(!1),S=function(t){const n=e.useContext(Mu);return t||n||"ltr"}(f),[O,C]=Jt({prop:a,defaultProp:o??!1,onChange:i,caller:zu}),[R,j]=Jt({prop:s,defaultProp:c,onChange:d,caller:zu}),T=e.useRef(null),_=!y||(g||!!y.closest("form")),[A,P]=e.useState(new Set),D=Array.from(A).map(e=>e.props.value).join(";");return l(Oi,{...b,children:u($u,{required:v,scope:n,trigger:y,onTriggerChange:w,valueNode:x,onValueNodeChange:E,valueNodeHasChildren:N,onValueNodeHasChildrenChange:k,contentId:Kt(),value:R,onValueChange:j,open:O,onOpenChange:C,dir:S,triggerPointerDownPosRef:T,disabled:h,children:[l(Bu.Provider,{scope:n,children:l(Yu,{scope:t.__scopeSelect,onNativeOptionAdd:e.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:e.useCallback(e=>{P(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),_?u(Ld,{"aria-hidden":!0,required:v,tabIndex:-1,name:m,autoComplete:p,value:R,onChange:e=>j(e.target.value),disabled:h,form:g,children:[void 0===R?l("option",{value:""}):null,Array.from(A)]},D):null]})})};Gu.displayName=zu;var Xu="SelectTrigger",Zu=e.forwardRef((t,n)=>{const{__scopeSelect:r,disabled:a=!1,...o}=t,i=Vu(r),s=Ku(Xu,r),c=s.disabled||a,u=xt(n,s.onTriggerChange),d=qu(r),f=e.useRef("touch"),[m,p,h]=Fd(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===s.value),r=zd(t,e,n);void 0!==r&&s.onValueChange(r.value)}),v=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return l(Ci,{asChild:!0,...i,children:l(en.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Id(s.value)?"":void 0,...o,ref:u,onClick:qt(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&v(e)}),onPointerDown:qt(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(v(e),e.preventDefault())}),onKeyDown:qt(o.onKeyDown,e=>{const t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||Iu.includes(e.key)&&(v(),e.preventDefault())})})})});Zu.displayName=Xu;var Qu="SelectValue",ed=e.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...s}=e,u=Ku(Qu,n),{onValueNodeHasChildrenChange:d}=u,f=void 0!==o,m=xt(t,u.onValueNodeChange);return Wt(()=>{d(f)},[d,f]),l(en.span,{...s,ref:m,style:{pointerEvents:"none"},children:Id(u.value)?l(c,{children:i}):o})});ed.displayName=Qu;var td=e.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return l(en.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});td.displayName="SelectIcon";var nd=e=>l(xn,{asChild:!0,...e});nd.displayName="SelectPortal";var rd="SelectContent",ad=e.forwardRef((t,n)=>{const r=Ku(rd,t.__scopeSelect),[a,o]=e.useState();if(Wt(()=>{o(new DocumentFragment)},[]),!r.open){const e=a;return e?d.createPortal(l(id,{scope:t.__scopeSelect,children:l(Bu.Slot,{scope:t.__scopeSelect,children:l("div",{children:t.children})})}),e):null}return l(cd,{...t,ref:n})});ad.displayName=rd;var od=10,[id,sd]=Hu(rd),ld=Gt("SelectContent.RemoveScroll"),cd=e.forwardRef((t,n)=>{const{__scopeSelect:r,position:a="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:v,hideWhenDetached:g,avoidCollisions:b,...y}=t,w=Ku(rd,r),[x,E]=e.useState(null),[N,k]=e.useState(null),S=xt(n,e=>E(e)),[O,C]=e.useState(null),[R,j]=e.useState(null),T=qu(r),[_,A]=e.useState(!1),P=e.useRef(!1);e.useEffect(()=>{if(x)return yr(x)},[x]),Sn();const D=e.useCallback(e=>{const[t,...n]=T().map(e=>e.ref.current),[r]=n.slice(-1),a=document.activeElement;for(const n of e){if(n===a)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&N&&(N.scrollTop=0),n===r&&N&&(N.scrollTop=N.scrollHeight),n?.focus(),document.activeElement!==a)return}},[T,N]),M=e.useCallback(()=>D([O,x]),[D,O,x]);e.useEffect(()=>{_&&M()},[_,M]);const{onOpenChange:L,triggerPointerDownPosRef:I}=w;e.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||L(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,L,I]),e.useEffect(()=>{const e=()=>L(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[L]);const[F,z]=Fd(e=>{const t=T().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=zd(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),B=e.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&(C(e),r&&(P.current=!0))},[w.value]),q=e.useCallback(()=>x?.focus(),[x]),U=e.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&j(e)},[w.value]),H="popper"===a?dd:ud,W=H===dd?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:v,hideWhenDetached:g,avoidCollisions:b}:{};return l(id,{scope:r,content:x,viewport:N,onViewportChange:k,itemRefCallback:B,selectedItem:O,onItemLeave:q,itemTextRefCallback:U,focusSelectedItem:M,selectedItemText:R,position:a,isPositioned:_,searchRef:F,children:l(fr,{as:ld,allowPinchZoom:!0,children:l(pn,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:qt(o,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:l(ln,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:l(H,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...W,onPlaced:()=>A(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:qt(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});cd.displayName="SelectContentImpl";var ud=e.forwardRef((t,n)=>{const{__scopeSelect:r,onPlaced:a,...o}=t,i=Ku(rd,r),s=sd(rd,r),[c,u]=e.useState(null),[d,f]=e.useState(null),m=xt(n,e=>f(e)),p=qu(r),h=e.useRef(!1),v=e.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=s,x=e.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&d&&g&&b&&y){const e=i.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=i.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if("rtl"!==i.dir){const a=r.left-t.left,o=n.left-a,i=e.left-o,s=e.width+i,l=Math.max(s,t.width),u=window.innerWidth-od,d=Du(o,[od,Math.max(od,u-l)]);c.style.minWidth=s+"px",c.style.left=d+"px"}else{const a=t.right-r.right,o=window.innerWidth-n.right-a,i=window.innerWidth-e.right-o,s=e.width+i,l=Math.max(s,t.width),u=window.innerWidth-od,d=Du(o,[od,Math.max(od,u-l)]);c.style.minWidth=s+"px",c.style.right=d+"px"}const o=p(),s=window.innerHeight-2*od,l=g.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),m=parseInt(u.paddingTop,10),v=parseInt(u.borderBottomWidth,10),w=f+m+l+parseInt(u.paddingBottom,10)+v,x=Math.min(5*b.offsetHeight,w),E=window.getComputedStyle(g),N=parseInt(E.paddingTop,10),k=parseInt(E.paddingBottom,10),S=e.top+e.height/2-od,O=s-S,C=b.offsetHeight/2,R=f+m+(b.offsetTop+C),j=w-R;if(R<=S){const e=o.length>0&&b===o[o.length-1].ref.current;c.style.bottom="0px";const t=d.clientHeight-g.offsetTop-g.offsetHeight,n=R+Math.max(O,C+(e?k:0)+t+v);c.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;c.style.top="0px";const t=Math.max(S,f+g.offsetTop+(e?N:0)+C)+j;c.style.height=t+"px",g.scrollTop=R-S+g.offsetTop}c.style.margin=`${od}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=s+"px",a?.(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,c,d,g,b,y,i.dir,a]);Wt(()=>x(),[x]);const[E,N]=e.useState();Wt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const k=e.useCallback(e=>{e&&!0===v.current&&(x(),w?.(),v.current=!1)},[x,w]);return l(fd,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:l("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:l(en.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});ud.displayName="SelectItemAlignedPosition";var dd=e.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=od,...o}=e,i=Vu(n);return l(Ri,{...i,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});dd.displayName="SelectPopperPosition";var[fd,md]=Hu(rd,{}),pd="SelectViewport",hd=e.forwardRef((t,n)=>{const{__scopeSelect:r,nonce:a,...o}=t,i=sd(pd,r),s=md(pd,r),d=xt(n,i.onViewportChange),f=e.useRef(0);return u(c,{children:[l("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),l(Bu.Slot,{scope:r,children:l(en.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:qt(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){const e=Math.abs(f.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*od,a=parseFloat(n.style.minHeight),o=parseFloat(n.style.height),i=Math.max(a,o);if(i<r){const a=i+e,o=Math.min(r,a),s=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});hd.displayName=pd;var vd="SelectGroup",[gd,bd]=Hu(vd);e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Kt();return l(gd,{scope:n,id:a,children:l(en.div,{role:"group","aria-labelledby":a,...r,ref:t})})}).displayName=vd;var yd="SelectLabel",wd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=bd(yd,n);return l(en.div,{id:a.id,...r,ref:t})});wd.displayName=yd;var xd="SelectItem",[Ed,Nd]=Hu(xd),kd=e.forwardRef((t,n)=>{const{__scopeSelect:r,value:a,disabled:o=!1,textValue:i,...s}=t,c=Ku(xd,r),u=sd(xd,r),d=c.value===a,[f,m]=e.useState(i??""),[p,h]=e.useState(!1),v=xt(n,e=>u.itemRefCallback?.(e,a,o)),g=Kt(),b=e.useRef("touch"),y=()=>{o||(c.onValueChange(a),c.onOpenChange(!1))};if(""===a)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l(Ed,{scope:r,value:a,disabled:o,textId:g,isSelected:d,onItemTextChange:e.useCallback(e=>{m(t=>t||(e?.textContent??"").trim())},[]),children:l(Bu.ItemSlot,{scope:r,value:a,disabled:o,textValue:f,children:l(en.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:v,onFocus:qt(s.onFocus,()=>h(!0)),onBlur:qt(s.onBlur,()=>h(!1)),onClick:qt(s.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:qt(s.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:qt(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:qt(s.onPointerMove,e=>{b.current=e.pointerType,o?u.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:qt(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:qt(s.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(Fu.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});kd.displayName=xd;var Sd="SelectItemText",Od=e.forwardRef((t,n)=>{const{__scopeSelect:r,className:a,style:o,...i}=t,s=Ku(Sd,r),f=sd(Sd,r),m=Nd(Sd,r),p=Ju(Sd,r),[h,v]=e.useState(null),g=xt(n,e=>v(e),m.onItemTextChange,e=>f.itemTextRefCallback?.(e,m.value,m.disabled)),b=h?.textContent,y=e.useMemo(()=>l("option",{value:m.value,disabled:m.disabled,children:b},m.value),[m.disabled,m.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return Wt(()=>(w(y),()=>x(y)),[w,x,y]),u(c,{children:[l(en.span,{id:m.textId,...i,ref:g}),m.isSelected&&s.valueNode&&!s.valueNodeHasChildren?d.createPortal(i.children,s.valueNode):null]})});Od.displayName=Sd;var Cd="SelectItemIndicator",Rd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Nd(Cd,n).isSelected?l(en.span,{"aria-hidden":!0,...r,ref:t}):null});Rd.displayName=Cd;var jd="SelectScrollUpButton",Td=e.forwardRef((t,n)=>{const r=sd(jd,t.__scopeSelect),a=md(jd,t.__scopeSelect),[o,i]=e.useState(!1),s=xt(n,a.onScrollButtonChange);return Wt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?l(Pd,{...t,ref:s,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Td.displayName=jd;var _d="SelectScrollDownButton",Ad=e.forwardRef((t,n)=>{const r=sd(_d,t.__scopeSelect),a=md(_d,t.__scopeSelect),[o,i]=e.useState(!1),s=xt(n,a.onScrollButtonChange);return Wt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;i(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?l(Pd,{...t,ref:s,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Ad.displayName=_d;var Pd=e.forwardRef((t,n)=>{const{__scopeSelect:r,onAutoScroll:a,...o}=t,i=sd("SelectScrollButton",r),s=e.useRef(null),c=qu(r),u=e.useCallback(()=>{null!==s.current&&(window.clearInterval(s.current),s.current=null)},[]);return e.useEffect(()=>()=>u(),[u]),Wt(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),l(en.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:qt(o.onPointerDown,()=>{null===s.current&&(s.current=window.setInterval(a,50))}),onPointerMove:qt(o.onPointerMove,()=>{i.onItemLeave?.(),null===s.current&&(s.current=window.setInterval(a,50))}),onPointerLeave:qt(o.onPointerLeave,()=>{u()})})}),Dd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l(en.div,{"aria-hidden":!0,...r,ref:t})});Dd.displayName="SelectSeparator";var Md="SelectArrow";e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Vu(n),o=Ku(Md,n),i=sd(Md,n);return o.open&&"popper"===i.position?l(ji,{...a,...r,ref:t}):null}).displayName=Md;var Ld=e.forwardRef(({__scopeSelect:t,value:n,...r},a)=>{const o=e.useRef(null),i=xt(a,o),s=Lu(n);return e.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(s!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[s,n]),l(en.select,{...r,style:{...Ti,...r.style},ref:i,defaultValue:n})});function Id(e){return""===e||void 0===e}function Fd(t){const n=tn(t),r=e.useRef(""),a=e.useRef(0),o=e.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),i=e.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return e.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function zd(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=(i=e,s=Math.max(a,0),i.map((e,t)=>i[(s+t)%i.length]));var i,s;1===r.length&&(o=o.filter(e=>e!==n));const l=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Ld.displayName="SelectBubbleInput";var Bd=Zu,qd=td,Ud=nd,Hd=ad,Wd=hd,Vd=wd,$d=kd,Kd=Od,Yd=Rd,Jd=Td,Gd=Ad,Xd=Dd,Zd=Gu,Qd=ed,ef=e.forwardRef(function(t,n){var r=t.className,a=t.children,o=Ee(t,["className","children"]);return e.createElement(Bd,Object.assign({ref:n,className:gt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r)},o),a,e.createElement(qd,{asChild:!0},e.createElement(X,{className:"h-4 w-4 opacity-50"})))});ef.displayName=Bd.displayName;var tf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(Jd,Object.assign({ref:n,className:gt("flex cursor-default items-center justify-center py-1",r)},a),e.createElement(ee,{className:"h-4 w-4"}))});tf.displayName=Jd.displayName;var nf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(Gd,Object.assign({ref:n,className:gt("flex cursor-default items-center justify-center py-1",r)},a),e.createElement(X,{className:"h-4 w-4"}))});nf.displayName=Gd.displayName;var rf=e.forwardRef(function(t,n){var r=t.className,a=t.children,o=t.position,i=void 0===o?"popper":o,s=Ee(t,["className","children","position"]);return e.createElement(Ud,null,e.createElement(Hd,Object.assign({ref:n,className:gt("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",r),position:i},s),e.createElement(tf,null),e.createElement(Wd,{className:gt("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},a),e.createElement(nf,null)))});rf.displayName=Hd.displayName,e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(Vd,Object.assign({ref:n,className:gt("py-1.5 pl-8 pr-2 text-sm font-semibold",r)},a))}).displayName=Vd.displayName;var af=e.forwardRef(function(t,n){var r=t.className,a=t.children,o=Ee(t,["className","children"]);return e.createElement($d,Object.assign({ref:n,className:gt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(Yd,null,e.createElement(G,{className:"h-4 w-4"}))),e.createElement(Kd,null,a))});af.displayName=$d.displayName,e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(Xd,Object.assign({ref:n,className:gt("-mx-1 my-1 h-px bg-muted",r)},a))}).displayName=Xd.displayName;var of="Switch",[sf,lf]=Ut(of),[cf,uf]=sf(of),df=e.forwardRef((t,n)=>{const{__scopeSwitch:r,name:a,checked:o,defaultChecked:i,required:s,disabled:c,value:d="on",onCheckedChange:f,form:m,...p}=t,[h,v]=e.useState(null),g=xt(n,e=>v(e)),b=e.useRef(!1),y=!h||(m||!!h.closest("form")),[w,x]=Jt({prop:o,defaultProp:i??!1,onChange:f,caller:of});return u(cf,{scope:r,checked:w,disabled:c,children:[l(en.button,{type:"button",role:"switch","aria-checked":w,"aria-required":s,"data-state":hf(w),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:qt(t.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&l(pf,{control:h,bubbles:!b.current,name:a,value:d,checked:w,required:s,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});df.displayName=of;var ff="SwitchThumb",mf=e.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=uf(ff,n);return l(en.span,{"data-state":hf(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});mf.displayName=ff;var pf=e.forwardRef(({__scopeSwitch:t,control:n,checked:r,bubbles:a=!0,...o},i)=>{const s=e.useRef(null),c=xt(s,i),u=Lu(r),d=si(n);return e.useEffect(()=>{const e=s.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(u!==r&&n){const t=new Event("click",{bubbles:a});n.call(e,r),e.dispatchEvent(t)}},[u,r,a]),l("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:c,style:{...o.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function hf(e){return e?"checked":"unchecked"}pf.displayName="SwitchBubbleInput";var vf=df,gf=mf,bf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(vf,Object.assign({className:gt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",r)},a,{ref:n}),e.createElement(gf,{className:gt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")}))});bf.displayName=vf.displayName;var yf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("textarea",Object.assign({className:gt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:n},a))});yf.displayName="Textarea";var wf=Qr,xf=ea,Ef=ta,Nf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(na,Object.assign({ref:n,className:gt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r)},a))});Nf.displayName=na.displayName;var kf=e.forwardRef(function(t,n){var r=t.className,a=t.children,o=Ee(t,["className","children"]);return e.createElement(Ef,null,e.createElement(Nf,null),e.createElement(ra,Object.assign({ref:n,className:gt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r)},o),a,e.createElement(ia,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"},e.createElement(we,{className:"h-4 w-4"}),e.createElement("span",{className:"sr-only"},"Close"))))});kf.displayName=ra.displayName;var Sf=function(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex flex-col space-y-1.5 text-center sm:text-left",n)},r))};Sf.displayName="DialogHeader";var Of=function(t){var n=t.className,r=Ee(t,["className"]);return e.createElement("div",Object.assign({className:gt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n)},r))};Of.displayName="DialogFooter";var Cf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(aa,Object.assign({ref:n,className:gt("text-lg font-semibold leading-none tracking-tight",r)},a))});Cf.displayName=aa.displayName;var Rf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement(oa,Object.assign({ref:n,className:gt("text-sm text-muted-foreground",r)},a))});function jf(e,t){if(!t.length)return"JSON 格式不正确";var n=t[0],r=function(e,t){for(var n=1,r=1,a=Math.max(0,Math.min(t,e.length)),o=0;o<a;o++){"\n"===e.charAt(o)?(n++,r=1):r++}return{line:n,col:r}}(e,n.offset),a=r.line,o=r.col,i=v(n.error);return"JSON 格式不正确(".concat(i,",行 ").concat(a," 列 ").concat(o,")")}function Tf(e){if(null==e||""===e)return{ok:!0,value:null,pretty:"null",compact:"null"};try{if("string"!=typeof e)return{ok:!0,value:e,pretty:JSON.stringify(e,null,2),compact:JSON.stringify(e)};var t=e,n=[],r=p(t,n,{allowTrailingComma:!0,disallowComments:!1});return n.length?{ok:!1,message:jf(t,n),pretty:t,compact:t}:{ok:!0,value:r,pretty:JSON.stringify(r,null,2),compact:JSON.stringify(r)}}catch(t){var a="string"==typeof e?e:String(e);return{ok:!1,message:"JSON 格式不正确",pretty:a,compact:a}}}function _f(e){return Af.apply(this,arguments)}function Af(){return(Af=O(M().m(function e(t){var n,r;return M().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(!(null===(n=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===n?void 0:n.writeText)){e.n=3;break}return e.n=2,navigator.clipboard.writeText(t);case 2:return e.a(2);case 3:(r=document.createElement("textarea")).value=t,r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function Pf(t){var n=t.value,r=t.title;if(null==n||""===n)return e.createElement("span",null,"-");var a,o=Tf(n),i=o.ok,s=o.pretty,l=o.compact,c=l.length>80?l.slice(0,80)+"…":l;return e.createElement(wf,null,e.createElement(xf,{asChild:!0},e.createElement("button",{type:"button",className:"max-w-xs truncate text-left font-mono text-xs text-muted-foreground hover:underline",title:"点击查看 JSON"},c)),e.createElement(kf,{className:"max-w-3xl"},e.createElement(Sf,null,e.createElement(Cf,null,r||"JSON")),e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(Dt,{variant:"outline",size:"sm",onClick:(a=O(M().m(function e(){return M().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,_f(s);case 1:Ks.success("已复制 JSON"),e.n=3;break;case 2:e.p=2,e.v,Ks.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return a.apply(this,arguments)})},"复制")),e.createElement("pre",{className:"max-h-[60vh] overflow-auto rounded-md bg-muted p-3 text-xs font-mono whitespace-pre"},s),!i&&e.createElement("div",{className:"text-xs text-destructive"},o.ok?"":o.message)))}function Df(t){t.id;var n=t.value;t.required;var r,a=t.onChange,o=F(e.useState(null),2),i=o[0],s=o[1];return e.createElement("div",{className:"space-y-2"},e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(Dt,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=(n||"").trim();if(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=(e||"").toString(),r=[];if(p(n,r,{allowTrailingComma:!0,disallowComments:!1}),r.length)return{ok:!1,message:jf(n,r)};for(var a=h(n,void 0,{insertSpaces:!0,tabSize:t}),o=n,i=a.length-1;i>=0;i--){var s=a[i];o=o.slice(0,s.offset)+s.content+o.slice(s.offset+s.length)}return{ok:!0,formatted:o}}(e,2);t.ok?(a(t.formatted),s(null)):s(t.message)}}},"格式化"),e.createElement(Dt,{type:"button",variant:"outline",size:"sm",onClick:(r=O(M().m(function e(){return M().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,_f(n||"");case 1:Ks.success("已复制"),e.n=3;break;case 2:e.p=2,e.v,Ks.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return r.apply(this,arguments)})},"复制")),e.createElement("div",{className:"rounded-md border bg-background"},e.createElement(g,{value:n||"",height:"220px",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},extensions:[b()],onChange:function(e){a(e),function(e){var t=(e||"").trim();if(!t)return s(null),!0;var n=Tf(t);n.ok?s(null):s(n.message)}(e)}})),i&&e.createElement("div",{className:"text-xs text-destructive"},i))}Rf.displayName=oa.displayName;var Mf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("div",{className:"relative w-full overflow-auto"},e.createElement("table",Object.assign({ref:n,className:gt("w-full caption-bottom text-sm",r)},a)))});Mf.displayName="Table";var Lf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("thead",Object.assign({ref:n,className:gt("[&_tr]:border-b",r)},a))});Lf.displayName="TableHeader";var If=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("tbody",Object.assign({ref:n,className:gt("[&_tr:last-child]:border-0",r)},a))});If.displayName="TableBody",e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("tfoot",Object.assign({ref:n,className:gt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r)},a))}).displayName="TableFooter";var Ff=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("tr",Object.assign({ref:n,className:gt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r)},a))});Ff.displayName="TableRow";var zf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("th",Object.assign({ref:n,className:gt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r)},a))});zf.displayName="TableHead";var Bf=e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("td",Object.assign({ref:n,className:gt("p-4 align-middle [&:has([role=checkbox])]:pr-0",r)},a))});Bf.displayName="TableCell",e.forwardRef(function(t,n){var r=t.className,a=Ee(t,["className"]);return e.createElement("caption",Object.assign({ref:n,className:gt("mt-4 text-sm text-muted-foreground",r)},a))}).displayName="TableCaption";var qf=At("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Uf(t){var n=t.className,r=t.variant,a=Ee(t,["className","variant"]);return e.createElement("div",Object.assign({className:gt(qf({variant:r}),n)},a))}function Hf(){return"".concat(Date.now(),"_").concat(Math.random().toString(16).slice(2))}function Wf(e){return"integer"===e||"float"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"大于"},{value:"gte",label:"大于等于"},{value:"lt",label:"小于"},{value:"lte",label:"小于等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]:"boolean"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"isNull",label:"为空(NULL)"}]:"date"===e||"datetime"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"晚于/大于"},{value:"gte",label:"晚于等于/大于等于"},{value:"lt",label:"早于/小于"},{value:"lte",label:"早于等于/小于等于"},{value:"isNull",label:"为空(NULL)"}]:[{value:"contains",label:"包含"},{value:"startsWith",label:"开头是"},{value:"endsWith",label:"结尾是"},{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]}function Vf(e){var n,r,o=i(function(){var t=[];t.push.apply(t,z([{column:"id",label:"ID",type:"id"},{column:"created_at",label:"创建时间",type:"datetime"},{column:"updated_at",label:"更新时间",type:"datetime"}]));var n,r=_(e.fields||[]);try{for(r.s();!(n=r.n()).done;){var a=n.value;if((null==a?void 0:a.name)&&("json"!==a.type&&"jsonb"!==a.type))if("relation"===a.type&&a.relation){var o=a.relation.foreignKey||"".concat(a.relation.target,"_id");t.push({column:o,label:"".concat(a.comment||a.name,"(关联)"),type:"relation"})}else t.push({column:a.name,label:a.comment||a.name,type:a.type})}}catch(e){r.e(e)}finally{r.f()}var i=new Set;return t.filter(function(e){return!i.has(e.column)&&(i.add(e.column),!0)})},[e.fields]),l=i(function(){return new Map(o.map(function(e){return[e.column,e]}))},[o]),c=i(function(){return new Map(o.map(function(e){return[e.column,e.type]}))},[o]),u=F(a([]),2),d=u[0],f=u[1];s(function(){f(function(e,t){return(e||[]).map(function(e){if(t.get(e.column),"is"===e.operator&&(null===e.value||"null"===e.value))return{id:Hf(),column:e.column,operator:"isNull",value:""};if(("ilike"===e.operator||"like"===e.operator)&&"string"==typeof e.value){var n=e.value;if(n.startsWith("%")&&n.endsWith("%")&&n.length>=2)return{id:Hf(),column:e.column,operator:"contains",value:n.slice(1,-1)};if(n.endsWith("%"))return{id:Hf(),column:e.column,operator:"startsWith",value:n.slice(0,-1)};if(n.startsWith("%"))return{id:Hf(),column:e.column,operator:"endsWith",value:n.slice(1)}}if("in"===e.operator){var r=Array.isArray(e.value)?e.value:[];return{id:Hf(),column:e.column,operator:"in",value:r.join(",")}}return{id:Hf(),column:e.column,operator:["eq","neq","gt","gte","lt","lte"].includes(e.operator)?e.operator:"eq",value:void 0===e.value||null===e.value?"":String(e.value)}})}(e.value||[],c))},[JSON.stringify(e.value),o.length]);var m=function(e,t){f(function(n){return n.map(function(n){var r,a;if(n.id!==e)return n;var o=Object.assign(Object.assign({},n),t);if(t.column&&t.column!==n.column){var i=Wf((null===(r=l.get(t.column))||void 0===r?void 0:r.type)||"string");o.operator=(null===(a=i[0])||void 0===a?void 0:a.value)||"eq",o.value=""}return t.operator&&"isNull"===t.operator&&(o.value=""),o})})};return t.createElement("div",{className:"space-y-3"},t.createElement("div",{className:"flex items-center justify-between gap-3"},t.createElement(Rs,{className:"text-base font-medium flex items-center gap-2"},t.createElement(ae,{className:"h-4 w-4"}),"动态筛选"),t.createElement("div",{className:"flex items-center gap-2"},(null===(n=e.value)||void 0===n?void 0:n.length)>0&&t.createElement(Uf,{variant:"secondary"},"已应用 ",e.value.length," 条"),t.createElement(Dt,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=o[0];if(e){var t=Wf(e.type);f(function(n){var r;return[].concat(z(n),[{id:Hf(),column:e.column,operator:(null===(r=t[0])||void 0===r?void 0:r.value)||"eq",value:""}])})}}},t.createElement(fe,{className:"h-4 w-4 mr-1"}),"添加条件"))),0===d.length?t.createElement("div",{className:"text-sm text-muted-foreground border rounded-lg p-3 bg-muted/20"},"暂无筛选条件(可添加条件后点击“应用”)"):t.createElement("div",{className:"space-y-2"},d.map(function(e){var n=l.get(e.column),r=(null==n?void 0:n.type)||"string",a=Wf(r),i="isNull"!==e.operator;return t.createElement("div",{key:e.id,className:"grid grid-cols-12 gap-2 items-center"},t.createElement("div",{className:"col-span-5"},t.createElement(Zd,{value:e.column,onValueChange:function(t){return m(e.id,{column:t})}},t.createElement(ef,{className:"h-10"},t.createElement(Qd,{placeholder:"字段"})),t.createElement(rf,null,o.map(function(e){return t.createElement(af,{key:e.column,value:e.column},e.label," (",e.column,")")})))),t.createElement("div",{className:"col-span-3"},t.createElement(Zd,{value:e.operator,onValueChange:function(t){return m(e.id,{operator:t})}},t.createElement(ef,{className:"h-10"},t.createElement(Qd,{placeholder:"操作符"})),t.createElement(rf,null,a.map(function(e){return t.createElement(af,{key:e.value,value:e.value},e.label)})))),t.createElement("div",{className:"col-span-3"},i?"boolean"===r?t.createElement(Zd,{value:e.value,onValueChange:function(t){return m(e.id,{value:t})}},t.createElement(ef,{className:"h-10"},t.createElement(Qd,{placeholder:"值"})),t.createElement(rf,null,t.createElement(af,{value:"true"},"true"),t.createElement(af,{value:"false"},"false"))):t.createElement(Mt,{className:"h-10",placeholder:"in"===e.operator?"多个值用逗号分隔":"值",type:"integer"===r||"float"===r?"number":"date"===r?"date":"datetime"===r?"datetime-local":"text",value:e.value,onChange:function(t){return m(e.id,{value:t.target.value})}}):t.createElement("div",{className:"h-10 flex items-center text-sm text-muted-foreground"},"无需填写")),t.createElement("div",{className:"col-span-1 flex justify-end"},t.createElement(Dt,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 p-0",onClick:function(){return t=e.id,void f(function(e){return e.filter(function(e){return e.id!==t})});var t}},t.createElement(we,{className:"h-4 w-4"}))))})),t.createElement("div",{className:"flex items-center justify-end gap-2"},t.createElement(Dt,{type:"button",variant:"outline",onClick:function(){f([]),e.onChange([])},disabled:0===d.length&&0===((null===(r=e.value)||void 0===r?void 0:r.length)||0)},"清空"),t.createElement(Dt,{type:"button",onClick:function(){var t=function(e,t){var n,r,a=[],o=_(e);try{for(o.s();!(r=o.n()).done;){var i=r.value,s=t.get(i.column);if(s&&i.operator)if("isNull"!==i.operator){var l=null!==(n=i.value)&&void 0!==n?n:"",c=String(l).trim();if(c)if("contains"!==i.operator)if("startsWith"!==i.operator)if("endsWith"!==i.operator)if("in"!==i.operator)a.push({column:s.column,operator:i.operator,value:c});else{var u=c.split(",").map(function(e){return e.trim()}).filter(Boolean);a.push({column:s.column,operator:"in",value:u})}else a.push({column:s.column,operator:"ilike",value:"%".concat(c)});else a.push({column:s.column,operator:"ilike",value:"".concat(c,"%")});else a.push({column:s.column,operator:"ilike",value:"%".concat(c,"%")})}else a.push({column:s.column,operator:"is",value:null})}}catch(e){o.e(e)}finally{o.f()}return a}(d,l);e.onChange(t)},disabled:0===d.length},"应用")))}function $f(){var e,n=F(a([]),2),r=n[0],o=n[1],i=F(a(null),2),l=i[0],c=i[1],u=F(a([]),2),d=u[0],f=u[1],m=F(a(!1),2),p=m[0],h=m[1],v=F(a(!1),2),g=v[0],b=v[1],w=F(a(null),2),x=w[0],E=w[1],N=F(a({}),2),k=N[0],S=N[1],C=F(a(1),2),R=C[0],j=C[1],T=F(a(10),2),_=T[0];T[1];var P=F(a(0),2),D=P[0],L=P[1],I=F(a(""),2),z=I[0],B=I[1],q=F(a(!1),2),U=q[0],H=q[1],W=F(a(null),2),V=W[0],$=W[1],K=F(a(!0),2),Y=K[0],J=K[1],G=F(a([]),2),X=G[0],ee=G[1],te=F(a(!1),2),ne=te[0],re=te[1],oe=function(e){return Array.isArray(e)?e:Array.isArray(null==e?void 0:e.models)?e.models:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(null==e?void 0:e.items)?e.items:[]},ie=function(e){var t;if(e&&Array.isArray(e.data)){var n="number"==typeof e.total?e.total:"number"==typeof(null===(t=e.pagination)||void 0===t?void 0:t.total)?e.pagination.total:e.data.length;return{rows:e.data,total:n}}if(e&&Array.isArray(e.rows)){var r="number"==typeof e.total?e.total:e.rows.length;return{rows:e.rows,total:r}}return Array.isArray(e)?{rows:e,total:e.length}:{rows:[],total:0}};s(function(){le()},[]),s(function(){l&&ce()},[l,R,_,z,X]);var le=function(){var e=O(M().m(function e(){var t;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:return J(!0),e.p=1,e.n=2,xu();case 2:t=e.v,o(oe(t.data)),e.n=4;break;case 3:e.p=3,e.v,Ks.error("加载模型列表失败");case 4:return e.p=4,J(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),ce=function(){var e=O(M().m(function e(){var t,n,r;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(l){e.n=1;break}return e.a(2);case 1:return h(!0),e.p=2,t={page:R,limit:_},z&&(t.search=z),X.length>0&&(t.filters=X),e.n=3,Ru(l.table_name,t);case 3:if((n=e.v).success){e.n=4;break}return Ks.error(n.message||"加载数据失败"),f([]),L(0),e.a(2);case 4:r=ie(n.data),f(r.rows),L(r.total),e.n=6;break;case 5:e.p=5,e.v,Ks.error("加载数据失败"),f([]),L(0);case 6:return e.p=6,h(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),ue=function(){var e=O(M().m(function e(t){var n;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return $(t.id),e.p=2,e.n=3,Au(null==l?void 0:l.table_name,t.id);case 3:(n=e.v).success?(Ks.success("删除成功"),ce()):Ks.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Ks.error("删除失败");case 5:return e.p=5,$(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),de=function(){var e=O(M().m(function e(){var t,n,r,a,o;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(l){e.n=1;break}return e.a(2);case 1:if(H(!0),e.p=2,t={},l.json_schema.fields.forEach(function(e){if("id"!==e.name){var n=k[e.name];if("date"!==e.type&&"datetime"!==e.type||(n=n?new Date(n).toISOString():null),"json"===e.type||"jsonb"===e.type){var r=(n||"").toString().trim();if(r){var a=Tf(r);if(!a.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(a.message));n=a.value}else n=null}t[e.name]=n}}),!x){e.n=4;break}return e.n=3,_u(l.table_name,Object.assign(Object.assign({},t),{id:x.id}));case 3:(n=e.v).success?(Ks.success("更新成功"),b(!1),ce()):Ks.error(n.message||"更新失败"),e.n=6;break;case 4:return e.n=5,Tu(l.table_name,t);case 5:(r=e.v).success?(Ks.success("创建成功"),b(!1),ce()):Ks.error(r.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,o=e.v,a=o instanceof Error?o.message:"操作失败",Ks.error(a);case 8:return e.p=8,H(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},t.createElement("div",{className:"space-y-2"},t.createElement("h1",{className:"text-3xl font-bold tracking-tight"},"数据列表"),t.createElement("p",{className:"text-muted-foreground"},"选择模型查看和管理数据")),t.createElement(js,{className:"border-2 shadow-lg"},t.createElement(Ts,{className:"bg-muted/30"},t.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},t.createElement("div",null,t.createElement(_s,null,"数据管理"),t.createElement(As,null,"选择数据模型进行查看和管理")),l&&t.createElement(Dt,{onClick:function(){E(null),S({}),b(!0)},className:"w-full md:w-auto"},t.createElement(fe,{className:"h-4 w-4 mr-2"}),"新建数据"))),t.createElement(Ps,{className:"space-y-6 pt-6"},t.createElement("div",{className:"flex flex-col md:flex-row gap-4"},t.createElement("div",{className:"flex-1 space-y-2"},t.createElement(Rs,{htmlFor:"model",className:"text-base font-medium flex items-center gap-2"},t.createElement(ae,{className:"h-4 w-4"}),"选择数据模型"),t.createElement(Zd,{value:(null===(e=null==l?void 0:l.id)||void 0===e?void 0:e.toString())||"",onValueChange:function(e){var t=r.find(function(t){return t.id.toString()===e});c(t||null),j(1),B(""),ee([])},disabled:Y},t.createElement(ef,{className:"h-11"},Y?t.createElement("div",{className:"flex items-center gap-2"},t.createElement(se,{className:"h-4 w-4 animate-spin"}),t.createElement("span",null,"加载中...")):t.createElement(Qd,{placeholder:"请选择模型"})),t.createElement(rf,null,r.map(function(e){return t.createElement(af,{key:e.id,value:e.id.toString()},e.name," (",e.table_name,")")})))),l&&t.createElement("div",{className:"flex-1 space-y-2"},t.createElement(Rs,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},t.createElement(me,{className:"h-4 w-4"}),"搜索"),t.createElement("div",{className:"relative"},t.createElement(me,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.createElement(Mt,{id:"search",placeholder:"搜索数据...",value:z,onChange:function(e){return B(e.target.value)},className:"pl-10 h-11"})))),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"flex items-center justify-end"},t.createElement(Dt,{type:"button",variant:"outline",className:"h-10",onClick:function(){return re(!0)}},t.createElement(ae,{className:"h-4 w-4 mr-2"}),"筛选",X.length>0?"(".concat(X.length,")"):"")),t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",t.createElement("span",{className:"font-semibold text-foreground"},D)," 条数据"),t.createElement(Uf,{variant:"outline"},l.name)),t.createElement("div",{className:"rounded-lg border overflow-hidden"},t.createElement("div",{className:"overflow-x-auto"},t.createElement(Mf,null,t.createElement(Lf,null,t.createElement(Ff,{className:"bg-muted/50"},t.createElement(zf,{className:"font-semibold w-20"},"ID"),l.json_schema.fields.map(function(e){return t.createElement(zf,{key:e.name,className:"font-semibold"},e.comment||e.name)}),t.createElement(zf,{className:"font-semibold"},"创建时间"),t.createElement(zf,{className:"font-semibold"},"更新时间"),t.createElement(zf,{className:"font-semibold w-32 text-center"},"操作"))),t.createElement(If,null,p?Array.from({length:3}).map(function(e,n){return t.createElement(Ff,{key:n},t.createElement(Bf,{colSpan:l.json_schema.fields.length+4},t.createElement("div",{className:"flex items-center gap-2 py-4"},t.createElement(se,{className:"h-4 w-4 animate-spin text-muted-foreground"}),t.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===d.length?t.createElement(Ff,null,t.createElement(Bf,{colSpan:l.json_schema.fields.length+4,className:"text-center py-12"},t.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},t.createElement(me,{className:"h-8 w-8"}),t.createElement("p",null,"暂无数据")))):d.map(function(e,n){return t.createElement(Ff,{key:e.id,className:n%2==0?"bg-muted/20":""},t.createElement(Bf,{className:"font-mono font-medium"},e.id),l.json_schema.fields.map(function(n){return t.createElement(Bf,{key:n.name},function(e,n){return"boolean"===e.type?t.createElement(Uf,{variant:n?"default":"secondary"},n?"是":"否"):"date"===e.type||"datetime"===e.type?n?y(n).format("YYYY-MM-DD HH:mm:ss"):"-":"text"===e.type&&n&&n.length>50?t.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"..."):"json"===e.type||"jsonb"===e.type?t.createElement(Pf,{value:n,title:e.comment||e.name}):n||"-"}(n,e[n.name]))}),t.createElement(Bf,{className:"text-sm text-muted-foreground"},y(e.created_at).format("YYYY-MM-DD HH:mm")),t.createElement(Bf,{className:"text-sm text-muted-foreground"},y(e.updated_at).format("YYYY-MM-DD HH:mm")),t.createElement(Bf,null,t.createElement("div",{className:"flex items-center justify-center gap-2"},t.createElement(Dt,{variant:"ghost",size:"sm",onClick:function(){return function(e){E(e);var t={};null==l||l.json_schema.fields.forEach(function(n){if("id"!==n.name){var r=e[n.name];"date"!==n.type&&"datetime"!==n.type||(r=r?y(r).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(r=null==r||""===r?"":"string"==typeof r?r:JSON.stringify(r,null,2)),t[n.name]=r}}),S(t),b(!0)}(e)},className:"h-8 w-8 p-0"},t.createElement(he,{className:"h-4 w-4"})),t.createElement(Dt,{variant:"ghost",size:"sm",onClick:function(){return ue(e)},disabled:V===e.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},V===e.id?t.createElement(se,{className:"h-4 w-4 animate-spin"}):t.createElement(ge,{className:"h-4 w-4"})))))}))))),D>_&&t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",t.createElement("span",{className:"font-semibold text-foreground"},R)," 页, 共 ",t.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(D/_))," 页"),t.createElement("div",{className:"flex gap-2"},t.createElement(Dt,{variant:"outline",size:"sm",onClick:function(){return j(Math.max(1,R-1))},disabled:1===R||p},t.createElement(Z,{className:"h-4 w-4 mr-1"}),"上一页"),t.createElement(Dt,{variant:"outline",size:"sm",onClick:function(){return j(Math.min(Math.ceil(D/_),R+1))},disabled:R>=Math.ceil(D/_)||p},"下一页",t.createElement(Q,{className:"h-4 w-4 ml-1"}))))))),l&&t.createElement(wf,{open:ne,onOpenChange:re},t.createElement(kf,{className:"max-w-3xl"},t.createElement(Sf,null,t.createElement(Cf,{className:"text-xl"},"筛选"),t.createElement(Rf,{className:"text-sm"},l.name," - ",l.table_name)),t.createElement("div",{className:"py-2"},t.createElement(Vf,{fields:l.json_schema.fields,value:X,onChange:function(e){ee(e),j(1)}})),t.createElement(Of,{className:"gap-2"},t.createElement(Dt,{variant:"outline",onClick:function(){return re(!1)}},"关闭")))),t.createElement(wf,{open:g,onOpenChange:b},t.createElement(kf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},t.createElement(Sf,null,t.createElement(Cf,{className:"text-2xl"},x?"编辑数据":"新建数据"),t.createElement(Rf,{className:"text-base"},null==l?void 0:l.name," - ",null==l?void 0:l.table_name)),t.createElement("div",{className:"space-y-4 py-4"},null==l?void 0:l.json_schema.fields.map(function(e){return function(e){if("id"===e.name)return null;switch(e.type){case"boolean":return t.createElement("div",{key:e.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},t.createElement(bf,{id:e.name,checked:k[e.name]||!1,onCheckedChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t)))}}),t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium cursor-pointer"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"date",value:k[e.name]||"",onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"datetime":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"datetime-local",value:k[e.name]||"",onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"text":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(yf,{id:e.name,rows:4,value:k[e.name]||"",onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t.target.value)))},required:e.required,className:"resize-none"}));case"json":case"jsonb":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Df,{id:e.name,value:k[e.name]||"",required:e.required,onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t)))}}));case"integer":case"float":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"number",value:k[e.name]||"",onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));default:return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"email"===e.type?"email":"text",maxLength:e.maxLength,value:k[e.name]||"",onChange:function(t){return S(Object.assign(Object.assign({},k),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}))}}(e)})),t.createElement(Of,{className:"gap-2"},t.createElement(Dt,{variant:"outline",onClick:function(){return b(!1)},disabled:U},"取消"),t.createElement(Dt,{onClick:de,disabled:U},U?t.createElement(t.Fragment,null,t.createElement(se,{className:"h-4 w-4 mr-2 animate-spin"}),x?"更新中...":"创建中..."):x?"更新":"创建"))))))}function Kf(e){var n=F(a(e||null),2),r=n[0],o=n[1],i=F(a([]),2),l=i[0],c=i[1],u=F(a(!1),2),d=u[0],f=u[1],m=F(a(!1),2),p=m[0],h=m[1],v=F(a(null),2),g=v[0],b=v[1],w=F(a({}),2),x=w[0],E=w[1],N=F(a(1),2),k=N[0],S=N[1],C=F(a(10),2),R=C[0];C[1];var j=F(a(0),2),T=j[0],_=j[1],P=F(a(""),2),D=P[0],L=P[1],I=F(a(!1),2),z=I[0],B=I[1],q=F(a(null),2),U=q[0],H=q[1],W=F(a({}),2),V=W[0],$=W[1];s(function(){r&&Y()},[r,k,R,D]),s(function(){e&&(o(e),S(1),L(""))},[e]);var K=function(){var e=O(M().m(function e(t){var n,r,a,o,i;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if("relation"===t.type&&t.relation){e.n=1;break}return e.a(2);case 1:if(n=t.relation,r=n.target,a=n.displayField,o="".concat(r,"_").concat(a||"name"),!V[o]){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,ju(r,{displayField:a||"name",limit:200});case 3:(i=e.v).success&&i.data&&$(function(e){return Object.assign(Object.assign({},e),A({},o,i.data))}),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}();s(function(){p&&r&&r.json_schema.fields.filter(function(e){return"relation"===e.type&&e.relation}).forEach(function(e){return K(e)})},[p,r]);var Y=function(){var e=O(M().m(function e(){var t,n,a,o;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:return f(!0),e.p=2,a={page:k,limit:R},D&&(a.search=D),e.n=3,Ru(r.table_name,a);case 3:o=e.v,c((null===(t=o.data)||void 0===t?void 0:t.data)||[]),_((null===(n=o.data)||void 0===n?void 0:n.total)||0),e.n=5;break;case 4:e.p=4,e.v,Ks.error("加载数据失败"),c([]),_(0);case 5:return e.p=5,f(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),J=function(){var e=O(M().m(function e(t){var n;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return H(t.id),e.p=2,e.n=3,Au(null==r?void 0:r.table_name,t.id);case 3:(n=e.v).success?(Ks.success("删除成功"),Y()):Ks.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Ks.error("删除失败");case 5:return e.p=5,H(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),G=function(){var e=O(M().m(function e(){var t,n,a,o;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:if(B(!0),e.p=2,t={},r.json_schema.fields.forEach(function(e){if("id"!==e.name)if("relation"===e.type&&e.relation){var n=e.relation.foreignKey||"".concat(e.relation.target,"_id");t[n]=x[n]}else{var r=x[e.name];"date"!==e.type&&"datetime"!==e.type||(r=r?new Date(r).toISOString():null),t[e.name]=r}}),!g){e.n=4;break}return n=Object.assign(Object.assign({},t),{id:g.id}),e.n=3,_u(r.table_name,n);case 3:(a=e.v).success?(Ks.success("更新成功"),h(!1),Y()):Ks.error(a.message||"更新失败"),e.n=6;break;case 4:return e.n=5,Tu(r.table_name,t);case 5:(o=e.v).success?(Ks.success("创建成功"),h(!1),Y()):Ks.error(o.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,e.v,Ks.error("操作失败");case 8:return e.p=8,B(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return r?t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},t.createElement("div",{className:"space-y-2"},t.createElement("div",{className:"flex items-center gap-3"},t.createElement("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10 text-primary"},t.createElement(ne,{className:"h-5 w-5"})),t.createElement("div",null,t.createElement("h1",{className:"text-3xl font-bold tracking-tight"},r.name),t.createElement("p",{className:"text-muted-foreground"},"表名: ",r.table_name)))),t.createElement(js,{className:"border-2 shadow-lg"},t.createElement(Ts,{className:"bg-muted/30"},t.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},t.createElement("div",null,t.createElement(_s,null,"数据管理"),t.createElement(As,null,"查看和管理 ",r.name," 的数据")),t.createElement(Dt,{onClick:function(){b(null),E({}),h(!0)},className:"w-full md:w-auto"},t.createElement(fe,{className:"h-4 w-4 mr-2"}),"新建数据"))),t.createElement(Ps,{className:"space-y-6 pt-6"},t.createElement("div",{className:"space-y-2"},t.createElement(Rs,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},t.createElement(me,{className:"h-4 w-4"}),"搜索"),t.createElement("div",{className:"relative"},t.createElement(me,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.createElement(Mt,{id:"search",placeholder:"搜索数据...",value:D,onChange:function(e){return L(e.target.value)},className:"pl-10 h-11"}))),t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",t.createElement("span",{className:"font-semibold text-foreground"},T)," 条数据"),t.createElement(Uf,{variant:"outline"},r.name)),t.createElement("div",{className:"rounded-lg border overflow-hidden"},t.createElement("div",{className:"overflow-x-auto"},t.createElement(Mf,null,t.createElement(Lf,null,t.createElement(Ff,{className:"bg-muted/50"},t.createElement(zf,{className:"font-semibold w-20"},"ID"),r.json_schema.fields.map(function(e){return t.createElement(zf,{key:e.name,className:"font-semibold"},e.comment||e.name)}),t.createElement(zf,{className:"font-semibold"},"创建时间"),t.createElement(zf,{className:"font-semibold"},"更新时间"),t.createElement(zf,{className:"font-semibold w-32 text-center"},"操作"))),t.createElement(If,null,d?Array.from({length:3}).map(function(e,n){return t.createElement(Ff,{key:n},t.createElement(Bf,{colSpan:r.json_schema.fields.length+4},t.createElement("div",{className:"flex items-center gap-2 py-4"},t.createElement(se,{className:"h-4 w-4 animate-spin text-muted-foreground"}),t.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===l.length?t.createElement(Ff,null,t.createElement(Bf,{colSpan:r.json_schema.fields.length+4,className:"text-center py-12"},t.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},t.createElement(me,{className:"h-8 w-8"}),t.createElement("p",null,"暂无数据")))):l.map(function(e,n){return t.createElement(Ff,{key:e.id,className:n%2==0?"bg-muted/20":""},t.createElement(Bf,{className:"font-mono font-medium"},e.id),r.json_schema.fields.map(function(n){return t.createElement(Bf,{key:n.name},function(e,n,r){if("boolean"===e.type)return t.createElement(Uf,{variant:n?"default":"secondary"},n?"是":"否");if("date"===e.type||"datetime"===e.type)return n?y(n).format("YYYY-MM-DD HH:mm:ss"):"-";if("text"===e.type&&n&&n.length>50)return t.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"...");if("relation"===e.type&&e.relation&&r){var a=e.relation.displayField,o=void 0===a?"name":a,i=r["".concat(e.name,"_data")];if(i)return t.createElement(Uf,{variant:"outline"},i[o]||"ID: ".concat(i.id));var s=r[e.relation.foreignKey||"".concat(e.relation.target,"_id")];return s?"ID: ".concat(s):"-"}return n||"-"}(n,e[n.name],e))}),t.createElement(Bf,{className:"text-sm text-muted-foreground"},y(e.created_at).format("YYYY-MM-DD HH:mm")),t.createElement(Bf,{className:"text-sm text-muted-foreground"},y(e.updated_at).format("YYYY-MM-DD HH:mm")),t.createElement(Bf,null,t.createElement("div",{className:"flex items-center justify-center gap-2"},t.createElement(Dt,{variant:"ghost",size:"sm",onClick:function(){return function(e){b(e);var t={};null==r||r.json_schema.fields.forEach(function(n){if("id"!==n.name)if("relation"===n.type&&n.relation){var r=n.relation.foreignKey||"".concat(n.relation.target,"_id");t[r]=e[r]}else{var a=e[n.name];"date"!==n.type&&"datetime"!==n.type||(a=a?y(a).format("YYYY-MM-DDTHH:mm"):""),t[n.name]=a}}),E(t),h(!0)}(e)},className:"h-8 w-8 p-0"},t.createElement(he,{className:"h-4 w-4"})),t.createElement(Dt,{variant:"ghost",size:"sm",onClick:function(){return J(e)},disabled:U===e.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},U===e.id?t.createElement(se,{className:"h-4 w-4 animate-spin"}):t.createElement(ge,{className:"h-4 w-4"})))))}))))),T>R&&t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",t.createElement("span",{className:"font-semibold text-foreground"},k)," 页, 共 ",t.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(T/R))," 页"),t.createElement("div",{className:"flex gap-2"},t.createElement(Dt,{variant:"outline",size:"sm",onClick:function(){return S(Math.max(1,k-1))},disabled:1===k||d},t.createElement(Z,{className:"h-4 w-4 mr-1"}),"上一页"),t.createElement(Dt,{variant:"outline",size:"sm",onClick:function(){return S(Math.min(Math.ceil(T/R),k+1))},disabled:k>=Math.ceil(T/R)||d},"下一页",t.createElement(Q,{className:"h-4 w-4 ml-1"})))))),t.createElement(wf,{open:p,onOpenChange:h},t.createElement(kf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},t.createElement(Sf,null,t.createElement(Cf,{className:"text-2xl"},g?"编辑数据":"新建数据"),t.createElement(Rf,{className:"text-base"},r.name," - ",r.table_name)),t.createElement("div",{className:"space-y-4 py-4"},r.json_schema.fields.map(function(e){return function(e){if("id"===e.name)return null;switch(e.type){case"boolean":return t.createElement("div",{key:e.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},t.createElement(bf,{id:e.name,checked:x[e.name]||!1,onCheckedChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t)))}}),t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium cursor-pointer"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"date",value:x[e.name]||"",onChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"datetime":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"datetime-local",value:x[e.name]||"",onChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"text":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(yf,{id:e.name,rows:4,value:x[e.name]||"",onChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t.target.value)))},required:e.required,className:"resize-none"}));case"integer":case"float":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"number",value:x[e.name]||"",onChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"relation":if(!e.relation)return null;var n=e.relation,r=n.target,a=n.displayField,o=void 0===a?"name":a,i="".concat(r,"_").concat(o),s=V[i]||[],l=e.relation.foreignKey||"".concat(r,"_id"),c=void 0!==x[l]&&null!==x[l]?String(x[l]):"",u=s.find(function(e){return String(e.id)===c});return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Zd,{value:c,onValueChange:function(e){var t=parseInt(e,10),n=!isNaN(t)&&String(t)===e;E(Object.assign(Object.assign({},x),A({},l,n?t:e)))}},t.createElement(ef,{className:"h-11"},t.createElement(Qd,{placeholder:"请选择".concat(e.comment||e.name)},u?u.label:c?"ID: ".concat(c):"请选择".concat(e.comment||e.name))),t.createElement(rf,null,0===s.length?t.createElement(af,{value:"_loading",disabled:!0},"加载中..."):s.map(function(e){return t.createElement(af,{key:e.id,value:String(e.id)},e.label)}))));default:return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Rs,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Mt,{id:e.name,type:"email"===e.type?"email":"text",maxLength:e.maxLength,value:x[e.name]||"",onChange:function(t){return E(Object.assign(Object.assign({},x),A({},e.name,t.target.value)))},required:e.required,className:"h-11"}))}}(e)})),t.createElement(Of,{className:"gap-2"},t.createElement(Dt,{variant:"outline",onClick:function(){return h(!1)},disabled:z},"取消"),t.createElement(Dt,{onClick:G,disabled:z},z?t.createElement(t.Fragment,null,t.createElement(se,{className:"h-4 w-4 mr-2 animate-spin"}),g?"更新中...":"创建中..."):g?"更新":"创建")))))):t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-8"},t.createElement(js,{className:"border-2"},t.createElement(Ps,{className:"py-16 text-center"},t.createElement(ne,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),t.createElement("p",{className:"text-lg text-muted-foreground"},"请选择数据模型")))))}function Yf(e){return e.models.map(function(e){return{path:"/data/list-".concat(e.id),name:e.name,icon:t.createElement(ve),component:function(){return n=e,t.createElement(Kf,Object.assign({},n));var n}}})}var Jf=function(e){return[{path:"/login",name:"登录",icon:t.createElement(ce),component:Pu},{name:"数据管理",icon:t.createElement(te),path:"/data",component:$f,routes:z(Yf(e))}]},Gf=pe,Xf=be,Zf=ue;function Qf(e){var n=e.inputModels,r=e.skipAuth,o=void 0!==r&&r,i=F(a("/data"),2),l=i[0],c=i[1],u=F(a([]),2);u[0],u[1];var d=F(a(!1),2),f=d[0],m=d[1],p=F(a(null),2),h=p[0],v=p[1],g=F(a(!0),2),b=g[0],y=g[1];s(function(){if(o)return m(!0),v(null),y(!1),void("/login"===l&&c("/data"));var e=function(){var e=O(M().m(function e(){var t,n;return M().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,Ou()){e.n=1;break}return m(!1),c("/login"),y(!1),e.a(2);case 1:return e.p=1,e.n=2,Nu();case 2:if(e.v.success){e.n=3;break}throw new Error("token验证失败");case 3:if(!(t=Cu())){e.n=4;break}v(t),e.n=6;break;case 4:return e.n=5,ku();case 5:(n=e.v).success&&n.data&&(v(n.data),localStorage.setItem("cms_user",JSON.stringify(n.data)));case 6:m(!0),"/login"===l&&c("/data"),e.n=8;break;case 7:e.p=7,e.v,Su(),m(!1),v(null),c("/login");case 8:e.n=10;break;case 9:e.p=9,e.v,m(!1),v(null),c("/login");case 10:return e.p=10,y(!1),e.f(10);case 11:return e.a(2)}},e,null,[[1,7],[0,9,10,11]])}));return function(){return e.apply(this,arguments)}}();e()},[o]);var w=function(e,t){v(t),m(!0),c("/data"),Ks.success("欢迎回来,".concat(t.username,"!"))},x=function(e,t){var n,r=_(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.path===t)return a;if(a.routes){var o=x(a.routes,t);if(o)return o}}}catch(e){r.e(e)}finally{r.f()}return null};if(b)return t.createElement("div",{className:"flex min-h-screen items-center justify-center bg-background"},t.createElement("div",{className:"space-y-4"},t.createElement(bt,{className:"h-12 w-48"}),t.createElement(bt,{className:"h-4 w-64"})));if(!f)return t.createElement(Pu,{onLoginSuccess:w});var E=Jf(n).filter(function(e){return"/login"!==e.path}),N=function(e){if(!e)return ne;if(t.isValidElement(e)){var n=e.type;if(n&&"function"==typeof n){var r=n.name||"";if(r.includes("Home"))return oe;if(r.includes("Table"))return ve;if(r.includes("Database"))return ne;if(r.includes("File"))return re}}return ne},k=E.flatMap(function(e){return e.routes&&e.routes.length>0?e.routes.map(function(e){return{title:e.name,icon:N(e.icon),path:e.path}}):[{title:e.name,icon:N(e.icon),path:e.path}]});return t.createElement(ds,null,t.createElement(fs,{variant:"inset"},t.createElement(hs,{className:"border-b border-sidebar-border"},t.createElement("div",{className:"flex items-center gap-2 px-2 py-1"},t.createElement("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-primary"},t.createElement(Gf,{className:"w-4 h-4 text-primary-foreground"})),t.createElement("span",{className:"font-semibold text-lg"},"WE0-CMS"))),t.createElement(gs,null,t.createElement(bs,null,t.createElement(ys,null,"Navigation"),t.createElement(ws,null,t.createElement(xs,null,k.map(function(e){return t.createElement(Es,{key:e.path},t.createElement(ks,{onClick:function(){return c(e.path)},isActive:(n=e.path,l===n||l.startsWith(n+"/")),tooltip:e.title},t.createElement(e.icon,{className:"w-4 h-4"}),t.createElement("span",null,e.title)));var n}))))),t.createElement(vs,{className:"border-t border-sidebar-border"},t.createElement(xs,null,!o&&h&&t.createElement(t.Fragment,null,t.createElement(Es,null,t.createElement(ks,{tooltip:h.username||"User"},t.createElement(Xf,{className:"w-4 h-4"}),t.createElement("span",{className:"truncate"},h.username))),t.createElement(Es,null,t.createElement(ks,{onClick:function(){window.confirm("确定要登出系统吗?")&&(Su(),localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),m(!1),v(null),c("/login"),Ks.success("已成功登出"))},tooltip:"Logout"},t.createElement(Zf,{className:"w-4 h-4"}),t.createElement("span",null,"Logout"))))))),t.createElement(ps,null,t.createElement("header",{className:"flex h-14 items-center gap-4 border-b bg-background px-6"},t.createElement(ms,null),t.createElement("h1",{className:"text-lg font-semibold"},function(){if("/login"===l)return"Login";var e=x(Jf(n),l);return(null==e?void 0:e.name)||"数据管理"}())),t.createElement("main",{className:"flex-1 p-6"},function(){if(!o&&"/login"===l)return t.createElement(Pu,{onLoginSuccess:w});if(o&&"/login"===l)return t.createElement($f,null);var e=x(Jf(n),l);if(e){var r=e.component;return t.createElement(r,null)}return t.createElement($f,null)}())))}export{Qf as CmsLayoutShadcn,Jf as cmsRoutes,Qf as default,wu as setSessionId};
9
+ */var A={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
10
+ /**
11
+ * @license lucide-react v0.344.0 - ISC
12
+ *
13
+ * This source code is licensed under the ISC license.
14
+ * See the LICENSE file in the root directory of this source tree.
15
+ */const T=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),M=(e,t)=>{const i=n(({color:n="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:a="",children:l,...c},h)=>r("svg",{ref:h,...A,width:i,height:i,stroke:n,strokeWidth:s?24*Number(o)/Number(i):o,className:["lucide",`lucide-${T(e)}`,a].join(" "),...c},[...t.map(([e,t])=>r(e,t)),...Array.isArray(l)?l:[l]]));return i.displayName=`${e}`,i},R=M("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),D=M("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),P=M("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),L=M("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),B=M("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),I=M("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),_=M("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),j=M("Crown",[["path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14",key:"zkxr6b"}]]),F=M("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),W=M("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),z=M("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),H=M("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),V=M("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),q=M("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),U=M("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),$=M("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),K=M("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),Y=M("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),G=M("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),X=M("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),J=M("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Q=M("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]),Z=M("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),ee=M("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),te=M("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),ne=M("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),re=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var ie=function(){return ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ie.apply(this,arguments)};function oe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function se(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=se(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ae(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=se(e))&&(r&&(r+=" "),r+=t);return r}"function"==typeof SuppressedError&&SuppressedError;const le=e=>{const t=de(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),ce(n,t)||ue(e)},getConflictingClassGroupIds:(e,t)=>{const i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},ce=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?ce(e.slice(1),r):void 0;if(i)return i;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},he=/^\[(.+)\]$/,ue=e=>{if(he.test(e)){const t=he.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},de=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return ge(Object.entries(e.classGroups),n).forEach(([e,n])=>{fe(n,r,e,t)}),r},fe=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:pe(t,e)).classGroupId=n)}if("function"==typeof e)return me(e)?void fe(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,i])=>{fe(i,pe(t,e),n,r)})})},pe=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},me=e=>e.isThemeGetter,ge=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,ve=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(i(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},be=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,i=t[0],o=t.length,s=e=>{const n=[];let s,a=0,l=0;for(let c=0;c<e.length;c++){let h=e[c];if(0===a){if(h===i&&(r||e.slice(c,c+o)===t)){n.push(e.slice(l,c)),l=c+o;continue}if("/"===h){s=c;continue}}"["===h?a++:"]"===h&&a--}const c=0===n.length?e:e.substring(l),h=c.startsWith("!");return{modifiers:n,hasImportantModifier:h,baseClassName:h?c.substring(1):c,maybePostfixModifierPosition:s&&s>l?s-l:void 0}};return n?e=>n({className:e,parseClassName:s}):s},ye=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},we=/\s+/;function xe(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ke(e))&&(r&&(r+=" "),r+=t);return r}const ke=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=ke(e[r]))&&(n&&(n+=" "),n+=t);return n};function Se(e,...t){let n,r,i,o=function(a){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:ve(e.cacheSize),parseClassName:be(e),...le(e)}))(l),r=n.cache.get,i=n.cache.set,o=s,s(a)};function s(e){const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(we);let a="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{modifiers:l,hasImportantModifier:c,baseClassName:h,maybePostfixModifierPosition:u}=n(t);let d=Boolean(u),f=r(d?h.substring(0,u):h);if(!f){if(!d){a=t+(a.length>0?" "+a:a);continue}if(f=r(h),!f){a=t+(a.length>0?" "+a:a);continue}d=!1}const p=ye(l).join(":"),m=c?p+"!":p,g=m+f;if(o.includes(g))continue;o.push(g);const v=i(f,d);for(let e=0;e<v.length;++e){const t=v[e];o.push(m+t)}a=t+(a.length>0?" "+a:a)}return a})(e,n);return i(e,o),o}return function(){return o(xe.apply(null,arguments))}}const Ee=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Ce=/^\[(?:([a-z-]+):)?(.+)\]$/i,Oe=/^\d+\/\d+$/,Ne=new Set(["px","full","screen"]),Ae=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Te=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Me=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Re=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,De=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pe=e=>Be(e)||Ne.has(e)||Oe.test(e),Le=e=>Ye(e,"length",Ge),Be=e=>Boolean(e)&&!Number.isNaN(Number(e)),Ie=e=>Ye(e,"number",Be),_e=e=>Boolean(e)&&Number.isInteger(Number(e)),je=e=>e.endsWith("%")&&Be(e.slice(0,-1)),Fe=e=>Ce.test(e),We=e=>Ae.test(e),ze=new Set(["length","size","percentage"]),He=e=>Ye(e,ze,Xe),Ve=e=>Ye(e,"position",Xe),qe=new Set(["image","url"]),Ue=e=>Ye(e,qe,Qe),$e=e=>Ye(e,"",Je),Ke=()=>!0,Ye=(e,t,n)=>{const r=Ce.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},Ge=e=>Te.test(e)&&!Me.test(e),Xe=()=>!1,Je=e=>Re.test(e),Qe=e=>De.test(e),Ze=Se(()=>{const e=Ee("colors"),t=Ee("spacing"),n=Ee("blur"),r=Ee("brightness"),i=Ee("borderColor"),o=Ee("borderRadius"),s=Ee("borderSpacing"),a=Ee("borderWidth"),l=Ee("contrast"),c=Ee("grayscale"),h=Ee("hueRotate"),u=Ee("invert"),d=Ee("gap"),f=Ee("gradientColorStops"),p=Ee("gradientColorStopPositions"),m=Ee("inset"),g=Ee("margin"),v=Ee("opacity"),b=Ee("padding"),y=Ee("saturate"),w=Ee("scale"),x=Ee("sepia"),k=Ee("skew"),S=Ee("space"),E=Ee("translate"),C=()=>["auto",Fe,t],O=()=>[Fe,t],N=()=>["",Pe,Le],A=()=>["auto",Be,Fe],T=()=>["","0",Fe],M=()=>[Be,Fe];return{cacheSize:500,separator:":",theme:{colors:[Ke],spacing:[Pe,Le],blur:["none","",We,Fe],brightness:M(),borderColor:[e],borderRadius:["none","","full",We,Fe],borderSpacing:O(),borderWidth:N(),contrast:M(),grayscale:T(),hueRotate:M(),invert:T(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[je,Le],inset:C(),margin:C(),opacity:M(),padding:O(),saturate:M(),scale:M(),sepia:T(),skew:M(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Fe]}],container:["container"],columns:[{columns:[We]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Fe]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",_e,Fe]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Fe]}],grow:[{grow:T()}],shrink:[{shrink:T()}],order:[{order:["first","last","none",_e,Fe]}],"grid-cols":[{"grid-cols":[Ke]}],"col-start-end":[{col:["auto",{span:["full",_e,Fe]},Fe]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Ke]}],"row-start-end":[{row:["auto",{span:[_e,Fe]},Fe]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Fe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Fe]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Fe,t]}],"min-w":[{"min-w":[Fe,t,"min","max","fit"]}],"max-w":[{"max-w":[Fe,t,"none","full","min","max","fit","prose",{screen:[We]},We]}],h:[{h:[Fe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Fe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",We,Le]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ie]}],"font-family":[{font:[Ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Fe]}],"line-clamp":[{"line-clamp":["none",Be,Ie]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pe,Fe]}],"list-image":[{"list-image":["none",Fe]}],"list-style-type":[{list:["none","disc","decimal",Fe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pe,Le]}],"underline-offset":[{"underline-offset":["auto",Pe,Fe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Ve]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",He]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ue]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[Pe,Fe]}],"outline-w":[{outline:[Pe,Le]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Pe,Le]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",We,$e]}],"shadow-color":[{shadow:[Ke]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",We,Fe]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[u]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Fe]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Fe]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Fe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[_e,Fe]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Fe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Fe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Pe,Le,Ie]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function et(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ze(ae(t))}function tt(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("animate-pulse rounded-md bg-muted",n)},r))}function nt(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function rt(...e){return t=>{let n=!1;const r=e.map(e=>{const r=nt(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():nt(e[t],null)}}}}function it(...t){return e.useCallback(rt(...t),t)}var ot=Symbol.for("react.lazy"),st=e[" use ".trim().toString()];function at(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ot&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function lt(t){const n=ht(t),r=e.forwardRef((t,r)=>{let{children:i,...o}=t;at(i)&&"function"==typeof st&&(i=st(i._payload));const s=e.Children.toArray(i),a=s.find(dt);if(a){const t=a.props.children,i=s.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return u(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return u(n,{...o,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}var ct=lt("Slot");function ht(t){const n=e.forwardRef((t,n)=>{let{children:r,...i}=t;if(at(r)&&"function"==typeof st&&(r=st(r._payload)),e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==e.Fragment&&(o.ref=n?rt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var ut=Symbol("radix.slottable");function dt(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===ut}const ft=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,pt=ae,mt=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return pt(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(e=>{const t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;const s=ft(t)||ft(r);return i[e][s]}),a=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...a}[t]):{...o,...a}[t]===n})?[...e,n,r]:e},[]);return pt(e,s,l,null==n?void 0:n.class,null==n?void 0:n.className)};var gt=mt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),vt=e.forwardRef(function(t,n){var r=t.className,i=t.variant,o=t.size,s=t.asChild,a=void 0!==s&&s,l=oe(t,["className","variant","size","asChild"]),c=a?ct:"button";return e.createElement(c,Object.assign({className:et(gt({variant:i,size:o,className:r})),ref:n},l))});vt.displayName="Button";var bt=e.forwardRef(function(t,n){var r=t.className,i=t.type,o=oe(t,["className","type"]);return e.createElement("input",Object.assign({type:i,className:et("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:n},o))});bt.displayName="Input";var yt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=lt(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),wt="horizontal",xt=["horizontal","vertical"],kt=e.forwardRef((e,t)=>{const{decorative:n,orientation:r=wt,...i}=e,o=function(e){return xt.includes(e)}(r)?r:wt,s=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return u(yt.div,{"data-orientation":o,...s,...i,ref:t})});kt.displayName="Separator";var St=kt,Et=e.forwardRef(function(t,n){var r=t.className,i=t.orientation,o=void 0===i?"horizontal":i,s=t.decorative,a=void 0===s||s,l=oe(t,["className","orientation","decorative"]);return e.createElement(St,Object.assign({ref:n,decorative:a,orientation:o,className:et("shrink-0 bg-border","horizontal"===o?"h-[1px] w-full":"h-full w-[1px]",r)},l))});function Ct(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Ot(t,n=[]){let r=[];const i=()=>{const n=r.map(t=>e.createContext(t));return function(r){const i=r?.[t]||n;return e.useMemo(()=>({[`__scope${t}`]:{...r,[t]:i}}),[r,i])}};return i.scopeName=t,[function(n,i){const o=e.createContext(i),s=r.length;r=[...r,i];const a=n=>{const{scope:r,children:i,...a}=n,l=r?.[t]?.[s]||o,c=e.useMemo(()=>a,Object.values(a));return u(l.Provider,{value:c,children:i})};return a.displayName=n+"Provider",[a,function(r,a){const l=a?.[t]?.[s]||o,c=e.useContext(l);if(c)return c;if(void 0!==i)return i;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},Nt(i,...n)]}function Nt(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const i=r.reduce((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]}),{});return e.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return r.scopeName=n.scopeName,r}Et.displayName=St.displayName;var At=globalThis?.document?e.useLayoutEffect:()=>{},Tt=e[" useId ".trim().toString()]||(()=>{}),Mt=0;function Rt(t){const[n,r]=e.useState(Tt());return At(()=>{t||r(e=>e??String(Mt++))},[t]),t||(n?`radix-${n}`:"")}var Dt=e[" useInsertionEffect ".trim().toString()]||At;function Pt({prop:t,defaultProp:n,onChange:r=()=>{},caller:i}){const[o,s,a]=function({defaultProp:t,onChange:n}){const[r,i]=e.useState(t),o=e.useRef(r),s=e.useRef(n);return Dt(()=>{s.current=n},[n]),e.useEffect(()=>{o.current!==r&&(s.current?.(r),o.current=r)},[r,o]),[r,i,s]}({defaultProp:n,onChange:r}),l=void 0!==t,c=l?t:o;{const n=e.useRef(void 0!==t);e.useEffect(()=>{const e=n.current;if(e!==l){}n.current=l},[l,i])}const h=e.useCallback(e=>{if(l){const n=function(e){return"function"==typeof e}(e)?e(t):e;n!==t&&a.current?.(n)}else s(e)},[l,t,s,a]);return[c,h]}function Lt(t){const n=Bt(t),r=e.forwardRef((t,r)=>{const{children:i,...o}=t,s=e.Children.toArray(i),a=s.find(_t);if(a){const t=a.props.children,i=s.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return u(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return u(n,{...o,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}function Bt(t){const n=e.forwardRef((t,n)=>{const{children:r,...i}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==e.Fragment&&(o.ref=n?rt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var It=Symbol("radix.slottable");function _t(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===It}var jt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=Lt(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{});function Ft(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>n.current?.(...e),[])}function Wt(t,n=globalThis?.document){const r=Ft(t);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})},[r,n])}var zt,Ht="dismissableLayer.update",Vt="dismissableLayer.pointerDownOutside",qt="dismissableLayer.focusOutside",Ut=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$t=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=t,h=e.useContext(Ut),[d,f]=e.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=e.useState({}),g=it(n,e=>f(e)),v=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=h.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1),o=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){let t=function(){Yt(Vt,r,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=t,n.addEventListener("click",o.current,{once:!0})):t()}else n.removeEventListener("click",o.current);i.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}},[n,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{const t=e.target,n=[...h.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),a?.(e),e.defaultPrevented||l?.())},p),E=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){Yt(qt,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{const t=e.target;[...h.branches].some(e=>e.contains(t))||(s?.(e),a?.(e),e.defaultPrevented||l?.())},p);return Wt(e=>{w===h.layers.size-1&&(i?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},p),e.useEffect(()=>{if(d)return r&&(0===h.layersWithOutsidePointerEventsDisabled.size&&(zt=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(d)),h.layers.add(d),Kt(),()=>{r&&1===h.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=zt)}},[d,p,r,h]),e.useEffect(()=>()=>{d&&(h.layers.delete(d),h.layersWithOutsidePointerEventsDisabled.delete(d),Kt())},[d,h]),e.useEffect(()=>{const e=()=>m({});return document.addEventListener(Ht,e),()=>document.removeEventListener(Ht,e)},[]),u(jt.div,{...c,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...t.style},onFocusCapture:Ct(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Ct(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ct(t.onPointerDownCapture,S.onPointerDownCapture)})});$t.displayName="DismissableLayer";function Kt(){const e=new CustomEvent(Ht);document.dispatchEvent(e)}function Yt(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&p.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}e.forwardRef((t,n)=>{const r=e.useContext(Ut),i=e.useRef(null),o=it(n,i);return e.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),u(jt.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var Gt="focusScope.autoFocusOnMount",Xt="focusScope.autoFocusOnUnmount",Jt={bubbles:!1,cancelable:!0},Qt=e.forwardRef((t,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=t,[l,c]=e.useState(null),h=Ft(o),d=Ft(s),f=e.useRef(null),p=it(n,e=>c(e)),m=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect(()=>{if(i){let e=function(e){if(m.paused||!l)return;const t=e.target;l.contains(t)?f.current=t:nn(f.current,{select:!0})},t=function(e){if(m.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||nn(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&nn(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[i,l,m.paused]),e.useEffect(()=>{if(l){rn.add(m);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(Gt,Jt);l.addEventListener(Gt,h),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(nn(r,{select:t}),document.activeElement!==n)return}((e=Zt(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&nn(l))}return()=>{l.removeEventListener(Gt,h),setTimeout(()=>{const e=new CustomEvent(Xt,Jt);l.addEventListener(Xt,d),l.dispatchEvent(e),e.defaultPrevented||nn(t??document.body,{select:!0}),l.removeEventListener(Xt,d),rn.remove(m)},0)}}var e},[l,h,d,m]);const g=e.useCallback(e=>{if(!r&&!i)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Zt(e),n=en(t,e),r=en(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&nn(o,{select:!0})):(e.preventDefault(),r&&nn(i,{select:!0})):n===t&&e.preventDefault()}},[r,i,m.paused]);return u(jt.div,{tabIndex:-1,...a,ref:p,onKeyDown:g})});function Zt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function en(e,t){for(const n of e)if(!tn(n,{upTo:t}))return n}function tn(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function nn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Qt.displayName="FocusScope";var rn=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=on(e,t),e.unshift(t)},remove(t){e=on(e,t),e[0]?.resume()}}}();function on(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var sn=e.forwardRef((t,n)=>{const{container:r,...i}=t,[o,s]=e.useState(!1);At(()=>s(!0),[]);const a=r||o&&globalThis?.document?.body;return a?m.createPortal(u(jt.div,{...i,ref:n}),a):null});sn.displayName="Portal";var an=t=>{const{present:n,children:r}=t,i=function(t){const[n,r]=e.useState(),i=e.useRef(null),o=e.useRef(t),s=e.useRef("none"),a=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=ln(i.current);s.current="mounted"===l?e:"none"},[l]),At(()=>{const e=i.current,n=o.current;if(n!==t){const r=s.current,i=ln(e);if(t)c("MOUNT");else if("none"===i||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=t}},[t,c]),At(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const s=ln(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&s&&(c("ANIMATION_END"),!o.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=ln(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{i.current=e?getComputedStyle(e):null,r(e)},[])}}(n),o="function"==typeof r?r({present:i.isPresent}):e.Children.only(r),s=it(i.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||i.isPresent?e.cloneElement(o,{ref:s}):null};function ln(e){return e?.animationName||"none"}an.displayName="Presence";var cn=0;function hn(){e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??un()),document.body.insertAdjacentElement("beforeend",e[1]??un()),cn++,()=>{1===cn&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cn--}},[])}function un(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dn="right-scroll-bar-position",fn="width-before-scroll-bar";function pn(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var mn="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,gn=new WeakMap;function vn(e,t){var n,r,o,s=(n=t||null,r=function(t){return e.forEach(function(e){return pn(e,t)})},(o=i(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return mn(function(){var t=gn.get(s);if(t){var n=new Set(t),r=new Set(e),i=s.current;n.forEach(function(e){r.has(e)||pn(e,null)}),r.forEach(function(e){n.has(e)||pn(e,i)})}gn.set(s,e)},[e]),s}function bn(e){return e}var yn=function(t){var n=t.sideCar,r=oe(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return e.createElement(i,ie({},r))};yn.isSideCarExport=!0;var wn=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=bn);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=ie({async:!0,ssr:!1},e),t}(),xn=function(){},kn=e.forwardRef(function(t,n){var r=e.useRef(null),i=e.useState({onScrollCapture:xn,onWheelCapture:xn,onTouchMoveCapture:xn}),o=i[0],s=i[1],a=t.forwardProps,l=t.children,c=t.className,h=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,p=t.noRelative,m=t.noIsolation,g=t.inert,v=t.allowPinchZoom,b=t.as,y=void 0===b?"div":b,w=t.gapMode,x=oe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,S=vn([r,n]),E=ie(ie({},x),o);return e.createElement(e.Fragment,null,u&&e.createElement(k,{sideCar:wn,removeScrollBar:h,shards:d,noRelative:p,noIsolation:m,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:w}),a?e.cloneElement(e.Children.only(l),ie(ie({},E),{ref:S})):e.createElement(y,ie({},E,{className:c,ref:S}),l))});kn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},kn.classNames={fullWidth:fn,zeroRight:dn};function Sn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var En=function(){var e=0,t=null;return{add:function(n){var r,i;0==e&&(t=Sn())&&(i=n,(r=t).styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Cn=function(){var t,n=(t=En(),function(n,r){e.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},On={left:0,top:0,right:0,gap:0},Nn=function(e){return parseInt(e||"",10)||0},An=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return On;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[Nn(n),Nn(r),Nn(i)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Tn=Cn(),Mn="data-scroll-locked",Rn=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(Mn,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(dn," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(fn," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(dn," .").concat(dn," {\n right: 0 ").concat(r,";\n }\n \n .").concat(fn," .").concat(fn," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Mn,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},Dn=function(){var e=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(e)?e:0},Pn=function(t){var n=t.noRelative,r=t.noImportant,i=t.gapMode,o=void 0===i?"margin":i;e.useEffect(function(){return document.body.setAttribute(Mn,(Dn()+1).toString()),function(){var e=Dn()-1;e<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,e.toString())}},[]);var s=e.useMemo(function(){return An(o)},[o]);return e.createElement(Tn,{styles:Rn(s,!n,o,r?"":"!important")})},Ln=!1;if("undefined"!=typeof window)try{var Bn=Object.defineProperty({},"passive",{get:function(){return Ln=!0,!0}});window.addEventListener("test",Bn,Bn),window.removeEventListener("test",Bn,Bn)}catch(e){Ln=!1}var In=!!Ln&&{passive:!1},_n=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},jn=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Fn(e,r)){var i=Wn(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fn=function(e,t){return"v"===e?function(e){return _n(e,"overflowY")}(t):function(e){return _n(e,"overflowX")}(t)},Wn=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},zn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hn=function(e){return[e.deltaX,e.deltaY]},Vn=function(e){return e&&"current"in e?e.current:e},qn=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Un=0,$n=[];function Kn(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Yn,Gn=(Yn=function(t){var n=e.useRef([]),r=e.useRef([0,0]),i=e.useRef(),o=e.useState(Un++)[0],s=e.useState(Cn)[0],a=e.useRef(t);e.useEffect(function(){a.current=t},[t]),e.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var e=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([t.lockRef.current],(t.shards||[]).map(Vn),!0).filter(Boolean);return e.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),e.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!a.current.allowPinchZoom;var n,o=zn(e),s=r.current,l="deltaX"in e?e.deltaX:s[0]-o[0],c="deltaY"in e?e.deltaY:s[1]-o[1],h=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===h.type)return!1;var d=window.getSelection(),f=d&&d.anchorNode;if(f&&(f===h||f.contains(h)))return!1;var p=jn(u,h);if(!p)return!0;if(p?n=u:(n="v"===u?"h":"v",p=jn(u,h)),!p)return!1;if(!i.current&&"changedTouches"in e&&(l||c)&&(i.current=n),!n)return!0;var m=i.current||n;return function(e,t,n,r,i){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),c=!1,h=s>0,u=0,d=0;do{if(!a)break;var f=Wn(e,a),p=f[0],m=f[1]-f[2]-o*p;(p||m)&&Fn(e,a)&&(u+=m,d+=p);var g=a.parentNode;a=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(h&&(i&&Math.abs(u)<1||!i&&s>u)||!h&&(i&&Math.abs(d)<1||!i&&-s>d))&&(c=!0),c}(m,t,e,"h"===m?l:c,!0)},[]),c=e.useCallback(function(e){var t=e;if($n.length&&$n[$n.length-1]===s){var r="deltaY"in t?Hn(t):zn(t),i=n.current.filter(function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&(n=e.delta,i=r,n[0]===i[0]&&n[1]===i[1]);var n,i})[0];if(i&&i.should)t.cancelable&&t.preventDefault();else if(!i){var o=(a.current.shards||[]).map(Vn).filter(Boolean).filter(function(e){return e.contains(t.target)});(o.length>0?l(t,o[0]):!a.current.noIsolation)&&t.cancelable&&t.preventDefault()}}},[]),h=e.useCallback(function(e,t,r,i){var o={name:e,delta:t,target:r,should:i,shadowParent:Kn(r)};n.current.push(o),setTimeout(function(){n.current=n.current.filter(function(e){return e!==o})},1)},[]),u=e.useCallback(function(e){r.current=zn(e),i.current=void 0},[]),d=e.useCallback(function(e){h(e.type,Hn(e),e.target,l(e,t.lockRef.current))},[]),f=e.useCallback(function(e){h(e.type,zn(e),e.target,l(e,t.lockRef.current))},[]);e.useEffect(function(){return $n.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,In),document.addEventListener("touchmove",c,In),document.addEventListener("touchstart",u,In),function(){$n=$n.filter(function(e){return e!==s}),document.removeEventListener("wheel",c,In),document.removeEventListener("touchmove",c,In),document.removeEventListener("touchstart",u,In)}},[]);var p=t.removeScrollBar,m=t.inert;return e.createElement(e.Fragment,null,m?e.createElement(s,{styles:qn(o)}):null,p?e.createElement(Pn,{noRelative:t.noRelative,gapMode:t.gapMode}):null)},wn.useMedium(Yn),yn),Xn=e.forwardRef(function(t,n){return e.createElement(kn,ie({},t,{ref:n,sideCar:Gn}))});Xn.classNames=kn.classNames;var Jn=Xn,Qn=new WeakMap,Zn=new WeakMap,er={},tr=0,nr=function(e){return e&&(e.host||nr(e.parentNode))},rr=function(e,t,n,r){var i=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=nr(t);return n&&e.contains(n)?n:null}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);er[n]||(er[n]=new WeakMap);var o=er[n],s=[],a=new Set,l=new Set(i),c=function(e){e&&!a.has(e)&&(a.add(e),c(e.parentNode))};i.forEach(c);var h=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(a.has(e))h(e);else try{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(Qn.get(e)||0)+1,c=(o.get(e)||0)+1;Qn.set(e,l),o.set(e,c),s.push(e),1===l&&i&&Zn.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}catch(e){}})};return h(t),a.clear(),tr++,function(){s.forEach(function(e){var t=Qn.get(e)-1,i=o.get(e)-1;Qn.set(e,t),o.set(e,i),t||(Zn.has(e)||e.removeAttribute(r),Zn.delete(e)),i||e.removeAttribute(n)}),--tr||(Qn=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,er={})}},ir=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),rr(r,i,n,"aria-hidden")):function(){return null}},or="Dialog",[sr,ar]=Ot(or),[lr,cr]=sr(or),hr=t=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=t,l=e.useRef(null),c=e.useRef(null),[h,d]=Pt({prop:i,defaultProp:o??!1,onChange:s,caller:or});return u(lr,{scope:n,triggerRef:l,contentRef:c,contentId:Rt(),titleId:Rt(),descriptionId:Rt(),open:h,onOpenChange:d,onOpenToggle:e.useCallback(()=>d(e=>!e),[d]),modal:a,children:r})};hr.displayName=or;var ur="DialogTrigger",dr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(ur,n),o=it(t,i.triggerRef);return u(jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Dr(i.open),...r,ref:o,onClick:Ct(e.onClick,i.onOpenToggle)})});dr.displayName=ur;var fr="DialogPortal",[pr,mr]=sr(fr,{forceMount:void 0}),gr=t=>{const{__scopeDialog:n,forceMount:r,children:i,container:o}=t,s=cr(fr,n);return u(pr,{scope:n,forceMount:r,children:e.Children.map(i,e=>u(an,{present:r||s.open,children:u(sn,{asChild:!0,container:o,children:e})}))})};gr.displayName=fr;var vr="DialogOverlay",br=e.forwardRef((e,t)=>{const n=mr(vr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=cr(vr,e.__scopeDialog);return o.modal?u(an,{present:r||o.open,children:u(wr,{...i,ref:t})}):null});br.displayName=vr;var yr=Lt("DialogOverlay.RemoveScroll"),wr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(vr,n);return u(Jn,{as:yr,allowPinchZoom:!0,shards:[i.contentRef],children:u(jt.div,{"data-state":Dr(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),xr="DialogContent",kr=e.forwardRef((e,t)=>{const n=mr(xr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=cr(xr,e.__scopeDialog);return u(an,{present:r||o.open,children:o.modal?u(Sr,{...i,ref:t}):u(Er,{...i,ref:t})})});kr.displayName=xr;var Sr=e.forwardRef((t,n)=>{const r=cr(xr,t.__scopeDialog),i=e.useRef(null),o=it(n,r.contentRef,i);return e.useEffect(()=>{const e=i.current;if(e)return ir(e)},[]),u(Cr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ct(t.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ct(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Ct(t.onFocusOutside,e=>e.preventDefault())})}),Er=e.forwardRef((t,n)=>{const r=cr(xr,t.__scopeDialog),i=e.useRef(!1),o=e.useRef(!1);return u(Cr,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(i.current||r.triggerRef.current?.focus(),e.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(i.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const n=e.target,s=r.triggerRef.current?.contains(n);s&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Cr=e.forwardRef((t,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=t,l=cr(xr,r),c=e.useRef(null),h=it(n,c);return hn(),d(f,{children:[u(Qt,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u($t,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Dr(l.open),...a,ref:h,onDismiss:()=>l.onOpenChange(!1)})}),d(f,{children:[u(Ir,{titleId:l.titleId}),u(_r,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Or="DialogTitle",Nr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(Or,n);return u(jt.h2,{id:i.titleId,...r,ref:t})});Nr.displayName=Or;var Ar="DialogDescription",Tr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(Ar,n);return u(jt.p,{id:i.descriptionId,...r,ref:t})});Tr.displayName=Ar;var Mr="DialogClose",Rr=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(Mr,n);return u(jt.button,{type:"button",...r,ref:t,onClick:Ct(e.onClick,()=>i.onOpenChange(!1))})});function Dr(e){return e?"open":"closed"}Rr.displayName=Mr;var Pr="DialogTitleWarning",[Lr,Br]=function(t,n){const r=e.createContext(n),i=t=>{const{children:n,...i}=t,o=e.useMemo(()=>i,Object.values(i));return u(r.Provider,{value:o,children:n})};return i.displayName=t+"Provider",[i,function(i){const o=e.useContext(r);if(o)return o;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${t}\``)}]}(Pr,{contentName:xr,titleName:Or,docsSlug:"dialog"}),Ir=({titleId:t})=>{const n=Br(Pr),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)}},[r,t]),null},_r=({contentRef:t,descriptionId:n})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Br("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(n&&e){document.getElementById(n)}},[r,t,n]),null},jr=hr,Fr=dr,Wr=gr,zr=br,Hr=kr,Vr=Nr,qr=Tr,Ur=Rr,$r=jr,Kr=Wr,Yr=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(zr,Object.assign({className:et("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r)},i,{ref:n}))});Yr.displayName=zr.displayName;var Gr=mt("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Xr=e.forwardRef(function(t,n){var r=t.side,i=void 0===r?"right":r,o=t.className,s=t.children,a=oe(t,["side","className","children"]);return e.createElement(Kr,null,e.createElement(Yr,null),e.createElement(Hr,Object.assign({ref:n,className:et(Gr({side:i}),o)},a),s,e.createElement(Ur,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"},e.createElement(re,{className:"h-4 w-4"}),e.createElement("span",{className:"sr-only"},"Close"))))});Xr.displayName=Hr.displayName;var Jr=function(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex flex-col space-y-2 text-center sm:text-left",n)},r))};Jr.displayName="SheetHeader";var Qr=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(Vr,Object.assign({ref:n,className:et("text-lg font-semibold text-foreground",r)},i))});Qr.displayName=Vr.displayName;var Zr=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(qr,Object.assign({ref:n,className:et("text-sm text-muted-foreground",r)},i))});function ei(t){const n=e.forwardRef((t,n)=>{const{children:r,...i}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==e.Fragment&&(o.ref=n?rt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}Zr.displayName=qr.displayName;var ti=Symbol("radix.slottable");function ni(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===ti}var ri=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=function(t){const n=ei(t),r=e.forwardRef((t,r)=>{const{children:i,...o}=t,s=e.Children.toArray(i),a=s.find(ni);if(a){const t=a.props.children,i=s.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return u(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return u(n,{...o,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{});var ii,oi="dismissableLayer.update",si="dismissableLayer.pointerDownOutside",ai="dismissableLayer.focusOutside",li=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ci=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=t,h=e.useContext(li),[d,f]=e.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=e.useState({}),g=it(n,e=>f(e)),v=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=h.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1),o=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){let t=function(){ui(si,r,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=t,n.addEventListener("click",o.current,{once:!0})):t()}else n.removeEventListener("click",o.current);i.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}},[n,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{const t=e.target,n=[...h.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),a?.(e),e.defaultPrevented||l?.())},p),E=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){ui(ai,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{const t=e.target;[...h.branches].some(e=>e.contains(t))||(s?.(e),a?.(e),e.defaultPrevented||l?.())},p);return Wt(e=>{w===h.layers.size-1&&(i?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},p),e.useEffect(()=>{if(d)return r&&(0===h.layersWithOutsidePointerEventsDisabled.size&&(ii=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(d)),h.layers.add(d),hi(),()=>{r&&1===h.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=ii)}},[d,p,r,h]),e.useEffect(()=>()=>{d&&(h.layers.delete(d),h.layersWithOutsidePointerEventsDisabled.delete(d),hi())},[d,h]),e.useEffect(()=>{const e=()=>m({});return document.addEventListener(oi,e),()=>document.removeEventListener(oi,e)},[]),u(ri.div,{...c,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...t.style},onFocusCapture:Ct(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Ct(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ct(t.onPointerDownCapture,S.onPointerDownCapture)})});ci.displayName="DismissableLayer";function hi(){const e=new CustomEvent(oi);document.dispatchEvent(e)}function ui(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&p.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}e.forwardRef((t,n)=>{const r=e.useContext(li),i=e.useRef(null),o=it(n,i);return e.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),u(ri.div,{...t,ref:o})}).displayName="DismissableLayerBranch";const di=["top","right","bottom","left"],fi=Math.min,pi=Math.max,mi=Math.round,gi=Math.floor,vi=e=>({x:e,y:e}),bi={left:"right",right:"left",bottom:"top",top:"bottom"},yi={start:"end",end:"start"};function wi(e,t,n){return pi(e,fi(t,n))}function xi(e,t){return"function"==typeof e?e(t):e}function ki(e){return e.split("-")[0]}function Si(e){return e.split("-")[1]}function Ei(e){return"x"===e?"y":"x"}function Ci(e){return"y"===e?"height":"width"}const Oi=new Set(["top","bottom"]);function Ni(e){return Oi.has(ki(e))?"y":"x"}function Ai(e){return Ei(Ni(e))}function Ti(e){return e.replace(/start|end/g,e=>yi[e])}const Mi=["left","right"],Ri=["right","left"],Di=["top","bottom"],Pi=["bottom","top"];function Li(e,t,n,r){const i=Si(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ri:Mi:t?Mi:Ri;case"left":case"right":return t?Di:Pi;default:return[]}}(ki(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Ti)))),o}function Bi(e){return e.replace(/left|right|bottom|top/g,e=>bi[e])}function Ii(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function _i(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ji(e,t,n){let{reference:r,floating:i}=e;const o=Ni(t),s=Ai(t),a=Ci(s),l=ki(t),c="y"===o,h=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:h,y:r.y-i.height};break;case"bottom":f={x:h,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-i.width,y:u};break;default:f={x:r.x,y:r.y}}switch(Si(t)){case"start":f[s]-=d*(n&&c?-1:1);break;case"end":f[s]+=d*(n&&c?-1:1)}return f}async function Fi(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:d=!1,padding:f=0}=xi(t,e),p=Ii(f),m=a[d?"floating"===u?"reference":"floating":u],g=_i(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),v="floating"===u?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},w=_i(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-w.top+p.top)/y.y,bottom:(w.bottom-g.bottom+p.bottom)/y.y,left:(g.left-w.left+p.left)/y.x,right:(w.right-g.right+p.right)/y.x}}function Wi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zi(e){return di.some(t=>e[t]>=0)}const Hi=new Set(["left","top"]);function Vi(){return"undefined"!=typeof window}function qi(e){return Ki(e)?(e.nodeName||"").toLowerCase():"#document"}function Ui(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function $i(e){var t;return null==(t=(Ki(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Ki(e){return!!Vi()&&(e instanceof Node||e instanceof Ui(e).Node)}function Yi(e){return!!Vi()&&(e instanceof Element||e instanceof Ui(e).Element)}function Gi(e){return!!Vi()&&(e instanceof HTMLElement||e instanceof Ui(e).HTMLElement)}function Xi(e){return!(!Vi()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Ui(e).ShadowRoot)}const Ji=new Set(["inline","contents"]);function Qi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=ho(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ji.has(i)}const Zi=new Set(["table","td","th"]);function eo(e){return Zi.has(qi(e))}const to=[":popover-open",":modal"];function no(e){return to.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const ro=["transform","translate","scale","rotate","perspective"],io=["transform","translate","scale","rotate","perspective","filter"],oo=["paint","layout","strict","content"];function so(e){const t=ao(),n=Yi(e)?ho(e):e;return ro.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||io.some(e=>(n.willChange||"").includes(e))||oo.some(e=>(n.contain||"").includes(e))}function ao(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const lo=new Set(["html","body","#document"]);function co(e){return lo.has(qi(e))}function ho(e){return Ui(e).getComputedStyle(e)}function uo(e){return Yi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fo(e){if("html"===qi(e))return e;const t=e.assignedSlot||e.parentNode||Xi(e)&&e.host||$i(e);return Xi(t)?t.host:t}function po(e){const t=fo(e);return co(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gi(t)&&Qi(t)?t:po(t)}function mo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=po(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=Ui(i);if(o){const e=go(s);return t.concat(s,s.visualViewport||[],Qi(i)?i:[],e&&n?mo(e):[])}return t.concat(i,mo(i,[],n))}function go(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vo(e){const t=ho(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Gi(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=mi(n)!==o||mi(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function bo(e){return Yi(e)?e:e.contextElement}function yo(e){const t=bo(e);if(!Gi(t))return vi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=vo(t);let s=(o?mi(n.width):n.width)/r,a=(o?mi(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const wo=vi(0);function xo(e){const t=Ui(e);return ao()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:wo}function ko(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=bo(e);let s=vi(1);t&&(r?Yi(r)&&(s=yo(r)):s=yo(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ui(e))&&t}(o,n,r)?xo(o):vi(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,h=i.width/s.x,u=i.height/s.y;if(o){const e=Ui(o),t=r&&Yi(r)?Ui(r):r;let n=e,i=go(n);for(;i&&r&&t!==n;){const e=yo(i),t=i.getBoundingClientRect(),r=ho(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,h*=e.x,u*=e.y,l+=o,c+=s,n=Ui(i),i=go(n)}}return _i({width:h,height:u,x:l,y:c})}function So(e,t){const n=uo(e).scrollLeft;return t?t.left+n:ko($i(e)).left+n}function Eo(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-So(e,n),y:n.top+t.scrollTop}}const Co=new Set(["absolute","fixed"]);function Oo(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ui(e),r=$i(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=ao();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=So(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=$i(e),n=uo(e),r=e.ownerDocument.body,i=pi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=pi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+So(e);const a=-n.scrollTop;return"rtl"===ho(r).direction&&(s+=pi(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}($i(e));else if(Yi(t))r=function(e,t){const n=ko(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Gi(e)?yo(e):vi(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=xo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _i(r)}function No(e,t){const n=fo(e);return!(n===t||!Yi(n)||co(n))&&("fixed"===ho(n).position||No(n,t))}function Ao(e,t,n){const r=Gi(t),i=$i(t),o="fixed"===n,s=ko(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=vi(0);function c(){l.x=So(i)}if(r||!r&&!o)if(("body"!==qi(t)||Qi(i))&&(a=uo(t)),r){const e=ko(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const h=!i||r||o?vi(0):Eo(i,a);return{x:s.left+a.scrollLeft-l.x-h.x,y:s.top+a.scrollTop-l.y-h.y,width:s.width,height:s.height}}function To(e){return"static"===ho(e).position}function Mo(e,t){if(!Gi(e)||"fixed"===ho(e).position)return null;if(t)return t(e);let n=e.offsetParent;return $i(e)===n&&(n=n.ownerDocument.body),n}function Ro(e,t){const n=Ui(e);if(no(e))return n;if(!Gi(e)){let t=fo(e);for(;t&&!co(t);){if(Yi(t)&&!To(t))return t;t=fo(t)}return n}let r=Mo(e,t);for(;r&&eo(r)&&To(r);)r=Mo(r,t);return r&&co(r)&&To(r)&&!so(r)?n:r||function(e){let t=fo(e);for(;Gi(t)&&!co(t);){if(so(t))return t;if(no(t))return null;t=fo(t)}return null}(e)||n}const Do={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=$i(r),a=!!t&&no(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=vi(1);const h=vi(0),u=Gi(r);if((u||!u&&!o)&&(("body"!==qi(r)||Qi(s))&&(l=uo(r)),Gi(r))){const e=ko(r);c=yo(r),h.x=e.x+r.clientLeft,h.y=e.y+r.clientTop}const d=!s||u||o?vi(0):Eo(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+d.x,y:n.y*c.y-l.scrollTop*c.y+h.y+d.y}},getDocumentElement:$i,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?no(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=mo(e,[],!1).filter(e=>Yi(e)&&"body"!==qi(e)),i=null;const o="fixed"===ho(e).position;let s=o?fo(e):e;for(;Yi(s)&&!co(s);){const t=ho(s),n=so(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&Co.has(i.position)||Qi(s)&&!n&&No(e,s))?r=r.filter(e=>e!==s):i=t,s=fo(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=o[0],a=o.reduce((e,n)=>{const r=Oo(t,n,i);return e.top=pi(r.top,e.top),e.right=fi(r.right,e.right),e.bottom=fi(r.bottom,e.bottom),e.left=pi(r.left,e.left),e},Oo(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Ro,getElementRects:async function(e){const t=this.getOffsetParent||Ro,n=this.getDimensions,r=await n(e.floating);return{reference:Ao(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=vo(e);return{width:t,height:n}},getScale:yo,isElement:Yi,isRTL:function(e){return"rtl"===ho(e).direction}};function Po(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Lo(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=bo(e),h=i||o?[...c?mo(c):[],...mo(t)]:[];h.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const u=c&&a?function(e,t){let n,r=null;const i=$i(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:h,top:u,width:d,height:f}=c;if(a||t(),!d||!f)return;const p={rootMargin:-gi(u)+"px "+-gi(i.clientWidth-(h+d))+"px "+-gi(i.clientHeight-(u+f))+"px "+-gi(h)+"px",threshold:pi(0,fi(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||Po(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),o}(c,n):null;let d,f=-1,p=null;s&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m=l?ko(e):null;return l&&function t(){const r=ko(e);m&&!Po(m,r)&&n();m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;h.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(d)}}const Bo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=ki(n),a=Si(n),l="y"===Ni(n),c=Hi.has(s)?-1:1,h=o&&l?-1:1,u=xi(t,e);let{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof p&&(f="end"===a?-1*p:p),l?{x:f*h,y:d*c}:{x:d*c,y:f*h}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Io=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=xi(e,t),c={x:n,y:r},h=await Fi(t,l),u=Ni(ki(i)),d=Ei(u);let f=c[d],p=c[u];if(o){const e="y"===d?"bottom":"right";f=wi(f+h["y"===d?"top":"left"],f,f-h[e])}if(s){const e="y"===u?"bottom":"right";p=wi(p+h["y"===u?"top":"left"],p,p-h[e])}const m=a.fn({...t,[d]:f,[u]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:o,[u]:s}}}}}},_o=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=xi(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const v=ki(i),b=Ni(a),y=ki(a)===a,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(y||!m?[Bi(a)]:function(e){const t=Bi(e);return[Ti(e),t,Ti(t)]}(a)),k="none"!==p;!d&&k&&x.push(...Li(a,m,p,w));const S=[a,...x],E=await Fi(t,g),C=[];let O=(null==(r=o.flip)?void 0:r.overflows)||[];if(h&&C.push(E[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Si(e),i=Ai(e),o=Ci(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Bi(s)),[s,Bi(s)]}(i,s,w);C.push(E[e[0]],E[e[1]])}if(O=[...O,{placement:i,overflows:C}],!C.every(e=>e<=0)){var N,A;const e=((null==(N=o.flip)?void 0:N.index)||0)+1,t=S[e];if(t){if(!("alignment"===u&&b!==Ni(t))||O.every(e=>Ni(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:O},reset:{placement:t}}}let n=null==(A=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!n)switch(f){case"bestFit":{var T;const e=null==(T=O.filter(e=>{if(k){const t=Ni(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},jo=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=xi(e,t),h=await Fi(t,c),u=ki(i),d=Si(i),f="y"===Ni(i),{width:p,height:m}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=d===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(v=u,g="end"===d?"top":"bottom");const b=m-h.top-h.bottom,y=p-h.left-h.right,w=fi(m-h[g],b),x=fi(p-h[v],y),k=!t.middlewareData.shift;let S=w,E=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(E=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=b),k&&!d){const e=pi(h.left,0),t=pi(h.right,0),n=pi(h.top,0),r=pi(h.bottom,0);f?E=p-2*(0!==e||0!==t?e+t:pi(h.left,h.right)):S=m-2*(0!==n||0!==r?n+r:pi(h.top,h.bottom))}await l({...t,availableWidth:E,availableHeight:S});const C=await s.getDimensions(a.floating);return p!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},Fo=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=xi(e,t);switch(r){case"referenceHidden":{const e=Wi(await Fi(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:zi(e)}}}case"escaped":{const e=Wi(await Fi(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:zi(e)}}}default:return{}}}}},Wo=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:h=0}=xi(e,t)||{};if(null==c)return{};const u=Ii(h),d={x:n,y:r},f=Ai(i),p=Ci(f),m=await s.getDimensions(c),g="y"===f,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[f]-d[f]-o.floating[p],x=d[f]-o.reference[f],k=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let S=k?k[y]:0;S&&await(null==s.isElement?void 0:s.isElement(k))||(S=a.floating[y]||o.floating[p]);const E=w/2-x/2,C=S/2-m[p]/2-1,O=fi(u[v],C),N=fi(u[b],C),A=O,T=S-m[p]-N,M=S/2-m[p]/2+E,R=wi(A,M,T),D=!l.arrow&&null!=Si(i)&&M!==R&&o.reference[p]/2-(M<A?O:N)-m[p]/2<0,P=D?M<A?M-A:M-T:0;return{[f]:d[f]+P,data:{[f]:R,centerOffset:M-R-P,...D&&{alignmentOffset:P}},reset:D}}}),zo=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=xi(e,t),h={x:n,y:r},u=Ni(i),d=Ei(u);let f=h[d],p=h[u];const m=xi(a,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===d?"height":"width",t=o.reference[d]-o.floating[e]+g.mainAxis,n=o.reference[d]+o.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,b;const e="y"===d?"width":"height",t=Hi.has(ki(i)),n=o.reference[u]-o.floating[e]+(t&&(null==(v=s.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),r=o.reference[u]+o.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[d]:f,[u]:p}}}},Ho=(e,t,n)=>{const r=new Map,i={platform:Do,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:u}=ji(c,r,l),d=r,f={},p=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:g,y:v,data:b,reset:y}=await m({x:h,y:u,initialPlacement:r,placement:d,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});h=null!=g?g:h,u=null!=v?v:u,f={...f,[o]:{...f[o],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(c=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):y.rects),({x:h,y:u}=ji(c,d,l))),n=-1)}return{x:h,y:u,placement:d,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var Vo="undefined"!=typeof document?o:function(){};function qo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!qo(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(("_owner"!==n||!e.$$typeof)&&!qo(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Uo(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $o(e,t){const n=Uo(e);return Math.round(t*n)/n}function Ko(t){const n=e.useRef(t);return Vo(()=>{n.current=t}),n}function Yo(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:h}=t,[u,d]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[f,m]=e.useState(i);qo(f,i)||m(i);const[g,v]=e.useState(null),[b,y]=e.useState(null),w=e.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),x=e.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),k=s||g,S=a||b,E=e.useRef(null),C=e.useRef(null),O=e.useRef(u),N=null!=c,A=Ko(c),T=Ko(o),M=Ko(h),R=e.useCallback(()=>{if(!E.current||!C.current)return;const e={placement:n,strategy:r,middleware:f};T.current&&(e.platform=T.current),Ho(E.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==M.current};D.current&&!qo(O.current,t)&&(O.current=t,p.flushSync(()=>{d(t)}))})},[f,n,r,T,M]);Vo(()=>{!1===h&&O.current.isPositioned&&(O.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[h]);const D=e.useRef(!1);Vo(()=>(D.current=!0,()=>{D.current=!1}),[]),Vo(()=>{if(k&&(E.current=k),S&&(C.current=S),k&&S){if(A.current)return A.current(k,S,R);R()}},[k,S,R,A,N]);const P=e.useMemo(()=>({reference:E,floating:C,setReference:w,setFloating:x}),[w,x]),L=e.useMemo(()=>({reference:k,floating:S}),[k,S]),B=e.useMemo(()=>{const e={position:r,left:0,top:0};if(!L.floating)return e;const t=$o(L.floating,u.x),n=$o(L.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Uo(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,L.floating,u.x,u.y]);return e.useMemo(()=>({...u,update:R,refs:P,elements:L,floatingStyles:B}),[u,R,P,L,B])}const Go=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(i=n,{}.hasOwnProperty.call(i,"current"))?null!=n.current?Wo({element:n.current,padding:r}).fn(t):{}:n?Wo({element:n,padding:r}).fn(t):{};var i}}),Xo=(e,t)=>({...Bo(e),options:[e,t]}),Jo=(e,t)=>({...Io(e),options:[e,t]}),Qo=(e,t)=>({...zo(e),options:[e,t]}),Zo=(e,t)=>({..._o(e),options:[e,t]}),es=(e,t)=>({...jo(e),options:[e,t]}),ts=(e,t)=>({...Fo(e),options:[e,t]}),ns=(e,t)=>({...Go(e),options:[e,t]});var rs=e.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return u(ri.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u("polygon",{points:"0,0 30,0 15,10"})})});rs.displayName="Arrow";var is=rs;function os(t){const[n,r]=e.useState(void 0);return At(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let i,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,o=t.blockSize}else i=t.offsetWidth,o=t.offsetHeight;r({width:i,height:o})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)},[t]),n}var ss="Popper",[as,ls]=Ot(ss),[cs,hs]=as(ss),us=t=>{const{__scopePopper:n,children:r}=t,[i,o]=e.useState(null);return u(cs,{scope:n,anchor:i,onAnchorChange:o,children:r})};us.displayName=ss;var ds="PopperAnchor",fs=e.forwardRef((t,n)=>{const{__scopePopper:r,virtualRef:i,...o}=t,s=hs(ds,r),a=e.useRef(null),l=it(n,a),c=e.useRef(null);return e.useEffect(()=>{const e=c.current;c.current=i?.current||a.current,e!==c.current&&s.onAnchorChange(c.current)}),i?null:u(ri.div,{...o,ref:l})});fs.displayName=ds;var ps="PopperContent",[ms,gs]=as(ps),vs=e.forwardRef((t,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:h=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=t,b=hs(ps,r),[y,w]=e.useState(null),x=it(n,e=>w(e)),[k,S]=e.useState(null),E=os(k),C=E?.width??0,O=E?.height??0,N=i+("center"!==s?"-"+s:""),A="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(h)?h:[h],M=T.length>0,R={padding:A,boundary:T.filter(xs),altBoundary:M},{refs:D,floatingStyles:P,placement:L,isPositioned:B,middlewareData:I}=Yo({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Lo(...e,{animationFrame:"always"===m}),elements:{reference:b.anchor},middleware:[Xo({mainAxis:o+O,alignmentAxis:a}),c&&Jo({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?Qo():void 0,...R}),c&&Zo({...R}),es({...R,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&ns({element:k,padding:l}),ks({arrowWidth:C,arrowHeight:O}),p&&ts({strategy:"referenceHidden",...R})]}),[_,j]=Ss(L),F=Ft(g);At(()=>{B&&F?.()},[B,F]);const W=I.arrow?.x,z=I.arrow?.y,H=0!==I.arrow?.centerOffset,[V,q]=e.useState();return At(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),u("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:B?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u(ms,{scope:r,placedSide:_,onArrowChange:S,arrowX:W,arrowY:z,shouldHideArrow:H,children:u(ri.div,{"data-side":_,"data-align":j,...v,ref:x,style:{...v.style,animation:B?void 0:"none"}})})})});vs.displayName=ps;var bs="PopperArrow",ys={top:"bottom",right:"left",bottom:"top",left:"right"},ws=e.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,i=gs(bs,n),o=ys[i.placedSide];return u("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:u(is,{...r,ref:t,style:{...r.style,display:"block"}})})});function xs(e){return null!==e}ws.displayName=bs;var ks=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,o=0!==i.arrow?.centerOffset,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=Ss(n),h={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,d=(i.arrow?.y??0)+a/2;let f="",p="";return"bottom"===l?(f=o?h:`${u}px`,p=-a+"px"):"top"===l?(f=o?h:`${u}px`,p=`${r.floating.height+a}px`):"right"===l?(f=-a+"px",p=o?h:`${d}px`):"left"===l&&(f=`${r.floating.width+a}px`,p=o?h:`${d}px`),{data:{x:f,y:p}}}});function Ss(e){const[t,n="center"]=e.split("-");return[t,n]}var Es=us,Cs=fs,Os=vs,Ns=ws;var As=t=>{const{present:n,children:r}=t,i=function(t){const[n,r]=e.useState(),i=e.useRef(null),o=e.useRef(t),s=e.useRef("none"),a=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=Ts(i.current);s.current="mounted"===l?e:"none"},[l]),At(()=>{const e=i.current,n=o.current;if(n!==t){const r=s.current,i=Ts(e);if(t)c("MOUNT");else if("none"===i||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=t}},[t,c]),At(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const s=Ts(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&s&&(c("ANIMATION_END"),!o.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=Ts(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{i.current=e?getComputedStyle(e):null,r(e)},[])}}(n),o="function"==typeof r?r({present:i.isPresent}):e.Children.only(r),s=it(i.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||i.isPresent?e.cloneElement(o,{ref:s}):null};function Ts(e){return e?.animationName||"none"}As.displayName="Presence";var Ms=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Rs=e.forwardRef((e,t)=>u(ri.span,{...e,ref:t,style:{...Ms,...e.style}}));Rs.displayName="VisuallyHidden";var Ds=Rs,[Ps,Ls]=Ot("Tooltip",[ls]),Bs=ls(),Is="TooltipProvider",_s=700,js="tooltip.open",[Fs,Ws]=Ps(Is),zs=t=>{const{__scopeTooltip:n,delayDuration:r=_s,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:s}=t,a=e.useRef(!0),l=e.useRef(!1),c=e.useRef(0);return e.useEffect(()=>{const e=c.current;return()=>window.clearTimeout(e)},[]),u(Fs,{scope:n,isOpenDelayedRef:a,delayDuration:r,onOpen:e.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:e.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:e.useCallback(e=>{l.current=e},[]),disableHoverableContent:o,children:s})};zs.displayName=Is;var Hs="Tooltip",[Vs,qs]=Ps(Hs),Us=t=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=t,c=Ws(Hs,t.__scopeTooltip),h=Bs(n),[d,f]=e.useState(null),p=Rt(),m=e.useRef(0),g=a??c.disableHoverableContent,v=l??c.delayDuration,b=e.useRef(!1),[y,w]=Pt({prop:i,defaultProp:o??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(js))):c.onClose(),s?.(e)},caller:Hs}),x=e.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),k=e.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b.current=!1,w(!0)},[w]),S=e.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=e.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{b.current=!0,w(!0),m.current=0},v)},[v,w]);return e.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),u(Es,{...h,children:u(Vs,{scope:n,contentId:p,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:e.useCallback(()=>{c.isOpenDelayedRef.current?E():k()},[c.isOpenDelayedRef,E,k]),onTriggerLeave:e.useCallback(()=>{g?S():(window.clearTimeout(m.current),m.current=0)},[S,g]),onOpen:k,onClose:S,disableHoverableContent:g,children:r})})};Us.displayName=Hs;var $s="TooltipTrigger",Ks=e.forwardRef((t,n)=>{const{__scopeTooltip:r,...i}=t,o=qs($s,r),s=Ws($s,r),a=Bs(r),l=it(n,e.useRef(null),o.onTriggerChange),c=e.useRef(!1),h=e.useRef(!1),d=e.useCallback(()=>c.current=!1,[]);return e.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),u(Cs,{asChild:!0,...a,children:u(ri.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:l,onPointerMove:Ct(t.onPointerMove,e=>{"touch"!==e.pointerType&&(h.current||s.isPointerInTransitRef.current||(o.onTriggerEnter(),h.current=!0))}),onPointerLeave:Ct(t.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:Ct(t.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ct(t.onFocus,()=>{c.current||o.onOpen()}),onBlur:Ct(t.onBlur,o.onClose),onClick:Ct(t.onClick,o.onClose)})})});Ks.displayName=$s;var[Ys,Gs]=Ps("TooltipPortal",{forceMount:void 0}),Xs="TooltipContent",Js=e.forwardRef((e,t)=>{const n=Gs(Xs,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=qs(Xs,e.__scopeTooltip);return u(As,{present:r||s.open,children:s.disableHoverableContent?u(na,{side:i,...o,ref:t}):u(Qs,{side:i,...o,ref:t})})}),Qs=e.forwardRef((t,n)=>{const r=qs(Xs,t.__scopeTooltip),i=Ws(Xs,t.__scopeTooltip),o=e.useRef(null),s=it(n,o),[a,l]=e.useState(null),{trigger:c,onClose:h}=r,d=o.current,{onPointerInTransitChange:f}=i,p=e.useCallback(()=>{l(null),f(!1)},[f]),m=e.useCallback((e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(r,n.getBoundingClientRect()),o=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(r,i),s=function(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}(t.getBoundingClientRect()),a=function(e){const t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const r=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const r=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x)))break;n.pop()}n.push(r)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...o,...s]);l(a),f(!0)},[f]);return e.useEffect(()=>()=>p(),[p]),e.useEffect(()=>{if(c&&d){const e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener("pointerleave",e),d.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),d.removeEventListener("pointerleave",t)}}},[c,d,m,p]),e.useEffect(()=>{if(a){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!function(e,t){const{x:n,y:r}=e;let i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){const s=t[e],a=t[o],l=s.x,c=s.y,h=a.x,u=a.y;c>r!=u>r&&n<(h-l)*(r-c)/(u-c)+l&&(i=!i)}return i}(n,a);r?p():i&&(p(),h())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,d,a,h,p]),u(na,{...t,ref:s})}),[Zs,ea]=Ps(Hs,{isInside:!1}),ta=function(e){const t=({children:e})=>u(f,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=ti,t}("TooltipContent"),na=e.forwardRef((t,n)=>{const{__scopeTooltip:r,children:i,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...l}=t,c=qs(Xs,r),h=Bs(r),{onClose:f}=c;return e.useEffect(()=>(document.addEventListener(js,f),()=>document.removeEventListener(js,f)),[f]),e.useEffect(()=>{if(c.trigger){const e=e=>{const t=e.target;t?.contains(c.trigger)&&f()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,f]),u(ci,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:d(Os,{"data-state":c.stateAttribute,...h,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u(ta,{children:i}),u(Zs,{scope:r,isInside:!0,children:u(Ds,{id:c.contentId,role:"tooltip",children:o||i})})]})})});Js.displayName=Xs;var ra="TooltipArrow";e.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Bs(n);return ea(ra,n).isInside?null:u(Ns,{...i,...r,ref:t})}).displayName=ra;var ia=Js,oa=zs,sa=Us,aa=Ks,la=e.forwardRef(function(t,n){var r=t.className,i=t.sideOffset,o=void 0===i?4:i,s=oe(t,["className","sideOffset"]);return e.createElement(ia,Object.assign({ref:n,sideOffset:o,className:et("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",r)},s))});la.displayName=ia.displayName;var ca=e.createContext(null);function ha(){var t=e.useContext(ca);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function ua(t){var n=t.defaultOpen,r=void 0===n||n,i=t.open,o=t.onOpenChange,s=t.className,a=t.style,l=t.children,c=oe(t,["defaultOpen","open","onOpenChange","className","style","children"]),h=function(){var t=C(e.useState(void 0),2),n=t[0],r=t[1];return e.useEffect(function(){var e=window.matchMedia("(max-width: ".concat(767,"px)")),t=function(){r(window.innerWidth<768)};return e.addEventListener("change",t),r(window.innerWidth<768),function(){return e.removeEventListener("change",t)}},[]),!!n}(),u=C(e.useState(!1),2),d=u[0],f=u[1],p=C(e.useState(r),2),m=p[0],g=p[1],v=null!=i?i:m,b=e.useCallback(function(e){var t="function"==typeof e?e(v):e;o?o(t):g(t),document.cookie="".concat("sidebar_state","=").concat(t,"; path=/; max-age=").concat(604800)},[o,v]),y=e.useCallback(function(){return h?f(function(e){return!e}):b(function(e){return!e})},[h,b,f]);e.useEffect(function(){var e=function(e){"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[y]);var w=v?"expanded":"collapsed",x=e.useMemo(function(){return{state:w,open:v,setOpen:b,isMobile:h,openMobile:d,setOpenMobile:f,toggleSidebar:y}},[w,v,b,h,d,f,y]);return e.createElement(ca.Provider,{value:x},e.createElement(oa,{delayDuration:0},e.createElement("div",Object.assign({style:Object.assign({"--sidebar-width":"16rem","--sidebar-width-icon":"3rem"},a),className:et("group/sidebar-wrapper flex min-h-svh w-full",s)},c),l)))}function da(t){var n=t.side,r=void 0===n?"left":n,i=t.variant,o=void 0===i?"sidebar":i,s=t.collapsible,a=void 0===s?"offcanvas":s,l=t.className,c=t.children,h=oe(t,["side","variant","collapsible","className","children"]),u=ha(),d=u.isMobile,f=u.state,p=u.openMobile,m=u.setOpenMobile;return"none"===a?e.createElement("div",Object.assign({className:et("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",l)},h),c):d?e.createElement($r,Object.assign({open:p,onOpenChange:m},h),e.createElement(Xr,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:r},e.createElement(Jr,{className:"sr-only"},e.createElement(Qr,null,"Sidebar"),e.createElement(Zr,null,"Displays the mobile sidebar.")),e.createElement("div",{className:"flex h-full w-full flex-col"},c))):e.createElement("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":f,"data-collapsible":"collapsed"===f?a:"","data-variant":o,"data-side":r},e.createElement("div",{className:et("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","floating"===o||"inset"===o?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),e.createElement("div",Object.assign({className:et("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===r?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===o||"inset"===o?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",l)},h),e.createElement("div",{className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"},c)))}function fa(t){var n=t.className,r=t.onClick,i=oe(t,["className","onClick"]),o=ha().toggleSidebar;return e.createElement(vt,Object.assign({variant:"ghost",size:"icon",className:et("h-7 w-7",n),onClick:function(e){null==r||r(e),o()}},i),e.createElement(Y,null),e.createElement("span",{className:"sr-only"},"Toggle Sidebar"))}function pa(t){var n=t.className,r=oe(t,["className"]);return e.createElement("main",Object.assign({className:et("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",n)},r))}function ma(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex flex-col gap-2 p-2",n)},r))}function ga(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex flex-col gap-2 p-2",n)},r))}function va(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",n)},r))}function ba(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("relative flex w-full min-w-0 flex-col p-2",n)},r))}function ya(t){var n=t.className,r=t.asChild,i=void 0!==r&&r,o=oe(t,["className","asChild"]),s=i?ct:"div";return e.createElement(s,Object.assign({className:et("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",n)},o))}function wa(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("w-full text-sm",n)},r))}function xa(t){var n=t.className,r=oe(t,["className"]);return e.createElement("ul",Object.assign({className:et("flex w-full min-w-0 flex-col gap-1",n)},r))}function ka(t){var n=t.className,r=oe(t,["className"]);return e.createElement("li",Object.assign({className:et("group/menu-item relative",n)},r))}var Sa=mt("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Ea(t){var n=t.asChild,r=void 0!==n&&n,i=t.isActive,o=void 0!==i&&i,s=t.variant,a=void 0===s?"default":s,l=t.size,c=void 0===l?"default":l,h=t.tooltip,u=t.className,d=oe(t,["asChild","isActive","variant","size","tooltip","className"]),f=r?ct:"button",p=ha(),m=p.isMobile,g=p.state,v=e.createElement(f,Object.assign({"data-size":c,"data-active":o,className:et(Sa({variant:a,size:c}),u)},d));return h?("string"==typeof h&&(h={children:h}),e.createElement(sa,null,e.createElement(aa,{asChild:!0},v),e.createElement(la,Object.assign({side:"right",align:"center",hidden:"collapsed"!==g||m},h)))):v}var Ca=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=lt(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),Oa=e.forwardRef((e,t)=>u(Ca.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Oa.displayName="Label";var Na=Oa,Aa=mt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ta=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(Na,Object.assign({ref:n,className:et(Aa(),r)},i))});Ta.displayName=Na.displayName;var Ma=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("rounded-lg border bg-card text-card-foreground shadow-sm",r)},i))});Ma.displayName="Card";var Ra=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("flex flex-col space-y-1.5 p-6",r)},i))});Ra.displayName="CardHeader";var Da=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("text-2xl font-semibold leading-none tracking-tight",r)},i))});Da.displayName="CardTitle";var Pa=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("text-sm text-muted-foreground",r)},i))});Pa.displayName="CardDescription";var La=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("p-6 pt-0",r)},i))});La.displayName="CardContent";var Ba=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",Object.assign({ref:n,className:et("flex items-center p-6 pt-0",r)},i))});Ba.displayName="CardFooter";var Ia={items:[],config:Object.assign({},{top:24,duration:3,maxCount:5})},_a=new Set;function ja(){_a.forEach(function(e){return e(Ia.items.slice())})}function Fa(e){switch(e){case"success":return t.createElement(D,null);case"error":return t.createElement(ne,null);case"warning":return t.createElement(R,null);case"loading":return t.createElement(q,{className:"animate-spin"});default:return t.createElement(V,null)}}function Wa(e){var t,n,r;qa();var i=Date.now(),o=null!==(t=e.key)&&void 0!==t?t:"msg_".concat(i,"_").concat(Math.random().toString(36).slice(2)),s=Ia.items.findIndex(function(e){return e.key===o}),a={key:o,content:e.content,duration:null!==(n=e.duration)&&void 0!==n?n:Ia.config.duration,type:e.type,onClose:e.onClose,icon:null!==(r=e.icon)&&void 0!==r?r:Fa(e.type),className:e.className,createdAt:i};return s>=0?Ia.items[s]=Object.assign({},Ia.items[s],a):(Ia.items.length>=Ia.config.maxCount&&Ia.items.shift(),Ia.items.push(a)),ja(),a.duration>0&&"loading"!==a.type&&window.setTimeout(function(){za(o)},1e3*a.duration),{close:function(){return za(o)}}}function za(e){var t;if(void 0===e)return Ia.items.forEach(function(e){var t;return null===(t=e.onClose)||void 0===t?void 0:t.call(e)}),Ia.items=[],void ja();var n=Ia.items.findIndex(function(t){return t.key===e});if(n>=0){var r=C(Ia.items.splice(n,1),1)[0];null===(t=null==r?void 0:r.onClose)||void 0===t||t.call(r),ja()}}var Ha=null,Va=null;function qa(){"undefined"!=typeof window&&(Va||((Va=document.createElement("div")).setAttribute("data-custom-message-holder",""),document.body.appendChild(Va)),Ha||(Ha=g(Va)).render(t.createElement(Ua,null)))}function Ua(){var e=function(){var e=C(i(Ia.items),2),t=e[0],n=e[1];return a(function(){var e=n;return _a.add(e),function(){_a.delete(e)}},[]),t}(),n=Ia.config.top;return t.createElement("div",{className:"fixed left-1/2 -translate-x-1/2 z-[1000] w-80 pointer-events-none",style:{top:n}},t.createElement("div",{className:"mx-auto flex w-full max-w-xl flex-col items-center gap-2 px-4"},e.map(function(e){var n,r,i=function(e){switch(e){case"success":return{container:"border-green-200 bg-green-50/90 text-green-800 border-l-4 border-l-green-500",icon:"text-green-500",text:"text-green-800"};case"error":return{container:"border-red-200 bg-red-50/90 text-red-800 border-l-4 border-l-red-500",icon:"text-red-500",text:"text-red-800"};case"warning":return{container:"border-yellow-200 bg-yellow-50/90 text-yellow-800 border-l-4 border-l-yellow-500",icon:"text-yellow-500",text:"text-yellow-800"};default:return{container:"border-blue-200 bg-blue-50/90 text-blue-800 border-l-4 border-l-blue-500",icon:"text-blue-500",text:"text-blue-800"}}}(e.type);return t.createElement("div",{key:e.key,className:"pointer-events-auto flex w-full items-center gap-2 rounded-md border px-3 py-2 backdrop-blur ".concat(i.container," ").concat(null!==(n=e.className)&&void 0!==n?n:"")},t.createElement("span",{className:"text-[18px] leading-none ".concat(i.icon)},null!==(r=e.icon)&&void 0!==r?r:Fa(e.type)),t.createElement("div",{className:"min-w-0 flex-1 text-[14px] leading-normal ".concat(i.text)},"string"==typeof e.content?t.createElement("span",{className:"break-words align-middle"},e.content):e.content))})))}function $a(e,n,r,i){if(t.isValidElement(n)||"string"==typeof n||"number"==typeof n)return{type:e,content:n,duration:r,onClose:i};var o=n;return Object.assign({},o,{type:e})}var Ka,Ya,Ga=(Ya={open:function(e){var t;return Wa(Object.assign({},e,{type:null!==(t=e.type)&&void 0!==t?t:"info"}))},info:function(e,t,n){return Wa($a("info",e,t,n))},success:function(e,t,n){return Wa($a("success",e,t,n))},error:function(e,t,n){return Wa($a("error",e,t,n))},warning:function(e,t,n){return Wa($a("warning",e,t,n))},loading:function(e,t,n){return Wa($a("loading",e,null!=t?t:0,n))},destroy:function(e){return za(e)},config:function(e){return t=e,Ia.config=Object.assign({},Ia.config,t),void ja();var t},useMessage:function(){var e=s(function(){return"undefined"!=typeof window&&qa(),t.createElement(t.Fragment,null)},[]);return[Ka.current,e]}},(Ka={}).current=Ya,Ya);function Xa(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ja}=Object.prototype,{getPrototypeOf:Qa}=Object,{iterator:Za,toStringTag:el}=Symbol,tl=(nl=Object.create(null),e=>{const t=Ja.call(e);return nl[t]||(nl[t]=t.slice(8,-1).toLowerCase())});var nl;const rl=e=>(e=e.toLowerCase(),t=>tl(t)===e),il=e=>t=>typeof t===e,{isArray:ol}=Array,sl=il("undefined");function al(e){return null!==e&&!sl(e)&&null!==e.constructor&&!sl(e.constructor)&&hl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ll=rl("ArrayBuffer");const cl=il("string"),hl=il("function"),ul=il("number"),dl=e=>null!==e&&"object"==typeof e,fl=e=>{if("object"!==tl(e))return!1;const t=Qa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||el in e||Za in e)},pl=rl("Date"),ml=rl("File"),gl=rl("Blob"),vl=rl("FileList"),bl=rl("URLSearchParams"),[yl,wl,xl,kl]=["ReadableStream","Request","Response","Headers"].map(rl);function Sl(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),ol(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(al(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(r=0;r<o;r++)s=i[r],t.call(null,e[s],s,e)}}function El(e,t){if(al(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const Cl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ol=e=>!sl(e)&&e!==Cl;const Nl=(Al="undefined"!=typeof Uint8Array&&Qa(Uint8Array),e=>Al&&e instanceof Al);var Al;const Tl=rl("HTMLFormElement"),Ml=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Rl=rl("RegExp"),Dl=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Sl(n,(n,i)=>{let o;!1!==(o=t(n,i,e))&&(r[i]=o||n)}),Object.defineProperties(e,r)};const Pl=rl("AsyncFunction"),Ll=(Bl="function"==typeof setImmediate,Il=hl(Cl.postMessage),Bl?setImmediate:Il?(_l=`axios@${Math.random()}`,jl=[],Cl.addEventListener("message",({source:e,data:t})=>{e===Cl&&t===_l&&jl.length&&jl.shift()()},!1),e=>{jl.push(e),Cl.postMessage(_l,"*")}):e=>setTimeout(e));var Bl,Il,_l,jl;const Fl="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Cl):"undefined"!=typeof process&&process.nextTick||Ll;var Wl={isArray:ol,isArrayBuffer:ll,isBuffer:al,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||hl(e.append)&&("formdata"===(t=tl(e))||"object"===t&&hl(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ll(e.buffer),t},isString:cl,isNumber:ul,isBoolean:e=>!0===e||!1===e,isObject:dl,isPlainObject:fl,isEmptyObject:e=>{if(!dl(e)||al(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:yl,isRequest:wl,isResponse:xl,isHeaders:kl,isUndefined:sl,isDate:pl,isFile:ml,isBlob:gl,isRegExp:Rl,isFunction:hl,isStream:e=>dl(e)&&hl(e.pipe),isURLSearchParams:bl,isTypedArray:Nl,isFileList:vl,forEach:Sl,merge:function e(){const{caseless:t,skipUndefined:n}=Ol(this)&&this||{},r={},i=(i,o)=>{const s=t&&El(r,o)||o;fl(r[s])&&fl(i)?r[s]=e(r[s],i):fl(i)?r[s]=e({},i):ol(i)?r[s]=i.slice():n&&sl(i)||(r[s]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Sl(arguments[e],i);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(Sl(t,(t,r)=>{n&&hl(t)?e[r]=Xa(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Qa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:tl,kindOfTest:rl,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(ol(e))return e;let t=e.length;if(!ul(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Za]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Tl,hasOwnProperty:Ml,hasOwnProp:Ml,reduceDescriptors:Dl,freezeMethods:e=>{Dl(e,(t,n)=>{if(hl(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];hl(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return ol(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:El,global:Cl,isContextDefined:Ol,isSpecCompliantForm:function(e){return!!(e&&hl(e.append)&&"FormData"===e[el]&&e[Za])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(dl(e)){if(t.indexOf(e)>=0)return;if(al(e))return e;if(!("toJSON"in e)){t[r]=e;const i=ol(e)?[]:{};return Sl(e,(e,t)=>{const o=n(e,r+1);!sl(o)&&(i[t]=o)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:Pl,isThenable:e=>e&&(dl(e)||hl(e))&&hl(e.then)&&hl(e.catch),setImmediate:Ll,asap:Fl,isIterable:e=>null!=e&&hl(e[Za])};function zl(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Wl.inherits(zl,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Wl.toJSONObject(this.config),code:this.code,status:this.status}}});const Hl=zl.prototype,Vl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Vl[e]={value:e}}),Object.defineProperties(zl,Vl),Object.defineProperty(Hl,"isAxiosError",{value:!0}),zl.from=(e,t,n,r,i,o)=>{const s=Object.create(Hl);Wl.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return zl.call(s,a,l,n,r,i),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function ql(e){return Wl.isPlainObject(e)||Wl.isArray(e)}function Ul(e){return Wl.endsWith(e,"[]")?e.slice(0,-2):e}function $l(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ul(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Kl=Wl.toFlatObject(Wl,{},null,function(e){return/^is[A-Z]/.test(e)});function Yl(e,t,n){if(!Wl.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Wl.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Wl.isUndefined(t[e])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Wl.isSpecCompliantForm(t);if(!Wl.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Wl.isDate(e))return e.toISOString();if(Wl.isBoolean(e))return e.toString();if(!a&&Wl.isBlob(e))throw new zl("Blob is not supported. Use a Buffer instead.");return Wl.isArrayBuffer(e)||Wl.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(Wl.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Wl.isArray(e)&&function(e){return Wl.isArray(e)&&!e.some(ql)}(e)||(Wl.isFileList(e)||Wl.endsWith(n,"[]"))&&(a=Wl.toArray(e)))return n=Ul(n),a.forEach(function(e,r){!Wl.isUndefined(e)&&null!==e&&t.append(!0===s?$l([n],r,o):null===s?n:n+"[]",l(e))}),!1;return!!ql(e)||(t.append($l(i,n,o),l(e)),!1)}const h=[],u=Object.assign(Kl,{defaultVisitor:c,convertValue:l,isVisitable:ql});if(!Wl.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Wl.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),Wl.forEach(n,function(n,o){!0===(!(Wl.isUndefined(n)||null===n)&&i.call(t,n,Wl.isString(o)?o.trim():o,r,u))&&e(n,r?r.concat(o):[o])}),h.pop()}}(e),t}function Gl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Xl(e,t){this._pairs=[],e&&Yl(e,this,t)}const Jl=Xl.prototype;function Ql(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Zl(e,t,n){if(!t)return e;const r=n&&n.encode||Ql;Wl.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(o=i?i(t,n):Wl.isURLSearchParams(t)?t.toString():new Xl(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Jl.append=function(e,t){this._pairs.push([e,t])},Jl.toString=function(e){const t=e?function(t){return e.call(this,t,Gl)}:Gl;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ec=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Wl.forEach(this.handlers,function(t){null!==t&&e(t)})}},tc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nc={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Xl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const rc="undefined"!=typeof window&&"undefined"!=typeof document,ic="object"==typeof navigator&&navigator||void 0,oc=rc&&(!ic||["ReactNative","NativeScript","NS"].indexOf(ic.product)<0),sc="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ac=rc&&window.location.href||"http://localhost";var lc={...Object.freeze({__proto__:null,hasBrowserEnv:rc,hasStandardBrowserEnv:oc,hasStandardBrowserWebWorkerEnv:sc,navigator:ic,origin:ac}),...nc};function cc(e){function t(e,n,r,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&Wl.isArray(r)?r.length:o,a)return Wl.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Wl.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],i)&&Wl.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}(r[o])),!s}if(Wl.isFormData(e)&&Wl.isFunction(e.entries)){const n={};return Wl.forEachEntry(e,(e,r)=>{t(function(e){return Wl.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const hc={transitional:tc,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=Wl.isObject(e);i&&Wl.isHTMLForm(e)&&(e=new FormData(e));if(Wl.isFormData(e))return r?JSON.stringify(cc(e)):e;if(Wl.isArrayBuffer(e)||Wl.isBuffer(e)||Wl.isStream(e)||Wl.isFile(e)||Wl.isBlob(e)||Wl.isReadableStream(e))return e;if(Wl.isArrayBufferView(e))return e.buffer;if(Wl.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Yl(e,new lc.classes.URLSearchParams,{visitor:function(e,t,n,r){return lc.isNode&&Wl.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Wl.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Yl(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(Wl.isString(e))try{return(t||JSON.parse)(e),Wl.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||hc.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Wl.isResponse(e)||Wl.isReadableStream(e))return e;if(e&&Wl.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw zl.from(e,zl.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lc.classes.FormData,Blob:lc.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Wl.forEach(["delete","get","head","post","put","patch"],e=>{hc.headers[e]={}});var uc=hc;const dc=Wl.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const fc=Symbol("internals");function pc(e){return e&&String(e).trim().toLowerCase()}function mc(e){return!1===e||null==e?e:Wl.isArray(e)?e.map(mc):String(e)}function gc(e,t,n,r,i){return Wl.isFunction(r)?r.call(this,t,n):(i&&(t=n),Wl.isString(t)?Wl.isString(r)?-1!==t.indexOf(r):Wl.isRegExp(r)?r.test(t):void 0:void 0)}class vc{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=pc(t);if(!i)throw new Error("header name must be a non-empty string");const o=Wl.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=mc(e))}const o=(e,t)=>Wl.forEach(e,(e,n)=>i(e,n,t));if(Wl.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Wl.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&dc[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Wl.isObject(e)&&Wl.isIterable(e)){let n,r,i={};for(const t of e){if(!Wl.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?Wl.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=pc(e)){const n=Wl.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Wl.isFunction(t))return t.call(this,e,n);if(Wl.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pc(e)){const n=Wl.findKey(this,e);return!(!n||void 0===this[n]||t&&!gc(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=pc(e)){const i=Wl.findKey(n,e);!i||t&&!gc(0,n[i],i,t)||(delete n[i],r=!0)}}return Wl.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!gc(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return Wl.forEach(this,(r,i)=>{const o=Wl.findKey(n,i);if(o)return t[o]=mc(r),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete t[i],t[s]=mc(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Wl.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Wl.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[fc]=this[fc]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=pc(e);t[r]||(!function(e,t){const n=Wl.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return Wl.isArray(e)?e.forEach(r):r(e),this}}vc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Wl.reduceDescriptors(vc.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Wl.freezeMethods(vc);var bc=vc;function yc(e,t){const n=this||uc,r=t||n,i=bc.from(r.headers);let o=r.data;return Wl.forEach(e,function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function wc(e){return!(!e||!e.__CANCEL__)}function xc(e,t,n){zl.call(this,null==e?"canceled":e,zl.ERR_CANCELED,t,n),this.name="CanceledError"}function kc(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new zl("Request failed with status code "+n.status,[zl.ERR_BAD_REQUEST,zl.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Wl.inherits(xc,zl,{__CANCEL__:!0});const Sc=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=r[s];i||(i=l),n[o]=a,r[o]=l;let h=s,u=0;for(;h!==o;)u+=n[h++],h%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const d=c&&l-c;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let n,r,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]}(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,l=i(a);r=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&o<=s?(s-o)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Ec=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Cc=e=>(...t)=>Wl.asap(()=>e(...t));var Oc=lc.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,lc.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(lc.origin),lc.navigator&&/(msie|trident)/i.test(lc.navigator.userAgent)):()=>!0,Nc=lc.hasStandardBrowserEnv?{write(e,t,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Wl.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Wl.isString(r)&&a.push(`path=${r}`),Wl.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Wl.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ac(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Tc=e=>e instanceof bc?{...e}:e;function Mc(e,t){t=t||{};const n={};function r(e,t,n,r){return Wl.isPlainObject(e)&&Wl.isPlainObject(t)?Wl.merge.call({caseless:r},e,t):Wl.isPlainObject(t)?Wl.merge({},t):Wl.isArray(t)?t.slice():t}function i(e,t,n,i){return Wl.isUndefined(t)?Wl.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function o(e,t){if(!Wl.isUndefined(t))return r(void 0,t)}function s(e,t){return Wl.isUndefined(t)?Wl.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>i(Tc(e),Tc(t),0,!0)};return Wl.forEach(Object.keys({...e,...t}),function(r){const o=l[r]||i,s=o(e[r],t[r],r);Wl.isUndefined(s)&&o!==a||(n[r]=s)}),n}var Rc=e=>{const t=Mc({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=bc.from(s),t.url=Zl(Ac(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Wl.isFormData(n))if(lc.hasStandardBrowserEnv||lc.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Wl.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(lc.hasStandardBrowserEnv&&(r&&Wl.isFunction(r)&&(r=r(t)),r||!1!==r&&Oc(t.url))){const e=i&&o&&Nc.read(o);e&&s.set(i,e)}return t};var Dc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Rc(e);let i=r.data;const o=bc.from(r.headers).normalize();let s,a,l,c,h,{responseType:u,onUploadProgress:d,onDownloadProgress:f}=r;function p(){c&&c(),h&&h(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=bc.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());kc(function(e){t(e),p()},function(e){n(e),p()},{data:u&&"text"!==u&&"json"!==u?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new zl("Request aborted",zl.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new zl(t&&t.message?t.message:"Network Error",zl.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||tc;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new zl(t,i.clarifyTimeoutError?zl.ETIMEDOUT:zl.ECONNABORTED,e,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Wl.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Wl.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),u&&"json"!==u&&(m.responseType=r.responseType),f&&([l,h]=Sc(f,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,c]=Sc(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new xc(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===lc.protocols.indexOf(v)?n(new zl("Unsupported protocol "+v+":",zl.ERR_BAD_REQUEST,e)):m.send(i||null)})};var Pc=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof zl?t:new xc(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,i(new zl(`timeout ${t} of ms exceeded`,zl.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>Wl.asap(s),a}};const Lc=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},Bc=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ic=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of Bc(e))yield*Lc(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:_c}=Wl,jc=(({Request:e,Response:t})=>({Request:e,Response:t}))(Wl.global),{ReadableStream:Fc,TextEncoder:Wc}=Wl.global,zc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Hc=e=>{e=Wl.merge.call({skipUndefined:!0},jc,e);const{fetch:t,Request:n,Response:r}=e,i=t?_c(t):"function"==typeof fetch,o=_c(n),s=_c(r);if(!i)return!1;const a=i&&_c(Fc),l=i&&("function"==typeof Wc?(c=new Wc,e=>c.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var c;const h=o&&a&&zc(()=>{let e=!1;const t=new n(lc.origin,{body:new Fc,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&zc(()=>Wl.isReadableStream(new r("").body)),d={stream:u&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new zl(`Response type '${e}' is not supported`,zl.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=Wl.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Wl.isBlob(e))return e.size;if(Wl.isSpecCompliantForm(e)){const t=new n(lc.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Wl.isArrayBufferView(e)||Wl.isArrayBuffer(e)?e.byteLength:(Wl.isURLSearchParams(e)&&(e+=""),Wl.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:i,method:s,data:a,signal:l,cancelToken:c,timeout:p,onDownloadProgress:m,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:w}=Rc(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let k=Pc([l,c&&c.toAbortSignal()],p),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let C;try{if(g&&h&&"get"!==s&&"head"!==s&&0!==(C=await f(b,a))){let e,t=new n(i,{method:"POST",body:a,duplex:"half"});if(Wl.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=Ec(C,Sc(Cc(g)));a=Ic(t.body,65536,e,n)}}Wl.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in n.prototype,l={...w,signal:k,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?y:void 0};S=o&&new n(i,l);let c=await(o?x(S,w):x(i,l));const p=u&&("stream"===v||"response"===v);if(u&&(m||p&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=Wl.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&Ec(t,Sc(Cc(m),!0))||[];c=new r(Ic(c.body,65536,n,()=>{i&&i(),E&&E()}),e)}v=v||"text";let O=await d[Wl.findKey(d,v)||"text"](c,e);return!p&&E&&E(),await new Promise((t,n)=>{kc(t,n,{data:O,headers:bc.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:S})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new zl("Network Error",zl.ERR_NETWORK,e,S),{cause:t.cause||t});throw zl.from(t,t&&t.code,e,S)}}},Vc=new Map,qc=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let s,a,l=o.length,c=Vc;for(;l--;)s=o[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:Hc(t)),c=a;return a};qc();const Uc={http:null,xhr:Dc,fetch:{get:qc}};Wl.forEach(Uc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const $c=e=>`- ${e}`,Kc=e=>Wl.isFunction(e)||null===e||!1===e;var Yc={getAdapter:function(e,t){e=Wl.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=e[s],i=r,!Kc(r)&&(i=Uc[(n=String(r)).toLowerCase()],void 0===i))throw new zl(`Unknown adapter '${n}'`);if(i&&(Wl.isFunction(i)||(i=i.get(t))))break;o[n||"#"+s]=i}if(!i){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new zl("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map($c).join("\n"):" "+$c(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:Uc};function Gc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xc(null,e)}function Xc(e){Gc(e),e.headers=bc.from(e.headers),e.data=yc.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Yc.getAdapter(e.adapter||uc.adapter,e)(e).then(function(t){return Gc(e),t.data=yc.call(e,e.transformResponse,t),t.headers=bc.from(t.headers),t},function(t){return wc(t)||(Gc(e),t&&t.response&&(t.response.data=yc.call(e,e.transformResponse,t.response),t.response.headers=bc.from(t.response.headers))),Promise.reject(t)})}const Jc="1.13.2",Qc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Zc={};Qc.transitional=function(e,t,n){return(r,i,o)=>{if(!1===e)throw new zl(function(e,t){return"[Axios v"+Jc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}(i," has been removed"+(t?" in "+t:"")),zl.ERR_DEPRECATED);return t&&!Zc[i]&&(Zc[i]=!0),!e||e(r,i,o)}},Qc.spelling=function(e){return(e,t)=>!0};var eh={assertOptions:function(e,t,n){if("object"!=typeof e)throw new zl("options must be an object",zl.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new zl("option "+o+" must be "+n,zl.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new zl("Unknown option "+o,zl.ERR_BAD_OPTION)}},validators:Qc};const th=eh.validators;class nh{constructor(e){this.defaults=e||{},this.interceptors={request:new ec,response:new ec}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Mc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&eh.assertOptions(n,{silentJSONParsing:th.transitional(th.boolean),forcedJSONParsing:th.transitional(th.boolean),clarifyTimeoutError:th.transitional(th.boolean)},!1),null!=r&&(Wl.isFunction(r)?t.paramsSerializer={serialize:r}:eh.assertOptions(r,{encode:th.function,serialize:th.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),eh.assertOptions(t,{baseUrl:th.spelling("baseURL"),withXsrfToken:th.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&Wl.merge(i.common,i[t.method]);i&&Wl.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=bc.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let h,u=0;if(!a){const e=[Xc.bind(this),void 0];for(e.unshift(...s),e.push(...l),h=e.length,c=Promise.resolve(t);u<h;)c=c.then(e[u++],e[u++]);return c}h=s.length;let d=t;for(;u<h;){const e=s[u++],t=s[u++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=Xc.call(this,d)}catch(e){return Promise.reject(e)}for(u=0,h=l.length;u<h;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Zl(Ac((e=Mc(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}Wl.forEach(["delete","get","head","options"],function(e){nh.prototype[e]=function(t,n){return this.request(Mc(n||{},{method:e,url:t,data:(n||{}).data}))}}),Wl.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(Mc(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}nh.prototype[e]=t(),nh.prototype[e+"Form"]=t(!0)});var rh=nh;class ih{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new xc(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ih(function(t){e=t}),cancel:e}}}var oh=ih;const sh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sh).forEach(([e,t])=>{sh[t]=e});var ah=sh;const lh=function e(t){const n=new rh(t),r=Xa(rh.prototype.request,n);return Wl.extend(r,rh.prototype,n,{allOwnKeys:!0}),Wl.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Mc(t,n))},r}(uc);lh.Axios=rh,lh.CanceledError=xc,lh.CancelToken=oh,lh.isCancel=wc,lh.VERSION=Jc,lh.toFormData=Yl,lh.AxiosError=zl,lh.Cancel=lh.CanceledError,lh.all=function(e){return Promise.all(e)},lh.spread=function(e){return function(t){return e.apply(null,t)}},lh.isAxiosError=function(e){return Wl.isObject(e)&&!0===e.isAxiosError},lh.mergeConfig=Mc,lh.AxiosHeaders=bc,lh.formToJSON=e=>cc(Wl.isHTMLForm(e)?new FormData(e):e),lh.getAdapter=Yc.getAdapter,lh.HttpStatusCode=ah,lh.default=lh;var ch=lh.create({baseURL:"/api/cms",timeout:1e4,headers:{"Content-Type":"application/json"}});ch.interceptors.request.use(function(e){e.url&&e.url.startsWith("http")&&(e.baseURL="");var t=localStorage.getItem("cms_token");t&&(e.headers.Authorization="Bearer ".concat(t));var n=localStorage.getItem("cms_session_id");return n&&(e.headers["X-Session-Id"]=n),e},function(e){return Promise.reject(e)}),ch.interceptors.response.use(function(e){return e},function(e){var t="请求错误",n=!1;if(e.response){var r=e.response.status,i=e.response.data;401===r?"登录已过期,请重新登录"===(null==i?void 0:i.message)?(t="登录已过期,请重新登录",n=!0):"认证信息无效"===(null==i?void 0:i.message)?(t="认证信息无效,请重新登录",n=!0):(t="认证失败,请登录",n=!0):t=(null==i?void 0:i.message)||"HTTP ".concat(r,": ").concat(e.response.statusText)}else t=e.request?"网络连接失败,请检查网络状态":e.message||"请求错误";return n?(localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),"/login"!==window.location.pathname&&"/"!==window.location.pathname&&(Ga.error(t),setTimeout(function(){window.location.reload()},1e3))):Ga.error(t),Promise.reject(e)});var hh,uh=function(e,t,n){if(t){var r=new URLSearchParams(t).toString();e=e+(e.includes("?")?"&":"?")+r}return ch.get(e,n).then(function(e){return e.data})},dh=function(e,t,n){return ch.post(e,t,n).then(function(e){return e.data})},fh=function(e,t,n){return ch.put(e,t,n).then(function(e){return e.data})},ph=function(e,t){return ch.delete(e,t).then(function(e){return e.data})};try{var mh=localStorage.getItem("cms_session_id")||void 0;hh=mh}catch(nS){}function gh(e){hh=e;try{localStorage.setItem("cms_session_id",e)}catch(e){}}var vh=function(){return uh("/models")},bh=function(){return uh("/auth/signup/status/".concat(hh?hh+"_":"","cms_users"))},yh=function(e){return dh("/auth/signup/".concat(hh?hh+"_":"","cms_users"),e)},wh=function(e){return dh("/auth/login/".concat(hh?hh+"_":"","cms_users"),e)},xh=function(){return dh("/auth/verify/".concat(hh?hh+"_":"","cms_users"))},kh=function(){return uh("/auth/user/".concat(hh?hh+"_":"","cms_users"))},Sh=function(){localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user")},Eh=function(){return localStorage.getItem("cms_token")},Ch=function(){var e=localStorage.getItem("cms_user");return e?JSON.parse(e):null},Oh=function(e,t){var n=t?Object.assign({},t):void 0;return(null==n?void 0:n.filters)&&Array.isArray(n.filters)&&(n.filters=JSON.stringify(n.filters)),uh("/data/".concat(hh?hh+"_":"").concat(e),n)},Nh=function(e,t){return uh("/relation/".concat(hh?hh+"_":"").concat(e,"/options"),t)},Ah=function(e,t){return dh("/data/".concat(hh?hh+"_":"").concat(e),t)},Th=function(e,t){return fh("/data/".concat(hh?hh+"_":"").concat(e),t)},Mh=function(e,t){return ph("/data/".concat(hh?hh+"_":"").concat(e,"?id=").concat(t))};function Rh(e){var n=e.onLoginSuccess,r=C(i(""),2),o=r[0],s=r[1],l=C(i(""),2),c=l[0],h=l[1],u=C(i(!1),2),d=u[0],f=u[1],p=C(i("login"),2),m=p[0],g=p[1];a(function(){var e=Eh();if(e){var t=function(){var t=w(S().m(function t(){var r;return S().w(function(t){for(;;)switch(t.p=t.n){case 0:return f(!0),t.p=1,t.n=2,xh();case 2:if(t.v.success){t.n=3;break}throw new Error("token验证失败");case 3:return t.n=4,kh();case 4:if(!(r=t.v).success||!r.data){t.n=5;break}localStorage.setItem("cms_user",JSON.stringify(r.data)),null==n||n(e,r.data),t.n=6;break;case 5:throw new Error("获取用户信息失败");case 6:t.n=8;break;case 7:t.p=7,t.v,Sh();case 8:return t.p=8,f(!1),t.f(8);case 9:return t.a(2)}},t,null,[[1,7,8,9]])}));return function(){return t.apply(this,arguments)}}();t()}},[n]),a(function(){if(!Eh()){var e=function(){var e=w(S().m(function e(){var t,n;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:return f(!0),e.p=1,e.n=2,bh();case 2:(n=e.v).success&&(null===(t=n.data)||void 0===t?void 0:t.allowSignup)?g("signup"):g("login"),e.n=4;break;case 3:e.p=3,e.v,g("login");case 4:return e.p=4,f(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()}},[]);var v=function(){var e=w(S().m(function e(t){var r,i,s,a,l;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),o&&c){e.n=1;break}return Ga.error("请完善登录信息"),e.a(2);case 1:if(f(!0),e.p=2,"signup"!==m){e.n=4;break}return e.n=3,yh({username:o,password:c});case 3:a=e.v,e.n=6;break;case 4:return e.n=5,wh({username:o,password:c});case 5:a=e.v;case 6:if((s=a).success&&(null===(r=s.data)||void 0===r?void 0:r.token)){e.n=7;break}return Ga.error(s.message||"登录失败"),"signup"===m&&(null===(i=s.message)||void 0===i?void 0:i.includes("已存在管理员"))&&g("login"),e.a(2);case 7:localStorage.setItem("cms_token",s.data.token),localStorage.setItem("cms_user",JSON.stringify(s.data.user)),null==n||n(s.data.token,s.data.user),e.n=9;break;case 8:e.p=8,l=e.v,Ga.error("登陆失败,".concat(l.message||"网络错误,请稍后重试"));case 9:return e.p=9,f(!1),e.f(9);case 10:return e.a(2)}},e,null,[[2,8,9,10]])}));return function(t){return e.apply(this,arguments)}}();return t.createElement("div",{className:"min-h-screen flex relative overflow-hidden bg-white"},t.createElement("div",{className:"pointer-events-none absolute inset-0"},t.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(110deg,#ffffff_0%,#f7fbff_40%,#edf6ff_70%,#eaf3ff_100%)]"}),t.createElement("div",{className:"absolute inset-0 bg-[radial-gradient(1200px_600px_at_-10%_-10%,rgba(59,130,246,0.12),transparent),radial-gradient(900px_500px_at_110%_20%,rgba(147,51,234,0.10),transparent),radial-gradient(700px_400px_at_60%_120%,rgba(99,102,241,0.10),transparent)]"}),t.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(115deg,rgba(255,255,255,0.6)_0%,rgba(255,255,255,0.15)_32%,transparent_32%,transparent_68%,rgba(255,255,255,0.15)_68%,rgba(255,255,255,0.6)_100%)]"})),t.createElement("div",{className:"flex-1 relative flex items-center justify-center"},t.createElement("div",{className:"relative z-10 max-w-4xl w-full px-16 text-left"},t.createElement("div",{className:"mb-12"},t.createElement("div",{className:"inline-flex items-center rounded-2xl px-4 py-2 bg-white/70 backdrop-blur border border-white/60"},t.createElement("span",{className:"text-2xl font-semibold tracking-tight text-gray-900"},"CMS 管理后台")),t.createElement("h1",{className:"mt-8 text-5xl md:text-6xl font-extrabold leading-tight text-gray-900"},"内容管理平台"),t.createElement("p",{className:"mt-6 text-2xl text-gray-600"},"一站式管理、协作与发布")),t.createElement("div",{className:"mt-8 flex items-center text-gray-500 gap-6"},t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-blue-500"}),"多角色权限"),t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-violet-500"}),"结构化内容"),t.createElement("span",{className:"flex items-center gap-2"},t.createElement("span",{className:"h-2 w-2 rounded-full bg-indigo-500"}),"可扩展 API")))),t.createElement("div",{className:"w-[480px] min-w-[380px] flex items-center justify-center p-8 mt-30"},t.createElement("div",{className:"w-full max-w-sm"},d?t.createElement(Ma,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},t.createElement(La,{className:"p-8"},t.createElement("div",{className:"space-y-4"},t.createElement(tt,{className:"h-12 w-48"}),t.createElement(tt,{className:"h-4 w-64"}),t.createElement(tt,{className:"h-10 w-full"}),t.createElement(tt,{className:"h-10 w-full"})))):t.createElement(Ma,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},t.createElement(Ra,{className:"p-8 pb-6"},t.createElement(Da,{className:"text-center text-2xl mb-2 text-gray-800"},"signup"===m?"创建管理员账号":"欢迎使用 CMS 管理后台"),t.createElement(Pa,{className:"text-center text-gray-500"},"signup"===m?"首次进入需要先创建一个管理员账号":"请输入账号和密码登录")),t.createElement(La,{className:"p-8 pt-0"},t.createElement("form",{onSubmit:v,className:"space-y-6"},t.createElement("div",{className:"space-y-2"},t.createElement(Ta,{htmlFor:"username"},"账号/邮箱"),t.createElement("div",{className:"relative"},t.createElement(te,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.createElement(bt,{id:"username",type:"text",placeholder:"邮箱",value:o,onChange:function(e){return s(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:2}))),t.createElement("div",{className:"space-y-2"},t.createElement(Ta,{htmlFor:"password"},"密码"),t.createElement("div",{className:"relative"},t.createElement(U,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.createElement(bt,{id:"password",type:"password",placeholder:"密码",value:c,onChange:function(e){return h(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:6}))),t.createElement(vt,{type:"submit",className:"w-full h-12 rounded-xl transition-all duration-200 font-semibold text-base shadow-lg hover:brightness-[1.03] active:scale-[0.99]",style:{backgroundImage:"linear-gradient(135deg, rgba(236, 248, 255, 0.78) 0%, rgba(221, 238, 255, 0.78) 100%)",color:"rgba(0, 0, 0, 0.7)",border:"none",boxShadow:"0 6px 24px rgba(37, 99, 235, 0.12)"},disabled:d},t.createElement($,{className:"h-4 w-4 mr-2"}),d?"signup"===m?"创建中...":"登录中...":"signup"===m?"创建账号并进入":"登录"),t.createElement("div",{className:"text-center text-sm text-gray-500"},"signup"===m?t.createElement("button",{type:"button",className:"underline underline-offset-4 hover:text-gray-700",onClick:function(){return g("login")},disabled:d},"已有账号?去登录"):t.createElement("button",{type:"button",className:"underline underline-offset-4 hover:text-gray-700",onClick:function(){return g("signup")},disabled:d},"首次使用?创建管理员"))))))))}function Dh(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ph(t){const n=Lh(t),r=e.forwardRef((t,r)=>{const{children:i,...o}=t,s=e.Children.toArray(i),a=s.find(Ih);if(a){const t=a.props.children,i=s.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return u(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return u(n,{...o,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}function Lh(t){const n=e.forwardRef((t,n)=>{const{children:r,...i}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==e.Fragment&&(o.ref=n?rt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Bh=Symbol("radix.slottable");function Ih(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Bh}var _h=e.createContext(void 0);var jh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=Ph(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{});var Fh,Wh="dismissableLayer.update",zh="dismissableLayer.pointerDownOutside",Hh="dismissableLayer.focusOutside",Vh=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qh=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=t,h=e.useContext(Vh),[d,f]=e.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=e.useState({}),g=it(n,e=>f(e)),v=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=h.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1),o=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){let t=function(){$h(zh,r,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=t,n.addEventListener("click",o.current,{once:!0})):t()}else n.removeEventListener("click",o.current);i.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}},[n,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{const t=e.target,n=[...h.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),a?.(e),e.defaultPrevented||l?.())},p),E=function(t,n=globalThis?.document){const r=Ft(t),i=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!i.current){$h(Hh,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{const t=e.target;[...h.branches].some(e=>e.contains(t))||(s?.(e),a?.(e),e.defaultPrevented||l?.())},p);return Wt(e=>{w===h.layers.size-1&&(i?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},p),e.useEffect(()=>{if(d)return r&&(0===h.layersWithOutsidePointerEventsDisabled.size&&(Fh=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(d)),h.layers.add(d),Uh(),()=>{r&&1===h.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Fh)}},[d,p,r,h]),e.useEffect(()=>()=>{d&&(h.layers.delete(d),h.layersWithOutsidePointerEventsDisabled.delete(d),Uh())},[d,h]),e.useEffect(()=>{const e=()=>m({});return document.addEventListener(Wh,e),()=>document.removeEventListener(Wh,e)},[]),u(jh.div,{...c,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...t.style},onFocusCapture:Ct(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Ct(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ct(t.onPointerDownCapture,S.onPointerDownCapture)})});qh.displayName="DismissableLayer";function Uh(){const e=new CustomEvent(Wh);document.dispatchEvent(e)}function $h(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&p.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}e.forwardRef((t,n)=>{const r=e.useContext(Vh),i=e.useRef(null),o=it(n,i);return e.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),u(jh.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var Kh="focusScope.autoFocusOnMount",Yh="focusScope.autoFocusOnUnmount",Gh={bubbles:!1,cancelable:!0},Xh=e.forwardRef((t,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=t,[l,c]=e.useState(null),h=Ft(o),d=Ft(s),f=e.useRef(null),p=it(n,e=>c(e)),m=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect(()=>{if(i){let e=function(e){if(m.paused||!l)return;const t=e.target;l.contains(t)?f.current=t:eu(f.current,{select:!0})},t=function(e){if(m.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||eu(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&eu(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[i,l,m.paused]),e.useEffect(()=>{if(l){tu.add(m);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(Kh,Gh);l.addEventListener(Kh,h),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(eu(r,{select:t}),document.activeElement!==n)return}((e=Jh(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&eu(l))}return()=>{l.removeEventListener(Kh,h),setTimeout(()=>{const e=new CustomEvent(Yh,Gh);l.addEventListener(Yh,d),l.dispatchEvent(e),e.defaultPrevented||eu(t??document.body,{select:!0}),l.removeEventListener(Yh,d),tu.remove(m)},0)}}var e},[l,h,d,m]);const g=e.useCallback(e=>{if(!r&&!i)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Jh(e),n=Qh(t,e),r=Qh(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&eu(o,{select:!0})):(e.preventDefault(),r&&eu(i,{select:!0})):n===t&&e.preventDefault()}},[r,i,m.paused]);return u(jh.div,{tabIndex:-1,...a,ref:p,onKeyDown:g})});function Jh(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Qh(e,t){for(const n of e)if(!Zh(n,{upTo:t}))return n}function Zh(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function eu(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Xh.displayName="FocusScope";var tu=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=nu(e,t),e.unshift(t)},remove(t){e=nu(e,t),e[0]?.resume()}}}();function nu(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var ru=e.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return u(jh.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u("polygon",{points:"0,0 30,0 15,10"})})});ru.displayName="Arrow";var iu=ru,ou="Popper",[su,au]=Ot(ou),[lu,cu]=su(ou),hu=t=>{const{__scopePopper:n,children:r}=t,[i,o]=e.useState(null);return u(lu,{scope:n,anchor:i,onAnchorChange:o,children:r})};hu.displayName=ou;var uu="PopperAnchor",du=e.forwardRef((t,n)=>{const{__scopePopper:r,virtualRef:i,...o}=t,s=cu(uu,r),a=e.useRef(null),l=it(n,a),c=e.useRef(null);return e.useEffect(()=>{const e=c.current;c.current=i?.current||a.current,e!==c.current&&s.onAnchorChange(c.current)}),i?null:u(jh.div,{...o,ref:l})});du.displayName=uu;var fu="PopperContent",[pu,mu]=su(fu),gu=e.forwardRef((t,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:h=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=t,b=cu(fu,r),[y,w]=e.useState(null),x=it(n,e=>w(e)),[k,S]=e.useState(null),E=os(k),C=E?.width??0,O=E?.height??0,N=i+("center"!==s?"-"+s:""),A="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(h)?h:[h],M=T.length>0,R={padding:A,boundary:T.filter(wu),altBoundary:M},{refs:D,floatingStyles:P,placement:L,isPositioned:B,middlewareData:I}=Yo({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Lo(...e,{animationFrame:"always"===m}),elements:{reference:b.anchor},middleware:[Xo({mainAxis:o+O,alignmentAxis:a}),c&&Jo({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?Qo():void 0,...R}),c&&Zo({...R}),es({...R,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&ns({element:k,padding:l}),xu({arrowWidth:C,arrowHeight:O}),p&&ts({strategy:"referenceHidden",...R})]}),[_,j]=ku(L),F=Ft(g);At(()=>{B&&F?.()},[B,F]);const W=I.arrow?.x,z=I.arrow?.y,H=0!==I.arrow?.centerOffset,[V,q]=e.useState();return At(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),u("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:B?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u(pu,{scope:r,placedSide:_,onArrowChange:S,arrowX:W,arrowY:z,shouldHideArrow:H,children:u(jh.div,{"data-side":_,"data-align":j,...v,ref:x,style:{...v.style,animation:B?void 0:"none"}})})})});gu.displayName=fu;var vu="PopperArrow",bu={top:"bottom",right:"left",bottom:"top",left:"right"},yu=e.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,i=mu(vu,n),o=bu[i.placedSide];return u("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:u(iu,{...r,ref:t,style:{...r.style,display:"block"}})})});function wu(e){return null!==e}yu.displayName=vu;var xu=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,o=0!==i.arrow?.centerOffset,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=ku(n),h={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,d=(i.arrow?.y??0)+a/2;let f="",p="";return"bottom"===l?(f=o?h:`${u}px`,p=-a+"px"):"top"===l?(f=o?h:`${u}px`,p=`${r.floating.height+a}px`):"right"===l?(f=-a+"px",p=o?h:`${d}px`):"left"===l&&(f=`${r.floating.width+a}px`,p=o?h:`${d}px`),{data:{x:f,y:p}}}});function ku(e){const[t,n="center"]=e.split("-");return[t,n]}var Su=hu,Eu=du,Cu=gu,Ou=yu,Nu=e.forwardRef((t,n)=>{const{container:r,...i}=t,[o,s]=e.useState(!1);At(()=>s(!0),[]);const a=r||o&&globalThis?.document?.body;return a?m.createPortal(u(jh.div,{...i,ref:n}),a):null});function Au(t){const n=e.useRef({value:t,previous:t});return e.useMemo(()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous),[t])}Nu.displayName="Portal";var Tu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});e.forwardRef((e,t)=>u(jh.span,{...e,ref:t,style:{...Tu,...e.style}})).displayName="VisuallyHidden";var Mu=[" ","Enter","ArrowUp","ArrowDown"],Ru=[" ","Enter"],Du="Select",[Pu,Lu,Bu]=function(e){const n=e+"CollectionProvider",[r,i]=Ot(n),[o,s]=r(n,{collectionRef:{current:null},itemMap:new Map}),a=e=>{const{scope:n,children:r}=e,i=t.useRef(null),s=t.useRef(new Map).current;return u(o,{scope:n,itemMap:s,collectionRef:i,children:r})};a.displayName=n;const l=e+"CollectionSlot",c=Ph(l),h=t.forwardRef((e,t)=>{const{scope:n,children:r}=e,i=it(t,s(l,n).collectionRef);return u(c,{ref:i,children:r})});h.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=Ph(d),m=t.forwardRef((e,n)=>{const{scope:r,children:i,...o}=e,a=t.useRef(null),l=it(n,a),c=s(d,r);return t.useEffect(()=>(c.itemMap.set(a,{ref:a,...o}),()=>{c.itemMap.delete(a)})),u(p,{[f]:"",ref:l,children:i})});return m.displayName=d,[{Provider:a,Slot:h,ItemSlot:m},function(n){const r=s(e+"CollectionConsumer",n);return t.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},i]}(Du),[Iu,_u]=Ot(Du,[Bu,au]),ju=au(),[Fu,Wu]=Iu(Du),[zu,Hu]=Iu(Du),Vu=t=>{const{__scopeSelect:n,children:r,open:i,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:c,dir:h,name:f,autoComplete:p,disabled:m,required:g,form:v}=t,b=ju(n),[y,w]=e.useState(null),[x,k]=e.useState(null),[S,E]=e.useState(!1),C=function(t){const n=e.useContext(_h);return t||n||"ltr"}(h),[O,N]=Pt({prop:i,defaultProp:o??!1,onChange:s,caller:Du}),[A,T]=Pt({prop:a,defaultProp:l,onChange:c,caller:Du}),M=e.useRef(null),R=!y||(v||!!y.closest("form")),[D,P]=e.useState(new Set),L=Array.from(D).map(e=>e.props.value).join(";");return u(Su,{...b,children:d(Fu,{required:g,scope:n,trigger:y,onTriggerChange:w,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:Rt(),value:A,onValueChange:T,open:O,onOpenChange:N,dir:C,triggerPointerDownPosRef:M,disabled:m,children:[u(Pu.Provider,{scope:n,children:u(zu,{scope:t.__scopeSelect,onNativeOptionAdd:e.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:e.useCallback(e=>{P(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),R?d(Td,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:p,value:A,onChange:e=>T(e.target.value),disabled:m,form:v,children:[void 0===A?u("option",{value:""}):null,Array.from(D)]},L):null]})})};Vu.displayName=Du;var qu="SelectTrigger",Uu=e.forwardRef((t,n)=>{const{__scopeSelect:r,disabled:i=!1,...o}=t,s=ju(r),a=Wu(qu,r),l=a.disabled||i,c=it(n,a.onTriggerChange),h=Lu(r),d=e.useRef("touch"),[f,p,m]=Rd(e=>{const t=h().filter(e=>!e.disabled),n=t.find(e=>e.value===a.value),r=Dd(t,e,n);void 0!==r&&a.onValueChange(r.value)}),g=e=>{l||(a.onOpenChange(!0),m()),e&&(a.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return u(Eu,{asChild:!0,...s,children:u(jh.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Md(a.value)?"":void 0,...o,ref:c,onClick:Ct(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&g(e)}),onPointerDown:Ct(o.onPointerDown,e=>{d.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Ct(o.onKeyDown,e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||Mu.includes(e.key)&&(g(),e.preventDefault())})})})});Uu.displayName=qu;var $u="SelectValue",Ku=e.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...a}=e,l=Wu($u,n),{onValueNodeHasChildrenChange:c}=l,h=void 0!==o,d=it(t,l.onValueNodeChange);return At(()=>{c(h)},[c,h]),u(jh.span,{...a,ref:d,style:{pointerEvents:"none"},children:Md(l.value)?u(f,{children:s}):o})});Ku.displayName=$u;var Yu=e.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return u(jh.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Yu.displayName="SelectIcon";var Gu=e=>u(Nu,{asChild:!0,...e});Gu.displayName="SelectPortal";var Xu="SelectContent",Ju=e.forwardRef((t,n)=>{const r=Wu(Xu,t.__scopeSelect),[i,o]=e.useState();if(At(()=>{o(new DocumentFragment)},[]),!r.open){const e=i;return e?p.createPortal(u(Zu,{scope:t.__scopeSelect,children:u(Pu.Slot,{scope:t.__scopeSelect,children:u("div",{children:t.children})})}),e):null}return u(nd,{...t,ref:n})});Ju.displayName=Xu;var Qu=10,[Zu,ed]=Iu(Xu),td=Ph("SelectContent.RemoveScroll"),nd=e.forwardRef((t,n)=>{const{__scopeSelect:r,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:h,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=t,w=Wu(Xu,r),[x,k]=e.useState(null),[S,E]=e.useState(null),C=it(n,e=>k(e)),[O,N]=e.useState(null),[A,T]=e.useState(null),M=Lu(r),[R,D]=e.useState(!1),P=e.useRef(!1);e.useEffect(()=>{if(x)return ir(x)},[x]),hn();const L=e.useCallback(e=>{const[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(const n of e){if(n===i)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i)return}},[M,S]),B=e.useCallback(()=>L([O,x]),[L,O,x]);e.useEffect(()=>{R&&B()},[R,B]);const{onOpenChange:I,triggerPointerDownPosRef:_}=w;e.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(_.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(_.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||I(!1),document.removeEventListener("pointermove",t),_.current=null};return null!==_.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,I,_]),e.useEffect(()=>{const e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);const[j,F]=Rd(e=>{const t=M().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Dd(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),W=e.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&(N(e),r&&(P.current=!0))},[w.value]),z=e.useCallback(()=>x?.focus(),[x]),H=e.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&T(e)},[w.value]),V="popper"===i?id:rd,q=V===id?{side:l,sideOffset:c,align:h,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return u(Zu,{scope:r,content:x,viewport:S,onViewportChange:E,itemRefCallback:W,selectedItem:O,onItemLeave:z,itemTextRefCallback:H,focusSelectedItem:B,selectedItemText:A,position:i,isPositioned:R,searchRef:j,children:u(Jn,{as:td,allowPinchZoom:!0,children:u(Xh,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Ct(o,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:u(qh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:u(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...q,onPlaced:()=>D(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Ct(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>L(t)),e.preventDefault()}})})})})})})});nd.displayName="SelectContentImpl";var rd=e.forwardRef((t,n)=>{const{__scopeSelect:r,onPlaced:i,...o}=t,s=Wu(Xu,r),a=ed(Xu,r),[l,c]=e.useState(null),[h,d]=e.useState(null),f=it(n,e=>d(e)),p=Lu(r),m=e.useRef(!1),g=e.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=a,x=e.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&h&&v&&b&&y){const e=s.trigger.getBoundingClientRect(),t=h.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if("rtl"!==s.dir){const i=r.left-t.left,o=n.left-i,s=e.left-o,a=e.width+s,c=Math.max(a,t.width),h=window.innerWidth-Qu,u=Dh(o,[Qu,Math.max(Qu,h-c)]);l.style.minWidth=a+"px",l.style.left=u+"px"}else{const i=t.right-r.right,o=window.innerWidth-n.right-i,s=window.innerWidth-e.right-o,a=e.width+s,c=Math.max(a,t.width),h=window.innerWidth-Qu,u=Dh(o,[Qu,Math.max(Qu,h-c)]);l.style.minWidth=a+"px",l.style.right=u+"px"}const o=p(),a=window.innerHeight-2*Qu,c=v.scrollHeight,u=window.getComputedStyle(h),d=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),w=d+f+c+parseInt(u.paddingBottom,10)+g,x=Math.min(5*b.offsetHeight,w),k=window.getComputedStyle(v),S=parseInt(k.paddingTop,10),E=parseInt(k.paddingBottom,10),C=e.top+e.height/2-Qu,O=a-C,N=b.offsetHeight/2,A=d+f+(b.offsetTop+N),T=w-A;if(A<=C){const e=o.length>0&&b===o[o.length-1].ref.current;l.style.bottom="0px";const t=h.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(O,N+(e?E:0)+t+g);l.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;l.style.top="0px";const t=Math.max(C,d+v.offsetTop+(e?S:0)+N)+T;l.style.height=t+"px",v.scrollTop=A-C+v.offsetTop}l.style.margin=`${Qu}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=a+"px",i?.(),requestAnimationFrame(()=>m.current=!0)}},[p,s.trigger,s.valueNode,l,h,v,b,y,s.dir,i]);At(()=>x(),[x]);const[k,S]=e.useState();At(()=>{h&&S(window.getComputedStyle(h).zIndex)},[h]);const E=e.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return u(od,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:u("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:u(jh.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});rd.displayName="SelectItemAlignedPosition";var id=e.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Qu,...o}=e,s=ju(n);return u(Cu,{...s,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});id.displayName="SelectPopperPosition";var[od,sd]=Iu(Xu,{}),ad="SelectViewport",ld=e.forwardRef((t,n)=>{const{__scopeSelect:r,nonce:i,...o}=t,s=ed(ad,r),a=sd(ad,r),l=it(n,s.onViewportChange),c=e.useRef(0);return d(f,{children:[u("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),u(Pu.Slot,{scope:r,children:u(jh.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ct(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=a;if(r?.current&&n){const e=Math.abs(c.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*Qu,i=parseFloat(n.style.minHeight),o=parseFloat(n.style.height),s=Math.max(i,o);if(s<r){const i=s+e,o=Math.min(r,i),a=i-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=a>0?a:0,n.style.justifyContent="flex-end")}}}c.current=t.scrollTop})})})]})});ld.displayName=ad;var cd="SelectGroup",[hd,ud]=Iu(cd);e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Rt();return u(hd,{scope:n,id:i,children:u(jh.div,{role:"group","aria-labelledby":i,...r,ref:t})})}).displayName=cd;var dd="SelectLabel",fd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=ud(dd,n);return u(jh.div,{id:i.id,...r,ref:t})});fd.displayName=dd;var pd="SelectItem",[md,gd]=Iu(pd),vd=e.forwardRef((t,n)=>{const{__scopeSelect:r,value:i,disabled:o=!1,textValue:s,...a}=t,l=Wu(pd,r),c=ed(pd,r),h=l.value===i,[d,f]=e.useState(s??""),[p,m]=e.useState(!1),g=it(n,e=>c.itemRefCallback?.(e,i,o)),v=Rt(),b=e.useRef("touch"),y=()=>{o||(l.onValueChange(i),l.onOpenChange(!1))};if(""===i)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u(md,{scope:r,value:i,disabled:o,textId:v,isSelected:h,onItemTextChange:e.useCallback(e=>{f(t=>t||(e?.textContent??"").trim())},[]),children:u(Pu.ItemSlot,{scope:r,value:i,disabled:o,textValue:d,children:u(jh.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":h&&p,"data-state":h?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:g,onFocus:Ct(a.onFocus,()=>m(!0)),onBlur:Ct(a.onBlur,()=>m(!1)),onClick:Ct(a.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:Ct(a.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:Ct(a.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:Ct(a.onPointerMove,e=>{b.current=e.pointerType,o?c.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ct(a.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Ct(a.onKeyDown,e=>{""!==c.searchRef?.current&&" "===e.key||(Ru.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});vd.displayName=pd;var bd="SelectItemText",yd=e.forwardRef((t,n)=>{const{__scopeSelect:r,className:i,style:o,...s}=t,a=Wu(bd,r),l=ed(bd,r),c=gd(bd,r),h=Hu(bd,r),[m,g]=e.useState(null),v=it(n,e=>g(e),c.onItemTextChange,e=>l.itemTextRefCallback?.(e,c.value,c.disabled)),b=m?.textContent,y=e.useMemo(()=>u("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=h;return At(()=>(w(y),()=>x(y)),[w,x,y]),d(f,{children:[u(jh.span,{id:c.textId,...s,ref:v}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?p.createPortal(s.children,a.valueNode):null]})});yd.displayName=bd;var wd="SelectItemIndicator",xd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return gd(wd,n).isSelected?u(jh.span,{"aria-hidden":!0,...r,ref:t}):null});xd.displayName=wd;var kd="SelectScrollUpButton",Sd=e.forwardRef((t,n)=>{const r=ed(kd,t.__scopeSelect),i=sd(kd,t.__scopeSelect),[o,s]=e.useState(!1),a=it(n,i.onScrollButtonChange);return At(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?u(Od,{...t,ref:a,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Sd.displayName=kd;var Ed="SelectScrollDownButton",Cd=e.forwardRef((t,n)=>{const r=ed(Ed,t.__scopeSelect),i=sd(Ed,t.__scopeSelect),[o,s]=e.useState(!1),a=it(n,i.onScrollButtonChange);return At(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?u(Od,{...t,ref:a,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Cd.displayName=Ed;var Od=e.forwardRef((t,n)=>{const{__scopeSelect:r,onAutoScroll:i,...o}=t,s=ed("SelectScrollButton",r),a=e.useRef(null),l=Lu(r),c=e.useCallback(()=>{null!==a.current&&(window.clearInterval(a.current),a.current=null)},[]);return e.useEffect(()=>()=>c(),[c]),At(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),u(jh.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:Ct(o.onPointerDown,()=>{null===a.current&&(a.current=window.setInterval(i,50))}),onPointerMove:Ct(o.onPointerMove,()=>{s.onItemLeave?.(),null===a.current&&(a.current=window.setInterval(i,50))}),onPointerLeave:Ct(o.onPointerLeave,()=>{c()})})}),Nd=e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u(jh.div,{"aria-hidden":!0,...r,ref:t})});Nd.displayName="SelectSeparator";var Ad="SelectArrow";e.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=ju(n),o=Wu(Ad,n),s=ed(Ad,n);return o.open&&"popper"===s.position?u(Ou,{...i,...r,ref:t}):null}).displayName=Ad;var Td=e.forwardRef(({__scopeSelect:t,value:n,...r},i)=>{const o=e.useRef(null),s=it(i,o),a=Au(n);return e.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(a!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[a,n]),u(jh.select,{...r,style:{...Tu,...r.style},ref:s,defaultValue:n})});function Md(e){return""===e||void 0===e}function Rd(t){const n=Ft(t),r=e.useRef(""),i=e.useRef(0),o=e.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(i.current),""!==t&&(i.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),s=e.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return e.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,o,s]}function Dd(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=(s=e,a=Math.max(i,0),s.map((e,t)=>s[(a+t)%s.length]));var s,a;1===r.length&&(o=o.filter(e=>e!==n));const l=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Td.displayName="SelectBubbleInput";var Pd=Uu,Ld=Yu,Bd=Gu,Id=Ju,_d=ld,jd=fd,Fd=vd,Wd=yd,zd=xd,Hd=Sd,Vd=Cd,qd=Nd,Ud=Vu,$d=Ku,Kd=e.forwardRef(function(t,n){var r=t.className,i=t.children,o=oe(t,["className","children"]);return e.createElement(Pd,Object.assign({ref:n,className:et("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r)},o),i,e.createElement(Ld,{asChild:!0},e.createElement(L,{className:"h-4 w-4 opacity-50"})))});Kd.displayName=Pd.displayName;var Yd=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(Hd,Object.assign({ref:n,className:et("flex cursor-default items-center justify-center py-1",r)},i),e.createElement(_,{className:"h-4 w-4"}))});Yd.displayName=Hd.displayName;var Gd=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(Vd,Object.assign({ref:n,className:et("flex cursor-default items-center justify-center py-1",r)},i),e.createElement(L,{className:"h-4 w-4"}))});Gd.displayName=Vd.displayName;var Xd=e.forwardRef(function(t,n){var r=t.className,i=t.children,o=t.position,s=void 0===o?"popper":o,a=oe(t,["className","children","position"]);return e.createElement(Bd,null,e.createElement(Id,Object.assign({ref:n,className:et("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",r),position:s},a),e.createElement(Yd,null),e.createElement(_d,{className:et("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},i),e.createElement(Gd,null)))});Xd.displayName=Id.displayName;var Jd=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(jd,Object.assign({ref:n,className:et("py-1.5 pl-8 pr-2 text-sm font-semibold",r)},i))});Jd.displayName=jd.displayName;var Qd=e.forwardRef(function(t,n){var r=t.className,i=t.children,o=oe(t,["className","children"]);return e.createElement(Fd,Object.assign({ref:n,className:et("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(zd,null,e.createElement(P,{className:"h-4 w-4"}))),e.createElement(Wd,null,i))});Qd.displayName=Fd.displayName;var Zd=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(qd,Object.assign({ref:n,className:et("-mx-1 my-1 h-px bg-muted",r)},i))});function ef(t){const n=e.forwardRef((t,n)=>{const{children:r,...i}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==e.Fragment&&(o.ref=n?rt(n,t):t),e.cloneElement(r,o)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}Zd.displayName=qd.displayName;var tf=Symbol("radix.slottable");function nf(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===tf}var rf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=function(t){const n=ef(t),r=e.forwardRef((t,r)=>{const{children:i,...o}=t,s=e.Children.toArray(i),a=s.find(nf);if(a){const t=a.props.children,i=s.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return u(n,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return u(n,{...o,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}(`Primitive.${n}`),i=e.forwardRef((e,t)=>{const{asChild:i,...o}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),u(s,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),of="Switch",[sf,af]=Ot(of),[lf,cf]=sf(of),hf=e.forwardRef((t,n)=>{const{__scopeSwitch:r,name:i,checked:o,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:h,form:f,...p}=t,[m,g]=e.useState(null),v=it(n,e=>g(e)),b=e.useRef(!1),y=!m||(f||!!m.closest("form")),[w,x]=Pt({prop:o,defaultProp:s??!1,onChange:h,caller:of});return d(lf,{scope:r,checked:w,disabled:l,children:[u(rf.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":pf(w),"data-disabled":l?"":void 0,disabled:l,value:c,...p,ref:v,onClick:Ct(t.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&u(ff,{control:m,bubbles:!b.current,name:i,value:c,checked:w,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});hf.displayName=of;var uf="SwitchThumb",df=e.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=cf(uf,n);return u(rf.span,{"data-state":pf(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});df.displayName=uf;var ff=e.forwardRef(({__scopeSwitch:t,control:n,checked:r,bubbles:i=!0,...o},s)=>{const a=e.useRef(null),l=it(a,s),c=Au(r),h=os(n);return e.useEffect(()=>{const e=a.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==r&&n){const t=new Event("click",{bubbles:i});n.call(e,r),e.dispatchEvent(t)}},[c,r,i]),u("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:l,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function pf(e){return e?"checked":"unchecked"}ff.displayName="SwitchBubbleInput";var mf=hf,gf=df,vf=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(mf,Object.assign({className:et("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",r)},i,{ref:n}),e.createElement(gf,{className:et("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")}))});vf.displayName=mf.displayName;var bf=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("textarea",Object.assign({className:et("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:n},i))});bf.displayName="Textarea";var yf=jr,wf=Fr,xf=Wr,kf=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(zr,Object.assign({ref:n,className:et("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r)},i))});kf.displayName=zr.displayName;var Sf=e.forwardRef(function(t,n){var r=t.className,i=t.children,o=oe(t,["className","children"]);return e.createElement(xf,null,e.createElement(kf,null),e.createElement(Hr,Object.assign({ref:n,className:et("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r)},o),i,e.createElement(Ur,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"},e.createElement(re,{className:"h-4 w-4"}),e.createElement("span",{className:"sr-only"},"Close"))))});Sf.displayName=Hr.displayName;var Ef=function(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex flex-col space-y-1.5 text-center sm:text-left",n)},r))};Ef.displayName="DialogHeader";var Cf=function(t){var n=t.className,r=oe(t,["className"]);return e.createElement("div",Object.assign({className:et("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n)},r))};Cf.displayName="DialogFooter";var Of=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(Vr,Object.assign({ref:n,className:et("text-lg font-semibold leading-none tracking-tight",r)},i))});Of.displayName=Vr.displayName;var Nf,Af=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement(qr,Object.assign({ref:n,className:et("text-sm text-muted-foreground",r)},i))});function Tf(e,t=!1){const n=e.length;let r=0,i="",o=0,s=16,a=0,l=0,c=0,h=0,u=0;function d(t,n){let i=0,o=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)o=16*o+t-48;else if(t>=65&&t<=70)o=16*o+t-65+10;else{if(!(t>=97&&t<=102))break;o=16*o+t-97+10}r++,i++}return i<t&&(o=-1),o}function f(){if(i="",u=0,o=r,l=a,h=c,r>=n)return o=n,s=17;let t=e.charCodeAt(r);if(Mf(t)){do{r++,i+=String.fromCharCode(t),t=e.charCodeAt(r)}while(Mf(t));return s=15}if(Rf(t))return r++,i+=String.fromCharCode(t),13===t&&10===e.charCodeAt(r)&&(r++,i+="\n"),a++,c=r,s=14;switch(t){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,i=function(){let t="",i=r;for(;;){if(r>=n){t+=e.substring(i,r),u=2;break}const o=e.charCodeAt(r);if(34===o){t+=e.substring(i,r),r++;break}if(92!==o){if(o>=0&&o<=31){if(Rf(o)){t+=e.substring(i,r),u=2;break}u=6}r++}else{if(t+=e.substring(i,r),r++,r>=n){u=2;break}switch(e.charCodeAt(r++)){case 34:t+='"';break;case 92:t+="\\";break;case 47:t+="/";break;case 98:t+="\b";break;case 102:t+="\f";break;case 110:t+="\n";break;case 114:t+="\r";break;case 116:t+="\t";break;case 117:const e=d(4,!0);e>=0?t+=String.fromCharCode(e):u=4;break;default:u=5}i=r}}return t}(),s=10;case 47:const l=r-1;if(47===e.charCodeAt(r+1)){for(r+=2;r<n&&!Rf(e.charCodeAt(r));)r++;return i=e.substring(l,r),s=12}if(42===e.charCodeAt(r+1)){r+=2;const t=n-1;let o=!1;for(;r<t;){const t=e.charCodeAt(r);if(42===t&&47===e.charCodeAt(r+1)){r+=2,o=!0;break}r++,Rf(t)&&(13===t&&10===e.charCodeAt(r)&&r++,a++,c=r)}return o||(r++,u=1),i=e.substring(l,r),s=13}return i+=String.fromCharCode(t),r++,s=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!Df(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=function(){let t=r;if(48===e.charCodeAt(r))r++;else for(r++;r<e.length&&Df(e.charCodeAt(r));)r++;if(r<e.length&&46===e.charCodeAt(r)){if(r++,!(r<e.length&&Df(e.charCodeAt(r))))return u=3,e.substring(t,r);for(r++;r<e.length&&Df(e.charCodeAt(r));)r++}let n=r;if(r<e.length&&(69===e.charCodeAt(r)||101===e.charCodeAt(r)))if(r++,(r<e.length&&43===e.charCodeAt(r)||45===e.charCodeAt(r))&&r++,r<e.length&&Df(e.charCodeAt(r))){for(r++;r<e.length&&Df(e.charCodeAt(r));)r++;n=r}else u=3;return e.substring(t,n)}(),s=11;default:for(;r<n&&p(t);)r++,t=e.charCodeAt(r);if(o!==r){switch(i=e.substring(o,r),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(t),r++,s=16}}function p(e){if(Mf(e)||Rf(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}return{setPosition:function(e){r=e,i="",o=0,s=16,u=0},getPosition:()=>r,scan:t?function(){let e;do{e=f()}while(e>=12&&e<=15);return e}:f,getToken:()=>s,getTokenValue:()=>i,getTokenOffset:()=>o,getTokenLength:()=>r-o,getTokenStartLine:()=>l,getTokenStartCharacter:()=>o-h,getTokenError:()=>u}}function Mf(e){return 32===e||9===e}function Rf(e){return 10===e||13===e}function Df(e){return e>=48&&e<=57}Af.displayName=qr.displayName,function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"}(Nf||(Nf={}));const Pf=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Lf=200,Bf={" ":{"\n":new Array(Lf).fill(0).map((e,t)=>"\n"+" ".repeat(t)),"\r":new Array(Lf).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Lf).fill(0).map((e,t)=>"\r\n"+" ".repeat(t))},"\t":{"\n":new Array(Lf).fill(0).map((e,t)=>"\n"+"\t".repeat(t)),"\r":new Array(Lf).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":new Array(Lf).fill(0).map((e,t)=>"\r\n"+"\t".repeat(t))}},If=["\n","\r","\r\n"];function _f(e,t,n){let r,i,o,s,a;if(t){for(s=t.offset,a=s+t.length,o=s;o>0&&!Ff(e,o-1);)o--;let l=a;for(;l<e.length&&!Ff(e,l);)l++;i=e.substring(o,l),r=function(e,t){let n=0,r=0;const i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===Pf[1])r++;else{if("\t"!==t)break;r+=i}n++}return Math.floor(r/i)}(i,n)}else i=e,r=0,o=0,s=0,a=e.length;const l=function(e,t){for(let e=0;e<t.length;e++){const n=t.charAt(e);if("\r"===n)return e+1<t.length&&"\n"===t.charAt(e+1)?"\r\n":"\r";if("\n"===n)return"\n"}return e&&e.eol||"\n"}(n,e),c=If.includes(l);let h,u=0,d=0;h=n.insertSpaces?Pf[n.tabSize||4]??jf(Pf[1],n.tabSize||4):"\t";const f="\t"===h?"\t":" ";let p=Tf(i,!1),m=!1;function g(){if(u>1)return jf(l,u)+jf(h,r+d);const e=h.length*(r+d);return!c||e>Bf[f][l].length?l+jf(h,r+d):e<=0?l:Bf[f][l][e]}function v(){let e=p.scan();for(u=0;15===e||14===e;)14===e&&n.keepLines?u+=1:14===e&&(u=1),e=p.scan();return m=16===e||0!==p.getTokenError(),e}const b=[];function y(n,r,i){m||t&&!(r<a&&i>s)||e.substring(r,i)===n||b.push({offset:r,length:i-r,content:n})}let w=v();if(n.keepLines&&u>0&&y(jf(l,u),0,0),17!==w){let e=p.getTokenOffset()+o;y(h.length*r<20&&n.insertSpaces?Pf[h.length*r]:jf(h,r),o,e)}for(;17!==w;){let e=p.getTokenOffset()+p.getTokenLength()+o,t=v(),r="",i=!1;for(;0===u&&(12===t||13===t);){let n=p.getTokenOffset()+o;y(Pf[1],e,n),e=p.getTokenOffset()+p.getTokenLength()+o,i=12===t,r=i?g():"",t=v()}if(2===t)1!==w&&d--,n.keepLines&&u>0||!n.keepLines&&1!==w?r=g():n.keepLines&&(r=Pf[1]);else if(4===t)3!==w&&d--,n.keepLines&&u>0||!n.keepLines&&3!==w?r=g():n.keepLines&&(r=Pf[1]);else{switch(w){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():Pf[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():Pf[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=Pf[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=Pf[1]);break;case 10:n.keepLines&&u>0?r=g():6!==t||i||(r="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():12!==t&&13!==t||i?5!==t&&17!==t&&(m=!0):r=Pf[1];break;case 16:m=!0}u>0&&(12===t||13===t)&&(r=g())}17===t&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?l:"");y(r,e,p.getTokenOffset()+o),w=t}return b}function jf(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Ff(e,t){return-1!=="\r\n".indexOf(e.charAt(t))}var Wf,zf,Hf;!function(e){e.DEFAULT={allowTrailingComma:!1}}(Wf||(Wf={})),function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"}(zf||(zf={})),function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"}(Hf||(Hf={}));const Vf=function(e,t=[],n=Wf.DEFAULT){let r=null,i=[];const o=[];function s(e){Array.isArray(i)?i.push(e):null!==r&&(i[r]=e)}const a={onObjectBegin:()=>{const e={};s(e),o.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=o.pop()},onArrayBegin:()=>{const e=[];s(e),o.push(i),i=e,r=null},onArrayEnd:()=>{i=o.pop()},onLiteralValue:s,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}};return function(e,t,n=Wf.DEFAULT){const r=Tf(e,!1),i=[];let o=0;function s(e){return e?()=>0===o&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(e){return e?t=>0===o&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>0===o&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function c(e){return e?()=>{if(o>0)o++;else{!1===e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())&&(o=1)}}:()=>!0}function h(e){return e?()=>{o>0&&o--,0===o&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const u=c(t.onObjectBegin),d=l(t.onObjectProperty),f=h(t.onObjectEnd),p=c(t.onArrayBegin),m=h(t.onArrayEnd),g=l(t.onLiteralValue),v=a(t.onSeparator),b=s(t.onComment),y=a(t.onError),w=n&&n.disallowComments,x=n&&n.allowTrailingComma;function k(){for(;;){const e=r.scan();switch(r.getTokenError()){case 4:S(14);break;case 5:S(15);break;case 3:S(13);break;case 1:w||S(11);break;case 2:S(12);break;case 6:S(16)}switch(e){case 12:case 13:w?S(10):b();break;case 16:S(1);break;case 15:case 14:break;default:return e}}}function S(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;17!==e;){if(-1!==t.indexOf(e)){k();break}if(-1!==n.indexOf(e))break;e=k()}}}function E(e){const t=r.getTokenValue();return e?g(t):(d(t),i.push(t)),k(),!0}function C(){switch(r.getToken()){case 11:const e=r.getTokenValue();let t=Number(e);isNaN(t)&&(S(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return k(),!0}function O(){return 10!==r.getToken()?(S(3,[],[2,5]),!1):(E(!1),6===r.getToken()?(v(":"),k(),T()||S(4,[],[2,5])):S(5,[],[2,5]),i.pop(),!0)}function N(){u(),k();let e=!1;for(;2!==r.getToken()&&17!==r.getToken();){if(5===r.getToken()){if(e||S(4,[],[]),v(","),k(),2===r.getToken()&&x)break}else e&&S(6,[],[]);O()||S(4,[],[2,5]),e=!0}return f(),2!==r.getToken()?S(7,[2],[]):k(),!0}function A(){p(),k();let e=!0,t=!1;for(;4!==r.getToken()&&17!==r.getToken();){if(5===r.getToken()){if(t||S(4,[],[]),v(","),k(),4===r.getToken()&&x)break}else t&&S(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,T()||S(4,[],[4,5]),t=!0}return m(),e||i.pop(),4!==r.getToken()?S(8,[4],[]):k(),!0}function T(){switch(r.getToken()){case 3:return A();case 1:return N();case 10:return E(!0);default:return C()}}if(k(),17===r.getToken())return!!n.allowEmptyContent||(S(4,[],[]),!1);if(!T())return S(4,[],[]),!1;17!==r.getToken()&&S(9,[],[])}(e,a,n),i[0]};var qf;function Uf(e,t){if(!t.length)return"JSON 格式不正确";var n=t[0],r=function(e,t){for(var n=1,r=1,i=Math.max(0,Math.min(t,e.length)),o=0;o<i;o++){"\n"===e.charAt(o)?(n++,r=1):r++}return{line:n,col:r}}(e,n.offset),i=r.line,o=r.col,s=function(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}(n.error);return"JSON 格式不正确(".concat(s,",行 ").concat(i," 列 ").concat(o,")")}function $f(e){if(null==e||""===e)return{ok:!0,value:null,pretty:"null",compact:"null"};try{if("string"!=typeof e)return{ok:!0,value:e,pretty:JSON.stringify(e,null,2),compact:JSON.stringify(e)};var t=e,n=[],r=Vf(t,n,{allowTrailingComma:!0,disallowComments:!1});return n.length?{ok:!1,message:Uf(t,n),pretty:t,compact:t}:{ok:!0,value:r,pretty:JSON.stringify(r,null,2),compact:JSON.stringify(r)}}catch(t){var i="string"==typeof e?e:String(e);return{ok:!1,message:"JSON 格式不正确",pretty:i,compact:i}}}function Kf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=(e||"").toString(),r=[];if(Vf(n,r,{allowTrailingComma:!0,disallowComments:!1}),r.length)return{ok:!1,message:Uf(n,r)};for(var i=function(e,t,n){return _f(e,t,n)}(n,void 0,{insertSpaces:!0,tabSize:t}),o=n,s=i.length-1;s>=0;s--){var a=i[s];o=o.slice(0,a.offset)+a.content+o.slice(a.offset+a.length)}return{ok:!0,formatted:o}}function Yf(){return Yf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yf.apply(null,arguments)}!function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"}(qf||(qf={}));let Gf=[],Xf=[];function Jf(e){if(e<768)return!1;for(let t=0,n=Gf.length;;){let r=t+n>>1;if(e<Gf[r])n=r;else{if(!(e>=Xf[r]))return!0;t=r+1}if(t==n)return!1}}function Qf(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?Xf:Gf).push(n+=e[t])})();function Zf(e,t,n=!0,r=!0){return(n?ep:tp)(e,t,r)}function ep(e,t,n){if(t==e.length)return t;t&&rp(e.charCodeAt(t))&&ip(e.charCodeAt(t-1))&&t--;let r=np(e,t);for(t+=op(r);t<e.length;){let i=np(e,t);if(8205==r||8205==i||n&&Jf(i))t+=op(i),r=i;else{if(!Qf(i))break;{let n=0,r=t-2;for(;r>=0&&Qf(np(e,r));)n++,r-=2;if(n%2==0)break;t+=2}}}return t}function tp(e,t,n){for(;t>0;){let r=ep(e,t-2,n);if(r<t)return r;t--}return 0}function np(e,t){let n=e.charCodeAt(t);if(!ip(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return rp(r)?r-56320+(n-55296<<10)+65536:n}function rp(e){return e>=56320&&e<57344}function ip(e){return e>=55296&&e<56320}function op(e){return e<65536?1:2}class sp{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=mp(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),lp.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=mp(this,e,t);let n=[];return this.decompose(e,t,n,0),lp.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new up(this),i=new up(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new up(this,e)}iterRange(e,t=this.length){return new dp(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new fp(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new ap(e):lp.from(ap.split(e,[])):sp.empty}}class ap extends sp{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new pp(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new ap(hp(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=cp(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new ap(t,e.length+i.length));else{let e=t.length>>1;n.push(new ap(t.slice(0,e)),new ap(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof ap))return super.replace(e,t,n);[e,t]=mp(this,e,t);let r=cp(this.text,cp(n.text,hp(this.text,0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new ap(r,i):lp.from(ap.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=mp(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new ap(n,r)),n=[],r=-1);return r>-1&&t.push(new ap(n,r)),t}}class lp extends sp{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(e,t,n){if([e,t]=mp(this,e,t),n.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],s=i+o.length;if(e>=i&&t<=s){let a=o.replace(e-i,t-i,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let i=this.children.slice();return i[r]=a,new lp(i,this.length-(t-e)+n.length)}return super.replace(i,s,a)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=mp(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof lp))return 0;let n=0,[r,i,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==o||i==s)return n;let a=this.children[r],l=e.children[i];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new ap(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>i&&e instanceof lp)for(let t of e.children)h(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof ap&&a&&(t=c[c.length-1])instanceof ap&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new ap(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>r&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:lp.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new lp(s,t)}}function cp(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}function hp(e,t,n){return cp(e,[""],t,n)}sp.empty=new ap([""],0);class up{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ap?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof ap?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof ap){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof ap?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class dp{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new up(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class fp{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(sp.prototype[Symbol.iterator]=function(){return this.iter()},up.prototype[Symbol.iterator]=dp.prototype[Symbol.iterator]=fp.prototype[Symbol.iterator]=function(){return this});class pp{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function mp(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function gp(e,t,n=!0,r=!0){return Zf(e,t,n,r)}function vp(e,t){let n=e.charCodeAt(t);if(!(r=n,r>=55296&&r<56320&&t+1!=e.length))return n;var r;let i=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(i)?i-56320+(n-55296<<10)+65536:n}function bp(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function yp(e){return e<65536?1:2}const wp=/\r\n?|\n/;var xp=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(xp||(xp={}));class kp{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){Op(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new kp(e)}composeDesc(e){return this.empty?e:e.empty?this:Ap(this,e)}mapDesc(e,t=!1){return e.empty?this:Np(this,e,t)}mapPos(e,t=-1,n=xp.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=xp.Simple&&l>=e&&(n==xp.TrackDel&&r<e&&l>e||n==xp.TrackBefore&&r<e||n==xp.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=r+this.sections[n++];if(this.sections[n++]>=0&&r<=t&&i>=e)return!(r<e&&i>t)||"cover";r=i}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new kp(e)}static create(e){return new kp(e)}}class Sp extends kp{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Op(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return Np(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(sp.empty);n.push(o?e.slice(i,i+o):sp.empty)}i+=o}return new Sp(t,n)}compose(e){return this.empty?e:e.empty?this:Ap(this,e,!0)}map(e,t=!1){return e.empty?this:Np(this,e,t,!0)}iterChanges(e,t=!1){Op(this,e,t)}get desc(){return kp.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new Tp(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-s);Ep(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;Ep(t,e,o),o>0&&Cp(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break e;let e=Math.min(i.len,l-s);Ep(t,e,-1),Ep(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new Sp(t,n),filtered:kp.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;o<t&&Ep(r,t-o,-1);let n=new Sp(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof Sp){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?sp.of(c.split(n||wp)):c:sp.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&Ep(r,e-o,-1),Ep(r,s-e,u),Cp(i,r,h),o=s}}(e),a(!s),s}static empty(e){return new Sp(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else{if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(sp.empty);n[r]=sp.of(i.slice(1)),t.push(i[0],n[r].length)}}}return new Sp(t,n)}static createSet(e,t){return new Sp(e,t)}}function Ep(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Cp(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(sp.empty);e.push(n)}}function Op(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,h=o,u=sp.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,c,o,h,u),i=c,o=h}}}function Np(e,t,n,r=!1){let i=[],o=r?[]:null,s=new Tp(e),a=new Tp(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Ep(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(Ep(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Ep(i,0,s.ins),o&&Cp(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?Sp.createSet(i,o):kp.create(i);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}Ep(i,t,e<s.i?s.ins:0),o&&e<s.i&&Cp(o,i,s.text),e=s.i,s.forward(s.len-n)}}}}function Ap(e,t,n=!1){let r=[],i=n?[]:null,o=new Tp(e),s=new Tp(t);for(let e=!1;;){if(o.done&&s.done)return i?Sp.createSet(r,i):kp.create(r);if(0==o.ins)Ep(r,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Ep(r,t,n,e),i&&n&&Cp(i,r,s.text)}else-1==s.ins?(Ep(r,o.off?0:o.len,t,e),i&&Cp(i,r,o.textBit(t))):(Ep(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&Cp(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}}else Ep(r,0,s.ins,e),i&&Cp(i,r,s.text),s.next()}}class Tp{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?sp.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?sp.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Mp{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Mp(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Rp.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Rp.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Rp.range(e.anchor,e.head)}static create(e,t,n){return new Mp(e,t,n)}}class Rp{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Rp.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Rp([this.main],0)}addRange(e,t=!0){return Rp.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Rp.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Rp(e.ranges.map(e=>Mp.fromJSON(e)),e.main)}static single(e,t=e){return new Rp([Rp.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return Rp.normalized(e.slice(),t);n=i.to}return new Rp(e,t)}static cursor(e,t=0,n,r){return Mp.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}static range(e,t,n,r){let i=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return t<e?Mp.create(t,e,48|i):Mp.create(e,t,(t>e?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?Rp.range(s,o):Rp.range(o,s))}}return new Rp(e,t)}}function Dp(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Pp=0;class Lp{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Pp++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new Lp(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Bp),!!e.static,e.enables)}of(e){return new Ip([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ip(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ip(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function Bp(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Ip{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Pp++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||jp(e,c)){let t=n(e);if(s?!_p(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=Zp(t,l);if(this.dependencies.every(n=>n instanceof Lp?t.facet(n)===e.facet(n):!(n instanceof zp)||t.field(n,!1)==e.field(n,!1))||(s?_p(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function _p(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function jp(e,t){let n=!1;for(let r of t)1&Qp(e,r)&&(n=!0);return n}function Fp(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<r.length;t++){let o=Zp(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)Qp(e,t);return e.values[s]=a(e),1},update(e,n){if(!jp(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=jp(e,r),l=i.config.facets[t.id],c=i.facet(t);if(l&&!o&&Bp(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const Wp=Lp.define({static:!0});class zp{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new zp(Pp++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Wp).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r,i=e.facet(Wp),o=n.facet(Wp);return(r=i.find(e=>e.field==this))&&r!=o.find(e=>e.field==this)?(e.values[t]=r.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,Wp.of({field:this,create:e})]}get extension(){return this}}const Hp=4,Vp=3,qp=2,Up=1;function $p(e){return t=>new Yp(t,e)}const Kp={highest:$p(0),high:$p(Up),default:$p(qp),low:$p(Vp),lowest:$p(Hp)};class Yp{constructor(e,t){this.inner=e,this.prec=t}}class Gp{of(e){return new Xp(this,e)}reconfigure(e){return Gp.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Xp{constructor(e,t){this.compartment=e,this.inner=t}}class Jp{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r=[],i=Object.create(null),o=new Map;for(let n of function(e,t,n){let r=[[],[],[],[],[]],i=new Map;function o(e,s){let a=i.get(e);if(null!=a){if(a<=s)return;let t=r[a].indexOf(e);t>-1&&r[a].splice(t,1),e instanceof Xp&&n.delete(e.compartment)}if(i.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof Xp){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),o(r,s)}else if(e instanceof Yp)o(e.inner,e.prec);else if(e instanceof zp)r[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof Ip)r[s].push(e),e.facet.extensions&&o(e.facet.extensions,qp);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(t,s)}}return o(e,qp),r.reduce((e,t)=>e.concat(t))}(e,t,o))n instanceof zp?r.push(n):(i[n.facet.id]||(i[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of r)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in i){let t=i[e],r=t[0].facet,o=c&&c[e]||[];if(t.every(e=>0==e.type))if(s[r.id]=a.length<<1|1,Bp(o,t))a.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));a.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[r.id]=l.length<<1,l.push(e=>Fp(e,r,t))}}let h=l.map(e=>e(s));return new Jp(e,o,h,s,a,i)}}function Qp(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Zp(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const em=Lp.define(),tm=Lp.define({combine:e=>e.some(e=>e),static:!0}),nm=Lp.define({combine:e=>e.length?e[0]:void 0,static:!0}),rm=Lp.define(),im=Lp.define(),om=Lp.define(),sm=Lp.define({combine:e=>!!e.length&&e[0]});class am{constructor(e,t){this.type=e,this.value=t}static define(){return new lm}}class lm{of(e){return new am(this,e)}}class cm{constructor(e){this.map=e}of(e){return new hm(this,e)}}class hm{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new hm(this.type,t)}is(e){return this.type==e}static define(e={}){return new cm(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}hm.reconfigure=hm.define(),hm.appendConfig=hm.define();class um{constructor(e,t,n,r,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Dp(n,t.newLength),i.some(e=>e.type==um.time)||(this.annotations=i.concat(um.time.of(Date.now())))}static create(e,t,n,r,i,o){return new um(e,t,n,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(um.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function dm(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function fm(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=Sp.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null===(r=e.selection)||void 0===r?void 0:r.map(i),effects:hm.mapEffects(e.effects,i).concat(hm.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function pm(e,t,n){let r=t.selection,i=vm(t.annotations);return t.userEvent&&(i=i.concat(um.userEvent.of(t.userEvent))),{changes:t.changes instanceof Sp?t.changes:Sp.of(t.changes||[],n,e.facet(nm)),selection:r&&(r instanceof Rp?r:Rp.single(r.anchor,r.head)),effects:vm(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function mm(e,t,n){let r=pm(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let i=1;i<t.length;i++){!1===t[i].filter&&(n=!1);let o=!!t[i].sequential;r=fm(r,pm(e,t[i],o?r.changes.newLength:e.doc.length),o)}let i=um.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return function(e){let t=e.startState,n=t.facet(om),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=fm(r,pm(t,o,e.changes.newLength),!0))}return r==e?e:um.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let r of t.facet(rm)){let t=r(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:dm(n,t))}if(!0!==n){let r,i;if(!1===n)i=e.changes.invertedDesc,r=Sp.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=um.create(t,r,e.selection&&e.selection.map(i),hm.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(im);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof um?i:Array.isArray(i)&&1==i.length&&i[0]instanceof um?i[0]:mm(t,vm(i),!1)}return e}(i):i)}um.time=am.define(),um.userEvent=am.define(),um.addToHistory=am.define(),um.remote=am.define();const gm=[];function vm(e){return null==e?gm:Array.isArray(e)?e:[e]}var bm=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(bm||(bm={}));const ym=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wm;try{wm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function xm(e){return t=>{if(!/\S/.test(t))return bm.Space;if(function(e){if(wm)return wm.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||ym.test(n)))return!0}return!1}(t))return bm.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return bm.Word;return bm.Other}}class km{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Qp(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return Qp(this,n),Zp(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return mm(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:i}=n;for(let t of e.effects)t.is(Gp.reconfigure)?(n&&(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),n=null),i.set(t.value.compartment,t.value.extension)):t.is(hm.reconfigure)?(n=null,r=t.value):t.is(hm.appendConfig)&&(n=null,r=vm(r).concat(t.value));if(n)t=e.startState.values.slice();else{n=Jp.resolve(r,i,this);let e=new km(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null);t=e.values}let o=e.startState.facet(tm)?e.newSelection:e.newSelection.asSingle();new km(n,e.newDoc,o,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Rp.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=vm(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let c=r.mapDesc(a,!0);i.push(s.range.map(c)),r=r.compose(l),o=hm.mapEffects(o,l).concat(hm.mapEffects(vm(s.effects),c))}return{changes:r,selection:Rp.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Sp?e:Sp.of(e,this.doc.length,this.facet(km.lineSeparator))}toText(e){return sp.of(e.split(this.facet(km.lineSeparator)||wp))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(Qp(this,t),Zp(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof zp&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let i=n[t],o=e[t];r.push(i.init(e=>i.spec.fromJSON(o,e)))}return km.create({doc:e.doc,selection:Rp.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Jp.resolve(e.extensions||[],new Map),n=e.doc instanceof sp?e.doc:sp.of((e.doc||"").split(t.staticFacet(km.lineSeparator)||wp)),r=e.selection?e.selection instanceof Rp?e.selection:Rp.single(e.selection.anchor,e.selection.head):Rp.single(0);return Dp(r,n.length),t.staticFacet(tm)||(r=r.asSingle()),new km(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(km.tabSize)}get lineBreak(){return this.facet(km.lineSeparator)||"\n"}get readOnly(){return this.facet(sm)}phrase(e,...t){for(let t of this.facet(km.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(em))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return xm(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=gp(t,o,!1);if(i(t.slice(e,o))!=bm.Word)break;o=e}for(;s<r;){let e=gp(t,s);if(i(t.slice(s,e))!=bm.Word)break;s=e}return o==s?null:Rp.range(o+n,s+n)}}function Sm(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);r[e]=n[e](o,i)}}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}km.allowMultipleSelections=tm,km.tabSize=Lp.define({combine:e=>e.length?e[0]:4}),km.lineSeparator=nm,km.readOnly=sm,km.phrases=Lp.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),km.languageData=em,km.changeFilter=rm,km.transactionFilter=im,km.transactionExtender=om,Gp.reconfigure=hm.define();class Em{eq(e){return this==e}range(e,t=e){return Om.create(e,t,this)}}function Cm(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}Em.prototype.startSide=Em.prototype.endSide=0,Em.prototype.point=!1,Em.prototype.mapMode=xp.TrackDel;let Om=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function Nm(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Am{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),r.push(l-o),i.push(c-o))}return{mapped:n.length?new Am(r,i,n,s):null,pos:o}}}class Tm{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new Tm(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(Nm)),this.isEmpty)return t.length?Tm.of(t):this;let s=new Dm(this,null,-1).goto(0),a=0,l=[],c=new Mm;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(Om.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?Tm.empty:this.nextLayer.update({add:l,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new Tm(n,t,i||Tm.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Pm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Pm.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=Rm(o,s,n),l=new Bm(o,a,i),c=new Bm(s,a,i);n.iterGaps((e,t,n)=>Im(l,e,c,t,n,r)),n.empty&&0==n.length&&Im(l,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),o=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let s=Rm(i,o),a=new Bm(i,s,0).goto(n),l=new Bm(o,s,0).goto(n);for(;;){if(a.to!=l.to||!_m(a.active,l.active)||a.point&&(!l.point||!Cm(a.point,l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new Bm(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Mm;for(let r of e instanceof Om?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Nm(t,r)>0)return e.slice().sort(Nm);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Tm.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Tm.empty;r=r.nextLayer)t=new Tm(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}Tm.empty=new Tm([],[],null,-1),Tm.empty.nextLayer=Tm.empty;class Mm{finishChunk(e){this.chunks.push(new Am(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Mm)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Tm.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Tm.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Rm(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class Dm{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Pm{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new Dm(o,t,n,i));return 1==r.length?r[0]:new Pm(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Lm(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Lm(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Lm(this.heap,0)}}}function Lm(e,t){for(let n=e[t];;){let r=1+(t<<1);if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class Bm{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Pm.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){jm(this.active,e),jm(this.activeTo,e),jm(this.activeRank,e),this.minActive=Wm(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;Fm(this.active,t,n),Fm(this.activeTo,t,r),Fm(this.activeRank,t,i),e&&Fm(e,t,this.cursor.from),this.minActive=Wm(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&jm(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Im(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t,c=!!o.boundChange;for(let t=!1;;){let r=e.to+l-n.to,i=r||e.endSide-n.endSide,h=i<0?e.to+l:n.to,u=Math.min(h,s);if(e.point||n.point?(e.point&&n.point&&Cm(e.point,n.point)&&_m(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,u,e.point,n.point),t=!1):(t&&o.boundChange(a),u>a&&!_m(e.active,n.active)&&o.compareRange(a,u,e.active,n.active),c&&u<s&&(r||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>s)break;a=h,i<=0&&e.next(),i>=0&&n.next()}}function _m(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!Cm(e[n],t[n]))return!1;return!0}function jm(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Fm(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Wm(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function zm(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=gp(e,i));return r}function Hm(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=gp(e,r)}return!0===r?-1:e.length}const Vm="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),qm="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Um="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class $m{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");i(r(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Um[Vm]||1;return Um[Vm]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[qm],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Ym(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let Km=new Map;class Ym{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Km.get(n);if(t)return e[qm]=t;this.sheet=new r.CSSStyleSheet,Km.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[qm]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Gm={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:"'"},Xm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Jm="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Qm="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Zm=0;Zm<10;Zm++)Gm[48+Zm]=Gm[96+Zm]=String(Zm);for(Zm=1;Zm<=24;Zm++)Gm[Zm+111]="F"+Zm;for(Zm=65;Zm<=90;Zm++)Gm[Zm]=String.fromCharCode(Zm+32),Xm[Zm]=String.fromCharCode(Zm);for(var eg in Gm)Xm.hasOwnProperty(eg)||(Xm[eg]=Gm[eg]);function tg(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)ng(e,arguments[t]);return e}function ng(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)ng(e,t[n])}}let rg="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},ig="undefined"!=typeof document?document:{documentElement:{style:{}}};const og=/Edge\/(\d+)/.exec(rg.userAgent),sg=/MSIE \d/.test(rg.userAgent),ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(rg.userAgent),lg=!!(sg||ag||og),cg=!lg&&/gecko\/(\d+)/i.test(rg.userAgent),hg=!lg&&/Chrome\/(\d+)/.exec(rg.userAgent),ug="webkitFontSmoothing"in ig.documentElement.style,dg=!lg&&/Apple Computer/.test(rg.vendor),fg=dg&&(/Mobile\/\w+/.test(rg.userAgent)||rg.maxTouchPoints>2);var pg={mac:fg||/Mac/.test(rg.platform),windows:/Win/.test(rg.platform),linux:/Linux|X11/.test(rg.platform),ie:lg,ie_version:sg?ig.documentMode||6:ag?+ag[1]:og?+og[1]:0,gecko:cg,gecko_version:cg?+(/Firefox\/(\d+)/.exec(rg.userAgent)||[0,0])[1]:0,chrome:!!hg,chrome_version:hg?+hg[1]:0,ios:fg,android:/Android\b/.test(rg.userAgent),webkit:ug,webkit_version:ug?+(/\bAppleWebKit\/(\d+)/.exec(rg.userAgent)||[0,0])[1]:0,safari:dg,safari_version:dg?+(/\bVersion\/(\d+(\.\d+)?)/.exec(rg.userAgent)||[0,0])[1]:0,tabSize:null!=ig.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function mg(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const gg=Object.create(null);function vg(e,t,n){if(e==t)return!0;e||(e=gg),t||(t=gg);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function bg(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function yg(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class wg{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var xg=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(xg||(xg={}));class kg extends Em{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Sg(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Cg(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:i,end:o}=Og(e,r);t=(i?r?-3e8:-1:5e8)-1,n=1+(o?r?2e8:1:-6e8)}return new Cg(e,t,n,r,e.widget||null,!0)}static line(e){return new Eg(e)}static set(e,t=!1){return Tm.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}kg.none=Tm.empty;class Sg extends kg{constructor(e){let{start:t,end:n}=Og(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?mg(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||gg}eq(e){return this==e||e instanceof Sg&&this.tagName==e.tagName&&vg(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Sg.prototype.point=!1;class Eg extends kg{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Eg&&this.spec.class==e.spec.class&&vg(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Eg.prototype.mapMode=xp.TrackBefore,Eg.prototype.point=!0;class Cg extends kg{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?xp.TrackBefore:xp.TrackAfter:xp.TrackDel}get type(){return this.startSide!=this.endSide?xg.WidgetRange:this.startSide<=0?xg.WidgetBefore:xg.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Cg&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function Og(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function Ng(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}Cg.prototype.point=!0;class Ag extends Em{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Ag&&this.tagName==e.tagName&&vg(this.attributes,e.attributes)}static create(e){return new Ag(e.tagName,e.attributes||gg)}static set(e,t=!1){return Tm.of(e,t)}}function Tg(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Mg(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Rg(e,t){if(!t.anchorNode)return!1;try{return Mg(e,t.anchorNode)}catch(e){return!1}}function Dg(e){return 3==e.nodeType?Ug(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Pg(e,t,n,r){return!!n&&(Ig(e,t,n,r,-1)||Ig(e,t,n,r,1))}function Lg(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Bg(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Ig(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:_g(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Lg(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?_g(e):0}}}function _g(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function jg(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Fg(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Wg(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}Ag.prototype.startSide=Ag.prototype.endSide=-1;class zg{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?_g(t):0),n,Math.min(e.focusOffset,n?_g(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let Hg,Vg=null;function qg(e){if(e.setActive)return e.setActive();if(Vg)return e.focus(Vg);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Vg?{get preventScroll(){return Vg={preventScroll:!0},!0}}:void 0),!Vg){Vg=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function Ug(e,t,n=t){let r=Hg||(Hg=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function $g(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Kg(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Yg(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;n=n.childNodes[r-1],r=_g(n)}else{if(!n.parentNode||Bg(n))return null;r=Lg(n),n=n.parentNode}}}function Gg(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||Bg(n))return null;r=Lg(n)+1,n=n.parentNode}}}pg.safari&&pg.safari_version>=26&&(Vg=!1);class Xg{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Xg(e.parentNode,Lg(e),t)}static after(e,t){return new Xg(e.parentNode,Lg(e)+1,t)}}var Jg=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Jg||(Jg={}));const Qg=Jg.LTR,Zg=Jg.RTL;function ev(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const tv=ev("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),nv=ev("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),rv=Object.create(null),iv=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);rv[t]=n,rv[n]=-t}function ov(e){return e<=247?tv[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?nv[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const sv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class av{get dir(){return this.level%2?Zg:Qg}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function lv(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!lv(r.inner,i.inner))return!1}return!0}const cv=[];function hv(e,t,n,r,i,o,s){let a=r%2?2:1;if(r%2==i%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=cv[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?r:r+1,f=l;e:for(;;)if(c<o.length&&f==o[c].from){if(h)break e;let p=o[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(cv[e]==a)break e;break}e=o[t++].to}if(c++,u)u.push(p);else{p.from>l&&s.push(new av(l,p.from,d)),uv(e,p.direction==Qg!=!(d%2)?r+1:r,i,p.inner,p.from,p.to,s),l=p.to}f=p.to}else{if(f==n||(t?cv[f]!=a:cv[f]==a))break;f++}u?hv(e,l,f,r+1,i,u,s):l<f&&s.push(new av(l,f,d)),l=f}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=cv[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?r:r+1,f=l;e:for(;;)if(c&&f==o[c-1].to){if(h)break e;let p=o[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(cv[e-1]==a)break e;break}e=o[--n].from}if(u)u.push(p);else{p.to<l&&s.push(new av(p.to,l,d)),uv(e,p.direction==Qg!=!(d%2)?r+1:r,i,p.inner,p.from,p.to,s),l=p.from}f=p.from}else{if(f==t||(n?cv[f-1]!=a:cv[f-1]==a))break;f--}u?hv(e,f,l,r+1,i,u,s):f<l&&s.push(new av(f,l,d)),l=f}}function uv(e,t,n,r,i,o,s){let a=t%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=ov(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),cv[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=cv[e];if(128==i)e<a-1&&t==cv[e+1]&&24&t?i=cv[e]=t:cv[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==cv[i];)i++;let o=e&&8==t||i<n&&8==cv[i]?1==r?1:8:256;for(let t=e;t<i;t++)cv[t]=o;e=i-1}else 8==i&&1==r&&(cv[e]=1);t=i,7&i&&(r=i)}}}(e,i,o,r,a),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let c=s?r[s-1].to:t,h=s<r.length?r[s].from:n;for(let t,n,r,s=c;s<h;s++)if(n=rv[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(iv[e+1]==-n){let t=iv[e+2],n=2&t?i:4&t?1&t?o:i:0;n&&(cv[s]=cv[iv[e]]=n),a=e;break}}else{if(189==iv.length)break;iv[a++]=s,iv[a++]=t,iv[a++]=l}else if(2==(r=cv[s])||1==r){let e=r==i;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=iv[t+2];if(2&n)break;if(e)iv[t+2]|=2;else{if(4&n)break;iv[t+2]|=4}}}}}(e,i,o,r,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=cv[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else{if(256!=cv[s])break;s++}let c=1==o,h=c==(1==(s<t?cv[s]:r))?c?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),cv[--t]=h;l=s}else o=s,l++}}}(i,o,r,a),hv(e,i,o,t,n,r,s)}function dv(e){return[new av(0,e,0)]}let fv="";function pv(e,t,n,r,i){var o;let s=r.head-e.from,a=av.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],c=l.side(i,n);if(s==c){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!i,n),c=l.side(i,n)}let h=gp(e.text,s,l.forward(i,n));(h<l.from||h>l.to)&&(h=c),fv=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?Rp.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):Rp.cursor(h+e.from,l.forward(i,n)?-1:1,l.level)}function mv(e,t,n){for(let r=t;r<n;r++){let t=ov(e.charCodeAt(r));if(1==t)return Qg;if(2==t||4==t)return Zg}return Qg}const gv=Lp.define(),vv=Lp.define(),bv=Lp.define(),yv=Lp.define(),wv=Lp.define(),xv=Lp.define(),kv=Lp.define(),Sv=Lp.define(),Ev=Lp.define(),Cv=Lp.define({combine:e=>e.some(e=>e)}),Ov=Lp.define({combine:e=>e.some(e=>e)}),Nv=Lp.define();class Av{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new Av(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Av(Rp.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Tv=hm.define({map:(e,t)=>e.map(t)}),Mv=hm.define();function Rv(e,t,n){let r=e.facet(yv);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)}const Dv=Lp.define({combine:e=>!e.length||e[0]});let Pv=0;const Lv=Lp.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class Bv{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Lv.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Lv.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new Bv(Pv++,e,n,r,e=>{let t=[];return o&&t.push(Fv.of(t=>{let n=t.plugin(e);return n?o(n):kg.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return Bv.define((t,n)=>new e(t,n),t)}}class Iv{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Rv(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Rv(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Rv(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _v=Lp.define(),jv=Lp.define(),Fv=Lp.define(),Wv=Lp.define(),zv=Lp.define(),Hv=Lp.define(),Vv=Lp.define();function qv(e,t){let n=e.state.facet(Vv);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return Tm.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n,i=r[e].spec.bidiIsolate;if(null==i&&(i=mv(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==i)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),i}const Uv=Lp.define();function $v(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(Uv)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}const Kv=Lp.define();class Yv{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new Yv(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0;;){let s=r<e.length?e[r].fromB:1e9,a=i<t.length?t[i]:1e9,l=Math.min(s,a);if(1e9==l)break;let c=l+o,h=l,u=c;for(;;)if(i<t.length&&t[i]<=h){let n=t[i+1];i+=2,h=Math.max(h,n);for(let t=r;t<e.length&&e[t].fromB<=h;t++)o=e[t].toA-e[t].toB;u=Math.max(u,n+o)}else{if(!(r<e.length&&e[r].fromB<=h))break;{let t=e[r++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),o=t.toA-t.toB}}n.push(new Yv(c,u,l,h))}return n}}class Gv{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Sp.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new Yv(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new Gv(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const Xv=[];class Jv{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Xv}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;null==t[r]&&e.removeAttribute(r)}for(let n in t){let r=t[n];"style"==n?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Lg(this.dom),r=this.length?e>0:t>0;return new Xg(this.parent.dom,n+(r?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof eb)return e;return null}static get(e){return e.cmTile}}class Qv extends Jv{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,r=null,i=(null==e?void 0:e.node)==n?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,t=r?r.nextSibling:n.firstChild,i&&t!=s.dom&&(i.written=!0),s.dom.parentNode==n)for(;t&&t!=s.dom;)t=Zv(t);else n.insertBefore(s.dom,t);r=s.dom}for(t=r?r.nextSibling:n.firstChild,i&&t&&(i.written=!0);t;)t=Zv(t);this.length=o}}function Zv(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class eb extends Qv{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Jv.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let o=n.children[r++];if(o instanceof tb)t.push(r),n=o,r=0;else{let t=i+o.length,n=e(o,i);if(void 0!==n)return n;i=t+o.breakAfter}}}resolveBlock(e,t){let n,r,i=-1,o=-1;if(this.blockTiles((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,i=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget())&&(r=s,o=e-a)}}),!n&&!r)throw new Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class tb extends Qv{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new tb(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class nb extends Qv{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new nb(t||document.createElement("div"),e);return t&&n||(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(a,l){for(let c=0,h=0;c<a.children.length&&h<=l;c++){let u=a.children[c],d=h+u.length;d>=l&&(u.isComposite()?e(u,l-h):(!o||o.isHidden&&(t>0||n&&rb(o,u)))&&(d>l||32&u.flags)?(o=u,s=l-h):(h<l||16&u.flags&&!u.isHidden)&&(r=u,i=l-h)),h=d}}(this,e);let a=(t<0?r:o)||r||o;return a?{tile:a,offset:a==r?i:s}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Dg(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new Xg(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,16&e.flags?1:32&e.flags?-1:t);let i=n.tile.parent,o=!1;for(let e of i.children){if(o)return new Xg(e.dom,0);e==n.tile&&(o=!0)}}return new Xg(this.dom,0)}}function rb(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class ib extends Qv{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new ib(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ob extends Jv{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,i=e,o=0;0==e&&t<0||e==n&&t>=0?pg.chrome||pg.gecko||(e?(r--,o=1):i<n&&(i++,o=-1)):t<0?r--:i<n&&i++;let s=Ug(this.dom,r,i).getClientRects();if(!s.length)return null;let a=s[(o?o<0:t>=0)?0:s.length-1];return pg.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(s,e=>e.width)||a),o?jg(a,o<0):a||null}static of(e,t){let n=new ob(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class sb extends Jv{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return jg(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?0==i:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return jg(n,!r)}}get overrideDOMText(){if(!this.length)return sp.empty;let{root:e}=this;if(!e)return sp.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,i){return i||(i=e.toDOM(t),e.editable||(i.contentEditable="false")),new sb(i,n,e,r)}}class ab extends Jv{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return sp.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class lb{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:o,parents:s}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(i==r.children.length){if(!e&&!s.length)break;n&&n.leave(r),o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++}else{let a=r.children[i],l=a.breakAfter;!(t>0?a.length<=e:a.length<e)||n&&!1===n.skip(a,0,a.length)&&a.isComposite?(s.push({tile:r,index:i}),r=a,i=0,n&&a.isComposite()&&n.enter(a)):(o=!!l,i++,e-=a.length)}else if(i==r.length)o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++;else{if(!e)break;{let t=Math.min(e,r.length-i);n&&n.skip(r,i,i+t),e-=t,i+=t}}return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class cb{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class hb{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var i;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;if(!s||!s.isText()||8&s.flags)o.append(r||ob.of(e,null===(i=this.cache.find(ob))||void 0===i?void 0:i.dom));else{this.cache.reused.set(s,2),(o.children[o.children.length-1]=new ob(s.dom,s.text+e)).parent=o}this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?vb(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof ib&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(vb(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=Jv.get(n.dom);e&&e.setDOM(vb(n.dom))}let e=ib.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=Jv.get(e.text);i&&this.cache.reused.set(i,2);let o=new ob(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);r||this.flushBuffer();let i=this.ensureMarks(t,n);r||16&e.flags||i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=gb);let r=nb.start(e,t||(null===(n=this.cache.find(nb))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let i=e.length-1;i>=0;i--){let o,s=e[i];if(t>0&&(o=r.lastChild)&&o instanceof ib&&o.mark.eq(s))r=o,t--;else{let e=ib.of(s,null===(n=this.cache.find(ib,e=>e.mark.eq(s)))||void 0===n?void 0:n.dom);r.append(e),r=e,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&mb(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||pg.ios&&mb(this.curLine,!0))||this.curLine.append(this.cache.findWidget(yb,0,32)||new sb(yb.toDOM(),0,yb,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new cb(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof tb&&r.wrapper.eq(n.wrapper))t=r;else{let r=tb.of(n.wrapper,null===(e=this.cache.find(tb,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(ab,void 0,1);return n&&(n.flags=t),n||new ab(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class ub{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw new Error("Ran out of text content when drawing inline views");this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const db=[sb,nb,ob,ib,ab,tb,eb];for(let e=0;e<db.length;e++)db[e].bucket=e;class fb{constructor(e){this.view=e,this.buckets=db.map(()=>[]),this.index=db.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],o=this.index[r];for(let e=i.length-1;e>=0;e--){let s=(e+o)%i.length,a=i[s];if((!t||t(a))&&!this.reused.has(a))return i.splice(s,1),s<o&&this.index[r]--,this.reused.set(a,n),a}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let s=r[i];if(!this.reused.has(s)&&(0==o?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==n?(this.reused.set(s,1),s):(this.reused.set(s,2),new sb(s.dom,t,e,-498&s.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class pb{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new fb(e),this.text=new ub(e.state.doc),this.builder=new hb(this.cache,new eb(e,e.contentDOM),Tm.iter(n)),this.cache.reused.set(t,2),this.old=new lb(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,o=0;;){let s=o<e.length?e[o++]:null,a=s?s.fromA:this.old.root.length;if(a>r){let e=a-r;this.preserve(e,!o,!s),r=a,i+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit(i,s.toB)),i=s.toB,r=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof ib&&t.push(r.mark)}return t}(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let o=n>0||t<e.length?sb.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&o.flags?(o.flags&=-2,this.builder.addBlockWidget(o)):(this.builder.ensureLine(null),this.builder.addInlineWidget(o,r,i),i=r.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)):this.builder.addText(e.text,r,i,this.cache.reuse(e)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof ab)this.cache.add(e);else{if(!(e instanceof ib))return!1;this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof ib&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&(r.length=i=0):e instanceof ib&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,o=Tm.spans(this.decorations,e,t,{point:(e,t,o,s,a,l)=>{if(o instanceof Cg){if(this.disallowBlockEffectsFor[l]){if(o.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=s.length,a>s.length)r.continueWidget(t-e);else{let i=o.widget||(o.block?bb.block:bb.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;e.block&&(t|=256);return t}(o),c=this.cache.findWidget(i,t-e,l)||sb.of(i,this.view,t-e,l);o.block?(o.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(c)):(r.ensureLine(n),r.addInlineWidget(c,s,a))}n=null}else n=function(e,t){let n=t.spec.attributes,r=t.spec.class;if(!n&&!r)return e;e||(e={class:"cm-line"});n&&mg(n,e);r&&(e.class+=" "+r);return e}(n,o);t>e&&this.text.skip(t-e)},span:(e,t,i,o)=>{for(let s=e;s<t;){let e=this.text.next(Math.min(512,t-s));null==e?(r.addLineStartIfNotCovered(n),r.addBreak(),s++):(r.ensureLine(n),r.addText(e,i,o),s+=e.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=o>i,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=Jv.get(r);if(r==this.view.contentDOM)break;e instanceof ib?t.push(e):(null==e?void 0:e.isLine())?n=e:"DIV"!=r.nodeName||n||r==this.view.contentDOM?t.push(ib.of(new Sg({tagName:r.nodeName.toLowerCase(),attributes:yg(r)}),r)):n=new nb(r,gb)}return{line:n,marks:t}}}function mb(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}const gb={class:"cm-line"};function vb(e){let t=Jv.get(e);return t&&t.setDOM(e.cloneNode()),e}class bb extends wg{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}bb.inline=new bb("span"),bb.block=new bb("div");const yb=new class extends wg{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class wb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=kg.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new eb(e,e.contentDOM),this.updateInner([new Yv(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)});return n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let i=r>-1?function(e,t,n){let r=kb(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new Yv(l.mapPos(o),l.mapPos(s),o,s),text:i}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:r}=this.hasComposition;n=new Yv(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(pg.ie||pg.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,s=this.blockWrappers;this.updateDeco();let a=function(e,t,n){let r=new Sb;return Tm.compare(e,t,n,r),r.changes}(o,this.decorations,e.changes);a.length&&(n=Yv.extendWithRanges(n,a));let l=function(e,t,n){let r=new Eb;return Tm.compare(e,t,n,r),r.changes}(s,this.blockWrappers,e.changes);return l.length&&(n=Yv.extendWithRanges(n,l)),i&&!n.some(e=>e.fromA<=i.range.fromA&&e.toA>=i.range.toA)&&(n=i.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length)&&(this.updateInner(n,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new pb(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=r.run(e,t),xb(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=pg.chrome||pg.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),!r||!r.written&&n.selectionRange.focusNode==r.node&&this.tile.dom.contains(r.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Cb&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Mv)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,o=!i&&!(this.view.state.facet(Dv)||n.tabIndex>-1)&&Rg(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),pg.gecko&&c.empty&&!this.hasComposition&&(1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new Xg(e,0),s=!0}var h;let u=this.view.observer.selectionRange;!s&&u.focusNode&&(Pg(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Pg(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{pg.android&&pg.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Tg(this.view.root);if(e)if(c.empty){if(pg.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?Yg:Gg)(a.node,a.offset);t&&(a=new Xg(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new Xg(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new Xg(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Pg(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Tg(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let r=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r;{let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=0==_g(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!Jv.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r,i=-1,o=!1,s=-1,a=!1;return this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(o=!0)}else{let c=l+t.length;if(l<=e&&(n=t,i=e-l,o=c<e),c>=e&&!r&&(r=t,s=e-l,a=l>e),l>e&&r)return!0}}),n||r?(o&&r?n=null:a&&n&&(r=null),n&&t<0||!r?n.domIn(i,t):r.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Cb?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;return function e(t,n){if(t.isComposite())for(let r of t.children){if(r.length>=n){let t=e(r,n);if(t)return t}if((n-=r.length)<0)break}else if(t.isText()&&n<t.length){let e=gp(t.text,n);if(e==n)return null;let r=Ug(t.dom,n,e).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==Jg.LTR,l=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>r);d++){let r=e.children[d],f=h+r.length,p=r.dom.getBoundingClientRect(),{height:m}=p;if(u&&!d&&(l+=p.top-u.top),r instanceof tb)f>n&&c(r,h,p);else if(h>=n&&(l>0&&t.push(-l),t.push(m+l),l=0,o)){let e=r.dom.lastChild,t=e?Dg(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(l+=u.bottom-p.bottom),h=f+r.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?Jg.RTL:Jg.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=Dg(r.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,r,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let e=Dg(i.firstChild)[0];t=i.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,r=e&&e.height?e.height:t,i.remove()}),{lineHeight:t,charWidth:n,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(kg.replace({widget:new Cb(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return kg.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Fv).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(zv).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(Tm.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Wv).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(Nv))try{if(t(this.view,e.range,e))return!0}catch(e){Rv(this.view.state,e,"scroll handler")}let t,{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!r)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,t.left),top:Math.min(r.top,t.top),right:Math.max(r.right,t.right),bottom:Math.max(r.bottom,t.bottom)});let i=$v(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,p=1;if(d)e=Fg(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=Wg(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let m=0,g=0;if("nearest"==i)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/p,n=(h.scrollTop-e)*p}if(m){let t=h.scrollLeft;h.scrollLeft+=m/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(r="nearest"),n&&Math.abs(n-g)<1&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==Jg.LTR)}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){xb(this.tile)}}function xb(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)xb(n,t)}}function kb(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Yg(n.focusNode,n.focusOffset),i=Gg(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=Jv.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=Jv.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let Sb=class{constructor(){this.changes=[]}compareRange(e,t){Ng(e,t,this.changes)}comparePoint(e,t){Ng(e,t,this.changes)}boundChange(e){Ng(e,e,this.changes)}};class Eb{constructor(){this.changes=[]}compareRange(e,t){Ng(e,t,this.changes)}comparePoint(){}boundChange(e){Ng(e,e,this.changes)}}class Cb extends wg{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Ob(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;e&&(i.type!=xg.Text||e.type==i.type&&!(n<0?i.from<t:i.to>t))||(e=i)}}return e||r}return r}function Nb(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=pv(i,o,s,a,n),c=fv;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return t;l=r(c)}a=t}}function Ab(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function Tb(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],o=null;if(i.empty){let t=Ab(e,i.from,0);t!=i.from&&(o=Rp.cursor(t,-1))}else{let t=Ab(e,i.from,-1),n=Ab(e,i.to,1);t==i.from&&n==i.to||(o=Rp.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}o&&(n||(n=t.ranges.slice()),n[r]=o)}return n?Rp.create(n,t.mainIndex):t}function Mb(e,t,n){let r=Ab(e.state.facet(Hv).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Rp.cursor(r,r<n.from?1:-1)}class Rb{constructor(e,t){this.pos=e,this.assoc=t}}function Db(e,t,n,r){let i,o=e.contentDOM.getBoundingClientRect(),s=o.top+e.viewState.paddingTop,{x:a,y:l}=t,c=l-s;for(;;){if(c<0)return new Rb(0,1);if(c>e.viewState.docHeight)return new Rb(e.state.doc.length,-1);if(i=e.elementAtHeight(c),null==r)break;if(i.type==xg.Text){let t=e.docView.coordsAt(r<0?i.from:i.to,r);if(t&&(r<0?t.top<=c+s:t.bottom>=c+s))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?i.bottom+t:i.top-t}if(e.viewport.from>=i.to||e.viewport.to<=i.from){if(n)return null;if(i.type==xg.Text){let t=function(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+Hm(s,o,e.state.tabSize)}(e,o,i,a,l);return new Rb(t,t==i.from?1:-1)}}if(i.type!=xg.Text)return c<(i.top+i.bottom)/2?new Rb(i.from,1):new Rb(i.to,-1);let h=e.docView.lineAt(i.from,2);return h&&h.length==i.length||(h=e.docView.lineAt(i.from,-2)),Pb(e,h,i.from,a,l)}function Pb(e,t,n,r,i){let o=-1,s=null,a=1e9,l=1e9,c=i,h=i,u=(e,t)=>{for(let n=0;n<e.length;n++){let u=e[n];if(u.top==u.bottom)continue;let d=u.left>r?u.left-r:u.right<r?r-u.right:0,f=u.top>i?u.top-i:u.bottom<i?i-u.bottom:0;u.top<=h&&u.bottom>=c&&(c=Math.min(u.top,c),h=Math.max(u.bottom,h),f=0),(o<0||(f-l||d-a)<0)&&(o>=0&&l&&a<d&&s.top<=h-2&&s.bottom>=c+2?l=0:(o=t,a=d,l=f,s=u))}};if(t.isText()){for(let e=0;e<t.length;){let n=gp(t.text,e);if(u(Ug(t.dom,e,n).getClientRects(),e),!a&&!l)break;e=n}return r>(s.left+s.right)/2==(Lb(e,o+n)==Jg.LTR)?new Rb(n+gp(t.text,o),-1):new Rb(n+o,1)}{if(!t.length)return new Rb(n,1);for(let e=0;e<t.children.length;e++){let n=t.children[e];if(!(48&n.flags)&&(u((1==n.dom.nodeType?n.dom:Ug(n.dom,0,n.length)).getClientRects(),e),!a&&!l))break}let c=t.children[o],h=t.posBefore(c,n);return c.isComposite()||c.isText()?Pb(e,c,h,Math.max(s.left,Math.min(s.right,r)),i):r>(s.left+s.right)/2==(Lb(e,o+n)==Jg.LTR)?new Rb(h+c.length,-1):new Rb(h,1)}}function Lb(e,t){let n=e.state.doc.lineAt(t);return e.bidiSpans(n)[av.find(e.bidiSpans(n),t-n.from,-1,1)].dir}const Bb="￿";class Ib{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(km.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bb}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=Jv.get(r),o=r.nextSibling;if(o==t){(null==i?void 0:i.breakAfter)&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let s=Jv.get(o);(i&&s?i.breakAfter:(i?i.breakAfter:Bg(r))||Bg(o)&&("BR"!=r.nodeName||(null==i?void 0:i.isWidget()))&&this.text.length>e)&&!jb(o,t)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(i=r.exec(t))&&(o=i.index,s=i[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){let t=Jv.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(_b(e,n.node,n.offset)?t:0))}}function _b(e,t,n){for(;;){if(!t||n<_g(t))return!1;if(t==e)return!0;n=Lg(t)+1,t=t.parentNode}}function jb(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Jv.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Fb{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Wb{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=zb(e.docView.tile,t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;n&&(t.push(new Fb(n,r)),i==n&&o==r||t.push(new Fb(i,o)));return t}(e),n=new Ib(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?Rp.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Mg(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!Mg(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((pg.ios||pg.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=s.from-t,a=s.to-i;0!=o&&1!=o&&0!=t||0!=a&&-1!=a&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Rp.range(r,n)):this.newSel=Rp.single(r,n)}}}function zb(e,t,n,r){if(e.isComposite()){let i=-1,o=-1,s=-1,a=-1;for(let l=0,c=r,h=r;l<e.children.length;l++){let r=e.children[l],u=c+r.length;if(c<t&&u>n)return zb(r,t,n,c);if(u>=t&&-1==i&&(i=l,o=c),c>n&&r.dom.parentNode==e.dom){s=l,a=h;break}h=u,c=u+r.breakAfter}return{from:o,to:a<0?r+e.length:a,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Hb(e,t){let n,{newSel:r}=t,i=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,a=i.from,l=null;(8===o||pg.android&&t.text.length<s-r)&&(a=i.to,l="end");let c=qb(e.state.doc.sliceString(r,s,Bb),t.text,a-r,l);c&&(pg.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Bb+Bb&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:sp.of(t.text.slice(c.from,c.toB).split(Bb))})}else r&&(!e.hasFocus&&e.state.facet(Dv)||Ub(r,i))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,i.to)}:(pg.mac||pg.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=Rp.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:sp.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:e.state.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:e.state.toText(e.inputState.insertingText)}:pg.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=Rp.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:sp.of([" "])}),n)return Vb(e,n,r,o);if(r&&!Ub(r,i)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=Tb(e.state.facet(Hv).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Vb(e,t,n,r=-1){if(pg.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(pg.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&$g(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>i.head)&&$g(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&$g(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let n=t.from<o.from?-1:1,r=n<0?o.from:o.to,a=Ab(i.facet(Hv).map(t=>t(e)),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:Rp.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&kb(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-u,h=r-c.length;if(e.state.sliceDoc(h,r)!=c||r>=l.from&&h<=l.to)return{range:n};let d=i.changes({from:h,to:r,insert:t.insert}),f=n.to-o.to;return{changes:d,range:a?Rp.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(d)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1));return i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(xv).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}function qb(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.length<t.length){o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o}else if(a<o){o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function Ub(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class $b{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,pg.safari&&e.contentDOM.addEventListener("input",()=>null),pg.gecko&&function(e){gy.has(e)||(gy.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=Jv.get(r))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Yb(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&i!=!o.handlers.length&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Jb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),pg.android&&pg.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!pg.ios||e.synthetic||e.altKey||e.metaKey||!((t=Gb.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Xb.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,$g(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(pg.safari&&!pg.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Kb(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Rv(n.state,e)}}}function Yb(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(Kb(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Kb(t.value,r))}}for(let e in ey)n(e).handlers.push(ey[e]);for(let e in ty)n(e).observers.push(ty[e]);return t}const Gb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Xb="dthko",Jb=[16,17,18,20,91,92,224,225];function Qb(e){return.7*Math.max(0,e)+8}class Zb{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,r=e.ownerDocument;for(let i=e.parentNode;i&&!(i==r.body||t&&n);)if(1==i.nodeType)!n&&i.scrollHeight>i.clientHeight&&(n=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(Hv).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(km.allowMultipleSelections)&&function(e,t){let n=e.state.facet(gv);return n.length?n[0](t):pg.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Tg(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=hy(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let r=0,i=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=$v(this.view);e.clientX-c.left<=o+6?r=-Qb(o-e.clientX):e.clientX+c.right>=a-6&&(r=Qb(e.clientX-a)),e.clientY-c.top<=s+6?i=-Qb(s-e.clientY):e.clientY+c.bottom>=l-6&&(i=Qb(e.clientY-l)),this.setScrollSpeed(r,i)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Tb(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const ey=Object.create(null),ty=Object.create(null),ny=pg.ie&&pg.ie_version<15||pg.ios&&pg.webkit_version<604;function ry(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function iy(e,t){t=ry(e.state,Sv,t);let n,{state:r}=e,i=1,o=r.toText(t),s=o.lines==r.selection.ranges.length,a=null!=dy&&r.selection.ranges.every(e=>e.empty)&&dy==o.toString();if(a){let e=-1;n=r.changeByRange(n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((s?o.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:Rp.cursor(n.from+l.length)}})}else n=s?r.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Rp.cursor(e.from+t.length)}}):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function oy(e,t,n,r){if(1==r)return Rp.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return Rp.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=gp(i.text,o,!1):a=gp(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=gp(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=gp(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return Rp.range(s+i.from,a+i.from)}(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,s=r?r.posAtEnd:i.to;return s<e.state.doc.length&&s==i.to&&s++,Rp.range(o,s)}}ty.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},ey.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ty.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},ty.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},ey.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(bv))if(n=r(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=hy(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,o,s){let a,l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=oy(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let t=oy(e,n.pos,n.assoc,r),i=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=i<c.from?Rp.range(i,o):Rp.range(o,i)}return o?i.replaceRange(i.main.extend(c.from,c.to)):s&&1==r&&i.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return Rp.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(i,l.pos))?a:s?i.addRange(c):Rp.create([c])}}}(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Zb(e,t,n,r)),r&&e.observer.ignore(()=>{qg(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),!1===i.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const sy=pg.ie&&pg.ie_version<=11;let ay=null,ly=0,cy=0;function hy(e){if(!sy)return e.detail;let t=ay,n=cy;return ay=e,cy=Date.now(),ly=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ly+1)%3:1}function uy(e,t,n,r){if(!(n=ry(e.state,Sv,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=r&&o&&function(e,t){let n=e.state.facet(vv);return n.length?n[0](t):pg.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:i,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}ey.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=Rp.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",ry(e.state,Ev,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},ey.dragend=e=>(e.inputState.draggedContent=null,!1),ey.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&uy(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return uy(e,t,n,!0),!0}return!1},ey.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ny?null:t.clipboardData;return n?(iy(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),iy(e,n.value)},50)}(e),!1)};let dy=null;ey.copy=ey.cut=(e,t)=>{let n=Tg(e.root);if(n&&!Rg(e.contentDOM,n))return!1;let{text:r,ranges:i,linewise:o}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:ry(e,Ev,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!r&&!o)return!1;dy=o?r:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=ny?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,r),!1)};const fy=am.define();function py(e,t){let n=[];for(let r of e.facet(kv)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:fy.of(!0)}):null}function my(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=py(e.state,t);n?e.dispatch(n):e.update([])}},10)}ty.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),my(e)},ty.blur=e=>{e.observer.clearSelectionRange(),my(e)},ty.compositionstart=ty.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},ty.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,pg.chrome&&pg.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ty.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ey.beforeinput=(e,t)=>{var n,r;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return Vb(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}let i;if(pg.chrome&&pg.android&&(i=Gb.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return pg.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),pg.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>ty.compositionend(e,t),20),!1};const gy=new Set;const vy=["pre-wrap","normal","pre-line","break-spaces"];let by=!1;function yy(){by=!1}class wy{constructor(e){this.lineWrapping=e,this.doc=sp.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return vy.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=vy.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class xy{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class ky{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?xg.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Cg?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ky(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Sy=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Sy||(Sy={}));const Ey=.001;class Cy{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ey&&(by=!0),this.height=e)}replace(e,t,n){return Cy.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=r[s],u=i.lineAt(a,Sy.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,Sy.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=r[s-1].toA;)a=r[s-1].fromA,c=r[s-1].fromB,s--,a<u.from&&(u=i.lineAt(a,Sy.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let f=Py.build(n.setDoc(o),e,c,h);i=Oy(i,i.replace(a,l,f))}return i.updateHeight(n,0)}static empty(){return new Ty(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else{if(!(i>2*r))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}}else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new Ry(Cy.of(e.slice(0,t)),o,Cy.of(e.slice(n)))}}function Oy(e,t){return e==t?e:(e.constructor!=t.constructor&&(by=!0),t)}Cy.prototype.size=1;const Ny=kg.replace({});class Ay extends Cy{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new ky(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new ky(r,0,n,this.spaceAbove,Ny):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(o):o}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.lineAt(0,Sy.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ty extends Ay{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new ky(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof Ty||r instanceof My&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof My?r=new Ty(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Cy.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class My extends Cy{constructor(e){super(e,0)}heightMetrics(e,t){let n,r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-r+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:r,lastLine:i,perLine:n,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),l=s+o.length*a,c=Math.max(n,e-l/2);return new ky(o.from,o.length,c,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new ky(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==Sy.ByHeight)return this.blockAt(e,n,r,i);if(t==Sy.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new ky(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=r+s*h+a*(l.from-i-h);return new ky(l.from,l.length,Math.max(r,Math.min(u,r+this.height-c)),c,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let c=e,h=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new ky(t.from,t.length,h,r,0)),h+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof My?n[n.length-1]=new My(e.length+r):n.push(null,new My(r-1))}if(e>0){let t=n[0];t instanceof My?n[0]=new My(e+t.length):n.unshift(new My(e-1),null)}return Cy.of(n)}decomposeLeft(e,t){t.push(new My(e-1),null)}decomposeRight(e,t){t.push(null,new My(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new My(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++],a=0;i<0&&(a=-i,i=r.heights[r.index++]),-1==s?s=i:Math.abs(i-s)>=Ey&&(s=-2);let l=new Ty(t,i,a);l.outdated=!1,n.push(l),o+=t+1}o<=i&&n.push(null,new My(i-o).updateHeight(e,o));let a=Cy.of(n);return(s<0||Math.abs(a.height-this.height)>=Ey||Math.abs(s-this.heightMetrics(e,t).perLine)>=Ey)&&(by=!0),Oy(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Ry extends Cy{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,a=t==Sy.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==Sy.ByPosNoHeight?Sy.ByPosNoHeight:Sy.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,Sy.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&Dy(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Dy(i,e)}return Cy.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Cy.of(this.break?[e,null,t]:[e,t]):(this.left=Oy(this.left,e),this.right=Oy(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Dy(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof My&&(r=e[t+1])instanceof My&&e.splice(t-1,3,new My(n.length+1+r.length))}class Py{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ty?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ty(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Ay(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ty(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new My(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ty)return e;let t=new Ty(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Ty||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ty(0,-1,0));let n=e;for(let e of this.nodes)e instanceof Ty&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new Py(n,e);return Tm.spans(t,n,r,i,0),i.finish(n)}}class Ly{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Ng(e,t,this.changes,5)}}function By(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Iy(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class _y{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return kg.replace({widget:new jy(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class jy extends wg{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Fy{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Vy,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jg.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(jv).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new wy(t),this.stateDeco=qy(e),this.heightMap=Cy.empty().applyChanges(this.stateDeco,sp.empty,this.heightOracle.setDoc(e.doc),[new Yv(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=kg.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new Wy(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Vy:new Uy(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push($y(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=qy(this.state);let r=e.changedRanges,i=Yv.extendWithRanges(r,function(e,t,n){let r=new Ly;return Tm.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:Sp.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);yy(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||by)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Ov)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Jg.RTL:Jg.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent,s=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=Wg(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Kg(e.scrollDOM);let f=(this.printing?Iy:By)(t,this.paddingTop),p=f.top-this.pixelViewport.top,m=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&r.refresh(i,n,s,a,Math.max(5,v/s),t),o&&(e.docView.minWidth=0,l|=16)}p>0&&m>0?c=Math.max(p,m):p<0&&m<0&&(c=Math.min(p,m)),yy();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Cy.empty().applyChanges(this.stateDeco,sp.empty,this.heightOracle,[new Yv(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new xy(n.from,i))}by&&(l|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new Wy(r.lineAt(o-1e3*n,Sy.ByHeight,i,0,0).from,r.lineAt(s+1e3*(1-n),Sy.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=r.lineAt(e,Sy.ByPos,i,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new Wy(r.lineAt(n-500,Sy.ByHeight,i,0,0).from,r.lineAt(n+o+500,Sy.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Wy(this.heightMap.lineAt(n,Sy.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Sy.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Sy.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Sy.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new _y(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=Jg.LTR&&!n)return[];let s=[],a=(r,o,l,c)=>{if(o-r<i)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>r&&e<o)return a(r,e-10,l,c),void a(e+10,o,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(Rp.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,c);d=new _y(r,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<o||t.type!=xg.Text)return;let i=function(e,t,n){let r=[],i=e,o=0;Tm.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),o+=t-i);return{total:o,ranges:r}}(t.from,t.to,this.stateDeco);if(i.total<o)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let r=Hy(i,c),s=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=r-s,n=r+s}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;s=zy(i,e),l=zy(i,n)}else{let n=i.total*this.heightOracle.charWidth,o=r*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+a,f=this.pixelViewport.right+a;if(null!=c){let e=Hy(i,c),t=((f-d)/2+o)/n;h=e-t,u=e+t}else h=(d-o)/n,u=(f+o)/n;s=zy(i,h),l=zy(i,u)}s>t.from&&a(t.from,s,t,i),l<t.to&&a(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=Hy(r,n)-Hy(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){_y.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=kg.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Tm.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];i.from==o.from&&i.to==o.to||(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||$y(this.heightMap.lineAt(e,Sy.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||$y(this.heightMap.lineAt(this.scaler.fromDOM(e),Sy.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return $y(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wy{constructor(e,t){this.from=e,this.to=t}}function zy({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function Hy(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}const Vy={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function qy(e){let t=e.facet(Fv).filter(e=>"function"!=typeof e),n=e.facet(zv).filter(e=>"function"!=typeof e);return n.length&&t.push(Tm.join(n)),t}class Uy{constructor(e,t,n){let r=0,i=0,o=0;this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,Sy.ByPos,e,0,0).top,s=t.lineAt(i,Sy.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=o+(e.top-i)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof Uy&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function $y(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new ky(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>$y(e,t)):e._content)}const Ky=Lp.define({combine:e=>e.join(" ")}),Yy=Lp.define({combine:e=>e.indexOf(!0)>-1}),Gy=$m.newName(),Xy=$m.newName(),Jy=$m.newName(),Qy={"&light":"."+Xy,"&dark":"."+Jy};function Zy(e,t,n){return new $m(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const ew=Zy("."+Gy,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qy),tw={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},nw=pg.ie&&pg.ie_version<=11;class rw{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new zg,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(pg.ie&&pg.ie_version<=11||pg.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!pg.android||!1===e.constructor.EDIT_CONTEXT||pg.chrome&&pg.chrome_version<126||(this.editContext=new sw(e),e.state.facet(Dv)&&(e.contentDOM.editContext=this.editContext.editContext)),nw&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Dv)?n.root.activeElement!=this.dom:!Rg(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(pg.ie&&pg.ie_version<=11||pg.android&&pg.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Pg(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Tg(e.root);if(!t)return!1;let n=pg.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return ow(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?ow(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Rg(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,_g(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:(n=e,r=_g(n))}else{if(n==e)return!0;r=Lg(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,tw),nw&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),nw&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&$g(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Rg(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Wb(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=Hb(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Ub(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=iw(t,e.previousSibling||e.target.previousSibling,-1),r=iw(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Dv)!=e.state.facet(Dv)&&(e.view.contentDOM.editContext=e.state.facet(Dv)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function iw(e,t,n){for(;t;){let r=Jv.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function ow(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return Pg(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class sw{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&i<this.from?s=i:a==this.to&&i>this.to&&(a=i);let c=qb(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!c){let t=Rp.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Ub(t,r)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+s,to:c.toA+s,insert:sp.of(n.text.slice(c.from,c.toB).split("\n"))};if((pg.mac||pg.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:s,to:a,insert:sp.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);Vb(e,h,Rp.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(kg.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:Mv.of(kg.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Tg(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,a,l)=>{if(n)return;let c=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l))return r=this.pendingContextChange=null,t+=c,void(this.to+=c);r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==r||this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class aw{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Fy(e.state||km.create(e)),e.scrollTo&&e.scrollTo.is(Tv)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Lv).map(e=>new Iv(e));for(let e of this.plugins)e.update(this);this.observer=new rw(this),this.inputState=new $b(this),this.inputState.ensureHandlers(this.plugins),this.docView=new wb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof um?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,i=this.state;for(let t of e){if(t.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed)return void(this.viewState.state=i);let o=this.hasFocus,s=0,a=null;e.some(e=>e.annotation(fy))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=py(i,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(km.phrases)!=this.state.facet(km.phrases))return this.setState(i);t=Gv.create(this,i,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Av(e.empty?e:Rp.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Tv)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=hw.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Kv)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(Ky)!=t.state.facet(Ky)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(wv))try{e(t)}catch(e){Rv(this.state,e,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Hb(this,c)&&l.force&&$g(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Fy(e),this.plugins=e.facet(Lv).map(e=>new Iv(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new wb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Lv),n=e.state.facet(Lv);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Iv(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Rv(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(Kg(n))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5)break;let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return Rv(this.state,e),cw}}),c=Gv.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=cw)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){Rv(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(wv))e(t)}get themeClasses(){return Gy+" "+(this.state.facet(Yy)?Jy:Xy)+" "+this.state.facet(Ky)}updateAttrs(){let e=uw(this,_v,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Dv)?"true":"false",class:"cm-content",style:`${pg.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),uw(this,jv,t);let n=this.observer.ignore(()=>{let n=bg(this.contentDOM,this.contentAttrs,t),r=bg(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(aw.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(Kv);let e=this.state.facet(aw.cspNonce);$m.mount(this.root,this.styleModules.concat(ew).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Mb(this,e,Nb(this,e,t,n))}moveByGroup(e,t){return Mb(this,e,Nb(this,e,t,t=>function(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==bm.Space&&(i=t),i==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return Rp.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=Ob(e,t.head,t.assoc||-1),o=r&&i.type==xg.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==Jg.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return Rp.cursor(s,n?-1:1)}return Rp.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Mb(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return Rp.cursor(i,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),s=(o<0?t.top:t.bottom)+h}let u=Db(e,{x:l.left+a,y:s+(null!=r?r:e.viewState.heightOracle.textHeight>>1)*o},!1,o);return Rp.cursor(u.pos,u.assoc,void 0,a)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Db(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Db(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return jg(n,i[av.find(i,e-r.from,-1,t)].dir==Jg.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Cv)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>lw)return dv(e.length);let t,n=this.textDirectionAt(e.from);for(let r of this.bidiCache)if(r.from==e.from&&r.dir==n&&(r.fresh||lv(r.isolates,t=qv(this,e))))return r.order;t||(t=qv(this,e));let r=function(e,t,n){if(!e)return[new av(0,0,t==Zg?1:0)];if(t==Qg&&!n.length&&!sv.test(e))return dv(e.length);if(n.length)for(;e.length>cv.length;)cv[cv.length]=256;let r=[],i=t==Qg?0:1;return uv(e,i,i,n,0,e.length,r),r}(e.text,n,t);return this.bidiCache.push(new hw(e.from,e.to,n,t,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||pg.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qg(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Tv.of(new Av("number"==typeof e?Rp.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Tv.of(new Av(Rp.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Bv.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Bv.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=$m.newName(),r=[Ky.of(n),Kv.of(Zy(`.${n}`,e))];return t&&t.dark&&r.push(Yy.of(!0)),r}static baseTheme(e){return Kp.lowest(Kv.of(Zy("."+Gy,e,Qy)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&Jv.get(n)||Jv.get(e);return(null===(t=null==r?void 0:r.root)||void 0===t?void 0:t.view)||null}}aw.styleModule=Kv,aw.inputHandler=xv,aw.clipboardInputFilter=Sv,aw.clipboardOutputFilter=Ev,aw.scrollHandler=Nv,aw.focusChangeEffect=kv,aw.perLineTextDirection=Cv,aw.exceptionSink=yv,aw.updateListener=wv,aw.editable=Dv,aw.mouseSelectionStyle=bv,aw.dragMovesSelection=vv,aw.clickAddsSelectionRange=gv,aw.decorations=Fv,aw.blockWrappers=Wv,aw.outerDecorations=zv,aw.atomicRanges=Hv,aw.bidiIsolatedRanges=Vv,aw.scrollMargins=Uv,aw.darkTheme=Yy,aw.cspNonce=Lp.define({combine:e=>e.length?e[0]:""}),aw.contentAttributes=jv,aw.editorAttributes=_v,aw.lineWrapping=aw.contentAttributes.of({class:"cm-lineWrapping"}),aw.announce=hm.define();const lw=4096,cw={};class hw{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Jg.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new hw(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function uw(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&mg(o,n)}return n}const dw=pg.mac?"mac":pg.windows?"win":pg.linux?"linux":"key";function fw(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const pw=Kp.default(aw.domEventHandlers({keydown:(e,t)=>xw(vw(t.state),e,t,"editor")})),mw=Lp.define({enables:pw}),gw=new WeakMap;function vw(e){let t=e.facet(mw),n=gw.get(t);return n||gw.set(t,n=function(e,t=dw){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=r.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let r,i,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:i=!0}}return r&&(a="Alt-"+a),i&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");i(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=bw={view:t,prefix:n,scope:e};return setTimeout(()=>{bw==r&&(bw=null)},yw),!0}]})}let d=u.join(" ");i(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,ww))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let bw=null;const yw=4e3;let ww=null;function xw(e,t,n,r){ww=t;let i=function(e){var t=!(Jm&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Qm&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Xm:Gm)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),o=yp(vp(i,0))==i.length&&" "!=i,s="",a=!1,l=!1,c=!1;bw&&bw.view==n&&bw.scope==r&&(s=bw.prefix+" ",Jb.indexOf(t.keyCode)<0&&(l=!0,bw=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},p=e[r];return p&&(f(p[s+fw(i,t,!o)])?a=!0:!o||!(t.altKey||t.metaKey||t.ctrlKey)||pg.windows&&t.ctrlKey&&t.altKey||pg.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=Gm[t.keyCode])||h==i?o&&t.shiftKey&&f(p[s+fw(i,t,!0)])&&(a=!0):(f(p[s+fw(h,t,!0)])||t.shiftKey&&(u=Xm[t.keyCode])!=i&&u!=h&&f(p[s+fw(u,t,!1)]))&&(a=!0),!a&&f(p._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),ww=null,a}class kw{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=Sw(e);return[new kw(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==Jg.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=Sw(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=Ob(e,r,1),p=Ob(e,i,-1),m=f.type==xg.Text?f:null,g=p.type==xg.Text?p:null;m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=Ew(e,r,1,m));g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=Ew(e,i,-1,g));if(m&&g&&m.from==g.from&&m.to==g.to)return b(y(n.from,n.to,m));{let t=m?y(n.from,null,m):w(f,!1),r=g?y(null,n.to,g):w(p,!0),i=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(u,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==xg.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),b(t).concat(i).concat(b(r))}function v(e,n,r,i){return new kw(t,e-l.left,n-l.top,r-e,i-n)}function b({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,c,h){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(l,l==r.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),s=Math.max(f.bottom,p.bottom,s),h==Jg.LTR?a.push(o&&n?u:f.left,o&&c?d:p.right):a.push(!o&&c?u:p.left,!o&&n?d:f.right))}let c=null!=t?t:r.from,h=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<h)for(let i=Math.max(r.from,c),o=Math.min(r.to,h);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(i=r.to+1,i>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function w(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Sw(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Jg.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Ew(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class Cw{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Ow)!=e.state.facet(Ow)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Ow);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;e==this.scaleX&&t==this.scaleY||(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{return n=e,r=this.drawn[t],!(n.constructor==r.constructor&&n.eq(r));var n,r})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,pg.safari&&pg.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ow=Lp.define();function Nw(e){return[Bv.define(t=>new Cw(t,e)),Ow.of(e)]}const Aw=Lp.define({combine:e=>Sm(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Tw(e){return e.startState.facet(Aw)!=e.state.facet(Aw)}const Mw=Nw({above:!0,markers(e){let{state:t}=e,n=t.facet(Aw),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:Rp.cursor(i.head,i.head>i.anchor?-1:1);for(let i of kw.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=Tw(e);return n&&Rw(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Rw(t.state,e)},class:"cm-cursorLayer"});function Rw(e,t){t.style.animationDuration=e.facet(Aw).cursorBlinkRate+"ms"}const Dw=Nw({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:kw.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Tw(e),class:"cm-selectionLayer"}),Pw=Kp.highest(aw.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Lw=hm.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Bw=zp.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Lw)?t.value:e,e))}),Iw=Bv.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(Bw);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Bw)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Bw),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Bw)!=e&&this.view.dispatch({effects:Lw.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function _w(e,t,n,r,i){t.lastIndex=0;for(let o,s=e.iterRange(n,r),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}class jw{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n)}this.boundary=i,this.maxLength=o}createDeco(e){let t=new Mm,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))_w(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,u);else _w(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}const Fw=null!=/x/.unicode?"gu":"g",Ww=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Fw),zw={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Hw=null;const Vw=Lp.define({combine(e){let t=Sm(e,{render:null,specialChars:Ww,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Hw&&"undefined"!=typeof document&&document.body){let t=document.body.style;Hw=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Hw||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Fw)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Fw)),t}});let qw=null;class Uw extends wg{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(zw[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class $w extends wg{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Kw=kg.line({class:"cm-activeLine"}),Yw=Bv.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(Kw.range(i.from)),t=i.from)}return kg.set(n)}},{decorations:e=>e.decorations});class Gw extends wg{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Dg(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=jg(t[0],"rtl"!=n.direction),i=parseInt(n.lineHeight);return r.bottom-r.top>1.5*i?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}const Xw=2e3;function Jw(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>Xw?-1:i==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):zm(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function Qw(e,t){let n=Jw(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,o){let s=Jw(e,t);if(!s)return r;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>Xw||n.off>Xw||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(Rp.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=Hm(n.text,s,e.tabSize,!0);if(r<0)o.push(Rp.cursor(n.to));else{let t=Hm(n.text,a,e.tabSize);o.push(Rp.range(n.from+r,n.from+t))}}}return o}(e.state,n,s);return a.length?o?Rp.create(a.concat(r.ranges)):Rp.create(a):r}}:null}const Zw={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},ex={style:"cursor: crosshair"};const tx="-10000px";class nx{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)o.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function rx(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const ix=Lp.define({combine:e=>{var t,n,r;return{position:pg.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||rx}}}),ox=new WeakMap,sx=Bv.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(ix);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new nx(e,hx,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(ix);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=tx,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(pg.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=$v(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(ix).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=tx;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,m=d.right-d.left,g=null!==(t=ox.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||cx,b=this.view.textDirection==Jg.LTR,y=d.width>r.right-r.left?b?r.left:r.right-d.width:b?Math.max(r.left,Math.min(u.left-(f?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,u.left-m+(f?14:0)-v.x),r.right-m),w=this.above[a];!l.strictSide&&(w?u.top-g-p-v.y<r.top:u.bottom+g+p+v.y>r.bottom)&&w==r.bottom-u.bottom>u.top-r.top&&(w=this.above[a]=!w);let x=(w?u.top-r.top:r.bottom-u.bottom)-p;if(x<g&&!1!==c.resize){if(x<this.view.defaultLineHeight){h.style.top=tx;continue}ox.set(c,g),h.style.height=(g=x)/o+"px"}else h.style.height&&(h.style.height="");let k=w?u.top-g-p-v.y:u.bottom+p+v.y,S=y+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>y&&e.top<k+g&&e.bottom>k&&(k=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(k-e.parent.top)/o+"px",ax(h,(y-e.parent.left)/i)):(h.style.top=k/o+"px",ax(h,y/i)),f){let e=u.left+(b?v.x:-v.x)-(y+14-7);f.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:y,top:k,right:S,bottom:k+g}),h.classList.toggle("cm-tooltip-above",w),h.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=tx}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ax(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const lx=aw.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),cx={x:0,y:0},hx=Lp.define({enables:[sx,lx]}),ux=Lp.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class dx{static create(e){return new dx(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new nx(e,ux,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r)if(void 0===t)t=r;else if(t!==r)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const fx=hx.compute([ux],e=>{let t=e.facet(ux);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:dx.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class px{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),null==r)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==Jg.RTL?-1:1;i=t.x<n.left?-s:s}let o=this.source(e,r,i);if(null==o?void 0:o.then){let t=this.pending={pos:r};o.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>Rv(e.state,t,"hover tooltip"))}else!o||Array.isArray(o)&&!o.length||e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(sx),t=e?e.manager.tooltips.findIndex(e=>e.create==dx.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!function(e,t){let n,{left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=r-mx&&t.clientX<=i+mx&&t.clientY>=o-mx&&t.clientY<=s+mx}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,r,i){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const mx=4;function gx(e,t={}){let n=hm.define(),r=zp.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,xp.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(bx)&&(e=[]);return e},provide:e=>ux.from(e)});return{active:r,extension:[r,Bv.define(i=>new px(i,e,r,n,t.hoverTime||300)),fx]}}function vx(e,t){let n=e.plugin(sx);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const bx=hm.define(),yx=Lp.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function wx(e,t){let n=e.plugin(xx),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const xx=Bv.fromClass(class{constructor(e){this.input=e.state.facet(Ex),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(yx);this.top=new kx(e,!0,t.topContainer),this.bottom=new kx(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(yx);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new kx(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new kx(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Ex);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),r.push(t),(t.top?i:o).push(t)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>aw.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class kx{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Sx(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Sx(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Sx(e){let t=e.nextSibling;return e.remove(),t}const Ex=Lp.define({enables:xx});function Cx(e,t){let n,r=new Promise(e=>n=e),i=e=>function(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=tg("form"),t.input){let e=tg("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),r.appendChild(tg("label",(t.label||"")+": ",e))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(tg("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i="FORM"==r.nodeName?[r]:r.querySelectorAll("form");for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),s(null)):13==e.keyCode&&(e.preventDefault(),s(t))}),t.addEventListener("submit",e=>{e.preventDefault(),s(t)})}let o=tg("div",r,tg("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(o.className=t.class);function s(t){o.contains(o.ownerDocument.activeElement)&&e.focus(),n(t)}return o.classList.add("cm-dialog"),{dom:o,top:t.top,mount:()=>{if(t.focus){let e;e="string"==typeof t.focus?r.querySelector(t.focus):r.querySelector("input")||r.querySelector("button"),e&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}}(e,t,n);e.state.field(Ox,!1)?e.dispatch({effects:Nx.of(i)}):e.dispatch({effects:hm.appendConfig.of(Ox.init(()=>[i]))});let o=Ax.of(i);return{close:o,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Ox).indexOf(i)>-1&&e.dispatch({effects:o})}),t))}}const Ox=zp.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(Nx)?e=[n.value].concat(e):n.is(Ax)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Ex.computeN([e],t=>t.field(e))}),Nx=hm.define(),Ax=hm.define();class Tx extends Em{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Tx.prototype.elementClass="",Tx.prototype.toDOM=void 0,Tx.prototype.mapMode=xp.TrackBefore,Tx.prototype.startSide=Tx.prototype.endSide=-1,Tx.prototype.point=!0;const Mx=Lp.define(),Rx=Lp.define(),Dx={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Tm.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Px=Lp.define();function Lx(e){return[Ix(),Px.of({...Dx,...e})]}const Bx=Lp.define({combine:e=>e.some(e=>e)});function Ix(e){let t=[_x];return e&&!1===e.fixed&&t.push(Bx.of(!0)),t}const _x=Bv.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Px).map(t=>new zx(e,t)),this.fixed=!e.state.facet(Bx);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Bx)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Tm.iter(this.view.state.facet(Mx),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Wx(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==xg.Text&&t){Fx(n,r,o.from);for(let e of i)e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==xg.Text){Fx(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Px),n=e.state.facet(Px),r=e.docChanged||e.heightChanged||e.viewportChanged||!Tm.eq(e.startState.facet(Mx),e.state.facet(Mx),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new zx(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>aw.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Jg.LTR?{left:r,right:i}:{right:r,left:i}})});function jx(e){return Array.isArray(e)?e:[e]}function Fx(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Wx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Tm.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new Hx(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Fx(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(Rx)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class zx{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i,o=r.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=jx(t.markers(e)),t.initialSpacer&&(this.spacer=new Hx(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=jx(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!Tm.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Hx{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const Vx=Lp.define(),qx=Lp.define(),Ux=Lp.define({combine:e=>Sm(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class $x extends Tx{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Kx(e,t){return e.state.facet(Ux).formatNumber(t,e.state)}const Yx=Px.compute([Ux],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Vx),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new $x(Kx(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(qx)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ux)!=e.state.facet(Ux),initialSpacer:e=>new $x(Kx(e,Gx(e.state.doc.lines))),updateSpacer(e,t){let n=Kx(t.view,Gx(t.view.state.doc.lines));return n==e.number?e:new $x(n)},domEventHandlers:e.facet(Ux).domEventHandlers,side:"before"}));function Gx(e){let t=9;for(;t<e;)t=10*t+9;return t}const Xx=new class extends Tx{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Jx=Mx.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Xx.range(i)))}return Tm.of(t)});const Qx=1024;let Zx=0;class ek{constructor(e,t){this.from=e,this.to=t}}class tk{constructor(e={}){this.id=Zx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=ik.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}tk.closedBy=new tk({deserialize:e=>e.split(" ")}),tk.openedBy=new tk({deserialize:e=>e.split(" ")}),tk.group=new tk({deserialize:e=>e.split(" ")}),tk.isolate=new tk({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),tk.contextHash=new tk({perNode:!0}),tk.lookAhead=new tk({perNode:!0}),tk.mounted=new tk({perNode:!0});class nk{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[tk.mounted.id]}}const rk=Object.create(null);class ik{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):rk,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new ik(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(tk.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(tk.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}ik.none=new ik("",Object.create(null),0,8);class ok{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new ik(n.name,r,n.id,n.flags):n)}return new ok(t)}}const sk=new WeakMap,ak=new WeakMap;var lk;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(lk||(lk={}));class ck{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=nk.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new kk(this.topNode,e)}cursorAt(e,t=0,n=0){let r=sk.get(this)||this.topNode,i=new kk(r);return i.moveTo(e,t),sk.set(this,i._tree),i}get topNode(){return new mk(this,0,0,null)}resolve(e,t=0){let n=fk(sk.get(this)||this.topNode,e,t,!1);return sk.set(this,n),n}resolveInner(e,t=0){let n=fk(ak.get(this)||this.topNode,e,t,!0);return ak.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof mk?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=nk.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new mk(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(fk(s,t,n,!1))}}return i?wk(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&lk.IncludeAnonymous)>0;for(let e=this.cursor(o|lk.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ok(ik.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new ck(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new ck(ik.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=Qx,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new hk(n,n.length):n,l=r.types,c=0,h=0;function u(e,t,n,b,y,w){let{id:x,start:k,end:S,size:E}=a,C=h,O=c;if(E<0){if(a.next(),-1==E){let t=o[x];return n.push(t),void b.push(k-e)}if(-3==E)return void(c=x);if(-4==E)return void(h=x);throw new RangeError(`Unrecognized record size: ${E}`)}let N,A,T=l[x],M=k-e;if(S-k<=i&&(A=g(a.pos-t,y))){let t=new Uint16Array(A.size-A.skip),n=a.pos-A.size,i=t.length;for(;a.pos>n;)i=v(A.start,t,i);N=new uk(t,S-A.start,r),M=A.start-e}else{let e=a.pos-E;a.next();let t=[],n=[],r=x>=s?x:-1,o=0,l=S;for(;a.pos>e;)r>=0&&a.id==r&&a.size>=0?(a.end<=l-i&&(p(t,n,k,o,a.end,l,r,C,O),o=t.length,l=a.end),a.next()):w>2500?d(k,e,t,n):u(k,e,t,n,r,w+1);if(r>=0&&o>0&&o<t.length&&p(t,n,k,o,k,l,r,C,O),t.reverse(),n.reverse(),r>-1&&o>0){let e=f(T,O);N=Ok(T,t,n,0,t.length,0,S-k,e,e)}else N=m(T,t,n,S-k,C-S,O)}n.push(N),b.push(M)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-i),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new uk(t,s[2]-i,r)),o.push(i-e)}}function f(e,t){return(n,r,i)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof ck){if(!l&&o.type==e&&o.length==i)return o;(s=o.prop(tk.lookAhead))&&(a=r[l]+o.length+s)}return m(e,n,r,i,a,t)}}function p(e,t,n,i,o,s,a,l,c){let h=[],u=[];for(;e.length>i;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(m(r.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function m(e,t,n,r,i,o,s){if(o){let e=[tk.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[tk.lookAhead,i];s=s?[e].concat(s):[e]}return new ck(e,t,n,r,s)}function g(e,t){let n=a.fork(),r=0,o=0,l=0,c=n.end-i,h={size:0,start:0,skip:0};e:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){h.size=r,h.start=o,h.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<c)break;let u=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,r+=e,l+=u}return(t<0||r==e)&&(h.size=r,h.start=o,h.skip=l),h.size>4?h:void 0}function v(e,t,n){let{id:r,start:i,end:o,size:l}=a;if(a.next(),l>=0&&r<s){let s=n;if(l>4){let r=a.pos-(l-4);for(;a.pos>r;)n=v(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==l?c=r:-4==l&&(h=r);return n}let b=[],y=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,b,y,-1,0);let w=null!==(t=e.length)&&void 0!==t?t:b.length?y[0]+b[0].length:0;return new ck(l[e.topID],b.reverse(),y.reverse(),w)}(e)}}ck.empty=new ck(ik.none,[],[],0);class hk{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new hk(this.buffer,this.index)}}class uk{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return ik.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&!(dk(i,r,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new uk(i,o,this.set)}}function dk(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function fk(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof mk&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:lk.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;r=s,s=r.parent)r instanceof mk&&r.index<0&&(null===(i=s.enter(t,n,o))||void 0===i?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class pk{cursor(e=0){return new kk(this,e)}getChild(e,t=null,n=null){let r=gk(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return gk(this,e,t,n)}resolve(e,t=0){return fk(this,e,t,!1)}resolveInner(e,t=0){return fk(this,e,t,!0)}matchContext(e){return vk(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class mk extends pk{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,i=0){var o;for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=t>0?a.length:-1;e!=c;e+=t){let c=a[e],h=l[e]+s.from;if(i&lk.EnterBracketed&&c instanceof ck&&null===(null===(o=nk.get(c))||void 0===o?void 0:o.overlay)&&(h>=n||h+c.length<=n)||dk(r,n,h,h+c.length))if(c instanceof uk){if(i&lk.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,n-h,r);if(o>-1)return new yk(new bk(s,c,e,h),null,o)}else if(i&lk.IncludeAnonymous||!c.type.isAnonymous||Sk(c)){let o;if(!(i&lk.IgnoreMounts)&&(o=nk.get(c))&&!o.overlay)return new mk(o.tree,h,e,s);let a=new mk(c,h,e,s);return i&lk.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?c.children.length-1:0,t,n,r,i)}}if(i&lk.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&lk.IgnoreOverlays)&&(r=nk.get(this._tree))&&r.overlay){let i=e-this.from,o=n&lk.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||o?e<=i:e<i)&&(t<0||o?n>=i:n>i))return new mk(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function gk(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function vk(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class bk{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class yk extends pk{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new yk(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&lk.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new yk(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new yk(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new yk(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new ck(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wk(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof mk&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new xk(i,n)}class xk{constructor(e,t){this.heads=e,this.node=t}get next(){return wk(this.heads)}}class kk{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~lk.EnterBracketed,e instanceof mk)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof mk?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&lk.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&lk.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&lk.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&lk.IncludeAnonymous||e instanceof uk||!e.type.isAnonymous||Sk(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new yk(this.buffer,t,this.stack[e]);return this.bufferNode=new yk(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return vk(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return vk(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Sk(e){return e.children.some(e=>e instanceof uk||!e.type.isAnonymous||Sk(e))}const Ek=new WeakMap;function Ck(e,t){if(!e.isAnonymous||t instanceof uk||t.type!=e)return 1;let n=Ek.get(t);if(null==n){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ck)){n=1;break}n+=Ck(e,r)}Ek.set(t,n)}return n}function Ok(e,t,n,r,i,o,s,a,l){let c=0;for(let n=r;n<i;n++)c+=Ck(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,r,i,s,a){for(let c=i;c<s;){let i=c,f=r[c],p=Ck(e,n[c]);for(c++;c<s;c++){let t=Ck(e,n[c]);if(p+t>=h)break;p+=t}if(c==i+1){if(p>h){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}u.push(n[i])}else{let t=r[c-1]+n[c-1].length-f;u.push(Ok(e,n,r,i,c,f,t,null,l))}d.push(f+a-o)}}(t,n,r,i,0),(a||l)(u,d,s)}class Nk{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new Nk(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let t=o;if(a>=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Nk(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&r.push(t),o.to>h)break;o=i<e.length?e[i++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return r}}class Ak{startParse(e,t,n){return"string"==typeof e&&(e=new Tk(e)),n=n?n.length?n.map(e=>new ek(e.from,e.to)):[new ek(0,0)]:[new ek(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class Tk{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new tk({perNode:!0});let Mk=0;class Rk{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Mk++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof Rk&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new Rk(n,[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new Pk(e);return e=>e.modified.indexOf(t)>-1?e:Pk.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let Dk=0;class Pk{constructor(e){this.name=e,this.instances=[],this.id=Dk++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]));var r,i});if(n)return n;let r=[],i=new Rk(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(Pk.get(t,e));return i}}function Lk(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(" "))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw new RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new Ik(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return Bk.add(t)}const Bk=new tk({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new Ik(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class Ik{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function _k(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function jk(e,t,n,r=0,i=e.length){let o=new Fk(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}Ik.empty=new Ik([],2,null);class Fk{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,c=function(e){let t=e.type.prop(Bk);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Ik.empty,h=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(tk.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,f=s;;d++){let p=d<u.overlay.length?u.overlay[d]:null,m=p?p.from+s:a,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&h)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;f=p.to+s,f>t&&(this.highlightRange(o.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),l))}h&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const Wk=Rk.define,zk=Wk(),Hk=Wk(),Vk=Wk(Hk),qk=Wk(Hk),Uk=Wk(),$k=Wk(Uk),Kk=Wk(Uk),Yk=Wk(),Gk=Wk(Yk),Xk=Wk(),Jk=Wk(),Qk=Wk(),Zk=Wk(Qk),eS=Wk(),tS={comment:zk,lineComment:Wk(zk),blockComment:Wk(zk),docComment:Wk(zk),name:Hk,variableName:Wk(Hk),typeName:Vk,tagName:Wk(Vk),propertyName:qk,attributeName:Wk(qk),className:Wk(Hk),labelName:Wk(Hk),namespace:Wk(Hk),macroName:Wk(Hk),literal:Uk,string:$k,docString:Wk($k),character:Wk($k),attributeValue:Wk($k),number:Kk,integer:Wk(Kk),float:Wk(Kk),bool:Wk(Uk),regexp:Wk(Uk),escape:Wk(Uk),color:Wk(Uk),url:Wk(Uk),keyword:Xk,self:Wk(Xk),null:Wk(Xk),atom:Wk(Xk),unit:Wk(Xk),modifier:Wk(Xk),operatorKeyword:Wk(Xk),controlKeyword:Wk(Xk),definitionKeyword:Wk(Xk),moduleKeyword:Wk(Xk),operator:Jk,derefOperator:Wk(Jk),arithmeticOperator:Wk(Jk),logicOperator:Wk(Jk),bitwiseOperator:Wk(Jk),compareOperator:Wk(Jk),updateOperator:Wk(Jk),definitionOperator:Wk(Jk),typeOperator:Wk(Jk),controlOperator:Wk(Jk),punctuation:Qk,separator:Wk(Qk),bracket:Zk,angleBracket:Wk(Zk),squareBracket:Wk(Zk),paren:Wk(Zk),brace:Wk(Zk),content:Yk,heading:Gk,heading1:Wk(Gk),heading2:Wk(Gk),heading3:Wk(Gk),heading4:Wk(Gk),heading5:Wk(Gk),heading6:Wk(Gk),contentSeparator:Wk(Yk),list:Wk(Yk),quote:Wk(Yk),emphasis:Wk(Yk),strong:Wk(Yk),link:Wk(Yk),monospace:Wk(Yk),strikethrough:Wk(Yk),inserted:Wk(),deleted:Wk(),changed:Wk(),invalid:Wk(),meta:eS,documentMeta:Wk(eS),annotation:Wk(eS),processingInstruction:Wk(eS),definition:Rk.defineModifier("definition"),constant:Rk.defineModifier("constant"),function:Rk.defineModifier("function"),standard:Rk.defineModifier("standard"),local:Rk.defineModifier("local"),special:Rk.defineModifier("special")};for(let e in tS){let t=tS[e];t instanceof Rk&&(t.name=e)}var nS;_k([{tag:tS.link,class:"tok-link"},{tag:tS.heading,class:"tok-heading"},{tag:tS.emphasis,class:"tok-emphasis"},{tag:tS.strong,class:"tok-strong"},{tag:tS.keyword,class:"tok-keyword"},{tag:tS.atom,class:"tok-atom"},{tag:tS.bool,class:"tok-bool"},{tag:tS.url,class:"tok-url"},{tag:tS.labelName,class:"tok-labelName"},{tag:tS.inserted,class:"tok-inserted"},{tag:tS.deleted,class:"tok-deleted"},{tag:tS.literal,class:"tok-literal"},{tag:tS.string,class:"tok-string"},{tag:tS.number,class:"tok-number"},{tag:[tS.regexp,tS.escape,tS.special(tS.string)],class:"tok-string2"},{tag:tS.variableName,class:"tok-variableName"},{tag:tS.local(tS.variableName),class:"tok-variableName tok-local"},{tag:tS.definition(tS.variableName),class:"tok-variableName tok-definition"},{tag:tS.special(tS.variableName),class:"tok-variableName2"},{tag:tS.definition(tS.propertyName),class:"tok-propertyName tok-definition"},{tag:tS.typeName,class:"tok-typeName"},{tag:tS.namespace,class:"tok-namespace"},{tag:tS.className,class:"tok-className"},{tag:tS.macroName,class:"tok-macroName"},{tag:tS.propertyName,class:"tok-propertyName"},{tag:tS.operator,class:"tok-operator"},{tag:tS.comment,class:"tok-comment"},{tag:tS.meta,class:"tok-meta"},{tag:tS.invalid,class:"tok-invalid"},{tag:tS.punctuation,class:"tok-punctuation"}]);const rS=new tk;const iS=new tk;class oS{constructor(e,t,n=[],r=""){this.data=e,this.name=r,km.prototype.hasOwnProperty("tree")||Object.defineProperty(km.prototype,"tree",{get(){return lS(this)}}),this.parser=t,this.extension=[vS.of(this),km.languageData.of((e,t,n)=>{let r=sS(e,t,n),i=r.type.prop(rS);if(!i)return[];let o=e.facet(i),s=r.type.prop(iS);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return sS(e,t,n).type.prop(rS)==this.data}findRegions(e){let t=e.facet(vS);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(rS)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(tk.mounted);if(i){if(i.tree.prop(rS)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof ck&&r(i,e.positions[n]+t)}};return r(lS(e),0),n}get allowsNesting(){return!0}}function sS(e,t,n){let r=e.facet(vS),i=lS(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,lk.ExcludeBuffers|lk.EnterBracketed))e.type.isTop&&(i=e);return i}oS.setState=hm.define();class aS extends oS{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,Lp.define({combine:n?e=>e.concat(n):void 0}));var n;return new aS(t,e.parser.configure({props:[rS.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new aS(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function lS(e){let t=e.field(oS.state,!1);return t?t.tree:ck.empty}class cS{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let hS=null;class uS{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new uS(e,t,[],ck.empty,0,n,[],null)}startParse(){return this.parser.startParse(new cS(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=ck.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(Nk.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Nk.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hS;hS=this;try{return e()}finally{hS=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=dS(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=Nk.applyChanges(n,t),r=ck.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&s.push({from:n,to:r})}}}return new uS(this.parser,t,n,r,i,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=dS(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Ak{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to,s={parsedPos:i,advance(){let t=hS;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new ck(ik.none,[],[],o-i)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return hS}}function dS(e,t,n){return Nk.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class fS{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new fS(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=uS.create(e.facet(vS).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new fS(n)}}oS.state=zp.define({create:fS.init,update(e,t){for(let e of t.effects)if(e.is(oS.setState))return e.value;return t.startState.facet(vS)!=t.state.facet(vS)?fS.init(t.state):e.apply(t)}});let pS=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(pS=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const mS="undefined"!=typeof navigator&&(null===(nS=navigator.scheduling)||void 0===nS?void 0:nS.isInputPending)?()=>navigator.scheduling.isInputPending():null,gS=Bv.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(oS.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(oS.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=pS(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(oS.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!mS?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>mS&&mS()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:oS.setState.of(new fS(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Rv(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),vS=Lp.define({combine:e=>e.length?e[0]:null,enables:e=>[oS.state,gS,aw.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class bS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const yS=Lp.define(),wS=Lp.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function xS(e){let t=e.facet(wS);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function kS(e,t){let n="",r=e.tabSize,i=e.facet(wS)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function SS(e,t){e instanceof km&&(e=new ES(e));for(let n of e.state.facet(yS)){let r=n(e,t);if(void 0!==r)return r}let n=lS(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return OS(r,e,n)}(e,n,t):null}class ES{constructor(e,t={}){this.state=e,this.options=t,this.unit=xS(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return zm(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const CS=new tk;function OS(e,t,n){for(let r=e;r;r=r.next){let e=NS(r.node);if(e)return e(TS.create(t,n,r))}return 0}function NS(e){let t=e.type.prop(CS);if(t)return t;let n,r=e.firstChild;if(r&&(n=r.type.prop(tk.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}(e,!0,1,void 0,r&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?AS:null}function AS(){return 0}class TS extends ES{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new TS(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(MS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return OS(this.context.next,this.base,this.pos)}}function MS(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function RS({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const DS=Lp.define(),PS=new tk;function LS(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function BS(e,t,n){for(let r of e.facet(DS)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=lS(e);if(r.length<n)return null;let i=null;for(let o=r.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<t)break;let a=s.type.prop(PS);if(a&&(s.to<r.length-50||r.length==e.doc.length||!LS(s))){let r=a(s,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function IS(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const _S=hm.define({map:IS}),jS=hm.define({map:IS});function FS(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const WS=zp.define({create:()=>kg.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=zS(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(_S)&&!VS(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(YS),i=r?kg.replace({widget:new QS(r(t.state,n.value))}):JS;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(jS)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=zS(e,t.selection.main.head)),e},provide:e=>aw.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid JSON for fold state");t.push(JS.range(r,i))}return kg.set(t,!0)}});function zS(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function HS(e,t,n){var r;let i=null;return null===(r=e.field(WS,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function VS(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function qS(e,t){return e.field(WS,!1)?t:t.concat(hm.appendConfig.of(GS()))}function US(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return aw.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const $S=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of FS(e)){let n=BS(e.state,t.from,t.to);if(n)return e.dispatch({effects:qS(e.state,[_S.of(n),US(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(WS,!1))return!1;let t=[];for(let n of FS(e)){let r=HS(e.state,n.from,n.to);r&&t.push(jS.of(r),US(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=BS(t,i.from,i.to);o&&n.push(_S.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:qS(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(WS,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(jS.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],KS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},YS=Lp.define({combine:e=>Sm(e,KS)});function GS(e){let t=[WS,tE];return e&&t.push(YS.of(e)),t}function XS(e,t){let{state:n}=e,r=n.facet(YS),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=HS(e.state,n.from,n.to);r&&e.dispatch({effects:jS.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const JS=kg.replace({widget:new class extends wg{toDOM(e){return XS(e,null)}}});class QS extends wg{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return XS(e,this.value)}}const ZS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class eE extends Tx{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}const tE=aw.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class nE{constructor(e,t){let n;function r(e){let t=$m.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof oS?e=>e.prop(rS)==o.data:o?e=>e==o:void 0,this.style=_k(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new $m(n):null,this.themeType=t.themeType}static define(e,t){return new nE(e,t||{})}}const rE=Lp.define(),iE=Lp.define({combine:e=>e.length?[e[0]]:null});function oE(e){let t=e.facet(rE);return t.length?t:e.facet(iE)}function sE(e,t){let n,r=[lE];return e instanceof nE&&(e.module&&r.push(aw.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(iE.of(e)):n?r.push(rE.computeN([aw.darkTheme],t=>t.facet(aw.darkTheme)==("dark"==n)?[e]:[])):r.push(rE.of(e)),r}class aE{constructor(e){this.markCache=Object.create(null),this.tree=lS(e.state),this.decorations=this.buildDeco(e,oE(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=lS(e.state),n=oE(e.state),r=n!=oE(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return kg.none;let n=new Mm;for(let{from:r,to:i}of e.visibleRanges)jk(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=kg.mark({class:r})))},r,i);return n.finish()}}const lE=Kp.high(Bv.fromClass(aE,{decorations:e=>e.decorations})),cE=nE.define([{tag:tS.meta,color:"#404740"},{tag:tS.link,textDecoration:"underline"},{tag:tS.heading,textDecoration:"underline",fontWeight:"bold"},{tag:tS.emphasis,fontStyle:"italic"},{tag:tS.strong,fontWeight:"bold"},{tag:tS.strikethrough,textDecoration:"line-through"},{tag:tS.keyword,color:"#708"},{tag:[tS.atom,tS.bool,tS.url,tS.contentSeparator,tS.labelName],color:"#219"},{tag:[tS.literal,tS.inserted],color:"#164"},{tag:[tS.string,tS.deleted],color:"#a11"},{tag:[tS.regexp,tS.escape,tS.special(tS.string)],color:"#e40"},{tag:tS.definition(tS.variableName),color:"#00f"},{tag:tS.local(tS.variableName),color:"#30a"},{tag:[tS.typeName,tS.namespace],color:"#085"},{tag:tS.className,color:"#167"},{tag:[tS.special(tS.variableName),tS.macroName],color:"#256"},{tag:tS.definition(tS.propertyName),color:"#00c"},{tag:tS.comment,color:"#940"},{tag:tS.invalid,color:"#f00"}]),hE=aw.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),uE="()[]{}",dE=Lp.define({combine:e=>Sm(e,{afterCursor:!0,brackets:uE,maxScanDistance:1e4,renderMatch:mE})}),fE=kg.mark({class:"cm-matchingBracket"}),pE=kg.mark({class:"cm-nonmatchingBracket"});function mE(e){let t=[],n=e.matched?fE:pE;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const gE=zp.define({create:()=>kg.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(dE);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=xE(t.state,e.head,-1,r)||e.head>0&&xE(t.state,e.head-1,1,r)||r.afterCursor&&(xE(t.state,e.head,1,r)||e.head<t.state.doc.length&&xE(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return kg.set(n,!0)},provide:e=>aw.decorations.from(e)}),vE=[gE,hE];const bE=new tk;function yE(e,t,n){let r=e.prop(t<0?tk.openedBy:tk.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function wE(e){let t=e.type.prop(bE);return t?t(e.node):e}function xE(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||uE,s=lS(e),a=s.resolveInner(t,n);for(let r=a;r;r=r.parent){let i=yE(r.type,n,o);if(i&&r.from<r.to){let s=wE(r);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return kE(e,t,n,r,s,i,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,i,o)}function kE(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do{if(n<0?h.to<=r.from:h.from>=r.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from<h.to){let e=wE(h);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(yE(h.type,n,s))c++;else if(yE(h.type,-n,s)){if(0==c){let e=wE(h);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}const SE=Object.create(null),EE=[ik.none],CE=[],OE=Object.create(null),NE=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])NE[e]=TE(SE,t);function AE(e,t){CE.indexOf(e)>-1||CE.push(e)}function TE(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||tS[n];r?"function"==typeof r?t.length?t=t.map(r):AE(n):t.length?AE(n):t=Array.isArray(r)?r:[r]:AE(n)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=OE[i];if(o)return o.id;let s=OE[i]=ik.define({id:EE.length,name:r,props:[Lk({[r]:n})]});return EE.push(s),s.id}Jg.RTL,Jg.LTR;function ME(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}const RE=ME(_E,0),DE=ME(IE,0),PE=ME((e,t)=>IE(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function LE(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const BE=50;function IE(e,t,n=t.selection.ranges){let r=n.map(e=>LE(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-BE,r),l=e.sliceDoc(i,i+BE),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=2*BE?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+BE),s=e.sliceDoc(i-BE,i));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null}(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t,n=0;n<i.length;n++)if(t=i[n]){let i=r[n],{open:o,close:s}=t;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}function _E(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:o}of n){let n=r.length,s=1e9,a=LE(t,e).line;if(a){for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)!s&&o||e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null}const jE=am.define(),FE=am.define(),WE=Lp.define(),zE=Lp.define({combine:e=>Sm(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),HE=zp.define({create:()=>iC.empty,update(e,t){let n=t.state.facet(zE),r=t.annotation(jE);if(r){let i=YE.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?GE(s,s.length,n.minDepth,i):ZE(s,t.startState.selection),new iC(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(FE);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(um.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=YE.fromTransaction(t),s=t.annotation(um.time),a=t.annotation(um.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new iC(e.done.map(YE.fromJSON),e.undone.map(YE.fromJSON))});function VE(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(HE,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}const qE=VE(0,!1),UE=VE(1,!1),$E=VE(0,!0),KE=VE(1,!0);class YE{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new YE(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new YE(e.changes&&Sp.fromJSON(e.changes),[],e.mapped&&kp.fromJSON(e.mapped),e.startSelection&&Rp.fromJSON(e.startSelection),e.selectionsAfter.map(Rp.fromJSON))}static fromTransaction(e,t){let n=JE;for(let t of e.startState.facet(WE)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new YE(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,JE)}static selection(e){return new YE(void 0,JE,void 0,void 0,e)}}function GE(e,t,n,r){let i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function XE(e,t){return e.length?t.length?e.concat(t):e:t}const JE=[],QE=200;function ZE(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-QE));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),GE(e,e.length-1,1e9,n.setSelAfter(r)))}return[YE.selection([t])]}function eC(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function tC(e,t){if(!e.length)return e;let n=e.length,r=JE;for(;n;){let i=nC(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[YE.selection(r)]:JE}function nC(e,t,n){let r=XE(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):JE,n);if(!e.changes)return YE.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new YE(i,hm.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const rC=/^(input\.type|delete)($|\.)/;class iC{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new iC(this.done,this.undone):this}addChanges(e,t,n,r,i){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||rC.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,function(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,o)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];o>=t&&i<=s&&(r=!0)}}),r}(s.changes,e.changes))||"input.type.compose"==n)?GE(o,o.length-1,r.minDepth,new YE(e.changes.compose(s.changes),XE(hm.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,JE)):GE(o,o.length,r.minDepth,e),new iC(o,JE,t,n)}addSelection(e,t,n,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:JE;return i.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(o=i[i.length-1],s=e,o.ranges.length==s.ranges.length&&0===o.ranges.filter((e,t)=>e.empty!=s.ranges[t].empty).length)?this:new iC(ZE(this.done,e),this.undone,t,n);var o,s}addMapping(e){return new iC(tC(this.done,e),tC(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:jE.of({side:e,rest:eC(r),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let n=1==r.length?JE:r.slice(0,r.length-1);return i.mapped&&(n=tC(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:jE.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}iC.empty=new iC(JE,JE);const oC=[{key:"Mod-z",run:qE,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:UE,preventDefault:!0},{linux:"Ctrl-Shift-z",run:UE,preventDefault:!0},{key:"Mod-u",run:$E,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:KE,preventDefault:!0}];function sC(e,t){return Rp.create(e.ranges.map(t),e.mainIndex)}function aC(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function lC({state:e,dispatch:t},n){let r=sC(e.selection,n);return!r.eq(e.selection,!0)&&(t(aC(e,r)),!0)}function cC(e,t){return Rp.cursor(t?e.to:e.from)}function hC(e,t){return lC(e,n=>n.empty?e.moveByChar(n,t):cC(n,t))}function uC(e){return e.textDirectionAt(e.state.selection.main.head)==Jg.LTR}const dC=e=>hC(e,!uC(e)),fC=e=>hC(e,uC(e));function pC(e,t){return lC(e,n=>n.empty?e.moveByGroup(n,t):cC(n,t))}function mC(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function gC(e,t,n){let r,i,o=lS(e).resolveInner(t.head),s=n?tk.closedBy:tk.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;mC(e,t,s)?o=t:r=n?t.to:t.from}return i=o.type.prop(s)&&(r=n?xE(e,o.from,1):xE(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,Rp.cursor(i,n?-1:1)}function vC(e,t){return lC(e,n=>{if(!n.empty)return cC(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const bC=e=>vC(e,!1),yC=e=>vC(e,!0);function wC(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(aw.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function xC(e,t){let n,r=wC(e),{state:i}=e,o=sC(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):cC(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=aw.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(aC(i,o),{effects:n}),!0}const kC=e=>xC(e,!1),SC=e=>xC(e,!0);function EC(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=Rp.cursor(r.from+n))}return i}function CC(e,t){let n=sC(e.state.selection,e=>{let n=t(e);return Rp.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(aC(e.state,n)),!0)}function OC(e,t){return CC(e,n=>e.moveByChar(n,t))}const NC=e=>OC(e,!uC(e)),AC=e=>OC(e,uC(e));function TC(e,t){return CC(e,n=>e.moveByGroup(n,t))}function MC(e,t){return CC(e,n=>e.moveVertically(n,t))}const RC=e=>MC(e,!1),DC=e=>MC(e,!0);function PC(e,t){return CC(e,n=>e.moveVertically(n,t,wC(e).height))}const LC=e=>PC(e,!1),BC=e=>PC(e,!0),IC=({state:e,dispatch:t})=>(t(aC(e,{anchor:0})),!0),_C=({state:e,dispatch:t})=>(t(aC(e,{anchor:e.doc.length})),!0),jC=({state:e,dispatch:t})=>(t(aC(e,{anchor:e.selection.main.anchor,head:0})),!0),FC=({state:e,dispatch:t})=>(t(aC(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function WC(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(aC(n,Rp.create(i,i.length-1))),!0)}function zC(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=HC(e,s,!1)):s>i&&(n="delete.forward",s=HC(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=HC(e,i,!1),o=HC(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:Rp.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?aw.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function HC(e,t,n){if(e instanceof aw)for(let r of e.state.facet(aw.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}const VC=(e,t,n)=>zC(e,r=>{let i,o,s=r.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(i=l.text.slice(0,s-l.from))){if("\t"==i[i.length-1])return s-1;let e=zm(i,a.tabSize)%xS(a)||xS(a);for(let t=0;t<e&&" "==i[i.length-1-t];t++)s--;o=s}else o=gp(l.text,s-l.from,t,t)+l.from,o==s&&l.number!=(t?a.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(o-l.from,s-l.from))&&(o=gp(l.text,o-l.from,!1,!1)+l.from);return o}),qC=e=>VC(e,!1,!0),UC=e=>VC(e,!0,!1),$C=(e,t)=>zC(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=gp(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&r==n.head||(e=c),r=a}return r}),KC=e=>$C(e,!1);function YC(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function GC(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of YC(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)i.push(Rp.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)i.push(Rp.range(e.anchor-s,e.head-s))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:Rp.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function XC(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of YC(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const JC=ZC(!1),QC=ZC(!0);function ZC(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=lS(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(tk.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(i.to,o.from))?{from:i.to,to:o.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new ES(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=SS(a,r);for(null==l&&(l=zm(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?({from:r,to:i}=s):r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let c=["",kS(t,l)];return s&&c.push(kS(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:sp.of(c)},range:Rp.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eO(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:Rp.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const tO=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eO(e,(t,n)=>{n.push({from:t.from,insert:e.facet(wS)})}),{userEvent:"input.indent"})),!0),nO=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eO(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=zm(r,e.tabSize),o=0,s=kS(e,Math.max(0,i-xS(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),rO=[{key:"Ctrl-b",run:dC,shift:NC,preventDefault:!0},{key:"Ctrl-f",run:fC,shift:AC},{key:"Ctrl-p",run:bC,shift:RC},{key:"Ctrl-n",run:yC,shift:DC},{key:"Ctrl-a",run:e=>lC(e,t=>Rp.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>CC(e,t=>Rp.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>lC(e,t=>Rp.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>CC(e,t=>Rp.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:UC},{key:"Ctrl-h",run:qC},{key:"Ctrl-k",run:e=>zC(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:KC},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:sp.of(["",""])},range:Rp.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:gp(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:gp(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:Rp.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:SC}],iO=[{key:"ArrowLeft",run:dC,shift:NC,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>pC(e,!uC(e)),shift:e=>TC(e,!uC(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>lC(e,t=>EC(e,t,!uC(e))),shift:e=>CC(e,t=>EC(e,t,!uC(e))),preventDefault:!0},{key:"ArrowRight",run:fC,shift:AC,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>pC(e,uC(e)),shift:e=>TC(e,uC(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>lC(e,t=>EC(e,t,uC(e))),shift:e=>CC(e,t=>EC(e,t,uC(e))),preventDefault:!0},{key:"ArrowUp",run:bC,shift:RC,preventDefault:!0},{mac:"Cmd-ArrowUp",run:IC,shift:jC},{mac:"Ctrl-ArrowUp",run:kC,shift:LC},{key:"ArrowDown",run:yC,shift:DC,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_C,shift:FC},{mac:"Ctrl-ArrowDown",run:SC,shift:BC},{key:"PageUp",run:kC,shift:LC},{key:"PageDown",run:SC,shift:BC},{key:"Home",run:e=>lC(e,t=>EC(e,t,!1)),shift:e=>CC(e,t=>EC(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:IC,shift:jC},{key:"End",run:e=>lC(e,t=>EC(e,t,!0)),shift:e=>CC(e,t=>EC(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:_C,shift:FC},{key:"Enter",run:JC,shift:JC},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:qC,shift:qC,preventDefault:!0},{key:"Delete",run:UC,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:KC,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>$C(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>zC(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>zC(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(rO.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),oO=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>lC(e,t=>gC(e.state,t,!uC(e))),shift:e=>CC(e,t=>gC(e.state,t,!uC(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>lC(e,t=>gC(e.state,t,uC(e))),shift:e=>CC(e,t=>gC(e.state,t,uC(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>GC(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>XC(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>GC(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>XC(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>WC(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>WC(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Rp.create([n.main]):n.main.empty||(r=Rp.create([Rp.cursor(n.main.head)])),!!r&&(t(aC(e,r)),!0)}},{key:"Mod-Enter",run:QC},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=YC(e).map(({from:t,to:n})=>Rp.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Rp.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=sC(e.selection,t=>{let n=lS(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Rp.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(aC(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:nO},{key:"Mod-]",run:tO},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ES(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=eO(e,(t,i,o)=>{let s=SS(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=kS(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(YC(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=sC(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let r=!1,i=sC(e.selection,t=>{let i=xE(e,t.head,-1)||xE(e,t.head,1)||t.head>0&&xE(e,t.head-1,1)||t.head<e.doc.length&&xE(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let o=i.start.from==t.head?i.end.to:i.end.from;return n?Rp.range(t.anchor,o):Rp.cursor(o)});return!!r&&(t(aC(e,i)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=LE(e.state,n.from);return r.line?RE(e):!!r.block&&PE(e)}},{key:"Alt-A",run:DE},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(iO),sO={key:"Tab",run:tO,shift:nO},aO="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class lO{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(aO(e)):aO,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return vp(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=bp(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=yp(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&e<t.length&&t.charCodeAt(e)==o&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(lO.prototype[Symbol.iterator]=function(){return this});const cO={from:-1,to:-1,match:/.*/.exec("")},hO="gm"+(null==/x/.unicode?"":"u");class uO{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=cO,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new pO(e,t,n,r,i);this.re=new RegExp(t,hO+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=mO(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=mO(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const dO=new WeakMap;class fO{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=dO.get(e);if(!r||r.from>=n||r.to<=t){let r=new fO(t,e.sliceString(t,n));return dO.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),dO.set(e,new fO(o,i)),new fO(t,i.slice(t-o,n-o))}}class pO{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=cO,this.matchPos=mO(e,r),this.re=new RegExp(t,hO+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=fO.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=mO(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function mO(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(uO.prototype[Symbol.iterator]=pO.prototype[Symbol.iterator]=function(){return this});const gO={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vO=Lp.define({combine:e=>Sm(e,gO,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});const bO=kg.mark({class:"cm-selectionMatch"}),yO=kg.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function wO(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==bm.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==bm.Word)}const xO=Bv.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(vO),{state:n}=e,r=n.selection;if(r.ranges.length>1)return kg.none;let i,o=r.main,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return kg.none;let e=n.wordAt(o.head);if(!e)return kg.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return kg.none;if(t.wholeWords){if(i=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!wO(s,n,o.from,o.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==bm.Word&&e(t.sliceDoc(r-1,r))==bm.Word}(s,n,o.from,o.to))return kg.none}else if(i=n.sliceDoc(o.from,o.to),!i)return kg.none}let a=[];for(let r of e.visibleRanges){let e=new lO(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||wO(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?a.push(yO.range(r,i)):(r>=o.to||i<=o.from)&&a.push(bO.range(r,i)),a.length>t.maxMatches))return kg.none}}return kg.set(a)}},{decorations:e=>e.decorations}),kO=aw.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const SO=Lp.define({combine:e=>Sm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new QO(e),scrollToMatch:e=>aw.scrollIntoView(e)})});class EO{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,hO),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new RO(this):new NO(this)}getCursor(e,t=0,n){let r=e.doc?e:km.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?AO(this,r,t,n):OO(this,r,t,n)}}class CO{constructor(e){this.spec=e}}function OO(e,t,n,r){let i;return e.wholeWord&&(i=function(e,t){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=e.sliceString(o,Math.min(e.length,r+2))),!(t(TO(i,n-o))==bm.Word&&t(MO(i,n-o))==bm.Word||t(MO(i,r-o))==bm.Word&&t(TO(i,r-o))==bm.Word))}(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=function(e,t,n){return(r,i,o,s)=>{if(n&&!n(r,i,o,s))return!1;let a=r>=s&&i<=s+o.length?o.slice(r-s,i-s):t.doc.sliceString(r,i);return e(a,t,r,i)}}(e.test,t,i)),new lO(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}class NO extends CO{constructor(e){super(e)}nextMatch(e,t,n){let r=OO(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=OO(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=OO(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=OO(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=OO(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function AO(e,t,n,r){let i;var o;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),i=(e,t,n)=>!n[0].length||(o(TO(n.input,n.index))!=bm.Word||o(MO(n.input,n.index))!=bm.Word)&&(o(MO(n.input,n.index+n[0].length))!=bm.Word||o(TO(n.input,n.index+n[0].length))!=bm.Word)),e.test&&(i=function(e,t,n){return(r,i,o)=>(!n||n(r,i,o))&&e(o[0],t,r,i)}(e.test,t,i)),new uO(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function TO(e,t){return e.slice(gp(e,t,!1),t)}function MO(e,t){return e.slice(t,gp(e,t))}class RO extends CO{nextMatch(e,t,n){let r=AO(this.spec,e,n,e.doc.length).next();return r.done&&(r=AO(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=AO(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=AO(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=AO(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const DO=hm.define(),PO=hm.define(),LO=zp.define({create:e=>new BO($O(e).create(),null),update(e,t){for(let n of t.effects)n.is(DO)?e=new BO(n.value.create(),e.panel):n.is(PO)&&(e=new BO(e.query,n.value?UO:null));return e},provide:e=>Ex.from(e,e=>e.panel)});class BO{constructor(e,t){this.query=e,this.panel=t}}const IO=kg.mark({class:"cm-searchMatch"}),_O=kg.mark({class:"cm-searchMatch cm-searchMatch-selected"}),jO=Bv.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(LO))}update(e){let t=e.state.field(LO);(t!=e.startState.field(LO)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return kg.none;let{view:n}=this,r=new Mm;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?_O:IO)})}return r.finish()}},{decorations:e=>e.decorations});function FO(e){return t=>{let n=t.state.field(LO,!1);return n&&n.query.spec.valid?e(t,n):GO(t)}}const WO=FO((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Rp.single(r.from,r.to),o=e.state.facet(SO);return e.dispatch({selection:i,effects:[nN(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),YO(e),!0}),zO=FO((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=Rp.single(i.from,i.to),s=e.state.facet(SO);return e.dispatch({selection:o,effects:[nN(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),YO(e),!0}),HO=FO((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:Rp.create(n.map(e=>Rp.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),VO=FO((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s,a,l=o,c=[],h=[];l.from==r&&l.to==i&&(a=n.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=t.nextMatch(n,l.from,l.to),h.push(aw.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=e.state.changes(c);return l&&(s=Rp.single(l.from,l.to).map(u),h.push(nN(e,l)),h.push(n.facet(SO).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:h,userEvent:"input.replace"}),!0}),qO=FO((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:aw.announce.of(r),userEvent:"input.replace.all"}),!0});function UO(e){return e.state.facet(SO).createPanel(e)}function $O(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(SO);return new EO({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function KO(e){let t=wx(e,UO);return t&&t.dom.querySelector("[main-field]")}function YO(e){let t=KO(e);t&&t==e.root.activeElement&&t.select()}const GO=e=>{let t=e.state.field(LO,!1);if(t&&t.panel){let n=KO(e);if(n&&n!=e.root.activeElement){let r=$O(e.state,t.query.spec);r.valid&&e.dispatch({effects:DO.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[PO.of(!0),t?DO.of($O(e.state,t.query.spec)):hm.appendConfig.of(iN)]});return!0},XO=e=>{let t=e.state.field(LO,!1);if(!t||!t.panel)return!1;let n=wx(e,UO);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:PO.of(!1)}),!0},JO=[{key:"Mod-f",run:GO,scope:"editor search-panel"},{key:"F3",run:WO,shift:zO,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:WO,shift:zO,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:XO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new lO(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(Rp.range(t.value.from,t.value.to))}return t(e.update({selection:Rp.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Cx(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i)return void e.dispatch({effects:r});let o=t.doc.lineAt(t.selection.main.head),[,s,a,l,c]=i,h=l?+l.slice(1):0,u=a?+a:o.number;if(a&&c){let e=u/100;s&&(e=e*("-"==s?-1:1)+o.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else a&&s&&(u=u*("-"==s?-1:1)+o.number);let d=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),f=Rp.cursor(d.from+Math.max(0,Math.min(h,d.length)));e.dispatch({effects:[r,aw.scrollIntoView(f.from,{y:"center"})],selection:f})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=Rp.create(n.ranges.map(t=>e.wordAt(t.head)||Rp.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new lO(e.doc,t,r[r.length-1].to);;){if(i.next(),!i.done){if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(n)return null;i=new lO(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(Rp.range(i.from,i.to),!1),effects:aw.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class QO{constructor(e){this.view=e;let t=this.query=e.state.field(LO).query.spec;function n(e,t,n){return tg("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=tg("input",{value:t.search,placeholder:ZO(e,"Find"),"aria-label":ZO(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=tg("input",{value:t.replace,placeholder:ZO(e,"Replace"),"aria-label":ZO(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=tg("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=tg("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=tg("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=tg("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>WO(e),[ZO(e,"next")]),n("prev",()=>zO(e),[ZO(e,"previous")]),n("select",()=>HO(e),[ZO(e,"all")]),tg("label",null,[this.caseField,ZO(e,"match case")]),tg("label",null,[this.reField,ZO(e,"regexp")]),tg("label",null,[this.wordField,ZO(e,"by word")]),...e.state.readOnly?[]:[tg("br"),this.replaceField,n("replace",()=>VO(e),[ZO(e,"replace")]),n("replaceAll",()=>qO(e),[ZO(e,"replace all")])],tg("button",{name:"close",onclick:()=>XO(e),"aria-label":ZO(e,"close"),type:"button"},["×"])])}commit(){let e=new EO({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:DO.of(e)}))}keydown(e){var t,n,r;t=this.view,n=e,r="search-panel",xw(vw(t.state),n,t,r)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?zO:WO)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),VO(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(DO)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(SO).top}}function ZO(e,t){return e.state.phrase(t)}const eN=30,tN=/[\s\.,:;?!]/;function nN(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-eN),s=Math.min(i,n+eN),a=e.state.sliceDoc(o,s);if(o!=r.from)for(let e=0;e<eN;e++)if(!tN.test(a[e+1])&&tN.test(a[e])){a=a.slice(e);break}if(s!=i)for(let e=a.length-1;e>a.length-eN;e--)if(!tN.test(a[e-1])&&tN.test(a[e])){a=a.slice(0,e);break}return aw.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const rN=aw.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),iN=[LO,Kp.low(jO),rN];class oN{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=lS(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(hN(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function sN(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function aN(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=sN(t)+sN(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}class lN{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function cN(e){return e.selection.main.from}function hN(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const uN=am.define();function dN(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:Rp.cursor(a.from+o+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const fN=new WeakMap;function pN(e){if(!Array.isArray(e))return e;let t=fN.get(e);return t||fN.set(e,t=aN(e)),t}const mN=hm.define(),gN=hm.define();class vN{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=vp(e,t),r=yp(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(vp(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=vp(e,0),i=yp(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=vp(e,i);o!=t[l]&&o!=n[l]||(r[l++]=i),i+=yp(o)}if(l<a)return null}let c=0,h=0,u=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&h<a;){let l=vp(e,r);s<0&&(c<a&&l==t[c]&&(i[c++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let b,y=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(b=bp(l))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!r||1==y&&m||0==v&&0!=y)&&(t[h]==l||n[h]==l&&(u=!0)?o[h++]=r:o.length&&(g=!1)),v=y,r+=yp(l)}return h==a&&0==o[0]&&g?this.result((u?-200:0)-100,o,e):d==a&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[f,p]):h==a?this.result((u?-200:0)-100-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?yp(vp(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class bN{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const yN=Lp.define({combine:e=>Sm(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:xN,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>wN(e(n),t(n)),optionClass:(e,t)=>n=>wN(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function wN(e,t){return e?t?e+" "+t:e:t}function xN(e,t,n,r,i,o){let s,a,l=e.textDirection==Jg.RTL,c=l,h=!1,u="top",d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(c&&d<Math.min(p,f)?c=!1:!c&&f<Math.min(p,d)&&(c=!0),p<=(c?d:f))s=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,a=Math.min(400,c?d:f);else{h=!0,a=Math.min(400,(l?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${a/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":c?"left":"right")}}function kN(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class SN{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(yN);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=kN(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t,i=n.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]<r.length)return this.applyCompletion(e,r[+t[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(yN).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:gN.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=kN(i.length,o,e.state.facet(yN).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=kN(t.options.length,t.selected,this.view.state.facet(yN).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>Rv(this.view.state,e,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):r--;return t&&function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(yN).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=i&&(o>n.from||0==n.from))if(i=e,"string"!=typeof l&&l.header)r.appendChild(l.header(l));else{r.appendChild(document.createElement("completion-section")).textContent=e}}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function EN(e,t){return n=>new SN(n,e,t)}function CN(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class ON{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ON(this.options,MN(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(yN);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new lN(t,r.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(r.from,r.to),l=s.filterStrict?new bN(a):new vN(a);for(let t of r.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new lN(t,r.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(a,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,c=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):CN(e.completion)>CN(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(yN).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new ON(s,MN(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:FN,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new ON(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ON(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class NN{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new NN(RN,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(yN),r=(n.override||t.languageDataAt("autocomplete",cN(t)).map(pN)).map(t=>(this.active.find(e=>e.source==t)||new PN(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(BN));i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=ON.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new PN(e.source,0):e));for(let t of e.effects)t.is(IN)&&(i=i&&i.setSelected(t.value,this.id));return r==this.active&&i==this.open?this:new NN(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?AN:TN}}const AN={"aria-autocomplete":"list"},TN={};function MN(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const RN=[];function DN(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(uN);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class PN{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=DN(e,t),r=this;(8&n||16&n&&this.touches(e))&&(r=new PN(r.source,0)),4&n&&0==r.state&&(r=new PN(this.source,1)),r=r.updateFor(e,n);for(let t of e.effects)if(t.is(mN))r=new PN(r.source,1,t.value);else if(t.is(gN))r=new PN(r.source,0);else if(t.is(BN))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(cN(e.state))}}class LN extends PN{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=cN(e.state);if(s>o||!r||2&t&&(cN(e.startState)==this.from||s<this.limit))return new PN(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):hN(e,!0).test(i)}(r.validFor,e.state,i,o)?new LN(this.source,this.explicit,a,r,i,o):r.update&&(r=r.update(r,i,o,new oN(e.state,s,!1)))?new LN(this.source,this.explicit,a,r,r.from,null!==(n=r.to)&&void 0!==n?n:cN(e.state)):new PN(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new LN(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new PN(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const BN=hm.define({map:(e,t)=>e.map(e=>e.map(t))}),IN=hm.define(),_N=zp.define({create:()=>NN.start(),update:(e,t)=>e.update(t),provide:e=>[hx.from(e,e=>e.tooltip),aw.contentAttributes.from(e,e=>e.attrs)]});function jN(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(_N).active.find(e=>e.source==t.source);return r instanceof LN&&("string"==typeof n?e.dispatch({...dN(e.state,n,r.from,r.to),annotations:uN.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}const FN=EN(_N,jN);function WN(e,t="option"){return n=>{let r=n.state.field(_N,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(yN).interactionDelay)return!1;let i,o=1;"page"==t&&(i=vx(n,r.open.tooltip))&&(o=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,a=r.open.selected>-1?r.open.selected+o*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:IN.of(a)}),!0}}const zN=e=>!!e.state.field(_N,!1)&&(e.dispatch({effects:mN.of(!0)}),!0);class HN{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const VN=Bv.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(_N).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(_N),n=e.state.facet(yN);if(!e.selectionSet&&!e.docChanged&&e.startState.field(_N)==t)return;let r=e.transactions.some(e=>{let t=DN(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){Rv(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(mN)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(_N);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yN).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=cN(t),r=new oN(t,n,e.explicit,this.view),i=new HN(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:gN.of(null)}),Rv(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yN).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(yN),r=this.view.state.field(_N);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=cN(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+(o.active.explicit?0:1)),s=new LN(o.active.source,o.active.explicit,i,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new PN(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:BN.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(_N,!1);if(t&&t.tooltip&&this.view.state.facet(yN).closeOnBlur){let n=t.open&&vx(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:gN.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:mN.of(!1)}),20),this.composing=0}}}),qN="object"==typeof navigator&&/Win/.test(navigator.platform),UN=Kp.highest(aw.domEventHandlers({keydown(e,t){let n=t.state.field(_N,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!qN||!e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&jN(t,r),!1}})),$N=aw.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),KN={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},YN=hm.define({map(e,t){let n=t.mapPos(e,-1,xp.TrackAfter);return null==n?void 0:n}}),GN=new class extends Em{};GN.startSide=1,GN.endSide=-1;const XN=zp.define({create:()=>Tm.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(YN)&&(e=e.update({add:[GN.range(n.value,n.value+1)]}));return e}});const JN="()[]{}<>«»»«[]{}";function QN(e){for(let t=0;t<16;t+=2)if(JN.charCodeAt(t)==e)return JN.charAt(t+1);return bp(e<128?e:e+1)}function ZN(e,t){return e.languageDataAt("closeBrackets",t)[0]||KN}const eA="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),tA=aw.inputHandler.of((e,t,n,r)=>{if((eA?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==yp(vp(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=ZN(e,e.selection.main.head),r=n.brackets||KN.brackets;for(let i of r){let o=QN(vp(i,0));if(t==i)return o==i?aA(e,i,r.indexOf(i+i+i)>-1,n):oA(e,i,o,n.before||KN.before);if(t==o&&rA(e,e.selection.main.from))return sA(e,i,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),nA=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=ZN(e,e.selection.main.head).brackets||KN.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return yp(vp(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&iA(e.doc,t.head)==QN(vp(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:Rp.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function rA(e,t){let n=!1;return e.field(XN).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function iA(e,t){let n=e.sliceString(t,t+2);return n.slice(0,yp(vp(n,0)))}function oA(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:YN.of(o.to+t.length),range:Rp.range(o.anchor+t.length,o.head+t.length)};let s=iA(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:YN.of(o.head+t.length),range:Rp.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function sA(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&iA(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Rp.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function aA(e,t,n,r){let i=r.stringPrefixes||KN.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:YN.of(r.to+t.length),range:Rp.range(r.anchor+t.length,r.head+t.length)};let s,a=r.head,l=iA(e.doc,a);if(l==t){if(lA(e,a))return{changes:{insert:t+t,from:a},effects:YN.of(a+t.length),range:Rp.cursor(a+t.length)};if(rA(e,a)){let r=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+r.length,insert:r},range:Rp.cursor(a+r.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=cA(e,a-2*t.length,i))>-1&&lA(e,s))return{changes:{insert:t+t+t+t,from:a},effects:YN.of(a+t.length),range:Rp.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=bm.Word&&cA(e,a,i)>-1&&!function(e,t,n,r){let i=lS(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,a,t,i))return{changes:{insert:t+t,from:a},effects:YN.of(a+t.length),range:Rp.cursor(a+t.length)}}return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function lA(e,t){let n=lS(e).resolveInner(t+1);return n.parent&&n.from==t}function cA(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=bm.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=bm.Word)return n}return-1}const hA=[{key:"Ctrl-Space",run:zN},{mac:"Alt-`",run:zN},{mac:"Alt-i",run:zN},{key:"Escape",run:e=>{let t=e.state.field(_N,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:gN.of(null)}),!0)}},{key:"ArrowDown",run:WN(!0)},{key:"ArrowUp",run:WN(!1)},{key:"PageDown",run:WN(!0,"page")},{key:"PageUp",run:WN(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(_N,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(yN).interactionDelay)&&jN(e,t.open.options[t.open.selected])}}],uA=Kp.highest(mw.computeN([yN],e=>e.facet(yN).defaultKeymap?[hA]:[]));class dA{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class fA{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(CA).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Mm,s=[],a=0,l=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>h)break;n=r.to,s.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from!=t||!(r.to>r.from||r.to==t)){n=Math.min(r.from,n);break}s.push(r),e++,n=Math.min(r.to,n)}n=Math.min(n,h);let u=!1;if(s.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=BA(s);if(u)o.add(t,t,kg.widget({widget:new TA(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");o.add(t,n,kg.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if(a=n,a==h)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let u=o.finish();return new fA(u,t,pA(u))}}function pA(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(r){if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new dA(r.from,n,r.diagnostic)}else r=new dA(e,n,t||i.diagnostics[0])}),r}function mA(e,t){return e.field(yA,!1)?t:t.concat(hm.appendConfig.of(IA))}const gA=hm.define(),vA=hm.define(),bA=hm.define(),yA=zp.define({create:()=>new fA(kg.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=pA(n,e.selected.diagnostic,i)||pA(n,null,i)}!n.size&&i&&t.state.facet(CA).autoPanel&&(i=null),e=new fA(n,i,r)}for(let n of t.effects)if(n.is(gA)){let r=t.state.facet(CA).autoPanel?n.value.length?RA.open:null:e.panel;e=fA.init(n.value,r,t.state)}else n.is(vA)?e=new fA(e.diagnostics,n.value?RA.open:null,e.selected):n.is(bA)&&(e=new fA(e.diagnostics,e.panel,n.value));return e},provide:e=>[Ex.from(e,e=>e.panel),aw.decorations.from(e,e=>e.diagnostics)]}),wA=kg.mark({class:"cm-lintRange cm-lintRange-active"});function xA(e,t,n){let r,{diagnostics:i}=e.state.field(yA),o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(e,i,{spec:a})=>{if(t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t<i||n<0)))return r=a.diagnostics,o=e,s=i,!1});let a=e.state.facet(CA).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:kA(e,r)})}:null}function kA(e,t){return tg("ul",{class:"cm-tooltip-lint"},t.map(t=>AA(e,t,!1)))}const SA=e=>{let t=e.state.field(yA,!1);return!(!t||!t.panel)&&(e.dispatch({effects:vA.of(!1)}),!0)},EA=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(yA,!1);t&&t.panel||e.dispatch({effects:mA(e.state,[vA.of(!0)])});let n=wx(e,RA.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(yA,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!(!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],CA=Lp.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...Sm(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:OA,tooltipFilter:OA,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function OA(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function NA(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function AA(e,t,n){var r;let i=n?NA(t.actions):[];return tg("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},tg("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=pA(e.state.field(yA).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,c=l<0?a:[a.slice(0,l),tg("u",a.slice(l,l+1)),a.slice(l+1)];return tg("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&tg("div",{class:"cm-diagnosticSource"},t.source))}class TA extends wg{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return tg("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class MA{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=AA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class RA{constructor(e){this.view=e,this.items=[];this.list=tg("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)SA(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],r=NA(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=pA(this.view.state.field(yA).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=tg("div",{class:"cm-panel-lint"},this.list,tg("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>SA(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(yA).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(yA),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new MA(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),i=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new MA(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=pA(this.view.state.field(yA).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:bA.of(t)})}static open(e){return new RA(e)}}function DA(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const PA=aw.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:DA("#d11")},".cm-lintRange-warning":{backgroundImage:DA("orange")},".cm-lintRange-info":{backgroundImage:DA("#999")},".cm-lintRange-hint":{backgroundImage:DA("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function LA(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function BA(e){let t="hint",n=1;for(let r of e){let e=LA(r.severity);e>n&&(n=e,t=r.severity)}return t}const IA=[yA,aw.decorations.compute([yA],e=>{let{selected:t,panel:n}=e.field(yA);return t&&n&&t.from!=t.to?kg.set([wA.range(t.from,t.to)]):kg.none}),gx(xA,{hideOn:function(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(CA).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(gA))&&!e.changes.touchesRange(o.from,Math.max(o.to,r)))}}),PA];var _A=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(nA)),!1!==e.defaultKeymap&&(n=n.concat(oO)),!1!==e.searchKeymap&&(n=n.concat(JO)),!1!==e.historyKeymap&&(n=n.concat(oC)),!1!==e.foldKeymap&&(n=n.concat($S)),!1!==e.completionKeymap&&(n=n.concat(hA)),!1!==e.lintKeymap&&(n=n.concat(EA));var r=[];return!1!==e.lineNumbers&&r.push(function(e={}){return[Ux.of(e),Ix(),Yx]}()),!1!==e.highlightActiveLineGutter&&r.push(Jx),!1!==e.highlightSpecialChars&&r.push(function(e={}){return[Vw.of(e),qw||(qw=Bv.fromClass(class{constructor(e){this.view=e,this.decorations=kg.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Vw)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new jw({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=vp(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=zm(e.text,t,r-e.from);return kg.replace({widget:new $w((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=kg.replace({widget:new Uw(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Vw);e.startState.facet(Vw)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&r.push(function(e={}){return[HE,zE.of(e),aw.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?qE:"historyRedo"==e.inputType?UE:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push(function(e={}){let t={...ZS,...e},n=new eE(t,!0),r=new eE(t,!1),i=Bv.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(vS)!=e.state.facet(vS)||e.startState.field(WS,!1)!=e.state.field(WS,!1)||lS(e.startState)!=lS(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Mm;for(let i of e.viewportLineBlocks){let o=HS(e.state,i.from,i.to)?r:BS(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,Lx({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||Tm.empty},initialSpacer:()=>new eE(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=HS(e.state,t.from,t.to);if(r)return e.dispatch({effects:jS.of(r)}),!0;let i=BS(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:_S.of(i)}),!0)}}}),GS()]}()),!1!==e.drawSelection&&r.push(function(e={}){return[Aw.of(e),Mw,Dw,Pw,Ov.of(!0)]}()),!1!==e.dropCursor&&r.push([Bw,Iw]),!1!==e.allowMultipleSelections&&r.push(km.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push(km.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=SS(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=kS(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&r.push(sE(cE,{fallback:!0})),!1!==e.bracketMatching&&r.push(function(e={}){return[dE.of(e),vE]}()),!1!==e.closeBrackets&&r.push([tA,XN]),!1!==e.autocompletion&&r.push(function(e={}){return[UN,_N,yN.of(e),VN,uA,$N]}()),!1!==e.rectangularSelection&&r.push(function(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return aw.mouseSelectionStyle.of((e,n)=>t(n)?Qw(e,n):null)}()),!1!==t&&r.push(function(e={}){let[t,n]=Zw[e.key||"Alt"],r=Bv.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,aw.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?ex:null})]}()),!1!==e.highlightActiveLine&&r.push(Yw),!1!==e.highlightSelectionMatches&&r.push(function(e){let t=[kO,xO];return e&&t.push(vO.of(e)),t}()),e.tabSize&&"number"==typeof e.tabSize&&r.push(wS.of(" ".repeat(e.tabSize))),r.concat([mw.of(n.flat())]).filter(Boolean)};const jA="#e06c75",FA="#abb2bf",WA="#7d8799",zA="#d19a66",HA="#2c313a",VA="#282c34",qA="#353a42",UA="#528bff",$A=[aw.theme({"&":{color:FA,backgroundColor:VA},".cm-content":{caretColor:UA},".cm-cursor, .cm-dropCursor":{borderLeftColor:UA},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:FA},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:VA,color:WA,border:"none"},".cm-activeLineGutter":{backgroundColor:HA},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:qA},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:qA,borderBottomColor:qA},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:HA,color:FA}}},{dark:!0}),sE(nE.define([{tag:tS.keyword,color:"#c678dd"},{tag:[tS.name,tS.deleted,tS.character,tS.propertyName,tS.macroName],color:jA},{tag:[tS.function(tS.variableName),tS.labelName],color:"#61afef"},{tag:[tS.color,tS.constant(tS.name),tS.standard(tS.name)],color:zA},{tag:[tS.definition(tS.name),tS.separator],color:FA},{tag:[tS.typeName,tS.className,tS.number,tS.changed,tS.annotation,tS.modifier,tS.self,tS.namespace],color:"#e5c07b"},{tag:[tS.operator,tS.operatorKeyword,tS.url,tS.escape,tS.regexp,tS.link,tS.special(tS.string)],color:"#56b6c2"},{tag:[tS.meta,tS.comment],color:WA},{tag:tS.strong,fontWeight:"bold"},{tag:tS.emphasis,fontStyle:"italic"},{tag:tS.strikethrough,textDecoration:"line-through"},{tag:tS.link,color:WA,textDecoration:"underline"},{tag:tS.heading,fontWeight:"bold",color:jA},{tag:[tS.atom,tS.bool,tS.special(tS.variableName)],color:zA},{tag:[tS.processingInstruction,tS.string,tS.inserted],color:"#98c379"},{tag:tS.invalid,color:"#ffffff"}]))];var KA=aw.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),YA=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,a=[];switch(t&&a.unshift(mw.of([sO])),s&&("boolean"==typeof s?a.unshift(_A()):a.unshift(_A(s))),o&&a.unshift(function(e){let t=Bv.fromClass(class{constructor(t){this.view=t,this.placeholder=e?kg.set([kg.widget({widget:new Gw(e),side:1}).range(0)]):kg.none}get decorations(){return this.view.state.doc.length?kg.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,aw.contentAttributes.of({"aria-placeholder":e})]:t}(o)),i){case"light":a.push(KA);break;case"dark":a.push($A);break;case"none":break;default:a.push(i)}return!1===n&&a.push(aw.editable.of(!1)),r&&a.push(km.readOnly.of(!0)),[...a]};class GA{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class XA{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var JA=null,QA=am.define(),ZA=[];function eT(e){var{value:t,selection:n,onChange:r,onStatistics:s,onCreateEditor:l,onUpdate:c,extensions:h=ZA,autoFocus:u,theme:d="light",height:f=null,minHeight:p=null,maxHeight:m=null,width:g=null,minWidth:v=null,maxWidth:b=null,placeholder:y="",editable:w=!0,readOnly:x=!1,indentWithTab:k=!0,basicSetup:S=!0,root:E,initialState:C}=e,[O,N]=i(),[A,T]=i(),[M,R]=i(),D=i(()=>({current:null}))[0],P=i(()=>({current:null}))[0],L=aw.theme({"&":{height:f,minHeight:p,maxHeight:m,width:g,minWidth:v,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),B=aw.updateListener.of(e=>{if(e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(QA))){D.current?D.current.reset():(D.current=new GA(()=>{if(P.current){var e=P.current;P.current=null,e()}D.current=null},200),("undefined"==typeof window?new XA:(JA||(JA=new XA),JA)).add(D.current));var t=e.state.doc.toString();r(t,e)}s&&s((e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}))(e))}),I=[B,L,...YA({theme:d,editable:w,readOnly:x,placeholder:y,indentWithTab:k,basicSetup:S})];return c&&"function"==typeof c&&I.push(aw.updateListener.of(c)),I=I.concat(h),o(()=>{if(O&&!M){var e={doc:t,selection:n,extensions:I},r=C?km.fromJSON(C.json,e,C.fields):km.create(e);if(R(r),!A){var i=new aw({state:r,parent:O,root:E});T(i),l&&l(i,r)}}return()=>{A&&(R(void 0),T(void 0))}},[O,M]),a(()=>{e.container&&N(e.container)},[e.container]),a(()=>()=>{A&&(A.destroy(),T(void 0)),D.current&&(D.current.cancel(),D.current=null)},[A]),a(()=>{u&&A&&A.focus()},[u,A]),a(()=>{A&&A.dispatch({effects:hm.reconfigure.of(I)})},[d,h,f,p,m,g,v,b,y,w,x,k,S,r,c]),a(()=>{if(void 0!==t){var e=A?A.state.doc.toString():"";if(A&&t!==e){var n=()=>{A&&t!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:t||""},annotations:[QA.of(!0)]})};D.current&&!D.current.isDone?P.current=n:n()}}},[t,A]),{state:M,setState:R,view:A,setView:T,container:O,setContainer:N}}var tT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],nT=n((e,t)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:s,onStatistics:a,onCreateEditor:d,onUpdate:f,autoFocus:p,theme:m="light",height:g,minHeight:v,maxHeight:b,width:y,minWidth:w,maxWidth:x,basicSetup:k,placeholder:S,indentWithTab:E,editable:C,readOnly:O,root:N,initialState:A}=e,T=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,tT),M=l(null),{state:R,view:D,container:P,setContainer:L}=eT({root:N,value:r,autoFocus:p,theme:m,height:g,minHeight:v,maxHeight:b,width:y,minWidth:w,maxWidth:x,basicSetup:k,placeholder:S,indentWithTab:E,editable:C,readOnly:O,selection:i,onChange:s,onStatistics:a,onCreateEditor:d,onUpdate:f,extensions:o,initialState:A});c(t,()=>({editor:M.current,state:R,view:D}),[M,P,R,D]);var B=h(e=>{M.current=e,L(e)},[L]);if("string"!=typeof r)throw new Error("value must be typeof string but got "+typeof r);return u("div",Yf({ref:B,className:("string"==typeof m?"cm-theme-"+m:"cm-theme")+(n?" "+n:"")},T))});nT.displayName="CodeMirror";class rT{constructor(e,t,n,r,i,o,s,a,l,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new rT(e,[],t,n,n,0,[],0,r?new iT(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=i.dynamicPrecedence(r);if(s&&(this.score+=s),0==n)return this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),void this.reduceContext(r,this.reducePos);let a=this.stack.length-3*(n-1)-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let h=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-h;if(r<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,e,u+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=i.getGoto(e,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,t,n,r=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(0==r&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&0==e.buffer[r-4]&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t)return void(e.buffer[r-2]=n)}}if(i&&this.pos!=n){let i=this.buffer.length;if(i>0&&(0!=this.buffer[i-4]||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:o}=this.p;this.pos=r,!o.stateFlag(i,1)&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(i,Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new rT(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new oT(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r,i=0;i<t.length;i+=2)(r=t[i+1])!=this.state&&this.p.parser.hasAction(r,e)&&n.push(t[i],r);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>1&t&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=65535&t,i=this.stack.length-3*n;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-i;if(n>1){let r=65535&t,i=this.stack.length-3*n;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new iT(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class iT{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class oT{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class sT{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new sT(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new sT(this.stack,this.pos,this.index)}}function aT(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,i=0;r<e.length;){let o=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(126==t){o=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),o+=i,n)break;o*=46}n?n[i++]=o:n=new t(o)}return n}class lT{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const cT=new lT;class hT{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=cT,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,r=this.chunkOff+e;if(r>=0&&r<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(r);else{let r=this.resolveOffset(e,1);if(null==r)return-1;if(t=r,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,r=this.range;for(;r.to<=t;)r=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=cT,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class uT{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;0!=(a&e[s]);){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&a)>0){let n=e[r];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||fT(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,c=0,h=e[s+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let i=c+h>>1,o=n+i+(i<<1),a=e[o],l=e[o+1]||65536;if(r<a)h=i;else{if(!(r>=l)){s=e[o+2],t.advance();continue e}c=i+1}}break}s=e[n+3*h-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function dT(e,t,n){for(let r,i=t;65535!=(r=e[i]);i++)if(r==n)return i-t;return-1}function fT(e,t,n,r){let i=dT(n,r,t);return i<0||dT(n,r,e)<i}uT.prototype.contextual=uT.prototype.fallback=uT.prototype.extend=!1,uT.prototype.fallback=uT.prototype.extend=!1;const pT="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let mT=null;function gT(e,t,n){let r=e.cursor(lk.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class vT{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?gT(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?gT(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof ck){if(o==e){if(o<this.safeFrom)return null;let e=o+i.length;if(e<=this.safeTo){let t=i.prop(tk.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class bT{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new lT)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let r=0;r<i.length;r++){if(!(1<<r&o))continue;let l=i[r],c=this.tokens[r];if((!n||l.fallback)&&((l.contextual||c.start!=e.pos||c.mask!=o||c.context!=s)&&(this.updateCachedToken(c,l,e),c.mask=o,c.context=s),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let r=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new lT,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new lT,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){1&i?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let e=0;e<2;e++)for(let a=o.stateSlot(i,e?2:1);;a+=3){if(65535==s[a]){if(1!=s[a+1]){0==r&&2==s[a+1]&&(r=this.putAction(ST(s,a+2),t,n,r));break}a=ST(s,a+2)}s[a]==t&&(r=this.putAction(ST(s,a+1),t,n,r))}return r}}class yT{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new hT(t,r),this.tokens=new bT(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[rT.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>4*e.bufferLength?new vT(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let s=n[o];for(;;){if(this.tokens.mainToken=null,s.pos>r)i.push(s);else{if(this.advanceStack(s,i,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!i.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return this.stackToTree(t);if(this.parser.strict)throw new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(n)return this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort((e,t)=>t.score-e.score);i.length>e;)i.pop();i.some(e=>e.reducePos>r)&&this.recovering--}else if(i.length>1){e:for(let e=0;e<i.length-1;e++){let t=i[e];for(let n=e+1;n<i.length;n++){let r=i[n];if(t.sameState(r)||t.buffer.length>500&&r.buffer.length>500){if(!((t.score-r.score||t.buffer.length-r.buffer.length)>0)){i.splice(e--,1);continue e}i.splice(n--,1)}}}i.length>12&&(i.sort((e,t)=>t.score-e.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this;pT&&this.stackID(e);if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(tk.contextHash)||0)==n))return e.useNode(o,r),!0;if(!(o instanceof ck)||0==o.children.length||o.positions[0]>0)break;let s=o.children[0];if(!(s instanceof ck&&0==o.positions[0]))break;o=s}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let i=0;i<s.length;){let o=s[i++],a=s[i++],l=s[i++],c=i==s.length||!n,h=c?e:e.split(),u=this.tokens.mainToken;if(h.apply(o,a,u?u.start:h.pos,l),c)return!0;h.pos>r?t.push(h):n.push(h)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return wT(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=t[o<<1],l=t[1+(o<<1)],c=pT?this.stackID(s)+" -> ":"";if(s.deadEnd){if(i)continue;if(i=!0,s.restart(),this.advanceFully(s,n))continue}let h=s.split(),u=c;for(let e=0;e<10&&h.forceReduce();e++){if(this.advanceFully(h,n))break;pT&&(u=this.stackID(h)+" -> ")}for(let e of s.recoverByInsert(a))this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),wT(s,n)):(!r||r.score<h.score)&&(r=h)}return r}stackToTree(e){return e.close(),ck.build({buffer:sT.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(mT||(mT=new WeakMap)).get(e);return t||mT.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function wT(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class xT{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class kT extends Ak{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=tk[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let o=t[n+-r];for(let s=-r;s>0;s--)i(t[n++],e,o);n++}}}this.nodeSet=new ok(t.map((t,i)=>ik.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Qx;let o=aT(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(ET),this.states=aT(e.states,Uint32Array),this.data=aT(e.stateData),this.goto=aT(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new uT(o,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new yT(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],o=1&t,s=r[i++];if(o&&n)return s;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return s;if(o)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i,o=this.stateSlot(e,r?2:1);;o+=3){if(65535==(i=n[o])){if(1!=n[o+1]){if(2==n[o+1])return ST(n,o+2);break}i=n[o=ST(n,o+2)]}if(i==t||0==i)return ST(n,o+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ST(this.data,n+2)}r=t(ST(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ST(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(kT.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let i=e.specializers.find(e=>e.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=ET(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,i=this.dialects[t[e]];65535!=(n=this.data[i++]);)(r||(r=new Uint8Array(this.maxTerm+1)))[n]=1;return new xT(e,n,r)}static deserialize(e){return new kT(e)}}function ST(e,t){return e[t]|e[t+1]<<16}function ET(e){if(e.external){let t=e.extend?1:0;return(n,r)=>e.external(n,r)<<1|t}return e.get}const CT=Lk({String:tS.string,Number:tS.number,"True False":tS.bool,PropertyName:tS.propertyName,Null:tS.null,", :":tS.separator,"[ ]":tS.squareBracket,"{ }":tS.brace}),OT=kT.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[CT],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),NT=aS.define({name:"json",parser:OT.configure({props:[CS.add({Object:RS({except:/^\s*\}/}),Array:RS({except:/^\s*\]/})}),PS.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function AT(e){return TT.apply(this,arguments)}function TT(){return TT=w(S().m(function e(t){var n,r;return S().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(!(null===(n=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===n?void 0:n.writeText)){e.n=3;break}return e.n=2,navigator.clipboard.writeText(t);case 2:return e.a(2);case 3:(r=document.createElement("textarea")).value=t,r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r);case 4:return e.a(2)}},e)})),TT.apply(this,arguments)}function MT(t){var n=t.value,r=t.title;if(null==n||""===n)return e.createElement("span",null,"-");var i,o=$f(n),s=o.ok,a=o.pretty,l=o.compact,c=l.length>80?l.slice(0,80)+"…":l;return e.createElement(yf,null,e.createElement(wf,{asChild:!0},e.createElement("button",{type:"button",className:"max-w-xs truncate text-left font-mono text-xs text-muted-foreground hover:underline",title:"点击查看 JSON"},c)),e.createElement(Sf,{className:"max-w-3xl"},e.createElement(Ef,null,e.createElement(Of,null,r||"JSON")),e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(vt,{variant:"outline",size:"sm",onClick:(i=w(S().m(function e(){return S().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,AT(a);case 1:Ga.success("已复制 JSON"),e.n=3;break;case 2:e.p=2,e.v,Ga.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return i.apply(this,arguments)})},"复制")),e.createElement("pre",{className:"max-h-[60vh] overflow-auto rounded-md bg-muted p-3 text-xs font-mono whitespace-pre"},a),!s&&e.createElement("div",{className:"text-xs text-destructive"},o.ok?"":o.message)))}function RT(t){t.id;var n=t.value;t.required;var r,i=t.onChange,o=C(e.useState(null),2),s=o[0],a=o[1];return e.createElement("div",{className:"space-y-2"},e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(vt,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=(n||"").trim();if(e){var t=Kf(e,2);t.ok?(i(t.formatted),a(null)):a(t.message)}}},"格式化"),e.createElement(vt,{type:"button",variant:"outline",size:"sm",onClick:(r=w(S().m(function e(){return S().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,AT(n||"");case 1:Ga.success("已复制"),e.n=3;break;case 2:e.p=2,e.v,Ga.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return r.apply(this,arguments)})},"复制")),e.createElement("div",{className:"rounded-md border bg-background"},e.createElement(nT,{value:n||"",height:"220px",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},extensions:[new bS(NT)],onChange:function(e){i(e),function(e){var t=(e||"").trim();if(!t)return a(null),!0;var n=$f(t);n.ok?a(null):a(n.message)}(e)}})),s&&e.createElement("div",{className:"text-xs text-destructive"},s))}var DT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("div",{className:"relative w-full overflow-auto"},e.createElement("table",Object.assign({ref:n,className:et("w-full caption-bottom text-sm",r)},i)))});DT.displayName="Table";var PT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("thead",Object.assign({ref:n,className:et("[&_tr]:border-b",r)},i))});PT.displayName="TableHeader";var LT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("tbody",Object.assign({ref:n,className:et("[&_tr:last-child]:border-0",r)},i))});LT.displayName="TableBody";var BT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("tfoot",Object.assign({ref:n,className:et("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r)},i))});BT.displayName="TableFooter";var IT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("tr",Object.assign({ref:n,className:et("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r)},i))});IT.displayName="TableRow";var _T=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("th",Object.assign({ref:n,className:et("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r)},i))});_T.displayName="TableHead";var jT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("td",Object.assign({ref:n,className:et("p-4 align-middle [&:has([role=checkbox])]:pr-0",r)},i))});jT.displayName="TableCell";var FT=e.forwardRef(function(t,n){var r=t.className,i=oe(t,["className"]);return e.createElement("caption",Object.assign({ref:n,className:et("mt-4 text-sm text-muted-foreground",r)},i))});FT.displayName="TableCaption";var WT=mt("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function zT(t){var n=t.className,r=t.variant,i=oe(t,["className","variant"]);return e.createElement("div",Object.assign({className:et(WT({variant:r}),n)},i))}function HT(){return"".concat(Date.now(),"_").concat(Math.random().toString(16).slice(2))}function VT(e){return"integer"===e||"float"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"大于"},{value:"gte",label:"大于等于"},{value:"lt",label:"小于"},{value:"lte",label:"小于等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]:"boolean"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"isNull",label:"为空(NULL)"}]:"date"===e||"datetime"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"晚于/大于"},{value:"gte",label:"晚于等于/大于等于"},{value:"lt",label:"早于/小于"},{value:"lte",label:"早于等于/小于等于"},{value:"isNull",label:"为空(NULL)"}]:[{value:"contains",label:"包含"},{value:"startsWith",label:"开头是"},{value:"endsWith",label:"结尾是"},{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]}function qT(e){var n,r,o=s(function(){var t=[];t.push.apply(t,O([{column:"id",label:"ID",type:"id"},{column:"created_at",label:"创建时间",type:"datetime"},{column:"updated_at",label:"更新时间",type:"datetime"}]));var n,r=x(e.fields||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if((null==i?void 0:i.name)&&("json"!==i.type&&"jsonb"!==i.type))if("relation"===i.type&&i.relation){var o=i.relation.foreignKey||"".concat(i.relation.target,"_id");t.push({column:o,label:"".concat(i.comment||i.name,"(关联)"),type:"relation"})}else t.push({column:i.name,label:i.comment||i.name,type:i.type})}}catch(e){r.e(e)}finally{r.f()}var s=new Set;return t.filter(function(e){return!s.has(e.column)&&(s.add(e.column),!0)})},[e.fields]),l=s(function(){return new Map(o.map(function(e){return[e.column,e]}))},[o]),c=s(function(){return new Map(o.map(function(e){return[e.column,e.type]}))},[o]),h=C(i([]),2),u=h[0],d=h[1];a(function(){d(function(e,t){return(e||[]).map(function(e){if(t.get(e.column),"is"===e.operator&&(null===e.value||"null"===e.value))return{id:HT(),column:e.column,operator:"isNull",value:""};if(("ilike"===e.operator||"like"===e.operator)&&"string"==typeof e.value){var n=e.value;if(n.startsWith("%")&&n.endsWith("%")&&n.length>=2)return{id:HT(),column:e.column,operator:"contains",value:n.slice(1,-1)};if(n.endsWith("%"))return{id:HT(),column:e.column,operator:"startsWith",value:n.slice(0,-1)};if(n.startsWith("%"))return{id:HT(),column:e.column,operator:"endsWith",value:n.slice(1)}}if("in"===e.operator){var r=Array.isArray(e.value)?e.value:[];return{id:HT(),column:e.column,operator:"in",value:r.join(",")}}return{id:HT(),column:e.column,operator:["eq","neq","gt","gte","lt","lte"].includes(e.operator)?e.operator:"eq",value:void 0===e.value||null===e.value?"":String(e.value)}})}(e.value||[],c))},[JSON.stringify(e.value),o.length]);var f=function(e,t){d(function(n){return n.map(function(n){var r,i;if(n.id!==e)return n;var o=Object.assign(Object.assign({},n),t);if(t.column&&t.column!==n.column){var s=VT((null===(r=l.get(t.column))||void 0===r?void 0:r.type)||"string");o.operator=(null===(i=s[0])||void 0===i?void 0:i.value)||"eq",o.value=""}return t.operator&&"isNull"===t.operator&&(o.value=""),o})})};return t.createElement("div",{className:"space-y-3"},t.createElement("div",{className:"flex items-center justify-between gap-3"},t.createElement(Ta,{className:"text-base font-medium flex items-center gap-2"},t.createElement(z,{className:"h-4 w-4"}),"动态筛选"),t.createElement("div",{className:"flex items-center gap-2"},(null===(n=e.value)||void 0===n?void 0:n.length)>0&&t.createElement(zT,{variant:"secondary"},"已应用 ",e.value.length," 条"),t.createElement(vt,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=o[0];if(e){var t=VT(e.type);d(function(n){var r;return[].concat(O(n),[{id:HT(),column:e.column,operator:(null===(r=t[0])||void 0===r?void 0:r.value)||"eq",value:""}])})}}},t.createElement(G,{className:"h-4 w-4 mr-1"}),"添加条件"))),0===u.length?t.createElement("div",{className:"text-sm text-muted-foreground border rounded-lg p-3 bg-muted/20"},"暂无筛选条件(可添加条件后点击“应用”)"):t.createElement("div",{className:"space-y-2"},u.map(function(e){var n=l.get(e.column),r=(null==n?void 0:n.type)||"string",i=VT(r),s="isNull"!==e.operator;return t.createElement("div",{key:e.id,className:"grid grid-cols-12 gap-2 items-center"},t.createElement("div",{className:"col-span-5"},t.createElement(Ud,{value:e.column,onValueChange:function(t){return f(e.id,{column:t})}},t.createElement(Kd,{className:"h-10"},t.createElement($d,{placeholder:"字段"})),t.createElement(Xd,null,o.map(function(e){return t.createElement(Qd,{key:e.column,value:e.column},e.label," (",e.column,")")})))),t.createElement("div",{className:"col-span-3"},t.createElement(Ud,{value:e.operator,onValueChange:function(t){return f(e.id,{operator:t})}},t.createElement(Kd,{className:"h-10"},t.createElement($d,{placeholder:"操作符"})),t.createElement(Xd,null,i.map(function(e){return t.createElement(Qd,{key:e.value,value:e.value},e.label)})))),t.createElement("div",{className:"col-span-3"},s?"boolean"===r?t.createElement(Ud,{value:e.value,onValueChange:function(t){return f(e.id,{value:t})}},t.createElement(Kd,{className:"h-10"},t.createElement($d,{placeholder:"值"})),t.createElement(Xd,null,t.createElement(Qd,{value:"true"},"true"),t.createElement(Qd,{value:"false"},"false"))):t.createElement(bt,{className:"h-10",placeholder:"in"===e.operator?"多个值用逗号分隔":"值",type:"integer"===r||"float"===r?"number":"date"===r?"date":"datetime"===r?"datetime-local":"text",value:e.value,onChange:function(t){return f(e.id,{value:t.target.value})}}):t.createElement("div",{className:"h-10 flex items-center text-sm text-muted-foreground"},"无需填写")),t.createElement("div",{className:"col-span-1 flex justify-end"},t.createElement(vt,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 p-0",onClick:function(){return t=e.id,void d(function(e){return e.filter(function(e){return e.id!==t})});var t}},t.createElement(re,{className:"h-4 w-4"}))))})),t.createElement("div",{className:"flex items-center justify-end gap-2"},t.createElement(vt,{type:"button",variant:"outline",onClick:function(){d([]),e.onChange([])},disabled:0===u.length&&0===((null===(r=e.value)||void 0===r?void 0:r.length)||0)},"清空"),t.createElement(vt,{type:"button",onClick:function(){var t=function(e,t){var n,r,i=[],o=x(e);try{for(o.s();!(r=o.n()).done;){var s=r.value,a=t.get(s.column);if(a&&s.operator)if("isNull"!==s.operator){var l=null!==(n=s.value)&&void 0!==n?n:"",c=String(l).trim();if(c)if("contains"!==s.operator)if("startsWith"!==s.operator)if("endsWith"!==s.operator)if("in"!==s.operator)i.push({column:a.column,operator:s.operator,value:c});else{var h=c.split(",").map(function(e){return e.trim()}).filter(Boolean);i.push({column:a.column,operator:"in",value:h})}else i.push({column:a.column,operator:"ilike",value:"%".concat(c)});else i.push({column:a.column,operator:"ilike",value:"".concat(c,"%")});else i.push({column:a.column,operator:"ilike",value:"%".concat(c,"%")})}else i.push({column:a.column,operator:"is",value:null})}}catch(e){o.e(e)}finally{o.f()}return i}(u,l);e.onChange(t)},disabled:0===u.length},"应用")))}function UT(){var e,n=C(i([]),2),r=n[0],o=n[1],s=C(i(null),2),l=s[0],c=s[1],h=C(i([]),2),u=h[0],d=h[1],f=C(i(!1),2),p=f[0],m=f[1],g=C(i(!1),2),b=g[0],y=g[1],x=C(i(null),2),E=x[0],O=x[1],N=C(i({}),2),A=N[0],T=N[1],M=C(i(1),2),R=M[0],D=M[1],P=C(i(10),2),L=P[0];P[1];var _=C(i(0),2),j=_[0],F=_[1],W=C(i(""),2),H=W[0],V=W[1],U=C(i(!1),2),$=U[0],K=U[1],Y=C(i(null),2),J=Y[0],Z=Y[1],te=C(i(!0),2),ne=te[0],re=te[1],ie=C(i([]),2),oe=ie[0],se=ie[1],ae=C(i(!1),2),le=ae[0],ce=ae[1],he=function(e){return Array.isArray(e)?e:Array.isArray(null==e?void 0:e.models)?e.models:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(null==e?void 0:e.items)?e.items:[]},ue=function(e){var t;if(e&&Array.isArray(e.data)){var n="number"==typeof e.total?e.total:"number"==typeof(null===(t=e.pagination)||void 0===t?void 0:t.total)?e.pagination.total:e.data.length;return{rows:e.data,total:n}}if(e&&Array.isArray(e.rows)){var r="number"==typeof e.total?e.total:e.rows.length;return{rows:e.rows,total:r}}return Array.isArray(e)?{rows:e,total:e.length}:{rows:[],total:0}};a(function(){de()},[]),a(function(){l&&fe()},[l,R,L,H,oe]);var de=function(){var e=w(S().m(function e(){var t;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:return re(!0),e.p=1,e.n=2,vh();case 2:t=e.v,o(he(t.data)),e.n=4;break;case 3:e.p=3,e.v,Ga.error("加载模型列表失败");case 4:return e.p=4,re(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),fe=function(){var e=w(S().m(function e(){var t,n,r;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(l){e.n=1;break}return e.a(2);case 1:return m(!0),e.p=2,t={page:R,limit:L},H&&(t.search=H),oe.length>0&&(t.filters=oe),e.n=3,Oh(l.table_name,t);case 3:if((n=e.v).success){e.n=4;break}return Ga.error(n.message||"加载数据失败"),d([]),F(0),e.a(2);case 4:r=ue(n.data),d(r.rows),F(r.total),e.n=6;break;case 5:e.p=5,e.v,Ga.error("加载数据失败"),d([]),F(0);case 6:return e.p=6,m(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),pe=function(){var e=w(S().m(function e(t){var n;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return Z(t.id),e.p=2,e.n=3,Mh(null==l?void 0:l.table_name,t.id);case 3:(n=e.v).success?(Ga.success("删除成功"),fe()):Ga.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Ga.error("删除失败");case 5:return e.p=5,Z(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),me=function(){var e=w(S().m(function e(){var t,n,r,i,o;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(l){e.n=1;break}return e.a(2);case 1:if(K(!0),e.p=2,t={},l.json_schema.fields.forEach(function(e){if("id"!==e.name){var n=A[e.name];if("date"!==e.type&&"datetime"!==e.type||(n=n?new Date(n).toISOString():null),"json"===e.type||"jsonb"===e.type){var r=(n||"").toString().trim();if(r){var i=$f(r);if(!i.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(i.message));n=i.value}else n=null}t[e.name]=n}}),!E){e.n=4;break}return e.n=3,Th(l.table_name,Object.assign(Object.assign({},t),{id:E.id}));case 3:(n=e.v).success?(Ga.success("更新成功"),y(!1),fe()):Ga.error(n.message||"更新失败"),e.n=6;break;case 4:return e.n=5,Ah(l.table_name,t);case 5:(r=e.v).success?(Ga.success("创建成功"),y(!1),fe()):Ga.error(r.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,o=e.v,i=o instanceof Error?o.message:"操作失败",Ga.error(i);case 8:return e.p=8,K(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},t.createElement("div",{className:"space-y-2"},t.createElement("h1",{className:"text-3xl font-bold tracking-tight"},"数据列表"),t.createElement("p",{className:"text-muted-foreground"},"选择模型查看和管理数据")),t.createElement(Ma,{className:"border-2 shadow-lg"},t.createElement(Ra,{className:"bg-muted/30"},t.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},t.createElement("div",null,t.createElement(Da,null,"数据管理"),t.createElement(Pa,null,"选择数据模型进行查看和管理")),l&&t.createElement(vt,{onClick:function(){O(null),T({}),y(!0)},className:"w-full md:w-auto"},t.createElement(G,{className:"h-4 w-4 mr-2"}),"新建数据"))),t.createElement(La,{className:"space-y-6 pt-6"},t.createElement("div",{className:"flex flex-col md:flex-row gap-4"},t.createElement("div",{className:"flex-1 space-y-2"},t.createElement(Ta,{htmlFor:"model",className:"text-base font-medium flex items-center gap-2"},t.createElement(z,{className:"h-4 w-4"}),"选择数据模型"),t.createElement(Ud,{value:(null===(e=null==l?void 0:l.id)||void 0===e?void 0:e.toString())||"",onValueChange:function(e){var t=r.find(function(t){return t.id.toString()===e});c(t||null),D(1),V(""),se([])},disabled:ne},t.createElement(Kd,{className:"h-11"},ne?t.createElement("div",{className:"flex items-center gap-2"},t.createElement(q,{className:"h-4 w-4 animate-spin"}),t.createElement("span",null,"加载中...")):t.createElement($d,{placeholder:"请选择模型"})),t.createElement(Xd,null,r.map(function(e){return t.createElement(Qd,{key:e.id,value:e.id.toString()},e.name," (",e.table_name,")")})))),l&&t.createElement("div",{className:"flex-1 space-y-2"},t.createElement(Ta,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},t.createElement(X,{className:"h-4 w-4"}),"搜索"),t.createElement("div",{className:"relative"},t.createElement(X,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.createElement(bt,{id:"search",placeholder:"搜索数据...",value:H,onChange:function(e){return V(e.target.value)},className:"pl-10 h-11"})))),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"flex items-center justify-end"},t.createElement(vt,{type:"button",variant:"outline",className:"h-10",onClick:function(){return ce(!0)}},t.createElement(z,{className:"h-4 w-4 mr-2"}),"筛选",oe.length>0?"(".concat(oe.length,")"):"")),t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",t.createElement("span",{className:"font-semibold text-foreground"},j)," 条数据"),t.createElement(zT,{variant:"outline"},l.name)),t.createElement("div",{className:"rounded-lg border overflow-hidden"},t.createElement("div",{className:"overflow-x-auto"},t.createElement(DT,null,t.createElement(PT,null,t.createElement(IT,{className:"bg-muted/50"},t.createElement(_T,{className:"font-semibold w-20"},"ID"),l.json_schema.fields.map(function(e){return t.createElement(_T,{key:e.name,className:"font-semibold"},e.comment||e.name)}),t.createElement(_T,{className:"font-semibold"},"创建时间"),t.createElement(_T,{className:"font-semibold"},"更新时间"),t.createElement(_T,{className:"font-semibold w-32 text-center"},"操作"))),t.createElement(LT,null,p?Array.from({length:3}).map(function(e,n){return t.createElement(IT,{key:n},t.createElement(jT,{colSpan:l.json_schema.fields.length+4},t.createElement("div",{className:"flex items-center gap-2 py-4"},t.createElement(q,{className:"h-4 w-4 animate-spin text-muted-foreground"}),t.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===u.length?t.createElement(IT,null,t.createElement(jT,{colSpan:l.json_schema.fields.length+4,className:"text-center py-12"},t.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},t.createElement(X,{className:"h-8 w-8"}),t.createElement("p",null,"暂无数据")))):u.map(function(e,n){return t.createElement(IT,{key:e.id,className:n%2==0?"bg-muted/20":""},t.createElement(jT,{className:"font-mono font-medium"},e.id),l.json_schema.fields.map(function(n){return t.createElement(jT,{key:n.name},function(e,n){return"boolean"===e.type?t.createElement(zT,{variant:n?"default":"secondary"},n?"是":"否"):"date"===e.type||"datetime"===e.type?n?v(n).format("YYYY-MM-DD HH:mm:ss"):"-":"text"===e.type&&n&&n.length>50?t.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"..."):"json"===e.type||"jsonb"===e.type?t.createElement(MT,{value:n,title:e.comment||e.name}):n||"-"}(n,e[n.name]))}),t.createElement(jT,{className:"text-sm text-muted-foreground"},v(e.created_at).format("YYYY-MM-DD HH:mm")),t.createElement(jT,{className:"text-sm text-muted-foreground"},v(e.updated_at).format("YYYY-MM-DD HH:mm")),t.createElement(jT,null,t.createElement("div",{className:"flex items-center justify-center gap-2"},t.createElement(vt,{variant:"ghost",size:"sm",onClick:function(){return function(e){O(e);var t={};null==l||l.json_schema.fields.forEach(function(n){if("id"!==n.name){var r=e[n.name];"date"!==n.type&&"datetime"!==n.type||(r=r?v(r).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(r=null==r||""===r?"":"string"==typeof r?r:JSON.stringify(r,null,2)),t[n.name]=r}}),T(t),y(!0)}(e)},className:"h-8 w-8 p-0"},t.createElement(Q,{className:"h-4 w-4"})),t.createElement(vt,{variant:"ghost",size:"sm",onClick:function(){return pe(e)},disabled:J===e.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},J===e.id?t.createElement(q,{className:"h-4 w-4 animate-spin"}):t.createElement(ee,{className:"h-4 w-4"})))))}))))),j>L&&t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",t.createElement("span",{className:"font-semibold text-foreground"},R)," 页, 共 ",t.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(j/L))," 页"),t.createElement("div",{className:"flex gap-2"},t.createElement(vt,{variant:"outline",size:"sm",onClick:function(){return D(Math.max(1,R-1))},disabled:1===R||p},t.createElement(B,{className:"h-4 w-4 mr-1"}),"上一页"),t.createElement(vt,{variant:"outline",size:"sm",onClick:function(){return D(Math.min(Math.ceil(j/L),R+1))},disabled:R>=Math.ceil(j/L)||p},"下一页",t.createElement(I,{className:"h-4 w-4 ml-1"}))))))),l&&t.createElement(yf,{open:le,onOpenChange:ce},t.createElement(Sf,{className:"max-w-3xl"},t.createElement(Ef,null,t.createElement(Of,{className:"text-xl"},"筛选"),t.createElement(Af,{className:"text-sm"},l.name," - ",l.table_name)),t.createElement("div",{className:"py-2"},t.createElement(qT,{fields:l.json_schema.fields,value:oe,onChange:function(e){se(e),D(1)}})),t.createElement(Cf,{className:"gap-2"},t.createElement(vt,{variant:"outline",onClick:function(){return ce(!1)}},"关闭")))),t.createElement(yf,{open:b,onOpenChange:y},t.createElement(Sf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},t.createElement(Ef,null,t.createElement(Of,{className:"text-2xl"},E?"编辑数据":"新建数据"),t.createElement(Af,{className:"text-base"},null==l?void 0:l.name," - ",null==l?void 0:l.table_name)),t.createElement("div",{className:"space-y-4 py-4"},null==l?void 0:l.json_schema.fields.map(function(e){return function(e){if("id"===e.name)return null;switch(e.type){case"boolean":return t.createElement("div",{key:e.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},t.createElement(vf,{id:e.name,checked:A[e.name]||!1,onCheckedChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t)))}}),t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium cursor-pointer"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"date",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"datetime":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"datetime-local",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"text":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bf,{id:e.name,rows:4,value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"resize-none"}));case"json":case"jsonb":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(RT,{id:e.name,value:A[e.name]||"",required:e.required,onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t)))}}));case"integer":case"float":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"number",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));default:return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"email"===e.type?"email":"text",maxLength:e.maxLength,value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}))}}(e)})),t.createElement(Cf,{className:"gap-2"},t.createElement(vt,{variant:"outline",onClick:function(){return y(!1)},disabled:$},"取消"),t.createElement(vt,{onClick:me,disabled:$},$?t.createElement(t.Fragment,null,t.createElement(q,{className:"h-4 w-4 mr-2 animate-spin"}),E?"更新中...":"创建中..."):E?"更新":"创建"))))))}function $T(e){var n=C(i(e||null),2),r=n[0],o=n[1],s=C(i([]),2),l=s[0],c=s[1],h=C(i(!1),2),u=h[0],d=h[1],f=C(i(!1),2),p=f[0],m=f[1],g=C(i(!1),2),b=g[0],y=g[1],x=C(i(null),2),E=x[0],O=x[1],N=C(i({}),2),A=N[0],T=N[1],M=C(i(1),2),R=M[0],D=M[1],P=C(i(10),2),L=P[0];P[1];var _=C(i(0),2),j=_[0],W=_[1],H=C(i(""),2),V=H[0],U=H[1],$=C(i(!1),2),K=$[0],Y=$[1],J=C(i(null),2),Z=J[0],te=J[1],ne=C(i({}),2),re=ne[0],ie=ne[1],oe=C(i([]),2),se=oe[0],ae=oe[1];a(function(){r&&ce()},[r,R,L,V,se]),a(function(){e&&(o(e),D(1),U(""),ae([]))},[e]);var le=function(){var e=w(S().m(function e(t){var n,r,i,o,s;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if("relation"===t.type&&t.relation){e.n=1;break}return e.a(2);case 1:if(n=t.relation,r=n.target,i=n.displayField,o="".concat(r,"_").concat(i||"name"),!re[o]){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,Nh(r,{displayField:i||"name",limit:200});case 3:(s=e.v).success&&s.data&&ie(function(e){return Object.assign(Object.assign({},e),k({},o,s.data))}),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}();a(function(){p&&r&&r.json_schema.fields.filter(function(e){return"relation"===e.type&&e.relation}).forEach(function(e){return le(e)})},[p,r]);var ce=function(){var e=w(S().m(function e(){var t,n,i,o;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:return d(!0),e.p=2,i={page:R,limit:L},V&&(i.search=V),se.length>0&&(i.filters=se),e.n=3,Oh(r.table_name,i);case 3:if((o=e.v).success){e.n=4;break}return Ga.error(o.message||"加载数据失败"),c([]),W(0),e.a(2);case 4:c((null===(t=o.data)||void 0===t?void 0:t.data)||[]),W((null===(n=o.data)||void 0===n?void 0:n.total)||0),e.n=6;break;case 5:e.p=5,e.v,Ga.error("加载数据失败"),c([]),W(0);case 6:return e.p=6,d(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),he=function(){var e=w(S().m(function e(t){var n;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return te(t.id),e.p=2,e.n=3,Mh(null==r?void 0:r.table_name,t.id);case 3:(n=e.v).success?(Ga.success("删除成功"),ce()):Ga.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Ga.error("删除失败");case 5:return e.p=5,te(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=w(S().m(function e(){var t,n,i,o,s,a;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:if(Y(!0),e.p=2,t={},r.json_schema.fields.forEach(function(e){if("id"!==e.name)if("relation"===e.type&&e.relation){var n=e.relation.foreignKey||"".concat(e.relation.target,"_id");t[n]=A[n]}else{var r=A[e.name];if("date"!==e.type&&"datetime"!==e.type||(r=r?new Date(r).toISOString():null),"json"===e.type||"jsonb"===e.type){var i=(r||"").toString().trim();if(i){var o=$f(i);if(!o.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(o.message));r=o.value}else r=null}t[e.name]=r}}),!E){e.n=4;break}return n=Object.assign(Object.assign({},t),{id:E.id}),e.n=3,Th(r.table_name,n);case 3:(i=e.v).success?(Ga.success("更新成功"),m(!1),ce()):Ga.error(i.message||"更新失败"),e.n=6;break;case 4:return e.n=5,Ah(r.table_name,t);case 5:(o=e.v).success?(Ga.success("创建成功"),m(!1),ce()):Ga.error(o.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,a=e.v,s=a instanceof Error?a.message:"操作失败",Ga.error(s);case 8:return e.p=8,Y(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return r?t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-4 space-y-4"},t.createElement("div",{className:"space-y-1"},t.createElement("div",{className:"flex items-center gap-3"},t.createElement("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-lg bg-primary/10 text-primary"},t.createElement(F,{className:"h-4 w-4"})),t.createElement("div",null,t.createElement("h1",{className:"text-2xl font-bold tracking-tight leading-tight"},r.name),t.createElement("p",{className:"text-sm text-muted-foreground"},"表名: ",r.table_name)))),t.createElement(Ma,{className:"border-2 shadow-lg"},t.createElement(Ra,{className:"bg-muted/30"},t.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},t.createElement("div",null,t.createElement(Da,null,"数据管理"),t.createElement(Pa,null,"查看和管理 ",r.name," 的数据")),t.createElement(vt,{onClick:function(){O(null),T({}),m(!0)},className:"w-full md:w-auto"},t.createElement(G,{className:"h-4 w-4 mr-2"}),"新建数据"))),t.createElement(La,{className:"space-y-4 pt-4"},t.createElement("div",{className:"flex flex-col md:flex-row md:items-center gap-3"},t.createElement("div",{className:"flex-1"},t.createElement(Ta,{htmlFor:"search",className:"sr-only"},"搜索"),t.createElement("div",{className:"relative"},t.createElement(X,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.createElement(bt,{id:"search",placeholder:"搜索数据...",value:V,onChange:function(e){return U(e.target.value)},className:"pl-10 h-10"}))),t.createElement(vt,{type:"button",variant:"outline",className:"h-10",onClick:function(){return y(!0)}},t.createElement(z,{className:"h-4 w-4 mr-2"}),"筛选",se.length>0?"(".concat(se.length,")"):"")),t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",t.createElement("span",{className:"font-semibold text-foreground"},j)," 条数据"),t.createElement(zT,{variant:"outline"},r.name)),t.createElement("div",{className:"rounded-lg border overflow-hidden"},t.createElement("div",{className:"overflow-x-auto"},t.createElement(DT,null,t.createElement(PT,null,t.createElement(IT,{className:"bg-muted/50"},t.createElement(_T,{className:"font-semibold w-20"},"ID"),r.json_schema.fields.map(function(e){return t.createElement(_T,{key:e.name,className:"font-semibold"},e.comment||e.name)}),t.createElement(_T,{className:"font-semibold"},"创建时间"),t.createElement(_T,{className:"font-semibold"},"更新时间"),t.createElement(_T,{className:"font-semibold w-32 text-center"},"操作"))),t.createElement(LT,null,u?Array.from({length:3}).map(function(e,n){return t.createElement(IT,{key:n},t.createElement(jT,{colSpan:r.json_schema.fields.length+4},t.createElement("div",{className:"flex items-center gap-2 py-4"},t.createElement(q,{className:"h-4 w-4 animate-spin text-muted-foreground"}),t.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===l.length?t.createElement(IT,null,t.createElement(jT,{colSpan:r.json_schema.fields.length+4,className:"text-center py-12"},t.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},t.createElement(X,{className:"h-8 w-8"}),t.createElement("p",null,"暂无数据")))):l.map(function(e,n){return t.createElement(IT,{key:e.id,className:n%2==0?"bg-muted/20":""},t.createElement(jT,{className:"font-mono font-medium"},e.id),r.json_schema.fields.map(function(n){return t.createElement(jT,{key:n.name},function(e,n,r){if("boolean"===e.type)return t.createElement(zT,{variant:n?"default":"secondary"},n?"是":"否");if("date"===e.type||"datetime"===e.type)return n?v(n).format("YYYY-MM-DD HH:mm:ss"):"-";if("text"===e.type&&n&&n.length>50)return t.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"...");if("json"===e.type||"jsonb"===e.type)return t.createElement(MT,{value:n,title:e.comment||e.name});if("relation"===e.type&&e.relation&&r){var i=e.relation.displayField,o=void 0===i?"name":i,s=r["".concat(e.name,"_data")];if(s)return t.createElement(zT,{variant:"outline"},s[o]||"ID: ".concat(s.id));var a=r[e.relation.foreignKey||"".concat(e.relation.target,"_id")];return a?"ID: ".concat(a):"-"}return n||"-"}(n,e[n.name],e))}),t.createElement(jT,{className:"text-sm text-muted-foreground"},v(e.created_at).format("YYYY-MM-DD HH:mm")),t.createElement(jT,{className:"text-sm text-muted-foreground"},v(e.updated_at).format("YYYY-MM-DD HH:mm")),t.createElement(jT,null,t.createElement("div",{className:"flex items-center justify-center gap-2"},t.createElement(vt,{variant:"ghost",size:"sm",onClick:function(){return function(e){O(e);var t={};null==r||r.json_schema.fields.forEach(function(n){if("id"!==n.name)if("relation"===n.type&&n.relation){var r=n.relation.foreignKey||"".concat(n.relation.target,"_id");t[r]=e[r]}else{var i=e[n.name];"date"!==n.type&&"datetime"!==n.type||(i=i?v(i).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(i=null==i||""===i?"":"string"==typeof i?i:JSON.stringify(i,null,2)),t[n.name]=i}}),T(t),m(!0)}(e)},className:"h-8 w-8 p-0"},t.createElement(Q,{className:"h-4 w-4"})),t.createElement(vt,{variant:"ghost",size:"sm",onClick:function(){return he(e)},disabled:Z===e.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},Z===e.id?t.createElement(q,{className:"h-4 w-4 animate-spin"}):t.createElement(ee,{className:"h-4 w-4"})))))}))))),j>L&&t.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},t.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",t.createElement("span",{className:"font-semibold text-foreground"},R)," 页, 共 ",t.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(j/L))," 页"),t.createElement("div",{className:"flex gap-2"},t.createElement(vt,{variant:"outline",size:"sm",onClick:function(){return D(Math.max(1,R-1))},disabled:1===R||u},t.createElement(B,{className:"h-4 w-4 mr-1"}),"上一页"),t.createElement(vt,{variant:"outline",size:"sm",onClick:function(){return D(Math.min(Math.ceil(j/L),R+1))},disabled:R>=Math.ceil(j/L)||u},"下一页",t.createElement(I,{className:"h-4 w-4 ml-1"})))))),t.createElement(yf,{open:b,onOpenChange:y},t.createElement(Sf,{className:"max-w-3xl"},t.createElement(Ef,null,t.createElement(Of,{className:"text-xl"},"筛选"),t.createElement(Af,{className:"text-sm"},r.name," - ",r.table_name)),t.createElement("div",{className:"py-2"},t.createElement(qT,{fields:r.json_schema.fields,value:se,onChange:function(e){ae(e),D(1)}})),t.createElement(Cf,{className:"gap-2"},t.createElement(vt,{variant:"outline",onClick:function(){return y(!1)}},"关闭")))),t.createElement(yf,{open:p,onOpenChange:m},t.createElement(Sf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},t.createElement(Ef,null,t.createElement(Of,{className:"text-2xl"},E?"编辑数据":"新建数据"),t.createElement(Af,{className:"text-base"},r.name," - ",r.table_name)),t.createElement("div",{className:"space-y-4 py-4"},r.json_schema.fields.map(function(e){return function(e){if("id"===e.name)return null;switch(e.type){case"boolean":return t.createElement("div",{key:e.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},t.createElement(vf,{id:e.name,checked:A[e.name]||!1,onCheckedChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t)))}}),t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium cursor-pointer"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"date",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"datetime":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"datetime-local",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"text":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bf,{id:e.name,rows:4,value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"resize-none"}));case"json":case"jsonb":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(RT,{id:e.name,value:A[e.name]||"",required:e.required,onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t)))}}));case"integer":case"float":return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"number",value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}));case"relation":if(!e.relation)return null;var n=e.relation,r=n.target,i=n.displayField,o=void 0===i?"name":i,s="".concat(r,"_").concat(o),a=re[s]||[],l=e.relation.foreignKey||"".concat(r,"_id"),c=void 0!==A[l]&&null!==A[l]?String(A[l]):"",h=a.find(function(e){return String(e.id)===c});return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(Ud,{value:c,onValueChange:function(e){var t=parseInt(e,10),n=!isNaN(t)&&String(t)===e;T(Object.assign(Object.assign({},A),k({},l,n?t:e)))}},t.createElement(Kd,{className:"h-11"},t.createElement($d,{placeholder:"请选择".concat(e.comment||e.name)},h?h.label:c?"ID: ".concat(c):"请选择".concat(e.comment||e.name))),t.createElement(Xd,null,0===a.length?t.createElement(Qd,{value:"_loading",disabled:!0},"加载中..."):a.map(function(e){return t.createElement(Qd,{key:e.id,value:String(e.id)},e.label)}))));default:return t.createElement("div",{key:e.name,className:"space-y-2"},t.createElement(Ta,{htmlFor:e.name,className:"text-base font-medium"},e.comment||e.name,e.required&&t.createElement("span",{className:"text-destructive ml-1"},"*")),t.createElement(bt,{id:e.name,type:"email"===e.type?"email":"text",maxLength:e.maxLength,value:A[e.name]||"",onChange:function(t){return T(Object.assign(Object.assign({},A),k({},e.name,t.target.value)))},required:e.required,className:"h-11"}))}}(e)})),t.createElement(Cf,{className:"gap-2"},t.createElement(vt,{variant:"outline",onClick:function(){return m(!1)},disabled:K},"取消"),t.createElement(vt,{onClick:ue,disabled:K},K?t.createElement(t.Fragment,null,t.createElement(q,{className:"h-4 w-4 mr-2 animate-spin"}),E?"更新中...":"创建中..."):E?"更新":"创建")))))):t.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},t.createElement("div",{className:"container mx-auto px-6 py-4"},t.createElement(Ma,{className:"border-2"},t.createElement(La,{className:"py-16 text-center"},t.createElement(F,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),t.createElement("p",{className:"text-lg text-muted-foreground"},"请选择数据模型")))))}function KT(e){return e.models.map(function(e){return{path:"/data/list-".concat(e.id),name:e.name,icon:t.createElement(Z),component:function(){return n=e,t.createElement($T,Object.assign({},n));var n}}})}var YT=function(e){return[{path:"/login",name:"登录",icon:t.createElement($),component:Rh},{name:"数据管理",icon:t.createElement(j),path:"/data",component:UT,routes:O(KT(e))}]},GT=J,XT=te,JT=K;function QT(e){var n=e.inputModels,r=e.skipAuth,o=void 0!==r&&r,s=C(i("/data"),2),l=s[0],c=s[1],h=C(i([]),2);h[0],h[1];var u=C(i(!1),2),d=u[0],f=u[1],p=C(i(null),2),m=p[0],g=p[1],v=C(i(!0),2),b=v[0],y=v[1];a(function(){if(o)return f(!0),g(null),y(!1),void("/login"===l&&c("/data"));var e=function(){var e=w(S().m(function e(){var t,n;return S().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,Eh()){e.n=1;break}return f(!1),c("/login"),y(!1),e.a(2);case 1:return e.p=1,e.n=2,xh();case 2:if(e.v.success){e.n=3;break}throw new Error("token验证失败");case 3:if(!(t=Ch())){e.n=4;break}g(t),e.n=6;break;case 4:return e.n=5,kh();case 5:(n=e.v).success&&n.data&&(g(n.data),localStorage.setItem("cms_user",JSON.stringify(n.data)));case 6:f(!0),"/login"===l&&c("/data"),e.n=8;break;case 7:e.p=7,e.v,Sh(),f(!1),g(null),c("/login");case 8:e.n=10;break;case 9:e.p=9,e.v,f(!1),g(null),c("/login");case 10:return e.p=10,y(!1),e.f(10);case 11:return e.a(2)}},e,null,[[1,7],[0,9,10,11]])}));return function(){return e.apply(this,arguments)}}();e()},[o]);var k=function(e,t){g(t),f(!0),c("/data"),Ga.success("欢迎回来,".concat(t.username,"!"))},E=function(e,t){var n,r=x(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.path===t)return i;if(i.routes){var o=E(i.routes,t);if(o)return o}}}catch(e){r.e(e)}finally{r.f()}return null};if(b)return t.createElement("div",{className:"flex min-h-screen items-center justify-center bg-background"},t.createElement("div",{className:"space-y-4"},t.createElement(tt,{className:"h-12 w-48"}),t.createElement(tt,{className:"h-4 w-64"})));if(!d)return t.createElement(Rh,{onLoginSuccess:k});var O=YT(n).filter(function(e){return"/login"!==e.path}),N=function(e){if(!e)return F;if(t.isValidElement(e)){var n=e.type;if(n&&"function"==typeof n){var r=n.name||"";if(r.includes("Home"))return H;if(r.includes("Table"))return Z;if(r.includes("Database"))return F;if(r.includes("File"))return W}}return F},A=O.flatMap(function(e){return e.routes&&e.routes.length>0?e.routes.map(function(e){return{title:e.name,icon:N(e.icon),path:e.path}}):[{title:e.name,icon:N(e.icon),path:e.path}]});return t.createElement(ua,null,t.createElement(da,{variant:"inset"},t.createElement(ma,{className:"border-b border-sidebar-border"},t.createElement("div",{className:"flex items-center gap-2 px-2 py-1"},t.createElement("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-primary"},t.createElement(GT,{className:"w-4 h-4 text-primary-foreground"})),t.createElement("span",{className:"font-semibold text-lg"},"WE0-CMS"))),t.createElement(va,null,t.createElement(ba,null,t.createElement(ya,null,"Navigation"),t.createElement(wa,null,t.createElement(xa,null,A.map(function(e){return t.createElement(ka,{key:e.path},t.createElement(Ea,{onClick:function(){return c(e.path)},isActive:(n=e.path,l===n||l.startsWith(n+"/")),tooltip:e.title},t.createElement(e.icon,{className:"w-4 h-4"}),t.createElement("span",null,e.title)));var n}))))),t.createElement(ga,{className:"border-t border-sidebar-border"},t.createElement(xa,null,!o&&m&&t.createElement(t.Fragment,null,t.createElement(ka,null,t.createElement(Ea,{tooltip:m.username||"User"},t.createElement(XT,{className:"w-4 h-4"}),t.createElement("span",{className:"truncate"},m.username))),t.createElement(ka,null,t.createElement(Ea,{onClick:function(){window.confirm("确定要登出系统吗?")&&(Sh(),localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),f(!1),g(null),c("/login"),Ga.success("已成功登出"))},tooltip:"Logout"},t.createElement(JT,{className:"w-4 h-4"}),t.createElement("span",null,"Logout"))))))),t.createElement(pa,null,t.createElement("header",{className:"flex h-14 items-center gap-4 border-b bg-background px-6"},t.createElement(fa,null),t.createElement("h1",{className:"text-lg font-semibold"},function(){if("/login"===l)return"Login";var e=E(YT(n),l);return(null==e?void 0:e.name)||"数据管理"}())),t.createElement("main",{className:"flex-1 p-6"},function(){if(!o&&"/login"===l)return t.createElement(Rh,{onLoginSuccess:k});if(o&&"/login"===l)return t.createElement(UT,null);var e=E(YT(n),l);if(e){var r=e.component;return t.createElement(r,null)}return t.createElement(UT,null)}())))}export{QT as CmsLayoutShadcn,YT as cmsRoutes,QT as default,gh as setSessionId};
11
16
  //# sourceMappingURL=index.esm.js.map