@promptowl/contextnest-community 1.24.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +109 -6
- package/CONFIGURATION.md +7 -2
- package/README.md +1 -1
- package/STEWARDSHIP.md +24 -0
- package/dist/{chunk-2TPQTN4Y.js → chunk-2KHM5C7V.js} +37 -3
- package/dist/{chunk-XUIWAWDO.js → chunk-32SZCH36.js} +4 -4
- package/dist/{chunk-KIAAEHWL.js → chunk-7FROMOZM.js} +23 -5
- package/dist/{chunk-5EZOPA47.js → chunk-DTLMBF4W.js} +10 -8
- package/dist/{chunk-LA3VTQ22.js → chunk-JDAOA5KP.js} +43 -1
- package/dist/{chunk-I3CSD6CK.js → chunk-KPGNZLZL.js} +2 -2
- package/dist/{chunk-YVMSM7LS.js → chunk-LHWOJPFE.js} +7 -0
- package/dist/{chunk-ZTT4U4NE.js → chunk-TI7HMP64.js} +99 -12
- package/dist/{client-KEY4PYJH.js → client-D44ZHDTJ.js} +1 -1
- package/dist/{engine-S3QBQ7LH.js → engine-TER6FDBP.js} +3 -3
- package/dist/{external-edit-service-6FNFPOJJ.js → external-edit-service-CAGENHDJ.js} +4 -4
- package/dist/{grants-service-UT3EQ3R7.js → grants-service-2OTFS7EH.js} +3 -3
- package/dist/index.js +863 -355
- package/dist/{migrations.postgres-AIQ7WSU7.js → migrations.postgres-23VJJJJX.js} +12 -2
- package/dist/{review-service-HHGOTO6P.js → review-service-4G2XUFS6.js} +7 -7
- package/dist/{stewardship-service-4DHNRULG.js → stewardship-service-S22V2JKG.js} +6 -4
- package/dist/{version-service-KIOQME6U.js → version-service-X4FAG2OZ.js} +4 -4
- package/dist/web3/assets/ActivityTracePage-D2iIbEph.js +1 -0
- package/dist/web3/assets/{AgentDocsPage-CIiaBqMy.js → AgentDocsPage-Dkhgb1hk.js} +1 -1
- package/dist/web3/assets/CollaboratorManager-Bo81D--Q.js +1 -0
- package/dist/web3/assets/CollaboratorsTab-DRCitQuX.js +1 -0
- package/dist/web3/assets/DocumentEditor-DV2WHYbj.js +36 -0
- package/dist/web3/assets/{DocumentsTab-Vba-AzBv.js → DocumentsTab-BUxBCN8o.js} +2 -2
- package/dist/web3/assets/{ExternalEditsTab-BSzAQIGM.js → ExternalEditsTab-kIBimZyE.js} +1 -1
- package/dist/web3/assets/MarkdownEditor-CsVusP2d.css +1 -0
- package/dist/web3/assets/MarkdownEditor-Dfk5uIE5.js +648 -0
- package/dist/web3/assets/{NestPageHeader-CoLUV1Oz.js → NestPageHeader-yOK-OIYZ.js} +1 -1
- package/dist/web3/assets/NestView-DwIagxwJ.js +68 -0
- package/dist/web3/assets/{OverviewTab-Dxi-Hu-N.js → OverviewTab-DFOFMVyE.js} +1 -1
- package/dist/web3/assets/{PersonCombobox-CPOlNs6G.js → PersonCombobox-D350WlrJ.js} +1 -1
- package/dist/web3/assets/{ReasonDialog-DgLxfRWv.js → ReasonDialog-CN3ECAnQ.js} +1 -1
- package/dist/web3/assets/{ReviewActions-OfOdqzCn.js → ReviewActions-BXDTDPp1.js} +1 -1
- package/dist/web3/assets/{ReviewTab-CyX8yxd3.js → ReviewTab-CZewAYiz.js} +1 -1
- package/dist/web3/assets/StewardsTab-AagNWcWS.js +1 -0
- package/dist/web3/assets/{SubmitForReviewModal-Ci2DdWs0.js → SubmitForReviewModal-BOZJxwRN.js} +1 -1
- package/dist/web3/assets/{alert-dialog-DTozKlmV.js → alert-dialog-4SiLKlz8.js} +1 -1
- package/dist/web3/assets/{arrow-left-BCKt4CwQ.js → arrow-left-BAgIocLn.js} +1 -1
- package/dist/web3/assets/backlinks-Cb8Uf8mw.js +24 -0
- package/dist/web3/assets/{card-XG2dP5Xf.js → card-UDyMRcps.js} +1 -1
- package/dist/web3/assets/{chevron-left-BPwUT9DS.js → chevron-left-XR4ReJ9Z.js} +1 -1
- package/dist/web3/assets/{circle-check-DI8IBGeo.js → circle-check-CSkZUEFK.js} +1 -1
- package/dist/web3/assets/{circle-x-VKVhC88W.js → circle-x-in2o3aHU.js} +1 -1
- package/dist/web3/assets/client-attribution-BraarYaP.js +1 -0
- package/dist/web3/assets/{code-xml-CMabYZvH.js → code-xml-pPQgdctI.js} +1 -1
- package/dist/web3/assets/{corner-down-right-BGxwK6wH.js → corner-down-right-CuxZWscX.js} +1 -1
- package/dist/web3/assets/{count-skeleton-DMbdpscX.js → count-skeleton-DBWCDhRy.js} +1 -1
- package/dist/web3/assets/{earth-BEp1EKTo.js → earth-CXOcThqn.js} +1 -1
- package/dist/web3/assets/{file-exclamation-point-r8qZGIjP.js → file-exclamation-point-CSphs1VD.js} +1 -1
- package/dist/web3/assets/{folder-input-Cmtx1Jhk.js → folder-input-BAwK9tFL.js} +1 -1
- package/dist/web3/assets/{index-C1wTSjfP.js → index-A0_ymcqL.js} +1 -1
- package/dist/web3/assets/index-B5hLclEq.js +389 -0
- package/dist/web3/assets/index-DrUAtoQM.css +1 -0
- package/dist/web3/assets/page-BHD4beun.js +1 -0
- package/dist/web3/assets/{page-CPjWQNKx.js → page-BSYUXYmO.js} +1 -1
- package/dist/web3/assets/page-BYc2DIux.js +45 -0
- package/dist/web3/assets/{page-Bicf02Cz.js → page-BfibLg8e.js} +1 -1
- package/dist/web3/assets/page-CGe8MtUu.js +9 -0
- package/dist/web3/assets/{page-CQt3ZGbf.js → page-CIgPJmG6.js} +1 -1
- package/dist/web3/assets/{page-CHb0F5hV.js → page-CUjuSs5Q.js} +1 -1
- package/dist/web3/assets/{page-BYUFhYWZ.js → page-Ck31nx9b.js} +1 -1
- package/dist/web3/assets/{page-BExMvttJ.js → page-Cpdj_11Y.js} +1 -1
- package/dist/web3/assets/{page-CtaW65El.js → page-D0sN3GO6.js} +1 -1
- package/dist/web3/assets/page-DEpH91X2.js +1 -0
- package/dist/web3/assets/{page-CC0NJi8v.js → page-l8-B7CGt.js} +1 -1
- package/dist/web3/assets/{page-DGOL9l8i.js → page-mnSHmk6A.js} +1 -1
- package/dist/web3/assets/{page-title-ClvvBsIo.js → page-title-BkqlUA0j.js} +1 -1
- package/dist/web3/assets/{page-ByyVLDVo.js → page-xzYqkBUP.js} +5 -5
- package/dist/web3/assets/{play-C5YNKpAH.js → play-B8xE9j5f.js} +1 -1
- package/dist/web3/assets/{refresh-cw-BhHzSH9m.js → refresh-cw-CsCtmWwX.js} +1 -1
- package/dist/web3/assets/{scroll-area-hz-xtayP.js → scroll-area-CbcH6yrZ.js} +1 -1
- package/dist/web3/assets/{select-DBFTrUmI.js → select-DrL0mpRN.js} +2 -2
- package/dist/web3/assets/{send-0CHvmluT.js → send-CvAgOUPG.js} +1 -1
- package/dist/web3/assets/{settings-CeeF4LEb.js → settings-EY4A_DYv.js} +1 -1
- package/dist/web3/assets/{share-2-CMnOlOt-.js → share-2-vGmZUl90.js} +1 -1
- package/dist/web3/assets/{tag-DQ_6J5Gv.js → tag-Br_y1f00.js} +1 -1
- package/dist/web3/assets/{trash-2-HBi-Pslz.js → trash-2-B4hRXo-p.js} +1 -1
- package/dist/web3/assets/{triangle-alert-CDy8-7sv.js → triangle-alert-CsYGyfGZ.js} +1 -1
- package/dist/web3/assets/{user-plus-CvBNcpn4.js → user-plus-4CTYEkd3.js} +1 -1
- package/dist/web3/assets/{x-By7piikG.js → x-qxt1WrUi.js} +1 -1
- package/dist/web3/assets/zap-BcsKR0ef.js +16 -0
- package/dist/web3/index.html +2 -2
- package/package.json +2 -2
- package/dist/web3/assets/ActivityTracePage-BOZHgJ8S.js +0 -1
- package/dist/web3/assets/CollaboratorManager-By91wrIr.js +0 -1
- package/dist/web3/assets/CollaboratorsTab-D1EE64Fs.js +0 -1
- package/dist/web3/assets/DocumentEditor-DrQfrW3d.js +0 -36
- package/dist/web3/assets/MarkdownEditor-74N_naNQ.css +0 -1
- package/dist/web3/assets/MarkdownEditor-C9zqZjC5.js +0 -643
- package/dist/web3/assets/NestView-CTZ55tXD.js +0 -63
- package/dist/web3/assets/StewardsTab-DBEEfAQI.js +0 -1
- package/dist/web3/assets/backlinks-CYd4xENL.js +0 -24
- package/dist/web3/assets/index-BM-h3DwI.css +0 -1
- package/dist/web3/assets/index-EaX2yql0.js +0 -389
- package/dist/web3/assets/page-B3yvQvHy.js +0 -1
- package/dist/web3/assets/page-BUOADv2X.js +0 -1
- package/dist/web3/assets/page-BsPMDm5d.js +0 -45
- package/dist/web3/assets/page-Cj1NetQ-.js +0 -1
- package/dist/web3/assets/zap-C2T8riBp.js +0 -11
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import{c as dt,r as ie,O as Dt,cu as $t,cv as Ht,cw as Gt,j as s,B as fe,D as qe,x as Ke,y as Ve,z as Ye,G as at,ao as Ot,at as ot,c8 as qt,cx as Kt,ab as Vt,cy as Pe,c7 as Yt,cz as Xt,s as Jt,L as ze,J as lt,I as Ge,H as ct,cA as Qt,ck as er,cB as tr,S as rr,i as Ue,u as nr,a2 as sr,cC as ir,aS as et,aP as tt,V as ar,bA as xt,cD as rt,E as or,ag as _t,bs as vt,a9 as lr,F as bt,U as yt,f as Ee,bG as wt,cE as cr,cF as dr,cG as ur,cH as hr,cI as fr,cJ as mr,C as pr}from"./index-B5hLclEq.js";import{E as kt}from"./earth-CXOcThqn.js";import{r as gr,f as nt}from"./dates-BCxbm4_q.js";import{C as jt,n as Le,R as xr,D as _r}from"./count-skeleton-DBWCDhRy.js";import{C as Me,a as vr,c as br,b as yr,d as We}from"./card-UDyMRcps.js";import{P as wr}from"./page-title-BkqlUA0j.js";import{T as kr}from"./scroll-area-CbcH6yrZ.js";import"./select-DrL0mpRN.js";import{R as jr}from"./ReasonDialog-CN3ECAnQ.js";import{A as Nr,a as Sr,b as Cr,c as Ar,d as Er,e as zr,f as Ir,g as Dr}from"./alert-dialog-4SiLKlz8.js";import{F as Ie,A as st}from"./folder-input-BAwK9tFL.js";import{T as Re}from"./trash-2-B4hRXo-p.js";import{C as Or}from"./circle-check-CSkZUEFK.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Rr=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],Tr=dt("archive-restore",Rr);/**
|
|
7
|
+
* @license lucide-react v0.577.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Fr=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],Br=dt("bookmark",Fr);/**
|
|
12
|
+
* @license lucide-react v0.577.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Pr=[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]],Ur=dt("folder-sync",Pr),Nt=typeof window<"u"?window.location.origin:"http://localhost:3838";function Lr({nests:W,onManageKeys:Q}){const[m,C]=ie.useState(!1),{authenticated:x,authMode:c}=Dt(),o=c==="open",r=x&&!o,{nestCount:a,documentCount:_}=$t(W),y=Ht(Nt),v=Gt(Nt,o);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border bg-gradient-to-br from-blue-50 to-indigo-50 p-4 dark:from-slate-900 dark:to-slate-900/40 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(kt,{className:"h-5 w-5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Your whole brain"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[a," ",a===1?"nest":"nests"," ·"," ",_.toLocaleString()," ",_===1?"document":"documents"," — connect an AI to all of it at once."]})]})]}),s.jsxs(fe,{className:"shrink-0",onClick:()=>C(!0),children:[s.jsx(kt,{className:"mr-2 h-4 w-4"}),"Connect all my nests"]})]}),s.jsx(qe,{open:m,onOpenChange:C,children:s.jsxs(Ke,{className:"max-w-lg",children:[s.jsxs(Ve,{children:[s.jsx(Ye,{children:"Connect all my nests"}),s.jsx(at,{children:"One connection your AI reads every nest through — it picks the right one for each question."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Server (MCP) endpoint"}),s.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/40 p-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate text-xs",children:y}),s.jsx(fe,{variant:"ghost",size:"sm","aria-label":"Copy endpoint",onClick:()=>ot(y,"Endpoint copied"),children:s.jsx(Ot,{className:"h-3.5 w-3.5"})})]})]}),r&&s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Your API key"}),s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border bg-muted/40 p-2.5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[s.jsx(qt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsx("span",{children:"Paste in the key you already use — any of your keys works here and on every nest. Need a new one?"})]}),Q&&s.jsx(fe,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>{C(!1),Q()},children:"Manage API keys"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Or paste this into your AI"}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 text-[11px] leading-relaxed",children:v}),s.jsxs(fe,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>ot(v,"Prompt copied"),children:[s.jsx(Kt,{className:"mr-1.5 h-3.5 w-3.5"}),'Copy "chat with all my nests"']})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-emerald-200 bg-emerald-50 p-2.5 text-xs text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/40 dark:text-emerald-200",children:[s.jsx(Vt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsx("span",{children:"Search and list across all nests at once, or target a specific nest. Create, update, delete, move, and submit for review — just name the nest. Approval and sharing stay in each nest's Connect panel."})]})]})]})})]})}const Ze="mine";function St(W){return W.is_owner??(W.permission??"owner")==="owner"}function Mr(W,Q){switch(Q){case"mine":return!W.discovered;case"owned":return St(W);case"shared":return!St(W)&&!W.discovered;case"org":return W.visibility==="org";case"public":return W.visibility==="public";default:return!0}}function Wr(W){return W!=="unsynced"}function Zr(W,Q,m){if(Q!=="all"&&Q!=="mine"&&Q!=="unsynced")return[];const C=m.trim().toLowerCase();return C?W.filter(x=>x.label.toLowerCase().includes(C)||x.name.toLowerCase().includes(C)):W}function $r(W,Q,m){const C=Q.trim().toLowerCase();return[...C?W.filter(c=>(c.name??"").toLowerCase().includes(C)):W].sort((c,o)=>m==="name"?String(c.name??"").localeCompare(String(o.name??"")):String(o.archived_at??"").localeCompare(String(c.archived_at??"")))}function $e(W){throw new Error('Could not dynamically require "'+W+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var it={exports:{}};/*!
|
|
17
|
+
|
|
18
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
19
|
+
<http://stuartk.com/jszip>
|
|
20
|
+
|
|
21
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
22
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
23
|
+
|
|
24
|
+
JSZip uses the library pako released under the MIT license :
|
|
25
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
26
|
+
*/var Ct;function Hr(){return Ct||(Ct=1,(function(W,Q){(function(m){W.exports=m()})(function(){return(function m(C,x,c){function o(_,y){if(!x[_]){if(!C[_]){var v=typeof $e=="function"&&$e;if(!y&&v)return v(_,!0);if(r)return r(_,!0);var b=new Error("Cannot find module '"+_+"'");throw b.code="MODULE_NOT_FOUND",b}var i=x[_]={exports:{}};C[_][0].call(i.exports,function(p){var n=C[_][1][p];return o(n||p)},i,i.exports,m,C,x,c)}return x[_].exports}for(var r=typeof $e=="function"&&$e,a=0;a<c.length;a++)o(c[a]);return o})({1:[function(m,C,x){var c=m("./utils"),o=m("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";x.encode=function(a){for(var _,y,v,b,i,p,n,h=[],l=0,g=a.length,w=g,N=c.getTypeOf(a)!=="string";l<a.length;)w=g-l,v=N?(_=a[l++],y=l<g?a[l++]:0,l<g?a[l++]:0):(_=a.charCodeAt(l++),y=l<g?a.charCodeAt(l++):0,l<g?a.charCodeAt(l++):0),b=_>>2,i=(3&_)<<4|y>>4,p=1<w?(15&y)<<2|v>>6:64,n=2<w?63&v:64,h.push(r.charAt(b)+r.charAt(i)+r.charAt(p)+r.charAt(n));return h.join("")},x.decode=function(a){var _,y,v,b,i,p,n=0,h=0,l="data:";if(a.substr(0,l.length)===l)throw new Error("Invalid base64 input, it looks like a data url.");var g,w=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===r.charAt(64)&&w--,a.charAt(a.length-2)===r.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(g=o.uint8array?new Uint8Array(0|w):new Array(0|w);n<a.length;)_=r.indexOf(a.charAt(n++))<<2|(b=r.indexOf(a.charAt(n++)))>>4,y=(15&b)<<4|(i=r.indexOf(a.charAt(n++)))>>2,v=(3&i)<<6|(p=r.indexOf(a.charAt(n++))),g[h++]=_,i!==64&&(g[h++]=y),p!==64&&(g[h++]=v);return g}},{"./support":30,"./utils":32}],2:[function(m,C,x){var c=m("./external"),o=m("./stream/DataWorker"),r=m("./stream/Crc32Probe"),a=m("./stream/DataLengthProbe");function _(y,v,b,i,p){this.compressedSize=y,this.uncompressedSize=v,this.crc32=b,this.compression=i,this.compressedContent=p}_.prototype={getContentWorker:function(){var y=new o(c.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),v=this;return y.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),y},getCompressedWorker:function(){return new o(c.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},_.createWorkerFrom=function(y,v,b){return y.pipe(new r).pipe(new a("uncompressedSize")).pipe(v.compressWorker(b)).pipe(new a("compressedSize")).withStreamInfo("compression",v)},C.exports=_},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(m,C,x){var c=m("./stream/GenericWorker");x.STORE={magic:"\0\0",compressWorker:function(){return new c("STORE compression")},uncompressWorker:function(){return new c("STORE decompression")}},x.DEFLATE=m("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(m,C,x){var c=m("./utils"),o=(function(){for(var r,a=[],_=0;_<256;_++){r=_;for(var y=0;y<8;y++)r=1&r?3988292384^r>>>1:r>>>1;a[_]=r}return a})();C.exports=function(r,a){return r!==void 0&&r.length?c.getTypeOf(r)!=="string"?(function(_,y,v,b){var i=o,p=b+v;_^=-1;for(var n=b;n<p;n++)_=_>>>8^i[255&(_^y[n])];return-1^_})(0|a,r,r.length,0):(function(_,y,v,b){var i=o,p=b+v;_^=-1;for(var n=b;n<p;n++)_=_>>>8^i[255&(_^y.charCodeAt(n))];return-1^_})(0|a,r,r.length,0):0}},{"./utils":32}],5:[function(m,C,x){x.base64=!1,x.binary=!1,x.dir=!1,x.createFolders=!0,x.date=null,x.compression=null,x.compressionOptions=null,x.comment=null,x.unixPermissions=null,x.dosPermissions=null},{}],6:[function(m,C,x){var c=null;c=typeof Promise<"u"?Promise:m("lie"),C.exports={Promise:c}},{lie:37}],7:[function(m,C,x){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=m("pako"),r=m("./utils"),a=m("./stream/GenericWorker"),_=c?"uint8array":"array";function y(v,b){a.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=b,this.meta={}}x.magic="\b\0",r.inherits(y,a),y.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(_,v.data),!1)},y.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},y.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},y.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(b){v.push({data:b,meta:v.meta})}},x.compressWorker=function(v){return new y("Deflate",v)},x.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(m,C,x){function c(i,p){var n,h="";for(n=0;n<p;n++)h+=String.fromCharCode(255&i),i>>>=8;return h}function o(i,p,n,h,l,g){var w,N,S=i.file,B=i.compression,T=g!==_.utf8encode,M=r.transformTo("string",g(S.name)),O=r.transformTo("string",_.utf8encode(S.name)),$=S.comment,re=r.transformTo("string",g($)),u=r.transformTo("string",_.utf8encode($)),D=O.length!==S.name.length,t=u.length!==$.length,R="",Y="",L="",ae=S.dir,H=S.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};p&&!n||(ne.crc32=i.crc32,ne.compressedSize=i.compressedSize,ne.uncompressedSize=i.uncompressedSize);var z=0;p&&(z|=8),T||!D&&!t||(z|=2048);var E=0,ee=0;ae&&(E|=16),l==="UNIX"?(ee=798,E|=(function(q,he){var pe=q;return q||(pe=he?16893:33204),(65535&pe)<<16})(S.unixPermissions,ae)):(ee=20,E|=(function(q){return 63&(q||0)})(S.dosPermissions)),w=H.getUTCHours(),w<<=6,w|=H.getUTCMinutes(),w<<=5,w|=H.getUTCSeconds()/2,N=H.getUTCFullYear()-1980,N<<=4,N|=H.getUTCMonth()+1,N<<=5,N|=H.getUTCDate(),D&&(Y=c(1,1)+c(y(M),4)+O,R+="up"+c(Y.length,2)+Y),t&&(L=c(1,1)+c(y(re),4)+u,R+="uc"+c(L.length,2)+L);var V="";return V+=`
|
|
27
|
+
\0`,V+=c(z,2),V+=B.magic,V+=c(w,2),V+=c(N,2),V+=c(ne.crc32,4),V+=c(ne.compressedSize,4),V+=c(ne.uncompressedSize,4),V+=c(M.length,2),V+=c(R.length,2),{fileRecord:v.LOCAL_FILE_HEADER+V+M+R,dirRecord:v.CENTRAL_FILE_HEADER+c(ee,2)+V+c(re.length,2)+"\0\0\0\0"+c(E,4)+c(h,4)+M+R+re}}var r=m("../utils"),a=m("../stream/GenericWorker"),_=m("../utf8"),y=m("../crc32"),v=m("../signature");function b(i,p,n,h){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=n,this.encodeFileName=h,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(b,a),b.prototype.push=function(i){var p=i.meta.percent||0,n=this.entriesCount,h=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,a.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:n?(p+100*(n-h-1))/n:100}}))},b.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var p=this.streamFiles&&!i.file.dir;if(p){var n=o(i,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(i){this.accumulate=!1;var p=this.streamFiles&&!i.file.dir,n=o(i,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),p)this.push({data:(function(h){return v.DATA_DESCRIPTOR+c(h.crc32,4)+c(h.compressedSize,4)+c(h.uncompressedSize,4)})(i),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},b.prototype.flush=function(){for(var i=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var n=this.bytesWritten-i,h=(function(l,g,w,N,S){var B=r.transformTo("string",S(N));return v.CENTRAL_DIRECTORY_END+"\0\0\0\0"+c(l,2)+c(l,2)+c(g,4)+c(w,4)+c(B.length,2)+B})(this.dirRecords.length,n,i,this.zipComment,this.encodeFileName);this.push({data:h,meta:{percent:100}})},b.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},b.prototype.registerPrevious=function(i){this._sources.push(i);var p=this;return i.on("data",function(n){p.processChunk(n)}),i.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),i.on("error",function(n){p.error(n)}),this},b.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},b.prototype.error=function(i){var p=this._sources;if(!a.prototype.error.call(this,i))return!1;for(var n=0;n<p.length;n++)try{p[n].error(i)}catch{}return!0},b.prototype.lock=function(){a.prototype.lock.call(this);for(var i=this._sources,p=0;p<i.length;p++)i[p].lock()},C.exports=b},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(m,C,x){var c=m("../compressions"),o=m("./ZipFileWorker");x.generateWorker=function(r,a,_){var y=new o(a.streamFiles,_,a.platform,a.encodeFileName),v=0;try{r.forEach(function(b,i){v++;var p=(function(g,w){var N=g||w,S=c[N];if(!S)throw new Error(N+" is not a valid compression method !");return S})(i.options.compression,a.compression),n=i.options.compressionOptions||a.compressionOptions||{},h=i.dir,l=i.date;i._compressWorker(p,n).withStreamInfo("file",{name:b,dir:h,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(y)}),y.entriesCount=v}catch(b){y.error(b)}return y}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(m,C,x){function c(){if(!(this instanceof c))return new c;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 o=new c;for(var r in this)typeof this[r]!="function"&&(o[r]=this[r]);return o}}(c.prototype=m("./object")).loadAsync=m("./load"),c.support=m("./support"),c.defaults=m("./defaults"),c.version="3.10.1",c.loadAsync=function(o,r){return new c().loadAsync(o,r)},c.external=m("./external"),C.exports=c},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(m,C,x){var c=m("./utils"),o=m("./external"),r=m("./utf8"),a=m("./zipEntries"),_=m("./stream/Crc32Probe"),y=m("./nodejsUtils");function v(b){return new o.Promise(function(i,p){var n=b.decompressed.getContentWorker().pipe(new _);n.on("error",function(h){p(h)}).on("end",function(){n.streamInfo.crc32!==b.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):i()}).resume()})}C.exports=function(b,i){var p=this;return i=c.extend(i||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),y.isNode&&y.isStream(b)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):c.prepareContent("the loaded zip file",b,!0,i.optimizedBinaryString,i.base64).then(function(n){var h=new a(i);return h.load(n),h}).then(function(n){var h=[o.Promise.resolve(n)],l=n.files;if(i.checkCRC32)for(var g=0;g<l.length;g++)h.push(v(l[g]));return o.Promise.all(h)}).then(function(n){for(var h=n.shift(),l=h.files,g=0;g<l.length;g++){var w=l[g],N=w.fileNameStr,S=c.resolve(w.fileNameStr);p.file(S,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:i.createFolders}),w.dir||(p.file(S).unsafeOriginalName=N)}return h.zipComment.length&&(p.comment=h.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(m,C,x){var c=m("../utils"),o=m("../stream/GenericWorker");function r(a,_){o.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(_)}c.inherits(r,o),r.prototype._bindStream=function(a){var _=this;(this._stream=a).pause(),a.on("data",function(y){_.push({data:y,meta:{percent:0}})}).on("error",function(y){_.isPaused?this.generatedError=y:_.error(y)}).on("end",function(){_.isPaused?_._upstreamEnded=!0:_.end()})},r.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},C.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(m,C,x){var c=m("readable-stream").Readable;function o(r,a,_){c.call(this,a),this._helper=r;var y=this;r.on("data",function(v,b){y.push(v)||y._helper.pause(),_&&_(b)}).on("error",function(v){y.emit("error",v)}).on("end",function(){y.push(null)})}m("../utils").inherits(o,c),o.prototype._read=function(){this._helper.resume()},C.exports=o},{"../utils":32,"readable-stream":16}],14:[function(m,C,x){C.exports={isNode:typeof Buffer<"u",newBufferFrom:function(c,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(c,o);if(typeof c=="number")throw new Error('The "data" argument must not be a number');return new Buffer(c,o)},allocBuffer:function(c){if(Buffer.alloc)return Buffer.alloc(c);var o=new Buffer(c);return o.fill(0),o},isBuffer:function(c){return Buffer.isBuffer(c)},isStream:function(c){return c&&typeof c.on=="function"&&typeof c.pause=="function"&&typeof c.resume=="function"}}},{}],15:[function(m,C,x){function c(S,B,T){var M,O=r.getTypeOf(B),$=r.extend(T||{},y);$.date=$.date||new Date,$.compression!==null&&($.compression=$.compression.toUpperCase()),typeof $.unixPermissions=="string"&&($.unixPermissions=parseInt($.unixPermissions,8)),$.unixPermissions&&16384&$.unixPermissions&&($.dir=!0),$.dosPermissions&&16&$.dosPermissions&&($.dir=!0),$.dir&&(S=l(S)),$.createFolders&&(M=h(S))&&g.call(this,M,!0);var re=O==="string"&&$.binary===!1&&$.base64===!1;T&&T.binary!==void 0||($.binary=!re),(B instanceof v&&B.uncompressedSize===0||$.dir||!B||B.length===0)&&($.base64=!1,$.binary=!0,B="",$.compression="STORE",O="string");var u=null;u=B instanceof v||B instanceof a?B:p.isNode&&p.isStream(B)?new n(S,B):r.prepareContent(S,B,$.binary,$.optimizedBinaryString,$.base64);var D=new b(S,u,$);this.files[S]=D}var o=m("./utf8"),r=m("./utils"),a=m("./stream/GenericWorker"),_=m("./stream/StreamHelper"),y=m("./defaults"),v=m("./compressedObject"),b=m("./zipObject"),i=m("./generate"),p=m("./nodejsUtils"),n=m("./nodejs/NodejsStreamInputAdapter"),h=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var B=S.lastIndexOf("/");return 0<B?S.substring(0,B):""},l=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},g=function(S,B){return B=B!==void 0?B:y.createFolders,S=l(S),this.files[S]||c.call(this,S,null,{dir:!0,createFolders:B}),this.files[S]};function w(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var N={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var B,T,M;for(B in this.files)M=this.files[B],(T=B.slice(this.root.length,B.length))&&B.slice(0,this.root.length)===this.root&&S(T,M)},filter:function(S){var B=[];return this.forEach(function(T,M){S(T,M)&&B.push(M)}),B},file:function(S,B,T){if(arguments.length!==1)return S=this.root+S,c.call(this,S,B,T),this;if(w(S)){var M=S;return this.filter(function($,re){return!re.dir&&M.test($)})}var O=this.files[this.root+S];return O&&!O.dir?O:null},folder:function(S){if(!S)return this;if(w(S))return this.filter(function(O,$){return $.dir&&S.test(O)});var B=this.root+S,T=g.call(this,B),M=this.clone();return M.root=T.name,M},remove:function(S){S=this.root+S;var B=this.files[S];if(B||(S.slice(-1)!=="/"&&(S+="/"),B=this.files[S]),B&&!B.dir)delete this.files[S];else for(var T=this.filter(function(O,$){return $.name.slice(0,S.length)===S}),M=0;M<T.length;M++)delete this.files[T[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var B,T={};try{if((T=r.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=T.type.toLowerCase(),T.compression=T.compression.toUpperCase(),T.type==="binarystring"&&(T.type="string"),!T.type)throw new Error("No output type specified.");r.checkSupport(T.type),T.platform!=="darwin"&&T.platform!=="freebsd"&&T.platform!=="linux"&&T.platform!=="sunos"||(T.platform="UNIX"),T.platform==="win32"&&(T.platform="DOS");var M=T.comment||this.comment||"";B=i.generateWorker(this,T,M)}catch(O){(B=new a("error")).error(O)}return new _(B,T.type||"string",T.mimeType)},generateAsync:function(S,B){return this.generateInternalStream(S).accumulate(B)},generateNodeStream:function(S,B){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(B)}};C.exports=N},{"./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(m,C,x){C.exports=m("stream")},{stream:void 0}],17:[function(m,C,x){var c=m("./DataReader");function o(r){c.call(this,r);for(var a=0;a<this.data.length;a++)r[a]=255&r[a]}m("../utils").inherits(o,c),o.prototype.byteAt=function(r){return this.data[this.zero+r]},o.prototype.lastIndexOfSignature=function(r){for(var a=r.charCodeAt(0),_=r.charCodeAt(1),y=r.charCodeAt(2),v=r.charCodeAt(3),b=this.length-4;0<=b;--b)if(this.data[b]===a&&this.data[b+1]===_&&this.data[b+2]===y&&this.data[b+3]===v)return b-this.zero;return-1},o.prototype.readAndCheckSignature=function(r){var a=r.charCodeAt(0),_=r.charCodeAt(1),y=r.charCodeAt(2),v=r.charCodeAt(3),b=this.readData(4);return a===b[0]&&_===b[1]&&y===b[2]&&v===b[3]},o.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,a},C.exports=o},{"../utils":32,"./DataReader":18}],18:[function(m,C,x){var c=m("../utils");function o(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var a,_=0;for(this.checkOffset(r),a=this.index+r-1;a>=this.index;a--)_=(_<<8)+this.byteAt(a);return this.index+=r,_},readString:function(r){return c.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},C.exports=o},{"../utils":32}],19:[function(m,C,x){var c=m("./Uint8ArrayReader");function o(r){c.call(this,r)}m("../utils").inherits(o,c),o.prototype.readData=function(r){this.checkOffset(r);var a=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,a},C.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(m,C,x){var c=m("./DataReader");function o(r){c.call(this,r)}m("../utils").inherits(o,c),o.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},o.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},o.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},o.prototype.readData=function(r){this.checkOffset(r);var a=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,a},C.exports=o},{"../utils":32,"./DataReader":18}],21:[function(m,C,x){var c=m("./ArrayReader");function o(r){c.call(this,r)}m("../utils").inherits(o,c),o.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,a},C.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(m,C,x){var c=m("../utils"),o=m("../support"),r=m("./ArrayReader"),a=m("./StringReader"),_=m("./NodeBufferReader"),y=m("./Uint8ArrayReader");C.exports=function(v){var b=c.getTypeOf(v);return c.checkSupport(b),b!=="string"||o.uint8array?b==="nodebuffer"?new _(v):o.uint8array?new y(c.transformTo("uint8array",v)):new r(c.transformTo("array",v)):new a(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(m,C,x){x.LOCAL_FILE_HEADER="PK",x.CENTRAL_FILE_HEADER="PK",x.CENTRAL_DIRECTORY_END="PK",x.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",x.ZIP64_CENTRAL_DIRECTORY_END="PK",x.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(m,C,x){var c=m("./GenericWorker"),o=m("../utils");function r(a){c.call(this,"ConvertWorker to "+a),this.destType=a}o.inherits(r,c),r.prototype.processChunk=function(a){this.push({data:o.transformTo(this.destType,a.data),meta:a.meta})},C.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(m,C,x){var c=m("./GenericWorker"),o=m("../crc32");function r(){c.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}m("../utils").inherits(r,c),r.prototype.processChunk=function(a){this.streamInfo.crc32=o(a.data,this.streamInfo.crc32||0),this.push(a)},C.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(m,C,x){var c=m("../utils"),o=m("./GenericWorker");function r(a){o.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}c.inherits(r,o),r.prototype.processChunk=function(a){if(a){var _=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=_+a.data.length}o.prototype.processChunk.call(this,a)},C.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(m,C,x){var c=m("../utils"),o=m("./GenericWorker");function r(a){o.call(this,"DataWorker");var _=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(y){_.dataIsReady=!0,_.data=y,_.max=y&&y.length||0,_.type=c.getTypeOf(y),_.isPaused||_._tickAndRepeat()},function(y){_.error(y)})}c.inherits(r,o),r.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,c.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(c.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,_=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,_);break;case"uint8array":a=this.data.subarray(this.index,_);break;case"array":case"nodebuffer":a=this.data.slice(this.index,_)}return this.index=_,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},C.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(m,C,x){function c(o){this.name=o||"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}c.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,r){return this._listeners[o].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,r){if(this._listeners[o])for(var a=0;a<this._listeners[o].length;a++)this._listeners[o][a].call(this,r)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var r=this;return o.on("data",function(a){r.processChunk(a)}),o.on("end",function(){r.end()}),o.on("error",function(a){r.error(a)}),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 o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,r){return this.extraStreamInfo[o]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},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 o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},C.exports=c},{}],29:[function(m,C,x){var c=m("../utils"),o=m("./ConvertWorker"),r=m("./GenericWorker"),a=m("../base64"),_=m("../support"),y=m("../external"),v=null;if(_.nodestream)try{v=m("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(p,n){return new y.Promise(function(h,l){var g=[],w=p._internalType,N=p._outputType,S=p._mimeType;p.on("data",function(B,T){g.push(B),n&&n(T)}).on("error",function(B){g=[],l(B)}).on("end",function(){try{var B=(function(T,M,O){switch(T){case"blob":return c.newBlob(c.transformTo("arraybuffer",M),O);case"base64":return a.encode(M);default:return c.transformTo(T,M)}})(N,(function(T,M){var O,$=0,re=null,u=0;for(O=0;O<M.length;O++)u+=M[O].length;switch(T){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(re=new Uint8Array(u),O=0;O<M.length;O++)re.set(M[O],$),$+=M[O].length;return re;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+T+"'")}})(w,g),S);h(B)}catch(T){l(T)}g=[]}).resume()})}function i(p,n,h){var l=n;switch(n){case"blob":case"arraybuffer":l="uint8array";break;case"base64":l="string"}try{this._internalType=l,this._outputType=n,this._mimeType=h,c.checkSupport(l),this._worker=p.pipe(new o(l)),p.lock()}catch(g){this._worker=new r("error"),this._worker.error(g)}}i.prototype={accumulate:function(p){return b(this,p)},on:function(p,n){var h=this;return p==="data"?this._worker.on(p,function(l){n.call(h,l.data,l.meta)}):this._worker.on(p,function(){c.delay(n,arguments,h)}),this},resume:function(){return c.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(c.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new v(this,{objectMode:this._outputType!=="nodebuffer"},p)}},C.exports=i},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(m,C,x){if(x.base64=!0,x.array=!0,x.string=!0,x.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",x.nodebuffer=typeof Buffer<"u",x.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")x.blob=!1;else{var c=new ArrayBuffer(0);try{x.blob=new Blob([c],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(c),x.blob=o.getBlob("application/zip").size===0}catch{x.blob=!1}}}try{x.nodestream=!!m("readable-stream").Readable}catch{x.nodestream=!1}},{"readable-stream":16}],31:[function(m,C,x){for(var c=m("./utils"),o=m("./support"),r=m("./nodejsUtils"),a=m("./stream/GenericWorker"),_=new Array(256),y=0;y<256;y++)_[y]=252<=y?6:248<=y?5:240<=y?4:224<=y?3:192<=y?2:1;_[254]=_[254]=1;function v(){a.call(this,"utf-8 decode"),this.leftOver=null}function b(){a.call(this,"utf-8 encode")}x.utf8encode=function(i){return o.nodebuffer?r.newBufferFrom(i,"utf-8"):(function(p){var n,h,l,g,w,N=p.length,S=0;for(g=0;g<N;g++)(64512&(h=p.charCodeAt(g)))==55296&&g+1<N&&(64512&(l=p.charCodeAt(g+1)))==56320&&(h=65536+(h-55296<<10)+(l-56320),g++),S+=h<128?1:h<2048?2:h<65536?3:4;for(n=o.uint8array?new Uint8Array(S):new Array(S),g=w=0;w<S;g++)(64512&(h=p.charCodeAt(g)))==55296&&g+1<N&&(64512&(l=p.charCodeAt(g+1)))==56320&&(h=65536+(h-55296<<10)+(l-56320),g++),h<128?n[w++]=h:(h<2048?n[w++]=192|h>>>6:(h<65536?n[w++]=224|h>>>12:(n[w++]=240|h>>>18,n[w++]=128|h>>>12&63),n[w++]=128|h>>>6&63),n[w++]=128|63&h);return n})(i)},x.utf8decode=function(i){return o.nodebuffer?c.transformTo("nodebuffer",i).toString("utf-8"):(function(p){var n,h,l,g,w=p.length,N=new Array(2*w);for(n=h=0;n<w;)if((l=p[n++])<128)N[h++]=l;else if(4<(g=_[l]))N[h++]=65533,n+=g-1;else{for(l&=g===2?31:g===3?15:7;1<g&&n<w;)l=l<<6|63&p[n++],g--;1<g?N[h++]=65533:l<65536?N[h++]=l:(l-=65536,N[h++]=55296|l>>10&1023,N[h++]=56320|1023&l)}return N.length!==h&&(N.subarray?N=N.subarray(0,h):N.length=h),c.applyFromCharCode(N)})(i=c.transformTo(o.uint8array?"uint8array":"array",i))},c.inherits(v,a),v.prototype.processChunk=function(i){var p=c.transformTo(o.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var n=p;(p=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),p.set(n,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var h=(function(g,w){var N;for((w=w||g.length)>g.length&&(w=g.length),N=w-1;0<=N&&(192&g[N])==128;)N--;return N<0||N===0?w:N+_[g[N]]>w?N:w})(p),l=p;h!==p.length&&(o.uint8array?(l=p.subarray(0,h),this.leftOver=p.subarray(h,p.length)):(l=p.slice(0,h),this.leftOver=p.slice(h,p.length))),this.push({data:x.utf8decode(l),meta:i.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:x.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},x.Utf8DecodeWorker=v,c.inherits(b,a),b.prototype.processChunk=function(i){this.push({data:x.utf8encode(i.data),meta:i.meta})},x.Utf8EncodeWorker=b},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(m,C,x){var c=m("./support"),o=m("./base64"),r=m("./nodejsUtils"),a=m("./external");function _(n){return n}function y(n,h){for(var l=0;l<n.length;++l)h[l]=255&n.charCodeAt(l);return h}m("setimmediate"),x.newBlob=function(n,h){x.checkSupport("blob");try{return new Blob([n],{type:h})}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return l.append(n),l.getBlob(h)}catch{throw new Error("Bug : can't construct the Blob.")}}};var v={stringifyByChunk:function(n,h,l){var g=[],w=0,N=n.length;if(N<=l)return String.fromCharCode.apply(null,n);for(;w<N;)h==="array"||h==="nodebuffer"?g.push(String.fromCharCode.apply(null,n.slice(w,Math.min(w+l,N)))):g.push(String.fromCharCode.apply(null,n.subarray(w,Math.min(w+l,N)))),w+=l;return g.join("")},stringifyByChar:function(n){for(var h="",l=0;l<n.length;l++)h+=String.fromCharCode(n[l]);return h},applyCanBeUsed:{uint8array:(function(){try{return c.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return c.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function b(n){var h=65536,l=x.getTypeOf(n),g=!0;if(l==="uint8array"?g=v.applyCanBeUsed.uint8array:l==="nodebuffer"&&(g=v.applyCanBeUsed.nodebuffer),g)for(;1<h;)try{return v.stringifyByChunk(n,l,h)}catch{h=Math.floor(h/2)}return v.stringifyByChar(n)}function i(n,h){for(var l=0;l<n.length;l++)h[l]=n[l];return h}x.applyFromCharCode=b;var p={};p.string={string:_,array:function(n){return y(n,new Array(n.length))},arraybuffer:function(n){return p.string.uint8array(n).buffer},uint8array:function(n){return y(n,new Uint8Array(n.length))},nodebuffer:function(n){return y(n,r.allocBuffer(n.length))}},p.array={string:b,array:_,arraybuffer:function(n){return new Uint8Array(n).buffer},uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return r.newBufferFrom(n)}},p.arraybuffer={string:function(n){return b(new Uint8Array(n))},array:function(n){return i(new Uint8Array(n),new Array(n.byteLength))},arraybuffer:_,uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return r.newBufferFrom(new Uint8Array(n))}},p.uint8array={string:b,array:function(n){return i(n,new Array(n.length))},arraybuffer:function(n){return n.buffer},uint8array:_,nodebuffer:function(n){return r.newBufferFrom(n)}},p.nodebuffer={string:b,array:function(n){return i(n,new Array(n.length))},arraybuffer:function(n){return p.nodebuffer.uint8array(n).buffer},uint8array:function(n){return i(n,new Uint8Array(n.length))},nodebuffer:_},x.transformTo=function(n,h){if(h=h||"",!n)return h;x.checkSupport(n);var l=x.getTypeOf(h);return p[l][n](h)},x.resolve=function(n){for(var h=n.split("/"),l=[],g=0;g<h.length;g++){var w=h[g];w==="."||w===""&&g!==0&&g!==h.length-1||(w===".."?l.pop():l.push(w))}return l.join("/")},x.getTypeOf=function(n){return typeof n=="string"?"string":Object.prototype.toString.call(n)==="[object Array]"?"array":c.nodebuffer&&r.isBuffer(n)?"nodebuffer":c.uint8array&&n instanceof Uint8Array?"uint8array":c.arraybuffer&&n instanceof ArrayBuffer?"arraybuffer":void 0},x.checkSupport=function(n){if(!c[n.toLowerCase()])throw new Error(n+" is not supported by this platform")},x.MAX_VALUE_16BITS=65535,x.MAX_VALUE_32BITS=-1,x.pretty=function(n){var h,l,g="";for(l=0;l<(n||"").length;l++)g+="\\x"+((h=n.charCodeAt(l))<16?"0":"")+h.toString(16).toUpperCase();return g},x.delay=function(n,h,l){setImmediate(function(){n.apply(l||null,h||[])})},x.inherits=function(n,h){function l(){}l.prototype=h.prototype,n.prototype=new l},x.extend=function(){var n,h,l={};for(n=0;n<arguments.length;n++)for(h in arguments[n])Object.prototype.hasOwnProperty.call(arguments[n],h)&&l[h]===void 0&&(l[h]=arguments[n][h]);return l},x.prepareContent=function(n,h,l,g,w){return a.Promise.resolve(h).then(function(N){return c.blob&&(N instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(N))!==-1)&&typeof FileReader<"u"?new a.Promise(function(S,B){var T=new FileReader;T.onload=function(M){S(M.target.result)},T.onerror=function(M){B(M.target.error)},T.readAsArrayBuffer(N)}):N}).then(function(N){var S=x.getTypeOf(N);return S?(S==="arraybuffer"?N=x.transformTo("uint8array",N):S==="string"&&(w?N=o.decode(N):l&&g!==!0&&(N=(function(B){return y(B,c.uint8array?new Uint8Array(B.length):new Array(B.length))})(N))),N):a.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(m,C,x){var c=m("./reader/readerFor"),o=m("./utils"),r=m("./signature"),a=m("./zipEntry"),_=m("./support");function y(v){this.files=[],this.loadOptions=v}y.prototype={checkSignature:function(v){if(!this.reader.readAndCheckSignature(v)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(b)+", expected "+o.pretty(v)+")")}},isSignature:function(v,b){var i=this.reader.index;this.reader.setIndex(v);var p=this.reader.readString(4)===b;return this.reader.setIndex(i),p},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 v=this.reader.readData(this.zipCommentLength),b=_.uint8array?"uint8array":"array",i=o.transformTo(b,v);this.zipComment=this.loadOptions.decodeFileName(i)},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 v,b,i,p=this.zip64EndOfCentralSize-44;0<p;)v=this.reader.readInt(2),b=this.reader.readInt(4),i=this.reader.readData(b),this.zip64ExtensibleData[v]={id:v,length:b,value:i}},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 v,b;for(v=0;v<this.files.length;v++)b=this.files[v],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var v;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(v=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(v);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 v=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(v<0)throw this.isSignature(0,r.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(v);var b=v;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(v=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(v),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var p=b-i;if(0<p)this.isSignature(b,r.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(v){this.reader=c(v)},load:function(v){this.prepareReader(v),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},C.exports=y},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(m,C,x){var c=m("./reader/readerFor"),o=m("./utils"),r=m("./compressedObject"),a=m("./crc32"),_=m("./utf8"),y=m("./compressions"),v=m("./support");function b(i,p){this.options=i,this.loadOptions=p}b.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(i){var p,n;if(i.skip(22),this.fileNameLength=i.readInt(2),n=i.readInt(2),this.fileName=i.readData(this.fileNameLength),i.skip(n),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((p=(function(h){for(var l in y)if(Object.prototype.hasOwnProperty.call(y,l)&&y[l].magic===h)return y[l];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,p,i.readData(this.compressedSize))},readCentralPart:function(i){this.versionMadeBy=i.readInt(2),i.skip(2),this.bitFlag=i.readInt(2),this.compressionMethod=i.readString(2),this.date=i.readDate(),this.crc32=i.readInt(4),this.compressedSize=i.readInt(4),this.uncompressedSize=i.readInt(4);var p=i.readInt(2);if(this.extraFieldsLength=i.readInt(2),this.fileCommentLength=i.readInt(2),this.diskNumberStart=i.readInt(2),this.internalFileAttributes=i.readInt(2),this.externalFileAttributes=i.readInt(4),this.localHeaderOffset=i.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");i.skip(p),this.readExtraFields(i),this.parseZIP64ExtraField(i),this.fileComment=i.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var i=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=c(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var p,n,h,l=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4<l;)p=i.readInt(2),n=i.readInt(2),h=i.readData(n),this.extraFields[p]={id:p,length:n,value:h};i.setIndex(l)},handleUTF8:function(){var i=v.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=_.utf8decode(this.fileName),this.fileCommentStr=_.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var n=o.transformTo(i,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var h=this.findExtraFieldUnicodeComment();if(h!==null)this.fileCommentStr=h;else{var l=o.transformTo(i,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(l)}}},findExtraFieldUnicodePath:function(){var i=this.extraFields[28789];if(i){var p=c(i.value);return p.readInt(1)!==1||a(this.fileName)!==p.readInt(4)?null:_.utf8decode(p.readData(i.length-5))}return null},findExtraFieldUnicodeComment:function(){var i=this.extraFields[25461];if(i){var p=c(i.value);return p.readInt(1)!==1||a(this.fileComment)!==p.readInt(4)?null:_.utf8decode(p.readData(i.length-5))}return null}},C.exports=b},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(m,C,x){function c(p,n,h){this.name=p,this.dir=h.dir,this.date=h.date,this.comment=h.comment,this.unixPermissions=h.unixPermissions,this.dosPermissions=h.dosPermissions,this._data=n,this._dataBinary=h.binary,this.options={compression:h.compression,compressionOptions:h.compressionOptions}}var o=m("./stream/StreamHelper"),r=m("./stream/DataWorker"),a=m("./utf8"),_=m("./compressedObject"),y=m("./stream/GenericWorker");c.prototype={internalStream:function(p){var n=null,h="string";try{if(!p)throw new Error("No output type specified.");var l=(h=p.toLowerCase())==="string"||h==="text";h!=="binarystring"&&h!=="text"||(h="string"),n=this._decompressWorker();var g=!this._dataBinary;g&&!l&&(n=n.pipe(new a.Utf8EncodeWorker)),!g&&l&&(n=n.pipe(new a.Utf8DecodeWorker))}catch(w){(n=new y("error")).error(w)}return new o(n,h,"")},async:function(p,n){return this.internalStream(p).accumulate(n)},nodeStream:function(p,n){return this.internalStream(p||"nodebuffer").toNodejsStream(n)},_compressWorker:function(p,n){if(this._data instanceof _&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var h=this._decompressWorker();return this._dataBinary||(h=h.pipe(new a.Utf8EncodeWorker)),_.createWorkerFrom(h,p,n)},_decompressWorker:function(){return this._data instanceof _?this._data.getContentWorker():this._data instanceof y?this._data:new r(this._data)}};for(var v=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],b=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},i=0;i<v.length;i++)c.prototype[v[i]]=b;C.exports=c},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(m,C,x){(function(c){var o,r,a=c.MutationObserver||c.WebKitMutationObserver;if(a){var _=0,y=new a(p),v=c.document.createTextNode("");y.observe(v,{characterData:!0}),o=function(){v.data=_=++_%2}}else if(c.setImmediate||c.MessageChannel===void 0)o="document"in c&&"onreadystatechange"in c.document.createElement("script")?function(){var n=c.document.createElement("script");n.onreadystatechange=function(){p(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},c.document.documentElement.appendChild(n)}:function(){setTimeout(p,0)};else{var b=new c.MessageChannel;b.port1.onmessage=p,o=function(){b.port2.postMessage(0)}}var i=[];function p(){var n,h;r=!0;for(var l=i.length;l;){for(h=i,i=[],n=-1;++n<l;)h[n]();l=i.length}r=!1}C.exports=function(n){i.push(n)!==1||r||o()}}).call(this,typeof Pe<"u"?Pe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(m,C,x){var c=m("immediate");function o(){}var r={},a=["REJECTED"],_=["FULFILLED"],y=["PENDING"];function v(l){if(typeof l!="function")throw new TypeError("resolver must be a function");this.state=y,this.queue=[],this.outcome=void 0,l!==o&&n(this,l)}function b(l,g,w){this.promise=l,typeof g=="function"&&(this.onFulfilled=g,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function i(l,g,w){c(function(){var N;try{N=g(w)}catch(S){return r.reject(l,S)}N===l?r.reject(l,new TypeError("Cannot resolve promise with itself")):r.resolve(l,N)})}function p(l){var g=l&&l.then;if(l&&(typeof l=="object"||typeof l=="function")&&typeof g=="function")return function(){g.apply(l,arguments)}}function n(l,g){var w=!1;function N(T){w||(w=!0,r.reject(l,T))}function S(T){w||(w=!0,r.resolve(l,T))}var B=h(function(){g(S,N)});B.status==="error"&&N(B.value)}function h(l,g){var w={};try{w.value=l(g),w.status="success"}catch(N){w.status="error",w.value=N}return w}(C.exports=v).prototype.finally=function(l){if(typeof l!="function")return this;var g=this.constructor;return this.then(function(w){return g.resolve(l()).then(function(){return w})},function(w){return g.resolve(l()).then(function(){throw w})})},v.prototype.catch=function(l){return this.then(null,l)},v.prototype.then=function(l,g){if(typeof l!="function"&&this.state===_||typeof g!="function"&&this.state===a)return this;var w=new this.constructor(o);return this.state!==y?i(w,this.state===_?l:g,this.outcome):this.queue.push(new b(w,l,g)),w},b.prototype.callFulfilled=function(l){r.resolve(this.promise,l)},b.prototype.otherCallFulfilled=function(l){i(this.promise,this.onFulfilled,l)},b.prototype.callRejected=function(l){r.reject(this.promise,l)},b.prototype.otherCallRejected=function(l){i(this.promise,this.onRejected,l)},r.resolve=function(l,g){var w=h(p,g);if(w.status==="error")return r.reject(l,w.value);var N=w.value;if(N)n(l,N);else{l.state=_,l.outcome=g;for(var S=-1,B=l.queue.length;++S<B;)l.queue[S].callFulfilled(g)}return l},r.reject=function(l,g){l.state=a,l.outcome=g;for(var w=-1,N=l.queue.length;++w<N;)l.queue[w].callRejected(g);return l},v.resolve=function(l){return l instanceof this?l:r.resolve(new this(o),l)},v.reject=function(l){var g=new this(o);return r.reject(g,l)},v.all=function(l){var g=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=l.length,N=!1;if(!w)return this.resolve([]);for(var S=new Array(w),B=0,T=-1,M=new this(o);++T<w;)O(l[T],T);return M;function O($,re){g.resolve($).then(function(u){S[re]=u,++B!==w||N||(N=!0,r.resolve(M,S))},function(u){N||(N=!0,r.reject(M,u))})}},v.race=function(l){var g=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=l.length,N=!1;if(!w)return this.resolve([]);for(var S=-1,B=new this(o);++S<w;)T=l[S],g.resolve(T).then(function(M){N||(N=!0,r.resolve(B,M))},function(M){N||(N=!0,r.reject(B,M))});var T;return B}},{immediate:36}],38:[function(m,C,x){var c={};(0,m("./lib/utils/common").assign)(c,m("./lib/deflate"),m("./lib/inflate"),m("./lib/zlib/constants")),C.exports=c},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(m,C,x){var c=m("./zlib/deflate"),o=m("./utils/common"),r=m("./utils/strings"),a=m("./zlib/messages"),_=m("./zlib/zstream"),y=Object.prototype.toString,v=0,b=-1,i=0,p=8;function n(l){if(!(this instanceof n))return new n(l);this.options=o.assign({level:b,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:i,to:""},l||{});var g=this.options;g.raw&&0<g.windowBits?g.windowBits=-g.windowBits:g.gzip&&0<g.windowBits&&g.windowBits<16&&(g.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var w=c.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(w!==v)throw new Error(a[w]);if(g.header&&c.deflateSetHeader(this.strm,g.header),g.dictionary){var N;if(N=typeof g.dictionary=="string"?r.string2buf(g.dictionary):y.call(g.dictionary)==="[object ArrayBuffer]"?new Uint8Array(g.dictionary):g.dictionary,(w=c.deflateSetDictionary(this.strm,N))!==v)throw new Error(a[w]);this._dict_set=!0}}function h(l,g){var w=new n(g);if(w.push(l,!0),w.err)throw w.msg||a[w.err];return w.result}n.prototype.push=function(l,g){var w,N,S=this.strm,B=this.options.chunkSize;if(this.ended)return!1;N=g===~~g?g:g===!0?4:0,typeof l=="string"?S.input=r.string2buf(l):y.call(l)==="[object ArrayBuffer]"?S.input=new Uint8Array(l):S.input=l,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new o.Buf8(B),S.next_out=0,S.avail_out=B),(w=c.deflate(S,N))!==1&&w!==v)return this.onEnd(w),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||N!==4&&N!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(o.shrinkBuf(S.output,S.next_out))):this.onData(o.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&w!==1);return N===4?(w=c.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===v):N!==2||(this.onEnd(v),!(S.avail_out=0))},n.prototype.onData=function(l){this.chunks.push(l)},n.prototype.onEnd=function(l){l===v&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},x.Deflate=n,x.deflate=h,x.deflateRaw=function(l,g){return(g=g||{}).raw=!0,h(l,g)},x.gzip=function(l,g){return(g=g||{}).gzip=!0,h(l,g)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(m,C,x){var c=m("./zlib/inflate"),o=m("./utils/common"),r=m("./utils/strings"),a=m("./zlib/constants"),_=m("./zlib/messages"),y=m("./zlib/zstream"),v=m("./zlib/gzheader"),b=Object.prototype.toString;function i(n){if(!(this instanceof i))return new i(n);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},n||{});var h=this.options;h.raw&&0<=h.windowBits&&h.windowBits<16&&(h.windowBits=-h.windowBits,h.windowBits===0&&(h.windowBits=-15)),!(0<=h.windowBits&&h.windowBits<16)||n&&n.windowBits||(h.windowBits+=32),15<h.windowBits&&h.windowBits<48&&(15&h.windowBits)==0&&(h.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new y,this.strm.avail_out=0;var l=c.inflateInit2(this.strm,h.windowBits);if(l!==a.Z_OK)throw new Error(_[l]);this.header=new v,c.inflateGetHeader(this.strm,this.header)}function p(n,h){var l=new i(h);if(l.push(n,!0),l.err)throw l.msg||_[l.err];return l.result}i.prototype.push=function(n,h){var l,g,w,N,S,B,T=this.strm,M=this.options.chunkSize,O=this.options.dictionary,$=!1;if(this.ended)return!1;g=h===~~h?h:h===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof n=="string"?T.input=r.binstring2buf(n):b.call(n)==="[object ArrayBuffer]"?T.input=new Uint8Array(n):T.input=n,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new o.Buf8(M),T.next_out=0,T.avail_out=M),(l=c.inflate(T,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&O&&(B=typeof O=="string"?r.string2buf(O):b.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,l=c.inflateSetDictionary(this.strm,B)),l===a.Z_BUF_ERROR&&$===!0&&(l=a.Z_OK,$=!1),l!==a.Z_STREAM_END&&l!==a.Z_OK)return this.onEnd(l),!(this.ended=!0);T.next_out&&(T.avail_out!==0&&l!==a.Z_STREAM_END&&(T.avail_in!==0||g!==a.Z_FINISH&&g!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=r.utf8border(T.output,T.next_out),N=T.next_out-w,S=r.buf2string(T.output,w),T.next_out=N,T.avail_out=M-N,N&&o.arraySet(T.output,T.output,w,N,0),this.onData(S)):this.onData(o.shrinkBuf(T.output,T.next_out)))),T.avail_in===0&&T.avail_out===0&&($=!0)}while((0<T.avail_in||T.avail_out===0)&&l!==a.Z_STREAM_END);return l===a.Z_STREAM_END&&(g=a.Z_FINISH),g===a.Z_FINISH?(l=c.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===a.Z_OK):g!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(T.avail_out=0))},i.prototype.onData=function(n){this.chunks.push(n)},i.prototype.onEnd=function(n){n===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},x.Inflate=i,x.inflate=p,x.inflateRaw=function(n,h){return(h=h||{}).raw=!0,p(n,h)},x.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(m,C,x){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";x.assign=function(a){for(var _=Array.prototype.slice.call(arguments,1);_.length;){var y=_.shift();if(y){if(typeof y!="object")throw new TypeError(y+"must be non-object");for(var v in y)y.hasOwnProperty(v)&&(a[v]=y[v])}}return a},x.shrinkBuf=function(a,_){return a.length===_?a:a.subarray?a.subarray(0,_):(a.length=_,a)};var o={arraySet:function(a,_,y,v,b){if(_.subarray&&a.subarray)a.set(_.subarray(y,y+v),b);else for(var i=0;i<v;i++)a[b+i]=_[y+i]},flattenChunks:function(a){var _,y,v,b,i,p;for(_=v=0,y=a.length;_<y;_++)v+=a[_].length;for(p=new Uint8Array(v),_=b=0,y=a.length;_<y;_++)i=a[_],p.set(i,b),b+=i.length;return p}},r={arraySet:function(a,_,y,v,b){for(var i=0;i<v;i++)a[b+i]=_[y+i]},flattenChunks:function(a){return[].concat.apply([],a)}};x.setTyped=function(a){a?(x.Buf8=Uint8Array,x.Buf16=Uint16Array,x.Buf32=Int32Array,x.assign(x,o)):(x.Buf8=Array,x.Buf16=Array,x.Buf32=Array,x.assign(x,r))},x.setTyped(c)},{}],42:[function(m,C,x){var c=m("./common"),o=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var a=new c.Buf8(256),_=0;_<256;_++)a[_]=252<=_?6:248<=_?5:240<=_?4:224<=_?3:192<=_?2:1;function y(v,b){if(b<65537&&(v.subarray&&r||!v.subarray&&o))return String.fromCharCode.apply(null,c.shrinkBuf(v,b));for(var i="",p=0;p<b;p++)i+=String.fromCharCode(v[p]);return i}a[254]=a[254]=1,x.string2buf=function(v){var b,i,p,n,h,l=v.length,g=0;for(n=0;n<l;n++)(64512&(i=v.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=v.charCodeAt(n+1)))==56320&&(i=65536+(i-55296<<10)+(p-56320),n++),g+=i<128?1:i<2048?2:i<65536?3:4;for(b=new c.Buf8(g),n=h=0;h<g;n++)(64512&(i=v.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=v.charCodeAt(n+1)))==56320&&(i=65536+(i-55296<<10)+(p-56320),n++),i<128?b[h++]=i:(i<2048?b[h++]=192|i>>>6:(i<65536?b[h++]=224|i>>>12:(b[h++]=240|i>>>18,b[h++]=128|i>>>12&63),b[h++]=128|i>>>6&63),b[h++]=128|63&i);return b},x.buf2binstring=function(v){return y(v,v.length)},x.binstring2buf=function(v){for(var b=new c.Buf8(v.length),i=0,p=b.length;i<p;i++)b[i]=v.charCodeAt(i);return b},x.buf2string=function(v,b){var i,p,n,h,l=b||v.length,g=new Array(2*l);for(i=p=0;i<l;)if((n=v[i++])<128)g[p++]=n;else if(4<(h=a[n]))g[p++]=65533,i+=h-1;else{for(n&=h===2?31:h===3?15:7;1<h&&i<l;)n=n<<6|63&v[i++],h--;1<h?g[p++]=65533:n<65536?g[p++]=n:(n-=65536,g[p++]=55296|n>>10&1023,g[p++]=56320|1023&n)}return y(g,p)},x.utf8border=function(v,b){var i;for((b=b||v.length)>v.length&&(b=v.length),i=b-1;0<=i&&(192&v[i])==128;)i--;return i<0||i===0?b:i+a[v[i]]>b?i:b}},{"./common":41}],43:[function(m,C,x){C.exports=function(c,o,r,a){for(var _=65535&c|0,y=c>>>16&65535|0,v=0;r!==0;){for(r-=v=2e3<r?2e3:r;y=y+(_=_+o[a++]|0)|0,--v;);_%=65521,y%=65521}return _|y<<16|0}},{}],44:[function(m,C,x){C.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(m,C,x){var c=(function(){for(var o,r=[],a=0;a<256;a++){o=a;for(var _=0;_<8;_++)o=1&o?3988292384^o>>>1:o>>>1;r[a]=o}return r})();C.exports=function(o,r,a,_){var y=c,v=_+a;o^=-1;for(var b=_;b<v;b++)o=o>>>8^y[255&(o^r[b])];return-1^o}},{}],46:[function(m,C,x){var c,o=m("../utils/common"),r=m("./trees"),a=m("./adler32"),_=m("./crc32"),y=m("./messages"),v=0,b=4,i=0,p=-2,n=-1,h=4,l=2,g=8,w=9,N=286,S=30,B=19,T=2*N+1,M=15,O=3,$=258,re=$+O+1,u=42,D=113,t=1,R=2,Y=3,L=4;function ae(e,F){return e.msg=y[F],F}function H(e){return(e<<1)-(4<e?9:0)}function ne(e){for(var F=e.length;0<=--F;)e[F]=0}function z(e){var F=e.state,I=F.pending;I>e.avail_out&&(I=e.avail_out),I!==0&&(o.arraySet(e.output,F.pending_buf,F.pending_out,I,e.next_out),e.next_out+=I,F.pending_out+=I,e.total_out+=I,e.avail_out-=I,F.pending-=I,F.pending===0&&(F.pending_out=0))}function E(e,F){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,F),e.block_start=e.strstart,z(e.strm)}function ee(e,F){e.pending_buf[e.pending++]=F}function V(e,F){e.pending_buf[e.pending++]=F>>>8&255,e.pending_buf[e.pending++]=255&F}function q(e,F){var I,f,d=e.max_chain_length,k=e.strstart,P=e.prev_length,U=e.nice_match,A=e.strstart>e.w_size-re?e.strstart-(e.w_size-re):0,Z=e.window,K=e.w_mask,G=e.prev,te=e.strstart+$,ce=Z[k+P-1],se=Z[k+P];e.prev_length>=e.good_match&&(d>>=2),U>e.lookahead&&(U=e.lookahead);do if(Z[(I=F)+P]===se&&Z[I+P-1]===ce&&Z[I]===Z[k]&&Z[++I]===Z[k+1]){k+=2,I++;do;while(Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&Z[++k]===Z[++I]&&k<te);if(f=$-(te-k),k=te-$,P<f){if(e.match_start=F,U<=(P=f))break;ce=Z[k+P-1],se=Z[k+P]}}while((F=G[F&K])>A&&--d!=0);return P<=e.lookahead?P:e.lookahead}function he(e){var F,I,f,d,k,P,U,A,Z,K,G=e.w_size;do{if(d=e.window_size-e.lookahead-e.strstart,e.strstart>=G+(G-re)){for(o.arraySet(e.window,e.window,G,G,0),e.match_start-=G,e.strstart-=G,e.block_start-=G,F=I=e.hash_size;f=e.head[--F],e.head[F]=G<=f?f-G:0,--I;);for(F=I=G;f=e.prev[--F],e.prev[F]=G<=f?f-G:0,--I;);d+=G}if(e.strm.avail_in===0)break;if(P=e.strm,U=e.window,A=e.strstart+e.lookahead,Z=d,K=void 0,K=P.avail_in,Z<K&&(K=Z),I=K===0?0:(P.avail_in-=K,o.arraySet(U,P.input,P.next_in,K,A),P.state.wrap===1?P.adler=a(P.adler,U,K,A):P.state.wrap===2&&(P.adler=_(P.adler,U,K,A)),P.next_in+=K,P.total_in+=K,K),e.lookahead+=I,e.lookahead+e.insert>=O)for(k=e.strstart-e.insert,e.ins_h=e.window[k],e.ins_h=(e.ins_h<<e.hash_shift^e.window[k+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[k+O-1])&e.hash_mask,e.prev[k&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=k,k++,e.insert--,!(e.lookahead+e.insert<O)););}while(e.lookahead<re&&e.strm.avail_in!==0)}function pe(e,F){for(var I,f;;){if(e.lookahead<re){if(he(e),e.lookahead<re&&F===v)return t;if(e.lookahead===0)break}if(I=0,e.lookahead>=O&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,I=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),I!==0&&e.strstart-I<=e.w_size-re&&(e.match_length=q(e,I)),e.match_length>=O)if(f=r._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,I=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,--e.match_length!=0;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else f=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(f&&(E(e,!1),e.strm.avail_out===0))return t}return e.insert=e.strstart<O-1?e.strstart:O-1,F===b?(E(e,!0),e.strm.avail_out===0?Y:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:R}function oe(e,F){for(var I,f,d;;){if(e.lookahead<re){if(he(e),e.lookahead<re&&F===v)return t;if(e.lookahead===0)break}if(I=0,e.lookahead>=O&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,I=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=O-1,I!==0&&e.prev_length<e.max_lazy_match&&e.strstart-I<=e.w_size-re&&(e.match_length=q(e,I),e.match_length<=5&&(e.strategy===1||e.match_length===O&&4096<e.strstart-e.match_start)&&(e.match_length=O-1)),e.prev_length>=O&&e.match_length<=e.prev_length){for(d=e.strstart+e.lookahead-O,f=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=d&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,I=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),--e.prev_length!=0;);if(e.match_available=0,e.match_length=O-1,e.strstart++,f&&(E(e,!1),e.strm.avail_out===0))return t}else if(e.match_available){if((f=r._tr_tally(e,0,e.window[e.strstart-1]))&&E(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return t}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(f=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<O-1?e.strstart:O-1,F===b?(E(e,!0),e.strm.avail_out===0?Y:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:R}function le(e,F,I,f,d){this.good_length=e,this.max_lazy=F,this.nice_length=I,this.max_chain=f,this.func=d}function ge(){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=g,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 o.Buf16(2*T),this.dyn_dtree=new o.Buf16(2*(2*S+1)),this.bl_tree=new o.Buf16(2*(2*B+1)),ne(this.dyn_ltree),ne(this.dyn_dtree),ne(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(M+1),this.heap=new o.Buf16(2*N+1),ne(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*N+1),ne(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 ue(e){var F;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=l,(F=e.state).pending=0,F.pending_out=0,F.wrap<0&&(F.wrap=-F.wrap),F.status=F.wrap?u:D,e.adler=F.wrap===2?0:1,F.last_flush=v,r._tr_init(F),i):ae(e,p)}function we(e){var F=ue(e);return F===i&&(function(I){I.window_size=2*I.w_size,ne(I.head),I.max_lazy_match=c[I.level].max_lazy,I.good_match=c[I.level].good_length,I.nice_match=c[I.level].nice_length,I.max_chain_length=c[I.level].max_chain,I.strstart=0,I.block_start=0,I.lookahead=0,I.insert=0,I.match_length=I.prev_length=O-1,I.match_available=0,I.ins_h=0})(e.state),F}function ye(e,F,I,f,d,k){if(!e)return p;var P=1;if(F===n&&(F=6),f<0?(P=0,f=-f):15<f&&(P=2,f-=16),d<1||w<d||I!==g||f<8||15<f||F<0||9<F||k<0||h<k)return ae(e,p);f===8&&(f=9);var U=new ge;return(e.state=U).strm=e,U.wrap=P,U.gzhead=null,U.w_bits=f,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=d+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+O-1)/O),U.window=new o.Buf8(2*U.w_size),U.head=new o.Buf16(U.hash_size),U.prev=new o.Buf16(U.w_size),U.lit_bufsize=1<<d+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new o.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=F,U.strategy=k,U.method=I,we(e)}c=[new le(0,0,0,0,function(e,F){var I=65535;for(I>e.pending_buf_size-5&&(I=e.pending_buf_size-5);;){if(e.lookahead<=1){if(he(e),e.lookahead===0&&F===v)return t;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var f=e.block_start+I;if((e.strstart===0||e.strstart>=f)&&(e.lookahead=e.strstart-f,e.strstart=f,E(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-re&&(E(e,!1),e.strm.avail_out===0))return t}return e.insert=0,F===b?(E(e,!0),e.strm.avail_out===0?Y:L):(e.strstart>e.block_start&&(E(e,!1),e.strm.avail_out),t)}),new le(4,4,8,4,pe),new le(4,5,16,8,pe),new le(4,6,32,32,pe),new le(4,4,16,16,oe),new le(8,16,32,32,oe),new le(8,16,128,128,oe),new le(8,32,128,256,oe),new le(32,128,258,1024,oe),new le(32,258,258,4096,oe)],x.deflateInit=function(e,F){return ye(e,F,g,15,8,0)},x.deflateInit2=ye,x.deflateReset=we,x.deflateResetKeep=ue,x.deflateSetHeader=function(e,F){return e&&e.state?e.state.wrap!==2?p:(e.state.gzhead=F,i):p},x.deflate=function(e,F){var I,f,d,k;if(!e||!e.state||5<F||F<0)return e?ae(e,p):p;if(f=e.state,!e.output||!e.input&&e.avail_in!==0||f.status===666&&F!==b)return ae(e,e.avail_out===0?-5:p);if(f.strm=e,I=f.last_flush,f.last_flush=F,f.status===u)if(f.wrap===2)e.adler=0,ee(f,31),ee(f,139),ee(f,8),f.gzhead?(ee(f,(f.gzhead.text?1:0)+(f.gzhead.hcrc?2:0)+(f.gzhead.extra?4:0)+(f.gzhead.name?8:0)+(f.gzhead.comment?16:0)),ee(f,255&f.gzhead.time),ee(f,f.gzhead.time>>8&255),ee(f,f.gzhead.time>>16&255),ee(f,f.gzhead.time>>24&255),ee(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),ee(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(ee(f,255&f.gzhead.extra.length),ee(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(e.adler=_(e.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(ee(f,0),ee(f,0),ee(f,0),ee(f,0),ee(f,0),ee(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),ee(f,3),f.status=D);else{var P=g+(f.w_bits-8<<4)<<8;P|=(2<=f.strategy||f.level<2?0:f.level<6?1:f.level===6?2:3)<<6,f.strstart!==0&&(P|=32),P+=31-P%31,f.status=D,V(f,P),f.strstart!==0&&(V(f,e.adler>>>16),V(f,65535&e.adler)),e.adler=1}if(f.status===69)if(f.gzhead.extra){for(d=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),z(e),d=f.pending,f.pending!==f.pending_buf_size));)ee(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(f.status===73)if(f.gzhead.name){d=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),z(e),d=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindex<f.gzhead.name.length?255&f.gzhead.name.charCodeAt(f.gzindex++):0,ee(f,k)}while(k!==0);f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),k===0&&(f.gzindex=0,f.status=91)}else f.status=91;if(f.status===91)if(f.gzhead.comment){d=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),z(e),d=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindex<f.gzhead.comment.length?255&f.gzhead.comment.charCodeAt(f.gzindex++):0,ee(f,k)}while(k!==0);f.gzhead.hcrc&&f.pending>d&&(e.adler=_(e.adler,f.pending_buf,f.pending-d,d)),k===0&&(f.status=103)}else f.status=103;if(f.status===103&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&z(e),f.pending+2<=f.pending_buf_size&&(ee(f,255&e.adler),ee(f,e.adler>>8&255),e.adler=0,f.status=D)):f.status=D),f.pending!==0){if(z(e),e.avail_out===0)return f.last_flush=-1,i}else if(e.avail_in===0&&H(F)<=H(I)&&F!==b)return ae(e,-5);if(f.status===666&&e.avail_in!==0)return ae(e,-5);if(e.avail_in!==0||f.lookahead!==0||F!==v&&f.status!==666){var U=f.strategy===2?(function(A,Z){for(var K;;){if(A.lookahead===0&&(he(A),A.lookahead===0)){if(Z===v)return t;break}if(A.match_length=0,K=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,K&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,Z===b?(E(A,!0),A.strm.avail_out===0?Y:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:R})(f,F):f.strategy===3?(function(A,Z){for(var K,G,te,ce,se=A.window;;){if(A.lookahead<=$){if(he(A),A.lookahead<=$&&Z===v)return t;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=O&&0<A.strstart&&(G=se[te=A.strstart-1])===se[++te]&&G===se[++te]&&G===se[++te]){ce=A.strstart+$;do;while(G===se[++te]&&G===se[++te]&&G===se[++te]&&G===se[++te]&&G===se[++te]&&G===se[++te]&&G===se[++te]&&G===se[++te]&&te<ce);A.match_length=$-(ce-te),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=O?(K=r._tr_tally(A,1,A.match_length-O),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(K=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),K&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,Z===b?(E(A,!0),A.strm.avail_out===0?Y:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:R})(f,F):c[f.level].func(f,F);if(U!==Y&&U!==L||(f.status=666),U===t||U===Y)return e.avail_out===0&&(f.last_flush=-1),i;if(U===R&&(F===1?r._tr_align(f):F!==5&&(r._tr_stored_block(f,0,0,!1),F===3&&(ne(f.head),f.lookahead===0&&(f.strstart=0,f.block_start=0,f.insert=0))),z(e),e.avail_out===0))return f.last_flush=-1,i}return F!==b?i:f.wrap<=0?1:(f.wrap===2?(ee(f,255&e.adler),ee(f,e.adler>>8&255),ee(f,e.adler>>16&255),ee(f,e.adler>>24&255),ee(f,255&e.total_in),ee(f,e.total_in>>8&255),ee(f,e.total_in>>16&255),ee(f,e.total_in>>24&255)):(V(f,e.adler>>>16),V(f,65535&e.adler)),z(e),0<f.wrap&&(f.wrap=-f.wrap),f.pending!==0?i:1)},x.deflateEnd=function(e){var F;return e&&e.state?(F=e.state.status)!==u&&F!==69&&F!==73&&F!==91&&F!==103&&F!==D&&F!==666?ae(e,p):(e.state=null,F===D?ae(e,-3):i):p},x.deflateSetDictionary=function(e,F){var I,f,d,k,P,U,A,Z,K=F.length;if(!e||!e.state||(k=(I=e.state).wrap)===2||k===1&&I.status!==u||I.lookahead)return p;for(k===1&&(e.adler=a(e.adler,F,K,0)),I.wrap=0,K>=I.w_size&&(k===0&&(ne(I.head),I.strstart=0,I.block_start=0,I.insert=0),Z=new o.Buf8(I.w_size),o.arraySet(Z,F,K-I.w_size,I.w_size,0),F=Z,K=I.w_size),P=e.avail_in,U=e.next_in,A=e.input,e.avail_in=K,e.next_in=0,e.input=F,he(I);I.lookahead>=O;){for(f=I.strstart,d=I.lookahead-(O-1);I.ins_h=(I.ins_h<<I.hash_shift^I.window[f+O-1])&I.hash_mask,I.prev[f&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=f,f++,--d;);I.strstart=f,I.lookahead=O-1,he(I)}return I.strstart+=I.lookahead,I.block_start=I.strstart,I.insert=I.lookahead,I.lookahead=0,I.match_length=I.prev_length=O-1,I.match_available=0,e.next_in=U,e.input=A,e.avail_in=P,I.wrap=k,i},x.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(m,C,x){C.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(m,C,x){C.exports=function(c,o){var r,a,_,y,v,b,i,p,n,h,l,g,w,N,S,B,T,M,O,$,re,u,D,t,R;r=c.state,a=c.next_in,t=c.input,_=a+(c.avail_in-5),y=c.next_out,R=c.output,v=y-(o-c.avail_out),b=y+(c.avail_out-257),i=r.dmax,p=r.wsize,n=r.whave,h=r.wnext,l=r.window,g=r.hold,w=r.bits,N=r.lencode,S=r.distcode,B=(1<<r.lenbits)-1,T=(1<<r.distbits)-1;e:do{w<15&&(g+=t[a++]<<w,w+=8,g+=t[a++]<<w,w+=8),M=N[g&B];t:for(;;){if(g>>>=O=M>>>24,w-=O,(O=M>>>16&255)===0)R[y++]=65535&M;else{if(!(16&O)){if((64&O)==0){M=N[(65535&M)+(g&(1<<O)-1)];continue t}if(32&O){r.mode=12;break e}c.msg="invalid literal/length code",r.mode=30;break e}$=65535&M,(O&=15)&&(w<O&&(g+=t[a++]<<w,w+=8),$+=g&(1<<O)-1,g>>>=O,w-=O),w<15&&(g+=t[a++]<<w,w+=8,g+=t[a++]<<w,w+=8),M=S[g&T];r:for(;;){if(g>>>=O=M>>>24,w-=O,!(16&(O=M>>>16&255))){if((64&O)==0){M=S[(65535&M)+(g&(1<<O)-1)];continue r}c.msg="invalid distance code",r.mode=30;break e}if(re=65535&M,w<(O&=15)&&(g+=t[a++]<<w,(w+=8)<O&&(g+=t[a++]<<w,w+=8)),i<(re+=g&(1<<O)-1)){c.msg="invalid distance too far back",r.mode=30;break e}if(g>>>=O,w-=O,(O=y-v)<re){if(n<(O=re-O)&&r.sane){c.msg="invalid distance too far back",r.mode=30;break e}if(D=l,(u=0)===h){if(u+=p-O,O<$){for($-=O;R[y++]=l[u++],--O;);u=y-re,D=R}}else if(h<O){if(u+=p+h-O,(O-=h)<$){for($-=O;R[y++]=l[u++],--O;);if(u=0,h<$){for($-=O=h;R[y++]=l[u++],--O;);u=y-re,D=R}}}else if(u+=h-O,O<$){for($-=O;R[y++]=l[u++],--O;);u=y-re,D=R}for(;2<$;)R[y++]=D[u++],R[y++]=D[u++],R[y++]=D[u++],$-=3;$&&(R[y++]=D[u++],1<$&&(R[y++]=D[u++]))}else{for(u=y-re;R[y++]=R[u++],R[y++]=R[u++],R[y++]=R[u++],2<($-=3););$&&(R[y++]=R[u++],1<$&&(R[y++]=R[u++]))}break}}break}}while(a<_&&y<b);a-=$=w>>3,g&=(1<<(w-=$<<3))-1,c.next_in=a,c.next_out=y,c.avail_in=a<_?_-a+5:5-(a-_),c.avail_out=y<b?b-y+257:257-(y-b),r.hold=g,r.bits=w}},{}],49:[function(m,C,x){var c=m("../utils/common"),o=m("./adler32"),r=m("./crc32"),a=m("./inffast"),_=m("./inftrees"),y=1,v=2,b=0,i=-2,p=1,n=852,h=592;function l(u){return(u>>>24&255)+(u>>>8&65280)+((65280&u)<<8)+((255&u)<<24)}function g(){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 c.Buf16(320),this.work=new c.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(u){var D;return u&&u.state?(D=u.state,u.total_in=u.total_out=D.total=0,u.msg="",D.wrap&&(u.adler=1&D.wrap),D.mode=p,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new c.Buf32(n),D.distcode=D.distdyn=new c.Buf32(h),D.sane=1,D.back=-1,b):i}function N(u){var D;return u&&u.state?((D=u.state).wsize=0,D.whave=0,D.wnext=0,w(u)):i}function S(u,D){var t,R;return u&&u.state?(R=u.state,D<0?(t=0,D=-D):(t=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?i:(R.window!==null&&R.wbits!==D&&(R.window=null),R.wrap=t,R.wbits=D,N(u))):i}function B(u,D){var t,R;return u?(R=new g,(u.state=R).window=null,(t=S(u,D))!==b&&(u.state=null),t):i}var T,M,O=!0;function $(u){if(O){var D;for(T=new c.Buf32(512),M=new c.Buf32(32),D=0;D<144;)u.lens[D++]=8;for(;D<256;)u.lens[D++]=9;for(;D<280;)u.lens[D++]=7;for(;D<288;)u.lens[D++]=8;for(_(y,u.lens,0,288,T,0,u.work,{bits:9}),D=0;D<32;)u.lens[D++]=5;_(v,u.lens,0,32,M,0,u.work,{bits:5}),O=!1}u.lencode=T,u.lenbits=9,u.distcode=M,u.distbits=5}function re(u,D,t,R){var Y,L=u.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new c.Buf8(L.wsize)),R>=L.wsize?(c.arraySet(L.window,D,t-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(R<(Y=L.wsize-L.wnext)&&(Y=R),c.arraySet(L.window,D,t-R,Y,L.wnext),(R-=Y)?(c.arraySet(L.window,D,t-R,R,0),L.wnext=R,L.whave=L.wsize):(L.wnext+=Y,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=Y))),0}x.inflateReset=N,x.inflateReset2=S,x.inflateResetKeep=w,x.inflateInit=function(u){return B(u,15)},x.inflateInit2=B,x.inflate=function(u,D){var t,R,Y,L,ae,H,ne,z,E,ee,V,q,he,pe,oe,le,ge,ue,we,ye,e,F,I,f,d=0,k=new c.Buf8(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!u||!u.state||!u.output||!u.input&&u.avail_in!==0)return i;(t=u.state).mode===12&&(t.mode=13),ae=u.next_out,Y=u.output,ne=u.avail_out,L=u.next_in,R=u.input,H=u.avail_in,z=t.hold,E=t.bits,ee=H,V=ne,F=b;e:for(;;)switch(t.mode){case p:if(t.wrap===0){t.mode=13;break}for(;E<16;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(2&t.wrap&&z===35615){k[t.check=0]=255&z,k[1]=z>>>8&255,t.check=r(t.check,k,2,0),E=z=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&z)<<8)+(z>>8))%31){u.msg="incorrect header check",t.mode=30;break}if((15&z)!=8){u.msg="unknown compression method",t.mode=30;break}if(E-=4,e=8+(15&(z>>>=4)),t.wbits===0)t.wbits=e;else if(e>t.wbits){u.msg="invalid window size",t.mode=30;break}t.dmax=1<<e,u.adler=t.check=1,t.mode=512&z?10:12,E=z=0;break;case 2:for(;E<16;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(t.flags=z,(255&t.flags)!=8){u.msg="unknown compression method",t.mode=30;break}if(57344&t.flags){u.msg="unknown header flags set",t.mode=30;break}t.head&&(t.head.text=z>>8&1),512&t.flags&&(k[0]=255&z,k[1]=z>>>8&255,t.check=r(t.check,k,2,0)),E=z=0,t.mode=3;case 3:for(;E<32;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.head&&(t.head.time=z),512&t.flags&&(k[0]=255&z,k[1]=z>>>8&255,k[2]=z>>>16&255,k[3]=z>>>24&255,t.check=r(t.check,k,4,0)),E=z=0,t.mode=4;case 4:for(;E<16;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.head&&(t.head.xflags=255&z,t.head.os=z>>8),512&t.flags&&(k[0]=255&z,k[1]=z>>>8&255,t.check=r(t.check,k,2,0)),E=z=0,t.mode=5;case 5:if(1024&t.flags){for(;E<16;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.length=z,t.head&&(t.head.extra_len=z),512&t.flags&&(k[0]=255&z,k[1]=z>>>8&255,t.check=r(t.check,k,2,0)),E=z=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&(H<(q=t.length)&&(q=H),q&&(t.head&&(e=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),c.arraySet(t.head.extra,R,L,q,e)),512&t.flags&&(t.check=r(t.check,R,q,L)),H-=q,L+=q,t.length-=q),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(H===0)break e;for(q=0;e=R[L+q++],t.head&&e&&t.length<65536&&(t.head.name+=String.fromCharCode(e)),e&&q<H;);if(512&t.flags&&(t.check=r(t.check,R,q,L)),H-=q,L+=q,e)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=8;case 8:if(4096&t.flags){if(H===0)break e;for(q=0;e=R[L+q++],t.head&&e&&t.length<65536&&(t.head.comment+=String.fromCharCode(e)),e&&q<H;);if(512&t.flags&&(t.check=r(t.check,R,q,L)),H-=q,L+=q,e)break e}else t.head&&(t.head.comment=null);t.mode=9;case 9:if(512&t.flags){for(;E<16;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(z!==(65535&t.check)){u.msg="header crc mismatch",t.mode=30;break}E=z=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),u.adler=t.check=0,t.mode=12;break;case 10:for(;E<32;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}u.adler=t.check=l(z),E=z=0,t.mode=11;case 11:if(t.havedict===0)return u.next_out=ae,u.avail_out=ne,u.next_in=L,u.avail_in=H,t.hold=z,t.bits=E,2;u.adler=t.check=1,t.mode=12;case 12:if(D===5||D===6)break e;case 13:if(t.last){z>>>=7&E,E-=7&E,t.mode=27;break}for(;E<3;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}switch(t.last=1&z,E-=1,3&(z>>>=1)){case 0:t.mode=14;break;case 1:if($(t),t.mode=20,D!==6)break;z>>>=2,E-=2;break e;case 2:t.mode=17;break;case 3:u.msg="invalid block type",t.mode=30}z>>>=2,E-=2;break;case 14:for(z>>>=7&E,E-=7&E;E<32;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if((65535&z)!=(z>>>16^65535)){u.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&z,E=z=0,t.mode=15,D===6)break e;case 15:t.mode=16;case 16:if(q=t.length){if(H<q&&(q=H),ne<q&&(q=ne),q===0)break e;c.arraySet(Y,R,L,q,ae),H-=q,L+=q,ne-=q,ae+=q,t.length-=q;break}t.mode=12;break;case 17:for(;E<14;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(t.nlen=257+(31&z),z>>>=5,E-=5,t.ndist=1+(31&z),z>>>=5,E-=5,t.ncode=4+(15&z),z>>>=4,E-=4,286<t.nlen||30<t.ndist){u.msg="too many length or distance symbols",t.mode=30;break}t.have=0,t.mode=18;case 18:for(;t.have<t.ncode;){for(;E<3;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.lens[P[t.have++]]=7&z,z>>>=3,E-=3}for(;t.have<19;)t.lens[P[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,I={bits:t.lenbits},F=_(0,t.lens,0,19,t.lencode,0,t.work,I),t.lenbits=I.bits,F){u.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have<t.nlen+t.ndist;){for(;le=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,ge=65535&d,!((oe=d>>>24)<=E);){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(ge<16)z>>>=oe,E-=oe,t.lens[t.have++]=ge;else{if(ge===16){for(f=oe+2;E<f;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(z>>>=oe,E-=oe,t.have===0){u.msg="invalid bit length repeat",t.mode=30;break}e=t.lens[t.have-1],q=3+(3&z),z>>>=2,E-=2}else if(ge===17){for(f=oe+3;E<f;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}E-=oe,e=0,q=3+(7&(z>>>=oe)),z>>>=3,E-=3}else{for(f=oe+7;E<f;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}E-=oe,e=0,q=11+(127&(z>>>=oe)),z>>>=7,E-=7}if(t.have+q>t.nlen+t.ndist){u.msg="invalid bit length repeat",t.mode=30;break}for(;q--;)t.lens[t.have++]=e}}if(t.mode===30)break;if(t.lens[256]===0){u.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,I={bits:t.lenbits},F=_(y,t.lens,0,t.nlen,t.lencode,0,t.work,I),t.lenbits=I.bits,F){u.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,I={bits:t.distbits},F=_(v,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,I),t.distbits=I.bits,F){u.msg="invalid distances set",t.mode=30;break}if(t.mode=20,D===6)break e;case 20:t.mode=21;case 21:if(6<=H&&258<=ne){u.next_out=ae,u.avail_out=ne,u.next_in=L,u.avail_in=H,t.hold=z,t.bits=E,a(u,V),ae=u.next_out,Y=u.output,ne=u.avail_out,L=u.next_in,R=u.input,H=u.avail_in,z=t.hold,E=t.bits,t.mode===12&&(t.back=-1);break}for(t.back=0;le=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,ge=65535&d,!((oe=d>>>24)<=E);){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(le&&(240&le)==0){for(ue=oe,we=le,ye=ge;le=(d=t.lencode[ye+((z&(1<<ue+we)-1)>>ue)])>>>16&255,ge=65535&d,!(ue+(oe=d>>>24)<=E);){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}z>>>=ue,E-=ue,t.back+=ue}if(z>>>=oe,E-=oe,t.back+=oe,t.length=ge,le===0){t.mode=26;break}if(32&le){t.back=-1,t.mode=12;break}if(64&le){u.msg="invalid literal/length code",t.mode=30;break}t.extra=15&le,t.mode=22;case 22:if(t.extra){for(f=t.extra;E<f;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.length+=z&(1<<t.extra)-1,z>>>=t.extra,E-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;le=(d=t.distcode[z&(1<<t.distbits)-1])>>>16&255,ge=65535&d,!((oe=d>>>24)<=E);){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if((240&le)==0){for(ue=oe,we=le,ye=ge;le=(d=t.distcode[ye+((z&(1<<ue+we)-1)>>ue)])>>>16&255,ge=65535&d,!(ue+(oe=d>>>24)<=E);){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}z>>>=ue,E-=ue,t.back+=ue}if(z>>>=oe,E-=oe,t.back+=oe,64&le){u.msg="invalid distance code",t.mode=30;break}t.offset=ge,t.extra=15&le,t.mode=24;case 24:if(t.extra){for(f=t.extra;E<f;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}t.offset+=z&(1<<t.extra)-1,z>>>=t.extra,E-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){u.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(ne===0)break e;if(q=V-ne,t.offset>q){if((q=t.offset-q)>t.whave&&t.sane){u.msg="invalid distance too far back",t.mode=30;break}he=q>t.wnext?(q-=t.wnext,t.wsize-q):t.wnext-q,q>t.length&&(q=t.length),pe=t.window}else pe=Y,he=ae-t.offset,q=t.length;for(ne<q&&(q=ne),ne-=q,t.length-=q;Y[ae++]=pe[he++],--q;);t.length===0&&(t.mode=21);break;case 26:if(ne===0)break e;Y[ae++]=t.length,ne--,t.mode=21;break;case 27:if(t.wrap){for(;E<32;){if(H===0)break e;H--,z|=R[L++]<<E,E+=8}if(V-=ne,u.total_out+=V,t.total+=V,V&&(u.adler=t.check=t.flags?r(t.check,Y,V,ae-V):o(t.check,Y,V,ae-V)),V=ne,(t.flags?z:l(z))!==t.check){u.msg="incorrect data check",t.mode=30;break}E=z=0}t.mode=28;case 28:if(t.wrap&&t.flags){for(;E<32;){if(H===0)break e;H--,z+=R[L++]<<E,E+=8}if(z!==(4294967295&t.total)){u.msg="incorrect length check",t.mode=30;break}E=z=0}t.mode=29;case 29:F=1;break e;case 30:F=-3;break e;case 31:return-4;case 32:default:return i}return u.next_out=ae,u.avail_out=ne,u.next_in=L,u.avail_in=H,t.hold=z,t.bits=E,(t.wsize||V!==u.avail_out&&t.mode<30&&(t.mode<27||D!==4))&&re(u,u.output,u.next_out,V-u.avail_out)?(t.mode=31,-4):(ee-=u.avail_in,V-=u.avail_out,u.total_in+=ee,u.total_out+=V,t.total+=V,t.wrap&&V&&(u.adler=t.check=t.flags?r(t.check,Y,V,u.next_out-V):o(t.check,Y,V,u.next_out-V)),u.data_type=t.bits+(t.last?64:0)+(t.mode===12?128:0)+(t.mode===20||t.mode===15?256:0),(ee==0&&V===0||D===4)&&F===b&&(F=-5),F)},x.inflateEnd=function(u){if(!u||!u.state)return i;var D=u.state;return D.window&&(D.window=null),u.state=null,b},x.inflateGetHeader=function(u,D){var t;return u&&u.state?(2&(t=u.state).wrap)==0?i:((t.head=D).done=!1,b):i},x.inflateSetDictionary=function(u,D){var t,R=D.length;return u&&u.state?(t=u.state).wrap!==0&&t.mode!==11?i:t.mode===11&&o(1,D,R,0)!==t.check?-3:re(u,D,R,R)?(t.mode=31,-4):(t.havedict=1,b):i},x.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(m,C,x){var c=m("../utils/common"),o=[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],r=[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],a=[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],_=[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];C.exports=function(y,v,b,i,p,n,h,l){var g,w,N,S,B,T,M,O,$,re=l.bits,u=0,D=0,t=0,R=0,Y=0,L=0,ae=0,H=0,ne=0,z=0,E=null,ee=0,V=new c.Buf16(16),q=new c.Buf16(16),he=null,pe=0;for(u=0;u<=15;u++)V[u]=0;for(D=0;D<i;D++)V[v[b+D]]++;for(Y=re,R=15;1<=R&&V[R]===0;R--);if(R<Y&&(Y=R),R===0)return p[n++]=20971520,p[n++]=20971520,l.bits=1,0;for(t=1;t<R&&V[t]===0;t++);for(Y<t&&(Y=t),u=H=1;u<=15;u++)if(H<<=1,(H-=V[u])<0)return-1;if(0<H&&(y===0||R!==1))return-1;for(q[1]=0,u=1;u<15;u++)q[u+1]=q[u]+V[u];for(D=0;D<i;D++)v[b+D]!==0&&(h[q[v[b+D]]++]=D);if(T=y===0?(E=he=h,19):y===1?(E=o,ee-=257,he=r,pe-=257,256):(E=a,he=_,-1),u=t,B=n,ae=D=z=0,N=-1,S=(ne=1<<(L=Y))-1,y===1&&852<ne||y===2&&592<ne)return 1;for(;;){for(M=u-ae,$=h[D]<T?(O=0,h[D]):h[D]>T?(O=he[pe+h[D]],E[ee+h[D]]):(O=96,0),g=1<<u-ae,t=w=1<<L;p[B+(z>>ae)+(w-=g)]=M<<24|O<<16|$|0,w!==0;);for(g=1<<u-1;z&g;)g>>=1;if(g!==0?(z&=g-1,z+=g):z=0,D++,--V[u]==0){if(u===R)break;u=v[b+h[D]]}if(Y<u&&(z&S)!==N){for(ae===0&&(ae=Y),B+=t,H=1<<(L=u-ae);L+ae<R&&!((H-=V[L+ae])<=0);)L++,H<<=1;if(ne+=1<<L,y===1&&852<ne||y===2&&592<ne)return 1;p[N=z&S]=Y<<24|L<<16|B-n|0}}return z!==0&&(p[B+z]=u-ae<<24|64<<16|0),l.bits=Y,0}},{"../utils/common":41}],51:[function(m,C,x){C.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(m,C,x){var c=m("../utils/common"),o=0,r=1;function a(d){for(var k=d.length;0<=--k;)d[k]=0}var _=0,y=29,v=256,b=v+1+y,i=30,p=19,n=2*b+1,h=15,l=16,g=7,w=256,N=16,S=17,B=18,T=[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],M=[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],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],re=new Array(2*(b+2));a(re);var u=new Array(2*i);a(u);var D=new Array(512);a(D);var t=new Array(256);a(t);var R=new Array(y);a(R);var Y,L,ae,H=new Array(i);function ne(d,k,P,U,A){this.static_tree=d,this.extra_bits=k,this.extra_base=P,this.elems=U,this.max_length=A,this.has_stree=d&&d.length}function z(d,k){this.dyn_tree=d,this.max_code=0,this.stat_desc=k}function E(d){return d<256?D[d]:D[256+(d>>>7)]}function ee(d,k){d.pending_buf[d.pending++]=255&k,d.pending_buf[d.pending++]=k>>>8&255}function V(d,k,P){d.bi_valid>l-P?(d.bi_buf|=k<<d.bi_valid&65535,ee(d,d.bi_buf),d.bi_buf=k>>l-d.bi_valid,d.bi_valid+=P-l):(d.bi_buf|=k<<d.bi_valid&65535,d.bi_valid+=P)}function q(d,k,P){V(d,P[2*k],P[2*k+1])}function he(d,k){for(var P=0;P|=1&d,d>>>=1,P<<=1,0<--k;);return P>>>1}function pe(d,k,P){var U,A,Z=new Array(h+1),K=0;for(U=1;U<=h;U++)Z[U]=K=K+P[U-1]<<1;for(A=0;A<=k;A++){var G=d[2*A+1];G!==0&&(d[2*A]=he(Z[G]++,G))}}function oe(d){var k;for(k=0;k<b;k++)d.dyn_ltree[2*k]=0;for(k=0;k<i;k++)d.dyn_dtree[2*k]=0;for(k=0;k<p;k++)d.bl_tree[2*k]=0;d.dyn_ltree[2*w]=1,d.opt_len=d.static_len=0,d.last_lit=d.matches=0}function le(d){8<d.bi_valid?ee(d,d.bi_buf):0<d.bi_valid&&(d.pending_buf[d.pending++]=d.bi_buf),d.bi_buf=0,d.bi_valid=0}function ge(d,k,P,U){var A=2*k,Z=2*P;return d[A]<d[Z]||d[A]===d[Z]&&U[k]<=U[P]}function ue(d,k,P){for(var U=d.heap[P],A=P<<1;A<=d.heap_len&&(A<d.heap_len&&ge(k,d.heap[A+1],d.heap[A],d.depth)&&A++,!ge(k,U,d.heap[A],d.depth));)d.heap[P]=d.heap[A],P=A,A<<=1;d.heap[P]=U}function we(d,k,P){var U,A,Z,K,G=0;if(d.last_lit!==0)for(;U=d.pending_buf[d.d_buf+2*G]<<8|d.pending_buf[d.d_buf+2*G+1],A=d.pending_buf[d.l_buf+G],G++,U===0?q(d,A,k):(q(d,(Z=t[A])+v+1,k),(K=T[Z])!==0&&V(d,A-=R[Z],K),q(d,Z=E(--U),P),(K=M[Z])!==0&&V(d,U-=H[Z],K)),G<d.last_lit;);q(d,w,k)}function ye(d,k){var P,U,A,Z=k.dyn_tree,K=k.stat_desc.static_tree,G=k.stat_desc.has_stree,te=k.stat_desc.elems,ce=-1;for(d.heap_len=0,d.heap_max=n,P=0;P<te;P++)Z[2*P]!==0?(d.heap[++d.heap_len]=ce=P,d.depth[P]=0):Z[2*P+1]=0;for(;d.heap_len<2;)Z[2*(A=d.heap[++d.heap_len]=ce<2?++ce:0)]=1,d.depth[A]=0,d.opt_len--,G&&(d.static_len-=K[2*A+1]);for(k.max_code=ce,P=d.heap_len>>1;1<=P;P--)ue(d,Z,P);for(A=te;P=d.heap[1],d.heap[1]=d.heap[d.heap_len--],ue(d,Z,1),U=d.heap[1],d.heap[--d.heap_max]=P,d.heap[--d.heap_max]=U,Z[2*A]=Z[2*P]+Z[2*U],d.depth[A]=(d.depth[P]>=d.depth[U]?d.depth[P]:d.depth[U])+1,Z[2*P+1]=Z[2*U+1]=A,d.heap[1]=A++,ue(d,Z,1),2<=d.heap_len;);d.heap[--d.heap_max]=d.heap[1],(function(se,_e){var je,ve,Ne,me,Ce,De,ke=_e.dyn_tree,Te=_e.max_code,Fe=_e.stat_desc.static_tree,j=_e.stat_desc.has_stree,X=_e.stat_desc.extra_bits,J=_e.stat_desc.extra_base,de=_e.stat_desc.max_length,xe=0;for(me=0;me<=h;me++)se.bl_count[me]=0;for(ke[2*se.heap[se.heap_max]+1]=0,je=se.heap_max+1;je<n;je++)de<(me=ke[2*ke[2*(ve=se.heap[je])+1]+1]+1)&&(me=de,xe++),ke[2*ve+1]=me,Te<ve||(se.bl_count[me]++,Ce=0,J<=ve&&(Ce=X[ve-J]),De=ke[2*ve],se.opt_len+=De*(me+Ce),j&&(se.static_len+=De*(Fe[2*ve+1]+Ce)));if(xe!==0){do{for(me=de-1;se.bl_count[me]===0;)me--;se.bl_count[me]--,se.bl_count[me+1]+=2,se.bl_count[de]--,xe-=2}while(0<xe);for(me=de;me!==0;me--)for(ve=se.bl_count[me];ve!==0;)Te<(Ne=se.heap[--je])||(ke[2*Ne+1]!==me&&(se.opt_len+=(me-ke[2*Ne+1])*ke[2*Ne],ke[2*Ne+1]=me),ve--)}})(d,k),pe(Z,ce,d.bl_count)}function e(d,k,P){var U,A,Z=-1,K=k[1],G=0,te=7,ce=4;for(K===0&&(te=138,ce=3),k[2*(P+1)+1]=65535,U=0;U<=P;U++)A=K,K=k[2*(U+1)+1],++G<te&&A===K||(G<ce?d.bl_tree[2*A]+=G:A!==0?(A!==Z&&d.bl_tree[2*A]++,d.bl_tree[2*N]++):G<=10?d.bl_tree[2*S]++:d.bl_tree[2*B]++,Z=A,ce=(G=0)===K?(te=138,3):A===K?(te=6,3):(te=7,4))}function F(d,k,P){var U,A,Z=-1,K=k[1],G=0,te=7,ce=4;for(K===0&&(te=138,ce=3),U=0;U<=P;U++)if(A=K,K=k[2*(U+1)+1],!(++G<te&&A===K)){if(G<ce)for(;q(d,A,d.bl_tree),--G!=0;);else A!==0?(A!==Z&&(q(d,A,d.bl_tree),G--),q(d,N,d.bl_tree),V(d,G-3,2)):G<=10?(q(d,S,d.bl_tree),V(d,G-3,3)):(q(d,B,d.bl_tree),V(d,G-11,7));Z=A,ce=(G=0)===K?(te=138,3):A===K?(te=6,3):(te=7,4)}}a(H);var I=!1;function f(d,k,P,U){V(d,(_<<1)+(U?1:0),3),(function(A,Z,K,G){le(A),ee(A,K),ee(A,~K),c.arraySet(A.pending_buf,A.window,Z,K,A.pending),A.pending+=K})(d,k,P)}x._tr_init=function(d){I||((function(){var k,P,U,A,Z,K=new Array(h+1);for(A=U=0;A<y-1;A++)for(R[A]=U,k=0;k<1<<T[A];k++)t[U++]=A;for(t[U-1]=A,A=Z=0;A<16;A++)for(H[A]=Z,k=0;k<1<<M[A];k++)D[Z++]=A;for(Z>>=7;A<i;A++)for(H[A]=Z<<7,k=0;k<1<<M[A]-7;k++)D[256+Z++]=A;for(P=0;P<=h;P++)K[P]=0;for(k=0;k<=143;)re[2*k+1]=8,k++,K[8]++;for(;k<=255;)re[2*k+1]=9,k++,K[9]++;for(;k<=279;)re[2*k+1]=7,k++,K[7]++;for(;k<=287;)re[2*k+1]=8,k++,K[8]++;for(pe(re,b+1,K),k=0;k<i;k++)u[2*k+1]=5,u[2*k]=he(k,5);Y=new ne(re,T,v+1,b,h),L=new ne(u,M,0,i,h),ae=new ne(new Array(0),O,0,p,g)})(),I=!0),d.l_desc=new z(d.dyn_ltree,Y),d.d_desc=new z(d.dyn_dtree,L),d.bl_desc=new z(d.bl_tree,ae),d.bi_buf=0,d.bi_valid=0,oe(d)},x._tr_stored_block=f,x._tr_flush_block=function(d,k,P,U){var A,Z,K=0;0<d.level?(d.strm.data_type===2&&(d.strm.data_type=(function(G){var te,ce=4093624447;for(te=0;te<=31;te++,ce>>>=1)if(1&ce&&G.dyn_ltree[2*te]!==0)return o;if(G.dyn_ltree[18]!==0||G.dyn_ltree[20]!==0||G.dyn_ltree[26]!==0)return r;for(te=32;te<v;te++)if(G.dyn_ltree[2*te]!==0)return r;return o})(d)),ye(d,d.l_desc),ye(d,d.d_desc),K=(function(G){var te;for(e(G,G.dyn_ltree,G.l_desc.max_code),e(G,G.dyn_dtree,G.d_desc.max_code),ye(G,G.bl_desc),te=p-1;3<=te&&G.bl_tree[2*$[te]+1]===0;te--);return G.opt_len+=3*(te+1)+5+5+4,te})(d),A=d.opt_len+3+7>>>3,(Z=d.static_len+3+7>>>3)<=A&&(A=Z)):A=Z=P+5,P+4<=A&&k!==-1?f(d,k,P,U):d.strategy===4||Z===A?(V(d,2+(U?1:0),3),we(d,re,u)):(V(d,4+(U?1:0),3),(function(G,te,ce,se){var _e;for(V(G,te-257,5),V(G,ce-1,5),V(G,se-4,4),_e=0;_e<se;_e++)V(G,G.bl_tree[2*$[_e]+1],3);F(G,G.dyn_ltree,te-1),F(G,G.dyn_dtree,ce-1)})(d,d.l_desc.max_code+1,d.d_desc.max_code+1,K+1),we(d,d.dyn_ltree,d.dyn_dtree)),oe(d),U&&le(d)},x._tr_tally=function(d,k,P){return d.pending_buf[d.d_buf+2*d.last_lit]=k>>>8&255,d.pending_buf[d.d_buf+2*d.last_lit+1]=255&k,d.pending_buf[d.l_buf+d.last_lit]=255&P,d.last_lit++,k===0?d.dyn_ltree[2*P]++:(d.matches++,k--,d.dyn_ltree[2*(t[P]+v+1)]++,d.dyn_dtree[2*E(k)]++),d.last_lit===d.lit_bufsize-1},x._tr_align=function(d){V(d,2,3),q(d,w,re),(function(k){k.bi_valid===16?(ee(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)})(d)}},{"../utils/common":41}],53:[function(m,C,x){C.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(m,C,x){(function(c){(function(o,r){if(!o.setImmediate){var a,_,y,v,b=1,i={},p=!1,n=o.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(o);h=h&&h.setTimeout?h:o,a={}.toString.call(o.process)==="[object process]"?function(N){process.nextTick(function(){g(N)})}:(function(){if(o.postMessage&&!o.importScripts){var N=!0,S=o.onmessage;return o.onmessage=function(){N=!1},o.postMessage("","*"),o.onmessage=S,N}})()?(v="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(N){o.postMessage(v+N,"*")}):o.MessageChannel?((y=new MessageChannel).port1.onmessage=function(N){g(N.data)},function(N){y.port2.postMessage(N)}):n&&"onreadystatechange"in n.createElement("script")?(_=n.documentElement,function(N){var S=n.createElement("script");S.onreadystatechange=function(){g(N),S.onreadystatechange=null,_.removeChild(S),S=null},_.appendChild(S)}):function(N){setTimeout(g,0,N)},h.setImmediate=function(N){typeof N!="function"&&(N=new Function(""+N));for(var S=new Array(arguments.length-1),B=0;B<S.length;B++)S[B]=arguments[B+1];var T={callback:N,args:S};return i[b]=T,a(b),b++},h.clearImmediate=l}function l(N){delete i[N]}function g(N){if(p)setTimeout(g,0,N);else{var S=i[N];if(S){p=!0;try{(function(B){var T=B.callback,M=B.args;switch(M.length){case 0:T();break;case 1:T(M[0]);break;case 2:T(M[0],M[1]);break;case 3:T(M[0],M[1],M[2]);break;default:T.apply(r,M)}})(S)}finally{l(N),p=!1}}}}function w(N){N.source===o&&typeof N.data=="string"&&N.data.indexOf(v)===0&&g(+N.data.slice(v.length))}})(typeof self>"u"?c===void 0?this:c:self)}).call(this,typeof Pe<"u"?Pe:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(it)),it.exports}var Gr=Hr();const qr=Yt(Gr);function Kr(W,Q){const m=W.replace(/\r\n/g,`
|
|
28
|
+
`),C=r=>/^---\n[\s\S]*?\n---\n/.test(r);if(!m.startsWith("---")||!m.includes(`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
`))return[{path:Q,content:W}];const x=[];for(const r of m.split(`
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
`))C(r)||x.length===0?x.push(r):x[x.length-1]+=`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
${r}`;if(x.length<2)return[{path:Q,content:W}];const c=(r,a)=>{var y,v;return(((v=(y=r.match(new RegExp(`^${a}:\\s*(.*)$`,"m")))==null?void 0:y[1])==null?void 0:v.trim())??"").replace(/^"(.*)"$/,"$1").trim()},o=new Map;return x.map((r,a)=>{var i;const _=((i=r.match(/^---\n([\s\S]*?)\n---\n/))==null?void 0:i[1])??"";let y=(c(_,"id")||c(_,"title")||`document-${a+1}`).trim();y=y.replace(/\.md$/i,"");const v=(o.get(y)??0)+1;return o.set(y,v),{path:`${v>1?`${y}-${v}`:y}.md`,content:r}})}function Vr(W,Q=[]){let m=[];function C(c,o){const r=ie.createContext(o);r.displayName=c+"Context";const a=m.length;m=[...m,o];const _=v=>{var l;const{scope:b,children:i,...p}=v,n=((l=b==null?void 0:b[W])==null?void 0:l[a])||r,h=ie.useMemo(()=>p,Object.values(p));return s.jsx(n.Provider,{value:h,children:i})};_.displayName=c+"Provider";function y(v,b){var n;const i=((n=b==null?void 0:b[W])==null?void 0:n[a])||r,p=ie.useContext(i);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[_,y]}const x=()=>{const c=m.map(o=>ie.createContext(o));return function(r){const a=(r==null?void 0:r[W])||c;return ie.useMemo(()=>({[`__scope${W}`]:{...r,[W]:a}}),[r,a])}};return x.scopeName=W,[C,Yr(x,...Q)]}function Yr(...W){const Q=W[0];if(W.length===1)return Q;const m=()=>{const C=W.map(x=>({useScope:x(),scopeName:x.scopeName}));return function(c){const o=C.reduce((r,{useScope:a,scopeName:_})=>{const v=a(c)[`__scope${_}`];return{...r,...v}},{});return ie.useMemo(()=>({[`__scope${Q.scopeName}`]:o}),[o])}};return m.scopeName=Q.scopeName,m}var Xr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rt=Xr.reduce((W,Q)=>{const m=Xt(`Primitive.${Q}`),C=ie.forwardRef((x,c)=>{const{asChild:o,...r}=x,a=o?m:Q;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(a,{...r,ref:c})});return C.displayName=`Primitive.${Q}`,{...W,[Q]:C}},{}),ut="Progress",ht=100,[Jr]=Vr(ut),[Qr,en]=Jr(ut),Tt=ie.forwardRef((W,Q)=>{const{__scopeProgress:m,value:C=null,max:x,getValueLabel:c=tn,...o}=W;(x||x===0)&&!At(x)&&console.error(rn(`${x}`,"Progress"));const r=At(x)?x:ht;C!==null&&!Et(C,r)&&console.error(nn(`${C}`,"Progress"));const a=Et(C,r)?C:null,_=Xe(a)?c(a,r):void 0;return s.jsx(Qr,{scope:m,value:a,max:r,children:s.jsx(Rt.div,{"aria-valuemax":r,"aria-valuemin":0,"aria-valuenow":Xe(a)?a:void 0,"aria-valuetext":_,role:"progressbar","data-state":Pt(a,r),"data-value":a??void 0,"data-max":r,...o,ref:Q})})});Tt.displayName=ut;var Ft="ProgressIndicator",Bt=ie.forwardRef((W,Q)=>{const{__scopeProgress:m,...C}=W,x=en(Ft,m);return s.jsx(Rt.div,{"data-state":Pt(x.value,x.max),"data-value":x.value??void 0,"data-max":x.max,...C,ref:Q})});Bt.displayName=Ft;function tn(W,Q){return`${Math.round(W/Q*100)}%`}function Pt(W,Q){return W==null?"indeterminate":W===Q?"complete":"loading"}function Xe(W){return typeof W=="number"}function At(W){return Xe(W)&&!isNaN(W)&&W>0}function Et(W,Q){return Xe(W)&&!isNaN(W)&&W<=Q&&W>=0}function rn(W,Q){return`Invalid prop \`max\` of value \`${W}\` supplied to \`${Q}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ht}\`.`}function nn(W,Q){return`Invalid prop \`value\` of value \`${W}\` supplied to \`${Q}\`. The \`value\` prop must be:
|
|
41
|
+
- a positive number
|
|
42
|
+
- less than the value passed to \`max\` (or ${ht} if no \`max\` prop is set)
|
|
43
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
44
|
+
|
|
45
|
+
Defaulting to \`null\`.`}var Ut=Tt,sn=Bt;const Lt=ie.forwardRef(({className:W,value:Q,...m},C)=>s.jsx(Ut,{ref:C,className:Jt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",W),...m,children:s.jsx(sn,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(Q||0)}%)`}})}));Lt.displayName=Ut.displayName;const Je=/\.(md|markdown|ya?ml|txt|json)$/i;function ft(W){return W===".versions"||W===".context"?!1:W.startsWith(".")||W==="node_modules"||W==="_suggestions"}const an=new Set(["INDEX.MD","CONTEXT.MD","CLAUDE.MD","GEMINI.MD","AGENTS.MD","QWEN.MD","README.MD"]);function on(W){return W.filter(Q=>{const m=Q.path.split("/"),C=m[m.length-1];return!C.endsWith(".md")||an.has(C.toUpperCase())?!1:!m.some(x=>x.startsWith(".")||x==="node_modules")}).length}async function Mt(W,Q,m=32){const C=[];for(let x=0;x<W.length;x+=m)C.push(...await Promise.all(W.slice(x,x+m).map(Q)));return C}async function ln(W,Q,m){const C=[],x=async(c,o)=>{const r=[];for await(const a of c.values()){const _=o?`${o}/${a.name}`:a.name;a.kind==="directory"?ft(a.name)||r.push({handle:a,rel:_}):Je.test(a.name)&&C.push({handle:a,rel:_})}await Promise.all(r.map(a=>x(a.handle,a.rel)))};await x(W,Q),m.push(...await Mt(C,async({handle:c,rel:o})=>({path:o,content:await(await c.getFile()).text()})))}async function cn(W,Q){const m=await qr.loadAsync(W);for(const C of Object.values(m.files)){if(C.dir)continue;const x=C.name.split("/");x.some(ft)||!Je.test(x[x.length-1])||Q.push({path:C.name,content:await C.async("string")})}}async function dn(W){const Q=[];for(const m of Array.from(W)){const C=m.webkitRelativePath.split("/");C.shift();const x=C.join("/");!x||C.some(ft)||!Je.test(m.name)||Q.push({file:m,rel:x})}return Mt(Q,async({file:m,rel:C})=>({path:C,content:await m.text()}))}function un({isOpen:W,onClose:Q,onImported:m}){const[C,x]=ie.useState("folder"),[c,o]=ie.useState(""),[r,a]=ie.useState(null),[_,y]=ie.useState(""),[v,b]=ie.useState(!1),[i,p]=ie.useState(!1),[n,h]=ie.useState(null),[l,g]=ie.useState(null),w=ie.useRef(null),N=ie.useRef(null),S=()=>{x("folder"),o(""),a(null),y(""),g(null),b(!1),p(!1),h(null)},B=u=>{u!==C&&(x(u),a(null),o(""),g(null))},T=()=>{i||(S(),Q())},M=async()=>{var t;g(null);const u=window.showDirectoryPicker;if(typeof u!="function"){(t=w.current)==null||t.click();return}let D;try{D=await u()}catch(R){if((R==null?void 0:R.name)==="AbortError")return;console.error("[ImportFolderModal] showDirectoryPicker failed",R),g("Couldn't open that folder");return}b(!0);try{const R=[];await ln(D,"",R),o(D.name),a(R),y(Y=>Y||D.name)}catch(R){console.error("[ImportFolderModal] scan failed",R),g("Couldn't read that folder")}finally{b(!1)}},O=async u=>{const D=u.target.files;if(!(!D||!D.length)){b(!0),g(null);try{const t=D[0].webkitRelativePath.split("/")[0]||"Imported",R=await dn(D);o(t),a(R),y(Y=>Y||t)}catch(t){console.error("[ImportFolderModal] scan failed",t),g("Couldn't read that folder")}finally{b(!1),u.target.value=""}}},$=async u=>{const D=u.target.files?Array.from(u.target.files):[];if(D.length){b(!0),g(null);try{const t=[];let R="Imported";for(const Y of D)if(Y.name.toLowerCase().endsWith(".zip"))await cn(Y,t),R=Y.name.replace(/\.zip$/i,"")||R;else if(/\.(md|markdown)$/i.test(Y.name))for(const L of Kr(await Y.text(),Y.name))t.push(L);else Je.test(Y.name)&&t.push({path:Y.name,content:await Y.text()});o(R),a(t),y(Y=>Y||R)}catch(t){console.error("[ImportFolderModal] file read failed",t),g("Couldn't read that selection")}finally{b(!1),u.target.value=""}}},re=async()=>{if(r){p(!0),h(null),g(null);try{const{rejected:u}=await Qt(_.trim()||c,r,(D,t)=>h({done:D,total:t}));if(m(),u.length){p(!1),h(null),g(`Imported, but ${u.length} file${u.length===1?"":"s"} could not be read or ${u.length===1?"was":"were"} too large: ${u.slice(0,5).join(", ")}`+(u.length>5?`, and ${u.length-5} more`:""));return}T()}catch(u){console.error("[ImportFolderModal] import failed",u),g((u==null?void 0:u.message)||"Import failed"),p(!1),h(null)}}};return s.jsx(qe,{open:W,onOpenChange:u=>!u&&T(),children:s.jsxs(Ke,{className:"sm:max-w-[480px]",children:[s.jsx(Ve,{children:s.jsxs(Ye,{className:"flex items-center gap-2",children:[s.jsx(Ie,{className:"h-5 w-5"}),"Import into a new nest"]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Import a folder from your computer, or a nest ",s.jsx("code",{children:".zip"})," (or markdown files) exported from another host. Files are uploaded into a new nest — your originals are left untouched."]}),s.jsx("input",{ref:u=>{w.current=u,u&&(u.setAttribute("webkitdirectory",""),u.setAttribute("directory",""))},type:"file",multiple:!0,className:"hidden",onChange:O}),s.jsx("input",{ref:N,type:"file",multiple:!0,accept:".zip,.md,.markdown,.yaml,.yml,.txt,.json",className:"hidden",onChange:$}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Import source",children:[{id:"folder",label:"Folder"},{id:"file",label:"File / .zip"}].map(u=>s.jsxs("label",{className:`flex flex-1 items-center gap-2 rounded-md border px-3 py-2 text-sm cursor-pointer transition-colors ${C===u.id?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:bg-secondary/50"}`,children:[s.jsx("input",{type:"radio",name:"import-source",className:"accent-primary",checked:C===u.id,onChange:()=>B(u.id),disabled:v||i}),u.label]},u.id))}),s.jsxs(fe,{className:"w-full",variant:"outline",onClick:C==="folder"?M:()=>{var u;g(null),(u=N.current)==null||u.click()},disabled:v||i,children:[v?s.jsx(ze,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Ie,{className:"h-4 w-4 mr-2"}),C==="folder"?"Choose folder":"Choose .zip or files"]}),r&&(()=>{const u=on(r);return s.jsxs("p",{className:"break-words text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:c})," — ",u," document",u===1?"":"s",s.jsxs("span",{className:"text-xs",children:[" · ",r.length," file",r.length===1?"":"s"," scanned"]})]})})()]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(lt,{children:"Nest name"}),s.jsx(Ge,{placeholder:c||"My Folder",value:_,onChange:u=>y(u.target.value)})]}),i&&s.jsxs("div",{className:"space-y-1",children:[s.jsx(Lt,{value:n&&n.total>0&&n.done<n.total?Math.round(n.done/n.total*100):void 0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:n&&n.done<n.total?`Uploading ${n.done} of ${n.total} files…`:"Registering documents…"})]}),l&&s.jsx("p",{className:"text-sm text-destructive",children:l})]}),s.jsxs(ct,{children:[s.jsx(fe,{variant:"outline",onClick:T,disabled:i,children:"Cancel"}),s.jsxs(fe,{onClick:re,disabled:!r||v||i,children:[i?s.jsx(ze,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Import"]})]})]})})}const He=24,zt="cn:dashboard:nestScope",hn=["all","mine","owned","shared","org","public","synced","unsynced"];function Cn(){var Fe;const{openNest:W,manageKeys:Q}=er(),{adminStatus:m,authMode:C,isAdmin:x}=Dt(),c=((Fe=m==null?void 0:m.me)==null?void 0:Fe.email)??null,{data:o,isLoading:r,refetch:a}=tr(),_=(o==null?void 0:o.nests)??[],[y,v]=ie.useState(!1),{data:b,isLoading:i}=rr({...Ue.nestList(!0),enabled:y}),p=(b==null?void 0:b.nests)??[],[n,h]=ie.useState(""),[l,g]=ie.useState("archived"),w=ie.useMemo(()=>$r(p,n,l),[p,n,l]),[N,S]=ie.useState(null),[B,T]=ie.useState(!1),[M,O]=ie.useState(""),[$,re]=ie.useState("activity"),[u,D]=ie.useState(()=>{try{const j=localStorage.getItem(zt);if(j&&hn.includes(j))return j}catch{}return Ze}),t=j=>{D(j);try{localStorage.setItem(zt,j)}catch{}},[R,Y]=ie.useState(He),L=ie.useMemo(()=>{if(!Wr(u))return[];const j=M.trim().toLowerCase();return[..._.filter(J=>Mr(J,u)?j?(J.name??"").toLowerCase().includes(j)||(J.description??"").toLowerCase().includes(j):!0:!1)].sort((J,de)=>{const xe=+!!de.pinned-+!!J.pinned;return xe!==0?xe:$==="name"?String(J.name??"").localeCompare(String(de.name??"")):String(de.last_activity??de.created_at??"").localeCompare(String(J.last_activity??J.created_at??""))})},[_,M,u,$]),ae=L.slice(0,R),H=M.trim()!==""||u!==Ze||$!=="activity",ne=()=>{O(""),t(Ze),re("activity")},z=ie.useMemo(()=>_.filter(j=>!!j.discovered).length,[_]),E=nr(),[ee,V]=ie.useState([]),q=ie.useMemo(()=>Zr(ee,u,M),[ee,u,M]),[he,pe]=ie.useState({}),[oe,le]=ie.useState({}),[ge,ue]=ie.useState(!1),[we,ye]=ie.useState(!1),[e,F]=ie.useState(""),[I,f]=ie.useState(""),[d,k]=ie.useState(null),[P,U]=ie.useState(new Set),[A,Z]=ie.useState(null),[K,G]=ie.useState(null),[te,ce]=ie.useState(null),[se,_e]=ie.useState(null),je=typeof window<"u"?window.location.origin:"http://localhost:3838",ve=async()=>{E.fetchQuery(Ue.unsynced()).then(j=>V(j.folders)).catch(()=>V([])),await a()},Ne=async j=>{pe(X=>({...X,[j]:!0})),le(X=>{const J={...X};return delete J[j],J});try{await dr(j),await ve()}catch(X){console.error("[Dashboard] syncUnsyncedFolder failed",j,X);const J=X instanceof Error?X.message:"Failed to sync folder";le(de=>({...de,[j]:J}))}finally{pe(X=>{const J={...X};return delete J[j],J})}},me=async j=>{pe(X=>({...X,[j]:!0})),le(X=>{const J={...X};return delete J[j],J});try{await ur(j),V(X=>X.filter(J=>J.name!==j)),_e(null)}catch(X){console.error("[Dashboard] deleteUnsyncedFolder failed",j,X);const J=X instanceof Error?X.message:"Failed to delete folder";le(de=>({...de,[j]:J})),_e(null)}finally{pe(X=>{const J={...X};return delete J[j],J})}};ie.useEffect(()=>{ve()},[c]);const Ce=async j=>{j.preventDefault();const X=Le(e);if(X){k(X);return}k(null);try{const{nest:J}=await hr(e.trim(),I.trim());F(""),f(""),ue(!1),ve(),W(J.id,J.name,!0,J.user_id===rt)}catch(J){console.error("[Dashboard] createNest failed",J),k(J instanceof Error?J.message:"Failed to create nest")}},De=async(j,X)=>{if(P.has(j))return;U(de=>new Set(de).add(j));const J=de=>E.setQueryData(Ue.nestList().queryKey,xe=>xe&&{...xe,nests:xe.nests.map(Ae=>Ae.id===j?{...Ae,pinned:de}:Ae)});J(X);try{await fr(j,X)}catch(de){J(!X),Ee.error((de==null?void 0:de.message)??`Failed to ${X?"pin":"unpin"} this nest`)}finally{U(de=>{const xe=new Set(de);return xe.delete(j),xe})}},ke=(j,X,J=!1)=>{Z({id:j,name:X,isImported:J})},Te=(j,X)=>{G({id:j,name:X})};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Me,{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border-blue-200",children:[s.jsx(vr,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx(br,{className:"text-lg",children:"Your Community Server"}),s.jsxs(yr,{children:["Running at"," ",s.jsx("code",{className:"text-xs bg-white/60 px-1.5 py-0.5 rounded font-mono",children:je}),s.jsx(fn,{value:je})]})]}),s.jsxs("div",{className:"flex gap-6 text-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold",children:r?s.jsx(jt,{}):_.length}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"Nests"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold",children:r?s.jsx(jt,{}):_.reduce((j,X)=>j+Number(X.document_count??0),0)}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"Documents"})]})]})]})}),s.jsx(We,{className:"pt-0",children:s.jsxs("div",{className:"grid md:grid-cols-2 gap-3 text-xs",children:[s.jsx(It,{icon:s.jsx(sr,{className:"h-4 w-4"}),title:"Hootie",desc:"Settings → Vault → Remote Server → paste URL"}),s.jsx(It,{icon:s.jsx(ir,{className:"h-4 w-4"}),title:"Claude Desktop",desc:"Add MCP endpoint per nest via Connect button"})]})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(wr,{icon:et,title:"Nests",description:"Shared knowledge vaults for your team",className:"mb-0",actions:s.jsxs(s.Fragment,{children:[s.jsxs(fe,{variant:"outline",onClick:()=>ye(!0),children:[s.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Import Folder"]}),s.jsxs(fe,{onClick:()=>ue(!0),children:[s.jsx(tt,{className:"h-4 w-4 mr-2"}),"New Nest"]})]})}),_.length>0&&s.jsx(Lr,{nests:_,onManageKeys:Q}),s.jsx(qe,{open:ge,onOpenChange:j=>{j||(ue(!1),k(null))},children:s.jsxs(Ke,{className:"sm:max-w-[480px]",children:[s.jsxs(Ve,{children:[s.jsx(Ye,{children:"New nest"}),s.jsx(at,{children:"A nest holds a set of documents and the governance around them."})]}),s.jsxs("form",{onSubmit:Ce,className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(lt,{children:"Name"}),s.jsx(Ge,{placeholder:"Team Knowledge",value:e,onChange:j=>{F(j.target.value),d&&k(null)},"aria-invalid":!!d,autoFocus:!0}),(d??(e?Le(e):null))&&s.jsx("p",{className:"text-xs text-destructive",children:d??Le(e)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(lt,{children:"Description (optional)"}),s.jsx(kr,{placeholder:"Shared docs for the engineering team",value:I,onChange:j=>f(j.target.value),rows:3})]}),s.jsxs(ct,{children:[s.jsx(fe,{type:"button",variant:"outline",onClick:()=>{ue(!1),k(null)},children:"Cancel"}),s.jsx(fe,{type:"submit",disabled:!!Le(e),children:"Create Nest"})]})]})]})}),!r&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!y&&_.length>5&&s.jsxs(s.Fragment,{children:[s.jsx(Ge,{value:M,onChange:j=>{O(j.target.value),Y(He)},placeholder:"Filter nests by name or description…",className:"h-9 max-w-xs","data-testid":"nest-filter-input"}),s.jsxs("select",{value:u,onChange:j=>{t(j.target.value),Y(He)},className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Filter nests by access","data-testid":"nest-scope-select",children:[s.jsx("option",{value:"mine",children:"My nests"}),s.jsx("option",{value:"all",children:"All nests"}),s.jsx("option",{value:"owned",children:"Owned by me"}),s.jsx("option",{value:"shared",children:"Shared with me"}),s.jsx("option",{value:"org",children:"Organization"}),s.jsx("option",{value:"public",children:"Public"}),(ee.length>0||u==="synced"||u==="unsynced")&&s.jsxs(s.Fragment,{children:[s.jsx("option",{value:"synced",children:"Synced nests only"}),s.jsx("option",{value:"unsynced",children:"Unsynced folders only"})]})]}),s.jsxs("select",{value:$,onChange:j=>re(j.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Sort nests","data-testid":"nest-sort-select",children:[s.jsx("option",{value:"activity",children:"Recent activity"}),s.jsx("option",{value:"name",children:"Name (A–Z)"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.length+q.length," of"," ",_.length+ee.length]}),H&&s.jsx(fe,{variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:ne,"data-testid":"nest-clear-filters",children:"Clear filters"})]}),s.jsxs("label",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(st,{className:"h-4 w-4"}),"Archived",s.jsx(ar,{checked:y,onCheckedChange:v,"aria-label":"Show archived nests","data-testid":"nest-archived-switch"})]})]}),y?s.jsx("div",{className:"space-y-4","data-testid":"archived-nests",children:i?s.jsxs("div",{className:"flex items-center gap-2 py-10 justify-center text-sm text-muted-foreground",children:[s.jsx(ze,{className:"h-4 w-4 animate-spin"}),"Loading archived nests…"]}):p.length===0?s.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[s.jsx(st,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),s.jsx("p",{className:"text-sm font-medium",children:"No archived nests"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Archiving a nest puts it here instead of deleting it — the option is in the delete dialog on any nest you own."})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"These nests are read-only. They don't appear on your dashboard, answer agents over MCP, or serve published links until restored."}),p.length>5&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Ge,{value:n,onChange:j=>h(j.target.value),placeholder:"Filter archived nests by name…",className:"h-9 max-w-xs","data-testid":"archived-filter-input"}),s.jsxs("select",{value:l,onChange:j=>g(j.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Sort archived nests","data-testid":"archived-sort-select",children:[s.jsx("option",{value:"archived",children:"Date archived"}),s.jsx("option",{value:"name",children:"Name (A–Z)"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[w.length," of ",p.length]}),n.trim()!==""&&s.jsx(fe,{variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>h(""),"data-testid":"archived-clear-filter",children:"Clear filter"})]}),w.length===0?s.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium",children:"Nothing matches this filter"}),s.jsx(fe,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>h(""),children:"Clear filter"})]}):s.jsx("div",{className:"space-y-2",children:w.map(j=>{const X=()=>W(j.id,j.name,j.is_owner??!1,j.user_id===rt,!0);return s.jsxs("div",{role:"button",tabIndex:0,onClick:X,onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&J.target===J.currentTarget&&(J.preventDefault(),X())},className:"flex items-center gap-3 rounded-lg border px-4 py-3 hover:bg-secondary/50 cursor-pointer",children:[s.jsx(st,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-sm font-medium",children:j.name}),s.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[j.archived_at?`Archived ${gr(j.archived_at)}`:"Archived",j.description?` — ${j.description}`:""]})]}),j.is_owner&&s.jsxs(s.Fragment,{children:[s.jsxs(fe,{variant:"outline",size:"sm",onClick:J=>{J.stopPropagation(),S({id:j.id,name:j.name})},"data-testid":"restore-nest",children:[s.jsx(Tr,{className:"h-3.5 w-3.5 mr-1.5"}),"Restore"]}),s.jsx(fe,{variant:"ghost",size:"sm",className:"text-red-700 hover:text-red-800",onClick:J=>{J.stopPropagation(),Z({id:j.id,name:j.name,isImported:!!j.is_imported})},children:s.jsx(Re,{className:"h-3.5 w-3.5"})})]})]},j.id)})})]})}):r?s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):u===Ze&&M.trim()===""&&L.length+q.length===0&&z>0?s.jsx(Me,{children:s.jsxs(We,{className:"text-center py-12",children:[s.jsx(et,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),s.jsx("p",{className:"font-medium",children:"No nests of your own yet"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Create one, or browse the ",z," nest",z===1?"":"s"," others have opened up on this server."]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsxs(fe,{onClick:()=>ue(!0),children:[s.jsx(tt,{className:"h-4 w-4 mr-2"}),"Create Nest"]}),s.jsx(fe,{variant:"outline",onClick:()=>t("all"),"data-testid":"nest-browse-discovered",children:"Browse all nests"})]})]})}):_.length+ee.length>0&&L.length+q.length===0?s.jsx(Me,{children:s.jsxs(We,{className:"text-center py-12",children:[s.jsx("p",{className:"font-medium",children:"Nothing matches this filter"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[_.length+ee.length," item",_.length+ee.length===1?" is":"s are"," hidden by the current filter."]}),s.jsx(fe,{variant:"outline",onClick:ne,children:"Clear filters"})]})}):ae.length===0&&ee.length===0?s.jsx(Me,{children:s.jsxs(We,{className:"text-center py-12",children:[s.jsx(et,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),s.jsx("p",{className:"font-medium",children:"No nests yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first nest to start sharing knowledge with your team"}),s.jsxs(fe,{onClick:()=>ue(!0),children:[s.jsx(tt,{className:"h-4 w-4 mr-2"}),"Create First Nest"]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[q.map(j=>{const X=!!he[j.name],J=oe[j.name];return s.jsx("div",{className:"relative text-left p-4 rounded-lg border border-dashed border-blue-300 bg-blue-50/40",children:s.jsxs("div",{className:"flex items-start gap-3 pr-2",children:[s.jsx("div",{className:"p-2 rounded-md bg-blue-100",children:s.jsx(xt,{className:"h-5 w-5 text-blue-700"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-medium truncate",children:j.label}),s.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",title:j.name,children:j.name}),s.jsxs("p",{className:"text-sm text-muted-foreground truncate mt-1",children:[j.mdCount," markdown file",j.mdCount===1?"":"s"," waiting to sync"]}),s.jsx("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200",title:"Folder is on disk but not registered as a nest",children:[s.jsx(xt,{className:"h-3 w-3"}),"Unsynced"]})}),s.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[s.jsx(fe,{size:"sm",onClick:()=>Ne(j.name),disabled:X,children:X?s.jsxs(s.Fragment,{children:[s.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Syncing…"]}):s.jsxs(s.Fragment,{children:[s.jsx(Ur,{className:"h-3.5 w-3.5 mr-2"}),"Sync to Nest"]})}),s.jsxs(fe,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>_e({name:j.name,label:j.label}),disabled:X,title:"Delete this folder from the server",children:[s.jsx(Re,{className:"h-3.5 w-3.5 mr-2"}),"Delete"]})]}),J&&s.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1 break-words",title:J,children:J})]})]})},`unsynced:${j.name}`)}),ae.map(j=>{var pt,gt;const X=j.user_id===rt,J=()=>W(j.id,j.name,j.is_owner??(j.permission??"owner")==="owner",X),de=j.permission??"owner",xe=j.is_owner??de==="owner",Ae=!xe,Oe=xe||X&&C!=="open"&&x,Wt=xe||Array.isArray(j.roles)&&j.roles.includes("admin")||X&&C!=="open"&&x,Be=Array.isArray(j.roles)?j.roles:[],Qe=Be.includes("admin")?"admin":Be.includes("editor")?"editor":Be.includes("reviewer")?"reviewer":Be.includes("viewer")?"viewer":de==="admin"?"admin":de==="write"?"editor":de==="read"?"viewer":null,Zt=mr(Qe,Oe),Se=Qe?{admin:{label:"Admin",Icon:vt,cls:"bg-purple-50 text-purple-700 border-purple-200",title:"Admin — full access except deleting the nest"},editor:{label:"Editor",Icon:_t,cls:"bg-indigo-50 text-indigo-700 border-indigo-200",title:"Editor — you can read and edit documents"},reviewer:{label:"Reviewer",Icon:Or,cls:"bg-amber-50 text-amber-700 border-amber-200",title:"Reviewer — you can approve or reject submissions"},viewer:{label:"Viewer",Icon:or,cls:"bg-slate-50 text-slate-700 border-slate-200",title:"View only — you can read but not edit"}}[Qe]:null,mt=(Se==null?void 0:Se.Icon)??null;return s.jsxs("div",{role:"button",tabIndex:0,onClick:J,onKeyDown:be=>{(be.key==="Enter"||be.key===" ")&&(be.preventDefault(),J())},className:`relative text-left p-4 rounded-lg border bg-card hover:bg-secondary/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${X?"border-dashed border-amber-300":"border-border"}`,children:[s.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-0.5",children:[Wt&&s.jsx("button",{type:"button","aria-label":`Rename nest ${j.name}`,title:"Rename nest",onClick:be=>{be.stopPropagation(),ce({id:j.id,name:j.name,description:j.description??null})},className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(_t,{className:"h-3.5 w-3.5"})}),(Oe||Zt)&&s.jsx("button",{type:"button","aria-label":Oe?`Delete nest ${j.name}`:`Request removal of nest ${j.name}`,title:Oe?"Delete nest":"Request nest removal",onClick:be=>{be.stopPropagation(),Oe?ke(j.id,j.name,!!j.is_imported):Te(j.id,j.name)},className:"p-1.5 rounded-md text-muted-foreground hover:text-red-600 hover:bg-red-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Re,{className:"h-3.5 w-3.5"})}),s.jsx("button",{type:"button","aria-label":j.pinned?`Unpin nest ${j.name}`:`Pin nest ${j.name}`,"aria-pressed":!!j.pinned,title:j.pinned?"Unpin — stop keeping this nest at the top":"Pin — keep this nest at the top for you",disabled:P.has(j.id),onClick:be=>{be.stopPropagation(),De(j.id,!j.pinned)},className:`p-1.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 ${j.pinned?"text-amber-500 hover:text-amber-600 hover:bg-amber-50":"text-muted-foreground hover:text-foreground hover:bg-secondary"}`,"data-testid":"pin-nest",children:s.jsx(Br,{className:`h-3.5 w-3.5 ${j.pinned?"fill-current":""}`})})]}),s.jsxs("div",{className:"flex items-start gap-3 pr-20",children:[s.jsx("div",{className:`p-2 rounded-md ${X?"bg-amber-100":"bg-primary/10"}`,children:X?s.jsx(lr,{className:"h-5 w-5 text-amber-700"}):s.jsx(bt,{className:"h-5 w-5 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-medium truncate",title:j.name,children:j.name}),j.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate mt-0.5",title:j.description,children:j.description}),Ae&&s.jsxs("p",{className:"flex items-center gap-1 mt-1 text-xs text-blue-700 truncate",title:j.owner_email?`Shared by ${j.owner_email}`:"Shared with you",children:[s.jsx(yt,{className:"h-3 w-3 shrink-0"}),s.jsxs("span",{className:"truncate",children:["Shared by"," ",s.jsx("span",{className:"font-medium",children:j.owner_email||"unknown user"})]})]}),j.is_imported?s.jsxs("p",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground truncate",title:`Imported ${nt(j.created_at)}`,children:[s.jsx(Ie,{className:"h-3 w-3 shrink-0"}),s.jsxs("span",{className:"truncate",children:["Imported by"," ",s.jsx("span",{className:"font-medium",children:j.is_owner?"you":j.owner_email||"unknown user"})," ","· ",nt(j.created_at)]})]}):null,s.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",title:"Documents",children:[s.jsx(bt,{className:"h-3 w-3"}),j.document_count??0]}),(((pt=j.collaborator_emails)==null?void 0:pt.length)??0)>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Shared with",children:[s.jsx(yt,{className:"h-3 w-3 mr-0.5"}),j.collaborator_emails.slice(0,4).map(be=>s.jsx("span",{title:`Shared with ${be}`,className:"inline-flex h-4.5 min-w-[18px] items-center justify-center rounded-full bg-muted px-1 text-[9px] font-semibold uppercase",children:be.slice(0,2)},be)),j.collaborator_emails.length>4&&s.jsxs("span",{className:"text-[10px]",children:["+",j.collaborator_emails.length-4]})]}),(((gt=j.steward_emails)==null?void 0:gt.length)??0)>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Stewards",children:[s.jsx(vt,{className:"h-3 w-3 mr-0.5 text-emerald-600"}),j.steward_emails.slice(0,4).map(be=>s.jsx("span",{title:`Steward: ${be}`,className:"inline-flex h-4.5 min-w-[18px] items-center justify-center rounded-full bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 px-1 text-[9px] font-semibold uppercase",children:be.slice(0,2)},be)),j.steward_emails.length>4&&s.jsxs("span",{className:"text-[10px]",children:["+",j.steward_emails.length-4]})]}),X&&!j.stewardship_enabled&&s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-200",title:"Owned by the anonymous admin — no stewardship applied",children:"Ungoverned"}),X&&j.stewardship_enabled&&s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-50 text-emerald-800 border border-emerald-200",title:"Stewardship is enabled — drafts require review before AI use",children:"Governed"}),Ae&&Se&&mt&&s.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border ${Se.cls}`,title:Se.title,children:[s.jsx(mt,{className:"h-3 w-3"}),Se.label]}),s.jsx("span",{className:`px-1.5 py-0.5 rounded ${j.visibility==="public"?"bg-green-100 text-green-700":j.visibility==="org"?"bg-blue-100 text-blue-700":"bg-secondary text-secondary-foreground"}`,children:j.visibility==="org"?"Organization":j.visibility==="public"?"Public":"Private"}),j.is_imported?s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200",title:"Imported from a folder — its files were copied into the workspace",children:[s.jsx(Ie,{className:"h-3 w-3"}),"Imported"]}):null,s.jsx("span",{children:nt(j.created_at)})]})]})]})]},j.id)})]}),L.length>ae.length&&s.jsx("div",{className:"flex justify-center",children:s.jsxs(fe,{variant:"outline",onClick:()=>Y(j=>j+He),"data-testid":"nest-show-more",children:["Show more (",L.length-ae.length," left)"]})})]})]}),te&&s.jsx(xr,{nestId:te.id,nestName:te.name,nestDescription:te.description,open:!0,onOpenChange:j=>{j||ce(null)},onRenamed:j=>{E.setQueryData(Ue.nestList().queryKey,X=>X&&{...X,nests:X.nests.map(J=>J.id===j.id?{...J,name:j.name,slug:j.slug,description:j.description}:J)}),ce(null)}}),A&&s.jsx(_r,{nestId:A.id,nestName:A.name,isImported:A.isImported,open:!0,onOpenChange:j=>{j||Z(null)},onDeleted:async()=>{Z(null),await ve()},onArchived:y?void 0:async()=>{Z(null),Ee.success(`"${A.name}" archived — find it under Archived`),await ve()}}),K&&s.jsx(jr,{open:!0,onOpenChange:j=>!j&&G(null),title:`Request removal of "${K.name}"`,description:"A nest owner or admin reviews this. Nothing is removed yet — ask for the nest to be archived (reversible, nothing deleted) or deleted outright.",label:"Why should it be removed?",placeholder:"e.g. project wound down, superseded by another nest",confirmLabel:"Request deletion",secondaryLabel:"Request archive",onSecondary:async j=>{await wt(K.id,"nest_archive",K.id,j),Ee.success("Archive requested — a nest admin will review it")},onConfirm:async j=>{await wt(K.id,"nest",K.id,j),Ee.success("Deletion requested — a nest admin will review it")}}),s.jsx(Nr,{open:!!N,onOpenChange:j=>{!j&&!B&&S(null)},children:s.jsxs(Sr,{children:[s.jsxs(Cr,{children:[s.jsxs(Ar,{children:["Restore “",N==null?void 0:N.name,"”?"]}),s.jsx(Er,{children:"It goes back exactly as it was — same documents, versions and stewards. It returns to your dashboard, becomes writable again, and its published links and MCP access start answering."})]}),s.jsxs(zr,{children:[s.jsx(Ir,{disabled:B,children:"Cancel"}),s.jsx(Dr,{disabled:B,onClick:async j=>{if(j.preventDefault(),!!N){T(!0);try{await cr(N.id),Ee.success(`"${N.name}" restored`),S(null),await ve()}catch(X){Ee.error((X==null?void 0:X.message)??"Failed to restore this nest")}finally{T(!1)}}},children:B?s.jsxs(s.Fragment,{children:[s.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Restoring..."]}):"Restore nest"})]})]})}),s.jsx(qe,{open:!!se,onOpenChange:j=>{!j&&se&&he[se.name]||j||_e(null)},children:s.jsxs(Ke,{className:"sm:max-w-[440px]",children:[s.jsxs(Ve,{children:[s.jsxs(Ye,{className:"flex items-center gap-2 text-red-700",children:[s.jsx(Re,{className:"h-4 w-4"}),"Delete folder"]}),s.jsxs(at,{children:["Permanently delete"," ",s.jsx("strong",{className:"text-foreground",children:se==null?void 0:se.label})," ","and its files from the server. This can't be undone. The folder won't be synced into a nest."]})]}),s.jsxs(ct,{className:"gap-2",children:[s.jsx(fe,{variant:"outline",onClick:()=>_e(null),disabled:!!se&&!!he[se.name],children:"Cancel"}),s.jsx(fe,{variant:"destructive",onClick:()=>se&&me(se.name),disabled:!!se&&!!he[se.name],children:se&&he[se.name]?s.jsxs(s.Fragment,{children:[s.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Deleting…"]}):s.jsxs(s.Fragment,{children:[s.jsx(Re,{className:"h-3.5 w-3.5 mr-2"}),"Delete folder"]})})]})]})}),s.jsx(un,{isOpen:we,onClose:()=>ye(!1),onImported:ve})]})}function It({icon:W,title:Q,desc:m,mono:C}){return s.jsxs("div",{className:"flex items-start gap-2 p-2 rounded bg-white/40",children:[s.jsx("div",{className:"text-muted-foreground mt-0.5",children:W}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium text-foreground",children:Q}),s.jsx("div",{className:`text-muted-foreground ${C?"font-mono text-[10px]":""} truncate`,children:m})]})]})}function fn({value:W}){const[Q,m]=ie.useState(!1);return s.jsx("button",{onClick:async C=>{C.stopPropagation(),await ot(W)&&(m(!0),setTimeout(()=>m(!1),1200))},className:"ml-1 inline-flex items-center hover:text-foreground",children:Q?s.jsx(pr,{className:"h-3 w-3 text-green-600"}):s.jsx(Ot,{className:"h-3 w-3"})})}export{Cn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as C,
|
|
1
|
+
import{u as C,cf as L,r as h,j as e,c8 as A,I as R,B as y,L as k,aP as P,cg as S,f as x,ch as _,ci as E,cj as I,i as D}from"./index-B5hLclEq.js";import{P as T}from"./page-title-BkqlUA0j.js";import{p as q}from"./dates-BCxbm4_q.js";import{R as B}from"./refresh-cw-CsCtmWwX.js";import{T as G}from"./trash-2-B4hRXo-p.js";function N(r){if(!r)return"never";const t=q(r);return t?t.toLocaleDateString():"never"}function W(){const r=C(),{data:t,isLoading:b}=L(),c=(t==null?void 0:t.keys)??[],[p,f]=h.useState(""),[n,i]=h.useState(null),[d,v]=h.useState(null),m=p.trim(),u=c.some(s=>{var a;return((a=s.label)==null?void 0:a.trim().toLowerCase())===m.toLowerCase()}),g=m.length>0&&!u,j=()=>r.invalidateQueries({queryKey:D.apiKeys().queryKey});async function w(s,a,o){i(s);try{const{api_key:l}=await a();v({apiKey:l,kind:o}),s==="new"&&f("")}catch(l){x.error(l instanceof Error?l.message:"Something went wrong.")}finally{j(),i(null)}}async function K(s,a){if(window.confirm(`Revoke "${a}"? Anything still using this key stops working immediately.`)){i(s);try{await _(s),x.success("Key revoked")}catch(o){x.error(o instanceof Error?o.message:"Couldn't revoke.")}finally{j(),i(null)}}}return e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{icon:A,title:"API keys",description:"Each key authenticates every nest you can see, plus the server-level MCP endpoint. Make one per place you connect from — then rotating the key for one client leaves the others alone.",className:"mb-0"}),e.jsxs("form",{className:"flex flex-col gap-2 sm:flex-row",onSubmit:s=>{s.preventDefault(),g&&w("new",()=>E({label:m}),"generated")},children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(R,{value:p,onChange:s=>f(s.target.value),maxLength:60,placeholder:"What's this key for? e.g. Claude Desktop, laptop CLI","aria-label":"Key name","aria-invalid":u||void 0}),u&&e.jsx("p",{className:"mt-1 text-xs text-destructive",children:"You already have a key with this name."})]}),e.jsxs(y,{type:"submit",disabled:n==="new"||!g,className:"shrink-0",children:[n==="new"?e.jsx(k,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(P,{className:"mr-2 h-4 w-4"}),"Generate key"]})]}),b?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Loading your keys…"}):c.length===0?e.jsx("p",{className:"rounded-md border border-dashed py-6 text-center text-sm text-muted-foreground",children:"No keys yet. Generate one above to connect an AI client."}):e.jsx("ul",{className:"divide-y rounded-md border",children:c.map(s=>{const a=s.label||"Unnamed key";return e.jsxs("li",{className:"flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:a}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("code",{className:"font-mono",children:s.key_prefix})," · created ",N(s.created_at)," · last used"," ",N(s.last_used_at)]})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsxs(y,{variant:"outline",size:"sm",disabled:n===s.id,onClick:()=>w(s.id,()=>I({key_id:s.id}),"rotated"),children:[n===s.id?e.jsx(k,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(B,{className:"mr-1.5 h-3.5 w-3.5"}),"Rotate"]}),e.jsx(y,{variant:"ghost",size:"sm",disabled:n===s.id,onClick:()=>K(s.id,a),"aria-label":`Revoke ${a}`,children:e.jsx(G,{className:"h-3.5 w-3.5"})})]})]},s.id)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A key is shown once, when it's created. There's no way to read it back — if you lose one, rotate that key (its client needs the new value) or revoke it and make another."}),d&&e.jsx(S,{apiKey:d.apiKey,kind:d.kind,onClose:()=>v(null)})]})}export{W as default};
|