@promptowl/contextnest-community 1.23.0 → 1.24.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.
Files changed (89) hide show
  1. package/API.md +2092 -0
  2. package/CONFIGURATION.md +1 -0
  3. package/README.md +61 -9
  4. package/STEWARDSHIP.md +229 -0
  5. package/dist/{chunk-2YPY2HGZ.js → chunk-2TPQTN4Y.js} +5 -4
  6. package/dist/{chunk-MLQU4I5J.js → chunk-5EZOPA47.js} +5 -5
  7. package/dist/{chunk-UOMW7TT6.js → chunk-I3CSD6CK.js} +1 -1
  8. package/dist/{chunk-QLXC6542.js → chunk-KIAAEHWL.js} +49 -25
  9. package/dist/{chunk-QWNXWRWO.js → chunk-LA3VTQ22.js} +25 -1
  10. package/dist/{chunk-XYD6V2LH.js → chunk-XUIWAWDO.js} +28 -33
  11. package/dist/{chunk-5CVZMHHB.js → chunk-ZTT4U4NE.js} +2 -2
  12. package/dist/{client-LWDMNKX3.js → client-KEY4PYJH.js} +1 -1
  13. package/dist/{engine-QFF2IA3G.js → engine-S3QBQ7LH.js} +2 -2
  14. package/dist/{external-edit-service-F7D3VSA2.js → external-edit-service-6FNFPOJJ.js} +3 -3
  15. package/dist/{grants-service-TBGTCO5K.js → grants-service-UT3EQ3R7.js} +2 -2
  16. package/dist/index.js +371 -90
  17. package/dist/{migrations.postgres-APCVSYUE.js → migrations.postgres-AIQ7WSU7.js} +45 -4
  18. package/dist/{review-service-A7PNLWG5.js → review-service-HHGOTO6P.js} +6 -6
  19. package/dist/{stewardship-service-32UHIRQ5.js → stewardship-service-4DHNRULG.js} +3 -3
  20. package/dist/{version-service-RJ6CWZ3O.js → version-service-KIOQME6U.js} +3 -3
  21. package/dist/web3/assets/ActivityTracePage-BOZHgJ8S.js +1 -0
  22. package/dist/web3/assets/AgentDocsPage-CIiaBqMy.js +1 -0
  23. package/dist/web3/assets/CollaboratorManager-By91wrIr.js +1 -0
  24. package/dist/web3/assets/CollaboratorsTab-D1EE64Fs.js +1 -0
  25. package/dist/web3/assets/DocumentEditor-DrQfrW3d.js +36 -0
  26. package/dist/web3/assets/DocumentsTab-Vba-AzBv.js +6 -0
  27. package/dist/web3/assets/ExternalEditsTab-BSzAQIGM.js +1 -0
  28. package/dist/web3/assets/MarkdownEditor-74N_naNQ.css +1 -0
  29. package/dist/web3/assets/MarkdownEditor-C9zqZjC5.js +643 -0
  30. package/dist/web3/assets/NestPageHeader-CoLUV1Oz.js +1 -0
  31. package/dist/web3/assets/NestView-CTZ55tXD.js +63 -0
  32. package/dist/web3/assets/OverviewTab-Dxi-Hu-N.js +1 -0
  33. package/dist/web3/assets/PersonCombobox-CPOlNs6G.js +1 -0
  34. package/dist/web3/assets/ReasonDialog-DgLxfRWv.js +1 -0
  35. package/dist/web3/assets/ReviewActions-OfOdqzCn.js +6 -0
  36. package/dist/web3/assets/ReviewTab-CyX8yxd3.js +1 -0
  37. package/dist/web3/assets/StewardsTab-DBEEfAQI.js +1 -0
  38. package/dist/web3/assets/SubmitForReviewModal-Ci2DdWs0.js +1 -0
  39. package/dist/web3/assets/alert-dialog-DTozKlmV.js +7 -0
  40. package/dist/web3/assets/arrow-left-BCKt4CwQ.js +6 -0
  41. package/dist/web3/assets/backlinks-CYd4xENL.js +24 -0
  42. package/dist/web3/assets/card-XG2dP5Xf.js +1 -0
  43. package/dist/web3/assets/chevron-left-BPwUT9DS.js +6 -0
  44. package/dist/web3/assets/circle-check-DI8IBGeo.js +6 -0
  45. package/dist/web3/assets/circle-x-VKVhC88W.js +6 -0
  46. package/dist/web3/assets/code-xml-CMabYZvH.js +6 -0
  47. package/dist/web3/assets/corner-down-right-BGxwK6wH.js +6 -0
  48. package/dist/web3/assets/count-skeleton-DMbdpscX.js +1 -0
  49. package/dist/web3/assets/dates-BCxbm4_q.js +1 -0
  50. package/dist/web3/assets/earth-BEp1EKTo.js +6 -0
  51. package/dist/web3/assets/file-exclamation-point-r8qZGIjP.js +6 -0
  52. package/dist/web3/assets/folder-input-Cmtx1Jhk.js +11 -0
  53. package/dist/web3/assets/folder-target-CUSWqImF.js +1 -0
  54. package/dist/web3/assets/index-BM-h3DwI.css +1 -0
  55. package/dist/web3/assets/index-C1wTSjfP.js +29 -0
  56. package/dist/web3/assets/index-EaX2yql0.js +389 -0
  57. package/dist/web3/assets/page-B3yvQvHy.js +1 -0
  58. package/dist/web3/assets/page-BExMvttJ.js +1 -0
  59. package/dist/web3/assets/page-BUOADv2X.js +1 -0
  60. package/dist/web3/assets/page-BYUFhYWZ.js +1 -0
  61. package/dist/web3/assets/page-Bicf02Cz.js +1 -0
  62. package/dist/web3/assets/page-BsPMDm5d.js +45 -0
  63. package/dist/web3/assets/page-ByyVLDVo.js +16 -0
  64. package/dist/web3/assets/page-CC0NJi8v.js +1 -0
  65. package/dist/web3/assets/page-CHb0F5hV.js +24 -0
  66. package/dist/web3/assets/page-CPjWQNKx.js +11 -0
  67. package/dist/web3/assets/page-CQt3ZGbf.js +2 -0
  68. package/dist/web3/assets/page-Cj1NetQ-.js +1 -0
  69. package/dist/web3/assets/page-CtaW65El.js +1 -0
  70. package/dist/web3/assets/page-DGOL9l8i.js +6 -0
  71. package/dist/web3/assets/page-title-ClvvBsIo.js +1 -0
  72. package/dist/web3/assets/play-C5YNKpAH.js +6 -0
  73. package/dist/web3/assets/refresh-cw-BhHzSH9m.js +6 -0
  74. package/dist/web3/assets/scroll-area-dRWncRqa.css +1 -0
  75. package/dist/web3/assets/scroll-area-hz-xtayP.js +1 -0
  76. package/dist/web3/assets/select-DBFTrUmI.js +6 -0
  77. package/dist/web3/assets/send-0CHvmluT.js +6 -0
  78. package/dist/web3/assets/settings-CeeF4LEb.js +6 -0
  79. package/dist/web3/assets/share-2-CMnOlOt-.js +6 -0
  80. package/dist/web3/assets/tag-DQ_6J5Gv.js +11 -0
  81. package/dist/web3/assets/trash-2-HBi-Pslz.js +6 -0
  82. package/dist/web3/assets/triangle-alert-CDy8-7sv.js +6 -0
  83. package/dist/web3/assets/user-plus-CvBNcpn4.js +6 -0
  84. package/dist/web3/assets/x-By7piikG.js +6 -0
  85. package/dist/web3/assets/zap-C2T8riBp.js +11 -0
  86. package/dist/web3/index.html +2 -2
  87. package/package.json +4 -2
  88. package/dist/web3/assets/index-BJ-LRNis.js +0 -1382
  89. package/dist/web3/assets/index-DPMEt-A_.css +0 -1
@@ -0,0 +1,45 @@
1
+ import{c as at,r as se,O as At,cr as Lt,cs as Mt,ct as Wt,j as i,B as pe,D as Ze,x as $e,y as He,z as Ge,G as rt,am as Et,aw as nt,c5 as Zt,cu as $t,ae as Ht,cv as Be,c4 as Gt,cw as qt,s as Kt,L as ze,J as st,I as We,H as it,cx as Vt,ch as Yt,cy as Xt,S as Jt,i as Pe,u as Qt,a2 as er,cz as tr,aS as ft,aP as mt,V as rr,bA as pt,cA as Ye,E as nr,aa as gt,bs as xt,ac as sr,F as _t,U as vt,f as Ee,bF as bt,cB as ir,cC as ar,cD as or,cE as lr,cF as cr,cG as dr,C as ur}from"./index-EaX2yql0.js";import{E as yt}from"./earth-BEp1EKTo.js";import{r as hr,f as Xe}from"./dates-BCxbm4_q.js";import{C as wt,n as Ue,R as fr,D as mr}from"./count-skeleton-DMbdpscX.js";import{C as Je,a as pr,c as gr,b as xr,d as Qe}from"./card-XG2dP5Xf.js";import{P as _r}from"./page-title-ClvvBsIo.js";import{T as vr}from"./scroll-area-hz-xtayP.js";import"./select-DBFTrUmI.js";import{R as br}from"./ReasonDialog-DgLxfRWv.js";import{A as yr,a as wr,b as kr,c as jr,d as Nr,e as Sr,f as Cr,g as Ar}from"./alert-dialog-DTozKlmV.js";import{F as Ie,A as et}from"./folder-input-Cmtx1Jhk.js";import{T as Fe}from"./trash-2-HBi-Pslz.js";import{C as Er}from"./circle-check-DI8IBGeo.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 zr=[["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"}]],Ir=at("archive-restore",zr);/**
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 Dr=[["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"}]],Rr=at("bookmark",Dr);/**
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 Or=[["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"}]],Fr=at("folder-sync",Or),kt=typeof window<"u"?window.location.origin:"http://localhost:3838";function Tr({nests:G,onManageKeys:Q}){const[m,C]=se.useState(!1),{authenticated:x,authMode:c}=At(),o=c==="open",r=x&&!o,{nestCount:a,documentCount:_}=Lt(G),y=Mt(kt),v=Wt(kt,o);return i.jsxs(i.Fragment,{children:[i.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:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:i.jsx(yt,{className:"h-5 w-5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Your whole brain"}),i.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."]})]})]}),i.jsxs(pe,{className:"shrink-0",onClick:()=>C(!0),children:[i.jsx(yt,{className:"mr-2 h-4 w-4"}),"Connect all my nests"]})]}),i.jsx(Ze,{open:m,onOpenChange:C,children:i.jsxs($e,{className:"max-w-lg",children:[i.jsxs(He,{children:[i.jsx(Ge,{children:"Connect all my nests"}),i.jsx(rt,{children:"One connection your AI reads every nest through — it picks the right one for each question."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Server (MCP) endpoint"}),i.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/40 p-2",children:[i.jsx("code",{className:"min-w-0 flex-1 truncate text-xs",children:y}),i.jsx(pe,{variant:"ghost",size:"sm","aria-label":"Copy endpoint",onClick:()=>nt(y,"Endpoint copied"),children:i.jsx(Et,{className:"h-3.5 w-3.5"})})]})]}),r&&i.jsxs("div",{children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Your API key"}),i.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:[i.jsxs("p",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[i.jsx(Zt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.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&&i.jsx(pe,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>{C(!1),Q()},children:"Manage API keys"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Or paste this into your AI"}),i.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}),i.jsxs(pe,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>nt(v,"Prompt copied"),children:[i.jsx($t,{className:"mr-1.5 h-3.5 w-3.5"}),'Copy "chat with all my nests"']})]}),i.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:[i.jsx(Ht,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.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."})]})]})]})})]})}function Br(G){return G!=="unsynced"}function Pr(G,Q,m){if(Q!=="all"&&Q!=="unsynced")return[];const C=m.trim().toLowerCase();return C?G.filter(x=>x.label.toLowerCase().includes(C)||x.name.toLowerCase().includes(C)):G}function Ur(G,Q,m){const C=Q.trim().toLowerCase();return[...C?G.filter(c=>(c.name??"").toLowerCase().includes(C)):G].sort((c,o)=>m==="name"?String(c.name??"").localeCompare(String(o.name??"")):String(o.archived_at??"").localeCompare(String(c.archived_at??"")))}function Le(G){throw new Error('Could not dynamically require "'+G+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var tt={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 jt;function Lr(){return jt||(jt=1,(function(G,Q){(function(m){G.exports=m()})(function(){return(function m(C,x,c){function o(_,y){if(!x[_]){if(!C[_]){var v=typeof Le=="function"&&Le;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 s=x[_]={exports:{}};C[_][0].call(s.exports,function(p){var n=C[_][1][p];return o(n||p)},s,s.exports,m,C,x,c)}return x[_].exports}for(var r=typeof Le=="function"&&Le,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,s,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,s=(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(s)+r.charAt(p)+r.charAt(n));return h.join("")},x.decode=function(a){var _,y,v,b,s,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|(s=r.indexOf(a.charAt(n++)))>>2,v=(3&s)<<6|(p=r.indexOf(a.charAt(n++))),g[h++]=_,s!==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,s,p){this.compressedSize=y,this.uncompressedSize=v,this.crc32=b,this.compression=s,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 s=o,p=b+v;_^=-1;for(var n=b;n<p;n++)_=_>>>8^s[255&(_^y[n])];return-1^_})(0|a,r,r.length,0):(function(_,y,v,b){var s=o,p=b+v;_^=-1;for(var n=b;n<p;n++)_=_>>>8^s[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(s,p){var n,h="";for(n=0;n<p;n++)h+=String.fromCharCode(255&s),s>>>=8;return h}function o(s,p,n,h,l,g){var w,N,S=s.file,B=s.compression,F=g!==_.utf8encode,M=r.transformTo("string",g(S.name)),O=r.transformTo("string",_.utf8encode(S.name)),Z=S.comment,te=r.transformTo("string",g(Z)),u=r.transformTo("string",_.utf8encode(Z)),I=O.length!==S.name.length,t=u.length!==Z.length,R="",J="",L="",ie=S.dir,$=S.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};p&&!n||(ne.crc32=s.crc32,ne.compressedSize=s.compressedSize,ne.uncompressedSize=s.uncompressedSize);var z=0;p&&(z|=8),F||!I&&!t||(z|=2048);var E=0,re=0;ie&&(E|=16),l==="UNIX"?(re=798,E|=(function(q,de){var _e=q;return q||(_e=de?16893:33204),(65535&_e)<<16})(S.unixPermissions,ie)):(re=20,E|=(function(q){return 63&(q||0)})(S.dosPermissions)),w=$.getUTCHours(),w<<=6,w|=$.getUTCMinutes(),w<<=5,w|=$.getUTCSeconds()/2,N=$.getUTCFullYear()-1980,N<<=4,N|=$.getUTCMonth()+1,N<<=5,N|=$.getUTCDate(),I&&(J=c(1,1)+c(y(M),4)+O,R+="up"+c(J.length,2)+J),t&&(L=c(1,1)+c(y(te),4)+u,R+="uc"+c(L.length,2)+L);var K="";return K+=`
27
+ \0`,K+=c(z,2),K+=B.magic,K+=c(w,2),K+=c(N,2),K+=c(ne.crc32,4),K+=c(ne.compressedSize,4),K+=c(ne.uncompressedSize,4),K+=c(M.length,2),K+=c(R.length,2),{fileRecord:v.LOCAL_FILE_HEADER+K+M+R,dirRecord:v.CENTRAL_FILE_HEADER+c(re,2)+K+c(te.length,2)+"\0\0\0\0"+c(E,4)+c(h,4)+M+R+te}}var r=m("../utils"),a=m("../stream/GenericWorker"),_=m("../utf8"),y=m("../crc32"),v=m("../signature");function b(s,p,n,h){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=n,this.encodeFileName=h,this.streamFiles=s,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(s){var p=s.meta.percent||0,n=this.entriesCount,h=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,a.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:n?(p+100*(n-h-1))/n:100}}))},b.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var p=this.streamFiles&&!s.file.dir;if(p){var n=o(s,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(s){this.accumulate=!1;var p=this.streamFiles&&!s.file.dir,n=o(s,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)})(s),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 s=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var n=this.bytesWritten-s,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,s,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(s){this._sources.push(s);var p=this;return s.on("data",function(n){p.processChunk(n)}),s.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),s.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(s){var p=this._sources;if(!a.prototype.error.call(this,s))return!1;for(var n=0;n<p.length;n++)try{p[n].error(s)}catch{}return!0},b.prototype.lock=function(){a.prototype.lock.call(this);for(var s=this._sources,p=0;p<s.length;p++)s[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,s){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})(s.options.compression,a.compression),n=s.options.compressionOptions||a.compressionOptions||{},h=s.dir,l=s.date;s._compressWorker(p,n).withStreamInfo("file",{name:b,dir:h,date:l,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.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(s,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")):s()}).resume()})}C.exports=function(b,s){var p=this;return s=c.extend(s||{},{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,s.optimizedBinaryString,s.base64).then(function(n){var h=new a(s);return h.load(n),h}).then(function(n){var h=[o.Promise.resolve(n)],l=n.files;if(s.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:s.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,F){var M,O=r.getTypeOf(B),Z=r.extend(F||{},y);Z.date=Z.date||new Date,Z.compression!==null&&(Z.compression=Z.compression.toUpperCase()),typeof Z.unixPermissions=="string"&&(Z.unixPermissions=parseInt(Z.unixPermissions,8)),Z.unixPermissions&&16384&Z.unixPermissions&&(Z.dir=!0),Z.dosPermissions&&16&Z.dosPermissions&&(Z.dir=!0),Z.dir&&(S=l(S)),Z.createFolders&&(M=h(S))&&g.call(this,M,!0);var te=O==="string"&&Z.binary===!1&&Z.base64===!1;F&&F.binary!==void 0||(Z.binary=!te),(B instanceof v&&B.uncompressedSize===0||Z.dir||!B||B.length===0)&&(Z.base64=!1,Z.binary=!0,B="",Z.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,Z.binary,Z.optimizedBinaryString,Z.base64);var I=new b(S,u,Z);this.files[S]=I}var o=m("./utf8"),r=m("./utils"),a=m("./stream/GenericWorker"),_=m("./stream/StreamHelper"),y=m("./defaults"),v=m("./compressedObject"),b=m("./zipObject"),s=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,F,M;for(B in this.files)M=this.files[B],(F=B.slice(this.root.length,B.length))&&B.slice(0,this.root.length)===this.root&&S(F,M)},filter:function(S){var B=[];return this.forEach(function(F,M){S(F,M)&&B.push(M)}),B},file:function(S,B,F){if(arguments.length!==1)return S=this.root+S,c.call(this,S,B,F),this;if(w(S)){var M=S;return this.filter(function(Z,te){return!te.dir&&M.test(Z)})}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,Z){return Z.dir&&S.test(O)});var B=this.root+S,F=g.call(this,B),M=this.clone();return M.root=F.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 F=this.filter(function(O,Z){return Z.name.slice(0,S.length)===S}),M=0;M<F.length;M++)delete this.files[F[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,F={};try{if((F=r.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=F.type.toLowerCase(),F.compression=F.compression.toUpperCase(),F.type==="binarystring"&&(F.type="string"),!F.type)throw new Error("No output type specified.");r.checkSupport(F.type),F.platform!=="darwin"&&F.platform!=="freebsd"&&F.platform!=="linux"&&F.platform!=="sunos"||(F.platform="UNIX"),F.platform==="win32"&&(F.platform="DOS");var M=F.comment||this.comment||"";B=s.generateWorker(this,F,M)}catch(O){(B=new a("error")).error(O)}return new _(B,F.type||"string",F.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,F){g.push(B),n&&n(F)}).on("error",function(B){g=[],l(B)}).on("end",function(){try{var B=(function(F,M,O){switch(F){case"blob":return c.newBlob(c.transformTo("arraybuffer",M),O);case"base64":return a.encode(M);default:return c.transformTo(F,M)}})(N,(function(F,M){var O,Z=0,te=null,u=0;for(O=0;O<M.length;O++)u+=M[O].length;switch(F){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(te=new Uint8Array(u),O=0;O<M.length;O++)te.set(M[O],Z),Z+=M[O].length;return te;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+F+"'")}})(w,g),S);h(B)}catch(F){l(F)}g=[]}).resume()})}function s(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)}}s.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=s},{"../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(s){return o.nodebuffer?r.newBufferFrom(s,"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})(s)},x.utf8decode=function(s){return o.nodebuffer?c.transformTo("nodebuffer",s).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)})(s=c.transformTo(o.uint8array?"uint8array":"array",s))},c.inherits(v,a),v.prototype.processChunk=function(s){var p=c.transformTo(o.uint8array?"uint8array":"array",s.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:s.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(s){this.push({data:x.utf8encode(s.data),meta:s.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 s(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 s(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 s(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 s(n,new Array(n.length))},arraybuffer:function(n){return p.nodebuffer.uint8array(n).buffer},uint8array:function(n){return s(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 F=new FileReader;F.onload=function(M){S(M.target.result)},F.onerror=function(M){B(M.target.error)},F.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 s=this.reader.index;this.reader.setIndex(v);var p=this.reader.readString(4)===b;return this.reader.setIndex(s),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",s=o.transformTo(b,v);this.zipComment=this.loadOptions.decodeFileName(s)},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,s,p=this.zip64EndOfCentralSize-44;0<p;)v=this.reader.readInt(2),b=this.reader.readInt(4),s=this.reader.readData(b),this.zip64ExtensibleData[v]={id:v,length:b,value:s}},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 s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var p=b-s;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(s,p){this.options=s,this.loadOptions=p}b.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var p,n;if(s.skip(22),this.fileNameLength=s.readInt(2),n=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.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,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var p=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(p),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=c(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var p,n,h,l=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<l;)p=s.readInt(2),n=s.readInt(2),h=s.readData(n),this.extraFields[p]={id:p,length:n,value:h};s.setIndex(l)},handleUTF8:function(){var s=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(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var h=this.findExtraFieldUnicodeComment();if(h!==null)this.fileCommentStr=h;else{var l=o.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(l)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var p=c(s.value);return p.readInt(1)!==1||a(this.fileName)!==p.readInt(4)?null:_.utf8decode(p.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var p=c(s.value);return p.readInt(1)!==1||a(this.fileComment)!==p.readInt(4)?null:_.utf8decode(p.readData(s.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.")},s=0;s<v.length;s++)c.prototype[v[s]]=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 s=[];function p(){var n,h;r=!0;for(var l=s.length;l;){for(h=s,s=[],n=-1;++n<l;)h[n]();l=s.length}r=!1}C.exports=function(n){s.push(n)!==1||r||o()}}).call(this,typeof Be<"u"?Be: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 s(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(F){w||(w=!0,r.reject(l,F))}function S(F){w||(w=!0,r.resolve(l,F))}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?s(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){s(this.promise,this.onFulfilled,l)},b.prototype.callRejected=function(l){r.reject(this.promise,l)},b.prototype.otherCallRejected=function(l){s(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,F=-1,M=new this(o);++F<w;)O(l[F],F);return M;function O(Z,te){g.resolve(Z).then(function(u){S[te]=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;)F=l[S],g.resolve(F).then(function(M){N||(N=!0,r.resolve(B,M))},function(M){N||(N=!0,r.reject(B,M))});var F;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,s=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:s,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 s(n){if(!(this instanceof s))return new s(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 s(h);if(l.push(n,!0),l.err)throw l.msg||_[l.err];return l.result}s.prototype.push=function(n,h){var l,g,w,N,S,B,F=this.strm,M=this.options.chunkSize,O=this.options.dictionary,Z=!1;if(this.ended)return!1;g=h===~~h?h:h===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof n=="string"?F.input=r.binstring2buf(n):b.call(n)==="[object ArrayBuffer]"?F.input=new Uint8Array(n):F.input=n,F.next_in=0,F.avail_in=F.input.length;do{if(F.avail_out===0&&(F.output=new o.Buf8(M),F.next_out=0,F.avail_out=M),(l=c.inflate(F,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&&Z===!0&&(l=a.Z_OK,Z=!1),l!==a.Z_STREAM_END&&l!==a.Z_OK)return this.onEnd(l),!(this.ended=!0);F.next_out&&(F.avail_out!==0&&l!==a.Z_STREAM_END&&(F.avail_in!==0||g!==a.Z_FINISH&&g!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=r.utf8border(F.output,F.next_out),N=F.next_out-w,S=r.buf2string(F.output,w),F.next_out=N,F.avail_out=M-N,N&&o.arraySet(F.output,F.output,w,N,0),this.onData(S)):this.onData(o.shrinkBuf(F.output,F.next_out)))),F.avail_in===0&&F.avail_out===0&&(Z=!0)}while((0<F.avail_in||F.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),!(F.avail_out=0))},s.prototype.onData=function(n){this.chunks.push(n)},s.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=s,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 s=0;s<v;s++)a[b+s]=_[y+s]},flattenChunks:function(a){var _,y,v,b,s,p;for(_=v=0,y=a.length;_<y;_++)v+=a[_].length;for(p=new Uint8Array(v),_=b=0,y=a.length;_<y;_++)s=a[_],p.set(s,b),b+=s.length;return p}},r={arraySet:function(a,_,y,v,b){for(var s=0;s<v;s++)a[b+s]=_[y+s]},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 s="",p=0;p<b;p++)s+=String.fromCharCode(v[p]);return s}a[254]=a[254]=1,x.string2buf=function(v){var b,s,p,n,h,l=v.length,g=0;for(n=0;n<l;n++)(64512&(s=v.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=v.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(p-56320),n++),g+=s<128?1:s<2048?2:s<65536?3:4;for(b=new c.Buf8(g),n=h=0;h<g;n++)(64512&(s=v.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=v.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(p-56320),n++),s<128?b[h++]=s:(s<2048?b[h++]=192|s>>>6:(s<65536?b[h++]=224|s>>>12:(b[h++]=240|s>>>18,b[h++]=128|s>>>12&63),b[h++]=128|s>>>6&63),b[h++]=128|63&s);return b},x.buf2binstring=function(v){return y(v,v.length)},x.binstring2buf=function(v){for(var b=new c.Buf8(v.length),s=0,p=b.length;s<p;s++)b[s]=v.charCodeAt(s);return b},x.buf2string=function(v,b){var s,p,n,h,l=b||v.length,g=new Array(2*l);for(s=p=0;s<l;)if((n=v[s++])<128)g[p++]=n;else if(4<(h=a[n]))g[p++]=65533,s+=h-1;else{for(n&=h===2?31:h===3?15:7;1<h&&s<l;)n=n<<6|63&v[s++],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 s;for((b=b||v.length)>v.length&&(b=v.length),s=b-1;0<=s&&(192&v[s])==128;)s--;return s<0||s===0?b:s+a[v[s]]>b?s: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,s=0,p=-2,n=-1,h=4,l=2,g=8,w=9,N=286,S=30,B=19,F=2*N+1,M=15,O=3,Z=258,te=Z+O+1,u=42,I=113,t=1,R=2,J=3,L=4;function ie(e,T){return e.msg=y[T],T}function $(e){return(e<<1)-(4<e?9:0)}function ne(e){for(var T=e.length;0<=--T;)e[T]=0}function z(e){var T=e.state,D=T.pending;D>e.avail_out&&(D=e.avail_out),D!==0&&(o.arraySet(e.output,T.pending_buf,T.pending_out,D,e.next_out),e.next_out+=D,T.pending_out+=D,e.total_out+=D,e.avail_out-=D,T.pending-=D,T.pending===0&&(T.pending_out=0))}function E(e,T){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,T),e.block_start=e.strstart,z(e.strm)}function re(e,T){e.pending_buf[e.pending++]=T}function K(e,T){e.pending_buf[e.pending++]=T>>>8&255,e.pending_buf[e.pending++]=255&T}function q(e,T){var D,f,d=e.max_chain_length,k=e.strstart,P=e.prev_length,U=e.nice_match,A=e.strstart>e.w_size-te?e.strstart-(e.w_size-te):0,W=e.window,V=e.w_mask,H=e.prev,ee=e.strstart+Z,ae=W[k+P-1],oe=W[k+P];e.prev_length>=e.good_match&&(d>>=2),U>e.lookahead&&(U=e.lookahead);do if(W[(D=T)+P]===oe&&W[D+P-1]===ae&&W[D]===W[k]&&W[++D]===W[k+1]){k+=2,D++;do;while(W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&W[++k]===W[++D]&&k<ee);if(f=Z-(ee-k),k=ee-Z,P<f){if(e.match_start=T,U<=(P=f))break;ae=W[k+P-1],oe=W[k+P]}}while((T=H[T&V])>A&&--d!=0);return P<=e.lookahead?P:e.lookahead}function de(e){var T,D,f,d,k,P,U,A,W,V,H=e.w_size;do{if(d=e.window_size-e.lookahead-e.strstart,e.strstart>=H+(H-te)){for(o.arraySet(e.window,e.window,H,H,0),e.match_start-=H,e.strstart-=H,e.block_start-=H,T=D=e.hash_size;f=e.head[--T],e.head[T]=H<=f?f-H:0,--D;);for(T=D=H;f=e.prev[--T],e.prev[T]=H<=f?f-H:0,--D;);d+=H}if(e.strm.avail_in===0)break;if(P=e.strm,U=e.window,A=e.strstart+e.lookahead,W=d,V=void 0,V=P.avail_in,W<V&&(V=W),D=V===0?0:(P.avail_in-=V,o.arraySet(U,P.input,P.next_in,V,A),P.state.wrap===1?P.adler=a(P.adler,U,V,A):P.state.wrap===2&&(P.adler=_(P.adler,U,V,A)),P.next_in+=V,P.total_in+=V,V),e.lookahead+=D,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<te&&e.strm.avail_in!==0)}function _e(e,T){for(var D,f;;){if(e.lookahead<te){if(de(e),e.lookahead<te&&T===v)return t;if(e.lookahead===0)break}if(D=0,e.lookahead>=O&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,D=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),D!==0&&e.strstart-D<=e.w_size-te&&(e.match_length=q(e,D)),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,D=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,T===b?(E(e,!0),e.strm.avail_out===0?J:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:R}function le(e,T){for(var D,f,d;;){if(e.lookahead<te){if(de(e),e.lookahead<te&&T===v)return t;if(e.lookahead===0)break}if(D=0,e.lookahead>=O&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,D=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,D!==0&&e.prev_length<e.max_lazy_match&&e.strstart-D<=e.w_size-te&&(e.match_length=q(e,D),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,D=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,T===b?(E(e,!0),e.strm.avail_out===0?J:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:R}function ce(e,T,D,f,d){this.good_length=e,this.max_lazy=T,this.nice_length=D,this.max_chain=f,this.func=d}function he(){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*F),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 fe(e){var T;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=l,(T=e.state).pending=0,T.pending_out=0,T.wrap<0&&(T.wrap=-T.wrap),T.status=T.wrap?u:I,e.adler=T.wrap===2?0:1,T.last_flush=v,r._tr_init(T),s):ie(e,p)}function ye(e){var T=fe(e);return T===s&&(function(D){D.window_size=2*D.w_size,ne(D.head),D.max_lazy_match=c[D.level].max_lazy,D.good_match=c[D.level].good_length,D.nice_match=c[D.level].nice_length,D.max_chain_length=c[D.level].max_chain,D.strstart=0,D.block_start=0,D.lookahead=0,D.insert=0,D.match_length=D.prev_length=O-1,D.match_available=0,D.ins_h=0})(e.state),T}function xe(e,T,D,f,d,k){if(!e)return p;var P=1;if(T===n&&(T=6),f<0?(P=0,f=-f):15<f&&(P=2,f-=16),d<1||w<d||D!==g||f<8||15<f||T<0||9<T||k<0||h<k)return ie(e,p);f===8&&(f=9);var U=new he;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=T,U.strategy=k,U.method=D,ye(e)}c=[new ce(0,0,0,0,function(e,T){var D=65535;for(D>e.pending_buf_size-5&&(D=e.pending_buf_size-5);;){if(e.lookahead<=1){if(de(e),e.lookahead===0&&T===v)return t;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var f=e.block_start+D;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-te&&(E(e,!1),e.strm.avail_out===0))return t}return e.insert=0,T===b?(E(e,!0),e.strm.avail_out===0?J:L):(e.strstart>e.block_start&&(E(e,!1),e.strm.avail_out),t)}),new ce(4,4,8,4,_e),new ce(4,5,16,8,_e),new ce(4,6,32,32,_e),new ce(4,4,16,16,le),new ce(8,16,32,32,le),new ce(8,16,128,128,le),new ce(8,32,128,256,le),new ce(32,128,258,1024,le),new ce(32,258,258,4096,le)],x.deflateInit=function(e,T){return xe(e,T,g,15,8,0)},x.deflateInit2=xe,x.deflateReset=ye,x.deflateResetKeep=fe,x.deflateSetHeader=function(e,T){return e&&e.state?e.state.wrap!==2?p:(e.state.gzhead=T,s):p},x.deflate=function(e,T){var D,f,d,k;if(!e||!e.state||5<T||T<0)return e?ie(e,p):p;if(f=e.state,!e.output||!e.input&&e.avail_in!==0||f.status===666&&T!==b)return ie(e,e.avail_out===0?-5:p);if(f.strm=e,D=f.last_flush,f.last_flush=T,f.status===u)if(f.wrap===2)e.adler=0,re(f,31),re(f,139),re(f,8),f.gzhead?(re(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)),re(f,255&f.gzhead.time),re(f,f.gzhead.time>>8&255),re(f,f.gzhead.time>>16&255),re(f,f.gzhead.time>>24&255),re(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),re(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(re(f,255&f.gzhead.extra.length),re(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):(re(f,0),re(f,0),re(f,0),re(f,0),re(f,0),re(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),re(f,3),f.status=I);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=I,K(f,P),f.strstart!==0&&(K(f,e.adler>>>16),K(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));)re(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,re(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,re(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&&(re(f,255&e.adler),re(f,e.adler>>8&255),e.adler=0,f.status=I)):f.status=I),f.pending!==0){if(z(e),e.avail_out===0)return f.last_flush=-1,s}else if(e.avail_in===0&&$(T)<=$(D)&&T!==b)return ie(e,-5);if(f.status===666&&e.avail_in!==0)return ie(e,-5);if(e.avail_in!==0||f.lookahead!==0||T!==v&&f.status!==666){var U=f.strategy===2?(function(A,W){for(var V;;){if(A.lookahead===0&&(de(A),A.lookahead===0)){if(W===v)return t;break}if(A.match_length=0,V=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,V&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,W===b?(E(A,!0),A.strm.avail_out===0?J:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:R})(f,T):f.strategy===3?(function(A,W){for(var V,H,ee,ae,oe=A.window;;){if(A.lookahead<=Z){if(de(A),A.lookahead<=Z&&W===v)return t;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=O&&0<A.strstart&&(H=oe[ee=A.strstart-1])===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]){ae=A.strstart+Z;do;while(H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&H===oe[++ee]&&ee<ae);A.match_length=Z-(ae-ee),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=O?(V=r._tr_tally(A,1,A.match_length-O),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(V=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),V&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,W===b?(E(A,!0),A.strm.avail_out===0?J:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:R})(f,T):c[f.level].func(f,T);if(U!==J&&U!==L||(f.status=666),U===t||U===J)return e.avail_out===0&&(f.last_flush=-1),s;if(U===R&&(T===1?r._tr_align(f):T!==5&&(r._tr_stored_block(f,0,0,!1),T===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,s}return T!==b?s:f.wrap<=0?1:(f.wrap===2?(re(f,255&e.adler),re(f,e.adler>>8&255),re(f,e.adler>>16&255),re(f,e.adler>>24&255),re(f,255&e.total_in),re(f,e.total_in>>8&255),re(f,e.total_in>>16&255),re(f,e.total_in>>24&255)):(K(f,e.adler>>>16),K(f,65535&e.adler)),z(e),0<f.wrap&&(f.wrap=-f.wrap),f.pending!==0?s:1)},x.deflateEnd=function(e){var T;return e&&e.state?(T=e.state.status)!==u&&T!==69&&T!==73&&T!==91&&T!==103&&T!==I&&T!==666?ie(e,p):(e.state=null,T===I?ie(e,-3):s):p},x.deflateSetDictionary=function(e,T){var D,f,d,k,P,U,A,W,V=T.length;if(!e||!e.state||(k=(D=e.state).wrap)===2||k===1&&D.status!==u||D.lookahead)return p;for(k===1&&(e.adler=a(e.adler,T,V,0)),D.wrap=0,V>=D.w_size&&(k===0&&(ne(D.head),D.strstart=0,D.block_start=0,D.insert=0),W=new o.Buf8(D.w_size),o.arraySet(W,T,V-D.w_size,D.w_size,0),T=W,V=D.w_size),P=e.avail_in,U=e.next_in,A=e.input,e.avail_in=V,e.next_in=0,e.input=T,de(D);D.lookahead>=O;){for(f=D.strstart,d=D.lookahead-(O-1);D.ins_h=(D.ins_h<<D.hash_shift^D.window[f+O-1])&D.hash_mask,D.prev[f&D.w_mask]=D.head[D.ins_h],D.head[D.ins_h]=f,f++,--d;);D.strstart=f,D.lookahead=O-1,de(D)}return D.strstart+=D.lookahead,D.block_start=D.strstart,D.insert=D.lookahead,D.lookahead=0,D.match_length=D.prev_length=O-1,D.match_available=0,e.next_in=U,e.input=A,e.avail_in=P,D.wrap=k,s},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,s,p,n,h,l,g,w,N,S,B,F,M,O,Z,te,u,I,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),s=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,F=(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}Z=65535&M,(O&=15)&&(w<O&&(g+=t[a++]<<w,w+=8),Z+=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&F];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(te=65535&M,w<(O&=15)&&(g+=t[a++]<<w,(w+=8)<O&&(g+=t[a++]<<w,w+=8)),s<(te+=g&(1<<O)-1)){c.msg="invalid distance too far back",r.mode=30;break e}if(g>>>=O,w-=O,(O=y-v)<te){if(n<(O=te-O)&&r.sane){c.msg="invalid distance too far back",r.mode=30;break e}if(I=l,(u=0)===h){if(u+=p-O,O<Z){for(Z-=O;R[y++]=l[u++],--O;);u=y-te,I=R}}else if(h<O){if(u+=p+h-O,(O-=h)<Z){for(Z-=O;R[y++]=l[u++],--O;);if(u=0,h<Z){for(Z-=O=h;R[y++]=l[u++],--O;);u=y-te,I=R}}}else if(u+=h-O,O<Z){for(Z-=O;R[y++]=l[u++],--O;);u=y-te,I=R}for(;2<Z;)R[y++]=I[u++],R[y++]=I[u++],R[y++]=I[u++],Z-=3;Z&&(R[y++]=I[u++],1<Z&&(R[y++]=I[u++]))}else{for(u=y-te;R[y++]=R[u++],R[y++]=R[u++],R[y++]=R[u++],2<(Z-=3););Z&&(R[y++]=R[u++],1<Z&&(R[y++]=R[u++]))}break}}break}}while(a<_&&y<b);a-=Z=w>>3,g&=(1<<(w-=Z<<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,s=-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 I;return u&&u.state?(I=u.state,u.total_in=u.total_out=I.total=0,u.msg="",I.wrap&&(u.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new c.Buf32(n),I.distcode=I.distdyn=new c.Buf32(h),I.sane=1,I.back=-1,b):s}function N(u){var I;return u&&u.state?((I=u.state).wsize=0,I.whave=0,I.wnext=0,w(u)):s}function S(u,I){var t,R;return u&&u.state?(R=u.state,I<0?(t=0,I=-I):(t=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?s:(R.window!==null&&R.wbits!==I&&(R.window=null),R.wrap=t,R.wbits=I,N(u))):s}function B(u,I){var t,R;return u?(R=new g,(u.state=R).window=null,(t=S(u,I))!==b&&(u.state=null),t):s}var F,M,O=!0;function Z(u){if(O){var I;for(F=new c.Buf32(512),M=new c.Buf32(32),I=0;I<144;)u.lens[I++]=8;for(;I<256;)u.lens[I++]=9;for(;I<280;)u.lens[I++]=7;for(;I<288;)u.lens[I++]=8;for(_(y,u.lens,0,288,F,0,u.work,{bits:9}),I=0;I<32;)u.lens[I++]=5;_(v,u.lens,0,32,M,0,u.work,{bits:5}),O=!1}u.lencode=F,u.lenbits=9,u.distcode=M,u.distbits=5}function te(u,I,t,R){var J,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,I,t-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(R<(J=L.wsize-L.wnext)&&(J=R),c.arraySet(L.window,I,t-R,J,L.wnext),(R-=J)?(c.arraySet(L.window,I,t-R,R,0),L.wnext=R,L.whave=L.wsize):(L.wnext+=J,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=J))),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,I){var t,R,J,L,ie,$,ne,z,E,re,K,q,de,_e,le,ce,he,fe,ye,xe,e,T,D,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 s;(t=u.state).mode===12&&(t.mode=13),ie=u.next_out,J=u.output,ne=u.avail_out,L=u.next_in,R=u.input,$=u.avail_in,z=t.hold,E=t.bits,re=$,K=ne,T=b;e:for(;;)switch(t.mode){case p:if(t.wrap===0){t.mode=13;break}for(;E<16;){if($===0)break e;$--,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($===0)break e;$--,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($===0)break e;$--,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($===0)break e;$--,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($===0)break e;$--,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&&($<(q=t.length)&&(q=$),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)),$-=q,L+=q,t.length-=q),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if($===0)break e;for(q=0;e=R[L+q++],t.head&&e&&t.length<65536&&(t.head.name+=String.fromCharCode(e)),e&&q<$;);if(512&t.flags&&(t.check=r(t.check,R,q,L)),$-=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($===0)break e;for(q=0;e=R[L+q++],t.head&&e&&t.length<65536&&(t.head.comment+=String.fromCharCode(e)),e&&q<$;);if(512&t.flags&&(t.check=r(t.check,R,q,L)),$-=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($===0)break e;$--,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($===0)break e;$--,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=ie,u.avail_out=ne,u.next_in=L,u.avail_in=$,t.hold=z,t.bits=E,2;u.adler=t.check=1,t.mode=12;case 12:if(I===5||I===6)break e;case 13:if(t.last){z>>>=7&E,E-=7&E,t.mode=27;break}for(;E<3;){if($===0)break e;$--,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(Z(t),t.mode=20,I!==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($===0)break e;$--,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,I===6)break e;case 15:t.mode=16;case 16:if(q=t.length){if($<q&&(q=$),ne<q&&(q=ne),q===0)break e;c.arraySet(J,R,L,q,ie),$-=q,L+=q,ne-=q,ie+=q,t.length-=q;break}t.mode=12;break;case 17:for(;E<14;){if($===0)break e;$--,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($===0)break e;$--,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,D={bits:t.lenbits},T=_(0,t.lens,0,19,t.lencode,0,t.work,D),t.lenbits=D.bits,T){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(;ce=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,he=65535&d,!((le=d>>>24)<=E);){if($===0)break e;$--,z+=R[L++]<<E,E+=8}if(he<16)z>>>=le,E-=le,t.lens[t.have++]=he;else{if(he===16){for(f=le+2;E<f;){if($===0)break e;$--,z+=R[L++]<<E,E+=8}if(z>>>=le,E-=le,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(he===17){for(f=le+3;E<f;){if($===0)break e;$--,z+=R[L++]<<E,E+=8}E-=le,e=0,q=3+(7&(z>>>=le)),z>>>=3,E-=3}else{for(f=le+7;E<f;){if($===0)break e;$--,z+=R[L++]<<E,E+=8}E-=le,e=0,q=11+(127&(z>>>=le)),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,D={bits:t.lenbits},T=_(y,t.lens,0,t.nlen,t.lencode,0,t.work,D),t.lenbits=D.bits,T){u.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,D={bits:t.distbits},T=_(v,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,D),t.distbits=D.bits,T){u.msg="invalid distances set",t.mode=30;break}if(t.mode=20,I===6)break e;case 20:t.mode=21;case 21:if(6<=$&&258<=ne){u.next_out=ie,u.avail_out=ne,u.next_in=L,u.avail_in=$,t.hold=z,t.bits=E,a(u,K),ie=u.next_out,J=u.output,ne=u.avail_out,L=u.next_in,R=u.input,$=u.avail_in,z=t.hold,E=t.bits,t.mode===12&&(t.back=-1);break}for(t.back=0;ce=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,he=65535&d,!((le=d>>>24)<=E);){if($===0)break e;$--,z+=R[L++]<<E,E+=8}if(ce&&(240&ce)==0){for(fe=le,ye=ce,xe=he;ce=(d=t.lencode[xe+((z&(1<<fe+ye)-1)>>fe)])>>>16&255,he=65535&d,!(fe+(le=d>>>24)<=E);){if($===0)break e;$--,z+=R[L++]<<E,E+=8}z>>>=fe,E-=fe,t.back+=fe}if(z>>>=le,E-=le,t.back+=le,t.length=he,ce===0){t.mode=26;break}if(32&ce){t.back=-1,t.mode=12;break}if(64&ce){u.msg="invalid literal/length code",t.mode=30;break}t.extra=15&ce,t.mode=22;case 22:if(t.extra){for(f=t.extra;E<f;){if($===0)break e;$--,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(;ce=(d=t.distcode[z&(1<<t.distbits)-1])>>>16&255,he=65535&d,!((le=d>>>24)<=E);){if($===0)break e;$--,z+=R[L++]<<E,E+=8}if((240&ce)==0){for(fe=le,ye=ce,xe=he;ce=(d=t.distcode[xe+((z&(1<<fe+ye)-1)>>fe)])>>>16&255,he=65535&d,!(fe+(le=d>>>24)<=E);){if($===0)break e;$--,z+=R[L++]<<E,E+=8}z>>>=fe,E-=fe,t.back+=fe}if(z>>>=le,E-=le,t.back+=le,64&ce){u.msg="invalid distance code",t.mode=30;break}t.offset=he,t.extra=15&ce,t.mode=24;case 24:if(t.extra){for(f=t.extra;E<f;){if($===0)break e;$--,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=K-ne,t.offset>q){if((q=t.offset-q)>t.whave&&t.sane){u.msg="invalid distance too far back",t.mode=30;break}de=q>t.wnext?(q-=t.wnext,t.wsize-q):t.wnext-q,q>t.length&&(q=t.length),_e=t.window}else _e=J,de=ie-t.offset,q=t.length;for(ne<q&&(q=ne),ne-=q,t.length-=q;J[ie++]=_e[de++],--q;);t.length===0&&(t.mode=21);break;case 26:if(ne===0)break e;J[ie++]=t.length,ne--,t.mode=21;break;case 27:if(t.wrap){for(;E<32;){if($===0)break e;$--,z|=R[L++]<<E,E+=8}if(K-=ne,u.total_out+=K,t.total+=K,K&&(u.adler=t.check=t.flags?r(t.check,J,K,ie-K):o(t.check,J,K,ie-K)),K=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($===0)break e;$--,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:T=1;break e;case 30:T=-3;break e;case 31:return-4;case 32:default:return s}return u.next_out=ie,u.avail_out=ne,u.next_in=L,u.avail_in=$,t.hold=z,t.bits=E,(t.wsize||K!==u.avail_out&&t.mode<30&&(t.mode<27||I!==4))&&te(u,u.output,u.next_out,K-u.avail_out)?(t.mode=31,-4):(re-=u.avail_in,K-=u.avail_out,u.total_in+=re,u.total_out+=K,t.total+=K,t.wrap&&K&&(u.adler=t.check=t.flags?r(t.check,J,K,u.next_out-K):o(t.check,J,K,u.next_out-K)),u.data_type=t.bits+(t.last?64:0)+(t.mode===12?128:0)+(t.mode===20||t.mode===15?256:0),(re==0&&K===0||I===4)&&T===b&&(T=-5),T)},x.inflateEnd=function(u){if(!u||!u.state)return s;var I=u.state;return I.window&&(I.window=null),u.state=null,b},x.inflateGetHeader=function(u,I){var t;return u&&u.state?(2&(t=u.state).wrap)==0?s:((t.head=I).done=!1,b):s},x.inflateSetDictionary=function(u,I){var t,R=I.length;return u&&u.state?(t=u.state).wrap!==0&&t.mode!==11?s:t.mode===11&&o(1,I,R,0)!==t.check?-3:te(u,I,R,R)?(t.mode=31,-4):(t.havedict=1,b):s},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,s,p,n,h,l){var g,w,N,S,B,F,M,O,Z,te=l.bits,u=0,I=0,t=0,R=0,J=0,L=0,ie=0,$=0,ne=0,z=0,E=null,re=0,K=new c.Buf16(16),q=new c.Buf16(16),de=null,_e=0;for(u=0;u<=15;u++)K[u]=0;for(I=0;I<s;I++)K[v[b+I]]++;for(J=te,R=15;1<=R&&K[R]===0;R--);if(R<J&&(J=R),R===0)return p[n++]=20971520,p[n++]=20971520,l.bits=1,0;for(t=1;t<R&&K[t]===0;t++);for(J<t&&(J=t),u=$=1;u<=15;u++)if($<<=1,($-=K[u])<0)return-1;if(0<$&&(y===0||R!==1))return-1;for(q[1]=0,u=1;u<15;u++)q[u+1]=q[u]+K[u];for(I=0;I<s;I++)v[b+I]!==0&&(h[q[v[b+I]]++]=I);if(F=y===0?(E=de=h,19):y===1?(E=o,re-=257,de=r,_e-=257,256):(E=a,de=_,-1),u=t,B=n,ie=I=z=0,N=-1,S=(ne=1<<(L=J))-1,y===1&&852<ne||y===2&&592<ne)return 1;for(;;){for(M=u-ie,Z=h[I]<F?(O=0,h[I]):h[I]>F?(O=de[_e+h[I]],E[re+h[I]]):(O=96,0),g=1<<u-ie,t=w=1<<L;p[B+(z>>ie)+(w-=g)]=M<<24|O<<16|Z|0,w!==0;);for(g=1<<u-1;z&g;)g>>=1;if(g!==0?(z&=g-1,z+=g):z=0,I++,--K[u]==0){if(u===R)break;u=v[b+h[I]]}if(J<u&&(z&S)!==N){for(ie===0&&(ie=J),B+=t,$=1<<(L=u-ie);L+ie<R&&!(($-=K[L+ie])<=0);)L++,$<<=1;if(ne+=1<<L,y===1&&852<ne||y===2&&592<ne)return 1;p[N=z&S]=J<<24|L<<16|B-n|0}}return z!==0&&(p[B+z]=u-ie<<24|64<<16|0),l.bits=J,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,s=30,p=19,n=2*b+1,h=15,l=16,g=7,w=256,N=16,S=17,B=18,F=[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],Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],te=new Array(2*(b+2));a(te);var u=new Array(2*s);a(u);var I=new Array(512);a(I);var t=new Array(256);a(t);var R=new Array(y);a(R);var J,L,ie,$=new Array(s);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?I[d]:I[256+(d>>>7)]}function re(d,k){d.pending_buf[d.pending++]=255&k,d.pending_buf[d.pending++]=k>>>8&255}function K(d,k,P){d.bi_valid>l-P?(d.bi_buf|=k<<d.bi_valid&65535,re(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){K(d,P[2*k],P[2*k+1])}function de(d,k){for(var P=0;P|=1&d,d>>>=1,P<<=1,0<--k;);return P>>>1}function _e(d,k,P){var U,A,W=new Array(h+1),V=0;for(U=1;U<=h;U++)W[U]=V=V+P[U-1]<<1;for(A=0;A<=k;A++){var H=d[2*A+1];H!==0&&(d[2*A]=de(W[H]++,H))}}function le(d){var k;for(k=0;k<b;k++)d.dyn_ltree[2*k]=0;for(k=0;k<s;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 ce(d){8<d.bi_valid?re(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 he(d,k,P,U){var A=2*k,W=2*P;return d[A]<d[W]||d[A]===d[W]&&U[k]<=U[P]}function fe(d,k,P){for(var U=d.heap[P],A=P<<1;A<=d.heap_len&&(A<d.heap_len&&he(k,d.heap[A+1],d.heap[A],d.depth)&&A++,!he(k,U,d.heap[A],d.depth));)d.heap[P]=d.heap[A],P=A,A<<=1;d.heap[P]=U}function ye(d,k,P){var U,A,W,V,H=0;if(d.last_lit!==0)for(;U=d.pending_buf[d.d_buf+2*H]<<8|d.pending_buf[d.d_buf+2*H+1],A=d.pending_buf[d.l_buf+H],H++,U===0?q(d,A,k):(q(d,(W=t[A])+v+1,k),(V=F[W])!==0&&K(d,A-=R[W],V),q(d,W=E(--U),P),(V=M[W])!==0&&K(d,U-=$[W],V)),H<d.last_lit;);q(d,w,k)}function xe(d,k){var P,U,A,W=k.dyn_tree,V=k.stat_desc.static_tree,H=k.stat_desc.has_stree,ee=k.stat_desc.elems,ae=-1;for(d.heap_len=0,d.heap_max=n,P=0;P<ee;P++)W[2*P]!==0?(d.heap[++d.heap_len]=ae=P,d.depth[P]=0):W[2*P+1]=0;for(;d.heap_len<2;)W[2*(A=d.heap[++d.heap_len]=ae<2?++ae:0)]=1,d.depth[A]=0,d.opt_len--,H&&(d.static_len-=V[2*A+1]);for(k.max_code=ae,P=d.heap_len>>1;1<=P;P--)fe(d,W,P);for(A=ee;P=d.heap[1],d.heap[1]=d.heap[d.heap_len--],fe(d,W,1),U=d.heap[1],d.heap[--d.heap_max]=P,d.heap[--d.heap_max]=U,W[2*A]=W[2*P]+W[2*U],d.depth[A]=(d.depth[P]>=d.depth[U]?d.depth[P]:d.depth[U])+1,W[2*P+1]=W[2*U+1]=A,d.heap[1]=A++,fe(d,W,1),2<=d.heap_len;);d.heap[--d.heap_max]=d.heap[1],(function(oe,be){var we,ke,Se,me,Ae,De,je=be.dyn_tree,Re=be.max_code,j=be.stat_desc.static_tree,X=be.stat_desc.has_stree,Y=be.stat_desc.extra_bits,ue=be.stat_desc.extra_base,ge=be.stat_desc.max_length,Ne=0;for(me=0;me<=h;me++)oe.bl_count[me]=0;for(je[2*oe.heap[oe.heap_max]+1]=0,we=oe.heap_max+1;we<n;we++)ge<(me=je[2*je[2*(ke=oe.heap[we])+1]+1]+1)&&(me=ge,Ne++),je[2*ke+1]=me,Re<ke||(oe.bl_count[me]++,Ae=0,ue<=ke&&(Ae=Y[ke-ue]),De=je[2*ke],oe.opt_len+=De*(me+Ae),X&&(oe.static_len+=De*(j[2*ke+1]+Ae)));if(Ne!==0){do{for(me=ge-1;oe.bl_count[me]===0;)me--;oe.bl_count[me]--,oe.bl_count[me+1]+=2,oe.bl_count[ge]--,Ne-=2}while(0<Ne);for(me=ge;me!==0;me--)for(ke=oe.bl_count[me];ke!==0;)Re<(Se=oe.heap[--we])||(je[2*Se+1]!==me&&(oe.opt_len+=(me-je[2*Se+1])*je[2*Se],je[2*Se+1]=me),ke--)}})(d,k),_e(W,ae,d.bl_count)}function e(d,k,P){var U,A,W=-1,V=k[1],H=0,ee=7,ae=4;for(V===0&&(ee=138,ae=3),k[2*(P+1)+1]=65535,U=0;U<=P;U++)A=V,V=k[2*(U+1)+1],++H<ee&&A===V||(H<ae?d.bl_tree[2*A]+=H:A!==0?(A!==W&&d.bl_tree[2*A]++,d.bl_tree[2*N]++):H<=10?d.bl_tree[2*S]++:d.bl_tree[2*B]++,W=A,ae=(H=0)===V?(ee=138,3):A===V?(ee=6,3):(ee=7,4))}function T(d,k,P){var U,A,W=-1,V=k[1],H=0,ee=7,ae=4;for(V===0&&(ee=138,ae=3),U=0;U<=P;U++)if(A=V,V=k[2*(U+1)+1],!(++H<ee&&A===V)){if(H<ae)for(;q(d,A,d.bl_tree),--H!=0;);else A!==0?(A!==W&&(q(d,A,d.bl_tree),H--),q(d,N,d.bl_tree),K(d,H-3,2)):H<=10?(q(d,S,d.bl_tree),K(d,H-3,3)):(q(d,B,d.bl_tree),K(d,H-11,7));W=A,ae=(H=0)===V?(ee=138,3):A===V?(ee=6,3):(ee=7,4)}}a($);var D=!1;function f(d,k,P,U){K(d,(_<<1)+(U?1:0),3),(function(A,W,V,H){ce(A),re(A,V),re(A,~V),c.arraySet(A.pending_buf,A.window,W,V,A.pending),A.pending+=V})(d,k,P)}x._tr_init=function(d){D||((function(){var k,P,U,A,W,V=new Array(h+1);for(A=U=0;A<y-1;A++)for(R[A]=U,k=0;k<1<<F[A];k++)t[U++]=A;for(t[U-1]=A,A=W=0;A<16;A++)for($[A]=W,k=0;k<1<<M[A];k++)I[W++]=A;for(W>>=7;A<s;A++)for($[A]=W<<7,k=0;k<1<<M[A]-7;k++)I[256+W++]=A;for(P=0;P<=h;P++)V[P]=0;for(k=0;k<=143;)te[2*k+1]=8,k++,V[8]++;for(;k<=255;)te[2*k+1]=9,k++,V[9]++;for(;k<=279;)te[2*k+1]=7,k++,V[7]++;for(;k<=287;)te[2*k+1]=8,k++,V[8]++;for(_e(te,b+1,V),k=0;k<s;k++)u[2*k+1]=5,u[2*k]=de(k,5);J=new ne(te,F,v+1,b,h),L=new ne(u,M,0,s,h),ie=new ne(new Array(0),O,0,p,g)})(),D=!0),d.l_desc=new z(d.dyn_ltree,J),d.d_desc=new z(d.dyn_dtree,L),d.bl_desc=new z(d.bl_tree,ie),d.bi_buf=0,d.bi_valid=0,le(d)},x._tr_stored_block=f,x._tr_flush_block=function(d,k,P,U){var A,W,V=0;0<d.level?(d.strm.data_type===2&&(d.strm.data_type=(function(H){var ee,ae=4093624447;for(ee=0;ee<=31;ee++,ae>>>=1)if(1&ae&&H.dyn_ltree[2*ee]!==0)return o;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return r;for(ee=32;ee<v;ee++)if(H.dyn_ltree[2*ee]!==0)return r;return o})(d)),xe(d,d.l_desc),xe(d,d.d_desc),V=(function(H){var ee;for(e(H,H.dyn_ltree,H.l_desc.max_code),e(H,H.dyn_dtree,H.d_desc.max_code),xe(H,H.bl_desc),ee=p-1;3<=ee&&H.bl_tree[2*Z[ee]+1]===0;ee--);return H.opt_len+=3*(ee+1)+5+5+4,ee})(d),A=d.opt_len+3+7>>>3,(W=d.static_len+3+7>>>3)<=A&&(A=W)):A=W=P+5,P+4<=A&&k!==-1?f(d,k,P,U):d.strategy===4||W===A?(K(d,2+(U?1:0),3),ye(d,te,u)):(K(d,4+(U?1:0),3),(function(H,ee,ae,oe){var be;for(K(H,ee-257,5),K(H,ae-1,5),K(H,oe-4,4),be=0;be<oe;be++)K(H,H.bl_tree[2*Z[be]+1],3);T(H,H.dyn_ltree,ee-1),T(H,H.dyn_dtree,ae-1)})(d,d.l_desc.max_code+1,d.d_desc.max_code+1,V+1),ye(d,d.dyn_ltree,d.dyn_dtree)),le(d),U&&ce(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){K(d,2,3),q(d,w,te),(function(k){k.bi_valid===16?(re(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,s={},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 F={callback:N,args:S};return s[b]=F,a(b),b++},h.clearImmediate=l}function l(N){delete s[N]}function g(N){if(p)setTimeout(g,0,N);else{var S=s[N];if(S){p=!0;try{(function(B){var F=B.callback,M=B.args;switch(M.length){case 0:F();break;case 1:F(M[0]);break;case 2:F(M[0],M[1]);break;case 3:F(M[0],M[1],M[2]);break;default:F.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 Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(tt)),tt.exports}var Mr=Lr();const Wr=Gt(Mr);function Zr(G,Q){const m=G.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:G}];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:G}];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 s;const _=((s=r.match(/^---\n([\s\S]*?)\n---\n/))==null?void 0:s[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 $r(G,Q=[]){let m=[];function C(c,o){const r=se.createContext(o);r.displayName=c+"Context";const a=m.length;m=[...m,o];const _=v=>{var l;const{scope:b,children:s,...p}=v,n=((l=b==null?void 0:b[G])==null?void 0:l[a])||r,h=se.useMemo(()=>p,Object.values(p));return i.jsx(n.Provider,{value:h,children:s})};_.displayName=c+"Provider";function y(v,b){var n;const s=((n=b==null?void 0:b[G])==null?void 0:n[a])||r,p=se.useContext(s);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=>se.createContext(o));return function(r){const a=(r==null?void 0:r[G])||c;return se.useMemo(()=>({[`__scope${G}`]:{...r,[G]:a}}),[r,a])}};return x.scopeName=G,[C,Hr(x,...Q)]}function Hr(...G){const Q=G[0];if(G.length===1)return Q;const m=()=>{const C=G.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 se.useMemo(()=>({[`__scope${Q.scopeName}`]:o}),[o])}};return m.scopeName=Q.scopeName,m}var Gr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zt=Gr.reduce((G,Q)=>{const m=qt(`Primitive.${Q}`),C=se.forwardRef((x,c)=>{const{asChild:o,...r}=x,a=o?m:Q;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(a,{...r,ref:c})});return C.displayName=`Primitive.${Q}`,{...G,[Q]:C}},{}),ot="Progress",lt=100,[qr]=$r(ot),[Kr,Vr]=qr(ot),It=se.forwardRef((G,Q)=>{const{__scopeProgress:m,value:C=null,max:x,getValueLabel:c=Yr,...o}=G;(x||x===0)&&!Nt(x)&&console.error(Xr(`${x}`,"Progress"));const r=Nt(x)?x:lt;C!==null&&!St(C,r)&&console.error(Jr(`${C}`,"Progress"));const a=St(C,r)?C:null,_=qe(a)?c(a,r):void 0;return i.jsx(Kr,{scope:m,value:a,max:r,children:i.jsx(zt.div,{"aria-valuemax":r,"aria-valuemin":0,"aria-valuenow":qe(a)?a:void 0,"aria-valuetext":_,role:"progressbar","data-state":Ot(a,r),"data-value":a??void 0,"data-max":r,...o,ref:Q})})});It.displayName=ot;var Dt="ProgressIndicator",Rt=se.forwardRef((G,Q)=>{const{__scopeProgress:m,...C}=G,x=Vr(Dt,m);return i.jsx(zt.div,{"data-state":Ot(x.value,x.max),"data-value":x.value??void 0,"data-max":x.max,...C,ref:Q})});Rt.displayName=Dt;function Yr(G,Q){return`${Math.round(G/Q*100)}%`}function Ot(G,Q){return G==null?"indeterminate":G===Q?"complete":"loading"}function qe(G){return typeof G=="number"}function Nt(G){return qe(G)&&!isNaN(G)&&G>0}function St(G,Q){return qe(G)&&!isNaN(G)&&G<=Q&&G>=0}function Xr(G,Q){return`Invalid prop \`max\` of value \`${G}\` supplied to \`${Q}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${lt}\`.`}function Jr(G,Q){return`Invalid prop \`value\` of value \`${G}\` supplied to \`${Q}\`. The \`value\` prop must be:
41
+ - a positive number
42
+ - less than the value passed to \`max\` (or ${lt} if no \`max\` prop is set)
43
+ - \`null\` or \`undefined\` if the progress is indeterminate.
44
+
45
+ Defaulting to \`null\`.`}var Ft=It,Qr=Rt;const Tt=se.forwardRef(({className:G,value:Q,...m},C)=>i.jsx(Ft,{ref:C,className:Kt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",G),...m,children:i.jsx(Qr,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(Q||0)}%)`}})}));Tt.displayName=Ft.displayName;const Ke=/\.(md|markdown|ya?ml|txt|json)$/i;function ct(G){return G===".versions"||G===".context"?!1:G.startsWith(".")||G==="node_modules"||G==="_suggestions"}const en=new Set(["INDEX.MD","CONTEXT.MD","CLAUDE.MD","GEMINI.MD","AGENTS.MD","QWEN.MD","README.MD"]);function tn(G){return G.filter(Q=>{const m=Q.path.split("/"),C=m[m.length-1];return!C.endsWith(".md")||en.has(C.toUpperCase())?!1:!m.some(x=>x.startsWith(".")||x==="node_modules")}).length}async function Bt(G,Q,m=32){const C=[];for(let x=0;x<G.length;x+=m)C.push(...await Promise.all(G.slice(x,x+m).map(Q)));return C}async function rn(G,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"?ct(a.name)||r.push({handle:a,rel:_}):Ke.test(a.name)&&C.push({handle:a,rel:_})}await Promise.all(r.map(a=>x(a.handle,a.rel)))};await x(G,Q),m.push(...await Bt(C,async({handle:c,rel:o})=>({path:o,content:await(await c.getFile()).text()})))}async function nn(G,Q){const m=await Wr.loadAsync(G);for(const C of Object.values(m.files)){if(C.dir)continue;const x=C.name.split("/");x.some(ct)||!Ke.test(x[x.length-1])||Q.push({path:C.name,content:await C.async("string")})}}async function sn(G){const Q=[];for(const m of Array.from(G)){const C=m.webkitRelativePath.split("/");C.shift();const x=C.join("/");!x||C.some(ct)||!Ke.test(m.name)||Q.push({file:m,rel:x})}return Bt(Q,async({file:m,rel:C})=>({path:C,content:await m.text()}))}function an({isOpen:G,onClose:Q,onImported:m}){const[C,x]=se.useState("folder"),[c,o]=se.useState(""),[r,a]=se.useState(null),[_,y]=se.useState(""),[v,b]=se.useState(!1),[s,p]=se.useState(!1),[n,h]=se.useState(null),[l,g]=se.useState(null),w=se.useRef(null),N=se.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))},F=()=>{s||(S(),Q())},M=async()=>{var t;g(null);const u=window.showDirectoryPicker;if(typeof u!="function"){(t=w.current)==null||t.click();return}let I;try{I=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 rn(I,"",R),o(I.name),a(R),y(J=>J||I.name)}catch(R){console.error("[ImportFolderModal] scan failed",R),g("Couldn't read that folder")}finally{b(!1)}},O=async u=>{const I=u.target.files;if(!(!I||!I.length)){b(!0),g(null);try{const t=I[0].webkitRelativePath.split("/")[0]||"Imported",R=await sn(I);o(t),a(R),y(J=>J||t)}catch(t){console.error("[ImportFolderModal] scan failed",t),g("Couldn't read that folder")}finally{b(!1),u.target.value=""}}},Z=async u=>{const I=u.target.files?Array.from(u.target.files):[];if(I.length){b(!0),g(null);try{const t=[];let R="Imported";for(const J of I)if(J.name.toLowerCase().endsWith(".zip"))await nn(J,t),R=J.name.replace(/\.zip$/i,"")||R;else if(/\.(md|markdown)$/i.test(J.name))for(const L of Zr(await J.text(),J.name))t.push(L);else Ke.test(J.name)&&t.push({path:J.name,content:await J.text()});o(R),a(t),y(J=>J||R)}catch(t){console.error("[ImportFolderModal] file read failed",t),g("Couldn't read that selection")}finally{b(!1),u.target.value=""}}},te=async()=>{if(r){p(!0),h(null),g(null);try{const{rejected:u}=await Vt(_.trim()||c,r,(I,t)=>h({done:I,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}F()}catch(u){console.error("[ImportFolderModal] import failed",u),g((u==null?void 0:u.message)||"Import failed"),p(!1),h(null)}}};return i.jsx(Ze,{open:G,onOpenChange:u=>!u&&F(),children:i.jsxs($e,{className:"sm:max-w-[480px]",children:[i.jsx(He,{children:i.jsxs(Ge,{className:"flex items-center gap-2",children:[i.jsx(Ie,{className:"h-5 w-5"}),"Import into a new nest"]})}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Import a folder from your computer, or a nest ",i.jsx("code",{children:".zip"})," (or markdown files) exported from another host. Files are uploaded into a new nest — your originals are left untouched."]}),i.jsx("input",{ref:u=>{w.current=u,u&&(u.setAttribute("webkitdirectory",""),u.setAttribute("directory",""))},type:"file",multiple:!0,className:"hidden",onChange:O}),i.jsx("input",{ref:N,type:"file",multiple:!0,accept:".zip,.md,.markdown,.yaml,.yml,.txt,.json",className:"hidden",onChange:Z}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Import source",children:[{id:"folder",label:"Folder"},{id:"file",label:"File / .zip"}].map(u=>i.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:[i.jsx("input",{type:"radio",name:"import-source",className:"accent-primary",checked:C===u.id,onChange:()=>B(u.id),disabled:v||s}),u.label]},u.id))}),i.jsxs(pe,{className:"w-full",variant:"outline",onClick:C==="folder"?M:()=>{var u;g(null),(u=N.current)==null||u.click()},disabled:v||s,children:[v?i.jsx(ze,{className:"h-4 w-4 mr-2 animate-spin"}):i.jsx(Ie,{className:"h-4 w-4 mr-2"}),C==="folder"?"Choose folder":"Choose .zip or files"]}),r&&(()=>{const u=tn(r);return i.jsxs("p",{className:"break-words text-sm text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-foreground",children:c})," — ",u," document",u===1?"":"s",i.jsxs("span",{className:"text-xs",children:[" · ",r.length," file",r.length===1?"":"s"," scanned"]})]})})()]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(st,{children:"Nest name"}),i.jsx(We,{placeholder:c||"My Folder",value:_,onChange:u=>y(u.target.value)})]}),s&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(Tt,{value:n&&n.total>0&&n.done<n.total?Math.round(n.done/n.total*100):void 0}),i.jsx("p",{className:"text-xs text-muted-foreground",children:n&&n.done<n.total?`Uploading ${n.done} of ${n.total} files…`:"Registering documents…"})]}),l&&i.jsx("p",{className:"text-sm text-destructive",children:l})]}),i.jsxs(it,{children:[i.jsx(pe,{variant:"outline",onClick:F,disabled:s,children:"Cancel"}),i.jsxs(pe,{onClick:te,disabled:!r||v||s,children:[s?i.jsx(ze,{className:"h-4 w-4 mr-2 animate-spin"}):i.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Import"]})]})]})})}const Me=24;function yn(){var Re;const{openNest:G,manageKeys:Q}=Yt(),{adminStatus:m,authMode:C,isAdmin:x}=At(),c=((Re=m==null?void 0:m.me)==null?void 0:Re.email)??null,{data:o,isLoading:r,refetch:a}=Xt(),_=(o==null?void 0:o.nests)??[],[y,v]=se.useState(!1),{data:b,isLoading:s}=Jt({...Pe.nestList(!0),enabled:y}),p=(b==null?void 0:b.nests)??[],[n,h]=se.useState(""),[l,g]=se.useState("archived"),w=se.useMemo(()=>Ur(p,n,l),[p,n,l]),[N,S]=se.useState(null),[B,F]=se.useState(!1),[M,O]=se.useState(""),[Z,te]=se.useState("activity"),[u,I]=se.useState("all"),[t,R]=se.useState(Me),J=j=>j.is_owner??(j.permission??"owner")==="owner",L=se.useMemo(()=>{if(!Br(u))return[];const j=M.trim().toLowerCase();return[..._.filter(Y=>u==="owned"&&!J(Y)||u==="shared"&&J(Y)||u==="public"&&Y.visibility!=="public"||u==="org"&&Y.visibility!=="org"?!1:j?(Y.name??"").toLowerCase().includes(j)||(Y.description??"").toLowerCase().includes(j):!0)].sort((Y,ue)=>{const ge=+!!ue.pinned-+!!Y.pinned;return ge!==0?ge:Z==="name"?String(Y.name??"").localeCompare(String(ue.name??"")):String(ue.last_activity??ue.created_at??"").localeCompare(String(Y.last_activity??Y.created_at??""))})},[_,M,u,Z]),ie=L.slice(0,t),$=M.trim()!==""||u!=="all"||Z!=="activity",ne=()=>{O(""),I("all"),te("activity")},z=Qt(),[E,re]=se.useState([]),K=se.useMemo(()=>Pr(E,u,M),[E,u,M]),[q,de]=se.useState({}),[_e,le]=se.useState({}),[ce,he]=se.useState(!1),[fe,ye]=se.useState(!1),[xe,e]=se.useState(""),[T,D]=se.useState(""),[f,d]=se.useState(null),[k,P]=se.useState(new Set),[U,A]=se.useState(null),[W,V]=se.useState(null),[H,ee]=se.useState(null),[ae,oe]=se.useState(null),be=typeof window<"u"?window.location.origin:"http://localhost:3838",we=async()=>{z.fetchQuery(Pe.unsynced()).then(j=>re(j.folders)).catch(()=>re([])),await a()},ke=async j=>{de(X=>({...X,[j]:!0})),le(X=>{const Y={...X};return delete Y[j],Y});try{await ar(j),await we()}catch(X){console.error("[Dashboard] syncUnsyncedFolder failed",j,X);const Y=X instanceof Error?X.message:"Failed to sync folder";le(ue=>({...ue,[j]:Y}))}finally{de(X=>{const Y={...X};return delete Y[j],Y})}},Se=async j=>{de(X=>({...X,[j]:!0})),le(X=>{const Y={...X};return delete Y[j],Y});try{await or(j),re(X=>X.filter(Y=>Y.name!==j)),oe(null)}catch(X){console.error("[Dashboard] deleteUnsyncedFolder failed",j,X);const Y=X instanceof Error?X.message:"Failed to delete folder";le(ue=>({...ue,[j]:Y})),oe(null)}finally{de(X=>{const Y={...X};return delete Y[j],Y})}};se.useEffect(()=>{we()},[c]);const me=async j=>{j.preventDefault();const X=Ue(xe);if(X){d(X);return}d(null);try{const{nest:Y}=await lr(xe.trim(),T.trim());e(""),D(""),he(!1),we(),G(Y.id,Y.name,!0,Y.user_id===Ye)}catch(Y){console.error("[Dashboard] createNest failed",Y),d(Y instanceof Error?Y.message:"Failed to create nest")}},Ae=async(j,X)=>{if(k.has(j))return;P(ue=>new Set(ue).add(j));const Y=ue=>z.setQueryData(Pe.nestList().queryKey,ge=>ge&&{...ge,nests:ge.nests.map(Ne=>Ne.id===j?{...Ne,pinned:ue}:Ne)});Y(X);try{await cr(j,X)}catch(ue){Y(!X),Ee.error((ue==null?void 0:ue.message)??`Failed to ${X?"pin":"unpin"} this nest`)}finally{P(ue=>{const ge=new Set(ue);return ge.delete(j),ge})}},De=(j,X,Y=!1)=>{A({id:j,name:X,isImported:Y})},je=(j,X)=>{V({id:j,name:X})};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs(Je,{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border-blue-200",children:[i.jsx(pr,{className:"pb-3",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{children:[i.jsx(gr,{className:"text-lg",children:"Your Community Server"}),i.jsxs(xr,{children:["Running at"," ",i.jsx("code",{className:"text-xs bg-white/60 px-1.5 py-0.5 rounded font-mono",children:be}),i.jsx(on,{value:be})]})]}),i.jsxs("div",{className:"flex gap-6 text-center",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xl font-bold",children:r?i.jsx(wt,{}):_.length}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Nests"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-2xl font-bold",children:r?i.jsx(wt,{}):_.reduce((j,X)=>j+Number(X.document_count??0),0)}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Documents"})]})]})]})}),i.jsx(Qe,{className:"pt-0",children:i.jsxs("div",{className:"grid md:grid-cols-2 gap-3 text-xs",children:[i.jsx(Ct,{icon:i.jsx(er,{className:"h-4 w-4"}),title:"Hootie",desc:"Settings → Vault → Remote Server → paste URL"}),i.jsx(Ct,{icon:i.jsx(tr,{className:"h-4 w-4"}),title:"Claude Desktop",desc:"Add MCP endpoint per nest via Connect button"})]})})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsx(_r,{icon:ft,title:"Nests",description:"Shared knowledge vaults for your team",className:"mb-0",actions:i.jsxs(i.Fragment,{children:[i.jsxs(pe,{variant:"outline",onClick:()=>ye(!0),children:[i.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Import Folder"]}),i.jsxs(pe,{onClick:()=>he(!0),children:[i.jsx(mt,{className:"h-4 w-4 mr-2"}),"New Nest"]})]})}),_.length>0&&i.jsx(Tr,{nests:_,onManageKeys:Q}),i.jsx(Ze,{open:ce,onOpenChange:j=>{j||(he(!1),d(null))},children:i.jsxs($e,{className:"sm:max-w-[480px]",children:[i.jsxs(He,{children:[i.jsx(Ge,{children:"New nest"}),i.jsx(rt,{children:"A nest holds a set of documents and the governance around them."})]}),i.jsxs("form",{onSubmit:me,className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(st,{children:"Name"}),i.jsx(We,{placeholder:"Team Knowledge",value:xe,onChange:j=>{e(j.target.value),f&&d(null)},"aria-invalid":!!f,autoFocus:!0}),(f??(xe?Ue(xe):null))&&i.jsx("p",{className:"text-xs text-destructive",children:f??Ue(xe)})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(st,{children:"Description (optional)"}),i.jsx(vr,{placeholder:"Shared docs for the engineering team",value:T,onChange:j=>D(j.target.value),rows:3})]}),i.jsxs(it,{children:[i.jsx(pe,{type:"button",variant:"outline",onClick:()=>{he(!1),d(null)},children:"Cancel"}),i.jsx(pe,{type:"submit",disabled:!!Ue(xe),children:"Create Nest"})]})]})]})}),!r&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!y&&_.length>5&&i.jsxs(i.Fragment,{children:[i.jsx(We,{value:M,onChange:j=>{O(j.target.value),R(Me)},placeholder:"Filter nests by name or description…",className:"h-9 max-w-xs","data-testid":"nest-filter-input"}),i.jsxs("select",{value:u,onChange:j=>{I(j.target.value),R(Me)},className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Filter nests by access","data-testid":"nest-scope-select",children:[i.jsx("option",{value:"all",children:"All nests"}),i.jsx("option",{value:"owned",children:"Owned by me"}),i.jsx("option",{value:"shared",children:"Shared with me"}),i.jsx("option",{value:"org",children:"Organization"}),i.jsx("option",{value:"public",children:"Public"}),(E.length>0||u==="synced"||u==="unsynced")&&i.jsxs(i.Fragment,{children:[i.jsx("option",{value:"synced",children:"Synced nests only"}),i.jsx("option",{value:"unsynced",children:"Unsynced folders only"})]})]}),i.jsxs("select",{value:Z,onChange:j=>te(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:[i.jsx("option",{value:"activity",children:"Recent activity"}),i.jsx("option",{value:"name",children:"Name (A–Z)"})]}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.length+K.length," of"," ",_.length+E.length]}),$&&i.jsx(pe,{variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:ne,"data-testid":"nest-clear-filters",children:"Clear filters"})]}),i.jsxs("label",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(et,{className:"h-4 w-4"}),"Archived",i.jsx(rr,{checked:y,onCheckedChange:v,"aria-label":"Show archived nests","data-testid":"nest-archived-switch"})]})]}),y?i.jsx("div",{className:"space-y-4","data-testid":"archived-nests",children:s?i.jsxs("div",{className:"flex items-center gap-2 py-10 justify-center text-sm text-muted-foreground",children:[i.jsx(ze,{className:"h-4 w-4 animate-spin"}),"Loading archived nests…"]}):p.length===0?i.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[i.jsx(et,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),i.jsx("p",{className:"text-sm font-medium",children:"No archived nests"}),i.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."})]}):i.jsxs(i.Fragment,{children:[i.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&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(We,{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"}),i.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:[i.jsx("option",{value:"archived",children:"Date archived"}),i.jsx("option",{value:"name",children:"Name (A–Z)"})]}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[w.length," of ",p.length]}),n.trim()!==""&&i.jsx(pe,{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?i.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[i.jsx("p",{className:"text-sm font-medium",children:"Nothing matches this filter"}),i.jsx(pe,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>h(""),children:"Clear filter"})]}):i.jsx("div",{className:"space-y-2",children:w.map(j=>{const X=()=>G(j.id,j.name,j.is_owner??!1,j.user_id===Ye,!0);return i.jsxs("div",{role:"button",tabIndex:0,onClick:X,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&Y.target===Y.currentTarget&&(Y.preventDefault(),X())},className:"flex items-center gap-3 rounded-lg border px-4 py-3 hover:bg-secondary/50 cursor-pointer",children:[i.jsx(et,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium",children:j.name}),i.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[j.archived_at?`Archived ${hr(j.archived_at)}`:"Archived",j.description?` — ${j.description}`:""]})]}),j.is_owner&&i.jsxs(i.Fragment,{children:[i.jsxs(pe,{variant:"outline",size:"sm",onClick:Y=>{Y.stopPropagation(),S({id:j.id,name:j.name})},"data-testid":"restore-nest",children:[i.jsx(Ir,{className:"h-3.5 w-3.5 mr-1.5"}),"Restore"]}),i.jsx(pe,{variant:"ghost",size:"sm",className:"text-red-700 hover:text-red-800",onClick:Y=>{Y.stopPropagation(),A({id:j.id,name:j.name,isImported:!!j.is_imported})},children:i.jsx(Fe,{className:"h-3.5 w-3.5"})})]})]},j.id)})})]})}):r?i.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):_.length+E.length>0&&L.length+K.length===0?i.jsx(Je,{children:i.jsxs(Qe,{className:"text-center py-12",children:[i.jsx("p",{className:"font-medium",children:"Nothing matches this filter"}),i.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[_.length+E.length," item",_.length+E.length===1?" is":"s are"," hidden by the current filter."]}),i.jsx(pe,{variant:"outline",onClick:ne,children:"Clear filters"})]})}):ie.length===0&&E.length===0?i.jsx(Je,{children:i.jsxs(Qe,{className:"text-center py-12",children:[i.jsx(ft,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),i.jsx("p",{className:"font-medium",children:"No nests yet"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first nest to start sharing knowledge with your team"}),i.jsxs(pe,{onClick:()=>he(!0),children:[i.jsx(mt,{className:"h-4 w-4 mr-2"}),"Create First Nest"]})]})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[K.map(j=>{const X=!!q[j.name],Y=_e[j.name];return i.jsx("div",{className:"relative text-left p-4 rounded-lg border border-dashed border-blue-300 bg-blue-50/40",children:i.jsxs("div",{className:"flex items-start gap-3 pr-2",children:[i.jsx("div",{className:"p-2 rounded-md bg-blue-100",children:i.jsx(pt,{className:"h-5 w-5 text-blue-700"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-medium truncate",children:j.label}),i.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",title:j.name,children:j.name}),i.jsxs("p",{className:"text-sm text-muted-foreground truncate mt-1",children:[j.mdCount," markdown file",j.mdCount===1?"":"s"," waiting to sync"]}),i.jsx("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:i.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:[i.jsx(pt,{className:"h-3 w-3"}),"Unsynced"]})}),i.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[i.jsx(pe,{size:"sm",onClick:()=>ke(j.name),disabled:X,children:X?i.jsxs(i.Fragment,{children:[i.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Syncing…"]}):i.jsxs(i.Fragment,{children:[i.jsx(Fr,{className:"h-3.5 w-3.5 mr-2"}),"Sync to Nest"]})}),i.jsxs(pe,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>oe({name:j.name,label:j.label}),disabled:X,title:"Delete this folder from the server",children:[i.jsx(Fe,{className:"h-3.5 w-3.5 mr-2"}),"Delete"]})]}),Y&&i.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:Y,children:Y})]})]})},`unsynced:${j.name}`)}),ie.map(j=>{var ut,ht;const X=j.user_id===Ye,Y=()=>G(j.id,j.name,j.is_owner??(j.permission??"owner")==="owner",X),ue=j.permission??"owner",ge=j.is_owner??ue==="owner",Ne=!ge,Oe=ge||X&&C!=="open"&&x,Pt=ge||Array.isArray(j.roles)&&j.roles.includes("admin")||X&&C!=="open"&&x,Te=Array.isArray(j.roles)?j.roles:[],Ve=Te.includes("admin")?"admin":Te.includes("editor")?"editor":Te.includes("reviewer")?"reviewer":Te.includes("viewer")?"viewer":ue==="admin"?"admin":ue==="write"?"editor":ue==="read"?"viewer":null,Ut=dr(Ve,Oe),Ce=Ve?{admin:{label:"Admin",Icon:xt,cls:"bg-purple-50 text-purple-700 border-purple-200",title:"Admin — full access except deleting the nest"},editor:{label:"Editor",Icon:gt,cls:"bg-indigo-50 text-indigo-700 border-indigo-200",title:"Editor — you can read and edit documents"},reviewer:{label:"Reviewer",Icon:Er,cls:"bg-amber-50 text-amber-700 border-amber-200",title:"Reviewer — you can approve or reject submissions"},viewer:{label:"Viewer",Icon:nr,cls:"bg-slate-50 text-slate-700 border-slate-200",title:"View only — you can read but not edit"}}[Ve]:null,dt=(Ce==null?void 0:Ce.Icon)??null;return i.jsxs("div",{role:"button",tabIndex:0,onClick:Y,onKeyDown:ve=>{(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),Y())},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:[i.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-0.5",children:[Pt&&i.jsx("button",{type:"button","aria-label":`Rename nest ${j.name}`,title:"Rename nest",onClick:ve=>{ve.stopPropagation(),ee({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:i.jsx(gt,{className:"h-3.5 w-3.5"})}),(Oe||Ut)&&i.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:ve=>{ve.stopPropagation(),Oe?De(j.id,j.name,!!j.is_imported):je(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:i.jsx(Fe,{className:"h-3.5 w-3.5"})}),i.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:k.has(j.id),onClick:ve=>{ve.stopPropagation(),Ae(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:i.jsx(Rr,{className:`h-3.5 w-3.5 ${j.pinned?"fill-current":""}`})})]}),i.jsxs("div",{className:"flex items-start gap-3 pr-20",children:[i.jsx("div",{className:`p-2 rounded-md ${X?"bg-amber-100":"bg-primary/10"}`,children:X?i.jsx(sr,{className:"h-5 w-5 text-amber-700"}):i.jsx(_t,{className:"h-5 w-5 text-primary"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-medium truncate",title:j.name,children:j.name}),j.description&&i.jsx("p",{className:"text-sm text-muted-foreground truncate mt-0.5",title:j.description,children:j.description}),Ne&&i.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:[i.jsx(vt,{className:"h-3 w-3 shrink-0"}),i.jsxs("span",{className:"truncate",children:["Shared by"," ",i.jsx("span",{className:"font-medium",children:j.owner_email||"unknown user"})]})]}),j.is_imported?i.jsxs("p",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground truncate",title:`Imported ${Xe(j.created_at)}`,children:[i.jsx(Ie,{className:"h-3 w-3 shrink-0"}),i.jsxs("span",{className:"truncate",children:["Imported by"," ",i.jsx("span",{className:"font-medium",children:j.is_owner?"you":j.owner_email||"unknown user"})," ","· ",Xe(j.created_at)]})]}):null,i.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",title:"Documents",children:[i.jsx(_t,{className:"h-3 w-3"}),j.document_count??0]}),(((ut=j.collaborator_emails)==null?void 0:ut.length)??0)>0&&i.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Shared with",children:[i.jsx(vt,{className:"h-3 w-3 mr-0.5"}),j.collaborator_emails.slice(0,4).map(ve=>i.jsx("span",{title:`Shared with ${ve}`,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:ve.slice(0,2)},ve)),j.collaborator_emails.length>4&&i.jsxs("span",{className:"text-[10px]",children:["+",j.collaborator_emails.length-4]})]}),(((ht=j.steward_emails)==null?void 0:ht.length)??0)>0&&i.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Stewards",children:[i.jsx(xt,{className:"h-3 w-3 mr-0.5 text-emerald-600"}),j.steward_emails.slice(0,4).map(ve=>i.jsx("span",{title:`Steward: ${ve}`,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:ve.slice(0,2)},ve)),j.steward_emails.length>4&&i.jsxs("span",{className:"text-[10px]",children:["+",j.steward_emails.length-4]})]}),X&&!j.stewardship_enabled&&i.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&&i.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"}),Ne&&Ce&&dt&&i.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border ${Ce.cls}`,title:Ce.title,children:[i.jsx(dt,{className:"h-3 w-3"}),Ce.label]}),i.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?i.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:[i.jsx(Ie,{className:"h-3 w-3"}),"Imported"]}):null,i.jsx("span",{children:Xe(j.created_at)})]})]})]})]},j.id)})]}),L.length>ie.length&&i.jsx("div",{className:"flex justify-center",children:i.jsxs(pe,{variant:"outline",onClick:()=>R(j=>j+Me),"data-testid":"nest-show-more",children:["Show more (",L.length-ie.length," left)"]})})]})]}),H&&i.jsx(fr,{nestId:H.id,nestName:H.name,nestDescription:H.description,open:!0,onOpenChange:j=>{j||ee(null)},onRenamed:j=>{z.setQueryData(Pe.nestList().queryKey,X=>X&&{...X,nests:X.nests.map(Y=>Y.id===j.id?{...Y,name:j.name,slug:j.slug,description:j.description}:Y)}),ee(null)}}),U&&i.jsx(mr,{nestId:U.id,nestName:U.name,isImported:U.isImported,open:!0,onOpenChange:j=>{j||A(null)},onDeleted:async()=>{A(null),await we()},onArchived:y?void 0:async()=>{A(null),Ee.success(`"${U.name}" archived — find it under Archived`),await we()}}),W&&i.jsx(br,{open:!0,onOpenChange:j=>!j&&V(null),title:`Request removal of "${W.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 bt(W.id,"nest_archive",W.id,j),Ee.success("Archive requested — a nest admin will review it")},onConfirm:async j=>{await bt(W.id,"nest",W.id,j),Ee.success("Deletion requested — a nest admin will review it")}}),i.jsx(yr,{open:!!N,onOpenChange:j=>{!j&&!B&&S(null)},children:i.jsxs(wr,{children:[i.jsxs(kr,{children:[i.jsxs(jr,{children:["Restore “",N==null?void 0:N.name,"”?"]}),i.jsx(Nr,{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."})]}),i.jsxs(Sr,{children:[i.jsx(Cr,{disabled:B,children:"Cancel"}),i.jsx(Ar,{disabled:B,onClick:async j=>{if(j.preventDefault(),!!N){F(!0);try{await ir(N.id),Ee.success(`"${N.name}" restored`),S(null),await we()}catch(X){Ee.error((X==null?void 0:X.message)??"Failed to restore this nest")}finally{F(!1)}}},children:B?i.jsxs(i.Fragment,{children:[i.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Restoring..."]}):"Restore nest"})]})]})}),i.jsx(Ze,{open:!!ae,onOpenChange:j=>{!j&&ae&&q[ae.name]||j||oe(null)},children:i.jsxs($e,{className:"sm:max-w-[440px]",children:[i.jsxs(He,{children:[i.jsxs(Ge,{className:"flex items-center gap-2 text-red-700",children:[i.jsx(Fe,{className:"h-4 w-4"}),"Delete folder"]}),i.jsxs(rt,{children:["Permanently delete"," ",i.jsx("strong",{className:"text-foreground",children:ae==null?void 0:ae.label})," ","and its files from the server. This can't be undone. The folder won't be synced into a nest."]})]}),i.jsxs(it,{className:"gap-2",children:[i.jsx(pe,{variant:"outline",onClick:()=>oe(null),disabled:!!ae&&!!q[ae.name],children:"Cancel"}),i.jsx(pe,{variant:"destructive",onClick:()=>ae&&Se(ae.name),disabled:!!ae&&!!q[ae.name],children:ae&&q[ae.name]?i.jsxs(i.Fragment,{children:[i.jsx(ze,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Deleting…"]}):i.jsxs(i.Fragment,{children:[i.jsx(Fe,{className:"h-3.5 w-3.5 mr-2"}),"Delete folder"]})})]})]})}),i.jsx(an,{isOpen:fe,onClose:()=>ye(!1),onImported:we})]})}function Ct({icon:G,title:Q,desc:m,mono:C}){return i.jsxs("div",{className:"flex items-start gap-2 p-2 rounded bg-white/40",children:[i.jsx("div",{className:"text-muted-foreground mt-0.5",children:G}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-medium text-foreground",children:Q}),i.jsx("div",{className:`text-muted-foreground ${C?"font-mono text-[10px]":""} truncate`,children:m})]})]})}function on({value:G}){const[Q,m]=se.useState(!1);return i.jsx("button",{onClick:async C=>{C.stopPropagation(),await nt(G)&&(m(!0),setTimeout(()=>m(!1),1200))},className:"ml-1 inline-flex items-center hover:text-foreground",children:Q?i.jsx(ur,{className:"h-3 w-3 text-green-600"}):i.jsx(Et,{className:"h-3 w-3"})})}export{yn as default};