vibora 2.12.2 → 2.12.3
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.
|
@@ -42,7 +42,7 @@ ${e.directory}`:e.name,children:[h&&y.jsx("div",{className:Le("absolute top-0 bo
|
|
|
42
42
|
|
|
43
43
|
`)+r.map(Y0e).join(`
|
|
44
44
|
`)}var Z0e=0,J0e=(function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Z0e++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:qr.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:qr.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this.lastCacheModificationPerId.get(t);this.lastCacheModificationPerId.set(t,r===void 0?1:r+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this.lastCacheModificationPerId.get(t)||0;return"".concat(this.cacheId,"-").concat(r)}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(r===void 0&&(r=!0),t.identifierAttribute){var n=t.identifier;this.cache.has(n)||this.cache.set(n,qr.array([],Mx));var i=this.cache.get(n);if(i.indexOf(t)!==-1)throw new ct("Already registered");i.push(t),r&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this;Gq(t.identifierCache.cache).forEach(function(n){return n.forEach(function(i){r.addNodeToCache(i)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.identifierAttribute){var r=t.identifier,n=this.cache.get(r);n&&(n.remove(t),n.length||this.cache.delete(r),this.updateLastCacheModificationPerId(t.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this,n=new e,i=t.path+"/";return lye(this.cache).forEach(function(s){for(var o=Jc(s,2),a=o[0],l=o[1],u=!1,h=l.length-1;h>=0;h--){var d=l[h];(d===t||d.path.indexOf(i)===0)&&(n.addNodeToCache(d,!1),l.splice(h,1),l.length||r.cache.delete(a),u=!0)}u&&r.updateLastCacheModificationPerId(a)}),n}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n=this.cache.get(r);return n?n.some(function(i){return t.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n=this.cache.get(r);if(!n)return null;var i=n.filter(function(s){return t.isAssignableFrom(s.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new ct("Cannot resolve a reference to type '".concat(t.name,"' with id: '").concat(r,"' unambigously, there are multiple candidates: ").concat(i.map(function(s){return s.path}).join(", ")))}}}),e})();function rM(e,t,r,n,i){var s=tK(i);if(s){if(s.parent)throw new ct("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t?t.path:"","/").concat(r,"', but it lives already at '").concat(s.path,"'"));return t&&s.setParent(t,r),s}return new es(e,t,r,n,i)}function du(e,t,r,n,i){return new Mg(e,t,r,n,i)}function e_e(e){return e instanceof Mg||e instanceof es}var Jn;(function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"})(Jn||(Jn={}));function Jr(e){return!!(e&&e.$treenode)}function dr(e){if(!Jr(e))throw new ct("Value ".concat(e," is no MST Node"));return e.$treenode}function tK(e){return e&&e.$treenode||null}function t_e(){return dr(this).snapshot}function r_e(e,t,r){r===void 0&&(r=!0);var n=e;try{for(var i=0;i<t.length;i++){var s=t[i];if(s===".."){if(n=n.parent,n)continue}else{if(s===".")continue;if(n){if(n instanceof Mg){var o=n.value;Jr(o)&&(n=dr(o))}if(n instanceof es){var a=n.getChildType(s);if(a&&(n=n.getChildNode(s),n))continue}}}throw new ct("Could not resolve '".concat(s,"' in path '").concat(v8(t.slice(0,i))||"/","' while resolving '").concat(v8(t),"'"))}}catch(l){if(!r)return;throw l}return n}function rK(e){if(!e)return kh;var t=Object.keys(e);if(!t.length)return kh;var r=new Array(t.length);return t.forEach(function(n,i){r[i]=e[n]}),r}var n_e=Object.toString(),kh=Object.freeze([]),Th=Object.freeze({}),Mx=Mve().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(Mx);var ct=(function(e){Nr(t,e);function t(r){return r===void 0&&(r="Illegal state"),e.call(this,"[mobx-state-tree] ".concat(r))||this}return t})(Error);function i_e(e){return e}var s_e=Number.isInteger;function o_e(e){return Number(e)===e&&e%1!==0}function a_e(e){return Number.isFinite(e)}function nK(e){return Array.isArray(e)||Aa(e)}function iK(e){return e?nK(e)?e:[e]:kh}function l_e(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0;n<t.length;n++){var i=t[n];for(var s in i)e[s]=i[s]}return e}function Wf(e){var t;if(e===null||typeof e!="object")return!1;var r=Object.getPrototypeOf(e);return r==null?!0:((t=r.constructor)===null||t===void 0?void 0:t.toString())===n_e}function sK(e){return e!==null&&typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)}function Dg(e,t){return t===void 0&&(t=!0),e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t&&e instanceof Date}function oK(e){return typeof e!="function"}function c_e(e,t,r){Ho(e)?Yq(e,t,r):Object.defineProperty(e,t,r)}function hd(e,t,r){c_e(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}var u_e=(function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n=this;return r===void 0&&(r=!1),r?this.handlers.unshift(t):this.handlers.push(t),function(){n.unregister(t)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.handlers.indexOf(t)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this.handlers.indexOf(t);r>=0&&this.handlers.splice(r,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.handlers.slice();n.forEach(function(i){return i.apply(void 0,Pd([],Jc(t),!1))})}}),e})(),aK=(function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this.eventHandlers&&this.eventHandlers[t];return!!r&&r.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){n===void 0&&(n=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[t];return i||(i=this.eventHandlers[t]=new u_e),i.register(r,n)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n=this.eventHandlers&&this.eventHandlers[t];return!!n&&n.has(r)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n=this.eventHandlers&&this.eventHandlers[t];n&&n.unregister(r)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.eventHandlers&&delete this.eventHandlers[t]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=this.eventHandlers&&this.eventHandlers[t];s&&(r=s).emit.apply(r,Pd([],Jc(n),!1))}}),e})();function d_e(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=e[r];return t}function SE(e,t){return e.indexOf(t)===0}function f_e(e){console.warn(new Error("[mobx-state-tree] ".concat(e)))}function h_e(){return typeof process<"u"&&m8&&m8.ENABLE_TYPE_CHECK==="true"}function p_e(e){if(!("oldValue"in e))throw new ct("Patches without `oldValue` field cannot be inversed");return[m_e(e),g_e(e)]}function m_e(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function g_e(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function v_e(e){return typeof e=="number"}function pd(e){return v_e(e)===!0?""+e:e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function y_e(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function v8(e){if(e.length===0)return"";var t=function(r){return r.map(pd).join("/")};return e[0]==="."||e[0]===".."?t(e):"/"+t(e)}function b_e(e){var t=e.split("/").map(y_e),r=e===""||e==="."||e===".."||SE(e,"/")||SE(e,"./")||SE(e,"../");if(!r)throw new ct("a json path must be either rooted, empty or relative, but got '".concat(e,"'"));return t[0]===""&&t.shift(),t}var wE=Symbol("$preProcessorFailed"),__e=(function(e){Nr(t,e);function t(r,n,i){var s=e.call(this,i||r.name)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:n}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ir.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._processors.preProcessor?this._processors.preProcessor.call(null,r):r}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(r){try{return this.preProcessSnapshot(r)}catch{return wE}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this._processors.postProcessor?this._processors.postProcessor.call(null,r,n.storedValue):r}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;x_e(r.type,this,"create"),r instanceof es&&(r.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=r.getSnapshot;r.getSnapshot=function(){return n.postProcessSnapshot(i.call(r),r)},H_e(this._subtype)||(r.getReconciliationType=function(){return n})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=Jr(s)?s:this.preProcessSnapshot(s),a=this._subtype.instantiate(r,n,i,o);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=this._subtype.reconcile(r,Jr(n)?n:this.preProcessSnapshot(n),i,s);return o!==r&&this._fixNode(o),o}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n=!0);var i=this._subtype.getSnapshot(r);return n?this.postProcessSnapshot(i,r):i}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this.preProcessSnapshotSafe(r);return i===wE?ns(n,r,"Failed to preprocess value"):this._subtype.validate(i,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=El(r)?this._subtype:Jr(r)?r:this.preProcessSnapshotSafe(r);return n===wE?!1:this._subtype.validate(n,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(!(this._subtype instanceof Oh))return!1;var i=this.preProcessSnapshot(n);return this._subtype.isMatchingSnapshotId(r,i)}}),t})(Cl);function x_e(e,t){for(var r,n,i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];try{for(var o=ag(i),a=o.next();!a.done;a=o.next()){var l=a.value;e[l]=t[l].bind(t)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}function S_e(e,t,r){return new __e(e,t,r)}var y8="Map.put can only be used to store complex values that have an identifier type attribute";function lK(e,t){var r,n,i=e.getSubTypes();if(i===JG)return!1;if(i){var s=iK(i);try{for(var o=ag(s),a=o.next();!a.done;a=o.next()){var l=a.value;if(!lK(l,t))return!1}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ig&&t.push(e),!0}var vc;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"})(vc||(vc={}));var w_e=(function(e){Nr(t,e);function t(r,n){return e.call(this,r,qr.ref.enhancer,n)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return e.prototype.get.call(this,""+r)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return e.prototype.has.call(this,""+r)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return e.prototype.delete.call(this,""+r)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return e.prototype.set.call(this,""+r,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!r)throw new ct("Map.put cannot be used to set empty values");if(Jr(r)){var n=dr(r);if(n.identifier===null)throw new ct(y8);return this.set(n.identifier,r),r}else if(sK(r)){var i=dr(this),s=i.type;if(s.identifierMode!==vc.YES)throw new ct(y8);var o=s.mapIdentifierAttribute,a=r[o];if(!nM(a)){var l=this.put(s.getChildType().create(r,i.environment));return this.put(M0e(l))}var u=Zv(a);return this.set(u,r),this.get(u)}else throw new ct("Map.put can only be used to store complex values")}}),t})(Wj),__=(function(e){Nr(t,e);function t(r,n,i){i===void 0&&(i=[]);var s=e.call(this,r)||this;return Object.defineProperty(s,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:vc.UNKNOWN}),Object.defineProperty(s,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Map}),Object.defineProperty(s,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),s._determineIdentifierMode(),s.hookInitializers=i,s}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.hookInitializers.length>0?this.hookInitializers.concat(r):[r];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this._determineIdentifierMode(),rM(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===vc.UNKNOWN){var r=[];if(lK(this._subType,r)){var n=r.reduce(function(i,s){if(!s.identifierAttribute)return i;if(i&&i!==s.identifierAttribute)throw new ct("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(s.name,"' declared attribute '").concat(s.identifierAttribute,"' as identifier"));return s.identifierAttribute},void 0);n?(this.identifierMode=vc.YES,this.mapIdentifierAttribute=n):this.identifierMode=vc.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n={});var i=r.type._subType,s={};return Object.keys(n).forEach(function(o){s[o]=i.instantiate(r,o,void 0,n[o])}),s}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return new w_e(r,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){Wq(n,r.unbox);var i=r.type;i.hookInitializers.forEach(function(s){var o=s(n);Object.keys(o).forEach(function(a){var l=o[a],u=Lg(n,a,l);hd(n,a,u)})}),Fj(n,this.willChange),Uj(n,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return Gq(r.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=r.storedValue.get(""+n);if(!i)throw new ct("Not a child "+n);return i}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=dr(r.object),i=r.name;n.assertWritable({subpath:i});var s=n.type,o=s._subType;switch(r.type){case"update":{var a=r.newValue,l=r.object.get(i);if(a===l)return null;vl(o,a),r.newValue=o.reconcile(n.getChildNode(i),r.newValue,n,i),s.processIdentifier(i,r.newValue)}break;case"add":vl(o,r.newValue),r.newValue=o.instantiate(n,i,void 0,r.newValue),s.processIdentifier(i,r.newValue);break}return r}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this.identifierMode===vc.YES&&n instanceof es){var i=n.identifier;if(i!==r)throw new ct("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(r,"'"))}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return r.getChildren().forEach(function(i){n[i.subpath]=i.snapshot}),n}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return Object.keys(r).forEach(function(i){n[i]=r[i].getSnapshot()}),n}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=dr(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:pd(r.name),value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"add":return void n.emitPatch({op:"add",path:pd(r.name),value:r.newValue.snapshot,oldValue:void 0},n);case"delete":var i=r.oldValue.snapshot;return r.oldValue.die(),void n.emitPatch({op:"remove",path:pd(r.name),oldValue:i},n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var s=r.storedValue;switch(i.op){case"add":case"replace":s.set(n,i.value);break;case"remove":s.delete(n);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){vl(this,n);var i=r.storedValue,s={};if(Array.from(i.keys()).forEach(function(a){s[a]=!1}),n)for(var o in n)i.set(o,n[o]),s[""+o]=!0;Object.keys(s).forEach(function(a){s[a]===!1&&i.delete(a)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;return Wf(r)?jx(Object.keys(r).map(function(s){return i._subType.validate(r[s],tM(n,s,i._subType))})):ns(n,r,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Th}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.delete(n)}}),t})(Oh);__.prototype.applySnapshot=Ln(__.prototype.applySnapshot);function C_e(e){return new __("Map<string, ".concat(e.name,">"),e)}var x_=(function(e){Nr(t,e);function t(r,n,i){i===void 0&&(i=[]);var s=e.call(this,r)||this;return Object.defineProperty(s,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Array}),Object.defineProperty(s,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),s.hookInitializers=i,s}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.hookInitializers.length>0?this.hookInitializers.concat(r):[r];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return rM(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n=[]);var i=r.type._subType,s={};return n.forEach(function(o,a){var l=""+a;s[l]=i.instantiate(r,l,void 0,o)}),s}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=xa(xa({},Mx),{name:this.name});return qr.array(rK(r),n)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){_a(n).dehancer=r.unbox;var i=r.type;i.hookInitializers.forEach(function(s){var o=s(n);Object.keys(o).forEach(function(a){var l=o[a],u=Lg(n,a,l);hd(n,a,u)})}),Fj(n,this.willChange),Uj(n,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=Number(n);if(i<r.storedValue.length)return r.storedValue[i];throw new ct("Not a child: "+n)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=dr(r.object);n.assertWritable({subpath:""+r.index});var i=n.type._subType,s=n.getChildren();switch(r.type){case"update":{if(r.newValue===r.object[r.index])return null;var o=b8(n,i,[s[r.index]],[r.newValue],[r.index]);if(!o)return null;r.newValue=o[0]}break;case"splice":{var a=r.index,l=r.removedCount,u=r.added,h=b8(n,i,s.slice(a,a+l),u,u.map(function(p,v){return a+v}));if(!h)return null;r.added=h;for(var d=a+l;d<s.length;d++)s[d].setParent(n,""+(d+u.length-l))}break}return r}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.getChildren().map(function(n){return n.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=[];return Object.keys(r).forEach(function(i){n.push(r[i].getSnapshot())}),n}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=dr(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:""+r.index,value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"splice":if(r.removedCount&&r.addedCount===r.object.length)return void n.emitPatch({op:"replace",path:"",value:n.snapshot,oldValue:r.removed.map(function(s){return s.snapshot})},n);for(var i=r.removedCount-1;i>=0;i--)n.emitPatch({op:"remove",path:""+(r.index+i),oldValue:r.removed[i].snapshot},n);for(var i=0;i<r.addedCount;i++)n.emitPatch({op:"add",path:""+(r.index+i),value:r.added[i].snapshot,oldValue:void 0},n);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var s=r.storedValue,o=n==="-"?s.length:Number(n);switch(i.op){case"replace":s[o]=i.value;break;case"add":s.splice(o,0,i.value);break;case"remove":s.splice(o,1);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){vl(this,n);var i=r.storedValue;i.replace(n)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;return nK(r)?jx(r.map(function(s,o){return i._subType.validate(s,tM(n,""+o,i._subType))})):ns(n,r,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return kh}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.splice(Number(n),1)}}),t})(Oh);x_.prototype.applySnapshot=Ln(x_.prototype.applySnapshot);function E_e(e){return new x_("".concat(e.name,"[]"),e)}function b8(e,t,r,n,i){for(var s=!0,o=0;;o++){var a=o<=n.length-1,l=r[o],u=a?n[o]:void 0,h=""+i[o];if(e_e(u)&&(u=u.storedValue),!l&&!a)break;if(!a)s=!1,r.splice(o,1),l instanceof es&&l.createObservableInstanceIfNeeded(),l.die(),o--;else if(l)if(_8(l,u))r[o]=CE(t,e,h,u,l);else{for(var p=void 0,v=o;v<r.length;v++)if(_8(r[v],u)){p=r.splice(v,1)[0];break}s=!1;var d=CE(t,e,h,u,p);r.splice(o,0,d)}else{if(Jr(u)&&dr(u).parent===e)throw new ct("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e.path,"/").concat(h,"', but it lives already at '").concat(dr(u).path,"'"));s=!1;var d=CE(t,e,h,u);r.splice(o,0,d)}}return s?null:r}function CE(e,t,r,n,i){vl(e,n);function s(){if(Jr(n)){var a=dr(n);if(a.assertAlive(Th),a.parent!==null&&a.parent===t)return a.setParent(t,r),a}return i?e.reconcile(i,n,t,r):e.instantiate(t,r,void 0,n)}var o=s();return i&&i!==o&&(i instanceof es&&i.createObservableInstanceIfNeeded(),i.die()),o}function _8(e,t){if(!e.isAlive)return!1;if(Jr(t)){var r=dr(t);return r.isAlive&&r===e}if(e.snapshot===t)return!0;if(!(e instanceof es))return!1;var n=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&Wf(t)&&n.is(t)&&n.isMatchingSnapshotId(e,t)}var x8="preProcessSnapshot",S8="postProcessSnapshot";function O_e(){return dr(this).toString()}var w8={name:"AnonymousModel",properties:{},initializers:kh};function k_e(e){var t=Object.keys(e),r=new Set;return t.forEach(function(n){if(r.has(n))throw new ct("".concat(n," is declared twice in the model. Model should not contain the same keys"));r.add(n)}),t.reduce(function(n,i){if(i in Mn)throw new ct("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var s=Object.getOwnPropertyDescriptor(e,i);if("get"in s)throw new ct("Getters are not supported as properties. Please use views instead");var o=s.value;if(o==null)throw new ct("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(Dg(o))n[i]=md(L_e(o),o);else if(o instanceof __)n[i]=md(o,{});else if(o instanceof x_)n[i]=md(o,[]);else if(!El(o))throw new ct("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(o,"' (").concat(typeof o,")"));return n},xa({},e))}var Ig=(function(e){Nr(t,e);function t(r){var n=e.call(this,r.name||w8.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Object}),Object.defineProperty(n,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return n.cloneAndEnhance({name:i})}}),Object.defineProperty(n,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return n.cloneAndEnhance({properties:i})}}),Object.defineProperty(n,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var s=n.preProcessor;return s?n.cloneAndEnhance({preProcessor:function(o){return s(i(o))}}):n.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(n,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var s=n.postProcessor;return s?n.cloneAndEnhance({postProcessor:function(o){return i(s(o))}}):n.cloneAndEnhance({postProcessor:i})}}),Object.assign(n,w8,r),n.properties=k_e(n.properties),n.properties,n.propertyNames=Object.keys(n.properties),n.identifierAttribute=n._getIdentifierAttribute(),n}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=void 0;return this.forAllProps(function(n,i){if(i.flags&ir.Identifier){if(r)throw new ct("Cannot define property '".concat(n,"' as object identifier, property '").concat(r,"' is already defined as identifier property"));r=n}}),r}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return new t({name:r.name||this.name,properties:Object.assign({},this.properties,r.properties),initializers:this.initializers.concat(r.initializers||[]),preProcessor:r.preProcessor||this.preProcessor,postProcessor:r.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(s){return n.instantiateActions(s,r(s)),s};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!Wf(n))throw new ct("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(n).forEach(function(s){if(s in i.properties)throw new ct("'".concat(s,"' is a property and cannot be declared as an action"));if(s===x8)throw new ct("Cannot define action '".concat(x8,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(s===S8)throw new ct("Cannot define action '".concat(S8,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var o=n[s],a=r[s];if(s in Mn&&a){var l=o;o=function(){a.apply(null,arguments),l.apply(null,arguments)}}var u=o.$mst_middleware,h=o.bind(n);h._isFlowAction=o._isFlowAction||!1,h.$mst_middleware=u;var d=Lg(r,s,h);n[s]=d,hd(r,s,d)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;if(typeof r!="function")throw new ct("You passed an ".concat(typeof r," to volatile state as an argument, when function is expected"));var i=function(s){return n.instantiateVolatileState(s,r(s)),s};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!Wf(n))throw new ct("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(n).forEach(function(s){if(s in i.properties)throw new ct("'".concat(s,"' is a property and cannot be declared as volatile state"));Kq(r,s,n[s])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(s){var o=r(s),a=o.actions,l=o.views,u=o.state,h=P0e(o,["actions","views","state"]);for(var d in h)throw new ct("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(d,"'"));return u&&n.instantiateVolatileState(s,u),l&&n.instantiateViews(s,l),a&&n.instantiateActions(s,a),s};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(s){return n.instantiateViews(s,r(s)),s};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!Wf(n))throw new ct("views initializer should return a plain object containing views");Object.getOwnPropertyNames(n).forEach(function(s){var o;if(s in i.properties)throw new ct("'".concat(s,"' is a property and cannot be declared as a view"));var a=Object.getOwnPropertyDescriptor(n,s);if("get"in a)Yq(r,s,a),Qq(r,(o={},o[s]=yp,o));else if(typeof a.value=="function")hd(r,s,a.value);else throw new ct("A view member should either be a function or getter based property")})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=Jr(s)?s:this.applySnapshotPreProcessor(s);return rM(this,r,n,i,o)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n={});var i=r.type,s={};return i.forAllProps(function(o,a){s[o]=a.instantiate(r,o,void 0,n[o])}),s}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=xa(xa({},Mx),{name:this.name});return qr.object(r,Th,n)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){hd(n,"toString",O_e),this.forAllProps(function(i){Wq(n,i,r.unbox)}),this.initializers.reduce(function(i,s){return s(i)},n),Fj(n,this.willChange),Uj(n,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=dr(n.object),s=n.name;i.assertWritable({subpath:s});var o=i.type.properties[s];return o&&(vl(o,n.newValue),n.newValue=o.reconcile(i.getChildNode(s),n.newValue,i,s)),n}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=dr(n.object),s=i.type.properties[n.name];if(s){var o=n.oldValue?n.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:pd(n.name),value:n.newValue.snapshot,oldValue:o},i)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=[];return this.forAllProps(function(s){i.push(n.getChildNode(r,s))}),i}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i;if(!(n in this.properties))throw new ct("Not a value property: "+n);var s=_a(r.storedValue,n),o=(i=s.raw)===null||i===void 0?void 0:i.call(s);if(!o)throw new ct("Node not available for property "+n);return o}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;n===void 0&&(n=!0);var s={};return this.forAllProps(function(o,a){var l=wh(r.storedValue,o);l.reportObserved(),s[o]=i.getChildNode(r,o).snapshot}),n?this.applySnapshotPostProcessor(s):s}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return Object.keys(r).forEach(function(i){n[i]=r[i].getSnapshot()}),this.applySnapshotPostProcessor(n)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){if(!(i.op==="replace"||i.op==="add"))throw new ct("object does not support operation ".concat(i.op));r.storedValue[n]=i.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){vl(this,n);var i=this.applySnapshotPreProcessor(n);this.forAllProps(function(s){r.storedValue[s]=i[s]})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.preProcessor;return n?n.call(null,r):r}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.postProcessor;return n?n.call(null,r):r}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.properties[r]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this,s=this.applySnapshotPreProcessor(r);return Wf(s)?jx(this.propertyNames.map(function(o){return i.properties[o].validate(s[o],tM(n,o,i.properties[o]))})):ns(n,s,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;this.propertyNames.forEach(function(i){return r(i,n.properties[i])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this;return"{ "+this.propertyNames.map(function(n){return n+": "+r.properties[n].describe()}).join("; ")+" }"}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Th}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue[n]=void 0}}),t})(Oh);Ig.prototype.applySnapshot=Ln(Ig.prototype.applySnapshot);function T_e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=typeof e[0]=="string"?e.shift():"AnonymousModel",n=e.shift()||{};return new Ig({name:r,properties:n})}function A_e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=typeof e[0]=="string",n=r?e[0]:"AnonymousModel";return r&&e.shift(),e.reduce(function(i,s){return i.cloneAndEnhance({name:i.name+"_"+s.name,properties:s.properties,initializers:s.initializers,preProcessor:function(o){return s.applySnapshotPreProcessor(i.applySnapshotPreProcessor(o))},postProcessor:function(o){return s.applySnapshotPostProcessor(i.applySnapshotPostProcessor(o))}})}).named(n)}function R_e(e){return El(e)&&(e.flags&ir.Object)>0}var Ll=(function(e){Nr(t,e);function t(r,n,i,s){s===void 0&&(s=i_e);var o=e.call(this,r)||this;return Object.defineProperty(o,"flags",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:s}),o.flags=n,o}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return du(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.initializer(r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(Dg(r)&&this.checker(r))return ts();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return ns(n,r,"Value is not a ".concat(i))}}),t})(Wd),cK=new Ll("string",ir.String,function(e){return typeof e=="string"}),uK=new Ll("number",ir.Number,function(e){return typeof e=="number"}),P_e=new Ll("integer",ir.Integer,function(e){return s_e(e)}),j_e=new Ll("float",ir.Float,function(e){return o_e(e)}),M_e=new Ll("finite",ir.Finite,function(e){return a_e(e)}),dK=new Ll("boolean",ir.Boolean,function(e){return typeof e=="boolean"}),fK=new Ll("null",ir.Null,function(e){return e===null}),hK=new Ll("undefined",ir.Undefined,function(e){return e===void 0}),pK=new Ll("Date",ir.Date,function(e){return typeof e=="number"||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});pK.getSnapshot=function(e){return e.storedValue.getTime()};var mK=pK;function L_e(e){switch(typeof e){case"string":return cK;case"number":return uK;case"boolean":return dK;case"object":if(e instanceof Date)return mK}throw new ct("Cannot determine primitive type from value "+e)}function D_e(e){return El(e)&&(e.flags&(ir.String|ir.Number|ir.Integer|ir.Boolean|ir.Date))>0}var I_e=(function(e){Nr(t,e);function t(r){var n=e.call(this,JSON.stringify(r))||this;return Object.defineProperty(n,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Literal}),n.value=r,n}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return du(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return Dg(r)&&r===this.value?ts():ns(n,r,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),t})(Wd);function gK(e){return new I_e(e)}var N_e=(function(e){Nr(t,e);function t(r,n,i,s){var o=e.call(this,r)||this;return Object.defineProperty(o,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_message",{enumerable:!0,configurable:!0,writable:!0,value:s}),o}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ir.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this._subtype.instantiate(r,n,i,s)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this._subtype.validate(r,n);if(i.length>0)return i;var s=Jr(r)?dr(r).snapshot:r;return this._predicate(s)?ts():ns(n,r,this._message(r))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this._subtype.reconcile(r,n,i,s)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(Cl);function B_e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=typeof e[0]=="string"?e.shift():El(e[0])?e[0].name:null,n=e[0],i=e[1],s=e[2]?e[2]:function(o){return"Value does not respect the refinement predicate"};return new N_e(r,n,i,s)}function $_e(e,t){var r=typeof e=="string"?t:e,n=Lx.apply(void 0,Pd([],Jc(r.map(function(i){return gK(""+i)})),!1));return typeof e=="string"&&(n.name=e),n}var z_e=(function(e){Nr(t,e);function t(r,n,i){var s=e.call(this,r)||this;return Object.defineProperty(s,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=xa({eager:!0,dispatcher:void 0},i),s._dispatcher=i.dispatcher,i.eager||(s._eager=!1),s}return Object.defineProperty(t.prototype,"flags",{get:function(){var r=ir.Union;return this._types.forEach(function(n){r|=n.flags}),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._types.some(function(n){return n.isAssignableFrom(r)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(r){return r.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=this.determineType(s,void 0);if(!o)throw new ct("No matching type for union "+this.describe());return o.instantiate(r,n,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=this.determineType(n,r.getReconciliationType());if(!o)throw new ct("No matching type for union "+this.describe());return o.reconcile(r,n,i,s)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this._dispatcher?this._dispatcher(r):n?n.is(r)?n:this._types.filter(function(i){return i!==n}).find(function(i){return i.is(r)}):this._types.find(function(i){return i.is(r)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this._dispatcher)return this._dispatcher(r).validate(r,n);for(var i=[],s=0,o=0;o<this._types.length;o++){var a=this._types[o],l=a.validate(r,n);if(l.length===0){if(this._eager)return ts();s++}else i.push(l)}return s===1?ts():ns(n,r,"No type is applicable for the union").concat(jx(i))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t})(Cl);function Lx(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=El(e)?void 0:e,i=El(e)?Pd([e],Jc(t),!1):t,s="("+i.map(function(o){return o.name}).join(" | ")+")";return new z_e(s,i,n)}function H_e(e){return El(e)&&(e.flags&ir.Union)>0}var F_e=(function(e){Nr(t,e);function t(r,n,i){var s=e.call(this,r.name)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ir.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){if(this.optionalValues.indexOf(s)>=0){var o=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(r,n,i,o)}return this._subtype.instantiate(r,n,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this._subtype.reconcile(r,this.optionalValues.indexOf(n)<0&&this._subtype.is(n)?n:this.getDefaultInstanceOrSnapshot(),i,s)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&vl(this,r),r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.optionalValues.indexOf(r)>=0?ts():this._subtype.validate(r,n)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(Cl);function U_e(e,t){if(typeof t!="function"&&Jr(t))throw new ct("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function md(e,t,r){return U_e(e,t),new F_e(e,t,r||V_e)}var V_e=[void 0],W_e=md(hK,void 0),q_e=md(fK,null);function vK(e){return Lx(e,W_e)}function G_e(e){return Lx(e,q_e)}var K_e=(function(e){Nr(t,e);function t(r,n){var i=e.call(this,r)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|ir.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this._subType){var n=void 0;try{n=this._definition()}catch(i){if(i instanceof ReferenceError)n=void 0;else throw i}if(r&&n===void 0)throw new ct("Late type seems to be used too early, the definition (still) returns undefined");n&&(this._subType=n)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this.getSubType(!0).instantiate(r,n,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this.getSubType(!0).reconcile(r,n,i,s)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this.getSubType(!1);return r?r.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this.getSubType(!1);return i?i.validate(r,n):ts()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.getSubType(!1);return n?n.isAssignableFrom(r):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this.getSubType(!1);return r||JG}}),t})(Cl);function Y_e(e,t){var r=typeof e=="string"?e:"late(".concat(e.toString(),")"),n=typeof e=="string"?t:e;return new K_e(r,n)}function X_e(e,t){return new Q_e(e,t)}var Q_e=(function(e){Nr(t,e);function t(r,n){var i=e.call(this,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:qr.array()}),C4(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(s){return s.isAlive&&i.options.shouldLoadPredicate(s.parent?s.parent.value:null)})},function(){i.options.loadType().then(Ln(function(s){i.loadedType=s,i.pendingNodeList.forEach(function(o){o.parent&&i.loadedType&&o.parent.applyPatches([{op:"replace",path:"/".concat(o.subpath),value:o.snapshot}])})}))}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=this;if(this.loadedType)return this.loadedType.instantiate(r,n,i,s);var a=du(this,r,n,i,s);return this.pendingNodeList.push(a),C4(function(){return!a.isAlive},function(){return o.pendingNodeList.splice(o.pendingNodeList.indexOf(a),1)}),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.loadedType?this.loadedType.validate(r,n):oK(r)?ts():ns(n,r,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return this.loadedType?(r.die(),this.loadedType.instantiate(i,s,i.environment,n)):e.prototype.reconcile.call(this,r,n,i,s)}}),t})(Wd),yK=(function(e){Nr(t,e);function t(r){var n=e.call(this,r?"frozen(".concat(r.name,")"):"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Frozen}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){return du(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return oK(r)?this.subType?this.subType.validate(r,n):ts():ns(n,r,"Value is not serializable and cannot be frozen")}}),t})(Wd),C8=new yK;function Z_e(e){return arguments.length===0?C8:El(e)?new yK(e):md(C8,e)}function J_e(e){switch(e){case Mn.beforeDestroy:return"destroy";case Mn.beforeDetach:return"detach";default:return}}var e1e=(function(){function e(t,r){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),nM(t))this.identifier=t;else if(Jr(t)){var n=dr(t);if(!n.identifierAttribute)throw new ct("Can only store references with a defined identifier attribute.");var i=n.unnormalizedIdentifier;if(i==null)throw new ct("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new ct("Can only store references to tree nodes or identifiers, got: '".concat(t,"'"))}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=Zv(this.identifier),n=t.root,i=n.identifierCache.getLastCacheModificationPerId(r);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var s=this.targetType,o=n.identifierCache.resolve(s,r);if(!o)throw new t1e("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(t.path,")"));this.resolvedReference={node:o,lastCacheModification:i}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e})(),t1e=(function(e){Nr(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error),bK=(function(e){Nr(t,e);function t(r,n){var i=e.call(this,"reference(".concat(r.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Reference}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.targetType.isAssignableFrom(r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return nM(r)?ts():ns(n,r,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=n.parent;if(!(!o||!o.isAlive)){var a=o.storedValue;a&&this.onInvalidated({cause:r,parent:a,invalidTarget:s?s.storedValue:void 0,invalidId:i,replaceRef:function(l){jg(n.root.storedValue,{op:"replace",value:l,path:n.path})},removeRef:function(){R_e(o.type)?this.replaceRef(void 0):jg(n.root.storedValue,{op:"remove",path:n.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this,s=this.getValue(r);if(s){var o=dr(s),a=function(h,d){var p=J_e(d);p&&i.fireInvalidated(p,r,n,o)},l=o.registerHook(Mn.beforeDetach,a),u=o.registerHook(Mn.beforeDestroy,a);return function(){l(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var s=this;if(this.onInvalidated){var o;r.registerHook(Mn.beforeDestroy,function(){o&&o()});var a=function(l){o&&o();var u=r.parent,h=u&&u.storedValue;if(u&&u.isAlive&&h){var d=void 0;i?d=!!i.get(n,h):d=r.root.identifierCache.has(s.targetType,Zv(n)),d?o=s.addTargetNodeWatcher(r,n):l||s.fireInvalidated("invalidSnapshotReference",r,n,null)}};r.state===Jn.FINALIZED?a(!0):(r.isRoot||r.root.registerHook(Mn.afterCreationFinalization,function(){r.parent&&r.parent.createObservableInstanceIfNeeded()}),r.registerHook(Mn.afterAttach,function(){a(!1)}))}}}),t})(Wd),r1e=(function(e){Nr(t,e);function t(r,n){return e.call(this,r,n)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(r.isAlive){var n=r.storedValue;return n.resolvedValue}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r.storedValue;return n.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=Jr(s)?D0e(s):s,a=new e1e(s,this.targetType),l=du(this,r,n,i,a);return a.node=l,this.watchTargetNodeForInvalidations(l,o,void 0),l}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){if(!r.isDetaching&&r.type===this){var o=Jr(n),a=r.storedValue;if(!o&&a.identifier===n||o&&a.resolvedValue===n)return r.setParent(i,s),r}var l=this.instantiate(i,s,void 0,n);return r.die(),l}}),t})(bK),n1e=(function(e){Nr(t,e);function t(r,n,i){var s=e.call(this,r,i)||this;return Object.defineProperty(s,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),s}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(r.isAlive){var n=this.options.get(r.storedValue,r.parent?r.parent.storedValue:null);return n}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=Jr(s)?this.options.set(s,r?r.storedValue:null):s,a=du(this,r,n,i,o);return this.watchTargetNodeForInvalidations(a,o,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=Jr(n)?this.options.set(n,r?r.storedValue:null):n;if(!r.isDetaching&&r.type===this&&r.storedValue===o)return r.setParent(i,s),r;var a=this.instantiate(i,s,void 0,o);return r.die(),a}}),t})(bK);function _K(e,t){var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new n1e(e,{get:r.get,set:r.set},n):new r1e(e,n)}function i1e(e,t){var r=_K(e,xa(xa({},t),{onInvalidated:function(n){t&&t.onInvalidated&&t.onInvalidated(n),n.removeRef()}}));return t&&t.acceptsUndefined===!1?r:vK(r)}var xK=(function(e){Nr(t,e);function t(r,n){var i=e.call(this,r)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Identifier}),i}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){if(!r||!(r.type instanceof Ig))throw new ct("Identifier types can only be instantiated as direct child of a model type");return du(this,r,n,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){if(r.storedValue!==n)throw new ct("Tried to change identifier from '".concat(r.storedValue,"' to '").concat(n,"'. Changing identifiers is not allowed."));return r.setParent(i,s),r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return typeof r!==this.validType?ns(n,r,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):ts()}}),t})(Wd),s1e=(function(e){Nr(t,e);function t(){var r=e.call(this,"identifier","string")||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Identifier}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t})(xK),o1e=(function(e){Nr(t,e);function t(){return e.call(this,"identifierNumber","number")||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t})(xK),a1e=new s1e,l1e=new o1e;function Zv(e){return""+e}function nM(e){return typeof e=="string"||typeof e=="number"}function c1e(e){return new u1e(e)}var u1e=(function(e){Nr(t,e);function t(r){var n=e.call(this,r.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ir.Custom}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this.options.isTargetType(r))return ts();var i=this.options.getValidationMessage(r);return i?ns(n,r,"Invalid value for type '".concat(this.name,"': ").concat(i)):ts()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.options.toSnapshot(r.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=this.options.isTargetType(s)?s:this.options.fromSnapshot(s,r&&r.root.environment);return du(this,r,n,i,o)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,s){var o=!this.options.isTargetType(n);if(!r.isDetaching){var a=r.type===this&&(o?n===r.snapshot:n===r.storedValue);if(a)return r.setParent(i,s),r}var l=o?this.options.fromSnapshot(n,i.root.environment):n,u=this.instantiate(i,s,void 0,l);return r.die(),u}}),t})(Wd),$t={enumeration:$_e,model:T_e,compose:A_e,custom:c1e,reference:_K,safeReference:i1e,union:Lx,optional:md,literal:gK,maybe:vK,maybeNull:G_e,refinement:B_e,string:cK,boolean:dK,number:uK,integer:P_e,float:j_e,finite:M_e,Date:mK,map:C_e,array:E_e,frozen:Z_e,identifier:a1e,identifierNumber:l1e,late:Y_e,lazy:X_e,undefined:hK,null:fK,snapshotProcessor:S_e};const d1e=$t.enumeration("TerminalStatus",["running","exited","error"]),f1e=$t.model("Terminal",{id:$t.identifier,name:$t.string,cwd:$t.string,status:d1e,exitCode:$t.maybe($t.number),cols:$t.number,rows:$t.number,createdAt:$t.number,tabId:$t.maybeNull($t.string),positionInTab:$t.optional($t.number,0)}).volatile(()=>({xterm:null,attachCleanup:null,isPending:!1,pendingId:null})).views(e=>({get isAlive(){return e.status==="running"},get isTabTerminal(){return e.tabId!=null}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.cwd!==void 0&&(e.cwd=t.cwd),t.status!==void 0&&(e.status=t.status),t.exitCode!==void 0&&(e.exitCode=t.exitCode),t.cols!==void 0&&(e.cols=t.cols),t.rows!==void 0&&(e.rows=t.rows),t.tabId!==void 0&&(e.tabId=t.tabId),t.positionInTab!==void 0&&(e.positionInTab=t.positionInTab)},setXterm(t){e.xterm=t},setAttachCleanup(t){e.attachCleanup=t},markExited(t){e.status="exited",e.exitCode=t},assignToTab(t,r){e.tabId=t,r!==void 0&&(e.positionInTab=r)},rename(t){e.name=t},resize(t,r){e.cols=t,e.rows=r},setPending(t,r){e.isPending=t,r!==void 0&&(e.pendingId=r)},cleanup(){e.attachCleanup&&(e.attachCleanup(),e.attachCleanup=null),e.xterm=null}})),h1e=$t.model("Tab",{id:$t.identifier,name:$t.string,position:$t.number,directory:$t.maybeNull($t.string),createdAt:$t.number}).volatile(()=>({isPending:!1})).views(e=>({get terminals(){const t=XG(e);return t.terminals?.items?t.terminals.items.filter(r=>r.tabId===e.id).sort((r,n)=>r.positionInTab-n.positionInTab):[]},get terminalCount(){return this.terminals.length}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.directory!==void 0&&(e.directory=t.directory),t.position!==void 0&&(e.position=t.position)},rename(t){e.name=t},setDirectory(t){e.directory=t},setPosition(t){e.position=t},setPending(t){e.isPending=t}})),p1e=$t.map($t.string),m1e=$t.model("ViewState",{focusedTerminals:$t.optional(p1e,{}),currentView:$t.maybeNull($t.string),currentTaskId:$t.maybeNull($t.string),isTabVisible:$t.maybeNull($t.boolean),viewUpdatedAt:$t.maybeNull($t.string)}).volatile(()=>({pendingUpdates:{},debounceTimer:null})).views(e=>({getFocusedTerminal(t){return e.focusedTerminals.get(t)??null}})).actions(e=>({setFocusedTerminal(t,r){r===null?e.focusedTerminals.delete(t):e.focusedTerminals.set(t,r)},clearFocusedTerminalForTab(t){e.focusedTerminals.delete(t)},updateViewTracking(t,r){e.currentView=t,e.currentTaskId=r,e.viewUpdatedAt=new Date().toISOString()},setTabVisible(t){e.isTabVisible=t,e.viewUpdatedAt=new Date().toISOString()},hydrateFromServer(t){if(t.focusedTerminals){e.focusedTerminals.clear();for(const[r,n]of Object.entries(t.focusedTerminals))e.focusedTerminals.set(r,n)}t.currentView!==void 0&&(e.currentView=t.currentView),t.currentTaskId!==void 0&&(e.currentTaskId=t.currentTaskId),t.isTabVisible!==void 0&&(e.isTabVisible=t.isTabVisible),t.viewUpdatedAt!==void 0&&(e.viewUpdatedAt=t.viewUpdatedAt)}}));function qA(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function E8(){return`temp-${qA()}`}const g1e=$t.model("TerminalsStore",{items:$t.array(f1e)}).views(e=>({get(t){return e.items.find(r=>r.id===t)},getByTab(t){return e.items.filter(r=>r.tabId===t).sort((r,n)=>r.positionInTab-n.positionInTab)},get taskTerminals(){return e.items.filter(t=>t.tabId==null)},has(t){return e.items.some(r=>r.id===t)}})).actions(e=>({add(t){if(e.items.some(r=>r.id===t.id)){xt.ws.debug("Terminal already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const r=e.items.find(n=>n.id===t);r&&(r.cleanup(),b_(r))},replaceAll(t){for(const r of e.items)r.cleanup();e.items.clear();for(const r of t)e.items.push(r)},clear(){for(const t of e.items)t.cleanup();e.items.clear()}})),v1e=$t.model("TabsStore",{items:$t.array(h1e)}).views(e=>({get(t){return e.items.find(r=>r.id===t)},get sorted(){return[...e.items].sort((t,r)=>t.position-r.position)},has(t){return e.items.some(r=>r.id===t)},get first(){return this.sorted[0]}})).actions(e=>({add(t){if(e.items.some(r=>r.id===t.id)){xt.ws.debug("Tab already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const r=e.items.find(n=>n.id===t);r&&b_(r)},replaceAll(t){e.items.clear();for(const r of t)e.items.push(r)},clear(){e.items.clear()}})),y1e=$t.model("RootStore",{terminals:$t.optional(g1e,{items:[]}),tabs:$t.optional(v1e,{items:[]}),viewState:$t.optional(m1e,{})}).volatile(()=>({connected:!1,initialized:!1,newTerminalIds:new Set,pendingUpdates:new Map,onAttachedCallbacks:new Map,terminalsReadyForCallback:new Set,lastFocusedTerminalId:null,terminalsPendingStartup:new Map})).views(e=>({get isReady(){return e.connected&&e.initialized}})).actions(e=>{const t=()=>I0e(e);return{setConnected(r){const n=e.connected;if(e.connected=r,!r)e.initialized=!1;else if(!n&&r&&e.pendingUpdates.size>0){t().log.ws.info("Reconnected: clearing stale pending updates",{count:e.pendingUpdates.size});for(const i of e.pendingUpdates.values())if(i.entityType==="terminal"){const s=e.terminals.get(i.tempId);s&&(s.cleanup(),e.terminals.remove(i.tempId)),e.newTerminalIds.delete(i.tempId)}else i.entityType==="tab"&&e.tabs.remove(i.tempId);e.pendingUpdates.clear()}},setInitialized(r){e.initialized=r},markNewTerminal(r){e.newTerminalIds.add(r)},clearNewTerminal(r){e.newTerminalIds.delete(r)},setLastFocusedTerminal(r){e.lastFocusedTerminalId=r},consumePendingStartup(r){const n=e.terminalsPendingStartup.get(r);return n&&(e.terminalsPendingStartup.delete(r),t().log.ws.debug("consumed pending startup",{terminalId:r,taskName:n.taskName})),n},createTerminal(r){const n=qA(),i=E8(),s={id:i,name:r.name,cwd:r.cwd??"~",status:"running",cols:r.cols,rows:r.rows,createdAt:Date.now(),tabId:r.tabId??null,positionInTab:r.positionInTab??0},o=g8(e.terminals);e.terminals.add(s),o.stop(),e.terminals.get(i)?.setPending(!0,i),e.pendingUpdates.set(n,{entityType:"terminal",tempId:i,inversePatches:o.inversePatches,createdAt:Date.now()}),e.newTerminalIds.add(i),r.startup&&(e.terminalsPendingStartup.set(i,r.startup),t().log.ws.debug("createTerminal registered startup",{tempId:i,taskName:r.startup.taskName}));const{startup:l,...u}=r;t().send({type:"terminal:create",payload:{...u,requestId:n,tempId:i}}),t().log.ws.debug("createTerminal optimistic",{requestId:n,tempId:i,name:r.name})},destroyTerminal(r,n){t().send({type:"terminal:destroy",payload:{terminalId:r,force:n?.force,reason:n?.reason}});const i=e.terminals.get(r);i&&i.cleanup(),e.terminals.remove(r)},writeToTerminal(r,n){t().send({type:"terminal:input",payload:{terminalId:r,data:n}})},sendInputToTerminal(r,n){t().send({type:"terminal:input",payload:{terminalId:r,data:n}}),setTimeout(()=>{t().send({type:"terminal:input",payload:{terminalId:r,data:"\r"}})},50)},resizeTerminal(r,n,i){t().send({type:"terminal:resize",payload:{terminalId:r,cols:n,rows:i}}),e.terminals.get(r)?.resize(n,i)},renameTerminal(r,n){t().send({type:"terminal:rename",payload:{terminalId:r,name:n}}),e.terminals.get(r)?.rename(n)},attachXterm(r,n,i){const s=e.terminals.get(r);if(!s)return t().log.ws.warn("attachXterm: terminal not found",{terminalId:r}),()=>{};if(s.xterm===n)return t().log.ws.debug("attachXterm: already attached, skipping",{terminalId:r}),i?.onAttached&&(e.terminalsReadyForCallback.has(r)?(e.terminalsReadyForCallback.delete(r),setTimeout(()=>i.onAttached?.(r),0)):e.onAttachedCallbacks.set(r,i.onAttached)),s.attachCleanup||(()=>{});s.attachCleanup&&s.attachCleanup(),s.setXterm(n),n.attachCustomKeyEventHandler(u=>u.type==="keydown"&&u.shiftKey&&u.key==="Enter"?(u.preventDefault(),u.stopPropagation(),t().send({type:"terminal:input",payload:{terminalId:r,data:`
|
|
45
|
-
`}}),!1):!0);const o=n.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:r,data:u}})}),a=()=>{this.setLastFocusedTerminal(r)};n.textarea?.addEventListener("focus",a),i?.onAttached&&(e.terminalsReadyForCallback.has(r)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:r}),e.terminalsReadyForCallback.delete(r),setTimeout(()=>i.onAttached?.(r),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:r,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(r,i.onAttached)));const l=()=>{o.dispose(),n.textarea?.removeEventListener("focus",a),e.terminals.get(r)?.setXterm(null)};return s.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:r}}),l},requestAttach(r){t().send({type:"terminal:attach",payload:{terminalId:r}})},clearTerminalBuffer(r){t().send({type:"terminal:clearBuffer",payload:{terminalId:r}})},assignTerminalToTab(r,n,i){t().send({type:"terminal:assignTab",payload:{terminalId:r,tabId:n,positionInTab:i}}),e.terminals.get(r)?.assignToTab(n,i)},createTab(r,n,i){const s=qA(),o=E8(),a=n??e.tabs.items.length,l={id:o,name:r,position:a,directory:i??null,createdAt:Date.now()},u=g8(e.tabs);e.tabs.add(l),u.stop(),e.tabs.get(o)?.setPending(!0),e.pendingUpdates.set(s,{entityType:"tab",tempId:o,inversePatches:u.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:r,position:n,directory:i,requestId:s,tempId:o}}),t().log.ws.debug("createTab optimistic",{requestId:s,tempId:o,name:r})},updateTab(r,n){t().send({type:"tab:update",payload:{tabId:r,...n}}),e.tabs.get(r)?.updateFromServer(n)},deleteTab(r){t().send({type:"tab:delete",payload:{tabId:r}}),e.tabs.remove(r),e.viewState.clearFocusedTerminalForTab(r)},reorderTab(r,n){t().send({type:"tab:reorder",payload:{tabId:r,position:n}}),e.tabs.get(r)?.setPosition(n)},handleMessage(r){const{type:n,payload:i}=r;switch(n){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:s,isNew:o,requestId:a,tempId:l}=i;if(a&&l){const u=e.pendingUpdates.get(a);if(u&&u.tempId===l){e.pendingUpdates.delete(a);const h=e.terminals.get(l);if(h){const d=h.xterm,p=e.onAttachedCallbacks.get(l),v=h.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:s.id,hasXterm:!!d,hasCallback:!!p,isNew:o}),v&&v(),h.setXterm(null),h.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),o){const w=e.terminals.items.findIndex(x=>x.id===l);w>=0&&b_(e.terminals.items[w]),e.terminals.add(s);const _=e.terminals.get(s.id);t().log.ws.info("terminal:created re-attaching xterm",{realId:s.id,hasRealTerminal:!!_,hasXterm:!!d,willAttach:!!(_&&d)}),_&&d?this.attachXterm(s.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:s.id}),e.onAttachedCallbacks.set(s.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(s.id);const m=e.terminalsPendingStartup.get(l);m&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(s.id,m),t().log.ws.debug("transferred pending startup",{tempId:l,realId:s.id})),t().log.ws.debug("terminal:created confirmed",{requestId:a,tempId:l,realId:s.id,xtermReattached:!!d,hasPendingStartup:!!m})}else{const w=e.terminals.items.findIndex(m=>m.id===l);w>=0&&b_(e.terminals.items[w]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(s.id)||e.terminals.add(s),e.terminals.get(s.id)&&d&&this.attachXterm(s.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:a,tempId:l,existingId:s.id,xtermReattached:!!d})}}break}}e.terminals.add(s),o&&e.newTerminalIds.add(s.id);break}case"terminal:destroyed":{const{terminalId:s}=i;e.terminals.remove(s),e.newTerminalIds.delete(s),e.terminalsReadyForCallback.delete(s),e.onAttachedCallbacks.delete(s);break}case"terminal:output":{const{terminalId:s,data:o}=i,a=e.terminals.get(s);a?.xterm?a.xterm.write(o):t().log.ws.warn("terminal:output but no xterm",{terminalId:s});break}case"terminal:attached":{const{terminalId:s,buffer:o}=i,a=e.terminals.get(s);t().log.ws.info("terminal:attached received",{terminalId:s,hasTerminal:!!a,hasXterm:!!a?.xterm,bufferLength:o?.length??0,hasCallback:e.onAttachedCallbacks.has(s),isReadyForCallback:e.terminalsReadyForCallback.has(s),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),a?.xterm&&(a.xterm.reset(),o&&a.xterm.write(o));const l=e.onAttachedCallbacks.get(s);l?(e.onAttachedCallbacks.delete(s),t().log.ws.debug("terminal:attached calling callback",{terminalId:s}),l(s)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:s}),e.terminalsReadyForCallback.add(s));break}case"terminal:bufferCleared":{const{terminalId:s}=i,o=e.terminals.get(s);o?.xterm&&o.xterm.reset();break}case"terminal:exit":{const{terminalId:s,exitCode:o}=i;e.terminals.get(s)?.markExited(o);break}case"terminal:renamed":{const{terminalId:s,name:o}=i;e.terminals.get(s)?.rename(o);break}case"terminal:tabAssigned":{const{terminalId:s,tabId:o,positionInTab:a}=i;e.terminals.get(s)?.assignToTab(o,a);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:s,requestId:o,tempId:a}=i;if(o&&a){const l=e.pendingUpdates.get(o);if(l&&l.tempId===a){e.pendingUpdates.delete(o),e.tabs.get(a)&&(e.tabs.remove(a),e.tabs.add(s),t().log.ws.debug("tab:created confirmed",{requestId:o,tempId:a,realId:s.id}));break}}e.tabs.add(s);break}case"tab:updated":{const{tabId:s,name:o,directory:a}=i;e.tabs.get(s)?.updateFromServer({name:o,directory:a});break}case"tab:deleted":{const{tabId:s}=i;e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s);break}case"tab:reordered":{const{tabId:s,position:o}=i;e.tabs.get(s)?.setPosition(o);break}case"terminal:error":{const{error:s,requestId:o,tempId:a}=i;if(o&&a){const l=e.pendingUpdates.get(o);if(l&&l.tempId===a){e.pendingUpdates.delete(o);for(let u=l.inversePatches.length-1;u>=0;u--)jg(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(a),e.terminalsPendingStartup.delete(a),t().log.ws.warn("terminal:error rollback",{requestId:o,tempId:a,error:s});break}}xt.ws.error("Terminal error from server",{error:s});break}case"sync:stale":{const{entityType:s,entityId:o,requestId:a,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:s,entityId:o,error:u}),a&&l){const h=e.pendingUpdates.get(a);if(h&&h.tempId===l)if(e.pendingUpdates.delete(a),h.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else h.entityType==="tab"&&e.tabs.remove(l)}if(s==="terminal"){if(e.terminals.has(o)){const h=e.terminals.get(o);h&&(h.cleanup(),e.terminals.remove(o))}e.terminalsPendingStartup.delete(o)}else s==="tab"&&e.tabs.has(o)&&(e.tabs.remove(o),e.viewState.clearFocusedTerminalForTab(o));break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function SK(){const e=b1e();return T.useMemo(()=>{const t=(r,n)=>{const i=async s=>{const o=s.clipboardData?.items;if(o){for(const a of o)if(a.type.startsWith("image/")){s.preventDefault(),s.stopPropagation();const l=a.getAsFile();if(!l)return;try{const u=await JV(l);e.writeToTerminal(n,u)}catch(u){xt.ws.error("Failed to upload image",{error:String(u)})}return}}};return r.addEventListener("paste",i,!0),()=>{r.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.items]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e)}},[e])}const wK=T.createContext(null);function b1e(){const e=T.useContext(wK);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function _1e(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function x1e({children:e,wsUrl:t=_1e(),reconnectInterval:r=2e3,maxReconnectAttempts:n=10}){const i=T.useRef(null),s=T.useRef(0),o=T.useRef(void 0),a=T.useRef(null),[,l]=T.useState({}),u=T.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(xt.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):xt.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!a.current){const d={send:u,log:xt};a.current=y1e.create({},d)}const h=a.current;return T.useEffect(()=>{let d=!0;const p=()=>{const v=i.current;if(v&&(v.readyState===WebSocket.CONNECTING||v.readyState===WebSocket.OPEN))return;const w=new WebSocket(t);i.current=w,w.onopen=()=>{d&&(xt.ws.info("WebSocket connected"),h.setConnected(!0),s.current=0)},w.onmessage=_=>{if(d)try{const m=JSON.parse(_.data);h.handleMessage(m)}catch(m){xt.ws.error("Failed to parse WebSocket message",{error:String(m)})}},w.onclose=()=>{if(d)if(xt.ws.info("WebSocket disconnected"),h.setConnected(!1),i.current===w&&(i.current=null),s.current<n){s.current++;const _=r*Math.pow(1.5,s.current-1);xt.ws.info("Scheduling reconnect",{attempt:s.current,delay:_}),o.current=setTimeout(p,_)}else xt.ws.warn("Max reconnect attempts reached")},w.onerror=_=>{xt.ws.error("WebSocket error",{event:String(_)})}};return p(),()=>{d=!1,o.current&&clearTimeout(o.current);const v=i.current;v?.readyState===WebSocket.OPEN&&v.close(),i.current=null}},[t,r,n,h]),T.useEffect(()=>{l({})},[]),y.jsx(wK.Provider,{value:h,children:e})}function O8(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function S1e(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Fs="all-tasks",k8=["IN_PROGRESS","IN_REVIEW"],T8="vibora:lastTerminalTab",w1e=Bye(function(){const{t}=Wt("terminals"),r=Ts(),{tab:n}=B1({from:"/terminals/"}),{terminals:i,tabs:s,connected:o,createTerminal:a,destroyTerminal:l,renameTerminal:u,assignTerminalToTab:h,createTab:d,updateTab:p,deleteTab:v,reorderTab:w,attachXterm:_,resizeTerminal:m,setupImagePaste:x,writeToTerminal:b,sendInputToTerminal:S}=SK(),[E,O]=T.useState(null),k=T.useMemo(()=>s.map(ae=>ae.id),[s]),R=n&&(k.includes(n)||n===Fs),A=R?n:s[0]?.id??null,j=T.useCallback(ae=>{r({to:"/terminals",search:{tab:ae},replace:!0})},[r]);T.useEffect(()=>{if(s.length>0&&!R){const ae=localStorage.getItem(T8),ge=ae&&(s.some(pe=>pe.id===ae)||ae===Fs)?ae:s[0].id;r({to:"/terminals",search:{tab:ge},replace:!0})}},[s,R,r]),T.useEffect(()=>{A&&localStorage.setItem(T8,A)},[A]);const{data:B=[],status:L}=Mj(),{data:z=[]}=Fv(),{data:D}=YW(),[V,H]=T.useState(null),$=T.useMemo(()=>{const ae=new Map;for(const ge of z)ae.set(ge.path,ge.id);return ae},[z]),F=T.useMemo(()=>new Set(B.filter(ae=>k8.includes(ae.status)&&ae.worktreePath).map(ae=>ae.worktreePath)),[B]),W=T.useMemo(()=>i.filter(ae=>ae.tabId!=null||ae.cwd&&F.has(ae.cwd)).length,[i,F]),N=T.useMemo(()=>new Set(B.filter(ae=>ae.worktreePath).map(ae=>ae.worktreePath)),[B]),q=T.useMemo(()=>{const ae=new Map;for(const ge of B)ge.worktreePath&&ae.set(ge.worktreePath,{taskId:ge.id,repoId:$.get(ge.repoPath),repoName:ge.repoName,title:ge.title,repoPath:ge.repoPath,worktreePath:ge.worktreePath,baseBranch:ge.baseBranch,branch:ge.branch,prUrl:ge.prUrl});return ae},[B,$]),I=T.useMemo(()=>{const ae=new Set(B.filter(ge=>k8.includes(ge.status)).map(ge=>ge.repoName));return Array.from(ae).sort()},[B]),U=T.useRef(new Map),Y=T.useRef(0),Q=T.useRef(!1),J=T.useRef(!1),re=T.useRef(null),X=3e4;T.useEffect(()=>{if(xt.terminalsView.debug("Orphan cleanup effect running",{worktreeBasePath:D,tasksStatus:L,taskCount:B.length,terminalCount:i.length,allTaskWorktreesSize:N.size}),!D){xt.terminalsView.debug("Orphan cleanup skipped: no worktreeBasePath");return}if(L!=="success"){xt.terminalsView.debug("Orphan cleanup skipped",{reason:`tasksStatus=${L}`});return}if(B.length===0){xt.terminalsView.debug("Orphan cleanup skipped: no tasks loaded (likely error or empty state)");return}for(const ae of i){if(ae.tabId)continue;const ge=Date.now()-ae.createdAt;if(ge<X){xt.terminalsView.debug("Orphan cleanup skipped: terminal too new",{terminalId:ae.id,name:ae.name,ageMs:ge,gracePeriodMs:X});continue}const pe=ae.cwd?.startsWith(D),Se=ae.cwd&&N.has(ae.cwd);pe&&!Se&&(xt.terminalsView.warn("DESTROYING ORPHAN TERMINAL",{terminalId:ae.id,name:ae.name,cwd:ae.cwd}),l(ae.id))}},[i,N,D,l,L,B.length]);const G=T.useMemo(()=>A===Fs?i.filter(ae=>ae.cwd&&F.has(ae.cwd)).filter(ae=>V?B.find(pe=>pe.worktreePath===ae.cwd)?.repoName===V:!0).sort((ae,ge)=>{const pe=B.find(Ce=>Ce.worktreePath===ae.cwd),Se=B.find(Ce=>Ce.worktreePath===ge.cwd);return!pe||!Se?0:new Date(Se.createdAt).getTime()-new Date(pe.createdAt).getTime()}).map(O8):i.filter(ae=>ae.tabId===A).sort((ae,ge)=>ae.positionInTab-ge.positionInTab).map(O8),[A,i,F,V,B]),Z=T.useCallback(()=>{if(xt.terminal.info("handleTerminalAdd called",{activeTabId:A,connected:o,pendingTerminalCreate:Q.current,terminalCount:i.length}),Q.current){xt.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,Y.current++;const ae=`Terminal ${Y.current}`,ge=i.filter(Se=>Se.tabId===A),pe=ge.length;xt.terminal.info("Creating terminal",{name:ae,tabId:A,positionInTab:pe,terminalsInTabCount:ge.length}),a({name:ae,cols:80,rows:24,tabId:A??void 0,positionInTab:pe}),setTimeout(()=>{Q.current=!1},500)},[a,A,i,o]);T.useEffect(()=>{if(L!=="success"){xt.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:L});return}for(const ae of i)ae.cwd&&N.has(ae.cwd)&&ae.tabId&&(xt.terminalsView.debug("Removing task terminal from regular tab",{terminalId:ae.id,name:ae.name,cwd:ae.cwd,tabId:ae.tabId}),h(ae.id,null))},[i,N,h,L]),T.useEffect(()=>{if(re.current!==null&&s.length>re.current){const ae=s.reduce((ge,pe)=>pe.position>ge.position?pe:ge);xt.terminal.debug("New tab detected, auto-opening",{tabId:ae.id,name:ae.name}),re.current=null,j(ae.id),setTimeout(()=>{Y.current++;const ge=`Terminal ${Y.current}`;xt.terminal.debug("Creating terminal in new tab",{tabId:ae.id,name:ge}),a({name:ge,cols:80,rows:24,tabId:ae.id,positionInTab:0})},100)}},[s,j,a]);const te=T.useCallback(ae=>{const ge=U.current.get(ae);ge&&(ge(),U.current.delete(ae)),l(ae,{force:!0,reason:"user_closed"})},[l]),ne=T.useCallback((ae,ge)=>{const pe=_(ae,ge);U.current.set(ae,pe)},[_]),ie=T.useCallback((ae,ge,pe)=>{m(ae,ge,pe)},[m]),me=T.useCallback((ae,ge)=>{u(ae,ge)},[u]),ye=T.useCallback(()=>{if(J.current){xt.terminal.debug("Skipping tab creation, already pending");return}J.current=!0,re.current=s.length;const ae=`Tab ${s.length+1}`;xt.terminal.debug("Quick creating tab",{name:ae}),d(ae,void 0,void 0),setTimeout(()=>{J.current=!1},500)},[d,s.length]),ue=T.useCallback((ae,ge)=>{xt.terminal.debug("Reordering tab",{tabId:ae,newPosition:ge}),w(ae,ge)},[w]),fe=T.useCallback((ae,ge)=>{if(J.current){xt.terminal.debug("Skipping tab creation, already pending");return}J.current=!0,re.current=s.length,xt.terminal.debug("Creating tab",{name:ae,directory:ge}),d(ae,void 0,ge),setTimeout(()=>{J.current=!1},500)},[d,s.length]),le=T.useCallback(ae=>{const ge=i.filter(pe=>pe.tabId===ae);for(const pe of ge){const Se=U.current.get(pe.id);Se&&(Se(),U.current.delete(pe.id))}v(ae)},[i,v]),je=s.map(S1e),Ee=T.useCallback(ae=>{O(ae)},[]),$e=T.useCallback((ae,ge)=>{p(ae,ge)},[p]);return y.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[y.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[y.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto",children:y.jsxs("div",{className:"flex items-center",children:[y.jsxs("button",{onClick:()=>j(Fs),className:Le("relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",A===Fs?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",A===Fs?"after:opacity-100":"after:opacity-0"),children:[y.jsx(he,{icon:vh,size:12,strokeWidth:2}),y.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),y.jsx("div",{className:"mx-2 h-4 w-px bg-border"}),y.jsx(k0e,{tabs:je,activeTabId:A??"",onTabSelect:j,onTabClose:le,onTabCreate:ye,onTabEdit:Ee,onTabReorder:ue})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[A===Fs&&I.length>1&&y.jsxs(Ti,{value:V??"",onValueChange:ae=>H(ae||null),children:[y.jsxs(Ri,{size:"sm",className:"max-sm:w-auto",children:[y.jsx(he,{icon:BV,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(Ai,{children:V||t("allRepos")})]}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"",children:t("allRepos")}),I.map(ae=>y.jsx(pr,{value:ae,children:ae},ae))]})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:Z,disabled:!o||W>=24||A===Fs,className:"max-sm:px-2 border-transparent text-primary",children:[y.jsx(he,{icon:sx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),y.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:y.jsx(Ibe,{terminals:G,onTerminalClose:A===Fs?void 0:te,onTerminalAdd:o&&A!==Fs?Z:void 0,onTerminalReady:ne,onTerminalResize:ie,onTerminalRename:A===Fs?void 0:me,setupImagePaste:x,writeToTerminal:b,sendInputToTerminal:S,taskInfoByCwd:A===Fs?q:void 0})}),y.jsx(T0e,{tab:E,open:E!==null,onOpenChange:ae=>{ae||O(null)},onSave:$e,onCreate:fe,defaultName:`Tab ${s.length+1}`})]})}),C1e=ao("/terminals/")({component:w1e,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0})});function E1e(){return{x:0,y:0}}function O1e(e){var t=e.render,r=e.nativeSetDragImage,n=e.getOffset,i=n===void 0?E1e:n,s=document.createElement("div");Object.assign(s.style,{position:"fixed",top:0,left:0,zIndex:zG,pointerEvents:"none"}),document.body.append(s);var o=t({container:s});queueMicrotask(function(){var u=i({container:s});if(Xv()){var h=s.getBoundingClientRect();if(h.width===0)return;s.style.left="-".concat(h.width-1e-4,"px")}r?.(s,u.x,u.y)});function a(){l(),o?.(),document.body.removeChild(s)}var l=WG({onDragStart:a,onDrop:a})}var k1e=Vd(function(){return Xv()&&"ontouchend"in document}),T1e=function(t){var r=t.container,n=r.getBoundingClientRect();return{x:n.width/2,y:n.height/2}};function A1e(e){return function(r){var n=r.container;if(k1e()||VG())return T1e({container:n});Object.assign(n.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(n);if(i.direction==="rtl"){var s=n.getBoundingClientRect();return{x:s.width,y:0}}return{x:0,y:0}}}const CK=T.createContext(null);function R1e({children:e}){const[t,r]=T.useState(null);return y.jsx(CK.Provider,{value:{activeTask:t,setActiveTask:r},children:e})}function EK(){const e=T.useContext(CK);if(!e)throw new Error("useDrag must be used within DragProvider");return e}function P1e(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function OK({task:e,open:t,onOpenChange:r}){const n=Lj(),i=GW(),[s,o]=T.useState(e.title),[a,l]=T.useState(!0),[u,h]=T.useState(e.description||""),[d,p]=T.useState(e.prUrl||""),[v,w]=T.useState(e.linearTicketUrl||"");T.useEffect(()=>{t&&(o(e.title),h(e.description||""),p(e.prUrl||""),w(e.linearTicketUrl||""),l(!0))},[t,e]);const _=()=>{const b={},S=s.trim();if(!S)return;S!==e.title&&(b.title=S);const E=u.trim();E!==(e.description||"")&&(b.description=E);const O=d.trim();O!==(e.prUrl||"")&&(b.prUrl=O||null);const k=v.trim();k!==(e.linearTicketUrl||"")&&(b.linearTicketUrl=k||null,b.linearTicketId=k?P1e(k):null),Object.keys(b).length>0&&n.mutate({taskId:e.id,updates:b}),r(!1)},m=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),_())},x=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:a},{onSuccess:()=>{r(!1)}})};return y.jsx(Ea,{open:t,onOpenChange:r,children:y.jsxs(Oa,{className:"sm:max-w-md",onKeyDown:m,children:[y.jsx(Pl,{children:y.jsx(jl,{children:"Task Settings"})}),y.jsxs(hl,{className:"mt-4",children:[y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-title",children:"Title"}),y.jsx(qt,{id:"config-title",value:s,onChange:b=>o(b.target.value),autoFocus:!0})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-description",children:"Description"}),y.jsx(tW,{id:"config-description",value:u,onValueChange:h,rows:3})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),y.jsx(qt,{id:"config-pr-url",value:d,onChange:b=>p(b.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),y.jsx(qt,{id:"config-linear-url",value:v,onChange:b=>w(b.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),y.jsxs(Bd,{className:"mt-4 flex-row justify-between sm:justify-between",children:[y.jsxs(Fc,{children:[y.jsx(Uc,{render:y.jsx(Ne,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),y.jsxs(Vc,{children:[y.jsxs(Wc,{children:[y.jsx(Gc,{children:"Delete Task"}),y.jsx(Kc,{children:"This will permanently delete this task. This action cannot be undone."})]}),y.jsxs("div",{className:"flex items-center gap-2 py-2",children:[y.jsx(ya,{id:"delete-worktree",checked:a,onCheckedChange:b=>l(b===!0)}),y.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),y.jsxs(qc,{children:[y.jsx(Yc,{children:"Cancel"}),y.jsx(aq,{onClick:x,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Ne,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),y.jsx(Ne,{onClick:_,disabled:!s.trim(),children:"Save"})]})]})]})})}function kK({task:e,isDragPreview:t}){const{setActiveTask:r}=EK(),n=Ts(),i=T.useRef(null),[s,o]=T.useState(!1),[a,l]=T.useState(null),[u,h]=T.useState(null),[d,p]=T.useState(!1),v=T.useRef(!1);T.useEffect(()=>{const x=i.current;if(!(!x||t))return Qv(qG({element:x,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:b})=>{O1e({nativeSetDragImage:b,getOffset:A1e({x:"16px",y:"8px"}),render:({container:S})=>{h(S)}})},onDragStart:()=>{o(!0),r(e),v.current=!0},onDrop:()=>{o(!1),r(null),h(null)}}),Px({element:x,getData:({input:b,element:S})=>{const E={type:"task",taskId:e.id,status:e.status};return KG(E,{input:b,element:S,allowedEdges:["top","bottom"]})},canDrop:({source:b})=>b.data.taskId!==e.id,onDragEnter:({self:b})=>{l(ih(b.data))},onDrag:({self:b})=>{l(ih(b.data))},onDragLeave:()=>{l(null)},onDrop:()=>{l(null)}}))},[e,t,r]);const w=()=>{v.current=!1},_=()=>{v.current||n({to:"/tasks/$taskId",params:{taskId:e.id}}),v.current=!1},m=y.jsxs(Qi,{ref:t?void 0:i,onPointerDown:w,onClick:_,className:Le("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",s&&"opacity-50"),children:[a&&y.jsx("div",{className:Le("absolute left-0 right-0 h-0.5 bg-primary z-10",a==="top"&&"-top-1",a==="bottom"&&"-bottom-1")}),y.jsxs(xge,{className:"p-3 pb-1 flex flex-row items-start justify-between gap-2",children:[y.jsx(Sge,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&y.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:x=>{x.stopPropagation(),p(!0)},onPointerDown:x=>x.stopPropagation(),children:y.jsx(he,{icon:gj,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),y.jsxs(mp,{className:"p-3 pt-1",children:[e.description&&y.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),y.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[y.jsx(he,{icon:pi,size:12,strokeWidth:2}),y.jsx("span",{children:e.repoName}),e.prUrl&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(he,{icon:s_,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(he,{icon:vj,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]});return y.jsxs(y.Fragment,{children:[m,u&&hn.createPortal(y.jsx("div",{className:"w-72 max-w-[90vw]",children:y.jsx(kK,{task:e,isDragPreview:!0})}),u),y.jsx(OK,{task:e,open:d,onOpenChange:p})]})}const j1e={IN_PROGRESS:"border-t-[#8d909b]",IN_REVIEW:"border-t-[#2a2a27] dark:border-t-[#faf9f5]",DONE:"border-t-[#0d5c63]",CANCELED:"border-t-[#dd403a]"};function A8({status:e,tasks:t,isMobile:r}){const{t:n}=Wt("common"),i=T.useRef(null),[s,o]=T.useState(!1),a=[...t].sort((l,u)=>u.position-l.position);return T.useEffect(()=>{const l=i.current;if(l)return Px({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>o(!0),onDragLeave:()=>o(!1),onDrop:()=>o(!1)})},[e]),y.jsxs("div",{ref:i,className:Le("flex flex-col rounded-lg border border-t-4 bg-card",r?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",j1e[e],s&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!r&&y.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[y.jsx("h3",{className:"text-sm font-medium",children:n(`statuses.${e}`)}),y.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),y.jsx(bh,{className:"min-h-0 flex-1",children:y.jsx("div",{className:"flex flex-col gap-2 p-2",children:a.map(l=>y.jsx(kK,{task:l},l.id))})})]})}const EE=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function M1e({status:e}){const{t}=Wt("common"),r=T.useRef(null),[n,i]=T.useState(!1);return T.useEffect(()=>{const s=r.current;if(s)return Px({element:s,getData:()=>({type:"column",status:e}),canDrop:({source:o})=>o.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),y.jsx("div",{ref:r,className:Le("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",n?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function L1e({repoFilter:e,searchQuery:t}){const{t:r}=Wt("common"),{data:n=[],isLoading:i}=Mj(),s=Jfe(),{activeTask:o}=EK(),[a,l]=T.useState("IN_PROGRESS"),u=T.useMemo(()=>{let d=n;return e&&(d=d.filter(p=>p.repoName===e)),t?.trim()?d=d.map(p=>({task:p,score:Math.max(Vu(p.title,t),Vu(p.description||"",t),Vu(p.branch||"",t),Vu(p.linearTicketId||"",t),Vu(p.prUrl||"",t))})).filter(({score:p})=>p>0).sort((p,v)=>v.score-p.score).map(({task:p})=>p):d=[...d].sort((p,v)=>new Date(v.createdAt).getTime()-new Date(p.createdAt).getTime()),d},[n,e,t]),h=T.useMemo(()=>{const d={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const p of u)d[p.status]++;return d},[u]);return T.useEffect(()=>WG({canMonitor:({source:d})=>d.data.type==="task",onDrop:({source:d,location:p})=>{const v=p.current.dropTargets;if(v.length===0)return;const w=d.data.taskId,_=u.find(b=>b.id===w);if(!_)return;const m=v[0],x=m.data;if(x.type==="column"){const b=x.status;if(b!==_.status){const S=u.filter(E=>E.status===b);s.mutate({taskId:w,status:b,position:S.length})}}else if(x.type==="task"){const b=ih(m.data),S=x.status,E=u.filter(R=>R.status===S).sort((R,A)=>R.position-A.position),O=E.findIndex(R=>R.id===x.taskId);let k=O;b==="bottom"&&(k=O+1),_.status===S&&E.findIndex(A=>A.id===w)<O&&(k=Math.max(0,k-1)),(_.status!==S||k!==_.position)&&s.mutate({taskId:w,status:S,position:k})}}}),[u,s]),i?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"border-b bg-background lg:hidden",children:y.jsx(Ic,{value:a,onValueChange:d=>l(d),children:y.jsx(Nc,{variant:"line",className:"w-full justify-start px-4",children:EE.map(d=>y.jsxs(ui,{value:d,className:"gap-1.5",children:[y.jsx("span",{className:"truncate",children:r(`statuses.${d}`)}),y.jsx("span",{className:"text-muted-foreground",children:h[d]})]},d))})})}),y.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:EE.map(d=>y.jsx(A8,{status:d,tasks:u.filter(p=>p.status===d)},d))}),y.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:y.jsx(A8,{status:a,tasks:u.filter(d=>d.status===a),isMobile:!0})}),o&&y.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:EE.filter(d=>d!==a).map(d=>y.jsx(M1e,{status:d},d))})]})}function D1e(e){return y.jsx(R1e,{children:y.jsx(L1e,{...e})})}const TK=ao("/tasks/")({component:I1e,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function I1e(){const{t:e}=Wt("tasks"),{data:t=[]}=Mj(),{repo:r}=TK.useSearch(),n=Ts(),[i,s]=T.useState(""),o=T.useCallback(l=>{n({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[n]),a=T.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"relative flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2",children:[y.jsx(he,{icon:HV,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(qt,{value:i,onChange:l=>s(l.target.value),placeholder:e("searchPlaceholder"),className:"w-64 pl-6"})]}),y.jsx("div",{className:"ml-auto",children:y.jsxs(Ti,{value:r??"",onValueChange:l=>o(l||null),children:[y.jsxs(Ri,{size:"sm",className:"max-sm:w-auto gap-1.5",children:[y.jsx(he,{icon:BV,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(Ai,{children:r??e("allRepos")})]}),y.jsxs(Pi,{className:"min-w-[160px]",children:[y.jsx(pr,{value:"",children:e("allRepos")}),a.map(l=>y.jsx(pr,{value:l,children:l},l))]})]})})]}),y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(D1e,{repoFilter:r??null,searchQuery:i})})]})}function ol({className:e,size:t="default",...r}){return y.jsx(Rfe,{"data-slot":"switch","data-size":t,className:Le("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...r,children:y.jsx(Pfe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const N1e=ao("/settings/")({component:B1e});function il({title:e,children:t}){return y.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[y.jsx("span",{className:"absolute -top-2.5 left-3 bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function B1e(){const{t:e}=Wt("settings"),{t}=Wt("common"),{data:r,isLoading:n}=KW(),{data:i,isLoading:s}=gx(),{data:o,isLoading:a}=vx(),{data:l,isLoading:u}=yx(),{data:h,isLoading:d}=bx(),{data:p,isLoading:v}=ahe(),{data:w,isLoading:_}=lhe(),{data:m,isLoading:x}=phe(),{data:b,isLoading:S}=mhe(),{data:E,isLoading:O}=vhe(),{data:k,isLoading:R}=_he(),{data:A}=XW(),j=She(),{savedLanguage:B,changeLanguage:L}=JW(),{theme:z,syncClaudeCode:D,changeTheme:V}=eq(),{data:H}=fhe(),{data:$}=hhe(),F=Dj(),W=ghe(),N=yhe(),q=xhe(),I=bhe(),[U,Y]=T.useState(""),[Q,J]=T.useState(""),[re,X]=T.useState("vscode"),[G,Z]=T.useState(""),[te,ne]=T.useState(""),[ie,me]=T.useState(""),[ye,ue]=T.useState(""),[fe,le]=T.useState(""),[je,Ee]=T.useState(""),[$e,ae]=T.useState(!1),[ge,pe]=T.useState(!1),[Se,Ce]=T.useState(!1),[qe,st]=T.useState(!1),[Re,Ve]=T.useState(!1),[Ge,vt]=T.useState(""),[Ke,Qe]=T.useState(!1),[Ae,ot]=T.useState(""),[ft,Je]=T.useState(!1),[lt,Ht]=T.useState(""),[pt,Rr]=T.useState(""),[Dt,Tt]=T.useState(!1),[tt,Gt]=T.useState(""),[rr,mt]=T.useState("glm-4.5-air"),[It,Rt]=T.useState("glm-4.7"),[Pt,rt]=T.useState("glm-4.7"),[nr,en]=T.useState(!1),[un,pn]=T.useState("light-ansi"),[yi,Ma]=T.useState("dark-ansi"),[Vn,Vr]=T.useState(!1),[Xr,Ii]=T.useState(!1),[ii,Rs]=T.useState(!1),Bl=T.useRef(null);T.useEffect(()=>{r!==void 0&&Y(String(r)),i!==void 0&&J(i),o!==void 0&&X(o),l!==void 0&&Z(l),h!==void 0&&ne(String(h)),p!==void 0&&me(p),w!==void 0&&ue(w),m!==void 0&&le(m)},[r,i,o,l,h,p,w,m]),T.useEffect(()=>{E&&(Ce(E.enabled),st(E.sound?.enabled??!1),Ii(!!E.sound?.customSoundFile),Ve(E.slack?.enabled??!1),vt(E.slack?.webhookUrl??""),Qe(E.discord?.enabled??!1),ot(E.discord?.webhookUrl??""),Je(E.pushover?.enabled??!1),Ht(E.pushover?.appToken??""),Rr(E.pushover?.userKey??""))},[E]),T.useEffect(()=>{k&&(Tt(k.enabled),Gt(k.apiKey??""),mt(k.haikuModel),Rt(k.sonnetModel),rt(k.opusModel))},[k]),T.useEffect(()=>{D!==void 0&&en(D),H!==void 0&&pn(H),$!==void 0&&Ma($)},[D,H,$]);const kt=n||s||a||u||d||v||_||x||S||O||R,Uo=k&&(Dt!==k.enabled||tt!==(k.apiKey??"")||rr!==k.haikuModel||It!==k.sonnetModel||Pt!==k.opusModel),Vo=nr!==(D??!1)||un!==H||yi!==$,Ps=E&&(Se!==E.enabled||qe!==(E.sound?.enabled??!1)||Re!==(E.slack?.enabled??!1)||Ge!==(E.slack?.webhookUrl??"")||Ke!==(E.discord?.enabled??!1)||Ae!==(E.discord?.webhookUrl??"")||ft!==(E.pushover?.enabled??!1)||lt!==(E.pushover?.appToken??"")||pt!==(E.pushover?.userKey??"")),js=fe!==m||je!=="",La=re!==o||G!==l||te!==String(h),os=U!==String(r)||Q!==i||ie!==p||ye!==w||js||La||Ps||Uo||Vo,tn=async()=>{const Me=[];if(U!==String(r)){const wt=parseInt(U,10);!isNaN(wt)&&wt>=1&&wt<=65535&&Me.push(new Promise(oi=>{F.mutate({key:Ut.PORT,value:wt},{onSettled:oi})}))}if(Q!==i&&Me.push(new Promise(wt=>{F.mutate({key:Ut.DEFAULT_GIT_REPOS_DIR,value:Q},{onSettled:wt})})),re!==o&&Me.push(new Promise(wt=>{F.mutate({key:Ut.EDITOR_APP,value:re},{onSettled:wt})})),G!==l&&Me.push(new Promise(wt=>{F.mutate({key:Ut.EDITOR_HOST,value:G},{onSettled:wt})})),te!==String(h)){const wt=parseInt(te,10);!isNaN(wt)&&wt>=1&&wt<=65535&&Me.push(new Promise(oi=>{F.mutate({key:Ut.EDITOR_SSH_PORT,value:wt},{onSettled:oi})}))}ie!==p&&Me.push(new Promise(wt=>{F.mutate({key:Ut.LINEAR_API_KEY,value:ie},{onSettled:wt})})),ye!==w&&Me.push(new Promise(wt=>{F.mutate({key:Ut.GITHUB_PAT,value:ye},{onSettled:wt})})),fe!==m&&Me.push(new Promise(wt=>{F.mutate({key:Ut.BASIC_AUTH_USERNAME,value:fe},{onSettled:wt})})),je!==""&&(Me.push(new Promise(wt=>{F.mutate({key:Ut.BASIC_AUTH_PASSWORD,value:je},{onSettled:wt})})),Ee("")),Ps&&Me.push(new Promise(wt=>{N.mutate({enabled:Se,sound:{enabled:qe},slack:{enabled:Re,webhookUrl:Ge},discord:{enabled:Ke,webhookUrl:Ae},pushover:{enabled:ft,appToken:lt,userKey:pt}},{onSettled:wt})})),Uo&&Me.push(new Promise(wt=>{q.mutate({enabled:Dt,apiKey:tt||null,haikuModel:rr,sonnetModel:It,opusModel:Pt},{onSettled:wt})})),Vo&&(nr!==(D??!1)&&Me.push(new Promise(wt=>{F.mutate({key:Ut.SYNC_CLAUDE_CODE_THEME,value:nr},{onSettled:wt})})),un!==H&&Me.push(new Promise(wt=>{F.mutate({key:Ut.CLAUDE_CODE_LIGHT_THEME,value:un},{onSettled:wt})})),yi!==$&&Me.push(new Promise(wt=>{F.mutate({key:Ut.CLAUDE_CODE_DARK_THEME,value:yi},{onSettled:wt})}))),await Promise.all(Me),pe(!0),setTimeout(()=>pe(!1),2e3)},Wn=()=>{W.mutate(Ut.PORT,{onSuccess:Me=>{Me.value!==null&&Y(String(Me.value))}})},qn=()=>{W.mutate(Ut.DEFAULT_GIT_REPOS_DIR,{onSuccess:Me=>{Me.value&&J(String(Me.value))}})},bi=()=>{W.mutate(Ut.EDITOR_APP,{onSuccess:Me=>{Me.value!==null&&Me.value!==void 0&&X(Me.value)}})},as=()=>{W.mutate(Ut.EDITOR_HOST,{onSuccess:Me=>{Z(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},Pp=()=>{W.mutate(Ut.EDITOR_SSH_PORT,{onSuccess:Me=>{Me.value!==null&&Me.value!==void 0&&ne(String(Me.value))}})},$l=()=>{W.mutate(Ut.LINEAR_API_KEY,{onSuccess:Me=>{me(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},zl=()=>{W.mutate(Ut.GITHUB_PAT,{onSuccess:Me=>{ue(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},jp=()=>{W.mutate(Ut.BASIC_AUTH_USERNAME,{onSuccess:Me=>{le(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},mo=()=>{W.mutate(Ut.BASIC_AUTH_PASSWORD,{onSuccess:()=>{Ee("")}})},ls=async Me=>{I.mutate(Me,{onSuccess:wt=>{wt.success?Jt.success(e("notifications.testSuccess",{channel:Me})):Jt.error(e("notifications.testFailed",{channel:Me,error:wt.error}))},onError:wt=>{Jt.error(e("notifications.testFailed",{channel:Me,error:wt.message}))}})},_i=async Me=>{const wt=Me.target.files?.[0];if(wt){Rs(!0);try{const oi=new FormData;oi.append("file",wt);const Ms=await fetch("/api/uploads/sound",{method:"POST",body:oi});if(!Ms.ok){const xi=await Ms.json();throw new Error(xi.error||"Upload failed")}Ii(!0),Jt.success(e("notifications.soundUploaded"))}catch(oi){Jt.error(e("notifications.soundUploadFailed",{error:oi instanceof Error?oi.message:"Unknown error"}))}finally{Rs(!1),Bl.current&&(Bl.current.value="")}}},si=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");Ii(!1),Jt.success(e("notifications.soundDeleted"))}catch{Jt.error(e("notifications.soundDeleteFailed"))}};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:y.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),y.jsx("div",{className:"flex-1 overflow-auto p-6",children:y.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[y.jsx(il,{title:e("sections.server"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(qt,{type:"number",min:1,max:65535,value:U,onChange:Me=>Y(Me.target.value),placeholder:"7777",disabled:kt,className:"w-24 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Wn,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),y.jsx(il,{title:e("sections.paths"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:Q,onChange:Me=>J(Me.target.value),placeholder:"~/projects",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ae(!0),disabled:kt,title:t("buttons.browse"),children:y.jsx(he,{icon:pi,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:qn,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),y.jsx(il,{title:e("sections.authentication"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.username")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:fe,onChange:Me=>le(Me.target.value),placeholder:e("fields.auth.usernamePlaceholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:jp,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]})}),y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.password")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:je,onChange:Me=>Ee(Me.target.value),placeholder:e(b?"fields.auth.passwordSet":"fields.auth.passwordPlaceholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:mo,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]})}),y.jsx("p",{className:"text-xs text-muted-foreground",children:e("fields.auth.description")})]})}),y.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[y.jsx(il,{title:e("sections.editor"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs(Ti,{value:re,onValueChange:Me=>X(Me),children:[y.jsx(Ri,{className:"w-32",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"vscode",children:"VS Code"}),y.jsx(pr,{value:"cursor",children:"Cursor"}),y.jsx(pr,{value:"windsurf",children:"Windsurf"}),y.jsx(pr,{value:"zed",children:"Zed"})]})]}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:bi,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:G,onChange:Me=>Z(Me.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:as,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(qt,{type:"number",min:1,max:65535,value:te,onChange:Me=>ne(Me.target.value),placeholder:"22",disabled:kt,className:"w-20 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Pp,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),y.jsx(il,{title:e("sections.integrations"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:ie,onChange:Me=>me(Me.target.value),placeholder:"lin_api_...",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:$l,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:ye,onChange:Me=>ue(Me.target.value),placeholder:"ghp_...",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:zl,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),y.jsx(il,{title:e("sections.zai"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),y.jsx(ol,{checked:Dt,onCheckedChange:Tt,disabled:kt})]}),Dt&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),y.jsx(qt,{type:"password",value:tt,onChange:Me=>Gt(Me.target.value),placeholder:"zai_...",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),y.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[y.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),y.jsx(qt,{value:rr,onChange:Me=>mt(Me.target.value),placeholder:"glm-4.5-air",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),y.jsx(qt,{value:It,onChange:Me=>Rt(Me.target.value),placeholder:"glm-4.7",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),y.jsx(qt,{value:Pt,onChange:Me=>rt(Me.target.value),placeholder:"glm-4.7",disabled:kt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),y.jsx(il,{title:e("sections.notifications"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),y.jsx(ol,{checked:Se,onCheckedChange:Ce,disabled:kt})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:qe,onCheckedChange:st,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),y.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[y.jsx("input",{ref:Bl,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:_i}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Bl.current?.click(),disabled:kt||!Se||!qe||ii,title:e("notifications.uploadSound"),children:ii?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:wce,size:14,strokeWidth:2})}),Xr&&y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:si,disabled:kt||!Se||!qe,title:e("notifications.deleteSound"),children:y.jsx(he,{icon:hp,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("sound"),disabled:kt||!Se||!qe||I.isPending,title:e("notifications.testSound"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]})]}),Xr&&y.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:Re,onCheckedChange:Ve,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("slack"),disabled:kt||!Se||!Re||!Ge||I.isPending,title:e("notifications.slack"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),Re&&y.jsx(qt,{type:"password",value:Ge,onChange:Me=>vt(Me.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:kt||!Se,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:Ke,onCheckedChange:Qe,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("discord"),disabled:kt||!Se||!Ke||!Ae||I.isPending,title:e("notifications.discord"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),Ke&&y.jsx(qt,{type:"password",value:Ae,onChange:Me=>ot(Me.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:kt||!Se,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:ft,onCheckedChange:Je,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("pushover"),disabled:kt||!Se||!ft||!lt||!pt||I.isPending,title:e("notifications.pushover"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),ft&&y.jsxs("div",{className:"ml-6 space-y-2",children:[y.jsx(qt,{type:"password",value:lt,onChange:Me=>Ht(Me.target.value),placeholder:e("notifications.appToken"),disabled:kt||!Se,className:"flex-1 font-mono text-sm"}),y.jsx(qt,{type:"password",value:pt,onChange:Me=>Rr(Me.target.value),placeholder:e("notifications.userKey"),disabled:kt||!Se,className:"flex-1 font-mono text-sm"})]})]})]})}),y.jsx(il,{title:e("sections.appearance"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),y.jsxs(Ti,{value:B??"auto",onValueChange:Me=>L(Me==="auto"?null:Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"auto",children:e("fields.language.options.auto")}),y.jsx(pr,{value:"en",children:e("fields.language.options.en")}),y.jsx(pr,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),y.jsxs(Ti,{value:z??"system",onValueChange:Me=>V(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"system",children:e("fields.theme.options.system")}),y.jsx(pr,{value:"light",children:e("fields.theme.options.light")}),y.jsx(pr,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),y.jsx(ol,{checked:nr,onCheckedChange:en})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),nr&&y.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),y.jsxs(Ti,{value:un,onValueChange:Me=>pn(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:h4.filter(Me=>Me.startsWith("light")).map(Me=>y.jsx(pr,{value:Me,children:e(`fields.claudeCodeTheme.options.${Me}`)},Me))})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),y.jsxs(Ti,{value:yi,onValueChange:Me=>Ma(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:h4.filter(Me=>Me.startsWith("dark")).map(Me=>y.jsx(pr,{value:Me,children:e(`fields.claudeCodeTheme.options.${Me}`)},Me))})]})]})]})]})}),A?.enabled&&y.jsx(il,{title:e("sections.developer"),children:y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[y.jsx("div",{className:"flex-1",children:y.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>{const Me=A?.startedAt;Vr(!0),j.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Ms=0;Ms<120;Ms++){await new Promise(xi=>setTimeout(xi,500));try{const xi=await fetch("/api/config/developer-mode");if(xi.ok&&(await xi.json()).startedAt!==Me){window.location.reload();return}}catch{}}Vr(!1),Jt.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:wt=>{Vr(!1),Jt.error(e("developer.restartFailed"),{description:wt.message})}})},disabled:j.isPending||Vn,className:"shrink-0 gap-2",children:[(j.isPending||Vn)&&y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),e(Vn?"developer.restarting":"developer.restartButton")]})]})})})]})}),y.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:y.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[ge&&y.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[y.jsx(he,{icon:ou,size:12,strokeWidth:2}),t("status.saved")]}),y.jsx(Ne,{size:"sm",onClick:tn,disabled:!os||kt||F.isPending,children:t("buttons.save")})]})}),y.jsx(Uv,{open:$e,onOpenChange:ae,onSelect:Me=>J(Me),initialPath:Q||void 0})]})}const Dx="";function $1e(){return Dr({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${Dx}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function z1e(){return Dr({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${Dx}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function H1e(e,t,r){return Dr({queryKey:["github-issues",e,t,r],queryFn:async()=>{const n=new URLSearchParams({filter:e});t&&n.set("viboraReposOnly","true"),r&&n.set("org",r);const i=await fetch(`${Dx}/api/github/issues?${n}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function F1e(e,t,r){return Dr({queryKey:["github-prs",e,t,r],queryFn:async()=>{const n=new URLSearchParams({filter:e});t&&n.set("viboraReposOnly","true"),r&&n.set("org",r);const i=await fetch(`${Dx}/api/github/prs?${n}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function U1e({filter:e,viboraReposOnly:t,org:r}){const{t:n}=Wt("review"),{t:i}=Wt("common"),{data:s,isLoading:o,error:a}=H1e(e,t,r);if(o)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(he,{icon:sr,size:24,className:"animate-spin text-muted-foreground"})});if(a)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:fp,size:24}),y.jsx("p",{className:"text-sm",children:n("issues.failedToLoad")}),y.jsx("p",{className:"text-xs",children:a.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return s?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(s.length===1?"results.one":"results.other",{count:s.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(u=>y.jsx(V1e,{issue:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:ou,size:24}),y.jsx("p",{className:"text-sm",children:n(l[e])})]})}function V1e({issue:e}){return y.jsx(Qi,{className:"transition-colors hover:border-border/80",children:y.jsx(mp,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>y.jsx(pl,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&y.jsxs(pl,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function W1e({filter:e,viboraReposOnly:t,org:r}){const{t:n}=Wt("review"),{t:i}=Wt("common"),{data:s,isLoading:o,error:a}=F1e(e,t,r);if(o)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(he,{icon:sr,size:24,className:"animate-spin text-muted-foreground"})});if(a)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:fp,size:24}),y.jsx("p",{className:"text-sm",children:n("prs.failedToLoad")}),y.jsx("p",{className:"text-xs",children:a.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return s?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(s.length===1?"results.one":"results.other",{count:s.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(u=>y.jsx(q1e,{pr:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:ou,size:24}),y.jsx("p",{className:"text-sm",children:n(l[e])})]})}function q1e({pr:e}){const{t}=Wt("review");return y.jsx(Qi,{className:"transition-colors hover:border-border/80",children:y.jsx(mp,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&y.jsx(pl,{variant:"secondary",className:Le("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&y.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),y.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(r=>y.jsx(pl,{className:"text-xs",style:{backgroundColor:`#${r.color}20`,color:`#${r.color}`,borderColor:`#${r.color}40`},children:r.name},r.name)),e.labels.length>3&&y.jsxs(pl,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const G1e=ao("/review/")({component:K1e});function K1e(){const{t:e}=Wt("review"),[t,r]=T.useState("prs"),[n,i]=T.useState("review_requested"),[s,o]=T.useState("assigned"),[a,l]=T.useState(!1),[u,h]=T.useState(""),{data:d,isLoading:p}=$1e(),{data:v=[]}=z1e();return!p&&!d?y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:y.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[y.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:y.jsx(he,{icon:vce,size:24,className:"text-muted-foreground"})}),y.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),y.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),y.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[y.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),y.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:y.jsxs(Ne,{variant:"outline",size:"sm",className:"w-full",children:[y.jsx(he,{icon:yce,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),y.jsx(hi,{to:"/settings",children:y.jsx(Ne,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):y.jsx("div",{className:"flex h-full flex-col",children:y.jsxs(Ic,{value:t,onValueChange:w=>r(w),className:"flex flex-1 flex-col overflow-hidden",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-1 max-sm:px-2",children:[y.jsxs(Nc,{variant:"line",children:[y.jsx(ui,{value:"prs",children:e("tabs.pullRequests")}),y.jsx(ui,{value:"issues",children:e("tabs.issues")})]}),y.jsxs("div",{className:"flex items-center gap-4 max-sm:gap-2",children:[t==="prs"?y.jsxs(Ti,{value:n,onValueChange:w=>i(w),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"created",children:e("filters.pr.created")}),y.jsx(pr,{value:"assigned",children:e("filters.pr.assigned")}),y.jsx(pr,{value:"review_requested",children:e("filters.pr.reviewRequested")}),y.jsx(pr,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):y.jsxs(Ti,{value:s,onValueChange:w=>o(w),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"assigned",children:e("filters.issue.assigned")}),y.jsx(pr,{value:"created",children:e("filters.issue.created")}),y.jsx(pr,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),y.jsxs(Ti,{value:u,onValueChange:w=>h(w||""),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{children:u||e("filters.allOrgs")})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"",children:e("filters.allOrganizations")}),v.map(w=>y.jsx(pr,{value:w.login,children:w.login},w.login))]})]}),y.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",title:e("filters.viboraReposOnly"),children:[y.jsx(ol,{checked:a,onCheckedChange:l,disabled:!!u}),y.jsx("span",{className:"text-muted-foreground max-sm:hidden",children:e("filters.viboraReposOnly")})]})]})]}),y.jsx(Wi,{value:"prs",className:"flex-1 overflow-auto p-4",children:y.jsx(W1e,{filter:n,viboraReposOnly:a,org:u||void 0})}),y.jsx(Wi,{value:"issues",className:"flex-1 overflow-auto p-4",children:y.jsx(U1e,{filter:s,viboraReposOnly:a,org:u||void 0})})]})})}function Y1e(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function X1e(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function iM(e={}){const t=SK();return{get terminals(){return t.terminals.map(Y1e)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(X1e)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup}}function AK(){const e=Ts(),{tabs:t,createTab:r,createTerminal:n,connected:i}=iM(),s=T.useRef(null);return T.useEffect(()=>{if(xt.ws.debug("useOpenInTerminal: tabs effect",{hasPending:!!s.current,pendingDirectory:s.current?.directory,tabCount:t.length,tabDirectories:t.map(u=>u.directory)}),!s.current)return;const{directory:a}=s.current,l=t.find(u=>u.directory===a);xt.ws.debug("useOpenInTerminal: checking for matching tab",{directory:a,matchingTab:l?{id:l.id,name:l.name}:null}),l&&(s.current=null,xt.ws.info("useOpenInTerminal: creating terminal in tab",{tabId:l.id,directory:a}),n({name:"Terminal 1",cols:80,rows:24,tabId:l.id,positionInTab:0}),e({to:"/terminals",search:{tab:l.id}}))},[t,n,e]),{openInTerminal:T.useCallback((a,l)=>{if(xt.ws.info("useOpenInTerminal: openInTerminal called",{directory:a,name:l,connected:i,tabCount:t.length}),!i){xt.ws.warn("useOpenInTerminal: not connected, aborting");return}const u=t.find(h=>h.directory===a);if(xt.ws.debug("useOpenInTerminal: existing tab check",{directory:a,existingTab:u?{id:u.id,name:u.name}:null}),u){xt.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:u.id}),e({to:"/terminals",search:{tab:u.id}});return}xt.ws.info("useOpenInTerminal: creating new tab",{name:l,directory:a}),s.current={directory:a,name:l},r(l,void 0,a)},[i,t,r,e]),connected:i}}const Q1e={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function S_(e,t,r,n){const i=Q1e[t];if(!r)return`${i}://file${e}`;const s=n!==22?`${r}:${n}`:r;return`${i}://vscode-remote/ssh-remote+${s}${e}`}function RK(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}const PK="";function Z1e(e){return Dr({queryKey:["copier-questions",e],queryFn:()=>zt(`${PK}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function J1e(){const{data:e,...t}=Fv();return{...t,data:e?.filter(r=>r.isCopierTemplate)??[]}}function exe(){const e=Cn();return Yr({mutationFn:t=>zt(`${PK}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function txe(){const{t:e}=Wt("repositories"),t=Ts(),[r,n]=T.useState(!1),[i,s]=T.useState("template"),[o,a]=T.useState(!1),[l,u]=T.useState(!1),h=T.useRef(null),[d,p]=T.useState(""),[v,w]=T.useState(""),[_,m]=T.useState({}),[x,b]=T.useState(""),[S,E]=T.useState(""),[O,k]=T.useState(null),{data:R}=J1e(),{data:A}=gx(),j=d||v,{data:B,isLoading:L,error:z}=Z1e(i==="questions"||i==="output"?j:null),D=exe();T.useEffect(()=>{r&&(s("template"),p(""),w(""),m({}),b(A||""),E(""),k(null))},[r,A]),T.useEffect(()=>{B?.questions&&m(Q=>{const J={...Q};for(const re of B.questions)J[re.name]===void 0&&re.default!==void 0&&(J[re.name]=re.default);return J})},[B]);const V=T.useCallback(()=>{const Q=h.current;if(!Q)return;const J=Q.scrollHeight>Q.clientHeight&&Q.scrollTop+Q.clientHeight<Q.scrollHeight-10;u(J)},[]);T.useEffect(()=>{const Q=setTimeout(V,100);return()=>clearTimeout(Q)},[i,B,V]);const H=T.useCallback(()=>{V()},[V]),$=()=>{i==="template"?s("questions"):i==="questions"&&s("output")},F=()=>{i==="questions"?s("template"):i==="output"&&s("questions")},W=()=>{s("creating"),k(null),D.mutate({templateSource:j,outputPath:x,answers:_,projectName:S},{onSuccess:Q=>{n(!1),t({to:"/repositories/$repoId",params:{repoId:Q.repositoryId}})},onError:Q=>{k(Q.message),s("output")}})},N=Q=>{const J=_[Q.name],re=Z=>m(te=>({...te,[Q.name]:Z})),G=Q.default===void 0||typeof Q.default=="string"&&Q.default.includes("{{")?`${Q.name} *`:Q.name;switch(Q.type){case"bool":return y.jsxs(mr,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ya,{checked:J,onCheckedChange:re}),y.jsx(gr,{className:"cursor-pointer",children:G})]}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);case"int":case"float":return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),y.jsx(qt,{type:"number",value:J,onChange:Z=>re(Q.type==="int"?parseInt(Z.target.value):parseFloat(Z.target.value)),step:Q.type==="float"?"any":1}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);default:{if(Q.choices&&Q.choices.length>0)return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),y.jsxs(Ti,{value:String(J??""),onValueChange:re,children:[y.jsx(Ri,{className:"w-full",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:Q.choices.map(te=>y.jsx(pr,{value:String(te.value),children:te.label},String(te.value)))})]}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);const Z=Q.type==="yaml"||Q.type==="json";return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),Z?y.jsx(fx,{value:String(J??""),onChange:te=>re(te.target.value),rows:4}):y.jsx(qt,{value:String(J??""),onChange:te=>re(te.target.value)}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name)}}},q=!!j,I=B?.questions.filter(Q=>{if(Q.default!==void 0&&!(typeof Q.default=="string"&&Q.default.includes("{{")))return!1;const re=_[Q.name];return re==null||re===""})??[],U=B&&!L&&I.length===0,Y=S.trim()&&x.trim();return y.jsxs(y.Fragment,{children:[y.jsxs(Ea,{open:r,onOpenChange:n,children:[y.jsxs(xj,{render:y.jsx(Ne,{variant:"outline",size:"sm"}),children:[y.jsx(he,{icon:dce,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),y.jsxs(Oa,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[y.jsxs(Pl,{className:"shrink-0",children:[y.jsx(jl,{children:e("newProject.title")}),y.jsxs(Bv,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),y.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((Q,J)=>y.jsx("div",{className:Le("flex-1 h-1 rounded",i===Q||["template","questions","output"].indexOf(i)>J||i==="creating"?"bg-primary":"bg-muted")},Q))}),y.jsxs("div",{ref:h,onScroll:H,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&y.jsxs(hl,{children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.template.savedTemplates")}),y.jsxs(Ti,{value:d,onValueChange:Q=>{p(Q??""),w("")},children:[y.jsx(Ri,{className:"w-full",children:y.jsx(Ai,{children:d?R?.find(Q=>Q.id===d)?.displayName:y.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),y.jsx(Pi,{children:R?.map(Q=>y.jsx(pr,{value:Q.id,children:Q.displayName},Q.id))})]})]}),y.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.template.customUrl")}),y.jsx(qt,{value:v,onChange:Q=>{w(Q.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),y.jsx(Ei,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&y.jsxs(hl,{children:[L&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(he,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),z&&y.jsx("div",{className:"text-destructive text-sm py-4",children:z.message}),B?.questions.map(N),B&&B.questions.length===0&&y.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&y.jsxs(hl,{children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.output.projectName")}),y.jsx(qt,{value:S,onChange:Q=>E(Q.target.value),placeholder:"my-new-project"})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.output.outputDirectory")}),y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>a(!0),children:[y.jsx(he,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),x||e("newProject.steps.output.selectDirectory")]})]}),S&&x&&y.jsxs(Ei,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",x,"/",S]}),O&&y.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:O})]}),i==="creating"&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[y.jsx(he,{icon:sr,size:32,strokeWidth:2,className:"animate-spin text-primary"}),y.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&y.jsx("div",{className:"flex justify-center py-1",children:y.jsx(he,{icon:pj,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),y.jsxs(Bd,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&y.jsxs(Ne,{variant:"outline",onClick:F,children:[y.jsx(he,{icon:DV,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&y.jsxs(Ne,{onClick:$,disabled:!q,children:[e("newProject.next"),y.jsx(he,{icon:K3,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&y.jsxs(Ne,{onClick:$,disabled:!U,children:[e("newProject.next"),y.jsx(he,{icon:K3,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&y.jsx(Ne,{onClick:W,disabled:!Y||D.isPending,children:e("newProject.create")})]})]})]}),y.jsx(Uv,{open:o,onOpenChange:a,onSelect:Q=>b(Q),initialPath:A||void 0})]})}const rxe=ao("/repositories/")({component:sxe});function nxe({repository:e,onDelete:t,onStartTask:r,onOpenInTerminal:n,onViewTasks:i}){const{t:s}=Wt("repositories"),[o,a]=T.useState(!1),[l,u]=T.useState(!1),{data:h}=vx(),{data:d}=yx(),{data:p}=bx(),v=()=>{const _=S_(e.path,h,d,p);window.open(_,"_blank")},w=async()=>{u(!0);try{await t(),a(!1)}catch{}finally{u(!1)}};return y.jsx(Qi,{className:"h-full",children:y.jsxs(mp,{className:"flex h-full flex-col gap-3 py-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("span",{className:"block truncate font-medium",children:e.displayName}),y.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[y.jsx(he,{icon:pi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]})]}),y.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[y.jsxs(Ne,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(he,{icon:yj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("newTask")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(he,{icon:vh,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("viewTasks")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",title:s("openInTerminal"),children:[y.jsx(he,{icon:sx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("terminal")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:v,className:"text-muted-foreground hover:text-foreground",title:s("openInEditor",{editor:RK(h)}),children:[y.jsx(he,{icon:bj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("editor")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-foreground",title:s("settings"),render:y.jsx(hi,{to:"/repositories/$repoId",params:{repoId:e.id}}),children:[y.jsx(he,{icon:gj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("settings")})]}),y.jsxs(Fc,{open:o,onOpenChange:a,children:[y.jsxs(Uc,{render:y.jsx(Ne,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:s("delete.button")}),children:[y.jsx(he,{icon:hp,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("delete.button")})]}),y.jsxs(Vc,{children:[y.jsxs(Wc,{children:[y.jsx(Gc,{children:s("delete.title")}),y.jsx(Kc,{children:s("delete.description",{name:e.displayName})})]}),y.jsxs(qc,{children:[y.jsx(Yc,{disabled:l,children:s("addModal.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:w,disabled:l,className:"gap-2",children:[l&&y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),s(l?"delete.deleting":"delete.button")]})]})]})]})]})]})})}function ixe(){const{t:e}=Wt("repositories"),[t,r]=T.useState(!1),[n,i]=T.useState(!1),[s,o]=T.useState(""),[a,l]=T.useState(""),[u,h]=T.useState(""),[d,p]=T.useState(""),[v,w]=T.useState(!1),_=QW(),{data:m}=gx(),x=E=>{o(E),a||l(E.split("/").pop()||"")},b=E=>{E.preventDefault(),s.trim()&&_.mutate({path:s.trim(),displayName:a.trim()||s.split("/").pop()||"repo",startupScript:u.trim()||null,copyFiles:d.trim()||null,isCopierTemplate:v},{onSuccess:()=>{r(!1),o(""),l(""),h(""),p(""),w(!1)}})},S=s?s.split("/").pop():"";return y.jsxs(y.Fragment,{children:[y.jsxs(Ea,{open:t,onOpenChange:r,children:[y.jsxs(xj,{render:y.jsx(Ne,{size:"sm"}),children:[y.jsx(he,{icon:ox,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),y.jsx(Oa,{className:"sm:max-w-md",children:y.jsxs("form",{onSubmit:b,children:[y.jsxs(Pl,{children:[y.jsx(jl,{children:e("addModal.title")}),y.jsx(Bv,{children:e("addModal.description")})]}),y.jsxs(hl,{className:"mt-4",children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("addModal.fields.path")}),y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>i(!0),children:[y.jsx(he,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),S?y.jsx("span",{className:"truncate",children:s}):y.jsx("span",{className:"text-muted-foreground",children:e("addModal.fields.pathPlaceholder")})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"displayName",children:e("addModal.fields.displayName")}),y.jsx(qt,{id:"displayName",value:a,onChange:E=>l(E.target.value),placeholder:S||"My Project"})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"startupScript",children:e("addModal.fields.startupScript")}),y.jsx(fx,{id:"startupScript",value:u,onChange:E=>h(E.target.value),placeholder:e("addModal.fields.startupScriptPlaceholder"),rows:2}),y.jsx(Ei,{children:e("addModal.fields.startupScriptDescription")})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"copyFiles",children:e("addModal.fields.copyFiles")}),y.jsx(qt,{id:"copyFiles",value:d,onChange:E=>p(E.target.value),placeholder:e("addModal.fields.copyFilesPlaceholder")}),y.jsx(Ei,{children:e("addModal.fields.copyFilesDescription")})]}),y.jsxs(mr,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ya,{checked:v,onCheckedChange:E=>w(E===!0)}),y.jsx(gr,{className:"cursor-pointer",children:e("addModal.fields.isCopierTemplate")})]}),y.jsx(Ei,{children:e("addModal.fields.isCopierTemplateDescription")})]})]}),y.jsxs(Bd,{className:"mt-4",children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline",type:"button"}),children:e("addModal.cancel")}),y.jsx(Ne,{type:"submit",disabled:_.isPending||!s.trim(),children:_.isPending?e("addModal.adding"):e("addRepository")})]})]})})]}),y.jsx(Uv,{open:n,onOpenChange:i,onSelect:x,initialPath:m||void 0})]})}function sxe(){const{t:e}=Wt("repositories"),t=Ts(),{data:r,isLoading:n,error:i}=Fv(),s=ZW(),[o,a]=T.useState(null),{openInTerminal:l}=AK(),u=async d=>{await s.mutateAsync(d)},h=d=>{t({to:"/tasks",search:{repo:d}})};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsx(txe,{}),y.jsx(ixe,{})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(he,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(he,{icon:fp,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!n&&!i&&r?.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:r?.map(d=>y.jsx(nxe,{repository:d,onDelete:()=>u(d.id),onStartTask:()=>a(d),onOpenInTerminal:()=>l(d.path,d.displayName),onViewTasks:()=>h(d.displayName)},d.id))})]}),y.jsx(Ij,{open:o!==null,onOpenChange:d=>!d&&a(null),defaultRepository:o??void 0,showTrigger:!1})]})}var OE,R8;function is(){if(R8)return OE;R8=1;var e=Array.isArray;return OE=e,OE}var kE,P8;function jK(){if(P8)return kE;P8=1;var e=typeof Sb=="object"&&Sb&&Sb.Object===Object&&Sb;return kE=e,kE}var TE,j8;function Pa(){if(j8)return TE;j8=1;var e=jK(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return TE=r,TE}var AE,M8;function Jv(){if(M8)return AE;M8=1;var e=Pa(),t=e.Symbol;return AE=t,AE}var RE,L8;function oxe(){if(L8)return RE;L8=1;var e=Jv(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function s(o){var a=r.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var h=n.call(o);return u&&(a?o[i]=l:delete o[i]),h}return RE=s,RE}var PE,D8;function axe(){if(D8)return PE;D8=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return PE=r,PE}var jE,I8;function Dl(){if(I8)return jE;I8=1;var e=Jv(),t=oxe(),r=axe(),n="[object Null]",i="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?i:n:s&&s in Object(a)?t(a):r(a)}return jE=o,jE}var ME,N8;function Il(){if(N8)return ME;N8=1;function e(t){return t!=null&&typeof t=="object"}return ME=e,ME}var LE,B8;function xp(){if(B8)return LE;B8=1;var e=Dl(),t=Il(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return LE=n,LE}var DE,$8;function sM(){if($8)return DE;$8=1;var e=is(),t=xp(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){if(e(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||t(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return DE=i,DE}var IE,z8;function fu(){if(z8)return IE;z8=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return IE=e,IE}var NE,H8;function oM(){if(H8)return NE;H8=1;var e=Dl(),t=fu(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!t(a))return!1;var l=e(a);return l==n||l==i||l==r||l==s}return NE=o,NE}var BE,F8;function lxe(){if(F8)return BE;F8=1;var e=Pa(),t=e["__core-js_shared__"];return BE=t,BE}var $E,U8;function cxe(){if(U8)return $E;U8=1;var e=lxe(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return $E=r,$E}var zE,V8;function MK(){if(V8)return zE;V8=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return zE=r,zE}var HE,W8;function uxe(){if(W8)return HE;W8=1;var e=oM(),t=cxe(),r=fu(),n=MK(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,l=o.toString,u=a.hasOwnProperty,h=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!r(p)||t(p))return!1;var v=e(p)?h:s;return v.test(n(p))}return HE=d,HE}var FE,q8;function dxe(){if(q8)return FE;q8=1;function e(t,r){return t?.[r]}return FE=e,FE}var UE,G8;function qd(){if(G8)return UE;G8=1;var e=uxe(),t=dxe();function r(n,i){var s=t(n,i);return e(s)?s:void 0}return UE=r,UE}var VE,K8;function Ix(){if(K8)return VE;K8=1;var e=qd(),t=e(Object,"create");return VE=t,VE}var WE,Y8;function fxe(){if(Y8)return WE;Y8=1;var e=Ix();function t(){this.__data__=e?e(null):{},this.size=0}return WE=t,WE}var qE,X8;function hxe(){if(X8)return qE;X8=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return qE=e,qE}var GE,Q8;function pxe(){if(Q8)return GE;Q8=1;var e=Ix(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(s){var o=this.__data__;if(e){var a=o[s];return a===t?void 0:a}return n.call(o,s)?o[s]:void 0}return GE=i,GE}var KE,Z8;function mxe(){if(Z8)return KE;Z8=1;var e=Ix(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var s=this.__data__;return e?s[i]!==void 0:r.call(s,i)}return KE=n,KE}var YE,J8;function gxe(){if(J8)return YE;J8=1;var e=Ix(),t="__lodash_hash_undefined__";function r(n,i){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=e&&i===void 0?t:i,this}return YE=r,YE}var XE,e6;function vxe(){if(e6)return XE;e6=1;var e=fxe(),t=hxe(),r=pxe(),n=mxe(),i=gxe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,XE=s,XE}var QE,t6;function yxe(){if(t6)return QE;t6=1;function e(){this.__data__=[],this.size=0}return QE=e,QE}var ZE,r6;function aM(){if(r6)return ZE;r6=1;function e(t,r){return t===r||t!==t&&r!==r}return ZE=e,ZE}var JE,n6;function Nx(){if(n6)return JE;n6=1;var e=aM();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return JE=t,JE}var eO,i6;function bxe(){if(i6)return eO;i6=1;var e=Nx(),t=Array.prototype,r=t.splice;function n(i){var s=this.__data__,o=e(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():r.call(s,o,1),--this.size,!0}return eO=n,eO}var tO,s6;function _xe(){if(s6)return tO;s6=1;var e=Nx();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return tO=t,tO}var rO,o6;function xxe(){if(o6)return rO;o6=1;var e=Nx();function t(r){return e(this.__data__,r)>-1}return rO=t,rO}var nO,a6;function Sxe(){if(a6)return nO;a6=1;var e=Nx();function t(r,n){var i=this.__data__,s=e(i,r);return s<0?(++this.size,i.push([r,n])):i[s][1]=n,this}return nO=t,nO}var iO,l6;function Bx(){if(l6)return iO;l6=1;var e=yxe(),t=bxe(),r=_xe(),n=xxe(),i=Sxe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,iO=s,iO}var sO,c6;function lM(){if(c6)return sO;c6=1;var e=qd(),t=Pa(),r=e(t,"Map");return sO=r,sO}var oO,u6;function wxe(){if(u6)return oO;u6=1;var e=vxe(),t=Bx(),r=lM();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return oO=n,oO}var aO,d6;function Cxe(){if(d6)return aO;d6=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return aO=e,aO}var lO,f6;function $x(){if(f6)return lO;f6=1;var e=Cxe();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return lO=t,lO}var cO,h6;function Exe(){if(h6)return cO;h6=1;var e=$x();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return cO=t,cO}var uO,p6;function Oxe(){if(p6)return uO;p6=1;var e=$x();function t(r){return e(this,r).get(r)}return uO=t,uO}var dO,m6;function kxe(){if(m6)return dO;m6=1;var e=$x();function t(r){return e(this,r).has(r)}return dO=t,dO}var fO,g6;function Txe(){if(g6)return fO;g6=1;var e=$x();function t(r,n){var i=e(this,r),s=i.size;return i.set(r,n),this.size+=i.size==s?0:1,this}return fO=t,fO}var hO,v6;function cM(){if(v6)return hO;v6=1;var e=wxe(),t=Exe(),r=Oxe(),n=kxe(),i=Txe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,hO=s,hO}var pO,y6;function LK(){if(y6)return pO;y6=1;var e=cM(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],l=s.cache;if(l.has(a))return l.get(a);var u=n.apply(this,o);return s.cache=l.set(a,u)||l,u};return s.cache=new(r.Cache||e),s}return r.Cache=e,pO=r,pO}var mO,b6;function Axe(){if(b6)return mO;b6=1;var e=LK(),t=500;function r(n){var i=e(n,function(o){return s.size===t&&s.clear(),o}),s=i.cache;return i}return mO=r,mO}var gO,_6;function Rxe(){if(_6)return gO;_6=1;var e=Axe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(t,function(o,a,l,u){s.push(l?u.replace(r,"$1"):a||o)}),s});return gO=n,gO}var vO,x6;function uM(){if(x6)return vO;x6=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}return vO=e,vO}var yO,S6;function Pxe(){if(S6)return yO;S6=1;var e=Jv(),t=uM(),r=is(),n=xp(),i=e?e.prototype:void 0,s=i?i.toString:void 0;function o(a){if(typeof a=="string")return a;if(r(a))return t(a,o)+"";if(n(a))return s?s.call(a):"";var l=a+"";return l=="0"&&1/a==-1/0?"-0":l}return yO=o,yO}var bO,w6;function DK(){if(w6)return bO;w6=1;var e=Pxe();function t(r){return r==null?"":e(r)}return bO=t,bO}var _O,C6;function IK(){if(C6)return _O;C6=1;var e=is(),t=sM(),r=Rxe(),n=DK();function i(s,o){return e(s)?s:t(s,o)?[s]:r(n(s))}return _O=i,_O}var xO,E6;function zx(){if(E6)return xO;E6=1;var e=xp();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return xO=t,xO}var SO,O6;function dM(){if(O6)return SO;O6=1;var e=IK(),t=zx();function r(n,i){i=e(i,n);for(var s=0,o=i.length;n!=null&&s<o;)n=n[t(i[s++])];return s&&s==o?n:void 0}return SO=r,SO}var wO,k6;function NK(){if(k6)return wO;k6=1;var e=dM();function t(r,n,i){var s=r==null?void 0:e(r,n);return s===void 0?i:s}return wO=t,wO}var jxe=NK();const so=br(jxe);var CO,T6;function Mxe(){if(T6)return CO;T6=1;function e(t){return t==null}return CO=e,CO}var Lxe=Mxe();const Xt=br(Lxe);var EO,A6;function Dxe(){if(A6)return EO;A6=1;var e=Dl(),t=is(),r=Il(),n="[object String]";function i(s){return typeof s=="string"||!t(s)&&r(s)&&e(s)==n}return EO=i,EO}var Ixe=Dxe();const jd=br(Ixe);var Nxe=oM();const Ot=br(Nxe);var Bxe=fu();const Sp=br(Bxe);var OO={exports:{}},vr={};var R6;function $xe(){if(R6)return vr;R6=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function _(m){if(typeof m=="object"&&m!==null){var x=m.$$typeof;switch(x){case e:switch(m=m.type,m){case r:case i:case n:case u:case h:return m;default:switch(m=m&&m.$$typeof,m){case a:case o:case l:case p:case d:case s:return m;default:return x}}case t:return x}}}return vr.ContextConsumer=o,vr.ContextProvider=s,vr.Element=e,vr.ForwardRef=l,vr.Fragment=r,vr.Lazy=p,vr.Memo=d,vr.Portal=t,vr.Profiler=i,vr.StrictMode=n,vr.Suspense=u,vr.SuspenseList=h,vr.isAsyncMode=function(){return!1},vr.isConcurrentMode=function(){return!1},vr.isContextConsumer=function(m){return _(m)===o},vr.isContextProvider=function(m){return _(m)===s},vr.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===e},vr.isForwardRef=function(m){return _(m)===l},vr.isFragment=function(m){return _(m)===r},vr.isLazy=function(m){return _(m)===p},vr.isMemo=function(m){return _(m)===d},vr.isPortal=function(m){return _(m)===t},vr.isProfiler=function(m){return _(m)===i},vr.isStrictMode=function(m){return _(m)===n},vr.isSuspense=function(m){return _(m)===u},vr.isSuspenseList=function(m){return _(m)===h},vr.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===r||m===i||m===n||m===u||m===h||m===v||typeof m=="object"&&m!==null&&(m.$$typeof===p||m.$$typeof===d||m.$$typeof===s||m.$$typeof===o||m.$$typeof===l||m.$$typeof===w||m.getModuleId!==void 0)},vr.typeOf=_,vr}var P6;function zxe(){return P6||(P6=1,OO.exports=$xe()),OO.exports}var Hxe=zxe(),kO,j6;function BK(){if(j6)return kO;j6=1;var e=Dl(),t=Il(),r="[object Number]";function n(i){return typeof i=="number"||t(i)&&e(i)==r}return kO=n,kO}var TO,M6;function Fxe(){if(M6)return TO;M6=1;var e=BK();function t(r){return e(r)&&r!=+r}return TO=t,TO}var Uxe=Fxe();const wp=br(Uxe);var Vxe=BK();const Wxe=br(Vxe);var Ki=function(t){return t===0?0:t>0?1:-1},ed=function(t){return jd(t)&&t.indexOf("%")===t.length-1},Fe=function(t){return Wxe(t)&&!wp(t)},qxe=function(t){return Xt(t)},Dn=function(t){return Fe(t)||jd(t)},Gxe=0,ey=function(t){var r=++Gxe;return"".concat(t||"").concat(r)},To=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Fe(t)&&!jd(t))return n;var s;if(ed(t)){var o=t.indexOf("%");s=r*parseFloat(t.slice(0,o))/100}else s=+t;return wp(s)&&(s=n),i&&s>r&&(s=r),s},yc=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Kxe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i<r;i++)if(!n[t[i]])n[t[i]]=!0;else return!0;return!1},Oi=function(t,r){return Fe(t)&&Fe(r)?function(n){return t+n*(r-t)}:function(){return r}};function w_(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):so(n,t))===r})}var Yxe=function(t,r){return Fe(t)&&Fe(r)?t-r:jd(t)&&jd(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function sh(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function GA(e){"@babel/helpers - typeof";return GA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},GA(e)}var Xxe=["viewBox","children"],Qxe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],L6=["points","pathLength"],AO={svg:Xxe,polygon:L6,polyline:L6},fM=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],C_=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(T.isValidElement(t)&&(n=t.props),!Sp(n))return null;var i={};return Object.keys(n).forEach(function(s){fM.includes(s)&&(i[s]=r||function(o){return n[s](n,o)})}),i},Zxe=function(t,r,n){return function(i){return t(r,n,i),null}},eu=function(t,r,n){if(!Sp(t)||GA(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(s){var o=t[s];fM.includes(s)&&typeof o=="function"&&(i||(i={}),i[s]=Zxe(o,r,n))}),i},Jxe=["children"],eSe=["children"];function D6(e,t){if(e==null)return{};var r=tSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function KA(e){"@babel/helpers - typeof";return KA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},KA(e)}var I6={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},yl=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},N6=null,RO=null,hM=function e(t){if(t===N6&&Array.isArray(RO))return RO;var r=[];return T.Children.forEach(t,function(n){Xt(n)||(Hxe.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),RO=r,N6=t,r};function oo(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return yl(i)}):n=[yl(t)],hM(e).forEach(function(i){var s=so(i,"type.displayName")||so(i,"type.name");n.indexOf(s)!==-1&&r.push(i)}),r}function bs(e,t){var r=oo(e,t);return r&&r[0]}var B6=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!Fe(n)||n<=0||!Fe(i)||i<=0)},rSe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],nSe=function(t){return t&&t.type&&jd(t.type)&&rSe.indexOf(t.type)>=0},iSe=function(t){return t&&KA(t)==="object"&&"clipDot"in t},sSe=function(t,r,n,i){var s,o=(s=AO?.[i])!==null&&s!==void 0?s:[];return r.startsWith("data-")||!Ot(t)&&(i&&o.includes(r)||Qxe.includes(r))||n&&fM.includes(r)},yt=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(T.isValidElement(t)&&(i=t.props),!Sp(i))return null;var s={};return Object.keys(i).forEach(function(o){var a;sSe((a=i)===null||a===void 0?void 0:a[o],o,r,n)&&(s[o]=i[o])}),s},YA=function e(t,r){if(t===r)return!0;var n=T.Children.count(t);if(n!==T.Children.count(r))return!1;if(n===0)return!0;if(n===1)return $6(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var s=t[i],o=r[i];if(Array.isArray(s)||Array.isArray(o)){if(!e(s,o))return!1}else if(!$6(s,o))return!1}return!0},$6=function(t,r){if(Xt(t)&&Xt(r))return!0;if(!Xt(t)&&!Xt(r)){var n=t.props||{},i=n.children,s=D6(n,Jxe),o=r.props||{},a=o.children,l=D6(o,eSe);return i&&a?sh(s,l)&&YA(i,a):!i&&!a?sh(s,l):!1}return!1},z6=function(t,r){var n=[],i={};return hM(t).forEach(function(s,o){if(nSe(s))n.push(s);else if(s){var a=yl(s.type),l=r[a]||{},u=l.handler,h=l.once;if(u&&(!h||!i[a])){var d=u(s,a,o);n.push(d),i[a]=!0}}}),n},oSe=function(t){var r=t&&t.type;return r&&I6[r]?I6[r]:null},aSe=function(t,r){return hM(r).indexOf(t)},lSe=["children","width","height","viewBox","className","style","title","desc"];function XA(){return XA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},XA.apply(this,arguments)}function cSe(e,t){if(e==null)return{};var r=uSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function uSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function QA(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,s=e.className,o=e.style,a=e.title,l=e.desc,u=cSe(e,lSe),h=i||{width:r,height:n,x:0,y:0},d=Lt("recharts-surface",s);return se.createElement("svg",XA({},yt(u,!0,"svg"),{className:d,width:r,height:n,style:o,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),se.createElement("title",null,a),se.createElement("desc",null,l),t)}var dSe=["children","className"];function ZA(){return ZA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ZA.apply(this,arguments)}function fSe(e,t){if(e==null)return{};var r=hSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var or=se.forwardRef(function(e,t){var r=e.children,n=e.className,i=fSe(e,dSe),s=Lt("recharts-layer",n);return se.createElement("g",ZA({className:s},yt(i,!0),{ref:t}),r)}),bl=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s]},PO,H6;function pSe(){if(H6)return PO;H6=1;function e(t,r,n){var i=-1,s=t.length;r<0&&(r=-r>s?0:s+r),n=n>s?s:n,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(s);++i<s;)o[i]=t[i+r];return o}return PO=e,PO}var jO,F6;function mSe(){if(F6)return jO;F6=1;var e=pSe();function t(r,n,i){var s=r.length;return i=i===void 0?s:i,!n&&i>=s?r:e(r,n,i)}return jO=t,jO}var MO,U6;function $K(){if(U6)return MO;U6=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,s="\\ufe0e\\ufe0f",o="\\u200d",a=RegExp("["+o+e+i+s+"]");function l(u){return a.test(u)}return MO=l,MO}var LO,V6;function gSe(){if(V6)return LO;V6=1;function e(t){return t.split("")}return LO=e,LO}var DO,W6;function vSe(){if(W6)return DO;W6=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,s="\\ufe0e\\ufe0f",o="["+e+"]",a="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+a+"|"+l+")",h="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",w=u+"?",_="["+s+"]?",m="(?:"+v+"(?:"+[h,d,p].join("|")+")"+_+w+")*",x=_+w+m,b="(?:"+[h+a+"?",a,d,p,o].join("|")+")",S=RegExp(l+"(?="+l+")|"+b+x,"g");function E(O){return O.match(S)||[]}return DO=E,DO}var IO,q6;function ySe(){if(q6)return IO;q6=1;var e=gSe(),t=$K(),r=vSe();function n(i){return t(i)?r(i):e(i)}return IO=n,IO}var NO,G6;function bSe(){if(G6)return NO;G6=1;var e=mSe(),t=$K(),r=ySe(),n=DK();function i(s){return function(o){o=n(o);var a=t(o)?r(o):void 0,l=a?a[0]:o.charAt(0),u=a?e(a,1).join(""):o.slice(1);return l[s]()+u}}return NO=i,NO}var BO,K6;function _Se(){if(K6)return BO;K6=1;var e=bSe(),t=e("toUpperCase");return BO=t,BO}var xSe=_Se();const Hx=br(xSe);function Mr(e){return function(){return e}}const zK=Math.cos,E_=Math.sin,Fo=Math.sqrt,O_=Math.PI,Fx=2*O_,JA=Math.PI,eR=2*JA,zu=1e-6,SSe=eR-zu;function HK(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function wSe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return HK;const r=10**t;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class CSe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?HK:wSe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,s,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(t,r,n,i,s){if(t=+t,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,l=n-t,u=i-r,h=o-t,d=a-r,p=h*h+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(p>zu)if(!(Math.abs(d*l-u*h)>zu)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,w=i-a,_=l*l+u*u,m=v*v+w*w,x=Math.sqrt(_),b=Math.sqrt(p),S=s*Math.tan((JA-Math.acos((_+p-m)/(2*x*b)))/2),E=S/b,O=S/x;Math.abs(E-1)>zu&&this._append`L${t+E*h},${r+E*d}`,this._append`A${s},${s},0,0,${+(d*v>h*w)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,s,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),l=n*Math.sin(i),u=t+a,h=r+l,d=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>zu||Math.abs(this._y1-h)>zu)&&this._append`L${u},${h}`,n&&(p<0&&(p=p%eR+eR),p>SSe?this._append`A${n},${n},0,1,${d},${t-a},${r-l}A${n},${n},0,1,${d},${this._x1=u},${this._y1=h}`:p>zu&&this._append`A${n},${n},0,${+(p>=JA)},${d},${this._x1=t+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function pM(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new CSe(t)}function mM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FK(e){this._context=e}FK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ux(e){return new FK(e)}function UK(e){return e[0]}function VK(e){return e[1]}function WK(e,t){var r=Mr(!0),n=null,i=Ux,s=null,o=pM(a);e=typeof e=="function"?e:e===void 0?UK:Mr(e),t=typeof t=="function"?t:t===void 0?VK:Mr(t);function a(l){var u,h=(l=mM(l)).length,d,p=!1,v;for(n==null&&(s=i(v=o())),u=0;u<=h;++u)!(u<h&&r(d=l[u],u,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+e(d,u,l),+t(d,u,l));if(v)return s=null,v+""||null}return a.x=function(l){return arguments.length?(e=typeof l=="function"?l:Mr(+l),a):e},a.y=function(l){return arguments.length?(t=typeof l=="function"?l:Mr(+l),a):t},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Mr(!!l),a):r},a.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),a):i},a.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),a):n},a}function e0(e,t,r){var n=null,i=Mr(!0),s=null,o=Ux,a=null,l=pM(u);e=typeof e=="function"?e:e===void 0?UK:Mr(+e),t=typeof t=="function"?t:Mr(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?VK:Mr(+r);function u(d){var p,v,w,_=(d=mM(d)).length,m,x=!1,b,S=new Array(_),E=new Array(_);for(s==null&&(a=o(b=l())),p=0;p<=_;++p){if(!(p<_&&i(m=d[p],p,d))===x)if(x=!x)v=p,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),w=p-1;w>=v;--w)a.point(S[w],E[w]);a.lineEnd(),a.areaEnd()}x&&(S[p]=+e(m,p,d),E[p]=+t(m,p,d),a.point(n?+n(m,p,d):S[p],r?+r(m,p,d):E[p]))}if(b)return a=null,b+""||null}function h(){return WK().defined(i).curve(o).context(s)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Mr(+d),n=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Mr(+d),u):e},u.x1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Mr(+d),u):n},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Mr(+d),r=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Mr(+d),u):t},u.y1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Mr(+d),u):r},u.lineX0=u.lineY0=function(){return h().x(e).y(t)},u.lineY1=function(){return h().x(e).y(r)},u.lineX1=function(){return h().x(n).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Mr(!!d),u):i},u.curve=function(d){return arguments.length?(o=d,s!=null&&(a=o(s)),u):o},u.context=function(d){return arguments.length?(d==null?s=a=null:a=o(s=d),u):s},u}class qK{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function ESe(e){return new qK(e,!0)}function OSe(e){return new qK(e,!1)}const gM={draw(e,t){const r=Fo(t/O_);e.moveTo(r,0),e.arc(0,0,r,0,Fx)}},kSe={draw(e,t){const r=Fo(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},GK=Fo(1/3),TSe=GK*2,ASe={draw(e,t){const r=Fo(t/TSe),n=r*GK;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},RSe={draw(e,t){const r=Fo(t),n=-r/2;e.rect(n,n,r,r)}},PSe=.8908130915292852,KK=E_(O_/10)/E_(7*O_/10),jSe=E_(Fx/10)*KK,MSe=-zK(Fx/10)*KK,LSe={draw(e,t){const r=Fo(t*PSe),n=jSe*r,i=MSe*r;e.moveTo(0,-r),e.lineTo(n,i);for(let s=1;s<5;++s){const o=Fx*s/5,a=zK(o),l=E_(o);e.lineTo(l*r,-a*r),e.lineTo(a*n-l*i,l*n+a*i)}e.closePath()}},$O=Fo(3),DSe={draw(e,t){const r=-Fo(t/($O*3));e.moveTo(0,r*2),e.lineTo(-$O*r,-r),e.lineTo($O*r,-r),e.closePath()}},Us=-.5,Vs=Fo(3)/2,tR=1/Fo(12),ISe=(tR/2+1)*3,NSe={draw(e,t){const r=Fo(t/ISe),n=r/2,i=r*tR,s=n,o=r*tR+r,a=-s,l=o;e.moveTo(n,i),e.lineTo(s,o),e.lineTo(a,l),e.lineTo(Us*n-Vs*i,Vs*n+Us*i),e.lineTo(Us*s-Vs*o,Vs*s+Us*o),e.lineTo(Us*a-Vs*l,Vs*a+Us*l),e.lineTo(Us*n+Vs*i,Us*i-Vs*n),e.lineTo(Us*s+Vs*o,Us*o-Vs*s),e.lineTo(Us*a+Vs*l,Us*l-Vs*a),e.closePath()}};function BSe(e,t){let r=null,n=pM(i);e=typeof e=="function"?e:Mr(e||gM),t=typeof t=="function"?t:Mr(t===void 0?64:+t);function i(){let s;if(r||(r=s=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),s)return r=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:Mr(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:Mr(+s),i):t},i.context=function(s){return arguments.length?(r=s??null,i):r},i}function k_(){}function T_(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function YK(e){this._context=e}YK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:T_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $Se(e){return new YK(e)}function XK(e){this._context=e}XK.prototype={areaStart:k_,areaEnd:k_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zSe(e){return new XK(e)}function QK(e){this._context=e}QK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function HSe(e){return new QK(e)}function ZK(e){this._context=e}ZK.prototype={areaStart:k_,areaEnd:k_,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function FSe(e){return new ZK(e)}function Y6(e){return e<0?-1:1}function X6(e,t,r){var n=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),a=(s*i+o*n)/(n+i);return(Y6(s)+Y6(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Q6(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function zO(e,t,r){var n=e._x0,i=e._y0,s=e._x1,o=e._y1,a=(s-n)/3;e._context.bezierCurveTo(n+a,i+a*t,s-a,o-a*r,s,o)}function A_(e){this._context=e}A_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zO(this,this._t0,Q6(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zO(this,Q6(this,r=X6(this,e,t)),r);break;default:zO(this,this._t0,r=X6(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function JK(e){this._context=new eY(e)}(JK.prototype=Object.create(A_.prototype)).point=function(e,t){A_.prototype.point.call(this,t,e)};function eY(e){this._context=e}eY.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,s){this._context.bezierCurveTo(t,e,n,r,s,i)}};function USe(e){return new A_(e)}function VSe(e){return new JK(e)}function tY(e){this._context=e}tY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Z6(e),i=Z6(t),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Z6(e){var t,r=e.length-1,n,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/s[t-1],s[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/s[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function WSe(e){return new tY(e)}function Vx(e,t){this._context=e,this._t=t}Vx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function qSe(e){return new Vx(e,.5)}function GSe(e){return new Vx(e,0)}function KSe(e){return new Vx(e,1)}function Ah(e,t){if((o=e.length)>1)for(var r=1,n,i,s=e[t[0]],o,a=s.length;r<o;++r)for(i=s,s=e[t[r]],n=0;n<a;++n)s[n][1]+=s[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function rR(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function YSe(e,t){return e[t]}function XSe(e){const t=[];return t.key=e,t}function QSe(){var e=Mr([]),t=rR,r=Ah,n=YSe;function i(s){var o=Array.from(e.apply(this,arguments),XSe),a,l=o.length,u=-1,h;for(const d of s)for(a=0,++u;a<l;++a)(o[a][u]=[0,+n(d,o[a].key,u,s)]).data=d;for(a=0,h=mM(t(o));a<l;++a)o[h[a]].index=a;return r(o,h),o}return i.keys=function(s){return arguments.length?(e=typeof s=="function"?s:Mr(Array.from(s)),i):e},i.value=function(s){return arguments.length?(n=typeof s=="function"?s:Mr(+s),i):n},i.order=function(s){return arguments.length?(t=s==null?rR:typeof s=="function"?s:Mr(Array.from(s)),i):t},i.offset=function(s){return arguments.length?(r=s??Ah,i):r},i}function ZSe(e,t){if((n=e.length)>0){for(var r,n,i=0,s=e[0].length,o;i<s;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Ah(e,t)}}function JSe(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,s=n.length;r<s;++r){for(var o=0,a=0;o<i;++o)a+=e[o][r][1]||0;n[r][1]+=n[r][0]=-a/2}Ah(e,t)}}function ewe(e,t){if(!(!((o=e.length)>0)||!((s=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,s,o;n<s;++n){for(var a=0,l=0,u=0;a<o;++a){for(var h=e[t[a]],d=h[n][1]||0,p=h[n-1][1]||0,v=(d-p)/2,w=0;w<a;++w){var _=e[t[w]],m=_[n][1]||0,x=_[n-1][1]||0;v+=m-x}l+=d,u+=v*d}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Ah(e,t)}}function Ng(e){"@babel/helpers - typeof";return Ng=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ng(e)}var twe=["type","size","sizeType"];function nR(){return nR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nR.apply(this,arguments)}function J6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function e9(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?J6(Object(r),!0).forEach(function(n){rwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rwe(e,t,r){return t=nwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nwe(e){var t=iwe(e,"string");return Ng(t)=="symbol"?t:t+""}function iwe(e,t){if(Ng(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ng(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function swe(e,t){if(e==null)return{};var r=owe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function owe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var rY={symbolCircle:gM,symbolCross:kSe,symbolDiamond:ASe,symbolSquare:RSe,symbolStar:LSe,symbolTriangle:DSe,symbolWye:NSe},awe=Math.PI/180,lwe=function(t){var r="symbol".concat(Hx(t));return rY[r]||gM},cwe=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*awe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},uwe=function(t,r){rY["symbol".concat(Hx(t))]=r},vM=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,s=i===void 0?64:i,o=t.sizeType,a=o===void 0?"area":o,l=swe(t,twe),u=e9(e9({},l),{},{type:n,size:s,sizeType:a}),h=function(){var m=lwe(n),x=BSe().type(m).size(cwe(s,a,n));return x()},d=u.className,p=u.cx,v=u.cy,w=yt(u,!0);return p===+p&&v===+v&&s===+s?se.createElement("path",nR({},w,{className:Lt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(v,")"),d:h()})):null};vM.registerSymbol=uwe;function Rh(e){"@babel/helpers - typeof";return Rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(e)}function iR(){return iR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},iR.apply(this,arguments)}function t9(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dwe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t9(Object(r),!0).forEach(function(n){Bg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t9(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hwe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,iY(n.key),n)}}function pwe(e,t,r){return t&&hwe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mwe(e,t,r){return t=R_(t),gwe(e,nY()?Reflect.construct(t,r||[],R_(e).constructor):t.apply(e,r))}function gwe(e,t){if(t&&(Rh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vwe(e)}function vwe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nY=function(){return!!e})()}function R_(e){return R_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},R_(e)}function ywe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sR(e,t)}function sR(e,t){return sR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},sR(e,t)}function Bg(e,t,r){return t=iY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iY(e){var t=bwe(e,"string");return Rh(t)=="symbol"?t:t+""}function bwe(e,t){if(Rh(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ws=32,yM=(function(e){function t(){return fwe(this,t),mwe(this,t,arguments)}return ywe(t,e),pwe(t,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,s=Ws/2,o=Ws/6,a=Ws/3,l=n.inactive?i:n.color;if(n.type==="plainline")return se.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:s,x2:Ws,y2:s,className:"recharts-legend-icon"});if(n.type==="line")return se.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(s,"h").concat(a,`
|
|
45
|
+
`}}),!1):!0);const o=n.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:r,data:u}})}),a=()=>{this.setLastFocusedTerminal(r)};n.textarea?.addEventListener("focus",a),i?.onAttached&&(e.terminalsReadyForCallback.has(r)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:r}),e.terminalsReadyForCallback.delete(r),setTimeout(()=>i.onAttached?.(r),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:r,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(r,i.onAttached)));const l=()=>{o.dispose(),n.textarea?.removeEventListener("focus",a),e.terminals.get(r)?.setXterm(null)};return s.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:r}}),l},requestAttach(r){t().send({type:"terminal:attach",payload:{terminalId:r}})},clearTerminalBuffer(r){t().send({type:"terminal:clearBuffer",payload:{terminalId:r}})},assignTerminalToTab(r,n,i){t().send({type:"terminal:assignTab",payload:{terminalId:r,tabId:n,positionInTab:i}}),e.terminals.get(r)?.assignToTab(n,i)},createTab(r,n,i){const s=qA(),o=E8(),a=n??e.tabs.items.length,l={id:o,name:r,position:a,directory:i??null,createdAt:Date.now()},u=g8(e.tabs);e.tabs.add(l),u.stop(),e.tabs.get(o)?.setPending(!0),e.pendingUpdates.set(s,{entityType:"tab",tempId:o,inversePatches:u.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:r,position:n,directory:i,requestId:s,tempId:o}}),t().log.ws.debug("createTab optimistic",{requestId:s,tempId:o,name:r})},updateTab(r,n){t().send({type:"tab:update",payload:{tabId:r,...n}}),e.tabs.get(r)?.updateFromServer(n)},deleteTab(r){t().send({type:"tab:delete",payload:{tabId:r}}),e.tabs.remove(r),e.viewState.clearFocusedTerminalForTab(r)},reorderTab(r,n){t().send({type:"tab:reorder",payload:{tabId:r,position:n}}),e.tabs.get(r)?.setPosition(n)},handleMessage(r){const{type:n,payload:i}=r;switch(n){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:s,isNew:o,requestId:a,tempId:l}=i;if(a&&l){const u=e.pendingUpdates.get(a);if(u&&u.tempId===l){e.pendingUpdates.delete(a);const h=e.terminals.get(l);if(h){const d=h.xterm,p=e.onAttachedCallbacks.get(l),v=h.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:s.id,hasXterm:!!d,hasCallback:!!p,isNew:o}),v&&v(),h.setXterm(null),h.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),o){const w=e.terminals.items.findIndex(x=>x.id===l);w>=0&&b_(e.terminals.items[w]),e.terminals.add(s);const _=e.terminals.get(s.id);t().log.ws.info("terminal:created re-attaching xterm",{realId:s.id,hasRealTerminal:!!_,hasXterm:!!d,willAttach:!!(_&&d)}),_&&d?this.attachXterm(s.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:s.id}),e.onAttachedCallbacks.set(s.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(s.id);const m=e.terminalsPendingStartup.get(l);m&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(s.id,m),t().log.ws.debug("transferred pending startup",{tempId:l,realId:s.id})),t().log.ws.debug("terminal:created confirmed",{requestId:a,tempId:l,realId:s.id,xtermReattached:!!d,hasPendingStartup:!!m})}else{const w=e.terminals.items.findIndex(m=>m.id===l);w>=0&&b_(e.terminals.items[w]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(s.id)||e.terminals.add(s),e.terminals.get(s.id)&&d&&this.attachXterm(s.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:a,tempId:l,existingId:s.id,xtermReattached:!!d})}}break}}e.terminals.add(s),o&&e.newTerminalIds.add(s.id);break}case"terminal:destroyed":{const{terminalId:s}=i;e.terminals.remove(s),e.newTerminalIds.delete(s),e.terminalsReadyForCallback.delete(s),e.onAttachedCallbacks.delete(s);break}case"terminal:output":{const{terminalId:s,data:o}=i,a=e.terminals.get(s);a?.xterm?a.xterm.write(o):t().log.ws.warn("terminal:output but no xterm",{terminalId:s});break}case"terminal:attached":{const{terminalId:s,buffer:o}=i,a=e.terminals.get(s);t().log.ws.info("terminal:attached received",{terminalId:s,hasTerminal:!!a,hasXterm:!!a?.xterm,bufferLength:o?.length??0,hasCallback:e.onAttachedCallbacks.has(s),isReadyForCallback:e.terminalsReadyForCallback.has(s),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),a?.xterm&&(a.xterm.reset(),o&&a.xterm.write(o));const l=e.onAttachedCallbacks.get(s);l?(e.onAttachedCallbacks.delete(s),t().log.ws.debug("terminal:attached calling callback",{terminalId:s}),l(s)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:s}),e.terminalsReadyForCallback.add(s));break}case"terminal:bufferCleared":{const{terminalId:s}=i,o=e.terminals.get(s);o?.xterm&&o.xterm.reset();break}case"terminal:exit":{const{terminalId:s,exitCode:o}=i;e.terminals.get(s)?.markExited(o);break}case"terminal:renamed":{const{terminalId:s,name:o}=i;e.terminals.get(s)?.rename(o);break}case"terminal:tabAssigned":{const{terminalId:s,tabId:o,positionInTab:a}=i;e.terminals.get(s)?.assignToTab(o,a);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:s,requestId:o,tempId:a}=i;if(o&&a){const l=e.pendingUpdates.get(o);if(l&&l.tempId===a){e.pendingUpdates.delete(o),e.tabs.get(a)&&(e.tabs.remove(a),e.tabs.add(s),t().log.ws.debug("tab:created confirmed",{requestId:o,tempId:a,realId:s.id}));break}}e.tabs.add(s);break}case"tab:updated":{const{tabId:s,name:o,directory:a}=i;e.tabs.get(s)?.updateFromServer({name:o,directory:a});break}case"tab:deleted":{const{tabId:s}=i;e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s);break}case"tab:reordered":{const{tabId:s,position:o}=i;e.tabs.get(s)?.setPosition(o);break}case"terminal:error":{const{error:s,requestId:o,tempId:a}=i;if(o&&a){const l=e.pendingUpdates.get(o);if(l&&l.tempId===a){e.pendingUpdates.delete(o);for(let u=l.inversePatches.length-1;u>=0;u--)jg(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(a),e.terminalsPendingStartup.delete(a),t().log.ws.warn("terminal:error rollback",{requestId:o,tempId:a,error:s});break}}xt.ws.error("Terminal error from server",{error:s});break}case"sync:stale":{const{entityType:s,entityId:o,requestId:a,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:s,entityId:o,error:u}),a&&l){const h=e.pendingUpdates.get(a);if(h&&h.tempId===l)if(e.pendingUpdates.delete(a),h.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else h.entityType==="tab"&&e.tabs.remove(l)}if(s==="terminal"){if(e.terminals.has(o)){const h=e.terminals.get(o);h&&(h.cleanup(),e.terminals.remove(o))}e.terminalsPendingStartup.delete(o)}else s==="tab"&&e.tabs.has(o)&&(e.tabs.remove(o),e.viewState.clearFocusedTerminalForTab(o));break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function SK(){const e=b1e();return T.useMemo(()=>{const t=(r,n)=>{const i=async s=>{const o=s.clipboardData?.items;if(o){for(const a of o)if(a.type.startsWith("image/")){s.preventDefault(),s.stopPropagation();const l=a.getAsFile();if(!l)return;try{const u=await JV(l);e.writeToTerminal(n,u)}catch(u){xt.ws.error("Failed to upload image",{error:String(u)})}return}}};return r.addEventListener("paste",i,!0),()=>{r.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.items]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e)}},[e])}const wK=T.createContext(null);function b1e(){const e=T.useContext(wK);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function _1e(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function x1e({children:e,wsUrl:t=_1e(),reconnectInterval:r=2e3,maxReconnectAttempts:n=10}){const i=T.useRef(null),s=T.useRef(0),o=T.useRef(void 0),a=T.useRef(null),[,l]=T.useState({}),u=T.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(xt.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):xt.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!a.current){const d={send:u,log:xt};a.current=y1e.create({},d)}const h=a.current;return T.useEffect(()=>{let d=!0;const p=()=>{const v=i.current;if(v&&(v.readyState===WebSocket.CONNECTING||v.readyState===WebSocket.OPEN))return;const w=new WebSocket(t);i.current=w,w.onopen=()=>{d&&(xt.ws.info("WebSocket connected"),h.setConnected(!0),s.current=0)},w.onmessage=_=>{if(d)try{const m=JSON.parse(_.data);h.handleMessage(m)}catch(m){xt.ws.error("Failed to parse WebSocket message",{error:String(m)})}},w.onclose=()=>{if(d)if(xt.ws.info("WebSocket disconnected"),h.setConnected(!1),i.current===w&&(i.current=null),s.current<n){s.current++;const _=r*Math.pow(1.5,s.current-1);xt.ws.info("Scheduling reconnect",{attempt:s.current,delay:_}),o.current=setTimeout(p,_)}else xt.ws.warn("Max reconnect attempts reached")},w.onerror=_=>{xt.ws.error("WebSocket error",{event:String(_)})}};return p(),()=>{d=!1,o.current&&clearTimeout(o.current);const v=i.current;v?.readyState===WebSocket.OPEN&&v.close(),i.current=null}},[t,r,n,h]),T.useEffect(()=>{l({})},[]),y.jsx(wK.Provider,{value:h,children:e})}function O8(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function S1e(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Fs="all-tasks",k8=["IN_PROGRESS","IN_REVIEW"],T8="vibora:lastTerminalTab",w1e=Bye(function(){const{t}=Wt("terminals"),r=Ts(),{tab:n}=B1({from:"/terminals/"}),{terminals:i,tabs:s,connected:o,createTerminal:a,destroyTerminal:l,renameTerminal:u,assignTerminalToTab:h,createTab:d,updateTab:p,deleteTab:v,reorderTab:w,attachXterm:_,resizeTerminal:m,setupImagePaste:x,writeToTerminal:b,sendInputToTerminal:S}=SK(),[E,O]=T.useState(null),k=T.useMemo(()=>s.map(ae=>ae.id),[s]),R=n&&(k.includes(n)||n===Fs),A=R?n:s[0]?.id??null,j=T.useCallback(ae=>{r({to:"/terminals",search:{tab:ae},replace:!0})},[r]);T.useEffect(()=>{if(s.length>0&&!R){const ae=localStorage.getItem(T8),ge=ae&&(s.some(pe=>pe.id===ae)||ae===Fs)?ae:s[0].id;r({to:"/terminals",search:{tab:ge},replace:!0})}},[s,R,r]),T.useEffect(()=>{A&&localStorage.setItem(T8,A)},[A]);const{data:B=[],status:L}=Mj(),{data:z=[]}=Fv(),{data:D}=YW(),[V,H]=T.useState(null),$=T.useMemo(()=>{const ae=new Map;for(const ge of z)ae.set(ge.path,ge.id);return ae},[z]),F=T.useMemo(()=>new Set(B.filter(ae=>k8.includes(ae.status)&&ae.worktreePath).map(ae=>ae.worktreePath)),[B]),W=T.useMemo(()=>i.filter(ae=>ae.tabId!=null||ae.cwd&&F.has(ae.cwd)).length,[i,F]),N=T.useMemo(()=>new Set(B.filter(ae=>ae.worktreePath).map(ae=>ae.worktreePath)),[B]),q=T.useMemo(()=>{const ae=new Map;for(const ge of B)ge.worktreePath&&ae.set(ge.worktreePath,{taskId:ge.id,repoId:$.get(ge.repoPath),repoName:ge.repoName,title:ge.title,repoPath:ge.repoPath,worktreePath:ge.worktreePath,baseBranch:ge.baseBranch,branch:ge.branch,prUrl:ge.prUrl});return ae},[B,$]),I=T.useMemo(()=>{const ae=new Set(B.filter(ge=>k8.includes(ge.status)).map(ge=>ge.repoName));return Array.from(ae).sort()},[B]),U=T.useRef(new Map),Y=T.useRef(0),Q=T.useRef(!1),J=T.useRef(!1),re=T.useRef(null),X=3e4;T.useEffect(()=>{if(xt.terminalsView.debug("Orphan cleanup effect running",{worktreeBasePath:D,tasksStatus:L,taskCount:B.length,terminalCount:i.length,allTaskWorktreesSize:N.size}),!D){xt.terminalsView.debug("Orphan cleanup skipped: no worktreeBasePath");return}if(L!=="success"){xt.terminalsView.debug("Orphan cleanup skipped",{reason:`tasksStatus=${L}`});return}if(B.length===0){xt.terminalsView.debug("Orphan cleanup skipped: no tasks loaded (likely error or empty state)");return}for(const ae of i){if(ae.tabId)continue;const ge=Date.now()-ae.createdAt;if(ge<X){xt.terminalsView.debug("Orphan cleanup skipped: terminal too new",{terminalId:ae.id,name:ae.name,ageMs:ge,gracePeriodMs:X});continue}const pe=ae.cwd?.startsWith(D),Se=ae.cwd&&N.has(ae.cwd);pe&&!Se&&(xt.terminalsView.warn("DESTROYING ORPHAN TERMINAL",{terminalId:ae.id,name:ae.name,cwd:ae.cwd}),l(ae.id))}},[i,N,D,l,L,B.length]);const G=T.useMemo(()=>A===Fs?i.filter(ae=>ae.cwd&&F.has(ae.cwd)).filter(ae=>V?B.find(pe=>pe.worktreePath===ae.cwd)?.repoName===V:!0).sort((ae,ge)=>{const pe=B.find(Ce=>Ce.worktreePath===ae.cwd),Se=B.find(Ce=>Ce.worktreePath===ge.cwd);return!pe||!Se?0:new Date(Se.createdAt).getTime()-new Date(pe.createdAt).getTime()}).map(O8):i.filter(ae=>ae.tabId===A).sort((ae,ge)=>ae.positionInTab-ge.positionInTab).map(O8),[A,i,F,V,B]),Z=T.useCallback(()=>{if(xt.terminal.info("handleTerminalAdd called",{activeTabId:A,connected:o,pendingTerminalCreate:Q.current,terminalCount:i.length}),Q.current){xt.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,Y.current++;const ae=`Terminal ${Y.current}`,ge=i.filter(Se=>Se.tabId===A),pe=ge.length;xt.terminal.info("Creating terminal",{name:ae,tabId:A,positionInTab:pe,terminalsInTabCount:ge.length}),a({name:ae,cols:80,rows:24,tabId:A??void 0,positionInTab:pe}),setTimeout(()=>{Q.current=!1},500)},[a,A,i,o]);T.useEffect(()=>{if(L!=="success"){xt.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:L});return}for(const ae of i)ae.cwd&&N.has(ae.cwd)&&ae.tabId&&(xt.terminalsView.debug("Removing task terminal from regular tab",{terminalId:ae.id,name:ae.name,cwd:ae.cwd,tabId:ae.tabId}),h(ae.id,null))},[i,N,h,L]),T.useEffect(()=>{if(re.current!==null&&s.length>re.current){const ae=s.reduce((ge,pe)=>pe.position>ge.position?pe:ge);xt.terminal.debug("New tab detected, auto-opening",{tabId:ae.id,name:ae.name}),re.current=null,j(ae.id),setTimeout(()=>{Y.current++;const ge=`Terminal ${Y.current}`;xt.terminal.debug("Creating terminal in new tab",{tabId:ae.id,name:ge}),a({name:ge,cols:80,rows:24,tabId:ae.id,positionInTab:0})},100)}},[s,j,a]);const te=T.useCallback(ae=>{const ge=U.current.get(ae);ge&&(ge(),U.current.delete(ae)),l(ae,{force:!0,reason:"user_closed"})},[l]),ne=T.useCallback((ae,ge)=>{const pe=_(ae,ge);U.current.set(ae,pe)},[_]),ie=T.useCallback((ae,ge,pe)=>{m(ae,ge,pe)},[m]),me=T.useCallback((ae,ge)=>{u(ae,ge)},[u]),ye=T.useCallback(()=>{if(J.current){xt.terminal.debug("Skipping tab creation, already pending");return}J.current=!0,re.current=s.length;const ae=`Tab ${s.length+1}`;xt.terminal.debug("Quick creating tab",{name:ae}),d(ae,void 0,void 0),setTimeout(()=>{J.current=!1},500)},[d,s.length]),ue=T.useCallback((ae,ge)=>{xt.terminal.debug("Reordering tab",{tabId:ae,newPosition:ge}),w(ae,ge)},[w]),fe=T.useCallback((ae,ge)=>{if(J.current){xt.terminal.debug("Skipping tab creation, already pending");return}J.current=!0,re.current=s.length,xt.terminal.debug("Creating tab",{name:ae,directory:ge}),d(ae,void 0,ge),setTimeout(()=>{J.current=!1},500)},[d,s.length]),le=T.useCallback(ae=>{const ge=i.filter(pe=>pe.tabId===ae);for(const pe of ge){const Se=U.current.get(pe.id);Se&&(Se(),U.current.delete(pe.id))}v(ae)},[i,v]),je=s.map(S1e),Ee=T.useCallback(ae=>{O(ae)},[]),$e=T.useCallback((ae,ge)=>{p(ae,ge)},[p]);return y.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[y.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[y.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto",children:y.jsxs("div",{className:"flex items-center",children:[y.jsxs("button",{onClick:()=>j(Fs),className:Le("relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",A===Fs?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",A===Fs?"after:opacity-100":"after:opacity-0"),children:[y.jsx(he,{icon:vh,size:12,strokeWidth:2}),y.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),y.jsx("div",{className:"mx-2 h-4 w-px bg-border"}),y.jsx(k0e,{tabs:je,activeTabId:A??"",onTabSelect:j,onTabClose:le,onTabCreate:ye,onTabEdit:Ee,onTabReorder:ue})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[A===Fs&&I.length>1&&y.jsxs(Ti,{value:V??"",onValueChange:ae=>H(ae||null),children:[y.jsxs(Ri,{size:"sm",className:"max-sm:w-auto",children:[y.jsx(he,{icon:BV,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(Ai,{children:V||t("allRepos")})]}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"",children:t("allRepos")}),I.map(ae=>y.jsx(pr,{value:ae,children:ae},ae))]})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:Z,disabled:!o||W>=24||A===Fs,className:"max-sm:px-2 border-transparent text-primary",children:[y.jsx(he,{icon:sx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),y.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:y.jsx(Ibe,{terminals:G,onTerminalClose:A===Fs?void 0:te,onTerminalAdd:o&&A!==Fs?Z:void 0,onTerminalReady:ne,onTerminalResize:ie,onTerminalRename:A===Fs?void 0:me,setupImagePaste:x,writeToTerminal:b,sendInputToTerminal:S,taskInfoByCwd:A===Fs?q:void 0})}),y.jsx(T0e,{tab:E,open:E!==null,onOpenChange:ae=>{ae||O(null)},onSave:$e,onCreate:fe,defaultName:`Tab ${s.length+1}`})]})}),C1e=ao("/terminals/")({component:w1e,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0})});function E1e(){return{x:0,y:0}}function O1e(e){var t=e.render,r=e.nativeSetDragImage,n=e.getOffset,i=n===void 0?E1e:n,s=document.createElement("div");Object.assign(s.style,{position:"fixed",top:0,left:0,zIndex:zG,pointerEvents:"none"}),document.body.append(s);var o=t({container:s});queueMicrotask(function(){var u=i({container:s});if(Xv()){var h=s.getBoundingClientRect();if(h.width===0)return;s.style.left="-".concat(h.width-1e-4,"px")}r?.(s,u.x,u.y)});function a(){l(),o?.(),document.body.removeChild(s)}var l=WG({onDragStart:a,onDrop:a})}var k1e=Vd(function(){return Xv()&&"ontouchend"in document}),T1e=function(t){var r=t.container,n=r.getBoundingClientRect();return{x:n.width/2,y:n.height/2}};function A1e(e){return function(r){var n=r.container;if(k1e()||VG())return T1e({container:n});Object.assign(n.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(n);if(i.direction==="rtl"){var s=n.getBoundingClientRect();return{x:s.width,y:0}}return{x:0,y:0}}}const CK=T.createContext(null);function R1e({children:e}){const[t,r]=T.useState(null);return y.jsx(CK.Provider,{value:{activeTask:t,setActiveTask:r},children:e})}function EK(){const e=T.useContext(CK);if(!e)throw new Error("useDrag must be used within DragProvider");return e}function P1e(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function OK({task:e,open:t,onOpenChange:r}){const n=Lj(),i=GW(),[s,o]=T.useState(e.title),[a,l]=T.useState(!0),[u,h]=T.useState(e.description||""),[d,p]=T.useState(e.prUrl||""),[v,w]=T.useState(e.linearTicketUrl||"");T.useEffect(()=>{t&&(o(e.title),h(e.description||""),p(e.prUrl||""),w(e.linearTicketUrl||""),l(!0))},[t,e]);const _=()=>{const b={},S=s.trim();if(!S)return;S!==e.title&&(b.title=S);const E=u.trim();E!==(e.description||"")&&(b.description=E);const O=d.trim();O!==(e.prUrl||"")&&(b.prUrl=O||null);const k=v.trim();k!==(e.linearTicketUrl||"")&&(b.linearTicketUrl=k||null,b.linearTicketId=k?P1e(k):null),Object.keys(b).length>0&&n.mutate({taskId:e.id,updates:b}),r(!1)},m=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),_())},x=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:a},{onSuccess:()=>{r(!1)}})};return y.jsx(Ea,{open:t,onOpenChange:r,children:y.jsxs(Oa,{className:"sm:max-w-md",onKeyDown:m,children:[y.jsx(Pl,{children:y.jsx(jl,{children:"Task Settings"})}),y.jsxs(hl,{className:"mt-4",children:[y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-title",children:"Title"}),y.jsx(qt,{id:"config-title",value:s,onChange:b=>o(b.target.value),autoFocus:!0})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-description",children:"Description"}),y.jsx(tW,{id:"config-description",value:u,onValueChange:h,rows:3})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),y.jsx(qt,{id:"config-pr-url",value:d,onChange:b=>p(b.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),y.jsx(qt,{id:"config-linear-url",value:v,onChange:b=>w(b.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),y.jsxs(Bd,{className:"mt-4 flex-row justify-between sm:justify-between",children:[y.jsxs(Fc,{children:[y.jsx(Uc,{render:y.jsx(Ne,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),y.jsxs(Vc,{children:[y.jsxs(Wc,{children:[y.jsx(Gc,{children:"Delete Task"}),y.jsx(Kc,{children:"This will permanently delete this task. This action cannot be undone."})]}),y.jsxs("div",{className:"flex items-center gap-2 py-2",children:[y.jsx(ya,{id:"delete-worktree",checked:a,onCheckedChange:b=>l(b===!0)}),y.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),y.jsxs(qc,{children:[y.jsx(Yc,{children:"Cancel"}),y.jsx(aq,{onClick:x,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Ne,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),y.jsx(Ne,{onClick:_,disabled:!s.trim(),children:"Save"})]})]})]})})}function kK({task:e,isDragPreview:t}){const{setActiveTask:r}=EK(),n=Ts(),i=T.useRef(null),[s,o]=T.useState(!1),[a,l]=T.useState(null),[u,h]=T.useState(null),[d,p]=T.useState(!1),v=T.useRef(!1);T.useEffect(()=>{const x=i.current;if(!(!x||t))return Qv(qG({element:x,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:b})=>{O1e({nativeSetDragImage:b,getOffset:A1e({x:"16px",y:"8px"}),render:({container:S})=>{h(S)}})},onDragStart:()=>{o(!0),r(e),v.current=!0},onDrop:()=>{o(!1),r(null),h(null)}}),Px({element:x,getData:({input:b,element:S})=>{const E={type:"task",taskId:e.id,status:e.status};return KG(E,{input:b,element:S,allowedEdges:["top","bottom"]})},canDrop:({source:b})=>b.data.taskId!==e.id,onDragEnter:({self:b})=>{l(ih(b.data))},onDrag:({self:b})=>{l(ih(b.data))},onDragLeave:()=>{l(null)},onDrop:()=>{l(null)}}))},[e,t,r]);const w=()=>{v.current=!1},_=()=>{v.current||n({to:"/tasks/$taskId",params:{taskId:e.id}}),v.current=!1},m=y.jsxs(Qi,{ref:t?void 0:i,onPointerDown:w,onClick:_,className:Le("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",s&&"opacity-50"),children:[a&&y.jsx("div",{className:Le("absolute left-0 right-0 h-0.5 bg-primary z-10",a==="top"&&"-top-1",a==="bottom"&&"-bottom-1")}),y.jsxs(xge,{className:"p-3 pb-1 flex flex-row items-start justify-between gap-2",children:[y.jsx(Sge,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&y.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:x=>{x.stopPropagation(),p(!0)},onPointerDown:x=>x.stopPropagation(),children:y.jsx(he,{icon:gj,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),y.jsxs(mp,{className:"p-3 pt-1",children:[e.description&&y.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),y.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[y.jsx(he,{icon:pi,size:12,strokeWidth:2}),y.jsx("span",{children:e.repoName}),e.prUrl&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(he,{icon:s_,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(he,{icon:vj,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]});return y.jsxs(y.Fragment,{children:[m,u&&hn.createPortal(y.jsx("div",{className:"w-72 max-w-[90vw]",children:y.jsx(kK,{task:e,isDragPreview:!0})}),u),y.jsx(OK,{task:e,open:d,onOpenChange:p})]})}const j1e={IN_PROGRESS:"border-t-[#8d909b]",IN_REVIEW:"border-t-[#2a2a27] dark:border-t-[#faf9f5]",DONE:"border-t-[#0d5c63]",CANCELED:"border-t-[#dd403a]"};function A8({status:e,tasks:t,isMobile:r}){const{t:n}=Wt("common"),i=T.useRef(null),[s,o]=T.useState(!1),a=[...t].sort((l,u)=>u.position-l.position);return T.useEffect(()=>{const l=i.current;if(l)return Px({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>o(!0),onDragLeave:()=>o(!1),onDrop:()=>o(!1)})},[e]),y.jsxs("div",{ref:i,className:Le("flex flex-col rounded-lg border border-t-4 bg-card",r?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",j1e[e],s&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!r&&y.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[y.jsx("h3",{className:"text-sm font-medium",children:n(`statuses.${e}`)}),y.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),y.jsx(bh,{className:"min-h-0 flex-1",children:y.jsx("div",{className:"flex flex-col gap-2 p-2",children:a.map(l=>y.jsx(kK,{task:l},l.id))})})]})}const EE=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function M1e({status:e}){const{t}=Wt("common"),r=T.useRef(null),[n,i]=T.useState(!1);return T.useEffect(()=>{const s=r.current;if(s)return Px({element:s,getData:()=>({type:"column",status:e}),canDrop:({source:o})=>o.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),y.jsx("div",{ref:r,className:Le("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",n?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function L1e({repoFilter:e,searchQuery:t}){const{t:r}=Wt("common"),{data:n=[],isLoading:i}=Mj(),s=Jfe(),{activeTask:o}=EK(),[a,l]=T.useState("IN_PROGRESS"),u=T.useMemo(()=>{let d=n;return e&&(d=d.filter(p=>p.repoName===e)),t?.trim()?d=d.map(p=>({task:p,score:Math.max(Vu(p.title,t),Vu(p.description||"",t),Vu(p.branch||"",t),Vu(p.linearTicketId||"",t),Vu(p.prUrl||"",t))})).filter(({score:p})=>p>0).sort((p,v)=>v.score-p.score).map(({task:p})=>p):d=[...d].sort((p,v)=>new Date(v.createdAt).getTime()-new Date(p.createdAt).getTime()),d},[n,e,t]),h=T.useMemo(()=>{const d={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const p of u)d[p.status]++;return d},[u]);return T.useEffect(()=>WG({canMonitor:({source:d})=>d.data.type==="task",onDrop:({source:d,location:p})=>{const v=p.current.dropTargets;if(v.length===0)return;const w=d.data.taskId,_=u.find(b=>b.id===w);if(!_)return;const m=v[0],x=m.data;if(x.type==="column"){const b=x.status;if(b!==_.status){const S=u.filter(E=>E.status===b);s.mutate({taskId:w,status:b,position:S.length})}}else if(x.type==="task"){const b=ih(m.data),S=x.status,E=u.filter(R=>R.status===S).sort((R,A)=>R.position-A.position),O=E.findIndex(R=>R.id===x.taskId);let k=O;b==="bottom"&&(k=O+1),_.status===S&&E.findIndex(A=>A.id===w)<O&&(k=Math.max(0,k-1)),(_.status!==S||k!==_.position)&&s.mutate({taskId:w,status:S,position:k})}}}),[u,s]),i?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"border-b bg-background lg:hidden",children:y.jsx(Ic,{value:a,onValueChange:d=>l(d),children:y.jsx(Nc,{variant:"line",className:"w-full justify-start px-4",children:EE.map(d=>y.jsxs(ui,{value:d,className:"gap-1.5",children:[y.jsx("span",{className:"truncate",children:r(`statuses.${d}`)}),y.jsx("span",{className:"text-muted-foreground",children:h[d]})]},d))})})}),y.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:EE.map(d=>y.jsx(A8,{status:d,tasks:u.filter(p=>p.status===d)},d))}),y.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:y.jsx(A8,{status:a,tasks:u.filter(d=>d.status===a),isMobile:!0})}),o&&y.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:EE.filter(d=>d!==a).map(d=>y.jsx(M1e,{status:d},d))})]})}function D1e(e){return y.jsx(R1e,{children:y.jsx(L1e,{...e})})}const TK=ao("/tasks/")({component:I1e,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function I1e(){const{t:e}=Wt("tasks"),{data:t=[]}=Mj(),{repo:r}=TK.useSearch(),n=Ts(),[i,s]=T.useState(""),o=T.useCallback(l=>{n({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[n]),a=T.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"relative flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2",children:[y.jsx(he,{icon:HV,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(qt,{value:i,onChange:l=>s(l.target.value),placeholder:e("searchPlaceholder"),className:"w-64 pl-6"})]}),y.jsx("div",{className:"ml-auto",children:y.jsxs(Ti,{value:r??"",onValueChange:l=>o(l||null),children:[y.jsxs(Ri,{size:"sm",className:"max-sm:w-auto gap-1.5",children:[y.jsx(he,{icon:BV,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(Ai,{children:r??e("allRepos")})]}),y.jsxs(Pi,{className:"min-w-[160px]",children:[y.jsx(pr,{value:"",children:e("allRepos")}),a.map(l=>y.jsx(pr,{value:l,children:l},l))]})]})})]}),y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(D1e,{repoFilter:r??null,searchQuery:i})})]})}function ol({className:e,size:t="default",...r}){return y.jsx(Rfe,{"data-slot":"switch","data-size":t,className:Le("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...r,children:y.jsx(Pfe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const N1e=ao("/settings/")({component:B1e});function il({title:e,children:t}){return y.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[y.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function B1e(){const{t:e}=Wt("settings"),{t}=Wt("common"),{data:r,isLoading:n}=KW(),{data:i,isLoading:s}=gx(),{data:o,isLoading:a}=vx(),{data:l,isLoading:u}=yx(),{data:h,isLoading:d}=bx(),{data:p,isLoading:v}=ahe(),{data:w,isLoading:_}=lhe(),{data:m,isLoading:x}=phe(),{data:b,isLoading:S}=mhe(),{data:E,isLoading:O}=vhe(),{data:k,isLoading:R}=_he(),{data:A}=XW(),j=She(),{savedLanguage:B,changeLanguage:L}=JW(),{theme:z,syncClaudeCode:D,changeTheme:V}=eq(),{data:H}=fhe(),{data:$}=hhe(),F=Dj(),W=ghe(),N=yhe(),q=xhe(),I=bhe(),[U,Y]=T.useState(""),[Q,J]=T.useState(""),[re,X]=T.useState("vscode"),[G,Z]=T.useState(""),[te,ne]=T.useState(""),[ie,me]=T.useState(""),[ye,ue]=T.useState(""),[fe,le]=T.useState(""),[je,Ee]=T.useState(""),[$e,ae]=T.useState(!1),[ge,pe]=T.useState(!1),[Se,Ce]=T.useState(!1),[qe,st]=T.useState(!1),[Re,Ve]=T.useState(!1),[Ge,vt]=T.useState(""),[Ke,Qe]=T.useState(!1),[Ae,ot]=T.useState(""),[ft,Je]=T.useState(!1),[lt,Ht]=T.useState(""),[pt,Rr]=T.useState(""),[Dt,Tt]=T.useState(!1),[tt,Gt]=T.useState(""),[rr,mt]=T.useState("glm-4.5-air"),[It,Rt]=T.useState("glm-4.7"),[Pt,rt]=T.useState("glm-4.7"),[nr,en]=T.useState(!1),[un,pn]=T.useState("light-ansi"),[yi,Ma]=T.useState("dark-ansi"),[Vn,Vr]=T.useState(!1),[Xr,Ii]=T.useState(!1),[ii,Rs]=T.useState(!1),Bl=T.useRef(null);T.useEffect(()=>{r!==void 0&&Y(String(r)),i!==void 0&&J(i),o!==void 0&&X(o),l!==void 0&&Z(l),h!==void 0&&ne(String(h)),p!==void 0&&me(p),w!==void 0&&ue(w),m!==void 0&&le(m)},[r,i,o,l,h,p,w,m]),T.useEffect(()=>{E&&(Ce(E.enabled),st(E.sound?.enabled??!1),Ii(!!E.sound?.customSoundFile),Ve(E.slack?.enabled??!1),vt(E.slack?.webhookUrl??""),Qe(E.discord?.enabled??!1),ot(E.discord?.webhookUrl??""),Je(E.pushover?.enabled??!1),Ht(E.pushover?.appToken??""),Rr(E.pushover?.userKey??""))},[E]),T.useEffect(()=>{k&&(Tt(k.enabled),Gt(k.apiKey??""),mt(k.haikuModel),Rt(k.sonnetModel),rt(k.opusModel))},[k]),T.useEffect(()=>{D!==void 0&&en(D),H!==void 0&&pn(H),$!==void 0&&Ma($)},[D,H,$]);const kt=n||s||a||u||d||v||_||x||S||O||R,Uo=k&&(Dt!==k.enabled||tt!==(k.apiKey??"")||rr!==k.haikuModel||It!==k.sonnetModel||Pt!==k.opusModel),Vo=nr!==(D??!1)||un!==H||yi!==$,Ps=E&&(Se!==E.enabled||qe!==(E.sound?.enabled??!1)||Re!==(E.slack?.enabled??!1)||Ge!==(E.slack?.webhookUrl??"")||Ke!==(E.discord?.enabled??!1)||Ae!==(E.discord?.webhookUrl??"")||ft!==(E.pushover?.enabled??!1)||lt!==(E.pushover?.appToken??"")||pt!==(E.pushover?.userKey??"")),js=fe!==m||je!=="",La=re!==o||G!==l||te!==String(h),os=U!==String(r)||Q!==i||ie!==p||ye!==w||js||La||Ps||Uo||Vo,tn=async()=>{const Me=[];if(U!==String(r)){const wt=parseInt(U,10);!isNaN(wt)&&wt>=1&&wt<=65535&&Me.push(new Promise(oi=>{F.mutate({key:Ut.PORT,value:wt},{onSettled:oi})}))}if(Q!==i&&Me.push(new Promise(wt=>{F.mutate({key:Ut.DEFAULT_GIT_REPOS_DIR,value:Q},{onSettled:wt})})),re!==o&&Me.push(new Promise(wt=>{F.mutate({key:Ut.EDITOR_APP,value:re},{onSettled:wt})})),G!==l&&Me.push(new Promise(wt=>{F.mutate({key:Ut.EDITOR_HOST,value:G},{onSettled:wt})})),te!==String(h)){const wt=parseInt(te,10);!isNaN(wt)&&wt>=1&&wt<=65535&&Me.push(new Promise(oi=>{F.mutate({key:Ut.EDITOR_SSH_PORT,value:wt},{onSettled:oi})}))}ie!==p&&Me.push(new Promise(wt=>{F.mutate({key:Ut.LINEAR_API_KEY,value:ie},{onSettled:wt})})),ye!==w&&Me.push(new Promise(wt=>{F.mutate({key:Ut.GITHUB_PAT,value:ye},{onSettled:wt})})),fe!==m&&Me.push(new Promise(wt=>{F.mutate({key:Ut.BASIC_AUTH_USERNAME,value:fe},{onSettled:wt})})),je!==""&&(Me.push(new Promise(wt=>{F.mutate({key:Ut.BASIC_AUTH_PASSWORD,value:je},{onSettled:wt})})),Ee("")),Ps&&Me.push(new Promise(wt=>{N.mutate({enabled:Se,sound:{enabled:qe},slack:{enabled:Re,webhookUrl:Ge},discord:{enabled:Ke,webhookUrl:Ae},pushover:{enabled:ft,appToken:lt,userKey:pt}},{onSettled:wt})})),Uo&&Me.push(new Promise(wt=>{q.mutate({enabled:Dt,apiKey:tt||null,haikuModel:rr,sonnetModel:It,opusModel:Pt},{onSettled:wt})})),Vo&&(nr!==(D??!1)&&Me.push(new Promise(wt=>{F.mutate({key:Ut.SYNC_CLAUDE_CODE_THEME,value:nr},{onSettled:wt})})),un!==H&&Me.push(new Promise(wt=>{F.mutate({key:Ut.CLAUDE_CODE_LIGHT_THEME,value:un},{onSettled:wt})})),yi!==$&&Me.push(new Promise(wt=>{F.mutate({key:Ut.CLAUDE_CODE_DARK_THEME,value:yi},{onSettled:wt})}))),await Promise.all(Me),pe(!0),setTimeout(()=>pe(!1),2e3)},Wn=()=>{W.mutate(Ut.PORT,{onSuccess:Me=>{Me.value!==null&&Y(String(Me.value))}})},qn=()=>{W.mutate(Ut.DEFAULT_GIT_REPOS_DIR,{onSuccess:Me=>{Me.value&&J(String(Me.value))}})},bi=()=>{W.mutate(Ut.EDITOR_APP,{onSuccess:Me=>{Me.value!==null&&Me.value!==void 0&&X(Me.value)}})},as=()=>{W.mutate(Ut.EDITOR_HOST,{onSuccess:Me=>{Z(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},Pp=()=>{W.mutate(Ut.EDITOR_SSH_PORT,{onSuccess:Me=>{Me.value!==null&&Me.value!==void 0&&ne(String(Me.value))}})},$l=()=>{W.mutate(Ut.LINEAR_API_KEY,{onSuccess:Me=>{me(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},zl=()=>{W.mutate(Ut.GITHUB_PAT,{onSuccess:Me=>{ue(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},jp=()=>{W.mutate(Ut.BASIC_AUTH_USERNAME,{onSuccess:Me=>{le(Me.value!==null&&Me.value!==void 0?String(Me.value):"")}})},mo=()=>{W.mutate(Ut.BASIC_AUTH_PASSWORD,{onSuccess:()=>{Ee("")}})},ls=async Me=>{I.mutate(Me,{onSuccess:wt=>{wt.success?Jt.success(e("notifications.testSuccess",{channel:Me})):Jt.error(e("notifications.testFailed",{channel:Me,error:wt.error}))},onError:wt=>{Jt.error(e("notifications.testFailed",{channel:Me,error:wt.message}))}})},_i=async Me=>{const wt=Me.target.files?.[0];if(wt){Rs(!0);try{const oi=new FormData;oi.append("file",wt);const Ms=await fetch("/api/uploads/sound",{method:"POST",body:oi});if(!Ms.ok){const xi=await Ms.json();throw new Error(xi.error||"Upload failed")}Ii(!0),Jt.success(e("notifications.soundUploaded"))}catch(oi){Jt.error(e("notifications.soundUploadFailed",{error:oi instanceof Error?oi.message:"Unknown error"}))}finally{Rs(!1),Bl.current&&(Bl.current.value="")}}},si=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");Ii(!1),Jt.success(e("notifications.soundDeleted"))}catch{Jt.error(e("notifications.soundDeleteFailed"))}};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:y.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),y.jsx("div",{className:"flex-1 overflow-auto p-6",children:y.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[y.jsx(il,{title:e("sections.server"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(qt,{type:"number",min:1,max:65535,value:U,onChange:Me=>Y(Me.target.value),placeholder:"7777",disabled:kt,className:"w-24 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Wn,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),y.jsx(il,{title:e("sections.paths"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:Q,onChange:Me=>J(Me.target.value),placeholder:"~/projects",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ae(!0),disabled:kt,title:t("buttons.browse"),children:y.jsx(he,{icon:pi,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:qn,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),y.jsx(il,{title:e("sections.authentication"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.username")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:fe,onChange:Me=>le(Me.target.value),placeholder:e("fields.auth.usernamePlaceholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:jp,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]})}),y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.password")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:je,onChange:Me=>Ee(Me.target.value),placeholder:e(b?"fields.auth.passwordSet":"fields.auth.passwordPlaceholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:mo,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]})}),y.jsx("p",{className:"text-xs text-muted-foreground",children:e("fields.auth.description")})]})}),y.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[y.jsx(il,{title:e("sections.editor"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs(Ti,{value:re,onValueChange:Me=>X(Me),children:[y.jsx(Ri,{className:"w-32",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"vscode",children:"VS Code"}),y.jsx(pr,{value:"cursor",children:"Cursor"}),y.jsx(pr,{value:"windsurf",children:"Windsurf"}),y.jsx(pr,{value:"zed",children:"Zed"})]})]}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:bi,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{value:G,onChange:Me=>Z(Me.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:as,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(qt,{type:"number",min:1,max:65535,value:te,onChange:Me=>ne(Me.target.value),placeholder:"22",disabled:kt,className:"w-20 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Pp,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),y.jsx(il,{title:e("sections.integrations"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:ie,onChange:Me=>me(Me.target.value),placeholder:"lin_api_...",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:$l,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(qt,{type:"password",value:ye,onChange:Me=>ue(Me.target.value),placeholder:"ghp_...",disabled:kt,className:"flex-1 font-mono text-sm"}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:zl,disabled:kt||W.isPending,title:t("buttons.reset"),children:y.jsx(he,{icon:tl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),y.jsx(il,{title:e("sections.zai"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),y.jsx(ol,{checked:Dt,onCheckedChange:Tt,disabled:kt})]}),Dt&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),y.jsx(qt,{type:"password",value:tt,onChange:Me=>Gt(Me.target.value),placeholder:"zai_...",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),y.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[y.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),y.jsx(qt,{value:rr,onChange:Me=>mt(Me.target.value),placeholder:"glm-4.5-air",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),y.jsx(qt,{value:It,onChange:Me=>Rt(Me.target.value),placeholder:"glm-4.7",disabled:kt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),y.jsx(qt,{value:Pt,onChange:Me=>rt(Me.target.value),placeholder:"glm-4.7",disabled:kt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),y.jsx(il,{title:e("sections.notifications"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),y.jsx(ol,{checked:Se,onCheckedChange:Ce,disabled:kt})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:qe,onCheckedChange:st,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),y.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[y.jsx("input",{ref:Bl,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:_i}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Bl.current?.click(),disabled:kt||!Se||!qe||ii,title:e("notifications.uploadSound"),children:ii?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:wce,size:14,strokeWidth:2})}),Xr&&y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:si,disabled:kt||!Se||!qe,title:e("notifications.deleteSound"),children:y.jsx(he,{icon:hp,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("sound"),disabled:kt||!Se||!qe||I.isPending,title:e("notifications.testSound"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]})]}),Xr&&y.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:Re,onCheckedChange:Ve,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("slack"),disabled:kt||!Se||!Re||!Ge||I.isPending,title:e("notifications.slack"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),Re&&y.jsx(qt,{type:"password",value:Ge,onChange:Me=>vt(Me.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:kt||!Se,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:Ke,onCheckedChange:Qe,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("discord"),disabled:kt||!Se||!Ke||!Ae||I.isPending,title:e("notifications.discord"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),Ke&&y.jsx(qt,{type:"password",value:Ae,onChange:Me=>ot(Me.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:kt||!Se,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ol,{checked:ft,onCheckedChange:Je,disabled:kt||!Se}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),y.jsx(Ne,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ls("pushover"),disabled:kt||!Se||!ft||!lt||!pt||I.isPending,title:e("notifications.pushover"),children:I.isPending?y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(he,{icon:Hb,size:14,strokeWidth:2})})]}),ft&&y.jsxs("div",{className:"ml-6 space-y-2",children:[y.jsx(qt,{type:"password",value:lt,onChange:Me=>Ht(Me.target.value),placeholder:e("notifications.appToken"),disabled:kt||!Se,className:"flex-1 font-mono text-sm"}),y.jsx(qt,{type:"password",value:pt,onChange:Me=>Rr(Me.target.value),placeholder:e("notifications.userKey"),disabled:kt||!Se,className:"flex-1 font-mono text-sm"})]})]})]})}),y.jsx(il,{title:e("sections.appearance"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),y.jsxs(Ti,{value:B??"auto",onValueChange:Me=>L(Me==="auto"?null:Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"auto",children:e("fields.language.options.auto")}),y.jsx(pr,{value:"en",children:e("fields.language.options.en")}),y.jsx(pr,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),y.jsxs(Ti,{value:z??"system",onValueChange:Me=>V(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"system",children:e("fields.theme.options.system")}),y.jsx(pr,{value:"light",children:e("fields.theme.options.light")}),y.jsx(pr,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),y.jsx(ol,{checked:nr,onCheckedChange:en})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),nr&&y.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),y.jsxs(Ti,{value:un,onValueChange:Me=>pn(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:h4.filter(Me=>Me.startsWith("light")).map(Me=>y.jsx(pr,{value:Me,children:e(`fields.claudeCodeTheme.options.${Me}`)},Me))})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),y.jsxs(Ti,{value:yi,onValueChange:Me=>Ma(Me),children:[y.jsx(Ri,{className:"w-40",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:h4.filter(Me=>Me.startsWith("dark")).map(Me=>y.jsx(pr,{value:Me,children:e(`fields.claudeCodeTheme.options.${Me}`)},Me))})]})]})]})]})}),A?.enabled&&y.jsx(il,{title:e("sections.developer"),children:y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[y.jsx("div",{className:"flex-1",children:y.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>{const Me=A?.startedAt;Vr(!0),j.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Ms=0;Ms<120;Ms++){await new Promise(xi=>setTimeout(xi,500));try{const xi=await fetch("/api/config/developer-mode");if(xi.ok&&(await xi.json()).startedAt!==Me){window.location.reload();return}}catch{}}Vr(!1),Jt.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:wt=>{Vr(!1),Jt.error(e("developer.restartFailed"),{description:wt.message})}})},disabled:j.isPending||Vn,className:"shrink-0 gap-2",children:[(j.isPending||Vn)&&y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),e(Vn?"developer.restarting":"developer.restartButton")]})]})})})]})}),y.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:y.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[ge&&y.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[y.jsx(he,{icon:ou,size:12,strokeWidth:2}),t("status.saved")]}),y.jsx(Ne,{size:"sm",onClick:tn,disabled:!os||kt||F.isPending,children:t("buttons.save")})]})}),y.jsx(Uv,{open:$e,onOpenChange:ae,onSelect:Me=>J(Me),initialPath:Q||void 0})]})}const Dx="";function $1e(){return Dr({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${Dx}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function z1e(){return Dr({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${Dx}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function H1e(e,t,r){return Dr({queryKey:["github-issues",e,t,r],queryFn:async()=>{const n=new URLSearchParams({filter:e});t&&n.set("viboraReposOnly","true"),r&&n.set("org",r);const i=await fetch(`${Dx}/api/github/issues?${n}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function F1e(e,t,r){return Dr({queryKey:["github-prs",e,t,r],queryFn:async()=>{const n=new URLSearchParams({filter:e});t&&n.set("viboraReposOnly","true"),r&&n.set("org",r);const i=await fetch(`${Dx}/api/github/prs?${n}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function U1e({filter:e,viboraReposOnly:t,org:r}){const{t:n}=Wt("review"),{t:i}=Wt("common"),{data:s,isLoading:o,error:a}=H1e(e,t,r);if(o)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(he,{icon:sr,size:24,className:"animate-spin text-muted-foreground"})});if(a)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:fp,size:24}),y.jsx("p",{className:"text-sm",children:n("issues.failedToLoad")}),y.jsx("p",{className:"text-xs",children:a.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return s?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(s.length===1?"results.one":"results.other",{count:s.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(u=>y.jsx(V1e,{issue:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:ou,size:24}),y.jsx("p",{className:"text-sm",children:n(l[e])})]})}function V1e({issue:e}){return y.jsx(Qi,{className:"transition-colors hover:border-border/80",children:y.jsx(mp,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>y.jsx(pl,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&y.jsxs(pl,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function W1e({filter:e,viboraReposOnly:t,org:r}){const{t:n}=Wt("review"),{t:i}=Wt("common"),{data:s,isLoading:o,error:a}=F1e(e,t,r);if(o)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(he,{icon:sr,size:24,className:"animate-spin text-muted-foreground"})});if(a)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:fp,size:24}),y.jsx("p",{className:"text-sm",children:n("prs.failedToLoad")}),y.jsx("p",{className:"text-xs",children:a.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return s?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(s.length===1?"results.one":"results.other",{count:s.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(u=>y.jsx(q1e,{pr:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(he,{icon:ou,size:24}),y.jsx("p",{className:"text-sm",children:n(l[e])})]})}function q1e({pr:e}){const{t}=Wt("review");return y.jsx(Qi,{className:"transition-colors hover:border-border/80",children:y.jsx(mp,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&y.jsx(pl,{variant:"secondary",className:Le("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&y.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),y.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(r=>y.jsx(pl,{className:"text-xs",style:{backgroundColor:`#${r.color}20`,color:`#${r.color}`,borderColor:`#${r.color}40`},children:r.name},r.name)),e.labels.length>3&&y.jsxs(pl,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const G1e=ao("/review/")({component:K1e});function K1e(){const{t:e}=Wt("review"),[t,r]=T.useState("prs"),[n,i]=T.useState("review_requested"),[s,o]=T.useState("assigned"),[a,l]=T.useState(!1),[u,h]=T.useState(""),{data:d,isLoading:p}=$1e(),{data:v=[]}=z1e();return!p&&!d?y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:y.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[y.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:y.jsx(he,{icon:vce,size:24,className:"text-muted-foreground"})}),y.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),y.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),y.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[y.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),y.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:y.jsxs(Ne,{variant:"outline",size:"sm",className:"w-full",children:[y.jsx(he,{icon:yce,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),y.jsx(hi,{to:"/settings",children:y.jsx(Ne,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):y.jsx("div",{className:"flex h-full flex-col",children:y.jsxs(Ic,{value:t,onValueChange:w=>r(w),className:"flex flex-1 flex-col overflow-hidden",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-1 max-sm:px-2",children:[y.jsxs(Nc,{variant:"line",children:[y.jsx(ui,{value:"prs",children:e("tabs.pullRequests")}),y.jsx(ui,{value:"issues",children:e("tabs.issues")})]}),y.jsxs("div",{className:"flex items-center gap-4 max-sm:gap-2",children:[t==="prs"?y.jsxs(Ti,{value:n,onValueChange:w=>i(w),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"created",children:e("filters.pr.created")}),y.jsx(pr,{value:"assigned",children:e("filters.pr.assigned")}),y.jsx(pr,{value:"review_requested",children:e("filters.pr.reviewRequested")}),y.jsx(pr,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):y.jsxs(Ti,{value:s,onValueChange:w=>o(w),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"assigned",children:e("filters.issue.assigned")}),y.jsx(pr,{value:"created",children:e("filters.issue.created")}),y.jsx(pr,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),y.jsxs(Ti,{value:u,onValueChange:w=>h(w||""),children:[y.jsx(Ri,{size:"sm",className:"max-sm:w-auto",children:y.jsx(Ai,{children:u||e("filters.allOrgs")})}),y.jsxs(Pi,{children:[y.jsx(pr,{value:"",children:e("filters.allOrganizations")}),v.map(w=>y.jsx(pr,{value:w.login,children:w.login},w.login))]})]}),y.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",title:e("filters.viboraReposOnly"),children:[y.jsx(ol,{checked:a,onCheckedChange:l,disabled:!!u}),y.jsx("span",{className:"text-muted-foreground max-sm:hidden",children:e("filters.viboraReposOnly")})]})]})]}),y.jsx(Wi,{value:"prs",className:"flex-1 overflow-auto p-4",children:y.jsx(W1e,{filter:n,viboraReposOnly:a,org:u||void 0})}),y.jsx(Wi,{value:"issues",className:"flex-1 overflow-auto p-4",children:y.jsx(U1e,{filter:s,viboraReposOnly:a,org:u||void 0})})]})})}function Y1e(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function X1e(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function iM(e={}){const t=SK();return{get terminals(){return t.terminals.map(Y1e)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(X1e)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup}}function AK(){const e=Ts(),{tabs:t,createTab:r,createTerminal:n,connected:i}=iM(),s=T.useRef(null);return T.useEffect(()=>{if(xt.ws.debug("useOpenInTerminal: tabs effect",{hasPending:!!s.current,pendingDirectory:s.current?.directory,tabCount:t.length,tabDirectories:t.map(u=>u.directory)}),!s.current)return;const{directory:a}=s.current,l=t.find(u=>u.directory===a);xt.ws.debug("useOpenInTerminal: checking for matching tab",{directory:a,matchingTab:l?{id:l.id,name:l.name}:null}),l&&(s.current=null,xt.ws.info("useOpenInTerminal: creating terminal in tab",{tabId:l.id,directory:a}),n({name:"Terminal 1",cols:80,rows:24,tabId:l.id,positionInTab:0}),e({to:"/terminals",search:{tab:l.id}}))},[t,n,e]),{openInTerminal:T.useCallback((a,l)=>{if(xt.ws.info("useOpenInTerminal: openInTerminal called",{directory:a,name:l,connected:i,tabCount:t.length}),!i){xt.ws.warn("useOpenInTerminal: not connected, aborting");return}const u=t.find(h=>h.directory===a);if(xt.ws.debug("useOpenInTerminal: existing tab check",{directory:a,existingTab:u?{id:u.id,name:u.name}:null}),u){xt.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:u.id}),e({to:"/terminals",search:{tab:u.id}});return}xt.ws.info("useOpenInTerminal: creating new tab",{name:l,directory:a}),s.current={directory:a,name:l},r(l,void 0,a)},[i,t,r,e]),connected:i}}const Q1e={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function S_(e,t,r,n){const i=Q1e[t];if(!r)return`${i}://file${e}`;const s=n!==22?`${r}:${n}`:r;return`${i}://vscode-remote/ssh-remote+${s}${e}`}function RK(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}const PK="";function Z1e(e){return Dr({queryKey:["copier-questions",e],queryFn:()=>zt(`${PK}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function J1e(){const{data:e,...t}=Fv();return{...t,data:e?.filter(r=>r.isCopierTemplate)??[]}}function exe(){const e=Cn();return Yr({mutationFn:t=>zt(`${PK}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function txe(){const{t:e}=Wt("repositories"),t=Ts(),[r,n]=T.useState(!1),[i,s]=T.useState("template"),[o,a]=T.useState(!1),[l,u]=T.useState(!1),h=T.useRef(null),[d,p]=T.useState(""),[v,w]=T.useState(""),[_,m]=T.useState({}),[x,b]=T.useState(""),[S,E]=T.useState(""),[O,k]=T.useState(null),{data:R}=J1e(),{data:A}=gx(),j=d||v,{data:B,isLoading:L,error:z}=Z1e(i==="questions"||i==="output"?j:null),D=exe();T.useEffect(()=>{r&&(s("template"),p(""),w(""),m({}),b(A||""),E(""),k(null))},[r,A]),T.useEffect(()=>{B?.questions&&m(Q=>{const J={...Q};for(const re of B.questions)J[re.name]===void 0&&re.default!==void 0&&(J[re.name]=re.default);return J})},[B]);const V=T.useCallback(()=>{const Q=h.current;if(!Q)return;const J=Q.scrollHeight>Q.clientHeight&&Q.scrollTop+Q.clientHeight<Q.scrollHeight-10;u(J)},[]);T.useEffect(()=>{const Q=setTimeout(V,100);return()=>clearTimeout(Q)},[i,B,V]);const H=T.useCallback(()=>{V()},[V]),$=()=>{i==="template"?s("questions"):i==="questions"&&s("output")},F=()=>{i==="questions"?s("template"):i==="output"&&s("questions")},W=()=>{s("creating"),k(null),D.mutate({templateSource:j,outputPath:x,answers:_,projectName:S},{onSuccess:Q=>{n(!1),t({to:"/repositories/$repoId",params:{repoId:Q.repositoryId}})},onError:Q=>{k(Q.message),s("output")}})},N=Q=>{const J=_[Q.name],re=Z=>m(te=>({...te,[Q.name]:Z})),G=Q.default===void 0||typeof Q.default=="string"&&Q.default.includes("{{")?`${Q.name} *`:Q.name;switch(Q.type){case"bool":return y.jsxs(mr,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ya,{checked:J,onCheckedChange:re}),y.jsx(gr,{className:"cursor-pointer",children:G})]}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);case"int":case"float":return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),y.jsx(qt,{type:"number",value:J,onChange:Z=>re(Q.type==="int"?parseInt(Z.target.value):parseFloat(Z.target.value)),step:Q.type==="float"?"any":1}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);default:{if(Q.choices&&Q.choices.length>0)return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),y.jsxs(Ti,{value:String(J??""),onValueChange:re,children:[y.jsx(Ri,{className:"w-full",children:y.jsx(Ai,{})}),y.jsx(Pi,{children:Q.choices.map(te=>y.jsx(pr,{value:String(te.value),children:te.label},String(te.value)))})]}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name);const Z=Q.type==="yaml"||Q.type==="json";return y.jsxs(mr,{children:[y.jsx(gr,{children:G}),Z?y.jsx(fx,{value:String(J??""),onChange:te=>re(te.target.value),rows:4}):y.jsx(qt,{value:String(J??""),onChange:te=>re(te.target.value)}),Q.help&&y.jsx(Ei,{children:Q.help})]},Q.name)}}},q=!!j,I=B?.questions.filter(Q=>{if(Q.default!==void 0&&!(typeof Q.default=="string"&&Q.default.includes("{{")))return!1;const re=_[Q.name];return re==null||re===""})??[],U=B&&!L&&I.length===0,Y=S.trim()&&x.trim();return y.jsxs(y.Fragment,{children:[y.jsxs(Ea,{open:r,onOpenChange:n,children:[y.jsxs(xj,{render:y.jsx(Ne,{variant:"outline",size:"sm"}),children:[y.jsx(he,{icon:dce,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),y.jsxs(Oa,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[y.jsxs(Pl,{className:"shrink-0",children:[y.jsx(jl,{children:e("newProject.title")}),y.jsxs(Bv,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),y.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((Q,J)=>y.jsx("div",{className:Le("flex-1 h-1 rounded",i===Q||["template","questions","output"].indexOf(i)>J||i==="creating"?"bg-primary":"bg-muted")},Q))}),y.jsxs("div",{ref:h,onScroll:H,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&y.jsxs(hl,{children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.template.savedTemplates")}),y.jsxs(Ti,{value:d,onValueChange:Q=>{p(Q??""),w("")},children:[y.jsx(Ri,{className:"w-full",children:y.jsx(Ai,{children:d?R?.find(Q=>Q.id===d)?.displayName:y.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),y.jsx(Pi,{children:R?.map(Q=>y.jsx(pr,{value:Q.id,children:Q.displayName},Q.id))})]})]}),y.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.template.customUrl")}),y.jsx(qt,{value:v,onChange:Q=>{w(Q.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),y.jsx(Ei,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&y.jsxs(hl,{children:[L&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(he,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),z&&y.jsx("div",{className:"text-destructive text-sm py-4",children:z.message}),B?.questions.map(N),B&&B.questions.length===0&&y.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&y.jsxs(hl,{children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.output.projectName")}),y.jsx(qt,{value:S,onChange:Q=>E(Q.target.value),placeholder:"my-new-project"})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:e("newProject.steps.output.outputDirectory")}),y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>a(!0),children:[y.jsx(he,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),x||e("newProject.steps.output.selectDirectory")]})]}),S&&x&&y.jsxs(Ei,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",x,"/",S]}),O&&y.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:O})]}),i==="creating"&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[y.jsx(he,{icon:sr,size:32,strokeWidth:2,className:"animate-spin text-primary"}),y.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&y.jsx("div",{className:"flex justify-center py-1",children:y.jsx(he,{icon:pj,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),y.jsxs(Bd,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&y.jsxs(Ne,{variant:"outline",onClick:F,children:[y.jsx(he,{icon:DV,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&y.jsxs(Ne,{onClick:$,disabled:!q,children:[e("newProject.next"),y.jsx(he,{icon:K3,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&y.jsxs(Ne,{onClick:$,disabled:!U,children:[e("newProject.next"),y.jsx(he,{icon:K3,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&y.jsx(Ne,{onClick:W,disabled:!Y||D.isPending,children:e("newProject.create")})]})]})]}),y.jsx(Uv,{open:o,onOpenChange:a,onSelect:Q=>b(Q),initialPath:A||void 0})]})}const rxe=ao("/repositories/")({component:sxe});function nxe({repository:e,onDelete:t,onStartTask:r,onOpenInTerminal:n,onViewTasks:i}){const{t:s}=Wt("repositories"),[o,a]=T.useState(!1),[l,u]=T.useState(!1),{data:h}=vx(),{data:d}=yx(),{data:p}=bx(),v=()=>{const _=S_(e.path,h,d,p);window.open(_,"_blank")},w=async()=>{u(!0);try{await t(),a(!1)}catch{}finally{u(!1)}};return y.jsx(Qi,{className:"h-full",children:y.jsxs(mp,{className:"flex h-full flex-col gap-3 py-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("span",{className:"block truncate font-medium",children:e.displayName}),y.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[y.jsx(he,{icon:pi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]})]}),y.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[y.jsxs(Ne,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(he,{icon:yj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("newTask")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(he,{icon:vh,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("viewTasks")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",title:s("openInTerminal"),children:[y.jsx(he,{icon:sx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("terminal")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:v,className:"text-muted-foreground hover:text-foreground",title:s("openInEditor",{editor:RK(h)}),children:[y.jsx(he,{icon:bj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("editor")})]}),y.jsxs(Ne,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-foreground",title:s("settings"),render:y.jsx(hi,{to:"/repositories/$repoId",params:{repoId:e.id}}),children:[y.jsx(he,{icon:gj,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("settings")})]}),y.jsxs(Fc,{open:o,onOpenChange:a,children:[y.jsxs(Uc,{render:y.jsx(Ne,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:s("delete.button")}),children:[y.jsx(he,{icon:hp,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:s("delete.button")})]}),y.jsxs(Vc,{children:[y.jsxs(Wc,{children:[y.jsx(Gc,{children:s("delete.title")}),y.jsx(Kc,{children:s("delete.description",{name:e.displayName})})]}),y.jsxs(qc,{children:[y.jsx(Yc,{disabled:l,children:s("addModal.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:w,disabled:l,className:"gap-2",children:[l&&y.jsx(he,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),s(l?"delete.deleting":"delete.button")]})]})]})]})]})]})})}function ixe(){const{t:e}=Wt("repositories"),[t,r]=T.useState(!1),[n,i]=T.useState(!1),[s,o]=T.useState(""),[a,l]=T.useState(""),[u,h]=T.useState(""),[d,p]=T.useState(""),[v,w]=T.useState(!1),_=QW(),{data:m}=gx(),x=E=>{o(E),a||l(E.split("/").pop()||"")},b=E=>{E.preventDefault(),s.trim()&&_.mutate({path:s.trim(),displayName:a.trim()||s.split("/").pop()||"repo",startupScript:u.trim()||null,copyFiles:d.trim()||null,isCopierTemplate:v},{onSuccess:()=>{r(!1),o(""),l(""),h(""),p(""),w(!1)}})},S=s?s.split("/").pop():"";return y.jsxs(y.Fragment,{children:[y.jsxs(Ea,{open:t,onOpenChange:r,children:[y.jsxs(xj,{render:y.jsx(Ne,{size:"sm"}),children:[y.jsx(he,{icon:ox,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),y.jsx(Oa,{className:"sm:max-w-md",children:y.jsxs("form",{onSubmit:b,children:[y.jsxs(Pl,{children:[y.jsx(jl,{children:e("addModal.title")}),y.jsx(Bv,{children:e("addModal.description")})]}),y.jsxs(hl,{className:"mt-4",children:[y.jsxs(mr,{children:[y.jsx(gr,{children:e("addModal.fields.path")}),y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>i(!0),children:[y.jsx(he,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),S?y.jsx("span",{className:"truncate",children:s}):y.jsx("span",{className:"text-muted-foreground",children:e("addModal.fields.pathPlaceholder")})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"displayName",children:e("addModal.fields.displayName")}),y.jsx(qt,{id:"displayName",value:a,onChange:E=>l(E.target.value),placeholder:S||"My Project"})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"startupScript",children:e("addModal.fields.startupScript")}),y.jsx(fx,{id:"startupScript",value:u,onChange:E=>h(E.target.value),placeholder:e("addModal.fields.startupScriptPlaceholder"),rows:2}),y.jsx(Ei,{children:e("addModal.fields.startupScriptDescription")})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"copyFiles",children:e("addModal.fields.copyFiles")}),y.jsx(qt,{id:"copyFiles",value:d,onChange:E=>p(E.target.value),placeholder:e("addModal.fields.copyFilesPlaceholder")}),y.jsx(Ei,{children:e("addModal.fields.copyFilesDescription")})]}),y.jsxs(mr,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(ya,{checked:v,onCheckedChange:E=>w(E===!0)}),y.jsx(gr,{className:"cursor-pointer",children:e("addModal.fields.isCopierTemplate")})]}),y.jsx(Ei,{children:e("addModal.fields.isCopierTemplateDescription")})]})]}),y.jsxs(Bd,{className:"mt-4",children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline",type:"button"}),children:e("addModal.cancel")}),y.jsx(Ne,{type:"submit",disabled:_.isPending||!s.trim(),children:_.isPending?e("addModal.adding"):e("addRepository")})]})]})})]}),y.jsx(Uv,{open:n,onOpenChange:i,onSelect:x,initialPath:m||void 0})]})}function sxe(){const{t:e}=Wt("repositories"),t=Ts(),{data:r,isLoading:n,error:i}=Fv(),s=ZW(),[o,a]=T.useState(null),{openInTerminal:l}=AK(),u=async d=>{await s.mutateAsync(d)},h=d=>{t({to:"/tasks",search:{repo:d}})};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsx(txe,{}),y.jsx(ixe,{})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(he,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(he,{icon:fp,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!n&&!i&&r?.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:r?.map(d=>y.jsx(nxe,{repository:d,onDelete:()=>u(d.id),onStartTask:()=>a(d),onOpenInTerminal:()=>l(d.path,d.displayName),onViewTasks:()=>h(d.displayName)},d.id))})]}),y.jsx(Ij,{open:o!==null,onOpenChange:d=>!d&&a(null),defaultRepository:o??void 0,showTrigger:!1})]})}var OE,R8;function is(){if(R8)return OE;R8=1;var e=Array.isArray;return OE=e,OE}var kE,P8;function jK(){if(P8)return kE;P8=1;var e=typeof Sb=="object"&&Sb&&Sb.Object===Object&&Sb;return kE=e,kE}var TE,j8;function Pa(){if(j8)return TE;j8=1;var e=jK(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return TE=r,TE}var AE,M8;function Jv(){if(M8)return AE;M8=1;var e=Pa(),t=e.Symbol;return AE=t,AE}var RE,L8;function oxe(){if(L8)return RE;L8=1;var e=Jv(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function s(o){var a=r.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var h=n.call(o);return u&&(a?o[i]=l:delete o[i]),h}return RE=s,RE}var PE,D8;function axe(){if(D8)return PE;D8=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return PE=r,PE}var jE,I8;function Dl(){if(I8)return jE;I8=1;var e=Jv(),t=oxe(),r=axe(),n="[object Null]",i="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?i:n:s&&s in Object(a)?t(a):r(a)}return jE=o,jE}var ME,N8;function Il(){if(N8)return ME;N8=1;function e(t){return t!=null&&typeof t=="object"}return ME=e,ME}var LE,B8;function xp(){if(B8)return LE;B8=1;var e=Dl(),t=Il(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return LE=n,LE}var DE,$8;function sM(){if($8)return DE;$8=1;var e=is(),t=xp(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){if(e(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||t(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return DE=i,DE}var IE,z8;function fu(){if(z8)return IE;z8=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return IE=e,IE}var NE,H8;function oM(){if(H8)return NE;H8=1;var e=Dl(),t=fu(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!t(a))return!1;var l=e(a);return l==n||l==i||l==r||l==s}return NE=o,NE}var BE,F8;function lxe(){if(F8)return BE;F8=1;var e=Pa(),t=e["__core-js_shared__"];return BE=t,BE}var $E,U8;function cxe(){if(U8)return $E;U8=1;var e=lxe(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return $E=r,$E}var zE,V8;function MK(){if(V8)return zE;V8=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return zE=r,zE}var HE,W8;function uxe(){if(W8)return HE;W8=1;var e=oM(),t=cxe(),r=fu(),n=MK(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,l=o.toString,u=a.hasOwnProperty,h=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!r(p)||t(p))return!1;var v=e(p)?h:s;return v.test(n(p))}return HE=d,HE}var FE,q8;function dxe(){if(q8)return FE;q8=1;function e(t,r){return t?.[r]}return FE=e,FE}var UE,G8;function qd(){if(G8)return UE;G8=1;var e=uxe(),t=dxe();function r(n,i){var s=t(n,i);return e(s)?s:void 0}return UE=r,UE}var VE,K8;function Ix(){if(K8)return VE;K8=1;var e=qd(),t=e(Object,"create");return VE=t,VE}var WE,Y8;function fxe(){if(Y8)return WE;Y8=1;var e=Ix();function t(){this.__data__=e?e(null):{},this.size=0}return WE=t,WE}var qE,X8;function hxe(){if(X8)return qE;X8=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return qE=e,qE}var GE,Q8;function pxe(){if(Q8)return GE;Q8=1;var e=Ix(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(s){var o=this.__data__;if(e){var a=o[s];return a===t?void 0:a}return n.call(o,s)?o[s]:void 0}return GE=i,GE}var KE,Z8;function mxe(){if(Z8)return KE;Z8=1;var e=Ix(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var s=this.__data__;return e?s[i]!==void 0:r.call(s,i)}return KE=n,KE}var YE,J8;function gxe(){if(J8)return YE;J8=1;var e=Ix(),t="__lodash_hash_undefined__";function r(n,i){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=e&&i===void 0?t:i,this}return YE=r,YE}var XE,e6;function vxe(){if(e6)return XE;e6=1;var e=fxe(),t=hxe(),r=pxe(),n=mxe(),i=gxe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,XE=s,XE}var QE,t6;function yxe(){if(t6)return QE;t6=1;function e(){this.__data__=[],this.size=0}return QE=e,QE}var ZE,r6;function aM(){if(r6)return ZE;r6=1;function e(t,r){return t===r||t!==t&&r!==r}return ZE=e,ZE}var JE,n6;function Nx(){if(n6)return JE;n6=1;var e=aM();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return JE=t,JE}var eO,i6;function bxe(){if(i6)return eO;i6=1;var e=Nx(),t=Array.prototype,r=t.splice;function n(i){var s=this.__data__,o=e(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():r.call(s,o,1),--this.size,!0}return eO=n,eO}var tO,s6;function _xe(){if(s6)return tO;s6=1;var e=Nx();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return tO=t,tO}var rO,o6;function xxe(){if(o6)return rO;o6=1;var e=Nx();function t(r){return e(this.__data__,r)>-1}return rO=t,rO}var nO,a6;function Sxe(){if(a6)return nO;a6=1;var e=Nx();function t(r,n){var i=this.__data__,s=e(i,r);return s<0?(++this.size,i.push([r,n])):i[s][1]=n,this}return nO=t,nO}var iO,l6;function Bx(){if(l6)return iO;l6=1;var e=yxe(),t=bxe(),r=_xe(),n=xxe(),i=Sxe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,iO=s,iO}var sO,c6;function lM(){if(c6)return sO;c6=1;var e=qd(),t=Pa(),r=e(t,"Map");return sO=r,sO}var oO,u6;function wxe(){if(u6)return oO;u6=1;var e=vxe(),t=Bx(),r=lM();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return oO=n,oO}var aO,d6;function Cxe(){if(d6)return aO;d6=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return aO=e,aO}var lO,f6;function $x(){if(f6)return lO;f6=1;var e=Cxe();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return lO=t,lO}var cO,h6;function Exe(){if(h6)return cO;h6=1;var e=$x();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return cO=t,cO}var uO,p6;function Oxe(){if(p6)return uO;p6=1;var e=$x();function t(r){return e(this,r).get(r)}return uO=t,uO}var dO,m6;function kxe(){if(m6)return dO;m6=1;var e=$x();function t(r){return e(this,r).has(r)}return dO=t,dO}var fO,g6;function Txe(){if(g6)return fO;g6=1;var e=$x();function t(r,n){var i=e(this,r),s=i.size;return i.set(r,n),this.size+=i.size==s?0:1,this}return fO=t,fO}var hO,v6;function cM(){if(v6)return hO;v6=1;var e=wxe(),t=Exe(),r=Oxe(),n=kxe(),i=Txe();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,hO=s,hO}var pO,y6;function LK(){if(y6)return pO;y6=1;var e=cM(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],l=s.cache;if(l.has(a))return l.get(a);var u=n.apply(this,o);return s.cache=l.set(a,u)||l,u};return s.cache=new(r.Cache||e),s}return r.Cache=e,pO=r,pO}var mO,b6;function Axe(){if(b6)return mO;b6=1;var e=LK(),t=500;function r(n){var i=e(n,function(o){return s.size===t&&s.clear(),o}),s=i.cache;return i}return mO=r,mO}var gO,_6;function Rxe(){if(_6)return gO;_6=1;var e=Axe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(t,function(o,a,l,u){s.push(l?u.replace(r,"$1"):a||o)}),s});return gO=n,gO}var vO,x6;function uM(){if(x6)return vO;x6=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}return vO=e,vO}var yO,S6;function Pxe(){if(S6)return yO;S6=1;var e=Jv(),t=uM(),r=is(),n=xp(),i=e?e.prototype:void 0,s=i?i.toString:void 0;function o(a){if(typeof a=="string")return a;if(r(a))return t(a,o)+"";if(n(a))return s?s.call(a):"";var l=a+"";return l=="0"&&1/a==-1/0?"-0":l}return yO=o,yO}var bO,w6;function DK(){if(w6)return bO;w6=1;var e=Pxe();function t(r){return r==null?"":e(r)}return bO=t,bO}var _O,C6;function IK(){if(C6)return _O;C6=1;var e=is(),t=sM(),r=Rxe(),n=DK();function i(s,o){return e(s)?s:t(s,o)?[s]:r(n(s))}return _O=i,_O}var xO,E6;function zx(){if(E6)return xO;E6=1;var e=xp();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return xO=t,xO}var SO,O6;function dM(){if(O6)return SO;O6=1;var e=IK(),t=zx();function r(n,i){i=e(i,n);for(var s=0,o=i.length;n!=null&&s<o;)n=n[t(i[s++])];return s&&s==o?n:void 0}return SO=r,SO}var wO,k6;function NK(){if(k6)return wO;k6=1;var e=dM();function t(r,n,i){var s=r==null?void 0:e(r,n);return s===void 0?i:s}return wO=t,wO}var jxe=NK();const so=br(jxe);var CO,T6;function Mxe(){if(T6)return CO;T6=1;function e(t){return t==null}return CO=e,CO}var Lxe=Mxe();const Xt=br(Lxe);var EO,A6;function Dxe(){if(A6)return EO;A6=1;var e=Dl(),t=is(),r=Il(),n="[object String]";function i(s){return typeof s=="string"||!t(s)&&r(s)&&e(s)==n}return EO=i,EO}var Ixe=Dxe();const jd=br(Ixe);var Nxe=oM();const Ot=br(Nxe);var Bxe=fu();const Sp=br(Bxe);var OO={exports:{}},vr={};var R6;function $xe(){if(R6)return vr;R6=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function _(m){if(typeof m=="object"&&m!==null){var x=m.$$typeof;switch(x){case e:switch(m=m.type,m){case r:case i:case n:case u:case h:return m;default:switch(m=m&&m.$$typeof,m){case a:case o:case l:case p:case d:case s:return m;default:return x}}case t:return x}}}return vr.ContextConsumer=o,vr.ContextProvider=s,vr.Element=e,vr.ForwardRef=l,vr.Fragment=r,vr.Lazy=p,vr.Memo=d,vr.Portal=t,vr.Profiler=i,vr.StrictMode=n,vr.Suspense=u,vr.SuspenseList=h,vr.isAsyncMode=function(){return!1},vr.isConcurrentMode=function(){return!1},vr.isContextConsumer=function(m){return _(m)===o},vr.isContextProvider=function(m){return _(m)===s},vr.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===e},vr.isForwardRef=function(m){return _(m)===l},vr.isFragment=function(m){return _(m)===r},vr.isLazy=function(m){return _(m)===p},vr.isMemo=function(m){return _(m)===d},vr.isPortal=function(m){return _(m)===t},vr.isProfiler=function(m){return _(m)===i},vr.isStrictMode=function(m){return _(m)===n},vr.isSuspense=function(m){return _(m)===u},vr.isSuspenseList=function(m){return _(m)===h},vr.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===r||m===i||m===n||m===u||m===h||m===v||typeof m=="object"&&m!==null&&(m.$$typeof===p||m.$$typeof===d||m.$$typeof===s||m.$$typeof===o||m.$$typeof===l||m.$$typeof===w||m.getModuleId!==void 0)},vr.typeOf=_,vr}var P6;function zxe(){return P6||(P6=1,OO.exports=$xe()),OO.exports}var Hxe=zxe(),kO,j6;function BK(){if(j6)return kO;j6=1;var e=Dl(),t=Il(),r="[object Number]";function n(i){return typeof i=="number"||t(i)&&e(i)==r}return kO=n,kO}var TO,M6;function Fxe(){if(M6)return TO;M6=1;var e=BK();function t(r){return e(r)&&r!=+r}return TO=t,TO}var Uxe=Fxe();const wp=br(Uxe);var Vxe=BK();const Wxe=br(Vxe);var Ki=function(t){return t===0?0:t>0?1:-1},ed=function(t){return jd(t)&&t.indexOf("%")===t.length-1},Fe=function(t){return Wxe(t)&&!wp(t)},qxe=function(t){return Xt(t)},Dn=function(t){return Fe(t)||jd(t)},Gxe=0,ey=function(t){var r=++Gxe;return"".concat(t||"").concat(r)},To=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Fe(t)&&!jd(t))return n;var s;if(ed(t)){var o=t.indexOf("%");s=r*parseFloat(t.slice(0,o))/100}else s=+t;return wp(s)&&(s=n),i&&s>r&&(s=r),s},yc=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Kxe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i<r;i++)if(!n[t[i]])n[t[i]]=!0;else return!0;return!1},Oi=function(t,r){return Fe(t)&&Fe(r)?function(n){return t+n*(r-t)}:function(){return r}};function w_(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):so(n,t))===r})}var Yxe=function(t,r){return Fe(t)&&Fe(r)?t-r:jd(t)&&jd(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function sh(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function GA(e){"@babel/helpers - typeof";return GA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},GA(e)}var Xxe=["viewBox","children"],Qxe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],L6=["points","pathLength"],AO={svg:Xxe,polygon:L6,polyline:L6},fM=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],C_=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(T.isValidElement(t)&&(n=t.props),!Sp(n))return null;var i={};return Object.keys(n).forEach(function(s){fM.includes(s)&&(i[s]=r||function(o){return n[s](n,o)})}),i},Zxe=function(t,r,n){return function(i){return t(r,n,i),null}},eu=function(t,r,n){if(!Sp(t)||GA(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(s){var o=t[s];fM.includes(s)&&typeof o=="function"&&(i||(i={}),i[s]=Zxe(o,r,n))}),i},Jxe=["children"],eSe=["children"];function D6(e,t){if(e==null)return{};var r=tSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function KA(e){"@babel/helpers - typeof";return KA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},KA(e)}var I6={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},yl=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},N6=null,RO=null,hM=function e(t){if(t===N6&&Array.isArray(RO))return RO;var r=[];return T.Children.forEach(t,function(n){Xt(n)||(Hxe.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),RO=r,N6=t,r};function oo(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return yl(i)}):n=[yl(t)],hM(e).forEach(function(i){var s=so(i,"type.displayName")||so(i,"type.name");n.indexOf(s)!==-1&&r.push(i)}),r}function bs(e,t){var r=oo(e,t);return r&&r[0]}var B6=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!Fe(n)||n<=0||!Fe(i)||i<=0)},rSe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],nSe=function(t){return t&&t.type&&jd(t.type)&&rSe.indexOf(t.type)>=0},iSe=function(t){return t&&KA(t)==="object"&&"clipDot"in t},sSe=function(t,r,n,i){var s,o=(s=AO?.[i])!==null&&s!==void 0?s:[];return r.startsWith("data-")||!Ot(t)&&(i&&o.includes(r)||Qxe.includes(r))||n&&fM.includes(r)},yt=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(T.isValidElement(t)&&(i=t.props),!Sp(i))return null;var s={};return Object.keys(i).forEach(function(o){var a;sSe((a=i)===null||a===void 0?void 0:a[o],o,r,n)&&(s[o]=i[o])}),s},YA=function e(t,r){if(t===r)return!0;var n=T.Children.count(t);if(n!==T.Children.count(r))return!1;if(n===0)return!0;if(n===1)return $6(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var s=t[i],o=r[i];if(Array.isArray(s)||Array.isArray(o)){if(!e(s,o))return!1}else if(!$6(s,o))return!1}return!0},$6=function(t,r){if(Xt(t)&&Xt(r))return!0;if(!Xt(t)&&!Xt(r)){var n=t.props||{},i=n.children,s=D6(n,Jxe),o=r.props||{},a=o.children,l=D6(o,eSe);return i&&a?sh(s,l)&&YA(i,a):!i&&!a?sh(s,l):!1}return!1},z6=function(t,r){var n=[],i={};return hM(t).forEach(function(s,o){if(nSe(s))n.push(s);else if(s){var a=yl(s.type),l=r[a]||{},u=l.handler,h=l.once;if(u&&(!h||!i[a])){var d=u(s,a,o);n.push(d),i[a]=!0}}}),n},oSe=function(t){var r=t&&t.type;return r&&I6[r]?I6[r]:null},aSe=function(t,r){return hM(r).indexOf(t)},lSe=["children","width","height","viewBox","className","style","title","desc"];function XA(){return XA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},XA.apply(this,arguments)}function cSe(e,t){if(e==null)return{};var r=uSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function uSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function QA(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,s=e.className,o=e.style,a=e.title,l=e.desc,u=cSe(e,lSe),h=i||{width:r,height:n,x:0,y:0},d=Lt("recharts-surface",s);return se.createElement("svg",XA({},yt(u,!0,"svg"),{className:d,width:r,height:n,style:o,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),se.createElement("title",null,a),se.createElement("desc",null,l),t)}var dSe=["children","className"];function ZA(){return ZA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ZA.apply(this,arguments)}function fSe(e,t){if(e==null)return{};var r=hSe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var or=se.forwardRef(function(e,t){var r=e.children,n=e.className,i=fSe(e,dSe),s=Lt("recharts-layer",n);return se.createElement("g",ZA({className:s},yt(i,!0),{ref:t}),r)}),bl=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s]},PO,H6;function pSe(){if(H6)return PO;H6=1;function e(t,r,n){var i=-1,s=t.length;r<0&&(r=-r>s?0:s+r),n=n>s?s:n,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(s);++i<s;)o[i]=t[i+r];return o}return PO=e,PO}var jO,F6;function mSe(){if(F6)return jO;F6=1;var e=pSe();function t(r,n,i){var s=r.length;return i=i===void 0?s:i,!n&&i>=s?r:e(r,n,i)}return jO=t,jO}var MO,U6;function $K(){if(U6)return MO;U6=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,s="\\ufe0e\\ufe0f",o="\\u200d",a=RegExp("["+o+e+i+s+"]");function l(u){return a.test(u)}return MO=l,MO}var LO,V6;function gSe(){if(V6)return LO;V6=1;function e(t){return t.split("")}return LO=e,LO}var DO,W6;function vSe(){if(W6)return DO;W6=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,s="\\ufe0e\\ufe0f",o="["+e+"]",a="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+a+"|"+l+")",h="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",w=u+"?",_="["+s+"]?",m="(?:"+v+"(?:"+[h,d,p].join("|")+")"+_+w+")*",x=_+w+m,b="(?:"+[h+a+"?",a,d,p,o].join("|")+")",S=RegExp(l+"(?="+l+")|"+b+x,"g");function E(O){return O.match(S)||[]}return DO=E,DO}var IO,q6;function ySe(){if(q6)return IO;q6=1;var e=gSe(),t=$K(),r=vSe();function n(i){return t(i)?r(i):e(i)}return IO=n,IO}var NO,G6;function bSe(){if(G6)return NO;G6=1;var e=mSe(),t=$K(),r=ySe(),n=DK();function i(s){return function(o){o=n(o);var a=t(o)?r(o):void 0,l=a?a[0]:o.charAt(0),u=a?e(a,1).join(""):o.slice(1);return l[s]()+u}}return NO=i,NO}var BO,K6;function _Se(){if(K6)return BO;K6=1;var e=bSe(),t=e("toUpperCase");return BO=t,BO}var xSe=_Se();const Hx=br(xSe);function Mr(e){return function(){return e}}const zK=Math.cos,E_=Math.sin,Fo=Math.sqrt,O_=Math.PI,Fx=2*O_,JA=Math.PI,eR=2*JA,zu=1e-6,SSe=eR-zu;function HK(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function wSe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return HK;const r=10**t;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class CSe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?HK:wSe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,s,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(t,r,n,i,s){if(t=+t,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,l=n-t,u=i-r,h=o-t,d=a-r,p=h*h+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(p>zu)if(!(Math.abs(d*l-u*h)>zu)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,w=i-a,_=l*l+u*u,m=v*v+w*w,x=Math.sqrt(_),b=Math.sqrt(p),S=s*Math.tan((JA-Math.acos((_+p-m)/(2*x*b)))/2),E=S/b,O=S/x;Math.abs(E-1)>zu&&this._append`L${t+E*h},${r+E*d}`,this._append`A${s},${s},0,0,${+(d*v>h*w)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,s,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),l=n*Math.sin(i),u=t+a,h=r+l,d=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>zu||Math.abs(this._y1-h)>zu)&&this._append`L${u},${h}`,n&&(p<0&&(p=p%eR+eR),p>SSe?this._append`A${n},${n},0,1,${d},${t-a},${r-l}A${n},${n},0,1,${d},${this._x1=u},${this._y1=h}`:p>zu&&this._append`A${n},${n},0,${+(p>=JA)},${d},${this._x1=t+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function pM(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new CSe(t)}function mM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FK(e){this._context=e}FK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ux(e){return new FK(e)}function UK(e){return e[0]}function VK(e){return e[1]}function WK(e,t){var r=Mr(!0),n=null,i=Ux,s=null,o=pM(a);e=typeof e=="function"?e:e===void 0?UK:Mr(e),t=typeof t=="function"?t:t===void 0?VK:Mr(t);function a(l){var u,h=(l=mM(l)).length,d,p=!1,v;for(n==null&&(s=i(v=o())),u=0;u<=h;++u)!(u<h&&r(d=l[u],u,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+e(d,u,l),+t(d,u,l));if(v)return s=null,v+""||null}return a.x=function(l){return arguments.length?(e=typeof l=="function"?l:Mr(+l),a):e},a.y=function(l){return arguments.length?(t=typeof l=="function"?l:Mr(+l),a):t},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Mr(!!l),a):r},a.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),a):i},a.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),a):n},a}function e0(e,t,r){var n=null,i=Mr(!0),s=null,o=Ux,a=null,l=pM(u);e=typeof e=="function"?e:e===void 0?UK:Mr(+e),t=typeof t=="function"?t:Mr(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?VK:Mr(+r);function u(d){var p,v,w,_=(d=mM(d)).length,m,x=!1,b,S=new Array(_),E=new Array(_);for(s==null&&(a=o(b=l())),p=0;p<=_;++p){if(!(p<_&&i(m=d[p],p,d))===x)if(x=!x)v=p,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),w=p-1;w>=v;--w)a.point(S[w],E[w]);a.lineEnd(),a.areaEnd()}x&&(S[p]=+e(m,p,d),E[p]=+t(m,p,d),a.point(n?+n(m,p,d):S[p],r?+r(m,p,d):E[p]))}if(b)return a=null,b+""||null}function h(){return WK().defined(i).curve(o).context(s)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Mr(+d),n=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Mr(+d),u):e},u.x1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Mr(+d),u):n},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Mr(+d),r=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Mr(+d),u):t},u.y1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Mr(+d),u):r},u.lineX0=u.lineY0=function(){return h().x(e).y(t)},u.lineY1=function(){return h().x(e).y(r)},u.lineX1=function(){return h().x(n).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Mr(!!d),u):i},u.curve=function(d){return arguments.length?(o=d,s!=null&&(a=o(s)),u):o},u.context=function(d){return arguments.length?(d==null?s=a=null:a=o(s=d),u):s},u}class qK{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function ESe(e){return new qK(e,!0)}function OSe(e){return new qK(e,!1)}const gM={draw(e,t){const r=Fo(t/O_);e.moveTo(r,0),e.arc(0,0,r,0,Fx)}},kSe={draw(e,t){const r=Fo(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},GK=Fo(1/3),TSe=GK*2,ASe={draw(e,t){const r=Fo(t/TSe),n=r*GK;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},RSe={draw(e,t){const r=Fo(t),n=-r/2;e.rect(n,n,r,r)}},PSe=.8908130915292852,KK=E_(O_/10)/E_(7*O_/10),jSe=E_(Fx/10)*KK,MSe=-zK(Fx/10)*KK,LSe={draw(e,t){const r=Fo(t*PSe),n=jSe*r,i=MSe*r;e.moveTo(0,-r),e.lineTo(n,i);for(let s=1;s<5;++s){const o=Fx*s/5,a=zK(o),l=E_(o);e.lineTo(l*r,-a*r),e.lineTo(a*n-l*i,l*n+a*i)}e.closePath()}},$O=Fo(3),DSe={draw(e,t){const r=-Fo(t/($O*3));e.moveTo(0,r*2),e.lineTo(-$O*r,-r),e.lineTo($O*r,-r),e.closePath()}},Us=-.5,Vs=Fo(3)/2,tR=1/Fo(12),ISe=(tR/2+1)*3,NSe={draw(e,t){const r=Fo(t/ISe),n=r/2,i=r*tR,s=n,o=r*tR+r,a=-s,l=o;e.moveTo(n,i),e.lineTo(s,o),e.lineTo(a,l),e.lineTo(Us*n-Vs*i,Vs*n+Us*i),e.lineTo(Us*s-Vs*o,Vs*s+Us*o),e.lineTo(Us*a-Vs*l,Vs*a+Us*l),e.lineTo(Us*n+Vs*i,Us*i-Vs*n),e.lineTo(Us*s+Vs*o,Us*o-Vs*s),e.lineTo(Us*a+Vs*l,Us*l-Vs*a),e.closePath()}};function BSe(e,t){let r=null,n=pM(i);e=typeof e=="function"?e:Mr(e||gM),t=typeof t=="function"?t:Mr(t===void 0?64:+t);function i(){let s;if(r||(r=s=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),s)return r=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:Mr(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:Mr(+s),i):t},i.context=function(s){return arguments.length?(r=s??null,i):r},i}function k_(){}function T_(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function YK(e){this._context=e}YK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:T_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $Se(e){return new YK(e)}function XK(e){this._context=e}XK.prototype={areaStart:k_,areaEnd:k_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zSe(e){return new XK(e)}function QK(e){this._context=e}QK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:T_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function HSe(e){return new QK(e)}function ZK(e){this._context=e}ZK.prototype={areaStart:k_,areaEnd:k_,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function FSe(e){return new ZK(e)}function Y6(e){return e<0?-1:1}function X6(e,t,r){var n=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),a=(s*i+o*n)/(n+i);return(Y6(s)+Y6(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Q6(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function zO(e,t,r){var n=e._x0,i=e._y0,s=e._x1,o=e._y1,a=(s-n)/3;e._context.bezierCurveTo(n+a,i+a*t,s-a,o-a*r,s,o)}function A_(e){this._context=e}A_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zO(this,this._t0,Q6(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zO(this,Q6(this,r=X6(this,e,t)),r);break;default:zO(this,this._t0,r=X6(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function JK(e){this._context=new eY(e)}(JK.prototype=Object.create(A_.prototype)).point=function(e,t){A_.prototype.point.call(this,t,e)};function eY(e){this._context=e}eY.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,s){this._context.bezierCurveTo(t,e,n,r,s,i)}};function USe(e){return new A_(e)}function VSe(e){return new JK(e)}function tY(e){this._context=e}tY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Z6(e),i=Z6(t),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Z6(e){var t,r=e.length-1,n,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/s[t-1],s[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/s[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function WSe(e){return new tY(e)}function Vx(e,t){this._context=e,this._t=t}Vx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function qSe(e){return new Vx(e,.5)}function GSe(e){return new Vx(e,0)}function KSe(e){return new Vx(e,1)}function Ah(e,t){if((o=e.length)>1)for(var r=1,n,i,s=e[t[0]],o,a=s.length;r<o;++r)for(i=s,s=e[t[r]],n=0;n<a;++n)s[n][1]+=s[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function rR(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function YSe(e,t){return e[t]}function XSe(e){const t=[];return t.key=e,t}function QSe(){var e=Mr([]),t=rR,r=Ah,n=YSe;function i(s){var o=Array.from(e.apply(this,arguments),XSe),a,l=o.length,u=-1,h;for(const d of s)for(a=0,++u;a<l;++a)(o[a][u]=[0,+n(d,o[a].key,u,s)]).data=d;for(a=0,h=mM(t(o));a<l;++a)o[h[a]].index=a;return r(o,h),o}return i.keys=function(s){return arguments.length?(e=typeof s=="function"?s:Mr(Array.from(s)),i):e},i.value=function(s){return arguments.length?(n=typeof s=="function"?s:Mr(+s),i):n},i.order=function(s){return arguments.length?(t=s==null?rR:typeof s=="function"?s:Mr(Array.from(s)),i):t},i.offset=function(s){return arguments.length?(r=s??Ah,i):r},i}function ZSe(e,t){if((n=e.length)>0){for(var r,n,i=0,s=e[0].length,o;i<s;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Ah(e,t)}}function JSe(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,s=n.length;r<s;++r){for(var o=0,a=0;o<i;++o)a+=e[o][r][1]||0;n[r][1]+=n[r][0]=-a/2}Ah(e,t)}}function ewe(e,t){if(!(!((o=e.length)>0)||!((s=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,s,o;n<s;++n){for(var a=0,l=0,u=0;a<o;++a){for(var h=e[t[a]],d=h[n][1]||0,p=h[n-1][1]||0,v=(d-p)/2,w=0;w<a;++w){var _=e[t[w]],m=_[n][1]||0,x=_[n-1][1]||0;v+=m-x}l+=d,u+=v*d}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Ah(e,t)}}function Ng(e){"@babel/helpers - typeof";return Ng=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ng(e)}var twe=["type","size","sizeType"];function nR(){return nR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nR.apply(this,arguments)}function J6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function e9(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?J6(Object(r),!0).forEach(function(n){rwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rwe(e,t,r){return t=nwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nwe(e){var t=iwe(e,"string");return Ng(t)=="symbol"?t:t+""}function iwe(e,t){if(Ng(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ng(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function swe(e,t){if(e==null)return{};var r=owe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function owe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var rY={symbolCircle:gM,symbolCross:kSe,symbolDiamond:ASe,symbolSquare:RSe,symbolStar:LSe,symbolTriangle:DSe,symbolWye:NSe},awe=Math.PI/180,lwe=function(t){var r="symbol".concat(Hx(t));return rY[r]||gM},cwe=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*awe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},uwe=function(t,r){rY["symbol".concat(Hx(t))]=r},vM=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,s=i===void 0?64:i,o=t.sizeType,a=o===void 0?"area":o,l=swe(t,twe),u=e9(e9({},l),{},{type:n,size:s,sizeType:a}),h=function(){var m=lwe(n),x=BSe().type(m).size(cwe(s,a,n));return x()},d=u.className,p=u.cx,v=u.cy,w=yt(u,!0);return p===+p&&v===+v&&s===+s?se.createElement("path",nR({},w,{className:Lt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(v,")"),d:h()})):null};vM.registerSymbol=uwe;function Rh(e){"@babel/helpers - typeof";return Rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(e)}function iR(){return iR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},iR.apply(this,arguments)}function t9(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dwe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t9(Object(r),!0).forEach(function(n){Bg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t9(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hwe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,iY(n.key),n)}}function pwe(e,t,r){return t&&hwe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mwe(e,t,r){return t=R_(t),gwe(e,nY()?Reflect.construct(t,r||[],R_(e).constructor):t.apply(e,r))}function gwe(e,t){if(t&&(Rh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vwe(e)}function vwe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nY=function(){return!!e})()}function R_(e){return R_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},R_(e)}function ywe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sR(e,t)}function sR(e,t){return sR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},sR(e,t)}function Bg(e,t,r){return t=iY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iY(e){var t=bwe(e,"string");return Rh(t)=="symbol"?t:t+""}function bwe(e,t){if(Rh(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ws=32,yM=(function(e){function t(){return fwe(this,t),mwe(this,t,arguments)}return ywe(t,e),pwe(t,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,s=Ws/2,o=Ws/6,a=Ws/3,l=n.inactive?i:n.color;if(n.type==="plainline")return se.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:s,x2:Ws,y2:s,className:"recharts-legend-icon"});if(n.type==="line")return se.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(s,"h").concat(a,`
|
|
46
46
|
A`).concat(o,",").concat(o,",0,1,1,").concat(2*a,",").concat(s,`
|
|
47
47
|
H`).concat(Ws,"M").concat(2*a,",").concat(s,`
|
|
48
48
|
A`).concat(o,",").concat(o,",0,1,1,").concat(a,",").concat(s),className:"recharts-legend-icon"});if(n.type==="rect")return se.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Ws/8,"h").concat(Ws,"v").concat(Ws*3/4,"h").concat(-Ws,"z"),className:"recharts-legend-icon"});if(se.isValidElement(n.legendIcon)){var u=dwe({},n);return delete u.legendIcon,se.cloneElement(n.legendIcon,u)}return se.createElement(vM,{fill:l,cx:s,cy:s,size:Ws,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,s=i.payload,o=i.iconSize,a=i.layout,l=i.formatter,u=i.inactiveColor,h={x:0,y:0,width:Ws,height:Ws},d={display:a==="horizontal"?"inline-block":"block",marginRight:10},p={display:"inline-block",verticalAlign:"middle",marginRight:4};return s.map(function(v,w){var _=v.formatter||l,m=Lt(Bg(Bg({"recharts-legend-item":!0},"legend-item-".concat(w),!0),"inactive",v.inactive));if(v.type==="none")return null;var x=Ot(v.value)?null:v.value;bl(!Ot(v.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=v.inactive?u:v.color;return se.createElement("li",iR({className:m,style:d,key:"legend-item-".concat(w)},eu(n.props,v,w)),se.createElement(QA,{width:o,height:o,viewBox:h,style:p},n.renderIcon(v)),se.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},_?_(x,v,w):x))})}},{key:"render",value:function(){var n=this.props,i=n.payload,s=n.layout,o=n.align;if(!i||!i.length)return null;var a={padding:0,margin:0,textAlign:s==="horizontal"?o:"left"};return se.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])})(T.PureComponent);Bg(yM,"displayName","Legend");Bg(yM,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var HO,r9;function _we(){if(r9)return HO;r9=1;var e=Bx();function t(){this.__data__=new e,this.size=0}return HO=t,HO}var FO,n9;function xwe(){if(n9)return FO;n9=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return FO=e,FO}var UO,i9;function Swe(){if(i9)return UO;i9=1;function e(t){return this.__data__.get(t)}return UO=e,UO}var VO,s9;function wwe(){if(s9)return VO;s9=1;function e(t){return this.__data__.has(t)}return VO=e,VO}var WO,o9;function Cwe(){if(o9)return WO;o9=1;var e=Bx(),t=lM(),r=cM(),n=200;function i(s,o){var a=this.__data__;if(a instanceof e){var l=a.__data__;if(!t||l.length<n-1)return l.push([s,o]),this.size=++a.size,this;a=this.__data__=new r(l)}return a.set(s,o),this.size=a.size,this}return WO=i,WO}var qO,a9;function sY(){if(a9)return qO;a9=1;var e=Bx(),t=_we(),r=xwe(),n=Swe(),i=wwe(),s=Cwe();function o(a){var l=this.__data__=new e(a);this.size=l.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=s,qO=o,qO}var GO,l9;function Ewe(){if(l9)return GO;l9=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return GO=t,GO}var KO,c9;function Owe(){if(c9)return KO;c9=1;function e(t){return this.__data__.has(t)}return KO=e,KO}var YO,u9;function oY(){if(u9)return YO;u9=1;var e=cM(),t=Ewe(),r=Owe();function n(i){var s=-1,o=i==null?0:i.length;for(this.__data__=new e;++s<o;)this.add(i[s])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,YO=n,YO}var XO,d9;function aY(){if(d9)return XO;d9=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(t[n],n,t))return!0;return!1}return XO=e,XO}var QO,f9;function lY(){if(f9)return QO;f9=1;function e(t,r){return t.has(r)}return QO=e,QO}var ZO,h9;function cY(){if(h9)return ZO;h9=1;var e=oY(),t=aY(),r=lY(),n=1,i=2;function s(o,a,l,u,h,d){var p=l&n,v=o.length,w=a.length;if(v!=w&&!(p&&w>v))return!1;var _=d.get(o),m=d.get(a);if(_&&m)return _==a&&m==o;var x=-1,b=!0,S=l&i?new e:void 0;for(d.set(o,a),d.set(a,o);++x<v;){var E=o[x],O=a[x];if(u)var k=p?u(O,E,x,a,o,d):u(E,O,x,o,a,d);if(k!==void 0){if(k)continue;b=!1;break}if(S){if(!t(a,function(R,A){if(!r(S,A)&&(E===R||h(E,R,l,u,d)))return S.push(A)})){b=!1;break}}else if(!(E===O||h(E,O,l,u,d))){b=!1;break}}return d.delete(o),d.delete(a),b}return ZO=s,ZO}var JO,p9;function kwe(){if(p9)return JO;p9=1;var e=Pa(),t=e.Uint8Array;return JO=t,JO}var e2,m9;function Twe(){if(m9)return e2;m9=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i,s){n[++r]=[s,i]}),n}return e2=e,e2}var t2,g9;function bM(){if(g9)return t2;g9=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i){n[++r]=i}),n}return t2=e,t2}var r2,v9;function Awe(){if(v9)return r2;v9=1;var e=Jv(),t=kwe(),r=aM(),n=cY(),i=Twe(),s=bM(),o=1,a=2,l="[object Boolean]",u="[object Date]",h="[object Error]",d="[object Map]",p="[object Number]",v="[object RegExp]",w="[object Set]",_="[object String]",m="[object Symbol]",x="[object ArrayBuffer]",b="[object DataView]",S=e?e.prototype:void 0,E=S?S.valueOf:void 0;function O(k,R,A,j,B,L,z){switch(A){case b:if(k.byteLength!=R.byteLength||k.byteOffset!=R.byteOffset)return!1;k=k.buffer,R=R.buffer;case x:return!(k.byteLength!=R.byteLength||!L(new t(k),new t(R)));case l:case u:case p:return r(+k,+R);case h:return k.name==R.name&&k.message==R.message;case v:case _:return k==R+"";case d:var D=i;case w:var V=j&o;if(D||(D=s),k.size!=R.size&&!V)return!1;var H=z.get(k);if(H)return H==R;j|=a,z.set(k,R);var $=n(D(k),D(R),j,B,L,z);return z.delete(k),$;case m:if(E)return E.call(k)==E.call(R)}return!1}return r2=O,r2}var n2,y9;function uY(){if(y9)return n2;y9=1;function e(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}return n2=e,n2}var i2,b9;function Rwe(){if(b9)return i2;b9=1;var e=uY(),t=is();function r(n,i,s){var o=i(n);return t(n)?o:e(o,s(n))}return i2=r,i2}var s2,_9;function Pwe(){if(_9)return s2;_9=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,s=0,o=[];++n<i;){var a=t[n];r(a,n,t)&&(o[s++]=a)}return o}return s2=e,s2}var o2,x9;function jwe(){if(x9)return o2;x9=1;function e(){return[]}return o2=e,o2}var a2,S9;function Mwe(){if(S9)return a2;S9=1;var e=Pwe(),t=jwe(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(o){return o==null?[]:(o=Object(o),e(i(o),function(a){return n.call(o,a)}))}:t;return a2=s,a2}var l2,w9;function Lwe(){if(w9)return l2;w9=1;function e(t,r){for(var n=-1,i=Array(t);++n<t;)i[n]=r(n);return i}return l2=e,l2}var c2,C9;function Dwe(){if(C9)return c2;C9=1;var e=Dl(),t=Il(),r="[object Arguments]";function n(i){return t(i)&&e(i)==r}return c2=n,c2}var u2,E9;function _M(){if(E9)return u2;E9=1;var e=Dwe(),t=Il(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,s=e((function(){return arguments})())?e:function(o){return t(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return u2=s,u2}var Km={exports:{}},d2,O9;function Iwe(){if(O9)return d2;O9=1;function e(){return!1}return d2=e,d2}Km.exports;var k9;function dY(){return k9||(k9=1,(function(e,t){var r=Pa(),n=Iwe(),i=t&&!t.nodeType&&t,s=i&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===i,a=o?r.Buffer:void 0,l=a?a.isBuffer:void 0,u=l||n;e.exports=u})(Km,Km.exports)),Km.exports}var f2,T9;function xM(){if(T9)return f2;T9=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,i){var s=typeof n;return i=i??e,!!i&&(s=="number"||s!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return f2=r,f2}var h2,A9;function SM(){if(A9)return h2;A9=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return h2=t,h2}var p2,R9;function Nwe(){if(R9)return p2;R9=1;var e=Dl(),t=SM(),r=Il(),n="[object Arguments]",i="[object Array]",s="[object Boolean]",o="[object Date]",a="[object Error]",l="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",p="[object RegExp]",v="[object Set]",w="[object String]",_="[object WeakMap]",m="[object ArrayBuffer]",x="[object DataView]",b="[object Float32Array]",S="[object Float64Array]",E="[object Int8Array]",O="[object Int16Array]",k="[object Int32Array]",R="[object Uint8Array]",A="[object Uint8ClampedArray]",j="[object Uint16Array]",B="[object Uint32Array]",L={};L[b]=L[S]=L[E]=L[O]=L[k]=L[R]=L[A]=L[j]=L[B]=!0,L[n]=L[i]=L[m]=L[s]=L[x]=L[o]=L[a]=L[l]=L[u]=L[h]=L[d]=L[p]=L[v]=L[w]=L[_]=!1;function z(D){return r(D)&&t(D.length)&&!!L[e(D)]}return p2=z,p2}var m2,P9;function fY(){if(P9)return m2;P9=1;function e(t){return function(r){return t(r)}}return m2=e,m2}var Ym={exports:{}};Ym.exports;var j9;function Bwe(){return j9||(j9=1,(function(e,t){var r=jK(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,o=s&&r.process,a=(function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}})();e.exports=a})(Ym,Ym.exports)),Ym.exports}var g2,M9;function hY(){if(M9)return g2;M9=1;var e=Nwe(),t=fY(),r=Bwe(),n=r&&r.isTypedArray,i=n?t(n):e;return g2=i,g2}var v2,L9;function $we(){if(L9)return v2;L9=1;var e=Lwe(),t=_M(),r=is(),n=dY(),i=xM(),s=hY(),o=Object.prototype,a=o.hasOwnProperty;function l(u,h){var d=r(u),p=!d&&t(u),v=!d&&!p&&n(u),w=!d&&!p&&!v&&s(u),_=d||p||v||w,m=_?e(u.length,String):[],x=m.length;for(var b in u)(h||a.call(u,b))&&!(_&&(b=="length"||v&&(b=="offset"||b=="parent")||w&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,x)))&&m.push(b);return m}return v2=l,v2}var y2,D9;function zwe(){if(D9)return y2;D9=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return y2=t,y2}var b2,I9;function pY(){if(I9)return b2;I9=1;function e(t,r){return function(n){return t(r(n))}}return b2=e,b2}var _2,N9;function Hwe(){if(N9)return _2;N9=1;var e=pY(),t=e(Object.keys,Object);return _2=t,_2}var x2,B9;function Fwe(){if(B9)return x2;B9=1;var e=zwe(),t=Hwe(),r=Object.prototype,n=r.hasOwnProperty;function i(s){if(!e(s))return t(s);var o=[];for(var a in Object(s))n.call(s,a)&&a!="constructor"&&o.push(a);return o}return x2=i,x2}var S2,$9;function ty(){if($9)return S2;$9=1;var e=oM(),t=SM();function r(n){return n!=null&&t(n.length)&&!e(n)}return S2=r,S2}var w2,z9;function Wx(){if(z9)return w2;z9=1;var e=$we(),t=Fwe(),r=ty();function n(i){return r(i)?e(i):t(i)}return w2=n,w2}var C2,H9;function Uwe(){if(H9)return C2;H9=1;var e=Rwe(),t=Mwe(),r=Wx();function n(i){return e(i,r,t)}return C2=n,C2}var E2,F9;function Vwe(){if(F9)return E2;F9=1;var e=Uwe(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(s,o,a,l,u,h){var d=a&t,p=e(s),v=p.length,w=e(o),_=w.length;if(v!=_&&!d)return!1;for(var m=v;m--;){var x=p[m];if(!(d?x in o:n.call(o,x)))return!1}var b=h.get(s),S=h.get(o);if(b&&S)return b==o&&S==s;var E=!0;h.set(s,o),h.set(o,s);for(var O=d;++m<v;){x=p[m];var k=s[x],R=o[x];if(l)var A=d?l(R,k,x,o,s,h):l(k,R,x,s,o,h);if(!(A===void 0?k===R||u(k,R,a,l,h):A)){E=!1;break}O||(O=x=="constructor")}if(E&&!O){var j=s.constructor,B=o.constructor;j!=B&&"constructor"in s&&"constructor"in o&&!(typeof j=="function"&&j instanceof j&&typeof B=="function"&&B instanceof B)&&(E=!1)}return h.delete(s),h.delete(o),E}return E2=i,E2}var O2,U9;function Wwe(){if(U9)return O2;U9=1;var e=qd(),t=Pa(),r=e(t,"DataView");return O2=r,O2}var k2,V9;function qwe(){if(V9)return k2;V9=1;var e=qd(),t=Pa(),r=e(t,"Promise");return k2=r,k2}var T2,W9;function mY(){if(W9)return T2;W9=1;var e=qd(),t=Pa(),r=e(t,"Set");return T2=r,T2}var A2,q9;function Gwe(){if(q9)return A2;q9=1;var e=qd(),t=Pa(),r=e(t,"WeakMap");return A2=r,A2}var R2,G9;function Kwe(){if(G9)return R2;G9=1;var e=Wwe(),t=lM(),r=qwe(),n=mY(),i=Gwe(),s=Dl(),o=MK(),a="[object Map]",l="[object Object]",u="[object Promise]",h="[object Set]",d="[object WeakMap]",p="[object DataView]",v=o(e),w=o(t),_=o(r),m=o(n),x=o(i),b=s;return(e&&b(new e(new ArrayBuffer(1)))!=p||t&&b(new t)!=a||r&&b(r.resolve())!=u||n&&b(new n)!=h||i&&b(new i)!=d)&&(b=function(S){var E=s(S),O=E==l?S.constructor:void 0,k=O?o(O):"";if(k)switch(k){case v:return p;case w:return a;case _:return u;case m:return h;case x:return d}return E}),R2=b,R2}var P2,K9;function Ywe(){if(K9)return P2;K9=1;var e=sY(),t=cY(),r=Awe(),n=Vwe(),i=Kwe(),s=is(),o=dY(),a=hY(),l=1,u="[object Arguments]",h="[object Array]",d="[object Object]",p=Object.prototype,v=p.hasOwnProperty;function w(_,m,x,b,S,E){var O=s(_),k=s(m),R=O?h:i(_),A=k?h:i(m);R=R==u?d:R,A=A==u?d:A;var j=R==d,B=A==d,L=R==A;if(L&&o(_)){if(!o(m))return!1;O=!0,j=!1}if(L&&!j)return E||(E=new e),O||a(_)?t(_,m,x,b,S,E):r(_,m,R,x,b,S,E);if(!(x&l)){var z=j&&v.call(_,"__wrapped__"),D=B&&v.call(m,"__wrapped__");if(z||D){var V=z?_.value():_,H=D?m.value():m;return E||(E=new e),S(V,H,x,b,E)}}return L?(E||(E=new e),n(_,m,x,b,S,E)):!1}return P2=w,P2}var j2,Y9;function wM(){if(Y9)return j2;Y9=1;var e=Ywe(),t=Il();function r(n,i,s,o,a){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:e(n,i,s,o,r,a)}return j2=r,j2}var M2,X9;function Xwe(){if(X9)return M2;X9=1;var e=sY(),t=wM(),r=1,n=2;function i(s,o,a,l){var u=a.length,h=u,d=!l;if(s==null)return!h;for(s=Object(s);u--;){var p=a[u];if(d&&p[2]?p[1]!==s[p[0]]:!(p[0]in s))return!1}for(;++u<h;){p=a[u];var v=p[0],w=s[v],_=p[1];if(d&&p[2]){if(w===void 0&&!(v in s))return!1}else{var m=new e;if(l)var x=l(w,_,v,s,o,m);if(!(x===void 0?t(_,w,r|n,l,m):x))return!1}}return!0}return M2=i,M2}var L2,Q9;function gY(){if(Q9)return L2;Q9=1;var e=fu();function t(r){return r===r&&!e(r)}return L2=t,L2}var D2,Z9;function Qwe(){if(Z9)return D2;Z9=1;var e=gY(),t=Wx();function r(n){for(var i=t(n),s=i.length;s--;){var o=i[s],a=n[o];i[s]=[o,a,e(a)]}return i}return D2=r,D2}var I2,J9;function vY(){if(J9)return I2;J9=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return I2=e,I2}var N2,eB;function Zwe(){if(eB)return N2;eB=1;var e=Xwe(),t=Qwe(),r=vY();function n(i){var s=t(i);return s.length==1&&s[0][2]?r(s[0][0],s[0][1]):function(o){return o===i||e(o,i,s)}}return N2=n,N2}var B2,tB;function Jwe(){if(tB)return B2;tB=1;function e(t,r){return t!=null&&r in Object(t)}return B2=e,B2}var $2,rB;function eCe(){if(rB)return $2;rB=1;var e=IK(),t=_M(),r=is(),n=xM(),i=SM(),s=zx();function o(a,l,u){l=e(l,a);for(var h=-1,d=l.length,p=!1;++h<d;){var v=s(l[h]);if(!(p=a!=null&&u(a,v)))break;a=a[v]}return p||++h!=d?p:(d=a==null?0:a.length,!!d&&i(d)&&n(v,d)&&(r(a)||t(a)))}return $2=o,$2}var z2,nB;function tCe(){if(nB)return z2;nB=1;var e=Jwe(),t=eCe();function r(n,i){return n!=null&&t(n,i,e)}return z2=r,z2}var H2,iB;function rCe(){if(iB)return H2;iB=1;var e=wM(),t=NK(),r=tCe(),n=sM(),i=gY(),s=vY(),o=zx(),a=1,l=2;function u(h,d){return n(h)&&i(d)?s(o(h),d):function(p){var v=t(p,h);return v===void 0&&v===d?r(p,h):e(d,v,a|l)}}return H2=u,H2}var F2,sB;function Cp(){if(sB)return F2;sB=1;function e(t){return t}return F2=e,F2}var U2,oB;function nCe(){if(oB)return U2;oB=1;function e(t){return function(r){return r?.[t]}}return U2=e,U2}var V2,aB;function iCe(){if(aB)return V2;aB=1;var e=dM();function t(r){return function(n){return e(n,r)}}return V2=t,V2}var W2,lB;function sCe(){if(lB)return W2;lB=1;var e=nCe(),t=iCe(),r=sM(),n=zx();function i(s){return r(s)?e(n(s)):t(s)}return W2=i,W2}var q2,cB;function ja(){if(cB)return q2;cB=1;var e=Zwe(),t=rCe(),r=Cp(),n=is(),i=sCe();function s(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?t(o[0],o[1]):e(o):i(o)}return q2=s,q2}var G2,uB;function yY(){if(uB)return G2;uB=1;function e(t,r,n,i){for(var s=t.length,o=n+(i?1:-1);i?o--:++o<s;)if(r(t[o],o,t))return o;return-1}return G2=e,G2}var K2,dB;function oCe(){if(dB)return K2;dB=1;function e(t){return t!==t}return K2=e,K2}var Y2,fB;function aCe(){if(fB)return Y2;fB=1;function e(t,r,n){for(var i=n-1,s=t.length;++i<s;)if(t[i]===r)return i;return-1}return Y2=e,Y2}var X2,hB;function lCe(){if(hB)return X2;hB=1;var e=yY(),t=oCe(),r=aCe();function n(i,s,o){return s===s?r(i,s,o):e(i,t,o)}return X2=n,X2}var Q2,pB;function cCe(){if(pB)return Q2;pB=1;var e=lCe();function t(r,n){var i=r==null?0:r.length;return!!i&&e(r,n,0)>-1}return Q2=t,Q2}var Z2,mB;function uCe(){if(mB)return Z2;mB=1;function e(t,r,n){for(var i=-1,s=t==null?0:t.length;++i<s;)if(n(r,t[i]))return!0;return!1}return Z2=e,Z2}var J2,gB;function dCe(){if(gB)return J2;gB=1;function e(){}return J2=e,J2}var ek,vB;function fCe(){if(vB)return ek;vB=1;var e=mY(),t=dCe(),r=bM(),n=1/0,i=e&&1/r(new e([,-0]))[1]==n?function(s){return new e(s)}:t;return ek=i,ek}var tk,yB;function hCe(){if(yB)return tk;yB=1;var e=oY(),t=cCe(),r=uCe(),n=lY(),i=fCe(),s=bM(),o=200;function a(l,u,h){var d=-1,p=t,v=l.length,w=!0,_=[],m=_;if(h)w=!1,p=r;else if(v>=o){var x=u?null:i(l);if(x)return s(x);w=!1,p=n,m=new e}else m=u?[]:_;e:for(;++d<v;){var b=l[d],S=u?u(b):b;if(b=h||b!==0?b:0,w&&S===S){for(var E=m.length;E--;)if(m[E]===S)continue e;u&&m.push(S),_.push(b)}else p(m,S,h)||(m!==_&&m.push(S),_.push(b))}return _}return tk=a,tk}var rk,bB;function pCe(){if(bB)return rk;bB=1;var e=ja(),t=hCe();function r(n,i){return n&&n.length?t(n,e(i,2)):[]}return rk=r,rk}var mCe=pCe();const _B=br(mCe);function bY(e,t,r){return t===!0?_B(e,r):Ot(t)?_B(e,t):e}function Ph(e){"@babel/helpers - typeof";return Ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ph(e)}var gCe=["ref"];function xB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function sl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xB(Object(r),!0).forEach(function(n){qx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xB(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SB(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xY(n.key),n)}}function yCe(e,t,r){return t&&SB(e.prototype,t),r&&SB(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function bCe(e,t,r){return t=P_(t),_Ce(e,_Y()?Reflect.construct(t,r||[],P_(e).constructor):t.apply(e,r))}function _Ce(e,t){if(t&&(Ph(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xCe(e)}function xCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_Y=function(){return!!e})()}function P_(e){return P_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},P_(e)}function SCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oR(e,t)}function oR(e,t){return oR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},oR(e,t)}function qx(e,t,r){return t=xY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xY(e){var t=wCe(e,"string");return Ph(t)=="symbol"?t:t+""}function wCe(e,t){if(Ph(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ph(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function CCe(e,t){if(e==null)return{};var r=ECe(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ECe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function OCe(e){return e.value}function kCe(e,t){if(se.isValidElement(e))return se.cloneElement(e,t);if(typeof e=="function")return se.createElement(e,t);t.ref;var r=CCe(t,gCe);return se.createElement(yM,r)}var wB=1,oh=(function(e){function t(){var r;vCe(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return r=bCe(this,t,[].concat(i)),qx(r,"lastBoundingBox",{width:-1,height:-1}),r}return SCe(t,e),yCe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>wB||Math.abs(i.height-this.lastBoundingBox.height)>wB)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sl({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,s=i.layout,o=i.align,a=i.verticalAlign,l=i.margin,u=i.chartWidth,h=i.chartHeight,d,p;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&s==="vertical"){var v=this.getBBoxSnapshot();d={left:((u||0)-v.width)/2}}else d=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(a==="middle"){var w=this.getBBoxSnapshot();p={top:((h||0)-w.height)/2}}else p=a==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return sl(sl({},d),p)}},{key:"render",value:function(){var n=this,i=this.props,s=i.content,o=i.width,a=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,h=i.payload,d=sl(sl({position:"absolute",width:o||"auto",height:a||"auto"},this.getDefaultPosition(l)),l);return se.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(v){n.wrapperNode=v}},kCe(s,sl(sl({},this.props),{},{payload:bY(h,u,OCe)})))}}],[{key:"getWithHeight",value:function(n,i){var s=sl(sl({},this.defaultProps),n.props),o=s.layout;return o==="vertical"&&Fe(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(T.PureComponent);qx(oh,"displayName","Legend");qx(oh,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var nk,CB;function TCe(){if(CB)return nk;CB=1;var e=Jv(),t=_M(),r=is(),n=e?e.isConcatSpreadable:void 0;function i(s){return r(s)||t(s)||!!(n&&s&&s[n])}return nk=i,nk}var ik,EB;function SY(){if(EB)return ik;EB=1;var e=uY(),t=TCe();function r(n,i,s,o,a){var l=-1,u=n.length;for(s||(s=t),a||(a=[]);++l<u;){var h=n[l];i>0&&s(h)?i>1?r(h,i-1,s,o,a):e(a,h):o||(a[a.length]=h)}return a}return ik=r,ik}var sk,OB;function ACe(){if(OB)return sk;OB=1;function e(t){return function(r,n,i){for(var s=-1,o=Object(r),a=i(r),l=a.length;l--;){var u=a[t?l:++s];if(n(o[u],u,o)===!1)break}return r}}return sk=e,sk}var ok,kB;function RCe(){if(kB)return ok;kB=1;var e=ACe(),t=e();return ok=t,ok}var ak,TB;function wY(){if(TB)return ak;TB=1;var e=RCe(),t=Wx();function r(n,i){return n&&e(n,i,t)}return ak=r,ak}var lk,AB;function PCe(){if(AB)return lk;AB=1;var e=ty();function t(r,n){return function(i,s){if(i==null)return i;if(!e(i))return r(i,s);for(var o=i.length,a=n?o:-1,l=Object(i);(n?a--:++a<o)&&s(l[a],a,l)!==!1;);return i}}return lk=t,lk}var ck,RB;function CM(){if(RB)return ck;RB=1;var e=wY(),t=PCe(),r=t(e);return ck=r,ck}var uk,PB;function CY(){if(PB)return uk;PB=1;var e=CM(),t=ty();function r(n,i){var s=-1,o=t(n)?Array(n.length):[];return e(n,function(a,l,u){o[++s]=i(a,l,u)}),o}return uk=r,uk}var dk,jB;function jCe(){if(jB)return dk;jB=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return dk=e,dk}var fk,MB;function MCe(){if(MB)return fk;MB=1;var e=xp();function t(r,n){if(r!==n){var i=r!==void 0,s=r===null,o=r===r,a=e(r),l=n!==void 0,u=n===null,h=n===n,d=e(n);if(!u&&!d&&!a&&r>n||a&&l&&h&&!u&&!d||s&&l&&h||!i&&h||!o)return 1;if(!s&&!a&&!d&&r<n||d&&i&&o&&!s&&!a||u&&i&&o||!l&&o||!h)return-1}return 0}return fk=t,fk}var hk,LB;function LCe(){if(LB)return hk;LB=1;var e=MCe();function t(r,n,i){for(var s=-1,o=r.criteria,a=n.criteria,l=o.length,u=i.length;++s<l;){var h=e(o[s],a[s]);if(h){if(s>=u)return h;var d=i[s];return h*(d=="desc"?-1:1)}}return r.index-n.index}return hk=t,hk}var pk,DB;function DCe(){if(DB)return pk;DB=1;var e=uM(),t=dM(),r=ja(),n=CY(),i=jCe(),s=fY(),o=LCe(),a=Cp(),l=is();function u(h,d,p){d.length?d=e(d,function(_){return l(_)?function(m){return t(m,_.length===1?_[0]:_)}:_}):d=[a];var v=-1;d=e(d,s(r));var w=n(h,function(_,m,x){var b=e(d,function(S){return S(_)});return{criteria:b,index:++v,value:_}});return i(w,function(_,m){return o(_,m,p)})}return pk=u,pk}var mk,IB;function ICe(){if(IB)return mk;IB=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return mk=e,mk}var gk,NB;function NCe(){if(NB)return gk;NB=1;var e=ICe(),t=Math.max;function r(n,i,s){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,a=-1,l=t(o.length-i,0),u=Array(l);++a<l;)u[a]=o[i+a];a=-1;for(var h=Array(i+1);++a<i;)h[a]=o[a];return h[i]=s(u),e(n,this,h)}}return gk=r,gk}var vk,BB;function BCe(){if(BB)return vk;BB=1;function e(t){return function(){return t}}return vk=e,vk}var yk,$B;function EY(){if($B)return yk;$B=1;var e=qd(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return yk=t,yk}var bk,zB;function $Ce(){if(zB)return bk;zB=1;var e=BCe(),t=EY(),r=Cp(),n=t?function(i,s){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(s),writable:!0})}:r;return bk=n,bk}var _k,HB;function zCe(){if(HB)return _k;HB=1;var e=800,t=16,r=Date.now;function n(i){var s=0,o=0;return function(){var a=r(),l=t-(a-o);if(o=a,l>0){if(++s>=e)return arguments[0]}else s=0;return i.apply(void 0,arguments)}}return _k=n,_k}var xk,FB;function HCe(){if(FB)return xk;FB=1;var e=$Ce(),t=zCe(),r=t(e);return xk=r,xk}var Sk,UB;function FCe(){if(UB)return Sk;UB=1;var e=Cp(),t=NCe(),r=HCe();function n(i,s){return r(t(i,s,e),i+"")}return Sk=n,Sk}var wk,VB;function Gx(){if(VB)return wk;VB=1;var e=aM(),t=ty(),r=xM(),n=fu();function i(s,o,a){if(!n(a))return!1;var l=typeof o;return(l=="number"?t(a)&&r(o,a.length):l=="string"&&o in a)?e(a[o],s):!1}return wk=i,wk}var Ck,WB;function UCe(){if(WB)return Ck;WB=1;var e=SY(),t=DCe(),r=FCe(),n=Gx(),i=r(function(s,o){if(s==null)return[];var a=o.length;return a>1&&n(s,o[0],o[1])?o=[]:a>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(s,e(o,1),[])});return Ck=i,Ck}var VCe=UCe();const EM=br(VCe);function $g(e){"@babel/helpers - typeof";return $g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$g(e)}function aR(){return aR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},aR.apply(this,arguments)}function WCe(e,t){return YCe(e)||KCe(e,t)||GCe(e,t)||qCe()}function qCe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/jpeg" href="/logo-dark.jpg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vibora</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Dj8l7E-q.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BAuZPd2w.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|