diff --git a/internal/deployer/aliyun.go b/internal/deployer/aliyun.go index db189283..58c26b17 100644 --- a/internal/deployer/aliyun.go +++ b/internal/deployer/aliyun.go @@ -19,6 +19,7 @@ import ( type aliyun struct { client *cas20200407.Client option *DeployerOption + infos []string } func NewAliyun(option *DeployerOption) (Deployer, error) { @@ -26,6 +27,7 @@ func NewAliyun(option *DeployerOption) (Deployer, error) { json.Unmarshal([]byte(option.Access), access) a := &aliyun{ option: option, + infos: make([]string, 0), } client, err := a.createClient(access.AccessKeyId, access.AccessKeySecret) if err != nil { @@ -36,6 +38,10 @@ func NewAliyun(option *DeployerOption) (Deployer, error) { } +func (a *aliyun) GetInfo() []string { + return a.infos +} + func (a *aliyun) Deploy(ctx context.Context) error { // 查询有没有对应的资源 @@ -44,24 +50,32 @@ func (a *aliyun) Deploy(ctx context.Context) error { return err } + a.infos = append(a.infos, toStr("查询对应的资源", resource)) + // 查询有没有对应的联系人 contacts, err := a.contacts() if err != nil { return err } + a.infos = append(a.infos, toStr("查询联系人", contacts)) + // 上传证书 certId, err := a.uploadCert(&a.option.Certificate) if err != nil { return err } + a.infos = append(a.infos, toStr("上传证书", certId)) + // 部署证书 jobId, err := a.deploy(resource, certId, contacts) if err != nil { return err } + a.infos = append(a.infos, toStr("创建部署证书任务", jobId)) + // 等待部署成功 err = a.updateDeployStatus(*jobId) if err != nil { @@ -80,10 +94,11 @@ func (a *aliyun) updateDeployStatus(jobId int64) error { JobId: tea.Int64(jobId), } - _, err := a.client.UpdateDeploymentJobStatus(req) + resp, err := a.client.UpdateDeploymentJobStatus(req) if err != nil { return err } + a.infos = append(a.infos, toStr("查询对应的资源", resp)) return nil } diff --git a/internal/deployer/aliyun_cdn.go b/internal/deployer/aliyun_cdn.go index 116e6024..586cc935 100644 --- a/internal/deployer/aliyun_cdn.go +++ b/internal/deployer/aliyun_cdn.go @@ -15,6 +15,7 @@ import ( type AliyunCdn struct { client *cdn20180510.Client option *DeployerOption + infos []string } func NewAliyunCdn(option *DeployerOption) (*AliyunCdn, error) { @@ -31,9 +32,14 @@ func NewAliyunCdn(option *DeployerOption) (*AliyunCdn, error) { return &AliyunCdn{ client: client, option: option, + infos: make([]string, 0), }, nil } +func (a *AliyunCdn) GetInfo() []string { + return a.infos +} + func (a *AliyunCdn) Deploy(ctx context.Context) error { certName := fmt.Sprintf("%s-%s", a.option.Domain, a.option.DomainId) @@ -49,11 +55,13 @@ func (a *AliyunCdn) Deploy(ctx context.Context) error { runtime := &util.RuntimeOptions{} - _, err := a.client.SetCdnDomainSSLCertificateWithOptions(setCdnDomainSSLCertificateRequest, runtime) + resp, err := a.client.SetCdnDomainSSLCertificateWithOptions(setCdnDomainSSLCertificateRequest, runtime) if err != nil { return err } + a.infos = append(a.infos, toStr("cdn设置证书", resp)) + return nil } diff --git a/internal/deployer/deployer.go b/internal/deployer/deployer.go index 9e0da854..c4d6efa1 100644 --- a/internal/deployer/deployer.go +++ b/internal/deployer/deployer.go @@ -3,6 +3,7 @@ package deployer import ( "certimate/internal/applicant" "context" + "encoding/json" "errors" "strings" @@ -31,6 +32,7 @@ type DeployerOption struct { type Deployer interface { Deploy(ctx context.Context) error + GetInfo() []string } func Get(record *models.Record, cert *applicant.Certificate) (Deployer, error) { @@ -73,3 +75,11 @@ func getProduct(record *models.Record) string { } return rs[1] } + +func toStr(tag string, data any) string { + if data == nil { + return tag + } + byts, _ := json.Marshal(data) + return tag + ":" + string(byts) +} diff --git a/internal/deployer/ssh.go b/internal/deployer/ssh.go index bd844c43..78186309 100644 --- a/internal/deployer/ssh.go +++ b/internal/deployer/ssh.go @@ -14,6 +14,7 @@ import ( type ssh struct { option *DeployerOption + infos []string } type sshAccess struct { @@ -30,9 +31,14 @@ type sshAccess struct { func NewSSH(option *DeployerOption) (Deployer, error) { return &ssh{ option: option, + infos: make([]string, 0), }, nil } +func (s *ssh) GetInfo() []string { + return s.infos +} + func (s *ssh) Deploy(ctx context.Context) error { access := &sshAccess{} if err := json.Unmarshal([]byte(s.option.Access), access); err != nil { @@ -45,6 +51,8 @@ func (s *ssh) Deploy(ctx context.Context) error { } defer client.Close() + s.infos = append(s.infos, toStr("ssh连接成功", nil)) + // 上传 session, err := client.NewSession() if err != nil { @@ -52,16 +60,22 @@ func (s *ssh) Deploy(ctx context.Context) error { } defer session.Close() + s.infos = append(s.infos, toStr("ssh创建session成功", nil)) + // 上传证书 if err := s.upload(client, s.option.Certificate.Certificate, access.CertPath); err != nil { return fmt.Errorf("failed to upload certificate: %w", err) } + s.infos = append(s.infos, toStr("ssh上传证书成功", nil)) + // 上传私钥 if err := s.upload(client, s.option.Certificate.PrivateKey, access.KeyPath); err != nil { return fmt.Errorf("failed to upload private key: %w", err) } + s.infos = append(s.infos, toStr("ssh上传私钥成功", nil)) + // 执行命令 var stdoutBuf bytes.Buffer session.Stdout = &stdoutBuf @@ -72,6 +86,8 @@ func (s *ssh) Deploy(ctx context.Context) error { return fmt.Errorf("failed to run command: %w, stdout: %s, stderr: %s", err, stdoutBuf.String(), stderrBuf.String()) } + s.infos = append(s.infos, toStr("ssh执行命令成功", []string{stdoutBuf.String()})) + return nil } diff --git a/internal/deployer/tencent_cdn.go b/internal/deployer/tencent_cdn.go index a9e9da58..4d5d4897 100644 --- a/internal/deployer/tencent_cdn.go +++ b/internal/deployer/tencent_cdn.go @@ -17,6 +17,7 @@ import ( type tencentCdn struct { option *DeployerOption credential *common.Credential + infos []string } func NewTencentCdn(option *DeployerOption) (Deployer, error) { @@ -34,9 +35,14 @@ func NewTencentCdn(option *DeployerOption) (Deployer, error) { return &tencentCdn{ option: option, credential: credential, + infos: make([]string, 0), }, nil } +func (t *tencentCdn) GetInfo() []string { + return t.infos +} + func (t *tencentCdn) Deploy(ctx context.Context) error { // 查询有没有对应的资源 @@ -45,11 +51,14 @@ func (t *tencentCdn) Deploy(ctx context.Context) error { return fmt.Errorf("failed to get resource: %w", err) } + t.infos = append(t.infos, toStr("查询对应的资源", resource)) + // 上传证书 certId, err := t.uploadCert() if err != nil { return fmt.Errorf("failed to upload certificate: %w", err) } + t.infos = append(t.infos, toStr("上传证书", certId)) if err := t.deploy(resource, certId); err != nil { return fmt.Errorf("failed to deploy: %w", err) @@ -100,11 +109,12 @@ func (t *tencentCdn) deploy(resource *tag.ResourceTagMapping, certId string) err request.Status = common.Int64Ptr(1) // 返回的resp是一个DeployCertificateInstanceResponse的实例,与请求对象对应 - _, err = client.DeployCertificateInstance(request) + resp, err := client.DeployCertificateInstance(request) if err != nil { return fmt.Errorf("failed to deploy certificate: %w", err) } + t.infos = append(t.infos, toStr("部署证书", resp.Response)) return nil } diff --git a/internal/deployer/webhook.go b/internal/deployer/webhook.go index 7ea49a51..2ccd0cdc 100644 --- a/internal/deployer/webhook.go +++ b/internal/deployer/webhook.go @@ -21,15 +21,21 @@ type hookData struct { type webhook struct { option *DeployerOption + infos []string } func NewWebhook(option *DeployerOption) (Deployer, error) { return &webhook{ option: option, + infos: make([]string, 0), }, nil } +func (w *webhook) GetInfo() []string { + return w.infos +} + func (w *webhook) Deploy(ctx context.Context) error { access := &webhookAccess{} if err := json.Unmarshal([]byte(w.option.Access), access); err != nil { @@ -44,12 +50,14 @@ func (w *webhook) Deploy(ctx context.Context) error { body, _ := json.Marshal(data) - _, err := xhttp.Req(access.Url, http.MethodPost, bytes.NewReader(body), map[string]string{ + resp, err := xhttp.Req(access.Url, http.MethodPost, bytes.NewReader(body), map[string]string{ "Content-Type": "application/json", }) if err != nil { return fmt.Errorf("failed to send hook request: %w", err) } + w.infos = append(w.infos, toStr("webhook response", string(resp))) + return nil } diff --git a/internal/domains/deploy.go b/internal/domains/deploy.go index ee07bad8..6ea6caa7 100644 --- a/internal/domains/deploy.go +++ b/internal/domains/deploy.go @@ -27,16 +27,17 @@ func deploy(ctx context.Context, record *models.Record) error { } }() var certificate *applicant.Certificate - currRecord, err := app.GetApp().Dao().FindRecordById("domains", record.Id) + history := NewHistory(record) defer history.commit() // ############1.检查域名配置 history.record(checkPhase, "开始检查", nil) + currRecord, err := app.GetApp().Dao().FindRecordById("domains", record.Id) if err != nil { app.GetApp().Logger().Error("获取记录失败", "err", err) - history.record(checkPhase, "获取域名配置失败", err) + history.record(checkPhase, "获取域名配置失败", &RecordInfo{Err: err}) return err } history.record(checkPhase, "获取记录成功", nil) @@ -48,7 +49,7 @@ func deploy(ctx context.Context, record *models.Record) error { } err = errors.Join(errList...) app.GetApp().Logger().Error("展开记录失败", "err", err) - history.record(checkPhase, "获取授权信息失败", err) + history.record(checkPhase, "获取授权信息失败", &RecordInfo{Err: err}) return err } history.record(checkPhase, "获取授权信息成功", nil) @@ -56,9 +57,11 @@ func deploy(ctx context.Context, record *models.Record) error { cert := currRecord.GetString("certificate") expiredAt := currRecord.GetDateTime("expiredAt").Time() - if cert != "" && time.Until(expiredAt) > time.Hour*24 && currRecord.GetBool("deployed") { + if cert != "" && time.Until(expiredAt) > time.Hour*24*10 && currRecord.GetBool("deployed") { app.GetApp().Logger().Info("证书在有效期内") - history.record(checkPhase, "证书在有效期内且已部署,跳过", nil, true) + history.record(checkPhase, "证书在有效期内且已部署,跳过", &RecordInfo{ + Info: []string{fmt.Sprintf("证书有效期至 %s", expiredAt.Format("2006-01-02"))}, + }, true) return err } history.record(checkPhase, "检查通过", nil, true) @@ -67,21 +70,25 @@ func deploy(ctx context.Context, record *models.Record) error { history.record(applyPhase, "开始申请", nil) if cert != "" && time.Until(expiredAt) > time.Hour*24 { - history.record(applyPhase, "证书在有效期内,跳过", nil) + history.record(applyPhase, "证书在有效期内,跳过", &RecordInfo{ + Info: []string{fmt.Sprintf("证书有效期至 %s", expiredAt.Format("2006-01-02"))}, + }) } else { applicant, err := applicant.Get(currRecord) if err != nil { - history.record(applyPhase, "获取applicant失败", err) + history.record(applyPhase, "获取applicant失败", &RecordInfo{Err: err}) app.GetApp().Logger().Error("获取applicant失败", "err", err) return err } certificate, err = applicant.Apply() if err != nil { - history.record(applyPhase, "申请证书失败", err) + history.record(applyPhase, "申请证书失败", &RecordInfo{Err: err}) app.GetApp().Logger().Error("申请证书失败", "err", err) return err } - history.record(applyPhase, "申请证书成功", nil) + history.record(applyPhase, "申请证书成功", &RecordInfo{ + Info: []string{fmt.Sprintf("证书地址: %s", certificate.CertUrl)}, + }) history.setCert(certificate) } @@ -91,7 +98,7 @@ func deploy(ctx context.Context, record *models.Record) error { history.record(deployPhase, "开始部署", nil, false) deployer, err := deployer.Get(currRecord, certificate) if err != nil { - history.record(deployPhase, "获取deployer失败", err) + history.record(deployPhase, "获取deployer失败", &RecordInfo{Err: err}) app.GetApp().Logger().Error("获取deployer失败", "err", err) return err } @@ -99,12 +106,14 @@ func deploy(ctx context.Context, record *models.Record) error { if err = deployer.Deploy(ctx); err != nil { app.GetApp().Logger().Error("部署失败", "err", err) - history.record(deployPhase, "部署失败", err) + history.record(deployPhase, "部署失败", &RecordInfo{Err: err, Info: deployer.GetInfo()}) return err } app.GetApp().Logger().Info("部署成功") - history.record(deployPhase, "部署成功", nil, true) + history.record(deployPhase, "部署成功", &RecordInfo{ + Info: deployer.GetInfo(), + }, true) return nil } diff --git a/internal/domains/history.go b/internal/domains/history.go index 5431bd2a..db9336dd 100644 --- a/internal/domains/history.go +++ b/internal/domains/history.go @@ -10,9 +10,15 @@ import ( ) type historyItem struct { - Time string `json:"time"` - Message string `json:"message"` - Error string `json:"error"` + Time string `json:"time"` + Message string `json:"message"` + Error string `json:"error"` + Info []string `json:"info"` +} + +type RecordInfo struct { + Err error `json:"err"` + Info []string `json:"info"` } type history struct { @@ -34,21 +40,25 @@ func NewHistory(record *models.Record) *history { } } -func (a *history) record(phase Phase, msg string, err error, pass ...bool) { +func (a *history) record(phase Phase, msg string, info *RecordInfo, pass ...bool) { + if info == nil { + info = &RecordInfo{} + } a.Phase = phase if len(pass) > 0 { a.PhaseSuccess = pass[0] } errMsg := "" - if err != nil { - errMsg = err.Error() + if info.Err != nil { + errMsg = info.Err.Error() a.PhaseSuccess = false } a.Log[phase] = append(a.Log[phase], historyItem{ Message: msg, Error: errMsg, + Info: info.Info, Time: xtime.BeijingTimeStr(), }) diff --git a/ui/dist/assets/index-B6xIlnQB.js b/ui/dist/assets/index-D3t3IJ9L.js similarity index 99% rename from ui/dist/assets/index-B6xIlnQB.js rename to ui/dist/assets/index-D3t3IJ9L.js index 6c372b9b..33338718 100644 --- a/ui/dist/assets/index-B6xIlnQB.js +++ b/ui/dist/assets/index-D3t3IJ9L.js @@ -236,4 +236,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(r){e.exports=r()})(function(){return function r(n,s,o){function i(c,f){if(!s[c]){if(!n[c]){var d=typeof eu=="function"&&eu;if(!f&&d)return d(c,!0);if(a)return a(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var p=s[c]={exports:{}};n[c][0].call(p.exports,function(w){var m=n[c][1][w];return i(m||w)},p,p.exports,r,n,s,o)}return s[c].exports}for(var a=typeof eu=="function"&&eu,l=0;l<o.length;l++)i(o[l]);return i}({1:[function(r,n,s){var o=r("./utils"),i=r("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var c,f,d,h,p,w,m,x=[],g=0,v=l.length,_=v,C=o.getTypeOf(l)!=="string";g<l.length;)_=v-g,d=C?(c=l[g++],f=g<v?l[g++]:0,g<v?l[g++]:0):(c=l.charCodeAt(g++),f=g<v?l.charCodeAt(g++):0,g<v?l.charCodeAt(g++):0),h=c>>2,p=(3&c)<<4|f>>4,w=1<_?(15&f)<<2|d>>6:64,m=2<_?63&d:64,x.push(a.charAt(h)+a.charAt(p)+a.charAt(w)+a.charAt(m));return x.join("")},s.decode=function(l){var c,f,d,h,p,w,m=0,x=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var v,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&_--,l.charAt(l.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=i.uint8array?new Uint8Array(0|_):new Array(0|_);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(h=a.indexOf(l.charAt(m++)))>>4,f=(15&h)<<4|(p=a.indexOf(l.charAt(m++)))>>2,d=(3&p)<<6|(w=a.indexOf(l.charAt(m++))),v[x++]=c,p!==64&&(v[x++]=f),w!==64&&(v[x++]=d);return v}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),i=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),l=r("./stream/DataLengthProbe");function c(f,d,h,p,w){this.compressedSize=f,this.uncompressedSize=d,this.crc32=h,this.compression=p,this.compressedContent=w}c.prototype={getContentWorker:function(){var f=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return f.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},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)}},c.createWorkerFrom=function(f,d,h){return f.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},n.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),i=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var f=0;f<8;f++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(c,f,d,h){var p=i,w=h+d;c^=-1;for(var m=h;m<w;m++)c=c>>>8^p[255&(c^f[m])];return-1^c}(0|l,a,a.length,0):function(c,f,d,h){var p=i,w=h+d;c^=-1;for(var m=h;m<w;m++)c=c>>>8^p[255&(c^f.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,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(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=r("pako"),a=r("./utils"),l=r("./stream/GenericWorker"),c=o?"uint8array":"array";function f(d,h){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=h,this.meta={}}s.magic="\b\0",a.inherits(f,l),f.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},f.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(h){d.push({data:h,meta:d.meta})}},s.compressWorker=function(d){return new f("Deflate",d)},s.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(p,w){var m,x="";for(m=0;m<w;m++)x+=String.fromCharCode(255&p),p>>>=8;return x}function i(p,w,m,x,g,v){var _,C,E=p.file,T=p.compression,P=v!==c.utf8encode,O=a.transformTo("string",v(E.name)),j=a.transformTo("string",c.utf8encode(E.name)),L=E.comment,q=a.transformTo("string",v(L)),R=a.transformTo("string",c.utf8encode(L)),F=j.length!==E.name.length,b=R.length!==L.length,V="",te="",W="",Z=E.dir,I=E.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};w&&!m||(Q.crc32=p.crc32,Q.compressedSize=p.compressedSize,Q.uncompressedSize=p.uncompressedSize);var z=0;w&&(z|=8),P||!F&&!b||(z|=2048);var $=0,de=0;Z&&($|=16),g==="UNIX"?(de=798,$|=function(se,Ee){var fe=se;return se||(fe=Ee?16893:33204),(65535&fe)<<16}(E.unixPermissions,Z)):(de=20,$|=function(se){return 63&(se||0)}(E.dosPermissions)),_=I.getUTCHours(),_<<=6,_|=I.getUTCMinutes(),_<<=5,_|=I.getUTCSeconds()/2,C=I.getUTCFullYear()-1980,C<<=4,C|=I.getUTCMonth()+1,C<<=5,C|=I.getUTCDate(),F&&(te=o(1,1)+o(f(O),4)+j,V+="up"+o(te.length,2)+te),b&&(W=o(1,1)+o(f(q),4)+R,V+="uc"+o(W.length,2)+W);var ne="";return ne+=` -\0`,ne+=o(z,2),ne+=T.magic,ne+=o(_,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(O.length,2),ne+=o(V.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ne+O+V,dirRecord:d.CENTRAL_FILE_HEADER+o(de,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(x,4)+O+V+q}}var a=r("../utils"),l=r("../stream/GenericWorker"),c=r("../utf8"),f=r("../crc32"),d=r("../signature");function h(p,w,m,x){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=w,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(p){var w=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(w+100*(m-x-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var w=this.streamFiles&&!p.file.dir;if(w){var m=i(p,w,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var w=this.streamFiles&&!p.file.dir,m=i(p,w,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),w)this.push({data:function(x){return d.DATA_DESCRIPTOR+o(x.crc32,4)+o(x.compressedSize,4)+o(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,w=0;w<this.dirRecords.length;w++)this.push({data:this.dirRecords[w],meta:{percent:100}});var m=this.bytesWritten-p,x=function(g,v,_,C,E){var T=a.transformTo("string",E(C));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(g,2)+o(g,2)+o(v,4)+o(_,4)+o(T.length,2)+T}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var w=this;return p.on("data",function(m){w.processChunk(m)}),p.on("end",function(){w.closedSource(w.previous.streamInfo),w._sources.length?w.prepareNextSource():w.end()}),p.on("error",function(m){w.error(m)}),this},h.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var w=this._sources;if(!l.prototype.error.call(this,p))return!1;for(var m=0;m<w.length;m++)try{w[m].error(p)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var p=this._sources,w=0;w<p.length;w++)p[w].lock()},n.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var o=r("../compressions"),i=r("./ZipFileWorker");s.generateWorker=function(a,l,c){var f=new i(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(h,p){d++;var w=function(v,_){var C=v||_,E=o[C];if(!E)throw new Error(C+" is not a valid compression method !");return E}(p.options.compression,l.compression),m=p.options.compressionOptions||l.compressionOptions||{},x=p.dir,g=p.date;p._compressWorker(w,m).withStreamInfo("file",{name:h,dir:x,date:g,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(f)}),f.entriesCount=d}catch(h){f.error(h)}return f}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function o(){if(!(this instanceof o))return new o;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new o;for(var a in this)typeof this[a]!="function"&&(i[a]=this[a]);return i}}(o.prototype=r("./object")).loadAsync=r("./load"),o.support=r("./support"),o.defaults=r("./defaults"),o.version="3.10.1",o.loadAsync=function(i,a){return new o().loadAsync(i,a)},o.external=r("./external"),n.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var o=r("./utils"),i=r("./external"),a=r("./utf8"),l=r("./zipEntries"),c=r("./stream/Crc32Probe"),f=r("./nodejsUtils");function d(h){return new i.Promise(function(p,w){var m=h.decompressed.getContentWorker().pipe(new c);m.on("error",function(x){w(x)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?w(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(h,p){var w=this;return p=o.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),f.isNode&&f.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new l(p);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],g=m.files;if(p.checkCRC32)for(var v=0;v<g.length;v++)x.push(d(g[v]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),g=x.files,v=0;v<g.length;v++){var _=g[v],C=_.fileNameStr,E=o.resolve(_.fileNameStr);w.file(E,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:p.createFolders}),_.dir||(w.file(E).unsafeOriginalName=C)}return x.zipComment.length&&(w.comment=x.zipComment),w})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var o=r("../utils"),i=r("../stream/GenericWorker");function a(l,c){i.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}o.inherits(a,i),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(f){c.push({data:f,meta:{percent:0}})}).on("error",function(f){c.isPaused?this.generatedError=f:c.error(f)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var o=r("readable-stream").Readable;function i(a,l,c){o.call(this,l),this._helper=a;var f=this;a.on("data",function(d,h){f.push(d)||f._helper.pause(),c&&c(h)}).on("error",function(d){f.emit("error",d)}).on("end",function(){f.push(null)})}r("../utils").inherits(i,o),i.prototype._read=function(){this._helper.resume()},n.exports=i},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,i);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,i)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var i=new Buffer(o);return i.fill(0),i},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(r,n,s){function o(E,T,P){var O,j=a.getTypeOf(T),L=a.extend(P||{},f);L.date=L.date||new Date,L.compression!==null&&(L.compression=L.compression.toUpperCase()),typeof L.unixPermissions=="string"&&(L.unixPermissions=parseInt(L.unixPermissions,8)),L.unixPermissions&&16384&L.unixPermissions&&(L.dir=!0),L.dosPermissions&&16&L.dosPermissions&&(L.dir=!0),L.dir&&(E=g(E)),L.createFolders&&(O=x(E))&&v.call(this,O,!0);var q=j==="string"&&L.binary===!1&&L.base64===!1;P&&P.binary!==void 0||(L.binary=!q),(T instanceof d&&T.uncompressedSize===0||L.dir||!T||T.length===0)&&(L.base64=!1,L.binary=!0,T="",L.compression="STORE",j="string");var R=null;R=T instanceof d||T instanceof l?T:w.isNode&&w.isStream(T)?new m(E,T):a.prepareContent(E,T,L.binary,L.optimizedBinaryString,L.base64);var F=new h(E,R,L);this.files[E]=F}var i=r("./utf8"),a=r("./utils"),l=r("./stream/GenericWorker"),c=r("./stream/StreamHelper"),f=r("./defaults"),d=r("./compressedObject"),h=r("./zipObject"),p=r("./generate"),w=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),x=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var T=E.lastIndexOf("/");return 0<T?E.substring(0,T):""},g=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,T){return T=T!==void 0?T:f.createFolders,E=g(E),this.files[E]||o.call(this,E,null,{dir:!0,createFolders:T}),this.files[E]};function _(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var T,P,O;for(T in this.files)O=this.files[T],(P=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&E(P,O)},filter:function(E){var T=[];return this.forEach(function(P,O){E(P,O)&&T.push(O)}),T},file:function(E,T,P){if(arguments.length!==1)return E=this.root+E,o.call(this,E,T,P),this;if(_(E)){var O=E;return this.filter(function(L,q){return!q.dir&&O.test(L)})}var j=this.files[this.root+E];return j&&!j.dir?j:null},folder:function(E){if(!E)return this;if(_(E))return this.filter(function(j,L){return L.dir&&E.test(j)});var T=this.root+E,P=v.call(this,T),O=this.clone();return O.root=P.name,O},remove:function(E){E=this.root+E;var T=this.files[E];if(T||(E.slice(-1)!=="/"&&(E+="/"),T=this.files[E]),T&&!T.dir)delete this.files[E];else for(var P=this.filter(function(j,L){return L.name.slice(0,E.length)===E}),O=0;O<P.length;O++)delete this.files[P[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var T,P={};try{if((P=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");a.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var O=P.comment||this.comment||"";T=p.generateWorker(this,P,O)}catch(j){(T=new l("error")).error(j)}return new c(T,P.type||"string",P.mimeType)},generateAsync:function(E,T){return this.generateInternalStream(E).accumulate(T)},generateNodeStream:function(E,T){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(T)}};n.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),f=a.charCodeAt(2),d=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===c&&this.data[h+2]===f&&this.data[h+3]===d)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),f=a.charCodeAt(2),d=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&c===h[1]&&f===h[2]&&d===h[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var o=r("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},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))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../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 l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),l=r("./StringReader"),c=r("./NodeBufferReader"),f=r("./Uint8ArrayReader");n.exports=function(d){var h=o.getTypeOf(d);return o.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new c(d):i.uint8array?new f(o.transformTo("uint8array",d)):new a(o.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,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(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(l){o.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,o),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(a,i),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}i.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(l){i.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(f){c.dataIsReady=!0,c.data=f,c.max=f&&f.length||0,c.type=o.getTypeOf(f),c.isPaused||c._tickAndRepeat()},function(f){c.error(f)})}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 l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,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 l=0;l<this._listeners[i].length;l++)this._listeners[i][l].call(this,a)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var a=this;return i.on("data",function(l){a.processChunk(l)}),i.on("end",function(){a.end()}),i.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,a){return this.extraStreamInfo[i]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),l=r("../base64"),c=r("../support"),f=r("../external"),d=null;if(c.nodestream)try{d=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(w,m){return new f.Promise(function(x,g){var v=[],_=w._internalType,C=w._outputType,E=w._mimeType;w.on("data",function(T,P){v.push(T),m&&m(P)}).on("error",function(T){v=[],g(T)}).on("end",function(){try{var T=function(P,O,j){switch(P){case"blob":return o.newBlob(o.transformTo("arraybuffer",O),j);case"base64":return l.encode(O);default:return o.transformTo(P,O)}}(C,function(P,O){var j,L=0,q=null,R=0;for(j=0;j<O.length;j++)R+=O[j].length;switch(P){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(q=new Uint8Array(R),j=0;j<O.length;j++)q.set(O[j],L),L+=O[j].length;return q;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+P+"'")}}(_,v),E);x(T)}catch(P){g(P)}v=[]}).resume()})}function p(w,m,x){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=x,o.checkSupport(g),this._worker=w.pipe(new i(g)),w.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}p.prototype={accumulate:function(w){return h(this,w)},on:function(w,m){var x=this;return w==="data"?this._worker.on(w,function(g){m.call(x,g.data,g.meta)}):this._worker.on(w,function(){o.delay(m,arguments,x)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(w){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},w)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"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=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),l=r("./stream/GenericWorker"),c=new Array(256),f=0;f<256;f++)c[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}s.utf8encode=function(p){return i.nodebuffer?a.newBufferFrom(p,"utf-8"):function(w){var m,x,g,v,_,C=w.length,E=0;for(v=0;v<C;v++)(64512&(x=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(g=w.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),v++),E+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(E):new Array(E),v=_=0;_<E;v++)(64512&(x=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(g=w.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),v++),x<128?m[_++]=x:(x<2048?m[_++]=192|x>>>6:(x<65536?m[_++]=224|x>>>12:(m[_++]=240|x>>>18,m[_++]=128|x>>>12&63),m[_++]=128|x>>>6&63),m[_++]=128|63&x);return m}(p)},s.utf8decode=function(p){return i.nodebuffer?o.transformTo("nodebuffer",p).toString("utf-8"):function(w){var m,x,g,v,_=w.length,C=new Array(2*_);for(m=x=0;m<_;)if((g=w[m++])<128)C[x++]=g;else if(4<(v=c[g]))C[x++]=65533,m+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&m<_;)g=g<<6|63&w[m++],v--;1<v?C[x++]=65533:g<65536?C[x++]=g:(g-=65536,C[x++]=55296|g>>10&1023,C[x++]=56320|1023&g)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),o.applyFromCharCode(C)}(p=o.transformTo(i.uint8array?"uint8array":"array",p))},o.inherits(d,l),d.prototype.processChunk=function(p){var w=o.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=w;(w=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),w.set(m,this.leftOver.length)}else w=this.leftOver.concat(w);this.leftOver=null}var x=function(v,_){var C;for((_=_||v.length)>v.length&&(_=v.length),C=_-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?_:C+c[v[C]]>_?C:_}(w),g=w;x!==w.length&&(i.uint8array?(g=w.subarray(0,x),this.leftOver=w.subarray(x,w.length)):(g=w.slice(0,x),this.leftOver=w.slice(x,w.length))),this.push({data:s.utf8decode(g),meta:p.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,o.inherits(h,l),h.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),l=r("./external");function c(m){return m}function f(m,x){for(var g=0;g<m.length;++g)x[g]=255&m.charCodeAt(g);return x}r("setimmediate"),s.newBlob=function(m,x){s.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,x,g){var v=[],_=0,C=m.length;if(C<=g)return String.fromCharCode.apply(null,m);for(;_<C;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(_,Math.min(_+g,C)))):v.push(String.fromCharCode.apply(null,m.subarray(_,Math.min(_+g,C)))),_+=g;return v.join("")},stringifyByChar:function(m){for(var x="",g=0;g<m.length;g++)x+=String.fromCharCode(m[g]);return x},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function h(m){var x=65536,g=s.getTypeOf(m),v=!0;if(g==="uint8array"?v=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(v=d.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return d.stringifyByChunk(m,g,x)}catch{x=Math.floor(x/2)}return d.stringifyByChar(m)}function p(m,x){for(var g=0;g<m.length;g++)x[g]=m[g];return x}s.applyFromCharCode=h;var w={};w.string={string:c,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return w.string.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:function(m){return f(m,a.allocBuffer(m.length))}},w.array={string:h,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},w.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},w.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},w.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return w.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,x){if(x=x||"",!m)return x;s.checkSupport(m);var g=s.getTypeOf(x);return w[g][m](x)},s.resolve=function(m){for(var x=m.split("/"),g=[],v=0;v<x.length;v++){var _=x[v];_==="."||_===""&&v!==0&&v!==x.length-1||(_===".."?g.pop():g.push(_))}return g.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":o.nodebuffer&&a.isBuffer(m)?"nodebuffer":o.uint8array&&m instanceof Uint8Array?"uint8array":o.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!o[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var x,g,v="";for(g=0;g<(m||"").length;g++)v+="\\x"+((x=m.charCodeAt(g))<16?"0":"")+x.toString(16).toUpperCase();return v},s.delay=function(m,x,g){setImmediate(function(){m.apply(g||null,x||[])})},s.inherits=function(m,x){function g(){}g.prototype=x.prototype,m.prototype=new g},s.extend=function(){var m,x,g={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&g[x]===void 0&&(g[x]=arguments[m][x]);return g},s.prepareContent=function(m,x,g,v,_){return l.Promise.resolve(x).then(function(C){return o.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(E,T){var P=new FileReader;P.onload=function(O){E(O.target.result)},P.onerror=function(O){T(O.target.error)},P.readAsArrayBuffer(C)}):C}).then(function(C){var E=s.getTypeOf(C);return E?(E==="arraybuffer"?C=s.transformTo("uint8array",C):E==="string"&&(_?C=i.decode(C):g&&v!==!0&&(C=function(T){return f(T,o.uint8array?new Uint8Array(T.length):new Array(T.length))}(C))),C):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var o=r("./reader/readerFor"),i=r("./utils"),a=r("./signature"),l=r("./zipEntry"),c=r("./support");function f(d){this.files=[],this.loadOptions=d}f.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(d)+")")}},isSignature:function(d,h){var p=this.reader.index;this.reader.setIndex(d);var w=this.reader.readString(4)===h;return this.reader.setIndex(p),w},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),h=c.uint8array?"uint8array":"array",p=i.transformTo(h,d);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,h,p,w=this.zip64EndOfCentralSize-44;0<w;)d=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[d]={id:d,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,h;for(d=0;d<this.files.length;d++)h=this.files[d],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var h=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var w=h-p;if(0<w)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=w);else if(w<0)throw new Error("Corrupted zip: missing "+Math.abs(w)+" bytes.")},prepareReader:function(d){this.reader=o(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var o=r("./reader/readerFor"),i=r("./utils"),a=r("./compressedObject"),l=r("./crc32"),c=r("./utf8"),f=r("./compressions"),d=r("./support");function h(p,w){this.options=p,this.loadOptions=w}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var w,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((w=function(x){for(var g in f)if(Object.prototype.hasOwnProperty.call(f,g)&&f[g].magic===x)return f[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,w,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var w=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(w),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var w,m,x,g=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<g;)w=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[w]={id:w,length:m,value:x};p.setIndex(g)},handleUTF8:function(){var p=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var w=this.findExtraFieldUnicodePath();if(w!==null)this.fileNameStr=w;else{var m=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var g=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var w=o(p.value);return w.readInt(1)!==1||l(this.fileName)!==w.readInt(4)?null:c.utf8decode(w.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var w=o(p.value);return w.readInt(1)!==1||l(this.fileComment)!==w.readInt(4)?null:c.utf8decode(w.readData(p.length-5))}return null}},n.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function o(w,m,x){this.name=w,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=r("./stream/StreamHelper"),a=r("./stream/DataWorker"),l=r("./utf8"),c=r("./compressedObject"),f=r("./stream/GenericWorker");o.prototype={internalStream:function(w){var m=null,x="string";try{if(!w)throw new Error("No output type specified.");var g=(x=w.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!v&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(_){(m=new f("error")).error(_)}return new i(m,x,"")},async:function(w,m){return this.internalStream(w).accumulate(m)},nodeStream:function(w,m){return this.internalStream(w||"nodebuffer").toNodejsStream(m)},_compressWorker:function(w,m){if(this._data instanceof c&&this._data.compression.magic===w.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(x,w,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof f?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<d.length;p++)o.prototype[d[p]]=h;n.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(o){var i,a,l=o.MutationObserver||o.WebKitMutationObserver;if(l){var c=0,f=new l(w),d=o.document.createTextNode("");f.observe(d,{characterData:!0}),i=function(){d.data=c=++c%2}}else if(o.setImmediate||o.MessageChannel===void 0)i="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var m=o.document.createElement("script");m.onreadystatechange=function(){w(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},o.document.documentElement.appendChild(m)}:function(){setTimeout(w,0)};else{var h=new o.MessageChannel;h.port1.onmessage=w,i=function(){h.port2.postMessage(0)}}var p=[];function w(){var m,x;a=!0;for(var g=p.length;g;){for(x=p,p=[],m=-1;++m<g;)x[m]();g=p.length}a=!1}n.exports=function(m){p.push(m)!==1||a||i()}}).call(this,typeof kc<"u"?kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var o=r("immediate");function i(){}var a={},l=["REJECTED"],c=["FULFILLED"],f=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,g!==i&&m(this,g)}function h(g,v,_){this.promise=g,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function p(g,v,_){o(function(){var C;try{C=v(_)}catch(E){return a.reject(g,E)}C===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,C)})}function w(g){var v=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof v=="function")return function(){v.apply(g,arguments)}}function m(g,v){var _=!1;function C(P){_||(_=!0,a.reject(g,P))}function E(P){_||(_=!0,a.resolve(g,P))}var T=x(function(){v(E,C)});T.status==="error"&&C(T.value)}function x(g,v){var _={};try{_.value=g(v),_.status="success"}catch(C){_.status="error",_.value=C}return _}(n.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var v=this.constructor;return this.then(function(_){return v.resolve(g()).then(function(){return _})},function(_){return v.resolve(g()).then(function(){throw _})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,v){if(typeof g!="function"&&this.state===c||typeof v!="function"&&this.state===l)return this;var _=new this.constructor(i);return this.state!==f?p(_,this.state===c?g:v,this.outcome):this.queue.push(new h(_,g,v)),_},h.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},h.prototype.otherCallFulfilled=function(g){p(this.promise,this.onFulfilled,g)},h.prototype.callRejected=function(g){a.reject(this.promise,g)},h.prototype.otherCallRejected=function(g){p(this.promise,this.onRejected,g)},a.resolve=function(g,v){var _=x(w,v);if(_.status==="error")return a.reject(g,_.value);var C=_.value;if(C)m(g,C);else{g.state=c,g.outcome=v;for(var E=-1,T=g.queue.length;++E<T;)g.queue[E].callFulfilled(v)}return g},a.reject=function(g,v){g.state=l,g.outcome=v;for(var _=-1,C=g.queue.length;++_<C;)g.queue[_].callRejected(v);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(i),g)},d.reject=function(g){var v=new this(i);return a.reject(v,g)},d.all=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,C=!1;if(!_)return this.resolve([]);for(var E=new Array(_),T=0,P=-1,O=new this(i);++P<_;)j(g[P],P);return O;function j(L,q){v.resolve(L).then(function(R){E[q]=R,++T!==_||C||(C=!0,a.resolve(O,E))},function(R){C||(C=!0,a.reject(O,R))})}},d.race=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,C=!1;if(!_)return this.resolve([]);for(var E=-1,T=new this(i);++E<_;)P=g[E],v.resolve(P).then(function(O){C||(C=!0,a.resolve(T,O))},function(O){C||(C=!0,a.reject(T,O))});var P;return T}},{immediate:36}],38:[function(r,n,s){var o={};(0,r("./lib/utils/common").assign)(o,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var o=r("./zlib/deflate"),i=r("./utils/common"),a=r("./utils/strings"),l=r("./zlib/messages"),c=r("./zlib/zstream"),f=Object.prototype.toString,d=0,h=-1,p=0,w=8;function m(g){if(!(this instanceof m))return new m(g);this.options=i.assign({level:h,method:w,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},g||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var _=o.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(_!==d)throw new Error(l[_]);if(v.header&&o.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?a.string2buf(v.dictionary):f.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(_=o.deflateSetDictionary(this.strm,C))!==d)throw new Error(l[_]);this._dict_set=!0}}function x(g,v){var _=new m(v);if(_.push(g,!0),_.err)throw _.msg||l[_.err];return _.result}m.prototype.push=function(g,v){var _,C,E=this.strm,T=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof g=="string"?E.input=a.string2buf(g):f.call(g)==="[object ArrayBuffer]"?E.input=new Uint8Array(g):E.input=g,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(T),E.next_out=0,E.avail_out=T),(_=o.deflate(E,C))!==1&&_!==d)return this.onEnd(_),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(i.shrinkBuf(E.output,E.next_out))):this.onData(i.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&_!==1);return C===4?(_=o.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===d):C!==2||(this.onEnd(d),!(E.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=m,s.deflate=x,s.deflateRaw=function(g,v){return(v=v||{}).raw=!0,x(g,v)},s.gzip=function(g,v){return(v=v||{}).gzip=!0,x(g,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var o=r("./zlib/inflate"),i=r("./utils/common"),a=r("./utils/strings"),l=r("./zlib/constants"),c=r("./zlib/messages"),f=r("./zlib/zstream"),d=r("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var g=o.inflateInit2(this.strm,x.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,o.inflateGetHeader(this.strm,this.header)}function w(m,x){var g=new p(x);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}p.prototype.push=function(m,x){var g,v,_,C,E,T,P=this.strm,O=this.options.chunkSize,j=this.options.dictionary,L=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?P.input=a.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?P.input=new Uint8Array(m):P.input=m,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new i.Buf8(O),P.next_out=0,P.avail_out=O),(g=o.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&j&&(T=typeof j=="string"?a.string2buf(j):h.call(j)==="[object ArrayBuffer]"?new Uint8Array(j):j,g=o.inflateSetDictionary(this.strm,T)),g===l.Z_BUF_ERROR&&L===!0&&(g=l.Z_OK,L=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&g!==l.Z_STREAM_END&&(P.avail_in!==0||v!==l.Z_FINISH&&v!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=a.utf8border(P.output,P.next_out),C=P.next_out-_,E=a.buf2string(P.output,_),P.next_out=C,P.avail_out=O-C,C&&i.arraySet(P.output,P.output,_,C,0),this.onData(E)):this.onData(i.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(L=!0)}while((0<P.avail_in||P.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(v=l.Z_FINISH),v===l.Z_FINISH?(g=o.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):v!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=w,s.inflateRaw=function(m,x){return(x=x||{}).raw=!0,w(m,x)},s.ungzip=w},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var f=c.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var d in f)f.hasOwnProperty(d)&&(l[d]=f[d])}}return l},s.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var i={arraySet:function(l,c,f,d,h){if(c.subarray&&l.subarray)l.set(c.subarray(f,f+d),h);else for(var p=0;p<d;p++)l[h+p]=c[f+p]},flattenChunks:function(l){var c,f,d,h,p,w;for(c=d=0,f=l.length;c<f;c++)d+=l[c].length;for(w=new Uint8Array(d),c=h=0,f=l.length;c<f;c++)p=l[c],w.set(p,h),h+=p.length;return w}},a={arraySet:function(l,c,f,d,h){for(var p=0;p<d;p++)l[h+p]=c[f+p]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,i)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(o)},{}],42:[function(r,n,s){var o=r("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new o.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function f(d,h){if(h<65537&&(d.subarray&&a||!d.subarray&&i))return String.fromCharCode.apply(null,o.shrinkBuf(d,h));for(var p="",w=0;w<h;w++)p+=String.fromCharCode(d[w]);return p}l[254]=l[254]=1,s.string2buf=function(d){var h,p,w,m,x,g=d.length,v=0;for(m=0;m<g;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(w=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(w-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new o.Buf8(v),m=x=0;x<v;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(w=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(w-56320),m++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},s.buf2binstring=function(d){return f(d,d.length)},s.binstring2buf=function(d){for(var h=new o.Buf8(d.length),p=0,w=h.length;p<w;p++)h[p]=d.charCodeAt(p);return h},s.buf2string=function(d,h){var p,w,m,x,g=h||d.length,v=new Array(2*g);for(p=w=0;p<g;)if((m=d[p++])<128)v[w++]=m;else if(4<(x=l[m]))v[w++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<g;)m=m<<6|63&d[p++],x--;1<x?v[w++]=65533:m<65536?v[w++]=m:(m-=65536,v[w++]=55296|m>>10&1023,v[w++]=56320|1023&m)}return f(v,w)},s.utf8border=function(d,h){var p;for((h=h||d.length)>d.length&&(h=d.length),p=h-1;0<=p&&(192&d[p])==128;)p--;return p<0||p===0?h:p+l[d[p]]>h?p:h}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,l){for(var c=65535&o|0,f=o>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;f=f+(c=c+i[l++]|0)|0,--d;);c%=65521,f%=65521}return c|f<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var o=function(){for(var i,a=[],l=0;l<256;l++){i=l;for(var c=0;c<8;c++)i=1&i?3988292384^i>>>1:i>>>1;a[l]=i}return a}();n.exports=function(i,a,l,c){var f=o,d=c+l;i^=-1;for(var h=c;h<d;h++)i=i>>>8^f[255&(i^a[h])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),l=r("./adler32"),c=r("./crc32"),f=r("./messages"),d=0,h=4,p=0,w=-2,m=-1,x=4,g=2,v=8,_=9,C=286,E=30,T=19,P=2*C+1,O=15,j=3,L=258,q=L+j+1,R=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=f[J],J}function I(k){return(k<<1)-(4<k?9:0)}function Q(k){for(var J=k.length;0<=--J;)k[J]=0}function z(k){var J=k.state,G=J.pending;G>k.avail_out&&(G=k.avail_out),G!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,G,k.next_out),k.next_out+=G,J.pending_out+=G,k.total_out+=G,k.avail_out-=G,J.pending-=G,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function de(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var G,D,S=k.max_chain_length,N=k.strstart,A=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,he=k.strstart+L,Le=H[N+A-1],Oe=H[N+A];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(G=J)+A]===Oe&&H[G+A-1]===Le&&H[G]===H[N]&&H[++G]===H[N+1]){N+=2,G++;do;while(H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&N<he);if(D=L-(he-N),N=he-L,A<D){if(k.match_start=J,Y<=(A=D))break;Le=H[N+A-1],Oe=H[N+A]}}while((J=ee[J&X])>M&&--S!=0);return A<=k.lookahead?A:k.lookahead}function Ee(k){var J,G,D,S,N,A,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=G=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--G;);for(J=G=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--G;);S+=ee}if(k.strm.avail_in===0)break;if(A=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=A.avail_in,H<X&&(X=H),G=X===0?0:(A.avail_in-=X,i.arraySet(Y,A.input,A.next_in,X,M),A.state.wrap===1?A.adler=l(A.adler,Y,X,M):A.state.wrap===2&&(A.adler=c(A.adler,Y,X,M)),A.next_in+=X,A.total_in+=X,X),k.lookahead+=G,k.lookahead+k.insert>=j)for(N=k.strstart-k.insert,k.ins_h=k.window[N],k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+1])&k.hash_mask;k.insert&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+j-1])&k.hash_mask,k.prev[N&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=N,N++,k.insert--,!(k.lookahead+k.insert<j)););}while(k.lookahead<q&&k.strm.avail_in!==0)}function fe(k,J){for(var G,D;;){if(k.lookahead<q){if(Ee(k),k.lookahead<q&&J===d)return b;if(k.lookahead===0)break}if(G=0,k.lookahead>=j&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),G!==0&&k.strstart-G<=k.w_size-q&&(k.match_length=se(k,G)),k.match_length>=j)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-j),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=j){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart,--k.match_length!=0;);k.strstart++}else k.strstart+=k.match_length,k.match_length=0,k.ins_h=k.window[k.strstart],k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+1])&k.hash_mask;else D=a._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++;if(D&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=k.strstart<j-1?k.strstart:j-1,J===h?($(k,!0),k.strm.avail_out===0?te:W):k.last_lit&&($(k,!1),k.strm.avail_out===0)?b:V}function ge(k,J){for(var G,D,S;;){if(k.lookahead<q){if(Ee(k),k.lookahead<q&&J===d)return b;if(k.lookahead===0)break}if(G=0,k.lookahead>=j&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),k.prev_length=k.match_length,k.prev_match=k.match_start,k.match_length=j-1,G!==0&&k.prev_length<k.max_lazy_match&&k.strstart-G<=k.w_size-q&&(k.match_length=se(k,G),k.match_length<=5&&(k.strategy===1||k.match_length===j&&4096<k.strstart-k.match_start)&&(k.match_length=j-1)),k.prev_length>=j&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-j,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-j),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),--k.prev_length!=0;);if(k.match_available=0,k.match_length=j-1,k.strstart++,D&&($(k,!1),k.strm.avail_out===0))return b}else if(k.match_available){if((D=a._tr_tally(k,0,k.window[k.strstart-1]))&&$(k,!1),k.strstart++,k.lookahead--,k.strm.avail_out===0)return b}else k.match_available=1,k.strstart++,k.lookahead--}return k.match_available&&(D=a._tr_tally(k,0,k.window[k.strstart-1]),k.match_available=0),k.insert=k.strstart<j-1?k.strstart:j-1,J===h?($(k,!0),k.strm.avail_out===0?te:W):k.last_lit&&($(k,!1),k.strm.avail_out===0)?b:V}function be(k,J,G,D,S){this.good_length=k,this.max_lazy=J,this.nice_length=G,this.max_chain=D,this.func=S}function Pe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*P),this.dyn_dtree=new i.Buf16(2*(2*E+1)),this.bl_tree=new i.Buf16(2*(2*T+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(O+1),this.heap=new i.Buf16(2*C+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Te(k){var J;return k&&k.state?(k.total_in=k.total_out=0,k.data_type=g,(J=k.state).pending=0,J.pending_out=0,J.wrap<0&&(J.wrap=-J.wrap),J.status=J.wrap?R:F,k.adler=J.wrap===2?0:1,J.last_flush=d,a._tr_init(J),p):Z(k,w)}function Se(k){var J=Te(k);return J===p&&function(G){G.window_size=2*G.w_size,Q(G.head),G.max_lazy_match=o[G.level].max_lazy,G.good_match=o[G.level].good_length,G.nice_match=o[G.level].nice_length,G.max_chain_length=o[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=j-1,G.match_available=0,G.ins_h=0}(k.state),J}function et(k,J,G,D,S,N){if(!k)return w;var A=1;if(J===m&&(J=6),D<0?(A=0,D=-D):15<D&&(A=2,D-=16),S<1||_<S||G!==v||D<8||15<D||J<0||9<J||N<0||x<N)return Z(k,w);D===8&&(D=9);var Y=new Pe;return(k.state=Y).strm=k,Y.wrap=A,Y.gzhead=null,Y.w_bits=D,Y.w_size=1<<Y.w_bits,Y.w_mask=Y.w_size-1,Y.hash_bits=S+7,Y.hash_size=1<<Y.hash_bits,Y.hash_mask=Y.hash_size-1,Y.hash_shift=~~((Y.hash_bits+j-1)/j),Y.window=new i.Buf8(2*Y.w_size),Y.head=new i.Buf16(Y.hash_size),Y.prev=new i.Buf16(Y.w_size),Y.lit_bufsize=1<<S+6,Y.pending_buf_size=4*Y.lit_bufsize,Y.pending_buf=new i.Buf8(Y.pending_buf_size),Y.d_buf=1*Y.lit_bufsize,Y.l_buf=3*Y.lit_bufsize,Y.level=J,Y.strategy=N,Y.method=G,Se(k)}o=[new be(0,0,0,0,function(k,J){var G=65535;for(G>k.pending_buf_size-5&&(G=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Ee(k),k.lookahead===0&&J===d)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+G;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===h?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new be(4,4,8,4,fe),new be(4,5,16,8,fe),new be(4,6,32,32,fe),new be(4,4,16,16,ge),new be(8,16,32,32,ge),new be(8,16,128,128,ge),new be(8,32,128,256,ge),new be(32,128,258,1024,ge),new be(32,258,258,4096,ge)],s.deflateInit=function(k,J){return et(k,J,v,15,8,0)},s.deflateInit2=et,s.deflateReset=Se,s.deflateResetKeep=Te,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?w:(k.state.gzhead=J,p):w},s.deflate=function(k,J){var G,D,S,N;if(!k||!k.state||5<J||J<0)return k?Z(k,w):w;if(D=k.state,!k.output||!k.input&&k.avail_in!==0||D.status===666&&J!==h)return Z(k,k.avail_out===0?-5:w);if(D.strm=k,G=D.last_flush,D.last_flush=J,D.status===R)if(D.wrap===2)k.adler=0,de(D,31),de(D,139),de(D,8),D.gzhead?(de(D,(D.gzhead.text?1:0)+(D.gzhead.hcrc?2:0)+(D.gzhead.extra?4:0)+(D.gzhead.name?8:0)+(D.gzhead.comment?16:0)),de(D,255&D.gzhead.time),de(D,D.gzhead.time>>8&255),de(D,D.gzhead.time>>16&255),de(D,D.gzhead.time>>24&255),de(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),de(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(de(D,255&D.gzhead.extra.length),de(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=c(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(de(D,0),de(D,0),de(D,0),de(D,0),de(D,0),de(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),de(D,3),D.status=F);else{var A=v+(D.w_bits-8<<4)<<8;A|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(A|=32),A+=31-A%31,D.status=F,ne(D,A),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)de(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){N=1;break}N=D.gzindex<D.gzhead.name.length?255&D.gzhead.name.charCodeAt(D.gzindex++):0,de(D,N)}while(N!==0);D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),N===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){N=1;break}N=D.gzindex<D.gzhead.comment.length?255&D.gzhead.comment.charCodeAt(D.gzindex++):0,de(D,N)}while(N!==0);D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),N===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(de(D,255&k.adler),de(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,p}else if(k.avail_in===0&&I(J)<=I(G)&&J!==h)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==d&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Ee(M),M.lookahead===0)){if(H===d)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===h?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,he,Le,Oe=M.window;;){if(M.lookahead<=L){if(Ee(M),M.lookahead<=L&&H===d)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=j&&0<M.strstart&&(ee=Oe[he=M.strstart-1])===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]){Le=M.strstart+L;do;while(ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&he<Le);M.match_length=L-(Le-he),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=j?(X=a._tr_tally(M,1,M.match_length-j),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===h?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),p;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,p}return J!==h?p:D.wrap<=0?1:(D.wrap===2?(de(D,255&k.adler),de(D,k.adler>>8&255),de(D,k.adler>>16&255),de(D,k.adler>>24&255),de(D,255&k.total_in),de(D,k.total_in>>8&255),de(D,k.total_in>>16&255),de(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0<D.wrap&&(D.wrap=-D.wrap),D.pending!==0?p:1)},s.deflateEnd=function(k){var J;return k&&k.state?(J=k.state.status)!==R&&J!==69&&J!==73&&J!==91&&J!==103&&J!==F&&J!==666?Z(k,w):(k.state=null,J===F?Z(k,-3):p):w},s.deflateSetDictionary=function(k,J){var G,D,S,N,A,Y,M,H,X=J.length;if(!k||!k.state||(N=(G=k.state).wrap)===2||N===1&&G.status!==R||G.lookahead)return w;for(N===1&&(k.adler=l(k.adler,J,X,0)),G.wrap=0,X>=G.w_size&&(N===0&&(Q(G.head),G.strstart=0,G.block_start=0,G.insert=0),H=new i.Buf8(G.w_size),i.arraySet(H,J,X-G.w_size,G.w_size,0),J=H,X=G.w_size),A=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Ee(G);G.lookahead>=j;){for(D=G.strstart,S=G.lookahead-(j-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[D+j-1])&G.hash_mask,G.prev[D&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=D,D++,--S;);G.strstart=D,G.lookahead=j-1,Ee(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=j-1,G.match_available=0,k.next_in=Y,k.input=M,k.avail_in=A,G.wrap=N,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(o,i){var a,l,c,f,d,h,p,w,m,x,g,v,_,C,E,T,P,O,j,L,q,R,F,b,V;a=o.state,l=o.next_in,b=o.input,c=l+(o.avail_in-5),f=o.next_out,V=o.output,d=f-(i-o.avail_out),h=f+(o.avail_out-257),p=a.dmax,w=a.wsize,m=a.whave,x=a.wnext,g=a.window,v=a.hold,_=a.bits,C=a.lencode,E=a.distcode,T=(1<<a.lenbits)-1,P=(1<<a.distbits)-1;e:do{_<15&&(v+=b[l++]<<_,_+=8,v+=b[l++]<<_,_+=8),O=C[v&T];t:for(;;){if(v>>>=j=O>>>24,_-=j,(j=O>>>16&255)===0)V[f++]=65535&O;else{if(!(16&j)){if(!(64&j)){O=C[(65535&O)+(v&(1<<j)-1)];continue t}if(32&j){a.mode=12;break e}o.msg="invalid literal/length code",a.mode=30;break e}L=65535&O,(j&=15)&&(_<j&&(v+=b[l++]<<_,_+=8),L+=v&(1<<j)-1,v>>>=j,_-=j),_<15&&(v+=b[l++]<<_,_+=8,v+=b[l++]<<_,_+=8),O=E[v&P];r:for(;;){if(v>>>=j=O>>>24,_-=j,!(16&(j=O>>>16&255))){if(!(64&j)){O=E[(65535&O)+(v&(1<<j)-1)];continue r}o.msg="invalid distance code",a.mode=30;break e}if(q=65535&O,_<(j&=15)&&(v+=b[l++]<<_,(_+=8)<j&&(v+=b[l++]<<_,_+=8)),p<(q+=v&(1<<j)-1)){o.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=j,_-=j,(j=f-d)<q){if(m<(j=q-j)&&a.sane){o.msg="invalid distance too far back",a.mode=30;break e}if(F=g,(R=0)===x){if(R+=w-j,j<L){for(L-=j;V[f++]=g[R++],--j;);R=f-q,F=V}}else if(x<j){if(R+=w+x-j,(j-=x)<L){for(L-=j;V[f++]=g[R++],--j;);if(R=0,x<L){for(L-=j=x;V[f++]=g[R++],--j;);R=f-q,F=V}}}else if(R+=x-j,j<L){for(L-=j;V[f++]=g[R++],--j;);R=f-q,F=V}for(;2<L;)V[f++]=F[R++],V[f++]=F[R++],V[f++]=F[R++],L-=3;L&&(V[f++]=F[R++],1<L&&(V[f++]=F[R++]))}else{for(R=f-q;V[f++]=V[R++],V[f++]=V[R++],V[f++]=V[R++],2<(L-=3););L&&(V[f++]=V[R++],1<L&&(V[f++]=V[R++]))}break}}break}}while(l<c&&f<h);l-=L=_>>3,v&=(1<<(_-=L<<3))-1,o.next_in=l,o.next_out=f,o.avail_in=l<c?c-l+5:5-(l-c),o.avail_out=f<h?h-f+257:257-(f-h),a.hold=v,a.bits=_}},{}],49:[function(r,n,s){var o=r("../utils/common"),i=r("./adler32"),a=r("./crc32"),l=r("./inffast"),c=r("./inftrees"),f=1,d=2,h=0,p=-2,w=1,m=852,x=592;function g(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<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 _(R){var F;return R&&R.state?(F=R.state,R.total_in=R.total_out=F.total=0,R.msg="",F.wrap&&(R.adler=1&F.wrap),F.mode=w,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(m),F.distcode=F.distdyn=new o.Buf32(x),F.sane=1,F.back=-1,h):p}function C(R){var F;return R&&R.state?((F=R.state).wsize=0,F.whave=0,F.wnext=0,_(R)):p}function E(R,F){var b,V;return R&&R.state?(V=R.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?p:(V.window!==null&&V.wbits!==F&&(V.window=null),V.wrap=b,V.wbits=F,C(R))):p}function T(R,F){var b,V;return R?(V=new v,(R.state=V).window=null,(b=E(R,F))!==h&&(R.state=null),b):p}var P,O,j=!0;function L(R){if(j){var F;for(P=new o.Buf32(512),O=new o.Buf32(32),F=0;F<144;)R.lens[F++]=8;for(;F<256;)R.lens[F++]=9;for(;F<280;)R.lens[F++]=7;for(;F<288;)R.lens[F++]=8;for(c(f,R.lens,0,288,P,0,R.work,{bits:9}),F=0;F<32;)R.lens[F++]=5;c(d,R.lens,0,32,O,0,R.work,{bits:5}),j=!1}R.lencode=P,R.lenbits=9,R.distcode=O,R.distbits=5}function q(R,F,b,V){var te,W=R.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new o.Buf8(W.wsize)),V>=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=te))),0}s.inflateReset=C,s.inflateReset2=E,s.inflateResetKeep=_,s.inflateInit=function(R){return T(R,15)},s.inflateInit2=T,s.inflate=function(R,F){var b,V,te,W,Z,I,Q,z,$,de,ne,se,Ee,fe,ge,be,Pe,Te,Se,et,k,J,G,D,S=0,N=new o.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return p;(b=R.state).mode===12&&(b.mode=13),Z=R.next_out,te=R.output,Q=R.avail_out,W=R.next_in,V=R.input,I=R.avail_in,z=b.hold,$=b.bits,de=I,ne=Q,J=h;e:for(;;)switch(b.mode){case w:if(b.wrap===0){b.mode=13;break}for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(2&b.wrap&&z===35615){N[b.check=0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){R.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){R.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){R.msg="invalid window size",b.mode=30;break}b.dmax=1<<k,R.adler=b.check=1,b.mode=512&z?10:12,$=z=0;break;case 2:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(b.flags=z,(255&b.flags)!=8){R.msg="unknown compression method",b.mode=30;break}if(57344&b.flags){R.msg="unknown header flags set",b.mode=30;break}b.head&&(b.head.text=z>>8&1),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,N[2]=z>>>16&255,N[3]=z>>>24&255,b.check=a(b.check,N,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se<I;);if(512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,k)break e}else b.head&&(b.head.name=null);b.length=0,b.mode=8;case 8:if(4096&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.comment+=String.fromCharCode(k)),k&&se<I;);if(512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,k)break e}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(512&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z!==(65535&b.check)){R.msg="header crc mismatch",b.mode=30;break}$=z=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0),R.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}R.adler=b.check=g(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,2;R.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:R.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){R.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I<se&&(se=I),Q<se&&(se=Q),se===0)break e;o.arraySet(te,V,W,se,Z),I-=se,W+=se,Q-=se,Z+=se,b.length-=se;break}b.mode=12;break;case 17:for(;$<14;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(b.nlen=257+(31&z),z>>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286<b.nlen||30<b.ndist){R.msg="too many length or distance symbols",b.mode=30;break}b.have=0,b.mode=18;case 18:for(;b.have<b.ncode;){for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.lens[A[b.have++]]=7&z,z>>>=3,$-=3}for(;b.have<19;)b.lens[A[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,G={bits:b.lenbits},J=c(0,b.lens,0,19,b.lencode,0,b.work,G),b.lenbits=G.bits,J){R.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have<b.nlen+b.ndist;){for(;be=(S=b.lencode[z&(1<<b.lenbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Pe<16)z>>>=ge,$-=ge,b.lens[b.have++]=Pe;else{if(Pe===16){for(D=ge+2;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z>>>=ge,$-=ge,b.have===0){R.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Pe===17){for(D=ge+3;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}$-=ge,k=0,se=3+(7&(z>>>=ge)),z>>>=3,$-=3}else{for(D=ge+7;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}$-=ge,k=0,se=11+(127&(z>>>=ge)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){R.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){R.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,G={bits:b.lenbits},J=c(f,b.lens,0,b.nlen,b.lencode,0,b.work,G),b.lenbits=G.bits,J){R.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,G={bits:b.distbits},J=c(d,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,G),b.distbits=G.bits,J){R.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,l(R,ne),Z=R.next_out,te=R.output,Q=R.avail_out,W=R.next_in,V=R.input,I=R.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;be=(S=b.lencode[z&(1<<b.lenbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(be&&!(240&be)){for(Te=ge,Se=be,et=Pe;be=(S=b.lencode[et+((z&(1<<Te+Se)-1)>>Te)])>>>16&255,Pe=65535&S,!(Te+(ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Te,$-=Te,b.back+=Te}if(z>>>=ge,$-=ge,b.back+=ge,b.length=Pe,be===0){b.mode=26;break}if(32&be){b.back=-1,b.mode=12;break}if(64&be){R.msg="invalid literal/length code",b.mode=30;break}b.extra=15&be,b.mode=22;case 22:if(b.extra){for(D=b.extra;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length+=z&(1<<b.extra)-1,z>>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;be=(S=b.distcode[z&(1<<b.distbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&be)){for(Te=ge,Se=be,et=Pe;be=(S=b.distcode[et+((z&(1<<Te+Se)-1)>>Te)])>>>16&255,Pe=65535&S,!(Te+(ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Te,$-=Te,b.back+=Te}if(z>>>=ge,$-=ge,b.back+=ge,64&be){R.msg="invalid distance code",b.mode=30;break}b.offset=Pe,b.extra=15&be,b.mode=24;case 24:if(b.extra){for(D=b.extra;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.offset+=z&(1<<b.extra)-1,z>>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){R.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){R.msg="invalid distance too far back",b.mode=30;break}Ee=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),fe=b.window}else fe=te,Ee=Z-b.offset,se=b.length;for(Q<se&&(se=Q),Q-=se,b.length-=se;te[Z++]=fe[Ee++],--se;);b.length===0&&(b.mode=21);break;case 26:if(Q===0)break e;te[Z++]=b.length,Q--,b.mode=21;break;case 27:if(b.wrap){for(;$<32;){if(I===0)break e;I--,z|=V[W++]<<$,$+=8}if(ne-=Q,R.total_out+=ne,b.total+=ne,ne&&(R.adler=b.check=b.flags?a(b.check,te,ne,Z-ne):i(b.check,te,ne,Z-ne)),ne=Q,(b.flags?z:g(z))!==b.check){R.msg="incorrect data check",b.mode=30;break}$=z=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z!==(4294967295&b.total)){R.msg="incorrect length check",b.mode=30;break}$=z=0}b.mode=29;case 29:J=1;break e;case 30:J=-3;break e;case 31:return-4;case 32:default:return p}return R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,(b.wsize||ne!==R.avail_out&&b.mode<30&&(b.mode<27||F!==4))&&q(R,R.output,R.next_out,ne-R.avail_out)?(b.mode=31,-4):(de-=R.avail_in,ne-=R.avail_out,R.total_in+=de,R.total_out+=ne,b.total+=ne,b.wrap&&ne&&(R.adler=b.check=b.flags?a(b.check,te,ne,R.next_out-ne):i(b.check,te,ne,R.next_out-ne)),R.data_type=b.bits+(b.last?64:0)+(b.mode===12?128:0)+(b.mode===20||b.mode===15?256:0),(de==0&&ne===0||F===4)&&J===h&&(J=-5),J)},s.inflateEnd=function(R){if(!R||!R.state)return p;var F=R.state;return F.window&&(F.window=null),R.state=null,h},s.inflateGetHeader=function(R,F){var b;return R&&R.state&&2&(b=R.state).wrap?((b.head=F).done=!1,h):p},s.inflateSetDictionary=function(R,F){var b,V=F.length;return R&&R.state?(b=R.state).wrap!==0&&b.mode!==11?p:b.mode===11&&i(1,F,V,0)!==b.check?-3:q(R,F,V,V)?(b.mode=31,-4):(b.havedict=1,h):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var o=r("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(f,d,h,p,w,m,x,g){var v,_,C,E,T,P,O,j,L,q=g.bits,R=0,F=0,b=0,V=0,te=0,W=0,Z=0,I=0,Q=0,z=0,$=null,de=0,ne=new o.Buf16(16),se=new o.Buf16(16),Ee=null,fe=0;for(R=0;R<=15;R++)ne[R]=0;for(F=0;F<p;F++)ne[d[h+F]]++;for(te=q,V=15;1<=V&&ne[V]===0;V--);if(V<te&&(te=V),V===0)return w[m++]=20971520,w[m++]=20971520,g.bits=1,0;for(b=1;b<V&&ne[b]===0;b++);for(te<b&&(te=b),R=I=1;R<=15;R++)if(I<<=1,(I-=ne[R])<0)return-1;if(0<I&&(f===0||V!==1))return-1;for(se[1]=0,R=1;R<15;R++)se[R+1]=se[R]+ne[R];for(F=0;F<p;F++)d[h+F]!==0&&(x[se[d[h+F]]++]=F);if(P=f===0?($=Ee=x,19):f===1?($=i,de-=257,Ee=a,fe-=257,256):($=l,Ee=c,-1),R=b,T=m,Z=F=z=0,C=-1,E=(Q=1<<(W=te))-1,f===1&&852<Q||f===2&&592<Q)return 1;for(;;){for(O=R-Z,L=x[F]<P?(j=0,x[F]):x[F]>P?(j=Ee[fe+x[F]],$[de+x[F]]):(j=96,0),v=1<<R-Z,b=_=1<<W;w[T+(z>>Z)+(_-=v)]=O<<24|j<<16|L|0,_!==0;);for(v=1<<R-1;z&v;)v>>=1;if(v!==0?(z&=v-1,z+=v):z=0,F++,--ne[R]==0){if(R===V)break;R=d[h+x[F]]}if(te<R&&(z&E)!==C){for(Z===0&&(Z=te),T+=b,I=1<<(W=R-Z);W+Z<V&&!((I-=ne[W+Z])<=0);)W++,I<<=1;if(Q+=1<<W,f===1&&852<Q||f===2&&592<Q)return 1;w[C=z&E]=te<<24|W<<16|T-m|0}}return z!==0&&(w[T+z]=R-Z<<24|64<<16|0),g.bits=te,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var o=r("../utils/common"),i=0,a=1;function l(S){for(var N=S.length;0<=--N;)S[N]=0}var c=0,f=29,d=256,h=d+1+f,p=30,w=19,m=2*h+1,x=15,g=16,v=7,_=256,C=16,E=17,T=18,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],j=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(h+2));l(q);var R=new Array(2*p);l(R);var F=new Array(512);l(F);var b=new Array(256);l(b);var V=new Array(f);l(V);var te,W,Z,I=new Array(p);function Q(S,N,A,Y,M){this.static_tree=S,this.extra_bits=N,this.extra_base=A,this.elems=Y,this.max_length=M,this.has_stree=S&&S.length}function z(S,N){this.dyn_tree=S,this.max_code=0,this.stat_desc=N}function $(S){return S<256?F[S]:F[256+(S>>>7)]}function de(S,N){S.pending_buf[S.pending++]=255&N,S.pending_buf[S.pending++]=N>>>8&255}function ne(S,N,A){S.bi_valid>g-A?(S.bi_buf|=N<<S.bi_valid&65535,de(S,S.bi_buf),S.bi_buf=N>>g-S.bi_valid,S.bi_valid+=A-g):(S.bi_buf|=N<<S.bi_valid&65535,S.bi_valid+=A)}function se(S,N,A){ne(S,A[2*N],A[2*N+1])}function Ee(S,N){for(var A=0;A|=1&S,S>>>=1,A<<=1,0<--N;);return A>>>1}function fe(S,N,A){var Y,M,H=new Array(x+1),X=0;for(Y=1;Y<=x;Y++)H[Y]=X=X+A[Y-1]<<1;for(M=0;M<=N;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Ee(H[ee]++,ee))}}function ge(S){var N;for(N=0;N<h;N++)S.dyn_ltree[2*N]=0;for(N=0;N<p;N++)S.dyn_dtree[2*N]=0;for(N=0;N<w;N++)S.bl_tree[2*N]=0;S.dyn_ltree[2*_]=1,S.opt_len=S.static_len=0,S.last_lit=S.matches=0}function be(S){8<S.bi_valid?de(S,S.bi_buf):0<S.bi_valid&&(S.pending_buf[S.pending++]=S.bi_buf),S.bi_buf=0,S.bi_valid=0}function Pe(S,N,A,Y){var M=2*N,H=2*A;return S[M]<S[H]||S[M]===S[H]&&Y[N]<=Y[A]}function Te(S,N,A){for(var Y=S.heap[A],M=A<<1;M<=S.heap_len&&(M<S.heap_len&&Pe(N,S.heap[M+1],S.heap[M],S.depth)&&M++,!Pe(N,Y,S.heap[M],S.depth));)S.heap[A]=S.heap[M],A=M,M<<=1;S.heap[A]=Y}function Se(S,N,A){var Y,M,H,X,ee=0;if(S.last_lit!==0)for(;Y=S.pending_buf[S.d_buf+2*ee]<<8|S.pending_buf[S.d_buf+2*ee+1],M=S.pending_buf[S.l_buf+ee],ee++,Y===0?se(S,M,N):(se(S,(H=b[M])+d+1,N),(X=P[H])!==0&&ne(S,M-=V[H],X),se(S,H=$(--Y),A),(X=O[H])!==0&&ne(S,Y-=I[H],X)),ee<S.last_lit;);se(S,_,N)}function et(S,N){var A,Y,M,H=N.dyn_tree,X=N.stat_desc.static_tree,ee=N.stat_desc.has_stree,he=N.stat_desc.elems,Le=-1;for(S.heap_len=0,S.heap_max=m,A=0;A<he;A++)H[2*A]!==0?(S.heap[++S.heap_len]=Le=A,S.depth[A]=0):H[2*A+1]=0;for(;S.heap_len<2;)H[2*(M=S.heap[++S.heap_len]=Le<2?++Le:0)]=1,S.depth[M]=0,S.opt_len--,ee&&(S.static_len-=X[2*M+1]);for(N.max_code=Le,A=S.heap_len>>1;1<=A;A--)Te(S,H,A);for(M=he;A=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Te(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=A,S.heap[--S.heap_max]=Y,H[2*M]=H[2*A]+H[2*Y],S.depth[M]=(S.depth[A]>=S.depth[Y]?S.depth[A]:S.depth[Y])+1,H[2*A+1]=H[2*Y+1]=M,S.heap[1]=M++,Te(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Oe,St){var Vr,Wt,Vn,st,Wn,Bn,Wr=St.dyn_tree,vc=St.max_code,yc=St.stat_desc.static_tree,ti=St.stat_desc.has_stree,wc=St.stat_desc.extra_bits,ri=St.stat_desc.extra_base,_n=St.stat_desc.max_length,Rs=0;for(st=0;st<=x;st++)Oe.bl_count[st]=0;for(Wr[2*Oe.heap[Oe.heap_max]+1]=0,Vr=Oe.heap_max+1;Vr<m;Vr++)_n<(st=Wr[2*Wr[2*(Wt=Oe.heap[Vr])+1]+1]+1)&&(st=_n,Rs++),Wr[2*Wt+1]=st,vc<Wt||(Oe.bl_count[st]++,Wn=0,ri<=Wt&&(Wn=wc[Wt-ri]),Bn=Wr[2*Wt],Oe.opt_len+=Bn*(st+Wn),ti&&(Oe.static_len+=Bn*(yc[2*Wt+1]+Wn)));if(Rs!==0){do{for(st=_n-1;Oe.bl_count[st]===0;)st--;Oe.bl_count[st]--,Oe.bl_count[st+1]+=2,Oe.bl_count[_n]--,Rs-=2}while(0<Rs);for(st=_n;st!==0;st--)for(Wt=Oe.bl_count[st];Wt!==0;)vc<(Vn=Oe.heap[--Vr])||(Wr[2*Vn+1]!==st&&(Oe.opt_len+=(st-Wr[2*Vn+1])*Wr[2*Vn],Wr[2*Vn+1]=st),Wt--)}}(S,N),fe(H,Le,S.bl_count)}function k(S,N,A){var Y,M,H=-1,X=N[1],ee=0,he=7,Le=4;for(X===0&&(he=138,Le=3),N[2*(A+1)+1]=65535,Y=0;Y<=A;Y++)M=X,X=N[2*(Y+1)+1],++ee<he&&M===X||(ee<Le?S.bl_tree[2*M]+=ee:M!==0?(M!==H&&S.bl_tree[2*M]++,S.bl_tree[2*C]++):ee<=10?S.bl_tree[2*E]++:S.bl_tree[2*T]++,H=M,Le=(ee=0)===X?(he=138,3):M===X?(he=6,3):(he=7,4))}function J(S,N,A){var Y,M,H=-1,X=N[1],ee=0,he=7,Le=4;for(X===0&&(he=138,Le=3),Y=0;Y<=A;Y++)if(M=X,X=N[2*(Y+1)+1],!(++ee<he&&M===X)){if(ee<Le)for(;se(S,M,S.bl_tree),--ee!=0;);else M!==0?(M!==H&&(se(S,M,S.bl_tree),ee--),se(S,C,S.bl_tree),ne(S,ee-3,2)):ee<=10?(se(S,E,S.bl_tree),ne(S,ee-3,3)):(se(S,T,S.bl_tree),ne(S,ee-11,7));H=M,Le=(ee=0)===X?(he=138,3):M===X?(he=6,3):(he=7,4)}}l(I);var G=!1;function D(S,N,A,Y){ne(S,(c<<1)+(Y?1:0),3),function(M,H,X,ee){be(M),de(M,X),de(M,~X),o.arraySet(M.pending_buf,M.window,H,X,M.pending),M.pending+=X}(S,N,A)}s._tr_init=function(S){G||(function(){var N,A,Y,M,H,X=new Array(x+1);for(M=Y=0;M<f-1;M++)for(V[M]=Y,N=0;N<1<<P[M];N++)b[Y++]=M;for(b[Y-1]=M,M=H=0;M<16;M++)for(I[M]=H,N=0;N<1<<O[M];N++)F[H++]=M;for(H>>=7;M<p;M++)for(I[M]=H<<7,N=0;N<1<<O[M]-7;N++)F[256+H++]=M;for(A=0;A<=x;A++)X[A]=0;for(N=0;N<=143;)q[2*N+1]=8,N++,X[8]++;for(;N<=255;)q[2*N+1]=9,N++,X[9]++;for(;N<=279;)q[2*N+1]=7,N++,X[7]++;for(;N<=287;)q[2*N+1]=8,N++,X[8]++;for(fe(q,h+1,X),N=0;N<p;N++)R[2*N+1]=5,R[2*N]=Ee(N,5);te=new Q(q,P,d+1,h,x),W=new Q(R,O,0,p,x),Z=new Q(new Array(0),j,0,w,v)}(),G=!0),S.l_desc=new z(S.dyn_ltree,te),S.d_desc=new z(S.dyn_dtree,W),S.bl_desc=new z(S.bl_tree,Z),S.bi_buf=0,S.bi_valid=0,ge(S)},s._tr_stored_block=D,s._tr_flush_block=function(S,N,A,Y){var M,H,X=0;0<S.level?(S.strm.data_type===2&&(S.strm.data_type=function(ee){var he,Le=4093624447;for(he=0;he<=31;he++,Le>>>=1)if(1&Le&&ee.dyn_ltree[2*he]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(he=32;he<d;he++)if(ee.dyn_ltree[2*he]!==0)return a;return i}(S)),et(S,S.l_desc),et(S,S.d_desc),X=function(ee){var he;for(k(ee,ee.dyn_ltree,ee.l_desc.max_code),k(ee,ee.dyn_dtree,ee.d_desc.max_code),et(ee,ee.bl_desc),he=w-1;3<=he&&ee.bl_tree[2*L[he]+1]===0;he--);return ee.opt_len+=3*(he+1)+5+5+4,he}(S),M=S.opt_len+3+7>>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=A+5,A+4<=M&&N!==-1?D(S,N,A,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Se(S,q,R)):(ne(S,4+(Y?1:0),3),function(ee,he,Le,Oe){var St;for(ne(ee,he-257,5),ne(ee,Le-1,5),ne(ee,Oe-4,4),St=0;St<Oe;St++)ne(ee,ee.bl_tree[2*L[St]+1],3);J(ee,ee.dyn_ltree,he-1),J(ee,ee.dyn_dtree,Le-1)}(S,S.l_desc.max_code+1,S.d_desc.max_code+1,X+1),Se(S,S.dyn_ltree,S.dyn_dtree)),ge(S),Y&&be(S)},s._tr_tally=function(S,N,A){return S.pending_buf[S.d_buf+2*S.last_lit]=N>>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&N,S.pending_buf[S.l_buf+S.last_lit]=255&A,S.last_lit++,N===0?S.dyn_ltree[2*A]++:(S.matches++,N--,S.dyn_ltree[2*(b[A]+d+1)]++,S.dyn_dtree[2*$(N)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,_,q),function(N){N.bi_valid===16?(de(N,N.bi_buf),N.bi_buf=0,N.bi_valid=0):8<=N.bi_valid&&(N.pending_buf[N.pending++]=255&N.bi_buf,N.bi_buf>>=8,N.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.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(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var l,c,f,d,h=1,p={},w=!1,m=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,l={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,E=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=E,C}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(C){i.postMessage(d+C,"*")}):i.MessageChannel?((f=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){f.port2.postMessage(C)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(C){var E=m.createElement("script");E.onreadystatechange=function(){v(C),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(C){setTimeout(v,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var E=new Array(arguments.length-1),T=0;T<E.length;T++)E[T]=arguments[T+1];var P={callback:C,args:E};return p[h]=P,l(h),h++},x.clearImmediate=g}function g(C){delete p[C]}function v(C){if(w)setTimeout(v,0,C);else{var E=p[C];if(E){w=!0;try{(function(T){var P=T.callback,O=T.args;switch(O.length){case 0:P();break;case 1:P(O[0]);break;case 2:P(O[0],O[1]);break;case 3:P(O[0],O[1],O[2]);break;default:P.apply(a,O)}})(E)}finally{g(C),w=!1}}}}function _(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(d)===0&&v(+C.data.slice(d.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof kc<"u"?kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bC);var h5=bC.exports;const p5=pm(h5);function m5(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const g5=async(e,t)=>{const r=new p5;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},Ol=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)},v5=e=>Ol(e).split(" ")[0],y5=async()=>Dt().collection("domains").getFullList({sort:"-created",expand:"lastDeployment"}),w5=async e=>await Dt().collection("domains").getOne(e),tm=async e=>e.id?await Dt().collection("domains").update(e.id,e):await Dt().collection("domains").create(e),x5=async e=>await Dt().collection("domains").delete(e),_5=(e,t)=>Dt().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),b5=e=>{Dt().collection("domains").unsubscribe(e)},S5=()=>{const e=bf(),t=Ss(),r=()=>{t("/edit")},n=d=>{t(`/edit?id=${d}`)},s=d=>{t(`/history?domain=${d}`)},o=async d=>{try{await x5(d),a(i.filter(h=>h.id!==d))}catch(h){console.error("Error deleting domain:",h)}},[i,a]=y.useState([]);y.useEffect(()=>{(async()=>{const h=await y5();a(h)})()},[]);const l=async d=>{const h=i.filter(x=>x.id===d),p=h[0].enabled,w=h[0];w.enabled=!p,await tm(w);const m=i.map(x=>x.id===d?{...x,checked:!p}:x);a(m)},c=async d=>{try{b5(d.id),_5(d.id,h=>{console.log(h);const p=i.map(w=>w.id===h.id?{...h}:w);a(p)}),d.rightnow=!0,await tm(d),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:u.jsxs(u.Fragment,{children:["执行失败,请查看",u.jsx(Kn,{to:`/history?domain=${d.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},f=async d=>{const h=`${d.id}-${d.domain}.zip`,p=[{name:`${d.domain}.pem`,content:d.certificate?d.certificate:""},{name:`${d.domain}.key`,content:d.privateKey?d.privateKey:""}];await g5(h,p)};return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"",children:[u.jsx(kv,{}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),u.jsx(Pt,{onClick:r,children:"新增域名"})]}),i.length?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-40",children:"域名"}),u.jsx("div",{className:"w-48",children:"有效期限"}),u.jsx("div",{className:"w-32",children:"最近执行状态"}),u.jsx("div",{className:"w-64",children:"最近执行阶段"}),u.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),u.jsx("div",{className:"w-32",children:"是否启用"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),i.map(d=>{var h,p,w,m,x,g;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:d.domain}),u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:u.jsx("div",{children:d.expiredAt?u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"有效期90天"}),u.jsxs("div",{children:[v5(d.expiredAt),"到期"]})]}):"---"})}),u.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((h=d.expand)!=null&&h.lastDeployment)?u.jsx(u.Fragment,{children:((p=d.expand.lastDeployment)==null?void 0:p.phase)==="deploy"&&((w=d.expand.lastDeployment)!=null&&w.phaseSuccess)?u.jsx(t1,{size:16,className:"text-green-700"}):u.jsx(r1,{size:16,className:"text-red-700"})}):"---"}),u.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((m=d.expand)!=null&&m.lastDeployment)?u.jsx(dk,{phase:(x=d.expand.lastDeployment)==null?void 0:x.phase,phaseSuccess:(g=d.expand.lastDeployment)==null?void 0:g.phaseSuccess}):"---"}),u.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:d.lastDeployedAt?Ol(d.lastDeployedAt):"---"}),u.jsx("div",{className:"sm:w-32 flex items-center",children:u.jsx(gC,{children:u.jsxs(u5,{children:[u.jsx(d5,{children:u.jsx(Bk,{checked:d.enabled,onCheckedChange:()=>{l(d.id)}})}),u.jsx(Ev,{children:u.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:d.enabled?"禁用":"启用"})})]})})}),u.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>s(d.id),children:"部署历史"}),u.jsxs(ow,{when:!!d.enabled,children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>c(d),children:"立即部署"})]}),u.jsxs(ow,{when:!!d.expiredAt,children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>f(d),children:"下载"})]}),!d.enabled&&u.jsxs(u.Fragment,{children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsxs(d3,{children:[u.jsx(f3,{asChild:!0,children:u.jsx(Pt,{variant:"link",className:"p-0",children:"删除"})}),u.jsxs(Dk,{children:[u.jsxs(Ok,{children:[u.jsx(Mk,{children:"删除域名"}),u.jsx(Ik,{children:"确定要删除域名吗?"})]}),u.jsxs(Ak,{children:[u.jsx(Fk,{children:"取消"}),u.jsx(Lk,{onClick:()=>{o(d.id)},children:"确认"})]})]})]}),u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>n(d.id),children:"编辑"})]})]})]},d.id)})]}):u.jsx(u.Fragment,{children:u.jsxs("div",{className:"flex flex-col items-center mt-10",children:[u.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:u.jsx(Op,{size:40,className:"text-primary"})}),u.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),u.jsx(Pt,{onClick:r,className:"mt-3",children:"添加域名"})]})})]})})},it=y.forwardRef(({className:e,type:t,...r},n)=>u.jsx("input",{type:t,className:we("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:n,...r}));it.displayName="Input";var pc=e=>e.type==="checkbox",Ni=e=>e instanceof Date,fr=e=>e==null;const SC=e=>typeof e=="object";var Gt=e=>!fr(e)&&!Array.isArray(e)&&SC(e)&&!Ni(e),kC=e=>Gt(e)&&e.target?pc(e.target)?e.target.checked:e.target.value:e,k5=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,CC=(e,t)=>e.has(k5(t)),C5=e=>{const t=e.constructor&&e.constructor.prototype;return Gt(t)&&t.hasOwnProperty("isPrototypeOf")},Tv=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function xr(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Tv&&(e instanceof Blob||e instanceof FileList))&&(r||Gt(e)))if(t=r?[]:{},!r&&!C5(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=xr(e[n]));else return e;return t}var Tf=e=>Array.isArray(e)?e.filter(Boolean):[],Lt=e=>e===void 0,ce=(e,t,r)=>{if(!t||!Gt(e))return r;const n=Tf(t.split(/[,[\].]+?/)).reduce((s,o)=>fr(s)?s:s[o],e);return Lt(n)||n===e?Lt(e[t])?r:e[t]:n},Rn=e=>typeof e=="boolean",Rv=e=>/^\w*$/.test(e),EC=e=>Tf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ut=(e,t,r)=>{let n=-1;const s=Rv(t)?[t]:EC(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let l=r;if(n!==i){const c=e[a];l=Gt(c)||Array.isArray(c)?c:isNaN(+s[n+1])?{}:[]}if(a==="__proto__")return;e[a]=l,e=e[a]}return e};const hd={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},an={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Gn={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},TC=Qe.createContext(null),Rf=()=>Qe.useContext(TC),E5=e=>{const{children:t,...r}=e;return Qe.createElement(TC.Provider,{value:r},t)};var RC=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==an.all&&(t._proxyFormState[i]=!n||an.all),r&&(r[i]=!0),e[i]}});return s},Nr=e=>Gt(e)&&!Object.keys(e).length,NC=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Nr(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||an.all))},rl=e=>Array.isArray(e)?e:[e],PC=(e,t,r)=>!e||!t||e===t||rl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function Nv(e){const t=Qe.useRef(e);t.current=e,Qe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function T5(e){const t=Rf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=Qe.useState(r._formState),l=Qe.useRef(!0),c=Qe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=Qe.useRef(s);return f.current=s,Nv({disabled:n,next:d=>l.current&&PC(f.current,d.name,o)&&NC(d,c.current,r._updateFormState)&&a({...r._formState,...d}),subject:r._subjects.state}),Qe.useEffect(()=>(l.current=!0,c.current.isValid&&r._updateValid(!0),()=>{l.current=!1}),[r]),RC(i,r,c.current,!1)}var Pn=e=>typeof e=="string",jC=(e,t,r,n,s)=>Pn(e)?(n&&t.watch.add(e),ce(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ce(r,o))):(n&&(t.watchAll=!0),r);function R5(e){const t=Rf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=Qe.useRef(n);a.current=n,Nv({disabled:o,subject:r._subjects.values,next:f=>{PC(a.current,f.name,i)&&c(xr(jC(a.current,r._names,f.values||r._formValues,!1,s)))}});const[l,c]=Qe.useState(r._getWatch(n,s));return Qe.useEffect(()=>r._removeUnmounted()),l}function N5(e){const t=Rf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=CC(s._names.array,r),a=R5({control:s,name:r,defaultValue:ce(s._formValues,r,ce(s._defaultValues,r,e.defaultValue)),exact:!0}),l=T5({control:s,name:r}),c=Qe.useRef(s.register(r,{...e.rules,value:a,...Rn(e.disabled)?{disabled:e.disabled}:{}}));return Qe.useEffect(()=>{const f=s._options.shouldUnregister||o,d=(h,p)=>{const w=ce(s._fields,h);w&&w._f&&(w._f.mount=p)};if(d(r,!0),f){const h=xr(ce(s._options.defaultValues,r));ut(s._defaultValues,r,h),Lt(ce(s._formValues,r))&&ut(s._formValues,r,h)}return()=>{(i?f&&!s._state.action:f)?s.unregister(r):d(r,!1)}},[r,s,i,o]),Qe.useEffect(()=>{ce(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ce(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Rn(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:Qe.useCallback(f=>c.current.onChange({target:{value:kC(f),name:r},type:hd.CHANGE}),[r]),onBlur:Qe.useCallback(()=>c.current.onBlur({target:{value:ce(s._formValues,r),name:r},type:hd.BLUR}),[r,s]),ref:f=>{const d=ce(s._fields,r);d&&f&&(d._f.ref={focus:()=>f.focus(),select:()=>f.select(),setCustomValidity:h=>f.setCustomValidity(h),reportValidity:()=>f.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ce(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!ce(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ce(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ce(l.validatingFields,r)},error:{enumerable:!0,get:()=>ce(l.errors,r)}})}}const P5=e=>e.render(N5(e));var DC=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},lw=e=>({isOnSubmit:!e||e===an.onSubmit,isOnBlur:e===an.onBlur,isOnChange:e===an.onChange,isOnAll:e===an.all,isOnTouch:e===an.onTouched}),cw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const nl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ce(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;nl(a,t)}else Gt(a)&&nl(a,t)}}};var j5=(e,t,r)=>{const n=rl(ce(e,r));return ut(n,"root",t[r]),ut(e,r,n),e},Pv=e=>e.type==="file",Bs=e=>typeof e=="function",pd=e=>{if(!Tv)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Su=e=>Pn(e),jv=e=>e.type==="radio",md=e=>e instanceof RegExp;const uw={value:!1,isValid:!1},dw={value:!0,isValid:!0};var OC=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?dw:{value:e[0].value,isValid:!0}:dw:uw}return uw};const fw={isValid:!1,value:null};var AC=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,fw):fw;function hw(e,t,r="validate"){if(Su(e)||Array.isArray(e)&&e.every(Su)||Rn(e)&&!e)return{type:r,message:Su(e)?e:"",ref:t}}var fi=e=>Gt(e)&&!md(e)?e:{value:e,message:""},pw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:l,minLength:c,min:f,max:d,pattern:h,validate:p,name:w,valueAsNumber:m,mount:x,disabled:g}=e._f,v=ce(t,w);if(!x||g)return{};const _=i?i[0]:o,C=R=>{n&&_.reportValidity&&(_.setCustomValidity(Rn(R)?"":R||""),_.reportValidity())},E={},T=jv(o),P=pc(o),O=T||P,j=(m||Pv(o))&&Lt(o.value)&&Lt(v)||pd(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,L=DC.bind(null,w,r,E),q=(R,F,b,V=Gn.maxLength,te=Gn.minLength)=>{const W=R?F:b;E[w]={type:R?V:te,message:W,ref:o,...L(R?V:te,W)}};if(s?!Array.isArray(v)||!v.length:a&&(!O&&(j||fr(v))||Rn(v)&&!v||P&&!OC(i).isValid||T&&!AC(i).isValid)){const{value:R,message:F}=Su(a)?{value:!!a,message:a}:fi(a);if(R&&(E[w]={type:Gn.required,message:F,ref:_,...L(Gn.required,F)},!r))return C(F),E}if(!j&&(!fr(f)||!fr(d))){let R,F;const b=fi(d),V=fi(f);if(!fr(v)&&!isNaN(v)){const te=o.valueAsNumber||v&&+v;fr(b.value)||(R=te>b.value),fr(V.value)||(F=te<V.value)}else{const te=o.valueAsDate||new Date(v),W=Q=>new Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Pn(b.value)&&v&&(R=Z?W(v)>W(b.value):I?v>b.value:te>new Date(b.value)),Pn(V.value)&&v&&(F=Z?W(v)<W(V.value):I?v<V.value:te<new Date(V.value))}if((R||F)&&(q(!!R,b.message,V.message,Gn.max,Gn.min),!r))return C(E[w].message),E}if((l||c)&&!j&&(Pn(v)||s&&Array.isArray(v))){const R=fi(l),F=fi(c),b=!fr(R.value)&&v.length>+R.value,V=!fr(F.value)&&v.length<+F.value;if((b||V)&&(q(b,R.message,F.message),!r))return C(E[w].message),E}if(h&&!j&&Pn(v)){const{value:R,message:F}=fi(h);if(md(R)&&!v.match(R)&&(E[w]={type:Gn.pattern,message:F,ref:o,...L(Gn.pattern,F)},!r))return C(F),E}if(p){if(Bs(p)){const R=await p(v,t),F=hw(R,_);if(F&&(E[w]={...F,...L(Gn.validate,F.message)},!r))return C(F.message),E}else if(Gt(p)){let R={};for(const F in p){if(!Nr(R)&&!r)break;const b=hw(await p[F](v,t),_,F);b&&(R={...b,...L(F,b.message)},C(b.message),r&&(E[w]=R))}if(!Nr(R)&&(E[w]={ref:_,...R},!r))return E}}return C(!0),E};function D5(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Lt(e)?n++:e[t[n++]];return e}function O5(e){for(const t in e)if(e.hasOwnProperty(t)&&!Lt(e[t]))return!1;return!0}function Bt(e,t){const r=Array.isArray(t)?t:Rv(t)?[t]:EC(t),n=r.length===1?e:D5(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Gt(n)&&Nr(n)||Array.isArray(n)&&O5(n))&&Bt(e,r.slice(0,-1)),e}var Ph=()=>{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=[]}}},gd=e=>fr(e)||!SC(e);function Ro(e,t){if(gd(e)||gd(t))return e===t;if(Ni(e)&&Ni(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if(Ni(o)&&Ni(i)||Gt(o)&&Gt(i)||Array.isArray(o)&&Array.isArray(i)?!Ro(o,i):o!==i)return!1}}return!0}var MC=e=>e.type==="select-multiple",A5=e=>jv(e)||pc(e),jh=e=>pd(e)&&e.isConnected,IC=e=>{for(const t in e)if(Bs(e[t]))return!0;return!1};function vd(e,t={}){const r=Array.isArray(e);if(Gt(e)||r)for(const n in e)Array.isArray(e[n])||Gt(e[n])&&!IC(e[n])?(t[n]=Array.isArray(e[n])?[]:{},vd(e[n],t[n])):fr(e[n])||(t[n]=!0);return t}function LC(e,t,r){const n=Array.isArray(e);if(Gt(e)||n)for(const s in e)Array.isArray(e[s])||Gt(e[s])&&!IC(e[s])?Lt(t)||gd(r[s])?r[s]=Array.isArray(e[s])?vd(e[s],[]):{...vd(e[s])}:LC(e[s],fr(t)?{}:t[s],r[s]):r[s]=!Ro(e[s],t[s]);return r}var tu=(e,t)=>LC(e,t,vd(t)),FC=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Lt(e)?e:t?e===""?NaN:e&&+e:r&&Pn(e)?new Date(e):n?n(e):e;function Dh(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return Pv(t)?t.files:jv(t)?AC(e.refs).value:MC(t)?[...t.selectedOptions].map(({value:r})=>r):pc(t)?OC(e.refs).value:FC(Lt(t.value)?e.ref.value:t.value,e)}var M5=(e,t,r,n)=>{const s={};for(const o of e){const i=ce(t,o);i&&ut(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ma=e=>Lt(e)?e:md(e)?e.source:Gt(e)?md(e.value)?e.value.source:e.value:e,I5=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function mw(e,t,r){const n=ce(e,r);if(n||Rv(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ce(t,o),a=ce(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var L5=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,F5=(e,t)=>!Tf(ce(e,t)).length&&Bt(e,t);const z5={mode:an.onSubmit,reValidateMode:an.onChange,shouldFocusError:!0};function U5(e={}){let t={...z5,...e},r={submitCount:0,isDirty:!1,isLoading:Bs(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Gt(t.defaultValues)||Gt(t.values)?xr(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:xr(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Ph(),array:Ph(),state:Ph()},h=lw(t.mode),p=lw(t.reValidateMode),w=t.criteriaMode===an.all,m=S=>N=>{clearTimeout(c),c=setTimeout(S,N)},x=async S=>{if(f.isValid||S){const N=t.resolver?Nr((await O()).errors):await L(n,!0);N!==r.isValid&&d.state.next({isValid:N})}},g=(S,N)=>{(f.isValidating||f.validatingFields)&&((S||Array.from(a.mount)).forEach(A=>{A&&(N?ut(r.validatingFields,A,N):Bt(r.validatingFields,A))}),d.state.next({validatingFields:r.validatingFields,isValidating:!Nr(r.validatingFields)}))},v=(S,N=[],A,Y,M=!0,H=!0)=>{if(Y&&A){if(i.action=!0,H&&Array.isArray(ce(n,S))){const X=A(ce(n,S),Y.argA,Y.argB);M&&ut(n,S,X)}if(H&&Array.isArray(ce(r.errors,S))){const X=A(ce(r.errors,S),Y.argA,Y.argB);M&&ut(r.errors,S,X),F5(r.errors,S)}if(f.touchedFields&&H&&Array.isArray(ce(r.touchedFields,S))){const X=A(ce(r.touchedFields,S),Y.argA,Y.argB);M&&ut(r.touchedFields,S,X)}f.dirtyFields&&(r.dirtyFields=tu(s,o)),d.state.next({name:S,isDirty:R(S,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ut(o,S,N)},_=(S,N)=>{ut(r.errors,S,N),d.state.next({errors:r.errors})},C=S=>{r.errors=S,d.state.next({errors:r.errors,isValid:!1})},E=(S,N,A,Y)=>{const M=ce(n,S);if(M){const H=ce(o,S,Lt(A)?ce(s,S):A);Lt(H)||Y&&Y.defaultChecked||N?ut(o,S,N?H:Dh(M._f)):V(S,H),i.mount&&x()}},T=(S,N,A,Y,M)=>{let H=!1,X=!1;const ee={name:S},he=!!(ce(n,S)&&ce(n,S)._f&&ce(n,S)._f.disabled);if(!A||Y){f.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=R(),H=X!==ee.isDirty);const Le=he||Ro(ce(s,S),N);X=!!(!he&&ce(r.dirtyFields,S)),Le||he?Bt(r.dirtyFields,S):ut(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||f.dirtyFields&&X!==!Le}if(A){const Le=ce(r.touchedFields,S);Le||(ut(r.touchedFields,S,A),ee.touchedFields=r.touchedFields,H=H||f.touchedFields&&Le!==A)}return H&&M&&d.state.next(ee),H?ee:{}},P=(S,N,A,Y)=>{const M=ce(r.errors,S),H=f.isValid&&Rn(N)&&r.isValid!==N;if(e.delayError&&A?(l=m(()=>_(S,A)),l(e.delayError)):(clearTimeout(c),l=null,A?ut(r.errors,S,A):Bt(r.errors,S)),(A?!Ro(M,A):M)||!Nr(Y)||H){const X={...Y,...H&&Rn(N)?{isValid:N}:{},errors:r.errors,name:S};r={...r,...X},d.state.next(X)}},O=async S=>{g(S,!0);const N=await t.resolver(o,t.context,M5(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return g(S),N},j=async S=>{const{errors:N}=await O(S);if(S)for(const A of S){const Y=ce(N,A);Y?ut(r.errors,A,Y):Bt(r.errors,A)}else r.errors=N;return N},L=async(S,N,A={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);g([Y],!0);const he=await pw(M,o,w,t.shouldUseNativeValidation&&!N,ee);if(g([Y]),he[H.name]&&(A.valid=!1,N))break;!N&&(ce(he,H.name)?ee?j5(r.errors,he,H.name):ut(r.errors,H.name,he[H.name]):Bt(r.errors,H.name))}X&&await L(X,N,A)}}return A.valid},q=()=>{for(const S of a.unMount){const N=ce(n,S);N&&(N._f.refs?N._f.refs.every(A=>!jh(A)):!jh(N._f.ref))&&Ee(S)}a.unMount=new Set},R=(S,N)=>(S&&N&&ut(o,S,N),!Ro(z(),s)),F=(S,N,A)=>jC(S,a,{...i.mount?o:Lt(N)?s:Pn(S)?{[S]:N}:N},A,N),b=S=>Tf(ce(i.mount?o:s,S,e.shouldUnregister?ce(s,S,[]):[])),V=(S,N,A={})=>{const Y=ce(n,S);let M=N;if(Y){const H=Y._f;H&&(!H.disabled&&ut(o,S,FC(N,H)),M=pd(H.ref)&&fr(N)?"":N,MC(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?pc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):Pv(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||d.values.next({name:S,values:{...o}})))}(A.shouldDirty||A.shouldTouch)&&T(S,M,A.shouldTouch,A.shouldDirty,!0),A.shouldValidate&&Q(S)},te=(S,N,A)=>{for(const Y in N){const M=N[Y],H=`${S}.${Y}`,X=ce(n,H);(a.array.has(S)||!gd(M)||X&&!X._f)&&!Ni(M)?te(H,M,A):V(H,M,A)}},W=(S,N,A={})=>{const Y=ce(n,S),M=a.array.has(S),H=xr(N);ut(o,S,H),M?(d.array.next({name:S,values:{...o}}),(f.isDirty||f.dirtyFields)&&A.shouldDirty&&d.state.next({name:S,dirtyFields:tu(s,o),isDirty:R(S,H)})):Y&&!Y._f&&!fr(H)?te(S,H,A):V(S,H,A),cw(S,a)&&d.state.next({...r}),d.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const N=S.target;let A=N.name,Y=!0;const M=ce(n,A),H=()=>N.type?Dh(M._f):kC(S),X=ee=>{Y=Number.isNaN(ee)||ee===ce(o,A,ee)};if(M){let ee,he;const Le=H(),Oe=S.type===hd.BLUR||S.type===hd.FOCUS_OUT,St=!I5(M._f)&&!t.resolver&&!ce(r.errors,A)&&!M._f.deps||L5(Oe,ce(r.touchedFields,A),r.isSubmitted,p,h),Vr=cw(A,a,Oe);ut(o,A,Le),Oe?(M._f.onBlur&&M._f.onBlur(S),l&&l(0)):M._f.onChange&&M._f.onChange(S);const Wt=T(A,Le,Oe,!1),Vn=!Nr(Wt)||Vr;if(!Oe&&d.values.next({name:A,type:S.type,values:{...o}}),St)return f.isValid&&x(),Vn&&d.state.next({name:A,...Vr?{}:Wt});if(!Oe&&Vr&&d.state.next({...r}),t.resolver){const{errors:st}=await O([A]);if(X(Le),Y){const Wn=mw(r.errors,n,A),Bn=mw(st,n,Wn.name||A);ee=Bn.error,A=Bn.name,he=Nr(st)}}else g([A],!0),ee=(await pw(M,o,w,t.shouldUseNativeValidation))[A],g([A]),X(Le),Y&&(ee?he=!1:f.isValid&&(he=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),P(A,he,ee,Wt))}},I=(S,N)=>{if(ce(r.errors,N)&&S.focus)return S.focus(),1},Q=async(S,N={})=>{let A,Y;const M=rl(S);if(t.resolver){const H=await j(Lt(S)?S:M);A=Nr(H),Y=S?!M.some(X=>ce(H,X)):A}else S?(Y=(await Promise.all(M.map(async H=>{const X=ce(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&x()):Y=A=await L(n);return d.state.next({...!Pn(S)||f.isValid&&A!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:A}:{},errors:r.errors}),N.shouldFocus&&!Y&&nl(n,I,S?M:a.mount),Y},z=S=>{const N={...i.mount?o:s};return Lt(S)?N:Pn(S)?ce(N,S):S.map(A=>ce(N,A))},$=(S,N)=>({invalid:!!ce((N||r).errors,S),isDirty:!!ce((N||r).dirtyFields,S),error:ce((N||r).errors,S),isValidating:!!ce(r.validatingFields,S),isTouched:!!ce((N||r).touchedFields,S)}),de=S=>{S&&rl(S).forEach(N=>Bt(r.errors,N)),d.state.next({errors:S?r.errors:{}})},ne=(S,N,A)=>{const Y=(ce(n,S,{_f:{}})._f||{}).ref,M=ce(r.errors,S)||{},{ref:H,message:X,type:ee,...he}=M;ut(r.errors,S,{...he,...N,ref:Y}),d.state.next({name:S,errors:r.errors,isValid:!1}),A&&A.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,N)=>Bs(S)?d.values.subscribe({next:A=>S(F(void 0,N),A)}):F(S,N,!0),Ee=(S,N={})=>{for(const A of S?rl(S):a.mount)a.mount.delete(A),a.array.delete(A),N.keepValue||(Bt(n,A),Bt(o,A)),!N.keepError&&Bt(r.errors,A),!N.keepDirty&&Bt(r.dirtyFields,A),!N.keepTouched&&Bt(r.touchedFields,A),!N.keepIsValidating&&Bt(r.validatingFields,A),!t.shouldUnregister&&!N.keepDefaultValue&&Bt(s,A);d.values.next({values:{...o}}),d.state.next({...r,...N.keepDirty?{isDirty:R()}:{}}),!N.keepIsValid&&x()},fe=({disabled:S,name:N,field:A,fields:Y,value:M})=>{if(Rn(S)&&i.mount||S){const H=S?void 0:Lt(M)?Dh(A?A._f:ce(Y,N)._f):M;ut(o,N,H),T(N,H,!1,!1,!0)}},ge=(S,N={})=>{let A=ce(n,S);const Y=Rn(N.disabled);return ut(n,S,{...A||{},_f:{...A&&A._f?A._f:{ref:{name:S}},name:S,mount:!0,...N}}),a.mount.add(S),A?fe({field:A,disabled:N.disabled,name:S,value:N.value}):E(S,!0,N.value),{...Y?{disabled:N.disabled}:{},...t.progressive?{required:!!N.required,min:Ma(N.min),max:Ma(N.max),minLength:Ma(N.minLength),maxLength:Ma(N.maxLength),pattern:Ma(N.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ge(S,N),A=ce(n,S);const H=Lt(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=A5(H),ee=A._f.refs||[];if(X?ee.find(he=>he===H):H===A._f.ref)return;ut(n,S,{_f:{...A._f,...X?{refs:[...ee.filter(jh),H,...Array.isArray(ce(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),E(S,!1,void 0,H)}else A=ce(n,S,{}),A._f&&(A._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(CC(a.array,S)&&i.action)&&a.unMount.add(S)}}},be=()=>t.shouldFocusError&&nl(n,I,a.mount),Pe=S=>{Rn(S)&&(d.state.next({disabled:S}),nl(n,(N,A)=>{const Y=ce(n,A);Y&&(N.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Te=(S,N)=>async A=>{let Y;A&&(A.preventDefault&&A.preventDefault(),A.persist&&A.persist());let M=xr(o);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await O();r.errors=H,M=X}else await L(n);if(Bt(r.errors,"root"),Nr(r.errors)){d.state.next({errors:{}});try{await S(M,A)}catch(H){Y=H}}else N&&await N({...r.errors},A),be(),setTimeout(be);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Nr(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Se=(S,N={})=>{ce(n,S)&&(Lt(N.defaultValue)?W(S,xr(ce(s,S))):(W(S,N.defaultValue),ut(s,S,xr(N.defaultValue))),N.keepTouched||Bt(r.touchedFields,S),N.keepDirty||(Bt(r.dirtyFields,S),r.isDirty=N.defaultValue?R(S,xr(ce(s,S))):R()),N.keepError||(Bt(r.errors,S),f.isValid&&x()),d.state.next({...r}))},et=(S,N={})=>{const A=S?xr(S):s,Y=xr(A),M=Nr(S),H=M?s:Y;if(N.keepDefaultValues||(s=A),!N.keepValues){if(N.keepDirtyValues)for(const X of a.mount)ce(r.dirtyFields,X)?ut(H,X,ce(o,X)):W(X,ce(H,X));else{if(Tv&&Lt(S))for(const X of a.mount){const ee=ce(n,X);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(pd(he)){const Le=he.closest("form");if(Le){Le.reset();break}}}}n={}}o=e.shouldUnregister?N.keepDefaultValues?xr(s):{}:xr(H),d.array.next({values:{...H}}),d.values.next({values:{...H}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:N.keepSubmitCount?r.submitCount:0,isDirty:M?!1:N.keepDirty?r.isDirty:!!(N.keepDefaultValues&&!Ro(S,s)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:N.keepDirtyValues?N.keepDefaultValues&&o?tu(s,o):r.dirtyFields:N.keepDefaultValues&&S?tu(s,S):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,N)=>et(Bs(S)?S(o):S,N);return{control:{register:ge,unregister:Ee,getFieldState:$,handleSubmit:Te,setError:ne,_executeSchema:O,_getWatch:F,_getDirty:R,_updateValid:x,_removeUnmounted:q,_updateFieldArray:v,_updateDisabledField:fe,_getFieldArray:b,_reset:et,_resetDefaultValues:()=>Bs(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Pe,_subjects:d,_proxyFormState:f,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ge,handleSubmit:Te,watch:se,setValue:W,getValues:z,reset:k,resetField:Se,clearErrors:de,unregister:Ee,setError:ne,setFocus:(S,N={})=>{const A=ce(n,S),Y=A&&A._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),N.shouldSelect&&M.select())}},getFieldState:$}}function Qo(e={}){const t=Qe.useRef(),r=Qe.useRef(),[n,s]=Qe.useState({isDirty:!1,isValidating:!1,isLoading:Bs(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Bs(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...U5(e),formState:n});const o=t.current.control;return o._options=e,Nv({subject:o._subjects.state,next:i=>{NC(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),Qe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),Qe.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),Qe.useEffect(()=>{e.values&&!Ro(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),Qe.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),Qe.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()}),Qe.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=RC(n,o),t.current}const gw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ce(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},zC=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?gw(n.ref,r,e):n.refs&&n.refs.forEach(s=>gw(s,r,e))}},$5=(e,t)=>{t.shouldUseNativeValidation&&zC(e,t);const r={};for(const n in e){const s=ce(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(V5(t.names||Object.keys(e),n)){const i=Object.assign({},ce(r,n));ut(i,"root",o),ut(r,n,i)}else ut(r,n,o)}return r},V5=(e,t)=>e.some(r=>r.startsWith(t+"."));var W5=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(d){return e.push(d)})}),t){var l=r[i].types,c=l&&l[n.code];r[i]=DC(i,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r},Jo=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var l=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(c){return o.shouldUseNativeValidation&&zC({},o),{errors:{},values:r.raw?n:c}})}catch(c){return a(c)}return l&&l.then?l.then(void 0,a):l}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:$5(W5(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},rt;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,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 n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(rt||(rt={}));var rm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(rm||(rm={}));const ye=rt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zs=e=>{switch(typeof e){case"undefined":return ye.undefined;case"string":return ye.string;case"number":return isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},ie=rt.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"]),B5=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Lr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_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)n._errors.push(r(i));else{let a=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),n}static assert(t){if(!(t instanceof Lr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,rt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Lr.create=e=>new Lr(e);const ea=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===ye.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rt.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${rt.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rt.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${rt.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rt.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,rt.assertNever(e)}return{message:r}};let UC=ea;function H5(e){UC=e}function yd(){return UC}const wd=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Y5=[];function pe(e,t){const r=yd(),n=wd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ea?void 0:ea].filter(s=>!!s)});e.common.issues.push(n)}class lr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Ie;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return lr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Ie;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Ie=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),pr=e=>({status:"valid",value:e}),nm=e=>e.status==="aborted",sm=e=>e.status==="dirty",Al=e=>e.status==="valid",Ml=e=>typeof Promise<"u"&&e instanceof Promise;function xd(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function $C(e,t,r,n,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,r),r}var Ce;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ce||(Ce={}));var Va,Wa;class Ln{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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 vw=(e,t)=>{if(Al(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 r=new Lr(e.common.issues);return this._error=r,this._error}}};function ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))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 l,c;const{message:f}=e;return i.code==="invalid_enum_value"?{message:f??a.defaultError}:typeof a.data>"u"?{message:(l=f??n)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(c=f??r)!==null&&c!==void 0?c:a.defaultError}},description:s}}class He{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 zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new lr,ctx:{common:t.parent.common,data:t.data,parsedType:zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(Ml(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return vw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(Ml(s)?s:Promise.resolve(s));return vw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new yn({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return An.create(this,this._def)}nullable(){return lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fn.create(this,this._def)}promise(){return ra.create(this,this._def)}or(t){return zl.create([this,t],this._def)}and(t){return Ul.create(this,t,this._def)}transform(t){return new yn({...ze(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Hl({...ze(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new Dv({typeName:Ae.ZodBranded,type:this,...ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new Yl({...ze(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return mc.create(this,t)}readonly(){return Zl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z5=/^c[^\s-]{8,}$/i,G5=/^[0-9a-z]+$/,K5=/^[0-9A-HJKMNP-TV-Z]{26}$/,q5=/^[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,X5=/^[a-z0-9_-]{21}$/i,Q5=/^[-+]?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)?)??$/,J5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ez="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oh;const tz=/^(?:(?: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])$/,rz=/^(([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})))$/,nz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VC="((\\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])))",sz=new RegExp(`^${VC}$`);function WC(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 oz(e){return new RegExp(`^${WC(e)}$`)}function BC(e){let t=`${VC}T${WC(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function iz(e,t){return!!((t==="v4"||!t)&&tz.test(e)||(t==="v6"||!t)&&rz.test(e))}class cn extends He{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ye.string){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.string,received:o.parsedType}),Ie}const n=new lr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?pe(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&pe(s,{code:ie.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")J5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"email",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Oh||(Oh=new RegExp(ez,"u")),Oh.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"emoji",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")q5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"uuid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")X5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"nanoid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Z5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"cuid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")G5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"cuid2",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")K5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"ulid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),pe(s,{validation:"url",code:ie.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"regex",code:ie.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?BC(o).test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?sz.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?oz(o).test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Q5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"duration",code:ie.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?iz(t.data,o.version)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"ip",code:ie.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?nz.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"base64",code:ie.invalid_string,message:o.message}),n.dirty()):rt.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:ie.invalid_string,...Ce.errToObj(n)})}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ce.errToObj(t)})}datetime(t){var r,n;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:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...Ce.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,...Ce.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ce.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Ce.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...Ce.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Ce.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Ce.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Ce.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Ce.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Ce.errToObj(r)})}nonempty(t){return this.min(1,Ce.errToObj(t))}trim(){return new cn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cn({...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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}cn.create=e=>{var t;return new cn({checks:[],typeName:Ae.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ze(e)})};function az(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class oo extends He{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)!==ye.number){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.number,received:o.parsedType}),Ie}let n;const s=new lr;for(const o of this._def.checks)o.kind==="int"?rt.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?az(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_finite,message:o.message}),s.dirty()):rt.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Ce.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ce.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ce.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ce.toString(r))}setLimit(t,r,n,s){return new oo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ce.toString(s)}]})}_addCheck(t){return new oo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&rt.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}oo.create=e=>new oo({checks:[],typeName:Ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ze(e)});class io extends He{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)!==ye.bigint){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.bigint,received:o.parsedType}),Ie}let n;const s=new lr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):rt.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Ce.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ce.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ce.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ce.toString(r))}setLimit(t,r,n,s){return new io({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ce.toString(s)}]})}_addCheck(t){return new io({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}io.create=e=>{var t;return new io({checks:[],typeName:Ae.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ze(e)})};class Il extends He{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ye.boolean){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.boolean,received:n.parsedType}),Ie}return pr(t.data)}}Il.create=e=>new Il({typeName:Ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ze(e)});class Wo extends He{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ye.date){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.date,received:o.parsedType}),Ie}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_date}),Ie}const n=new lr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):rt.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Wo({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Ce.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Ce.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}Wo.create=e=>new Wo({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ae.ZodDate,...ze(e)});class _d extends He{_parse(t){if(this._getType(t)!==ye.symbol){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.symbol,received:n.parsedType}),Ie}return pr(t.data)}}_d.create=e=>new _d({typeName:Ae.ZodSymbol,...ze(e)});class Ll extends He{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.undefined,received:n.parsedType}),Ie}return pr(t.data)}}Ll.create=e=>new Ll({typeName:Ae.ZodUndefined,...ze(e)});class Fl extends He{_parse(t){if(this._getType(t)!==ye.null){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.null,received:n.parsedType}),Ie}return pr(t.data)}}Fl.create=e=>new Fl({typeName:Ae.ZodNull,...ze(e)});class ta extends He{constructor(){super(...arguments),this._any=!0}_parse(t){return pr(t.data)}}ta.create=e=>new ta({typeName:Ae.ZodAny,...ze(e)});class Do extends He{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pr(t.data)}}Do.create=e=>new Do({typeName:Ae.ZodUnknown,...ze(e)});class ys extends He{_parse(t){const r=this._getOrReturnCtx(t);return pe(r,{code:ie.invalid_type,expected:ye.never,received:r.parsedType}),Ie}}ys.create=e=>new ys({typeName:Ae.ZodNever,...ze(e)});class bd extends He{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.void,received:n.parsedType}),Ie}return pr(t.data)}}bd.create=e=>new bd({typeName:Ae.ZodVoid,...ze(e)});class fn extends He{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==ye.array)return pe(r,{code:ie.invalid_type,expected:ye.array,received:r.parsedType}),Ie;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(pe(r,{code:i?ie.too_big:ie.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(pe(r,{code:ie.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(pe(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Ln(r,i,r.path,a)))).then(i=>lr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Ln(r,i,r.path,a)));return lr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new fn({...this._def,minLength:{value:t,message:Ce.toString(r)}})}max(t,r){return new fn({...this._def,maxLength:{value:t,message:Ce.toString(r)}})}length(t,r){return new fn({...this._def,exactLength:{value:t,message:Ce.toString(r)}})}nonempty(t){return this.min(1,t)}}fn.create=(e,t)=>new fn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...ze(t)});function pi(e){if(e instanceof Tt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=An.create(pi(n))}return new Tt({...e._def,shape:()=>t})}else return e instanceof fn?new fn({...e._def,type:pi(e.element)}):e instanceof An?An.create(pi(e.unwrap())):e instanceof lo?lo.create(pi(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>pi(t))):e}class Tt extends He{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(),r=rt.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==ye.object){const c=this._getOrReturnCtx(t);return pe(c,{code:ie.invalid_type,expected:ye.object,received:c.parsedType}),Ie}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ys&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const f=o[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Ln(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof ys){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")a.length>0&&(pe(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of a){const d=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Ln(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const d=await f.key,h=await f.value;c.push({key:d,value:h,alwaysSet:f.alwaysSet})}return c}).then(c=>lr.mergeObjectSync(n,c)):lr.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return Ce.errToObj,new Tt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const l=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=Ce.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Tt({...this._def,unknownKeys:"strip"})}passthrough(){return new Tt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Tt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Tt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ae.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Tt({...this._def,catchall:t})}pick(t){const r={};return rt.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Tt({...this._def,shape:()=>r})}omit(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Tt({...this._def,shape:()=>r})}deepPartial(){return pi(this)}partial(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Tt({...this._def,shape:()=>r})}required(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof An;)o=o._def.innerType;r[n]=o}}),new Tt({...this._def,shape:()=>r})}keyof(){return HC(rt.objectKeys(this.shape))}}Tt.create=(e,t)=>new Tt({shape:()=>e,unknownKeys:"strip",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});Tt.strictCreate=(e,t)=>new Tt({shape:()=>e,unknownKeys:"strict",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});Tt.lazycreate=(e,t)=>new Tt({shape:e,unknownKeys:"strip",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});class zl extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n=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 r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Lr(a.ctx.common.issues));return pe(r,{code:ie.invalid_union,unionErrors:i}),Ie}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const l of n){const c={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(l=>new Lr(l));return pe(r,{code:ie.invalid_union,unionErrors:a}),Ie}}get options(){return this._def.options}}zl.create=(e,t)=>new zl({options:e,typeName:Ae.ZodUnion,...ze(t)});const qn=e=>e instanceof Vl?qn(e.schema):e instanceof yn?qn(e.innerType()):e instanceof Wl?[e.value]:e instanceof ao?e.options:e instanceof Bl?rt.objectValues(e.enum):e instanceof Hl?qn(e._def.innerType):e instanceof Ll?[void 0]:e instanceof Fl?[null]:e instanceof An?[void 0,...qn(e.unwrap())]:e instanceof lo?[null,...qn(e.unwrap())]:e instanceof Dv||e instanceof Zl?qn(e.unwrap()):e instanceof Yl?qn(e._def.innerType):[];class Nf extends He{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.object)return pe(r,{code:ie.invalid_type,expected:ye.object,received:r.parsedType}),Ie;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(pe(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=qn(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 Nf({typeName:Ae.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...ze(n)})}}function om(e,t){const r=zs(e),n=zs(t);if(e===t)return{valid:!0,data:e};if(r===ye.object&&n===ye.object){const s=rt.objectKeys(t),o=rt.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const l=om(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(r===ye.array&&n===ye.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],l=om(i,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return r===ye.date&&n===ye.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ul extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(o,i)=>{if(nm(o)||nm(i))return Ie;const a=om(o.value,i.value);return a.valid?((sm(o)||sm(i))&&r.dirty(),{status:r.value,value:a.data}):(pe(n,{code:ie.invalid_intersection_types}),Ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ul.create=(e,t,r)=>new Ul({left:e,right:t,typeName:Ae.ZodIntersection,...ze(r)});class Fn extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.array)return pe(n,{code:ie.invalid_type,expected:ye.array,received:n.parsedType}),Ie;if(n.data.length<this._def.items.length)return pe(n,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&n.data.length>this._def.items.length&&(pe(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ln(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>lr.mergeArray(r,i)):lr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:Ae.ZodTuple,rest:null,...ze(t)})};class $l extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.object)return pe(n,{code:ie.invalid_type,expected:ye.object,received:n.parsedType}),Ie;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Ln(n,a,n.path,a)),value:i._parse(new Ln(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?lr.mergeObjectAsync(r,s):lr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof He?new $l({keyType:t,valueType:r,typeName:Ae.ZodRecord,...ze(n)}):new $l({keyType:cn.create(),valueType:t,typeName:Ae.ZodRecord,...ze(r)})}}class Sd extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.map)return pe(n,{code:ie.invalid_type,expected:ye.map,received:n.parsedType}),Ie;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,l],c)=>({key:s._parse(new Ln(n,a,n.path,[c,"key"])),value:o._parse(new Ln(n,l,n.path,[c,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return Ie;(c.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(c.value,f.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return Ie;(c.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(c.value,f.value)}return{status:r.value,value:a}}}}Sd.create=(e,t,r)=>new Sd({valueType:t,keyType:e,typeName:Ae.ZodMap,...ze(r)});class Bo extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.set)return pe(n,{code:ie.invalid_type,expected:ye.set,received:n.parsedType}),Ie;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(pe(n,{code:ie.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(pe(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(l){const c=new Set;for(const f of l){if(f.status==="aborted")return Ie;f.status==="dirty"&&r.dirty(),c.add(f.value)}return{status:r.value,value:c}}const a=[...n.data.values()].map((l,c)=>o._parse(new Ln(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,r){return new Bo({...this._def,minSize:{value:t,message:Ce.toString(r)}})}max(t,r){return new Bo({...this._def,maxSize:{value:t,message:Ce.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}Bo.create=(e,t)=>new Bo({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...ze(t)});class Bi extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.function)return pe(r,{code:ie.invalid_type,expected:ye.function,received:r.parsedType}),Ie;function n(a,l){return wd({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yd(),ea].filter(c=>!!c),issueData:{code:ie.invalid_arguments,argumentsError:l}})}function s(a,l){return wd({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yd(),ea].filter(c=>!!c),issueData:{code:ie.invalid_return_type,returnTypeError:l}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ra){const a=this;return pr(async function(...l){const c=new Lr([]),f=await a._def.args.parseAsync(l,o).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(i,this,f);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw c.addIssue(s(d,p)),c})})}else{const a=this;return pr(function(...l){const c=a._def.args.safeParse(l,o);if(!c.success)throw new Lr([n(l,c.error)]);const f=Reflect.apply(i,this,c.data),d=a._def.returns.safeParse(f,o);if(!d.success)throw new Lr([s(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Bi({...this._def,args:Fn.create(t).rest(Do.create())})}returns(t){return new Bi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Bi({args:t||Fn.create([]).rest(Do.create()),returns:r||Do.create(),typeName:Ae.ZodFunction,...ze(n)})}}class Vl extends He{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Vl.create=(e,t)=>new Vl({getter:e,typeName:Ae.ZodLazy,...ze(t)});class Wl extends He{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return pe(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:t.data}}get value(){return this._def.value}}Wl.create=(e,t)=>new Wl({value:e,typeName:Ae.ZodLiteral,...ze(t)});function HC(e,t){return new ao({values:e,typeName:Ae.ZodEnum,...ze(t)})}class ao extends He{constructor(){super(...arguments),Va.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return pe(r,{expected:rt.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Ie}if(xd(this,Va)||$C(this,Va,new Set(this._def.values)),!xd(this,Va).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return pe(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Ie}return pr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return ao.create(t,{...this._def,...r})}exclude(t,r=this._def){return ao.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}Va=new WeakMap;ao.create=HC;class Bl extends He{constructor(){super(...arguments),Wa.set(this,void 0)}_parse(t){const r=rt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ye.string&&n.parsedType!==ye.number){const s=rt.objectValues(r);return pe(n,{expected:rt.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Ie}if(xd(this,Wa)||$C(this,Wa,new Set(rt.getValidEnumValues(this._def.values))),!xd(this,Wa).has(t.data)){const s=rt.objectValues(r);return pe(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Ie}return pr(t.data)}get enum(){return this._def.values}}Wa=new WeakMap;Bl.create=(e,t)=>new Bl({values:e,typeName:Ae.ZodNativeEnum,...ze(t)});class ra extends He{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.promise&&r.common.async===!1)return pe(r,{code:ie.invalid_type,expected:ye.promise,received:r.parsedType}),Ie;const n=r.parsedType===ye.promise?r.data:Promise.resolve(r.data);return pr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ra.create=(e,t)=>new ra({type:e,typeName:Ae.ZodPromise,...ze(t)});class yn extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{pe(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Ie;const l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Ie:l.status==="dirty"||r.value==="dirty"?Pi(l.value):l});{if(r.value==="aborted")return Ie;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Ie:a.status==="dirty"||r.value==="dirty"?Pi(a.value):a}}if(s.type==="refinement"){const i=a=>{const l=s.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ie:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Ie:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Al(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:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Al(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);rt.assertNever(s)}}yn.create=(e,t,r)=>new yn({schema:e,typeName:Ae.ZodEffects,effect:t,...ze(r)});yn.createWithPreprocess=(e,t,r)=>new yn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...ze(r)});class An extends He{_parse(t){return this._getType(t)===ye.undefined?pr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Ae.ZodOptional,...ze(t)});class lo extends He{_parse(t){return this._getType(t)===ye.null?pr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}lo.create=(e,t)=>new lo({innerType:e,typeName:Ae.ZodNullable,...ze(t)});class Hl extends He{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===ye.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ze(t)});class Yl extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ml(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Lr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Lr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Yl.create=(e,t)=>new Yl({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ze(t)});class kd extends He{_parse(t){if(this._getType(t)!==ye.nan){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.nan,received:n.parsedType}),Ie}return{status:"valid",value:t.data}}}kd.create=e=>new kd({typeName:Ae.ZodNaN,...ze(e)});const lz=Symbol("zod_brand");class Dv extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class mc extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ie:o.status==="dirty"?(r.dirty(),Pi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ie:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new mc({in:t,out:r,typeName:Ae.ZodPipeline})}}class Zl extends He{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Al(s)&&(s.value=Object.freeze(s.value)),s);return Ml(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Ae.ZodReadonly,...ze(t)});function YC(e,t={},r){return e?ta.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,l=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,c=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...c,fatal:l})}}):ta.create()}const cz={object:Tt.lazycreate};var Ae;(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"})(Ae||(Ae={}));const uz=(e,t={message:`Input not instance of ${e.name}`})=>YC(r=>r instanceof e,t),ZC=cn.create,GC=oo.create,dz=kd.create,fz=io.create,KC=Il.create,hz=Wo.create,pz=_d.create,mz=Ll.create,gz=Fl.create,vz=ta.create,yz=Do.create,wz=ys.create,xz=bd.create,_z=fn.create,bz=Tt.create,Sz=Tt.strictCreate,kz=zl.create,Cz=Nf.create,Ez=Ul.create,Tz=Fn.create,Rz=$l.create,Nz=Sd.create,Pz=Bo.create,jz=Bi.create,Dz=Vl.create,Oz=Wl.create,Az=ao.create,Mz=Bl.create,Iz=ra.create,yw=yn.create,Lz=An.create,Fz=lo.create,zz=yn.createWithPreprocess,Uz=mc.create,$z=()=>ZC().optional(),Vz=()=>GC().optional(),Wz=()=>KC().optional(),Bz={string:e=>cn.create({...e,coerce:!0}),number:e=>oo.create({...e,coerce:!0}),boolean:e=>Il.create({...e,coerce:!0}),bigint:e=>io.create({...e,coerce:!0}),date:e=>Wo.create({...e,coerce:!0})},Hz=Ie;var Fe=Object.freeze({__proto__:null,defaultErrorMap:ea,setErrorMap:H5,getErrorMap:yd,makeIssue:wd,EMPTY_PATH:Y5,addIssueToContext:pe,ParseStatus:lr,INVALID:Ie,DIRTY:Pi,OK:pr,isAborted:nm,isDirty:sm,isValid:Al,isAsync:Ml,get util(){return rt},get objectUtil(){return rm},ZodParsedType:ye,getParsedType:zs,ZodType:He,datetimeRegex:BC,ZodString:cn,ZodNumber:oo,ZodBigInt:io,ZodBoolean:Il,ZodDate:Wo,ZodSymbol:_d,ZodUndefined:Ll,ZodNull:Fl,ZodAny:ta,ZodUnknown:Do,ZodNever:ys,ZodVoid:bd,ZodArray:fn,ZodObject:Tt,ZodUnion:zl,ZodDiscriminatedUnion:Nf,ZodIntersection:Ul,ZodTuple:Fn,ZodRecord:$l,ZodMap:Sd,ZodSet:Bo,ZodFunction:Bi,ZodLazy:Vl,ZodLiteral:Wl,ZodEnum:ao,ZodNativeEnum:Bl,ZodPromise:ra,ZodEffects:yn,ZodTransformer:yn,ZodOptional:An,ZodNullable:lo,ZodDefault:Hl,ZodCatch:Yl,ZodNaN:kd,BRAND:lz,ZodBranded:Dv,ZodPipeline:mc,ZodReadonly:Zl,custom:YC,Schema:He,ZodSchema:He,late:cz,get ZodFirstPartyTypeKind(){return Ae},coerce:Bz,any:vz,array:_z,bigint:fz,boolean:KC,date:hz,discriminatedUnion:Cz,effect:yw,enum:Az,function:jz,instanceof:uz,intersection:Ez,lazy:Dz,literal:Oz,map:Nz,nan:dz,nativeEnum:Mz,never:wz,null:gz,nullable:Fz,number:GC,object:bz,oboolean:Wz,onumber:Vz,optional:Lz,ostring:$z,pipeline:Uz,preprocess:zz,promise:Iz,record:Rz,set:Pz,strictObject:Sz,string:ZC,symbol:pz,transformer:yw,tuple:Tz,undefined:mz,union:kz,unknown:yz,void:xz,NEVER:Hz,ZodIssueCode:ie,quotelessJson:B5,ZodError:Lr}),Yz="Label",qC=y.forwardRef((e,t)=>u.jsx(De.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));qC.displayName=Yz;var XC=qC;const Zz=Jl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Cd=y.forwardRef(({className:e,...t},r)=>u.jsx(XC,{ref:r,className:we(Zz(),e),...t}));Cd.displayName=XC.displayName;const ei=E5,QC=y.createContext({}),tt=({...e})=>u.jsx(QC.Provider,{value:{name:e.name},children:u.jsx(P5,{...e})}),Pf=()=>{const e=y.useContext(QC),t=y.useContext(JC),{getFieldState:r,formState:n}=Rf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");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}},JC=y.createContext({}),Ke=y.forwardRef(({className:e,...t},r)=>{const n=y.useId();return u.jsx(JC.Provider,{value:{id:n},children:u.jsx("div",{ref:r,className:we("space-y-2",e),...t})})});Ke.displayName="FormItem";const qe=y.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Pf();return u.jsx(Cd,{ref:r,className:we(n&&"text-destructive",e),htmlFor:s,...t})});qe.displayName="FormLabel";const Xe=y.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Pf();return u.jsx(hs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Xe.displayName="FormControl";const Gz=y.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Pf();return u.jsx("p",{ref:r,id:n,className:we("text-sm text-muted-foreground",e),...t})});Gz.displayName="FormDescription";const Ze=y.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Pf(),i=s?String(s==null?void 0:s.message):t;return i?u.jsx("p",{ref:n,id:o,className:we("text-sm font-medium text-destructive",e),...r,children:i}):null});Ze.displayName="FormMessage";function im(e,[t,r]){return Math.min(r,Math.max(t,e))}var Kz=[" ","Enter","ArrowUp","ArrowDown"],qz=[" ","Enter"],gc="Select",[jf,Df,Xz]=qd(gc),[ya,_U]=Er(gc,[Xz,ha]),Of=ha(),[Qz,mo]=ya(gc),[Jz,e6]=ya(gc),eE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:d,disabled:h,required:p}=e,w=Of(t),[m,x]=y.useState(null),[g,v]=y.useState(null),[_,C]=y.useState(!1),E=ec(c),[T=!1,P]=ps({prop:n,defaultProp:s,onChange:o}),[O,j]=ps({prop:i,defaultProp:a,onChange:l}),L=y.useRef(null),q=m?!!m.closest("form"):!0,[R,F]=y.useState(new Set),b=Array.from(R).map(V=>V.props.value).join(";");return u.jsx(Ng,{...w,children:u.jsxs(Qz,{required:p,scope:t,trigger:m,onTriggerChange:x,valueNode:g,onValueNodeChange:v,valueNodeHasChildren:_,onValueNodeHasChildrenChange:C,contentId:On(),value:O,onValueChange:j,open:T,onOpenChange:P,dir:E,triggerPointerDownPosRef:L,disabled:h,children:[u.jsx(jf.Provider,{scope:t,children:u.jsx(Jz,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:y.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?u.jsxs(EE,{"aria-hidden":!0,required:p,tabIndex:-1,name:f,autoComplete:d,value:O,onChange:V=>j(V.target.value),disabled:h,children:[O===void 0?u.jsx("option",{value:""}):null,Array.from(R)]},b):null]})})};eE.displayName=gc;var tE="SelectTrigger",rE=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Of(r),i=mo(tE,r),a=i.disabled||n,l=Ue(t,i.onTriggerChange),c=Df(r),[f,d,h]=TE(w=>{const m=c().filter(v=>!v.disabled),x=m.find(v=>v.value===i.value),g=RE(m,w,x);g!==void 0&&i.onValueChange(g.value)}),p=()=>{a||(i.onOpenChange(!0),h())};return u.jsx(Pg,{asChild:!0,...o,children:u.jsx(De.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":CE(i.value)?"":void 0,...s,ref:l,onClick:le(s.onClick,w=>{w.currentTarget.focus()}),onPointerDown:le(s.onPointerDown,w=>{const m=w.target;m.hasPointerCapture(w.pointerId)&&m.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&(p(),i.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)},w.preventDefault())}),onKeyDown:le(s.onKeyDown,w=>{const m=f.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&d(w.key),!(m&&w.key===" ")&&Kz.includes(w.key)&&(p(),w.preventDefault())})})})});rE.displayName=tE;var nE="SelectValue",sE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,l=mo(nE,r),{onValueNodeHasChildrenChange:c}=l,f=o!==void 0,d=Ue(t,l.onValueNodeChange);return rr(()=>{c(f)},[c,f]),u.jsx(De.span,{...a,ref:d,style:{pointerEvents:"none"},children:CE(l.value)?u.jsx(u.Fragment,{children:i}):o})});sE.displayName=nE;var t6="SelectIcon",oE=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return u.jsx(De.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});oE.displayName=t6;var r6="SelectPortal",iE=e=>u.jsx(rc,{asChild:!0,...e});iE.displayName=r6;var Ho="SelectContent",aE=y.forwardRef((e,t)=>{const r=mo(Ho,e.__scopeSelect),[n,s]=y.useState();if(rr(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?xs.createPortal(u.jsx(lE,{scope:e.__scopeSelect,children:u.jsx(jf.Slot,{scope:e.__scopeSelect,children:u.jsx("div",{children:e.children})})}),o):null}return u.jsx(cE,{...e,ref:t})});aE.displayName=Ho;var Jn=10,[lE,go]=ya(Ho),n6="SelectContentImpl",cE=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:w,hideWhenDetached:m,avoidCollisions:x,...g}=e,v=mo(Ho,r),[_,C]=y.useState(null),[E,T]=y.useState(null),P=Ue(t,fe=>C(fe)),[O,j]=y.useState(null),[L,q]=y.useState(null),R=Df(r),[F,b]=y.useState(!1),V=y.useRef(!1);y.useEffect(()=>{if(_)return Og(_)},[_]),wg();const te=y.useCallback(fe=>{const[ge,...be]=R().map(Se=>Se.ref.current),[Pe]=be.slice(-1),Te=document.activeElement;for(const Se of fe)if(Se===Te||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ge&&E&&(E.scrollTop=0),Se===Pe&&E&&(E.scrollTop=E.scrollHeight),Se==null||Se.focus(),document.activeElement!==Te))return},[R,E]),W=y.useCallback(()=>te([O,_]),[te,O,_]);y.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=v;y.useEffect(()=>{if(_){let fe={x:0,y:0};const ge=Pe=>{var Te,Se;fe={x:Math.abs(Math.round(Pe.pageX)-(((Te=I.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(Pe.pageY)-(((Se=I.current)==null?void 0:Se.y)??0))}},be=Pe=>{fe.x<=10&&fe.y<=10?Pe.preventDefault():_.contains(Pe.target)||Z(!1),document.removeEventListener("pointermove",ge),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",be,{capture:!0})}}},[_,Z,I]),y.useEffect(()=>{const fe=()=>Z(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[Z]);const[Q,z]=TE(fe=>{const ge=R().filter(Te=>!Te.disabled),be=ge.find(Te=>Te.ref.current===document.activeElement),Pe=RE(ge,fe,be);Pe&&setTimeout(()=>Pe.ref.current.focus())}),$=y.useCallback((fe,ge,be)=>{const Pe=!V.current&&!be;(v.value!==void 0&&v.value===ge||Pe)&&(j(fe),Pe&&(V.current=!0))},[v.value]),de=y.useCallback(()=>_==null?void 0:_.focus(),[_]),ne=y.useCallback((fe,ge,be)=>{const Pe=!V.current&&!be;(v.value!==void 0&&v.value===ge||Pe)&&q(fe)},[v.value]),se=n==="popper"?am:uE,Ee=se===am?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:w,hideWhenDetached:m,avoidCollisions:x}:{};return u.jsx(lE,{scope:r,content:_,viewport:E,onViewportChange:T,itemRefCallback:$,selectedItem:O,onItemLeave:de,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:u.jsx(nf,{as:hs,allowPinchZoom:!0,children:u.jsx(Xd,{asChild:!0,trapped:v.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:le(s,fe=>{var ge;(ge=v.trigger)==null||ge.focus({preventScroll:!0}),fe.preventDefault()}),children:u.jsx(ua,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:u.jsx(se,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:fe=>fe.preventDefault(),...g,...Ee,onPlaced:()=>b(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:le(g.onKeyDown,fe=>{const ge=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!ge&&fe.key.length===1&&z(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let Pe=R().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(Pe=Pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Te=fe.target,Se=Pe.indexOf(Te);Pe=Pe.slice(Se+1)}setTimeout(()=>te(Pe)),fe.preventDefault()}})})})})})})});cE.displayName=n6;var s6="SelectItemAlignedPosition",uE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=mo(Ho,r),i=go(Ho,r),[a,l]=y.useState(null),[c,f]=y.useState(null),d=Ue(t,P=>f(P)),h=Df(r),p=y.useRef(!1),w=y.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:g,focusSelectedItem:v}=i,_=y.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&m&&x&&g){const P=o.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),L=g.getBoundingClientRect();if(o.dir!=="rtl"){const Te=L.left-O.left,Se=j.left-Te,et=P.left-Se,k=P.width+et,J=Math.max(k,O.width),G=window.innerWidth-Jn,D=im(Se,[Jn,G-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Te=O.right-L.right,Se=window.innerWidth-j.right-Te,et=window.innerWidth-P.right-Se,k=P.width+et,J=Math.max(k,O.width),G=window.innerWidth-Jn,D=im(Se,[Jn,G-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=h(),R=window.innerHeight-Jn*2,F=m.scrollHeight,b=window.getComputedStyle(c),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(x.offsetHeight*5,I),z=window.getComputedStyle(m),$=parseInt(z.paddingTop,10),de=parseInt(z.paddingBottom,10),ne=P.top+P.height/2-Jn,se=R-ne,Ee=x.offsetHeight/2,fe=x.offsetTop+Ee,ge=V+te+fe,be=I-ge;if(ge<=ne){const Te=x===q[q.length-1].ref.current;a.style.bottom="0px";const Se=c.clientHeight-m.offsetTop-m.offsetHeight,et=Math.max(se,Ee+(Te?de:0)+Se+W),k=ge+et;a.style.height=k+"px"}else{const Te=x===q[0].ref.current;a.style.top="0px";const et=Math.max(ne,V+m.offsetTop+(Te?$:0)+Ee)+be;a.style.height=et+"px",m.scrollTop=ge-ne+m.offsetTop}a.style.margin=`${Jn}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=R+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,a,c,m,x,g,o.dir,n]);rr(()=>_(),[_]);const[C,E]=y.useState();rr(()=>{c&&E(window.getComputedStyle(c).zIndex)},[c]);const T=y.useCallback(P=>{P&&w.current===!0&&(_(),v==null||v(),w.current=!1)},[_,v]);return u.jsx(i6,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:u.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:u.jsx(De.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});uE.displayName=s6;var o6="SelectPopperPosition",am=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Jn,...o}=e,i=Of(r);return u.jsx(jg,{...i,...o,ref:t,align:n,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)"}})});am.displayName=o6;var[i6,Ov]=ya(Ho,{}),lm="SelectViewport",dE=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=go(lm,r),i=Ov(lm,r),a=Ue(t,o.onViewportChange),l=y.useRef(0);return u.jsxs(u.Fragment,{children:[u.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:n}),u.jsx(jf.Slot,{scope:r,children:u.jsx(De.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:le(s.onScroll,c=>{const f=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&d){const p=Math.abs(l.current-f.scrollTop);if(p>0){const w=window.innerHeight-Jn*2,m=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),g=Math.max(m,x);if(g<w){const v=g+p,_=Math.min(w,v),C=v-_;d.style.height=_+"px",d.style.bottom==="0px"&&(f.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});dE.displayName=lm;var fE="SelectGroup",[a6,l6]=ya(fE),hE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=On();return u.jsx(a6,{scope:r,id:s,children:u.jsx(De.div,{role:"group","aria-labelledby":s,...n,ref:t})})});hE.displayName=fE;var pE="SelectLabel",mE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=l6(pE,r);return u.jsx(De.div,{id:s.id,...n,ref:t})});mE.displayName=pE;var Ed="SelectItem",[c6,gE]=ya(Ed),vE=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=mo(Ed,r),l=go(Ed,r),c=a.value===n,[f,d]=y.useState(o??""),[h,p]=y.useState(!1),w=Ue(t,g=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,g,n,s)}),m=On(),x=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u.jsx(c6,{scope:r,value:n,disabled:s,textId:m,isSelected:c,onItemTextChange:y.useCallback(g=>{d(v=>v||((g==null?void 0:g.textContent)??"").trim())},[]),children:u.jsx(jf.ItemSlot,{scope:r,value:n,disabled:s,textValue:f,children:u.jsx(De.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:w,onFocus:le(i.onFocus,()=>p(!0)),onBlur:le(i.onBlur,()=>p(!1)),onPointerUp:le(i.onPointerUp,x),onPointerMove:le(i.onPointerMove,g=>{var v;s?(v=l.onItemLeave)==null||v.call(l):g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:le(i.onPointerLeave,g=>{var v;g.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:le(i.onKeyDown,g=>{var _;((_=l.searchRef)==null?void 0:_.current)!==""&&g.key===" "||(qz.includes(g.key)&&x(),g.key===" "&&g.preventDefault())})})})})});vE.displayName=Ed;var Ba="SelectItemText",yE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=mo(Ba,r),a=go(Ba,r),l=gE(Ba,r),c=e6(Ba,r),[f,d]=y.useState(null),h=Ue(t,g=>d(g),l.onItemTextChange,g=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,g,l.value,l.disabled)}),p=f==null?void 0:f.textContent,w=y.useMemo(()=>u.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=c;return rr(()=>(m(w),()=>x(w)),[m,x,w]),u.jsxs(u.Fragment,{children:[u.jsx(De.span,{id:l.textId,...o,ref:h}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?xs.createPortal(o.children,i.valueNode):null]})});yE.displayName=Ba;var wE="SelectItemIndicator",xE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return gE(wE,r).isSelected?u.jsx(De.span,{"aria-hidden":!0,...n,ref:t}):null});xE.displayName=wE;var cm="SelectScrollUpButton",_E=y.forwardRef((e,t)=>{const r=go(cm,e.__scopeSelect),n=Ov(cm,e.__scopeSelect),[s,o]=y.useState(!1),i=Ue(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const c=l.scrollTop>0;o(c)};const l=r.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?u.jsx(SE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=r;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_E.displayName=cm;var um="SelectScrollDownButton",bE=y.forwardRef((e,t)=>{const r=go(um,e.__scopeSelect),n=Ov(um,e.__scopeSelect),[s,o]=y.useState(!1),i=Ue(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<c;o(f)};const l=r.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?u.jsx(SE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=r;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});bE.displayName=um;var SE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=go("SelectScrollButton",r),i=y.useRef(null),a=Df(r),l=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),rr(()=>{var f;const c=a().find(d=>d.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),u.jsx(De.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:le(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:le(s.onPointerMove,()=>{var c;(c=o.onItemLeave)==null||c.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:le(s.onPointerLeave,()=>{l()})})}),u6="SelectSeparator",kE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return u.jsx(De.div,{"aria-hidden":!0,...n,ref:t})});kE.displayName=u6;var dm="SelectArrow",d6=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Of(r),o=mo(dm,r),i=go(dm,r);return o.open&&i.position==="popper"?u.jsx(Dg,{...s,...n,ref:t}):null});d6.displayName=dm;function CE(e){return e===""||e===void 0}var EE=y.forwardRef((e,t)=>{const{value:r,...n}=e,s=y.useRef(null),o=Ue(t,s),i=wv(r);return y.useEffect(()=>{const a=s.current,l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==r&&f){const d=new Event("change",{bubbles:!0});f.call(a,r),a.dispatchEvent(d)}},[i,r]),u.jsx(hc,{asChild:!0,children:u.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function TE(e){const t=jt(e),r=y.useRef(""),n=y.useRef(0),s=y.useCallback(i=>{const a=r.current+i;t(a),function l(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),o=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function RE(e,t,r){const s=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=f6(e,Math.max(o,0));s.length===1&&(i=i.filter(c=>c!==r));const l=i.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}function f6(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var h6=eE,NE=rE,p6=sE,m6=oE,g6=iE,PE=aE,v6=dE,y6=hE,jE=mE,DE=vE,w6=yE,x6=xE,OE=_E,AE=bE,ME=kE;const Ah=h6,Mh=y6,Ih=p6,ku=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(NE,{ref:n,className:we("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),...r,children:[t,u.jsx(m6,{asChild:!0,children:u.jsx(e1,{className:"h-4 w-4 opacity-50"})})]}));ku.displayName=NE.displayName;const IE=y.forwardRef(({className:e,...t},r)=>u.jsx(OE,{ref:r,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(UP,{className:"h-4 w-4"})}));IE.displayName=OE.displayName;const LE=y.forwardRef(({className:e,...t},r)=>u.jsx(AE,{ref:r,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(e1,{className:"h-4 w-4"})}));LE.displayName=AE.displayName;const Cu=y.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>u.jsx(g6,{children:u.jsxs(PE,{ref:s,className:we("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",r==="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:r,...n,children:[u.jsx(IE,{}),u.jsx(v6,{className:we("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(LE,{})]})}));Cu.displayName=PE.displayName;const Eu=y.forwardRef(({className:e,...t},r)=>u.jsx(jE,{ref:r,className:we("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Eu.displayName=jE.displayName;const Tu=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(DE,{ref:n,className:we("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),...r,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(x6,{children:u.jsx(J_,{className:"h-4 w-4"})})}),u.jsx(w6,{children:t})]}));Tu.displayName=DE.displayName;const _6=y.forwardRef(({className:e,...t},r)=>u.jsx(ME,{ref:r,className:we("-mx-1 my-1 h-px bg-muted",e),...t}));_6.displayName=ME.displayName;const fm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),b6=Array.from(fm.keys()),S6=Yg,k6=Zg,C6=Gg,FE=y.forwardRef(({className:e,...t},r)=>u.jsx(oc,{ref:r,className:we("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}));FE.displayName=oc.displayName;const zE=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(C6,{children:[u.jsx(FE,{}),u.jsxs(ic,{ref:n,className:we("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),...r,children:[t,u.jsxs(af,{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:[u.jsx(pg,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zE.displayName=ic.displayName;const UE=({className:e,...t})=>u.jsx("div",{className:we("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});UE.displayName="DialogHeader";const $E=y.forwardRef(({className:e,...t},r)=>u.jsx(ac,{ref:r,className:we("text-lg font-semibold leading-none tracking-tight",e),...t}));$E.displayName=ac.displayName;const E6=y.forwardRef(({className:e,...t},r)=>u.jsx(lc,{ref:r,className:we("text-sm text-muted-foreground",e),...t}));E6.displayName=lc.displayName;const Oo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),Af=Fe.union([Fe.literal("aliyun"),Fe.literal("tencent"),Fe.literal("ssh"),Fe.literal("webhook")],{message:"请选择云服务商"}),T6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,secretId:Fe.string().min(1).max(64),secretKey:Fe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async l=>{const c={id:l.id,name:l.name,configType:l.configType,config:{secretId:l.secretId,secretKey:l.secretKey}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})})}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"secretId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SecretId"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入SecretId",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"secretKey",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SecretKey"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入SecretKey",...l})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})},R6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,accessKeyId:Fe.string().min(1).max(64),accessSecretId:Fe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async l=>{const c={id:l.id,name:l.name,configType:l.configType,config:{accessKeyId:l.accessKeyId,accessKeySecret:l.accessSecretId}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})});return}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"accessKeyId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"AccessKeyId"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入AccessKeyId",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"accessSecretId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"AccessKeySecret"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入AccessKeySecret",...l})}),u.jsx(Ze,{})]})}),u.jsx(Ze,{}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})};var Av="Radio",[N6,VE]=Er(Av),[P6,j6]=N6(Av),WE=y.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:o,disabled:i,value:a="on",onCheck:l,...c}=e,[f,d]=y.useState(null),h=Ue(t,m=>d(m)),p=y.useRef(!1),w=f?!!f.closest("form"):!0;return u.jsxs(P6,{scope:r,checked:s,disabled:i,children:[u.jsx(De.button,{type:"button",role:"radio","aria-checked":s,"data-state":YE(s),"data-disabled":i?"":void 0,disabled:i,value:a,...c,ref:h,onClick:le(e.onClick,m=>{s||l==null||l(),w&&(p.current=m.isPropagationStopped(),p.current||m.stopPropagation())})}),w&&u.jsx(D6,{control:f,bubbles:!p.current,name:n,value:a,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});WE.displayName=Av;var BE="RadioIndicator",HE=y.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...s}=e,o=j6(BE,r);return u.jsx(vr,{present:n||o.checked,children:u.jsx(De.span,{"data-state":YE(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});HE.displayName=BE;var D6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=y.useRef(null),i=wv(r),a=Eg(t);return y.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==r&&d){const h=new Event("click",{bubbles:n});d.call(l,r),l.dispatchEvent(h)}},[i,r,n]),u.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function YE(e){return e?"checked":"unchecked"}var O6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mv="RadioGroup",[A6,bU]=Er(Mv,[tf,VE]),ZE=tf(),GE=VE(),[M6,I6]=A6(Mv),KE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:o,required:i=!1,disabled:a=!1,orientation:l,dir:c,loop:f=!0,onValueChange:d,...h}=e,p=ZE(r),w=ec(c),[m,x]=ps({prop:o,defaultProp:s,onChange:d});return u.jsx(M6,{scope:r,name:n,required:i,disabled:a,value:m,onValueChange:x,children:u.jsx(z1,{asChild:!0,...p,orientation:l,dir:w,loop:f,children:u.jsx(De.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":a?"":void 0,dir:w,...h,ref:t})})})});KE.displayName=Mv;var qE="RadioGroupItem",XE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...s}=e,o=I6(qE,r),i=o.disabled||n,a=ZE(r),l=GE(r),c=y.useRef(null),f=Ue(t,c),d=o.value===s.value,h=y.useRef(!1);return y.useEffect(()=>{const p=m=>{O6.includes(m.key)&&(h.current=!0)},w=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",w)}},[]),u.jsx(U1,{asChild:!0,...a,focusable:!i,active:d,children:u.jsx(WE,{disabled:i,required:o.required,checked:d,...l,...s,name:o.name,ref:f,onCheck:()=>o.onValueChange(s.value),onKeyDown:le(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:le(s.onFocus,()=>{var p;h.current&&((p=c.current)==null||p.click())})})})});XE.displayName=qE;var L6="RadioGroupIndicator",QE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,s=GE(r);return u.jsx(HE,{...s,...n,ref:t})});QE.displayName=L6;var JE=KE,eT=XE,F6=QE;const tT=y.forwardRef(({className:e,...t},r)=>u.jsx(JE,{className:we("grid gap-2",e),...t,ref:r}));tT.displayName=JE.displayName;const rT=y.forwardRef(({className:e,...t},r)=>u.jsx(eT,{ref:r,className:we("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:u.jsx(F6,{className:"flex items-center justify-center",children:u.jsx(n1,{className:"h-2.5 w-2.5 fill-current text-current"})})}));rT.displayName=eT.displayName;const nT=y.forwardRef(({className:e,...t},r)=>u.jsx("textarea",{className:we("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:r,...t}));nT.displayName="Textarea";const z6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,host:Fe.string().ip({message:"请输入合法的IP地址"}),port:Fe.string().min(1).max(5),username:Fe.string().min(1).max(64),password:Fe.string().min(0).max(64),key:Fe.string().min(0).max(20480),keyFile:Fe.string().optional(),command:Fe.string().min(1).max(2048),certPath:Fe.string().min(0).max(2048),keyPath:Fe.string().min(0).max(2048)});let o={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",host:o.host,port:o.port,username:o.username,password:o.password,key:o.key,keyFile:o.keyFile,certPath:o.certPath,keyPath:o.keyPath,command:o.command}}),a=async c=>{console.log(c);const f={id:c.id,name:c.name,configType:c.configType,config:{host:c.host,port:c.port,username:c.username,password:c.password,key:c.key,command:c.command,certPath:c.certPath,keyPath:c.keyPath}};try{const d=await wf(f);if(t(),f.id=d.id,f.created=d.created,f.updated=d.updated,c.id){n(f);return}r(f)}catch(d){Object.entries(d.response.data).forEach(([p,w])=>{i.setError(p,{type:"manual",message:w.message})});return}},l=async c=>{var h;const f=(h=c.target.files)==null?void 0:h[0];if(!f)return;const d=await m5(f);i.setValue("key",d),i.setValue("keyFile","")};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-3",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:c})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:c})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...c})}),u.jsx(Ze,{})]})}),u.jsxs("div",{className:"flex space-x-2",children:[u.jsx(tt,{control:i.control,name:"host",render:({field:c})=>u.jsxs(Ke,{className:"grow",children:[u.jsx(qe,{children:"服务器IP"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Host",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"port",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SSH端口"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Port",...c,type:"number"})}),u.jsx(Ze,{})]})})]}),u.jsx(tt,{control:i.control,name:"username",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"用户名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入用户名",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"password",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入密码",...c,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"key",render:({field:c})=>u.jsxs(Ke,{hidden:!0,children:[u.jsx(qe,{children:"Key(使用证书登录)"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Key",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"keyFile",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Key(使用证书登录)"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Key",...c,type:"file",onChange:l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"certPath",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"证书上传路径"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入证书上传路径",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"keyPath",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"私钥上传路径"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入私钥上传路径",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"command",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Command"}),u.jsx(Xe,{children:u.jsx(nT,{placeholder:"请输入要执行的命令",...c})}),u.jsx(Ze,{})]})}),u.jsx(Ze,{}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})},U6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,url:Fe.string().url()});let o={url:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async l=>{console.log(l);const c={id:l.id,name:l.name,configType:l.configType,config:{url:l.url}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})})}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{console.log(l),l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"url",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Webhook Url"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Webhook Url",...l})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})};function sl({trigger:e,op:t,data:r,className:n}){const[s,o]=y.useState(!1),i=Array.from(Oo.keys()),[a,l]=y.useState((r==null?void 0:r.configType)||"");let c=u.jsx(u.Fragment,{children:" "});switch(a){case"tencent":c=u.jsx(T6,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":c=u.jsx(R6,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":c=u.jsx(z6,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":c=u.jsx(U6,{data:r,onAfterReq:()=>{o(!1)}})}const f=d=>d==a?"border-primary":"";return u.jsxs(S6,{onOpenChange:o,open:s,children:[u.jsx(k6,{asChild:!0,className:we(n),children:e}),u.jsxs(zE,{className:"sm:max-w-[600px] w-full",children:[u.jsx(UE,{children:u.jsxs($E,{children:[t=="add"?"添加":"编辑","授权"]})}),u.jsxs("div",{className:"container",children:[u.jsx(Cd,{children:"服务商"}),u.jsx(tT,{value:a,className:"flex mt-3 space-x-2",onValueChange:d=>{console.log(d),l(d)},children:i.map(d=>{var h,p;return u.jsx("div",{className:"flex items-center space-x-2",children:u.jsxs(Cd,{children:[u.jsx(rT,{value:d,hidden:!0}),u.jsxs("div",{className:we("flex items-center space-x-2 border p-2 rounded cursor-pointer",f(d)),children:[u.jsx("img",{src:(h=Oo.get(d))==null?void 0:h[1],className:"h-6"}),u.jsx("div",{children:(p=Oo.get(d))==null?void 0:p[0]})]})]})},d)})}),c]})]})]})}const $6=()=>{const{config:{accesses:e}}=va(),[t,r]=y.useState(),n=po();y.useEffect(()=>{const p=new URLSearchParams(n.search).get("id");p&&(async()=>{const m=await w5(p);r(m)})()},[n.search]);const s=Fe.object({id:Fe.string().optional(),domain:Fe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),access:Fe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:Fe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择部署服务商配置"}),targetType:Fe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"})}),o=Qo({resolver:Jo(s),defaultValues:{id:"",domain:"",access:"",targetAccess:"",targetType:""}});y.useEffect(()=>{t&&o.reset({id:t.id,domain:t.domain,access:t.access,targetAccess:t.targetAccess,targetType:t.targetType})},[t,o]);const[i,a]=y.useState(t?t.targetType:""),l=e.filter(h=>{if(i=="")return!0;const p=o.getValues().targetType.split("-");return h.configType===p[0]}),{toast:c}=bf(),f=Ss(),d=async h=>{const p={id:h.id,crontab:"0 0 * * *",domain:h.domain,access:h.access,targetAccess:h.targetAccess,targetType:h.targetType};try{await tm(p);let w="域名编辑成功";p.id==""&&(w="域名添加成功"),c({title:"成功",description:w}),f("/")}catch(w){Object.entries(w.response.data).forEach(([x,g])=>{o.setError(x,{type:"manual",message:g.message})});return}};return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"",children:[u.jsx(kv,{}),u.jsxs("div",{className:"border-b h-10 text-muted-foreground",children:[t!=null&&t.id?"编辑":"新增","域名"]}),u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...o,children:u.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-8",children:[u.jsx(tt,{control:o.control,name:"domain",render:({field:h})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"域名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入域名",...h})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"access",render:({field:h})=>u.jsxs(Ke,{children:[u.jsxs(qe,{className:"flex w-full justify-between",children:[u.jsx("div",{children:"DNS 服务商授权配置"}),u.jsx(sl,{trigger:u.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[u.jsx(_0,{size:14}),"新增"]}),op:"add"})]}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,value:h.value,onValueChange:p=>{o.setValue("access",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择授权配置"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"服务商授权配置"}),e.map(p=>{var w;return u.jsx(Tu,{value:p.id,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=Oo.get(p.configType))==null?void 0:w[1]}),u.jsx("div",{children:p.name})]})},p.id)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"targetType",render:({field:h})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"部署服务类型"}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,onValueChange:p=>{a(p),o.setValue("targetType",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择部署服务类型"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"部署服务类型"}),b6.map(p=>{var w,m;return u.jsx(Tu,{value:p,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=fm.get(p))==null?void 0:w[1]}),u.jsx("div",{children:(m=fm.get(p))==null?void 0:m[0]})]})},p)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"targetAccess",render:({field:h})=>u.jsxs(Ke,{children:[u.jsxs(qe,{className:"w-full flex justify-between",children:[u.jsx("div",{children:"部署服务商授权配置"}),u.jsx(sl,{trigger:u.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[u.jsx(_0,{size:14}),"新增"]}),op:"add"})]}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,onValueChange:p=>{o.setValue("targetAccess",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择授权配置"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"服务商授权配置"}),l.map(p=>{var w;return u.jsx(Tu,{value:p.id,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=Oo.get(p.configType))==null?void 0:w[1]}),u.jsx("div",{children:p.name})]})},p.id)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})]})})},V6=()=>{const{config:e,deleteAccess:t}=va(),{accesses:r}=e,n=async s=>{const o=await Z4(s);t(o.id)};return u.jsxs("div",{className:"",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),u.jsx(sl,{trigger:u.jsx(Pt,{children:"添加授权"}),op:"add"})]}),r.length===0?u.jsxs("div",{className:"flex flex-col items-center mt-10",children:[u.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:u.jsx(VP,{size:40,className:"text-primary"})}),u.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),u.jsx(sl,{trigger:u.jsx(Pt,{children:"添加授权"}),op:"add",className:"mt-3"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-48",children:"名称"}),u.jsx("div",{className:"w-48",children:"服务商"}),u.jsx("div",{className:"w-52",children:"创建时间"}),u.jsx("div",{className:"w-52",children:"更新时间"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.map(s=>{var o,i;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:s.name}),u.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[u.jsx("img",{src:(o=Oo.get(s.configType))==null?void 0:o[1],className:"w-6"}),u.jsx("div",{children:(i=Oo.get(s.configType))==null?void 0:i[0]})]}),u.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于 ",s.created&&Ol(s.created)]}),u.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于 ",s.updated&&Ol(s.updated)]}),u.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[u.jsx(sl,{trigger:u.jsx(Pt,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:s}),u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>{n(s)},children:"删除"})]})]},s.id)})]})]})},W6=Jl("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"}}),sT=y.forwardRef(({className:e,variant:t,...r},n)=>u.jsx("div",{ref:n,role:"alert",className:we(W6({variant:t}),e),...r}));sT.displayName="Alert";const oT=y.forwardRef(({className:e,...t},r)=>u.jsx("h5",{ref:r,className:we("mb-1 font-medium leading-none tracking-tight",e),...t}));oT.displayName="AlertTitle";const iT=y.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:we("text-sm [&_p]:leading-relaxed",e),...t}));iT.displayName="AlertDescription";function B6(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var Iv="ScrollArea",[aT,SU]=Er(Iv),[H6,en]=aT(Iv),lT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,l]=y.useState(null),[c,f]=y.useState(null),[d,h]=y.useState(null),[p,w]=y.useState(null),[m,x]=y.useState(null),[g,v]=y.useState(0),[_,C]=y.useState(0),[E,T]=y.useState(!1),[P,O]=y.useState(!1),j=Ue(t,q=>l(q)),L=ec(s);return u.jsx(H6,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:c,onViewportChange:f,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:w,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:P,onScrollbarYEnabledChange:O,onCornerWidthChange:v,onCornerHeightChange:C,children:u.jsx(De.div,{dir:L,...i,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})})});lT.displayName=Iv;var cT="ScrollAreaViewport",uT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=en(cT,r),a=y.useRef(null),l=Ue(t,a,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.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}),u.jsx(De.div,{"data-radix-scroll-area-viewport":"",...o,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});uT.displayName=cT;var $n="ScrollAreaScrollbar",Lv=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return y.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?u.jsx(Y6,{...n,ref:t,forceMount:r}):s.type==="scroll"?u.jsx(Z6,{...n,ref:t,forceMount:r}):s.type==="auto"?u.jsx(dT,{...n,ref:t,forceMount:r}):s.type==="always"?u.jsx(Fv,{...n,ref:t}):null});Lv.displayName=$n;var Y6=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),[o,i]=y.useState(!1);return y.useEffect(()=>{const a=s.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),u.jsx(vr,{present:r||o,children:u.jsx(dT,{"data-state":o?"visible":"hidden",...n,ref:t})})}),Z6=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),o=e.orientation==="horizontal",i=If(()=>l("SCROLL_END"),100),[a,l]=B6("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 y.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,s.scrollHideDelay,l]),y.useEffect(()=>{const c=s.viewport,f=o?"scrollLeft":"scrollTop";if(c){let d=c[f];const h=()=>{const p=c[f];d!==p&&(l("SCROLL"),i()),d=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[s.viewport,o,l,i]),u.jsx(vr,{present:r||a!=="hidden",children:u.jsx(Fv,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:le(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:le(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),dT=y.forwardRef((e,t)=>{const r=en($n,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=y.useState(!1),a=e.orientation==="horizontal",l=If(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,f=r.viewport.offsetHeight<r.viewport.scrollHeight;i(a?c:f)}},10);return na(r.viewport,l),na(r.content,l),u.jsx(vr,{present:n||o,children:u.jsx(Fv,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Fv=y.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=en($n,e.__scopeScrollArea),o=y.useRef(null),i=y.useRef(0),[a,l]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=gT(a.viewport,a.content),f={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function d(h,p){return J6(h,i.current,a,p)}return r==="horizontal"?u.jsx(G6,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollLeft,p=ww(h,a,s.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=d(h,s.dir))}}):r==="vertical"?u.jsx(K6,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollTop,p=ww(h,a);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=d(h))}}):null}),G6=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=en($n,e.__scopeScrollArea),[i,a]=y.useState(),l=y.useRef(null),c=Ue(t,l,o.onScrollbarXChange);return y.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(hT,{"data-orientation":"horizontal",...s,ref:c,sizes:r,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":Mf(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(o.viewport){const h=o.viewport.scrollLeft+f.deltaX;e.onWheelScroll(h),yT(h,d)&&f.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Rd(i.paddingLeft),paddingEnd:Rd(i.paddingRight)}})}})}),K6=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=en($n,e.__scopeScrollArea),[i,a]=y.useState(),l=y.useRef(null),c=Ue(t,l,o.onScrollbarYChange);return y.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(hT,{"data-orientation":"vertical",...s,ref:c,sizes:r,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":Mf(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(o.viewport){const h=o.viewport.scrollTop+f.deltaY;e.onWheelScroll(h),yT(h,d)&&f.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Rd(i.paddingTop),paddingEnd:Rd(i.paddingBottom)}})}})}),[q6,fT]=aT($n),hT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:f,onResize:d,...h}=e,p=en($n,r),[w,m]=y.useState(null),x=Ue(t,j=>m(j)),g=y.useRef(null),v=y.useRef(""),_=p.viewport,C=n.content-n.viewport,E=jt(f),T=jt(l),P=If(d,10);function O(j){if(g.current){const L=j.clientX-g.current.left,q=j.clientY-g.current.top;c({x:L,y:q})}}return y.useEffect(()=>{const j=L=>{const q=L.target;(w==null?void 0:w.contains(q))&&E(L,C)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[_,w,C,E]),y.useEffect(T,[n,T]),na(w,P),na(p.content,P),u.jsx(q6,{scope:r,scrollbar:w,hasThumb:s,onThumbChange:jt(o),onThumbPointerUp:jt(i),onThumbPositionChange:T,onThumbPointerDown:jt(a),children:u.jsx(De.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:le(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),g.current=w.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(j))}),onPointerMove:le(e.onPointerMove,O),onPointerUp:le(e.onPointerUp,j=>{const L=j.target;L.hasPointerCapture(j.pointerId)&&L.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),Td="ScrollAreaThumb",pT=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=fT(Td,e.__scopeScrollArea);return u.jsx(vr,{present:r||s.hasThumb,children:u.jsx(X6,{ref:t,...n})})}),X6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=en(Td,r),i=fT(Td,r),{onThumbPositionChange:a}=i,l=Ue(t,d=>i.onThumbChange(d)),c=y.useRef(),f=If(()=>{c.current&&(c.current(),c.current=void 0)},100);return y.useEffect(()=>{const d=o.viewport;if(d){const h=()=>{if(f(),!c.current){const p=eU(d,a);c.current=p,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[o.viewport,f,a]),u.jsx(De.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:le(e.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),w=d.clientX-p.left,m=d.clientY-p.top;i.onThumbPointerDown({x:w,y:m})}),onPointerUp:le(e.onPointerUp,i.onThumbPointerUp)})});pT.displayName=Td;var zv="ScrollAreaCorner",mT=y.forwardRef((e,t)=>{const r=en(zv,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?u.jsx(Q6,{...e,ref:t}):null});mT.displayName=zv;var Q6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=en(zv,r),[o,i]=y.useState(0),[a,l]=y.useState(0),c=!!(o&&a);return na(s.scrollbarX,()=>{var d;const f=((d=s.scrollbarX)==null?void 0:d.offsetHeight)||0;s.onCornerHeightChange(f),l(f)}),na(s.scrollbarY,()=>{var d;const f=((d=s.scrollbarY)==null?void 0:d.offsetWidth)||0;s.onCornerWidthChange(f),i(f)}),c?u.jsx(De.div,{...n,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 Rd(e){return e?parseInt(e,10):0}function gT(e,t){const r=e/t;return isNaN(r)?0:r}function Mf(e){const t=gT(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function J6(e,t,r,n="ltr"){const s=Mf(r),o=s/2,i=t||o,a=s-i,l=r.scrollbar.paddingStart+i,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,f=r.content-r.viewport,d=n==="ltr"?[0,f]:[f*-1,0];return vT([l,c],d)(e)}function ww(e,t,r="ltr"){const n=Mf(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,l=r==="ltr"?[0,i]:[i*-1,0],c=im(e,l);return vT([0,i],[0,a])(c)}function vT(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function yT(e,t){return e>0&&e<t}var eU=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function If(e,t){const r=jt(e),n=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),y.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function na(e,t){const r=jt(t);rr(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var wT=lT,tU=uT,rU=mT;const xT=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(wT,{ref:n,className:we("relative overflow-hidden",e),...r,children:[u.jsx(tU,{className:"h-full w-full rounded-[inherit]",children:t}),u.jsx(_T,{}),u.jsx(rU,{})]}));xT.displayName=wT.displayName;const _T=y.forwardRef(({className:e,orientation:t="vertical",...r},n)=>u.jsx(Lv,{ref:n,orientation:t,className:we("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),...r,children:u.jsx(pT,{className:"relative flex-1 rounded-full bg-border"})}));_T.displayName=Lv.displayName;const nU=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await Dt().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},sU=()=>{const e=Ss(),[t,r]=y.useState(),[n]=MP(),s=n.get("domain");return y.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await nU(i);r(a.items)})()},[s]),u.jsxs(xT,{className:"h-[80vh] overflow-hidden",children:[u.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-48",children:"域名"}),u.jsx("div",{className:"w-24",children:"状态"}),u.jsx("div",{className:"w-56",children:"阶段"}),u.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),u.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:o.phase==="deploy"&&o.phaseSuccess?u.jsx(t1,{size:16,className:"text-green-700"}):u.jsx(r1,{size:16,className:"text-red-700"})}),u.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:u.jsx(dk,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),u.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ol(o.deployedAt)}),u.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:u.jsxs(lS,{children:[u.jsx(cS,{asChild:!0,children:u.jsx(Pt,{variant:"link",className:"p-0",children:"日志"})}),u.jsxs(Kg,{className:"sm:max-w-5xl",children:[u.jsx(dS,{children:u.jsxs(fS,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),u.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&u.jsx(u.Fragment,{children:o.log.check.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),o.log.apply&&u.jsx(u.Fragment,{children:o.log.apply.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),o.log.deploy&&u.jsx(u.Fragment,{children:o.log.deploy.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))})]})]})]})})]},o.id)})]}):u.jsx(u.Fragment,{children:u.jsxs(sT,{className:"max-w-[40em] mx-auto mt-20",children:[u.jsx(oT,{children:"暂无数据"}),u.jsxs(iT,{children:[u.jsxs("div",{className:"flex items-center mt-5",children:[u.jsx("div",{children:u.jsx(BP,{className:"text-yellow-400",size:36})}),u.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),u.jsx("div",{className:"mt-2 flex justify-end",children:u.jsx(Pt,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},hm=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",oU=Fe.object({username:Fe.string().email({message:"请输入正确的邮箱地址"}),password:Fe.string().min(10,{message:"密码至少10个字符"})}),iU=()=>{const e=Qo({resolver:Jo(oU),defaultValues:{username:"",password:""}}),t=async n=>{try{await Dt().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=hm(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Ss();return u.jsxs("div",{className:"max-w-[35em] border mx-auto mt-32 p-10 rounded-md shadow-md",children:[u.jsx("div",{className:"flex justify-center mb-10",children:u.jsx("img",{src:"/vite.svg",className:"w-16"})}),u.jsx(ei,{...e,children:u.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8",children:[u.jsx(tt,{control:e.control,name:"username",render:({field:n})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"用户名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"email",...n})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:e.control,name:"password",render:({field:n})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"shadcn",...n,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"登录"})})]})})]})},aU=()=>Dt().authStore.isValid&&Dt().authStore.isAdmin?u.jsx(X_,{to:"/"}):u.jsx("div",{className:"container",children:u.jsx(hg,{})}),lU=Fe.object({oldPassword:Fe.string().min(10,{message:"密码至少10个字符"}),newPassword:Fe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:Fe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),cU=()=>{const{toast:e}=bf(),t=Ss(),r=Qo({resolver:Jo(lU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await Dt().admins.authWithPassword((o=Dt().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const l=hm(a);r.setError("oldPassword",{message:l})}try{await Dt().admins.update((i=Dt().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),Dt().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const l=hm(a);e({title:"修改密码失败",description:l,variant:"destructive"})}};return u.jsx(u.Fragment,{children:u.jsx(ei,{...r,children:u.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8",children:[u.jsx(tt,{control:r.control,name:"oldPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"当前密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"当前密码",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:r.control,name:"newPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"新密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"newPassword",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:r.control,name:"confirmPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"确认密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"confirmPassword",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"确认修改"})})]})})})},uU=()=>u.jsxs("div",{children:[u.jsx(kv,{}),u.jsx("div",{className:"text-muted-foreground border-b py-5",children:"设置密码"}),u.jsx("div",{className:"w-full sm:w-[35em] mt-10 flex flex-col p-3 mx-auto",children:u.jsx(hg,{})})]}),dU=xP([{path:"/",element:u.jsx(q4,{}),children:[{path:"/",element:u.jsx(S5,{})},{path:"/edit",element:u.jsx($6,{})},{path:"/access",element:u.jsx(V6,{})},{path:"/history",element:u.jsx(sU,{})},{path:"/setting",element:u.jsx(uU,{}),children:[{path:"/setting/password",element:u.jsx(cU,{})}]}]},{path:"/login",element:u.jsx(aU,{}),children:[{path:"/login",element:u.jsx(iU,{})}]},{path:"/about",element:u.jsx("div",{children:"About"})}]);Lh.createRoot(document.getElementById("root")).render(u.jsx(Qe.StrictMode,{children:u.jsx(NP,{router:dU})}))});export default fU(); +\0`,ne+=o(z,2),ne+=T.magic,ne+=o(_,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(O.length,2),ne+=o(V.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ne+O+V,dirRecord:d.CENTRAL_FILE_HEADER+o(de,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(x,4)+O+V+q}}var a=r("../utils"),l=r("../stream/GenericWorker"),c=r("../utf8"),f=r("../crc32"),d=r("../signature");function h(p,w,m,x){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=w,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(p){var w=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(w+100*(m-x-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var w=this.streamFiles&&!p.file.dir;if(w){var m=i(p,w,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var w=this.streamFiles&&!p.file.dir,m=i(p,w,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),w)this.push({data:function(x){return d.DATA_DESCRIPTOR+o(x.crc32,4)+o(x.compressedSize,4)+o(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,w=0;w<this.dirRecords.length;w++)this.push({data:this.dirRecords[w],meta:{percent:100}});var m=this.bytesWritten-p,x=function(g,v,_,C,E){var T=a.transformTo("string",E(C));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(g,2)+o(g,2)+o(v,4)+o(_,4)+o(T.length,2)+T}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var w=this;return p.on("data",function(m){w.processChunk(m)}),p.on("end",function(){w.closedSource(w.previous.streamInfo),w._sources.length?w.prepareNextSource():w.end()}),p.on("error",function(m){w.error(m)}),this},h.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var w=this._sources;if(!l.prototype.error.call(this,p))return!1;for(var m=0;m<w.length;m++)try{w[m].error(p)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var p=this._sources,w=0;w<p.length;w++)p[w].lock()},n.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var o=r("../compressions"),i=r("./ZipFileWorker");s.generateWorker=function(a,l,c){var f=new i(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(h,p){d++;var w=function(v,_){var C=v||_,E=o[C];if(!E)throw new Error(C+" is not a valid compression method !");return E}(p.options.compression,l.compression),m=p.options.compressionOptions||l.compressionOptions||{},x=p.dir,g=p.date;p._compressWorker(w,m).withStreamInfo("file",{name:h,dir:x,date:g,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(f)}),f.entriesCount=d}catch(h){f.error(h)}return f}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function o(){if(!(this instanceof o))return new o;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new o;for(var a in this)typeof this[a]!="function"&&(i[a]=this[a]);return i}}(o.prototype=r("./object")).loadAsync=r("./load"),o.support=r("./support"),o.defaults=r("./defaults"),o.version="3.10.1",o.loadAsync=function(i,a){return new o().loadAsync(i,a)},o.external=r("./external"),n.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var o=r("./utils"),i=r("./external"),a=r("./utf8"),l=r("./zipEntries"),c=r("./stream/Crc32Probe"),f=r("./nodejsUtils");function d(h){return new i.Promise(function(p,w){var m=h.decompressed.getContentWorker().pipe(new c);m.on("error",function(x){w(x)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?w(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(h,p){var w=this;return p=o.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),f.isNode&&f.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new l(p);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],g=m.files;if(p.checkCRC32)for(var v=0;v<g.length;v++)x.push(d(g[v]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),g=x.files,v=0;v<g.length;v++){var _=g[v],C=_.fileNameStr,E=o.resolve(_.fileNameStr);w.file(E,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:p.createFolders}),_.dir||(w.file(E).unsafeOriginalName=C)}return x.zipComment.length&&(w.comment=x.zipComment),w})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var o=r("../utils"),i=r("../stream/GenericWorker");function a(l,c){i.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}o.inherits(a,i),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(f){c.push({data:f,meta:{percent:0}})}).on("error",function(f){c.isPaused?this.generatedError=f:c.error(f)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var o=r("readable-stream").Readable;function i(a,l,c){o.call(this,l),this._helper=a;var f=this;a.on("data",function(d,h){f.push(d)||f._helper.pause(),c&&c(h)}).on("error",function(d){f.emit("error",d)}).on("end",function(){f.push(null)})}r("../utils").inherits(i,o),i.prototype._read=function(){this._helper.resume()},n.exports=i},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,i);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,i)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var i=new Buffer(o);return i.fill(0),i},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(r,n,s){function o(E,T,P){var O,j=a.getTypeOf(T),L=a.extend(P||{},f);L.date=L.date||new Date,L.compression!==null&&(L.compression=L.compression.toUpperCase()),typeof L.unixPermissions=="string"&&(L.unixPermissions=parseInt(L.unixPermissions,8)),L.unixPermissions&&16384&L.unixPermissions&&(L.dir=!0),L.dosPermissions&&16&L.dosPermissions&&(L.dir=!0),L.dir&&(E=g(E)),L.createFolders&&(O=x(E))&&v.call(this,O,!0);var q=j==="string"&&L.binary===!1&&L.base64===!1;P&&P.binary!==void 0||(L.binary=!q),(T instanceof d&&T.uncompressedSize===0||L.dir||!T||T.length===0)&&(L.base64=!1,L.binary=!0,T="",L.compression="STORE",j="string");var R=null;R=T instanceof d||T instanceof l?T:w.isNode&&w.isStream(T)?new m(E,T):a.prepareContent(E,T,L.binary,L.optimizedBinaryString,L.base64);var F=new h(E,R,L);this.files[E]=F}var i=r("./utf8"),a=r("./utils"),l=r("./stream/GenericWorker"),c=r("./stream/StreamHelper"),f=r("./defaults"),d=r("./compressedObject"),h=r("./zipObject"),p=r("./generate"),w=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),x=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var T=E.lastIndexOf("/");return 0<T?E.substring(0,T):""},g=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,T){return T=T!==void 0?T:f.createFolders,E=g(E),this.files[E]||o.call(this,E,null,{dir:!0,createFolders:T}),this.files[E]};function _(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var T,P,O;for(T in this.files)O=this.files[T],(P=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&E(P,O)},filter:function(E){var T=[];return this.forEach(function(P,O){E(P,O)&&T.push(O)}),T},file:function(E,T,P){if(arguments.length!==1)return E=this.root+E,o.call(this,E,T,P),this;if(_(E)){var O=E;return this.filter(function(L,q){return!q.dir&&O.test(L)})}var j=this.files[this.root+E];return j&&!j.dir?j:null},folder:function(E){if(!E)return this;if(_(E))return this.filter(function(j,L){return L.dir&&E.test(j)});var T=this.root+E,P=v.call(this,T),O=this.clone();return O.root=P.name,O},remove:function(E){E=this.root+E;var T=this.files[E];if(T||(E.slice(-1)!=="/"&&(E+="/"),T=this.files[E]),T&&!T.dir)delete this.files[E];else for(var P=this.filter(function(j,L){return L.name.slice(0,E.length)===E}),O=0;O<P.length;O++)delete this.files[P[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var T,P={};try{if((P=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");a.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var O=P.comment||this.comment||"";T=p.generateWorker(this,P,O)}catch(j){(T=new l("error")).error(j)}return new c(T,P.type||"string",P.mimeType)},generateAsync:function(E,T){return this.generateInternalStream(E).accumulate(T)},generateNodeStream:function(E,T){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(T)}};n.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),f=a.charCodeAt(2),d=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===c&&this.data[h+2]===f&&this.data[h+3]===d)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),f=a.charCodeAt(2),d=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&c===h[1]&&f===h[2]&&d===h[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var o=r("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},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))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../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 l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),l=r("./StringReader"),c=r("./NodeBufferReader"),f=r("./Uint8ArrayReader");n.exports=function(d){var h=o.getTypeOf(d);return o.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new c(d):i.uint8array?new f(o.transformTo("uint8array",d)):new a(o.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,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(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(l){o.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,o),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(a,i),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}i.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(l){i.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(f){c.dataIsReady=!0,c.data=f,c.max=f&&f.length||0,c.type=o.getTypeOf(f),c.isPaused||c._tickAndRepeat()},function(f){c.error(f)})}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 l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,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 l=0;l<this._listeners[i].length;l++)this._listeners[i][l].call(this,a)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var a=this;return i.on("data",function(l){a.processChunk(l)}),i.on("end",function(){a.end()}),i.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,a){return this.extraStreamInfo[i]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),l=r("../base64"),c=r("../support"),f=r("../external"),d=null;if(c.nodestream)try{d=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(w,m){return new f.Promise(function(x,g){var v=[],_=w._internalType,C=w._outputType,E=w._mimeType;w.on("data",function(T,P){v.push(T),m&&m(P)}).on("error",function(T){v=[],g(T)}).on("end",function(){try{var T=function(P,O,j){switch(P){case"blob":return o.newBlob(o.transformTo("arraybuffer",O),j);case"base64":return l.encode(O);default:return o.transformTo(P,O)}}(C,function(P,O){var j,L=0,q=null,R=0;for(j=0;j<O.length;j++)R+=O[j].length;switch(P){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(q=new Uint8Array(R),j=0;j<O.length;j++)q.set(O[j],L),L+=O[j].length;return q;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+P+"'")}}(_,v),E);x(T)}catch(P){g(P)}v=[]}).resume()})}function p(w,m,x){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=x,o.checkSupport(g),this._worker=w.pipe(new i(g)),w.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}p.prototype={accumulate:function(w){return h(this,w)},on:function(w,m){var x=this;return w==="data"?this._worker.on(w,function(g){m.call(x,g.data,g.meta)}):this._worker.on(w,function(){o.delay(m,arguments,x)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(w){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},w)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"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=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),l=r("./stream/GenericWorker"),c=new Array(256),f=0;f<256;f++)c[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}s.utf8encode=function(p){return i.nodebuffer?a.newBufferFrom(p,"utf-8"):function(w){var m,x,g,v,_,C=w.length,E=0;for(v=0;v<C;v++)(64512&(x=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(g=w.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),v++),E+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(E):new Array(E),v=_=0;_<E;v++)(64512&(x=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(g=w.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),v++),x<128?m[_++]=x:(x<2048?m[_++]=192|x>>>6:(x<65536?m[_++]=224|x>>>12:(m[_++]=240|x>>>18,m[_++]=128|x>>>12&63),m[_++]=128|x>>>6&63),m[_++]=128|63&x);return m}(p)},s.utf8decode=function(p){return i.nodebuffer?o.transformTo("nodebuffer",p).toString("utf-8"):function(w){var m,x,g,v,_=w.length,C=new Array(2*_);for(m=x=0;m<_;)if((g=w[m++])<128)C[x++]=g;else if(4<(v=c[g]))C[x++]=65533,m+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&m<_;)g=g<<6|63&w[m++],v--;1<v?C[x++]=65533:g<65536?C[x++]=g:(g-=65536,C[x++]=55296|g>>10&1023,C[x++]=56320|1023&g)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),o.applyFromCharCode(C)}(p=o.transformTo(i.uint8array?"uint8array":"array",p))},o.inherits(d,l),d.prototype.processChunk=function(p){var w=o.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=w;(w=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),w.set(m,this.leftOver.length)}else w=this.leftOver.concat(w);this.leftOver=null}var x=function(v,_){var C;for((_=_||v.length)>v.length&&(_=v.length),C=_-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?_:C+c[v[C]]>_?C:_}(w),g=w;x!==w.length&&(i.uint8array?(g=w.subarray(0,x),this.leftOver=w.subarray(x,w.length)):(g=w.slice(0,x),this.leftOver=w.slice(x,w.length))),this.push({data:s.utf8decode(g),meta:p.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,o.inherits(h,l),h.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),l=r("./external");function c(m){return m}function f(m,x){for(var g=0;g<m.length;++g)x[g]=255&m.charCodeAt(g);return x}r("setimmediate"),s.newBlob=function(m,x){s.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,x,g){var v=[],_=0,C=m.length;if(C<=g)return String.fromCharCode.apply(null,m);for(;_<C;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(_,Math.min(_+g,C)))):v.push(String.fromCharCode.apply(null,m.subarray(_,Math.min(_+g,C)))),_+=g;return v.join("")},stringifyByChar:function(m){for(var x="",g=0;g<m.length;g++)x+=String.fromCharCode(m[g]);return x},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function h(m){var x=65536,g=s.getTypeOf(m),v=!0;if(g==="uint8array"?v=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(v=d.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return d.stringifyByChunk(m,g,x)}catch{x=Math.floor(x/2)}return d.stringifyByChar(m)}function p(m,x){for(var g=0;g<m.length;g++)x[g]=m[g];return x}s.applyFromCharCode=h;var w={};w.string={string:c,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return w.string.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:function(m){return f(m,a.allocBuffer(m.length))}},w.array={string:h,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},w.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},w.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},w.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return w.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,x){if(x=x||"",!m)return x;s.checkSupport(m);var g=s.getTypeOf(x);return w[g][m](x)},s.resolve=function(m){for(var x=m.split("/"),g=[],v=0;v<x.length;v++){var _=x[v];_==="."||_===""&&v!==0&&v!==x.length-1||(_===".."?g.pop():g.push(_))}return g.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":o.nodebuffer&&a.isBuffer(m)?"nodebuffer":o.uint8array&&m instanceof Uint8Array?"uint8array":o.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!o[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var x,g,v="";for(g=0;g<(m||"").length;g++)v+="\\x"+((x=m.charCodeAt(g))<16?"0":"")+x.toString(16).toUpperCase();return v},s.delay=function(m,x,g){setImmediate(function(){m.apply(g||null,x||[])})},s.inherits=function(m,x){function g(){}g.prototype=x.prototype,m.prototype=new g},s.extend=function(){var m,x,g={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&g[x]===void 0&&(g[x]=arguments[m][x]);return g},s.prepareContent=function(m,x,g,v,_){return l.Promise.resolve(x).then(function(C){return o.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(E,T){var P=new FileReader;P.onload=function(O){E(O.target.result)},P.onerror=function(O){T(O.target.error)},P.readAsArrayBuffer(C)}):C}).then(function(C){var E=s.getTypeOf(C);return E?(E==="arraybuffer"?C=s.transformTo("uint8array",C):E==="string"&&(_?C=i.decode(C):g&&v!==!0&&(C=function(T){return f(T,o.uint8array?new Uint8Array(T.length):new Array(T.length))}(C))),C):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var o=r("./reader/readerFor"),i=r("./utils"),a=r("./signature"),l=r("./zipEntry"),c=r("./support");function f(d){this.files=[],this.loadOptions=d}f.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(d)+")")}},isSignature:function(d,h){var p=this.reader.index;this.reader.setIndex(d);var w=this.reader.readString(4)===h;return this.reader.setIndex(p),w},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),h=c.uint8array?"uint8array":"array",p=i.transformTo(h,d);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,h,p,w=this.zip64EndOfCentralSize-44;0<w;)d=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[d]={id:d,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,h;for(d=0;d<this.files.length;d++)h=this.files[d],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var h=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var w=h-p;if(0<w)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=w);else if(w<0)throw new Error("Corrupted zip: missing "+Math.abs(w)+" bytes.")},prepareReader:function(d){this.reader=o(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var o=r("./reader/readerFor"),i=r("./utils"),a=r("./compressedObject"),l=r("./crc32"),c=r("./utf8"),f=r("./compressions"),d=r("./support");function h(p,w){this.options=p,this.loadOptions=w}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var w,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((w=function(x){for(var g in f)if(Object.prototype.hasOwnProperty.call(f,g)&&f[g].magic===x)return f[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,w,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var w=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(w),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var w,m,x,g=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<g;)w=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[w]={id:w,length:m,value:x};p.setIndex(g)},handleUTF8:function(){var p=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var w=this.findExtraFieldUnicodePath();if(w!==null)this.fileNameStr=w;else{var m=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var g=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var w=o(p.value);return w.readInt(1)!==1||l(this.fileName)!==w.readInt(4)?null:c.utf8decode(w.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var w=o(p.value);return w.readInt(1)!==1||l(this.fileComment)!==w.readInt(4)?null:c.utf8decode(w.readData(p.length-5))}return null}},n.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function o(w,m,x){this.name=w,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=r("./stream/StreamHelper"),a=r("./stream/DataWorker"),l=r("./utf8"),c=r("./compressedObject"),f=r("./stream/GenericWorker");o.prototype={internalStream:function(w){var m=null,x="string";try{if(!w)throw new Error("No output type specified.");var g=(x=w.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!v&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(_){(m=new f("error")).error(_)}return new i(m,x,"")},async:function(w,m){return this.internalStream(w).accumulate(m)},nodeStream:function(w,m){return this.internalStream(w||"nodebuffer").toNodejsStream(m)},_compressWorker:function(w,m){if(this._data instanceof c&&this._data.compression.magic===w.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(x,w,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof f?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<d.length;p++)o.prototype[d[p]]=h;n.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(o){var i,a,l=o.MutationObserver||o.WebKitMutationObserver;if(l){var c=0,f=new l(w),d=o.document.createTextNode("");f.observe(d,{characterData:!0}),i=function(){d.data=c=++c%2}}else if(o.setImmediate||o.MessageChannel===void 0)i="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var m=o.document.createElement("script");m.onreadystatechange=function(){w(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},o.document.documentElement.appendChild(m)}:function(){setTimeout(w,0)};else{var h=new o.MessageChannel;h.port1.onmessage=w,i=function(){h.port2.postMessage(0)}}var p=[];function w(){var m,x;a=!0;for(var g=p.length;g;){for(x=p,p=[],m=-1;++m<g;)x[m]();g=p.length}a=!1}n.exports=function(m){p.push(m)!==1||a||i()}}).call(this,typeof kc<"u"?kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var o=r("immediate");function i(){}var a={},l=["REJECTED"],c=["FULFILLED"],f=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,g!==i&&m(this,g)}function h(g,v,_){this.promise=g,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function p(g,v,_){o(function(){var C;try{C=v(_)}catch(E){return a.reject(g,E)}C===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,C)})}function w(g){var v=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof v=="function")return function(){v.apply(g,arguments)}}function m(g,v){var _=!1;function C(P){_||(_=!0,a.reject(g,P))}function E(P){_||(_=!0,a.resolve(g,P))}var T=x(function(){v(E,C)});T.status==="error"&&C(T.value)}function x(g,v){var _={};try{_.value=g(v),_.status="success"}catch(C){_.status="error",_.value=C}return _}(n.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var v=this.constructor;return this.then(function(_){return v.resolve(g()).then(function(){return _})},function(_){return v.resolve(g()).then(function(){throw _})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,v){if(typeof g!="function"&&this.state===c||typeof v!="function"&&this.state===l)return this;var _=new this.constructor(i);return this.state!==f?p(_,this.state===c?g:v,this.outcome):this.queue.push(new h(_,g,v)),_},h.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},h.prototype.otherCallFulfilled=function(g){p(this.promise,this.onFulfilled,g)},h.prototype.callRejected=function(g){a.reject(this.promise,g)},h.prototype.otherCallRejected=function(g){p(this.promise,this.onRejected,g)},a.resolve=function(g,v){var _=x(w,v);if(_.status==="error")return a.reject(g,_.value);var C=_.value;if(C)m(g,C);else{g.state=c,g.outcome=v;for(var E=-1,T=g.queue.length;++E<T;)g.queue[E].callFulfilled(v)}return g},a.reject=function(g,v){g.state=l,g.outcome=v;for(var _=-1,C=g.queue.length;++_<C;)g.queue[_].callRejected(v);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(i),g)},d.reject=function(g){var v=new this(i);return a.reject(v,g)},d.all=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,C=!1;if(!_)return this.resolve([]);for(var E=new Array(_),T=0,P=-1,O=new this(i);++P<_;)j(g[P],P);return O;function j(L,q){v.resolve(L).then(function(R){E[q]=R,++T!==_||C||(C=!0,a.resolve(O,E))},function(R){C||(C=!0,a.reject(O,R))})}},d.race=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=g.length,C=!1;if(!_)return this.resolve([]);for(var E=-1,T=new this(i);++E<_;)P=g[E],v.resolve(P).then(function(O){C||(C=!0,a.resolve(T,O))},function(O){C||(C=!0,a.reject(T,O))});var P;return T}},{immediate:36}],38:[function(r,n,s){var o={};(0,r("./lib/utils/common").assign)(o,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var o=r("./zlib/deflate"),i=r("./utils/common"),a=r("./utils/strings"),l=r("./zlib/messages"),c=r("./zlib/zstream"),f=Object.prototype.toString,d=0,h=-1,p=0,w=8;function m(g){if(!(this instanceof m))return new m(g);this.options=i.assign({level:h,method:w,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},g||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var _=o.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(_!==d)throw new Error(l[_]);if(v.header&&o.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?a.string2buf(v.dictionary):f.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(_=o.deflateSetDictionary(this.strm,C))!==d)throw new Error(l[_]);this._dict_set=!0}}function x(g,v){var _=new m(v);if(_.push(g,!0),_.err)throw _.msg||l[_.err];return _.result}m.prototype.push=function(g,v){var _,C,E=this.strm,T=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof g=="string"?E.input=a.string2buf(g):f.call(g)==="[object ArrayBuffer]"?E.input=new Uint8Array(g):E.input=g,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(T),E.next_out=0,E.avail_out=T),(_=o.deflate(E,C))!==1&&_!==d)return this.onEnd(_),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(i.shrinkBuf(E.output,E.next_out))):this.onData(i.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&_!==1);return C===4?(_=o.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===d):C!==2||(this.onEnd(d),!(E.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=m,s.deflate=x,s.deflateRaw=function(g,v){return(v=v||{}).raw=!0,x(g,v)},s.gzip=function(g,v){return(v=v||{}).gzip=!0,x(g,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var o=r("./zlib/inflate"),i=r("./utils/common"),a=r("./utils/strings"),l=r("./zlib/constants"),c=r("./zlib/messages"),f=r("./zlib/zstream"),d=r("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var g=o.inflateInit2(this.strm,x.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,o.inflateGetHeader(this.strm,this.header)}function w(m,x){var g=new p(x);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}p.prototype.push=function(m,x){var g,v,_,C,E,T,P=this.strm,O=this.options.chunkSize,j=this.options.dictionary,L=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?P.input=a.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?P.input=new Uint8Array(m):P.input=m,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new i.Buf8(O),P.next_out=0,P.avail_out=O),(g=o.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&j&&(T=typeof j=="string"?a.string2buf(j):h.call(j)==="[object ArrayBuffer]"?new Uint8Array(j):j,g=o.inflateSetDictionary(this.strm,T)),g===l.Z_BUF_ERROR&&L===!0&&(g=l.Z_OK,L=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&g!==l.Z_STREAM_END&&(P.avail_in!==0||v!==l.Z_FINISH&&v!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=a.utf8border(P.output,P.next_out),C=P.next_out-_,E=a.buf2string(P.output,_),P.next_out=C,P.avail_out=O-C,C&&i.arraySet(P.output,P.output,_,C,0),this.onData(E)):this.onData(i.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(L=!0)}while((0<P.avail_in||P.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(v=l.Z_FINISH),v===l.Z_FINISH?(g=o.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):v!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=w,s.inflateRaw=function(m,x){return(x=x||{}).raw=!0,w(m,x)},s.ungzip=w},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var f=c.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var d in f)f.hasOwnProperty(d)&&(l[d]=f[d])}}return l},s.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var i={arraySet:function(l,c,f,d,h){if(c.subarray&&l.subarray)l.set(c.subarray(f,f+d),h);else for(var p=0;p<d;p++)l[h+p]=c[f+p]},flattenChunks:function(l){var c,f,d,h,p,w;for(c=d=0,f=l.length;c<f;c++)d+=l[c].length;for(w=new Uint8Array(d),c=h=0,f=l.length;c<f;c++)p=l[c],w.set(p,h),h+=p.length;return w}},a={arraySet:function(l,c,f,d,h){for(var p=0;p<d;p++)l[h+p]=c[f+p]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,i)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(o)},{}],42:[function(r,n,s){var o=r("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new o.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function f(d,h){if(h<65537&&(d.subarray&&a||!d.subarray&&i))return String.fromCharCode.apply(null,o.shrinkBuf(d,h));for(var p="",w=0;w<h;w++)p+=String.fromCharCode(d[w]);return p}l[254]=l[254]=1,s.string2buf=function(d){var h,p,w,m,x,g=d.length,v=0;for(m=0;m<g;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(w=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(w-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new o.Buf8(v),m=x=0;x<v;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(w=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(w-56320),m++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},s.buf2binstring=function(d){return f(d,d.length)},s.binstring2buf=function(d){for(var h=new o.Buf8(d.length),p=0,w=h.length;p<w;p++)h[p]=d.charCodeAt(p);return h},s.buf2string=function(d,h){var p,w,m,x,g=h||d.length,v=new Array(2*g);for(p=w=0;p<g;)if((m=d[p++])<128)v[w++]=m;else if(4<(x=l[m]))v[w++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<g;)m=m<<6|63&d[p++],x--;1<x?v[w++]=65533:m<65536?v[w++]=m:(m-=65536,v[w++]=55296|m>>10&1023,v[w++]=56320|1023&m)}return f(v,w)},s.utf8border=function(d,h){var p;for((h=h||d.length)>d.length&&(h=d.length),p=h-1;0<=p&&(192&d[p])==128;)p--;return p<0||p===0?h:p+l[d[p]]>h?p:h}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,l){for(var c=65535&o|0,f=o>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;f=f+(c=c+i[l++]|0)|0,--d;);c%=65521,f%=65521}return c|f<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var o=function(){for(var i,a=[],l=0;l<256;l++){i=l;for(var c=0;c<8;c++)i=1&i?3988292384^i>>>1:i>>>1;a[l]=i}return a}();n.exports=function(i,a,l,c){var f=o,d=c+l;i^=-1;for(var h=c;h<d;h++)i=i>>>8^f[255&(i^a[h])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),l=r("./adler32"),c=r("./crc32"),f=r("./messages"),d=0,h=4,p=0,w=-2,m=-1,x=4,g=2,v=8,_=9,C=286,E=30,T=19,P=2*C+1,O=15,j=3,L=258,q=L+j+1,R=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=f[J],J}function I(k){return(k<<1)-(4<k?9:0)}function Q(k){for(var J=k.length;0<=--J;)k[J]=0}function z(k){var J=k.state,G=J.pending;G>k.avail_out&&(G=k.avail_out),G!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,G,k.next_out),k.next_out+=G,J.pending_out+=G,k.total_out+=G,k.avail_out-=G,J.pending-=G,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function de(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var G,D,S=k.max_chain_length,N=k.strstart,A=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,he=k.strstart+L,Le=H[N+A-1],Oe=H[N+A];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(G=J)+A]===Oe&&H[G+A-1]===Le&&H[G]===H[N]&&H[++G]===H[N+1]){N+=2,G++;do;while(H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&H[++N]===H[++G]&&N<he);if(D=L-(he-N),N=he-L,A<D){if(k.match_start=J,Y<=(A=D))break;Le=H[N+A-1],Oe=H[N+A]}}while((J=ee[J&X])>M&&--S!=0);return A<=k.lookahead?A:k.lookahead}function Ee(k){var J,G,D,S,N,A,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=G=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--G;);for(J=G=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--G;);S+=ee}if(k.strm.avail_in===0)break;if(A=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=A.avail_in,H<X&&(X=H),G=X===0?0:(A.avail_in-=X,i.arraySet(Y,A.input,A.next_in,X,M),A.state.wrap===1?A.adler=l(A.adler,Y,X,M):A.state.wrap===2&&(A.adler=c(A.adler,Y,X,M)),A.next_in+=X,A.total_in+=X,X),k.lookahead+=G,k.lookahead+k.insert>=j)for(N=k.strstart-k.insert,k.ins_h=k.window[N],k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+1])&k.hash_mask;k.insert&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+j-1])&k.hash_mask,k.prev[N&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=N,N++,k.insert--,!(k.lookahead+k.insert<j)););}while(k.lookahead<q&&k.strm.avail_in!==0)}function fe(k,J){for(var G,D;;){if(k.lookahead<q){if(Ee(k),k.lookahead<q&&J===d)return b;if(k.lookahead===0)break}if(G=0,k.lookahead>=j&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),G!==0&&k.strstart-G<=k.w_size-q&&(k.match_length=se(k,G)),k.match_length>=j)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-j),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=j){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart,--k.match_length!=0;);k.strstart++}else k.strstart+=k.match_length,k.match_length=0,k.ins_h=k.window[k.strstart],k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+1])&k.hash_mask;else D=a._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++;if(D&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=k.strstart<j-1?k.strstart:j-1,J===h?($(k,!0),k.strm.avail_out===0?te:W):k.last_lit&&($(k,!1),k.strm.avail_out===0)?b:V}function ge(k,J){for(var G,D,S;;){if(k.lookahead<q){if(Ee(k),k.lookahead<q&&J===d)return b;if(k.lookahead===0)break}if(G=0,k.lookahead>=j&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),k.prev_length=k.match_length,k.prev_match=k.match_start,k.match_length=j-1,G!==0&&k.prev_length<k.max_lazy_match&&k.strstart-G<=k.w_size-q&&(k.match_length=se(k,G),k.match_length<=5&&(k.strategy===1||k.match_length===j&&4096<k.strstart-k.match_start)&&(k.match_length=j-1)),k.prev_length>=j&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-j,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-j),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+j-1])&k.hash_mask,G=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),--k.prev_length!=0;);if(k.match_available=0,k.match_length=j-1,k.strstart++,D&&($(k,!1),k.strm.avail_out===0))return b}else if(k.match_available){if((D=a._tr_tally(k,0,k.window[k.strstart-1]))&&$(k,!1),k.strstart++,k.lookahead--,k.strm.avail_out===0)return b}else k.match_available=1,k.strstart++,k.lookahead--}return k.match_available&&(D=a._tr_tally(k,0,k.window[k.strstart-1]),k.match_available=0),k.insert=k.strstart<j-1?k.strstart:j-1,J===h?($(k,!0),k.strm.avail_out===0?te:W):k.last_lit&&($(k,!1),k.strm.avail_out===0)?b:V}function be(k,J,G,D,S){this.good_length=k,this.max_lazy=J,this.nice_length=G,this.max_chain=D,this.func=S}function Pe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*P),this.dyn_dtree=new i.Buf16(2*(2*E+1)),this.bl_tree=new i.Buf16(2*(2*T+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(O+1),this.heap=new i.Buf16(2*C+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Te(k){var J;return k&&k.state?(k.total_in=k.total_out=0,k.data_type=g,(J=k.state).pending=0,J.pending_out=0,J.wrap<0&&(J.wrap=-J.wrap),J.status=J.wrap?R:F,k.adler=J.wrap===2?0:1,J.last_flush=d,a._tr_init(J),p):Z(k,w)}function Se(k){var J=Te(k);return J===p&&function(G){G.window_size=2*G.w_size,Q(G.head),G.max_lazy_match=o[G.level].max_lazy,G.good_match=o[G.level].good_length,G.nice_match=o[G.level].nice_length,G.max_chain_length=o[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=j-1,G.match_available=0,G.ins_h=0}(k.state),J}function et(k,J,G,D,S,N){if(!k)return w;var A=1;if(J===m&&(J=6),D<0?(A=0,D=-D):15<D&&(A=2,D-=16),S<1||_<S||G!==v||D<8||15<D||J<0||9<J||N<0||x<N)return Z(k,w);D===8&&(D=9);var Y=new Pe;return(k.state=Y).strm=k,Y.wrap=A,Y.gzhead=null,Y.w_bits=D,Y.w_size=1<<Y.w_bits,Y.w_mask=Y.w_size-1,Y.hash_bits=S+7,Y.hash_size=1<<Y.hash_bits,Y.hash_mask=Y.hash_size-1,Y.hash_shift=~~((Y.hash_bits+j-1)/j),Y.window=new i.Buf8(2*Y.w_size),Y.head=new i.Buf16(Y.hash_size),Y.prev=new i.Buf16(Y.w_size),Y.lit_bufsize=1<<S+6,Y.pending_buf_size=4*Y.lit_bufsize,Y.pending_buf=new i.Buf8(Y.pending_buf_size),Y.d_buf=1*Y.lit_bufsize,Y.l_buf=3*Y.lit_bufsize,Y.level=J,Y.strategy=N,Y.method=G,Se(k)}o=[new be(0,0,0,0,function(k,J){var G=65535;for(G>k.pending_buf_size-5&&(G=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Ee(k),k.lookahead===0&&J===d)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+G;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===h?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new be(4,4,8,4,fe),new be(4,5,16,8,fe),new be(4,6,32,32,fe),new be(4,4,16,16,ge),new be(8,16,32,32,ge),new be(8,16,128,128,ge),new be(8,32,128,256,ge),new be(32,128,258,1024,ge),new be(32,258,258,4096,ge)],s.deflateInit=function(k,J){return et(k,J,v,15,8,0)},s.deflateInit2=et,s.deflateReset=Se,s.deflateResetKeep=Te,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?w:(k.state.gzhead=J,p):w},s.deflate=function(k,J){var G,D,S,N;if(!k||!k.state||5<J||J<0)return k?Z(k,w):w;if(D=k.state,!k.output||!k.input&&k.avail_in!==0||D.status===666&&J!==h)return Z(k,k.avail_out===0?-5:w);if(D.strm=k,G=D.last_flush,D.last_flush=J,D.status===R)if(D.wrap===2)k.adler=0,de(D,31),de(D,139),de(D,8),D.gzhead?(de(D,(D.gzhead.text?1:0)+(D.gzhead.hcrc?2:0)+(D.gzhead.extra?4:0)+(D.gzhead.name?8:0)+(D.gzhead.comment?16:0)),de(D,255&D.gzhead.time),de(D,D.gzhead.time>>8&255),de(D,D.gzhead.time>>16&255),de(D,D.gzhead.time>>24&255),de(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),de(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(de(D,255&D.gzhead.extra.length),de(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=c(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(de(D,0),de(D,0),de(D,0),de(D,0),de(D,0),de(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),de(D,3),D.status=F);else{var A=v+(D.w_bits-8<<4)<<8;A|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(A|=32),A+=31-A%31,D.status=F,ne(D,A),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)de(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){N=1;break}N=D.gzindex<D.gzhead.name.length?255&D.gzhead.name.charCodeAt(D.gzindex++):0,de(D,N)}while(N!==0);D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),N===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){N=1;break}N=D.gzindex<D.gzhead.comment.length?255&D.gzhead.comment.charCodeAt(D.gzindex++):0,de(D,N)}while(N!==0);D.gzhead.hcrc&&D.pending>S&&(k.adler=c(k.adler,D.pending_buf,D.pending-S,S)),N===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(de(D,255&k.adler),de(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,p}else if(k.avail_in===0&&I(J)<=I(G)&&J!==h)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==d&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Ee(M),M.lookahead===0)){if(H===d)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===h?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,he,Le,Oe=M.window;;){if(M.lookahead<=L){if(Ee(M),M.lookahead<=L&&H===d)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=j&&0<M.strstart&&(ee=Oe[he=M.strstart-1])===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]){Le=M.strstart+L;do;while(ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&ee===Oe[++he]&&he<Le);M.match_length=L-(Le-he),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=j?(X=a._tr_tally(M,1,M.match_length-j),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===h?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),p;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,p}return J!==h?p:D.wrap<=0?1:(D.wrap===2?(de(D,255&k.adler),de(D,k.adler>>8&255),de(D,k.adler>>16&255),de(D,k.adler>>24&255),de(D,255&k.total_in),de(D,k.total_in>>8&255),de(D,k.total_in>>16&255),de(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0<D.wrap&&(D.wrap=-D.wrap),D.pending!==0?p:1)},s.deflateEnd=function(k){var J;return k&&k.state?(J=k.state.status)!==R&&J!==69&&J!==73&&J!==91&&J!==103&&J!==F&&J!==666?Z(k,w):(k.state=null,J===F?Z(k,-3):p):w},s.deflateSetDictionary=function(k,J){var G,D,S,N,A,Y,M,H,X=J.length;if(!k||!k.state||(N=(G=k.state).wrap)===2||N===1&&G.status!==R||G.lookahead)return w;for(N===1&&(k.adler=l(k.adler,J,X,0)),G.wrap=0,X>=G.w_size&&(N===0&&(Q(G.head),G.strstart=0,G.block_start=0,G.insert=0),H=new i.Buf8(G.w_size),i.arraySet(H,J,X-G.w_size,G.w_size,0),J=H,X=G.w_size),A=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Ee(G);G.lookahead>=j;){for(D=G.strstart,S=G.lookahead-(j-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[D+j-1])&G.hash_mask,G.prev[D&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=D,D++,--S;);G.strstart=D,G.lookahead=j-1,Ee(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=j-1,G.match_available=0,k.next_in=Y,k.input=M,k.avail_in=A,G.wrap=N,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(o,i){var a,l,c,f,d,h,p,w,m,x,g,v,_,C,E,T,P,O,j,L,q,R,F,b,V;a=o.state,l=o.next_in,b=o.input,c=l+(o.avail_in-5),f=o.next_out,V=o.output,d=f-(i-o.avail_out),h=f+(o.avail_out-257),p=a.dmax,w=a.wsize,m=a.whave,x=a.wnext,g=a.window,v=a.hold,_=a.bits,C=a.lencode,E=a.distcode,T=(1<<a.lenbits)-1,P=(1<<a.distbits)-1;e:do{_<15&&(v+=b[l++]<<_,_+=8,v+=b[l++]<<_,_+=8),O=C[v&T];t:for(;;){if(v>>>=j=O>>>24,_-=j,(j=O>>>16&255)===0)V[f++]=65535&O;else{if(!(16&j)){if(!(64&j)){O=C[(65535&O)+(v&(1<<j)-1)];continue t}if(32&j){a.mode=12;break e}o.msg="invalid literal/length code",a.mode=30;break e}L=65535&O,(j&=15)&&(_<j&&(v+=b[l++]<<_,_+=8),L+=v&(1<<j)-1,v>>>=j,_-=j),_<15&&(v+=b[l++]<<_,_+=8,v+=b[l++]<<_,_+=8),O=E[v&P];r:for(;;){if(v>>>=j=O>>>24,_-=j,!(16&(j=O>>>16&255))){if(!(64&j)){O=E[(65535&O)+(v&(1<<j)-1)];continue r}o.msg="invalid distance code",a.mode=30;break e}if(q=65535&O,_<(j&=15)&&(v+=b[l++]<<_,(_+=8)<j&&(v+=b[l++]<<_,_+=8)),p<(q+=v&(1<<j)-1)){o.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=j,_-=j,(j=f-d)<q){if(m<(j=q-j)&&a.sane){o.msg="invalid distance too far back",a.mode=30;break e}if(F=g,(R=0)===x){if(R+=w-j,j<L){for(L-=j;V[f++]=g[R++],--j;);R=f-q,F=V}}else if(x<j){if(R+=w+x-j,(j-=x)<L){for(L-=j;V[f++]=g[R++],--j;);if(R=0,x<L){for(L-=j=x;V[f++]=g[R++],--j;);R=f-q,F=V}}}else if(R+=x-j,j<L){for(L-=j;V[f++]=g[R++],--j;);R=f-q,F=V}for(;2<L;)V[f++]=F[R++],V[f++]=F[R++],V[f++]=F[R++],L-=3;L&&(V[f++]=F[R++],1<L&&(V[f++]=F[R++]))}else{for(R=f-q;V[f++]=V[R++],V[f++]=V[R++],V[f++]=V[R++],2<(L-=3););L&&(V[f++]=V[R++],1<L&&(V[f++]=V[R++]))}break}}break}}while(l<c&&f<h);l-=L=_>>3,v&=(1<<(_-=L<<3))-1,o.next_in=l,o.next_out=f,o.avail_in=l<c?c-l+5:5-(l-c),o.avail_out=f<h?h-f+257:257-(f-h),a.hold=v,a.bits=_}},{}],49:[function(r,n,s){var o=r("../utils/common"),i=r("./adler32"),a=r("./crc32"),l=r("./inffast"),c=r("./inftrees"),f=1,d=2,h=0,p=-2,w=1,m=852,x=592;function g(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<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 _(R){var F;return R&&R.state?(F=R.state,R.total_in=R.total_out=F.total=0,R.msg="",F.wrap&&(R.adler=1&F.wrap),F.mode=w,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(m),F.distcode=F.distdyn=new o.Buf32(x),F.sane=1,F.back=-1,h):p}function C(R){var F;return R&&R.state?((F=R.state).wsize=0,F.whave=0,F.wnext=0,_(R)):p}function E(R,F){var b,V;return R&&R.state?(V=R.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?p:(V.window!==null&&V.wbits!==F&&(V.window=null),V.wrap=b,V.wbits=F,C(R))):p}function T(R,F){var b,V;return R?(V=new v,(R.state=V).window=null,(b=E(R,F))!==h&&(R.state=null),b):p}var P,O,j=!0;function L(R){if(j){var F;for(P=new o.Buf32(512),O=new o.Buf32(32),F=0;F<144;)R.lens[F++]=8;for(;F<256;)R.lens[F++]=9;for(;F<280;)R.lens[F++]=7;for(;F<288;)R.lens[F++]=8;for(c(f,R.lens,0,288,P,0,R.work,{bits:9}),F=0;F<32;)R.lens[F++]=5;c(d,R.lens,0,32,O,0,R.work,{bits:5}),j=!1}R.lencode=P,R.lenbits=9,R.distcode=O,R.distbits=5}function q(R,F,b,V){var te,W=R.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new o.Buf8(W.wsize)),V>=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=te))),0}s.inflateReset=C,s.inflateReset2=E,s.inflateResetKeep=_,s.inflateInit=function(R){return T(R,15)},s.inflateInit2=T,s.inflate=function(R,F){var b,V,te,W,Z,I,Q,z,$,de,ne,se,Ee,fe,ge,be,Pe,Te,Se,et,k,J,G,D,S=0,N=new o.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return p;(b=R.state).mode===12&&(b.mode=13),Z=R.next_out,te=R.output,Q=R.avail_out,W=R.next_in,V=R.input,I=R.avail_in,z=b.hold,$=b.bits,de=I,ne=Q,J=h;e:for(;;)switch(b.mode){case w:if(b.wrap===0){b.mode=13;break}for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(2&b.wrap&&z===35615){N[b.check=0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){R.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){R.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){R.msg="invalid window size",b.mode=30;break}b.dmax=1<<k,R.adler=b.check=1,b.mode=512&z?10:12,$=z=0;break;case 2:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(b.flags=z,(255&b.flags)!=8){R.msg="unknown compression method",b.mode=30;break}if(57344&b.flags){R.msg="unknown header flags set",b.mode=30;break}b.head&&(b.head.text=z>>8&1),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,N[2]=z>>>16&255,N[3]=z>>>24&255,b.check=a(b.check,N,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(N[0]=255&z,N[1]=z>>>8&255,b.check=a(b.check,N,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se<I;);if(512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,k)break e}else b.head&&(b.head.name=null);b.length=0,b.mode=8;case 8:if(4096&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.comment+=String.fromCharCode(k)),k&&se<I;);if(512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,k)break e}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(512&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z!==(65535&b.check)){R.msg="header crc mismatch",b.mode=30;break}$=z=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0),R.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}R.adler=b.check=g(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,2;R.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:R.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){R.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I<se&&(se=I),Q<se&&(se=Q),se===0)break e;o.arraySet(te,V,W,se,Z),I-=se,W+=se,Q-=se,Z+=se,b.length-=se;break}b.mode=12;break;case 17:for(;$<14;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(b.nlen=257+(31&z),z>>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286<b.nlen||30<b.ndist){R.msg="too many length or distance symbols",b.mode=30;break}b.have=0,b.mode=18;case 18:for(;b.have<b.ncode;){for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.lens[A[b.have++]]=7&z,z>>>=3,$-=3}for(;b.have<19;)b.lens[A[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,G={bits:b.lenbits},J=c(0,b.lens,0,19,b.lencode,0,b.work,G),b.lenbits=G.bits,J){R.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have<b.nlen+b.ndist;){for(;be=(S=b.lencode[z&(1<<b.lenbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Pe<16)z>>>=ge,$-=ge,b.lens[b.have++]=Pe;else{if(Pe===16){for(D=ge+2;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z>>>=ge,$-=ge,b.have===0){R.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Pe===17){for(D=ge+3;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}$-=ge,k=0,se=3+(7&(z>>>=ge)),z>>>=3,$-=3}else{for(D=ge+7;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}$-=ge,k=0,se=11+(127&(z>>>=ge)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){R.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){R.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,G={bits:b.lenbits},J=c(f,b.lens,0,b.nlen,b.lencode,0,b.work,G),b.lenbits=G.bits,J){R.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,G={bits:b.distbits},J=c(d,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,G),b.distbits=G.bits,J){R.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,l(R,ne),Z=R.next_out,te=R.output,Q=R.avail_out,W=R.next_in,V=R.input,I=R.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;be=(S=b.lencode[z&(1<<b.lenbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(be&&!(240&be)){for(Te=ge,Se=be,et=Pe;be=(S=b.lencode[et+((z&(1<<Te+Se)-1)>>Te)])>>>16&255,Pe=65535&S,!(Te+(ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Te,$-=Te,b.back+=Te}if(z>>>=ge,$-=ge,b.back+=ge,b.length=Pe,be===0){b.mode=26;break}if(32&be){b.back=-1,b.mode=12;break}if(64&be){R.msg="invalid literal/length code",b.mode=30;break}b.extra=15&be,b.mode=22;case 22:if(b.extra){for(D=b.extra;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length+=z&(1<<b.extra)-1,z>>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;be=(S=b.distcode[z&(1<<b.distbits)-1])>>>16&255,Pe=65535&S,!((ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&be)){for(Te=ge,Se=be,et=Pe;be=(S=b.distcode[et+((z&(1<<Te+Se)-1)>>Te)])>>>16&255,Pe=65535&S,!(Te+(ge=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Te,$-=Te,b.back+=Te}if(z>>>=ge,$-=ge,b.back+=ge,64&be){R.msg="invalid distance code",b.mode=30;break}b.offset=Pe,b.extra=15&be,b.mode=24;case 24:if(b.extra){for(D=b.extra;$<D;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.offset+=z&(1<<b.extra)-1,z>>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){R.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){R.msg="invalid distance too far back",b.mode=30;break}Ee=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),fe=b.window}else fe=te,Ee=Z-b.offset,se=b.length;for(Q<se&&(se=Q),Q-=se,b.length-=se;te[Z++]=fe[Ee++],--se;);b.length===0&&(b.mode=21);break;case 26:if(Q===0)break e;te[Z++]=b.length,Q--,b.mode=21;break;case 27:if(b.wrap){for(;$<32;){if(I===0)break e;I--,z|=V[W++]<<$,$+=8}if(ne-=Q,R.total_out+=ne,b.total+=ne,ne&&(R.adler=b.check=b.flags?a(b.check,te,ne,Z-ne):i(b.check,te,ne,Z-ne)),ne=Q,(b.flags?z:g(z))!==b.check){R.msg="incorrect data check",b.mode=30;break}$=z=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(z!==(4294967295&b.total)){R.msg="incorrect length check",b.mode=30;break}$=z=0}b.mode=29;case 29:J=1;break e;case 30:J=-3;break e;case 31:return-4;case 32:default:return p}return R.next_out=Z,R.avail_out=Q,R.next_in=W,R.avail_in=I,b.hold=z,b.bits=$,(b.wsize||ne!==R.avail_out&&b.mode<30&&(b.mode<27||F!==4))&&q(R,R.output,R.next_out,ne-R.avail_out)?(b.mode=31,-4):(de-=R.avail_in,ne-=R.avail_out,R.total_in+=de,R.total_out+=ne,b.total+=ne,b.wrap&&ne&&(R.adler=b.check=b.flags?a(b.check,te,ne,R.next_out-ne):i(b.check,te,ne,R.next_out-ne)),R.data_type=b.bits+(b.last?64:0)+(b.mode===12?128:0)+(b.mode===20||b.mode===15?256:0),(de==0&&ne===0||F===4)&&J===h&&(J=-5),J)},s.inflateEnd=function(R){if(!R||!R.state)return p;var F=R.state;return F.window&&(F.window=null),R.state=null,h},s.inflateGetHeader=function(R,F){var b;return R&&R.state&&2&(b=R.state).wrap?((b.head=F).done=!1,h):p},s.inflateSetDictionary=function(R,F){var b,V=F.length;return R&&R.state?(b=R.state).wrap!==0&&b.mode!==11?p:b.mode===11&&i(1,F,V,0)!==b.check?-3:q(R,F,V,V)?(b.mode=31,-4):(b.havedict=1,h):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var o=r("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(f,d,h,p,w,m,x,g){var v,_,C,E,T,P,O,j,L,q=g.bits,R=0,F=0,b=0,V=0,te=0,W=0,Z=0,I=0,Q=0,z=0,$=null,de=0,ne=new o.Buf16(16),se=new o.Buf16(16),Ee=null,fe=0;for(R=0;R<=15;R++)ne[R]=0;for(F=0;F<p;F++)ne[d[h+F]]++;for(te=q,V=15;1<=V&&ne[V]===0;V--);if(V<te&&(te=V),V===0)return w[m++]=20971520,w[m++]=20971520,g.bits=1,0;for(b=1;b<V&&ne[b]===0;b++);for(te<b&&(te=b),R=I=1;R<=15;R++)if(I<<=1,(I-=ne[R])<0)return-1;if(0<I&&(f===0||V!==1))return-1;for(se[1]=0,R=1;R<15;R++)se[R+1]=se[R]+ne[R];for(F=0;F<p;F++)d[h+F]!==0&&(x[se[d[h+F]]++]=F);if(P=f===0?($=Ee=x,19):f===1?($=i,de-=257,Ee=a,fe-=257,256):($=l,Ee=c,-1),R=b,T=m,Z=F=z=0,C=-1,E=(Q=1<<(W=te))-1,f===1&&852<Q||f===2&&592<Q)return 1;for(;;){for(O=R-Z,L=x[F]<P?(j=0,x[F]):x[F]>P?(j=Ee[fe+x[F]],$[de+x[F]]):(j=96,0),v=1<<R-Z,b=_=1<<W;w[T+(z>>Z)+(_-=v)]=O<<24|j<<16|L|0,_!==0;);for(v=1<<R-1;z&v;)v>>=1;if(v!==0?(z&=v-1,z+=v):z=0,F++,--ne[R]==0){if(R===V)break;R=d[h+x[F]]}if(te<R&&(z&E)!==C){for(Z===0&&(Z=te),T+=b,I=1<<(W=R-Z);W+Z<V&&!((I-=ne[W+Z])<=0);)W++,I<<=1;if(Q+=1<<W,f===1&&852<Q||f===2&&592<Q)return 1;w[C=z&E]=te<<24|W<<16|T-m|0}}return z!==0&&(w[T+z]=R-Z<<24|64<<16|0),g.bits=te,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var o=r("../utils/common"),i=0,a=1;function l(S){for(var N=S.length;0<=--N;)S[N]=0}var c=0,f=29,d=256,h=d+1+f,p=30,w=19,m=2*h+1,x=15,g=16,v=7,_=256,C=16,E=17,T=18,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],j=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(h+2));l(q);var R=new Array(2*p);l(R);var F=new Array(512);l(F);var b=new Array(256);l(b);var V=new Array(f);l(V);var te,W,Z,I=new Array(p);function Q(S,N,A,Y,M){this.static_tree=S,this.extra_bits=N,this.extra_base=A,this.elems=Y,this.max_length=M,this.has_stree=S&&S.length}function z(S,N){this.dyn_tree=S,this.max_code=0,this.stat_desc=N}function $(S){return S<256?F[S]:F[256+(S>>>7)]}function de(S,N){S.pending_buf[S.pending++]=255&N,S.pending_buf[S.pending++]=N>>>8&255}function ne(S,N,A){S.bi_valid>g-A?(S.bi_buf|=N<<S.bi_valid&65535,de(S,S.bi_buf),S.bi_buf=N>>g-S.bi_valid,S.bi_valid+=A-g):(S.bi_buf|=N<<S.bi_valid&65535,S.bi_valid+=A)}function se(S,N,A){ne(S,A[2*N],A[2*N+1])}function Ee(S,N){for(var A=0;A|=1&S,S>>>=1,A<<=1,0<--N;);return A>>>1}function fe(S,N,A){var Y,M,H=new Array(x+1),X=0;for(Y=1;Y<=x;Y++)H[Y]=X=X+A[Y-1]<<1;for(M=0;M<=N;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Ee(H[ee]++,ee))}}function ge(S){var N;for(N=0;N<h;N++)S.dyn_ltree[2*N]=0;for(N=0;N<p;N++)S.dyn_dtree[2*N]=0;for(N=0;N<w;N++)S.bl_tree[2*N]=0;S.dyn_ltree[2*_]=1,S.opt_len=S.static_len=0,S.last_lit=S.matches=0}function be(S){8<S.bi_valid?de(S,S.bi_buf):0<S.bi_valid&&(S.pending_buf[S.pending++]=S.bi_buf),S.bi_buf=0,S.bi_valid=0}function Pe(S,N,A,Y){var M=2*N,H=2*A;return S[M]<S[H]||S[M]===S[H]&&Y[N]<=Y[A]}function Te(S,N,A){for(var Y=S.heap[A],M=A<<1;M<=S.heap_len&&(M<S.heap_len&&Pe(N,S.heap[M+1],S.heap[M],S.depth)&&M++,!Pe(N,Y,S.heap[M],S.depth));)S.heap[A]=S.heap[M],A=M,M<<=1;S.heap[A]=Y}function Se(S,N,A){var Y,M,H,X,ee=0;if(S.last_lit!==0)for(;Y=S.pending_buf[S.d_buf+2*ee]<<8|S.pending_buf[S.d_buf+2*ee+1],M=S.pending_buf[S.l_buf+ee],ee++,Y===0?se(S,M,N):(se(S,(H=b[M])+d+1,N),(X=P[H])!==0&&ne(S,M-=V[H],X),se(S,H=$(--Y),A),(X=O[H])!==0&&ne(S,Y-=I[H],X)),ee<S.last_lit;);se(S,_,N)}function et(S,N){var A,Y,M,H=N.dyn_tree,X=N.stat_desc.static_tree,ee=N.stat_desc.has_stree,he=N.stat_desc.elems,Le=-1;for(S.heap_len=0,S.heap_max=m,A=0;A<he;A++)H[2*A]!==0?(S.heap[++S.heap_len]=Le=A,S.depth[A]=0):H[2*A+1]=0;for(;S.heap_len<2;)H[2*(M=S.heap[++S.heap_len]=Le<2?++Le:0)]=1,S.depth[M]=0,S.opt_len--,ee&&(S.static_len-=X[2*M+1]);for(N.max_code=Le,A=S.heap_len>>1;1<=A;A--)Te(S,H,A);for(M=he;A=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Te(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=A,S.heap[--S.heap_max]=Y,H[2*M]=H[2*A]+H[2*Y],S.depth[M]=(S.depth[A]>=S.depth[Y]?S.depth[A]:S.depth[Y])+1,H[2*A+1]=H[2*Y+1]=M,S.heap[1]=M++,Te(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Oe,St){var Vr,Wt,Vn,st,Wn,Bn,Wr=St.dyn_tree,vc=St.max_code,yc=St.stat_desc.static_tree,ti=St.stat_desc.has_stree,wc=St.stat_desc.extra_bits,ri=St.stat_desc.extra_base,_n=St.stat_desc.max_length,Rs=0;for(st=0;st<=x;st++)Oe.bl_count[st]=0;for(Wr[2*Oe.heap[Oe.heap_max]+1]=0,Vr=Oe.heap_max+1;Vr<m;Vr++)_n<(st=Wr[2*Wr[2*(Wt=Oe.heap[Vr])+1]+1]+1)&&(st=_n,Rs++),Wr[2*Wt+1]=st,vc<Wt||(Oe.bl_count[st]++,Wn=0,ri<=Wt&&(Wn=wc[Wt-ri]),Bn=Wr[2*Wt],Oe.opt_len+=Bn*(st+Wn),ti&&(Oe.static_len+=Bn*(yc[2*Wt+1]+Wn)));if(Rs!==0){do{for(st=_n-1;Oe.bl_count[st]===0;)st--;Oe.bl_count[st]--,Oe.bl_count[st+1]+=2,Oe.bl_count[_n]--,Rs-=2}while(0<Rs);for(st=_n;st!==0;st--)for(Wt=Oe.bl_count[st];Wt!==0;)vc<(Vn=Oe.heap[--Vr])||(Wr[2*Vn+1]!==st&&(Oe.opt_len+=(st-Wr[2*Vn+1])*Wr[2*Vn],Wr[2*Vn+1]=st),Wt--)}}(S,N),fe(H,Le,S.bl_count)}function k(S,N,A){var Y,M,H=-1,X=N[1],ee=0,he=7,Le=4;for(X===0&&(he=138,Le=3),N[2*(A+1)+1]=65535,Y=0;Y<=A;Y++)M=X,X=N[2*(Y+1)+1],++ee<he&&M===X||(ee<Le?S.bl_tree[2*M]+=ee:M!==0?(M!==H&&S.bl_tree[2*M]++,S.bl_tree[2*C]++):ee<=10?S.bl_tree[2*E]++:S.bl_tree[2*T]++,H=M,Le=(ee=0)===X?(he=138,3):M===X?(he=6,3):(he=7,4))}function J(S,N,A){var Y,M,H=-1,X=N[1],ee=0,he=7,Le=4;for(X===0&&(he=138,Le=3),Y=0;Y<=A;Y++)if(M=X,X=N[2*(Y+1)+1],!(++ee<he&&M===X)){if(ee<Le)for(;se(S,M,S.bl_tree),--ee!=0;);else M!==0?(M!==H&&(se(S,M,S.bl_tree),ee--),se(S,C,S.bl_tree),ne(S,ee-3,2)):ee<=10?(se(S,E,S.bl_tree),ne(S,ee-3,3)):(se(S,T,S.bl_tree),ne(S,ee-11,7));H=M,Le=(ee=0)===X?(he=138,3):M===X?(he=6,3):(he=7,4)}}l(I);var G=!1;function D(S,N,A,Y){ne(S,(c<<1)+(Y?1:0),3),function(M,H,X,ee){be(M),de(M,X),de(M,~X),o.arraySet(M.pending_buf,M.window,H,X,M.pending),M.pending+=X}(S,N,A)}s._tr_init=function(S){G||(function(){var N,A,Y,M,H,X=new Array(x+1);for(M=Y=0;M<f-1;M++)for(V[M]=Y,N=0;N<1<<P[M];N++)b[Y++]=M;for(b[Y-1]=M,M=H=0;M<16;M++)for(I[M]=H,N=0;N<1<<O[M];N++)F[H++]=M;for(H>>=7;M<p;M++)for(I[M]=H<<7,N=0;N<1<<O[M]-7;N++)F[256+H++]=M;for(A=0;A<=x;A++)X[A]=0;for(N=0;N<=143;)q[2*N+1]=8,N++,X[8]++;for(;N<=255;)q[2*N+1]=9,N++,X[9]++;for(;N<=279;)q[2*N+1]=7,N++,X[7]++;for(;N<=287;)q[2*N+1]=8,N++,X[8]++;for(fe(q,h+1,X),N=0;N<p;N++)R[2*N+1]=5,R[2*N]=Ee(N,5);te=new Q(q,P,d+1,h,x),W=new Q(R,O,0,p,x),Z=new Q(new Array(0),j,0,w,v)}(),G=!0),S.l_desc=new z(S.dyn_ltree,te),S.d_desc=new z(S.dyn_dtree,W),S.bl_desc=new z(S.bl_tree,Z),S.bi_buf=0,S.bi_valid=0,ge(S)},s._tr_stored_block=D,s._tr_flush_block=function(S,N,A,Y){var M,H,X=0;0<S.level?(S.strm.data_type===2&&(S.strm.data_type=function(ee){var he,Le=4093624447;for(he=0;he<=31;he++,Le>>>=1)if(1&Le&&ee.dyn_ltree[2*he]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(he=32;he<d;he++)if(ee.dyn_ltree[2*he]!==0)return a;return i}(S)),et(S,S.l_desc),et(S,S.d_desc),X=function(ee){var he;for(k(ee,ee.dyn_ltree,ee.l_desc.max_code),k(ee,ee.dyn_dtree,ee.d_desc.max_code),et(ee,ee.bl_desc),he=w-1;3<=he&&ee.bl_tree[2*L[he]+1]===0;he--);return ee.opt_len+=3*(he+1)+5+5+4,he}(S),M=S.opt_len+3+7>>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=A+5,A+4<=M&&N!==-1?D(S,N,A,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Se(S,q,R)):(ne(S,4+(Y?1:0),3),function(ee,he,Le,Oe){var St;for(ne(ee,he-257,5),ne(ee,Le-1,5),ne(ee,Oe-4,4),St=0;St<Oe;St++)ne(ee,ee.bl_tree[2*L[St]+1],3);J(ee,ee.dyn_ltree,he-1),J(ee,ee.dyn_dtree,Le-1)}(S,S.l_desc.max_code+1,S.d_desc.max_code+1,X+1),Se(S,S.dyn_ltree,S.dyn_dtree)),ge(S),Y&&be(S)},s._tr_tally=function(S,N,A){return S.pending_buf[S.d_buf+2*S.last_lit]=N>>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&N,S.pending_buf[S.l_buf+S.last_lit]=255&A,S.last_lit++,N===0?S.dyn_ltree[2*A]++:(S.matches++,N--,S.dyn_ltree[2*(b[A]+d+1)]++,S.dyn_dtree[2*$(N)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,_,q),function(N){N.bi_valid===16?(de(N,N.bi_buf),N.bi_buf=0,N.bi_valid=0):8<=N.bi_valid&&(N.pending_buf[N.pending++]=255&N.bi_buf,N.bi_buf>>=8,N.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.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(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var l,c,f,d,h=1,p={},w=!1,m=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,l={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,E=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=E,C}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(C){i.postMessage(d+C,"*")}):i.MessageChannel?((f=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){f.port2.postMessage(C)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(C){var E=m.createElement("script");E.onreadystatechange=function(){v(C),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(C){setTimeout(v,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var E=new Array(arguments.length-1),T=0;T<E.length;T++)E[T]=arguments[T+1];var P={callback:C,args:E};return p[h]=P,l(h),h++},x.clearImmediate=g}function g(C){delete p[C]}function v(C){if(w)setTimeout(v,0,C);else{var E=p[C];if(E){w=!0;try{(function(T){var P=T.callback,O=T.args;switch(O.length){case 0:P();break;case 1:P(O[0]);break;case 2:P(O[0],O[1]);break;case 3:P(O[0],O[1],O[2]);break;default:P.apply(a,O)}})(E)}finally{g(C),w=!1}}}}function _(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(d)===0&&v(+C.data.slice(d.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof kc<"u"?kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bC);var h5=bC.exports;const p5=pm(h5);function m5(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const g5=async(e,t)=>{const r=new p5;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},Ol=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)},v5=e=>Ol(e).split(" ")[0],y5=async()=>Dt().collection("domains").getFullList({sort:"-created",expand:"lastDeployment"}),w5=async e=>await Dt().collection("domains").getOne(e),tm=async e=>e.id?await Dt().collection("domains").update(e.id,e):await Dt().collection("domains").create(e),x5=async e=>await Dt().collection("domains").delete(e),_5=(e,t)=>Dt().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),b5=e=>{Dt().collection("domains").unsubscribe(e)},S5=()=>{const e=bf(),t=Ss(),r=()=>{t("/edit")},n=d=>{t(`/edit?id=${d}`)},s=d=>{t(`/history?domain=${d}`)},o=async d=>{try{await x5(d),a(i.filter(h=>h.id!==d))}catch(h){console.error("Error deleting domain:",h)}},[i,a]=y.useState([]);y.useEffect(()=>{(async()=>{const h=await y5();a(h)})()},[]);const l=async d=>{const h=i.filter(x=>x.id===d),p=h[0].enabled,w=h[0];w.enabled=!p,await tm(w);const m=i.map(x=>x.id===d?{...x,checked:!p}:x);a(m)},c=async d=>{try{b5(d.id),_5(d.id,h=>{console.log(h);const p=i.map(w=>w.id===h.id?{...h}:w);a(p)}),d.rightnow=!0,await tm(d),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:u.jsxs(u.Fragment,{children:["执行失败,请查看",u.jsx(Kn,{to:`/history?domain=${d.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},f=async d=>{const h=`${d.id}-${d.domain}.zip`,p=[{name:`${d.domain}.pem`,content:d.certificate?d.certificate:""},{name:`${d.domain}.key`,content:d.privateKey?d.privateKey:""}];await g5(h,p)};return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"",children:[u.jsx(kv,{}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),u.jsx(Pt,{onClick:r,children:"新增域名"})]}),i.length?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-40",children:"域名"}),u.jsx("div",{className:"w-48",children:"有效期限"}),u.jsx("div",{className:"w-32",children:"最近执行状态"}),u.jsx("div",{className:"w-64",children:"最近执行阶段"}),u.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),u.jsx("div",{className:"w-32",children:"是否启用"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),i.map(d=>{var h,p,w,m,x,g;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:d.domain}),u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:u.jsx("div",{children:d.expiredAt?u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"有效期90天"}),u.jsxs("div",{children:[v5(d.expiredAt),"到期"]})]}):"---"})}),u.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((h=d.expand)!=null&&h.lastDeployment)?u.jsx(u.Fragment,{children:((p=d.expand.lastDeployment)==null?void 0:p.phase)==="deploy"&&((w=d.expand.lastDeployment)!=null&&w.phaseSuccess)?u.jsx(t1,{size:16,className:"text-green-700"}):u.jsx(r1,{size:16,className:"text-red-700"})}):"---"}),u.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((m=d.expand)!=null&&m.lastDeployment)?u.jsx(dk,{phase:(x=d.expand.lastDeployment)==null?void 0:x.phase,phaseSuccess:(g=d.expand.lastDeployment)==null?void 0:g.phaseSuccess}):"---"}),u.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:d.lastDeployedAt?Ol(d.lastDeployedAt):"---"}),u.jsx("div",{className:"sm:w-32 flex items-center",children:u.jsx(gC,{children:u.jsxs(u5,{children:[u.jsx(d5,{children:u.jsx(Bk,{checked:d.enabled,onCheckedChange:()=>{l(d.id)}})}),u.jsx(Ev,{children:u.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:d.enabled?"禁用":"启用"})})]})})}),u.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>s(d.id),children:"部署历史"}),u.jsxs(ow,{when:!!d.enabled,children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>c(d),children:"立即部署"})]}),u.jsxs(ow,{when:!!d.expiredAt,children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>f(d),children:"下载"})]}),!d.enabled&&u.jsxs(u.Fragment,{children:[u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsxs(d3,{children:[u.jsx(f3,{asChild:!0,children:u.jsx(Pt,{variant:"link",className:"p-0",children:"删除"})}),u.jsxs(Dk,{children:[u.jsxs(Ok,{children:[u.jsx(Mk,{children:"删除域名"}),u.jsx(Ik,{children:"确定要删除域名吗?"})]}),u.jsxs(Ak,{children:[u.jsx(Fk,{children:"取消"}),u.jsx(Lk,{onClick:()=>{o(d.id)},children:"确认"})]})]})]}),u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>n(d.id),children:"编辑"})]})]})]},d.id)})]}):u.jsx(u.Fragment,{children:u.jsxs("div",{className:"flex flex-col items-center mt-10",children:[u.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:u.jsx(Op,{size:40,className:"text-primary"})}),u.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),u.jsx(Pt,{onClick:r,className:"mt-3",children:"添加域名"})]})})]})})},it=y.forwardRef(({className:e,type:t,...r},n)=>u.jsx("input",{type:t,className:we("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:n,...r}));it.displayName="Input";var pc=e=>e.type==="checkbox",Ni=e=>e instanceof Date,fr=e=>e==null;const SC=e=>typeof e=="object";var Gt=e=>!fr(e)&&!Array.isArray(e)&&SC(e)&&!Ni(e),kC=e=>Gt(e)&&e.target?pc(e.target)?e.target.checked:e.target.value:e,k5=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,CC=(e,t)=>e.has(k5(t)),C5=e=>{const t=e.constructor&&e.constructor.prototype;return Gt(t)&&t.hasOwnProperty("isPrototypeOf")},Tv=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function xr(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Tv&&(e instanceof Blob||e instanceof FileList))&&(r||Gt(e)))if(t=r?[]:{},!r&&!C5(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=xr(e[n]));else return e;return t}var Tf=e=>Array.isArray(e)?e.filter(Boolean):[],Lt=e=>e===void 0,ce=(e,t,r)=>{if(!t||!Gt(e))return r;const n=Tf(t.split(/[,[\].]+?/)).reduce((s,o)=>fr(s)?s:s[o],e);return Lt(n)||n===e?Lt(e[t])?r:e[t]:n},Rn=e=>typeof e=="boolean",Rv=e=>/^\w*$/.test(e),EC=e=>Tf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ut=(e,t,r)=>{let n=-1;const s=Rv(t)?[t]:EC(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let l=r;if(n!==i){const c=e[a];l=Gt(c)||Array.isArray(c)?c:isNaN(+s[n+1])?{}:[]}if(a==="__proto__")return;e[a]=l,e=e[a]}return e};const hd={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},an={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Gn={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},TC=Qe.createContext(null),Rf=()=>Qe.useContext(TC),E5=e=>{const{children:t,...r}=e;return Qe.createElement(TC.Provider,{value:r},t)};var RC=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==an.all&&(t._proxyFormState[i]=!n||an.all),r&&(r[i]=!0),e[i]}});return s},Nr=e=>Gt(e)&&!Object.keys(e).length,NC=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Nr(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||an.all))},rl=e=>Array.isArray(e)?e:[e],PC=(e,t,r)=>!e||!t||e===t||rl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function Nv(e){const t=Qe.useRef(e);t.current=e,Qe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function T5(e){const t=Rf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=Qe.useState(r._formState),l=Qe.useRef(!0),c=Qe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=Qe.useRef(s);return f.current=s,Nv({disabled:n,next:d=>l.current&&PC(f.current,d.name,o)&&NC(d,c.current,r._updateFormState)&&a({...r._formState,...d}),subject:r._subjects.state}),Qe.useEffect(()=>(l.current=!0,c.current.isValid&&r._updateValid(!0),()=>{l.current=!1}),[r]),RC(i,r,c.current,!1)}var Pn=e=>typeof e=="string",jC=(e,t,r,n,s)=>Pn(e)?(n&&t.watch.add(e),ce(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ce(r,o))):(n&&(t.watchAll=!0),r);function R5(e){const t=Rf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=Qe.useRef(n);a.current=n,Nv({disabled:o,subject:r._subjects.values,next:f=>{PC(a.current,f.name,i)&&c(xr(jC(a.current,r._names,f.values||r._formValues,!1,s)))}});const[l,c]=Qe.useState(r._getWatch(n,s));return Qe.useEffect(()=>r._removeUnmounted()),l}function N5(e){const t=Rf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=CC(s._names.array,r),a=R5({control:s,name:r,defaultValue:ce(s._formValues,r,ce(s._defaultValues,r,e.defaultValue)),exact:!0}),l=T5({control:s,name:r}),c=Qe.useRef(s.register(r,{...e.rules,value:a,...Rn(e.disabled)?{disabled:e.disabled}:{}}));return Qe.useEffect(()=>{const f=s._options.shouldUnregister||o,d=(h,p)=>{const w=ce(s._fields,h);w&&w._f&&(w._f.mount=p)};if(d(r,!0),f){const h=xr(ce(s._options.defaultValues,r));ut(s._defaultValues,r,h),Lt(ce(s._formValues,r))&&ut(s._formValues,r,h)}return()=>{(i?f&&!s._state.action:f)?s.unregister(r):d(r,!1)}},[r,s,i,o]),Qe.useEffect(()=>{ce(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ce(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Rn(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:Qe.useCallback(f=>c.current.onChange({target:{value:kC(f),name:r},type:hd.CHANGE}),[r]),onBlur:Qe.useCallback(()=>c.current.onBlur({target:{value:ce(s._formValues,r),name:r},type:hd.BLUR}),[r,s]),ref:f=>{const d=ce(s._fields,r);d&&f&&(d._f.ref={focus:()=>f.focus(),select:()=>f.select(),setCustomValidity:h=>f.setCustomValidity(h),reportValidity:()=>f.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ce(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!ce(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ce(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ce(l.validatingFields,r)},error:{enumerable:!0,get:()=>ce(l.errors,r)}})}}const P5=e=>e.render(N5(e));var DC=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},lw=e=>({isOnSubmit:!e||e===an.onSubmit,isOnBlur:e===an.onBlur,isOnChange:e===an.onChange,isOnAll:e===an.all,isOnTouch:e===an.onTouched}),cw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const nl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ce(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;nl(a,t)}else Gt(a)&&nl(a,t)}}};var j5=(e,t,r)=>{const n=rl(ce(e,r));return ut(n,"root",t[r]),ut(e,r,n),e},Pv=e=>e.type==="file",Bs=e=>typeof e=="function",pd=e=>{if(!Tv)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Su=e=>Pn(e),jv=e=>e.type==="radio",md=e=>e instanceof RegExp;const uw={value:!1,isValid:!1},dw={value:!0,isValid:!0};var OC=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?dw:{value:e[0].value,isValid:!0}:dw:uw}return uw};const fw={isValid:!1,value:null};var AC=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,fw):fw;function hw(e,t,r="validate"){if(Su(e)||Array.isArray(e)&&e.every(Su)||Rn(e)&&!e)return{type:r,message:Su(e)?e:"",ref:t}}var fi=e=>Gt(e)&&!md(e)?e:{value:e,message:""},pw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:l,minLength:c,min:f,max:d,pattern:h,validate:p,name:w,valueAsNumber:m,mount:x,disabled:g}=e._f,v=ce(t,w);if(!x||g)return{};const _=i?i[0]:o,C=R=>{n&&_.reportValidity&&(_.setCustomValidity(Rn(R)?"":R||""),_.reportValidity())},E={},T=jv(o),P=pc(o),O=T||P,j=(m||Pv(o))&&Lt(o.value)&&Lt(v)||pd(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,L=DC.bind(null,w,r,E),q=(R,F,b,V=Gn.maxLength,te=Gn.minLength)=>{const W=R?F:b;E[w]={type:R?V:te,message:W,ref:o,...L(R?V:te,W)}};if(s?!Array.isArray(v)||!v.length:a&&(!O&&(j||fr(v))||Rn(v)&&!v||P&&!OC(i).isValid||T&&!AC(i).isValid)){const{value:R,message:F}=Su(a)?{value:!!a,message:a}:fi(a);if(R&&(E[w]={type:Gn.required,message:F,ref:_,...L(Gn.required,F)},!r))return C(F),E}if(!j&&(!fr(f)||!fr(d))){let R,F;const b=fi(d),V=fi(f);if(!fr(v)&&!isNaN(v)){const te=o.valueAsNumber||v&&+v;fr(b.value)||(R=te>b.value),fr(V.value)||(F=te<V.value)}else{const te=o.valueAsDate||new Date(v),W=Q=>new Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Pn(b.value)&&v&&(R=Z?W(v)>W(b.value):I?v>b.value:te>new Date(b.value)),Pn(V.value)&&v&&(F=Z?W(v)<W(V.value):I?v<V.value:te<new Date(V.value))}if((R||F)&&(q(!!R,b.message,V.message,Gn.max,Gn.min),!r))return C(E[w].message),E}if((l||c)&&!j&&(Pn(v)||s&&Array.isArray(v))){const R=fi(l),F=fi(c),b=!fr(R.value)&&v.length>+R.value,V=!fr(F.value)&&v.length<+F.value;if((b||V)&&(q(b,R.message,F.message),!r))return C(E[w].message),E}if(h&&!j&&Pn(v)){const{value:R,message:F}=fi(h);if(md(R)&&!v.match(R)&&(E[w]={type:Gn.pattern,message:F,ref:o,...L(Gn.pattern,F)},!r))return C(F),E}if(p){if(Bs(p)){const R=await p(v,t),F=hw(R,_);if(F&&(E[w]={...F,...L(Gn.validate,F.message)},!r))return C(F.message),E}else if(Gt(p)){let R={};for(const F in p){if(!Nr(R)&&!r)break;const b=hw(await p[F](v,t),_,F);b&&(R={...b,...L(F,b.message)},C(b.message),r&&(E[w]=R))}if(!Nr(R)&&(E[w]={ref:_,...R},!r))return E}}return C(!0),E};function D5(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Lt(e)?n++:e[t[n++]];return e}function O5(e){for(const t in e)if(e.hasOwnProperty(t)&&!Lt(e[t]))return!1;return!0}function Bt(e,t){const r=Array.isArray(t)?t:Rv(t)?[t]:EC(t),n=r.length===1?e:D5(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Gt(n)&&Nr(n)||Array.isArray(n)&&O5(n))&&Bt(e,r.slice(0,-1)),e}var Ph=()=>{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=[]}}},gd=e=>fr(e)||!SC(e);function Ro(e,t){if(gd(e)||gd(t))return e===t;if(Ni(e)&&Ni(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if(Ni(o)&&Ni(i)||Gt(o)&&Gt(i)||Array.isArray(o)&&Array.isArray(i)?!Ro(o,i):o!==i)return!1}}return!0}var MC=e=>e.type==="select-multiple",A5=e=>jv(e)||pc(e),jh=e=>pd(e)&&e.isConnected,IC=e=>{for(const t in e)if(Bs(e[t]))return!0;return!1};function vd(e,t={}){const r=Array.isArray(e);if(Gt(e)||r)for(const n in e)Array.isArray(e[n])||Gt(e[n])&&!IC(e[n])?(t[n]=Array.isArray(e[n])?[]:{},vd(e[n],t[n])):fr(e[n])||(t[n]=!0);return t}function LC(e,t,r){const n=Array.isArray(e);if(Gt(e)||n)for(const s in e)Array.isArray(e[s])||Gt(e[s])&&!IC(e[s])?Lt(t)||gd(r[s])?r[s]=Array.isArray(e[s])?vd(e[s],[]):{...vd(e[s])}:LC(e[s],fr(t)?{}:t[s],r[s]):r[s]=!Ro(e[s],t[s]);return r}var tu=(e,t)=>LC(e,t,vd(t)),FC=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Lt(e)?e:t?e===""?NaN:e&&+e:r&&Pn(e)?new Date(e):n?n(e):e;function Dh(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return Pv(t)?t.files:jv(t)?AC(e.refs).value:MC(t)?[...t.selectedOptions].map(({value:r})=>r):pc(t)?OC(e.refs).value:FC(Lt(t.value)?e.ref.value:t.value,e)}var M5=(e,t,r,n)=>{const s={};for(const o of e){const i=ce(t,o);i&&ut(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ma=e=>Lt(e)?e:md(e)?e.source:Gt(e)?md(e.value)?e.value.source:e.value:e,I5=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function mw(e,t,r){const n=ce(e,r);if(n||Rv(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ce(t,o),a=ce(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var L5=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,F5=(e,t)=>!Tf(ce(e,t)).length&&Bt(e,t);const z5={mode:an.onSubmit,reValidateMode:an.onChange,shouldFocusError:!0};function U5(e={}){let t={...z5,...e},r={submitCount:0,isDirty:!1,isLoading:Bs(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Gt(t.defaultValues)||Gt(t.values)?xr(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:xr(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Ph(),array:Ph(),state:Ph()},h=lw(t.mode),p=lw(t.reValidateMode),w=t.criteriaMode===an.all,m=S=>N=>{clearTimeout(c),c=setTimeout(S,N)},x=async S=>{if(f.isValid||S){const N=t.resolver?Nr((await O()).errors):await L(n,!0);N!==r.isValid&&d.state.next({isValid:N})}},g=(S,N)=>{(f.isValidating||f.validatingFields)&&((S||Array.from(a.mount)).forEach(A=>{A&&(N?ut(r.validatingFields,A,N):Bt(r.validatingFields,A))}),d.state.next({validatingFields:r.validatingFields,isValidating:!Nr(r.validatingFields)}))},v=(S,N=[],A,Y,M=!0,H=!0)=>{if(Y&&A){if(i.action=!0,H&&Array.isArray(ce(n,S))){const X=A(ce(n,S),Y.argA,Y.argB);M&&ut(n,S,X)}if(H&&Array.isArray(ce(r.errors,S))){const X=A(ce(r.errors,S),Y.argA,Y.argB);M&&ut(r.errors,S,X),F5(r.errors,S)}if(f.touchedFields&&H&&Array.isArray(ce(r.touchedFields,S))){const X=A(ce(r.touchedFields,S),Y.argA,Y.argB);M&&ut(r.touchedFields,S,X)}f.dirtyFields&&(r.dirtyFields=tu(s,o)),d.state.next({name:S,isDirty:R(S,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ut(o,S,N)},_=(S,N)=>{ut(r.errors,S,N),d.state.next({errors:r.errors})},C=S=>{r.errors=S,d.state.next({errors:r.errors,isValid:!1})},E=(S,N,A,Y)=>{const M=ce(n,S);if(M){const H=ce(o,S,Lt(A)?ce(s,S):A);Lt(H)||Y&&Y.defaultChecked||N?ut(o,S,N?H:Dh(M._f)):V(S,H),i.mount&&x()}},T=(S,N,A,Y,M)=>{let H=!1,X=!1;const ee={name:S},he=!!(ce(n,S)&&ce(n,S)._f&&ce(n,S)._f.disabled);if(!A||Y){f.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=R(),H=X!==ee.isDirty);const Le=he||Ro(ce(s,S),N);X=!!(!he&&ce(r.dirtyFields,S)),Le||he?Bt(r.dirtyFields,S):ut(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||f.dirtyFields&&X!==!Le}if(A){const Le=ce(r.touchedFields,S);Le||(ut(r.touchedFields,S,A),ee.touchedFields=r.touchedFields,H=H||f.touchedFields&&Le!==A)}return H&&M&&d.state.next(ee),H?ee:{}},P=(S,N,A,Y)=>{const M=ce(r.errors,S),H=f.isValid&&Rn(N)&&r.isValid!==N;if(e.delayError&&A?(l=m(()=>_(S,A)),l(e.delayError)):(clearTimeout(c),l=null,A?ut(r.errors,S,A):Bt(r.errors,S)),(A?!Ro(M,A):M)||!Nr(Y)||H){const X={...Y,...H&&Rn(N)?{isValid:N}:{},errors:r.errors,name:S};r={...r,...X},d.state.next(X)}},O=async S=>{g(S,!0);const N=await t.resolver(o,t.context,M5(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return g(S),N},j=async S=>{const{errors:N}=await O(S);if(S)for(const A of S){const Y=ce(N,A);Y?ut(r.errors,A,Y):Bt(r.errors,A)}else r.errors=N;return N},L=async(S,N,A={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);g([Y],!0);const he=await pw(M,o,w,t.shouldUseNativeValidation&&!N,ee);if(g([Y]),he[H.name]&&(A.valid=!1,N))break;!N&&(ce(he,H.name)?ee?j5(r.errors,he,H.name):ut(r.errors,H.name,he[H.name]):Bt(r.errors,H.name))}X&&await L(X,N,A)}}return A.valid},q=()=>{for(const S of a.unMount){const N=ce(n,S);N&&(N._f.refs?N._f.refs.every(A=>!jh(A)):!jh(N._f.ref))&&Ee(S)}a.unMount=new Set},R=(S,N)=>(S&&N&&ut(o,S,N),!Ro(z(),s)),F=(S,N,A)=>jC(S,a,{...i.mount?o:Lt(N)?s:Pn(S)?{[S]:N}:N},A,N),b=S=>Tf(ce(i.mount?o:s,S,e.shouldUnregister?ce(s,S,[]):[])),V=(S,N,A={})=>{const Y=ce(n,S);let M=N;if(Y){const H=Y._f;H&&(!H.disabled&&ut(o,S,FC(N,H)),M=pd(H.ref)&&fr(N)?"":N,MC(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?pc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):Pv(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||d.values.next({name:S,values:{...o}})))}(A.shouldDirty||A.shouldTouch)&&T(S,M,A.shouldTouch,A.shouldDirty,!0),A.shouldValidate&&Q(S)},te=(S,N,A)=>{for(const Y in N){const M=N[Y],H=`${S}.${Y}`,X=ce(n,H);(a.array.has(S)||!gd(M)||X&&!X._f)&&!Ni(M)?te(H,M,A):V(H,M,A)}},W=(S,N,A={})=>{const Y=ce(n,S),M=a.array.has(S),H=xr(N);ut(o,S,H),M?(d.array.next({name:S,values:{...o}}),(f.isDirty||f.dirtyFields)&&A.shouldDirty&&d.state.next({name:S,dirtyFields:tu(s,o),isDirty:R(S,H)})):Y&&!Y._f&&!fr(H)?te(S,H,A):V(S,H,A),cw(S,a)&&d.state.next({...r}),d.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const N=S.target;let A=N.name,Y=!0;const M=ce(n,A),H=()=>N.type?Dh(M._f):kC(S),X=ee=>{Y=Number.isNaN(ee)||ee===ce(o,A,ee)};if(M){let ee,he;const Le=H(),Oe=S.type===hd.BLUR||S.type===hd.FOCUS_OUT,St=!I5(M._f)&&!t.resolver&&!ce(r.errors,A)&&!M._f.deps||L5(Oe,ce(r.touchedFields,A),r.isSubmitted,p,h),Vr=cw(A,a,Oe);ut(o,A,Le),Oe?(M._f.onBlur&&M._f.onBlur(S),l&&l(0)):M._f.onChange&&M._f.onChange(S);const Wt=T(A,Le,Oe,!1),Vn=!Nr(Wt)||Vr;if(!Oe&&d.values.next({name:A,type:S.type,values:{...o}}),St)return f.isValid&&x(),Vn&&d.state.next({name:A,...Vr?{}:Wt});if(!Oe&&Vr&&d.state.next({...r}),t.resolver){const{errors:st}=await O([A]);if(X(Le),Y){const Wn=mw(r.errors,n,A),Bn=mw(st,n,Wn.name||A);ee=Bn.error,A=Bn.name,he=Nr(st)}}else g([A],!0),ee=(await pw(M,o,w,t.shouldUseNativeValidation))[A],g([A]),X(Le),Y&&(ee?he=!1:f.isValid&&(he=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),P(A,he,ee,Wt))}},I=(S,N)=>{if(ce(r.errors,N)&&S.focus)return S.focus(),1},Q=async(S,N={})=>{let A,Y;const M=rl(S);if(t.resolver){const H=await j(Lt(S)?S:M);A=Nr(H),Y=S?!M.some(X=>ce(H,X)):A}else S?(Y=(await Promise.all(M.map(async H=>{const X=ce(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&x()):Y=A=await L(n);return d.state.next({...!Pn(S)||f.isValid&&A!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:A}:{},errors:r.errors}),N.shouldFocus&&!Y&&nl(n,I,S?M:a.mount),Y},z=S=>{const N={...i.mount?o:s};return Lt(S)?N:Pn(S)?ce(N,S):S.map(A=>ce(N,A))},$=(S,N)=>({invalid:!!ce((N||r).errors,S),isDirty:!!ce((N||r).dirtyFields,S),error:ce((N||r).errors,S),isValidating:!!ce(r.validatingFields,S),isTouched:!!ce((N||r).touchedFields,S)}),de=S=>{S&&rl(S).forEach(N=>Bt(r.errors,N)),d.state.next({errors:S?r.errors:{}})},ne=(S,N,A)=>{const Y=(ce(n,S,{_f:{}})._f||{}).ref,M=ce(r.errors,S)||{},{ref:H,message:X,type:ee,...he}=M;ut(r.errors,S,{...he,...N,ref:Y}),d.state.next({name:S,errors:r.errors,isValid:!1}),A&&A.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,N)=>Bs(S)?d.values.subscribe({next:A=>S(F(void 0,N),A)}):F(S,N,!0),Ee=(S,N={})=>{for(const A of S?rl(S):a.mount)a.mount.delete(A),a.array.delete(A),N.keepValue||(Bt(n,A),Bt(o,A)),!N.keepError&&Bt(r.errors,A),!N.keepDirty&&Bt(r.dirtyFields,A),!N.keepTouched&&Bt(r.touchedFields,A),!N.keepIsValidating&&Bt(r.validatingFields,A),!t.shouldUnregister&&!N.keepDefaultValue&&Bt(s,A);d.values.next({values:{...o}}),d.state.next({...r,...N.keepDirty?{isDirty:R()}:{}}),!N.keepIsValid&&x()},fe=({disabled:S,name:N,field:A,fields:Y,value:M})=>{if(Rn(S)&&i.mount||S){const H=S?void 0:Lt(M)?Dh(A?A._f:ce(Y,N)._f):M;ut(o,N,H),T(N,H,!1,!1,!0)}},ge=(S,N={})=>{let A=ce(n,S);const Y=Rn(N.disabled);return ut(n,S,{...A||{},_f:{...A&&A._f?A._f:{ref:{name:S}},name:S,mount:!0,...N}}),a.mount.add(S),A?fe({field:A,disabled:N.disabled,name:S,value:N.value}):E(S,!0,N.value),{...Y?{disabled:N.disabled}:{},...t.progressive?{required:!!N.required,min:Ma(N.min),max:Ma(N.max),minLength:Ma(N.minLength),maxLength:Ma(N.maxLength),pattern:Ma(N.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ge(S,N),A=ce(n,S);const H=Lt(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=A5(H),ee=A._f.refs||[];if(X?ee.find(he=>he===H):H===A._f.ref)return;ut(n,S,{_f:{...A._f,...X?{refs:[...ee.filter(jh),H,...Array.isArray(ce(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),E(S,!1,void 0,H)}else A=ce(n,S,{}),A._f&&(A._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(CC(a.array,S)&&i.action)&&a.unMount.add(S)}}},be=()=>t.shouldFocusError&&nl(n,I,a.mount),Pe=S=>{Rn(S)&&(d.state.next({disabled:S}),nl(n,(N,A)=>{const Y=ce(n,A);Y&&(N.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Te=(S,N)=>async A=>{let Y;A&&(A.preventDefault&&A.preventDefault(),A.persist&&A.persist());let M=xr(o);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await O();r.errors=H,M=X}else await L(n);if(Bt(r.errors,"root"),Nr(r.errors)){d.state.next({errors:{}});try{await S(M,A)}catch(H){Y=H}}else N&&await N({...r.errors},A),be(),setTimeout(be);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Nr(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Se=(S,N={})=>{ce(n,S)&&(Lt(N.defaultValue)?W(S,xr(ce(s,S))):(W(S,N.defaultValue),ut(s,S,xr(N.defaultValue))),N.keepTouched||Bt(r.touchedFields,S),N.keepDirty||(Bt(r.dirtyFields,S),r.isDirty=N.defaultValue?R(S,xr(ce(s,S))):R()),N.keepError||(Bt(r.errors,S),f.isValid&&x()),d.state.next({...r}))},et=(S,N={})=>{const A=S?xr(S):s,Y=xr(A),M=Nr(S),H=M?s:Y;if(N.keepDefaultValues||(s=A),!N.keepValues){if(N.keepDirtyValues)for(const X of a.mount)ce(r.dirtyFields,X)?ut(H,X,ce(o,X)):W(X,ce(H,X));else{if(Tv&&Lt(S))for(const X of a.mount){const ee=ce(n,X);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(pd(he)){const Le=he.closest("form");if(Le){Le.reset();break}}}}n={}}o=e.shouldUnregister?N.keepDefaultValues?xr(s):{}:xr(H),d.array.next({values:{...H}}),d.values.next({values:{...H}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:N.keepSubmitCount?r.submitCount:0,isDirty:M?!1:N.keepDirty?r.isDirty:!!(N.keepDefaultValues&&!Ro(S,s)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:N.keepDirtyValues?N.keepDefaultValues&&o?tu(s,o):r.dirtyFields:N.keepDefaultValues&&S?tu(s,S):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,N)=>et(Bs(S)?S(o):S,N);return{control:{register:ge,unregister:Ee,getFieldState:$,handleSubmit:Te,setError:ne,_executeSchema:O,_getWatch:F,_getDirty:R,_updateValid:x,_removeUnmounted:q,_updateFieldArray:v,_updateDisabledField:fe,_getFieldArray:b,_reset:et,_resetDefaultValues:()=>Bs(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Pe,_subjects:d,_proxyFormState:f,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ge,handleSubmit:Te,watch:se,setValue:W,getValues:z,reset:k,resetField:Se,clearErrors:de,unregister:Ee,setError:ne,setFocus:(S,N={})=>{const A=ce(n,S),Y=A&&A._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),N.shouldSelect&&M.select())}},getFieldState:$}}function Qo(e={}){const t=Qe.useRef(),r=Qe.useRef(),[n,s]=Qe.useState({isDirty:!1,isValidating:!1,isLoading:Bs(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Bs(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...U5(e),formState:n});const o=t.current.control;return o._options=e,Nv({subject:o._subjects.state,next:i=>{NC(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),Qe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),Qe.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),Qe.useEffect(()=>{e.values&&!Ro(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),Qe.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),Qe.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()}),Qe.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=RC(n,o),t.current}const gw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ce(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},zC=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?gw(n.ref,r,e):n.refs&&n.refs.forEach(s=>gw(s,r,e))}},$5=(e,t)=>{t.shouldUseNativeValidation&&zC(e,t);const r={};for(const n in e){const s=ce(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(V5(t.names||Object.keys(e),n)){const i=Object.assign({},ce(r,n));ut(i,"root",o),ut(r,n,i)}else ut(r,n,o)}return r},V5=(e,t)=>e.some(r=>r.startsWith(t+"."));var W5=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(d){return e.push(d)})}),t){var l=r[i].types,c=l&&l[n.code];r[i]=DC(i,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r},Jo=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var l=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(c){return o.shouldUseNativeValidation&&zC({},o),{errors:{},values:r.raw?n:c}})}catch(c){return a(c)}return l&&l.then?l.then(void 0,a):l}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:$5(W5(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},rt;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,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 n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(rt||(rt={}));var rm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(rm||(rm={}));const ye=rt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zs=e=>{switch(typeof e){case"undefined":return ye.undefined;case"string":return ye.string;case"number":return isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},ie=rt.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"]),B5=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Lr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_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)n._errors.push(r(i));else{let a=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),n}static assert(t){if(!(t instanceof Lr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,rt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Lr.create=e=>new Lr(e);const ea=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===ye.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rt.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${rt.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rt.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${rt.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rt.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,rt.assertNever(e)}return{message:r}};let UC=ea;function H5(e){UC=e}function yd(){return UC}const wd=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Y5=[];function pe(e,t){const r=yd(),n=wd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ea?void 0:ea].filter(s=>!!s)});e.common.issues.push(n)}class lr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Ie;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return lr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Ie;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Ie=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),pr=e=>({status:"valid",value:e}),nm=e=>e.status==="aborted",sm=e=>e.status==="dirty",Al=e=>e.status==="valid",Ml=e=>typeof Promise<"u"&&e instanceof Promise;function xd(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function $C(e,t,r,n,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,r),r}var Ce;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ce||(Ce={}));var Va,Wa;class Ln{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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 vw=(e,t)=>{if(Al(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 r=new Lr(e.common.issues);return this._error=r,this._error}}};function ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))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 l,c;const{message:f}=e;return i.code==="invalid_enum_value"?{message:f??a.defaultError}:typeof a.data>"u"?{message:(l=f??n)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(c=f??r)!==null&&c!==void 0?c:a.defaultError}},description:s}}class He{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 zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new lr,ctx:{common:t.parent.common,data:t.data,parsedType:zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(Ml(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return vw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(Ml(s)?s:Promise.resolve(s));return vw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new yn({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return An.create(this,this._def)}nullable(){return lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fn.create(this,this._def)}promise(){return ra.create(this,this._def)}or(t){return zl.create([this,t],this._def)}and(t){return Ul.create(this,t,this._def)}transform(t){return new yn({...ze(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Hl({...ze(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new Dv({typeName:Ae.ZodBranded,type:this,...ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new Yl({...ze(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return mc.create(this,t)}readonly(){return Zl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z5=/^c[^\s-]{8,}$/i,G5=/^[0-9a-z]+$/,K5=/^[0-9A-HJKMNP-TV-Z]{26}$/,q5=/^[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,X5=/^[a-z0-9_-]{21}$/i,Q5=/^[-+]?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)?)??$/,J5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ez="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oh;const tz=/^(?:(?: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])$/,rz=/^(([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})))$/,nz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VC="((\\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])))",sz=new RegExp(`^${VC}$`);function WC(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 oz(e){return new RegExp(`^${WC(e)}$`)}function BC(e){let t=`${VC}T${WC(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function iz(e,t){return!!((t==="v4"||!t)&&tz.test(e)||(t==="v6"||!t)&&rz.test(e))}class cn extends He{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ye.string){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.string,received:o.parsedType}),Ie}const n=new lr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?pe(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&pe(s,{code:ie.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")J5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"email",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Oh||(Oh=new RegExp(ez,"u")),Oh.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"emoji",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")q5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"uuid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")X5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"nanoid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Z5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"cuid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")G5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"cuid2",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")K5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"ulid",code:ie.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),pe(s,{validation:"url",code:ie.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"regex",code:ie.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?BC(o).test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?sz.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?oz(o).test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Q5.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"duration",code:ie.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?iz(t.data,o.version)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"ip",code:ie.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?nz.test(t.data)||(s=this._getOrReturnCtx(t,s),pe(s,{validation:"base64",code:ie.invalid_string,message:o.message}),n.dirty()):rt.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:ie.invalid_string,...Ce.errToObj(n)})}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ce.errToObj(t)})}datetime(t){var r,n;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:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...Ce.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,...Ce.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ce.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Ce.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...Ce.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Ce.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Ce.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Ce.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Ce.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Ce.errToObj(r)})}nonempty(t){return this.min(1,Ce.errToObj(t))}trim(){return new cn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cn({...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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}cn.create=e=>{var t;return new cn({checks:[],typeName:Ae.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ze(e)})};function az(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class oo extends He{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)!==ye.number){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.number,received:o.parsedType}),Ie}let n;const s=new lr;for(const o of this._def.checks)o.kind==="int"?rt.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?az(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_finite,message:o.message}),s.dirty()):rt.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Ce.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ce.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ce.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ce.toString(r))}setLimit(t,r,n,s){return new oo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ce.toString(s)}]})}_addCheck(t){return new oo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&rt.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}oo.create=e=>new oo({checks:[],typeName:Ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ze(e)});class io extends He{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)!==ye.bigint){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.bigint,received:o.parsedType}),Ie}let n;const s=new lr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):rt.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Ce.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Ce.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Ce.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Ce.toString(r))}setLimit(t,r,n,s){return new io({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ce.toString(s)}]})}_addCheck(t){return new io({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}io.create=e=>{var t;return new io({checks:[],typeName:Ae.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ze(e)})};class Il extends He{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ye.boolean){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.boolean,received:n.parsedType}),Ie}return pr(t.data)}}Il.create=e=>new Il({typeName:Ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ze(e)});class Wo extends He{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ye.date){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_type,expected:ye.date,received:o.parsedType}),Ie}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return pe(o,{code:ie.invalid_date}),Ie}const n=new lr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),pe(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):rt.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Wo({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Ce.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Ce.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}Wo.create=e=>new Wo({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ae.ZodDate,...ze(e)});class _d extends He{_parse(t){if(this._getType(t)!==ye.symbol){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.symbol,received:n.parsedType}),Ie}return pr(t.data)}}_d.create=e=>new _d({typeName:Ae.ZodSymbol,...ze(e)});class Ll extends He{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.undefined,received:n.parsedType}),Ie}return pr(t.data)}}Ll.create=e=>new Ll({typeName:Ae.ZodUndefined,...ze(e)});class Fl extends He{_parse(t){if(this._getType(t)!==ye.null){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.null,received:n.parsedType}),Ie}return pr(t.data)}}Fl.create=e=>new Fl({typeName:Ae.ZodNull,...ze(e)});class ta extends He{constructor(){super(...arguments),this._any=!0}_parse(t){return pr(t.data)}}ta.create=e=>new ta({typeName:Ae.ZodAny,...ze(e)});class Do extends He{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pr(t.data)}}Do.create=e=>new Do({typeName:Ae.ZodUnknown,...ze(e)});class ys extends He{_parse(t){const r=this._getOrReturnCtx(t);return pe(r,{code:ie.invalid_type,expected:ye.never,received:r.parsedType}),Ie}}ys.create=e=>new ys({typeName:Ae.ZodNever,...ze(e)});class bd extends He{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.void,received:n.parsedType}),Ie}return pr(t.data)}}bd.create=e=>new bd({typeName:Ae.ZodVoid,...ze(e)});class fn extends He{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==ye.array)return pe(r,{code:ie.invalid_type,expected:ye.array,received:r.parsedType}),Ie;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(pe(r,{code:i?ie.too_big:ie.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(pe(r,{code:ie.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(pe(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Ln(r,i,r.path,a)))).then(i=>lr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Ln(r,i,r.path,a)));return lr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new fn({...this._def,minLength:{value:t,message:Ce.toString(r)}})}max(t,r){return new fn({...this._def,maxLength:{value:t,message:Ce.toString(r)}})}length(t,r){return new fn({...this._def,exactLength:{value:t,message:Ce.toString(r)}})}nonempty(t){return this.min(1,t)}}fn.create=(e,t)=>new fn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...ze(t)});function pi(e){if(e instanceof Tt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=An.create(pi(n))}return new Tt({...e._def,shape:()=>t})}else return e instanceof fn?new fn({...e._def,type:pi(e.element)}):e instanceof An?An.create(pi(e.unwrap())):e instanceof lo?lo.create(pi(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>pi(t))):e}class Tt extends He{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(),r=rt.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==ye.object){const c=this._getOrReturnCtx(t);return pe(c,{code:ie.invalid_type,expected:ye.object,received:c.parsedType}),Ie}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ys&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const f=o[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Ln(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof ys){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")a.length>0&&(pe(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of a){const d=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Ln(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const d=await f.key,h=await f.value;c.push({key:d,value:h,alwaysSet:f.alwaysSet})}return c}).then(c=>lr.mergeObjectSync(n,c)):lr.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return Ce.errToObj,new Tt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const l=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=Ce.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Tt({...this._def,unknownKeys:"strip"})}passthrough(){return new Tt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Tt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Tt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ae.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Tt({...this._def,catchall:t})}pick(t){const r={};return rt.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Tt({...this._def,shape:()=>r})}omit(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Tt({...this._def,shape:()=>r})}deepPartial(){return pi(this)}partial(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Tt({...this._def,shape:()=>r})}required(t){const r={};return rt.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof An;)o=o._def.innerType;r[n]=o}}),new Tt({...this._def,shape:()=>r})}keyof(){return HC(rt.objectKeys(this.shape))}}Tt.create=(e,t)=>new Tt({shape:()=>e,unknownKeys:"strip",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});Tt.strictCreate=(e,t)=>new Tt({shape:()=>e,unknownKeys:"strict",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});Tt.lazycreate=(e,t)=>new Tt({shape:e,unknownKeys:"strip",catchall:ys.create(),typeName:Ae.ZodObject,...ze(t)});class zl extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n=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 r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Lr(a.ctx.common.issues));return pe(r,{code:ie.invalid_union,unionErrors:i}),Ie}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const l of n){const c={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(l=>new Lr(l));return pe(r,{code:ie.invalid_union,unionErrors:a}),Ie}}get options(){return this._def.options}}zl.create=(e,t)=>new zl({options:e,typeName:Ae.ZodUnion,...ze(t)});const qn=e=>e instanceof Vl?qn(e.schema):e instanceof yn?qn(e.innerType()):e instanceof Wl?[e.value]:e instanceof ao?e.options:e instanceof Bl?rt.objectValues(e.enum):e instanceof Hl?qn(e._def.innerType):e instanceof Ll?[void 0]:e instanceof Fl?[null]:e instanceof An?[void 0,...qn(e.unwrap())]:e instanceof lo?[null,...qn(e.unwrap())]:e instanceof Dv||e instanceof Zl?qn(e.unwrap()):e instanceof Yl?qn(e._def.innerType):[];class Nf extends He{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.object)return pe(r,{code:ie.invalid_type,expected:ye.object,received:r.parsedType}),Ie;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(pe(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=qn(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 Nf({typeName:Ae.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...ze(n)})}}function om(e,t){const r=zs(e),n=zs(t);if(e===t)return{valid:!0,data:e};if(r===ye.object&&n===ye.object){const s=rt.objectKeys(t),o=rt.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const l=om(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(r===ye.array&&n===ye.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],l=om(i,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return r===ye.date&&n===ye.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ul extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(o,i)=>{if(nm(o)||nm(i))return Ie;const a=om(o.value,i.value);return a.valid?((sm(o)||sm(i))&&r.dirty(),{status:r.value,value:a.data}):(pe(n,{code:ie.invalid_intersection_types}),Ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ul.create=(e,t,r)=>new Ul({left:e,right:t,typeName:Ae.ZodIntersection,...ze(r)});class Fn extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.array)return pe(n,{code:ie.invalid_type,expected:ye.array,received:n.parsedType}),Ie;if(n.data.length<this._def.items.length)return pe(n,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&n.data.length>this._def.items.length&&(pe(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ln(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>lr.mergeArray(r,i)):lr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:Ae.ZodTuple,rest:null,...ze(t)})};class $l extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.object)return pe(n,{code:ie.invalid_type,expected:ye.object,received:n.parsedType}),Ie;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Ln(n,a,n.path,a)),value:i._parse(new Ln(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?lr.mergeObjectAsync(r,s):lr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof He?new $l({keyType:t,valueType:r,typeName:Ae.ZodRecord,...ze(n)}):new $l({keyType:cn.create(),valueType:t,typeName:Ae.ZodRecord,...ze(r)})}}class Sd extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.map)return pe(n,{code:ie.invalid_type,expected:ye.map,received:n.parsedType}),Ie;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,l],c)=>({key:s._parse(new Ln(n,a,n.path,[c,"key"])),value:o._parse(new Ln(n,l,n.path,[c,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return Ie;(c.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(c.value,f.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return Ie;(c.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(c.value,f.value)}return{status:r.value,value:a}}}}Sd.create=(e,t,r)=>new Sd({valueType:t,keyType:e,typeName:Ae.ZodMap,...ze(r)});class Bo extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.set)return pe(n,{code:ie.invalid_type,expected:ye.set,received:n.parsedType}),Ie;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(pe(n,{code:ie.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(pe(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(l){const c=new Set;for(const f of l){if(f.status==="aborted")return Ie;f.status==="dirty"&&r.dirty(),c.add(f.value)}return{status:r.value,value:c}}const a=[...n.data.values()].map((l,c)=>o._parse(new Ln(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,r){return new Bo({...this._def,minSize:{value:t,message:Ce.toString(r)}})}max(t,r){return new Bo({...this._def,maxSize:{value:t,message:Ce.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}Bo.create=(e,t)=>new Bo({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...ze(t)});class Bi extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.function)return pe(r,{code:ie.invalid_type,expected:ye.function,received:r.parsedType}),Ie;function n(a,l){return wd({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yd(),ea].filter(c=>!!c),issueData:{code:ie.invalid_arguments,argumentsError:l}})}function s(a,l){return wd({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yd(),ea].filter(c=>!!c),issueData:{code:ie.invalid_return_type,returnTypeError:l}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ra){const a=this;return pr(async function(...l){const c=new Lr([]),f=await a._def.args.parseAsync(l,o).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(i,this,f);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw c.addIssue(s(d,p)),c})})}else{const a=this;return pr(function(...l){const c=a._def.args.safeParse(l,o);if(!c.success)throw new Lr([n(l,c.error)]);const f=Reflect.apply(i,this,c.data),d=a._def.returns.safeParse(f,o);if(!d.success)throw new Lr([s(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Bi({...this._def,args:Fn.create(t).rest(Do.create())})}returns(t){return new Bi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Bi({args:t||Fn.create([]).rest(Do.create()),returns:r||Do.create(),typeName:Ae.ZodFunction,...ze(n)})}}class Vl extends He{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Vl.create=(e,t)=>new Vl({getter:e,typeName:Ae.ZodLazy,...ze(t)});class Wl extends He{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return pe(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:t.data}}get value(){return this._def.value}}Wl.create=(e,t)=>new Wl({value:e,typeName:Ae.ZodLiteral,...ze(t)});function HC(e,t){return new ao({values:e,typeName:Ae.ZodEnum,...ze(t)})}class ao extends He{constructor(){super(...arguments),Va.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return pe(r,{expected:rt.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Ie}if(xd(this,Va)||$C(this,Va,new Set(this._def.values)),!xd(this,Va).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return pe(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Ie}return pr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return ao.create(t,{...this._def,...r})}exclude(t,r=this._def){return ao.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}Va=new WeakMap;ao.create=HC;class Bl extends He{constructor(){super(...arguments),Wa.set(this,void 0)}_parse(t){const r=rt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ye.string&&n.parsedType!==ye.number){const s=rt.objectValues(r);return pe(n,{expected:rt.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Ie}if(xd(this,Wa)||$C(this,Wa,new Set(rt.getValidEnumValues(this._def.values))),!xd(this,Wa).has(t.data)){const s=rt.objectValues(r);return pe(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Ie}return pr(t.data)}get enum(){return this._def.values}}Wa=new WeakMap;Bl.create=(e,t)=>new Bl({values:e,typeName:Ae.ZodNativeEnum,...ze(t)});class ra extends He{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.promise&&r.common.async===!1)return pe(r,{code:ie.invalid_type,expected:ye.promise,received:r.parsedType}),Ie;const n=r.parsedType===ye.promise?r.data:Promise.resolve(r.data);return pr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ra.create=(e,t)=>new ra({type:e,typeName:Ae.ZodPromise,...ze(t)});class yn extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{pe(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Ie;const l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Ie:l.status==="dirty"||r.value==="dirty"?Pi(l.value):l});{if(r.value==="aborted")return Ie;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Ie:a.status==="dirty"||r.value==="dirty"?Pi(a.value):a}}if(s.type==="refinement"){const i=a=>{const l=s.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ie:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Ie:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Al(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:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Al(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);rt.assertNever(s)}}yn.create=(e,t,r)=>new yn({schema:e,typeName:Ae.ZodEffects,effect:t,...ze(r)});yn.createWithPreprocess=(e,t,r)=>new yn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...ze(r)});class An extends He{_parse(t){return this._getType(t)===ye.undefined?pr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Ae.ZodOptional,...ze(t)});class lo extends He{_parse(t){return this._getType(t)===ye.null?pr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}lo.create=(e,t)=>new lo({innerType:e,typeName:Ae.ZodNullable,...ze(t)});class Hl extends He{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===ye.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ze(t)});class Yl extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ml(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Lr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Lr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Yl.create=(e,t)=>new Yl({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ze(t)});class kd extends He{_parse(t){if(this._getType(t)!==ye.nan){const n=this._getOrReturnCtx(t);return pe(n,{code:ie.invalid_type,expected:ye.nan,received:n.parsedType}),Ie}return{status:"valid",value:t.data}}}kd.create=e=>new kd({typeName:Ae.ZodNaN,...ze(e)});const lz=Symbol("zod_brand");class Dv extends He{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class mc extends He{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ie:o.status==="dirty"?(r.dirty(),Pi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ie:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new mc({in:t,out:r,typeName:Ae.ZodPipeline})}}class Zl extends He{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Al(s)&&(s.value=Object.freeze(s.value)),s);return Ml(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Ae.ZodReadonly,...ze(t)});function YC(e,t={},r){return e?ta.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,l=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,c=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...c,fatal:l})}}):ta.create()}const cz={object:Tt.lazycreate};var Ae;(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"})(Ae||(Ae={}));const uz=(e,t={message:`Input not instance of ${e.name}`})=>YC(r=>r instanceof e,t),ZC=cn.create,GC=oo.create,dz=kd.create,fz=io.create,KC=Il.create,hz=Wo.create,pz=_d.create,mz=Ll.create,gz=Fl.create,vz=ta.create,yz=Do.create,wz=ys.create,xz=bd.create,_z=fn.create,bz=Tt.create,Sz=Tt.strictCreate,kz=zl.create,Cz=Nf.create,Ez=Ul.create,Tz=Fn.create,Rz=$l.create,Nz=Sd.create,Pz=Bo.create,jz=Bi.create,Dz=Vl.create,Oz=Wl.create,Az=ao.create,Mz=Bl.create,Iz=ra.create,yw=yn.create,Lz=An.create,Fz=lo.create,zz=yn.createWithPreprocess,Uz=mc.create,$z=()=>ZC().optional(),Vz=()=>GC().optional(),Wz=()=>KC().optional(),Bz={string:e=>cn.create({...e,coerce:!0}),number:e=>oo.create({...e,coerce:!0}),boolean:e=>Il.create({...e,coerce:!0}),bigint:e=>io.create({...e,coerce:!0}),date:e=>Wo.create({...e,coerce:!0})},Hz=Ie;var Fe=Object.freeze({__proto__:null,defaultErrorMap:ea,setErrorMap:H5,getErrorMap:yd,makeIssue:wd,EMPTY_PATH:Y5,addIssueToContext:pe,ParseStatus:lr,INVALID:Ie,DIRTY:Pi,OK:pr,isAborted:nm,isDirty:sm,isValid:Al,isAsync:Ml,get util(){return rt},get objectUtil(){return rm},ZodParsedType:ye,getParsedType:zs,ZodType:He,datetimeRegex:BC,ZodString:cn,ZodNumber:oo,ZodBigInt:io,ZodBoolean:Il,ZodDate:Wo,ZodSymbol:_d,ZodUndefined:Ll,ZodNull:Fl,ZodAny:ta,ZodUnknown:Do,ZodNever:ys,ZodVoid:bd,ZodArray:fn,ZodObject:Tt,ZodUnion:zl,ZodDiscriminatedUnion:Nf,ZodIntersection:Ul,ZodTuple:Fn,ZodRecord:$l,ZodMap:Sd,ZodSet:Bo,ZodFunction:Bi,ZodLazy:Vl,ZodLiteral:Wl,ZodEnum:ao,ZodNativeEnum:Bl,ZodPromise:ra,ZodEffects:yn,ZodTransformer:yn,ZodOptional:An,ZodNullable:lo,ZodDefault:Hl,ZodCatch:Yl,ZodNaN:kd,BRAND:lz,ZodBranded:Dv,ZodPipeline:mc,ZodReadonly:Zl,custom:YC,Schema:He,ZodSchema:He,late:cz,get ZodFirstPartyTypeKind(){return Ae},coerce:Bz,any:vz,array:_z,bigint:fz,boolean:KC,date:hz,discriminatedUnion:Cz,effect:yw,enum:Az,function:jz,instanceof:uz,intersection:Ez,lazy:Dz,literal:Oz,map:Nz,nan:dz,nativeEnum:Mz,never:wz,null:gz,nullable:Fz,number:GC,object:bz,oboolean:Wz,onumber:Vz,optional:Lz,ostring:$z,pipeline:Uz,preprocess:zz,promise:Iz,record:Rz,set:Pz,strictObject:Sz,string:ZC,symbol:pz,transformer:yw,tuple:Tz,undefined:mz,union:kz,unknown:yz,void:xz,NEVER:Hz,ZodIssueCode:ie,quotelessJson:B5,ZodError:Lr}),Yz="Label",qC=y.forwardRef((e,t)=>u.jsx(De.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));qC.displayName=Yz;var XC=qC;const Zz=Jl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Cd=y.forwardRef(({className:e,...t},r)=>u.jsx(XC,{ref:r,className:we(Zz(),e),...t}));Cd.displayName=XC.displayName;const ei=E5,QC=y.createContext({}),tt=({...e})=>u.jsx(QC.Provider,{value:{name:e.name},children:u.jsx(P5,{...e})}),Pf=()=>{const e=y.useContext(QC),t=y.useContext(JC),{getFieldState:r,formState:n}=Rf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");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}},JC=y.createContext({}),Ke=y.forwardRef(({className:e,...t},r)=>{const n=y.useId();return u.jsx(JC.Provider,{value:{id:n},children:u.jsx("div",{ref:r,className:we("space-y-2",e),...t})})});Ke.displayName="FormItem";const qe=y.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Pf();return u.jsx(Cd,{ref:r,className:we(n&&"text-destructive",e),htmlFor:s,...t})});qe.displayName="FormLabel";const Xe=y.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Pf();return u.jsx(hs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Xe.displayName="FormControl";const Gz=y.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Pf();return u.jsx("p",{ref:r,id:n,className:we("text-sm text-muted-foreground",e),...t})});Gz.displayName="FormDescription";const Ze=y.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Pf(),i=s?String(s==null?void 0:s.message):t;return i?u.jsx("p",{ref:n,id:o,className:we("text-sm font-medium text-destructive",e),...r,children:i}):null});Ze.displayName="FormMessage";function im(e,[t,r]){return Math.min(r,Math.max(t,e))}var Kz=[" ","Enter","ArrowUp","ArrowDown"],qz=[" ","Enter"],gc="Select",[jf,Df,Xz]=qd(gc),[ya,_U]=Er(gc,[Xz,ha]),Of=ha(),[Qz,mo]=ya(gc),[Jz,e6]=ya(gc),eE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:d,disabled:h,required:p}=e,w=Of(t),[m,x]=y.useState(null),[g,v]=y.useState(null),[_,C]=y.useState(!1),E=ec(c),[T=!1,P]=ps({prop:n,defaultProp:s,onChange:o}),[O,j]=ps({prop:i,defaultProp:a,onChange:l}),L=y.useRef(null),q=m?!!m.closest("form"):!0,[R,F]=y.useState(new Set),b=Array.from(R).map(V=>V.props.value).join(";");return u.jsx(Ng,{...w,children:u.jsxs(Qz,{required:p,scope:t,trigger:m,onTriggerChange:x,valueNode:g,onValueNodeChange:v,valueNodeHasChildren:_,onValueNodeHasChildrenChange:C,contentId:On(),value:O,onValueChange:j,open:T,onOpenChange:P,dir:E,triggerPointerDownPosRef:L,disabled:h,children:[u.jsx(jf.Provider,{scope:t,children:u.jsx(Jz,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:y.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?u.jsxs(EE,{"aria-hidden":!0,required:p,tabIndex:-1,name:f,autoComplete:d,value:O,onChange:V=>j(V.target.value),disabled:h,children:[O===void 0?u.jsx("option",{value:""}):null,Array.from(R)]},b):null]})})};eE.displayName=gc;var tE="SelectTrigger",rE=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Of(r),i=mo(tE,r),a=i.disabled||n,l=Ue(t,i.onTriggerChange),c=Df(r),[f,d,h]=TE(w=>{const m=c().filter(v=>!v.disabled),x=m.find(v=>v.value===i.value),g=RE(m,w,x);g!==void 0&&i.onValueChange(g.value)}),p=()=>{a||(i.onOpenChange(!0),h())};return u.jsx(Pg,{asChild:!0,...o,children:u.jsx(De.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":CE(i.value)?"":void 0,...s,ref:l,onClick:le(s.onClick,w=>{w.currentTarget.focus()}),onPointerDown:le(s.onPointerDown,w=>{const m=w.target;m.hasPointerCapture(w.pointerId)&&m.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&(p(),i.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)},w.preventDefault())}),onKeyDown:le(s.onKeyDown,w=>{const m=f.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&d(w.key),!(m&&w.key===" ")&&Kz.includes(w.key)&&(p(),w.preventDefault())})})})});rE.displayName=tE;var nE="SelectValue",sE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,l=mo(nE,r),{onValueNodeHasChildrenChange:c}=l,f=o!==void 0,d=Ue(t,l.onValueNodeChange);return rr(()=>{c(f)},[c,f]),u.jsx(De.span,{...a,ref:d,style:{pointerEvents:"none"},children:CE(l.value)?u.jsx(u.Fragment,{children:i}):o})});sE.displayName=nE;var t6="SelectIcon",oE=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return u.jsx(De.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});oE.displayName=t6;var r6="SelectPortal",iE=e=>u.jsx(rc,{asChild:!0,...e});iE.displayName=r6;var Ho="SelectContent",aE=y.forwardRef((e,t)=>{const r=mo(Ho,e.__scopeSelect),[n,s]=y.useState();if(rr(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?xs.createPortal(u.jsx(lE,{scope:e.__scopeSelect,children:u.jsx(jf.Slot,{scope:e.__scopeSelect,children:u.jsx("div",{children:e.children})})}),o):null}return u.jsx(cE,{...e,ref:t})});aE.displayName=Ho;var Jn=10,[lE,go]=ya(Ho),n6="SelectContentImpl",cE=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:w,hideWhenDetached:m,avoidCollisions:x,...g}=e,v=mo(Ho,r),[_,C]=y.useState(null),[E,T]=y.useState(null),P=Ue(t,fe=>C(fe)),[O,j]=y.useState(null),[L,q]=y.useState(null),R=Df(r),[F,b]=y.useState(!1),V=y.useRef(!1);y.useEffect(()=>{if(_)return Og(_)},[_]),wg();const te=y.useCallback(fe=>{const[ge,...be]=R().map(Se=>Se.ref.current),[Pe]=be.slice(-1),Te=document.activeElement;for(const Se of fe)if(Se===Te||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ge&&E&&(E.scrollTop=0),Se===Pe&&E&&(E.scrollTop=E.scrollHeight),Se==null||Se.focus(),document.activeElement!==Te))return},[R,E]),W=y.useCallback(()=>te([O,_]),[te,O,_]);y.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=v;y.useEffect(()=>{if(_){let fe={x:0,y:0};const ge=Pe=>{var Te,Se;fe={x:Math.abs(Math.round(Pe.pageX)-(((Te=I.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(Pe.pageY)-(((Se=I.current)==null?void 0:Se.y)??0))}},be=Pe=>{fe.x<=10&&fe.y<=10?Pe.preventDefault():_.contains(Pe.target)||Z(!1),document.removeEventListener("pointermove",ge),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",be,{capture:!0})}}},[_,Z,I]),y.useEffect(()=>{const fe=()=>Z(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[Z]);const[Q,z]=TE(fe=>{const ge=R().filter(Te=>!Te.disabled),be=ge.find(Te=>Te.ref.current===document.activeElement),Pe=RE(ge,fe,be);Pe&&setTimeout(()=>Pe.ref.current.focus())}),$=y.useCallback((fe,ge,be)=>{const Pe=!V.current&&!be;(v.value!==void 0&&v.value===ge||Pe)&&(j(fe),Pe&&(V.current=!0))},[v.value]),de=y.useCallback(()=>_==null?void 0:_.focus(),[_]),ne=y.useCallback((fe,ge,be)=>{const Pe=!V.current&&!be;(v.value!==void 0&&v.value===ge||Pe)&&q(fe)},[v.value]),se=n==="popper"?am:uE,Ee=se===am?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:w,hideWhenDetached:m,avoidCollisions:x}:{};return u.jsx(lE,{scope:r,content:_,viewport:E,onViewportChange:T,itemRefCallback:$,selectedItem:O,onItemLeave:de,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:u.jsx(nf,{as:hs,allowPinchZoom:!0,children:u.jsx(Xd,{asChild:!0,trapped:v.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:le(s,fe=>{var ge;(ge=v.trigger)==null||ge.focus({preventScroll:!0}),fe.preventDefault()}),children:u.jsx(ua,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:u.jsx(se,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:fe=>fe.preventDefault(),...g,...Ee,onPlaced:()=>b(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:le(g.onKeyDown,fe=>{const ge=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!ge&&fe.key.length===1&&z(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let Pe=R().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(Pe=Pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Te=fe.target,Se=Pe.indexOf(Te);Pe=Pe.slice(Se+1)}setTimeout(()=>te(Pe)),fe.preventDefault()}})})})})})})});cE.displayName=n6;var s6="SelectItemAlignedPosition",uE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=mo(Ho,r),i=go(Ho,r),[a,l]=y.useState(null),[c,f]=y.useState(null),d=Ue(t,P=>f(P)),h=Df(r),p=y.useRef(!1),w=y.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:g,focusSelectedItem:v}=i,_=y.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&m&&x&&g){const P=o.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),L=g.getBoundingClientRect();if(o.dir!=="rtl"){const Te=L.left-O.left,Se=j.left-Te,et=P.left-Se,k=P.width+et,J=Math.max(k,O.width),G=window.innerWidth-Jn,D=im(Se,[Jn,G-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Te=O.right-L.right,Se=window.innerWidth-j.right-Te,et=window.innerWidth-P.right-Se,k=P.width+et,J=Math.max(k,O.width),G=window.innerWidth-Jn,D=im(Se,[Jn,G-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=h(),R=window.innerHeight-Jn*2,F=m.scrollHeight,b=window.getComputedStyle(c),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(x.offsetHeight*5,I),z=window.getComputedStyle(m),$=parseInt(z.paddingTop,10),de=parseInt(z.paddingBottom,10),ne=P.top+P.height/2-Jn,se=R-ne,Ee=x.offsetHeight/2,fe=x.offsetTop+Ee,ge=V+te+fe,be=I-ge;if(ge<=ne){const Te=x===q[q.length-1].ref.current;a.style.bottom="0px";const Se=c.clientHeight-m.offsetTop-m.offsetHeight,et=Math.max(se,Ee+(Te?de:0)+Se+W),k=ge+et;a.style.height=k+"px"}else{const Te=x===q[0].ref.current;a.style.top="0px";const et=Math.max(ne,V+m.offsetTop+(Te?$:0)+Ee)+be;a.style.height=et+"px",m.scrollTop=ge-ne+m.offsetTop}a.style.margin=`${Jn}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=R+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,a,c,m,x,g,o.dir,n]);rr(()=>_(),[_]);const[C,E]=y.useState();rr(()=>{c&&E(window.getComputedStyle(c).zIndex)},[c]);const T=y.useCallback(P=>{P&&w.current===!0&&(_(),v==null||v(),w.current=!1)},[_,v]);return u.jsx(i6,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:u.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:u.jsx(De.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});uE.displayName=s6;var o6="SelectPopperPosition",am=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Jn,...o}=e,i=Of(r);return u.jsx(jg,{...i,...o,ref:t,align:n,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)"}})});am.displayName=o6;var[i6,Ov]=ya(Ho,{}),lm="SelectViewport",dE=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=go(lm,r),i=Ov(lm,r),a=Ue(t,o.onViewportChange),l=y.useRef(0);return u.jsxs(u.Fragment,{children:[u.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:n}),u.jsx(jf.Slot,{scope:r,children:u.jsx(De.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:le(s.onScroll,c=>{const f=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&d){const p=Math.abs(l.current-f.scrollTop);if(p>0){const w=window.innerHeight-Jn*2,m=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),g=Math.max(m,x);if(g<w){const v=g+p,_=Math.min(w,v),C=v-_;d.style.height=_+"px",d.style.bottom==="0px"&&(f.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});dE.displayName=lm;var fE="SelectGroup",[a6,l6]=ya(fE),hE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=On();return u.jsx(a6,{scope:r,id:s,children:u.jsx(De.div,{role:"group","aria-labelledby":s,...n,ref:t})})});hE.displayName=fE;var pE="SelectLabel",mE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=l6(pE,r);return u.jsx(De.div,{id:s.id,...n,ref:t})});mE.displayName=pE;var Ed="SelectItem",[c6,gE]=ya(Ed),vE=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=mo(Ed,r),l=go(Ed,r),c=a.value===n,[f,d]=y.useState(o??""),[h,p]=y.useState(!1),w=Ue(t,g=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,g,n,s)}),m=On(),x=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u.jsx(c6,{scope:r,value:n,disabled:s,textId:m,isSelected:c,onItemTextChange:y.useCallback(g=>{d(v=>v||((g==null?void 0:g.textContent)??"").trim())},[]),children:u.jsx(jf.ItemSlot,{scope:r,value:n,disabled:s,textValue:f,children:u.jsx(De.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:w,onFocus:le(i.onFocus,()=>p(!0)),onBlur:le(i.onBlur,()=>p(!1)),onPointerUp:le(i.onPointerUp,x),onPointerMove:le(i.onPointerMove,g=>{var v;s?(v=l.onItemLeave)==null||v.call(l):g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:le(i.onPointerLeave,g=>{var v;g.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:le(i.onKeyDown,g=>{var _;((_=l.searchRef)==null?void 0:_.current)!==""&&g.key===" "||(qz.includes(g.key)&&x(),g.key===" "&&g.preventDefault())})})})})});vE.displayName=Ed;var Ba="SelectItemText",yE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=mo(Ba,r),a=go(Ba,r),l=gE(Ba,r),c=e6(Ba,r),[f,d]=y.useState(null),h=Ue(t,g=>d(g),l.onItemTextChange,g=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,g,l.value,l.disabled)}),p=f==null?void 0:f.textContent,w=y.useMemo(()=>u.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=c;return rr(()=>(m(w),()=>x(w)),[m,x,w]),u.jsxs(u.Fragment,{children:[u.jsx(De.span,{id:l.textId,...o,ref:h}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?xs.createPortal(o.children,i.valueNode):null]})});yE.displayName=Ba;var wE="SelectItemIndicator",xE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return gE(wE,r).isSelected?u.jsx(De.span,{"aria-hidden":!0,...n,ref:t}):null});xE.displayName=wE;var cm="SelectScrollUpButton",_E=y.forwardRef((e,t)=>{const r=go(cm,e.__scopeSelect),n=Ov(cm,e.__scopeSelect),[s,o]=y.useState(!1),i=Ue(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const c=l.scrollTop>0;o(c)};const l=r.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?u.jsx(SE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=r;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_E.displayName=cm;var um="SelectScrollDownButton",bE=y.forwardRef((e,t)=>{const r=go(um,e.__scopeSelect),n=Ov(um,e.__scopeSelect),[s,o]=y.useState(!1),i=Ue(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<c;o(f)};const l=r.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?u.jsx(SE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=r;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});bE.displayName=um;var SE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=go("SelectScrollButton",r),i=y.useRef(null),a=Df(r),l=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),rr(()=>{var f;const c=a().find(d=>d.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),u.jsx(De.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:le(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:le(s.onPointerMove,()=>{var c;(c=o.onItemLeave)==null||c.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:le(s.onPointerLeave,()=>{l()})})}),u6="SelectSeparator",kE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return u.jsx(De.div,{"aria-hidden":!0,...n,ref:t})});kE.displayName=u6;var dm="SelectArrow",d6=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Of(r),o=mo(dm,r),i=go(dm,r);return o.open&&i.position==="popper"?u.jsx(Dg,{...s,...n,ref:t}):null});d6.displayName=dm;function CE(e){return e===""||e===void 0}var EE=y.forwardRef((e,t)=>{const{value:r,...n}=e,s=y.useRef(null),o=Ue(t,s),i=wv(r);return y.useEffect(()=>{const a=s.current,l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==r&&f){const d=new Event("change",{bubbles:!0});f.call(a,r),a.dispatchEvent(d)}},[i,r]),u.jsx(hc,{asChild:!0,children:u.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function TE(e){const t=jt(e),r=y.useRef(""),n=y.useRef(0),s=y.useCallback(i=>{const a=r.current+i;t(a),function l(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),o=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function RE(e,t,r){const s=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=f6(e,Math.max(o,0));s.length===1&&(i=i.filter(c=>c!==r));const l=i.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}function f6(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var h6=eE,NE=rE,p6=sE,m6=oE,g6=iE,PE=aE,v6=dE,y6=hE,jE=mE,DE=vE,w6=yE,x6=xE,OE=_E,AE=bE,ME=kE;const Ah=h6,Mh=y6,Ih=p6,ku=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(NE,{ref:n,className:we("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),...r,children:[t,u.jsx(m6,{asChild:!0,children:u.jsx(e1,{className:"h-4 w-4 opacity-50"})})]}));ku.displayName=NE.displayName;const IE=y.forwardRef(({className:e,...t},r)=>u.jsx(OE,{ref:r,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(UP,{className:"h-4 w-4"})}));IE.displayName=OE.displayName;const LE=y.forwardRef(({className:e,...t},r)=>u.jsx(AE,{ref:r,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(e1,{className:"h-4 w-4"})}));LE.displayName=AE.displayName;const Cu=y.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>u.jsx(g6,{children:u.jsxs(PE,{ref:s,className:we("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",r==="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:r,...n,children:[u.jsx(IE,{}),u.jsx(v6,{className:we("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(LE,{})]})}));Cu.displayName=PE.displayName;const Eu=y.forwardRef(({className:e,...t},r)=>u.jsx(jE,{ref:r,className:we("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Eu.displayName=jE.displayName;const Tu=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(DE,{ref:n,className:we("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),...r,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(x6,{children:u.jsx(J_,{className:"h-4 w-4"})})}),u.jsx(w6,{children:t})]}));Tu.displayName=DE.displayName;const _6=y.forwardRef(({className:e,...t},r)=>u.jsx(ME,{ref:r,className:we("-mx-1 my-1 h-px bg-muted",e),...t}));_6.displayName=ME.displayName;const fm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),b6=Array.from(fm.keys()),S6=Yg,k6=Zg,C6=Gg,FE=y.forwardRef(({className:e,...t},r)=>u.jsx(oc,{ref:r,className:we("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}));FE.displayName=oc.displayName;const zE=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(C6,{children:[u.jsx(FE,{}),u.jsxs(ic,{ref:n,className:we("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),...r,children:[t,u.jsxs(af,{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:[u.jsx(pg,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zE.displayName=ic.displayName;const UE=({className:e,...t})=>u.jsx("div",{className:we("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});UE.displayName="DialogHeader";const $E=y.forwardRef(({className:e,...t},r)=>u.jsx(ac,{ref:r,className:we("text-lg font-semibold leading-none tracking-tight",e),...t}));$E.displayName=ac.displayName;const E6=y.forwardRef(({className:e,...t},r)=>u.jsx(lc,{ref:r,className:we("text-sm text-muted-foreground",e),...t}));E6.displayName=lc.displayName;const Oo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),Af=Fe.union([Fe.literal("aliyun"),Fe.literal("tencent"),Fe.literal("ssh"),Fe.literal("webhook")],{message:"请选择云服务商"}),T6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,secretId:Fe.string().min(1).max(64),secretKey:Fe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async l=>{const c={id:l.id,name:l.name,configType:l.configType,config:{secretId:l.secretId,secretKey:l.secretKey}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})})}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"secretId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SecretId"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入SecretId",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"secretKey",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SecretKey"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入SecretKey",...l})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})},R6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,accessKeyId:Fe.string().min(1).max(64),accessSecretId:Fe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async l=>{const c={id:l.id,name:l.name,configType:l.configType,config:{accessKeyId:l.accessKeyId,accessKeySecret:l.accessSecretId}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})});return}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"accessKeyId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"AccessKeyId"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入AccessKeyId",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"accessSecretId",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"AccessKeySecret"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入AccessKeySecret",...l})}),u.jsx(Ze,{})]})}),u.jsx(Ze,{}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})};var Av="Radio",[N6,VE]=Er(Av),[P6,j6]=N6(Av),WE=y.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:o,disabled:i,value:a="on",onCheck:l,...c}=e,[f,d]=y.useState(null),h=Ue(t,m=>d(m)),p=y.useRef(!1),w=f?!!f.closest("form"):!0;return u.jsxs(P6,{scope:r,checked:s,disabled:i,children:[u.jsx(De.button,{type:"button",role:"radio","aria-checked":s,"data-state":YE(s),"data-disabled":i?"":void 0,disabled:i,value:a,...c,ref:h,onClick:le(e.onClick,m=>{s||l==null||l(),w&&(p.current=m.isPropagationStopped(),p.current||m.stopPropagation())})}),w&&u.jsx(D6,{control:f,bubbles:!p.current,name:n,value:a,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});WE.displayName=Av;var BE="RadioIndicator",HE=y.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...s}=e,o=j6(BE,r);return u.jsx(vr,{present:n||o.checked,children:u.jsx(De.span,{"data-state":YE(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});HE.displayName=BE;var D6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=y.useRef(null),i=wv(r),a=Eg(t);return y.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==r&&d){const h=new Event("click",{bubbles:n});d.call(l,r),l.dispatchEvent(h)}},[i,r,n]),u.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function YE(e){return e?"checked":"unchecked"}var O6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mv="RadioGroup",[A6,bU]=Er(Mv,[tf,VE]),ZE=tf(),GE=VE(),[M6,I6]=A6(Mv),KE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:o,required:i=!1,disabled:a=!1,orientation:l,dir:c,loop:f=!0,onValueChange:d,...h}=e,p=ZE(r),w=ec(c),[m,x]=ps({prop:o,defaultProp:s,onChange:d});return u.jsx(M6,{scope:r,name:n,required:i,disabled:a,value:m,onValueChange:x,children:u.jsx(z1,{asChild:!0,...p,orientation:l,dir:w,loop:f,children:u.jsx(De.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":a?"":void 0,dir:w,...h,ref:t})})})});KE.displayName=Mv;var qE="RadioGroupItem",XE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...s}=e,o=I6(qE,r),i=o.disabled||n,a=ZE(r),l=GE(r),c=y.useRef(null),f=Ue(t,c),d=o.value===s.value,h=y.useRef(!1);return y.useEffect(()=>{const p=m=>{O6.includes(m.key)&&(h.current=!0)},w=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",w)}},[]),u.jsx(U1,{asChild:!0,...a,focusable:!i,active:d,children:u.jsx(WE,{disabled:i,required:o.required,checked:d,...l,...s,name:o.name,ref:f,onCheck:()=>o.onValueChange(s.value),onKeyDown:le(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:le(s.onFocus,()=>{var p;h.current&&((p=c.current)==null||p.click())})})})});XE.displayName=qE;var L6="RadioGroupIndicator",QE=y.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,s=GE(r);return u.jsx(HE,{...s,...n,ref:t})});QE.displayName=L6;var JE=KE,eT=XE,F6=QE;const tT=y.forwardRef(({className:e,...t},r)=>u.jsx(JE,{className:we("grid gap-2",e),...t,ref:r}));tT.displayName=JE.displayName;const rT=y.forwardRef(({className:e,...t},r)=>u.jsx(eT,{ref:r,className:we("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:u.jsx(F6,{className:"flex items-center justify-center",children:u.jsx(n1,{className:"h-2.5 w-2.5 fill-current text-current"})})}));rT.displayName=eT.displayName;const nT=y.forwardRef(({className:e,...t},r)=>u.jsx("textarea",{className:we("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:r,...t}));nT.displayName="Textarea";const z6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,host:Fe.string().ip({message:"请输入合法的IP地址"}),port:Fe.string().min(1).max(5),username:Fe.string().min(1).max(64),password:Fe.string().min(0).max(64),key:Fe.string().min(0).max(20480),keyFile:Fe.string().optional(),command:Fe.string().min(1).max(2048),certPath:Fe.string().min(0).max(2048),keyPath:Fe.string().min(0).max(2048)});let o={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",host:o.host,port:o.port,username:o.username,password:o.password,key:o.key,keyFile:o.keyFile,certPath:o.certPath,keyPath:o.keyPath,command:o.command}}),a=async c=>{console.log(c);const f={id:c.id,name:c.name,configType:c.configType,config:{host:c.host,port:c.port,username:c.username,password:c.password,key:c.key,command:c.command,certPath:c.certPath,keyPath:c.keyPath}};try{const d=await wf(f);if(t(),f.id=d.id,f.created=d.created,f.updated=d.updated,c.id){n(f);return}r(f)}catch(d){Object.entries(d.response.data).forEach(([p,w])=>{i.setError(p,{type:"manual",message:w.message})});return}},l=async c=>{var h;const f=(h=c.target.files)==null?void 0:h[0];if(!f)return;const d=await m5(f);i.setValue("key",d),i.setValue("keyFile","")};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-3",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:c})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:c})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...c})}),u.jsx(Ze,{})]})}),u.jsxs("div",{className:"flex space-x-2",children:[u.jsx(tt,{control:i.control,name:"host",render:({field:c})=>u.jsxs(Ke,{className:"grow",children:[u.jsx(qe,{children:"服务器IP"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Host",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"port",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"SSH端口"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Port",...c,type:"number"})}),u.jsx(Ze,{})]})})]}),u.jsx(tt,{control:i.control,name:"username",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"用户名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入用户名",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"password",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入密码",...c,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"key",render:({field:c})=>u.jsxs(Ke,{hidden:!0,children:[u.jsx(qe,{children:"Key(使用证书登录)"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Key",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"keyFile",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Key(使用证书登录)"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Key",...c,type:"file",onChange:l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"certPath",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"证书上传路径"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入证书上传路径",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"keyPath",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"私钥上传路径"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入私钥上传路径",...c})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"command",render:({field:c})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Command"}),u.jsx(Xe,{children:u.jsx(nT,{placeholder:"请输入要执行的命令",...c})}),u.jsx(Ze,{})]})}),u.jsx(Ze,{}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})},U6=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=va(),s=Fe.object({id:Fe.string().optional(),name:Fe.string().min(1).max(64),configType:Af,url:Fe.string().url()});let o={url:""};e&&(o=e.config);const i=Qo({resolver:Jo(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async l=>{console.log(l);const c={id:l.id,name:l.name,configType:l.configType,config:{url:l.url}};try{const f=await wf(c);if(t(),c.id=f.id,c.created=f.created,c.updated=f.updated,l.id){n(c);return}r(c)}catch(f){Object.entries(f.response.data).forEach(([h,p])=>{i.setError(h,{type:"manual",message:p.message})})}};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...i,children:u.jsxs("form",{onSubmit:l=>{console.log(l),l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[u.jsx(tt,{control:i.control,name:"name",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"名称"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入授权名称",...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"id",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>u.jsxs(Ke,{className:"hidden",children:[u.jsx(qe,{children:"配置类型"}),u.jsx(Xe,{children:u.jsx(it,{...l})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:i.control,name:"url",render:({field:l})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"Webhook Url"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入Webhook Url",...l})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})})};function sl({trigger:e,op:t,data:r,className:n}){const[s,o]=y.useState(!1),i=Array.from(Oo.keys()),[a,l]=y.useState((r==null?void 0:r.configType)||"");let c=u.jsx(u.Fragment,{children:" "});switch(a){case"tencent":c=u.jsx(T6,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":c=u.jsx(R6,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":c=u.jsx(z6,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":c=u.jsx(U6,{data:r,onAfterReq:()=>{o(!1)}})}const f=d=>d==a?"border-primary":"";return u.jsxs(S6,{onOpenChange:o,open:s,children:[u.jsx(k6,{asChild:!0,className:we(n),children:e}),u.jsxs(zE,{className:"sm:max-w-[600px] w-full",children:[u.jsx(UE,{children:u.jsxs($E,{children:[t=="add"?"添加":"编辑","授权"]})}),u.jsxs("div",{className:"container",children:[u.jsx(Cd,{children:"服务商"}),u.jsx(tT,{value:a,className:"flex mt-3 space-x-2",onValueChange:d=>{console.log(d),l(d)},children:i.map(d=>{var h,p;return u.jsx("div",{className:"flex items-center space-x-2",children:u.jsxs(Cd,{children:[u.jsx(rT,{value:d,hidden:!0}),u.jsxs("div",{className:we("flex items-center space-x-2 border p-2 rounded cursor-pointer",f(d)),children:[u.jsx("img",{src:(h=Oo.get(d))==null?void 0:h[1],className:"h-6"}),u.jsx("div",{children:(p=Oo.get(d))==null?void 0:p[0]})]})]})},d)})}),c]})]})]})}const $6=()=>{const{config:{accesses:e}}=va(),[t,r]=y.useState(),n=po();y.useEffect(()=>{const p=new URLSearchParams(n.search).get("id");p&&(async()=>{const m=await w5(p);r(m)})()},[n.search]);const s=Fe.object({id:Fe.string().optional(),domain:Fe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),access:Fe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:Fe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择部署服务商配置"}),targetType:Fe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"})}),o=Qo({resolver:Jo(s),defaultValues:{id:"",domain:"",access:"",targetAccess:"",targetType:""}});y.useEffect(()=>{t&&o.reset({id:t.id,domain:t.domain,access:t.access,targetAccess:t.targetAccess,targetType:t.targetType})},[t,o]);const[i,a]=y.useState(t?t.targetType:""),l=e.filter(h=>{if(i=="")return!0;const p=o.getValues().targetType.split("-");return h.configType===p[0]}),{toast:c}=bf(),f=Ss(),d=async h=>{const p={id:h.id,crontab:"0 0 * * *",domain:h.domain,access:h.access,targetAccess:h.targetAccess,targetType:h.targetType};try{await tm(p);let w="域名编辑成功";p.id==""&&(w="域名添加成功"),c({title:"成功",description:w}),f("/")}catch(w){Object.entries(w.response.data).forEach(([x,g])=>{o.setError(x,{type:"manual",message:g.message})});return}};return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"",children:[u.jsx(kv,{}),u.jsxs("div",{className:"border-b h-10 text-muted-foreground",children:[t!=null&&t.id?"编辑":"新增","域名"]}),u.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:u.jsx(ei,{...o,children:u.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-8",children:[u.jsx(tt,{control:o.control,name:"domain",render:({field:h})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"域名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"请输入域名",...h})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"access",render:({field:h})=>u.jsxs(Ke,{children:[u.jsxs(qe,{className:"flex w-full justify-between",children:[u.jsx("div",{children:"DNS 服务商授权配置"}),u.jsx(sl,{trigger:u.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[u.jsx(_0,{size:14}),"新增"]}),op:"add"})]}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,value:h.value,onValueChange:p=>{o.setValue("access",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择授权配置"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"服务商授权配置"}),e.map(p=>{var w;return u.jsx(Tu,{value:p.id,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=Oo.get(p.configType))==null?void 0:w[1]}),u.jsx("div",{children:p.name})]})},p.id)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"targetType",render:({field:h})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"部署服务类型"}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,onValueChange:p=>{a(p),o.setValue("targetType",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择部署服务类型"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"部署服务类型"}),b6.map(p=>{var w,m;return u.jsx(Tu,{value:p,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=fm.get(p))==null?void 0:w[1]}),u.jsx("div",{children:(m=fm.get(p))==null?void 0:m[0]})]})},p)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:o.control,name:"targetAccess",render:({field:h})=>u.jsxs(Ke,{children:[u.jsxs(qe,{className:"w-full flex justify-between",children:[u.jsx("div",{children:"部署服务商授权配置"}),u.jsx(sl,{trigger:u.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[u.jsx(_0,{size:14}),"新增"]}),op:"add"})]}),u.jsx(Xe,{children:u.jsxs(Ah,{...h,onValueChange:p=>{o.setValue("targetAccess",p)},children:[u.jsx(ku,{children:u.jsx(Ih,{placeholder:"请选择授权配置"})}),u.jsx(Cu,{children:u.jsxs(Mh,{children:[u.jsx(Eu,{children:"服务商授权配置"}),l.map(p=>{var w;return u.jsx(Tu,{value:p.id,children:u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx("img",{className:"w-6",src:(w=Oo.get(p.configType))==null?void 0:w[1]}),u.jsx("div",{children:p.name})]})},p.id)})]})})]})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"保存"})})]})})})]})})},V6=()=>{const{config:e,deleteAccess:t}=va(),{accesses:r}=e,n=async s=>{const o=await Z4(s);t(o.id)};return u.jsxs("div",{className:"",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),u.jsx(sl,{trigger:u.jsx(Pt,{children:"添加授权"}),op:"add"})]}),r.length===0?u.jsxs("div",{className:"flex flex-col items-center mt-10",children:[u.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:u.jsx(VP,{size:40,className:"text-primary"})}),u.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),u.jsx(sl,{trigger:u.jsx(Pt,{children:"添加授权"}),op:"add",className:"mt-3"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-48",children:"名称"}),u.jsx("div",{className:"w-48",children:"服务商"}),u.jsx("div",{className:"w-52",children:"创建时间"}),u.jsx("div",{className:"w-52",children:"更新时间"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.map(s=>{var o,i;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:s.name}),u.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[u.jsx("img",{src:(o=Oo.get(s.configType))==null?void 0:o[1],className:"w-6"}),u.jsx("div",{children:(i=Oo.get(s.configType))==null?void 0:i[0]})]}),u.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于 ",s.created&&Ol(s.created)]}),u.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于 ",s.updated&&Ol(s.updated)]}),u.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[u.jsx(sl,{trigger:u.jsx(Pt,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:s}),u.jsx(Kt,{orientation:"vertical",className:"h-4 mx-2"}),u.jsx(Pt,{variant:"link",className:"p-0",onClick:()=>{n(s)},children:"删除"})]})]},s.id)})]})]})},W6=Jl("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"}}),sT=y.forwardRef(({className:e,variant:t,...r},n)=>u.jsx("div",{ref:n,role:"alert",className:we(W6({variant:t}),e),...r}));sT.displayName="Alert";const oT=y.forwardRef(({className:e,...t},r)=>u.jsx("h5",{ref:r,className:we("mb-1 font-medium leading-none tracking-tight",e),...t}));oT.displayName="AlertTitle";const iT=y.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:we("text-sm [&_p]:leading-relaxed",e),...t}));iT.displayName="AlertDescription";function B6(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var Iv="ScrollArea",[aT,SU]=Er(Iv),[H6,en]=aT(Iv),lT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,l]=y.useState(null),[c,f]=y.useState(null),[d,h]=y.useState(null),[p,w]=y.useState(null),[m,x]=y.useState(null),[g,v]=y.useState(0),[_,C]=y.useState(0),[E,T]=y.useState(!1),[P,O]=y.useState(!1),j=Ue(t,q=>l(q)),L=ec(s);return u.jsx(H6,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:c,onViewportChange:f,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:w,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:P,onScrollbarYEnabledChange:O,onCornerWidthChange:v,onCornerHeightChange:C,children:u.jsx(De.div,{dir:L,...i,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})})});lT.displayName=Iv;var cT="ScrollAreaViewport",uT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=en(cT,r),a=y.useRef(null),l=Ue(t,a,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.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}),u.jsx(De.div,{"data-radix-scroll-area-viewport":"",...o,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});uT.displayName=cT;var $n="ScrollAreaScrollbar",Lv=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return y.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?u.jsx(Y6,{...n,ref:t,forceMount:r}):s.type==="scroll"?u.jsx(Z6,{...n,ref:t,forceMount:r}):s.type==="auto"?u.jsx(dT,{...n,ref:t,forceMount:r}):s.type==="always"?u.jsx(Fv,{...n,ref:t}):null});Lv.displayName=$n;var Y6=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),[o,i]=y.useState(!1);return y.useEffect(()=>{const a=s.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),u.jsx(vr,{present:r||o,children:u.jsx(dT,{"data-state":o?"visible":"hidden",...n,ref:t})})}),Z6=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=en($n,e.__scopeScrollArea),o=e.orientation==="horizontal",i=If(()=>l("SCROLL_END"),100),[a,l]=B6("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 y.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,s.scrollHideDelay,l]),y.useEffect(()=>{const c=s.viewport,f=o?"scrollLeft":"scrollTop";if(c){let d=c[f];const h=()=>{const p=c[f];d!==p&&(l("SCROLL"),i()),d=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[s.viewport,o,l,i]),u.jsx(vr,{present:r||a!=="hidden",children:u.jsx(Fv,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:le(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:le(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),dT=y.forwardRef((e,t)=>{const r=en($n,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=y.useState(!1),a=e.orientation==="horizontal",l=If(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,f=r.viewport.offsetHeight<r.viewport.scrollHeight;i(a?c:f)}},10);return na(r.viewport,l),na(r.content,l),u.jsx(vr,{present:n||o,children:u.jsx(Fv,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Fv=y.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=en($n,e.__scopeScrollArea),o=y.useRef(null),i=y.useRef(0),[a,l]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=gT(a.viewport,a.content),f={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function d(h,p){return J6(h,i.current,a,p)}return r==="horizontal"?u.jsx(G6,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollLeft,p=ww(h,a,s.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=d(h,s.dir))}}):r==="vertical"?u.jsx(K6,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const h=s.viewport.scrollTop,p=ww(h,a);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=d(h))}}):null}),G6=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=en($n,e.__scopeScrollArea),[i,a]=y.useState(),l=y.useRef(null),c=Ue(t,l,o.onScrollbarXChange);return y.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(hT,{"data-orientation":"horizontal",...s,ref:c,sizes:r,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":Mf(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(o.viewport){const h=o.viewport.scrollLeft+f.deltaX;e.onWheelScroll(h),yT(h,d)&&f.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Rd(i.paddingLeft),paddingEnd:Rd(i.paddingRight)}})}})}),K6=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=en($n,e.__scopeScrollArea),[i,a]=y.useState(),l=y.useRef(null),c=Ue(t,l,o.onScrollbarYChange);return y.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(hT,{"data-orientation":"vertical",...s,ref:c,sizes:r,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":Mf(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(o.viewport){const h=o.viewport.scrollTop+f.deltaY;e.onWheelScroll(h),yT(h,d)&&f.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Rd(i.paddingTop),paddingEnd:Rd(i.paddingBottom)}})}})}),[q6,fT]=aT($n),hT=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:f,onResize:d,...h}=e,p=en($n,r),[w,m]=y.useState(null),x=Ue(t,j=>m(j)),g=y.useRef(null),v=y.useRef(""),_=p.viewport,C=n.content-n.viewport,E=jt(f),T=jt(l),P=If(d,10);function O(j){if(g.current){const L=j.clientX-g.current.left,q=j.clientY-g.current.top;c({x:L,y:q})}}return y.useEffect(()=>{const j=L=>{const q=L.target;(w==null?void 0:w.contains(q))&&E(L,C)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[_,w,C,E]),y.useEffect(T,[n,T]),na(w,P),na(p.content,P),u.jsx(q6,{scope:r,scrollbar:w,hasThumb:s,onThumbChange:jt(o),onThumbPointerUp:jt(i),onThumbPositionChange:T,onThumbPointerDown:jt(a),children:u.jsx(De.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:le(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),g.current=w.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(j))}),onPointerMove:le(e.onPointerMove,O),onPointerUp:le(e.onPointerUp,j=>{const L=j.target;L.hasPointerCapture(j.pointerId)&&L.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),Td="ScrollAreaThumb",pT=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=fT(Td,e.__scopeScrollArea);return u.jsx(vr,{present:r||s.hasThumb,children:u.jsx(X6,{ref:t,...n})})}),X6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=en(Td,r),i=fT(Td,r),{onThumbPositionChange:a}=i,l=Ue(t,d=>i.onThumbChange(d)),c=y.useRef(),f=If(()=>{c.current&&(c.current(),c.current=void 0)},100);return y.useEffect(()=>{const d=o.viewport;if(d){const h=()=>{if(f(),!c.current){const p=eU(d,a);c.current=p,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[o.viewport,f,a]),u.jsx(De.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:le(e.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),w=d.clientX-p.left,m=d.clientY-p.top;i.onThumbPointerDown({x:w,y:m})}),onPointerUp:le(e.onPointerUp,i.onThumbPointerUp)})});pT.displayName=Td;var zv="ScrollAreaCorner",mT=y.forwardRef((e,t)=>{const r=en(zv,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?u.jsx(Q6,{...e,ref:t}):null});mT.displayName=zv;var Q6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=en(zv,r),[o,i]=y.useState(0),[a,l]=y.useState(0),c=!!(o&&a);return na(s.scrollbarX,()=>{var d;const f=((d=s.scrollbarX)==null?void 0:d.offsetHeight)||0;s.onCornerHeightChange(f),l(f)}),na(s.scrollbarY,()=>{var d;const f=((d=s.scrollbarY)==null?void 0:d.offsetWidth)||0;s.onCornerWidthChange(f),i(f)}),c?u.jsx(De.div,{...n,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 Rd(e){return e?parseInt(e,10):0}function gT(e,t){const r=e/t;return isNaN(r)?0:r}function Mf(e){const t=gT(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function J6(e,t,r,n="ltr"){const s=Mf(r),o=s/2,i=t||o,a=s-i,l=r.scrollbar.paddingStart+i,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,f=r.content-r.viewport,d=n==="ltr"?[0,f]:[f*-1,0];return vT([l,c],d)(e)}function ww(e,t,r="ltr"){const n=Mf(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,l=r==="ltr"?[0,i]:[i*-1,0],c=im(e,l);return vT([0,i],[0,a])(c)}function vT(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function yT(e,t){return e>0&&e<t}var eU=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function If(e,t){const r=jt(e),n=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),y.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function na(e,t){const r=jt(t);rr(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var wT=lT,tU=uT,rU=mT;const xT=y.forwardRef(({className:e,children:t,...r},n)=>u.jsxs(wT,{ref:n,className:we("relative overflow-hidden",e),...r,children:[u.jsx(tU,{className:"h-full w-full rounded-[inherit]",children:t}),u.jsx(_T,{}),u.jsx(rU,{})]}));xT.displayName=wT.displayName;const _T=y.forwardRef(({className:e,orientation:t="vertical",...r},n)=>u.jsx(Lv,{ref:n,orientation:t,className:we("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),...r,children:u.jsx(pT,{className:"relative flex-1 rounded-full bg-border"})}));_T.displayName=Lv.displayName;const nU=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await Dt().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},sU=()=>{const e=Ss(),[t,r]=y.useState(),[n]=MP(),s=n.get("domain");return y.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await nU(i);r(a.items)})()},[s]),u.jsxs(xT,{className:"h-[80vh] overflow-hidden",children:[u.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[u.jsx("div",{className:"w-48",children:"域名"}),u.jsx("div",{className:"w-24",children:"状态"}),u.jsx("div",{className:"w-56",children:"阶段"}),u.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),u.jsx("div",{className:"grow",children:"操作"})]}),u.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return u.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[u.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),u.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:o.phase==="deploy"&&o.phaseSuccess?u.jsx(t1,{size:16,className:"text-green-700"}):u.jsx(r1,{size:16,className:"text-red-700"})}),u.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:u.jsx(dk,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),u.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:Ol(o.deployedAt)}),u.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:u.jsxs(lS,{children:[u.jsx(cS,{asChild:!0,children:u.jsx(Pt,{variant:"link",className:"p-0",children:"日志"})}),u.jsxs(Kg,{className:"sm:max-w-5xl",children:[u.jsx(dS,{children:u.jsxs(fS,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),u.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&u.jsx(u.Fragment,{children:o.log.check.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),o.log.apply&&u.jsx(u.Fragment,{children:o.log.apply.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.info&&l.info.map(c=>u.jsx("div",{className:"mt-1 text-green-600",children:c})),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),o.log.deploy&&u.jsx(u.Fragment,{children:o.log.deploy.map(l=>u.jsxs("div",{className:"flex flex-col mt-2",children:[u.jsxs("div",{className:"flex",children:[u.jsxs("div",{children:["[",l.time,"]"]}),u.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&u.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))})]})]})]})})]},o.id)})]}):u.jsx(u.Fragment,{children:u.jsxs(sT,{className:"max-w-[40em] mx-auto mt-20",children:[u.jsx(oT,{children:"暂无数据"}),u.jsxs(iT,{children:[u.jsxs("div",{className:"flex items-center mt-5",children:[u.jsx("div",{children:u.jsx(BP,{className:"text-yellow-400",size:36})}),u.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),u.jsx("div",{className:"mt-2 flex justify-end",children:u.jsx(Pt,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},hm=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",oU=Fe.object({username:Fe.string().email({message:"请输入正确的邮箱地址"}),password:Fe.string().min(10,{message:"密码至少10个字符"})}),iU=()=>{const e=Qo({resolver:Jo(oU),defaultValues:{username:"",password:""}}),t=async n=>{try{await Dt().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=hm(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Ss();return u.jsxs("div",{className:"max-w-[35em] border mx-auto mt-32 p-10 rounded-md shadow-md",children:[u.jsx("div",{className:"flex justify-center mb-10",children:u.jsx("img",{src:"/vite.svg",className:"w-16"})}),u.jsx(ei,{...e,children:u.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8",children:[u.jsx(tt,{control:e.control,name:"username",render:({field:n})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"用户名"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"email",...n})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:e.control,name:"password",render:({field:n})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"shadcn",...n,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"登录"})})]})})]})},aU=()=>Dt().authStore.isValid&&Dt().authStore.isAdmin?u.jsx(X_,{to:"/"}):u.jsx("div",{className:"container",children:u.jsx(hg,{})}),lU=Fe.object({oldPassword:Fe.string().min(10,{message:"密码至少10个字符"}),newPassword:Fe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:Fe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),cU=()=>{const{toast:e}=bf(),t=Ss(),r=Qo({resolver:Jo(lU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await Dt().admins.authWithPassword((o=Dt().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const l=hm(a);r.setError("oldPassword",{message:l})}try{await Dt().admins.update((i=Dt().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),Dt().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const l=hm(a);e({title:"修改密码失败",description:l,variant:"destructive"})}};return u.jsx(u.Fragment,{children:u.jsx(ei,{...r,children:u.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8",children:[u.jsx(tt,{control:r.control,name:"oldPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"当前密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"当前密码",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:r.control,name:"newPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"新密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"newPassword",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx(tt,{control:r.control,name:"confirmPassword",render:({field:s})=>u.jsxs(Ke,{children:[u.jsx(qe,{children:"确认密码"}),u.jsx(Xe,{children:u.jsx(it,{placeholder:"confirmPassword",...s,type:"password"})}),u.jsx(Ze,{})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Pt,{type:"submit",children:"确认修改"})})]})})})},uU=()=>u.jsxs("div",{children:[u.jsx(kv,{}),u.jsx("div",{className:"text-muted-foreground border-b py-5",children:"设置密码"}),u.jsx("div",{className:"w-full sm:w-[35em] mt-10 flex flex-col p-3 mx-auto",children:u.jsx(hg,{})})]}),dU=xP([{path:"/",element:u.jsx(q4,{}),children:[{path:"/",element:u.jsx(S5,{})},{path:"/edit",element:u.jsx($6,{})},{path:"/access",element:u.jsx(V6,{})},{path:"/history",element:u.jsx(sU,{})},{path:"/setting",element:u.jsx(uU,{}),children:[{path:"/setting/password",element:u.jsx(cU,{})}]}]},{path:"/login",element:u.jsx(aU,{}),children:[{path:"/login",element:u.jsx(iU,{})}]},{path:"/about",element:u.jsx("div",{children:"About"})}]);Lh.createRoot(document.getElementById("root")).render(u.jsx(Qe.StrictMode,{children:u.jsx(NP,{router:dU})}))});export default fU(); diff --git a/ui/dist/index.html b/ui/dist/index.html index 68bc49bb..d5d941d3 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Certimate - Your Trusted SSL Automation Partner</title> - <script type="module" crossorigin src="/assets/index-B6xIlnQB.js"></script> + <script type="module" crossorigin src="/assets/index-D3t3IJ9L.js"></script> <link rel="stylesheet" crossorigin href="/assets/index-VYJgHfoP.css"> </head> <body class="bg-background"> diff --git a/ui/src/domain/deployment.ts b/ui/src/domain/deployment.ts index b854de84..ff38c041 100644 --- a/ui/src/domain/deployment.ts +++ b/ui/src/domain/deployment.ts @@ -24,6 +24,7 @@ export type Log = { time: string; message: string; error: string; + info?: string[]; }; export type DeploymentListReq = { diff --git a/ui/src/pages/DashboardLayout.tsx b/ui/src/pages/DashboardLayout.tsx index 7ec9ea2d..1b6a92bb 100644 --- a/ui/src/pages/DashboardLayout.tsx +++ b/ui/src/pages/DashboardLayout.tsx @@ -187,7 +187,7 @@ export default function Dashboard() { href="https://github.com/usual2970/certimate/releases" target="_blank" > - Certimate v0.0.7 + Certimate v0.0.8 </a> </div> </div> diff --git a/ui/src/pages/history/History.tsx b/ui/src/pages/history/History.tsx index 798d8321..83ebe6a0 100644 --- a/ui/src/pages/history/History.tsx +++ b/ui/src/pages/history/History.tsx @@ -147,6 +147,14 @@ const History = () => { <div>[{item.time}]</div> <div className="ml-2">{item.message}</div> </div> + {item.info && + item.info.map((info: string) => { + return ( + <div className="mt-1 text-green-600"> + {info} + </div> + ); + })} {item.error && ( <div className="mt-1 text-red-600"> {item.error}