From 2c97fa929a914e063f268017a46351d2f403dca4 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 14 Oct 2024 21:43:05 +0800 Subject: [PATCH] chore: improve i18n --- ui/dist/assets/{index-Dm8Q4Rp7.js => index-D0F7NB_8.js} | 2 +- ui/dist/index.html | 2 +- ui/src/components/certimate/AccessAliyunForm.tsx | 4 ++-- ui/src/components/certimate/AccessHuaweicloudForm.tsx | 4 ++-- ui/src/domain/access.ts | 2 +- ui/src/i18n/locales/en/nls.access.json | 6 ++---- ui/src/i18n/locales/en/nls.history.json | 3 +-- ui/src/i18n/locales/zh/nls.access.json | 6 ++---- 8 files changed, 12 insertions(+), 17 deletions(-) rename ui/dist/assets/{index-Dm8Q4Rp7.js => index-D0F7NB_8.js} (78%) diff --git a/ui/dist/assets/index-Dm8Q4Rp7.js b/ui/dist/assets/index-D0F7NB_8.js similarity index 78% rename from ui/dist/assets/index-Dm8Q4Rp7.js rename to ui/dist/assets/index-D0F7NB_8.js index 7b9bcd8e..d19ad202 100644 --- a/ui/dist/assets/index-Dm8Q4Rp7.js +++ b/ui/dist/assets/index-D0F7NB_8.js @@ -321,4 +321,4 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,s,o){function i(u,d){if(!s[u]){if(!r[u]){var f=typeof nd=="function"&&nd;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var m=s[u]={exports:{}};r[u][0].call(m.exports,function(x){var p=r[u][1][x];return i(p||x)},m,m.exports,n,r,s,o)}return s[u].exports}for(var a=typeof nd=="function"&&nd,c=0;c>2,m=(3&u)<<4|d>>4,x=1>6:64,p=2>4,d=(15&h)<<4|(m=a.indexOf(c.charAt(p++)))>>2,f=(3&m)<<6|(x=a.indexOf(c.charAt(p++))),v[w++]=u,m!==64&&(v[w++]=d),x!==64&&(v[w++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,r,s){var o=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,m,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=m,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,h){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var o=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var o=n("./utils"),i=function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c}();r.exports=function(a,c){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,d,f,h){var m=i,x=h+f;u^=-1;for(var p=h;p>>8^m[255&(u^d[p])];return-1^u}(0|c,a,a.length,0):function(u,d,f,h){var m=i,x=h+f;u^=-1;for(var p=h;p>>8^m[255&(u^d.charCodeAt(p))];return-1^u}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var o=null;o=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:o}},{lie:37}],7:[function(n,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),a=n("./utils"),c=n("./stream/GenericWorker"),u=o?"uint8array":"array";function d(f,h){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}s.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},s.compressWorker=function(f){return new d("Deflate",f)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function o(m,x){var p,w="";for(p=0;p>>=8;return w}function i(m,x,p,w,y,v){var b,_,C=m.file,j=m.compression,T=v!==u.utf8encode,R=a.transformTo("string",v(C.name)),A=a.transformTo("string",u.utf8encode(C.name)),O=C.comment,G=a.transformTo("string",v(O)),N=a.transformTo("string",u.utf8encode(O)),z=A.length!==C.name.length,S=N.length!==O.length,U="",J="",F="",W=C.dir,I=C.date,X={crc32:0,compressedSize:0,uncompressedSize:0};x&&!p||(X.crc32=m.crc32,X.compressedSize=m.compressedSize,X.uncompressedSize=m.uncompressedSize);var $=0;x&&($|=8),T||!z&&!S||($|=2048);var B=0,he=0;W&&(B|=16),y==="UNIX"?(he=798,B|=function(oe,Oe){var me=oe;return oe||(me=Oe?16893:33204),(65535&me)<<16}(C.unixPermissions,W)):(he=20,B|=function(oe){return 63&(oe||0)}(C.dosPermissions)),b=I.getUTCHours(),b<<=6,b|=I.getUTCMinutes(),b<<=5,b|=I.getUTCSeconds()/2,_=I.getUTCFullYear()-1980,_<<=4,_|=I.getUTCMonth()+1,_<<=5,_|=I.getUTCDate(),z&&(J=o(1,1)+o(d(R),4)+A,U+="up"+o(J.length,2)+J),S&&(F=o(1,1)+o(d(G),4)+N,U+="uc"+o(F.length,2)+F);var se="";return se+=` -\0`,se+=o($,2),se+=j.magic,se+=o(b,2),se+=o(_,2),se+=o(X.crc32,4),se+=o(X.compressedSize,4),se+=o(X.uncompressedSize,4),se+=o(R.length,2),se+=o(U.length,2),{fileRecord:f.LOCAL_FILE_HEADER+se+R+U,dirRecord:f.CENTRAL_FILE_HEADER+o(he,2)+se+o(G.length,2)+"\0\0\0\0"+o(B,4)+o(w,4)+R+U+G}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(m,x,p,w){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=p,this.encodeFileName=w,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,c),h.prototype.push=function(m){var x=m.meta.percent||0,p=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:p?(x+100*(p-w-1))/p:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var x=this.streamFiles&&!m.file.dir;if(x){var p=i(m,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var x=this.streamFiles&&!m.file.dir,p=i(m,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),x)this.push({data:function(w){return f.DATA_DESCRIPTOR+o(w.crc32,4)+o(w.compressedSize,4)+o(w.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,s){var o=n("./Uint8ArrayReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,s){var o=n("./DataReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,s){var o=n("./ArrayReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,s){var o=n("../utils"),i=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=o.getTypeOf(f);return o.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var o=n("./GenericWorker"),i=n("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,s){var o=n("./GenericWorker"),i=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},r.exports=o},{}],29:[function(n,r,s){var o=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(x,p){return new d.Promise(function(w,y){var v=[],b=x._internalType,_=x._outputType,C=x._mimeType;x.on("data",function(j,T){v.push(j),p&&p(T)}).on("error",function(j){v=[],y(j)}).on("end",function(){try{var j=function(T,R,A){switch(T){case"blob":return o.newBlob(o.transformTo("arraybuffer",R),A);case"base64":return c.encode(R);default:return o.transformTo(T,R)}}(_,function(T,R){var A,O=0,G=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var o=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}s.utf8encode=function(m){return i.nodebuffer?a.newBufferFrom(m,"utf-8"):function(x){var p,w,y,v,b,_=x.length,C=0;for(v=0;v<_;v++)(64512&(w=x.charCodeAt(v)))==55296&&v+1<_&&(64512&(y=x.charCodeAt(v+1)))==56320&&(w=65536+(w-55296<<10)+(y-56320),v++),C+=w<128?1:w<2048?2:w<65536?3:4;for(p=i.uint8array?new Uint8Array(C):new Array(C),v=b=0;b>>6:(w<65536?p[b++]=224|w>>>12:(p[b++]=240|w>>>18,p[b++]=128|w>>>12&63),p[b++]=128|w>>>6&63),p[b++]=128|63&w);return p}(m)},s.utf8decode=function(m){return i.nodebuffer?o.transformTo("nodebuffer",m).toString("utf-8"):function(x){var p,w,y,v,b=x.length,_=new Array(2*b);for(p=w=0;p>10&1023,_[w++]=56320|1023&y)}return _.length!==w&&(_.subarray?_=_.subarray(0,w):_.length=w),o.applyFromCharCode(_)}(m=o.transformTo(i.uint8array?"uint8array":"array",m))},o.inherits(f,c),f.prototype.processChunk=function(m){var x=o.transformTo(i.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=x;(x=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),x.set(p,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var w=function(v,b){var _;for((b=b||v.length)>v.length&&(b=v.length),_=b-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?b:_+u[v[_]]>b?_:b}(x),y=x;w!==x.length&&(i.uint8array?(y=x.subarray(0,w),this.leftOver=x.subarray(w,x.length)):(y=x.slice(0,w),this.leftOver=x.slice(w,x.length))),this.push({data:s.utf8decode(y),meta:m.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(h,c),h.prototype.processChunk=function(m){this.push({data:s.utf8encode(m.data),meta:m.meta})},s.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var o=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(p){return p}function d(p,w){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var x,p,w,y=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4>>6:(m<65536?h[w++]=224|m>>>12:(h[w++]=240|m>>>18,h[w++]=128|m>>>12&63),h[w++]=128|m>>>6&63),h[w++]=128|63&m);return h},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var h=new o.Buf8(f.length),m=0,x=h.length;m>10&1023,v[x++]=56320|1023&p)}return d(v,x)},s.utf8border=function(f,h){var m;for((h=h||f.length)>f.length&&(h=f.length),m=h-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?h:m+c[f[m]]>h?m:h}},{"./common":41}],43:[function(n,r,s){r.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();r.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var h=u;h>>8^d[255&(i^a[h])];return-1^i}},{}],46:[function(n,r,s){var o,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,m=0,x=-2,p=-1,w=4,y=2,v=8,b=9,_=286,C=30,j=19,T=2*_+1,R=15,A=3,O=258,G=O+A+1,N=42,z=113,S=1,U=2,J=3,F=4;function W(E,ee){return E.msg=d[ee],ee}function I(E){return(E<<1)-(4E.avail_out&&(Z=E.avail_out),Z!==0&&(i.arraySet(E.output,ee.pending_buf,ee.pending_out,Z,E.next_out),E.next_out+=Z,ee.pending_out+=Z,E.total_out+=Z,E.avail_out-=Z,ee.pending-=Z,ee.pending===0&&(ee.pending_out=0))}function B(E,ee){a._tr_flush_block(E,0<=E.block_start?E.block_start:-1,E.strstart-E.block_start,ee),E.block_start=E.strstart,$(E.strm)}function he(E,ee){E.pending_buf[E.pending++]=ee}function se(E,ee){E.pending_buf[E.pending++]=ee>>>8&255,E.pending_buf[E.pending++]=255&ee}function oe(E,ee){var Z,D,k=E.max_chain_length,P=E.strstart,M=E.prev_length,K=E.nice_match,L=E.strstart>E.w_size-G?E.strstart-(E.w_size-G):0,Y=E.window,Q=E.w_mask,te=E.prev,ge=E.strstart+O,Ke=Y[P+M-1],Ue=Y[P+M];E.prev_length>=E.good_match&&(k>>=2),K>E.lookahead&&(K=E.lookahead);do if(Y[(Z=ee)+M]===Ue&&Y[Z+M-1]===Ke&&Y[Z]===Y[P]&&Y[++Z]===Y[P+1]){P+=2,Z++;do;while(Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&PL&&--k!=0);return M<=E.lookahead?M:E.lookahead}function Oe(E){var ee,Z,D,k,P,M,K,L,Y,Q,te=E.w_size;do{if(k=E.window_size-E.lookahead-E.strstart,E.strstart>=te+(te-G)){for(i.arraySet(E.window,E.window,te,te,0),E.match_start-=te,E.strstart-=te,E.block_start-=te,ee=Z=E.hash_size;D=E.head[--ee],E.head[ee]=te<=D?D-te:0,--Z;);for(ee=Z=te;D=E.prev[--ee],E.prev[ee]=te<=D?D-te:0,--Z;);k+=te}if(E.strm.avail_in===0)break;if(M=E.strm,K=E.window,L=E.strstart+E.lookahead,Y=k,Q=void 0,Q=M.avail_in,Y=A)for(P=E.strstart-E.insert,E.ins_h=E.window[P],E.ins_h=(E.ins_h<=A&&(E.ins_h=(E.ins_h<=A)if(D=a._tr_tally(E,E.strstart-E.match_start,E.match_length-A),E.lookahead-=E.match_length,E.match_length<=E.max_lazy_match&&E.lookahead>=A){for(E.match_length--;E.strstart++,E.ins_h=(E.ins_h<=A&&(E.ins_h=(E.ins_h<=A&&E.match_length<=E.prev_length){for(k=E.strstart+E.lookahead-A,D=a._tr_tally(E,E.strstart-1-E.prev_match,E.prev_length-A),E.lookahead-=E.prev_length-1,E.prev_length-=2;++E.strstart<=k&&(E.ins_h=(E.ins_h<E.pending_buf_size-5&&(Z=E.pending_buf_size-5);;){if(E.lookahead<=1){if(Oe(E),E.lookahead===0&&ee===f)return S;if(E.lookahead===0)break}E.strstart+=E.lookahead,E.lookahead=0;var D=E.block_start+Z;if((E.strstart===0||E.strstart>=D)&&(E.lookahead=E.strstart-D,E.strstart=D,B(E,!1),E.strm.avail_out===0)||E.strstart-E.block_start>=E.w_size-G&&(B(E,!1),E.strm.avail_out===0))return S}return E.insert=0,ee===h?(B(E,!0),E.strm.avail_out===0?J:F):(E.strstart>E.block_start&&(B(E,!1),E.strm.avail_out),S)}),new Te(4,4,8,4,me),new Te(4,5,16,8,me),new Te(4,6,32,32,me),new Te(4,4,16,16,we),new Te(8,16,32,32,we),new Te(8,16,128,128,we),new Te(8,32,128,256,we),new Te(32,128,258,1024,we),new Te(32,258,258,4096,we)],s.deflateInit=function(E,ee){return st(E,ee,v,15,8,0)},s.deflateInit2=st,s.deflateReset=Re,s.deflateResetKeep=Ie,s.deflateSetHeader=function(E,ee){return E&&E.state?E.state.wrap!==2?x:(E.state.gzhead=ee,m):x},s.deflate=function(E,ee){var Z,D,k,P;if(!E||!E.state||5>8&255),he(D,D.gzhead.time>>16&255),he(D,D.gzhead.time>>24&255),he(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),he(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(he(D,255&D.gzhead.extra.length),he(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(E.adler=u(E.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(he(D,0),he(D,0),he(D,0),he(D,0),he(D,0),he(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),he(D,3),D.status=z);else{var M=v+(D.w_bits-8<<4)<<8;M|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(M|=32),M+=31-M%31,D.status=z,se(D,M),D.strstart!==0&&(se(D,E.adler>>>16),se(D,65535&E.adler)),E.adler=1}if(D.status===69)if(D.gzhead.extra){for(k=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending!==D.pending_buf_size));)he(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){k=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending===D.pending_buf_size)){P=1;break}P=D.gzindexk&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),P===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){k=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending===D.pending_buf_size)){P=1;break}P=D.gzindexk&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),P===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&$(E),D.pending+2<=D.pending_buf_size&&(he(D,255&E.adler),he(D,E.adler>>8&255),E.adler=0,D.status=z)):D.status=z),D.pending!==0){if($(E),E.avail_out===0)return D.last_flush=-1,m}else if(E.avail_in===0&&I(ee)<=I(Z)&&ee!==h)return W(E,-5);if(D.status===666&&E.avail_in!==0)return W(E,-5);if(E.avail_in!==0||D.lookahead!==0||ee!==f&&D.status!==666){var K=D.strategy===2?function(L,Y){for(var Q;;){if(L.lookahead===0&&(Oe(L),L.lookahead===0)){if(Y===f)return S;break}if(L.match_length=0,Q=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,Q&&(B(L,!1),L.strm.avail_out===0))return S}return L.insert=0,Y===h?(B(L,!0),L.strm.avail_out===0?J:F):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?S:U}(D,ee):D.strategy===3?function(L,Y){for(var Q,te,ge,Ke,Ue=L.window;;){if(L.lookahead<=O){if(Oe(L),L.lookahead<=O&&Y===f)return S;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=A&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=A?(Q=a._tr_tally(L,1,L.match_length-A),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(Q=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),Q&&(B(L,!1),L.strm.avail_out===0))return S}return L.insert=0,Y===h?(B(L,!0),L.strm.avail_out===0?J:F):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?S:U}(D,ee):o[D.level].func(D,ee);if(K!==J&&K!==F||(D.status=666),K===S||K===J)return E.avail_out===0&&(D.last_flush=-1),m;if(K===U&&(ee===1?a._tr_align(D):ee!==5&&(a._tr_stored_block(D,0,0,!1),ee===3&&(X(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),$(E),E.avail_out===0))return D.last_flush=-1,m}return ee!==h?m:D.wrap<=0?1:(D.wrap===2?(he(D,255&E.adler),he(D,E.adler>>8&255),he(D,E.adler>>16&255),he(D,E.adler>>24&255),he(D,255&E.total_in),he(D,E.total_in>>8&255),he(D,E.total_in>>16&255),he(D,E.total_in>>24&255)):(se(D,E.adler>>>16),se(D,65535&E.adler)),$(E),0=Z.w_size&&(P===0&&(X(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),Y=new i.Buf8(Z.w_size),i.arraySet(Y,ee,Q-Z.w_size,Z.w_size,0),ee=Y,Q=Z.w_size),M=E.avail_in,K=E.next_in,L=E.input,E.avail_in=Q,E.next_in=0,E.input=ee,Oe(Z);Z.lookahead>=A;){for(D=Z.strstart,k=Z.lookahead-(A-1);Z.ins_h=(Z.ins_h<>>=A=R>>>24,b-=A,(A=R>>>16&255)===0)U[d++]=65535&R;else{if(!(16&A)){if(!(64&A)){R=_[(65535&R)+(v&(1<>>=A,b-=A),b<15&&(v+=S[c++]<>>=A=R>>>24,b-=A,!(16&(A=R>>>16&255))){if(!(64&A)){R=C[(65535&R)+(v&(1<>>=A,b-=A,(A=d-f)>3,v&=(1<<(b-=O<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(N){var z;return N&&N.state?(z=N.state,N.total_in=N.total_out=z.total=0,N.msg="",z.wrap&&(N.adler=1&z.wrap),z.mode=x,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new o.Buf32(p),z.distcode=z.distdyn=new o.Buf32(w),z.sane=1,z.back=-1,h):m}function _(N){var z;return N&&N.state?((z=N.state).wsize=0,z.whave=0,z.wnext=0,b(N)):m}function C(N,z){var S,U;return N&&N.state?(U=N.state,z<0?(S=0,z=-z):(S=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15=F.wsize?(o.arraySet(F.window,z,S-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(U<(J=F.wsize-F.wnext)&&(J=U),o.arraySet(F.window,z,S-U,J,F.wnext),(U-=J)?(o.arraySet(F.window,z,S-U,U,0),F.wnext=U,F.whave=F.wsize):(F.wnext+=J,F.wnext===F.wsize&&(F.wnext=0),F.whave>>8&255,S.check=a(S.check,P,2,0),B=$=0,S.mode=2;break}if(S.flags=0,S.head&&(S.head.done=!1),!(1&S.wrap)||(((255&$)<<8)+($>>8))%31){N.msg="incorrect header check",S.mode=30;break}if((15&$)!=8){N.msg="unknown compression method",S.mode=30;break}if(B-=4,E=8+(15&($>>>=4)),S.wbits===0)S.wbits=E;else if(E>S.wbits){N.msg="invalid window size",S.mode=30;break}S.dmax=1<>8&1),512&S.flags&&(P[0]=255&$,P[1]=$>>>8&255,S.check=a(S.check,P,2,0)),B=$=0,S.mode=3;case 3:for(;B<32;){if(I===0)break e;I--,$+=U[F++]<>>8&255,P[2]=$>>>16&255,P[3]=$>>>24&255,S.check=a(S.check,P,4,0)),B=$=0,S.mode=4;case 4:for(;B<16;){if(I===0)break e;I--,$+=U[F++]<>8),512&S.flags&&(P[0]=255&$,P[1]=$>>>8&255,S.check=a(S.check,P,2,0)),B=$=0,S.mode=5;case 5:if(1024&S.flags){for(;B<16;){if(I===0)break e;I--,$+=U[F++]<>>8&255,S.check=a(S.check,P,2,0)),B=$=0}else S.head&&(S.head.extra=null);S.mode=6;case 6:if(1024&S.flags&&(I<(oe=S.length)&&(oe=I),oe&&(S.head&&(E=S.head.extra_len-S.length,S.head.extra||(S.head.extra=new Array(S.head.extra_len)),o.arraySet(S.head.extra,U,F,oe,E)),512&S.flags&&(S.check=a(S.check,U,oe,F)),I-=oe,F+=oe,S.length-=oe),S.length))break e;S.length=0,S.mode=7;case 7:if(2048&S.flags){if(I===0)break e;for(oe=0;E=U[F+oe++],S.head&&E&&S.length<65536&&(S.head.name+=String.fromCharCode(E)),E&&oe>9&1,S.head.done=!0),N.adler=S.check=0,S.mode=12;break;case 10:for(;B<32;){if(I===0)break e;I--,$+=U[F++]<>>=7&B,B-=7&B,S.mode=27;break}for(;B<3;){if(I===0)break e;I--,$+=U[F++]<>>=1)){case 0:S.mode=14;break;case 1:if(O(S),S.mode=20,z!==6)break;$>>>=2,B-=2;break e;case 2:S.mode=17;break;case 3:N.msg="invalid block type",S.mode=30}$>>>=2,B-=2;break;case 14:for($>>>=7&B,B-=7&B;B<32;){if(I===0)break e;I--,$+=U[F++]<>>16^65535)){N.msg="invalid stored block lengths",S.mode=30;break}if(S.length=65535&$,B=$=0,S.mode=15,z===6)break e;case 15:S.mode=16;case 16:if(oe=S.length){if(I>>=5,B-=5,S.ndist=1+(31&$),$>>>=5,B-=5,S.ncode=4+(15&$),$>>>=4,B-=4,286>>=3,B-=3}for(;S.have<19;)S.lens[M[S.have++]]=0;if(S.lencode=S.lendyn,S.lenbits=7,Z={bits:S.lenbits},ee=u(0,S.lens,0,19,S.lencode,0,S.work,Z),S.lenbits=Z.bits,ee){N.msg="invalid code lengths set",S.mode=30;break}S.have=0,S.mode=19;case 19:for(;S.have>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=we,B-=we,S.lens[S.have++]=Fe;else{if(Fe===16){for(D=we+2;B>>=we,B-=we,S.have===0){N.msg="invalid bit length repeat",S.mode=30;break}E=S.lens[S.have-1],oe=3+(3&$),$>>>=2,B-=2}else if(Fe===17){for(D=we+3;B>>=we)),$>>>=3,B-=3}else{for(D=we+7;B>>=we)),$>>>=7,B-=7}if(S.have+oe>S.nlen+S.ndist){N.msg="invalid bit length repeat",S.mode=30;break}for(;oe--;)S.lens[S.have++]=E}}if(S.mode===30)break;if(S.lens[256]===0){N.msg="invalid code -- missing end-of-block",S.mode=30;break}if(S.lenbits=9,Z={bits:S.lenbits},ee=u(d,S.lens,0,S.nlen,S.lencode,0,S.work,Z),S.lenbits=Z.bits,ee){N.msg="invalid literal/lengths set",S.mode=30;break}if(S.distbits=6,S.distcode=S.distdyn,Z={bits:S.distbits},ee=u(f,S.lens,S.nlen,S.ndist,S.distcode,0,S.work,Z),S.distbits=Z.bits,ee){N.msg="invalid distances set",S.mode=30;break}if(S.mode=20,z===6)break e;case 20:S.mode=21;case 21:if(6<=I&&258<=X){N.next_out=W,N.avail_out=X,N.next_in=F,N.avail_in=I,S.hold=$,S.bits=B,c(N,se),W=N.next_out,J=N.output,X=N.avail_out,F=N.next_in,U=N.input,I=N.avail_in,$=S.hold,B=S.bits,S.mode===12&&(S.back=-1);break}for(S.back=0;Te=(k=S.lencode[$&(1<>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>Ie)])>>>16&255,Fe=65535&k,!(Ie+(we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=Ie,B-=Ie,S.back+=Ie}if($>>>=we,B-=we,S.back+=we,S.length=Fe,Te===0){S.mode=26;break}if(32&Te){S.back=-1,S.mode=12;break}if(64&Te){N.msg="invalid literal/length code",S.mode=30;break}S.extra=15&Te,S.mode=22;case 22:if(S.extra){for(D=S.extra;B>>=S.extra,B-=S.extra,S.back+=S.extra}S.was=S.length,S.mode=23;case 23:for(;Te=(k=S.distcode[$&(1<>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>Ie)])>>>16&255,Fe=65535&k,!(Ie+(we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=Ie,B-=Ie,S.back+=Ie}if($>>>=we,B-=we,S.back+=we,64&Te){N.msg="invalid distance code",S.mode=30;break}S.offset=Fe,S.extra=15&Te,S.mode=24;case 24:if(S.extra){for(D=S.extra;B>>=S.extra,B-=S.extra,S.back+=S.extra}if(S.offset>S.dmax){N.msg="invalid distance too far back",S.mode=30;break}S.mode=25;case 25:if(X===0)break e;if(oe=se-X,S.offset>oe){if((oe=S.offset-oe)>S.whave&&S.sane){N.msg="invalid distance too far back",S.mode=30;break}Oe=oe>S.wnext?(oe-=S.wnext,S.wsize-oe):S.wnext-oe,oe>S.length&&(oe=S.length),me=S.window}else me=J,Oe=W-S.offset,oe=S.length;for(XT?(A=Oe[me+w[z]],B[he+w[z]]):(A=96,0),v=1<>W)+(b-=v)]=R<<24|A<<16|O|0,b!==0;);for(v=1<>=1;if(v!==0?($&=v-1,$+=v):$=0,z++,--se[N]==0){if(N===U)break;N=f[h+w[z]]}if(J>>7)]}function he(k,P){k.pending_buf[k.pending++]=255&P,k.pending_buf[k.pending++]=P>>>8&255}function se(k,P,M){k.bi_valid>y-M?(k.bi_buf|=P<>y-k.bi_valid,k.bi_valid+=M-y):(k.bi_buf|=P<>>=1,M<<=1,0<--P;);return M>>>1}function me(k,P,M){var K,L,Y=new Array(w+1),Q=0;for(K=1;K<=w;K++)Y[K]=Q=Q+M[K-1]<<1;for(L=0;L<=P;L++){var te=k[2*L+1];te!==0&&(k[2*L]=Oe(Y[te]++,te))}}function we(k){var P;for(P=0;P>1;1<=M;M--)Ie(k,Y,M);for(L=ge;M=k.heap[1],k.heap[1]=k.heap[k.heap_len--],Ie(k,Y,1),K=k.heap[1],k.heap[--k.heap_max]=M,k.heap[--k.heap_max]=K,Y[2*L]=Y[2*M]+Y[2*K],k.depth[L]=(k.depth[M]>=k.depth[K]?k.depth[M]:k.depth[K])+1,Y[2*M+1]=Y[2*K+1]=L,k.heap[1]=L++,Ie(k,Y,1),2<=k.heap_len;);k.heap[--k.heap_max]=k.heap[1],function(Ue,Et){var nr,Kt,fs,lt,hs,ms,rr=Et.dyn_tree,xu=Et.max_code,wu=Et.stat_desc.static_tree,Ai=Et.stat_desc.has_stree,bu=Et.stat_desc.extra_bits,Di=Et.stat_desc.extra_base,$r=Et.stat_desc.max_length,Xs=0;for(lt=0;lt<=w;lt++)Ue.bl_count[lt]=0;for(rr[2*Ue.heap[Ue.heap_max]+1]=0,nr=Ue.heap_max+1;nr>=7;L>>=1)if(1&Ke&&te.dyn_ltree[2*ge]!==0)return i;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return a;for(ge=32;ge>>3,(Y=k.static_len+3+7>>>3)<=L&&(L=Y)):L=Y=M+5,M+4<=L&&P!==-1?D(k,P,M,K):k.strategy===4||Y===L?(se(k,2+(K?1:0),3),Re(k,G,N)):(se(k,4+(K?1:0),3),function(te,ge,Ke,Ue){var Et;for(se(te,ge-257,5),se(te,Ke-1,5),se(te,Ue-4,4),Et=0;Et>>8&255,k.pending_buf[k.d_buf+2*k.last_lit+1]=255&P,k.pending_buf[k.l_buf+k.last_lit]=255&M,k.last_lit++,P===0?k.dyn_ltree[2*M]++:(k.matches++,P--,k.dyn_ltree[2*(S[M]+f+1)]++,k.dyn_dtree[2*B(P)]++),k.last_lit===k.lit_bufsize-1},s._tr_align=function(k){se(k,2,3),oe(k,b,G),function(P){P.bi_valid===16?(he(P,P.bi_buf),P.bi_buf=0,P.bi_valid=0):8<=P.bi_valid&&(P.pending_buf[P.pending++]=255&P.bi_buf,P.bi_buf>>=8,P.bi_valid-=8)}(k)}},{"../utils/common":41}],53:[function(n,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,h=1,m={},x=!1,p=i.document,w=Object.getPrototypeOf&&Object.getPrototypeOf(i);w=w&&w.setTimeout?w:i,c={}.toString.call(i.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(i.postMessage&&!i.importScripts){var _=!0,C=i.onmessage;return i.onmessage=function(){_=!1},i.postMessage("","*"),i.onmessage=C,_}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",b,!1):i.attachEvent("onmessage",b),function(_){i.postMessage(f+_,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){d.port2.postMessage(_)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(_){var C=p.createElement("script");C.onreadystatechange=function(){v(_),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(_){setTimeout(v,0,_)},w.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var C=new Array(arguments.length-1),j=0;j"u"?o===void 0?this:o:self)}).call(this,typeof ju<"u"?ju:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(gN);var VU=gN.exports;const BU=Vf(VU);function WU(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{r.result?t(r.result.toString()):n("No content found")},r.onerror=()=>n(r.error),r.readAsText(e)})}const HU=async(e,t)=>{const n=new BU;t.forEach(o=>{n.file(o.name,o.content)});const r=await n.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(r),s.download=e,s.click()},Ma=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},YU=e=>Ma(e).split(" ")[0];function yN(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${n}-${r}-${s} ${o}:${i}:${a}`}const KU=async e=>{let t=1;e.page&&(t=e.page);let n=2;e.perPage&&(n=e.perPage);const r=ot();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=r.filter("expiredAt<{:expiredAt}",{expiredAt:yN(15)})),r.collection("domains").getList(t,n,{sort:"-created",expand:"lastDeployment",filter:s})},GU=async()=>{const e=ot(),t=await e.collection("domains").getList(1,1,{}),n=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:yN(15)})}),r=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:n.totalItems,enabled:r.totalItems,disabled:s.totalItems}},ZU=async e=>await ot().collection("domains").getOne(e),pf=async e=>e.id?await ot().collection("domains").update(e.id,e):await ot().collection("domains").create(e),qU=async e=>await ot().collection("domains").delete(e),XU=(e,t)=>ot().collection("domains").subscribe(e,n=>{n.action==="update"&&t(n.record)},{expand:"lastDeployment"}),QU=e=>{ot().collection("domains").unsubscribe(e)},JU=()=>{const e=Fr(),t=er(),{t:n}=Ye(),r=Mr(),s=new URLSearchParams(r.search),o=s.get("page"),i=s.get("state"),[a,c]=g.useState(0),u=()=>{t("/edit")},d=_=>{s.set("page",_.toString()),t(`?${s.toString()}`)},f=_=>{t(`/edit?id=${_}`)},h=_=>{t(`/history?domain=${_}`)},m=async _=>{try{await qU(_),p(x.filter(C=>C.id!==_))}catch(C){console.error("Error deleting domain:",C)}},[x,p]=g.useState([]);g.useEffect(()=>{(async()=>{const C=await KU({page:o?Number(o):1,perPage:10,state:i||""});p(C.items),c(C.totalPages)})()},[o,i]);const w=async _=>{const C=x.filter(A=>A.id===_),j=C[0].enabled,T=C[0];T.enabled=!j,await pf(T);const R=x.map(A=>A.id===_?{...A,checked:!j}:A);p(R)},y=async _=>{try{QU(_.id??""),XU(_.id??"",C=>{console.log(C);const j=x.map(T=>T.id===C.id?{...C}:T);p(j)}),_.rightnow=!0,await pf(_),e.toast({title:n("domain.deploy.started.message"),description:n("domain.deploy.started.tips")})}catch{e.toast({title:n("domain.deploy.failed.message"),description:l.jsxs(fI,{i18nKey:"domain.deploy.failed.tips",children:["text1",l.jsx(bn,{to:`/history?domain=${_.id}`,className:"underline text-blue-500",children:"text2"}),"text3"]}),variant:"destructive"})}},v=async _=>{await y({..._,deployed:!1})},b=async _=>{const C=`${_.id}-${_.domain}.zip`,j=[{name:`${_.domain}.pem`,content:_.certificate?_.certificate:""},{name:`${_.domain}.key`,content:_.privateKey?_.privateKey:""}];await HU(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(Rx,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:n("domain.page.title")}),l.jsx(Me,{onClick:u,children:n("domain.add")})]}),x.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-36",children:n("common.text.domain")}),l.jsx("div",{className:"w-40",children:n("domain.props.expiry")}),l.jsx("div",{className:"w-32",children:n("domain.props.last_execution_status")}),l.jsx("div",{className:"w-64",children:n("domain.props.last_execution_stage")}),l.jsx("div",{className:"w-40 sm:ml-2",children:n("domain.props.last_execution_time")}),l.jsx("div",{className:"w-24",children:n("domain.props.enable")}),l.jsx("div",{className:"grow",children:n("common.text.operations")})]}),x.map(_=>{var C,j,T,R;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-36 w-full pt-1 sm:pt-0 flex items-center truncate",children:_.domain.split(";").map(A=>l.jsxs(l.Fragment,{children:[A,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:_.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:n("domain.props.expiry.date1",{date:90})}),l.jsx("div",{children:n("domain.props.expiry.date2",{date:YU(_.expiredAt)})})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:_.lastDeployedAt&&((C=_.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Sx,{deployment:_.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:_.lastDeployedAt&&((j=_.expand)!=null&&j.lastDeployment)?l.jsx(xx,{phase:(T=_.expand.lastDeployment)==null?void 0:T.phase,phaseSuccess:(R=_.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:_.lastDeployedAt?Ma(_.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(bx,{children:l.jsxs(hE,{children:[l.jsx(mE,{children:l.jsx(pu,{checked:_.enabled,onCheckedChange:()=>{w(_.id??"")}})}),l.jsx(_x,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:_.enabled?n("domain.props.enable.disabled"):n("domain.props.enable.enabled")})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>h(_.id??""),children:n("domain.history")}),l.jsxs(dr,{when:!!_.enabled,children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>y(_),children:n("domain.deploy")})]}),l.jsxs(dr,{when:!!(_.enabled&&_.deployed),children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>v(_),children:n("domain.deploy_forced")})]}),l.jsxs(dr,{when:!!_.expiredAt,children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>b(_),children:n("common.download")})]}),!_.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:n("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{children:n("domain.delete")}),l.jsx(Uh,{children:n("domain.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{children:n("common.cancel")}),l.jsx(Vh,{onClick:()=>{m(_.id??"")},children:n("common.confirm")})]})]})]}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>f(_.id??""),children:n("common.edit")})]})]})]},_.id)}),l.jsx(wE,{totalPages:a,currentPage:o?Number(o):1,onPageChange:_=>{d(_)}})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(mg,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:n("domain.nodata")}),l.jsx(Me,{onClick:u,className:"mt-3",children:n("domain.add")})]})})]})})};var gu=e=>e.type==="checkbox",ua=e=>e instanceof Date,Sn=e=>e==null;const vN=e=>typeof e=="object";var Qt=e=>!Sn(e)&&!Array.isArray(e)&&vN(e)&&!ua(e),xN=e=>Qt(e)&&e.target?gu(e.target)?e.target.checked:e.target.value:e,e8=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wN=(e,t)=>e.has(e8(t)),t8=e=>{const t=e.constructor&&e.constructor.prototype;return Qt(t)&&t.hasOwnProperty("isPrototypeOf")},Ax=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Pn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Ax&&(e instanceof Blob||e instanceof FileList))&&(n||Qt(e)))if(t=n?[]:{},!n&&!t8(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Pn(e[r]));else return e;return t}var Yh=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,de=(e,t,n)=>{if(!t||!Qt(e))return n;const r=Yh(t.split(/[,[\].]+?/)).reduce((s,o)=>Sn(s)?s:s[o],e);return Ft(r)||r===e?Ft(e[t])?n:e[t]:r},Kr=e=>typeof e=="boolean",Dx=e=>/^\w*$/.test(e),bN=e=>Yh(e.replace(/["|']|\]/g,"").split(/\.|\[/)),mt=(e,t,n)=>{let r=-1;const s=Dx(t)?[t]:bN(t),o=s.length,i=o-1;for(;++rWe.useContext(_N),n8=e=>{const{children:t,...n}=e;return We.createElement(_N.Provider,{value:n},t)};var SN=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Sr.all&&(t._proxyFormState[i]=!r||Sr.all),n&&(n[i]=!0),e[i]}});return s},zn=e=>Qt(e)&&!Object.keys(e).length,kN=(e,t,n,r)=>{n(e);const{name:s,...o}=e;return zn(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!r||Sr.all))},ec=e=>Array.isArray(e)?e:[e],CN=(e,t,n)=>!e||!t||e===t||ec(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function Ox(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function r8(e){const t=Kh(),{control:n=t.control,disabled:r,name:s,exact:o}=e||{},[i,a]=We.useState(n._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,Ox({disabled:r,next:f=>c.current&&CN(d.current,f.name,o)&&kN(f,u.current,n._updateFormState)&&a({...n._formState,...f}),subject:n._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),SN(i,n,u.current,!1)}var Zr=e=>typeof e=="string",jN=(e,t,n,r,s)=>Zr(e)?(r&&t.watch.add(e),de(n,e,s)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),de(n,o))):(r&&(t.watchAll=!0),n);function s8(e){const t=Kh(),{control:n=t.control,name:r,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(r);a.current=r,Ox({disabled:o,subject:n._subjects.values,next:d=>{CN(a.current,d.name,i)&&u(Pn(jN(a.current,n._names,d.values||n._formValues,!1,s)))}});const[c,u]=We.useState(n._getWatch(r,s));return We.useEffect(()=>n._removeUnmounted()),c}function o8(e){const t=Kh(),{name:n,disabled:r,control:s=t.control,shouldUnregister:o}=e,i=wN(s._names.array,n),a=s8({control:s,name:n,defaultValue:de(s._formValues,n,de(s._defaultValues,n,e.defaultValue)),exact:!0}),c=r8({control:s,name:n}),u=We.useRef(s.register(n,{...e.rules,value:a,...Kr(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(h,m)=>{const x=de(s._fields,h);x&&x._f&&(x._f.mount=m)};if(f(n,!0),d){const h=Pn(de(s._options.defaultValues,n));mt(s._defaultValues,n,h),Ft(de(s._formValues,n))&&mt(s._formValues,n,h)}return()=>{(i?d&&!s._state.action:d)?s.unregister(n):f(n,!1)}},[n,s,i,o]),We.useEffect(()=>{de(s._fields,n)&&s._updateDisabledField({disabled:r,fields:s._fields,name:n,value:de(s._fields,n)._f.value})},[r,n,s]),{field:{name:n,value:a,...Kr(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:xN(d),name:n},type:gf.CHANGE}),[n]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:de(s._formValues,n),name:n},type:gf.BLUR}),[n,s]),ref:d=>{const f=de(s._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!de(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!de(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!de(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!de(c.validatingFields,n)},error:{enumerable:!0,get:()=>de(c.errors,n)}})}}const i8=e=>e.render(o8(e));var EN=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},Ib=e=>({isOnSubmit:!e||e===Sr.onSubmit,isOnBlur:e===Sr.onBlur,isOnChange:e===Sr.onChange,isOnAll:e===Sr.all,isOnTouch:e===Sr.onTouched}),Mb=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const tc=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const o=de(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;tc(a,t)}else Qt(a)&&tc(a,t)}}};var a8=(e,t,n)=>{const r=ec(de(e,n));return mt(r,"root",t[n]),mt(e,n,r),e},Ix=e=>e.type==="file",mo=e=>typeof e=="function",yf=e=>{if(!Ax)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ed=e=>Zr(e),Mx=e=>e.type==="radio",vf=e=>e instanceof RegExp;const Lb={value:!1,isValid:!1},zb={value:!0,isValid:!0};var NN=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?zb:{value:e[0].value,isValid:!0}:zb:Lb}return Lb};const Fb={isValid:!1,value:null};var TN=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Fb):Fb;function $b(e,t,n="validate"){if(Ed(e)||Array.isArray(e)&&e.every(Ed)||Kr(e)&&!e)return{type:n,message:Ed(e)?e:"",ref:t}}var Bi=e=>Qt(e)&&!vf(e)?e:{value:e,message:""},Ub=async(e,t,n,r,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:m,name:x,valueAsNumber:p,mount:w,disabled:y}=e._f,v=de(t,x);if(!w||y)return{};const b=i?i[0]:o,_=N=>{r&&b.reportValidity&&(b.setCustomValidity(Kr(N)?"":N||""),b.reportValidity())},C={},j=Mx(o),T=gu(o),R=j||T,A=(p||Ix(o))&&Ft(o.value)&&Ft(v)||yf(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,O=EN.bind(null,x,n,C),G=(N,z,S,U=vs.maxLength,J=vs.minLength)=>{const F=N?z:S;C[x]={type:N?U:J,message:F,ref:o,...O(N?U:J,F)}};if(s?!Array.isArray(v)||!v.length:a&&(!R&&(A||Sn(v))||Kr(v)&&!v||T&&!NN(i).isValid||j&&!TN(i).isValid)){const{value:N,message:z}=Ed(a)?{value:!!a,message:a}:Bi(a);if(N&&(C[x]={type:vs.required,message:z,ref:b,...O(vs.required,z)},!n))return _(z),C}if(!A&&(!Sn(d)||!Sn(f))){let N,z;const S=Bi(f),U=Bi(d);if(!Sn(v)&&!isNaN(v)){const J=o.valueAsNumber||v&&+v;Sn(S.value)||(N=J>S.value),Sn(U.value)||(z=Jnew Date(new Date().toDateString()+" "+X),W=o.type=="time",I=o.type=="week";Zr(S.value)&&v&&(N=W?F(v)>F(S.value):I?v>S.value:J>new Date(S.value)),Zr(U.value)&&v&&(z=W?F(v)+N.value,U=!Sn(z.value)&&v.length<+z.value;if((S||U)&&(G(S,N.message,z.message),!n))return _(C[x].message),C}if(h&&!A&&Zr(v)){const{value:N,message:z}=Bi(h);if(vf(N)&&!v.match(N)&&(C[x]={type:vs.pattern,message:z,ref:o,...O(vs.pattern,z)},!n))return _(z),C}if(m){if(mo(m)){const N=await m(v,t),z=$b(N,b);if(z&&(C[x]={...z,...O(vs.validate,z.message)},!n))return _(z.message),C}else if(Qt(m)){let N={};for(const z in m){if(!zn(N)&&!n)break;const S=$b(await m[z](v,t),b,z);S&&(N={...S,...O(z,S.message)},_(S.message),n&&(C[x]=N))}if(!zn(N)&&(C[x]={ref:b,...N},!n))return C}}return _(!0),C};function l8(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},xf=e=>Sn(e)||!vN(e);function Qo(e,t){if(xf(e)||xf(t))return e===t;if(ua(e)&&ua(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const o=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const i=t[s];if(ua(o)&&ua(i)||Qt(o)&&Qt(i)||Array.isArray(o)&&Array.isArray(i)?!Qo(o,i):o!==i)return!1}}return!0}var PN=e=>e.type==="select-multiple",u8=e=>Mx(e)||gu(e),lp=e=>yf(e)&&e.isConnected,RN=e=>{for(const t in e)if(mo(e[t]))return!0;return!1};function wf(e,t={}){const n=Array.isArray(e);if(Qt(e)||n)for(const r in e)Array.isArray(e[r])||Qt(e[r])&&!RN(e[r])?(t[r]=Array.isArray(e[r])?[]:{},wf(e[r],t[r])):Sn(e[r])||(t[r]=!0);return t}function AN(e,t,n){const r=Array.isArray(e);if(Qt(e)||r)for(const s in e)Array.isArray(e[s])||Qt(e[s])&&!RN(e[s])?Ft(t)||xf(n[s])?n[s]=Array.isArray(e[s])?wf(e[s],[]):{...wf(e[s])}:AN(e[s],Sn(t)?{}:t[s],n[s]):n[s]=!Qo(e[s],t[s]);return n}var rd=(e,t)=>AN(e,t,wf(t)),DN=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ft(e)?e:t?e===""?NaN:e&&+e:n&&Zr(e)?new Date(e):r?r(e):e;function cp(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Ix(t)?t.files:Mx(t)?TN(e.refs).value:PN(t)?[...t.selectedOptions].map(({value:n})=>n):gu(t)?NN(e.refs).value:DN(Ft(t.value)?e.ref.value:t.value,e)}var d8=(e,t,n,r)=>{const s={};for(const o of e){const i=de(t,o);i&&mt(s,o,i._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},El=e=>Ft(e)?e:vf(e)?e.source:Qt(e)?vf(e.value)?e.value.source:e.value:e,f8=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Vb(e,t,n){const r=de(e,n);if(r||Dx(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const o=s.join("."),i=de(t,o),a=de(e,o);if(i&&!Array.isArray(i)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:n}}var h8=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,m8=(e,t)=>!Yh(de(e,t)).length&&Gt(e,t);const p8={mode:Sr.onSubmit,reValidateMode:Sr.onChange,shouldFocusError:!0};function g8(e={}){let t={...p8,...e},n={submitCount:0,isDirty:!1,isLoading:mo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=Qt(t.defaultValues)||Qt(t.values)?Pn(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Pn(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:ap(),array:ap(),state:ap()},h=Ib(t.mode),m=Ib(t.reValidateMode),x=t.criteriaMode===Sr.all,p=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},w=async k=>{if(d.isValid||k){const P=t.resolver?zn((await R()).errors):await O(r,!0);P!==n.isValid&&f.state.next({isValid:P})}},y=(k,P)=>{(d.isValidating||d.validatingFields)&&((k||Array.from(a.mount)).forEach(M=>{M&&(P?mt(n.validatingFields,M,P):Gt(n.validatingFields,M))}),f.state.next({validatingFields:n.validatingFields,isValidating:!zn(n.validatingFields)}))},v=(k,P=[],M,K,L=!0,Y=!0)=>{if(K&&M){if(i.action=!0,Y&&Array.isArray(de(r,k))){const Q=M(de(r,k),K.argA,K.argB);L&&mt(r,k,Q)}if(Y&&Array.isArray(de(n.errors,k))){const Q=M(de(n.errors,k),K.argA,K.argB);L&&mt(n.errors,k,Q),m8(n.errors,k)}if(d.touchedFields&&Y&&Array.isArray(de(n.touchedFields,k))){const Q=M(de(n.touchedFields,k),K.argA,K.argB);L&&mt(n.touchedFields,k,Q)}d.dirtyFields&&(n.dirtyFields=rd(s,o)),f.state.next({name:k,isDirty:N(k,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mt(o,k,P)},b=(k,P)=>{mt(n.errors,k,P),f.state.next({errors:n.errors})},_=k=>{n.errors=k,f.state.next({errors:n.errors,isValid:!1})},C=(k,P,M,K)=>{const L=de(r,k);if(L){const Y=de(o,k,Ft(M)?de(s,k):M);Ft(Y)||K&&K.defaultChecked||P?mt(o,k,P?Y:cp(L._f)):U(k,Y),i.mount&&w()}},j=(k,P,M,K,L)=>{let Y=!1,Q=!1;const te={name:k},ge=!!(de(r,k)&&de(r,k)._f&&de(r,k)._f.disabled);if(!M||K){d.isDirty&&(Q=n.isDirty,n.isDirty=te.isDirty=N(),Y=Q!==te.isDirty);const Ke=ge||Qo(de(s,k),P);Q=!!(!ge&&de(n.dirtyFields,k)),Ke||ge?Gt(n.dirtyFields,k):mt(n.dirtyFields,k,!0),te.dirtyFields=n.dirtyFields,Y=Y||d.dirtyFields&&Q!==!Ke}if(M){const Ke=de(n.touchedFields,k);Ke||(mt(n.touchedFields,k,M),te.touchedFields=n.touchedFields,Y=Y||d.touchedFields&&Ke!==M)}return Y&&L&&f.state.next(te),Y?te:{}},T=(k,P,M,K)=>{const L=de(n.errors,k),Y=d.isValid&&Kr(P)&&n.isValid!==P;if(e.delayError&&M?(c=p(()=>b(k,M)),c(e.delayError)):(clearTimeout(u),c=null,M?mt(n.errors,k,M):Gt(n.errors,k)),(M?!Qo(L,M):L)||!zn(K)||Y){const Q={...K,...Y&&Kr(P)?{isValid:P}:{},errors:n.errors,name:k};n={...n,...Q},f.state.next(Q)}},R=async k=>{y(k,!0);const P=await t.resolver(o,t.context,d8(k||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return y(k),P},A=async k=>{const{errors:P}=await R(k);if(k)for(const M of k){const K=de(P,M);K?mt(n.errors,M,K):Gt(n.errors,M)}else n.errors=P;return P},O=async(k,P,M={valid:!0})=>{for(const K in k){const L=k[K];if(L){const{_f:Y,...Q}=L;if(Y){const te=a.array.has(Y.name);y([K],!0);const ge=await Ub(L,o,x,t.shouldUseNativeValidation&&!P,te);if(y([K]),ge[Y.name]&&(M.valid=!1,P))break;!P&&(de(ge,Y.name)?te?a8(n.errors,ge,Y.name):mt(n.errors,Y.name,ge[Y.name]):Gt(n.errors,Y.name))}Q&&await O(Q,P,M)}}return M.valid},G=()=>{for(const k of a.unMount){const P=de(r,k);P&&(P._f.refs?P._f.refs.every(M=>!lp(M)):!lp(P._f.ref))&&Oe(k)}a.unMount=new Set},N=(k,P)=>(k&&P&&mt(o,k,P),!Qo($(),s)),z=(k,P,M)=>jN(k,a,{...i.mount?o:Ft(P)?s:Zr(k)?{[k]:P}:P},M,P),S=k=>Yh(de(i.mount?o:s,k,e.shouldUnregister?de(s,k,[]):[])),U=(k,P,M={})=>{const K=de(r,k);let L=P;if(K){const Y=K._f;Y&&(!Y.disabled&&mt(o,k,DN(P,Y)),L=yf(Y.ref)&&Sn(P)?"":P,PN(Y.ref)?[...Y.ref.options].forEach(Q=>Q.selected=L.includes(Q.value)):Y.refs?gu(Y.ref)?Y.refs.length>1?Y.refs.forEach(Q=>(!Q.defaultChecked||!Q.disabled)&&(Q.checked=Array.isArray(L)?!!L.find(te=>te===Q.value):L===Q.value)):Y.refs[0]&&(Y.refs[0].checked=!!L):Y.refs.forEach(Q=>Q.checked=Q.value===L):Ix(Y.ref)?Y.ref.value="":(Y.ref.value=L,Y.ref.type||f.values.next({name:k,values:{...o}})))}(M.shouldDirty||M.shouldTouch)&&j(k,L,M.shouldTouch,M.shouldDirty,!0),M.shouldValidate&&X(k)},J=(k,P,M)=>{for(const K in P){const L=P[K],Y=`${k}.${K}`,Q=de(r,Y);(a.array.has(k)||!xf(L)||Q&&!Q._f)&&!ua(L)?J(Y,L,M):U(Y,L,M)}},F=(k,P,M={})=>{const K=de(r,k),L=a.array.has(k),Y=Pn(P);mt(o,k,Y),L?(f.array.next({name:k,values:{...o}}),(d.isDirty||d.dirtyFields)&&M.shouldDirty&&f.state.next({name:k,dirtyFields:rd(s,o),isDirty:N(k,Y)})):K&&!K._f&&!Sn(Y)?J(k,Y,M):U(k,Y,M),Mb(k,a)&&f.state.next({...n}),f.values.next({name:i.mount?k:void 0,values:{...o}})},W=async k=>{i.mount=!0;const P=k.target;let M=P.name,K=!0;const L=de(r,M),Y=()=>P.type?cp(L._f):xN(k),Q=te=>{K=Number.isNaN(te)||te===de(o,M,te)};if(L){let te,ge;const Ke=Y(),Ue=k.type===gf.BLUR||k.type===gf.FOCUS_OUT,Et=!f8(L._f)&&!t.resolver&&!de(n.errors,M)&&!L._f.deps||h8(Ue,de(n.touchedFields,M),n.isSubmitted,m,h),nr=Mb(M,a,Ue);mt(o,M,Ke),Ue?(L._f.onBlur&&L._f.onBlur(k),c&&c(0)):L._f.onChange&&L._f.onChange(k);const Kt=j(M,Ke,Ue,!1),fs=!zn(Kt)||nr;if(!Ue&&f.values.next({name:M,type:k.type,values:{...o}}),Et)return d.isValid&&w(),fs&&f.state.next({name:M,...nr?{}:Kt});if(!Ue&&nr&&f.state.next({...n}),t.resolver){const{errors:lt}=await R([M]);if(Q(Ke),K){const hs=Vb(n.errors,r,M),ms=Vb(lt,r,hs.name||M);te=ms.error,M=ms.name,ge=zn(lt)}}else y([M],!0),te=(await Ub(L,o,x,t.shouldUseNativeValidation))[M],y([M]),Q(Ke),K&&(te?ge=!1:d.isValid&&(ge=await O(r,!0)));K&&(L._f.deps&&X(L._f.deps),T(M,ge,te,Kt))}},I=(k,P)=>{if(de(n.errors,P)&&k.focus)return k.focus(),1},X=async(k,P={})=>{let M,K;const L=ec(k);if(t.resolver){const Y=await A(Ft(k)?k:L);M=zn(Y),K=k?!L.some(Q=>de(Y,Q)):M}else k?(K=(await Promise.all(L.map(async Y=>{const Q=de(r,Y);return await O(Q&&Q._f?{[Y]:Q}:Q)}))).every(Boolean),!(!K&&!n.isValid)&&w()):K=M=await O(r);return f.state.next({...!Zr(k)||d.isValid&&M!==n.isValid?{}:{name:k},...t.resolver||!k?{isValid:M}:{},errors:n.errors}),P.shouldFocus&&!K&&tc(r,I,k?L:a.mount),K},$=k=>{const P={...i.mount?o:s};return Ft(k)?P:Zr(k)?de(P,k):k.map(M=>de(P,M))},B=(k,P)=>({invalid:!!de((P||n).errors,k),isDirty:!!de((P||n).dirtyFields,k),error:de((P||n).errors,k),isValidating:!!de(n.validatingFields,k),isTouched:!!de((P||n).touchedFields,k)}),he=k=>{k&&ec(k).forEach(P=>Gt(n.errors,P)),f.state.next({errors:k?n.errors:{}})},se=(k,P,M)=>{const K=(de(r,k,{_f:{}})._f||{}).ref,L=de(n.errors,k)||{},{ref:Y,message:Q,type:te,...ge}=L;mt(n.errors,k,{...ge,...P,ref:K}),f.state.next({name:k,errors:n.errors,isValid:!1}),M&&M.shouldFocus&&K&&K.focus&&K.focus()},oe=(k,P)=>mo(k)?f.values.subscribe({next:M=>k(z(void 0,P),M)}):z(k,P,!0),Oe=(k,P={})=>{for(const M of k?ec(k):a.mount)a.mount.delete(M),a.array.delete(M),P.keepValue||(Gt(r,M),Gt(o,M)),!P.keepError&&Gt(n.errors,M),!P.keepDirty&&Gt(n.dirtyFields,M),!P.keepTouched&&Gt(n.touchedFields,M),!P.keepIsValidating&&Gt(n.validatingFields,M),!t.shouldUnregister&&!P.keepDefaultValue&&Gt(s,M);f.values.next({values:{...o}}),f.state.next({...n,...P.keepDirty?{isDirty:N()}:{}}),!P.keepIsValid&&w()},me=({disabled:k,name:P,field:M,fields:K,value:L})=>{if(Kr(k)&&i.mount||k){const Y=k?void 0:Ft(L)?cp(M?M._f:de(K,P)._f):L;mt(o,P,Y),j(P,Y,!1,!1,!0)}},we=(k,P={})=>{let M=de(r,k);const K=Kr(P.disabled);return mt(r,k,{...M||{},_f:{...M&&M._f?M._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),M?me({field:M,disabled:P.disabled,name:k,value:P.value}):C(k,!0,P.value),{...K?{disabled:P.disabled}:{},...t.progressive?{required:!!P.required,min:El(P.min),max:El(P.max),minLength:El(P.minLength),maxLength:El(P.maxLength),pattern:El(P.pattern)}:{},name:k,onChange:W,onBlur:W,ref:L=>{if(L){we(k,P),M=de(r,k);const Y=Ft(L.value)&&L.querySelectorAll&&L.querySelectorAll("input,select,textarea")[0]||L,Q=u8(Y),te=M._f.refs||[];if(Q?te.find(ge=>ge===Y):Y===M._f.ref)return;mt(r,k,{_f:{...M._f,...Q?{refs:[...te.filter(lp),Y,...Array.isArray(de(s,k))?[{}]:[]],ref:{type:Y.type,name:k}}:{ref:Y}}}),C(k,!1,void 0,Y)}else M=de(r,k,{}),M._f&&(M._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(wN(a.array,k)&&i.action)&&a.unMount.add(k)}}},Te=()=>t.shouldFocusError&&tc(r,I,a.mount),Fe=k=>{Kr(k)&&(f.state.next({disabled:k}),tc(r,(P,M)=>{const K=de(r,M);K&&(P.disabled=K._f.disabled||k,Array.isArray(K._f.refs)&&K._f.refs.forEach(L=>{L.disabled=K._f.disabled||k}))},0,!1))},Ie=(k,P)=>async M=>{let K;M&&(M.preventDefault&&M.preventDefault(),M.persist&&M.persist());let L=Pn(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Y,values:Q}=await R();n.errors=Y,L=Q}else await O(r);if(Gt(n.errors,"root"),zn(n.errors)){f.state.next({errors:{}});try{await k(L,M)}catch(Y){K=Y}}else P&&await P({...n.errors},M),Te(),setTimeout(Te);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:zn(n.errors)&&!K,submitCount:n.submitCount+1,errors:n.errors}),K)throw K},Re=(k,P={})=>{de(r,k)&&(Ft(P.defaultValue)?F(k,Pn(de(s,k))):(F(k,P.defaultValue),mt(s,k,Pn(P.defaultValue))),P.keepTouched||Gt(n.touchedFields,k),P.keepDirty||(Gt(n.dirtyFields,k),n.isDirty=P.defaultValue?N(k,Pn(de(s,k))):N()),P.keepError||(Gt(n.errors,k),d.isValid&&w()),f.state.next({...n}))},st=(k,P={})=>{const M=k?Pn(k):s,K=Pn(M),L=zn(k),Y=L?s:K;if(P.keepDefaultValues||(s=M),!P.keepValues){if(P.keepDirtyValues)for(const Q of a.mount)de(n.dirtyFields,Q)?mt(Y,Q,de(o,Q)):F(Q,de(Y,Q));else{if(Ax&&Ft(k))for(const Q of a.mount){const te=de(r,Q);if(te&&te._f){const ge=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(yf(ge)){const Ke=ge.closest("form");if(Ke){Ke.reset();break}}}}r={}}o=e.shouldUnregister?P.keepDefaultValues?Pn(s):{}:Pn(Y),f.array.next({values:{...Y}}),f.values.next({values:{...Y}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:L?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Qo(k,s)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:L?{}:P.keepDirtyValues?P.keepDefaultValues&&o?rd(s,o):n.dirtyFields:P.keepDefaultValues&&k?rd(s,k):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},E=(k,P)=>st(mo(k)?k(o):k,P);return{control:{register:we,unregister:Oe,getFieldState:B,handleSubmit:Ie,setError:se,_executeSchema:R,_getWatch:z,_getDirty:N,_updateValid:w,_removeUnmounted:G,_updateFieldArray:v,_updateDisabledField:me,_getFieldArray:S,_reset:st,_resetDefaultValues:()=>mo(t.defaultValues)&&t.defaultValues().then(k=>{E(k,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:k=>{n={...n,...k}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:_,get _fields(){return r},get _formValues(){return o},get _state(){return i},set _state(k){i=k},get _defaultValues(){return s},get _names(){return a},set _names(k){a=k},get _formState(){return n},set _formState(k){n=k},get _options(){return t},set _options(k){t={...t,...k}}},trigger:X,register:we,handleSubmit:Ie,watch:oe,setValue:F,getValues:$,reset:E,resetField:Re,clearErrors:he,unregister:Oe,setError:se,setFocus:(k,P={})=>{const M=de(r,k),K=M&&M._f;if(K){const L=K.refs?K.refs[0]:K.ref;L.focus&&(L.focus(),P.shouldSelect&&L.select())}},getFieldState:B}}function un(e={}){const t=We.useRef(),n=We.useRef(),[r,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:mo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:mo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...g8(e),formState:r});const o=t.current.control;return o._options=e,Ox({subject:o._subjects.state,next:i=>{kN(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==r.isDirty&&o._subjects.state.next({isDirty:i})}},[o,r.isDirty]),We.useEffect(()=>{e.values&&!Qo(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=SN(r,o),t.current}const Bb=(e,t,n)=>{if(e&&"reportValidity"in e){const r=de(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},ON=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Bb(r.ref,n,e):r.refs&&r.refs.forEach(s=>Bb(s,n,e))}},y8=(e,t)=>{t.shouldUseNativeValidation&&ON(e,t);const n={};for(const r in e){const s=de(t.fields,r),o=Object.assign(e[r]||{},{ref:s&&s.ref});if(v8(t.names||Object.keys(e),r)){const i=Object.assign({},de(n,r));mt(i,"root",o),mt(n,r,i)}else mt(n,r,o)}return n},v8=(e,t)=>e.some(n=>n.startsWith(t+"."));var x8=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[i].types,u=c&&c[r.code];n[i]=EN(i,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},dn=function(e,t,n){return n===void 0&&(n={}),function(r,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return o.shouldUseNativeValidation&&ON({},o),{errors:{},values:n.raw?r:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:y8(x8(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},it;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(it||(it={}));var Lg;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lg||(Lg={}));const _e=it.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lo=e=>{switch(typeof e){case"undefined":return _e.undefined;case"string":return _e.string;case"number":return isNaN(e)?_e.nan:_e.number;case"boolean":return _e.boolean;case"function":return _e.function;case"bigint":return _e.bigint;case"symbol":return _e.symbol;case"object":return Array.isArray(e)?_e.array:e===null?_e.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_e.promise:typeof Map<"u"&&e instanceof Map?_e.map:typeof Set<"u"&&e instanceof Set?_e.set:typeof Date<"u"&&e instanceof Date?_e.date:_e.object;default:return _e.unknown}},ae=it.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),w8=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Kn extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Kn.create=e=>new Kn(e);const La=(e,t)=>{let n;switch(e.code){case ae.invalid_type:e.received===_e.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ae.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,it.jsonStringifyReplacer)}`;break;case ae.unrecognized_keys:n=`Unrecognized key(s) in object: ${it.joinValues(e.keys,", ")}`;break;case ae.invalid_union:n="Invalid input";break;case ae.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${it.joinValues(e.options)}`;break;case ae.invalid_enum_value:n=`Invalid enum value. Expected ${it.joinValues(e.options)}, received '${e.received}'`;break;case ae.invalid_arguments:n="Invalid function arguments";break;case ae.invalid_return_type:n="Invalid function return type";break;case ae.invalid_date:n="Invalid date";break;case ae.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:it.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ae.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ae.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ae.custom:n="Invalid input";break;case ae.invalid_intersection_types:n="Intersection results could not be merged";break;case ae.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ae.not_finite:n="Number must be finite";break;default:n=t.defaultError,it.assertNever(e)}return{message:n}};let IN=La;function b8(e){IN=e}function bf(){return IN}const _f=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},_8=[];function ve(e,t){const n=bf(),r=_f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===La?void 0:La].filter(s=>!!s)});e.common.issues.push(r)}class vn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return He;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,i=await s.value;r.push({key:o,value:i})}return vn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return He;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const He=Object.freeze({status:"aborted"}),da=e=>({status:"dirty",value:e}),Cn=e=>({status:"valid",value:e}),zg=e=>e.status==="aborted",Fg=e=>e.status==="dirty",Rc=e=>e.status==="valid",Ac=e=>typeof Promise<"u"&&e instanceof Promise;function Sf(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function MN(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var Ll,zl;class ss{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wb=(e,t)=>{if(Rc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Kn(e.common.issues);return this._error=n,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:a.defaultError}},description:s}}class et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return lo(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:lo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new vn,ctx:{common:t.parent.common,data:t.data,parsedType:lo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ac(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lo(t)},o=this._parseSync({data:t,path:s.path,parent:s});return Wb(s,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lo(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(Ac(s)?s:Promise.resolve(s));return Wb(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ae.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ir({schema:this,typeName:Ve.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return es.create(this,this._def)}nullable(){return Ao.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Tr.create(this,this._def)}promise(){return Fa.create(this,this._def)}or(t){return Mc.create([this,t],this._def)}and(t){return Lc.create(this,t,this._def)}transform(t){return new Ir({...Ze(this._def),schema:this,typeName:Ve.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vc({...Ze(this._def),innerType:this,defaultValue:n,typeName:Ve.ZodDefault})}brand(){return new Lx({typeName:Ve.ZodBranded,type:this,...Ze(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Bc({...Ze(this._def),innerType:this,catchValue:n,typeName:Ve.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return yu.create(this,t)}readonly(){return Wc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const S8=/^c[^\s-]{8,}$/i,k8=/^[0-9a-z]+$/,C8=/^[0-9A-HJKMNP-TV-Z]{26}$/,j8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,E8=/^[a-z0-9_-]{21}$/i,N8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,T8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let up;const R8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,A8=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,D8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LN="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",O8=new RegExp(`^${LN}$`);function zN(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function I8(e){return new RegExp(`^${zN(e)}$`)}function FN(e){let t=`${LN}T${zN(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function M8(e,t){return!!((t==="v4"||!t)&&R8.test(e)||(t==="v6"||!t)&&A8.test(e))}class jr extends et{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_e.string){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.string,received:o.parsedType}),He}const r=new vn;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:ae.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:n,code:ae.invalid_string,...De.errToObj(r)})}_addCheck(t){return new jr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...De.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...De.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...De.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...De.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...De.errToObj(n)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new jr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new jr({checks:[],typeName:Ve.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function L8(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class To extends et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_e.number){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.number,received:o.parsedType}),He}let r;const s=new vn;for(const o of this._def.checks)o.kind==="int"?it.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?L8(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_finite,message:o.message}),s.dirty()):it.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,s){return new To({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(s)}]})}_addCheck(t){return new To({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&it.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew To({checks:[],typeName:Ve.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class Po extends et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==_e.bigint){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.bigint,received:o.parsedType}),He}let r;const s=new vn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):it.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,s){return new Po({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(s)}]})}_addCheck(t){return new Po({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Po({checks:[],typeName:Ve.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class Dc extends et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_e.boolean){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.boolean,received:r.parsedType}),He}return Cn(t.data)}}Dc.create=e=>new Dc({typeName:Ve.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class pi extends et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_e.date){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.date,received:o.parsedType}),He}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_date}),He}const r=new vn;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:ae.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):it.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new pi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew pi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ve.ZodDate,...Ze(e)});class kf extends et{_parse(t){if(this._getType(t)!==_e.symbol){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.symbol,received:r.parsedType}),He}return Cn(t.data)}}kf.create=e=>new kf({typeName:Ve.ZodSymbol,...Ze(e)});class Oc extends et{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.undefined,received:r.parsedType}),He}return Cn(t.data)}}Oc.create=e=>new Oc({typeName:Ve.ZodUndefined,...Ze(e)});class Ic extends et{_parse(t){if(this._getType(t)!==_e.null){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.null,received:r.parsedType}),He}return Cn(t.data)}}Ic.create=e=>new Ic({typeName:Ve.ZodNull,...Ze(e)});class za extends et{constructor(){super(...arguments),this._any=!0}_parse(t){return Cn(t.data)}}za.create=e=>new za({typeName:Ve.ZodAny,...Ze(e)});class si extends et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Cn(t.data)}}si.create=e=>new si({typeName:Ve.ZodUnknown,...Ze(e)});class $s extends et{_parse(t){const n=this._getOrReturnCtx(t);return ve(n,{code:ae.invalid_type,expected:_e.never,received:n.parsedType}),He}}$s.create=e=>new $s({typeName:Ve.ZodNever,...Ze(e)});class Cf extends et{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.void,received:r.parsedType}),He}return Cn(t.data)}}Cf.create=e=>new Cf({typeName:Ve.ZodVoid,...Ze(e)});class Tr extends et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==_e.array)return ve(n,{code:ae.invalid_type,expected:_e.array,received:n.parsedType}),He;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,a=n.data.lengths.maxLength.value&&(ve(n,{code:ae.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new ss(n,i,n.path,a)))).then(i=>vn.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new ss(n,i,n.path,a)));return vn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Tr({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new Tr({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new Tr({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(t){return this.min(1,t)}}Tr.create=(e,t)=>new Tr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ve.ZodArray,...Ze(t)});function Ki(e){if(e instanceof Rt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=es.create(Ki(r))}return new Rt({...e._def,shape:()=>t})}else return e instanceof Tr?new Tr({...e._def,type:Ki(e.element)}):e instanceof es?es.create(Ki(e.unwrap())):e instanceof Ao?Ao.create(Ki(e.unwrap())):e instanceof os?os.create(e.items.map(t=>Ki(t))):e}class Rt extends et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=it.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==_e.object){const u=this._getOrReturnCtx(t);return ve(u,{code:ae.invalid_type,expected:_e.object,received:u.parsedType}),He}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof $s&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ss(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof $s){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ve(s,{code:ae.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ss(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>vn.mergeObjectSync(r,u)):vn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ve.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const n={};return it.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}omit(t){const n={};return it.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}deepPartial(){return Ki(this)}partial(t){const n={};return it.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new Rt({...this._def,shape:()=>n})}required(t){const n={};return it.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof es;)o=o._def.innerType;n[r]=o}}),new Rt({...this._def,shape:()=>n})}keyof(){return $N(it.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});class Mc extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Kn(a.ctx.common.issues));return ve(n,{code:ae.invalid_union,unionErrors:i}),He}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Kn(c));return ve(n,{code:ae.invalid_union,unionErrors:a}),He}}get options(){return this._def.options}}Mc.create=(e,t)=>new Mc({options:e,typeName:Ve.ZodUnion,...Ze(t)});const xs=e=>e instanceof Fc?xs(e.schema):e instanceof Ir?xs(e.innerType()):e instanceof $c?[e.value]:e instanceof Ro?e.options:e instanceof Uc?it.objectValues(e.enum):e instanceof Vc?xs(e._def.innerType):e instanceof Oc?[void 0]:e instanceof Ic?[null]:e instanceof es?[void 0,...xs(e.unwrap())]:e instanceof Ao?[null,...xs(e.unwrap())]:e instanceof Lx||e instanceof Wc?xs(e.unwrap()):e instanceof Bc?xs(e._def.innerType):[];class Gh extends et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.object)return ve(n,{code:ae.invalid_type,expected:_e.object,received:n.parsedType}),He;const r=this.discriminator,s=n.data[r],o=this.optionsMap.get(s);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ve(n,{code:ae.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),He)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const o of n){const i=xs(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new Gh({typeName:Ve.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...Ze(r)})}}function $g(e,t){const n=lo(e),r=lo(t);if(e===t)return{valid:!0,data:e};if(n===_e.object&&r===_e.object){const s=it.objectKeys(t),o=it.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=$g(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===_e.array&&r===_e.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(zg(o)||zg(i))return He;const a=$g(o.value,i.value);return a.valid?((Fg(o)||Fg(i))&&n.dirty(),{status:n.value,value:a.data}):(ve(r,{code:ae.invalid_intersection_types}),He)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Lc.create=(e,t,n)=>new Lc({left:e,right:t,typeName:Ve.ZodIntersection,...Ze(n)});class os extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.array)return ve(r,{code:ae.invalid_type,expected:_e.array,received:r.parsedType}),He;if(r.data.lengththis._def.items.length&&(ve(r,{code:ae.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ss(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>vn.mergeArray(n,i)):vn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new os({...this._def,rest:t})}}os.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new os({items:e,typeName:Ve.ZodTuple,rest:null,...Ze(t)})};class zc extends et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.object)return ve(r,{code:ae.invalid_type,expected:_e.object,received:r.parsedType}),He;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in r.data)s.push({key:o._parse(new ss(r,a,r.path,a)),value:i._parse(new ss(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?vn.mergeObjectAsync(n,s):vn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof et?new zc({keyType:t,valueType:n,typeName:Ve.ZodRecord,...Ze(r)}):new zc({keyType:jr.create(),valueType:t,typeName:Ve.ZodRecord,...Ze(n)})}}class jf extends et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.map)return ve(r,{code:ae.invalid_type,expected:_e.map,received:r.parsedType}),He;const s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:s._parse(new ss(r,a,r.path,[u,"key"])),value:o._parse(new ss(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return He;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return He;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}jf.create=(e,t,n)=>new jf({valueType:t,keyType:e,typeName:Ve.ZodMap,...Ze(n)});class gi extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.set)return ve(r,{code:ae.invalid_type,expected:_e.set,received:r.parsedType}),He;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(ve(r,{code:ae.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return He;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>o._parse(new ss(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new gi({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new gi({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}gi.create=(e,t)=>new gi({valueType:e,minSize:null,maxSize:null,typeName:Ve.ZodSet,...Ze(t)});class ja extends et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.function)return ve(n,{code:ae.invalid_type,expected:_e.function,received:n.parsedType}),He;function r(a,c){return _f({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bf(),La].filter(u=>!!u),issueData:{code:ae.invalid_arguments,argumentsError:c}})}function s(a,c){return _f({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bf(),La].filter(u=>!!u),issueData:{code:ae.invalid_return_type,returnTypeError:c}})}const o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Fa){const a=this;return Cn(async function(...c){const u=new Kn([]),d=await a._def.args.parseAsync(c,o).catch(m=>{throw u.addIssue(r(c,m)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(m=>{throw u.addIssue(s(f,m)),u})})}else{const a=this;return Cn(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Kn([r(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Kn([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ja({...this._def,args:os.create(t).rest(si.create())})}returns(t){return new ja({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new ja({args:t||os.create([]).rest(si.create()),returns:n||si.create(),typeName:Ve.ZodFunction,...Ze(r)})}}class Fc extends et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Fc.create=(e,t)=>new Fc({getter:e,typeName:Ve.ZodLazy,...Ze(t)});class $c extends et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ve(n,{received:n.data,code:ae.invalid_literal,expected:this._def.value}),He}return{status:"valid",value:t.data}}get value(){return this._def.value}}$c.create=(e,t)=>new $c({value:e,typeName:Ve.ZodLiteral,...Ze(t)});function $N(e,t){return new Ro({values:e,typeName:Ve.ZodEnum,...Ze(t)})}class Ro extends et{constructor(){super(...arguments),Ll.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{expected:it.joinValues(r),received:n.parsedType,code:ae.invalid_type}),He}if(Sf(this,Ll)||MN(this,Ll,new Set(this._def.values)),!Sf(this,Ll).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{received:n.data,code:ae.invalid_enum_value,options:r}),He}return Cn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ro.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ro.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ll=new WeakMap;Ro.create=$N;class Uc extends et{constructor(){super(...arguments),zl.set(this,void 0)}_parse(t){const n=it.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_e.string&&r.parsedType!==_e.number){const s=it.objectValues(n);return ve(r,{expected:it.joinValues(s),received:r.parsedType,code:ae.invalid_type}),He}if(Sf(this,zl)||MN(this,zl,new Set(it.getValidEnumValues(this._def.values))),!Sf(this,zl).has(t.data)){const s=it.objectValues(n);return ve(r,{received:r.data,code:ae.invalid_enum_value,options:s}),He}return Cn(t.data)}get enum(){return this._def.values}}zl=new WeakMap;Uc.create=(e,t)=>new Uc({values:e,typeName:Ve.ZodNativeEnum,...Ze(t)});class Fa extends et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.promise&&n.common.async===!1)return ve(n,{code:ae.invalid_type,expected:_e.promise,received:n.parsedType}),He;const r=n.parsedType===_e.promise?n.data:Promise.resolve(n.data);return Cn(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Fa.create=(e,t)=>new Fa({type:e,typeName:Ve.ZodPromise,...Ze(t)});class Ir extends et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ve(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return He;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?He:c.status==="dirty"||n.value==="dirty"?da(c.value):c});{if(n.value==="aborted")return He;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?He:a.status==="dirty"||n.value==="dirty"?da(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?He:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?He:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Rc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):i);it.assertNever(s)}}Ir.create=(e,t,n)=>new Ir({schema:e,typeName:Ve.ZodEffects,effect:t,...Ze(n)});Ir.createWithPreprocess=(e,t,n)=>new Ir({schema:t,effect:{type:"preprocess",transform:e},typeName:Ve.ZodEffects,...Ze(n)});class es extends et{_parse(t){return this._getType(t)===_e.undefined?Cn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}es.create=(e,t)=>new es({innerType:e,typeName:Ve.ZodOptional,...Ze(t)});class Ao extends et{_parse(t){return this._getType(t)===_e.null?Cn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ao.create=(e,t)=>new Ao({innerType:e,typeName:Ve.ZodNullable,...Ze(t)});class Vc extends et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===_e.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vc.create=(e,t)=>new Vc({innerType:e,typeName:Ve.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class Bc extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ac(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Bc.create=(e,t)=>new Bc({innerType:e,typeName:Ve.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Ef extends et{_parse(t){if(this._getType(t)!==_e.nan){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.nan,received:r.parsedType}),He}return{status:"valid",value:t.data}}}Ef.create=e=>new Ef({typeName:Ve.ZodNaN,...Ze(e)});const z8=Symbol("zod_brand");class Lx extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class yu extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?He:o.status==="dirty"?(n.dirty(),da(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?He:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new yu({in:t,out:n,typeName:Ve.ZodPipeline})}}class Wc extends et{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Rc(s)&&(s.value=Object.freeze(s.value)),s);return Ac(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Wc.create=(e,t)=>new Wc({innerType:e,typeName:Ve.ZodReadonly,...Ze(t)});function UN(e,t={},n){return e?za.create().superRefine((r,s)=>{var o,i;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):za.create()}const F8={object:Rt.lazycreate};var Ve;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ve||(Ve={}));const $8=(e,t={message:`Input not instance of ${e.name}`})=>UN(n=>n instanceof e,t),VN=jr.create,BN=To.create,U8=Ef.create,V8=Po.create,WN=Dc.create,B8=pi.create,W8=kf.create,H8=Oc.create,Y8=Ic.create,K8=za.create,G8=si.create,Z8=$s.create,q8=Cf.create,X8=Tr.create,Q8=Rt.create,J8=Rt.strictCreate,eV=Mc.create,tV=Gh.create,nV=Lc.create,rV=os.create,sV=zc.create,oV=jf.create,iV=gi.create,aV=ja.create,lV=Fc.create,cV=$c.create,uV=Ro.create,dV=Uc.create,fV=Fa.create,Hb=Ir.create,hV=es.create,mV=Ao.create,pV=Ir.createWithPreprocess,gV=yu.create,yV=()=>VN().optional(),vV=()=>BN().optional(),xV=()=>WN().optional(),wV={string:e=>jr.create({...e,coerce:!0}),number:e=>To.create({...e,coerce:!0}),boolean:e=>Dc.create({...e,coerce:!0}),bigint:e=>Po.create({...e,coerce:!0}),date:e=>pi.create({...e,coerce:!0})},bV=He;var ce=Object.freeze({__proto__:null,defaultErrorMap:La,setErrorMap:b8,getErrorMap:bf,makeIssue:_f,EMPTY_PATH:_8,addIssueToContext:ve,ParseStatus:vn,INVALID:He,DIRTY:da,OK:Cn,isAborted:zg,isDirty:Fg,isValid:Rc,isAsync:Ac,get util(){return it},get objectUtil(){return Lg},ZodParsedType:_e,getParsedType:lo,ZodType:et,datetimeRegex:FN,ZodString:jr,ZodNumber:To,ZodBigInt:Po,ZodBoolean:Dc,ZodDate:pi,ZodSymbol:kf,ZodUndefined:Oc,ZodNull:Ic,ZodAny:za,ZodUnknown:si,ZodNever:$s,ZodVoid:Cf,ZodArray:Tr,ZodObject:Rt,ZodUnion:Mc,ZodDiscriminatedUnion:Gh,ZodIntersection:Lc,ZodTuple:os,ZodRecord:zc,ZodMap:jf,ZodSet:gi,ZodFunction:ja,ZodLazy:Fc,ZodLiteral:$c,ZodEnum:Ro,ZodNativeEnum:Uc,ZodPromise:Fa,ZodEffects:Ir,ZodTransformer:Ir,ZodOptional:es,ZodNullable:Ao,ZodDefault:Vc,ZodCatch:Bc,ZodNaN:Ef,BRAND:z8,ZodBranded:Lx,ZodPipeline:yu,ZodReadonly:Wc,custom:UN,Schema:et,ZodSchema:et,late:F8,get ZodFirstPartyTypeKind(){return Ve},coerce:wV,any:K8,array:X8,bigint:V8,boolean:WN,date:B8,discriminatedUnion:tV,effect:Hb,enum:uV,function:aV,instanceof:$8,intersection:nV,lazy:lV,literal:cV,map:oV,nan:U8,nativeEnum:dV,never:Z8,null:Y8,nullable:mV,number:BN,object:Q8,oboolean:xV,onumber:vV,optional:hV,ostring:yV,pipeline:gV,preprocess:pV,promise:fV,record:sV,set:iV,strictObject:J8,string:VN,symbol:W8,transformer:Hb,tuple:rV,undefined:H8,union:eV,unknown:G8,void:q8,NEVER:bV,ZodIssueCode:ae,quotelessJson:w8,ZodError:Kn}),_V="Label",HN=g.forwardRef((e,t)=>l.jsx(Pe.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));HN.displayName=_V;var YN=HN;const SV=eu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Vt=g.forwardRef(({className:e,...t},n)=>l.jsx(YN,{ref:n,className:re(SV(),e),...t}));Vt.displayName=YN.displayName;const fn=n8,KN=g.createContext({}),ke=({...e})=>l.jsx(KN.Provider,{value:{name:e.name},children:l.jsx(i8,{...e})}),Zh=()=>{const e=g.useContext(KN),t=g.useContext(GN),{getFieldState:n,formState:r}=Kh(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},GN=g.createContext({}),Se=g.forwardRef(({className:e,...t},n)=>{const r=g.useId();return l.jsx(GN.Provider,{value:{id:r},children:l.jsx("div",{ref:n,className:re("space-y-2",e),...t})})});Se.displayName="FormItem";const Ce=g.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=Zh();return l.jsx(Vt,{ref:n,className:re(r&&"text-destructive",e),htmlFor:s,...t})});Ce.displayName="FormLabel";const je=g.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:o}=Zh();return l.jsx(ts,{ref:t,id:r,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...e})});je.displayName="FormControl";const kV=g.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Zh();return l.jsx("p",{ref:n,id:r,className:re("text-sm text-muted-foreground",e),...t})});kV.displayName="FormDescription";const ye=g.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:o}=Zh(),{t:i}=Ye(),a=s?i(String(s==null?void 0:s.message)):t;return a?l.jsx("p",{ref:r,id:o,className:re("text-sm font-medium text-destructive",e),...n,children:a}):null});ye.displayName="FormMessage";function Ug(e,[t,n]){return Math.min(n,Math.max(t,e))}var CV=[" ","Enter","ArrowUp","ArrowDown"],jV=[" ","Enter"],vu="Select",[qh,Xh,EV]=tu(vu),[ll,QH]=an(vu,[EV,nl]),Qh=nl(),[NV,zo]=ll(vu),[TV,PV]=ll(vu),ZN=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:m}=e,x=Qh(t),[p,w]=g.useState(null),[y,v]=g.useState(null),[b,_]=g.useState(!1),C=ki(u),[j=!1,T]=Zn({prop:r,defaultProp:s,onChange:o}),[R,A]=Zn({prop:i,defaultProp:a,onChange:c}),O=g.useRef(null),G=p?!!p.closest("form"):!0,[N,z]=g.useState(new Set),S=Array.from(N).map(U=>U.props.value).join(";");return l.jsx(bv,{...x,children:l.jsxs(NV,{required:m,scope:t,trigger:p,onTriggerChange:w,valueNode:y,onValueNodeChange:v,valueNodeHasChildren:b,onValueNodeHasChildrenChange:_,contentId:Wn(),value:R,onValueChange:A,open:j,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:h,children:[l.jsx(qh.Provider,{scope:t,children:l.jsx(TV,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(U=>{z(J=>new Set(J).add(U))},[]),onNativeOptionRemove:g.useCallback(U=>{z(J=>{const F=new Set(J);return F.delete(U),F})},[]),children:n})}),G?l.jsxs(b2,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:R,onChange:U=>A(U.target.value),disabled:h,children:[R===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},S):null]})})};ZN.displayName=vu;var qN="SelectTrigger",XN=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Qh(n),i=zo(qN,n),a=i.disabled||r,c=Ge(t,i.onTriggerChange),u=Xh(n),[d,f,h]=_2(x=>{const p=u().filter(v=>!v.disabled),w=p.find(v=>v.value===i.value),y=S2(p,x,w);y!==void 0&&i.onValueChange(y.value)}),m=()=>{a||(i.onOpenChange(!0),h())};return l.jsx(_v,{asChild:!0,...o,children:l.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":w2(i.value)?"":void 0,...s,ref:c,onClick:ue(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ue(s.onPointerDown,x=>{const p=x.target;p.hasPointerCapture(x.pointerId)&&p.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(m(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ue(s.onKeyDown,x=>{const p=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(p&&x.key===" ")&&CV.includes(x.key)&&(m(),x.preventDefault())})})})});XN.displayName=qN;var QN="SelectValue",JN=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...a}=e,c=zo(QN,n),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ge(t,c.onValueNodeChange);return tn(()=>{u(d)},[u,d]),l.jsx(Pe.span,{...a,ref:f,style:{pointerEvents:"none"},children:w2(c.value)?l.jsx(l.Fragment,{children:i}):o})});JN.displayName=QN;var RV="SelectIcon",e2=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return l.jsx(Pe.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});e2.displayName=RV;var AV="SelectPortal",t2=e=>l.jsx(ru,{asChild:!0,...e});t2.displayName=AV;var yi="SelectContent",n2=g.forwardRef((e,t)=>{const n=zo(yi,e.__scopeSelect),[r,s]=g.useState();if(tn(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Bs.createPortal(l.jsx(r2,{scope:e.__scopeSelect,children:l.jsx(qh.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(s2,{...e,ref:t})});n2.displayName=yi;var _s=10,[r2,Fo]=ll(yi),DV="SelectContentImpl",s2=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:w,...y}=e,v=zo(yi,n),[b,_]=g.useState(null),[C,j]=g.useState(null),T=Ge(t,me=>_(me)),[R,A]=g.useState(null),[O,G]=g.useState(null),N=Xh(n),[z,S]=g.useState(!1),U=g.useRef(!1);g.useEffect(()=>{if(b)return Ev(b)},[b]),dv();const J=g.useCallback(me=>{const[we,...Te]=N().map(Re=>Re.ref.current),[Fe]=Te.slice(-1),Ie=document.activeElement;for(const Re of me)if(Re===Ie||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===we&&C&&(C.scrollTop=0),Re===Fe&&C&&(C.scrollTop=C.scrollHeight),Re==null||Re.focus(),document.activeElement!==Ie))return},[N,C]),F=g.useCallback(()=>J([R,b]),[J,R,b]);g.useEffect(()=>{z&&F()},[z,F]);const{onOpenChange:W,triggerPointerDownPosRef:I}=v;g.useEffect(()=>{if(b){let me={x:0,y:0};const we=Fe=>{var Ie,Re;me={x:Math.abs(Math.round(Fe.pageX)-(((Ie=I.current)==null?void 0:Ie.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Re=I.current)==null?void 0:Re.y)??0))}},Te=Fe=>{me.x<=10&&me.y<=10?Fe.preventDefault():b.contains(Fe.target)||W(!1),document.removeEventListener("pointermove",we),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",Te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",Te,{capture:!0})}}},[b,W,I]),g.useEffect(()=>{const me=()=>W(!1);return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[W]);const[X,$]=_2(me=>{const we=N().filter(Ie=>!Ie.disabled),Te=we.find(Ie=>Ie.ref.current===document.activeElement),Fe=S2(we,me,Te);Fe&&setTimeout(()=>Fe.ref.current.focus())}),B=g.useCallback((me,we,Te)=>{const Fe=!U.current&&!Te;(v.value!==void 0&&v.value===we||Fe)&&(A(me),Fe&&(U.current=!0))},[v.value]),he=g.useCallback(()=>b==null?void 0:b.focus(),[b]),se=g.useCallback((me,we,Te)=>{const Fe=!U.current&&!Te;(v.value!==void 0&&v.value===we||Fe)&&G(me)},[v.value]),oe=r==="popper"?Vg:o2,Oe=oe===Vg?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:w}:{};return l.jsx(r2,{scope:n,content:b,viewport:C,onViewportChange:j,itemRefCallback:B,selectedItem:R,onItemLeave:he,itemTextRefCallback:se,focusSelectedItem:F,selectedItemText:O,position:r,isPositioned:z,searchRef:X,children:l.jsx(gh,{as:ts,allowPinchZoom:!0,children:l.jsx(dh,{asChild:!0,trapped:v.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:ue(s,me=>{var we;(we=v.trigger)==null||we.focus({preventScroll:!0}),me.preventDefault()}),children:l.jsx(Ja,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:me=>me.preventDefault(),...y,...Oe,onPlaced:()=>S(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ue(y.onKeyDown,me=>{const we=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!we&&me.key.length===1&&$(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Fe=N().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Ie=me.target,Re=Fe.indexOf(Ie);Fe=Fe.slice(Re+1)}setTimeout(()=>J(Fe)),me.preventDefault()}})})})})})})});s2.displayName=DV;var OV="SelectItemAlignedPosition",o2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=zo(yi,n),i=Fo(yi,n),[a,c]=g.useState(null),[u,d]=g.useState(null),f=Ge(t,T=>d(T)),h=Xh(n),m=g.useRef(!1),x=g.useRef(!0),{viewport:p,selectedItem:w,selectedItemText:y,focusSelectedItem:v}=i,b=g.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&p&&w&&y){const T=o.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(o.dir!=="rtl"){const Ie=O.left-R.left,Re=A.left-Ie,st=T.left-Re,E=T.width+st,ee=Math.max(E,R.width),Z=window.innerWidth-_s,D=Ug(Re,[_s,Z-ee]);a.style.minWidth=E+"px",a.style.left=D+"px"}else{const Ie=R.right-O.right,Re=window.innerWidth-A.right-Ie,st=window.innerWidth-T.right-Re,E=T.width+st,ee=Math.max(E,R.width),Z=window.innerWidth-_s,D=Ug(Re,[_s,Z-ee]);a.style.minWidth=E+"px",a.style.right=D+"px"}const G=h(),N=window.innerHeight-_s*2,z=p.scrollHeight,S=window.getComputedStyle(u),U=parseInt(S.borderTopWidth,10),J=parseInt(S.paddingTop,10),F=parseInt(S.borderBottomWidth,10),W=parseInt(S.paddingBottom,10),I=U+J+z+W+F,X=Math.min(w.offsetHeight*5,I),$=window.getComputedStyle(p),B=parseInt($.paddingTop,10),he=parseInt($.paddingBottom,10),se=T.top+T.height/2-_s,oe=N-se,Oe=w.offsetHeight/2,me=w.offsetTop+Oe,we=U+J+me,Te=I-we;if(we<=se){const Ie=w===G[G.length-1].ref.current;a.style.bottom="0px";const Re=u.clientHeight-p.offsetTop-p.offsetHeight,st=Math.max(oe,Oe+(Ie?he:0)+Re+F),E=we+st;a.style.height=E+"px"}else{const Ie=w===G[0].ref.current;a.style.top="0px";const st=Math.max(se,U+p.offsetTop+(Ie?B:0)+Oe)+Te;a.style.height=st+"px",p.scrollTop=we-se+p.offsetTop}a.style.margin=`${_s}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=N+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[h,o.trigger,o.valueNode,a,u,p,w,y,o.dir,r]);tn(()=>b(),[b]);const[_,C]=g.useState();tn(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=g.useCallback(T=>{T&&x.current===!0&&(b(),v==null||v(),x.current=!1)},[b,v]);return l.jsx(MV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:j,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(Pe.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});o2.displayName=OV;var IV="SelectPopperPosition",Vg=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=_s,...o}=e,i=Qh(n);return l.jsx(Sv,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Vg.displayName=IV;var[MV,zx]=ll(yi,{}),Bg="SelectViewport",i2=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Fo(Bg,n),i=zx(Bg,n),a=Ge(t,o.onViewportChange),c=g.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),l.jsx(qh.Slot,{scope:n,children:l.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ue(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&f){const m=Math.abs(c.current-d.scrollTop);if(m>0){const x=window.innerHeight-_s*2,p=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),y=Math.max(p,w);if(y0?_:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});i2.displayName=Bg;var a2="SelectGroup",[LV,zV]=ll(a2),l2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Wn();return l.jsx(LV,{scope:n,id:s,children:l.jsx(Pe.div,{role:"group","aria-labelledby":s,...r,ref:t})})});l2.displayName=a2;var c2="SelectLabel",u2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=zV(c2,n);return l.jsx(Pe.div,{id:s.id,...r,ref:t})});u2.displayName=c2;var Nf="SelectItem",[FV,d2]=ll(Nf),f2=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,a=zo(Nf,n),c=Fo(Nf,n),u=a.value===r,[d,f]=g.useState(o??""),[h,m]=g.useState(!1),x=Ge(t,y=>{var v;return(v=c.itemRefCallback)==null?void 0:v.call(c,y,r,s)}),p=Wn(),w=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(FV,{scope:n,value:r,disabled:s,textId:p,isSelected:u,onItemTextChange:g.useCallback(y=>{f(v=>v||((y==null?void 0:y.textContent)??"").trim())},[]),children:l.jsx(qh.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:l.jsx(Pe.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ue(i.onFocus,()=>m(!0)),onBlur:ue(i.onBlur,()=>m(!1)),onPointerUp:ue(i.onPointerUp,w),onPointerMove:ue(i.onPointerMove,y=>{var v;s?(v=c.onItemLeave)==null||v.call(c):y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,y=>{var v;y.currentTarget===document.activeElement&&((v=c.onItemLeave)==null||v.call(c))}),onKeyDown:ue(i.onKeyDown,y=>{var b;((b=c.searchRef)==null?void 0:b.current)!==""&&y.key===" "||(jV.includes(y.key)&&w(),y.key===" "&&y.preventDefault())})})})})});f2.displayName=Nf;var Fl="SelectItemText",h2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=zo(Fl,n),a=Fo(Fl,n),c=d2(Fl,n),u=PV(Fl,n),[d,f]=g.useState(null),h=Ge(t,y=>f(y),c.onItemTextChange,y=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,y,c.value,c.disabled)}),m=d==null?void 0:d.textContent,x=g.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:w}=u;return tn(()=>(p(x),()=>w(x)),[p,w,x]),l.jsxs(l.Fragment,{children:[l.jsx(Pe.span,{id:c.textId,...o,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Bs.createPortal(o.children,i.valueNode):null]})});h2.displayName=Fl;var m2="SelectItemIndicator",p2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d2(m2,n).isSelected?l.jsx(Pe.span,{"aria-hidden":!0,...r,ref:t}):null});p2.displayName=m2;var Wg="SelectScrollUpButton",g2=g.forwardRef((e,t)=>{const n=Fo(Wg,e.__scopeSelect),r=zx(Wg,e.__scopeSelect),[s,o]=g.useState(!1),i=Ge(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(v2,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});g2.displayName=Wg;var Hg="SelectScrollDownButton",y2=g.forwardRef((e,t)=>{const n=Fo(Hg,e.__scopeSelect),r=zx(Hg,e.__scopeSelect),[s,o]=g.useState(!1),i=Ge(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(v2,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});y2.displayName=Hg;var v2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Fo("SelectScrollButton",n),i=g.useRef(null),a=Xh(n),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),tn(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Pe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ue(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ue(s.onPointerLeave,()=>{c()})})}),$V="SelectSeparator",x2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Pe.div,{"aria-hidden":!0,...r,ref:t})});x2.displayName=$V;var Yg="SelectArrow",UV=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Qh(n),o=zo(Yg,n),i=Fo(Yg,n);return o.open&&i.position==="popper"?l.jsx(kv,{...s,...r,ref:t}):null});UV.displayName=Yg;function w2(e){return e===""||e===void 0}var b2=g.forwardRef((e,t)=>{const{value:n,...r}=e,s=g.useRef(null),o=Ge(t,s),i=jx(n);return g.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==n&&d){const f=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(f)}},[i,n]),l.jsx(mu,{asChild:!0,children:l.jsx("select",{...r,ref:o,defaultValue:n})})});b2.displayName="BubbleSelect";function _2(e){const t=Ot(e),n=g.useRef(""),r=g.useRef(0),s=g.useCallback(i=>{const a=n.current+i;t(a),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function S2(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=VV(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function VV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BV=ZN,k2=XN,WV=JN,HV=e2,YV=t2,C2=n2,KV=i2,GV=l2,j2=u2,E2=f2,ZV=h2,qV=p2,N2=g2,T2=y2,P2=x2;const $a=BV,Hc=GV,Ua=WV,vi=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(k2,{ref:r,className:re("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,l.jsx(HV,{asChild:!0,children:l.jsx(rv,{className:"h-4 w-4 opacity-50"})})]}));vi.displayName=k2.displayName;const R2=g.forwardRef(({className:e,...t},n)=>l.jsx(N2,{ref:n,className:re("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(RO,{className:"h-4 w-4"})}));R2.displayName=N2.displayName;const A2=g.forwardRef(({className:e,...t},n)=>l.jsx(T2,{ref:n,className:re("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(rv,{className:"h-4 w-4"})}));A2.displayName=T2.displayName;const xi=g.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(YV,{children:l.jsxs(C2,{ref:s,className:re("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[l.jsx(R2,{}),l.jsx(KV,{className:re("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(A2,{})]})}));xi.displayName=C2.displayName;const Va=g.forwardRef(({className:e,...t},n)=>l.jsx(j2,{ref:n,className:re("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Va.displayName=j2.displayName;const Do=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(E2,{ref:r,className:re("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(qV,{children:l.jsx(qS,{className:"h-4 w-4"})})}),l.jsx(ZV,{children:t})]}));Do.displayName=E2.displayName;const XV=g.forwardRef(({className:e,...t},n)=>l.jsx(P2,{ref:n,className:re("-mx-1 my-1 h-px bg-muted",e),...t}));XV.displayName=P2.displayName;const cl=Vv,ul=Bv,QV=Wv,D2=g.forwardRef(({className:e,...t},n)=>l.jsx(iu,{ref:n,className:re("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));D2.displayName=iu.displayName;const Ti=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(QV,{children:[l.jsx(D2,{}),l.jsxs(au,{ref:r,className:re("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,l.jsxs(wh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(iv,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ti.displayName=au.displayName;const Pi=({className:e,...t})=>l.jsx("div",{className:re("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Pi.displayName="DialogHeader";const Jh=({className:e,...t})=>l.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Jh.displayName="DialogFooter";const Ri=g.forwardRef(({className:e,...t},n)=>l.jsx(lu,{ref:n,className:re("text-lg font-semibold leading-none tracking-tight",e),...t}));Ri.displayName=lu.displayName;const O2=g.forwardRef(({className:e,...t},n)=>l.jsx(cu,{ref:n,className:re("text-sm text-muted-foreground",e),...t}));O2.displayName=cu.displayName;function JV(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Fx="ScrollArea",[I2,JH]=an(Fx),[eB,gr]=I2(Fx),M2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=g.useState(null),[u,d]=g.useState(null),[f,h]=g.useState(null),[m,x]=g.useState(null),[p,w]=g.useState(null),[y,v]=g.useState(0),[b,_]=g.useState(0),[C,j]=g.useState(!1),[T,R]=g.useState(!1),A=Ge(t,G=>c(G)),O=ki(s);return l.jsx(eB,{scope:n,type:r,dir:O,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:p,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:R,onCornerWidthChange:v,onCornerHeightChange:_,children:l.jsx(Pe.div,{dir:O,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});M2.displayName=Fx;var L2="ScrollAreaViewport",z2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...o}=e,i=gr(L2,n),a=g.useRef(null),c=Ge(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Pe.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});z2.displayName=L2;var cs="ScrollAreaScrollbar",$x=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return g.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(tB,{...r,ref:t,forceMount:n}):s.type==="scroll"?l.jsx(nB,{...r,ref:t,forceMount:n}):s.type==="auto"?l.jsx(F2,{...r,ref:t,forceMount:n}):s.type==="always"?l.jsx(Ux,{...r,ref:t}):null});$x.displayName=cs;var tB=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),[o,i]=g.useState(!1);return g.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ln,{present:n||o,children:l.jsx(F2,{"data-state":o?"visible":"hidden",...r,ref:t})})}),nB=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),o=e.orientation==="horizontal",i=tm(()=>c("SCROLL_END"),100),[a,c]=JV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),g.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(c("SCROLL"),i()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,o,c,i]),l.jsx(ln,{present:n||a!=="hidden",children:l.jsx(Ux,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ue(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ue(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),F2=g.forwardRef((e,t)=>{const n=gr(cs,e.__scopeScrollArea),{forceMount:r,...s}=e,[o,i]=g.useState(!1),a=e.orientation==="horizontal",c=tm(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,s=gr(cs,e.__scopeScrollArea),o=g.useRef(null),i=g.useRef(0),[a,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=W2(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function f(h,m){return lB(h,i.current,a,m)}return n==="horizontal"?l.jsx(rB,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollLeft,m=Yb(h,a,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?l.jsx(sB,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollTop,m=Yb(h,a);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),rB=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=gr(cs,e.__scopeScrollArea),[i,a]=g.useState(),c=g.useRef(null),u=Ge(t,c,o.onScrollbarXChange);return g.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(U2,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":em(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),Y2(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Pf(i.paddingLeft),paddingEnd:Pf(i.paddingRight)}})}})}),sB=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=gr(cs,e.__scopeScrollArea),[i,a]=g.useState(),c=g.useRef(null),u=Ge(t,c,o.onScrollbarYChange);return g.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(U2,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":em(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),Y2(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Pf(i.paddingTop),paddingEnd:Pf(i.paddingBottom)}})}})}),[oB,$2]=I2(cs),U2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,m=gr(cs,n),[x,p]=g.useState(null),w=Ge(t,A=>p(A)),y=g.useRef(null),v=g.useRef(""),b=m.viewport,_=r.content-r.viewport,C=Ot(d),j=Ot(c),T=tm(f,10);function R(A){if(y.current){const O=A.clientX-y.current.left,G=A.clientY-y.current.top;u({x:O,y:G})}}return g.useEffect(()=>{const A=O=>{const G=O.target;(x==null?void 0:x.contains(G))&&C(O,_)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[b,x,_,C]),g.useEffect(j,[r,j]),Ba(x,T),Ba(m.content,T),l.jsx(oB,{scope:n,scrollbar:x,hasThumb:s,onThumbChange:Ot(o),onThumbPointerUp:Ot(i),onThumbPositionChange:j,onThumbPointerDown:Ot(a),children:l.jsx(Pe.div,{...h,ref:w,style:{position:"absolute",...h.style},onPointerDown:ue(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),R(A))}),onPointerMove:ue(e.onPointerMove,R),onPointerUp:ue(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=v.current,m.viewport&&(m.viewport.style.scrollBehavior=""),y.current=null})})})}),Tf="ScrollAreaThumb",V2=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=$2(Tf,e.__scopeScrollArea);return l.jsx(ln,{present:n||s.hasThumb,children:l.jsx(iB,{ref:t,...r})})}),iB=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,o=gr(Tf,n),i=$2(Tf,n),{onThumbPositionChange:a}=i,c=Ge(t,f=>i.onThumbChange(f)),u=g.useRef(),d=tm(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const m=cB(f,a);u.current=m,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,a]),l.jsx(Pe.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ue(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),x=f.clientX-m.left,p=f.clientY-m.top;i.onThumbPointerDown({x,y:p})}),onPointerUp:ue(e.onPointerUp,i.onThumbPointerUp)})});V2.displayName=Tf;var Vx="ScrollAreaCorner",B2=g.forwardRef((e,t)=>{const n=gr(Vx,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(aB,{...e,ref:t}):null});B2.displayName=Vx;var aB=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=gr(Vx,n),[o,i]=g.useState(0),[a,c]=g.useState(0),u=!!(o&&a);return Ba(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),Ba(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Pe.div,{...r,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Pf(e){return e?parseInt(e,10):0}function W2(e,t){const n=e/t;return isNaN(n)?0:n}function em(e){const t=W2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function lB(e,t,n,r="ltr"){const s=em(n),o=s/2,i=t||o,a=s-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return H2([c,u],f)(e)}function Yb(e,t,n="ltr"){const r=em(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-r,c=n==="ltr"?[0,i]:[i*-1,0],u=Ug(e,c);return H2([0,i],[0,a])(u)}function H2(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Y2(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=n.left!==o.left,a=n.top!==o.top;(i||a)&&t(),n=o,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function tm(e,t){const n=Ot(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Ba(e,t){const n=Ot(t);tn(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var K2=M2,uB=z2,dB=B2;const nm=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(K2,{ref:r,className:re("relative overflow-hidden",e),...n,children:[l.jsx(uB,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(G2,{}),l.jsx(dB,{})]}));nm.displayName=K2.displayName;const G2=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>l.jsx($x,{ref:r,orientation:t,className:re("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:l.jsx(V2,{className:"relative flex-1 rounded-full bg-border"})}));G2.displayName=$x.displayName;const As=new Map([["aliyun",["common.provider.aliyun","/imgs/providers/aliyun.svg"]],["tencent",["common.provider.tencent","/imgs/providers/tencent.svg"]],["huaweicloud",["common.provider.huaweicloud","/imgs/providers/huaweicloud.svg"]],["qiniu",["common.provider.qiniu","/imgs/providers/qiniu.svg"]],["cloudflare",["common.provider.cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["common.provider.namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["common.provider.godaddy","/imgs/providers/godaddy.svg"]],["local",["common.provider.local","/imgs/providers/local.svg"]],["ssh",["common.provider.ssh","/imgs/providers/ssh.svg"]],["webhook",["common.provider.webhook","/imgs/providers/webhook.svg"]]]),Kb=e=>As.get(e),us=ce.union([ce.literal("aliyun"),ce.literal("tencent"),ce.literal("huaweicloud"),ce.literal("qiniu"),ce.literal("cloudflare"),ce.literal("namesilo"),ce.literal("godaddy"),ce.literal("local"),ce.literal("ssh"),ce.literal("webhook")],{message:"access.common.type.errmsg.empty"}),ds=e=>{switch(e){case"aliyun":case"tencent":case"huaweicloud":return"all";case"qiniu":case"local":case"ssh":case"webhook":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},pe=g.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:re("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));pe.displayName="Input";const fB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,accessKeyId:ce.string().min(1,"access.authorization.form.access_key_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),accessSecretId:ce.string().min(1,"access.authorization.form.access_key_secret..placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={accessKeyId:"",accessKeySecret:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"aliyun",accessKeyId:a.accessKeyId,accessSecretId:a.accessKeySecret}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{accessKeyId:d.accessKeyId,accessKeySecret:d.accessSecretId}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}console.log(f),r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKeyId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessSecretId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_secret..placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},hB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,secretId:ce.string().min(1,"access.authorization.form.secret_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),secretKey:ce.string().min(1,"access.authorization.form.secret_key.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={secretId:"",secretKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"tencent",secretId:a.secretId,secretKey:a.secretKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{secretId:d.secretId,secretKey:d.secretKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},mB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,region:ce.string().min(1,"access.authorization.form.region.placeholder").max(64,o("common.errmsg.string_max",{max:64})),accessKeyId:ce.string().min(1,"access.authorization.form.access_key_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),secretAccessKey:ce.string().min(1,"access.authorization.form.access_key_secret..placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={region:"cn-north-1",accessKeyId:"",secretAccessKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"huaweicloud",region:a.region,accessKeyId:a.accessKeyId,secretAccessKey:a.secretAccessKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{region:d.region,accessKeyId:d.accessKeyId,secretAccessKey:d.secretAccessKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}console.log(f),r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"region",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.region.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.region.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKeyId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretAccessKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_secret..placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},pB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,accessKey:ce.string().min(1,"access.authorization.form.access_key.placeholder").max(64),secretKey:ce.string().min(1,"access.authorization.form.secret_key.placeholder").max(64)});let a={accessKey:"",secretKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"qiniu",accessKey:a.accessKey,secretKey:a.secretKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{accessKey:d.accessKey,secretKey:d.secretKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},gB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,dnsApiToken:ce.string().min(1,"access.authorization.form.cloud_dns_api_token.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={dnsApiToken:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"cloudflare",dnsApiToken:a.dnsApiToken}}),u=async d=>{console.log(d);const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{dnsApiToken:d.dnsApiToken}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"dnsApiToken",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.cloud_dns_api_token.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.cloud_dns_api_token.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},yB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,apiKey:ce.string().min(1,"access.authorization.form.namesilo_api_key.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={apiKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"namesilo",apiKey:a.apiKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{apiKey:d.apiKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.namesilo_api_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.namesilo_api_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},vB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,apiKey:ce.string().min(1,"access.authorization.form.godaddy_api_key.placeholder").max(64,o("common.errmsg.string_max",{max:64})),apiSecret:ce.string().min(1,"access.authorization.form.godaddy_api_secret.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={apiKey:"",apiSecret:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"godaddy",apiKey:a.apiKey,apiSecret:a.apiSecret}}),u=async d=>{console.log(d);const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{apiKey:d.apiKey,apiSecret:d.apiSecret}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.godaddy_api_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.godaddy_api_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiSecret",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.godaddy_api_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.godaddy_api_secret.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},xB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s,reloadAccessGroups:o}=cn(),{t:i}=Ye(),a=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,i("common.errmsg.string_max",{max:64})),configType:us}),c=un({resolver:dn(a),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"local"}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"?s(f):r(f),o()}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-3",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:i("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:i("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:i("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:i("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:i("common.save")})})]})})})})},Bx=({className:e,trigger:t})=>{const{reloadAccessGroups:n}=cn(),[r,s]=g.useState(!1),{t:o}=Ye(),i=ce.object({name:ce.string().min(1,"access.group.form.name.errmsg.empty").max(64,o("common.errmsg.string_max",{max:64}))}),a=un({resolver:dn(i),defaultValues:{name:""}}),c=async u=>{try{await v$({name:u.name}),n(),s(!1)}catch(d){Object.entries(d.response.data).forEach(([h,m])=>{a.setError(h,{type:"manual",message:m.message})})}};return l.jsxs(cl,{onOpenChange:s,open:r,children:[l.jsx(ul,{asChild:!0,className:re(e),children:t}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:o("access.group.add")})}),l.jsx("div",{className:"container py-3",children:l.jsx(fn,{...a,children:l.jsxs("form",{onSubmit:u=>{u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(ke,{control:a.control,name:"name",render:({field:u})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.group.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.group.form.name.errmsg.empty"),...u,type:"text"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})]})]})},wB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s,reloadAccessGroups:o,config:{accessGroups:i}}=cn(),a=g.useRef(null),[c,u]=g.useState(""),{t:d}=Ye(),f=e&&e.group?e.group:"",h=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,m=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,x=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,d("common.errmsg.string_max",{max:64})),configType:us,host:ce.string().refine(_=>m.test(_)||h.test(_),{message:"common.errmsg.host_invalid"}),group:ce.string().optional(),port:ce.string().min(1,"access.authorization.form.ssh_port.placeholder").max(5,d("common.errmsg.string_max",{max:5})),username:ce.string().min(1,"username.not.empty").max(64,d("common.errmsg.string_max",{max:64})),password:ce.string().min(0,"password.not.empty").max(64,d("common.errmsg.string_max",{max:64})),key:ce.string().min(0,"access.authorization.form.ssh_key.placeholder").max(20480,d("common.errmsg.string_max",{max:20480})),keyFile:ce.any().optional()});let p={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:""};e&&(p=e.config);const w=un({resolver:dn(x),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"ssh",group:e==null?void 0:e.group,host:p.host,port:p.port,username:p.username,password:p.password,key:p.key,keyFile:p.keyFile}}),y=async _=>{let C=_.group;C=="emptyId"&&(C="");const j={id:_.id,name:_.name,configType:_.configType,usage:ds(_.configType),group:C,config:{host:_.host,port:_.port,username:_.username,password:_.password,key:_.key}};try{j.id=t=="copy"?"":j.id;const T=await ls(j);n(),j.id=T.id,j.created=T.created,j.updated=T.updated,_.id&&t=="edit"?s(j):r(j),C!=f&&(f&&await Rb({id:f,"access-":j.id}),C&&await Rb({id:C,"access+":j.id})),o()}catch(T){Object.entries(T.response.data).forEach(([A,O])=>{w.setError(A,{type:"manual",message:O.message})});return}},v=async _=>{var R;const C=(R=_.target.files)==null?void 0:R[0];if(!C)return;const j=C;u(j.name);const T=await WU(j);w.setValue("key",T)},b=()=>{var _;console.log(a.current),(_=a.current)==null||_.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...w,children:l.jsxs("form",{onSubmit:_=>{_.stopPropagation(),w.handleSubmit(y)(_)},className:"space-y-3",children:[l.jsx(ke,{control:w.control,name:"name",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.name.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"group",render:({field:_})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"w-full flex justify-between",children:[l.jsx("div",{children:d("access.authorization.form.ssh_group.label")}),l.jsx(Bx,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),d("common.add")]})})]}),l.jsx(je,{children:l.jsxs($a,{..._,value:_.value,defaultValue:"emptyId",onValueChange:C=>{w.setValue("group",C)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:d("access.authorization.form.access_group.placeholder")})}),l.jsxs(xi,{children:[l.jsx(Do,{value:"emptyId",children:l.jsx("div",{className:re("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),i.map(C=>l.jsx(Do,{value:C.id?C.id:"",children:l.jsx("div",{className:re("flex items-center space-x-2 rounded cursor-pointer"),children:C.name})},C.id))]})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"id",render:({field:_})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:d("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"configType",render:({field:_})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:d("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{..._})}),l.jsx(ye,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(ke,{control:w.control,name:"host",render:({field:_})=>l.jsxs(Se,{className:"grow",children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_host.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_host.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"port",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_port.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_port.placeholder"),..._,type:"number"})}),l.jsx(ye,{})]})})]}),l.jsx(ke,{control:w.control,name:"username",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.username.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.username.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"password",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.password.placeholder"),..._,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"key",render:({field:_})=>l.jsxs(Se,{hidden:!0,children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_key.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"keyFile",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_key.label")}),l.jsx(je,{children:l.jsxs("div",{children:[l.jsx(Me,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:b,children:c||d("access.authorization.form.ssh_key_file.placeholder")}),l.jsx(pe,{placeholder:d("access.authorization.form.ssh_key.placeholder"),..._,ref:a,className:"hidden",hidden:!0,type:"file",onChange:v})]})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:d("common.save")})})]})})})})},bB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,url:ce.string().url("common.errmsg.url_invalid")});let a={url:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"webhook",url:a.url}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{url:d.url}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"url",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.webhook_url.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.webhook_url.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})};function fa({trigger:e,op:t,data:n,className:r}){const[s,o]=g.useState(!1),{t:i}=Ye(),a=Array.from(As.keys()),[c,u]=g.useState((n==null?void 0:n.configType)||"");let d=l.jsx(l.Fragment,{children:" "});switch(c){case"aliyun":d=l.jsx(fB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"tencent":d=l.jsx(hB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"huaweicloud":d=l.jsx(mB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"qiniu":d=l.jsx(pB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"cloudflare":d=l.jsx(gB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"namesilo":d=l.jsx(yB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"godaddy":d=l.jsx(vB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"local":d=l.jsx(xB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"ssh":d=l.jsx(wB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"webhook":d=l.jsx(bB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break}const f=h=>h==c?"border-primary":"";return l.jsxs(cl,{onOpenChange:o,open:s,children:[l.jsx(ul,{asChild:!0,className:re(r),children:e}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:t=="add"?i("access.authorization.add"):t=="edit"?i("access.authorization.edit"):i("access.authorization.copy")})}),l.jsx(nm,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Vt,{children:i("access.authorization.form.type.label")}),l.jsxs($a,{onValueChange:h=>{u(h)},defaultValue:c,children:[l.jsx(vi,{className:"mt-3",children:l.jsx(Ua,{placeholder:i("access.authorization.form.type.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:i("access.authorization.form.type.list")}),a.map(h=>{var m,x;return l.jsx(Do,{value:h,children:l.jsxs("div",{className:re("flex items-center space-x-2 rounded cursor-pointer",f(h)),children:[l.jsx("img",{src:(m=As.get(h))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:i(((x=As.get(h))==null?void 0:x[0])||"")})]})},h)})]})})]}),d]})})]})]})}const _B=({className:e,trigger:t})=>{const{config:{emails:n},setEmails:r}=cn(),[s,o]=g.useState(!1),{t:i}=Ye(),a=ce.object({email:ce.string().email("common.errmsg.email_invalid")}),c=un({resolver:dn(a),defaultValues:{email:""}}),u=async d=>{if(n.content.emails.includes(d.email)){c.setError("email",{message:"common.errmsg.email_duplicate"});return}const f=[...n.content.emails,d.email];try{const h=await al({...n,name:"emails",content:{emails:f}});r(h),c.reset(),c.clearErrors(),o(!1)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsxs(cl,{onOpenChange:o,open:s,children:[l.jsx(ul,{asChild:!0,className:re(e),children:t}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:i("domain.application.form.email.add")})}),l.jsx("div",{className:"container py-3",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"email",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:i("domain.application.form.email.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:i("common.errmsg.email_empty"),...d,type:"email"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:i("common.save")})})]})})})]})]})},Z2={domain:"common.text.domain",ip:"common.text.ip",dns:"common.text.dns"},Gb=({value:e,className:t,onValueChange:n,valueType:r="domain"})=>{const[s,o]=g.useState([]),{t:i}=Ye();g.useMemo(()=>{e&&o(e.split(";"))},[e]),g.useEffect(()=>{(()=>{n(s.join(";"))})()},[s]);const a=d=>{s.includes(d)||o([...s,d])},c=(d,f)=>{const h=[...s];h[d]=f,o(h)},u=d=>{const f=[...s];f.splice(d,1),o(f)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:re(t),children:[l.jsxs(Ce,{className:"flex justify-between items-center",children:[l.jsx("div",{children:i(Z2[r])}),l.jsx(dr,{when:s.length>0,children:l.jsx(dp,{op:"add",onValueChange:d=>{a(d)},valueType:r,value:"",trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:i("common.add")})]})})})]}),l.jsx(je,{children:l.jsx(dr,{when:s.length>0,fallback:l.jsxs("div",{className:"border rounded-md p-3 text-sm mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:i("common.text."+r+".empty")}),l.jsx(dp,{value:"",trigger:i("common.add"),onValueChange:a,valueType:r})]}),children:l.jsx("div",{className:"border rounded-md p-3 text-sm mt-2 text-gray-700 space-y-2 dark:text-white dark:border-stone-700 dark:bg-stone-950",children:s.map((d,f)=>l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{children:d}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(dp,{op:"edit",valueType:r,trigger:l.jsx(sv,{size:16,className:"cursor-pointer text-gray-600 dark:text-white"}),value:d,onValueChange:h=>{c(f,h)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{u(f)}})]})]},f))})})})]})})},dp=({trigger:e,value:t,onValueChange:n,op:r="add",valueType:s})=>{const[o,i]=g.useState(""),[a,c]=g.useState(!1),[u,d]=g.useState(""),{t:f}=Ye();g.useEffect(()=>{i(t)},[t]);const h=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:f("common.errmsg.domain_invalid")}),m=ce.string().ip({message:f("common.errmsg.ip_invalid")}),x={domain:h,dns:m,host:m},p=g.useCallback(()=>{const y=x[s].safeParse(o);if(!y.success){d(JSON.parse(y.error.message)[0].message);return}i(""),c(!1),d(""),n(o)},[o]);return l.jsxs(cl,{open:a,onOpenChange:w=>{c(w)},children:[l.jsx(ul,{className:"text-primary",children:e}),l.jsxs(Ti,{className:"dark:text-white",children:[l.jsx(Pi,{children:l.jsx(Ri,{className:"dark:text-white",children:f(Z2[s])})}),l.jsx(pe,{value:o,className:"dark:text-white",onChange:w=>{i(w.target.value)}}),l.jsx(dr,{when:u.length>0,children:l.jsx("div",{className:"text-red-500 text-sm",children:u})}),l.jsx(Jh,{children:l.jsx(Me,{onClick:()=>{p()},children:f(r==="add"?"common.add":"common.confirm")})})]})]})},Rf=new Map([["aliyun-oss",["common.provider.aliyun.oss","/imgs/providers/aliyun.svg"]],["aliyun-cdn",["common.provider.aliyun.cdn","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["common.provider.aliyun.dcdn","/imgs/providers/aliyun.svg"]],["tencent-cdn",["common.provider.tencent.cdn","/imgs/providers/tencent.svg"]],["qiniu-cdn",["common.provider.qiniu.cdn","/imgs/providers/qiniu.svg"]],["local",["common.provider.local","/imgs/providers/local.svg"]],["ssh",["common.provider.ssh","/imgs/providers/ssh.svg"]],["webhook",["common.provider.webhook","/imgs/providers/webhook.svg"]]]),SB=Array.from(Rf.keys()),kB=eu("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),rm=g.forwardRef(({className:e,variant:t,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:re(kB({variant:t}),e),...n}));rm.displayName="Alert";const Wx=g.forwardRef(({className:e,...t},n)=>l.jsx("h5",{ref:n,className:re("mb-1 font-medium leading-none tracking-tight",e),...t}));Wx.displayName="AlertTitle";const sm=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("text-sm [&_p]:leading-relaxed",e),...t}));sm.displayName="AlertDescription";const Af=g.forwardRef(({className:e,...t},n)=>l.jsx("textarea",{className:re("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Af.displayName="Textarea";var q2=Symbol.for("immer-nothing"),Zb=Symbol.for("immer-draftable"),qn=Symbol.for("immer-state");function kr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wa=Object.getPrototypeOf;function Ha(e){return!!e&&!!e[qn]}function wi(e){var t;return e?X2(e)||Array.isArray(e)||!!e[Zb]||!!((t=e.constructor)!=null&&t[Zb])||im(e)||am(e):!1}var CB=Object.prototype.constructor.toString();function X2(e){if(!e||typeof e!="object")return!1;const t=Wa(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===CB}function Df(e,t){om(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function om(e){const t=e[qn];return t?t.type_:Array.isArray(e)?1:im(e)?2:am(e)?3:0}function Kg(e,t){return om(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q2(e,t,n){const r=om(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function jB(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function im(e){return e instanceof Map}function am(e){return e instanceof Set}function Bo(e){return e.copy_||e.base_}function Gg(e,t){if(im(e))return new Map(e);if(am(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=X2(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[qn];let s=Reflect.ownKeys(r);for(let o=0;o1&&(e.set=e.add=e.clear=e.delete=EB),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Hx(r,!0))),e}function EB(){kr(2)}function lm(e){return Object.isFrozen(e)}var NB={};function bi(e){const t=NB[e];return t||kr(0,e),t}var Yc;function J2(){return Yc}function TB(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function qb(e,t){t&&(bi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zg(e){qg(e),e.drafts_.forEach(PB),e.drafts_=null}function qg(e){e===Yc&&(Yc=e.parent_)}function Xb(e){return Yc=TB(Yc,e)}function PB(e){const t=e[qn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qb(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[qn].modified_&&(Zg(t),kr(4)),wi(e)&&(e=Of(t,e),t.parent_||If(t,e)),t.patches_&&bi("Patches").generateReplacementPatches_(n[qn].base_,e,t.patches_,t.inversePatches_)):e=Of(t,n,[]),Zg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==q2?e:void 0}function Of(e,t,n){if(lm(t))return t;const r=t[qn];if(!r)return Df(t,(s,o)=>Jb(e,r,t,s,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return If(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let o=s,i=!1;r.type_===3&&(o=new Set(s),s.clear(),i=!0),Df(o,(a,c)=>Jb(e,r,s,a,c,n,i)),If(e,s,!1),n&&e.patches_&&bi("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Jb(e,t,n,r,s,o,i){if(Ha(s)){const a=o&&t&&t.type_!==3&&!Kg(t.assigned_,r)?o.concat(r):void 0,c=Of(e,s,a);if(Q2(n,r,c),Ha(c))e.canAutoFreeze_=!1;else return}else i&&n.add(s);if(wi(s)&&!lm(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Of(e,s),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&If(e,s)}}function If(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hx(t,n)}function RB(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:J2(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,o=Yx;n&&(s=[r],o=Kc);const{revoke:i,proxy:a}=Proxy.revocable(s,o);return r.draft_=a,r.revoke_=i,a}var Yx={get(e,t){if(t===qn)return e;const n=Bo(e);if(!Kg(n,t))return AB(e,n,t);const r=n[t];return e.finalized_||!wi(r)?r:r===fp(e.base_,t)?(hp(e),e.copy_[t]=Qg(r,e)):r},has(e,t){return t in Bo(e)},ownKeys(e){return Reflect.ownKeys(Bo(e))},set(e,t,n){const r=eT(Bo(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const s=fp(Bo(e),t),o=s==null?void 0:s[qn];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(jB(n,s)&&(n!==void 0||Kg(e.base_,t)))return!0;hp(e),Xg(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fp(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,hp(e),Xg(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Bo(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){kr(11)},getPrototypeOf(e){return Wa(e.base_)},setPrototypeOf(){kr(12)}},Kc={};Df(Yx,(e,t)=>{Kc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Kc.deleteProperty=function(e,t){return Kc.set.call(this,e,t,void 0)};Kc.set=function(e,t,n){return Yx.set.call(this,e[0],t,n,e[0])};function fp(e,t){const n=e[qn];return(n?Bo(n):e)[t]}function AB(e,t,n){var s;const r=eT(t,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(e.draft_):void 0}function eT(e,t){if(!(t in e))return;let n=Wa(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wa(n)}}function Xg(e){e.modified_||(e.modified_=!0,e.parent_&&Xg(e.parent_))}function hp(e){e.copy_||(e.copy_=Gg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var DB=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const i=this;return function(c=o,...u){return i.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&kr(6),r!==void 0&&typeof r!="function"&&kr(7);let s;if(wi(t)){const o=Xb(this),i=Qg(t,void 0);let a=!0;try{s=n(i),a=!1}finally{a?Zg(o):qg(o)}return qb(o,r),Qb(s,o)}else if(!t||typeof t!="object"){if(s=n(t),s===void 0&&(s=t),s===q2&&(s=void 0),this.autoFreeze_&&Hx(s,!0),r){const o=[],i=[];bi("Patches").generateReplacementPatches_(t,s,o,i),r(o,i)}return s}else kr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...a)=>this.produceWithPatches(i,c=>t(c,...a));let r,s;return[this.produce(t,n,(i,a)=>{r=i,s=a}),r,s]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){wi(e)||kr(8),Ha(e)&&(e=OB(e));const t=Xb(this),n=Qg(e,void 0);return n[qn].isManual_=!0,qg(t),n}finishDraft(e,t){const n=e&&e[qn];(!n||!n.isManual_)&&kr(9);const{scope_:r}=n;return qb(r,t),Qb(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const s=t[n];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}n>-1&&(t=t.slice(n+1));const r=bi("Patches").applyPatches_;return Ha(e)?r(e,t):this.produce(e,s=>r(s,t))}};function Qg(e,t){const n=im(e)?bi("MapSet").proxyMap_(e,t):am(e)?bi("MapSet").proxySet_(e,t):RB(e,t);return(t?t.scope_:J2()).drafts_.push(n),n}function OB(e){return Ha(e)||kr(10,e),tT(e)}function tT(e){if(!wi(e)||lm(e))return e;const t=e[qn];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Gg(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Gg(e,!0);return Df(n,(r,s)=>{Q2(n,r,tT(s))}),t&&(t.finalized_=!1),n}var Xn=new DB,qr=Xn.produce;Xn.produceWithPatches.bind(Xn);Xn.setAutoFreeze.bind(Xn);Xn.setUseStrictShallowCopy.bind(Xn);Xn.applyPatches.bind(Xn);Xn.createDraft.bind(Xn);Xn.finishDraft.bind(Xn);const IB=({variables:e,onValueChange:t})=>{const[n,r]=g.useState([]),{t:s}=Ye();g.useEffect(()=>{e&&r(e)},[e]);const o=c=>{const u=n.findIndex(f=>f.key===c.key),d=qr(n,f=>{u===-1?f.push(c):f[u]=c});r(d),t==null||t(d)},i=c=>{const u=[...n];u.splice(c,1),r(u),t==null||t(u)},a=(c,u)=>{const d=[...n];d[c]=u,r(d),t==null||t(d)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex justify-between dark:text-stone-200",children:[l.jsx(Vt,{children:s("domain.deployment.form.variables.label")}),l.jsx(dr,{when:!!(n!=null&&n.length),children:l.jsx(mp,{variable:{key:"",value:""},trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:s("common.add")})]}),onSave:c=>{o(c)}})})]}),l.jsx(dr,{when:!!(n!=null&&n.length),fallback:l.jsxs("div",{className:"border rounded-md p-3 text-sm mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:s("domain.deployment.form.variables.empty")}),l.jsx(mp,{trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:s("common.add")})]}),variable:{key:"",value:""},onSave:c=>{o(c)}})]}),children:l.jsx("div",{className:"border p-3 rounded-md text-stone-700 text-sm dark:text-stone-200",children:n==null?void 0:n.map((c,u)=>l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("div",{children:[c.key,"=",c.value]}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(mp,{trigger:l.jsx(sv,{size:16,className:"cursor-pointer"}),variable:c,onSave:d=>{a(u,d)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{i(u)}})]})]},u))})})]})},mp=({variable:e,trigger:t,onSave:n})=>{const[r,s]=g.useState({key:"",value:""});g.useEffect(()=>{e&&s(e)},[e]);const{t:o}=Ye(),[i,a]=g.useState(!1),[c,u]=g.useState({}),d=()=>{if(!r.key){u({key:o("domain.deployment.form.variables.key.required")});return}if(!r.value){u({value:o("domain.deployment.form.variables.value.required")});return}n==null||n(r),a(!1),u({})};return l.jsxs(cl,{open:i,onOpenChange:()=>{a(!i)},children:[l.jsx(ul,{children:t}),l.jsxs(Ti,{className:"dark:text-stone-200",children:[l.jsxs(Pi,{className:"flex flex-col",children:[l.jsx(Ri,{children:o("domain.deployment.form.variables.label")}),l.jsxs("div",{className:"pt-5 flex flex-col items-start",children:[l.jsx(Vt,{children:o("domain.deployment.form.variables.key")}),l.jsx(pe,{placeholder:o("domain.deployment.form.variables.key.placeholder"),value:r==null?void 0:r.key,onChange:f=>{s({...r,key:f.target.value})},className:"w-full mt-1"}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c==null?void 0:c.key})]}),l.jsxs("div",{className:"pt-2 flex flex-col items-start",children:[l.jsx(Vt,{children:o("domain.deployment.form.variables.value")}),l.jsx(pe,{placeholder:o("domain.deployment.form.variables.value.placeholder"),value:r==null?void 0:r.value,onChange:f=>{s({...r,value:f.target.value})},className:"w-full mt-1"}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c==null?void 0:c.value})]})]}),l.jsx(Jh,{children:l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{onClick:()=>{d()},children:o("common.save")})})})]})]})},MB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let LB=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=MB[n[e]&63];return t};const nT=g.createContext({}),Ya=()=>g.useContext(nT),zB=({deploys:e,onChange:t})=>{const[n,r]=g.useState([]),{t:s}=Ye();g.useEffect(()=>{r(e)},[e]);const o=c=>{c.id=LB();const u=[...n,c];r(u),t(u)},i=c=>{const u=n.filter(d=>d.id!==c);r(u),t(u)},a=c=>{const u=n.map(d=>d.id===c.id?{...c}:d);r(u),t(u)};return l.jsx(l.Fragment,{children:l.jsxs(dr,{when:n.length>0,fallback:l.jsx(rm,{className:"w-full border dark:border-stone-400",children:l.jsxs(sm,{className:"flex flex-col items-center",children:[l.jsx("div",{children:s("domain.deployment.nodata")}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Jg,{onSave:c=>{o(c)},trigger:l.jsx(Me,{size:"sm",children:s("common.add")})})})]})}),children:[l.jsx("div",{className:"flex justify-end py-2 border-b dark:border-stone-400",children:l.jsx(Jg,{trigger:l.jsx(Me,{size:"sm",children:s("common.add")}),onSave:c=>{o(c)}})}),l.jsx("div",{className:"w-full md:w-[35em] rounded mt-5 border dark:border-stone-400 dark:text-stone-200",children:l.jsx("div",{className:"",children:n.map(c=>l.jsx(FB,{item:c,onDelete:()=>{i(c.id??"")},onSave:u=>{a(u)}},c.id))})})]})})},FB=({item:e,onDelete:t,onSave:n})=>{const{config:{accesses:r}}=cn(),{t:s}=Ye(),o=r.find(c=>c.id===e.access),i=()=>{if(!o)return"";const c=As.get(o.configType);return c?c[1]:""},a=()=>{if(!o)return"";const c=Rf.get(e.type);return c?s(c[0]):""};return l.jsxs("div",{className:"flex justify-between text-sm p-3 items-center text-stone-700 dark:text-stone-200",children:[l.jsxs("div",{className:"flex space-x-2 items-center",children:[l.jsx("div",{children:l.jsx("img",{src:i(),className:"w-9"})}),l.jsxs("div",{className:"text-stone-600 flex-col flex space-y-0 dark:text-stone-200",children:[l.jsx("div",{children:a()}),l.jsx("div",{children:o==null?void 0:o.name})]})]}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Jg,{trigger:l.jsx(sv,{size:16,className:"cursor-pointer"}),deployConfig:e,onSave:c=>{n(c)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{t()}})]})]})},Jg=({trigger:e,deployConfig:t,onSave:n})=>{const{config:{accesses:r}}=cn(),[s,o]=g.useState(),[i,a]=g.useState({access:"",type:""}),[c,u]=g.useState({}),[d,f]=g.useState(!1);g.useEffect(()=>{a(t?{...t}:{access:"",type:""})},[t]),g.useEffect(()=>{const w=i.type.split("-");console.log(w);let y;w&&w.length>1?y=w[1]:y=i.type,o(y),u({})},[i.type]);const h=g.useCallback(w=>{w.type!==i.type?a({...w,access:"",config:{}}):a({...w})},[i.type]),{t:m}=Ye(),x=r.filter(w=>{if(w.usage=="apply")return!1;if(i.type=="")return!0;const y=i.type.split("-");return w.configType===y[0]}),p=()=>{const w={...c};i.type===""?w.type=m("domain.deployment.form.access.placeholder"):w.type="",i.access===""?w.access=m("domain.deployment.form.access.placeholder"):w.access="",u(w);for(const y in w)if(w[y]!=="")return;n(i),a({access:"",type:""}),u({}),f(!1)};return l.jsx(nT.Provider,{value:{deploy:i,setDeploy:h,error:c,setError:u},children:l.jsxs(cl,{open:d,onOpenChange:f,children:[l.jsx(ul,{children:e}),l.jsxs(Ti,{className:"dark:text-stone-200",children:[l.jsxs(Pi,{children:[l.jsx(Ri,{children:m("history.page.title")}),l.jsx(O2,{})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:m("domain.deployment.form.type.label")}),l.jsxs($a,{value:i.type,onValueChange:w=>{h({...i,type:w})},children:[l.jsx(vi,{className:"mt-2",children:l.jsx(Ua,{placeholder:m("domain.deployment.form.type.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:m("domain.deployment.form.type.list")}),SB.map(w=>{var y,v;return l.jsx(Do,{value:w,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(y=Rf.get(w))==null?void 0:y[1]}),l.jsx("div",{children:m(((v=Rf.get(w))==null?void 0:v[0])??"")})]})},w)})]})})]}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c.type})]}),l.jsxs("div",{children:[l.jsxs(Vt,{className:"flex justify-between",children:[l.jsx("div",{children:m("domain.deployment.form.access.label")}),l.jsx(fa,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),m("common.add")]}),op:"add"})]}),l.jsxs($a,{value:i.access,onValueChange:w=>{h({...i,access:w})},children:[l.jsx(vi,{className:"mt-2",children:l.jsx(Ua,{placeholder:m("domain.deployment.form.access.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:m("domain.deployment.form.access.list")}),x.map(w=>{var y;return l.jsx(Do,{value:w.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(y=As.get(w.configType))==null?void 0:y[1]}),l.jsx("div",{children:w.name})]})},w.id)})]})})]}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c.access})]}),l.jsx($B,{type:s}),l.jsx(Jh,{children:l.jsx(Me,{onClick:w=>{w.stopPropagation(),p()},children:m("common.save")})})]})]})})},$B=({type:e})=>(()=>{switch(e){case"ssh":return l.jsx(e1,{});case"local":return l.jsx(e1,{});case"cdn":return l.jsx(pp,{});case"dcdn":return l.jsx(pp,{});case"oss":return l.jsx(UB,{});case"webhook":return l.jsx(VB,{});default:return l.jsx(pp,{})}})(),e1=()=>{var s,o,i,a;const{t:e}=Ye(),{setError:t}=Ya();g.useEffect(()=>{t({})},[]);const{deploy:n,setDeploy:r}=Ya();return g.useEffect(()=>{n.id||r({...n,config:{certPath:"/etc/nginx/ssl/nginx.crt",keyPath:"/etc/nginx/ssl/nginx.key",preCommand:"",command:"sudo service nginx reload"}})},[]),l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col space-y-2",children:[l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_cert_path.label")}),l.jsx(pe,{placeholder:e("access.authorization.form.ssh_cert_path.label"),className:"w-full mt-1",value:(s=n==null?void 0:n.config)==null?void 0:s.certPath,onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.certPath=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_key_path.label")}),l.jsx(pe,{placeholder:e("access.authorization.form.ssh_key_path.placeholder"),className:"w-full mt-1",value:(o=n==null?void 0:n.config)==null?void 0:o.keyPath,onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.keyPath=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_pre_command.label")}),l.jsx(Af,{className:"mt-1",value:(i=n==null?void 0:n.config)==null?void 0:i.preCommand,placeholder:e("access.authorization.form.ssh_pre_command.placeholder"),onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.preCommand=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_command.label")}),l.jsx(Af,{className:"mt-1",value:(a=n==null?void 0:n.config)==null?void 0:a.command,placeholder:e("access.authorization.form.ssh_command.placeholder"),onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.command=c.target.value});r(u)}})]})]})})},pp=()=>{var i;const{deploy:e,setDeploy:t,error:n,setError:r}=Ya(),{t:s}=Ye();g.useEffect(()=>{r({})},[]),g.useEffect(()=>{var c;const a=o.safeParse((c=e.config)==null?void 0:c.domain);a.success?r({...n,domain:""}):r({...n,domain:JSON.parse(a.error.message)[0].message})},[e]);const o=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:s("common.errmsg.domain_invalid")});return l.jsx("div",{className:"flex flex-col space-y-2",children:l.jsxs("div",{children:[l.jsx(Vt,{children:s("domain.deployment.form.cdn_domain.label")}),l.jsx(pe,{placeholder:s("domain.deployment.form.cdn_domain.placeholder"),className:"w-full mt-1",value:(i=e==null?void 0:e.config)==null?void 0:i.domain,onChange:a=>{const c=a.target.value,u=o.safeParse(c);u.success?r({...n,domain:""}):r({...n,domain:JSON.parse(u.error.message)[0].message});const d=qr(e,f=>{f.config||(f.config={}),f.config.domain=c});t(d)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.domain})]})})},UB=()=>{var a,c,u;const{deploy:e,setDeploy:t,error:n,setError:r}=Ya(),{t:s}=Ye();g.useEffect(()=>{r({})},[]),g.useEffect(()=>{var f;const d=o.safeParse((f=e.config)==null?void 0:f.domain);d.success?r({...n,domain:""}):r({...n,domain:JSON.parse(d.error.message)[0].message})},[e]),g.useEffect(()=>{var f;const d=i.safeParse((f=e.config)==null?void 0:f.domain);d.success?r({...n,bucket:""}):r({...n,bucket:JSON.parse(d.error.message)[0].message})},[]),g.useEffect(()=>{e.id||t({...e,config:{endpoint:"oss-cn-hangzhou.aliyuncs.com",bucket:"",domain:""}})},[]);const o=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:s("common.errmsg.domain_invalid")}),i=ce.string().min(1,{message:s("domain.deployment.form.oss_bucket.placeholder")});return l.jsx("div",{className:"flex flex-col space-y-2",children:l.jsxs("div",{children:[l.jsx(Vt,{children:s("domain.deployment.form.oss_endpoint.label")}),l.jsx(pe,{className:"w-full mt-1",value:(a=e==null?void 0:e.config)==null?void 0:a.endpoint,onChange:d=>{const f=d.target.value,h=qr(e,m=>{m.config||(m.config={}),m.config.endpoint=f});t(h)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.endpoint}),l.jsx(Vt,{children:s("domain.deployment.form.oss_bucket")}),l.jsx(pe,{placeholder:s("domain.deployment.form.oss_bucket.placeholder"),className:"w-full mt-1",value:(c=e==null?void 0:e.config)==null?void 0:c.bucket,onChange:d=>{const f=d.target.value,h=i.safeParse(f);h.success?r({...n,bucket:""}):r({...n,bucket:JSON.parse(h.error.message)[0].message});const m=qr(e,x=>{x.config||(x.config={}),x.config.bucket=f});t(m)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.bucket}),l.jsx(Vt,{children:s("domain.deployment.form.cdn_domain.label")}),l.jsx(pe,{placeholder:s("domain.deployment.form.cdn_domain.label"),className:"w-full mt-1",value:(u=e==null?void 0:e.config)==null?void 0:u.domain,onChange:d=>{const f=d.target.value,h=o.safeParse(f);h.success?r({...n,domain:""}):r({...n,domain:JSON.parse(h.error.message)[0].message});const m=qr(e,x=>{x.config||(x.config={}),x.config.domain=f});t(m)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.domain})]})})},VB=()=>{var r;const{deploy:e,setDeploy:t}=Ya(),{setError:n}=Ya();return g.useEffect(()=>{n({})},[]),l.jsx(l.Fragment,{children:l.jsx(IB,{variables:(r=e==null?void 0:e.config)==null?void 0:r.variables,onValueChange:s=>{const o=qr(e,i=>{i.config||(i.config={}),i.config.variables=s});t(o)}})})},rT=g.forwardRef(({...e},t)=>l.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));rT.displayName="Breadcrumb";const sT=g.forwardRef(({className:e,...t},n)=>l.jsx("ol",{ref:n,className:re("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));sT.displayName="BreadcrumbList";const ey=g.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:re("inline-flex items-center gap-1.5",e),...t}));ey.displayName="BreadcrumbItem";const oT=g.forwardRef(({asChild:e,className:t,...n},r)=>{const s=e?ts:"a";return l.jsx(s,{ref:r,className:re("transition-colors hover:text-foreground",t),...n})});oT.displayName="BreadcrumbLink";const iT=g.forwardRef(({className:e,...t},n)=>l.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:re("font-normal text-foreground",e),...t}));iT.displayName="BreadcrumbPage";const aT=({children:e,className:t,...n})=>l.jsx("li",{role:"presentation","aria-hidden":"true",className:re("[&>svg]:size-3.5",t),...n,children:e??l.jsx(XS,{})});aT.displayName="BreadcrumbSeparator";const BB=()=>{const{config:{accesses:e,emails:t}}=cn(),[n,r]=g.useState({}),s=Mr(),{t:o}=Ye(),[i,a]=g.useState("apply");g.useEffect(()=>{const x=new URLSearchParams(s.search).get("id");x&&(async()=>{const w=await ZU(x);r(w)})()},[s.search]);const c=ce.object({id:ce.string().optional(),domain:ce.string().min(1,{message:"common.errmsg.domain_invalid"}),email:ce.string().email("common.errmsg.email_invalid").optional(),access:ce.string().regex(/^[a-zA-Z0-9]+$/,{message:"domain.application.form.access.errmsg.empty"}),nameservers:ce.string().optional(),timeout:ce.number().optional()}),u=un({resolver:dn(c),defaultValues:{id:"",domain:"",email:"",access:"",nameservers:"",timeout:60}});g.useEffect(()=>{var m,x,p,w;n&&u.reset({id:n.id,domain:n.domain,email:(m=n.applyConfig)==null?void 0:m.email,access:(x=n.applyConfig)==null?void 0:x.access,nameservers:(p=n.applyConfig)==null?void 0:p.nameservers,timeout:(w=n.applyConfig)==null?void 0:w.timeout})},[n,u]);const{toast:d}=Fr(),f=async m=>{console.log(m);const x={id:m.id,crontab:"0 0 * * *",domain:m.domain,email:m.email,access:m.access,applyConfig:{email:m.email??"",access:m.access,nameservers:m.nameservers,timeout:m.timeout}};try{const p=await pf(x);let w=o("domain.application.form.domain.changed.message");x.id==""&&(w=o("domain.application.form.domain.added.message")),d({title:o("common.save.succeeded.message"),description:w}),n!=null&&n.id||a("deploy"),r({...p})}catch(p){Object.entries(p.response.data).forEach(([y,v])=>{u.setError(y,{type:"manual",message:v.message})});return}},h=async m=>{const x={...n,deployConfig:m};try{const p=await pf(x);let w=o("domain.application.form.domain.changed.message");x.id==""&&(w=o("domain.application.form.domain.added.message")),d({title:o("common.save.succeeded.message"),description:w}),n!=null&&n.id||a("deploy"),r({...p})}catch(p){Object.entries(p.response.data).forEach(([y,v])=>{u.setError(y,{type:"manual",message:v.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(Rx,{}),l.jsx("div",{className:" h-5 text-muted-foreground",children:l.jsx(rT,{children:l.jsxs(sT,{children:[l.jsx(ey,{children:l.jsx(oT,{href:"#/domains",children:o("domain.page.title")})}),l.jsx(aT,{}),l.jsx(ey,{children:l.jsx(iT,{children:n!=null&&n.id?o("domain.edit"):o("domain.add")})})]})})}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex md:mt-5",children:[l.jsx("div",{className:re("cursor-pointer text-right",i==="apply"?"text-primary":""),onClick:()=>{a("apply")},children:o("domain.application.tab")}),l.jsx("div",{className:re("cursor-pointer text-right",i==="deploy"?"text-primary":""),onClick:()=>{if(!(n!=null&&n.id)){d({title:o("domain.application.unsaved.message"),description:o("domain.application.unsaved.message"),variant:"destructive"});return}a("deploy")},children:o("domain.deployment.tab")})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:re("w-full md:w-[35em] p-5 rounded mt-3 md:mt-0",i=="deploy"&&"hidden"),children:l.jsx(fn,{...u,children:l.jsxs("form",{onSubmit:u.handleSubmit(f),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:u.control,name:"domain",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(l.Fragment,{children:l.jsx(Gb,{value:m.value,valueType:"domain",onValueChange:x=>{u.setValue("domain",x)}})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"email",render:({field:m})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"flex w-full justify-between",children:[l.jsx("div",{children:o("domain.application.form.email.label")+" "+o("domain.application.form.email.tips")}),l.jsx(_B,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),o("common.add")]})})]}),l.jsx(je,{children:l.jsxs($a,{...m,value:m.value,onValueChange:x=>{u.setValue("email",x)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:o("domain.application.form.email.errmsg.empty")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:o("domain.application.form.email.list")}),t.content.emails.map(x=>l.jsx(Do,{value:x,children:l.jsx("div",{children:x})},x))]})})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"access",render:({field:m})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"flex w-full justify-between",children:[l.jsx("div",{children:o("domain.application.form.access.label")}),l.jsx(fa,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),o("common.add")]}),op:"add"})]}),l.jsx(je,{children:l.jsxs($a,{...m,value:m.value,onValueChange:x=>{u.setValue("access",x)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:o("domain.application.form.access.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:o("domain.application.form.access.list")}),e.filter(x=>x.usage!="deploy").map(x=>{var p;return l.jsx(Do,{value:x.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(p=As.get(x.configType))==null?void 0:p[1]}),l.jsx("div",{children:x.name})]})},x.id)})]})})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"timeout",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("domain.application.form.timeout.label")}),l.jsx(je,{children:l.jsx(pe,{type:"number",placeholder:o("ddomain.application.form.timeout.placeholder"),...m,value:m.value,onChange:x=>{u.setValue("timeout",parseInt(x.target.value))}})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"nameservers",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(Gb,{value:m.value??"",onValueChange:x=>{u.setValue("nameservers",x)},valueType:"dns"}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:n!=null&&n.id?o("common.save"):o("common.next")})})]})})}),l.jsx("div",{className:re("flex flex-col space-y-5 w-full md:w-[35em]",i=="apply"&&"hidden"),children:l.jsx(zB,{deploys:(n==null?void 0:n.deployConfig)??[],onChange:m=>{h(m)}})})]})]})]})})},lT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));lT.displayName="Card";const cT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("flex flex-col space-y-1.5 p-6",e),...t}));cT.displayName="CardHeader";const uT=g.forwardRef(({className:e,...t},n)=>l.jsx("h3",{ref:n,className:re("text-2xl font-semibold leading-none tracking-tight",e),...t}));uT.displayName="CardTitle";const dT=g.forwardRef(({className:e,...t},n)=>l.jsx("p",{ref:n,className:re("text-sm text-muted-foreground",e),...t}));dT.displayName="CardDescription";const fT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("p-6 pt-0",e),...t}));fT.displayName="CardContent";const hT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("flex items-center p-6 pt-0",e),...t}));hT.displayName="CardFooter";const Us=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",WB=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=cn(),{toast:n}=Fr(),r=er(),{t:s}=Ye(),o=async a=>{try{await y$(a),t()}catch(c){n({title:s("common.delete.failed.message"),description:Us(c),variant:"destructive"});return}},i=()=>{r("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(dr,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(Uw,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:s("access.group.domains.nodata")}),l.jsx(Bx,{trigger:l.jsx(Me,{children:s("access.group.add")}),className:"mt-3"})]})})}),l.jsx(nm,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(a=>l.jsxs(lT,{className:"w-full md:w-[350px]",children:[l.jsxs(cT,{children:[l.jsx(uT,{children:a.name}),l.jsx(dT,{children:s("access.group.total",{total:a.expand?a.expand.access.length:0})})]}),l.jsx(fT,{className:"min-h-[180px]",children:a.expand?l.jsx(l.Fragment,{children:a.expand.access.slice(0,3).map(c=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:Kb(c.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:c.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:Kb(c.configType)[0]})]})]})},c.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(Uw,{size:40})}),l.jsx("div",{className:"ml-2",children:s("access.group.nodata")})]})})}),l.jsx(hT,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(dr,{when:!!(a.expand&&a.expand.access.length>0),children:l.jsx("div",{children:l.jsx(Me,{size:"sm",variant:"link",onClick:()=>{r(`/access?accessGroupId=${a.id}&tab=access`,{replace:!0})},children:s("access.group.domains")})})}),l.jsx(dr,{when:!a.expand||a.expand.access.length==0,children:l.jsx("div",{children:l.jsx(Me,{size:"sm",onClick:i,children:s("access.authorization.add")})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"destructive",size:"sm",children:s("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{className:"dark:text-gray-200",children:s("access.group.delete")}),l.jsx(Uh,{children:s("access.group.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{className:"dark:text-gray-200",children:s("common.cancel")}),l.jsx(Vh,{onClick:()=>{o(a.id?a.id:"")},children:s("common.confirm")})]})]})]})})]})})]}))})})]})};var Kx="Tabs",[HB,e9]=an(Kx,[rl]),mT=rl(),[YB,Gx]=HB(Kx),pT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=ki(a),[f,h]=Zn({prop:r,onChange:s,defaultProp:o});return l.jsx(YB,{scope:n,baseId:Wn(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:l.jsx(Pe.div,{dir:d,"data-orientation":i,...u,ref:t})})});pT.displayName=Kx;var gT="TabsList",yT=g.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Gx(gT,n),i=mT(n);return l.jsx(Cv,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(Pe.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});yT.displayName=gT;var vT="TabsTrigger",xT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Gx(vT,n),a=mT(n),c=_T(i.baseId,r),u=ST(i.baseId,r),d=r===i.value;return l.jsx(jv,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Pe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:ue(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:ue(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(r)})})})});xT.displayName=vT;var wT="TabsContent",bT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=Gx(wT,n),c=_T(a.baseId,r),u=ST(a.baseId,r),d=r===a.value,f=g.useRef(d);return g.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(ln,{present:s||d,children:({present:h})=>l.jsx(Pe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});bT.displayName=wT;function _T(e,t){return`${e}-trigger-${t}`}function ST(e,t){return`${e}-content-${t}`}var KB=pT,kT=yT,CT=xT,jT=bT;const ET=KB,Zx=g.forwardRef(({className:e,...t},n)=>l.jsx(kT,{ref:n,className:re("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Zx.displayName=kT.displayName;const Jo=g.forwardRef(({className:e,...t},n)=>l.jsx(CT,{ref:n,className:re("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Jo.displayName=CT.displayName;const Mf=g.forwardRef(({className:e,...t},n)=>l.jsx(jT,{ref:n,className:re("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Mf.displayName=jT.displayName;const GB={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Lf{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||GB,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{let[a,c]=i;for(let u=0;u{let[a,c]=i;for(let u=0;u{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},t1=e=>e==null?"":""+e,ZB=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},qB=/###/g,n1=e=>e&&e.indexOf("###")>-1?e.replace(qB,"."):e,r1=e=>!e||typeof e=="string",nc=(e,t,n)=>{const r=typeof t!="string"?t:t.split(".");let s=0;for(;s{const{obj:r,k:s}=nc(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),a=nc(e,i,Object);for(;a.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),a=nc(e,i,Object),a&&a.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=n},XB=(e,t,n,r)=>{const{obj:s,k:o}=nc(e,t,Object);s[o]=s[o]||[],s[o].push(n)},zf=(e,t)=>{const{obj:n,k:r}=nc(e,t);if(n)return n[r]},QB=(e,t,n)=>{const r=zf(e,n);return r!==void 0?r:zf(t,n)},NT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):NT(e[r],t[r],n):e[r]=t[r]);return e},Wi=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var JB={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const eW=e=>typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>JB[t]):e;class tW{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const nW=[" ",",","?","!",";"],rW=new tW(20),sW=(e,t,n)=>{t=t||"",n=n||"";const r=nW.filter(i=>t.indexOf(i)<0&&n.indexOf(i)<0);if(r.length===0)return!0;const s=rW.getRegExp(`(${r.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!s.test(e);if(!o){const i=e.indexOf(n);i>0&&!s.test(e.substring(0,i))&&(o=!0)}return o},ty=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let o=0;o-1&&ce&&e.indexOf("_")>0?e.replace("_","-"):e;class o1 extends cm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,i=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):typeof r=="string"&&o?a.push(...r.split(o)):a.push(r)));const c=zf(this.data,a);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),c||!i||typeof r!="string"?c:ty(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,s){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(i?r.split(i):r)),t.indexOf(".")>-1&&(a=t.split("."),s=n,n=a[1]),this.addNamespaces(n),s1(this.data,a,s),o.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,o){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),s=r,r=n,n=a[1]),this.addNamespaces(n);let c=zf(this.data,a)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?NT(c,r,o):c={...c,...r},s1(this.data,a,c),i.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var TT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,s))}),t}};const i1={};class $f extends cm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ZB(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Xr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const i=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!sW(t,r,s);if(i&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(s)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(t[t.length-1],n),c=a[a.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const _=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${_}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${_}${i}`}return s?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:i}const f=this.resolve(t,n);let h=f&&f.res;const m=f&&f.usedKey||i,x=f&&f.exactUsedKey||i,p=Object.prototype.toString.apply(h),w=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&h&&(typeof h!="string"&&typeof h!="boolean"&&typeof h!="number")&&w.indexOf(p)<0&&!(typeof y=="string"&&Array.isArray(h))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const _=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,h,{...n,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return s?(f.res=_,f.usedParams=this.getUsedParamsDetails(n),f):_}if(o){const _=Array.isArray(h),C=_?[]:{},j=_?x:m;for(const T in h)if(Object.prototype.hasOwnProperty.call(h,T)){const R=`${j}${o}${T}`;C[T]=this.translate(R,{...n,joinArrays:!1,ns:a}),C[T]===R&&(C[T]=h[T])}h=C}}else if(v&&typeof y=="string"&&Array.isArray(h))h=h.join(y),h&&(h=this.extendTranslation(h,t,n,r));else{let _=!1,C=!1;const j=n.count!==void 0&&typeof n.count!="string",T=$f.hasDefaultValue(n),R=j?this.pluralResolver.getSuffix(u,n.count,n):"",A=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",O=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),G=O&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${A}`]||n.defaultValue;!this.isValidLookup(h)&&T&&(_=!0,h=G),this.isValidLookup(h)||(C=!0,h=i);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:h,S=T&&G!==h&&this.options.updateMissing;if(C||_||S){if(this.logger.log(S?"updateKey":"missingKey",u,c,i,S?G:h),o){const W=this.resolve(i,{...n,keySeparator:!1});W&&W.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let U=[];const J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(let W=0;W{const $=T&&X!==h?X:z;this.options.missingKeyHandler?this.options.missingKeyHandler(W,c,I,$,S,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(W,c,I,$,S,n),this.emit("missingKey",W,c,I,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?U.forEach(W=>{const I=this.pluralResolver.getSuffixes(W,n);O&&n[`defaultValue${this.options.pluralSeparator}zero`]&&I.indexOf(`${this.options.pluralSeparator}zero`)<0&&I.push(`${this.options.pluralSeparator}zero`),I.forEach(X=>{F([W],i+X,n[`defaultValue${X}`]||G)})}):F(U,i,G))}h=this.extendTranslation(h,t,n,f,r),C&&h===i&&this.options.appendNamespaceToMissingKey&&(h=`${c}:${i}`),(C||_)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${i}`:i,_?h:void 0):h=this.options.parseMissingKeyHandler(h))}return s?(f.res=h,f.usedParams=this.getUsedParamsDetails(n),f):h}extendTranslation(t,n,r,s,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const h=t.match(this.interpolator.nestingRegexp);d=h&&h.length}let f=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),u){const h=t.match(this.interpolator.nestingRegexp),m=h&&h.length;d1&&arguments[1]!==void 0?arguments[1]:{},r,s,o,i,a;return typeof t=="string"&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;s=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=n.count!==void 0&&typeof n.count!="string",m=h&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),x=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",p=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(w=>{this.isValidLookup(r)||(a=w,!i1[`${p[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(i1[`${p[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(y=>{if(this.isValidLookup(r))return;i=y;const v=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,y,w,n);else{let _;h&&(_=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(v.push(d+_),n.ordinal&&_.indexOf(j)===0&&v.push(d+_.replace(j,this.options.pluralSeparator)),m&&v.push(d+C)),x){const T=`${d}${this.options.contextSeparator}${n.context}`;v.push(T),h&&(v.push(T+_),n.ordinal&&_.indexOf(j)===0&&v.push(T+_.replace(j,this.options.pluralSeparator)),m&&v.push(T+C))}}let b;for(;b=v.pop();)this.isValidLookup(r)||(o=b,r=this.getResource(y,w,b,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,usedLng:i,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const o of n)delete s[o]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const gp=e=>e.charAt(0).toUpperCase()+e.slice(1);class a1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Xr.create("languageUtils")}getScriptPartFromCode(t){if(t=Ff(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Ff(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=gp(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=gp(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=gp(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],o=i=>{i&&(this.isSupportedCode(i)?s.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(i=>{s.indexOf(i)<0&&o(this.formatLanguageCode(i))}),s}}let oW=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],iW={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const aW=["v1","v2","v3"],lW=["v4"],l1={zero:0,one:1,two:2,few:3,many:4,other:5},cW=()=>{const e={};return oW.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:iW[t.fc]}})}),e};class uW{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Xr.create("pluralResolver"),(!this.options.compatibilityJSON||lW.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=cW(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const r=Ff(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];const i=new Intl.PluralRules(r,{type:s});return this.pluralRulesCache[o]=i,i}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,o)=>l1[s]-l1[o]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const o=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!aW.includes(this.options.compatibilityJSON)}}const c1=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=QB(e,t,n);return!o&&s&&typeof n=="string"&&(o=ty(e,n,r),o===void 0&&(o=ty(t,n,r))),o},yp=e=>e.replace(/\$/g,"$$$$");class dW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:m,nestingSuffix:x,nestingSuffixEscaped:p,nestingOptionsSeparator:w,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:eW,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Wi(o):i||"{{",this.suffix=a?Wi(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=h?Wi(h):m||Wi("$t("),this.nestingSuffix=x?Wi(x):p||Wi(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,i,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=m=>{if(m.indexOf(this.formatSeparator)<0){const y=c1(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:m}):y}const x=m.split(this.formatSeparator),p=x.shift().trim(),w=x.join(this.formatSeparator).trim();return this.format(c1(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:p})};this.resetRegExp();const d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>yp(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?yp(this.escape(m)):yp(m)}].forEach(m=>{for(a=0;o=m.regex.exec(t);){const x=o[1].trim();if(i=u(x),i===void 0)if(typeof d=="function"){const w=d(t,o,s);i=typeof w=="string"?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,x))i="";else if(f){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${t}`),i="";else typeof i!="string"&&!this.useRawValueToEscape&&(i=t1(i));const p=m.safeValue(i);if(t=t.replace(o[0],p),f?(m.regex.lastIndex+=i.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,o,i;const a=(c,u)=>{const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const f=c.split(new RegExp(`${d}[ ]*{`));let h=`{${f[1]}`;c=f[0],h=this.interpolate(h,i);const m=h.match(/'/g),x=h.match(/"/g);(m&&m.length%2===0&&!x||x.length%2!==0)&&(h=h.replace(/'/g,'"'));try{i=JSON.parse(h),u&&(i={...u,...i})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,p),`${c}${d}${h}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];i={...r},i=i.replace&&typeof i.replace!="string"?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const d=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=d.shift(),c=d,u=!0}if(o=n(a.call(this,s[1].trim(),i),i),o&&s[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=t1(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u&&(o=c.reduce((d,f)=>this.format(d,f,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const fW=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(i=>{if(i){const[a,...c]=i.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Hi=e=>{const t={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const i=r+JSON.stringify(o);let a=t[i];return a||(a=e(Ff(r),s),t[i]=a),a(n)}};class hW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.create("formatter"),this.options=t,this.formats={number:Hi((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return o=>s.format(o)}),currency:Hi((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>s.format(o)}),datetime:Hi((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return o=>s.format(o)}),relativetime:Hi((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return o=>s.format(o,r.range||"day")}),list:Hi((n,r)=>{const s=new Intl.ListFormat(n,{...r});return o=>s.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Hi(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(a=>a.indexOf(")")>-1)){const a=o.findIndex(c=>c.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,c)=>{const{formatName:u,formatOptions:d}=fW(c);if(this.formats[u]){let f=a;try{const h=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},m=h.locale||h.lng||s.locale||s.lng||r;f=this.formats[u](a,m,{...d,...s,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const mW=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class pW extends cm{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Xr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const o={},i={},a={},c={};return t.forEach(u=>{let d=!0;n.forEach(f=>{const h=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?i[h]===void 0&&(i[h]=!0):(this.state[h]=1,d=!1,i[h]===void 0&&(i[h]=!0),o[h]===void 0&&(o[h]=!0),c[f]===void 0&&(c[f]=!0)))}),d||(a[u]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),o=s[0],i=s[1];n&&this.emit("failedLoading",o,i,n),!n&&r&&this.store.addResourceBundle(o,i,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(c=>{XB(c.loaded,[o],i),mW(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const d=c.loaded[u];d.length&&d.forEach(f=>{a[u][f]===void 0&&(a[u][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:o,callback:i});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&d&&s{this.read.call(this,t,n,r,s+1,o*2,i)},o);return}i(u,d)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],o=r[1];this.read(s,o,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,i),!i&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,a),this.loaded(t,i,a)})}saveMissing(t,n,r,s,o){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...i,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,s,c):d=u(t,n,r,s),d&&typeof d.then=="function"?d.then(f=>a(null,f)).catch(a):a(null,d)}catch(d){a(d)}else u(t,n,r,s,a,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const u1=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),d1=e=>(typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),sd=()=>{},gW=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Gc extends cm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=d1(t),this.services={},this.logger=Xr,this.modules={external:[]},gW(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=u1();this.options={...s,...this.options,...d1(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Xr.init(o(this.modules.logger),this.options):Xr.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=hW);const f=new a1(this.options);this.store=new o1(this.options.resources,this.options);const h=this.services;h.logger=Xr,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new uW(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=o(d),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new dW(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new pW(o(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(m){for(var x=arguments.length,p=new Array(x>1?x-1:0),w=1;w1?x-1:0),w=1;w{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,r||(r=sd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const c=Nl(),u=()=>{const d=(f,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(h),r(f,h)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sd;const s=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.push(u)})};s?i(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>i(c)),this.options.preload&&this.options.preload.forEach(a=>i(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const s=Nl();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=sd),this.services.backendConnector.reload(t,n,o=>{s.resolve(),r(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&TT.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=Nl();this.emit("languageChanging",t);const o=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},i=(c,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=typeof c=="string"?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{i(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),s}getFixedT(t,n,r){var s=this;const o=function(i,a){let c;if(typeof a!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),f=2;f`${c.keyPrefix}${h}${x}`):m=c.keyPrefix?`${c.keyPrefix}${h}${i}`:i,s.t(m,c)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!s||i(o,t)))}loadNamespaces(t,n){const r=Nl();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Nl();typeof t=="string"&&(t=[t]);const s=this.options.preload||[],o=t.filter(i=>s.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=s.concat(o),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new a1(u1());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Gc(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sd;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new Gc(s);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new o1(this.store.data,s),o.services.resourceStore=o.store),o.translator=new $f(o.services,s),o.translator.on("*",function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d{const{config:e,deleteAccess:t}=cn(),{accesses:n}=e,r=10,s=Math.ceil(n.length/r),o=er(),i=Mr(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),h=(u-1)*r,m=h+r,x=async w=>{const y=await g$(w);t(y.id)},p=w=>{a.set("tab",w),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:Wt("access.page.title")}),d!="access_group"?l.jsx(fa,{trigger:l.jsx(Me,{children:Wt("access.authorization.add")}),op:"add"}):l.jsx(Bx,{trigger:l.jsx(Me,{children:Wt("access.group.add")})})]}),l.jsxs(ET,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(Zx,{className:"space-x-5 px-3",children:[l.jsx(Jo,{value:"access",onClick:()=>{p("access")},children:Wt("access.authorization.tab")}),l.jsx(Jo,{value:"access_group",onClick:()=>{p("access_group")},children:Wt("access.group.tab")})]}),l.jsx(Mf,{value:"access",children:n.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(MO,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:Wt("access.authorization.nodata")}),l.jsx(fa,{trigger:l.jsx(Me,{children:Wt("access.authorization.add")}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:Wt("common.text.name")}),l.jsx("div",{className:"w-48",children:Wt("common.text.provider")}),l.jsx("div",{className:"w-60",children:Wt("common.text.created_at")}),l.jsx("div",{className:"w-60",children:Wt("common.text.updated_at")}),l.jsx("div",{className:"grow",children:Wt("common.text.operations")})]}),n.filter(w=>f?w.group==f:!0).slice(h,m).map(w=>{var y,v;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:w.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(y=As.get(w.configType))==null?void 0:y[1],className:"w-6"}),l.jsx("div",{children:Wt(((v=As.get(w.configType))==null?void 0:v[0])||"")})]}),l.jsx("div",{className:"sm:w-60 w-full pt-1 sm:pt-0 flex items-center",children:w.created&&Ma(w.created)}),l.jsx("div",{className:"sm:w-60 w-full pt-1 sm:pt-0 flex items-center",children:w.updated&&Ma(w.updated)}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(fa,{trigger:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.edit")}),op:"edit",data:w}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(fa,{trigger:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.copy")}),op:"copy",data:w}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{className:"dark:text-gray-200",children:Wt("access.authorization.delete")}),l.jsx(Uh,{children:Wt("access.authorization.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{className:"dark:text-gray-200",children:Wt("common.cancel")}),l.jsx(Vh,{onClick:()=>{x(w)},children:Wt("common.confirm")})]})]})]})]})]},w.id)}),l.jsx(wE,{totalPages:s,currentPage:u,onPageChange:w=>{a.set("page",w.toString()),o({search:a.toString()})}})]})}),l.jsx(Mf,{value:"access_group",children:l.jsx(WB,{})})]})]})},PT=async e=>{let t=1;e.page&&(t=e.page);let n=50;e.perPage&&(n=e.perPage);let r="domain!=null";return e.domain&&(r=`domain="${e.domain}"`),await ot().collection("deployments").getList(t,n,{filter:r,sort:"-deployedAt",expand:"domain"})},vW=()=>{const e=er(),[t,n]=g.useState(),[r]=kO(),{t:s}=Ye(),o=r.get("domain");return g.useEffect(()=>{(async()=>{const a={};o&&(a.domain=o);const c=await PT(a);n(c.items)})()},[o]),l.jsxs(nm,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:s("history.page.title")}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:s("history.props.domain")}),l.jsx("div",{className:"w-24",children:s("history.props.status")}),l.jsx("div",{className:"w-56",children:s("history.props.stage")}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:s("history.props.last_execution_time")}),l.jsx("div",{className:"grow",children:s("common.text.operations")})]}),t==null?void 0:t.map(i=>{var a,c;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(a=i.expand.domain)==null?void 0:a.domain.split(";").map(u=>l.jsxs(l.Fragment,{children:[u,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Sx,{deployment:i})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(xx,{phase:i.phase,phaseSuccess:i.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ma(i.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(Hv,{children:[l.jsx(Yv,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:s("history.log")})}),l.jsxs(bh,{className:"sm:max-w-5xl",children:[l.jsx(Kv,{children:l.jsxs(Gv,{children:[(c=i.expand.domain)==null?void 0:c.domain,"-",i.id,s("history.log")]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[i.log.check&&l.jsx(l.Fragment,{children:i.log.check.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.apply&&l.jsx(l.Fragment,{children:i.log.apply.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.info&&u.info.map(d=>l.jsx("div",{className:"mt-1 text-green-600",children:d})),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.deploy&&l.jsx(l.Fragment,{children:i.log.deploy.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))})]})]})]})})]},i.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(rm,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(Wx,{children:s("common.text.nodata")}),l.jsxs(sm,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(JS,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ",s("history.nodata")]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(Me,{onClick:()=>{e("/")},children:s("domain.add")})})]})]})})]})},xW=ce.object({username:ce.string().email({message:"login.username.errmsg.invalid"}),password:ce.string().min(10,{message:"login.password.errmsg.invalid"})}),wW=()=>{const{t:e}=Ye(),t=un({resolver:dn(xW),defaultValues:{username:"",password:""}}),n=async s=>{try{await ot().admins.authWithPassword(s.username,s.password),r("/")}catch(o){const i=Us(o);t.setError("username",{message:i}),t.setError("password",{message:i})}},r=er();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(fn,{...t,children:l.jsxs("form",{onSubmit:t.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:t.control,name:"username",render:({field:s})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("login.username.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("login.username.placeholder"),...s})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:t.control,name:"password",render:({field:s})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("login.password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("login.password.placeholder"),...s,type:"password"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:e("login.submit")})})]})})]})},bW=()=>ot().authStore.isValid&&ot().authStore.isAdmin?l.jsx(GS,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(nv,{}),l.jsx(iE,{})]}),_W=ce.object({oldPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"}),newPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"}),confirmPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"settings.password.password.errmsg.not_matched",path:["confirmPassword"]}),SW=()=>{const{toast:e}=Fr(),t=er(),{t:n}=Ye(),r=un({resolver:dn(_W),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),s=async o=>{var i,a;try{await ot().admins.authWithPassword((i=ot().authStore.model)==null?void 0:i.email,o.oldPassword)}catch(c){const u=Us(c);r.setError("oldPassword",{message:u})}try{await ot().admins.update((a=ot().authStore.model)==null?void 0:a.id,{password:o.newPassword,passwordConfirm:o.confirmPassword}),ot().authStore.clear(),e({title:n("settings.password.changed.message"),description:n("settings.account.relogin.message")}),setTimeout(()=>{t("/login")},500)}catch(c){const u=Us(c);e({title:n("settings.password.failed.message"),description:u,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(s),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:r.control,name:"oldPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.current_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.current_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:r.control,name:"newPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.new_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.new_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:r.control,name:"confirmPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.confirm_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.confirm_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:n("common.update")})})]})})})})},kW=()=>{const e=Mr(),[t,n]=g.useState("account"),r=er(),{t:s}=Ye();return g.useEffect(()=>{const i=e.pathname.split("/")[2];n(i)},[e]),l.jsxs("div",{children:[l.jsx(Rx,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:s("settings.page.title")}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(ET,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(Zx,{className:"mx-auto",children:[l.jsxs(Jo,{value:"account",onClick:()=>{r("/setting/account")},className:"px-5",children:[l.jsx(HO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.account.tab")})]}),l.jsxs(Jo,{value:"password",onClick:()=>{r("/setting/password")},className:"px-5",children:[l.jsx(IO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.password.tab")})]}),l.jsxs(Jo,{value:"notify",onClick:()=>{r("/setting/notify")},className:"px-5",children:[l.jsx(FO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.notification.tab")})]}),l.jsxs(Jo,{value:"ssl-provider",onClick:()=>{r("/setting/ssl-provider")},className:"px-5",children:[l.jsx(VO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.ca.tab")})]})]}),l.jsx(Mf,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(nv,{})})})]})})]})},CW=()=>{const[e,t]=g.useState(),[n,r]=g.useState(),s=er(),{t:o}=Ye();return g.useEffect(()=>{(async()=>{const a=await GU();t(a)})()},[]),g.useEffect(()=>{(async()=>{const c=await PT({perPage:8});r(c.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:o("dashboard.page.title")})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(BO,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.all")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(bn,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(PO,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.near_expired")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(bn,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(zO,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.enabled")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(bn,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(NO,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.disabled")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(bn,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]})]}),l.jsx("div",{className:"my-4",children:l.jsx("hr",{})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:o("dashboard.history")}),(n==null?void 0:n.length)==0?l.jsx(l.Fragment,{children:l.jsxs(rm,{className:"max-w-[40em] mt-10",children:[l.jsx(Wx,{children:o("common.text.nodata")}),l.jsxs(sm,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(JS,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ",o("history.nodata")]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(Me,{onClick:()=>{s("/edit")},children:o("domain.add")})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:o("history.props.domain")}),l.jsx("div",{className:"w-24",children:o("history.props.status")}),l.jsx("div",{className:"w-56",children:o("history.props.stage")}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:o("history.props.last_execution_time")}),l.jsx("div",{className:"grow",children:o("common.text.operations")})]}),n==null?void 0:n.map(i=>{var a,c;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(a=i.expand.domain)==null?void 0:a.domain.split(";").map(u=>l.jsxs(l.Fragment,{children:[u,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Sx,{deployment:i})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(xx,{phase:i.phase,phaseSuccess:i.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ma(i.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(Hv,{children:[l.jsx(Yv,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:o("history.log")})}),l.jsxs(bh,{className:"sm:max-w-5xl",children:[l.jsx(Kv,{children:l.jsxs(Gv,{children:[(c=i.expand.domain)==null?void 0:c.domain,"-",i.id,o("history.log")]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[i.log.check&&l.jsx(l.Fragment,{children:i.log.check.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.apply&&l.jsx(l.Fragment,{children:i.log.apply.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.info&&u.info.map(d=>l.jsx("div",{className:"mt-1 text-green-600",children:d})),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.deploy&&l.jsx(l.Fragment,{children:i.log.deploy.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))})]})]})]})})]},i.id)})]})]})]})},jW=ce.object({email:ce.string().email("settings.account.email.errmsg.invalid")}),EW=()=>{var a;const{toast:e}=Fr(),t=er(),{t:n}=Ye(),[r,s]=g.useState(!1),o=un({resolver:dn(jW),defaultValues:{email:(a=ot().authStore.model)==null?void 0:a.email}}),i=async c=>{var u;try{await ot().admins.update((u=ot().authStore.model)==null?void 0:u.id,{email:c.email}),ot().authStore.clear(),e({title:n("settings.account.email.changed.message"),description:n("settings.account.relogin.message")}),setTimeout(()=>{t("/login")},500)}catch(d){const f=Us(d);e({title:n("settings.account.email.failed.message"),description:f,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...o,children:l.jsxs("form",{onSubmit:o.handleSubmit(i),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:o.control,name:"email",render:({field:c})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.account.email.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.account.email.placeholder"),...c,type:"email",onChange:u=>{s(!0),o.setValue("email",u.target.value)}})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(Me,{type:"submit",children:n("common.update")}):l.jsx(Me,{type:"submit",disabled:!0,variant:"secondary",children:n("common.update")})})]})})})})},NW=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const n=t.payload.channel;return{...e,content:{...e.content,[n]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},RT=g.createContext({}),qx=()=>g.useContext(RT),TW=({children:e})=>{const[t,n]=g.useReducer(NW,{});g.useEffect(()=>{(async()=>{const i=await vx("notifyChannels");n({type:"SET_CHANNELS",payload:i})})()},[]);const r=g.useCallback(o=>{n({type:"SET_CHANNEL",payload:o})},[]),s=g.useCallback(o=>{n({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(RT.Provider,{value:{config:t,setChannel:r,setChannels:s},children:e})},PW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={accessToken:"",secret:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.dingtalk?d.dingtalk:u})();s({id:e.id??"",name:"dingtalk",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{const a=await al({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"AccessToken",value:r.data.accessToken,onChange:a=>{s({...r,data:{...r.data,accessToken:a.target.value}})}}),l.jsx(pe,{placeholder:n("settings.notification.dingtalk.secret.placeholder"),className:"mt-2",value:r.data.secret,onChange:a=>{s({...r,data:{...r.data,secret:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})},RW={title:"您有 {COUNT} 张证书即将过期",content:"有 {COUNT} 张证书即将过期,域名分别为 {DOMAINS},请保持关注!"},AW=()=>{const[e,t]=g.useState(""),[n,r]=g.useState([RW]),{toast:s}=Fr(),{t:o}=Ye();g.useEffect(()=>{(async()=>{const d=await vx("templates");d.content&&(r(d.content.notifyTemplates),t(d.id?d.id:""))})()},[]);const i=u=>{const d=n[0];r([{...d,title:u}])},a=u=>{const d=n[0];r([{...d,content:u}])},c=async()=>{const u=await al({id:e,content:{notifyTemplates:n},name:"templates"});u.id&&t(u.id),s({title:o("common.save.succeeded.message"),description:o("settings.notification.template.saved.message")})};return l.jsxs("div",{children:[l.jsx(pe,{value:n[0].title,onChange:u=>{i(u.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:o("settings.notification.template.variables.tips.title")}),l.jsx(Af,{className:"mt-2",value:n[0].content,onChange:u=>{a(u.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:o("settings.notification.template.variables.tips.content")}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:c,children:o("common.save")})})]})},DW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={apiToken:"",chatId:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.telegram?d.telegram:u})();s({id:e.id??"",name:"common.provider.telegram",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{const a=await al({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"ApiToken",value:r.data.apiToken,onChange:a=>{s({...r,data:{...r.data,apiToken:a.target.value}})}}),l.jsx(pe,{placeholder:"ChatId",value:r.data.chatId,onChange:a=>{s({...r,data:{...r.data,chatId:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})};function OW(e){try{return new URL(e),!0}catch{return!1}}const IW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={url:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.webhook?d.webhook:u})();s({id:e.id??"",name:"webhook",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{if(r.data.url=r.data.url.trim(),!OW(r.data.url)){o({title:n("common.save.failed.message"),description:n("settings.notification.url.errmsg.invalid"),variant:"destructive"});return}const a=await al({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"Url",value:r.data.url,onChange:a=>{s({...r,data:{...r.data,url:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})};var Xx="Collapsible",[MW,AT]=an(Xx),[LW,Qx]=MW(Xx),DT=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=Zn({prop:r,defaultProp:s,onChange:i});return l.jsx(LW,{scope:n,disabled:o,contentId:Wn(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Pe.div,{"data-state":e0(c),"data-disabled":o?"":void 0,...a,ref:t})})});DT.displayName=Xx;var OT="CollapsibleTrigger",IT=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Qx(OT,n);return l.jsx(Pe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":e0(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ue(e.onClick,s.onOpenToggle)})});IT.displayName=OT;var Jx="CollapsibleContent",MT=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Qx(Jx,e.__scopeCollapsible);return l.jsx(ln,{present:n||s.open,children:({present:o})=>l.jsx(zW,{...r,ref:t,present:o})})});MT.displayName=Jx;var zW=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=Qx(Jx,n),[a,c]=g.useState(r),u=g.useRef(null),d=Ge(t,u),f=g.useRef(0),h=f.current,m=g.useRef(0),x=m.current,p=i.open||a,w=g.useRef(p),y=g.useRef();return g.useEffect(()=>{const v=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(v)},[]),tn(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const b=v.getBoundingClientRect();f.current=b.height,m.current=b.width,w.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),c(r)}},[i.open,r]),l.jsx(Pe.div,{"data-state":e0(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!p,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:p&&s})});function e0(e){return e?"open":"closed"}var FW=DT,$W=IT,UW=MT,qs="Accordion",VW=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[t0,BW,WW]=tu(qs),[um,t9]=an(qs,[WW,AT]),n0=AT(),LT=We.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,o=r;return l.jsx(t0.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?l.jsx(GW,{...o,ref:t}):l.jsx(KW,{...s,ref:t})})});LT.displayName=qs;var[zT,HW]=um(qs),[FT,YW]=um(qs,{collapsible:!1}),KW=We.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=Zn({prop:n,defaultProp:r,onChange:s});return l.jsx(zT,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(FT,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx($T,{...i,ref:t})})})}),GW=We.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...o}=e,[i=[],a]=Zn({prop:n,defaultProp:r,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(h=>h!==d)),[a]);return l.jsx(zT,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(FT,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx($T,{...o,ref:t})})})}),[ZW,dm]=um(qs),$T=We.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ge(a,t),u=BW(n),f=ki(s)==="ltr",h=ue(e.onKeyDown,m=>{var R;if(!VW.includes(m.key))return;const x=m.target,p=u().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),w=p.findIndex(A=>A.ref.current===x),y=p.length;if(w===-1)return;m.preventDefault();let v=w;const b=0,_=y-1,C=()=>{v=w+1,v>_&&(v=b)},j=()=>{v=w-1,v{const{__scopeAccordion:n,value:r,...s}=e,o=dm(Uf,n),i=HW(Uf,n),a=n0(n),c=Wn(),u=r&&i.value.includes(r)||!1,d=o.disabled||e.disabled;return l.jsx(qW,{scope:n,open:u,disabled:d,triggerId:c,children:l.jsx(FW,{"data-orientation":o.orientation,"data-state":KT(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(r):i.onItemClose(r)}})})});UT.displayName=Uf;var VT="AccordionHeader",BT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(VT,n);return l.jsx(Pe.h3,{"data-orientation":s.orientation,"data-state":KT(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:t})});BT.displayName=VT;var ny="AccordionTrigger",WT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(ny,n),i=YW(ny,n),a=n0(n);return l.jsx(t0.ItemSlot,{scope:n,children:l.jsx($W,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...r,ref:t})})});WT.displayName=ny;var HT="AccordionContent",YT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(HT,n),i=n0(n);return l.jsx(UW,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});YT.displayName=HT;function KT(e){return e?"open":"closed"}var XW=LT,QW=UT,JW=BT,GT=WT,ZT=YT;const f1=XW,$l=g.forwardRef(({className:e,...t},n)=>l.jsx(QW,{ref:n,className:re("border-b",e),...t}));$l.displayName="AccordionItem";const Ul=g.forwardRef(({className:e,children:t,...n},r)=>l.jsx(JW,{className:"flex",children:l.jsxs(GT,{ref:r,className:re("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,l.jsx(rv,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ul.displayName=GT.displayName;const Vl=g.forwardRef(({className:e,children:t,...n},r)=>l.jsx(ZT,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:l.jsx("div",{className:re("pb-4 pt-0",e),children:t})}));Vl.displayName=ZT.displayName;const eH=()=>{const{t:e}=Ye();return l.jsx(l.Fragment,{children:l.jsxs(TW,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(f1,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs($l,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("settings.notification.template.label")}),l.jsx(Vl,{children:l.jsx(AW,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(f1,{type:"single",className:"dark:text-stone-200",children:[l.jsxs($l,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.dingtalk")}),l.jsx(Vl,{children:l.jsx(PW,{})})]}),l.jsxs($l,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.telegram")}),l.jsx(Vl,{children:l.jsx(DW,{})})]}),l.jsxs($l,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.webhook")}),l.jsx(Vl,{children:l.jsx(IW,{})})]})]})})]})})};var s0="Radio",[tH,qT]=an(s0),[nH,rH]=tH(s0),XT=g.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:o,disabled:i,value:a="on",onCheck:c,...u}=e,[d,f]=g.useState(null),h=Ge(t,p=>f(p)),m=g.useRef(!1),x=d?!!d.closest("form"):!0;return l.jsxs(nH,{scope:n,checked:s,disabled:i,children:[l.jsx(Pe.button,{type:"button",role:"radio","aria-checked":s,"data-state":eP(s),"data-disabled":i?"":void 0,disabled:i,value:a,...u,ref:h,onClick:ue(e.onClick,p=>{s||c==null||c(),x&&(m.current=p.isPropagationStopped(),m.current||p.stopPropagation())})}),x&&l.jsx(sH,{control:d,bubbles:!m.current,name:r,value:a,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});XT.displayName=s0;var QT="RadioIndicator",JT=g.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,o=rH(QT,n);return l.jsx(ln,{present:r||o.checked,children:l.jsx(Pe.span,{"data-state":eP(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});JT.displayName=QT;var sH=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,o=g.useRef(null),i=jx(n),a=vv(t);return g.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[i,n,r]),l.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function eP(e){return e?"checked":"unchecked"}var oH=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o0="RadioGroup",[iH,n9]=an(o0,[rl,qT]),tP=rl(),nP=qT(),[aH,lH]=iH(o0),rP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:o,required:i=!1,disabled:a=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,m=tP(n),x=ki(u),[p,w]=Zn({prop:o,defaultProp:s,onChange:f});return l.jsx(aH,{scope:n,name:r,required:i,disabled:a,value:p,onValueChange:w,children:l.jsx(Cv,{asChild:!0,...m,orientation:c,dir:x,loop:d,children:l.jsx(Pe.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":a?"":void 0,dir:x,...h,ref:t})})})});rP.displayName=o0;var sP="RadioGroupItem",oP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,o=lH(sP,n),i=o.disabled||r,a=tP(n),c=nP(n),u=g.useRef(null),d=Ge(t,u),f=o.value===s.value,h=g.useRef(!1);return g.useEffect(()=>{const m=p=>{oH.includes(p.key)&&(h.current=!0)},x=()=>h.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",x)}},[]),l.jsx(jv,{asChild:!0,...a,focusable:!i,active:f,children:l.jsx(XT,{disabled:i,required:o.required,checked:f,...c,...s,name:o.name,ref:d,onCheck:()=>o.onValueChange(s.value),onKeyDown:ue(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:ue(s.onFocus,()=>{var m;h.current&&((m=u.current)==null||m.click())})})})});oP.displayName=sP;var cH="RadioGroupIndicator",iP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=nP(n);return l.jsx(JT,{...s,...r,ref:t})});iP.displayName=cH;var aP=rP,lP=oP,uH=iP;const cP=g.forwardRef(({className:e,...t},n)=>l.jsx(aP,{className:re("grid gap-2",e),...t,ref:n}));cP.displayName=aP.displayName;const ry=g.forwardRef(({className:e,...t},n)=>l.jsx(lP,{ref:n,className:re("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:l.jsx(uH,{className:"flex items-center justify-center",children:l.jsx(QS,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ry.displayName=lP.displayName;const dH=()=>{const{t:e}=Ye(),t=ce.object({provider:ce.enum(["letsencrypt","zerossl"],{message:e("settings.ca.provider.errmsg.empty")}),eabKid:ce.string().optional(),eabHmacKey:ce.string().optional()}),n=un({resolver:dn(t),defaultValues:{provider:"letsencrypt"}}),[r,s]=g.useState("letsencrypt"),[o,i]=g.useState(),{toast:a}=Fr();g.useEffect(()=>{(async()=>{const f=await vx("ssl-provider");if(f){i(f);const h=f.content;n.setValue("provider",h.provider),n.setValue("eabKid",h.config[h.provider].eabKid),n.setValue("eabHmacKey",h.config[h.provider].eabHmacKey),s(h.provider)}else n.setValue("provider","letsencrypt"),s("letsencrypt")})()},[]);const c=d=>r===d?"border-primary":"",u=async d=>{if(d.provider==="zerossl"&&(d.eabKid||n.setError("eabKid",{message:e("settings.ca.eab_kid_hmac_key.errmsg.empty")}),d.eabHmacKey||n.setError("eabHmacKey",{message:e("settings.ca.eab_kid_hmac_key.errmsg.empty")}),!d.eabKid||!d.eabHmacKey))return;const f={id:o==null?void 0:o.id,name:"ssl-provider",content:{provider:d.provider,config:{letsencrypt:{},zerossl:{eabKid:d.eabKid??"",eabHmacKey:d.eabHmacKey??""}}}};try{await al(f),a({title:e("common.update.succeeded.message"),description:e("common.update.succeeded.message")})}catch(h){const m=Us(h);a({title:e("common.update.failed.message"),description:m,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...n,children:l.jsxs("form",{onSubmit:n.handleSubmit(u),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:n.control,name:"provider",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("common.text.ca")}),l.jsx(je,{children:l.jsxs(cP,{...d,className:"flex",onValueChange:f=>{s(f),n.setValue("provider",f)},value:r,children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ry,{value:"letsencrypt",id:"letsencrypt"}),l.jsx(Vt,{htmlFor:"letsencrypt",children:l.jsxs("div",{className:re("flex items-center space-x-2 border p-2 rounded cursor-pointer",c("letsencrypt")),children:[l.jsx("img",{src:"/imgs/providers/letsencrypt.svg",className:"h-6"}),l.jsx("div",{children:"Let's Encrypt"})]})})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ry,{value:"zerossl",id:"zerossl"}),l.jsx(Vt,{htmlFor:"zerossl",children:l.jsxs("div",{className:re("flex items-center space-x-2 border p-2 rounded cursor-pointer",c("zerossl")),children:[l.jsx("img",{src:"/imgs/providers/zerossl.svg",className:"h-6"}),l.jsx("div",{children:"ZeroSSL"})]})})]})]})}),l.jsx(ke,{control:n.control,name:"eabKid",render:({field:f})=>l.jsxs(Se,{hidden:r!=="zerossl",children:[l.jsx(Ce,{children:"EAB_KID"}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("settings.ca.eab_kid.errmsg.empty"),...f,type:"text"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:n.control,name:"eabHmacKey",render:({field:f})=>l.jsxs(Se,{hidden:r!=="zerossl",children:[l.jsx(Ce,{children:"EAB_HMAC_KEY"}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("settings.ca.eab_hmac_key.errmsg.empty"),...f,type:"text"})}),l.jsx(ye,{})]})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:e("common.update")})})]})})})})},fH=cO([{path:"/",element:l.jsx(R$,{}),children:[{path:"/",element:l.jsx(CW,{})},{path:"/domains",element:l.jsx(JU,{})},{path:"/edit",element:l.jsx(BB,{})},{path:"/access",element:l.jsx(yW,{})},{path:"/history",element:l.jsx(vW,{})},{path:"/setting",element:l.jsx(kW,{}),children:[{path:"/setting/password",element:l.jsx(SW,{})},{path:"/setting/account",element:l.jsx(EW,{})},{path:"/setting/notify",element:l.jsx(eH,{})},{path:"/setting/ssl-provider",element:l.jsx(dH,{})}]}]},{path:"/login",element:l.jsx(bW,{}),children:[{path:"/login",element:l.jsx(wW,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]),{slice:hH,forEach:mH}=[];function pH(e){return mH.call(hH.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const h1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,gH=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const s=encodeURIComponent(t);let o=`${e}=${s}`;if(r.maxAge>0){const i=r.maxAge-0;if(Number.isNaN(i))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(i)}`}if(r.domain){if(!h1.test(r.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${r.domain}`}if(r.path){if(!h1.test(r.path))throw new TypeError("option path is invalid");o+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o},m1={create(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=gH(e,encodeURIComponent(t),s)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));const i=s.substring(1).split("&");for(let a=0;a0&&i[a].substring(0,c)===t&&(n=i[a].substring(c+1))}}return n}};let Tl=null;const p1=()=>{if(Tl!==null)return Tl;try{Tl=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Tl=!1}return Tl};var xH={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&p1())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&p1()&&window.localStorage.setItem(n,e)}};let Pl=null;const g1=()=>{if(Pl!==null)return Pl;try{Pl=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Pl=!1}return Pl};var wH={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&g1())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&g1()&&window.sessionStorage.setItem(n,e)}},bH={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let o=0;o0?t:void 0}},_H={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},SH={name:"path",lookup(e){var s;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(s=n[typeof t=="number"?t:0])==null?void 0:s.replace("/",""):void 0}},kH={name:"subdomain",lookup(e){var s,o;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((o=(s=window.location)==null?void 0:s.hostname)==null?void 0:o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function CH(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class uP{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=pH(n,this.options||{},CH()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(yH),this.addDetector(vH),this.addDetector(xH),this.addDetector(wH),this.addDetector(bH),this.addDetector(_H),this.addDetector(SH),this.addDetector(kH)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}uP.type="languageDetector";const jH={"common.add":"新增","common.save":"保存","common.save.succeeded.message":"保存成功","common.save.failed.message":"保存失败","common.edit":"编辑","common.copy":"复制","common.download":"下载","common.delete":"刪除","common.delete.succeeded.message":"删除成功","common.delete.failed.message":"删除失败","common.next":"下一步","common.confirm":"确认","common.cancel":"取消","common.submit":"提交","common.update":"更新","common.update.succeeded.message":"修改成功","common.update.failed.message":"修改失败","common.text.domain":"域名","common.text.domain.empty":"无域名","common.text.ip":"IP 地址","common.text.ip.empty":"无 IP 地址","common.text.dns":"DNS(域名服务器)","common.text.dns.empty":"无 DNS 地址","common.text.ca":"CA(证书颁发机构)","common.text.name":"名称","common.text.provider":"服务商","common.text.created_at":"创建时间","common.text.updated_at":"更新时间","common.text.operations":"操作","common.text.nodata":"暂无数据","common.menu.settings":"系统设置","common.menu.logout":"退出登录","common.menu.document":"文档","common.pagination.next":"下一页","common.pagination.prev":"上一页","common.pagination.more":"更多","common.theme.light":"浅色","common.theme.dark":"暗黑","common.theme.system":"跟随系统","common.errmsg.string_max":"请输入不超过 {{max}} 个字符","common.errmsg.email_empty":"请输入邮箱","common.errmsg.email_invalid":"请输入正确的邮箱","common.errmsg.email_duplicate":"邮箱已存在","common.errmsg.domain_invalid":"请输入正确的域名","common.errmsg.host_invalid":"请输入正确的域名或 IP 地址","common.errmsg.ip_invalid":"请输入正确的 IP 地址","common.errmsg.url_invalid":"请输入正确的 URL","common.provider.tencent":"腾讯云","common.provider.tencent.cdn":"腾讯云-CDN","common.provider.aliyun":"阿里云","common.provider.aliyun.cdn":"阿里云-CDN","common.provider.aliyun.oss":"阿里云-OSS","common.provider.aliyun.dcdn":"阿里云-DCDN","common.provider.huaweicloud":"华为云","common.provider.qiniu":"七牛云","common.provider.qiniu.cdn":"七牛云-CDN","common.provider.cloudflare":"Cloudflare","common.provider.namesilo":"Namesilo","common.provider.godaddy":"GoDaddy","common.provider.local":"本地部署","common.provider.ssh":"SSH 部署","common.provider.webhook":"Webhook","common.provider.dingtalk":"钉钉","common.provider.telegram":"Telegram"},EH={"login.username.label":"用户名","login.username.placeholder":"请输入用户名/邮箱","login.username.errmsg.invalid":"请输入正确的用户名/邮箱","login.password.label":"密码","login.password.placeholder":"请输入密码","login.password.errmsg.invalid":"密码至少 10 个字符","login.submit":"登录"},NH={"dashboard.page.title":"仪表盘","dashboard.statistics.all":"所有","dashboard.statistics.near_expired":"即将过期","dashboard.statistics.enabled":"启用中","dashboard.statistics.disabled":"未启用","dashboard.statistics.unit":"个","dashboard.history":"部署历史"},TH={"settings.page.title":"系统设置","settings.account.relogin.message":"请重新登录","settings.account.tab":"账号","settings.account.email.label":"登录邮箱","settings.account.email.errmsg.invalid":"请输入正确的邮箱地址","settings.account.email.placeholder":"请输入邮箱","settings.account.email.changed.message":"修改账户邮箱成功","settings.account.email.failed.message":"修改账户邮箱失败","settings.password.tab":"密码","settings.password.password.errmsg.length":"密码至少10个字符","settings.password.password.errmsg.not_matched":"两次密码不一致","settings.password.current_password.label":"当前密码","settings.password.current_password.placeholder":"请输入旧密码","settings.password.new_password.label":"新密码","settings.password.new_password.placeholder":"请输入新密码","settings.password.confirm_password.label":"确认密码","settings.password.confirm_password.placeholder":"请再次输入新密码","settings.password.changed.message":"修改密码成功","settings.password.failed.message":"修改密码失败","settings.notification.tab":"消息推送","settings.notification.template.label":"内容模板","settings.notification.template.saved.message":"通知模板保存成功","settings.notification.template.variables.tips.title":"可选的变量({COUNT}: 即将过期张数)","settings.notification.template.variables.tips.content":"可选的变量({COUNT}: 即将过期张数;{DOMAINS}: 域名列表)","settings.notification.config.enable":"是否启用","settings.notification.config.saved.message":"配置保存成功","settings.notification.config.failed.message":"配置保存失败","settings.notification.dingtalk.secret.placeholder":"加签的签名","settings.notification.url.errmsg.invalid":"URL 格式不正确","settings.ca.tab":"证书颁发机构(CA)","settings.ca.provider.errmsg.empty":"请选择证书分发机构","settings.ca.eab_kid.errmsg.empty":"请输入EAB_KID","settings.ca.eab_hmac_key.errmsg.empty":"请输入EAB_HMAC_KEY","settings.ca.eab_kid_hmac_key.errmsg.empty":"请输入EAB_KID和EAB_HMAC_KEY"},PH={"domain.page.title":"域名列表","domain.nodata":"请添加域名开始部署证书吧。","domain.add":"新增域名","domain.edit":"编辑域名","domain.delete":"删除域名","domain.delete.confirm":"确定要删除域名吗?","domain.history":"部署历史","domain.deploy":"立即部署","domain.deploy.started.message":"开始部署","domain.deploy.started.tips":"已发起部署,请稍后查看部署日志。","domain.deploy.failed.message":"执行失败","domain.deploy.failed.tips":"执行失败,请在 <1>部署历史 查看详情。","domain.deploy_forced":"强行部署","domain.props.expiry":"有效期限","domain.props.expiry.date1":"有效期 {{date}} 天","domain.props.expiry.date2":"{{date}} 到期","domain.props.last_execution_status":"最近执行状态","domain.props.last_execution_stage":"最近执行阶段","domain.props.last_execution_time":"最近执行时间","domain.props.enable":"是否启用","domain.props.enable.enabled":"启用","domain.props.enable.disabled":"禁用","domain.application.tab":"申请配置","domain.application.form.domain.added.message":"域名添加成功","domain.application.form.domain.changed.message":"域名编辑成功","domain.application.form.email.label":"邮箱","domain.application.form.email.tips":"(申请证书需要提供邮箱)","domain.application.form.email.add":"添加邮箱","domain.application.form.email.list":"邮箱列表","domain.application.form.email.errmsg.empty":"请选择邮箱","domain.application.form.access.label":"DNS 服务商授权配置","domain.application.form.access.placeholder":"请选择 DNS 服务商授权配置","domain.application.form.access.errmsg.empty":"请选择 DNS 服务商授权配置","domain.application.form.access.list":"已有的 DNS 服务商授权配置","domain.application.form.timeout.label":"超时时间","domain.application.form.timeoue.placeholder":"超时时间(单位:秒)","domain.application.unsaved.message":"请先保存申请配置","domain.deployment.tab":"部署配置","domain.deployment.nodata":"暂无部署配置,请添加后开始部署证书吧","domain.deployment.form.type.label":"部署方式","domain.deployment.form.type.placeholder":"请选择部署方式","domain.deployment.form.type.list":"支持的部署方式","domain.deployment.form.access.label":"授权配置","domain.deployment.form.access.placeholder":"请选择授权配置","domain.deployment.form.access.list":"已有的服务商授权配置","domain.deployment.form.cdn_domain.label":"部署到域名","domain.deployment.form.cdn_domain.placeholder":"请输入 CDN 域名","domain.deployment.form.oss_endpoint.label":"Endpoint","domain.deployment.form.oss_bucket":"存储桶","domain.deployment.form.oss_bucket.placeholder":"请输入存储桶名","domain.deployment.form.variables.label":"变量","domain.deployment.form.variables.key":"变量名","domain.deployment.form.variables.value":"值","domain.deployment.form.variables.empty":"尚未添加变量","domain.deployment.form.variables.key.required":"变量名不能为空","domain.deployment.form.variables.value.required":"变量值不能为空","domain.deployment.form.variables.key.placeholder":"请输入变量名","domain.deployment.form.variables.value.placeholder":"请输入变量值"},RH={"access.page.title":"授权管理","access.authorization.tab":"授权","access.authorization.nodata":"请添加授权开始部署证书吧。","access.authorization.add":"新增授权","access.authorization.edit":"编辑授权","access.authorization.copy":"复制授权","access.authorization.delete":"删除授权","access.authorization.delete.confirm":"确定要删除授权吗?","access.authorization.form.type.label":"服务商","access.authorization.form.type.placeholder":"请选择服务商","access.authorization.form.type.list":"服务商列表","access.authorization.form.name.label":"名称","access.authorization.form.name.placeholder":"请输入授权名称","access.authorization.form.config.label":"配置类型","access.authorization.form.region.label":"Region","access.authorization.form.region.placeholder":"请输入区域","access.authorization.form.access_key_id.label":"AccessKeyId","access.authorization.form.access_key_id.placeholder":"请输入 AccessKeyId","access.authorization.form.access_key_secret.label":"AccessKeySecret","access.authorization.form.access_key_secret..placeholder":"请输入 AccessKeySecret","access.authorization.form.access_key.label":"AccessKey","access.authorization.form.access_key.placeholder":"请输入 AccessKey","access.authorization.form.secret_id.label":"SecretId","access.authorization.form.secret_id.placeholder":"请输入 SecretId","access.authorization.form.secret_key.label":"SecretKey","access.authorization.form.secret_key.placeholder":"请输入 SecretKey","access.authorization.form.cloud_dns_api_token.label":"CLOUD_DNS_API_TOKEN","access.authorization.form.cloud_dns_api_token.placeholder":"请输入 CLOUD_DNS_API_TOKEN","access.authorization.form.godaddy_api_key.label":"GO_DADDY_API_KEY","access.authorization.form.godaddy_api_key.placeholder":"请输入 GO_DADDY_API_KEY","access.authorization.form.godaddy_api_secret.label":"GO_DADDY_API_SECRET","access.authorization.form.godaddy_api_secret.placeholder":"请输入 GO_DADDY_API_SECRET","access.authorization.form.namesilo_api_key.label":"NAMESILO_API_KEY","access.authorization.form.namesilo_api_key.placeholder":"请输入 NAMESILO_API_KEY","access.authorization.form.username.label":"用户名","access.authorization.form.username.placeholder":"请输入用户名","access.authorization.form.password.label":"密码","access.authorization.form.password.placeholder":"请输入密码","access.authorization.form.access_group.placeholder":"请选择分组","access.authorization.form.ssh_group.label":"授权配置组(用于将一个域名证书部署到多个 SSH 主机)","access.authorization.form.ssh_host.label":"服务器 Host","access.authorization.form.ssh_host.placeholder":"请输入 Host","access.authorization.form.ssh_port.label":"SSH 端口","access.authorization.form.ssh_port.placeholder":"请输入 Port","access.authorization.form.ssh_key.label":"Key(使用私钥登录)","access.authorization.form.ssh_key.placeholder":"请输入 Key","access.authorization.form.ssh_key_file.placeholder":"请选择文件","access.authorization.form.ssh_key.label.passphrase":"私钥密码","access.authorization.form.ssh_key_path.label":"私钥保存路径","access.authorization.form.ssh_key_path.placeholder":"请输入私钥保存路径","access.authorization.form.ssh_cert_path.label":"证书保存路径","access.authorization.form.ssh_cert_path.placeholder":"请输入证书保存路径","access.authorization.form.ssh_pre_command.label":"前置 Command","access.authorization.form.ssh_pre_command.placeholder":"在部署证书前执行的前置命令","access.authorization.form.ssh_command.label":"Command","access.authorization.form.ssh_command.placeholder":"请输入要执行的命令","access.authorization.form.webhook_url.label":"Webhook URL","access.authorization.form.webhook_url.placeholder":"请输入 Webhook URL","access.group.tab":"授权组","access.group.nodata":"暂无部署授权配置,请添加后开始使用吧","access.group.total":"共有 {{total}} 个部署授权配置","access.group.add":"添加授权组","access.group.delete":"删除组","access.group.delete.confirm":"确定要删除部署授权组吗?","access.group.form.name.label":"组名","access.group.form.name.errmsg.empty":"请输入组名","access.group.domains":"所有授权","access.group.domains.nodata":"请添加域名开始部署证书吧。","access.common.type.errmsg.empty":"请选择服务商"},AH={"history.page.title":"部署","history.nodata":"你暂未创建任何部署,请先添加域名进行部署吧!","history.props.domain":"域名","history.props.status":"状态","history.props.stage":"阶段","history.props.stage.progress.check":"检查","history.props.stage.progress.apply":"获取","history.props.stage.progress.deploy":"部署","history.props.last_execution_time":"最近执行时间","history.log":"日志"},DH=Object.freeze({...jH,...EH,...NH,...TH,...PH,...RH,...AH}),OH={"common.save":"Save","common.save.succeeded.message":"Save Successful","common.save.failed.message":"Save Failed","common.add":"Add","common.edit":"Edit","common.copy":"Copy","common.download":"Download","common.delete":"Delete","common.delete.succeeded.message":"Delete Successful","common.delete.failed.message":"Delete Failed","common.next":"Next","common.confirm":"Confirm","common.cancel":"Cancel","common.submit":"Submit","common.update":"Update","common.update.succeeded.message":"Update Successful","common.update.failed.message":"Update Failed","common.text.domain":"Domain","common.text.domain.empty":"No Domain","common.text.ip":"IP Address","common.text.ip.empty":"No IP address","common.text.dns":"Domain Name Server","common.text.dns.empty":"No DNS","common.text.ca":"Certificate Authority","common.text.provider":"Provider","common.text.name":"Name","common.text.created_at":"Created At","common.text.updated_at":"Updated At","common.text.operations":"Operations","common.text.nodata":"No data available","common.menu.settings":"Settings","common.menu.logout":"Logout","common.menu.document":"Document","common.pagination.next":"Next","common.pagination.prev":"Previous","common.pagination.more":"More pages","common.theme.light":"Light","common.theme.dark":"Dark","common.theme.system":"System","common.errmsg.string_max":"Please enter no more than {{max}} characters","common.errmsg.email_invalid":"Please enter a valid email address","common.errmsg.email_empty":"Please enter email","common.errmsg.email_duplicate":"Email already exists","common.errmsg.domain_invalid":"Please enter domain","common.errmsg.host_invalid":"Please enter the correct domain name or IP","common.errmsg.ip_invalid":"Please enter IP","common.errmsg.url_invalid":"Please enter a valid URL","common.provider.aliyun":"Alibaba Cloud","common.provider.aliyun.cdn":"Alibaba Cloud-CDN","common.provider.aliyun.oss":"Alibaba Cloud-OSS","common.provider.aliyun.dcdn":"Alibaba Cloud-DCDN","common.provider.tencent":"Tencent","common.provider.tencent.cdn":"Tencent-CDN","common.provider.huaweicloud":"Huawei Cloud","common.provider.qiniu":"Qiniu","common.provider.qiniu.cdn":"Qiniu-CDN","common.provider.cloudflare":"Cloudflare","common.provider.namesilo":"Namesilo","common.provider.godaddy":"GoDaddy","common.provider.local":"Local Deployment","common.provider.ssh":"SSH Deployment","common.provider.webhook":"Webhook","common.provider.dingtalk":"DingTalk","common.provider.telegram":"Telegram"},IH={"login.username.label":"Username","login.username.placeholder":"Username/Email","login.username.errmsg.invalid":"Please enter a valid email address","login.password.label":"Password","login.password.placeholder":"Password","login.password.errmsg.invalid":"Password should be at least 10 characters","login.submit":"Log In"},MH={"dashboard.page.title":"Dashboard","dashboard.statistics.all":"All","dashboard.statistics.near_expired":"About to Expire","dashboard.statistics.enabled":"Enabled","dashboard.statistics.disabled":"Not Enabled","dashboard.statistics.unit":"","dashboard.history":"Deployment History"},LH={"settings.page.title":"Settings","settings.account.relogin.message":"Please login again","settings.account.tab":"Account","settings.account.email.label":"Email","settings.account.email.placeholder":"Please enter email","settings.account.email.errmsg.invalid":"Please enter a valid email address","settings.account.email.changed.message":"Account email altered successfully","settings.account.email.failed.message":"Account email alteration failed","settings.password.tab":"Password","settings.password.current_password.label":"Current Password","settings.password.current_password.placeholder":"Please enter the current password","settings.password.new_password.label":"New Password","settings.password.new_password.placeholder":"Please enter the new password","settings.password.confirm_password.label":"Confirm Password","settings.password.confirm_password.placeholder":"Please enter the new password again","settings.password.password.errmsg.length":"Password should be at least 10 characters","settings.password.password.errmsg.not_matched":"Passwords do not match","settings.password.changed.message":"Password changed successfully","settings.password.failed.message":"Password change failed","settings.notification.tab":"Notification","settings.notification.template.label":"Template","settings.notification.template.saved.message":"Notification template saved successfully","settings.notification.template.variables.tips.title":"Optional variables ({COUNT}: number of expiring soon)","settings.notification.template.variables.tips.content":"Optional variables ({COUNT}: number of expiring soon. {DOMAINS}: Domain list)","settings.notification.config.enable":"Enable","settings.notification.config.saved.message":"Configuration saved successfully","settings.notification.config.failed.message":"Configuration save failed","settings.notification.dingtalk.secret.placeholder":"Signature for signed addition","settings.notification.url.errmsg.invalid":"Invalid Url format","settings.ca.tab":"Certificate Authority","settings.ca.provider.errmsg.empty":"Please select a Certificate Authority","settings.ca.eab_kid.errmsg.empty":"Please enter EAB_KID","settings.ca.eab_hmac_key.errmsg.empty":"Please enter EAB_HMAC_KEY.","settings.ca.eab_kid_hmac_key.errmsg.empty":"Please enter EAB_KID and EAB_HMAC_KEY"},zH={"domain.page.title":"Domain List","domain.nodata":"Please add a domain to start deploying the certificate.","domain.add":"Add Domain","domain.edit":"Edit Domain","domain.delete":"Delete Domain","domain.delete.confirm":"Are you sure you want to delete this domain?","domain.history":"Deployment History","domain.deploy":"Deploy Now","domain.deploy.started.message":"Deploy Started","domain.deploy.started.tips":"Deployment initiated, please check the deployment log later.","domain.deploy.failed.message":"Execution Failed","domain.deploy.failed.tips":"Execution failed, please check the details in <1>Deployment History.","domain.deploy_forced":"Force Deployment","domain.props.expiry":"Validity Period","domain.props.expiry.date1":"Valid for {{date}} days","domain.props.expiry.date2":"Expiry on {{date}}","domain.props.last_execution_status":"Last Execution Status","domain.props.last_execution_stage":"Last Execution Stage","domain.props.last_execution_time":"Last Execution Time","domain.props.enable":"Enable","domain.props.enable.enabled":"Enable","domain.props.enable.disabled":"Disable","domain.application.tab":"Apply Settings","domain.application.form.domain.added.message":"Domain added successfully","domain.application.form.domain.changed.message":"Domain updated successfully","domain.application.form.email.label":"Email","domain.application.form.email.tips":"(A email is required to apply for a certificate)","domain.application.form.email.add":"Add Email","domain.application.form.email.list":"Email List","domain.application.form.email.errmsg.empty":"Please select email","domain.application.form.access.label":"DNS Provider Authorization Configuration","domain.application.form.access.placeholder":"Please select DNS provider authorization configuration","domain.application.form.access.errmsg.empty":"Please select DNS provider authorization configuration","domain.application.form.access.list":"Provider Authorization Configurations","domain.application.form.timeout.label":"Timeout","domain.application.form.timeoue.placeholder":"Timeout (seconds)","domain.application.unsaved.message":"Please save applyment configuration first","domain.deployment.tab":"Deploy Settings","domain.deployment.nodata":"Deployment not added yet","domain.deployment.form.type.label":"Deploy Method","domain.deployment.form.type.placeholder":"Please select deploy method","domain.deployment.form.type.list":"Deploy Method List","domain.deployment.form.access.label":"Access Configuration","domain.deployment.form.access.placeholder":"Please select provider authorization configuration","domain.deployment.form.access.list":"Provider Authorization Configurations","domain.deployment.form.cdn_domain.label":"Deploy to domain","domain.deployment.form.cdn_domain.placeholder":"Please enter CDN domain","domain.deployment.form.oss_endpoint.label":"Endpoint","domain.deployment.form.oss_bucket":"Bucket","domain.deployment.form.oss_bucket.placeholder":"Please enter Bucket","domain.deployment.form.variables.label":"Variable","domain.deployment.form.variables.key":"Name","domain.deployment.form.variables.value":"Value","domain.deployment.form.variables.empty":"Variable not added yet","domain.deployment.form.variables.key.required":"Variable name cannot be empty","domain.deployment.form.variables.value.required":"Variable value cannot be empty","domain.deployment.form.variables.key.placeholder":"Variable name","domain.deployment.form.variables.value.placeholder":"Variable value"},FH={"access.page.title":"Authorization Management","access.authorization.tab":"Authorization","access.authorization.nodata":"Please add authorization to start deploying certificate.","access.authorization.add":"Add Authorization","access.authorization.edit":"Edit Authorization","access.authorization.copy":"Copy Authorization","access.authorization.delete":"Delete Authorization","access.authorization.delete.confirm":"Are you sure you want to delete the deployment authorization?","access.authorization.form.type.label":"Provider","access.authorization.form.type.placeholder":"Please select a provider","access.authorization.form.type.list":"Authorization List","access.authorization.form.name.label":"Name","access.authorization.form.name.placeholder":"Please enter authorization name","access.authorization.form.config.label":"Configuration Type","access.authorization.form.region.label":"Region","access.authorization.form.region.placeholder":"Please enter Region","access.authorization.form.access_key_id.label":"AccessKeyId","access.authorization.form.access_key_id.placeholder":"Please enter AccessKeyId","access.authorization.form.access_key_secret.label":"AccessKeySecret","access.authorization.form.access_key_secret..placeholder":"Please enter AccessKeySecret","access.authorization.form.access_key.label":"AccessKey","access.authorization.form.access_key.placeholder":"Please enter AccessKey","access.authorization.form.secret_id.label":"SecretId","access.authorization.form.secret_id.placeholder":"Please enter SecretId","access.authorization.form.secret_key.label":"SecretKey","access.authorization.form.secret_key.placeholder":"Please enter SecretKey","access.authorization.form.cloud_dns_api_token.label":"CLOUD_DNS_API_TOKEN","access.authorization.form.cloud_dns_api_token.placeholder":"Please enter CLOUD_DNS_API_TOKEN","access.authorization.form.godaddy_api_key.label":"GO_DADDY_API_KEY","access.authorization.form.godaddy_api_key.placeholder":"Please enter GO_DADDY_API_KEY","access.authorization.form.godaddy_api_secret.label":"GO_DADDY_API_SECRET","access.authorization.form.godaddy_api_secret.placeholder":"Please enter GO_DADDY_API_SECRET","access.authorization.form.namesilo_api_key.label":"NAMESILO_API_KEY","access.authorization.form.namesilo_api_key.placeholder":"Please enter NAMESILO_API_KEY","access.authorization.form.username.label":"Username","access.authorization.form.username.placeholder":"Please enter username","access.authorization.form.password.label":"Password","access.authorization.form.password.placeholder":"Please enter password","access.authorization.form.access_group.placeholder":"Please select a group","access.authorization.form.ssh_group.label":"Authorization Configuration Group (used to deploy a single domain certificate to multiple SSH hosts)","access.authorization.form.ssh_host.label":"Server Host","access.authorization.form.ssh_host.placeholder":"Please enter Host","access.authorization.form.ssh_port.label":"SSH Port","access.authorization.form.ssh_port.placeholder":"Please enter Port","access.authorization.form.ssh_key.label":"Key (Log in using private key)","access.authorization.form.ssh_key.placeholder":"Please enter Key","access.authorization.form.ssh_key_file.placeholder":"Please select file","access.authorization.form.ssh_key_path.label":"Private Key Save Path","access.authorization.form.ssh_key_path.placeholder":"Please enter private key save path","access.authorization.form.ssh_cert_path.label":"Certificate Save Path","access.authorization.form.ssh_cert_path.placeholder":"Please enter certificate save path","access.authorization.form.ssh_pre_command.label":"Pre-deployment Command","access.authorization.form.ssh_pre_command.placeholder":"Command to be executed before deploying the certificate","access.authorization.form.ssh_command.label":"Command","access.authorization.form.ssh_command.placeholder":"Please enter command","access.authorization.form.webhook_url.label":"Webhook URL","access.authorization.form.webhook_url.placeholder":"Please enter Webhook URL","access.group.tab":"Authorization Group","access.group.nodata":"No deployment authorization configuration yet, please add after starting use.","access.group.total":"Totally {{total}} deployment authorization configuration","access.group.add":"Add Group","access.group.delete":"Delete Group","access.group.delete.confirm":"Are you sure you want to delete the deployment authorization group?","access.group.form.name.label":"Group Name","access.group.form.name.errmsg.empty":"Please enter group name","access.group.domains":"All Authorizations","access.group.domains.nodata":"Please add a domain to start deploying the certificate.","access.common.type.errmsg.empty":"Please select a provider"},$H={"history.page.title":"Deployment","history.nodata":"You have not created any deployments yet, please add a domain to start deployment!","history.props.domain":"Domain","history.props.status":"Status","history.props.stage":"Stage","history.props.last_execution_time":"Last Execution Time","history.props.stage.progress.check":"Check","history.props.stage.progress.apply":"Apply","history.props.stage.progress.deploy":"Deploy","history.log":"Log"},UH=Object.freeze({...OH,...IH,...MH,...LH,...zH,...FH,...$H}),VH={zh:{name:"简体中文",translation:DH},en:{name:"English",translation:UH}};xn.use(uP).use(uI).init({resources:VH,fallbackLng:"zh",debug:!0,interpolation:{escapeValue:!1},backend:{loadPath:"/locales/{{lng}}.json"}});vp.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(S$,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(vO,{router:fH})})}))});export default BH(); +\0`,se+=o($,2),se+=j.magic,se+=o(b,2),se+=o(_,2),se+=o(X.crc32,4),se+=o(X.compressedSize,4),se+=o(X.uncompressedSize,4),se+=o(R.length,2),se+=o(U.length,2),{fileRecord:f.LOCAL_FILE_HEADER+se+R+U,dirRecord:f.CENTRAL_FILE_HEADER+o(he,2)+se+o(G.length,2)+"\0\0\0\0"+o(B,4)+o(w,4)+R+U+G}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(m,x,p,w){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=p,this.encodeFileName=w,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,c),h.prototype.push=function(m){var x=m.meta.percent||0,p=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:p?(x+100*(p-w-1))/p:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var x=this.streamFiles&&!m.file.dir;if(x){var p=i(m,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var x=this.streamFiles&&!m.file.dir,p=i(m,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),x)this.push({data:function(w){return f.DATA_DESCRIPTOR+o(w.crc32,4)+o(w.compressedSize,4)+o(w.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,s){var o=n("./Uint8ArrayReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,s){var o=n("./DataReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,s){var o=n("./ArrayReader");function i(a){o.call(this,a)}n("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,s){var o=n("../utils"),i=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=o.getTypeOf(f);return o.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var o=n("./GenericWorker"),i=n("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,s){var o=n("./GenericWorker"),i=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},r.exports=o},{}],29:[function(n,r,s){var o=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(x,p){return new d.Promise(function(w,y){var v=[],b=x._internalType,_=x._outputType,C=x._mimeType;x.on("data",function(j,T){v.push(j),p&&p(T)}).on("error",function(j){v=[],y(j)}).on("end",function(){try{var j=function(T,R,A){switch(T){case"blob":return o.newBlob(o.transformTo("arraybuffer",R),A);case"base64":return c.encode(R);default:return o.transformTo(T,R)}}(_,function(T,R){var A,O=0,G=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var o=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}s.utf8encode=function(m){return i.nodebuffer?a.newBufferFrom(m,"utf-8"):function(x){var p,w,y,v,b,_=x.length,C=0;for(v=0;v<_;v++)(64512&(w=x.charCodeAt(v)))==55296&&v+1<_&&(64512&(y=x.charCodeAt(v+1)))==56320&&(w=65536+(w-55296<<10)+(y-56320),v++),C+=w<128?1:w<2048?2:w<65536?3:4;for(p=i.uint8array?new Uint8Array(C):new Array(C),v=b=0;b>>6:(w<65536?p[b++]=224|w>>>12:(p[b++]=240|w>>>18,p[b++]=128|w>>>12&63),p[b++]=128|w>>>6&63),p[b++]=128|63&w);return p}(m)},s.utf8decode=function(m){return i.nodebuffer?o.transformTo("nodebuffer",m).toString("utf-8"):function(x){var p,w,y,v,b=x.length,_=new Array(2*b);for(p=w=0;p>10&1023,_[w++]=56320|1023&y)}return _.length!==w&&(_.subarray?_=_.subarray(0,w):_.length=w),o.applyFromCharCode(_)}(m=o.transformTo(i.uint8array?"uint8array":"array",m))},o.inherits(f,c),f.prototype.processChunk=function(m){var x=o.transformTo(i.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=x;(x=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),x.set(p,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var w=function(v,b){var _;for((b=b||v.length)>v.length&&(b=v.length),_=b-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?b:_+u[v[_]]>b?_:b}(x),y=x;w!==x.length&&(i.uint8array?(y=x.subarray(0,w),this.leftOver=x.subarray(w,x.length)):(y=x.slice(0,w),this.leftOver=x.slice(w,x.length))),this.push({data:s.utf8decode(y),meta:m.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(h,c),h.prototype.processChunk=function(m){this.push({data:s.utf8encode(m.data),meta:m.meta})},s.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var o=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(p){return p}function d(p,w){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var x,p,w,y=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4>>6:(m<65536?h[w++]=224|m>>>12:(h[w++]=240|m>>>18,h[w++]=128|m>>>12&63),h[w++]=128|m>>>6&63),h[w++]=128|63&m);return h},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var h=new o.Buf8(f.length),m=0,x=h.length;m>10&1023,v[x++]=56320|1023&p)}return d(v,x)},s.utf8border=function(f,h){var m;for((h=h||f.length)>f.length&&(h=f.length),m=h-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?h:m+c[f[m]]>h?m:h}},{"./common":41}],43:[function(n,r,s){r.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();r.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var h=u;h>>8^d[255&(i^a[h])];return-1^i}},{}],46:[function(n,r,s){var o,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,m=0,x=-2,p=-1,w=4,y=2,v=8,b=9,_=286,C=30,j=19,T=2*_+1,R=15,A=3,O=258,G=O+A+1,N=42,z=113,S=1,U=2,J=3,F=4;function W(E,ee){return E.msg=d[ee],ee}function I(E){return(E<<1)-(4E.avail_out&&(Z=E.avail_out),Z!==0&&(i.arraySet(E.output,ee.pending_buf,ee.pending_out,Z,E.next_out),E.next_out+=Z,ee.pending_out+=Z,E.total_out+=Z,E.avail_out-=Z,ee.pending-=Z,ee.pending===0&&(ee.pending_out=0))}function B(E,ee){a._tr_flush_block(E,0<=E.block_start?E.block_start:-1,E.strstart-E.block_start,ee),E.block_start=E.strstart,$(E.strm)}function he(E,ee){E.pending_buf[E.pending++]=ee}function se(E,ee){E.pending_buf[E.pending++]=ee>>>8&255,E.pending_buf[E.pending++]=255&ee}function oe(E,ee){var Z,D,k=E.max_chain_length,P=E.strstart,M=E.prev_length,K=E.nice_match,L=E.strstart>E.w_size-G?E.strstart-(E.w_size-G):0,Y=E.window,Q=E.w_mask,te=E.prev,ge=E.strstart+O,Ke=Y[P+M-1],Ue=Y[P+M];E.prev_length>=E.good_match&&(k>>=2),K>E.lookahead&&(K=E.lookahead);do if(Y[(Z=ee)+M]===Ue&&Y[Z+M-1]===Ke&&Y[Z]===Y[P]&&Y[++Z]===Y[P+1]){P+=2,Z++;do;while(Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&Y[++P]===Y[++Z]&&PL&&--k!=0);return M<=E.lookahead?M:E.lookahead}function Oe(E){var ee,Z,D,k,P,M,K,L,Y,Q,te=E.w_size;do{if(k=E.window_size-E.lookahead-E.strstart,E.strstart>=te+(te-G)){for(i.arraySet(E.window,E.window,te,te,0),E.match_start-=te,E.strstart-=te,E.block_start-=te,ee=Z=E.hash_size;D=E.head[--ee],E.head[ee]=te<=D?D-te:0,--Z;);for(ee=Z=te;D=E.prev[--ee],E.prev[ee]=te<=D?D-te:0,--Z;);k+=te}if(E.strm.avail_in===0)break;if(M=E.strm,K=E.window,L=E.strstart+E.lookahead,Y=k,Q=void 0,Q=M.avail_in,Y=A)for(P=E.strstart-E.insert,E.ins_h=E.window[P],E.ins_h=(E.ins_h<=A&&(E.ins_h=(E.ins_h<=A)if(D=a._tr_tally(E,E.strstart-E.match_start,E.match_length-A),E.lookahead-=E.match_length,E.match_length<=E.max_lazy_match&&E.lookahead>=A){for(E.match_length--;E.strstart++,E.ins_h=(E.ins_h<=A&&(E.ins_h=(E.ins_h<=A&&E.match_length<=E.prev_length){for(k=E.strstart+E.lookahead-A,D=a._tr_tally(E,E.strstart-1-E.prev_match,E.prev_length-A),E.lookahead-=E.prev_length-1,E.prev_length-=2;++E.strstart<=k&&(E.ins_h=(E.ins_h<E.pending_buf_size-5&&(Z=E.pending_buf_size-5);;){if(E.lookahead<=1){if(Oe(E),E.lookahead===0&&ee===f)return S;if(E.lookahead===0)break}E.strstart+=E.lookahead,E.lookahead=0;var D=E.block_start+Z;if((E.strstart===0||E.strstart>=D)&&(E.lookahead=E.strstart-D,E.strstart=D,B(E,!1),E.strm.avail_out===0)||E.strstart-E.block_start>=E.w_size-G&&(B(E,!1),E.strm.avail_out===0))return S}return E.insert=0,ee===h?(B(E,!0),E.strm.avail_out===0?J:F):(E.strstart>E.block_start&&(B(E,!1),E.strm.avail_out),S)}),new Te(4,4,8,4,me),new Te(4,5,16,8,me),new Te(4,6,32,32,me),new Te(4,4,16,16,we),new Te(8,16,32,32,we),new Te(8,16,128,128,we),new Te(8,32,128,256,we),new Te(32,128,258,1024,we),new Te(32,258,258,4096,we)],s.deflateInit=function(E,ee){return st(E,ee,v,15,8,0)},s.deflateInit2=st,s.deflateReset=Re,s.deflateResetKeep=Ie,s.deflateSetHeader=function(E,ee){return E&&E.state?E.state.wrap!==2?x:(E.state.gzhead=ee,m):x},s.deflate=function(E,ee){var Z,D,k,P;if(!E||!E.state||5>8&255),he(D,D.gzhead.time>>16&255),he(D,D.gzhead.time>>24&255),he(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),he(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(he(D,255&D.gzhead.extra.length),he(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(E.adler=u(E.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(he(D,0),he(D,0),he(D,0),he(D,0),he(D,0),he(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),he(D,3),D.status=z);else{var M=v+(D.w_bits-8<<4)<<8;M|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(M|=32),M+=31-M%31,D.status=z,se(D,M),D.strstart!==0&&(se(D,E.adler>>>16),se(D,65535&E.adler)),E.adler=1}if(D.status===69)if(D.gzhead.extra){for(k=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending!==D.pending_buf_size));)he(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){k=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending===D.pending_buf_size)){P=1;break}P=D.gzindexk&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),P===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){k=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>k&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),$(E),k=D.pending,D.pending===D.pending_buf_size)){P=1;break}P=D.gzindexk&&(E.adler=u(E.adler,D.pending_buf,D.pending-k,k)),P===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&$(E),D.pending+2<=D.pending_buf_size&&(he(D,255&E.adler),he(D,E.adler>>8&255),E.adler=0,D.status=z)):D.status=z),D.pending!==0){if($(E),E.avail_out===0)return D.last_flush=-1,m}else if(E.avail_in===0&&I(ee)<=I(Z)&&ee!==h)return W(E,-5);if(D.status===666&&E.avail_in!==0)return W(E,-5);if(E.avail_in!==0||D.lookahead!==0||ee!==f&&D.status!==666){var K=D.strategy===2?function(L,Y){for(var Q;;){if(L.lookahead===0&&(Oe(L),L.lookahead===0)){if(Y===f)return S;break}if(L.match_length=0,Q=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,Q&&(B(L,!1),L.strm.avail_out===0))return S}return L.insert=0,Y===h?(B(L,!0),L.strm.avail_out===0?J:F):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?S:U}(D,ee):D.strategy===3?function(L,Y){for(var Q,te,ge,Ke,Ue=L.window;;){if(L.lookahead<=O){if(Oe(L),L.lookahead<=O&&Y===f)return S;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=A&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=A?(Q=a._tr_tally(L,1,L.match_length-A),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(Q=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),Q&&(B(L,!1),L.strm.avail_out===0))return S}return L.insert=0,Y===h?(B(L,!0),L.strm.avail_out===0?J:F):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?S:U}(D,ee):o[D.level].func(D,ee);if(K!==J&&K!==F||(D.status=666),K===S||K===J)return E.avail_out===0&&(D.last_flush=-1),m;if(K===U&&(ee===1?a._tr_align(D):ee!==5&&(a._tr_stored_block(D,0,0,!1),ee===3&&(X(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),$(E),E.avail_out===0))return D.last_flush=-1,m}return ee!==h?m:D.wrap<=0?1:(D.wrap===2?(he(D,255&E.adler),he(D,E.adler>>8&255),he(D,E.adler>>16&255),he(D,E.adler>>24&255),he(D,255&E.total_in),he(D,E.total_in>>8&255),he(D,E.total_in>>16&255),he(D,E.total_in>>24&255)):(se(D,E.adler>>>16),se(D,65535&E.adler)),$(E),0=Z.w_size&&(P===0&&(X(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),Y=new i.Buf8(Z.w_size),i.arraySet(Y,ee,Q-Z.w_size,Z.w_size,0),ee=Y,Q=Z.w_size),M=E.avail_in,K=E.next_in,L=E.input,E.avail_in=Q,E.next_in=0,E.input=ee,Oe(Z);Z.lookahead>=A;){for(D=Z.strstart,k=Z.lookahead-(A-1);Z.ins_h=(Z.ins_h<>>=A=R>>>24,b-=A,(A=R>>>16&255)===0)U[d++]=65535&R;else{if(!(16&A)){if(!(64&A)){R=_[(65535&R)+(v&(1<>>=A,b-=A),b<15&&(v+=S[c++]<>>=A=R>>>24,b-=A,!(16&(A=R>>>16&255))){if(!(64&A)){R=C[(65535&R)+(v&(1<>>=A,b-=A,(A=d-f)>3,v&=(1<<(b-=O<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(N){var z;return N&&N.state?(z=N.state,N.total_in=N.total_out=z.total=0,N.msg="",z.wrap&&(N.adler=1&z.wrap),z.mode=x,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new o.Buf32(p),z.distcode=z.distdyn=new o.Buf32(w),z.sane=1,z.back=-1,h):m}function _(N){var z;return N&&N.state?((z=N.state).wsize=0,z.whave=0,z.wnext=0,b(N)):m}function C(N,z){var S,U;return N&&N.state?(U=N.state,z<0?(S=0,z=-z):(S=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15=F.wsize?(o.arraySet(F.window,z,S-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(U<(J=F.wsize-F.wnext)&&(J=U),o.arraySet(F.window,z,S-U,J,F.wnext),(U-=J)?(o.arraySet(F.window,z,S-U,U,0),F.wnext=U,F.whave=F.wsize):(F.wnext+=J,F.wnext===F.wsize&&(F.wnext=0),F.whave>>8&255,S.check=a(S.check,P,2,0),B=$=0,S.mode=2;break}if(S.flags=0,S.head&&(S.head.done=!1),!(1&S.wrap)||(((255&$)<<8)+($>>8))%31){N.msg="incorrect header check",S.mode=30;break}if((15&$)!=8){N.msg="unknown compression method",S.mode=30;break}if(B-=4,E=8+(15&($>>>=4)),S.wbits===0)S.wbits=E;else if(E>S.wbits){N.msg="invalid window size",S.mode=30;break}S.dmax=1<>8&1),512&S.flags&&(P[0]=255&$,P[1]=$>>>8&255,S.check=a(S.check,P,2,0)),B=$=0,S.mode=3;case 3:for(;B<32;){if(I===0)break e;I--,$+=U[F++]<>>8&255,P[2]=$>>>16&255,P[3]=$>>>24&255,S.check=a(S.check,P,4,0)),B=$=0,S.mode=4;case 4:for(;B<16;){if(I===0)break e;I--,$+=U[F++]<>8),512&S.flags&&(P[0]=255&$,P[1]=$>>>8&255,S.check=a(S.check,P,2,0)),B=$=0,S.mode=5;case 5:if(1024&S.flags){for(;B<16;){if(I===0)break e;I--,$+=U[F++]<>>8&255,S.check=a(S.check,P,2,0)),B=$=0}else S.head&&(S.head.extra=null);S.mode=6;case 6:if(1024&S.flags&&(I<(oe=S.length)&&(oe=I),oe&&(S.head&&(E=S.head.extra_len-S.length,S.head.extra||(S.head.extra=new Array(S.head.extra_len)),o.arraySet(S.head.extra,U,F,oe,E)),512&S.flags&&(S.check=a(S.check,U,oe,F)),I-=oe,F+=oe,S.length-=oe),S.length))break e;S.length=0,S.mode=7;case 7:if(2048&S.flags){if(I===0)break e;for(oe=0;E=U[F+oe++],S.head&&E&&S.length<65536&&(S.head.name+=String.fromCharCode(E)),E&&oe>9&1,S.head.done=!0),N.adler=S.check=0,S.mode=12;break;case 10:for(;B<32;){if(I===0)break e;I--,$+=U[F++]<>>=7&B,B-=7&B,S.mode=27;break}for(;B<3;){if(I===0)break e;I--,$+=U[F++]<>>=1)){case 0:S.mode=14;break;case 1:if(O(S),S.mode=20,z!==6)break;$>>>=2,B-=2;break e;case 2:S.mode=17;break;case 3:N.msg="invalid block type",S.mode=30}$>>>=2,B-=2;break;case 14:for($>>>=7&B,B-=7&B;B<32;){if(I===0)break e;I--,$+=U[F++]<>>16^65535)){N.msg="invalid stored block lengths",S.mode=30;break}if(S.length=65535&$,B=$=0,S.mode=15,z===6)break e;case 15:S.mode=16;case 16:if(oe=S.length){if(I>>=5,B-=5,S.ndist=1+(31&$),$>>>=5,B-=5,S.ncode=4+(15&$),$>>>=4,B-=4,286>>=3,B-=3}for(;S.have<19;)S.lens[M[S.have++]]=0;if(S.lencode=S.lendyn,S.lenbits=7,Z={bits:S.lenbits},ee=u(0,S.lens,0,19,S.lencode,0,S.work,Z),S.lenbits=Z.bits,ee){N.msg="invalid code lengths set",S.mode=30;break}S.have=0,S.mode=19;case 19:for(;S.have>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=we,B-=we,S.lens[S.have++]=Fe;else{if(Fe===16){for(D=we+2;B>>=we,B-=we,S.have===0){N.msg="invalid bit length repeat",S.mode=30;break}E=S.lens[S.have-1],oe=3+(3&$),$>>>=2,B-=2}else if(Fe===17){for(D=we+3;B>>=we)),$>>>=3,B-=3}else{for(D=we+7;B>>=we)),$>>>=7,B-=7}if(S.have+oe>S.nlen+S.ndist){N.msg="invalid bit length repeat",S.mode=30;break}for(;oe--;)S.lens[S.have++]=E}}if(S.mode===30)break;if(S.lens[256]===0){N.msg="invalid code -- missing end-of-block",S.mode=30;break}if(S.lenbits=9,Z={bits:S.lenbits},ee=u(d,S.lens,0,S.nlen,S.lencode,0,S.work,Z),S.lenbits=Z.bits,ee){N.msg="invalid literal/lengths set",S.mode=30;break}if(S.distbits=6,S.distcode=S.distdyn,Z={bits:S.distbits},ee=u(f,S.lens,S.nlen,S.ndist,S.distcode,0,S.work,Z),S.distbits=Z.bits,ee){N.msg="invalid distances set",S.mode=30;break}if(S.mode=20,z===6)break e;case 20:S.mode=21;case 21:if(6<=I&&258<=X){N.next_out=W,N.avail_out=X,N.next_in=F,N.avail_in=I,S.hold=$,S.bits=B,c(N,se),W=N.next_out,J=N.output,X=N.avail_out,F=N.next_in,U=N.input,I=N.avail_in,$=S.hold,B=S.bits,S.mode===12&&(S.back=-1);break}for(S.back=0;Te=(k=S.lencode[$&(1<>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>Ie)])>>>16&255,Fe=65535&k,!(Ie+(we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=Ie,B-=Ie,S.back+=Ie}if($>>>=we,B-=we,S.back+=we,S.length=Fe,Te===0){S.mode=26;break}if(32&Te){S.back=-1,S.mode=12;break}if(64&Te){N.msg="invalid literal/length code",S.mode=30;break}S.extra=15&Te,S.mode=22;case 22:if(S.extra){for(D=S.extra;B>>=S.extra,B-=S.extra,S.back+=S.extra}S.was=S.length,S.mode=23;case 23:for(;Te=(k=S.distcode[$&(1<>>16&255,Fe=65535&k,!((we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>Ie)])>>>16&255,Fe=65535&k,!(Ie+(we=k>>>24)<=B);){if(I===0)break e;I--,$+=U[F++]<>>=Ie,B-=Ie,S.back+=Ie}if($>>>=we,B-=we,S.back+=we,64&Te){N.msg="invalid distance code",S.mode=30;break}S.offset=Fe,S.extra=15&Te,S.mode=24;case 24:if(S.extra){for(D=S.extra;B>>=S.extra,B-=S.extra,S.back+=S.extra}if(S.offset>S.dmax){N.msg="invalid distance too far back",S.mode=30;break}S.mode=25;case 25:if(X===0)break e;if(oe=se-X,S.offset>oe){if((oe=S.offset-oe)>S.whave&&S.sane){N.msg="invalid distance too far back",S.mode=30;break}Oe=oe>S.wnext?(oe-=S.wnext,S.wsize-oe):S.wnext-oe,oe>S.length&&(oe=S.length),me=S.window}else me=J,Oe=W-S.offset,oe=S.length;for(XT?(A=Oe[me+w[z]],B[he+w[z]]):(A=96,0),v=1<>W)+(b-=v)]=R<<24|A<<16|O|0,b!==0;);for(v=1<>=1;if(v!==0?($&=v-1,$+=v):$=0,z++,--se[N]==0){if(N===U)break;N=f[h+w[z]]}if(J>>7)]}function he(k,P){k.pending_buf[k.pending++]=255&P,k.pending_buf[k.pending++]=P>>>8&255}function se(k,P,M){k.bi_valid>y-M?(k.bi_buf|=P<>y-k.bi_valid,k.bi_valid+=M-y):(k.bi_buf|=P<>>=1,M<<=1,0<--P;);return M>>>1}function me(k,P,M){var K,L,Y=new Array(w+1),Q=0;for(K=1;K<=w;K++)Y[K]=Q=Q+M[K-1]<<1;for(L=0;L<=P;L++){var te=k[2*L+1];te!==0&&(k[2*L]=Oe(Y[te]++,te))}}function we(k){var P;for(P=0;P>1;1<=M;M--)Ie(k,Y,M);for(L=ge;M=k.heap[1],k.heap[1]=k.heap[k.heap_len--],Ie(k,Y,1),K=k.heap[1],k.heap[--k.heap_max]=M,k.heap[--k.heap_max]=K,Y[2*L]=Y[2*M]+Y[2*K],k.depth[L]=(k.depth[M]>=k.depth[K]?k.depth[M]:k.depth[K])+1,Y[2*M+1]=Y[2*K+1]=L,k.heap[1]=L++,Ie(k,Y,1),2<=k.heap_len;);k.heap[--k.heap_max]=k.heap[1],function(Ue,Et){var nr,Kt,fs,lt,hs,ms,rr=Et.dyn_tree,xu=Et.max_code,wu=Et.stat_desc.static_tree,Ai=Et.stat_desc.has_stree,bu=Et.stat_desc.extra_bits,Di=Et.stat_desc.extra_base,$r=Et.stat_desc.max_length,Xs=0;for(lt=0;lt<=w;lt++)Ue.bl_count[lt]=0;for(rr[2*Ue.heap[Ue.heap_max]+1]=0,nr=Ue.heap_max+1;nr>=7;L>>=1)if(1&Ke&&te.dyn_ltree[2*ge]!==0)return i;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return a;for(ge=32;ge>>3,(Y=k.static_len+3+7>>>3)<=L&&(L=Y)):L=Y=M+5,M+4<=L&&P!==-1?D(k,P,M,K):k.strategy===4||Y===L?(se(k,2+(K?1:0),3),Re(k,G,N)):(se(k,4+(K?1:0),3),function(te,ge,Ke,Ue){var Et;for(se(te,ge-257,5),se(te,Ke-1,5),se(te,Ue-4,4),Et=0;Et>>8&255,k.pending_buf[k.d_buf+2*k.last_lit+1]=255&P,k.pending_buf[k.l_buf+k.last_lit]=255&M,k.last_lit++,P===0?k.dyn_ltree[2*M]++:(k.matches++,P--,k.dyn_ltree[2*(S[M]+f+1)]++,k.dyn_dtree[2*B(P)]++),k.last_lit===k.lit_bufsize-1},s._tr_align=function(k){se(k,2,3),oe(k,b,G),function(P){P.bi_valid===16?(he(P,P.bi_buf),P.bi_buf=0,P.bi_valid=0):8<=P.bi_valid&&(P.pending_buf[P.pending++]=255&P.bi_buf,P.bi_buf>>=8,P.bi_valid-=8)}(k)}},{"../utils/common":41}],53:[function(n,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,h=1,m={},x=!1,p=i.document,w=Object.getPrototypeOf&&Object.getPrototypeOf(i);w=w&&w.setTimeout?w:i,c={}.toString.call(i.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(i.postMessage&&!i.importScripts){var _=!0,C=i.onmessage;return i.onmessage=function(){_=!1},i.postMessage("","*"),i.onmessage=C,_}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",b,!1):i.attachEvent("onmessage",b),function(_){i.postMessage(f+_,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){d.port2.postMessage(_)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(_){var C=p.createElement("script");C.onreadystatechange=function(){v(_),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(_){setTimeout(v,0,_)},w.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var C=new Array(arguments.length-1),j=0;j"u"?o===void 0?this:o:self)}).call(this,typeof ju<"u"?ju:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(gN);var VU=gN.exports;const BU=Vf(VU);function WU(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{r.result?t(r.result.toString()):n("No content found")},r.onerror=()=>n(r.error),r.readAsText(e)})}const HU=async(e,t)=>{const n=new BU;t.forEach(o=>{n.file(o.name,o.content)});const r=await n.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(r),s.download=e,s.click()},Ma=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},YU=e=>Ma(e).split(" ")[0];function yN(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${n}-${r}-${s} ${o}:${i}:${a}`}const KU=async e=>{let t=1;e.page&&(t=e.page);let n=2;e.perPage&&(n=e.perPage);const r=ot();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=r.filter("expiredAt<{:expiredAt}",{expiredAt:yN(15)})),r.collection("domains").getList(t,n,{sort:"-created",expand:"lastDeployment",filter:s})},GU=async()=>{const e=ot(),t=await e.collection("domains").getList(1,1,{}),n=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:yN(15)})}),r=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:n.totalItems,enabled:r.totalItems,disabled:s.totalItems}},ZU=async e=>await ot().collection("domains").getOne(e),pf=async e=>e.id?await ot().collection("domains").update(e.id,e):await ot().collection("domains").create(e),qU=async e=>await ot().collection("domains").delete(e),XU=(e,t)=>ot().collection("domains").subscribe(e,n=>{n.action==="update"&&t(n.record)},{expand:"lastDeployment"}),QU=e=>{ot().collection("domains").unsubscribe(e)},JU=()=>{const e=Fr(),t=er(),{t:n}=Ye(),r=Mr(),s=new URLSearchParams(r.search),o=s.get("page"),i=s.get("state"),[a,c]=g.useState(0),u=()=>{t("/edit")},d=_=>{s.set("page",_.toString()),t(`?${s.toString()}`)},f=_=>{t(`/edit?id=${_}`)},h=_=>{t(`/history?domain=${_}`)},m=async _=>{try{await qU(_),p(x.filter(C=>C.id!==_))}catch(C){console.error("Error deleting domain:",C)}},[x,p]=g.useState([]);g.useEffect(()=>{(async()=>{const C=await KU({page:o?Number(o):1,perPage:10,state:i||""});p(C.items),c(C.totalPages)})()},[o,i]);const w=async _=>{const C=x.filter(A=>A.id===_),j=C[0].enabled,T=C[0];T.enabled=!j,await pf(T);const R=x.map(A=>A.id===_?{...A,checked:!j}:A);p(R)},y=async _=>{try{QU(_.id??""),XU(_.id??"",C=>{console.log(C);const j=x.map(T=>T.id===C.id?{...C}:T);p(j)}),_.rightnow=!0,await pf(_),e.toast({title:n("domain.deploy.started.message"),description:n("domain.deploy.started.tips")})}catch{e.toast({title:n("domain.deploy.failed.message"),description:l.jsxs(fI,{i18nKey:"domain.deploy.failed.tips",children:["text1",l.jsx(bn,{to:`/history?domain=${_.id}`,className:"underline text-blue-500",children:"text2"}),"text3"]}),variant:"destructive"})}},v=async _=>{await y({..._,deployed:!1})},b=async _=>{const C=`${_.id}-${_.domain}.zip`,j=[{name:`${_.domain}.pem`,content:_.certificate?_.certificate:""},{name:`${_.domain}.key`,content:_.privateKey?_.privateKey:""}];await HU(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(Rx,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:n("domain.page.title")}),l.jsx(Me,{onClick:u,children:n("domain.add")})]}),x.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-36",children:n("common.text.domain")}),l.jsx("div",{className:"w-40",children:n("domain.props.expiry")}),l.jsx("div",{className:"w-32",children:n("domain.props.last_execution_status")}),l.jsx("div",{className:"w-64",children:n("domain.props.last_execution_stage")}),l.jsx("div",{className:"w-40 sm:ml-2",children:n("domain.props.last_execution_time")}),l.jsx("div",{className:"w-24",children:n("domain.props.enable")}),l.jsx("div",{className:"grow",children:n("common.text.operations")})]}),x.map(_=>{var C,j,T,R;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-36 w-full pt-1 sm:pt-0 flex items-center truncate",children:_.domain.split(";").map(A=>l.jsxs(l.Fragment,{children:[A,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:_.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:n("domain.props.expiry.date1",{date:90})}),l.jsx("div",{children:n("domain.props.expiry.date2",{date:YU(_.expiredAt)})})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:_.lastDeployedAt&&((C=_.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Sx,{deployment:_.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:_.lastDeployedAt&&((j=_.expand)!=null&&j.lastDeployment)?l.jsx(xx,{phase:(T=_.expand.lastDeployment)==null?void 0:T.phase,phaseSuccess:(R=_.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:_.lastDeployedAt?Ma(_.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(bx,{children:l.jsxs(hE,{children:[l.jsx(mE,{children:l.jsx(pu,{checked:_.enabled,onCheckedChange:()=>{w(_.id??"")}})}),l.jsx(_x,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:_.enabled?n("domain.props.enable.disabled"):n("domain.props.enable.enabled")})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>h(_.id??""),children:n("domain.history")}),l.jsxs(dr,{when:!!_.enabled,children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>y(_),children:n("domain.deploy")})]}),l.jsxs(dr,{when:!!(_.enabled&&_.deployed),children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>v(_),children:n("domain.deploy_forced")})]}),l.jsxs(dr,{when:!!_.expiredAt,children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>b(_),children:n("common.download")})]}),!_.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:n("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{children:n("domain.delete")}),l.jsx(Uh,{children:n("domain.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{children:n("common.cancel")}),l.jsx(Vh,{onClick:()=>{m(_.id??"")},children:n("common.confirm")})]})]})]}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(Me,{variant:"link",className:"p-0",onClick:()=>f(_.id??""),children:n("common.edit")})]})]})]},_.id)}),l.jsx(wE,{totalPages:a,currentPage:o?Number(o):1,onPageChange:_=>{d(_)}})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(mg,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:n("domain.nodata")}),l.jsx(Me,{onClick:u,className:"mt-3",children:n("domain.add")})]})})]})})};var gu=e=>e.type==="checkbox",ua=e=>e instanceof Date,Sn=e=>e==null;const vN=e=>typeof e=="object";var Qt=e=>!Sn(e)&&!Array.isArray(e)&&vN(e)&&!ua(e),xN=e=>Qt(e)&&e.target?gu(e.target)?e.target.checked:e.target.value:e,e8=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wN=(e,t)=>e.has(e8(t)),t8=e=>{const t=e.constructor&&e.constructor.prototype;return Qt(t)&&t.hasOwnProperty("isPrototypeOf")},Ax=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Pn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Ax&&(e instanceof Blob||e instanceof FileList))&&(n||Qt(e)))if(t=n?[]:{},!n&&!t8(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Pn(e[r]));else return e;return t}var Yh=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,de=(e,t,n)=>{if(!t||!Qt(e))return n;const r=Yh(t.split(/[,[\].]+?/)).reduce((s,o)=>Sn(s)?s:s[o],e);return Ft(r)||r===e?Ft(e[t])?n:e[t]:r},Kr=e=>typeof e=="boolean",Dx=e=>/^\w*$/.test(e),bN=e=>Yh(e.replace(/["|']|\]/g,"").split(/\.|\[/)),mt=(e,t,n)=>{let r=-1;const s=Dx(t)?[t]:bN(t),o=s.length,i=o-1;for(;++rWe.useContext(_N),n8=e=>{const{children:t,...n}=e;return We.createElement(_N.Provider,{value:n},t)};var SN=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Sr.all&&(t._proxyFormState[i]=!r||Sr.all),n&&(n[i]=!0),e[i]}});return s},zn=e=>Qt(e)&&!Object.keys(e).length,kN=(e,t,n,r)=>{n(e);const{name:s,...o}=e;return zn(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!r||Sr.all))},ec=e=>Array.isArray(e)?e:[e],CN=(e,t,n)=>!e||!t||e===t||ec(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function Ox(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function r8(e){const t=Kh(),{control:n=t.control,disabled:r,name:s,exact:o}=e||{},[i,a]=We.useState(n._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,Ox({disabled:r,next:f=>c.current&&CN(d.current,f.name,o)&&kN(f,u.current,n._updateFormState)&&a({...n._formState,...f}),subject:n._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),SN(i,n,u.current,!1)}var Zr=e=>typeof e=="string",jN=(e,t,n,r,s)=>Zr(e)?(r&&t.watch.add(e),de(n,e,s)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),de(n,o))):(r&&(t.watchAll=!0),n);function s8(e){const t=Kh(),{control:n=t.control,name:r,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(r);a.current=r,Ox({disabled:o,subject:n._subjects.values,next:d=>{CN(a.current,d.name,i)&&u(Pn(jN(a.current,n._names,d.values||n._formValues,!1,s)))}});const[c,u]=We.useState(n._getWatch(r,s));return We.useEffect(()=>n._removeUnmounted()),c}function o8(e){const t=Kh(),{name:n,disabled:r,control:s=t.control,shouldUnregister:o}=e,i=wN(s._names.array,n),a=s8({control:s,name:n,defaultValue:de(s._formValues,n,de(s._defaultValues,n,e.defaultValue)),exact:!0}),c=r8({control:s,name:n}),u=We.useRef(s.register(n,{...e.rules,value:a,...Kr(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(h,m)=>{const x=de(s._fields,h);x&&x._f&&(x._f.mount=m)};if(f(n,!0),d){const h=Pn(de(s._options.defaultValues,n));mt(s._defaultValues,n,h),Ft(de(s._formValues,n))&&mt(s._formValues,n,h)}return()=>{(i?d&&!s._state.action:d)?s.unregister(n):f(n,!1)}},[n,s,i,o]),We.useEffect(()=>{de(s._fields,n)&&s._updateDisabledField({disabled:r,fields:s._fields,name:n,value:de(s._fields,n)._f.value})},[r,n,s]),{field:{name:n,value:a,...Kr(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:xN(d),name:n},type:gf.CHANGE}),[n]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:de(s._formValues,n),name:n},type:gf.BLUR}),[n,s]),ref:d=>{const f=de(s._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!de(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!de(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!de(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!de(c.validatingFields,n)},error:{enumerable:!0,get:()=>de(c.errors,n)}})}}const i8=e=>e.render(o8(e));var EN=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},Ib=e=>({isOnSubmit:!e||e===Sr.onSubmit,isOnBlur:e===Sr.onBlur,isOnChange:e===Sr.onChange,isOnAll:e===Sr.all,isOnTouch:e===Sr.onTouched}),Mb=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const tc=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const o=de(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;tc(a,t)}else Qt(a)&&tc(a,t)}}};var a8=(e,t,n)=>{const r=ec(de(e,n));return mt(r,"root",t[n]),mt(e,n,r),e},Ix=e=>e.type==="file",mo=e=>typeof e=="function",yf=e=>{if(!Ax)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ed=e=>Zr(e),Mx=e=>e.type==="radio",vf=e=>e instanceof RegExp;const Lb={value:!1,isValid:!1},zb={value:!0,isValid:!0};var NN=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?zb:{value:e[0].value,isValid:!0}:zb:Lb}return Lb};const Fb={isValid:!1,value:null};var TN=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Fb):Fb;function $b(e,t,n="validate"){if(Ed(e)||Array.isArray(e)&&e.every(Ed)||Kr(e)&&!e)return{type:n,message:Ed(e)?e:"",ref:t}}var Bi=e=>Qt(e)&&!vf(e)?e:{value:e,message:""},Ub=async(e,t,n,r,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:m,name:x,valueAsNumber:p,mount:w,disabled:y}=e._f,v=de(t,x);if(!w||y)return{};const b=i?i[0]:o,_=N=>{r&&b.reportValidity&&(b.setCustomValidity(Kr(N)?"":N||""),b.reportValidity())},C={},j=Mx(o),T=gu(o),R=j||T,A=(p||Ix(o))&&Ft(o.value)&&Ft(v)||yf(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,O=EN.bind(null,x,n,C),G=(N,z,S,U=vs.maxLength,J=vs.minLength)=>{const F=N?z:S;C[x]={type:N?U:J,message:F,ref:o,...O(N?U:J,F)}};if(s?!Array.isArray(v)||!v.length:a&&(!R&&(A||Sn(v))||Kr(v)&&!v||T&&!NN(i).isValid||j&&!TN(i).isValid)){const{value:N,message:z}=Ed(a)?{value:!!a,message:a}:Bi(a);if(N&&(C[x]={type:vs.required,message:z,ref:b,...O(vs.required,z)},!n))return _(z),C}if(!A&&(!Sn(d)||!Sn(f))){let N,z;const S=Bi(f),U=Bi(d);if(!Sn(v)&&!isNaN(v)){const J=o.valueAsNumber||v&&+v;Sn(S.value)||(N=J>S.value),Sn(U.value)||(z=Jnew Date(new Date().toDateString()+" "+X),W=o.type=="time",I=o.type=="week";Zr(S.value)&&v&&(N=W?F(v)>F(S.value):I?v>S.value:J>new Date(S.value)),Zr(U.value)&&v&&(z=W?F(v)+N.value,U=!Sn(z.value)&&v.length<+z.value;if((S||U)&&(G(S,N.message,z.message),!n))return _(C[x].message),C}if(h&&!A&&Zr(v)){const{value:N,message:z}=Bi(h);if(vf(N)&&!v.match(N)&&(C[x]={type:vs.pattern,message:z,ref:o,...O(vs.pattern,z)},!n))return _(z),C}if(m){if(mo(m)){const N=await m(v,t),z=$b(N,b);if(z&&(C[x]={...z,...O(vs.validate,z.message)},!n))return _(z.message),C}else if(Qt(m)){let N={};for(const z in m){if(!zn(N)&&!n)break;const S=$b(await m[z](v,t),b,z);S&&(N={...S,...O(z,S.message)},_(S.message),n&&(C[x]=N))}if(!zn(N)&&(C[x]={ref:b,...N},!n))return C}}return _(!0),C};function l8(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},xf=e=>Sn(e)||!vN(e);function Qo(e,t){if(xf(e)||xf(t))return e===t;if(ua(e)&&ua(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const o=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const i=t[s];if(ua(o)&&ua(i)||Qt(o)&&Qt(i)||Array.isArray(o)&&Array.isArray(i)?!Qo(o,i):o!==i)return!1}}return!0}var PN=e=>e.type==="select-multiple",u8=e=>Mx(e)||gu(e),lp=e=>yf(e)&&e.isConnected,RN=e=>{for(const t in e)if(mo(e[t]))return!0;return!1};function wf(e,t={}){const n=Array.isArray(e);if(Qt(e)||n)for(const r in e)Array.isArray(e[r])||Qt(e[r])&&!RN(e[r])?(t[r]=Array.isArray(e[r])?[]:{},wf(e[r],t[r])):Sn(e[r])||(t[r]=!0);return t}function AN(e,t,n){const r=Array.isArray(e);if(Qt(e)||r)for(const s in e)Array.isArray(e[s])||Qt(e[s])&&!RN(e[s])?Ft(t)||xf(n[s])?n[s]=Array.isArray(e[s])?wf(e[s],[]):{...wf(e[s])}:AN(e[s],Sn(t)?{}:t[s],n[s]):n[s]=!Qo(e[s],t[s]);return n}var rd=(e,t)=>AN(e,t,wf(t)),DN=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ft(e)?e:t?e===""?NaN:e&&+e:n&&Zr(e)?new Date(e):r?r(e):e;function cp(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Ix(t)?t.files:Mx(t)?TN(e.refs).value:PN(t)?[...t.selectedOptions].map(({value:n})=>n):gu(t)?NN(e.refs).value:DN(Ft(t.value)?e.ref.value:t.value,e)}var d8=(e,t,n,r)=>{const s={};for(const o of e){const i=de(t,o);i&&mt(s,o,i._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},El=e=>Ft(e)?e:vf(e)?e.source:Qt(e)?vf(e.value)?e.value.source:e.value:e,f8=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Vb(e,t,n){const r=de(e,n);if(r||Dx(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const o=s.join("."),i=de(t,o),a=de(e,o);if(i&&!Array.isArray(i)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:n}}var h8=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,m8=(e,t)=>!Yh(de(e,t)).length&&Gt(e,t);const p8={mode:Sr.onSubmit,reValidateMode:Sr.onChange,shouldFocusError:!0};function g8(e={}){let t={...p8,...e},n={submitCount:0,isDirty:!1,isLoading:mo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=Qt(t.defaultValues)||Qt(t.values)?Pn(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Pn(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:ap(),array:ap(),state:ap()},h=Ib(t.mode),m=Ib(t.reValidateMode),x=t.criteriaMode===Sr.all,p=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},w=async k=>{if(d.isValid||k){const P=t.resolver?zn((await R()).errors):await O(r,!0);P!==n.isValid&&f.state.next({isValid:P})}},y=(k,P)=>{(d.isValidating||d.validatingFields)&&((k||Array.from(a.mount)).forEach(M=>{M&&(P?mt(n.validatingFields,M,P):Gt(n.validatingFields,M))}),f.state.next({validatingFields:n.validatingFields,isValidating:!zn(n.validatingFields)}))},v=(k,P=[],M,K,L=!0,Y=!0)=>{if(K&&M){if(i.action=!0,Y&&Array.isArray(de(r,k))){const Q=M(de(r,k),K.argA,K.argB);L&&mt(r,k,Q)}if(Y&&Array.isArray(de(n.errors,k))){const Q=M(de(n.errors,k),K.argA,K.argB);L&&mt(n.errors,k,Q),m8(n.errors,k)}if(d.touchedFields&&Y&&Array.isArray(de(n.touchedFields,k))){const Q=M(de(n.touchedFields,k),K.argA,K.argB);L&&mt(n.touchedFields,k,Q)}d.dirtyFields&&(n.dirtyFields=rd(s,o)),f.state.next({name:k,isDirty:N(k,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mt(o,k,P)},b=(k,P)=>{mt(n.errors,k,P),f.state.next({errors:n.errors})},_=k=>{n.errors=k,f.state.next({errors:n.errors,isValid:!1})},C=(k,P,M,K)=>{const L=de(r,k);if(L){const Y=de(o,k,Ft(M)?de(s,k):M);Ft(Y)||K&&K.defaultChecked||P?mt(o,k,P?Y:cp(L._f)):U(k,Y),i.mount&&w()}},j=(k,P,M,K,L)=>{let Y=!1,Q=!1;const te={name:k},ge=!!(de(r,k)&&de(r,k)._f&&de(r,k)._f.disabled);if(!M||K){d.isDirty&&(Q=n.isDirty,n.isDirty=te.isDirty=N(),Y=Q!==te.isDirty);const Ke=ge||Qo(de(s,k),P);Q=!!(!ge&&de(n.dirtyFields,k)),Ke||ge?Gt(n.dirtyFields,k):mt(n.dirtyFields,k,!0),te.dirtyFields=n.dirtyFields,Y=Y||d.dirtyFields&&Q!==!Ke}if(M){const Ke=de(n.touchedFields,k);Ke||(mt(n.touchedFields,k,M),te.touchedFields=n.touchedFields,Y=Y||d.touchedFields&&Ke!==M)}return Y&&L&&f.state.next(te),Y?te:{}},T=(k,P,M,K)=>{const L=de(n.errors,k),Y=d.isValid&&Kr(P)&&n.isValid!==P;if(e.delayError&&M?(c=p(()=>b(k,M)),c(e.delayError)):(clearTimeout(u),c=null,M?mt(n.errors,k,M):Gt(n.errors,k)),(M?!Qo(L,M):L)||!zn(K)||Y){const Q={...K,...Y&&Kr(P)?{isValid:P}:{},errors:n.errors,name:k};n={...n,...Q},f.state.next(Q)}},R=async k=>{y(k,!0);const P=await t.resolver(o,t.context,d8(k||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return y(k),P},A=async k=>{const{errors:P}=await R(k);if(k)for(const M of k){const K=de(P,M);K?mt(n.errors,M,K):Gt(n.errors,M)}else n.errors=P;return P},O=async(k,P,M={valid:!0})=>{for(const K in k){const L=k[K];if(L){const{_f:Y,...Q}=L;if(Y){const te=a.array.has(Y.name);y([K],!0);const ge=await Ub(L,o,x,t.shouldUseNativeValidation&&!P,te);if(y([K]),ge[Y.name]&&(M.valid=!1,P))break;!P&&(de(ge,Y.name)?te?a8(n.errors,ge,Y.name):mt(n.errors,Y.name,ge[Y.name]):Gt(n.errors,Y.name))}Q&&await O(Q,P,M)}}return M.valid},G=()=>{for(const k of a.unMount){const P=de(r,k);P&&(P._f.refs?P._f.refs.every(M=>!lp(M)):!lp(P._f.ref))&&Oe(k)}a.unMount=new Set},N=(k,P)=>(k&&P&&mt(o,k,P),!Qo($(),s)),z=(k,P,M)=>jN(k,a,{...i.mount?o:Ft(P)?s:Zr(k)?{[k]:P}:P},M,P),S=k=>Yh(de(i.mount?o:s,k,e.shouldUnregister?de(s,k,[]):[])),U=(k,P,M={})=>{const K=de(r,k);let L=P;if(K){const Y=K._f;Y&&(!Y.disabled&&mt(o,k,DN(P,Y)),L=yf(Y.ref)&&Sn(P)?"":P,PN(Y.ref)?[...Y.ref.options].forEach(Q=>Q.selected=L.includes(Q.value)):Y.refs?gu(Y.ref)?Y.refs.length>1?Y.refs.forEach(Q=>(!Q.defaultChecked||!Q.disabled)&&(Q.checked=Array.isArray(L)?!!L.find(te=>te===Q.value):L===Q.value)):Y.refs[0]&&(Y.refs[0].checked=!!L):Y.refs.forEach(Q=>Q.checked=Q.value===L):Ix(Y.ref)?Y.ref.value="":(Y.ref.value=L,Y.ref.type||f.values.next({name:k,values:{...o}})))}(M.shouldDirty||M.shouldTouch)&&j(k,L,M.shouldTouch,M.shouldDirty,!0),M.shouldValidate&&X(k)},J=(k,P,M)=>{for(const K in P){const L=P[K],Y=`${k}.${K}`,Q=de(r,Y);(a.array.has(k)||!xf(L)||Q&&!Q._f)&&!ua(L)?J(Y,L,M):U(Y,L,M)}},F=(k,P,M={})=>{const K=de(r,k),L=a.array.has(k),Y=Pn(P);mt(o,k,Y),L?(f.array.next({name:k,values:{...o}}),(d.isDirty||d.dirtyFields)&&M.shouldDirty&&f.state.next({name:k,dirtyFields:rd(s,o),isDirty:N(k,Y)})):K&&!K._f&&!Sn(Y)?J(k,Y,M):U(k,Y,M),Mb(k,a)&&f.state.next({...n}),f.values.next({name:i.mount?k:void 0,values:{...o}})},W=async k=>{i.mount=!0;const P=k.target;let M=P.name,K=!0;const L=de(r,M),Y=()=>P.type?cp(L._f):xN(k),Q=te=>{K=Number.isNaN(te)||te===de(o,M,te)};if(L){let te,ge;const Ke=Y(),Ue=k.type===gf.BLUR||k.type===gf.FOCUS_OUT,Et=!f8(L._f)&&!t.resolver&&!de(n.errors,M)&&!L._f.deps||h8(Ue,de(n.touchedFields,M),n.isSubmitted,m,h),nr=Mb(M,a,Ue);mt(o,M,Ke),Ue?(L._f.onBlur&&L._f.onBlur(k),c&&c(0)):L._f.onChange&&L._f.onChange(k);const Kt=j(M,Ke,Ue,!1),fs=!zn(Kt)||nr;if(!Ue&&f.values.next({name:M,type:k.type,values:{...o}}),Et)return d.isValid&&w(),fs&&f.state.next({name:M,...nr?{}:Kt});if(!Ue&&nr&&f.state.next({...n}),t.resolver){const{errors:lt}=await R([M]);if(Q(Ke),K){const hs=Vb(n.errors,r,M),ms=Vb(lt,r,hs.name||M);te=ms.error,M=ms.name,ge=zn(lt)}}else y([M],!0),te=(await Ub(L,o,x,t.shouldUseNativeValidation))[M],y([M]),Q(Ke),K&&(te?ge=!1:d.isValid&&(ge=await O(r,!0)));K&&(L._f.deps&&X(L._f.deps),T(M,ge,te,Kt))}},I=(k,P)=>{if(de(n.errors,P)&&k.focus)return k.focus(),1},X=async(k,P={})=>{let M,K;const L=ec(k);if(t.resolver){const Y=await A(Ft(k)?k:L);M=zn(Y),K=k?!L.some(Q=>de(Y,Q)):M}else k?(K=(await Promise.all(L.map(async Y=>{const Q=de(r,Y);return await O(Q&&Q._f?{[Y]:Q}:Q)}))).every(Boolean),!(!K&&!n.isValid)&&w()):K=M=await O(r);return f.state.next({...!Zr(k)||d.isValid&&M!==n.isValid?{}:{name:k},...t.resolver||!k?{isValid:M}:{},errors:n.errors}),P.shouldFocus&&!K&&tc(r,I,k?L:a.mount),K},$=k=>{const P={...i.mount?o:s};return Ft(k)?P:Zr(k)?de(P,k):k.map(M=>de(P,M))},B=(k,P)=>({invalid:!!de((P||n).errors,k),isDirty:!!de((P||n).dirtyFields,k),error:de((P||n).errors,k),isValidating:!!de(n.validatingFields,k),isTouched:!!de((P||n).touchedFields,k)}),he=k=>{k&&ec(k).forEach(P=>Gt(n.errors,P)),f.state.next({errors:k?n.errors:{}})},se=(k,P,M)=>{const K=(de(r,k,{_f:{}})._f||{}).ref,L=de(n.errors,k)||{},{ref:Y,message:Q,type:te,...ge}=L;mt(n.errors,k,{...ge,...P,ref:K}),f.state.next({name:k,errors:n.errors,isValid:!1}),M&&M.shouldFocus&&K&&K.focus&&K.focus()},oe=(k,P)=>mo(k)?f.values.subscribe({next:M=>k(z(void 0,P),M)}):z(k,P,!0),Oe=(k,P={})=>{for(const M of k?ec(k):a.mount)a.mount.delete(M),a.array.delete(M),P.keepValue||(Gt(r,M),Gt(o,M)),!P.keepError&&Gt(n.errors,M),!P.keepDirty&&Gt(n.dirtyFields,M),!P.keepTouched&&Gt(n.touchedFields,M),!P.keepIsValidating&&Gt(n.validatingFields,M),!t.shouldUnregister&&!P.keepDefaultValue&&Gt(s,M);f.values.next({values:{...o}}),f.state.next({...n,...P.keepDirty?{isDirty:N()}:{}}),!P.keepIsValid&&w()},me=({disabled:k,name:P,field:M,fields:K,value:L})=>{if(Kr(k)&&i.mount||k){const Y=k?void 0:Ft(L)?cp(M?M._f:de(K,P)._f):L;mt(o,P,Y),j(P,Y,!1,!1,!0)}},we=(k,P={})=>{let M=de(r,k);const K=Kr(P.disabled);return mt(r,k,{...M||{},_f:{...M&&M._f?M._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),M?me({field:M,disabled:P.disabled,name:k,value:P.value}):C(k,!0,P.value),{...K?{disabled:P.disabled}:{},...t.progressive?{required:!!P.required,min:El(P.min),max:El(P.max),minLength:El(P.minLength),maxLength:El(P.maxLength),pattern:El(P.pattern)}:{},name:k,onChange:W,onBlur:W,ref:L=>{if(L){we(k,P),M=de(r,k);const Y=Ft(L.value)&&L.querySelectorAll&&L.querySelectorAll("input,select,textarea")[0]||L,Q=u8(Y),te=M._f.refs||[];if(Q?te.find(ge=>ge===Y):Y===M._f.ref)return;mt(r,k,{_f:{...M._f,...Q?{refs:[...te.filter(lp),Y,...Array.isArray(de(s,k))?[{}]:[]],ref:{type:Y.type,name:k}}:{ref:Y}}}),C(k,!1,void 0,Y)}else M=de(r,k,{}),M._f&&(M._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(wN(a.array,k)&&i.action)&&a.unMount.add(k)}}},Te=()=>t.shouldFocusError&&tc(r,I,a.mount),Fe=k=>{Kr(k)&&(f.state.next({disabled:k}),tc(r,(P,M)=>{const K=de(r,M);K&&(P.disabled=K._f.disabled||k,Array.isArray(K._f.refs)&&K._f.refs.forEach(L=>{L.disabled=K._f.disabled||k}))},0,!1))},Ie=(k,P)=>async M=>{let K;M&&(M.preventDefault&&M.preventDefault(),M.persist&&M.persist());let L=Pn(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Y,values:Q}=await R();n.errors=Y,L=Q}else await O(r);if(Gt(n.errors,"root"),zn(n.errors)){f.state.next({errors:{}});try{await k(L,M)}catch(Y){K=Y}}else P&&await P({...n.errors},M),Te(),setTimeout(Te);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:zn(n.errors)&&!K,submitCount:n.submitCount+1,errors:n.errors}),K)throw K},Re=(k,P={})=>{de(r,k)&&(Ft(P.defaultValue)?F(k,Pn(de(s,k))):(F(k,P.defaultValue),mt(s,k,Pn(P.defaultValue))),P.keepTouched||Gt(n.touchedFields,k),P.keepDirty||(Gt(n.dirtyFields,k),n.isDirty=P.defaultValue?N(k,Pn(de(s,k))):N()),P.keepError||(Gt(n.errors,k),d.isValid&&w()),f.state.next({...n}))},st=(k,P={})=>{const M=k?Pn(k):s,K=Pn(M),L=zn(k),Y=L?s:K;if(P.keepDefaultValues||(s=M),!P.keepValues){if(P.keepDirtyValues)for(const Q of a.mount)de(n.dirtyFields,Q)?mt(Y,Q,de(o,Q)):F(Q,de(Y,Q));else{if(Ax&&Ft(k))for(const Q of a.mount){const te=de(r,Q);if(te&&te._f){const ge=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(yf(ge)){const Ke=ge.closest("form");if(Ke){Ke.reset();break}}}}r={}}o=e.shouldUnregister?P.keepDefaultValues?Pn(s):{}:Pn(Y),f.array.next({values:{...Y}}),f.values.next({values:{...Y}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:L?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Qo(k,s)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:L?{}:P.keepDirtyValues?P.keepDefaultValues&&o?rd(s,o):n.dirtyFields:P.keepDefaultValues&&k?rd(s,k):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},E=(k,P)=>st(mo(k)?k(o):k,P);return{control:{register:we,unregister:Oe,getFieldState:B,handleSubmit:Ie,setError:se,_executeSchema:R,_getWatch:z,_getDirty:N,_updateValid:w,_removeUnmounted:G,_updateFieldArray:v,_updateDisabledField:me,_getFieldArray:S,_reset:st,_resetDefaultValues:()=>mo(t.defaultValues)&&t.defaultValues().then(k=>{E(k,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:k=>{n={...n,...k}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:_,get _fields(){return r},get _formValues(){return o},get _state(){return i},set _state(k){i=k},get _defaultValues(){return s},get _names(){return a},set _names(k){a=k},get _formState(){return n},set _formState(k){n=k},get _options(){return t},set _options(k){t={...t,...k}}},trigger:X,register:we,handleSubmit:Ie,watch:oe,setValue:F,getValues:$,reset:E,resetField:Re,clearErrors:he,unregister:Oe,setError:se,setFocus:(k,P={})=>{const M=de(r,k),K=M&&M._f;if(K){const L=K.refs?K.refs[0]:K.ref;L.focus&&(L.focus(),P.shouldSelect&&L.select())}},getFieldState:B}}function un(e={}){const t=We.useRef(),n=We.useRef(),[r,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:mo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:mo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...g8(e),formState:r});const o=t.current.control;return o._options=e,Ox({subject:o._subjects.state,next:i=>{kN(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==r.isDirty&&o._subjects.state.next({isDirty:i})}},[o,r.isDirty]),We.useEffect(()=>{e.values&&!Qo(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=SN(r,o),t.current}const Bb=(e,t,n)=>{if(e&&"reportValidity"in e){const r=de(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},ON=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Bb(r.ref,n,e):r.refs&&r.refs.forEach(s=>Bb(s,n,e))}},y8=(e,t)=>{t.shouldUseNativeValidation&&ON(e,t);const n={};for(const r in e){const s=de(t.fields,r),o=Object.assign(e[r]||{},{ref:s&&s.ref});if(v8(t.names||Object.keys(e),r)){const i=Object.assign({},de(n,r));mt(i,"root",o),mt(n,r,i)}else mt(n,r,o)}return n},v8=(e,t)=>e.some(n=>n.startsWith(t+"."));var x8=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[i].types,u=c&&c[r.code];n[i]=EN(i,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},dn=function(e,t,n){return n===void 0&&(n={}),function(r,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return o.shouldUseNativeValidation&&ON({},o),{errors:{},values:n.raw?r:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:y8(x8(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},it;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(it||(it={}));var Lg;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lg||(Lg={}));const _e=it.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lo=e=>{switch(typeof e){case"undefined":return _e.undefined;case"string":return _e.string;case"number":return isNaN(e)?_e.nan:_e.number;case"boolean":return _e.boolean;case"function":return _e.function;case"bigint":return _e.bigint;case"symbol":return _e.symbol;case"object":return Array.isArray(e)?_e.array:e===null?_e.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_e.promise:typeof Map<"u"&&e instanceof Map?_e.map:typeof Set<"u"&&e instanceof Set?_e.set:typeof Date<"u"&&e instanceof Date?_e.date:_e.object;default:return _e.unknown}},ae=it.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),w8=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Kn extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Kn.create=e=>new Kn(e);const La=(e,t)=>{let n;switch(e.code){case ae.invalid_type:e.received===_e.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ae.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,it.jsonStringifyReplacer)}`;break;case ae.unrecognized_keys:n=`Unrecognized key(s) in object: ${it.joinValues(e.keys,", ")}`;break;case ae.invalid_union:n="Invalid input";break;case ae.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${it.joinValues(e.options)}`;break;case ae.invalid_enum_value:n=`Invalid enum value. Expected ${it.joinValues(e.options)}, received '${e.received}'`;break;case ae.invalid_arguments:n="Invalid function arguments";break;case ae.invalid_return_type:n="Invalid function return type";break;case ae.invalid_date:n="Invalid date";break;case ae.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:it.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ae.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ae.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ae.custom:n="Invalid input";break;case ae.invalid_intersection_types:n="Intersection results could not be merged";break;case ae.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ae.not_finite:n="Number must be finite";break;default:n=t.defaultError,it.assertNever(e)}return{message:n}};let IN=La;function b8(e){IN=e}function bf(){return IN}const _f=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},_8=[];function ve(e,t){const n=bf(),r=_f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===La?void 0:La].filter(s=>!!s)});e.common.issues.push(r)}class vn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return He;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,i=await s.value;r.push({key:o,value:i})}return vn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return He;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const He=Object.freeze({status:"aborted"}),da=e=>({status:"dirty",value:e}),Cn=e=>({status:"valid",value:e}),zg=e=>e.status==="aborted",Fg=e=>e.status==="dirty",Rc=e=>e.status==="valid",Ac=e=>typeof Promise<"u"&&e instanceof Promise;function Sf(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function MN(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var Ll,zl;class ss{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wb=(e,t)=>{if(Rc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Kn(e.common.issues);return this._error=n,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:a.defaultError}},description:s}}class et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return lo(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:lo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new vn,ctx:{common:t.parent.common,data:t.data,parsedType:lo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ac(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lo(t)},o=this._parseSync({data:t,path:s.path,parent:s});return Wb(s,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lo(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(Ac(s)?s:Promise.resolve(s));return Wb(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ae.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ir({schema:this,typeName:Ve.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return es.create(this,this._def)}nullable(){return Ao.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Tr.create(this,this._def)}promise(){return Fa.create(this,this._def)}or(t){return Mc.create([this,t],this._def)}and(t){return Lc.create(this,t,this._def)}transform(t){return new Ir({...Ze(this._def),schema:this,typeName:Ve.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vc({...Ze(this._def),innerType:this,defaultValue:n,typeName:Ve.ZodDefault})}brand(){return new Lx({typeName:Ve.ZodBranded,type:this,...Ze(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Bc({...Ze(this._def),innerType:this,catchValue:n,typeName:Ve.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return yu.create(this,t)}readonly(){return Wc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const S8=/^c[^\s-]{8,}$/i,k8=/^[0-9a-z]+$/,C8=/^[0-9A-HJKMNP-TV-Z]{26}$/,j8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,E8=/^[a-z0-9_-]{21}$/i,N8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,T8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let up;const R8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,A8=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,D8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LN="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",O8=new RegExp(`^${LN}$`);function zN(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function I8(e){return new RegExp(`^${zN(e)}$`)}function FN(e){let t=`${LN}T${zN(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function M8(e,t){return!!((t==="v4"||!t)&&R8.test(e)||(t==="v6"||!t)&&A8.test(e))}class jr extends et{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_e.string){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.string,received:o.parsedType}),He}const r=new vn;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:ae.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:n,code:ae.invalid_string,...De.errToObj(r)})}_addCheck(t){return new jr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...De.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...De.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...De.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...De.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...De.errToObj(n)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new jr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new jr({checks:[],typeName:Ve.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function L8(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class To extends et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_e.number){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.number,received:o.parsedType}),He}let r;const s=new vn;for(const o of this._def.checks)o.kind==="int"?it.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?L8(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_finite,message:o.message}),s.dirty()):it.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,s){return new To({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(s)}]})}_addCheck(t){return new To({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&it.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew To({checks:[],typeName:Ve.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class Po extends et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==_e.bigint){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.bigint,received:o.parsedType}),He}let r;const s=new vn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:ae.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):it.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,s){return new Po({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(s)}]})}_addCheck(t){return new Po({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Po({checks:[],typeName:Ve.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class Dc extends et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_e.boolean){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.boolean,received:r.parsedType}),He}return Cn(t.data)}}Dc.create=e=>new Dc({typeName:Ve.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class pi extends et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_e.date){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_type,expected:_e.date,received:o.parsedType}),He}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ve(o,{code:ae.invalid_date}),He}const r=new vn;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:ae.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):it.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new pi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew pi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ve.ZodDate,...Ze(e)});class kf extends et{_parse(t){if(this._getType(t)!==_e.symbol){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.symbol,received:r.parsedType}),He}return Cn(t.data)}}kf.create=e=>new kf({typeName:Ve.ZodSymbol,...Ze(e)});class Oc extends et{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.undefined,received:r.parsedType}),He}return Cn(t.data)}}Oc.create=e=>new Oc({typeName:Ve.ZodUndefined,...Ze(e)});class Ic extends et{_parse(t){if(this._getType(t)!==_e.null){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.null,received:r.parsedType}),He}return Cn(t.data)}}Ic.create=e=>new Ic({typeName:Ve.ZodNull,...Ze(e)});class za extends et{constructor(){super(...arguments),this._any=!0}_parse(t){return Cn(t.data)}}za.create=e=>new za({typeName:Ve.ZodAny,...Ze(e)});class si extends et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Cn(t.data)}}si.create=e=>new si({typeName:Ve.ZodUnknown,...Ze(e)});class $s extends et{_parse(t){const n=this._getOrReturnCtx(t);return ve(n,{code:ae.invalid_type,expected:_e.never,received:n.parsedType}),He}}$s.create=e=>new $s({typeName:Ve.ZodNever,...Ze(e)});class Cf extends et{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.void,received:r.parsedType}),He}return Cn(t.data)}}Cf.create=e=>new Cf({typeName:Ve.ZodVoid,...Ze(e)});class Tr extends et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==_e.array)return ve(n,{code:ae.invalid_type,expected:_e.array,received:n.parsedType}),He;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,a=n.data.lengths.maxLength.value&&(ve(n,{code:ae.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new ss(n,i,n.path,a)))).then(i=>vn.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new ss(n,i,n.path,a)));return vn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Tr({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new Tr({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new Tr({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(t){return this.min(1,t)}}Tr.create=(e,t)=>new Tr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ve.ZodArray,...Ze(t)});function Ki(e){if(e instanceof Rt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=es.create(Ki(r))}return new Rt({...e._def,shape:()=>t})}else return e instanceof Tr?new Tr({...e._def,type:Ki(e.element)}):e instanceof es?es.create(Ki(e.unwrap())):e instanceof Ao?Ao.create(Ki(e.unwrap())):e instanceof os?os.create(e.items.map(t=>Ki(t))):e}class Rt extends et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=it.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==_e.object){const u=this._getOrReturnCtx(t);return ve(u,{code:ae.invalid_type,expected:_e.object,received:u.parsedType}),He}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof $s&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ss(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof $s){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ve(s,{code:ae.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ss(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>vn.mergeObjectSync(r,u)):vn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ve.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const n={};return it.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}omit(t){const n={};return it.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}deepPartial(){return Ki(this)}partial(t){const n={};return it.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new Rt({...this._def,shape:()=>n})}required(t){const n={};return it.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof es;)o=o._def.innerType;n[r]=o}}),new Rt({...this._def,shape:()=>n})}keyof(){return $N(it.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:$s.create(),typeName:Ve.ZodObject,...Ze(t)});class Mc extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Kn(a.ctx.common.issues));return ve(n,{code:ae.invalid_union,unionErrors:i}),He}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Kn(c));return ve(n,{code:ae.invalid_union,unionErrors:a}),He}}get options(){return this._def.options}}Mc.create=(e,t)=>new Mc({options:e,typeName:Ve.ZodUnion,...Ze(t)});const xs=e=>e instanceof Fc?xs(e.schema):e instanceof Ir?xs(e.innerType()):e instanceof $c?[e.value]:e instanceof Ro?e.options:e instanceof Uc?it.objectValues(e.enum):e instanceof Vc?xs(e._def.innerType):e instanceof Oc?[void 0]:e instanceof Ic?[null]:e instanceof es?[void 0,...xs(e.unwrap())]:e instanceof Ao?[null,...xs(e.unwrap())]:e instanceof Lx||e instanceof Wc?xs(e.unwrap()):e instanceof Bc?xs(e._def.innerType):[];class Gh extends et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.object)return ve(n,{code:ae.invalid_type,expected:_e.object,received:n.parsedType}),He;const r=this.discriminator,s=n.data[r],o=this.optionsMap.get(s);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ve(n,{code:ae.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),He)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const o of n){const i=xs(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new Gh({typeName:Ve.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...Ze(r)})}}function $g(e,t){const n=lo(e),r=lo(t);if(e===t)return{valid:!0,data:e};if(n===_e.object&&r===_e.object){const s=it.objectKeys(t),o=it.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=$g(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===_e.array&&r===_e.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(zg(o)||zg(i))return He;const a=$g(o.value,i.value);return a.valid?((Fg(o)||Fg(i))&&n.dirty(),{status:n.value,value:a.data}):(ve(r,{code:ae.invalid_intersection_types}),He)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Lc.create=(e,t,n)=>new Lc({left:e,right:t,typeName:Ve.ZodIntersection,...Ze(n)});class os extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.array)return ve(r,{code:ae.invalid_type,expected:_e.array,received:r.parsedType}),He;if(r.data.lengththis._def.items.length&&(ve(r,{code:ae.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ss(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>vn.mergeArray(n,i)):vn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new os({...this._def,rest:t})}}os.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new os({items:e,typeName:Ve.ZodTuple,rest:null,...Ze(t)})};class zc extends et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.object)return ve(r,{code:ae.invalid_type,expected:_e.object,received:r.parsedType}),He;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in r.data)s.push({key:o._parse(new ss(r,a,r.path,a)),value:i._parse(new ss(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?vn.mergeObjectAsync(n,s):vn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof et?new zc({keyType:t,valueType:n,typeName:Ve.ZodRecord,...Ze(r)}):new zc({keyType:jr.create(),valueType:t,typeName:Ve.ZodRecord,...Ze(n)})}}class jf extends et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.map)return ve(r,{code:ae.invalid_type,expected:_e.map,received:r.parsedType}),He;const s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:s._parse(new ss(r,a,r.path,[u,"key"])),value:o._parse(new ss(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return He;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return He;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}jf.create=(e,t,n)=>new jf({valueType:t,keyType:e,typeName:Ve.ZodMap,...Ze(n)});class gi extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.set)return ve(r,{code:ae.invalid_type,expected:_e.set,received:r.parsedType}),He;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(ve(r,{code:ae.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return He;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>o._parse(new ss(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new gi({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new gi({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}gi.create=(e,t)=>new gi({valueType:e,minSize:null,maxSize:null,typeName:Ve.ZodSet,...Ze(t)});class ja extends et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.function)return ve(n,{code:ae.invalid_type,expected:_e.function,received:n.parsedType}),He;function r(a,c){return _f({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bf(),La].filter(u=>!!u),issueData:{code:ae.invalid_arguments,argumentsError:c}})}function s(a,c){return _f({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bf(),La].filter(u=>!!u),issueData:{code:ae.invalid_return_type,returnTypeError:c}})}const o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Fa){const a=this;return Cn(async function(...c){const u=new Kn([]),d=await a._def.args.parseAsync(c,o).catch(m=>{throw u.addIssue(r(c,m)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(m=>{throw u.addIssue(s(f,m)),u})})}else{const a=this;return Cn(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Kn([r(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Kn([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ja({...this._def,args:os.create(t).rest(si.create())})}returns(t){return new ja({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new ja({args:t||os.create([]).rest(si.create()),returns:n||si.create(),typeName:Ve.ZodFunction,...Ze(r)})}}class Fc extends et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Fc.create=(e,t)=>new Fc({getter:e,typeName:Ve.ZodLazy,...Ze(t)});class $c extends et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ve(n,{received:n.data,code:ae.invalid_literal,expected:this._def.value}),He}return{status:"valid",value:t.data}}get value(){return this._def.value}}$c.create=(e,t)=>new $c({value:e,typeName:Ve.ZodLiteral,...Ze(t)});function $N(e,t){return new Ro({values:e,typeName:Ve.ZodEnum,...Ze(t)})}class Ro extends et{constructor(){super(...arguments),Ll.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{expected:it.joinValues(r),received:n.parsedType,code:ae.invalid_type}),He}if(Sf(this,Ll)||MN(this,Ll,new Set(this._def.values)),!Sf(this,Ll).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{received:n.data,code:ae.invalid_enum_value,options:r}),He}return Cn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ro.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ro.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ll=new WeakMap;Ro.create=$N;class Uc extends et{constructor(){super(...arguments),zl.set(this,void 0)}_parse(t){const n=it.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_e.string&&r.parsedType!==_e.number){const s=it.objectValues(n);return ve(r,{expected:it.joinValues(s),received:r.parsedType,code:ae.invalid_type}),He}if(Sf(this,zl)||MN(this,zl,new Set(it.getValidEnumValues(this._def.values))),!Sf(this,zl).has(t.data)){const s=it.objectValues(n);return ve(r,{received:r.data,code:ae.invalid_enum_value,options:s}),He}return Cn(t.data)}get enum(){return this._def.values}}zl=new WeakMap;Uc.create=(e,t)=>new Uc({values:e,typeName:Ve.ZodNativeEnum,...Ze(t)});class Fa extends et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.promise&&n.common.async===!1)return ve(n,{code:ae.invalid_type,expected:_e.promise,received:n.parsedType}),He;const r=n.parsedType===_e.promise?n.data:Promise.resolve(n.data);return Cn(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Fa.create=(e,t)=>new Fa({type:e,typeName:Ve.ZodPromise,...Ze(t)});class Ir extends et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ve(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return He;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?He:c.status==="dirty"||n.value==="dirty"?da(c.value):c});{if(n.value==="aborted")return He;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?He:a.status==="dirty"||n.value==="dirty"?da(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?He:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?He:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Rc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):i);it.assertNever(s)}}Ir.create=(e,t,n)=>new Ir({schema:e,typeName:Ve.ZodEffects,effect:t,...Ze(n)});Ir.createWithPreprocess=(e,t,n)=>new Ir({schema:t,effect:{type:"preprocess",transform:e},typeName:Ve.ZodEffects,...Ze(n)});class es extends et{_parse(t){return this._getType(t)===_e.undefined?Cn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}es.create=(e,t)=>new es({innerType:e,typeName:Ve.ZodOptional,...Ze(t)});class Ao extends et{_parse(t){return this._getType(t)===_e.null?Cn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ao.create=(e,t)=>new Ao({innerType:e,typeName:Ve.ZodNullable,...Ze(t)});class Vc extends et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===_e.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vc.create=(e,t)=>new Vc({innerType:e,typeName:Ve.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class Bc extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ac(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Bc.create=(e,t)=>new Bc({innerType:e,typeName:Ve.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Ef extends et{_parse(t){if(this._getType(t)!==_e.nan){const r=this._getOrReturnCtx(t);return ve(r,{code:ae.invalid_type,expected:_e.nan,received:r.parsedType}),He}return{status:"valid",value:t.data}}}Ef.create=e=>new Ef({typeName:Ve.ZodNaN,...Ze(e)});const z8=Symbol("zod_brand");class Lx extends et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class yu extends et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?He:o.status==="dirty"?(n.dirty(),da(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?He:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new yu({in:t,out:n,typeName:Ve.ZodPipeline})}}class Wc extends et{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Rc(s)&&(s.value=Object.freeze(s.value)),s);return Ac(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Wc.create=(e,t)=>new Wc({innerType:e,typeName:Ve.ZodReadonly,...Ze(t)});function UN(e,t={},n){return e?za.create().superRefine((r,s)=>{var o,i;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):za.create()}const F8={object:Rt.lazycreate};var Ve;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ve||(Ve={}));const $8=(e,t={message:`Input not instance of ${e.name}`})=>UN(n=>n instanceof e,t),VN=jr.create,BN=To.create,U8=Ef.create,V8=Po.create,WN=Dc.create,B8=pi.create,W8=kf.create,H8=Oc.create,Y8=Ic.create,K8=za.create,G8=si.create,Z8=$s.create,q8=Cf.create,X8=Tr.create,Q8=Rt.create,J8=Rt.strictCreate,eV=Mc.create,tV=Gh.create,nV=Lc.create,rV=os.create,sV=zc.create,oV=jf.create,iV=gi.create,aV=ja.create,lV=Fc.create,cV=$c.create,uV=Ro.create,dV=Uc.create,fV=Fa.create,Hb=Ir.create,hV=es.create,mV=Ao.create,pV=Ir.createWithPreprocess,gV=yu.create,yV=()=>VN().optional(),vV=()=>BN().optional(),xV=()=>WN().optional(),wV={string:e=>jr.create({...e,coerce:!0}),number:e=>To.create({...e,coerce:!0}),boolean:e=>Dc.create({...e,coerce:!0}),bigint:e=>Po.create({...e,coerce:!0}),date:e=>pi.create({...e,coerce:!0})},bV=He;var ce=Object.freeze({__proto__:null,defaultErrorMap:La,setErrorMap:b8,getErrorMap:bf,makeIssue:_f,EMPTY_PATH:_8,addIssueToContext:ve,ParseStatus:vn,INVALID:He,DIRTY:da,OK:Cn,isAborted:zg,isDirty:Fg,isValid:Rc,isAsync:Ac,get util(){return it},get objectUtil(){return Lg},ZodParsedType:_e,getParsedType:lo,ZodType:et,datetimeRegex:FN,ZodString:jr,ZodNumber:To,ZodBigInt:Po,ZodBoolean:Dc,ZodDate:pi,ZodSymbol:kf,ZodUndefined:Oc,ZodNull:Ic,ZodAny:za,ZodUnknown:si,ZodNever:$s,ZodVoid:Cf,ZodArray:Tr,ZodObject:Rt,ZodUnion:Mc,ZodDiscriminatedUnion:Gh,ZodIntersection:Lc,ZodTuple:os,ZodRecord:zc,ZodMap:jf,ZodSet:gi,ZodFunction:ja,ZodLazy:Fc,ZodLiteral:$c,ZodEnum:Ro,ZodNativeEnum:Uc,ZodPromise:Fa,ZodEffects:Ir,ZodTransformer:Ir,ZodOptional:es,ZodNullable:Ao,ZodDefault:Vc,ZodCatch:Bc,ZodNaN:Ef,BRAND:z8,ZodBranded:Lx,ZodPipeline:yu,ZodReadonly:Wc,custom:UN,Schema:et,ZodSchema:et,late:F8,get ZodFirstPartyTypeKind(){return Ve},coerce:wV,any:K8,array:X8,bigint:V8,boolean:WN,date:B8,discriminatedUnion:tV,effect:Hb,enum:uV,function:aV,instanceof:$8,intersection:nV,lazy:lV,literal:cV,map:oV,nan:U8,nativeEnum:dV,never:Z8,null:Y8,nullable:mV,number:BN,object:Q8,oboolean:xV,onumber:vV,optional:hV,ostring:yV,pipeline:gV,preprocess:pV,promise:fV,record:sV,set:iV,strictObject:J8,string:VN,symbol:W8,transformer:Hb,tuple:rV,undefined:H8,union:eV,unknown:G8,void:q8,NEVER:bV,ZodIssueCode:ae,quotelessJson:w8,ZodError:Kn}),_V="Label",HN=g.forwardRef((e,t)=>l.jsx(Pe.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));HN.displayName=_V;var YN=HN;const SV=eu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Vt=g.forwardRef(({className:e,...t},n)=>l.jsx(YN,{ref:n,className:re(SV(),e),...t}));Vt.displayName=YN.displayName;const fn=n8,KN=g.createContext({}),ke=({...e})=>l.jsx(KN.Provider,{value:{name:e.name},children:l.jsx(i8,{...e})}),Zh=()=>{const e=g.useContext(KN),t=g.useContext(GN),{getFieldState:n,formState:r}=Kh(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},GN=g.createContext({}),Se=g.forwardRef(({className:e,...t},n)=>{const r=g.useId();return l.jsx(GN.Provider,{value:{id:r},children:l.jsx("div",{ref:n,className:re("space-y-2",e),...t})})});Se.displayName="FormItem";const Ce=g.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=Zh();return l.jsx(Vt,{ref:n,className:re(r&&"text-destructive",e),htmlFor:s,...t})});Ce.displayName="FormLabel";const je=g.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:o}=Zh();return l.jsx(ts,{ref:t,id:r,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...e})});je.displayName="FormControl";const kV=g.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Zh();return l.jsx("p",{ref:n,id:r,className:re("text-sm text-muted-foreground",e),...t})});kV.displayName="FormDescription";const ye=g.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:o}=Zh(),{t:i}=Ye(),a=s?i(String(s==null?void 0:s.message)):t;return a?l.jsx("p",{ref:r,id:o,className:re("text-sm font-medium text-destructive",e),...n,children:a}):null});ye.displayName="FormMessage";function Ug(e,[t,n]){return Math.min(n,Math.max(t,e))}var CV=[" ","Enter","ArrowUp","ArrowDown"],jV=[" ","Enter"],vu="Select",[qh,Xh,EV]=tu(vu),[ll,QH]=an(vu,[EV,nl]),Qh=nl(),[NV,zo]=ll(vu),[TV,PV]=ll(vu),ZN=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:m}=e,x=Qh(t),[p,w]=g.useState(null),[y,v]=g.useState(null),[b,_]=g.useState(!1),C=ki(u),[j=!1,T]=Zn({prop:r,defaultProp:s,onChange:o}),[R,A]=Zn({prop:i,defaultProp:a,onChange:c}),O=g.useRef(null),G=p?!!p.closest("form"):!0,[N,z]=g.useState(new Set),S=Array.from(N).map(U=>U.props.value).join(";");return l.jsx(bv,{...x,children:l.jsxs(NV,{required:m,scope:t,trigger:p,onTriggerChange:w,valueNode:y,onValueNodeChange:v,valueNodeHasChildren:b,onValueNodeHasChildrenChange:_,contentId:Wn(),value:R,onValueChange:A,open:j,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:h,children:[l.jsx(qh.Provider,{scope:t,children:l.jsx(TV,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(U=>{z(J=>new Set(J).add(U))},[]),onNativeOptionRemove:g.useCallback(U=>{z(J=>{const F=new Set(J);return F.delete(U),F})},[]),children:n})}),G?l.jsxs(b2,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:R,onChange:U=>A(U.target.value),disabled:h,children:[R===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},S):null]})})};ZN.displayName=vu;var qN="SelectTrigger",XN=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Qh(n),i=zo(qN,n),a=i.disabled||r,c=Ge(t,i.onTriggerChange),u=Xh(n),[d,f,h]=_2(x=>{const p=u().filter(v=>!v.disabled),w=p.find(v=>v.value===i.value),y=S2(p,x,w);y!==void 0&&i.onValueChange(y.value)}),m=()=>{a||(i.onOpenChange(!0),h())};return l.jsx(_v,{asChild:!0,...o,children:l.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":w2(i.value)?"":void 0,...s,ref:c,onClick:ue(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ue(s.onPointerDown,x=>{const p=x.target;p.hasPointerCapture(x.pointerId)&&p.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(m(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ue(s.onKeyDown,x=>{const p=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(p&&x.key===" ")&&CV.includes(x.key)&&(m(),x.preventDefault())})})})});XN.displayName=qN;var QN="SelectValue",JN=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...a}=e,c=zo(QN,n),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ge(t,c.onValueNodeChange);return tn(()=>{u(d)},[u,d]),l.jsx(Pe.span,{...a,ref:f,style:{pointerEvents:"none"},children:w2(c.value)?l.jsx(l.Fragment,{children:i}):o})});JN.displayName=QN;var RV="SelectIcon",e2=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return l.jsx(Pe.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});e2.displayName=RV;var AV="SelectPortal",t2=e=>l.jsx(ru,{asChild:!0,...e});t2.displayName=AV;var yi="SelectContent",n2=g.forwardRef((e,t)=>{const n=zo(yi,e.__scopeSelect),[r,s]=g.useState();if(tn(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Bs.createPortal(l.jsx(r2,{scope:e.__scopeSelect,children:l.jsx(qh.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(s2,{...e,ref:t})});n2.displayName=yi;var _s=10,[r2,Fo]=ll(yi),DV="SelectContentImpl",s2=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:w,...y}=e,v=zo(yi,n),[b,_]=g.useState(null),[C,j]=g.useState(null),T=Ge(t,me=>_(me)),[R,A]=g.useState(null),[O,G]=g.useState(null),N=Xh(n),[z,S]=g.useState(!1),U=g.useRef(!1);g.useEffect(()=>{if(b)return Ev(b)},[b]),dv();const J=g.useCallback(me=>{const[we,...Te]=N().map(Re=>Re.ref.current),[Fe]=Te.slice(-1),Ie=document.activeElement;for(const Re of me)if(Re===Ie||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===we&&C&&(C.scrollTop=0),Re===Fe&&C&&(C.scrollTop=C.scrollHeight),Re==null||Re.focus(),document.activeElement!==Ie))return},[N,C]),F=g.useCallback(()=>J([R,b]),[J,R,b]);g.useEffect(()=>{z&&F()},[z,F]);const{onOpenChange:W,triggerPointerDownPosRef:I}=v;g.useEffect(()=>{if(b){let me={x:0,y:0};const we=Fe=>{var Ie,Re;me={x:Math.abs(Math.round(Fe.pageX)-(((Ie=I.current)==null?void 0:Ie.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Re=I.current)==null?void 0:Re.y)??0))}},Te=Fe=>{me.x<=10&&me.y<=10?Fe.preventDefault():b.contains(Fe.target)||W(!1),document.removeEventListener("pointermove",we),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",Te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",Te,{capture:!0})}}},[b,W,I]),g.useEffect(()=>{const me=()=>W(!1);return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[W]);const[X,$]=_2(me=>{const we=N().filter(Ie=>!Ie.disabled),Te=we.find(Ie=>Ie.ref.current===document.activeElement),Fe=S2(we,me,Te);Fe&&setTimeout(()=>Fe.ref.current.focus())}),B=g.useCallback((me,we,Te)=>{const Fe=!U.current&&!Te;(v.value!==void 0&&v.value===we||Fe)&&(A(me),Fe&&(U.current=!0))},[v.value]),he=g.useCallback(()=>b==null?void 0:b.focus(),[b]),se=g.useCallback((me,we,Te)=>{const Fe=!U.current&&!Te;(v.value!==void 0&&v.value===we||Fe)&&G(me)},[v.value]),oe=r==="popper"?Vg:o2,Oe=oe===Vg?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:w}:{};return l.jsx(r2,{scope:n,content:b,viewport:C,onViewportChange:j,itemRefCallback:B,selectedItem:R,onItemLeave:he,itemTextRefCallback:se,focusSelectedItem:F,selectedItemText:O,position:r,isPositioned:z,searchRef:X,children:l.jsx(gh,{as:ts,allowPinchZoom:!0,children:l.jsx(dh,{asChild:!0,trapped:v.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:ue(s,me=>{var we;(we=v.trigger)==null||we.focus({preventScroll:!0}),me.preventDefault()}),children:l.jsx(Ja,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:me=>me.preventDefault(),...y,...Oe,onPlaced:()=>S(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ue(y.onKeyDown,me=>{const we=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!we&&me.key.length===1&&$(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Fe=N().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Ie=me.target,Re=Fe.indexOf(Ie);Fe=Fe.slice(Re+1)}setTimeout(()=>J(Fe)),me.preventDefault()}})})})})})})});s2.displayName=DV;var OV="SelectItemAlignedPosition",o2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=zo(yi,n),i=Fo(yi,n),[a,c]=g.useState(null),[u,d]=g.useState(null),f=Ge(t,T=>d(T)),h=Xh(n),m=g.useRef(!1),x=g.useRef(!0),{viewport:p,selectedItem:w,selectedItemText:y,focusSelectedItem:v}=i,b=g.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&p&&w&&y){const T=o.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(o.dir!=="rtl"){const Ie=O.left-R.left,Re=A.left-Ie,st=T.left-Re,E=T.width+st,ee=Math.max(E,R.width),Z=window.innerWidth-_s,D=Ug(Re,[_s,Z-ee]);a.style.minWidth=E+"px",a.style.left=D+"px"}else{const Ie=R.right-O.right,Re=window.innerWidth-A.right-Ie,st=window.innerWidth-T.right-Re,E=T.width+st,ee=Math.max(E,R.width),Z=window.innerWidth-_s,D=Ug(Re,[_s,Z-ee]);a.style.minWidth=E+"px",a.style.right=D+"px"}const G=h(),N=window.innerHeight-_s*2,z=p.scrollHeight,S=window.getComputedStyle(u),U=parseInt(S.borderTopWidth,10),J=parseInt(S.paddingTop,10),F=parseInt(S.borderBottomWidth,10),W=parseInt(S.paddingBottom,10),I=U+J+z+W+F,X=Math.min(w.offsetHeight*5,I),$=window.getComputedStyle(p),B=parseInt($.paddingTop,10),he=parseInt($.paddingBottom,10),se=T.top+T.height/2-_s,oe=N-se,Oe=w.offsetHeight/2,me=w.offsetTop+Oe,we=U+J+me,Te=I-we;if(we<=se){const Ie=w===G[G.length-1].ref.current;a.style.bottom="0px";const Re=u.clientHeight-p.offsetTop-p.offsetHeight,st=Math.max(oe,Oe+(Ie?he:0)+Re+F),E=we+st;a.style.height=E+"px"}else{const Ie=w===G[0].ref.current;a.style.top="0px";const st=Math.max(se,U+p.offsetTop+(Ie?B:0)+Oe)+Te;a.style.height=st+"px",p.scrollTop=we-se+p.offsetTop}a.style.margin=`${_s}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=N+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[h,o.trigger,o.valueNode,a,u,p,w,y,o.dir,r]);tn(()=>b(),[b]);const[_,C]=g.useState();tn(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=g.useCallback(T=>{T&&x.current===!0&&(b(),v==null||v(),x.current=!1)},[b,v]);return l.jsx(MV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:j,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(Pe.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});o2.displayName=OV;var IV="SelectPopperPosition",Vg=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=_s,...o}=e,i=Qh(n);return l.jsx(Sv,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Vg.displayName=IV;var[MV,zx]=ll(yi,{}),Bg="SelectViewport",i2=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Fo(Bg,n),i=zx(Bg,n),a=Ge(t,o.onViewportChange),c=g.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),l.jsx(qh.Slot,{scope:n,children:l.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ue(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&f){const m=Math.abs(c.current-d.scrollTop);if(m>0){const x=window.innerHeight-_s*2,p=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),y=Math.max(p,w);if(y0?_:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});i2.displayName=Bg;var a2="SelectGroup",[LV,zV]=ll(a2),l2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Wn();return l.jsx(LV,{scope:n,id:s,children:l.jsx(Pe.div,{role:"group","aria-labelledby":s,...r,ref:t})})});l2.displayName=a2;var c2="SelectLabel",u2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=zV(c2,n);return l.jsx(Pe.div,{id:s.id,...r,ref:t})});u2.displayName=c2;var Nf="SelectItem",[FV,d2]=ll(Nf),f2=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,a=zo(Nf,n),c=Fo(Nf,n),u=a.value===r,[d,f]=g.useState(o??""),[h,m]=g.useState(!1),x=Ge(t,y=>{var v;return(v=c.itemRefCallback)==null?void 0:v.call(c,y,r,s)}),p=Wn(),w=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(FV,{scope:n,value:r,disabled:s,textId:p,isSelected:u,onItemTextChange:g.useCallback(y=>{f(v=>v||((y==null?void 0:y.textContent)??"").trim())},[]),children:l.jsx(qh.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:l.jsx(Pe.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ue(i.onFocus,()=>m(!0)),onBlur:ue(i.onBlur,()=>m(!1)),onPointerUp:ue(i.onPointerUp,w),onPointerMove:ue(i.onPointerMove,y=>{var v;s?(v=c.onItemLeave)==null||v.call(c):y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,y=>{var v;y.currentTarget===document.activeElement&&((v=c.onItemLeave)==null||v.call(c))}),onKeyDown:ue(i.onKeyDown,y=>{var b;((b=c.searchRef)==null?void 0:b.current)!==""&&y.key===" "||(jV.includes(y.key)&&w(),y.key===" "&&y.preventDefault())})})})})});f2.displayName=Nf;var Fl="SelectItemText",h2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=zo(Fl,n),a=Fo(Fl,n),c=d2(Fl,n),u=PV(Fl,n),[d,f]=g.useState(null),h=Ge(t,y=>f(y),c.onItemTextChange,y=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,y,c.value,c.disabled)}),m=d==null?void 0:d.textContent,x=g.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:w}=u;return tn(()=>(p(x),()=>w(x)),[p,w,x]),l.jsxs(l.Fragment,{children:[l.jsx(Pe.span,{id:c.textId,...o,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Bs.createPortal(o.children,i.valueNode):null]})});h2.displayName=Fl;var m2="SelectItemIndicator",p2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d2(m2,n).isSelected?l.jsx(Pe.span,{"aria-hidden":!0,...r,ref:t}):null});p2.displayName=m2;var Wg="SelectScrollUpButton",g2=g.forwardRef((e,t)=>{const n=Fo(Wg,e.__scopeSelect),r=zx(Wg,e.__scopeSelect),[s,o]=g.useState(!1),i=Ge(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(v2,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});g2.displayName=Wg;var Hg="SelectScrollDownButton",y2=g.forwardRef((e,t)=>{const n=Fo(Hg,e.__scopeSelect),r=zx(Hg,e.__scopeSelect),[s,o]=g.useState(!1),i=Ge(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(v2,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});y2.displayName=Hg;var v2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Fo("SelectScrollButton",n),i=g.useRef(null),a=Xh(n),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),tn(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Pe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ue(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ue(s.onPointerLeave,()=>{c()})})}),$V="SelectSeparator",x2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Pe.div,{"aria-hidden":!0,...r,ref:t})});x2.displayName=$V;var Yg="SelectArrow",UV=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Qh(n),o=zo(Yg,n),i=Fo(Yg,n);return o.open&&i.position==="popper"?l.jsx(kv,{...s,...r,ref:t}):null});UV.displayName=Yg;function w2(e){return e===""||e===void 0}var b2=g.forwardRef((e,t)=>{const{value:n,...r}=e,s=g.useRef(null),o=Ge(t,s),i=jx(n);return g.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==n&&d){const f=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(f)}},[i,n]),l.jsx(mu,{asChild:!0,children:l.jsx("select",{...r,ref:o,defaultValue:n})})});b2.displayName="BubbleSelect";function _2(e){const t=Ot(e),n=g.useRef(""),r=g.useRef(0),s=g.useCallback(i=>{const a=n.current+i;t(a),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function S2(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=VV(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function VV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BV=ZN,k2=XN,WV=JN,HV=e2,YV=t2,C2=n2,KV=i2,GV=l2,j2=u2,E2=f2,ZV=h2,qV=p2,N2=g2,T2=y2,P2=x2;const $a=BV,Hc=GV,Ua=WV,vi=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(k2,{ref:r,className:re("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,l.jsx(HV,{asChild:!0,children:l.jsx(rv,{className:"h-4 w-4 opacity-50"})})]}));vi.displayName=k2.displayName;const R2=g.forwardRef(({className:e,...t},n)=>l.jsx(N2,{ref:n,className:re("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(RO,{className:"h-4 w-4"})}));R2.displayName=N2.displayName;const A2=g.forwardRef(({className:e,...t},n)=>l.jsx(T2,{ref:n,className:re("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(rv,{className:"h-4 w-4"})}));A2.displayName=T2.displayName;const xi=g.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(YV,{children:l.jsxs(C2,{ref:s,className:re("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[l.jsx(R2,{}),l.jsx(KV,{className:re("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(A2,{})]})}));xi.displayName=C2.displayName;const Va=g.forwardRef(({className:e,...t},n)=>l.jsx(j2,{ref:n,className:re("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Va.displayName=j2.displayName;const Do=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(E2,{ref:r,className:re("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(qV,{children:l.jsx(qS,{className:"h-4 w-4"})})}),l.jsx(ZV,{children:t})]}));Do.displayName=E2.displayName;const XV=g.forwardRef(({className:e,...t},n)=>l.jsx(P2,{ref:n,className:re("-mx-1 my-1 h-px bg-muted",e),...t}));XV.displayName=P2.displayName;const cl=Vv,ul=Bv,QV=Wv,D2=g.forwardRef(({className:e,...t},n)=>l.jsx(iu,{ref:n,className:re("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));D2.displayName=iu.displayName;const Ti=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(QV,{children:[l.jsx(D2,{}),l.jsxs(au,{ref:r,className:re("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,l.jsxs(wh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(iv,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ti.displayName=au.displayName;const Pi=({className:e,...t})=>l.jsx("div",{className:re("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Pi.displayName="DialogHeader";const Jh=({className:e,...t})=>l.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Jh.displayName="DialogFooter";const Ri=g.forwardRef(({className:e,...t},n)=>l.jsx(lu,{ref:n,className:re("text-lg font-semibold leading-none tracking-tight",e),...t}));Ri.displayName=lu.displayName;const O2=g.forwardRef(({className:e,...t},n)=>l.jsx(cu,{ref:n,className:re("text-sm text-muted-foreground",e),...t}));O2.displayName=cu.displayName;function JV(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Fx="ScrollArea",[I2,JH]=an(Fx),[eB,gr]=I2(Fx),M2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=g.useState(null),[u,d]=g.useState(null),[f,h]=g.useState(null),[m,x]=g.useState(null),[p,w]=g.useState(null),[y,v]=g.useState(0),[b,_]=g.useState(0),[C,j]=g.useState(!1),[T,R]=g.useState(!1),A=Ge(t,G=>c(G)),O=ki(s);return l.jsx(eB,{scope:n,type:r,dir:O,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:p,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:R,onCornerWidthChange:v,onCornerHeightChange:_,children:l.jsx(Pe.div,{dir:O,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});M2.displayName=Fx;var L2="ScrollAreaViewport",z2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...o}=e,i=gr(L2,n),a=g.useRef(null),c=Ge(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Pe.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});z2.displayName=L2;var cs="ScrollAreaScrollbar",$x=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return g.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(tB,{...r,ref:t,forceMount:n}):s.type==="scroll"?l.jsx(nB,{...r,ref:t,forceMount:n}):s.type==="auto"?l.jsx(F2,{...r,ref:t,forceMount:n}):s.type==="always"?l.jsx(Ux,{...r,ref:t}):null});$x.displayName=cs;var tB=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),[o,i]=g.useState(!1);return g.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ln,{present:n||o,children:l.jsx(F2,{"data-state":o?"visible":"hidden",...r,ref:t})})}),nB=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gr(cs,e.__scopeScrollArea),o=e.orientation==="horizontal",i=tm(()=>c("SCROLL_END"),100),[a,c]=JV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),g.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(c("SCROLL"),i()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,o,c,i]),l.jsx(ln,{present:n||a!=="hidden",children:l.jsx(Ux,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ue(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ue(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),F2=g.forwardRef((e,t)=>{const n=gr(cs,e.__scopeScrollArea),{forceMount:r,...s}=e,[o,i]=g.useState(!1),a=e.orientation==="horizontal",c=tm(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,s=gr(cs,e.__scopeScrollArea),o=g.useRef(null),i=g.useRef(0),[a,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=W2(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function f(h,m){return lB(h,i.current,a,m)}return n==="horizontal"?l.jsx(rB,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollLeft,m=Yb(h,a,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?l.jsx(sB,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollTop,m=Yb(h,a);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),rB=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=gr(cs,e.__scopeScrollArea),[i,a]=g.useState(),c=g.useRef(null),u=Ge(t,c,o.onScrollbarXChange);return g.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(U2,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":em(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),Y2(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Pf(i.paddingLeft),paddingEnd:Pf(i.paddingRight)}})}})}),sB=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=gr(cs,e.__scopeScrollArea),[i,a]=g.useState(),c=g.useRef(null),u=Ge(t,c,o.onScrollbarYChange);return g.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(U2,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":em(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),Y2(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Pf(i.paddingTop),paddingEnd:Pf(i.paddingBottom)}})}})}),[oB,$2]=I2(cs),U2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,m=gr(cs,n),[x,p]=g.useState(null),w=Ge(t,A=>p(A)),y=g.useRef(null),v=g.useRef(""),b=m.viewport,_=r.content-r.viewport,C=Ot(d),j=Ot(c),T=tm(f,10);function R(A){if(y.current){const O=A.clientX-y.current.left,G=A.clientY-y.current.top;u({x:O,y:G})}}return g.useEffect(()=>{const A=O=>{const G=O.target;(x==null?void 0:x.contains(G))&&C(O,_)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[b,x,_,C]),g.useEffect(j,[r,j]),Ba(x,T),Ba(m.content,T),l.jsx(oB,{scope:n,scrollbar:x,hasThumb:s,onThumbChange:Ot(o),onThumbPointerUp:Ot(i),onThumbPositionChange:j,onThumbPointerDown:Ot(a),children:l.jsx(Pe.div,{...h,ref:w,style:{position:"absolute",...h.style},onPointerDown:ue(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),R(A))}),onPointerMove:ue(e.onPointerMove,R),onPointerUp:ue(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=v.current,m.viewport&&(m.viewport.style.scrollBehavior=""),y.current=null})})})}),Tf="ScrollAreaThumb",V2=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=$2(Tf,e.__scopeScrollArea);return l.jsx(ln,{present:n||s.hasThumb,children:l.jsx(iB,{ref:t,...r})})}),iB=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,o=gr(Tf,n),i=$2(Tf,n),{onThumbPositionChange:a}=i,c=Ge(t,f=>i.onThumbChange(f)),u=g.useRef(),d=tm(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const m=cB(f,a);u.current=m,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,a]),l.jsx(Pe.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ue(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),x=f.clientX-m.left,p=f.clientY-m.top;i.onThumbPointerDown({x,y:p})}),onPointerUp:ue(e.onPointerUp,i.onThumbPointerUp)})});V2.displayName=Tf;var Vx="ScrollAreaCorner",B2=g.forwardRef((e,t)=>{const n=gr(Vx,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(aB,{...e,ref:t}):null});B2.displayName=Vx;var aB=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=gr(Vx,n),[o,i]=g.useState(0),[a,c]=g.useState(0),u=!!(o&&a);return Ba(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),Ba(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Pe.div,{...r,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Pf(e){return e?parseInt(e,10):0}function W2(e,t){const n=e/t;return isNaN(n)?0:n}function em(e){const t=W2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function lB(e,t,n,r="ltr"){const s=em(n),o=s/2,i=t||o,a=s-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return H2([c,u],f)(e)}function Yb(e,t,n="ltr"){const r=em(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-r,c=n==="ltr"?[0,i]:[i*-1,0],u=Ug(e,c);return H2([0,i],[0,a])(u)}function H2(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Y2(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=n.left!==o.left,a=n.top!==o.top;(i||a)&&t(),n=o,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function tm(e,t){const n=Ot(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Ba(e,t){const n=Ot(t);tn(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var K2=M2,uB=z2,dB=B2;const nm=g.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(K2,{ref:r,className:re("relative overflow-hidden",e),...n,children:[l.jsx(uB,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(G2,{}),l.jsx(dB,{})]}));nm.displayName=K2.displayName;const G2=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>l.jsx($x,{ref:r,orientation:t,className:re("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:l.jsx(V2,{className:"relative flex-1 rounded-full bg-border"})}));G2.displayName=$x.displayName;const As=new Map([["aliyun",["common.provider.aliyun","/imgs/providers/aliyun.svg"]],["tencent",["common.provider.tencent","/imgs/providers/tencent.svg"]],["huaweicloud",["common.provider.huaweicloud","/imgs/providers/huaweicloud.svg"]],["qiniu",["common.provider.qiniu","/imgs/providers/qiniu.svg"]],["cloudflare",["common.provider.cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["common.provider.namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["common.provider.godaddy","/imgs/providers/godaddy.svg"]],["local",["common.provider.local","/imgs/providers/local.svg"]],["ssh",["common.provider.ssh","/imgs/providers/ssh.svg"]],["webhook",["common.provider.webhook","/imgs/providers/webhook.svg"]]]),Kb=e=>As.get(e),us=ce.union([ce.literal("aliyun"),ce.literal("tencent"),ce.literal("huaweicloud"),ce.literal("qiniu"),ce.literal("cloudflare"),ce.literal("namesilo"),ce.literal("godaddy"),ce.literal("local"),ce.literal("ssh"),ce.literal("webhook")],{message:"access.authorization.form.type.placeholder"}),ds=e=>{switch(e){case"aliyun":case"tencent":case"huaweicloud":return"all";case"qiniu":case"local":case"ssh":case"webhook":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},pe=g.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:re("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));pe.displayName="Input";const fB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,accessKeyId:ce.string().min(1,"access.authorization.form.access_key_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),accessSecretId:ce.string().min(1,"access.authorization.form.access_key_secret.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={accessKeyId:"",accessKeySecret:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"aliyun",accessKeyId:a.accessKeyId,accessSecretId:a.accessKeySecret}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{accessKeyId:d.accessKeyId,accessKeySecret:d.accessSecretId}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}console.log(f),r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKeyId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessSecretId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_secret.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},hB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,secretId:ce.string().min(1,"access.authorization.form.secret_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),secretKey:ce.string().min(1,"access.authorization.form.secret_key.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={secretId:"",secretKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"tencent",secretId:a.secretId,secretKey:a.secretKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{secretId:d.secretId,secretKey:d.secretKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},mB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,region:ce.string().min(1,"access.authorization.form.region.placeholder").max(64,o("common.errmsg.string_max",{max:64})),accessKeyId:ce.string().min(1,"access.authorization.form.access_key_id.placeholder").max(64,o("common.errmsg.string_max",{max:64})),secretAccessKey:ce.string().min(1,"access.authorization.form.access_key_secret.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={region:"cn-north-1",accessKeyId:"",secretAccessKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"huaweicloud",region:a.region,accessKeyId:a.accessKeyId,secretAccessKey:a.secretAccessKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{region:d.region,accessKeyId:d.accessKeyId,secretAccessKey:d.secretAccessKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}console.log(f),r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"region",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.region.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.region.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKeyId",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_id.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_id.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretAccessKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key_secret.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},pB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,accessKey:ce.string().min(1,"access.authorization.form.access_key.placeholder").max(64),secretKey:ce.string().min(1,"access.authorization.form.secret_key.placeholder").max(64)});let a={accessKey:"",secretKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"qiniu",accessKey:a.accessKey,secretKey:a.secretKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{accessKey:d.accessKey,secretKey:d.secretKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"accessKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.access_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.access_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"secretKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.secret_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.secret_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},gB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,dnsApiToken:ce.string().min(1,"access.authorization.form.cloud_dns_api_token.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={dnsApiToken:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"cloudflare",dnsApiToken:a.dnsApiToken}}),u=async d=>{console.log(d);const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{dnsApiToken:d.dnsApiToken}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"dnsApiToken",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.cloud_dns_api_token.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.cloud_dns_api_token.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},yB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,apiKey:ce.string().min(1,"access.authorization.form.namesilo_api_key.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={apiKey:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"namesilo",apiKey:a.apiKey}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{apiKey:d.apiKey}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.namesilo_api_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.namesilo_api_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},vB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,apiKey:ce.string().min(1,"access.authorization.form.godaddy_api_key.placeholder").max(64,o("common.errmsg.string_max",{max:64})),apiSecret:ce.string().min(1,"access.authorization.form.godaddy_api_secret.placeholder").max(64,o("common.errmsg.string_max",{max:64}))});let a={apiKey:"",apiSecret:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"godaddy",apiKey:a.apiKey,apiSecret:a.apiSecret}}),u=async d=>{console.log(d);const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{apiKey:d.apiKey,apiSecret:d.apiSecret}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiKey",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.godaddy_api_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.godaddy_api_key.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"apiSecret",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.godaddy_api_secret.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.godaddy_api_secret.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})},xB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s,reloadAccessGroups:o}=cn(),{t:i}=Ye(),a=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,i("common.errmsg.string_max",{max:64})),configType:us}),c=un({resolver:dn(a),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"local"}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"?s(f):r(f),o()}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-3",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:i("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:i("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:i("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:i("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:i("common.save")})})]})})})})},Bx=({className:e,trigger:t})=>{const{reloadAccessGroups:n}=cn(),[r,s]=g.useState(!1),{t:o}=Ye(),i=ce.object({name:ce.string().min(1,"access.group.form.name.errmsg.empty").max(64,o("common.errmsg.string_max",{max:64}))}),a=un({resolver:dn(i),defaultValues:{name:""}}),c=async u=>{try{await v$({name:u.name}),n(),s(!1)}catch(d){Object.entries(d.response.data).forEach(([h,m])=>{a.setError(h,{type:"manual",message:m.message})})}};return l.jsxs(cl,{onOpenChange:s,open:r,children:[l.jsx(ul,{asChild:!0,className:re(e),children:t}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:o("access.group.add")})}),l.jsx("div",{className:"container py-3",children:l.jsx(fn,{...a,children:l.jsxs("form",{onSubmit:u=>{u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(ke,{control:a.control,name:"name",render:({field:u})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.group.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.group.form.name.errmsg.empty"),...u,type:"text"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})]})]})},wB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s,reloadAccessGroups:o,config:{accessGroups:i}}=cn(),a=g.useRef(null),[c,u]=g.useState(""),{t:d}=Ye(),f=e&&e.group?e.group:"",h=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,m=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,x=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,d("common.errmsg.string_max",{max:64})),configType:us,host:ce.string().refine(_=>m.test(_)||h.test(_),{message:"common.errmsg.host_invalid"}),group:ce.string().optional(),port:ce.string().min(1,"access.authorization.form.ssh_port.placeholder").max(5,d("common.errmsg.string_max",{max:5})),username:ce.string().min(1,"username.not.empty").max(64,d("common.errmsg.string_max",{max:64})),password:ce.string().min(0,"password.not.empty").max(64,d("common.errmsg.string_max",{max:64})),key:ce.string().min(0,"access.authorization.form.ssh_key.placeholder").max(20480,d("common.errmsg.string_max",{max:20480})),keyFile:ce.any().optional()});let p={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:""};e&&(p=e.config);const w=un({resolver:dn(x),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"ssh",group:e==null?void 0:e.group,host:p.host,port:p.port,username:p.username,password:p.password,key:p.key,keyFile:p.keyFile}}),y=async _=>{let C=_.group;C=="emptyId"&&(C="");const j={id:_.id,name:_.name,configType:_.configType,usage:ds(_.configType),group:C,config:{host:_.host,port:_.port,username:_.username,password:_.password,key:_.key}};try{j.id=t=="copy"?"":j.id;const T=await ls(j);n(),j.id=T.id,j.created=T.created,j.updated=T.updated,_.id&&t=="edit"?s(j):r(j),C!=f&&(f&&await Rb({id:f,"access-":j.id}),C&&await Rb({id:C,"access+":j.id})),o()}catch(T){Object.entries(T.response.data).forEach(([A,O])=>{w.setError(A,{type:"manual",message:O.message})});return}},v=async _=>{var R;const C=(R=_.target.files)==null?void 0:R[0];if(!C)return;const j=C;u(j.name);const T=await WU(j);w.setValue("key",T)},b=()=>{var _;console.log(a.current),(_=a.current)==null||_.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...w,children:l.jsxs("form",{onSubmit:_=>{_.stopPropagation(),w.handleSubmit(y)(_)},className:"space-y-3",children:[l.jsx(ke,{control:w.control,name:"name",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.name.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"group",render:({field:_})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"w-full flex justify-between",children:[l.jsx("div",{children:d("access.authorization.form.ssh_group.label")}),l.jsx(Bx,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),d("common.add")]})})]}),l.jsx(je,{children:l.jsxs($a,{..._,value:_.value,defaultValue:"emptyId",onValueChange:C=>{w.setValue("group",C)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:d("access.authorization.form.access_group.placeholder")})}),l.jsxs(xi,{children:[l.jsx(Do,{value:"emptyId",children:l.jsx("div",{className:re("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),i.map(C=>l.jsx(Do,{value:C.id?C.id:"",children:l.jsx("div",{className:re("flex items-center space-x-2 rounded cursor-pointer"),children:C.name})},C.id))]})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"id",render:({field:_})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:d("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"configType",render:({field:_})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:d("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{..._})}),l.jsx(ye,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(ke,{control:w.control,name:"host",render:({field:_})=>l.jsxs(Se,{className:"grow",children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_host.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_host.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"port",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_port.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_port.placeholder"),..._,type:"number"})}),l.jsx(ye,{})]})})]}),l.jsx(ke,{control:w.control,name:"username",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.username.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.username.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"password",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.password.placeholder"),..._,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"key",render:({field:_})=>l.jsxs(Se,{hidden:!0,children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_key.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:d("access.authorization.form.ssh_key.placeholder"),..._})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:w.control,name:"keyFile",render:({field:_})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:d("access.authorization.form.ssh_key.label")}),l.jsx(je,{children:l.jsxs("div",{children:[l.jsx(Me,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:b,children:c||d("access.authorization.form.ssh_key_file.placeholder")}),l.jsx(pe,{placeholder:d("access.authorization.form.ssh_key.placeholder"),..._,ref:a,className:"hidden",hidden:!0,type:"file",onChange:v})]})}),l.jsx(ye,{})]})}),l.jsx(ye,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:d("common.save")})})]})})})})},bB=({data:e,op:t,onAfterReq:n})=>{const{addAccess:r,updateAccess:s}=cn(),{t:o}=Ye(),i=ce.object({id:ce.string().optional(),name:ce.string().min(1,"access.authorization.form.name.placeholder").max(64,o("common.errmsg.string_max",{max:64})),configType:us,url:ce.string().url("common.errmsg.url_invalid")});let a={url:""};e&&(a=e.config);const c=un({resolver:dn(i),defaultValues:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",configType:"webhook",url:a.url}}),u=async d=>{const f={id:d.id,name:d.name,configType:d.configType,usage:ds(d.configType),config:{url:d.url}};try{f.id=t=="copy"?"":f.id;const h=await ls(f);if(n(),f.id=h.id,f.created=h.created,f.updated=h.updated,d.id&&t=="edit"){s(f);return}r(f)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"name",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.name.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.name.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"id",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"configType",render:({field:d})=>l.jsxs(Se,{className:"hidden",children:[l.jsx(Ce,{children:o("access.authorization.form.config.label")}),l.jsx(je,{children:l.jsx(pe,{...d})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:c.control,name:"url",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("access.authorization.form.webhook_url.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:o("access.authorization.form.webhook_url.placeholder"),...d})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:o("common.save")})})]})})})})};function fa({trigger:e,op:t,data:n,className:r}){const[s,o]=g.useState(!1),{t:i}=Ye(),a=Array.from(As.keys()),[c,u]=g.useState((n==null?void 0:n.configType)||"");let d=l.jsx(l.Fragment,{children:" "});switch(c){case"aliyun":d=l.jsx(fB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"tencent":d=l.jsx(hB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"huaweicloud":d=l.jsx(mB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"qiniu":d=l.jsx(pB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"cloudflare":d=l.jsx(gB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"namesilo":d=l.jsx(yB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"godaddy":d=l.jsx(vB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"local":d=l.jsx(xB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"ssh":d=l.jsx(wB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break;case"webhook":d=l.jsx(bB,{data:n,op:t,onAfterReq:()=>{o(!1)}});break}const f=h=>h==c?"border-primary":"";return l.jsxs(cl,{onOpenChange:o,open:s,children:[l.jsx(ul,{asChild:!0,className:re(r),children:e}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:t=="add"?i("access.authorization.add"):t=="edit"?i("access.authorization.edit"):i("access.authorization.copy")})}),l.jsx(nm,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Vt,{children:i("access.authorization.form.type.label")}),l.jsxs($a,{onValueChange:h=>{u(h)},defaultValue:c,children:[l.jsx(vi,{className:"mt-3",children:l.jsx(Ua,{placeholder:i("access.authorization.form.type.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:i("access.authorization.form.type.list")}),a.map(h=>{var m,x;return l.jsx(Do,{value:h,children:l.jsxs("div",{className:re("flex items-center space-x-2 rounded cursor-pointer",f(h)),children:[l.jsx("img",{src:(m=As.get(h))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:i(((x=As.get(h))==null?void 0:x[0])||"")})]})},h)})]})})]}),d]})})]})]})}const _B=({className:e,trigger:t})=>{const{config:{emails:n},setEmails:r}=cn(),[s,o]=g.useState(!1),{t:i}=Ye(),a=ce.object({email:ce.string().email("common.errmsg.email_invalid")}),c=un({resolver:dn(a),defaultValues:{email:""}}),u=async d=>{if(n.content.emails.includes(d.email)){c.setError("email",{message:"common.errmsg.email_duplicate"});return}const f=[...n.content.emails,d.email];try{const h=await al({...n,name:"emails",content:{emails:f}});r(h),c.reset(),c.clearErrors(),o(!1)}catch(h){Object.entries(h.response.data).forEach(([x,p])=>{c.setError(x,{type:"manual",message:p.message})})}};return l.jsxs(cl,{onOpenChange:o,open:s,children:[l.jsx(ul,{asChild:!0,className:re(e),children:t}),l.jsxs(Ti,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(Pi,{children:l.jsx(Ri,{children:i("domain.application.form.email.add")})}),l.jsx("div",{className:"container py-3",children:l.jsx(fn,{...c,children:l.jsxs("form",{onSubmit:d=>{console.log(d),d.stopPropagation(),c.handleSubmit(u)(d)},className:"space-y-8",children:[l.jsx(ke,{control:c.control,name:"email",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:i("domain.application.form.email.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:i("common.errmsg.email_empty"),...d,type:"email"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:i("common.save")})})]})})})]})]})},Z2={domain:"common.text.domain",ip:"common.text.ip",dns:"common.text.dns"},Gb=({value:e,className:t,onValueChange:n,valueType:r="domain"})=>{const[s,o]=g.useState([]),{t:i}=Ye();g.useMemo(()=>{e&&o(e.split(";"))},[e]),g.useEffect(()=>{(()=>{n(s.join(";"))})()},[s]);const a=d=>{s.includes(d)||o([...s,d])},c=(d,f)=>{const h=[...s];h[d]=f,o(h)},u=d=>{const f=[...s];f.splice(d,1),o(f)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:re(t),children:[l.jsxs(Ce,{className:"flex justify-between items-center",children:[l.jsx("div",{children:i(Z2[r])}),l.jsx(dr,{when:s.length>0,children:l.jsx(dp,{op:"add",onValueChange:d=>{a(d)},valueType:r,value:"",trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:i("common.add")})]})})})]}),l.jsx(je,{children:l.jsx(dr,{when:s.length>0,fallback:l.jsxs("div",{className:"border rounded-md p-3 text-sm mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:i("common.text."+r+".empty")}),l.jsx(dp,{value:"",trigger:i("common.add"),onValueChange:a,valueType:r})]}),children:l.jsx("div",{className:"border rounded-md p-3 text-sm mt-2 text-gray-700 space-y-2 dark:text-white dark:border-stone-700 dark:bg-stone-950",children:s.map((d,f)=>l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{children:d}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(dp,{op:"edit",valueType:r,trigger:l.jsx(sv,{size:16,className:"cursor-pointer text-gray-600 dark:text-white"}),value:d,onValueChange:h=>{c(f,h)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{u(f)}})]})]},f))})})})]})})},dp=({trigger:e,value:t,onValueChange:n,op:r="add",valueType:s})=>{const[o,i]=g.useState(""),[a,c]=g.useState(!1),[u,d]=g.useState(""),{t:f}=Ye();g.useEffect(()=>{i(t)},[t]);const h=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:f("common.errmsg.domain_invalid")}),m=ce.string().ip({message:f("common.errmsg.ip_invalid")}),x={domain:h,dns:m,host:m},p=g.useCallback(()=>{const y=x[s].safeParse(o);if(!y.success){d(JSON.parse(y.error.message)[0].message);return}i(""),c(!1),d(""),n(o)},[o]);return l.jsxs(cl,{open:a,onOpenChange:w=>{c(w)},children:[l.jsx(ul,{className:"text-primary",children:e}),l.jsxs(Ti,{className:"dark:text-white",children:[l.jsx(Pi,{children:l.jsx(Ri,{className:"dark:text-white",children:f(Z2[s])})}),l.jsx(pe,{value:o,className:"dark:text-white",onChange:w=>{i(w.target.value)}}),l.jsx(dr,{when:u.length>0,children:l.jsx("div",{className:"text-red-500 text-sm",children:u})}),l.jsx(Jh,{children:l.jsx(Me,{onClick:()=>{p()},children:f(r==="add"?"common.add":"common.confirm")})})]})]})},Rf=new Map([["aliyun-oss",["common.provider.aliyun.oss","/imgs/providers/aliyun.svg"]],["aliyun-cdn",["common.provider.aliyun.cdn","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["common.provider.aliyun.dcdn","/imgs/providers/aliyun.svg"]],["tencent-cdn",["common.provider.tencent.cdn","/imgs/providers/tencent.svg"]],["qiniu-cdn",["common.provider.qiniu.cdn","/imgs/providers/qiniu.svg"]],["local",["common.provider.local","/imgs/providers/local.svg"]],["ssh",["common.provider.ssh","/imgs/providers/ssh.svg"]],["webhook",["common.provider.webhook","/imgs/providers/webhook.svg"]]]),SB=Array.from(Rf.keys()),kB=eu("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),rm=g.forwardRef(({className:e,variant:t,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:re(kB({variant:t}),e),...n}));rm.displayName="Alert";const Wx=g.forwardRef(({className:e,...t},n)=>l.jsx("h5",{ref:n,className:re("mb-1 font-medium leading-none tracking-tight",e),...t}));Wx.displayName="AlertTitle";const sm=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("text-sm [&_p]:leading-relaxed",e),...t}));sm.displayName="AlertDescription";const Af=g.forwardRef(({className:e,...t},n)=>l.jsx("textarea",{className:re("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Af.displayName="Textarea";var q2=Symbol.for("immer-nothing"),Zb=Symbol.for("immer-draftable"),qn=Symbol.for("immer-state");function kr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wa=Object.getPrototypeOf;function Ha(e){return!!e&&!!e[qn]}function wi(e){var t;return e?X2(e)||Array.isArray(e)||!!e[Zb]||!!((t=e.constructor)!=null&&t[Zb])||im(e)||am(e):!1}var CB=Object.prototype.constructor.toString();function X2(e){if(!e||typeof e!="object")return!1;const t=Wa(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===CB}function Df(e,t){om(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function om(e){const t=e[qn];return t?t.type_:Array.isArray(e)?1:im(e)?2:am(e)?3:0}function Kg(e,t){return om(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q2(e,t,n){const r=om(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function jB(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function im(e){return e instanceof Map}function am(e){return e instanceof Set}function Bo(e){return e.copy_||e.base_}function Gg(e,t){if(im(e))return new Map(e);if(am(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=X2(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[qn];let s=Reflect.ownKeys(r);for(let o=0;o1&&(e.set=e.add=e.clear=e.delete=EB),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Hx(r,!0))),e}function EB(){kr(2)}function lm(e){return Object.isFrozen(e)}var NB={};function bi(e){const t=NB[e];return t||kr(0,e),t}var Yc;function J2(){return Yc}function TB(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function qb(e,t){t&&(bi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zg(e){qg(e),e.drafts_.forEach(PB),e.drafts_=null}function qg(e){e===Yc&&(Yc=e.parent_)}function Xb(e){return Yc=TB(Yc,e)}function PB(e){const t=e[qn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qb(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[qn].modified_&&(Zg(t),kr(4)),wi(e)&&(e=Of(t,e),t.parent_||If(t,e)),t.patches_&&bi("Patches").generateReplacementPatches_(n[qn].base_,e,t.patches_,t.inversePatches_)):e=Of(t,n,[]),Zg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==q2?e:void 0}function Of(e,t,n){if(lm(t))return t;const r=t[qn];if(!r)return Df(t,(s,o)=>Jb(e,r,t,s,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return If(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let o=s,i=!1;r.type_===3&&(o=new Set(s),s.clear(),i=!0),Df(o,(a,c)=>Jb(e,r,s,a,c,n,i)),If(e,s,!1),n&&e.patches_&&bi("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Jb(e,t,n,r,s,o,i){if(Ha(s)){const a=o&&t&&t.type_!==3&&!Kg(t.assigned_,r)?o.concat(r):void 0,c=Of(e,s,a);if(Q2(n,r,c),Ha(c))e.canAutoFreeze_=!1;else return}else i&&n.add(s);if(wi(s)&&!lm(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Of(e,s),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&If(e,s)}}function If(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hx(t,n)}function RB(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:J2(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,o=Yx;n&&(s=[r],o=Kc);const{revoke:i,proxy:a}=Proxy.revocable(s,o);return r.draft_=a,r.revoke_=i,a}var Yx={get(e,t){if(t===qn)return e;const n=Bo(e);if(!Kg(n,t))return AB(e,n,t);const r=n[t];return e.finalized_||!wi(r)?r:r===fp(e.base_,t)?(hp(e),e.copy_[t]=Qg(r,e)):r},has(e,t){return t in Bo(e)},ownKeys(e){return Reflect.ownKeys(Bo(e))},set(e,t,n){const r=eT(Bo(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const s=fp(Bo(e),t),o=s==null?void 0:s[qn];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(jB(n,s)&&(n!==void 0||Kg(e.base_,t)))return!0;hp(e),Xg(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fp(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,hp(e),Xg(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Bo(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){kr(11)},getPrototypeOf(e){return Wa(e.base_)},setPrototypeOf(){kr(12)}},Kc={};Df(Yx,(e,t)=>{Kc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Kc.deleteProperty=function(e,t){return Kc.set.call(this,e,t,void 0)};Kc.set=function(e,t,n){return Yx.set.call(this,e[0],t,n,e[0])};function fp(e,t){const n=e[qn];return(n?Bo(n):e)[t]}function AB(e,t,n){var s;const r=eT(t,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(e.draft_):void 0}function eT(e,t){if(!(t in e))return;let n=Wa(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wa(n)}}function Xg(e){e.modified_||(e.modified_=!0,e.parent_&&Xg(e.parent_))}function hp(e){e.copy_||(e.copy_=Gg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var DB=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const i=this;return function(c=o,...u){return i.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&kr(6),r!==void 0&&typeof r!="function"&&kr(7);let s;if(wi(t)){const o=Xb(this),i=Qg(t,void 0);let a=!0;try{s=n(i),a=!1}finally{a?Zg(o):qg(o)}return qb(o,r),Qb(s,o)}else if(!t||typeof t!="object"){if(s=n(t),s===void 0&&(s=t),s===q2&&(s=void 0),this.autoFreeze_&&Hx(s,!0),r){const o=[],i=[];bi("Patches").generateReplacementPatches_(t,s,o,i),r(o,i)}return s}else kr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...a)=>this.produceWithPatches(i,c=>t(c,...a));let r,s;return[this.produce(t,n,(i,a)=>{r=i,s=a}),r,s]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){wi(e)||kr(8),Ha(e)&&(e=OB(e));const t=Xb(this),n=Qg(e,void 0);return n[qn].isManual_=!0,qg(t),n}finishDraft(e,t){const n=e&&e[qn];(!n||!n.isManual_)&&kr(9);const{scope_:r}=n;return qb(r,t),Qb(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const s=t[n];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}n>-1&&(t=t.slice(n+1));const r=bi("Patches").applyPatches_;return Ha(e)?r(e,t):this.produce(e,s=>r(s,t))}};function Qg(e,t){const n=im(e)?bi("MapSet").proxyMap_(e,t):am(e)?bi("MapSet").proxySet_(e,t):RB(e,t);return(t?t.scope_:J2()).drafts_.push(n),n}function OB(e){return Ha(e)||kr(10,e),tT(e)}function tT(e){if(!wi(e)||lm(e))return e;const t=e[qn];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Gg(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Gg(e,!0);return Df(n,(r,s)=>{Q2(n,r,tT(s))}),t&&(t.finalized_=!1),n}var Xn=new DB,qr=Xn.produce;Xn.produceWithPatches.bind(Xn);Xn.setAutoFreeze.bind(Xn);Xn.setUseStrictShallowCopy.bind(Xn);Xn.applyPatches.bind(Xn);Xn.createDraft.bind(Xn);Xn.finishDraft.bind(Xn);const IB=({variables:e,onValueChange:t})=>{const[n,r]=g.useState([]),{t:s}=Ye();g.useEffect(()=>{e&&r(e)},[e]);const o=c=>{const u=n.findIndex(f=>f.key===c.key),d=qr(n,f=>{u===-1?f.push(c):f[u]=c});r(d),t==null||t(d)},i=c=>{const u=[...n];u.splice(c,1),r(u),t==null||t(u)},a=(c,u)=>{const d=[...n];d[c]=u,r(d),t==null||t(d)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex justify-between dark:text-stone-200",children:[l.jsx(Vt,{children:s("domain.deployment.form.variables.label")}),l.jsx(dr,{when:!!(n!=null&&n.length),children:l.jsx(mp,{variable:{key:"",value:""},trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:s("common.add")})]}),onSave:c=>{o(c)}})})]}),l.jsx(dr,{when:!!(n!=null&&n.length),fallback:l.jsxs("div",{className:"border rounded-md p-3 text-sm mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:s("domain.deployment.form.variables.empty")}),l.jsx(mp,{trigger:l.jsxs("div",{className:"flex items-center text-primary",children:[l.jsx(fi,{size:16,className:"cursor-pointer "}),l.jsx("div",{className:"text-sm ",children:s("common.add")})]}),variable:{key:"",value:""},onSave:c=>{o(c)}})]}),children:l.jsx("div",{className:"border p-3 rounded-md text-stone-700 text-sm dark:text-stone-200",children:n==null?void 0:n.map((c,u)=>l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("div",{children:[c.key,"=",c.value]}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(mp,{trigger:l.jsx(sv,{size:16,className:"cursor-pointer"}),variable:c,onSave:d=>{a(u,d)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{i(u)}})]})]},u))})})]})},mp=({variable:e,trigger:t,onSave:n})=>{const[r,s]=g.useState({key:"",value:""});g.useEffect(()=>{e&&s(e)},[e]);const{t:o}=Ye(),[i,a]=g.useState(!1),[c,u]=g.useState({}),d=()=>{if(!r.key){u({key:o("domain.deployment.form.variables.key.required")});return}if(!r.value){u({value:o("domain.deployment.form.variables.value.required")});return}n==null||n(r),a(!1),u({})};return l.jsxs(cl,{open:i,onOpenChange:()=>{a(!i)},children:[l.jsx(ul,{children:t}),l.jsxs(Ti,{className:"dark:text-stone-200",children:[l.jsxs(Pi,{className:"flex flex-col",children:[l.jsx(Ri,{children:o("domain.deployment.form.variables.label")}),l.jsxs("div",{className:"pt-5 flex flex-col items-start",children:[l.jsx(Vt,{children:o("domain.deployment.form.variables.key")}),l.jsx(pe,{placeholder:o("domain.deployment.form.variables.key.placeholder"),value:r==null?void 0:r.key,onChange:f=>{s({...r,key:f.target.value})},className:"w-full mt-1"}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c==null?void 0:c.key})]}),l.jsxs("div",{className:"pt-2 flex flex-col items-start",children:[l.jsx(Vt,{children:o("domain.deployment.form.variables.value")}),l.jsx(pe,{placeholder:o("domain.deployment.form.variables.value.placeholder"),value:r==null?void 0:r.value,onChange:f=>{s({...r,value:f.target.value})},className:"w-full mt-1"}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c==null?void 0:c.value})]})]}),l.jsx(Jh,{children:l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{onClick:()=>{d()},children:o("common.save")})})})]})]})},MB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let LB=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=MB[n[e]&63];return t};const nT=g.createContext({}),Ya=()=>g.useContext(nT),zB=({deploys:e,onChange:t})=>{const[n,r]=g.useState([]),{t:s}=Ye();g.useEffect(()=>{r(e)},[e]);const o=c=>{c.id=LB();const u=[...n,c];r(u),t(u)},i=c=>{const u=n.filter(d=>d.id!==c);r(u),t(u)},a=c=>{const u=n.map(d=>d.id===c.id?{...c}:d);r(u),t(u)};return l.jsx(l.Fragment,{children:l.jsxs(dr,{when:n.length>0,fallback:l.jsx(rm,{className:"w-full border dark:border-stone-400",children:l.jsxs(sm,{className:"flex flex-col items-center",children:[l.jsx("div",{children:s("domain.deployment.nodata")}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Jg,{onSave:c=>{o(c)},trigger:l.jsx(Me,{size:"sm",children:s("common.add")})})})]})}),children:[l.jsx("div",{className:"flex justify-end py-2 border-b dark:border-stone-400",children:l.jsx(Jg,{trigger:l.jsx(Me,{size:"sm",children:s("common.add")}),onSave:c=>{o(c)}})}),l.jsx("div",{className:"w-full md:w-[35em] rounded mt-5 border dark:border-stone-400 dark:text-stone-200",children:l.jsx("div",{className:"",children:n.map(c=>l.jsx(FB,{item:c,onDelete:()=>{i(c.id??"")},onSave:u=>{a(u)}},c.id))})})]})})},FB=({item:e,onDelete:t,onSave:n})=>{const{config:{accesses:r}}=cn(),{t:s}=Ye(),o=r.find(c=>c.id===e.access),i=()=>{if(!o)return"";const c=As.get(o.configType);return c?c[1]:""},a=()=>{if(!o)return"";const c=Rf.get(e.type);return c?s(c[0]):""};return l.jsxs("div",{className:"flex justify-between text-sm p-3 items-center text-stone-700 dark:text-stone-200",children:[l.jsxs("div",{className:"flex space-x-2 items-center",children:[l.jsx("div",{children:l.jsx("img",{src:i(),className:"w-9"})}),l.jsxs("div",{className:"text-stone-600 flex-col flex space-y-0 dark:text-stone-200",children:[l.jsx("div",{children:a()}),l.jsx("div",{children:o==null?void 0:o.name})]})]}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Jg,{trigger:l.jsx(sv,{size:16,className:"cursor-pointer"}),deployConfig:e,onSave:c=>{n(c)}}),l.jsx(ov,{size:16,className:"cursor-pointer",onClick:()=>{t()}})]})]})},Jg=({trigger:e,deployConfig:t,onSave:n})=>{const{config:{accesses:r}}=cn(),[s,o]=g.useState(),[i,a]=g.useState({access:"",type:""}),[c,u]=g.useState({}),[d,f]=g.useState(!1);g.useEffect(()=>{a(t?{...t}:{access:"",type:""})},[t]),g.useEffect(()=>{const w=i.type.split("-");console.log(w);let y;w&&w.length>1?y=w[1]:y=i.type,o(y),u({})},[i.type]);const h=g.useCallback(w=>{w.type!==i.type?a({...w,access:"",config:{}}):a({...w})},[i.type]),{t:m}=Ye(),x=r.filter(w=>{if(w.usage=="apply")return!1;if(i.type=="")return!0;const y=i.type.split("-");return w.configType===y[0]}),p=()=>{const w={...c};i.type===""?w.type=m("domain.deployment.form.access.placeholder"):w.type="",i.access===""?w.access=m("domain.deployment.form.access.placeholder"):w.access="",u(w);for(const y in w)if(w[y]!=="")return;n(i),a({access:"",type:""}),u({}),f(!1)};return l.jsx(nT.Provider,{value:{deploy:i,setDeploy:h,error:c,setError:u},children:l.jsxs(cl,{open:d,onOpenChange:f,children:[l.jsx(ul,{children:e}),l.jsxs(Ti,{className:"dark:text-stone-200",children:[l.jsxs(Pi,{children:[l.jsx(Ri,{children:m("history.page.title")}),l.jsx(O2,{})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:m("domain.deployment.form.type.label")}),l.jsxs($a,{value:i.type,onValueChange:w=>{h({...i,type:w})},children:[l.jsx(vi,{className:"mt-2",children:l.jsx(Ua,{placeholder:m("domain.deployment.form.type.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:m("domain.deployment.form.type.list")}),SB.map(w=>{var y,v;return l.jsx(Do,{value:w,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(y=Rf.get(w))==null?void 0:y[1]}),l.jsx("div",{children:m(((v=Rf.get(w))==null?void 0:v[0])??"")})]})},w)})]})})]}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c.type})]}),l.jsxs("div",{children:[l.jsxs(Vt,{className:"flex justify-between",children:[l.jsx("div",{children:m("domain.deployment.form.access.label")}),l.jsx(fa,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),m("common.add")]}),op:"add"})]}),l.jsxs($a,{value:i.access,onValueChange:w=>{h({...i,access:w})},children:[l.jsx(vi,{className:"mt-2",children:l.jsx(Ua,{placeholder:m("domain.deployment.form.access.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:m("domain.deployment.form.access.list")}),x.map(w=>{var y;return l.jsx(Do,{value:w.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(y=As.get(w.configType))==null?void 0:y[1]}),l.jsx("div",{children:w.name})]})},w.id)})]})})]}),l.jsx("div",{className:"text-red-500 text-sm mt-1",children:c.access})]}),l.jsx($B,{type:s}),l.jsx(Jh,{children:l.jsx(Me,{onClick:w=>{w.stopPropagation(),p()},children:m("common.save")})})]})]})})},$B=({type:e})=>(()=>{switch(e){case"ssh":return l.jsx(e1,{});case"local":return l.jsx(e1,{});case"cdn":return l.jsx(pp,{});case"dcdn":return l.jsx(pp,{});case"oss":return l.jsx(UB,{});case"webhook":return l.jsx(VB,{});default:return l.jsx(pp,{})}})(),e1=()=>{var s,o,i,a;const{t:e}=Ye(),{setError:t}=Ya();g.useEffect(()=>{t({})},[]);const{deploy:n,setDeploy:r}=Ya();return g.useEffect(()=>{n.id||r({...n,config:{certPath:"/etc/nginx/ssl/nginx.crt",keyPath:"/etc/nginx/ssl/nginx.key",preCommand:"",command:"sudo service nginx reload"}})},[]),l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col space-y-2",children:[l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_cert_path.label")}),l.jsx(pe,{placeholder:e("access.authorization.form.ssh_cert_path.label"),className:"w-full mt-1",value:(s=n==null?void 0:n.config)==null?void 0:s.certPath,onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.certPath=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_key_path.label")}),l.jsx(pe,{placeholder:e("access.authorization.form.ssh_key_path.placeholder"),className:"w-full mt-1",value:(o=n==null?void 0:n.config)==null?void 0:o.keyPath,onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.keyPath=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_pre_command.label")}),l.jsx(Af,{className:"mt-1",value:(i=n==null?void 0:n.config)==null?void 0:i.preCommand,placeholder:e("access.authorization.form.ssh_pre_command.placeholder"),onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.preCommand=c.target.value});r(u)}})]}),l.jsxs("div",{children:[l.jsx(Vt,{children:e("access.authorization.form.ssh_command.label")}),l.jsx(Af,{className:"mt-1",value:(a=n==null?void 0:n.config)==null?void 0:a.command,placeholder:e("access.authorization.form.ssh_command.placeholder"),onChange:c=>{const u=qr(n,d=>{d.config||(d.config={}),d.config.command=c.target.value});r(u)}})]})]})})},pp=()=>{var i;const{deploy:e,setDeploy:t,error:n,setError:r}=Ya(),{t:s}=Ye();g.useEffect(()=>{r({})},[]),g.useEffect(()=>{var c;const a=o.safeParse((c=e.config)==null?void 0:c.domain);a.success?r({...n,domain:""}):r({...n,domain:JSON.parse(a.error.message)[0].message})},[e]);const o=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:s("common.errmsg.domain_invalid")});return l.jsx("div",{className:"flex flex-col space-y-2",children:l.jsxs("div",{children:[l.jsx(Vt,{children:s("domain.deployment.form.cdn_domain.label")}),l.jsx(pe,{placeholder:s("domain.deployment.form.cdn_domain.placeholder"),className:"w-full mt-1",value:(i=e==null?void 0:e.config)==null?void 0:i.domain,onChange:a=>{const c=a.target.value,u=o.safeParse(c);u.success?r({...n,domain:""}):r({...n,domain:JSON.parse(u.error.message)[0].message});const d=qr(e,f=>{f.config||(f.config={}),f.config.domain=c});t(d)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.domain})]})})},UB=()=>{var a,c,u;const{deploy:e,setDeploy:t,error:n,setError:r}=Ya(),{t:s}=Ye();g.useEffect(()=>{r({})},[]),g.useEffect(()=>{var f;const d=o.safeParse((f=e.config)==null?void 0:f.domain);d.success?r({...n,domain:""}):r({...n,domain:JSON.parse(d.error.message)[0].message})},[e]),g.useEffect(()=>{var f;const d=i.safeParse((f=e.config)==null?void 0:f.domain);d.success?r({...n,bucket:""}):r({...n,bucket:JSON.parse(d.error.message)[0].message})},[]),g.useEffect(()=>{e.id||t({...e,config:{endpoint:"oss-cn-hangzhou.aliyuncs.com",bucket:"",domain:""}})},[]);const o=ce.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:s("common.errmsg.domain_invalid")}),i=ce.string().min(1,{message:s("domain.deployment.form.oss_bucket.placeholder")});return l.jsx("div",{className:"flex flex-col space-y-2",children:l.jsxs("div",{children:[l.jsx(Vt,{children:s("domain.deployment.form.oss_endpoint.label")}),l.jsx(pe,{className:"w-full mt-1",value:(a=e==null?void 0:e.config)==null?void 0:a.endpoint,onChange:d=>{const f=d.target.value,h=qr(e,m=>{m.config||(m.config={}),m.config.endpoint=f});t(h)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.endpoint}),l.jsx(Vt,{children:s("domain.deployment.form.oss_bucket")}),l.jsx(pe,{placeholder:s("domain.deployment.form.oss_bucket.placeholder"),className:"w-full mt-1",value:(c=e==null?void 0:e.config)==null?void 0:c.bucket,onChange:d=>{const f=d.target.value,h=i.safeParse(f);h.success?r({...n,bucket:""}):r({...n,bucket:JSON.parse(h.error.message)[0].message});const m=qr(e,x=>{x.config||(x.config={}),x.config.bucket=f});t(m)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.bucket}),l.jsx(Vt,{children:s("domain.deployment.form.cdn_domain.label")}),l.jsx(pe,{placeholder:s("domain.deployment.form.cdn_domain.label"),className:"w-full mt-1",value:(u=e==null?void 0:e.config)==null?void 0:u.domain,onChange:d=>{const f=d.target.value,h=o.safeParse(f);h.success?r({...n,domain:""}):r({...n,domain:JSON.parse(h.error.message)[0].message});const m=qr(e,x=>{x.config||(x.config={}),x.config.domain=f});t(m)}}),l.jsx("div",{className:"text-red-600 text-sm mt-1",children:n==null?void 0:n.domain})]})})},VB=()=>{var r;const{deploy:e,setDeploy:t}=Ya(),{setError:n}=Ya();return g.useEffect(()=>{n({})},[]),l.jsx(l.Fragment,{children:l.jsx(IB,{variables:(r=e==null?void 0:e.config)==null?void 0:r.variables,onValueChange:s=>{const o=qr(e,i=>{i.config||(i.config={}),i.config.variables=s});t(o)}})})},rT=g.forwardRef(({...e},t)=>l.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));rT.displayName="Breadcrumb";const sT=g.forwardRef(({className:e,...t},n)=>l.jsx("ol",{ref:n,className:re("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));sT.displayName="BreadcrumbList";const ey=g.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:re("inline-flex items-center gap-1.5",e),...t}));ey.displayName="BreadcrumbItem";const oT=g.forwardRef(({asChild:e,className:t,...n},r)=>{const s=e?ts:"a";return l.jsx(s,{ref:r,className:re("transition-colors hover:text-foreground",t),...n})});oT.displayName="BreadcrumbLink";const iT=g.forwardRef(({className:e,...t},n)=>l.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:re("font-normal text-foreground",e),...t}));iT.displayName="BreadcrumbPage";const aT=({children:e,className:t,...n})=>l.jsx("li",{role:"presentation","aria-hidden":"true",className:re("[&>svg]:size-3.5",t),...n,children:e??l.jsx(XS,{})});aT.displayName="BreadcrumbSeparator";const BB=()=>{const{config:{accesses:e,emails:t}}=cn(),[n,r]=g.useState({}),s=Mr(),{t:o}=Ye(),[i,a]=g.useState("apply");g.useEffect(()=>{const x=new URLSearchParams(s.search).get("id");x&&(async()=>{const w=await ZU(x);r(w)})()},[s.search]);const c=ce.object({id:ce.string().optional(),domain:ce.string().min(1,{message:"common.errmsg.domain_invalid"}),email:ce.string().email("common.errmsg.email_invalid").optional(),access:ce.string().regex(/^[a-zA-Z0-9]+$/,{message:"domain.application.form.access.errmsg.empty"}),nameservers:ce.string().optional(),timeout:ce.number().optional()}),u=un({resolver:dn(c),defaultValues:{id:"",domain:"",email:"",access:"",nameservers:"",timeout:60}});g.useEffect(()=>{var m,x,p,w;n&&u.reset({id:n.id,domain:n.domain,email:(m=n.applyConfig)==null?void 0:m.email,access:(x=n.applyConfig)==null?void 0:x.access,nameservers:(p=n.applyConfig)==null?void 0:p.nameservers,timeout:(w=n.applyConfig)==null?void 0:w.timeout})},[n,u]);const{toast:d}=Fr(),f=async m=>{console.log(m);const x={id:m.id,crontab:"0 0 * * *",domain:m.domain,email:m.email,access:m.access,applyConfig:{email:m.email??"",access:m.access,nameservers:m.nameservers,timeout:m.timeout}};try{const p=await pf(x);let w=o("domain.application.form.domain.changed.message");x.id==""&&(w=o("domain.application.form.domain.added.message")),d({title:o("common.save.succeeded.message"),description:w}),n!=null&&n.id||a("deploy"),r({...p})}catch(p){Object.entries(p.response.data).forEach(([y,v])=>{u.setError(y,{type:"manual",message:v.message})});return}},h=async m=>{const x={...n,deployConfig:m};try{const p=await pf(x);let w=o("domain.application.form.domain.changed.message");x.id==""&&(w=o("domain.application.form.domain.added.message")),d({title:o("common.save.succeeded.message"),description:w}),n!=null&&n.id||a("deploy"),r({...p})}catch(p){Object.entries(p.response.data).forEach(([y,v])=>{u.setError(y,{type:"manual",message:v.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(Rx,{}),l.jsx("div",{className:" h-5 text-muted-foreground",children:l.jsx(rT,{children:l.jsxs(sT,{children:[l.jsx(ey,{children:l.jsx(oT,{href:"#/domains",children:o("domain.page.title")})}),l.jsx(aT,{}),l.jsx(ey,{children:l.jsx(iT,{children:n!=null&&n.id?o("domain.edit"):o("domain.add")})})]})})}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex md:mt-5",children:[l.jsx("div",{className:re("cursor-pointer text-right",i==="apply"?"text-primary":""),onClick:()=>{a("apply")},children:o("domain.application.tab")}),l.jsx("div",{className:re("cursor-pointer text-right",i==="deploy"?"text-primary":""),onClick:()=>{if(!(n!=null&&n.id)){d({title:o("domain.application.unsaved.message"),description:o("domain.application.unsaved.message"),variant:"destructive"});return}a("deploy")},children:o("domain.deployment.tab")})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:re("w-full md:w-[35em] p-5 rounded mt-3 md:mt-0",i=="deploy"&&"hidden"),children:l.jsx(fn,{...u,children:l.jsxs("form",{onSubmit:u.handleSubmit(f),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:u.control,name:"domain",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(l.Fragment,{children:l.jsx(Gb,{value:m.value,valueType:"domain",onValueChange:x=>{u.setValue("domain",x)}})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"email",render:({field:m})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"flex w-full justify-between",children:[l.jsx("div",{children:o("domain.application.form.email.label")+" "+o("domain.application.form.email.tips")}),l.jsx(_B,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),o("common.add")]})})]}),l.jsx(je,{children:l.jsxs($a,{...m,value:m.value,onValueChange:x=>{u.setValue("email",x)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:o("domain.application.form.email.errmsg.empty")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:o("domain.application.form.email.list")}),t.content.emails.map(x=>l.jsx(Do,{value:x,children:l.jsx("div",{children:x})},x))]})})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"access",render:({field:m})=>l.jsxs(Se,{children:[l.jsxs(Ce,{className:"flex w-full justify-between",children:[l.jsx("div",{children:o("domain.application.form.access.label")}),l.jsx(fa,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(fi,{size:14}),o("common.add")]}),op:"add"})]}),l.jsx(je,{children:l.jsxs($a,{...m,value:m.value,onValueChange:x=>{u.setValue("access",x)},children:[l.jsx(vi,{children:l.jsx(Ua,{placeholder:o("domain.application.form.access.placeholder")})}),l.jsx(xi,{children:l.jsxs(Hc,{children:[l.jsx(Va,{children:o("domain.application.form.access.list")}),e.filter(x=>x.usage!="deploy").map(x=>{var p;return l.jsx(Do,{value:x.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(p=As.get(x.configType))==null?void 0:p[1]}),l.jsx("div",{children:x.name})]})},x.id)})]})})]})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"timeout",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:o("domain.application.form.timeout.label")}),l.jsx(je,{children:l.jsx(pe,{type:"number",placeholder:o("ddomain.application.form.timeout.placeholder"),...m,value:m.value,onChange:x=>{u.setValue("timeout",parseInt(x.target.value))}})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:u.control,name:"nameservers",render:({field:m})=>l.jsxs(Se,{children:[l.jsx(Gb,{value:m.value??"",onValueChange:x=>{u.setValue("nameservers",x)},valueType:"dns"}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:n!=null&&n.id?o("common.save"):o("common.next")})})]})})}),l.jsx("div",{className:re("flex flex-col space-y-5 w-full md:w-[35em]",i=="apply"&&"hidden"),children:l.jsx(zB,{deploys:(n==null?void 0:n.deployConfig)??[],onChange:m=>{h(m)}})})]})]})]})})},lT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));lT.displayName="Card";const cT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("flex flex-col space-y-1.5 p-6",e),...t}));cT.displayName="CardHeader";const uT=g.forwardRef(({className:e,...t},n)=>l.jsx("h3",{ref:n,className:re("text-2xl font-semibold leading-none tracking-tight",e),...t}));uT.displayName="CardTitle";const dT=g.forwardRef(({className:e,...t},n)=>l.jsx("p",{ref:n,className:re("text-sm text-muted-foreground",e),...t}));dT.displayName="CardDescription";const fT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("p-6 pt-0",e),...t}));fT.displayName="CardContent";const hT=g.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:re("flex items-center p-6 pt-0",e),...t}));hT.displayName="CardFooter";const Us=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",WB=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=cn(),{toast:n}=Fr(),r=er(),{t:s}=Ye(),o=async a=>{try{await y$(a),t()}catch(c){n({title:s("common.delete.failed.message"),description:Us(c),variant:"destructive"});return}},i=()=>{r("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(dr,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(Uw,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:s("access.group.domains.nodata")}),l.jsx(Bx,{trigger:l.jsx(Me,{children:s("access.group.add")}),className:"mt-3"})]})})}),l.jsx(nm,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(a=>l.jsxs(lT,{className:"w-full md:w-[350px]",children:[l.jsxs(cT,{children:[l.jsx(uT,{children:a.name}),l.jsx(dT,{children:s("access.group.total",{total:a.expand?a.expand.access.length:0})})]}),l.jsx(fT,{className:"min-h-[180px]",children:a.expand?l.jsx(l.Fragment,{children:a.expand.access.slice(0,3).map(c=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:Kb(c.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:c.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:Kb(c.configType)[0]})]})]})},c.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(Uw,{size:40})}),l.jsx("div",{className:"ml-2",children:s("access.group.nodata")})]})})}),l.jsx(hT,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(dr,{when:!!(a.expand&&a.expand.access.length>0),children:l.jsx("div",{children:l.jsx(Me,{size:"sm",variant:"link",onClick:()=>{r(`/access?accessGroupId=${a.id}&tab=access`,{replace:!0})},children:s("access.group.domains")})})}),l.jsx(dr,{when:!a.expand||a.expand.access.length==0,children:l.jsx("div",{children:l.jsx(Me,{size:"sm",onClick:i,children:s("access.authorization.add")})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"destructive",size:"sm",children:s("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{className:"dark:text-gray-200",children:s("access.group.delete")}),l.jsx(Uh,{children:s("access.group.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{className:"dark:text-gray-200",children:s("common.cancel")}),l.jsx(Vh,{onClick:()=>{o(a.id?a.id:"")},children:s("common.confirm")})]})]})]})})]})})]}))})})]})};var Kx="Tabs",[HB,e9]=an(Kx,[rl]),mT=rl(),[YB,Gx]=HB(Kx),pT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=ki(a),[f,h]=Zn({prop:r,onChange:s,defaultProp:o});return l.jsx(YB,{scope:n,baseId:Wn(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:l.jsx(Pe.div,{dir:d,"data-orientation":i,...u,ref:t})})});pT.displayName=Kx;var gT="TabsList",yT=g.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Gx(gT,n),i=mT(n);return l.jsx(Cv,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(Pe.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});yT.displayName=gT;var vT="TabsTrigger",xT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Gx(vT,n),a=mT(n),c=_T(i.baseId,r),u=ST(i.baseId,r),d=r===i.value;return l.jsx(jv,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Pe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:ue(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:ue(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(r)})})})});xT.displayName=vT;var wT="TabsContent",bT=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=Gx(wT,n),c=_T(a.baseId,r),u=ST(a.baseId,r),d=r===a.value,f=g.useRef(d);return g.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(ln,{present:s||d,children:({present:h})=>l.jsx(Pe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});bT.displayName=wT;function _T(e,t){return`${e}-trigger-${t}`}function ST(e,t){return`${e}-content-${t}`}var KB=pT,kT=yT,CT=xT,jT=bT;const ET=KB,Zx=g.forwardRef(({className:e,...t},n)=>l.jsx(kT,{ref:n,className:re("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Zx.displayName=kT.displayName;const Jo=g.forwardRef(({className:e,...t},n)=>l.jsx(CT,{ref:n,className:re("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Jo.displayName=CT.displayName;const Mf=g.forwardRef(({className:e,...t},n)=>l.jsx(jT,{ref:n,className:re("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Mf.displayName=jT.displayName;const GB={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Lf{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||GB,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{let[a,c]=i;for(let u=0;u{let[a,c]=i;for(let u=0;u{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},t1=e=>e==null?"":""+e,ZB=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},qB=/###/g,n1=e=>e&&e.indexOf("###")>-1?e.replace(qB,"."):e,r1=e=>!e||typeof e=="string",nc=(e,t,n)=>{const r=typeof t!="string"?t:t.split(".");let s=0;for(;s{const{obj:r,k:s}=nc(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),a=nc(e,i,Object);for(;a.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),a=nc(e,i,Object),a&&a.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=n},XB=(e,t,n,r)=>{const{obj:s,k:o}=nc(e,t,Object);s[o]=s[o]||[],s[o].push(n)},zf=(e,t)=>{const{obj:n,k:r}=nc(e,t);if(n)return n[r]},QB=(e,t,n)=>{const r=zf(e,n);return r!==void 0?r:zf(t,n)},NT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):NT(e[r],t[r],n):e[r]=t[r]);return e},Wi=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var JB={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const eW=e=>typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>JB[t]):e;class tW{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const nW=[" ",",","?","!",";"],rW=new tW(20),sW=(e,t,n)=>{t=t||"",n=n||"";const r=nW.filter(i=>t.indexOf(i)<0&&n.indexOf(i)<0);if(r.length===0)return!0;const s=rW.getRegExp(`(${r.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!s.test(e);if(!o){const i=e.indexOf(n);i>0&&!s.test(e.substring(0,i))&&(o=!0)}return o},ty=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let o=0;o-1&&ce&&e.indexOf("_")>0?e.replace("_","-"):e;class o1 extends cm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,i=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):typeof r=="string"&&o?a.push(...r.split(o)):a.push(r)));const c=zf(this.data,a);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),c||!i||typeof r!="string"?c:ty(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,s){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(i?r.split(i):r)),t.indexOf(".")>-1&&(a=t.split("."),s=n,n=a[1]),this.addNamespaces(n),s1(this.data,a,s),o.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,o){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),s=r,r=n,n=a[1]),this.addNamespaces(n);let c=zf(this.data,a)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?NT(c,r,o):c={...c,...r},s1(this.data,a,c),i.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var TT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,s))}),t}};const i1={};class $f extends cm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ZB(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Xr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const i=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!sW(t,r,s);if(i&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(s)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(t[t.length-1],n),c=a[a.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const _=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${_}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${_}${i}`}return s?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:i}const f=this.resolve(t,n);let h=f&&f.res;const m=f&&f.usedKey||i,x=f&&f.exactUsedKey||i,p=Object.prototype.toString.apply(h),w=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&h&&(typeof h!="string"&&typeof h!="boolean"&&typeof h!="number")&&w.indexOf(p)<0&&!(typeof y=="string"&&Array.isArray(h))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const _=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,h,{...n,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return s?(f.res=_,f.usedParams=this.getUsedParamsDetails(n),f):_}if(o){const _=Array.isArray(h),C=_?[]:{},j=_?x:m;for(const T in h)if(Object.prototype.hasOwnProperty.call(h,T)){const R=`${j}${o}${T}`;C[T]=this.translate(R,{...n,joinArrays:!1,ns:a}),C[T]===R&&(C[T]=h[T])}h=C}}else if(v&&typeof y=="string"&&Array.isArray(h))h=h.join(y),h&&(h=this.extendTranslation(h,t,n,r));else{let _=!1,C=!1;const j=n.count!==void 0&&typeof n.count!="string",T=$f.hasDefaultValue(n),R=j?this.pluralResolver.getSuffix(u,n.count,n):"",A=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",O=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),G=O&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${A}`]||n.defaultValue;!this.isValidLookup(h)&&T&&(_=!0,h=G),this.isValidLookup(h)||(C=!0,h=i);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:h,S=T&&G!==h&&this.options.updateMissing;if(C||_||S){if(this.logger.log(S?"updateKey":"missingKey",u,c,i,S?G:h),o){const W=this.resolve(i,{...n,keySeparator:!1});W&&W.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let U=[];const J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(let W=0;W{const $=T&&X!==h?X:z;this.options.missingKeyHandler?this.options.missingKeyHandler(W,c,I,$,S,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(W,c,I,$,S,n),this.emit("missingKey",W,c,I,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?U.forEach(W=>{const I=this.pluralResolver.getSuffixes(W,n);O&&n[`defaultValue${this.options.pluralSeparator}zero`]&&I.indexOf(`${this.options.pluralSeparator}zero`)<0&&I.push(`${this.options.pluralSeparator}zero`),I.forEach(X=>{F([W],i+X,n[`defaultValue${X}`]||G)})}):F(U,i,G))}h=this.extendTranslation(h,t,n,f,r),C&&h===i&&this.options.appendNamespaceToMissingKey&&(h=`${c}:${i}`),(C||_)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${i}`:i,_?h:void 0):h=this.options.parseMissingKeyHandler(h))}return s?(f.res=h,f.usedParams=this.getUsedParamsDetails(n),f):h}extendTranslation(t,n,r,s,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const h=t.match(this.interpolator.nestingRegexp);d=h&&h.length}let f=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),u){const h=t.match(this.interpolator.nestingRegexp),m=h&&h.length;d1&&arguments[1]!==void 0?arguments[1]:{},r,s,o,i,a;return typeof t=="string"&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;s=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=n.count!==void 0&&typeof n.count!="string",m=h&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),x=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",p=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(w=>{this.isValidLookup(r)||(a=w,!i1[`${p[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(i1[`${p[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(y=>{if(this.isValidLookup(r))return;i=y;const v=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,y,w,n);else{let _;h&&(_=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(v.push(d+_),n.ordinal&&_.indexOf(j)===0&&v.push(d+_.replace(j,this.options.pluralSeparator)),m&&v.push(d+C)),x){const T=`${d}${this.options.contextSeparator}${n.context}`;v.push(T),h&&(v.push(T+_),n.ordinal&&_.indexOf(j)===0&&v.push(T+_.replace(j,this.options.pluralSeparator)),m&&v.push(T+C))}}let b;for(;b=v.pop();)this.isValidLookup(r)||(o=b,r=this.getResource(y,w,b,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,usedLng:i,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const o of n)delete s[o]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const gp=e=>e.charAt(0).toUpperCase()+e.slice(1);class a1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Xr.create("languageUtils")}getScriptPartFromCode(t){if(t=Ff(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Ff(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=gp(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=gp(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=gp(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],o=i=>{i&&(this.isSupportedCode(i)?s.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(i=>{s.indexOf(i)<0&&o(this.formatLanguageCode(i))}),s}}let oW=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],iW={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const aW=["v1","v2","v3"],lW=["v4"],l1={zero:0,one:1,two:2,few:3,many:4,other:5},cW=()=>{const e={};return oW.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:iW[t.fc]}})}),e};class uW{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Xr.create("pluralResolver"),(!this.options.compatibilityJSON||lW.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=cW(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const r=Ff(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];const i=new Intl.PluralRules(r,{type:s});return this.pluralRulesCache[o]=i,i}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,o)=>l1[s]-l1[o]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const o=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!aW.includes(this.options.compatibilityJSON)}}const c1=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=QB(e,t,n);return!o&&s&&typeof n=="string"&&(o=ty(e,n,r),o===void 0&&(o=ty(t,n,r))),o},yp=e=>e.replace(/\$/g,"$$$$");class dW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:m,nestingSuffix:x,nestingSuffixEscaped:p,nestingOptionsSeparator:w,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:eW,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Wi(o):i||"{{",this.suffix=a?Wi(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=h?Wi(h):m||Wi("$t("),this.nestingSuffix=x?Wi(x):p||Wi(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,i,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=m=>{if(m.indexOf(this.formatSeparator)<0){const y=c1(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:m}):y}const x=m.split(this.formatSeparator),p=x.shift().trim(),w=x.join(this.formatSeparator).trim();return this.format(c1(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:p})};this.resetRegExp();const d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>yp(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?yp(this.escape(m)):yp(m)}].forEach(m=>{for(a=0;o=m.regex.exec(t);){const x=o[1].trim();if(i=u(x),i===void 0)if(typeof d=="function"){const w=d(t,o,s);i=typeof w=="string"?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,x))i="";else if(f){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${t}`),i="";else typeof i!="string"&&!this.useRawValueToEscape&&(i=t1(i));const p=m.safeValue(i);if(t=t.replace(o[0],p),f?(m.regex.lastIndex+=i.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,o,i;const a=(c,u)=>{const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const f=c.split(new RegExp(`${d}[ ]*{`));let h=`{${f[1]}`;c=f[0],h=this.interpolate(h,i);const m=h.match(/'/g),x=h.match(/"/g);(m&&m.length%2===0&&!x||x.length%2!==0)&&(h=h.replace(/'/g,'"'));try{i=JSON.parse(h),u&&(i={...u,...i})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,p),`${c}${d}${h}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];i={...r},i=i.replace&&typeof i.replace!="string"?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const d=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=d.shift(),c=d,u=!0}if(o=n(a.call(this,s[1].trim(),i),i),o&&s[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=t1(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u&&(o=c.reduce((d,f)=>this.format(d,f,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const fW=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(i=>{if(i){const[a,...c]=i.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Hi=e=>{const t={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const i=r+JSON.stringify(o);let a=t[i];return a||(a=e(Ff(r),s),t[i]=a),a(n)}};class hW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.create("formatter"),this.options=t,this.formats={number:Hi((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return o=>s.format(o)}),currency:Hi((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>s.format(o)}),datetime:Hi((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return o=>s.format(o)}),relativetime:Hi((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return o=>s.format(o,r.range||"day")}),list:Hi((n,r)=>{const s=new Intl.ListFormat(n,{...r});return o=>s.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Hi(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(a=>a.indexOf(")")>-1)){const a=o.findIndex(c=>c.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,c)=>{const{formatName:u,formatOptions:d}=fW(c);if(this.formats[u]){let f=a;try{const h=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},m=h.locale||h.lng||s.locale||s.lng||r;f=this.formats[u](a,m,{...d,...s,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const mW=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class pW extends cm{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Xr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const o={},i={},a={},c={};return t.forEach(u=>{let d=!0;n.forEach(f=>{const h=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?i[h]===void 0&&(i[h]=!0):(this.state[h]=1,d=!1,i[h]===void 0&&(i[h]=!0),o[h]===void 0&&(o[h]=!0),c[f]===void 0&&(c[f]=!0)))}),d||(a[u]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),o=s[0],i=s[1];n&&this.emit("failedLoading",o,i,n),!n&&r&&this.store.addResourceBundle(o,i,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(c=>{XB(c.loaded,[o],i),mW(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const d=c.loaded[u];d.length&&d.forEach(f=>{a[u][f]===void 0&&(a[u][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:o,callback:i});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&d&&s{this.read.call(this,t,n,r,s+1,o*2,i)},o);return}i(u,d)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],o=r[1];this.read(s,o,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,i),!i&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,a),this.loaded(t,i,a)})}saveMissing(t,n,r,s,o){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...i,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,s,c):d=u(t,n,r,s),d&&typeof d.then=="function"?d.then(f=>a(null,f)).catch(a):a(null,d)}catch(d){a(d)}else u(t,n,r,s,a,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const u1=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),d1=e=>(typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),sd=()=>{},gW=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Gc extends cm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=d1(t),this.services={},this.logger=Xr,this.modules={external:[]},gW(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=u1();this.options={...s,...this.options,...d1(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Xr.init(o(this.modules.logger),this.options):Xr.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=hW);const f=new a1(this.options);this.store=new o1(this.options.resources,this.options);const h=this.services;h.logger=Xr,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new uW(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=o(d),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new dW(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new pW(o(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(m){for(var x=arguments.length,p=new Array(x>1?x-1:0),w=1;w1?x-1:0),w=1;w{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,r||(r=sd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const c=Nl(),u=()=>{const d=(f,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(h),r(f,h)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sd;const s=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.push(u)})};s?i(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>i(c)),this.options.preload&&this.options.preload.forEach(a=>i(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const s=Nl();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=sd),this.services.backendConnector.reload(t,n,o=>{s.resolve(),r(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&TT.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=Nl();this.emit("languageChanging",t);const o=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},i=(c,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=typeof c=="string"?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{i(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),s}getFixedT(t,n,r){var s=this;const o=function(i,a){let c;if(typeof a!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),f=2;f`${c.keyPrefix}${h}${x}`):m=c.keyPrefix?`${c.keyPrefix}${h}${i}`:i,s.t(m,c)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!s||i(o,t)))}loadNamespaces(t,n){const r=Nl();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Nl();typeof t=="string"&&(t=[t]);const s=this.options.preload||[],o=t.filter(i=>s.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=s.concat(o),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new a1(u1());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Gc(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sd;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new Gc(s);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new o1(this.store.data,s),o.services.resourceStore=o.store),o.translator=new $f(o.services,s),o.translator.on("*",function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d{const{config:e,deleteAccess:t}=cn(),{accesses:n}=e,r=10,s=Math.ceil(n.length/r),o=er(),i=Mr(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),h=(u-1)*r,m=h+r,x=async w=>{const y=await g$(w);t(y.id)},p=w=>{a.set("tab",w),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:Wt("access.page.title")}),d!="access_group"?l.jsx(fa,{trigger:l.jsx(Me,{children:Wt("access.authorization.add")}),op:"add"}):l.jsx(Bx,{trigger:l.jsx(Me,{children:Wt("access.group.add")})})]}),l.jsxs(ET,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(Zx,{className:"space-x-5 px-3",children:[l.jsx(Jo,{value:"access",onClick:()=>{p("access")},children:Wt("access.authorization.tab")}),l.jsx(Jo,{value:"access_group",onClick:()=>{p("access_group")},children:Wt("access.group.tab")})]}),l.jsx(Mf,{value:"access",children:n.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(MO,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:Wt("access.authorization.nodata")}),l.jsx(fa,{trigger:l.jsx(Me,{children:Wt("access.authorization.add")}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:Wt("common.text.name")}),l.jsx("div",{className:"w-48",children:Wt("common.text.provider")}),l.jsx("div",{className:"w-60",children:Wt("common.text.created_at")}),l.jsx("div",{className:"w-60",children:Wt("common.text.updated_at")}),l.jsx("div",{className:"grow",children:Wt("common.text.operations")})]}),n.filter(w=>f?w.group==f:!0).slice(h,m).map(w=>{var y,v;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:w.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(y=As.get(w.configType))==null?void 0:y[1],className:"w-6"}),l.jsx("div",{children:Wt(((v=As.get(w.configType))==null?void 0:v[0])||"")})]}),l.jsx("div",{className:"sm:w-60 w-full pt-1 sm:pt-0 flex items-center",children:w.created&&Ma(w.created)}),l.jsx("div",{className:"sm:w-60 w-full pt-1 sm:pt-0 flex items-center",children:w.updated&&Ma(w.updated)}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(fa,{trigger:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.edit")}),op:"edit",data:w}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(fa,{trigger:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.copy")}),op:"copy",data:w}),l.jsx(_r,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(kx,{children:[l.jsx(Cx,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:Wt("common.delete")})}),l.jsxs(Lh,{children:[l.jsxs(zh,{children:[l.jsx($h,{className:"dark:text-gray-200",children:Wt("access.authorization.delete")}),l.jsx(Uh,{children:Wt("access.authorization.delete.confirm")})]}),l.jsxs(Fh,{children:[l.jsx(Bh,{className:"dark:text-gray-200",children:Wt("common.cancel")}),l.jsx(Vh,{onClick:()=>{x(w)},children:Wt("common.confirm")})]})]})]})]})]},w.id)}),l.jsx(wE,{totalPages:s,currentPage:u,onPageChange:w=>{a.set("page",w.toString()),o({search:a.toString()})}})]})}),l.jsx(Mf,{value:"access_group",children:l.jsx(WB,{})})]})]})},PT=async e=>{let t=1;e.page&&(t=e.page);let n=50;e.perPage&&(n=e.perPage);let r="domain!=null";return e.domain&&(r=`domain="${e.domain}"`),await ot().collection("deployments").getList(t,n,{filter:r,sort:"-deployedAt",expand:"domain"})},vW=()=>{const e=er(),[t,n]=g.useState(),[r]=kO(),{t:s}=Ye(),o=r.get("domain");return g.useEffect(()=>{(async()=>{const a={};o&&(a.domain=o);const c=await PT(a);n(c.items)})()},[o]),l.jsxs(nm,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:s("history.page.title")}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:s("history.props.domain")}),l.jsx("div",{className:"w-24",children:s("history.props.status")}),l.jsx("div",{className:"w-56",children:s("history.props.stage")}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:s("history.props.last_execution_time")}),l.jsx("div",{className:"grow",children:s("common.text.operations")})]}),t==null?void 0:t.map(i=>{var a,c;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(a=i.expand.domain)==null?void 0:a.domain.split(";").map(u=>l.jsxs(l.Fragment,{children:[u,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Sx,{deployment:i})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(xx,{phase:i.phase,phaseSuccess:i.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ma(i.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(Hv,{children:[l.jsx(Yv,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:s("history.log")})}),l.jsxs(bh,{className:"sm:max-w-5xl",children:[l.jsx(Kv,{children:l.jsxs(Gv,{children:[(c=i.expand.domain)==null?void 0:c.domain,"-",i.id,s("history.log")]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[i.log.check&&l.jsx(l.Fragment,{children:i.log.check.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.apply&&l.jsx(l.Fragment,{children:i.log.apply.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.info&&u.info.map(d=>l.jsx("div",{className:"mt-1 text-green-600",children:d})),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.deploy&&l.jsx(l.Fragment,{children:i.log.deploy.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))})]})]})]})})]},i.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(rm,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(Wx,{children:s("common.text.nodata")}),l.jsxs(sm,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(JS,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ",s("history.nodata")]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(Me,{onClick:()=>{e("/")},children:s("domain.add")})})]})]})})]})},xW=ce.object({username:ce.string().email({message:"login.username.errmsg.invalid"}),password:ce.string().min(10,{message:"login.password.errmsg.invalid"})}),wW=()=>{const{t:e}=Ye(),t=un({resolver:dn(xW),defaultValues:{username:"",password:""}}),n=async s=>{try{await ot().admins.authWithPassword(s.username,s.password),r("/")}catch(o){const i=Us(o);t.setError("username",{message:i}),t.setError("password",{message:i})}},r=er();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(fn,{...t,children:l.jsxs("form",{onSubmit:t.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:t.control,name:"username",render:({field:s})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("login.username.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("login.username.placeholder"),...s})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:t.control,name:"password",render:({field:s})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("login.password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("login.password.placeholder"),...s,type:"password"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:e("login.submit")})})]})})]})},bW=()=>ot().authStore.isValid&&ot().authStore.isAdmin?l.jsx(GS,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(nv,{}),l.jsx(iE,{})]}),_W=ce.object({oldPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"}),newPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"}),confirmPassword:ce.string().min(10,{message:"settings.password.password.errmsg.length"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"settings.password.password.errmsg.not_matched",path:["confirmPassword"]}),SW=()=>{const{toast:e}=Fr(),t=er(),{t:n}=Ye(),r=un({resolver:dn(_W),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),s=async o=>{var i,a;try{await ot().admins.authWithPassword((i=ot().authStore.model)==null?void 0:i.email,o.oldPassword)}catch(c){const u=Us(c);r.setError("oldPassword",{message:u})}try{await ot().admins.update((a=ot().authStore.model)==null?void 0:a.id,{password:o.newPassword,passwordConfirm:o.confirmPassword}),ot().authStore.clear(),e({title:n("settings.password.changed.message"),description:n("settings.account.relogin.message")}),setTimeout(()=>{t("/login")},500)}catch(c){const u=Us(c);e({title:n("settings.password.failed.message"),description:u,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(s),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:r.control,name:"oldPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.current_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.current_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:r.control,name:"newPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.new_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.new_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:r.control,name:"confirmPassword",render:({field:o})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.password.confirm_password.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.password.confirm_password.placeholder"),...o,type:"password"})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:n("common.update")})})]})})})})},kW=()=>{const e=Mr(),[t,n]=g.useState("account"),r=er(),{t:s}=Ye();return g.useEffect(()=>{const i=e.pathname.split("/")[2];n(i)},[e]),l.jsxs("div",{children:[l.jsx(Rx,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:s("settings.page.title")}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(ET,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(Zx,{className:"mx-auto",children:[l.jsxs(Jo,{value:"account",onClick:()=>{r("/setting/account")},className:"px-5",children:[l.jsx(HO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.account.tab")})]}),l.jsxs(Jo,{value:"password",onClick:()=>{r("/setting/password")},className:"px-5",children:[l.jsx(IO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.password.tab")})]}),l.jsxs(Jo,{value:"notify",onClick:()=>{r("/setting/notify")},className:"px-5",children:[l.jsx(FO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.notification.tab")})]}),l.jsxs(Jo,{value:"ssl-provider",onClick:()=>{r("/setting/ssl-provider")},className:"px-5",children:[l.jsx(VO,{size:14}),l.jsx("div",{className:"ml-1",children:s("settings.ca.tab")})]})]}),l.jsx(Mf,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(nv,{})})})]})})]})},CW=()=>{const[e,t]=g.useState(),[n,r]=g.useState(),s=er(),{t:o}=Ye();return g.useEffect(()=>{(async()=>{const a=await GU();t(a)})()},[]),g.useEffect(()=>{(async()=>{const c=await PT({perPage:8});r(c.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:o("dashboard.page.title")})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(BO,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.all")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(bn,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(PO,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.near_expired")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(bn,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(zO,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.enabled")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(bn,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(NO,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:o("dashboard.statistics.disabled")}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(bn,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:o("dashboard.statistics.unit")})]})]})]})]}),l.jsx("div",{className:"my-4",children:l.jsx("hr",{})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:o("dashboard.history")}),(n==null?void 0:n.length)==0?l.jsx(l.Fragment,{children:l.jsxs(rm,{className:"max-w-[40em] mt-10",children:[l.jsx(Wx,{children:o("common.text.nodata")}),l.jsxs(sm,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(JS,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ",o("history.nodata")]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(Me,{onClick:()=>{s("/edit")},children:o("domain.add")})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:o("history.props.domain")}),l.jsx("div",{className:"w-24",children:o("history.props.status")}),l.jsx("div",{className:"w-56",children:o("history.props.stage")}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:o("history.props.last_execution_time")}),l.jsx("div",{className:"grow",children:o("common.text.operations")})]}),n==null?void 0:n.map(i=>{var a,c;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(a=i.expand.domain)==null?void 0:a.domain.split(";").map(u=>l.jsxs(l.Fragment,{children:[u,l.jsx("br",{})]}))}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Sx,{deployment:i})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(xx,{phase:i.phase,phaseSuccess:i.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ma(i.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(Hv,{children:[l.jsx(Yv,{asChild:!0,children:l.jsx(Me,{variant:"link",className:"p-0",children:o("history.log")})}),l.jsxs(bh,{className:"sm:max-w-5xl",children:[l.jsx(Kv,{children:l.jsxs(Gv,{children:[(c=i.expand.domain)==null?void 0:c.domain,"-",i.id,o("history.log")]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[i.log.check&&l.jsx(l.Fragment,{children:i.log.check.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.apply&&l.jsx(l.Fragment,{children:i.log.apply.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.info&&u.info.map(d=>l.jsx("div",{className:"mt-1 text-green-600",children:d})),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))}),i.log.deploy&&l.jsx(l.Fragment,{children:i.log.deploy.map(u=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",u.time,"]"]}),l.jsx("div",{className:"ml-2",children:u.message})]}),u.error&&l.jsx("div",{className:"mt-1 text-red-600",children:u.error})]}))})]})]})]})})]},i.id)})]})]})]})},jW=ce.object({email:ce.string().email("settings.account.email.errmsg.invalid")}),EW=()=>{var a;const{toast:e}=Fr(),t=er(),{t:n}=Ye(),[r,s]=g.useState(!1),o=un({resolver:dn(jW),defaultValues:{email:(a=ot().authStore.model)==null?void 0:a.email}}),i=async c=>{var u;try{await ot().admins.update((u=ot().authStore.model)==null?void 0:u.id,{email:c.email}),ot().authStore.clear(),e({title:n("settings.account.email.changed.message"),description:n("settings.account.relogin.message")}),setTimeout(()=>{t("/login")},500)}catch(d){const f=Us(d);e({title:n("settings.account.email.failed.message"),description:f,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...o,children:l.jsxs("form",{onSubmit:o.handleSubmit(i),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:o.control,name:"email",render:({field:c})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:n("settings.account.email.label")}),l.jsx(je,{children:l.jsx(pe,{placeholder:n("settings.account.email.placeholder"),...c,type:"email",onChange:u=>{s(!0),o.setValue("email",u.target.value)}})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(Me,{type:"submit",children:n("common.update")}):l.jsx(Me,{type:"submit",disabled:!0,variant:"secondary",children:n("common.update")})})]})})})})},NW=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const n=t.payload.channel;return{...e,content:{...e.content,[n]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},RT=g.createContext({}),qx=()=>g.useContext(RT),TW=({children:e})=>{const[t,n]=g.useReducer(NW,{});g.useEffect(()=>{(async()=>{const i=await vx("notifyChannels");n({type:"SET_CHANNELS",payload:i})})()},[]);const r=g.useCallback(o=>{n({type:"SET_CHANNEL",payload:o})},[]),s=g.useCallback(o=>{n({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(RT.Provider,{value:{config:t,setChannel:r,setChannels:s},children:e})},PW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={accessToken:"",secret:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.dingtalk?d.dingtalk:u})();s({id:e.id??"",name:"dingtalk",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{const a=await al({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"AccessToken",value:r.data.accessToken,onChange:a=>{s({...r,data:{...r.data,accessToken:a.target.value}})}}),l.jsx(pe,{placeholder:n("settings.notification.dingtalk.secret.placeholder"),className:"mt-2",value:r.data.secret,onChange:a=>{s({...r,data:{...r.data,secret:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})},RW={title:"您有 {COUNT} 张证书即将过期",content:"有 {COUNT} 张证书即将过期,域名分别为 {DOMAINS},请保持关注!"},AW=()=>{const[e,t]=g.useState(""),[n,r]=g.useState([RW]),{toast:s}=Fr(),{t:o}=Ye();g.useEffect(()=>{(async()=>{const d=await vx("templates");d.content&&(r(d.content.notifyTemplates),t(d.id?d.id:""))})()},[]);const i=u=>{const d=n[0];r([{...d,title:u}])},a=u=>{const d=n[0];r([{...d,content:u}])},c=async()=>{const u=await al({id:e,content:{notifyTemplates:n},name:"templates"});u.id&&t(u.id),s({title:o("common.save.succeeded.message"),description:o("settings.notification.template.saved.message")})};return l.jsxs("div",{children:[l.jsx(pe,{value:n[0].title,onChange:u=>{i(u.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:o("settings.notification.template.variables.tips.title")}),l.jsx(Af,{className:"mt-2",value:n[0].content,onChange:u=>{a(u.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:o("settings.notification.template.variables.tips.content")}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:c,children:o("common.save")})})]})},DW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={apiToken:"",chatId:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.telegram?d.telegram:u})();s({id:e.id??"",name:"common.provider.telegram",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{const a=await al({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"ApiToken",value:r.data.apiToken,onChange:a=>{s({...r,data:{...r.data,apiToken:a.target.value}})}}),l.jsx(pe,{placeholder:"ChatId",value:r.data.chatId,onChange:a=>{s({...r,data:{...r.data,chatId:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})};function OW(e){try{return new URL(e),!0}catch{return!1}}const IW=()=>{const{config:e,setChannels:t}=qx(),{t:n}=Ye(),[r,s]=g.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});g.useEffect(()=>{const c=(()=>{const u={url:"",enabled:!1};if(!e.content)return u;const d=e.content;return d.webhook?d.webhook:u})();s({id:e.id??"",name:"webhook",data:c})},[e]);const{toast:o}=Fr(),i=async()=>{try{if(r.data.url=r.data.url.trim(),!OW(r.data.url)){o({title:n("common.save.failed.message"),description:n("settings.notification.url.errmsg.invalid"),variant:"destructive"});return}const a=await al({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(a),o({title:n("common.save.succeeded.message"),description:n("settings.notification.config.saved.message")})}catch(a){const c=Us(a);o({title:n("common.save.failed.message"),description:`${n("settings.notification.config.failed.message")}: ${c}`,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(pe,{placeholder:"Url",value:r.data.url,onChange:a=>{s({...r,data:{...r.data,url:a.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(pu,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{s({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Vt,{htmlFor:"airplane-mode",children:n("settings.notification.config.enable")})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(Me,{onClick:()=>{i()},children:n("common.save")})})]})};var Xx="Collapsible",[MW,AT]=an(Xx),[LW,Qx]=MW(Xx),DT=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=Zn({prop:r,defaultProp:s,onChange:i});return l.jsx(LW,{scope:n,disabled:o,contentId:Wn(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Pe.div,{"data-state":e0(c),"data-disabled":o?"":void 0,...a,ref:t})})});DT.displayName=Xx;var OT="CollapsibleTrigger",IT=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Qx(OT,n);return l.jsx(Pe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":e0(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ue(e.onClick,s.onOpenToggle)})});IT.displayName=OT;var Jx="CollapsibleContent",MT=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Qx(Jx,e.__scopeCollapsible);return l.jsx(ln,{present:n||s.open,children:({present:o})=>l.jsx(zW,{...r,ref:t,present:o})})});MT.displayName=Jx;var zW=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=Qx(Jx,n),[a,c]=g.useState(r),u=g.useRef(null),d=Ge(t,u),f=g.useRef(0),h=f.current,m=g.useRef(0),x=m.current,p=i.open||a,w=g.useRef(p),y=g.useRef();return g.useEffect(()=>{const v=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(v)},[]),tn(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const b=v.getBoundingClientRect();f.current=b.height,m.current=b.width,w.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),c(r)}},[i.open,r]),l.jsx(Pe.div,{"data-state":e0(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!p,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:p&&s})});function e0(e){return e?"open":"closed"}var FW=DT,$W=IT,UW=MT,qs="Accordion",VW=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[t0,BW,WW]=tu(qs),[um,t9]=an(qs,[WW,AT]),n0=AT(),LT=We.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,o=r;return l.jsx(t0.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?l.jsx(GW,{...o,ref:t}):l.jsx(KW,{...s,ref:t})})});LT.displayName=qs;var[zT,HW]=um(qs),[FT,YW]=um(qs,{collapsible:!1}),KW=We.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=Zn({prop:n,defaultProp:r,onChange:s});return l.jsx(zT,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(FT,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx($T,{...i,ref:t})})})}),GW=We.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...o}=e,[i=[],a]=Zn({prop:n,defaultProp:r,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(h=>h!==d)),[a]);return l.jsx(zT,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(FT,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx($T,{...o,ref:t})})})}),[ZW,dm]=um(qs),$T=We.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ge(a,t),u=BW(n),f=ki(s)==="ltr",h=ue(e.onKeyDown,m=>{var R;if(!VW.includes(m.key))return;const x=m.target,p=u().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),w=p.findIndex(A=>A.ref.current===x),y=p.length;if(w===-1)return;m.preventDefault();let v=w;const b=0,_=y-1,C=()=>{v=w+1,v>_&&(v=b)},j=()=>{v=w-1,v{const{__scopeAccordion:n,value:r,...s}=e,o=dm(Uf,n),i=HW(Uf,n),a=n0(n),c=Wn(),u=r&&i.value.includes(r)||!1,d=o.disabled||e.disabled;return l.jsx(qW,{scope:n,open:u,disabled:d,triggerId:c,children:l.jsx(FW,{"data-orientation":o.orientation,"data-state":KT(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(r):i.onItemClose(r)}})})});UT.displayName=Uf;var VT="AccordionHeader",BT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(VT,n);return l.jsx(Pe.h3,{"data-orientation":s.orientation,"data-state":KT(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:t})});BT.displayName=VT;var ny="AccordionTrigger",WT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(ny,n),i=YW(ny,n),a=n0(n);return l.jsx(t0.ItemSlot,{scope:n,children:l.jsx($W,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...r,ref:t})})});WT.displayName=ny;var HT="AccordionContent",YT=We.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=dm(qs,n),o=r0(HT,n),i=n0(n);return l.jsx(UW,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});YT.displayName=HT;function KT(e){return e?"open":"closed"}var XW=LT,QW=UT,JW=BT,GT=WT,ZT=YT;const f1=XW,$l=g.forwardRef(({className:e,...t},n)=>l.jsx(QW,{ref:n,className:re("border-b",e),...t}));$l.displayName="AccordionItem";const Ul=g.forwardRef(({className:e,children:t,...n},r)=>l.jsx(JW,{className:"flex",children:l.jsxs(GT,{ref:r,className:re("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,l.jsx(rv,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ul.displayName=GT.displayName;const Vl=g.forwardRef(({className:e,children:t,...n},r)=>l.jsx(ZT,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:l.jsx("div",{className:re("pb-4 pt-0",e),children:t})}));Vl.displayName=ZT.displayName;const eH=()=>{const{t:e}=Ye();return l.jsx(l.Fragment,{children:l.jsxs(TW,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(f1,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs($l,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("settings.notification.template.label")}),l.jsx(Vl,{children:l.jsx(AW,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(f1,{type:"single",className:"dark:text-stone-200",children:[l.jsxs($l,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.dingtalk")}),l.jsx(Vl,{children:l.jsx(PW,{})})]}),l.jsxs($l,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.telegram")}),l.jsx(Vl,{children:l.jsx(DW,{})})]}),l.jsxs($l,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(Ul,{children:e("common.provider.webhook")}),l.jsx(Vl,{children:l.jsx(IW,{})})]})]})})]})})};var s0="Radio",[tH,qT]=an(s0),[nH,rH]=tH(s0),XT=g.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:o,disabled:i,value:a="on",onCheck:c,...u}=e,[d,f]=g.useState(null),h=Ge(t,p=>f(p)),m=g.useRef(!1),x=d?!!d.closest("form"):!0;return l.jsxs(nH,{scope:n,checked:s,disabled:i,children:[l.jsx(Pe.button,{type:"button",role:"radio","aria-checked":s,"data-state":eP(s),"data-disabled":i?"":void 0,disabled:i,value:a,...u,ref:h,onClick:ue(e.onClick,p=>{s||c==null||c(),x&&(m.current=p.isPropagationStopped(),m.current||p.stopPropagation())})}),x&&l.jsx(sH,{control:d,bubbles:!m.current,name:r,value:a,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});XT.displayName=s0;var QT="RadioIndicator",JT=g.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,o=rH(QT,n);return l.jsx(ln,{present:r||o.checked,children:l.jsx(Pe.span,{"data-state":eP(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});JT.displayName=QT;var sH=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,o=g.useRef(null),i=jx(n),a=vv(t);return g.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[i,n,r]),l.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function eP(e){return e?"checked":"unchecked"}var oH=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o0="RadioGroup",[iH,n9]=an(o0,[rl,qT]),tP=rl(),nP=qT(),[aH,lH]=iH(o0),rP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:o,required:i=!1,disabled:a=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,m=tP(n),x=ki(u),[p,w]=Zn({prop:o,defaultProp:s,onChange:f});return l.jsx(aH,{scope:n,name:r,required:i,disabled:a,value:p,onValueChange:w,children:l.jsx(Cv,{asChild:!0,...m,orientation:c,dir:x,loop:d,children:l.jsx(Pe.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":a?"":void 0,dir:x,...h,ref:t})})})});rP.displayName=o0;var sP="RadioGroupItem",oP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,o=lH(sP,n),i=o.disabled||r,a=tP(n),c=nP(n),u=g.useRef(null),d=Ge(t,u),f=o.value===s.value,h=g.useRef(!1);return g.useEffect(()=>{const m=p=>{oH.includes(p.key)&&(h.current=!0)},x=()=>h.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",x)}},[]),l.jsx(jv,{asChild:!0,...a,focusable:!i,active:f,children:l.jsx(XT,{disabled:i,required:o.required,checked:f,...c,...s,name:o.name,ref:d,onCheck:()=>o.onValueChange(s.value),onKeyDown:ue(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:ue(s.onFocus,()=>{var m;h.current&&((m=u.current)==null||m.click())})})})});oP.displayName=sP;var cH="RadioGroupIndicator",iP=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=nP(n);return l.jsx(JT,{...s,...r,ref:t})});iP.displayName=cH;var aP=rP,lP=oP,uH=iP;const cP=g.forwardRef(({className:e,...t},n)=>l.jsx(aP,{className:re("grid gap-2",e),...t,ref:n}));cP.displayName=aP.displayName;const ry=g.forwardRef(({className:e,...t},n)=>l.jsx(lP,{ref:n,className:re("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:l.jsx(uH,{className:"flex items-center justify-center",children:l.jsx(QS,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ry.displayName=lP.displayName;const dH=()=>{const{t:e}=Ye(),t=ce.object({provider:ce.enum(["letsencrypt","zerossl"],{message:e("settings.ca.provider.errmsg.empty")}),eabKid:ce.string().optional(),eabHmacKey:ce.string().optional()}),n=un({resolver:dn(t),defaultValues:{provider:"letsencrypt"}}),[r,s]=g.useState("letsencrypt"),[o,i]=g.useState(),{toast:a}=Fr();g.useEffect(()=>{(async()=>{const f=await vx("ssl-provider");if(f){i(f);const h=f.content;n.setValue("provider",h.provider),n.setValue("eabKid",h.config[h.provider].eabKid),n.setValue("eabHmacKey",h.config[h.provider].eabHmacKey),s(h.provider)}else n.setValue("provider","letsencrypt"),s("letsencrypt")})()},[]);const c=d=>r===d?"border-primary":"",u=async d=>{if(d.provider==="zerossl"&&(d.eabKid||n.setError("eabKid",{message:e("settings.ca.eab_kid_hmac_key.errmsg.empty")}),d.eabHmacKey||n.setError("eabHmacKey",{message:e("settings.ca.eab_kid_hmac_key.errmsg.empty")}),!d.eabKid||!d.eabHmacKey))return;const f={id:o==null?void 0:o.id,name:"ssl-provider",content:{provider:d.provider,config:{letsencrypt:{},zerossl:{eabKid:d.eabKid??"",eabHmacKey:d.eabHmacKey??""}}}};try{await al(f),a({title:e("common.update.succeeded.message"),description:e("common.update.succeeded.message")})}catch(h){const m=Us(h);a({title:e("common.update.failed.message"),description:m,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(fn,{...n,children:l.jsxs("form",{onSubmit:n.handleSubmit(u),className:"space-y-8 dark:text-stone-200",children:[l.jsx(ke,{control:n.control,name:"provider",render:({field:d})=>l.jsxs(Se,{children:[l.jsx(Ce,{children:e("common.text.ca")}),l.jsx(je,{children:l.jsxs(cP,{...d,className:"flex",onValueChange:f=>{s(f),n.setValue("provider",f)},value:r,children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ry,{value:"letsencrypt",id:"letsencrypt"}),l.jsx(Vt,{htmlFor:"letsencrypt",children:l.jsxs("div",{className:re("flex items-center space-x-2 border p-2 rounded cursor-pointer",c("letsencrypt")),children:[l.jsx("img",{src:"/imgs/providers/letsencrypt.svg",className:"h-6"}),l.jsx("div",{children:"Let's Encrypt"})]})})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ry,{value:"zerossl",id:"zerossl"}),l.jsx(Vt,{htmlFor:"zerossl",children:l.jsxs("div",{className:re("flex items-center space-x-2 border p-2 rounded cursor-pointer",c("zerossl")),children:[l.jsx("img",{src:"/imgs/providers/zerossl.svg",className:"h-6"}),l.jsx("div",{children:"ZeroSSL"})]})})]})]})}),l.jsx(ke,{control:n.control,name:"eabKid",render:({field:f})=>l.jsxs(Se,{hidden:r!=="zerossl",children:[l.jsx(Ce,{children:"EAB_KID"}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("settings.ca.eab_kid.errmsg.empty"),...f,type:"text"})}),l.jsx(ye,{})]})}),l.jsx(ke,{control:n.control,name:"eabHmacKey",render:({field:f})=>l.jsxs(Se,{hidden:r!=="zerossl",children:[l.jsx(Ce,{children:"EAB_HMAC_KEY"}),l.jsx(je,{children:l.jsx(pe,{placeholder:e("settings.ca.eab_hmac_key.errmsg.empty"),...f,type:"text"})}),l.jsx(ye,{})]})}),l.jsx(ye,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Me,{type:"submit",children:e("common.update")})})]})})})})},fH=cO([{path:"/",element:l.jsx(R$,{}),children:[{path:"/",element:l.jsx(CW,{})},{path:"/domains",element:l.jsx(JU,{})},{path:"/edit",element:l.jsx(BB,{})},{path:"/access",element:l.jsx(yW,{})},{path:"/history",element:l.jsx(vW,{})},{path:"/setting",element:l.jsx(kW,{}),children:[{path:"/setting/password",element:l.jsx(SW,{})},{path:"/setting/account",element:l.jsx(EW,{})},{path:"/setting/notify",element:l.jsx(eH,{})},{path:"/setting/ssl-provider",element:l.jsx(dH,{})}]}]},{path:"/login",element:l.jsx(bW,{}),children:[{path:"/login",element:l.jsx(wW,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]),{slice:hH,forEach:mH}=[];function pH(e){return mH.call(hH.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const h1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,gH=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const s=encodeURIComponent(t);let o=`${e}=${s}`;if(r.maxAge>0){const i=r.maxAge-0;if(Number.isNaN(i))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(i)}`}if(r.domain){if(!h1.test(r.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${r.domain}`}if(r.path){if(!h1.test(r.path))throw new TypeError("option path is invalid");o+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o},m1={create(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=gH(e,encodeURIComponent(t),s)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));const i=s.substring(1).split("&");for(let a=0;a0&&i[a].substring(0,c)===t&&(n=i[a].substring(c+1))}}return n}};let Tl=null;const p1=()=>{if(Tl!==null)return Tl;try{Tl=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Tl=!1}return Tl};var xH={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&p1())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&p1()&&window.localStorage.setItem(n,e)}};let Pl=null;const g1=()=>{if(Pl!==null)return Pl;try{Pl=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Pl=!1}return Pl};var wH={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&g1())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&g1()&&window.sessionStorage.setItem(n,e)}},bH={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let o=0;o0?t:void 0}},_H={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},SH={name:"path",lookup(e){var s;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(s=n[typeof t=="number"?t:0])==null?void 0:s.replace("/",""):void 0}},kH={name:"subdomain",lookup(e){var s,o;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((o=(s=window.location)==null?void 0:s.hostname)==null?void 0:o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function CH(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class uP{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=pH(n,this.options||{},CH()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(yH),this.addDetector(vH),this.addDetector(xH),this.addDetector(wH),this.addDetector(bH),this.addDetector(_H),this.addDetector(SH),this.addDetector(kH)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}uP.type="languageDetector";const jH={"common.add":"新增","common.save":"保存","common.save.succeeded.message":"保存成功","common.save.failed.message":"保存失败","common.edit":"编辑","common.copy":"复制","common.download":"下载","common.delete":"刪除","common.delete.succeeded.message":"删除成功","common.delete.failed.message":"删除失败","common.next":"下一步","common.confirm":"确认","common.cancel":"取消","common.submit":"提交","common.update":"更新","common.update.succeeded.message":"修改成功","common.update.failed.message":"修改失败","common.text.domain":"域名","common.text.domain.empty":"无域名","common.text.ip":"IP 地址","common.text.ip.empty":"无 IP 地址","common.text.dns":"DNS(域名服务器)","common.text.dns.empty":"无 DNS 地址","common.text.ca":"CA(证书颁发机构)","common.text.name":"名称","common.text.provider":"服务商","common.text.created_at":"创建时间","common.text.updated_at":"更新时间","common.text.operations":"操作","common.text.nodata":"暂无数据","common.menu.settings":"系统设置","common.menu.logout":"退出登录","common.menu.document":"文档","common.pagination.next":"下一页","common.pagination.prev":"上一页","common.pagination.more":"更多","common.theme.light":"浅色","common.theme.dark":"暗黑","common.theme.system":"跟随系统","common.errmsg.string_max":"请输入不超过 {{max}} 个字符","common.errmsg.email_empty":"请输入邮箱","common.errmsg.email_invalid":"请输入正确的邮箱","common.errmsg.email_duplicate":"邮箱已存在","common.errmsg.domain_invalid":"请输入正确的域名","common.errmsg.host_invalid":"请输入正确的域名或 IP 地址","common.errmsg.ip_invalid":"请输入正确的 IP 地址","common.errmsg.url_invalid":"请输入正确的 URL","common.provider.tencent":"腾讯云","common.provider.tencent.cdn":"腾讯云-CDN","common.provider.aliyun":"阿里云","common.provider.aliyun.cdn":"阿里云-CDN","common.provider.aliyun.oss":"阿里云-OSS","common.provider.aliyun.dcdn":"阿里云-DCDN","common.provider.huaweicloud":"华为云","common.provider.qiniu":"七牛云","common.provider.qiniu.cdn":"七牛云-CDN","common.provider.cloudflare":"Cloudflare","common.provider.namesilo":"Namesilo","common.provider.godaddy":"GoDaddy","common.provider.local":"本地部署","common.provider.ssh":"SSH 部署","common.provider.webhook":"Webhook","common.provider.dingtalk":"钉钉","common.provider.telegram":"Telegram"},EH={"login.username.label":"用户名","login.username.placeholder":"请输入用户名/邮箱","login.username.errmsg.invalid":"请输入正确的用户名/邮箱","login.password.label":"密码","login.password.placeholder":"请输入密码","login.password.errmsg.invalid":"密码至少 10 个字符","login.submit":"登录"},NH={"dashboard.page.title":"仪表盘","dashboard.statistics.all":"所有","dashboard.statistics.near_expired":"即将过期","dashboard.statistics.enabled":"启用中","dashboard.statistics.disabled":"未启用","dashboard.statistics.unit":"个","dashboard.history":"部署历史"},TH={"settings.page.title":"系统设置","settings.account.relogin.message":"请重新登录","settings.account.tab":"账号","settings.account.email.label":"登录邮箱","settings.account.email.errmsg.invalid":"请输入正确的邮箱地址","settings.account.email.placeholder":"请输入邮箱","settings.account.email.changed.message":"修改账户邮箱成功","settings.account.email.failed.message":"修改账户邮箱失败","settings.password.tab":"密码","settings.password.password.errmsg.length":"密码至少10个字符","settings.password.password.errmsg.not_matched":"两次密码不一致","settings.password.current_password.label":"当前密码","settings.password.current_password.placeholder":"请输入旧密码","settings.password.new_password.label":"新密码","settings.password.new_password.placeholder":"请输入新密码","settings.password.confirm_password.label":"确认密码","settings.password.confirm_password.placeholder":"请再次输入新密码","settings.password.changed.message":"修改密码成功","settings.password.failed.message":"修改密码失败","settings.notification.tab":"消息推送","settings.notification.template.label":"内容模板","settings.notification.template.saved.message":"通知模板保存成功","settings.notification.template.variables.tips.title":"可选的变量({COUNT}: 即将过期张数)","settings.notification.template.variables.tips.content":"可选的变量({COUNT}: 即将过期张数;{DOMAINS}: 域名列表)","settings.notification.config.enable":"是否启用","settings.notification.config.saved.message":"配置保存成功","settings.notification.config.failed.message":"配置保存失败","settings.notification.dingtalk.secret.placeholder":"加签的签名","settings.notification.url.errmsg.invalid":"URL 格式不正确","settings.ca.tab":"证书颁发机构(CA)","settings.ca.provider.errmsg.empty":"请选择证书分发机构","settings.ca.eab_kid.errmsg.empty":"请输入EAB_KID","settings.ca.eab_hmac_key.errmsg.empty":"请输入EAB_HMAC_KEY","settings.ca.eab_kid_hmac_key.errmsg.empty":"请输入EAB_KID和EAB_HMAC_KEY"},PH={"domain.page.title":"域名列表","domain.nodata":"请添加域名开始部署证书吧。","domain.add":"新增域名","domain.edit":"编辑域名","domain.delete":"删除域名","domain.delete.confirm":"确定要删除域名吗?","domain.history":"部署历史","domain.deploy":"立即部署","domain.deploy.started.message":"开始部署","domain.deploy.started.tips":"已发起部署,请稍后查看部署日志。","domain.deploy.failed.message":"执行失败","domain.deploy.failed.tips":"执行失败,请在 <1>部署历史 查看详情。","domain.deploy_forced":"强行部署","domain.props.expiry":"有效期限","domain.props.expiry.date1":"有效期 {{date}} 天","domain.props.expiry.date2":"{{date}} 到期","domain.props.last_execution_status":"最近执行状态","domain.props.last_execution_stage":"最近执行阶段","domain.props.last_execution_time":"最近执行时间","domain.props.enable":"是否启用","domain.props.enable.enabled":"启用","domain.props.enable.disabled":"禁用","domain.application.tab":"申请配置","domain.application.form.domain.added.message":"域名添加成功","domain.application.form.domain.changed.message":"域名编辑成功","domain.application.form.email.label":"邮箱","domain.application.form.email.tips":"(申请证书需要提供邮箱)","domain.application.form.email.add":"添加邮箱","domain.application.form.email.list":"邮箱列表","domain.application.form.email.errmsg.empty":"请选择邮箱","domain.application.form.access.label":"DNS 服务商授权配置","domain.application.form.access.placeholder":"请选择 DNS 服务商授权配置","domain.application.form.access.errmsg.empty":"请选择 DNS 服务商授权配置","domain.application.form.access.list":"已有的 DNS 服务商授权配置","domain.application.form.timeout.label":"超时时间","domain.application.form.timeoue.placeholder":"超时时间(单位:秒)","domain.application.unsaved.message":"请先保存申请配置","domain.deployment.tab":"部署配置","domain.deployment.nodata":"暂无部署配置,请添加后开始部署证书吧","domain.deployment.form.type.label":"部署方式","domain.deployment.form.type.placeholder":"请选择部署方式","domain.deployment.form.type.list":"支持的部署方式","domain.deployment.form.access.label":"授权配置","domain.deployment.form.access.placeholder":"请选择授权配置","domain.deployment.form.access.list":"已有的服务商授权配置","domain.deployment.form.cdn_domain.label":"部署到域名","domain.deployment.form.cdn_domain.placeholder":"请输入 CDN 域名","domain.deployment.form.oss_endpoint.label":"Endpoint","domain.deployment.form.oss_bucket":"存储桶","domain.deployment.form.oss_bucket.placeholder":"请输入存储桶名","domain.deployment.form.variables.label":"变量","domain.deployment.form.variables.key":"变量名","domain.deployment.form.variables.value":"值","domain.deployment.form.variables.empty":"尚未添加变量","domain.deployment.form.variables.key.required":"变量名不能为空","domain.deployment.form.variables.value.required":"变量值不能为空","domain.deployment.form.variables.key.placeholder":"请输入变量名","domain.deployment.form.variables.value.placeholder":"请输入变量值"},RH={"access.page.title":"授权管理","access.authorization.tab":"授权","access.authorization.nodata":"请添加授权开始部署证书吧。","access.authorization.add":"新增授权","access.authorization.edit":"编辑授权","access.authorization.copy":"复制授权","access.authorization.delete":"删除授权","access.authorization.delete.confirm":"确定要删除授权吗?","access.authorization.form.type.label":"服务商","access.authorization.form.type.placeholder":"请选择服务商","access.authorization.form.type.list":"服务商列表","access.authorization.form.name.label":"名称","access.authorization.form.name.placeholder":"请输入授权名称","access.authorization.form.config.label":"配置类型","access.authorization.form.region.label":"Region","access.authorization.form.region.placeholder":"请输入区域","access.authorization.form.access_key_id.label":"AccessKeyId","access.authorization.form.access_key_id.placeholder":"请输入 AccessKeyId","access.authorization.form.access_key_secret.label":"AccessKeySecret","access.authorization.form.access_key_secret.placeholder":"请输入 AccessKeySecret","access.authorization.form.access_key.label":"AccessKey","access.authorization.form.access_key.placeholder":"请输入 AccessKey","access.authorization.form.secret_id.label":"SecretId","access.authorization.form.secret_id.placeholder":"请输入 SecretId","access.authorization.form.secret_key.label":"SecretKey","access.authorization.form.secret_key.placeholder":"请输入 SecretKey","access.authorization.form.cloud_dns_api_token.label":"CLOUD_DNS_API_TOKEN","access.authorization.form.cloud_dns_api_token.placeholder":"请输入 CLOUD_DNS_API_TOKEN","access.authorization.form.godaddy_api_key.label":"GO_DADDY_API_KEY","access.authorization.form.godaddy_api_key.placeholder":"请输入 GO_DADDY_API_KEY","access.authorization.form.godaddy_api_secret.label":"GO_DADDY_API_SECRET","access.authorization.form.godaddy_api_secret.placeholder":"请输入 GO_DADDY_API_SECRET","access.authorization.form.namesilo_api_key.label":"NAMESILO_API_KEY","access.authorization.form.namesilo_api_key.placeholder":"请输入 NAMESILO_API_KEY","access.authorization.form.username.label":"用户名","access.authorization.form.username.placeholder":"请输入用户名","access.authorization.form.password.label":"密码","access.authorization.form.password.placeholder":"请输入密码","access.authorization.form.access_group.placeholder":"请选择分组","access.authorization.form.ssh_group.label":"授权配置组(用于将一个域名证书部署到多个 SSH 主机)","access.authorization.form.ssh_host.label":"服务器 Host","access.authorization.form.ssh_host.placeholder":"请输入 Host","access.authorization.form.ssh_port.label":"SSH 端口","access.authorization.form.ssh_port.placeholder":"请输入 Port","access.authorization.form.ssh_key.label":"Key(使用私钥登录)","access.authorization.form.ssh_key.placeholder":"请输入 Key","access.authorization.form.ssh_key_file.placeholder":"请选择文件","access.authorization.form.ssh_key.label.passphrase":"私钥密码","access.authorization.form.ssh_key_path.label":"私钥保存路径","access.authorization.form.ssh_key_path.placeholder":"请输入私钥保存路径","access.authorization.form.ssh_cert_path.label":"证书保存路径","access.authorization.form.ssh_cert_path.placeholder":"请输入证书保存路径","access.authorization.form.ssh_pre_command.label":"前置 Command","access.authorization.form.ssh_pre_command.placeholder":"在部署证书前执行的前置命令","access.authorization.form.ssh_command.label":"Command","access.authorization.form.ssh_command.placeholder":"请输入要执行的命令","access.authorization.form.webhook_url.label":"Webhook URL","access.authorization.form.webhook_url.placeholder":"请输入 Webhook URL","access.group.tab":"授权组","access.group.nodata":"暂无部署授权配置,请添加后开始使用吧","access.group.total":"共有 {{total}} 个部署授权配置","access.group.add":"添加授权组","access.group.delete":"删除组","access.group.delete.confirm":"确定要删除部署授权组吗?","access.group.form.name.label":"组名","access.group.form.name.errmsg.empty":"请输入组名","access.group.domains":"所有授权","access.group.domains.nodata":"请添加域名开始部署证书吧。"},AH={"history.page.title":"部署","history.nodata":"你暂未创建任何部署,请先添加域名进行部署吧!","history.props.domain":"域名","history.props.status":"状态","history.props.stage":"阶段","history.props.stage.progress.check":"检查","history.props.stage.progress.apply":"获取","history.props.stage.progress.deploy":"部署","history.props.last_execution_time":"最近执行时间","history.log":"日志"},DH=Object.freeze({...jH,...EH,...NH,...TH,...PH,...RH,...AH}),OH={"common.save":"Save","common.save.succeeded.message":"Save Successful","common.save.failed.message":"Save Failed","common.add":"Add","common.edit":"Edit","common.copy":"Copy","common.download":"Download","common.delete":"Delete","common.delete.succeeded.message":"Delete Successful","common.delete.failed.message":"Delete Failed","common.next":"Next","common.confirm":"Confirm","common.cancel":"Cancel","common.submit":"Submit","common.update":"Update","common.update.succeeded.message":"Update Successful","common.update.failed.message":"Update Failed","common.text.domain":"Domain","common.text.domain.empty":"No Domain","common.text.ip":"IP Address","common.text.ip.empty":"No IP address","common.text.dns":"Domain Name Server","common.text.dns.empty":"No DNS","common.text.ca":"Certificate Authority","common.text.provider":"Provider","common.text.name":"Name","common.text.created_at":"Created At","common.text.updated_at":"Updated At","common.text.operations":"Operations","common.text.nodata":"No data available","common.menu.settings":"Settings","common.menu.logout":"Logout","common.menu.document":"Document","common.pagination.next":"Next","common.pagination.prev":"Previous","common.pagination.more":"More pages","common.theme.light":"Light","common.theme.dark":"Dark","common.theme.system":"System","common.errmsg.string_max":"Please enter no more than {{max}} characters","common.errmsg.email_invalid":"Please enter a valid email address","common.errmsg.email_empty":"Please enter email","common.errmsg.email_duplicate":"Email already exists","common.errmsg.domain_invalid":"Please enter domain","common.errmsg.host_invalid":"Please enter the correct domain name or IP","common.errmsg.ip_invalid":"Please enter IP","common.errmsg.url_invalid":"Please enter a valid URL","common.provider.aliyun":"Alibaba Cloud","common.provider.aliyun.cdn":"Alibaba Cloud-CDN","common.provider.aliyun.oss":"Alibaba Cloud-OSS","common.provider.aliyun.dcdn":"Alibaba Cloud-DCDN","common.provider.tencent":"Tencent","common.provider.tencent.cdn":"Tencent-CDN","common.provider.huaweicloud":"Huawei Cloud","common.provider.qiniu":"Qiniu","common.provider.qiniu.cdn":"Qiniu-CDN","common.provider.cloudflare":"Cloudflare","common.provider.namesilo":"Namesilo","common.provider.godaddy":"GoDaddy","common.provider.local":"Local Deployment","common.provider.ssh":"SSH Deployment","common.provider.webhook":"Webhook","common.provider.dingtalk":"DingTalk","common.provider.telegram":"Telegram"},IH={"login.username.label":"Username","login.username.placeholder":"Username/Email","login.username.errmsg.invalid":"Please enter a valid email address","login.password.label":"Password","login.password.placeholder":"Password","login.password.errmsg.invalid":"Password should be at least 10 characters","login.submit":"Log In"},MH={"dashboard.page.title":"Dashboard","dashboard.statistics.all":"All","dashboard.statistics.near_expired":"About to Expire","dashboard.statistics.enabled":"Enabled","dashboard.statistics.disabled":"Not Enabled","dashboard.statistics.unit":"","dashboard.history":"Deployment History"},LH={"settings.page.title":"Settings","settings.account.relogin.message":"Please login again","settings.account.tab":"Account","settings.account.email.label":"Email","settings.account.email.placeholder":"Please enter email","settings.account.email.errmsg.invalid":"Please enter a valid email address","settings.account.email.changed.message":"Account email altered successfully","settings.account.email.failed.message":"Account email alteration failed","settings.password.tab":"Password","settings.password.current_password.label":"Current Password","settings.password.current_password.placeholder":"Please enter the current password","settings.password.new_password.label":"New Password","settings.password.new_password.placeholder":"Please enter the new password","settings.password.confirm_password.label":"Confirm Password","settings.password.confirm_password.placeholder":"Please enter the new password again","settings.password.password.errmsg.length":"Password should be at least 10 characters","settings.password.password.errmsg.not_matched":"Passwords do not match","settings.password.changed.message":"Password changed successfully","settings.password.failed.message":"Password change failed","settings.notification.tab":"Notification","settings.notification.template.label":"Template","settings.notification.template.saved.message":"Notification template saved successfully","settings.notification.template.variables.tips.title":"Optional variables ({COUNT}: number of expiring soon)","settings.notification.template.variables.tips.content":"Optional variables ({COUNT}: number of expiring soon. {DOMAINS}: Domain list)","settings.notification.config.enable":"Enable","settings.notification.config.saved.message":"Configuration saved successfully","settings.notification.config.failed.message":"Configuration save failed","settings.notification.dingtalk.secret.placeholder":"Signature for signed addition","settings.notification.url.errmsg.invalid":"Invalid Url format","settings.ca.tab":"Certificate Authority","settings.ca.provider.errmsg.empty":"Please select a Certificate Authority","settings.ca.eab_kid.errmsg.empty":"Please enter EAB_KID","settings.ca.eab_hmac_key.errmsg.empty":"Please enter EAB_HMAC_KEY.","settings.ca.eab_kid_hmac_key.errmsg.empty":"Please enter EAB_KID and EAB_HMAC_KEY"},zH={"domain.page.title":"Domain List","domain.nodata":"Please add a domain to start deploying the certificate.","domain.add":"Add Domain","domain.edit":"Edit Domain","domain.delete":"Delete Domain","domain.delete.confirm":"Are you sure you want to delete this domain?","domain.history":"Deployment History","domain.deploy":"Deploy Now","domain.deploy.started.message":"Deploy Started","domain.deploy.started.tips":"Deployment initiated, please check the deployment log later.","domain.deploy.failed.message":"Execution Failed","domain.deploy.failed.tips":"Execution failed, please check the details in <1>Deployment History.","domain.deploy_forced":"Force Deployment","domain.props.expiry":"Validity Period","domain.props.expiry.date1":"Valid for {{date}} days","domain.props.expiry.date2":"Expiry on {{date}}","domain.props.last_execution_status":"Last Execution Status","domain.props.last_execution_stage":"Last Execution Stage","domain.props.last_execution_time":"Last Execution Time","domain.props.enable":"Enable","domain.props.enable.enabled":"Enable","domain.props.enable.disabled":"Disable","domain.application.tab":"Apply Settings","domain.application.form.domain.added.message":"Domain added successfully","domain.application.form.domain.changed.message":"Domain updated successfully","domain.application.form.email.label":"Email","domain.application.form.email.tips":"(A email is required to apply for a certificate)","domain.application.form.email.add":"Add Email","domain.application.form.email.list":"Email List","domain.application.form.email.errmsg.empty":"Please select email","domain.application.form.access.label":"DNS Provider Authorization Configuration","domain.application.form.access.placeholder":"Please select DNS provider authorization configuration","domain.application.form.access.errmsg.empty":"Please select DNS provider authorization configuration","domain.application.form.access.list":"Provider Authorization Configurations","domain.application.form.timeout.label":"Timeout","domain.application.form.timeoue.placeholder":"Timeout (seconds)","domain.application.unsaved.message":"Please save applyment configuration first","domain.deployment.tab":"Deploy Settings","domain.deployment.nodata":"Deployment not added yet","domain.deployment.form.type.label":"Deploy Method","domain.deployment.form.type.placeholder":"Please select deploy method","domain.deployment.form.type.list":"Deploy Method List","domain.deployment.form.access.label":"Access Configuration","domain.deployment.form.access.placeholder":"Please select provider authorization configuration","domain.deployment.form.access.list":"Provider Authorization Configurations","domain.deployment.form.cdn_domain.label":"Deploy to domain","domain.deployment.form.cdn_domain.placeholder":"Please enter CDN domain","domain.deployment.form.oss_endpoint.label":"Endpoint","domain.deployment.form.oss_bucket":"Bucket","domain.deployment.form.oss_bucket.placeholder":"Please enter Bucket","domain.deployment.form.variables.label":"Variable","domain.deployment.form.variables.key":"Name","domain.deployment.form.variables.value":"Value","domain.deployment.form.variables.empty":"Variable not added yet","domain.deployment.form.variables.key.required":"Variable name cannot be empty","domain.deployment.form.variables.value.required":"Variable value cannot be empty","domain.deployment.form.variables.key.placeholder":"Variable name","domain.deployment.form.variables.value.placeholder":"Variable value"},FH={"access.page.title":"Authorization Management","access.authorization.tab":"Authorization","access.authorization.nodata":"Please add authorization to start deploying certificate.","access.authorization.add":"Add Authorization","access.authorization.edit":"Edit Authorization","access.authorization.copy":"Copy Authorization","access.authorization.delete":"Delete Authorization","access.authorization.delete.confirm":"Are you sure you want to delete the deployment authorization?","access.authorization.form.type.label":"Provider","access.authorization.form.type.placeholder":"Please select a provider","access.authorization.form.type.list":"Authorization List","access.authorization.form.name.label":"Name","access.authorization.form.name.placeholder":"Please enter authorization name","access.authorization.form.config.label":"Configuration Type","access.authorization.form.region.label":"Region","access.authorization.form.region.placeholder":"Please enter Region","access.authorization.form.access_key_id.label":"AccessKeyId","access.authorization.form.access_key_id.placeholder":"Please enter AccessKeyId","access.authorization.form.access_key_secret.label":"AccessKeySecret","access.authorization.form.access_key_secret.placeholder":"Please enter AccessKeySecret","access.authorization.form.access_key.label":"AccessKey","access.authorization.form.access_key.placeholder":"Please enter AccessKey","access.authorization.form.secret_id.label":"SecretId","access.authorization.form.secret_id.placeholder":"Please enter SecretId","access.authorization.form.secret_key.label":"SecretKey","access.authorization.form.secret_key.placeholder":"Please enter SecretKey","access.authorization.form.cloud_dns_api_token.label":"CLOUD_DNS_API_TOKEN","access.authorization.form.cloud_dns_api_token.placeholder":"Please enter CLOUD_DNS_API_TOKEN","access.authorization.form.godaddy_api_key.label":"GO_DADDY_API_KEY","access.authorization.form.godaddy_api_key.placeholder":"Please enter GO_DADDY_API_KEY","access.authorization.form.godaddy_api_secret.label":"GO_DADDY_API_SECRET","access.authorization.form.godaddy_api_secret.placeholder":"Please enter GO_DADDY_API_SECRET","access.authorization.form.namesilo_api_key.label":"NAMESILO_API_KEY","access.authorization.form.namesilo_api_key.placeholder":"Please enter NAMESILO_API_KEY","access.authorization.form.username.label":"Username","access.authorization.form.username.placeholder":"Please enter username","access.authorization.form.password.label":"Password","access.authorization.form.password.placeholder":"Please enter password","access.authorization.form.access_group.placeholder":"Please select a group","access.authorization.form.ssh_group.label":"Authorization Configuration Group (used to deploy a single domain certificate to multiple SSH hosts)","access.authorization.form.ssh_host.label":"Server Host","access.authorization.form.ssh_host.placeholder":"Please enter Host","access.authorization.form.ssh_port.label":"SSH Port","access.authorization.form.ssh_port.placeholder":"Please enter Port","access.authorization.form.ssh_key.label":"Key (Log in using private key)","access.authorization.form.ssh_key.placeholder":"Please enter Key","access.authorization.form.ssh_key_file.placeholder":"Please select file","access.authorization.form.ssh_key_path.label":"Private Key Save Path","access.authorization.form.ssh_key_path.placeholder":"Please enter private key save path","access.authorization.form.ssh_cert_path.label":"Certificate Save Path","access.authorization.form.ssh_cert_path.placeholder":"Please enter certificate save path","access.authorization.form.ssh_pre_command.label":"Pre-deployment Command","access.authorization.form.ssh_pre_command.placeholder":"Command to be executed before deploying the certificate","access.authorization.form.ssh_command.label":"Command","access.authorization.form.ssh_command.placeholder":"Please enter command","access.authorization.form.webhook_url.label":"Webhook URL","access.authorization.form.webhook_url.placeholder":"Please enter Webhook URL","access.group.tab":"Authorization Group","access.group.nodata":"No deployment authorization configuration yet, please add after starting use.","access.group.total":"Totally {{total}} deployment authorization configuration","access.group.add":"Add Group","access.group.delete":"Delete Group","access.group.delete.confirm":"Are you sure you want to delete the deployment authorization group?","access.group.form.name.label":"Group Name","access.group.form.name.errmsg.empty":"Please enter group name","access.group.domains":"All Authorizations","access.group.domains.nodata":"Please add a domain to start deploying the certificate."},$H={"history.page.title":"Deployment","history.nodata":"You have not created any deployments yet, please add a domain to start deployment!","history.props.domain":"Domain","history.props.status":"Status","history.props.stage":"Stage","history.props.stage.progress.check":"Check","history.props.stage.progress.apply":"Apply","history.props.stage.progress.deploy":"Deploy","history.props.last_execution_time":"Last Execution Time","history.log":"Log"},UH=Object.freeze({...OH,...IH,...MH,...LH,...zH,...FH,...$H}),VH={zh:{name:"简体中文",translation:DH},en:{name:"English",translation:UH}};xn.use(uP).use(uI).init({resources:VH,fallbackLng:"zh",debug:!0,interpolation:{escapeValue:!1},backend:{loadPath:"/locales/{{lng}}.json"}});vp.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(S$,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(vO,{router:fH})})}))});export default BH(); diff --git a/ui/dist/index.html b/ui/dist/index.html index 3567c9f3..e842afa1 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ Certimate - Your Trusted SSL Automation Partner - + diff --git a/ui/src/components/certimate/AccessAliyunForm.tsx b/ui/src/components/certimate/AccessAliyunForm.tsx index d49e596f..11a3ca9b 100644 --- a/ui/src/components/certimate/AccessAliyunForm.tsx +++ b/ui/src/components/certimate/AccessAliyunForm.tsx @@ -51,7 +51,7 @@ const AccessAliyunForm = ({ .max(64, t("common.errmsg.string_max", { max: 64 })), accessSecretId: z .string() - .min(1, "access.authorization.form.access_key_secret..placeholder") + .min(1, "access.authorization.form.access_key_secret.placeholder") .max(64, t("common.errmsg.string_max", { max: 64 })), }); @@ -200,7 +200,7 @@ const AccessAliyunForm = ({ {t("access.authorization.form.access_key_secret.label")} diff --git a/ui/src/components/certimate/AccessHuaweicloudForm.tsx b/ui/src/components/certimate/AccessHuaweicloudForm.tsx index cc4c1b18..bfdac7fd 100644 --- a/ui/src/components/certimate/AccessHuaweicloudForm.tsx +++ b/ui/src/components/certimate/AccessHuaweicloudForm.tsx @@ -55,7 +55,7 @@ const AccessHuaweicloudForm = ({ .max(64, t("common.errmsg.string_max", { max: 64 })), secretAccessKey: z .string() - .min(1, "access.authorization.form.access_key_secret..placeholder") + .min(1, "access.authorization.form.access_key_secret.placeholder") .max(64, t("common.errmsg.string_max", { max: 64 })), }); @@ -225,7 +225,7 @@ const AccessHuaweicloudForm = ({ {t("access.authorization.form.access_key_secret.label")} diff --git a/ui/src/domain/access.ts b/ui/src/domain/access.ts index 1c1828c6..085c8c9c 100644 --- a/ui/src/domain/access.ts +++ b/ui/src/domain/access.ts @@ -30,7 +30,7 @@ export const accessFormType = z.union( z.literal("ssh"), z.literal("webhook"), ], - { message: "access.common.type.errmsg.empty" } + { message: "access.authorization.form.type.placeholder" } ); type AccessUsage = "apply" | "deploy" | "all"; diff --git a/ui/src/i18n/locales/en/nls.access.json b/ui/src/i18n/locales/en/nls.access.json index 92fe53f9..1af187b6 100644 --- a/ui/src/i18n/locales/en/nls.access.json +++ b/ui/src/i18n/locales/en/nls.access.json @@ -21,7 +21,7 @@ "access.authorization.form.access_key_id.label": "AccessKeyId", "access.authorization.form.access_key_id.placeholder": "Please enter AccessKeyId", "access.authorization.form.access_key_secret.label": "AccessKeySecret", - "access.authorization.form.access_key_secret..placeholder": "Please enter AccessKeySecret", + "access.authorization.form.access_key_secret.placeholder": "Please enter AccessKeySecret", "access.authorization.form.access_key.label": "AccessKey", "access.authorization.form.access_key.placeholder": "Please enter AccessKey", "access.authorization.form.secret_id.label": "SecretId", @@ -73,7 +73,5 @@ "access.group.form.name.errmsg.empty": "Please enter group name", "access.group.domains": "All Authorizations", - "access.group.domains.nodata": "Please add a domain to start deploying the certificate.", - - "access.common.type.errmsg.empty": "Please select a provider" + "access.group.domains.nodata": "Please add a domain to start deploying the certificate." } diff --git a/ui/src/i18n/locales/en/nls.history.json b/ui/src/i18n/locales/en/nls.history.json index 8202baa0..97e40e0f 100644 --- a/ui/src/i18n/locales/en/nls.history.json +++ b/ui/src/i18n/locales/en/nls.history.json @@ -6,11 +6,10 @@ "history.props.domain": "Domain", "history.props.status": "Status", "history.props.stage": "Stage", - "history.props.last_execution_time": "Last Execution Time", - "history.props.stage.progress.check": "Check", "history.props.stage.progress.apply": "Apply", "history.props.stage.progress.deploy": "Deploy", + "history.props.last_execution_time": "Last Execution Time", "history.log": "Log" } diff --git a/ui/src/i18n/locales/zh/nls.access.json b/ui/src/i18n/locales/zh/nls.access.json index e7c4ecf1..c1edff04 100644 --- a/ui/src/i18n/locales/zh/nls.access.json +++ b/ui/src/i18n/locales/zh/nls.access.json @@ -21,7 +21,7 @@ "access.authorization.form.access_key_id.label": "AccessKeyId", "access.authorization.form.access_key_id.placeholder": "请输入 AccessKeyId", "access.authorization.form.access_key_secret.label": "AccessKeySecret", - "access.authorization.form.access_key_secret..placeholder": "请输入 AccessKeySecret", + "access.authorization.form.access_key_secret.placeholder": "请输入 AccessKeySecret", "access.authorization.form.access_key.label": "AccessKey", "access.authorization.form.access_key.placeholder": "请输入 AccessKey", "access.authorization.form.secret_id.label": "SecretId", @@ -74,7 +74,5 @@ "access.group.form.name.errmsg.empty": "请输入组名", "access.group.domains": "所有授权", - "access.group.domains.nodata": "请添加域名开始部署证书吧。", - - "access.common.type.errmsg.empty": "请选择服务商" + "access.group.domains.nodata": "请添加域名开始部署证书吧。" }