@promptowl/contextnest-community 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +68 -8
- package/CONFIGURATION.md +572 -116
- package/README.md +3 -2
- package/dist/{chunk-32SZCH36.js → chunk-2QOJE7A5.js} +4 -4
- package/dist/{chunk-2KHM5C7V.js → chunk-DGPTJXIV.js} +13 -15
- package/dist/chunk-I5EDEZBQ.js +523 -0
- package/dist/{chunk-TI7HMP64.js → chunk-IEAWRHMV.js} +2 -2
- package/dist/{chunk-DTLMBF4W.js → chunk-M6PGYMBD.js} +15 -8
- package/dist/{chunk-F66VCBLA.js → chunk-PICUHQEM.js} +51 -2
- package/dist/{chunk-KPGNZLZL.js → chunk-RPGFHESR.js} +1 -1
- package/dist/{chunk-7FROMOZM.js → chunk-SWA5M5XX.js} +68 -544
- package/dist/{chunk-JDAOA5KP.js → chunk-TRSGPS27.js} +39 -14
- package/dist/{engine-TER6FDBP.js → engine-QNMFDIBV.js} +3 -2
- package/dist/{external-edit-service-CAGENHDJ.js → external-edit-service-4MEGPT4D.js} +4 -3
- package/dist/{grants-service-2OTFS7EH.js → grants-service-24GLUBY4.js} +2 -2
- package/dist/index.js +911 -263
- package/dist/invited-user-AM6A3WGO.js +12 -0
- package/dist/{migrations.postgres-23VJJJJX.js → migrations.postgres-HGSQ7IA5.js} +4 -0
- package/dist/{review-service-4G2XUFS6.js → review-service-2EWN7WWO.js} +7 -6
- package/dist/{stewardship-service-S22V2JKG.js → stewardship-service-TDZUC2Q6.js} +4 -3
- package/dist/{version-service-X4FAG2OZ.js → version-service-C3JTZLJH.js} +4 -3
- package/dist/web3/assets/ActivityTracePage-DzwWIjjx.js +1 -0
- package/dist/web3/assets/{AgentDocsPage-Dkhgb1hk.js → AgentDocsPage-ixP2UdAE.js} +1 -1
- package/dist/web3/assets/CollaboratorManager-C9VAXZ0h.js +1 -0
- package/dist/web3/assets/CollaboratorsTab-tq4ZTexH.js +1 -0
- package/dist/web3/assets/DocumentEditor-C2CP2fiE.js +36 -0
- package/dist/web3/assets/DocumentsTab-Mh7KxUoB.js +6 -0
- package/dist/web3/assets/ExternalEditsTab-B_CWKXZ_.js +1 -0
- package/dist/web3/assets/{MarkdownEditor-Dfk5uIE5.js → MarkdownEditor-CKh4WSn-.js} +136 -131
- package/dist/web3/assets/MarkdownEditor-ndtIx5x0.css +1 -0
- package/dist/web3/assets/NestPageHeader-Cizo8nUi.js +1 -0
- package/dist/web3/assets/NestView-EW-sraEb.js +73 -0
- package/dist/web3/assets/OverviewTab-CjidsMX_.js +6 -0
- package/dist/web3/assets/PersonCombobox-BKI7dff4.js +1 -0
- package/dist/web3/assets/{ReviewActions-BXDTDPp1.js → ReviewActions-CS8JXgXF.js} +2 -2
- package/dist/web3/assets/ReviewTab-CwVrXzw5.js +1 -0
- package/dist/web3/assets/StewardsTab-C-iP6gnh.js +1 -0
- package/dist/web3/assets/SubmitForReviewModal-Biq3m79i.js +1 -0
- package/dist/web3/assets/{alert-dialog-4SiLKlz8.js → alert-dialog-BvF3NFr7.js} +2 -2
- package/dist/web3/assets/{arrow-left-BAgIocLn.js → arrow-left-CWIsv-sG.js} +1 -1
- package/dist/web3/assets/backlinks-Cqcn7n1J.js +19 -0
- package/dist/web3/assets/boxes-ClbgQqG2.js +6 -0
- package/dist/web3/assets/{chevron-left-XR4ReJ9Z.js → chevron-left-CK_ZPFm9.js} +1 -1
- package/dist/web3/assets/{circle-check-CSkZUEFK.js → circle-check-Bw_aTXiH.js} +1 -1
- package/dist/web3/assets/{circle-x-in2o3aHU.js → circle-x-DkIG68H7.js} +1 -1
- package/dist/web3/assets/{code-xml-pPQgdctI.js → code-xml-BlR7EN6l.js} +1 -1
- package/dist/web3/assets/{corner-down-right-CuxZWscX.js → corner-down-right-DSVxK3tf.js} +1 -1
- package/dist/web3/assets/count-skeleton-DToLM74B.js +1 -0
- package/dist/web3/assets/{earth-CXOcThqn.js → earth-BXhVPvCR.js} +1 -1
- package/dist/web3/assets/{file-exclamation-point-CSphs1VD.js → file-exclamation-point-BevGZgtj.js} +1 -1
- package/dist/web3/assets/{folder-input-BAwK9tFL.js → folder-input-m8UBV4fA.js} +1 -1
- package/dist/web3/assets/{index-A0_ymcqL.js → index-BOVYgMvj.js} +1 -1
- package/dist/web3/assets/index-DVnaYqj9.css +1 -0
- package/dist/web3/assets/index-WYDmEOfO.js +404 -0
- package/dist/web3/assets/page-B6pkc9cd.js +2 -0
- package/dist/web3/assets/page-BJrFCKXB.js +1 -0
- package/dist/web3/assets/page-Bgy9Ng9p.js +1 -0
- package/dist/web3/assets/page-C2zoxumw.js +1 -0
- package/dist/web3/assets/page-CJWO06dN.js +1 -0
- package/dist/web3/assets/page-CptuAPJc.js +6 -0
- package/dist/web3/assets/page-DPY01SOj.js +1 -0
- package/dist/web3/assets/page-Dea2SblF.js +9 -0
- package/dist/web3/assets/page-Deq6IKiN.js +6 -0
- package/dist/web3/assets/page-Dfjg8p7Z.js +1 -0
- package/dist/web3/assets/{page-xzYqkBUP.js → page-Dh57L0RG.js} +5 -5
- package/dist/web3/assets/page-Dwbp4Seu.js +6 -0
- package/dist/web3/assets/{page-CUjuSs5Q.js → page-DzKwP5Ds.js} +3 -3
- package/dist/web3/assets/page-YxjrE5b5.js +45 -0
- package/dist/web3/assets/{page-title-BkqlUA0j.js → page-title-DVq4qvMR.js} +1 -1
- package/dist/web3/assets/{play-B8xE9j5f.js → play-CXhS6Pgq.js} +1 -1
- package/dist/web3/assets/{send-CvAgOUPG.js → send-DdfwnIrj.js} +1 -1
- package/dist/web3/assets/{settings-EY4A_DYv.js → settings-DKX0Q4gO.js} +1 -1
- package/dist/web3/assets/{share-2-vGmZUl90.js → share-2-CxmXRt58.js} +1 -1
- package/dist/web3/assets/{tag-Br_y1f00.js → tag-DeYC_mRv.js} +1 -1
- package/dist/web3/assets/{trash-2-B4hRXo-p.js → trash-2-B0HyPTnI.js} +1 -1
- package/dist/web3/assets/{user-plus-4CTYEkd3.js → user-plus-Ckm_Isyc.js} +1 -1
- package/dist/web3/assets/{x-qxt1WrUi.js → x-mNtADYHc.js} +1 -1
- package/dist/web3/assets/{zap-BcsKR0ef.js → zap-D2ifcnYb.js} +1 -1
- package/dist/web3/index.html +2 -2
- package/package.json +3 -2
- package/dist/client-D44ZHDTJ.js +0 -11
- package/dist/keys-CTOGAG3W.js +0 -20
- package/dist/web3/assets/ActivityTracePage-D2iIbEph.js +0 -1
- package/dist/web3/assets/CollaboratorManager-Bo81D--Q.js +0 -1
- package/dist/web3/assets/CollaboratorsTab-DRCitQuX.js +0 -1
- package/dist/web3/assets/DocumentEditor-DV2WHYbj.js +0 -36
- package/dist/web3/assets/DocumentsTab-BUxBCN8o.js +0 -6
- package/dist/web3/assets/ExternalEditsTab-kIBimZyE.js +0 -1
- package/dist/web3/assets/MarkdownEditor-CsVusP2d.css +0 -1
- package/dist/web3/assets/NestPageHeader-yOK-OIYZ.js +0 -1
- package/dist/web3/assets/NestView-DwIagxwJ.js +0 -68
- package/dist/web3/assets/OverviewTab-DFOFMVyE.js +0 -1
- package/dist/web3/assets/PersonCombobox-D350WlrJ.js +0 -1
- package/dist/web3/assets/ReasonDialog-CN3ECAnQ.js +0 -1
- package/dist/web3/assets/ReviewTab-CZewAYiz.js +0 -1
- package/dist/web3/assets/StewardsTab-AagNWcWS.js +0 -1
- package/dist/web3/assets/SubmitForReviewModal-BOZJxwRN.js +0 -1
- package/dist/web3/assets/backlinks-Cb8Uf8mw.js +0 -24
- package/dist/web3/assets/card-UDyMRcps.js +0 -1
- package/dist/web3/assets/count-skeleton-DBWCDhRy.js +0 -1
- package/dist/web3/assets/dates-BCxbm4_q.js +0 -1
- package/dist/web3/assets/index-B5hLclEq.js +0 -389
- package/dist/web3/assets/index-DrUAtoQM.css +0 -1
- package/dist/web3/assets/page-BHD4beun.js +0 -1
- package/dist/web3/assets/page-BSYUXYmO.js +0 -11
- package/dist/web3/assets/page-BYc2DIux.js +0 -45
- package/dist/web3/assets/page-BfibLg8e.js +0 -1
- package/dist/web3/assets/page-CGe8MtUu.js +0 -9
- package/dist/web3/assets/page-CIgPJmG6.js +0 -2
- package/dist/web3/assets/page-Ck31nx9b.js +0 -1
- package/dist/web3/assets/page-Cpdj_11Y.js +0 -1
- package/dist/web3/assets/page-D0sN3GO6.js +0 -1
- package/dist/web3/assets/page-DEpH91X2.js +0 -1
- package/dist/web3/assets/page-l8-B7CGt.js +0 -1
- package/dist/web3/assets/page-mnSHmk6A.js +0 -6
- package/dist/web3/assets/refresh-cw-CsCtmWwX.js +0 -6
- package/dist/web3/assets/scroll-area-CbcH6yrZ.js +0 -1
- package/dist/web3/assets/scroll-area-dRWncRqa.css +0 -1
- package/dist/web3/assets/select-DrL0mpRN.js +0 -6
- package/dist/web3/assets/triangle-alert-CsYGyfGZ.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ue,r as A,
|
|
1
|
+
import{c as ue,r as A,b5 as Qe,j as u,U as Oe,B as Pe,L as Ue,b6 as Ve,h as Je,C as Ke,az as qe,aE as et,b2 as tt}from"./index-WYDmEOfO.js";import{N as nt}from"./NestPageHeader-Cizo8nUi.js";import{L as rt,T as st}from"./tag-DeYC_mRv.js";import"./arrow-left-CWIsv-sG.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,7 +18,7 @@ import{c as ue,r as A,aW as Qe,j as u,U as Oe,B as Pe,L as Ue,aX as Ve,C as Je,a
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const ft=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ht=ue("zoom-out",ft);function dt(e,t){var n,s=1;e==null&&(e=0),t==null&&(t=0);function i(){var r,h=n.length,x,v=0,l=0;for(r=0;r<h;++r)x=n[r],v+=x.x,l+=x.y;for(v=(v/h-e)*s,l=(l/h-t)*s,r=0;r<h;++r)x=n[r],x.x-=v,x.y-=l}return i.initialize=function(r){n=r},i.x=function(r){return arguments.length?(e=+r,i):e},i.y=function(r){return arguments.length?(t=+r,i):t},i.strength=function(r){return arguments.length?(s=+r,i):s},i}function xt(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Te(this.cover(t,n),t,n,e)}function Te(e,t,n,s){if(isNaN(t)||isNaN(n))return e;var i,r=e._root,h={data:s},x=e._x0,v=e._y0,l=e._x1,y=e._y1,_,p,c,k,f,o,d,m;if(!r)return e._root=h,e;for(;r.length;)if((f=t>=(_=(x+l)/2))?x=_:l=_,(o=n>=(p=(v+y)/2))?v=p:y=p,i=r,!(r=r[d=o<<1|f]))return i[d]=h,e;if(c=+e._x.call(null,r.data),k=+e._y.call(null,r.data),t===c&&n===k)return h.next=r,i?i[d]=h:e._root=h,e;do i=i?i[d]=new Array(4):e._root=new Array(4),(f=t>=(_=(x+l)/2))?x=_:l=_,(o=n>=(p=(v+y)/2))?v=p:y=p;while((d=o<<1|f)===(m=(k>=p)<<1|c>=_));return i[m]=r,i[d]=h,e}function gt(e){var t,n,s=e.length,i,r,h=new Array(s),x=new Array(s),v=1/0,l=1/0,y=-1/0,_=-1/0;for(n=0;n<s;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(h[n]=i,x[n]=r,i<v&&(v=i),i>y&&(y=i),r<l&&(l=r),r>_&&(_=r));if(v>y||l>_)return this;for(this.cover(v,l).cover(y,_),n=0;n<s;++n)Te(this,h[n],x[n],e[n]);return this}function mt(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,s=this._y0,i=this._x1,r=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,r=(s=Math.floor(t))+1;else{for(var h=i-n||1,x=this._root,v,l;n>e||e>=i||s>t||t>=r;)switch(l=(t<s)<<1|e<n,v=new Array(4),v[l]=x,x=v,h*=2,l){case 0:i=n+h,r=s+h;break;case 1:n=i-h,r=s+h;break;case 2:i=n+h,s=r-h;break;case 3:n=i-h,s=r-h;break}this._root&&this._root.length&&(this._root=x)}return this._x0=n,this._y0=s,this._x1=i,this._y1=r,this}function pt(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function yt(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function R(e,t,n,s,i){this.node=e,this.x0=t,this.y0=n,this.x1=s,this.y1=i}function vt(e,t,n){var s,i=this._x0,r=this._y0,h,x,v,l,y=this._x1,_=this._y1,p=[],c=this._root,k,f;for(c&&p.push(new R(c,i,r,y,_)),n==null?n=1/0:(i=e-n,r=t-n,y=e+n,_=t+n,n*=n);k=p.pop();)if(!(!(c=k.node)||(h=k.x0)>y||(x=k.y0)>_||(v=k.x1)<i||(l=k.y1)<r))if(c.length){var o=(h+v)/2,d=(x+l)/2;p.push(new R(c[3],o,d,v,l),new R(c[2],h,d,o,l),new R(c[1],o,x,v,d),new R(c[0],h,x,o,d)),(f=(t>=d)<<1|e>=o)&&(k=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=k)}else{var m=e-+this._x.call(null,c.data),j=t-+this._y.call(null,c.data),w=m*m+j*j;if(w<n){var $=Math.sqrt(n=w);i=e-$,r=t-$,y=e+$,_=t+$,s=c.data}}return s}function wt(e){if(isNaN(y=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e)))return this;var t,n=this._root,s,i,r,h=this._x0,x=this._y0,v=this._x1,l=this._y1,y,_,p,c,k,f,o,d;if(!n)return this;if(n.length)for(;;){if((k=y>=(p=(h+v)/2))?h=p:v=p,(f=_>=(c=(x+l)/2))?x=c:l=c,t=n,!(n=n[o=f<<1|k]))return this;if(!n.length)break;(t[o+1&3]||t[o+2&3]||t[o+3&3])&&(s=t,d=o)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,i?(r?i.next=r:delete i.next,this):t?(r?t[o]=r:delete t[o],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(s?s[d]=n:this._root=n),this):(this._root=r,this)}function Nt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function _t(){return this._root}function jt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function bt(e){var t=[],n,s=this._root,i,r,h,x,v;for(s&&t.push(new R(s,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(s=n.node,r=n.x0,h=n.y0,x=n.x1,v=n.y1)&&s.length){var l=(r+x)/2,y=(h+v)/2;(i=s[3])&&t.push(new R(i,l,y,x,v)),(i=s[2])&&t.push(new R(i,r,y,l,v)),(i=s[1])&&t.push(new R(i,l,h,x,y)),(i=s[0])&&t.push(new R(i,r,h,l,y))}return this}function kt(e){var t=[],n=[],s;for(this._root&&t.push(new R(this._root,this._x0,this._y0,this._x1,this._y1));s=t.pop();){var i=s.node;if(i.length){var r,h=s.x0,x=s.y0,v=s.x1,l=s.y1,y=(h+v)/2,_=(x+l)/2;(r=i[0])&&t.push(new R(r,h,x,y,_)),(r=i[1])&&t.push(new R(r,y,x,v,_)),(r=i[2])&&t.push(new R(r,h,_,y,l)),(r=i[3])&&t.push(new R(r,y,_,v,l))}n.push(s)}for(;s=n.pop();)e(s.node,s.x0,s.y0,s.x1,s.y1);return this}function Mt(e){return e[0]}function St(e){return arguments.length?(this._x=e,this):this._x}function $t(e){return e[1]}function Ct(e){return arguments.length?(this._y=e,this):this._y}function ve(e,t,n){var s=new we(t??Mt,n??$t,NaN,NaN,NaN,NaN);return e==null?s:s.addAll(e)}function we(e,t,n,s,i,r){this._x=e,this._y=t,this._x0=n,this._y0=s,this._x1=i,this._y1=r,this._root=void 0}function Me(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var L=ve.prototype=we.prototype;L.copy=function(){var e=new we(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,s;if(!t)return e;if(!t.length)return e._root=Me(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var i=0;i<4;++i)(s=t.source[i])&&(s.length?n.push({source:s,target:t.target[i]=new Array(4)}):t.target[i]=Me(s));return e};L.add=xt;L.addAll=gt;L.cover=mt;L.data=pt;L.extent=yt;L.find=vt;L.remove=wt;L.removeAll=Nt;L.root=_t;L.size=jt;L.visit=bt;L.visitAfter=kt;L.x=St;L.y=Ct;function J(e){return function(){return e}}function U(e){return(e()-.5)*1e-6}function At(e){return e.x+e.vx}function zt(e){return e.y+e.vy}function It(e){var t,n,s,i=1,r=1;typeof e!="function"&&(e=J(e==null?1:+e));function h(){for(var l,y=t.length,_,p,c,k,f,o,d=0;d<r;++d)for(_=ve(t,At,zt).visitAfter(x),l=0;l<y;++l)p=t[l],f=n[p.index],o=f*f,c=p.x+p.vx,k=p.y+p.vy,_.visit(m);function m(j,w,$,P,z){var C=j.data,H=j.r,I=f+H;if(C){if(C.index>p.index){var B=c-C.x-C.vx,F=k-C.y-C.vy,X=B*B+F*F;X<I*I&&(B===0&&(B=U(s),X+=B*B),F===0&&(F=U(s),X+=F*F),X=(I-(X=Math.sqrt(X)))/X*i,p.vx+=(B*=X)*(I=(H*=H)/(o+H)),p.vy+=(F*=X)*I,C.vx-=B*(I=1-I),C.vy-=F*I)}return}return w>c+I||P<c-I||$>k+I||z<k-I}}function x(l){if(l.data)return l.r=n[l.data.index];for(var y=l.r=0;y<4;++y)l[y]&&l[y].r>l.r&&(l.r=l[y].r)}function v(){if(t){var l,y=t.length,_;for(n=new Array(y),l=0;l<y;++l)_=t[l],n[_.index]=+e(_,l,t)}}return h.initialize=function(l,y){t=l,s=y,v()},h.iterations=function(l){return arguments.length?(r=+l,h):r},h.strength=function(l){return arguments.length?(i=+l,h):i},h.radius=function(l){return arguments.length?(e=typeof l=="function"?l:J(+l),v(),h):e},h}function Et(e){return e.index}function Se(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function Pt(e){var t=Et,n=_,s,i=J(30),r,h,x,v,l,y=1;e==null&&(e=[]);function _(o){return 1/Math.min(x[o.source.index],x[o.target.index])}function p(o){for(var d=0,m=e.length;d<y;++d)for(var j=0,w,$,P,z,C,H,I;j<m;++j)w=e[j],$=w.source,P=w.target,z=P.x+P.vx-$.x-$.vx||U(l),C=P.y+P.vy-$.y-$.vy||U(l),H=Math.sqrt(z*z+C*C),H=(H-r[j])/H*o*s[j],z*=H,C*=H,P.vx-=z*(I=v[j]),P.vy-=C*I,$.vx+=z*(I=1-I),$.vy+=C*I}function c(){if(h){var o,d=h.length,m=e.length,j=new Map(h.map(($,P)=>[t($,P,h),$])),w;for(o=0,x=new Array(d);o<m;++o)w=e[o],w.index=o,typeof w.source!="object"&&(w.source=Se(j,w.source)),typeof w.target!="object"&&(w.target=Se(j,w.target)),x[w.source.index]=(x[w.source.index]||0)+1,x[w.target.index]=(x[w.target.index]||0)+1;for(o=0,v=new Array(m);o<m;++o)w=e[o],v[o]=x[w.source.index]/(x[w.source.index]+x[w.target.index]);s=new Array(m),k(),r=new Array(m),f()}}function k(){if(h)for(var o=0,d=e.length;o<d;++o)s[o]=+n(e[o],o,e)}function f(){if(h)for(var o=0,d=e.length;o<d;++o)r[o]=+i(e[o],o,e)}return p.initialize=function(o,d){h=o,l=d,c()},p.links=function(o){return arguments.length?(e=o,c(),p):e},p.id=function(o){return arguments.length?(t=o,p):t},p.iterations=function(o){return arguments.length?(y=+o,p):y},p.strength=function(o){return arguments.length?(n=typeof o=="function"?o:J(+o),k(),p):n},p.distance=function(o){return arguments.length?(i=typeof o=="function"?o:J(+o),f(),p):i},p}var Tt={value:()=>{}};function Re(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new ae(n)}function ae(e){this._=e}function Rt(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}ae.prototype=Re.prototype={constructor:ae,on:function(e,t){var n=this._,s=Rt(e+"",n),i,r=-1,h=s.length;if(arguments.length<2){for(;++r<h;)if((i=(e=s[r]).type)&&(i=Lt(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<h;)if(i=(e=s[r]).type)n[i]=$e(n[i],e.name,t);else if(t==null)for(i in n)n[i]=$e(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ae(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,r;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,r=s.length;i<r;++i)s[i].value.apply(t,n)}};function Lt(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function $e(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=Tt,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var ee=0,re=0,ne=0,Le=1e3,le,se,ce=0,K=0,fe=0,ie=typeof performance=="object"&&performance.now?performance:Date,Be=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fe(){return K||(Be(Bt),K=ie.now()+fe)}function Bt(){K=0}function pe(){this._call=this._time=this._next=null}pe.prototype=He.prototype={constructor:pe,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fe():+n)+(t==null?0:+t),!this._next&&se!==this&&(se?se._next=this:le=this,se=this),this._call=e,this._time=n,ye()},stop:function(){this._call&&(this._call=null,this._time=1/0,ye())}};function He(e,t,n){var s=new pe;return s.restart(e,t,n),s}function Ft(){Fe(),++ee;for(var e=le,t;e;)(t=K-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ee}function Ce(){K=(ce=ie.now())+fe,ee=re=0;try{Ft()}finally{ee=0,Xt(),K=0}}function Ht(){var e=ie.now(),t=e-ce;t>Le&&(fe-=t,ce=e)}function Xt(){for(var e,t=le,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:le=n);se=e,ye(s)}function ye(e){if(!ee){re&&(re=clearTimeout(re));var t=e-K;t>24?(e<1/0&&(re=setTimeout(Ce,e-ie.now()-fe)),ne&&(ne=clearInterval(ne))):(ne||(ce=ie.now(),ne=setInterval(Ht,Le)),ee=1,Be(Ce))}}const Dt=1664525,Yt=1013904223,Ae=4294967296;function Zt(){let e=1;return()=>(e=(Dt*e+Yt)%Ae)/Ae}function Wt(e){return e.x}function Gt(e){return e.y}var Qt=10,Ot=Math.PI*(3-Math.sqrt(5));function Ut(e){var t,n=1,s=.001,i=1-Math.pow(s,1/300),r=0,h=.6,x=new Map,v=He(_),l=Re("tick","end"),y=Zt();e==null&&(e=[]);function _(){p(),l.call("tick",t),n<s&&(v.stop(),l.call("end",t))}function p(f){var o,d=e.length,m;f===void 0&&(f=1);for(var j=0;j<f;++j)for(n+=(r-n)*i,x.forEach(function(w){w(n)}),o=0;o<d;++o)m=e[o],m.fx==null?m.x+=m.vx*=h:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=h:(m.y=m.fy,m.vy=0);return t}function c(){for(var f=0,o=e.length,d;f<o;++f){if(d=e[f],d.index=f,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var m=Qt*Math.sqrt(.5+f),j=f*Ot;d.x=m*Math.cos(j),d.y=m*Math.sin(j)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function k(f){return f.initialize&&f.initialize(e,y),f}return c(),t={tick:p,restart:function(){return v.restart(_),t},stop:function(){return v.stop(),t},nodes:function(f){return arguments.length?(e=f,c(),x.forEach(k),t):e},alpha:function(f){return arguments.length?(n=+f,t):n},alphaMin:function(f){return arguments.length?(s=+f,t):s},alphaDecay:function(f){return arguments.length?(i=+f,t):+i},alphaTarget:function(f){return arguments.length?(r=+f,t):r},velocityDecay:function(f){return arguments.length?(h=1-f,t):1-h},randomSource:function(f){return arguments.length?(y=f,x.forEach(k),t):y},force:function(f,o){return arguments.length>1?(o==null?x.delete(f):x.set(f,k(o)),t):x.get(f)},find:function(f,o,d){var m=0,j=e.length,w,$,P,z,C;for(d==null?d=1/0:d*=d,m=0;m<j;++m)z=e[m],w=f-z.x,$=o-z.y,P=w*w+$*$,P<d&&(C=z,d=P);return C},on:function(f,o){return arguments.length>1?(l.on(f,o),t):l.on(f)}}}function Vt(){var e,t,n,s,i=J(-30),r,h=1,x=1/0,v=.81;function l(c){var k,f=e.length,o=ve(e,Wt,Gt).visitAfter(_);for(s=c,k=0;k<f;++k)t=e[k],o.visit(p)}function y(){if(e){var c,k=e.length,f;for(r=new Array(k),c=0;c<k;++c)f=e[c],r[f.index]=+i(f,c,e)}}function _(c){var k=0,f,o,d=0,m,j,w;if(c.length){for(m=j=w=0;w<4;++w)(f=c[w])&&(o=Math.abs(f.value))&&(k+=f.value,d+=o,m+=o*f.x,j+=o*f.y);c.x=m/d,c.y=j/d}else{f=c,f.x=f.data.x,f.y=f.data.y;do k+=r[f.data.index];while(f=f.next)}c.value=k}function p(c,k,f,o){if(!c.value)return!0;var d=c.x-t.x,m=c.y-t.y,j=o-k,w=d*d+m*m;if(j*j/v<w)return w<x&&(d===0&&(d=U(n),w+=d*d),m===0&&(m=U(n),w+=m*m),w<h&&(w=Math.sqrt(h*w)),t.vx+=d*c.value*s/w,t.vy+=m*c.value*s/w),!0;if(c.length||w>=x)return;(c.data!==t||c.next)&&(d===0&&(d=U(n),w+=d*d),m===0&&(m=U(n),w+=m*m),w<h&&(w=Math.sqrt(h*w)));do c.data!==t&&(j=r[c.data.index]*s/w,t.vx+=d*j,t.vy+=m*j);while(c=c.next)}return l.initialize=function(c,k){e=c,n=k,y()},l.strength=function(c){return arguments.length?(i=typeof c=="function"?c:J(+c),y(),l):i},l.distanceMin=function(c){return arguments.length?(h=c*c,l):Math.sqrt(h)},l.distanceMax=function(c){return arguments.length?(x=c*c,l):Math.sqrt(x)},l.theta=function(c){return arguments.length?(v=c*c,l):Math.sqrt(v)},l}function Jt(e,t){return e>0?"Every category has a steward.":t>0?"No categories yet — tag documents to see steward coverage.":"No categories or stewards yet — tag documents and assign stewards to see coverage."}const G={doc:"#3b82f6",steward:"#16a34a",tag:"#f59e0b",root:"#64748b",folder:"#a855f7"};function Kt(e){return e==="steward"?"#16a34a66":e==="tag"?"#f59e0b66":e==="structure"?"#a855f766":"#94a3b8aa"}const ze=(e,t,n)=>Math.min(n,Math.max(t,e)),Ie=.15,qt=5;function Ee(e){return e.kind==="doc"?e.name.includes("]]")||e.name.includes("|")?null:`[[${e.name}]]`:e.kind==="tag"?`#${e.name.replace(/^#/,"")}`:null}function en(e){return`'${e.replace(/'/g,"'\\''")}'`}function tn({nestId:e,nestName:t,onOpenTag:n,onOpenDocument:s,onBack:i}){const[r,h]=A.useState(null),[x,v]=A.useState(!0),[l,y]=A.useState(null),[_,p]=A.useState({links:!0,stewardship:!0,categories:!0,structure:!0}),[c,k]=A.useState(null),[f,o]=A.useState(1),d=A.useRef(null),m=A.useRef(null),[j,w]=A.useState({w:800,h:560}),[$,P]=A.useState({nodes:[],links:[]}),[z,C]=A.useState({x:0,y:0,k:1}),[H,I]=A.useState(!1),B=A.useRef(null),F=A.useRef(!1),X=A.useRef({w:0,h:0}),Xe=(a,g)=>{const N=m.current.getBoundingClientRect();return{x:(a-N.left-z.x)/z.k,y:(g-N.top-z.y)/z.k}},Ne=(a,g,N)=>{const b=a.filter(Z=>Z.x!=null&&Z.y!=null);if(!b.length)return C({x:g/2,y:N/2,k:1});let M=1/0,S=1/0,T=-1/0,E=-1/0;for(const Z of b)M=Math.min(M,Z.x),S=Math.min(S,Z.y),T=Math.max(T,Z.x),E=Math.max(E,Z.y);const D=48,W=T-M||1,Q=E-S||1,V=ze(Math.min((g-2*D)/W,(N-2*D)/Q),Ie,1.5);C({x:g/2-(M+T)/2*V,y:N/2-(S+E)/2*V,k:V})},he=(a,g=j.w/2,N=j.h/2)=>{F.current=!0,C(b=>{const M=ze(b.k*a,Ie,qt),S=(g-b.x)/b.k,T=(N-b.y)/b.k;return{k:M,x:g-S*M,y:N-T*M}})};A.useEffect(()=>{const a=m.current;if(!a)return;const g=N=>{N.preventDefault();const b=a.getBoundingClientRect();he(N.deltaY<0?1.1:1/1.1,N.clientX-b.left,N.clientY-b.top)};return a.addEventListener("wheel",g,{passive:!1}),()=>a.removeEventListener("wheel",g)},[j.w,j.h,x,l]);const De=a=>{var g,N;(N=(g=m.current)==null?void 0:g.setPointerCapture)==null||N.call(g,a.pointerId),B.current={mode:"pan",px:a.clientX,py:a.clientY},I(!0)},Ye=(a,g)=>{var N,b;a.stopPropagation(),(b=(N=m.current)==null?void 0:N.setPointerCapture)==null||b.call(N,a.pointerId),B.current={mode:"node",node:g,moved:!1}},Ze=a=>{const g=B.current;if(g)if(g.mode==="pan"){const N=a.clientX-g.px,b=a.clientY-g.py;g.px=a.clientX,g.py=a.clientY,F.current=!0,C(M=>({...M,x:M.x+N,y:M.y+b}))}else{g.moved=!0;const N=Xe(a.clientX,a.clientY);g.node.x=N.x,g.node.y=N.y,P(b=>({...b,nodes:b.nodes.slice()}))}},_e=a=>{var N,b;const g=B.current;(b=(N=m.current)==null?void 0:N.releasePointerCapture)==null||b.call(N,a.pointerId),(g==null?void 0:g.mode)==="node"&&!g.moved&&k(M=>(M==null?void 0:M.id)===g.node.id?null:g.node),B.current=null,I(!1)};A.useEffect(()=>{let a=!1;return v(!0),Qe(e).then(g=>{a||(F.current=!1,h(g))}).catch(g=>!a&&y((g==null?void 0:g.message)||"Failed to load graph")).finally(()=>!a&&v(!1)),()=>{a=!0}},[e]),A.useEffect(()=>{if(!d.current)return;const a=d.current,g=()=>w({w:a.clientWidth,h:Math.max(420,a.clientHeight)});g();let N;const b=new ResizeObserver(()=>{clearTimeout(N),N=setTimeout(g,150)});return b.observe(a),()=>{clearTimeout(N),b.disconnect()}},[]);const Y=(r==null?void 0:r.signals)??null,oe=A.useMemo(()=>{if(!r)return{nodes:[],links:[]};const a=[],g=[],N=new Set(((Y==null?void 0:Y.orphans)||[]).map(S=>S.id));for(const S of r.nodes)a.push({id:S.id,name:S.title,kind:"doc",color:N.has(S.id)?"#ef4444":G.doc,val:2});if(_.links)for(const S of r.links)g.push({...S,kind:"link"});const b=()=>{a.some(S=>S.id==="root:nest")||a.push({id:"root:nest",name:t,kind:"root",color:G.root,val:4})};if(_.structure){b();const S=new Set,T=(D,W)=>{const Q=`${D}~>${W}`;S.has(Q)||(S.add(Q),g.push({source:D,target:W,kind:"structure"}))},E=new Set;for(const D of r.nodes){const W=D.id.split("/").filter(Boolean),Q=W[0]==="nodes"?W.slice(1,-1):W.slice(0,-1);let V="root:nest",Z="";for(const de of Q){Z=Z?`${Z}/${de}`:de;const te=`folder:${Z}`;E.has(te)||(E.add(te),a.push({id:te,name:de,kind:"folder",color:G.folder,val:2})),T(V,te),V=te}T(V,D.id)}}if(_.categories){for(const S of r.tags)a.push({id:`tag:${S.name}`,name:`#${S.name}`,kind:"tag",color:G.tag,val:1+Math.min(S.count,4)});for(const S of r.nodes)for(const T of S.tags)g.push({source:S.id,target:`tag:${T}`,kind:"tag"})}if(_.stewardship){const S=new Map(r.stewards.map(E=>[E.id,E.label]));for(const E of r.stewards)a.push({id:`steward:${E.id}`,name:E.label,kind:"steward",color:G.steward,val:3});let T=!1;for(const E of r.stewardEdges){const D=`steward:${E.steward}`;if(S.has(E.steward))if(E.scope==="tag")if(_.categories)g.push({source:D,target:E.target,kind:"steward"});else{const W=E.target.replace(/^tag:/,"");for(const Q of r.nodes)Q.tags.includes(W)&&g.push({source:D,target:Q.id,kind:"steward"})}else E.scope==="document"?g.push({source:D,target:E.target,kind:"steward"}):(T=!0,g.push({source:D,target:"root:nest",kind:"steward"}))}T&&b()}const M=new Set(a.map(S=>S.id));return{nodes:a,links:g.filter(S=>M.has(S.source)&&M.has(S.target))}},[r,_,Y,t]);A.useEffect(()=>{if(!oe.nodes.length){P({nodes:[],links:[]});return}const a=oe.nodes.map(M=>({...M})),g=oe.links.map(M=>({...M})),N=Ut(a).force("link",Pt(g).id(M=>M.id).distance(55).strength(.35)).force("charge",Vt().strength(-170)).force("center",dt(j.w/2,j.h/2)).force("collide",It(14)).stop();for(let M=0;M<300;M++)N.tick();P({nodes:a,links:g});const b=X.current.w!==j.w||X.current.h!==j.h;(!F.current||b)&&(Ne(a,j.w,j.h),X.current={w:j.w,h:j.h})},[oe,j.w,j.h]);const je=a=>3+a.val,O=A.useMemo(()=>{if(!c)return null;const a=new Map;for(const b of $.links){const M=typeof b.source=="string"?b.source:b.source.id,S=typeof b.target=="string"?b.target:b.target.id;(a.get(M)??a.set(M,[]).get(M)).push(S),(a.get(S)??a.set(S,[]).get(S)).push(M)}const g=new Set([c.id]);let N=[c.id];for(let b=0;b<f&&N.length;b++){const M=[];for(const S of N)for(const T of a.get(S)??[])g.has(T)||(g.add(T),M.push(T));N=M}return g},[c,f,$.links]),We=A.useMemo(()=>new Map($.nodes.map(a=>[a.id,a])),[$.nodes]),be=((r==null?void 0:r.stewards.length)??0)>0,ke=((r==null?void 0:r.tags.length)??0)>0,Ge=((r==null?void 0:r.links.length)??0)>0;return u.jsxs("div",{className:"space-y-4",children:[u.jsx(tt,{nestName:t,onBack:i,children:u.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[[["structure","Structure",ot,!0],["links","Links",nt,Ge],["stewardship","Stewardship",Oe,be],["categories","Categories",rt,ke]].filter(([,,,a])=>a).map(([a,g,N])=>u.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[u.jsx("input",{type:"checkbox",checked:_[a],onChange:b=>p(M=>({...M,[a]:b.target.checked}))}),u.jsx(N,{className:"h-3.5 w-3.5"}),g]},a)),u.jsx(Pe,{variant:"ghost",size:"sm",onClick:()=>{F.current=!1,C({x:0,y:0,k:1})},title:"Reset pan & zoom",children:"Reset view"})]})}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-4",children:[u.jsxs("div",{ref:d,className:"border border-border rounded-lg bg-card overflow-hidden h-[560px] relative",children:[x&&u.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground",children:[u.jsx(Ue,{className:"h-5 w-5 animate-spin mr-2"})," Loading ontology…"]}),l&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-red-500 text-sm",children:l}),!x&&!l&&(r==null?void 0:r.truncated)&&u.jsxs("div",{className:"absolute top-2 left-2 z-10 rounded bg-amber-100 text-amber-800 text-xs px-2 py-1 border border-amber-300",children:["Showing ",r.nodes.length," of ",r.totalNodes," nodes (highest-connected). Gaps below cover all ",r.totalNodes,"."]}),!x&&!l&&u.jsxs(u.Fragment,{children:[u.jsx("svg",{ref:m,width:j.w,height:j.h,className:"block touch-none",style:{cursor:H?"grabbing":"grab"},onPointerDown:De,onPointerMove:Ze,onPointerUp:_e,onPointerLeave:_e,children:u.jsxs("g",{transform:`translate(${z.x},${z.y}) scale(${z.k})`,children:[u.jsx("g",{children:$.links.map((a,g)=>{const N=a.source,b=a.target;if((N==null?void 0:N.x)==null||(b==null?void 0:b.x)==null)return null;const M=!O||O.has(N.id)&&O.has(b.id);return u.jsx("line",{x1:N.x,y1:N.y,x2:b.x,y2:b.y,stroke:Kt(a.kind),strokeWidth:(M&&O?1.6:1)/z.k,opacity:M?1:.15},g)})}),u.jsx("g",{children:$.nodes.map(a=>{const g=!O||O.has(a.id);return u.jsxs("g",{transform:`translate(${a.x??0},${a.y??0})`,onPointerDown:N=>Ye(N,a),onDoubleClick:()=>{a.kind==="doc"&&(s==null||s(a.id))},style:{cursor:"grab"},opacity:g?1:.25,children:[a.kind==="doc"&&s&&u.jsx("title",{children:`Double-click to open "${a.name}"`}),u.jsx("circle",{r:je(a),fill:a.color,stroke:(c==null?void 0:c.id)===a.id?"#111827":g&&O?"#111827aa":"#ffffff",strokeWidth:(c==null?void 0:c.id)===a.id?2:1}),u.jsx("text",{x:je(a)+3,y:3,fontSize:9,fill:"#475569",children:a.name.length>24?a.name.slice(0,24)+"…":a.name})]},a.id)})})]})}),u.jsxs("div",{className:"absolute bottom-2 right-2 z-10 flex flex-col gap-1",children:[u.jsx(xe,{label:"Zoom in",onClick:()=>he(1.25),children:u.jsx(ut,{className:"h-4 w-4"})}),u.jsx(xe,{label:"Zoom out",onClick:()=>he(1/1.25),children:u.jsx(ht,{className:"h-4 w-4"})}),u.jsx(xe,{label:"Fit to view",onClick:()=>Ne($.nodes,j.w,j.h),children:u.jsx(lt,{className:"h-4 w-4"})})]})]})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"border border-border rounded-lg bg-card p-3",children:[u.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-sm mb-2",children:[((r==null?void 0:r.nodes.length)??0)===0?u.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}):u.jsx(st,{className:"h-4 w-4 text-amber-500"})," ","Coverage gaps"]}),Y?((r==null?void 0:r.nodes.length)??0)===0?u.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.jsx("span",{className:"font-medium text-foreground",children:"No documents yet"})," ","— add content to see governance coverage and connection gaps."]}):u.jsxs("div",{className:"space-y-3 text-sm",children:[u.jsx(me,{label:"Categories with no steward",items:Y.unstewardedTags.map(a=>`#${a.name} (${a.count})`),empty:Jt((r==null?void 0:r.tags.length)??0,(r==null?void 0:r.stewards.length)??0),onSelect:n&&(a=>n(Y.unstewardedTags[a].name)),selectTitle:a=>`Show #${Y.unstewardedTags[a].name} documents`}),u.jsx(me,{label:"Bottleneck stewards (≥50% of nodes)",items:Y.bottlenecks.map(a=>`${a.label} — ${a.share}%`),empty:"No single-owner concentration."}),u.jsx(me,{label:"Orphan nodes (no links)",items:Y.orphans.map(a=>a.title),empty:"No orphans — everything connects.",onSelect:s&&(a=>s(Y.orphans[a].id)),selectTitle:a=>`Open "${Y.orphans[a].title}"`})]}):u.jsx("p",{className:"text-xs text-muted-foreground",children:"—"})]}),c&&u.jsx(nn,{node:c,graph:r,nestId:e,hopDepth:f,onHopDepth:o,neighborhood:O,nodesById:We,onOpenTag:n,onOpenDocument:s}),u.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[u.jsx(q,{color:G.root,label:"Nest"}),u.jsx(q,{color:G.folder,label:"Folder"}),u.jsx(q,{color:G.doc,label:"Document"}),u.jsx(q,{color:"#ef4444",label:"Orphan document"}),ke&&u.jsx(q,{color:G.tag,label:"Category / tag"}),be&&u.jsx(q,{color:G.steward,label:"Steward"})]})]})]})]})}function xe({label:e,onClick:t,children:n}){return u.jsx("button",{type:"button","aria-label":e,title:e,onClick:t,className:"flex h-7 w-7 items-center justify-center rounded border border-border bg-card text-foreground shadow-sm hover:bg-accent",children:n})}function nn({node:e,graph:t,nestId:n,hopDepth:s,onHopDepth:i,neighborhood:r,nodesById:h,onOpenTag:x,onOpenDocument:v}){const l=e.kind==="doc"?t==null?void 0:t.nodes.find(o=>o.id===e.id):null,y=l&&t?t.links.filter(o=>o.source===l.id||o.target===l.id).length:0,_=Ee(e),p=r?[...r].map(o=>h.get(o)).filter(o=>!!o).map(Ee).filter(o=>!!o):[],c=p.join(" | "),k=typeof window<"u"?window.location.origin:"",f=_?`curl -X POST ${k}/nests/${n}/context \\
|
|
21
|
+
*/const ft=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ht=ue("zoom-out",ft);function dt(e,t){var n,s=1;e==null&&(e=0),t==null&&(t=0);function i(){var r,h=n.length,x,v=0,l=0;for(r=0;r<h;++r)x=n[r],v+=x.x,l+=x.y;for(v=(v/h-e)*s,l=(l/h-t)*s,r=0;r<h;++r)x=n[r],x.x-=v,x.y-=l}return i.initialize=function(r){n=r},i.x=function(r){return arguments.length?(e=+r,i):e},i.y=function(r){return arguments.length?(t=+r,i):t},i.strength=function(r){return arguments.length?(s=+r,i):s},i}function xt(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Re(this.cover(t,n),t,n,e)}function Re(e,t,n,s){if(isNaN(t)||isNaN(n))return e;var i,r=e._root,h={data:s},x=e._x0,v=e._y0,l=e._x1,y=e._y1,_,p,c,k,f,o,d,m;if(!r)return e._root=h,e;for(;r.length;)if((f=t>=(_=(x+l)/2))?x=_:l=_,(o=n>=(p=(v+y)/2))?v=p:y=p,i=r,!(r=r[d=o<<1|f]))return i[d]=h,e;if(c=+e._x.call(null,r.data),k=+e._y.call(null,r.data),t===c&&n===k)return h.next=r,i?i[d]=h:e._root=h,e;do i=i?i[d]=new Array(4):e._root=new Array(4),(f=t>=(_=(x+l)/2))?x=_:l=_,(o=n>=(p=(v+y)/2))?v=p:y=p;while((d=o<<1|f)===(m=(k>=p)<<1|c>=_));return i[m]=r,i[d]=h,e}function gt(e){var t,n,s=e.length,i,r,h=new Array(s),x=new Array(s),v=1/0,l=1/0,y=-1/0,_=-1/0;for(n=0;n<s;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(h[n]=i,x[n]=r,i<v&&(v=i),i>y&&(y=i),r<l&&(l=r),r>_&&(_=r));if(v>y||l>_)return this;for(this.cover(v,l).cover(y,_),n=0;n<s;++n)Re(this,h[n],x[n],e[n]);return this}function mt(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,s=this._y0,i=this._x1,r=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,r=(s=Math.floor(t))+1;else{for(var h=i-n||1,x=this._root,v,l;n>e||e>=i||s>t||t>=r;)switch(l=(t<s)<<1|e<n,v=new Array(4),v[l]=x,x=v,h*=2,l){case 0:i=n+h,r=s+h;break;case 1:n=i-h,r=s+h;break;case 2:i=n+h,s=r-h;break;case 3:n=i-h,s=r-h;break}this._root&&this._root.length&&(this._root=x)}return this._x0=n,this._y0=s,this._x1=i,this._y1=r,this}function pt(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function yt(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function L(e,t,n,s,i){this.node=e,this.x0=t,this.y0=n,this.x1=s,this.y1=i}function vt(e,t,n){var s,i=this._x0,r=this._y0,h,x,v,l,y=this._x1,_=this._y1,p=[],c=this._root,k,f;for(c&&p.push(new L(c,i,r,y,_)),n==null?n=1/0:(i=e-n,r=t-n,y=e+n,_=t+n,n*=n);k=p.pop();)if(!(!(c=k.node)||(h=k.x0)>y||(x=k.y0)>_||(v=k.x1)<i||(l=k.y1)<r))if(c.length){var o=(h+v)/2,d=(x+l)/2;p.push(new L(c[3],o,d,v,l),new L(c[2],h,d,o,l),new L(c[1],o,x,v,d),new L(c[0],h,x,o,d)),(f=(t>=d)<<1|e>=o)&&(k=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=k)}else{var m=e-+this._x.call(null,c.data),b=t-+this._y.call(null,c.data),w=m*m+b*b;if(w<n){var $=Math.sqrt(n=w);i=e-$,r=t-$,y=e+$,_=t+$,s=c.data}}return s}function wt(e){if(isNaN(y=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e)))return this;var t,n=this._root,s,i,r,h=this._x0,x=this._y0,v=this._x1,l=this._y1,y,_,p,c,k,f,o,d;if(!n)return this;if(n.length)for(;;){if((k=y>=(p=(h+v)/2))?h=p:v=p,(f=_>=(c=(x+l)/2))?x=c:l=c,t=n,!(n=n[o=f<<1|k]))return this;if(!n.length)break;(t[o+1&3]||t[o+2&3]||t[o+3&3])&&(s=t,d=o)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,i?(r?i.next=r:delete i.next,this):t?(r?t[o]=r:delete t[o],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(s?s[d]=n:this._root=n),this):(this._root=r,this)}function Nt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function _t(){return this._root}function bt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function jt(e){var t=[],n,s=this._root,i,r,h,x,v;for(s&&t.push(new L(s,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(s=n.node,r=n.x0,h=n.y0,x=n.x1,v=n.y1)&&s.length){var l=(r+x)/2,y=(h+v)/2;(i=s[3])&&t.push(new L(i,l,y,x,v)),(i=s[2])&&t.push(new L(i,r,y,l,v)),(i=s[1])&&t.push(new L(i,l,h,x,y)),(i=s[0])&&t.push(new L(i,r,h,l,y))}return this}function kt(e){var t=[],n=[],s;for(this._root&&t.push(new L(this._root,this._x0,this._y0,this._x1,this._y1));s=t.pop();){var i=s.node;if(i.length){var r,h=s.x0,x=s.y0,v=s.x1,l=s.y1,y=(h+v)/2,_=(x+l)/2;(r=i[0])&&t.push(new L(r,h,x,y,_)),(r=i[1])&&t.push(new L(r,y,x,v,_)),(r=i[2])&&t.push(new L(r,h,_,y,l)),(r=i[3])&&t.push(new L(r,y,_,v,l))}n.push(s)}for(;s=n.pop();)e(s.node,s.x0,s.y0,s.x1,s.y1);return this}function Mt(e){return e[0]}function St(e){return arguments.length?(this._x=e,this):this._x}function $t(e){return e[1]}function Ct(e){return arguments.length?(this._y=e,this):this._y}function ve(e,t,n){var s=new we(t??Mt,n??$t,NaN,NaN,NaN,NaN);return e==null?s:s.addAll(e)}function we(e,t,n,s,i,r){this._x=e,this._y=t,this._x0=n,this._y0=s,this._x1=i,this._y1=r,this._root=void 0}function Me(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var T=ve.prototype=we.prototype;T.copy=function(){var e=new we(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,s;if(!t)return e;if(!t.length)return e._root=Me(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var i=0;i<4;++i)(s=t.source[i])&&(s.length?n.push({source:s,target:t.target[i]=new Array(4)}):t.target[i]=Me(s));return e};T.add=xt;T.addAll=gt;T.cover=mt;T.data=pt;T.extent=yt;T.find=vt;T.remove=wt;T.removeAll=Nt;T.root=_t;T.size=bt;T.visit=jt;T.visitAfter=kt;T.x=St;T.y=Ct;function J(e){return function(){return e}}function U(e){return(e()-.5)*1e-6}function At(e){return e.x+e.vx}function zt(e){return e.y+e.vy}function It(e){var t,n,s,i=1,r=1;typeof e!="function"&&(e=J(e==null?1:+e));function h(){for(var l,y=t.length,_,p,c,k,f,o,d=0;d<r;++d)for(_=ve(t,At,zt).visitAfter(x),l=0;l<y;++l)p=t[l],f=n[p.index],o=f*f,c=p.x+p.vx,k=p.y+p.vy,_.visit(m);function m(b,w,$,P,z){var C=b.data,H=b.r,I=f+H;if(C){if(C.index>p.index){var B=c-C.x-C.vx,F=k-C.y-C.vy,X=B*B+F*F;X<I*I&&(B===0&&(B=U(s),X+=B*B),F===0&&(F=U(s),X+=F*F),X=(I-(X=Math.sqrt(X)))/X*i,p.vx+=(B*=X)*(I=(H*=H)/(o+H)),p.vy+=(F*=X)*I,C.vx-=B*(I=1-I),C.vy-=F*I)}return}return w>c+I||P<c-I||$>k+I||z<k-I}}function x(l){if(l.data)return l.r=n[l.data.index];for(var y=l.r=0;y<4;++y)l[y]&&l[y].r>l.r&&(l.r=l[y].r)}function v(){if(t){var l,y=t.length,_;for(n=new Array(y),l=0;l<y;++l)_=t[l],n[_.index]=+e(_,l,t)}}return h.initialize=function(l,y){t=l,s=y,v()},h.iterations=function(l){return arguments.length?(r=+l,h):r},h.strength=function(l){return arguments.length?(i=+l,h):i},h.radius=function(l){return arguments.length?(e=typeof l=="function"?l:J(+l),v(),h):e},h}function Et(e){return e.index}function Se(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function Pt(e){var t=Et,n=_,s,i=J(30),r,h,x,v,l,y=1;e==null&&(e=[]);function _(o){return 1/Math.min(x[o.source.index],x[o.target.index])}function p(o){for(var d=0,m=e.length;d<y;++d)for(var b=0,w,$,P,z,C,H,I;b<m;++b)w=e[b],$=w.source,P=w.target,z=P.x+P.vx-$.x-$.vx||U(l),C=P.y+P.vy-$.y-$.vy||U(l),H=Math.sqrt(z*z+C*C),H=(H-r[b])/H*o*s[b],z*=H,C*=H,P.vx-=z*(I=v[b]),P.vy-=C*I,$.vx+=z*(I=1-I),$.vy+=C*I}function c(){if(h){var o,d=h.length,m=e.length,b=new Map(h.map(($,P)=>[t($,P,h),$])),w;for(o=0,x=new Array(d);o<m;++o)w=e[o],w.index=o,typeof w.source!="object"&&(w.source=Se(b,w.source)),typeof w.target!="object"&&(w.target=Se(b,w.target)),x[w.source.index]=(x[w.source.index]||0)+1,x[w.target.index]=(x[w.target.index]||0)+1;for(o=0,v=new Array(m);o<m;++o)w=e[o],v[o]=x[w.source.index]/(x[w.source.index]+x[w.target.index]);s=new Array(m),k(),r=new Array(m),f()}}function k(){if(h)for(var o=0,d=e.length;o<d;++o)s[o]=+n(e[o],o,e)}function f(){if(h)for(var o=0,d=e.length;o<d;++o)r[o]=+i(e[o],o,e)}return p.initialize=function(o,d){h=o,l=d,c()},p.links=function(o){return arguments.length?(e=o,c(),p):e},p.id=function(o){return arguments.length?(t=o,p):t},p.iterations=function(o){return arguments.length?(y=+o,p):y},p.strength=function(o){return arguments.length?(n=typeof o=="function"?o:J(+o),k(),p):n},p.distance=function(o){return arguments.length?(i=typeof o=="function"?o:J(+o),f(),p):i},p}var Rt={value:()=>{}};function Le(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new ae(n)}function ae(e){this._=e}function Lt(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}ae.prototype=Le.prototype={constructor:ae,on:function(e,t){var n=this._,s=Lt(e+"",n),i,r=-1,h=s.length;if(arguments.length<2){for(;++r<h;)if((i=(e=s[r]).type)&&(i=Tt(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<h;)if(i=(e=s[r]).type)n[i]=$e(n[i],e.name,t);else if(t==null)for(i in n)n[i]=$e(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ae(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,r;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,r=s.length;i<r;++i)s[i].value.apply(t,n)}};function Tt(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function $e(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=Rt,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var ee=0,re=0,ne=0,Te=1e3,le,se,ce=0,K=0,fe=0,ie=typeof performance=="object"&&performance.now?performance:Date,Be=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fe(){return K||(Be(Bt),K=ie.now()+fe)}function Bt(){K=0}function pe(){this._call=this._time=this._next=null}pe.prototype=He.prototype={constructor:pe,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fe():+n)+(t==null?0:+t),!this._next&&se!==this&&(se?se._next=this:le=this,se=this),this._call=e,this._time=n,ye()},stop:function(){this._call&&(this._call=null,this._time=1/0,ye())}};function He(e,t,n){var s=new pe;return s.restart(e,t,n),s}function Ft(){Fe(),++ee;for(var e=le,t;e;)(t=K-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ee}function Ce(){K=(ce=ie.now())+fe,ee=re=0;try{Ft()}finally{ee=0,Xt(),K=0}}function Ht(){var e=ie.now(),t=e-ce;t>Te&&(fe-=t,ce=e)}function Xt(){for(var e,t=le,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:le=n);se=e,ye(s)}function ye(e){if(!ee){re&&(re=clearTimeout(re));var t=e-K;t>24?(e<1/0&&(re=setTimeout(Ce,e-ie.now()-fe)),ne&&(ne=clearInterval(ne))):(ne||(ce=ie.now(),ne=setInterval(Ht,Te)),ee=1,Be(Ce))}}const Dt=1664525,Yt=1013904223,Ae=4294967296;function Zt(){let e=1;return()=>(e=(Dt*e+Yt)%Ae)/Ae}function Gt(e){return e.x}function Wt(e){return e.y}var Qt=10,Ot=Math.PI*(3-Math.sqrt(5));function Ut(e){var t,n=1,s=.001,i=1-Math.pow(s,1/300),r=0,h=.6,x=new Map,v=He(_),l=Le("tick","end"),y=Zt();e==null&&(e=[]);function _(){p(),l.call("tick",t),n<s&&(v.stop(),l.call("end",t))}function p(f){var o,d=e.length,m;f===void 0&&(f=1);for(var b=0;b<f;++b)for(n+=(r-n)*i,x.forEach(function(w){w(n)}),o=0;o<d;++o)m=e[o],m.fx==null?m.x+=m.vx*=h:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=h:(m.y=m.fy,m.vy=0);return t}function c(){for(var f=0,o=e.length,d;f<o;++f){if(d=e[f],d.index=f,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var m=Qt*Math.sqrt(.5+f),b=f*Ot;d.x=m*Math.cos(b),d.y=m*Math.sin(b)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function k(f){return f.initialize&&f.initialize(e,y),f}return c(),t={tick:p,restart:function(){return v.restart(_),t},stop:function(){return v.stop(),t},nodes:function(f){return arguments.length?(e=f,c(),x.forEach(k),t):e},alpha:function(f){return arguments.length?(n=+f,t):n},alphaMin:function(f){return arguments.length?(s=+f,t):s},alphaDecay:function(f){return arguments.length?(i=+f,t):+i},alphaTarget:function(f){return arguments.length?(r=+f,t):r},velocityDecay:function(f){return arguments.length?(h=1-f,t):1-h},randomSource:function(f){return arguments.length?(y=f,x.forEach(k),t):y},force:function(f,o){return arguments.length>1?(o==null?x.delete(f):x.set(f,k(o)),t):x.get(f)},find:function(f,o,d){var m=0,b=e.length,w,$,P,z,C;for(d==null?d=1/0:d*=d,m=0;m<b;++m)z=e[m],w=f-z.x,$=o-z.y,P=w*w+$*$,P<d&&(C=z,d=P);return C},on:function(f,o){return arguments.length>1?(l.on(f,o),t):l.on(f)}}}function Vt(){var e,t,n,s,i=J(-30),r,h=1,x=1/0,v=.81;function l(c){var k,f=e.length,o=ve(e,Gt,Wt).visitAfter(_);for(s=c,k=0;k<f;++k)t=e[k],o.visit(p)}function y(){if(e){var c,k=e.length,f;for(r=new Array(k),c=0;c<k;++c)f=e[c],r[f.index]=+i(f,c,e)}}function _(c){var k=0,f,o,d=0,m,b,w;if(c.length){for(m=b=w=0;w<4;++w)(f=c[w])&&(o=Math.abs(f.value))&&(k+=f.value,d+=o,m+=o*f.x,b+=o*f.y);c.x=m/d,c.y=b/d}else{f=c,f.x=f.data.x,f.y=f.data.y;do k+=r[f.data.index];while(f=f.next)}c.value=k}function p(c,k,f,o){if(!c.value)return!0;var d=c.x-t.x,m=c.y-t.y,b=o-k,w=d*d+m*m;if(b*b/v<w)return w<x&&(d===0&&(d=U(n),w+=d*d),m===0&&(m=U(n),w+=m*m),w<h&&(w=Math.sqrt(h*w)),t.vx+=d*c.value*s/w,t.vy+=m*c.value*s/w),!0;if(c.length||w>=x)return;(c.data!==t||c.next)&&(d===0&&(d=U(n),w+=d*d),m===0&&(m=U(n),w+=m*m),w<h&&(w=Math.sqrt(h*w)));do c.data!==t&&(b=r[c.data.index]*s/w,t.vx+=d*b,t.vy+=m*b);while(c=c.next)}return l.initialize=function(c,k){e=c,n=k,y()},l.strength=function(c){return arguments.length?(i=typeof c=="function"?c:J(+c),y(),l):i},l.distanceMin=function(c){return arguments.length?(h=c*c,l):Math.sqrt(h)},l.distanceMax=function(c){return arguments.length?(x=c*c,l):Math.sqrt(x)},l.theta=function(c){return arguments.length?(v=c*c,l):Math.sqrt(v)},l}function Jt(e,t){return e>0?"Every category has a steward.":t>0?"No categories yet — tag documents to see steward coverage.":"No categories or stewards yet — tag documents and assign stewards to see coverage."}const W={doc:"#3b82f6",steward:"#16a34a",tag:"#f59e0b",root:"#64748b",folder:"#a855f7"};function Kt(e){return e==="steward"?"#16a34a66":e==="tag"?"#f59e0b66":e==="structure"?"#a855f766":"#94a3b8aa"}const ze=(e,t,n)=>Math.min(n,Math.max(t,e)),Ie=.15,qt=5;function Ee(e){return e.kind==="doc"?e.name.includes("]]")||e.name.includes("|")?null:`[[${e.name}]]`:e.kind==="tag"?`#${e.name.replace(/^#/,"")}`:null}function en(e){return`'${e.replace(/'/g,"'\\''")}'`}function tn({nestId:e,nestName:t,onOpenTag:n,onOpenDocument:s,onBack:i}){const[r,h]=A.useState(null),[x,v]=A.useState(!0),[l,y]=A.useState(null),[_,p]=A.useState({links:!0,stewardship:!0,categories:!0,structure:!0}),[c,k]=A.useState(null),[f,o]=A.useState(1),d=A.useRef(null),m=A.useRef(null),[b,w]=A.useState({w:800,h:560}),[$,P]=A.useState({nodes:[],links:[]}),[z,C]=A.useState({x:0,y:0,k:1}),[H,I]=A.useState(!1),B=A.useRef(null),F=A.useRef(!1),X=A.useRef({w:0,h:0}),Xe=(a,g)=>{const N=m.current.getBoundingClientRect();return{x:(a-N.left-z.x)/z.k,y:(g-N.top-z.y)/z.k}},Ne=(a,g,N)=>{const j=a.filter(Z=>Z.x!=null&&Z.y!=null);if(!j.length)return C({x:g/2,y:N/2,k:1});let M=1/0,S=1/0,R=-1/0,E=-1/0;for(const Z of j)M=Math.min(M,Z.x),S=Math.min(S,Z.y),R=Math.max(R,Z.x),E=Math.max(E,Z.y);const D=48,G=R-M||1,Q=E-S||1,V=ze(Math.min((g-2*D)/G,(N-2*D)/Q),Ie,1.5);C({x:g/2-(M+R)/2*V,y:N/2-(S+E)/2*V,k:V})},he=(a,g=b.w/2,N=b.h/2)=>{F.current=!0,C(j=>{const M=ze(j.k*a,Ie,qt),S=(g-j.x)/j.k,R=(N-j.y)/j.k;return{k:M,x:g-S*M,y:N-R*M}})};A.useEffect(()=>{const a=m.current;if(!a)return;const g=N=>{N.preventDefault();const j=a.getBoundingClientRect();he(N.deltaY<0?1.1:1/1.1,N.clientX-j.left,N.clientY-j.top)};return a.addEventListener("wheel",g,{passive:!1}),()=>a.removeEventListener("wheel",g)},[b.w,b.h,x,l]);const De=a=>{var g,N;(N=(g=m.current)==null?void 0:g.setPointerCapture)==null||N.call(g,a.pointerId),B.current={mode:"pan",px:a.clientX,py:a.clientY},I(!0)},Ye=(a,g)=>{var N,j;a.stopPropagation(),(j=(N=m.current)==null?void 0:N.setPointerCapture)==null||j.call(N,a.pointerId),B.current={mode:"node",node:g,moved:!1}},Ze=a=>{const g=B.current;if(g)if(g.mode==="pan"){const N=a.clientX-g.px,j=a.clientY-g.py;g.px=a.clientX,g.py=a.clientY,F.current=!0,C(M=>({...M,x:M.x+N,y:M.y+j}))}else{g.moved=!0;const N=Xe(a.clientX,a.clientY);g.node.x=N.x,g.node.y=N.y,P(j=>({...j,nodes:j.nodes.slice()}))}},_e=a=>{var N,j;const g=B.current;(j=(N=m.current)==null?void 0:N.releasePointerCapture)==null||j.call(N,a.pointerId),(g==null?void 0:g.mode)==="node"&&!g.moved&&k(M=>(M==null?void 0:M.id)===g.node.id?null:g.node),B.current=null,I(!1)};A.useEffect(()=>{let a=!1;return v(!0),Qe(e).then(g=>{a||(F.current=!1,h(g))}).catch(g=>!a&&y((g==null?void 0:g.message)||"Failed to load graph")).finally(()=>!a&&v(!1)),()=>{a=!0}},[e]),A.useEffect(()=>{if(!d.current)return;const a=d.current,g=()=>w({w:a.clientWidth,h:Math.max(420,a.clientHeight)});g();let N;const j=new ResizeObserver(()=>{clearTimeout(N),N=setTimeout(g,150)});return j.observe(a),()=>{clearTimeout(N),j.disconnect()}},[]);const Y=(r==null?void 0:r.signals)??null,oe=A.useMemo(()=>{if(!r)return{nodes:[],links:[]};const a=[],g=[],N=new Set(((Y==null?void 0:Y.orphans)||[]).map(S=>S.id));for(const S of r.nodes)a.push({id:S.id,name:S.title,kind:"doc",color:N.has(S.id)?"#ef4444":W.doc,val:2});if(_.links)for(const S of r.links)g.push({...S,kind:"link"});const j=()=>{a.some(S=>S.id==="root:nest")||a.push({id:"root:nest",name:t,kind:"root",color:W.root,val:4})};if(_.structure){j();const S=new Set,R=(D,G)=>{const Q=`${D}~>${G}`;S.has(Q)||(S.add(Q),g.push({source:D,target:G,kind:"structure"}))},E=new Set;for(const D of r.nodes){const G=D.id.split("/").filter(Boolean),Q=G[0]==="nodes"?G.slice(1,-1):G.slice(0,-1);let V="root:nest",Z="";for(const de of Q){Z=Z?`${Z}/${de}`:de;const te=`folder:${Z}`;E.has(te)||(E.add(te),a.push({id:te,name:de,kind:"folder",color:W.folder,val:2})),R(V,te),V=te}R(V,D.id)}}if(_.categories){for(const S of r.tags)a.push({id:`tag:${S.name}`,name:`#${S.name}`,kind:"tag",color:W.tag,val:1+Math.min(S.count,4)});for(const S of r.nodes)for(const R of S.tags)g.push({source:S.id,target:`tag:${R}`,kind:"tag"})}if(_.stewardship){const S=new Map(r.stewards.map(E=>[E.id,E.label]));for(const E of r.stewards)a.push({id:`steward:${E.id}`,name:E.label,kind:"steward",color:W.steward,val:3});let R=!1;for(const E of r.stewardEdges){const D=`steward:${E.steward}`;if(S.has(E.steward))if(E.scope==="tag")if(_.categories)g.push({source:D,target:E.target,kind:"steward"});else{const G=E.target.replace(/^tag:/,"");for(const Q of r.nodes)Q.tags.includes(G)&&g.push({source:D,target:Q.id,kind:"steward"})}else E.scope==="document"?g.push({source:D,target:E.target,kind:"steward"}):(R=!0,g.push({source:D,target:"root:nest",kind:"steward"}))}R&&j()}const M=new Set(a.map(S=>S.id));return{nodes:a,links:g.filter(S=>M.has(S.source)&&M.has(S.target))}},[r,_,Y,t]);A.useEffect(()=>{if(!oe.nodes.length){P({nodes:[],links:[]});return}const a=oe.nodes.map(M=>({...M})),g=oe.links.map(M=>({...M})),N=Ut(a).force("link",Pt(g).id(M=>M.id).distance(55).strength(.35)).force("charge",Vt().strength(-170)).force("center",dt(b.w/2,b.h/2)).force("collide",It(14)).stop();for(let M=0;M<300;M++)N.tick();P({nodes:a,links:g});const j=X.current.w!==b.w||X.current.h!==b.h;(!F.current||j)&&(Ne(a,b.w,b.h),X.current={w:b.w,h:b.h})},[oe,b.w,b.h]);const be=a=>3+a.val,O=A.useMemo(()=>{if(!c)return null;const a=new Map;for(const j of $.links){const M=typeof j.source=="string"?j.source:j.source.id,S=typeof j.target=="string"?j.target:j.target.id;(a.get(M)??a.set(M,[]).get(M)).push(S),(a.get(S)??a.set(S,[]).get(S)).push(M)}const g=new Set([c.id]);let N=[c.id];for(let j=0;j<f&&N.length;j++){const M=[];for(const S of N)for(const R of a.get(S)??[])g.has(R)||(g.add(R),M.push(R));N=M}return g},[c,f,$.links]),Ge=A.useMemo(()=>new Map($.nodes.map(a=>[a.id,a])),[$.nodes]),je=((r==null?void 0:r.stewards.length)??0)>0,ke=((r==null?void 0:r.tags.length)??0)>0,We=((r==null?void 0:r.links.length)??0)>0;return u.jsxs("div",{className:"space-y-4",children:[u.jsx(nt,{nestName:t,onBack:i,children:u.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[[["structure","Structure",ot,!0],["links","Links",rt,We],["stewardship","Stewardship",Oe,je],["categories","Categories",st,ke]].filter(([,,,a])=>a).map(([a,g,N])=>u.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[u.jsx("input",{type:"checkbox",checked:_[a],onChange:j=>p(M=>({...M,[a]:j.target.checked}))}),u.jsx(N,{className:"h-3.5 w-3.5"}),g]},a)),u.jsx(Pe,{variant:"ghost",size:"sm",onClick:()=>{F.current=!1,C({x:0,y:0,k:1})},title:"Reset pan & zoom",children:"Reset view"})]})}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-4",children:[u.jsxs("div",{ref:d,className:"border border-border rounded-lg bg-card overflow-hidden h-[560px] relative",children:[x&&u.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground",children:[u.jsx(Ue,{className:"h-5 w-5 animate-spin mr-2"})," Loading ontology…"]}),l&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-red-500 text-sm",children:l}),!x&&!l&&(r==null?void 0:r.truncated)&&u.jsxs("div",{className:"absolute top-2 left-2 z-10 rounded bg-amber-100 text-amber-800 text-xs px-2 py-1 border border-amber-300",children:["Showing ",r.nodes.length," of ",r.totalNodes," nodes (highest-connected). Gaps below cover all ",r.totalNodes,"."]}),!x&&!l&&u.jsxs(u.Fragment,{children:[u.jsx("svg",{ref:m,width:b.w,height:b.h,className:"block touch-none",style:{cursor:H?"grabbing":"grab"},onPointerDown:De,onPointerMove:Ze,onPointerUp:_e,onPointerLeave:_e,children:u.jsxs("g",{transform:`translate(${z.x},${z.y}) scale(${z.k})`,children:[u.jsx("g",{children:$.links.map((a,g)=>{const N=a.source,j=a.target;if((N==null?void 0:N.x)==null||(j==null?void 0:j.x)==null)return null;const M=!O||O.has(N.id)&&O.has(j.id);return u.jsx("line",{x1:N.x,y1:N.y,x2:j.x,y2:j.y,stroke:Kt(a.kind),strokeWidth:(M&&O?1.6:1)/z.k,opacity:M?1:.15},g)})}),u.jsx("g",{children:$.nodes.map(a=>{const g=!O||O.has(a.id);return u.jsxs("g",{transform:`translate(${a.x??0},${a.y??0})`,onPointerDown:N=>Ye(N,a),onDoubleClick:()=>{a.kind==="doc"&&(s==null||s(a.id))},style:{cursor:"grab"},opacity:g?1:.25,children:[a.kind==="doc"&&s&&u.jsx("title",{children:`Double-click to open "${a.name}"`}),u.jsx("circle",{r:be(a),fill:a.color,stroke:(c==null?void 0:c.id)===a.id?"#111827":g&&O?"#111827aa":"#ffffff",strokeWidth:(c==null?void 0:c.id)===a.id?2:1}),u.jsx("text",{x:be(a)+3,y:3,fontSize:9,fill:"#475569",children:a.name.length>24?a.name.slice(0,24)+"…":a.name})]},a.id)})})]})}),u.jsxs("div",{className:"absolute bottom-2 right-2 z-10 flex flex-col gap-1",children:[u.jsx(xe,{label:"Zoom in",onClick:()=>he(1.25),children:u.jsx(ut,{className:"h-4 w-4"})}),u.jsx(xe,{label:"Zoom out",onClick:()=>he(1/1.25),children:u.jsx(ht,{className:"h-4 w-4"})}),u.jsx(xe,{label:"Fit to view",onClick:()=>Ne($.nodes,b.w,b.h),children:u.jsx(lt,{className:"h-4 w-4"})})]})]})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"border border-border rounded-lg bg-card p-3",children:[u.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-sm mb-2",children:[((r==null?void 0:r.nodes.length)??0)===0?u.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}):u.jsx(Je,{className:"h-4 w-4 text-amber-500"})," ","Coverage gaps"]}),Y?((r==null?void 0:r.nodes.length)??0)===0?u.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.jsx("span",{className:"font-medium text-foreground",children:"No documents yet"})," ","— add content to see governance coverage and connection gaps."]}):u.jsxs("div",{className:"space-y-3 text-sm",children:[u.jsx(me,{label:"Categories with no steward",items:Y.unstewardedTags.map(a=>`#${a.name} (${a.count})`),empty:Jt((r==null?void 0:r.tags.length)??0,(r==null?void 0:r.stewards.length)??0),onSelect:n&&(a=>n(Y.unstewardedTags[a].name)),selectTitle:a=>`Show #${Y.unstewardedTags[a].name} documents`}),u.jsx(me,{label:"Bottleneck stewards (≥50% of nodes)",items:Y.bottlenecks.map(a=>`${a.label} — ${a.share}%`),empty:"No single-owner concentration."}),u.jsx(me,{label:"Orphan nodes (no links)",items:Y.orphans.map(a=>a.title),empty:"No orphans — everything connects.",onSelect:s&&(a=>s(Y.orphans[a].id)),selectTitle:a=>`Open "${Y.orphans[a].title}"`})]}):u.jsx("p",{className:"text-xs text-muted-foreground",children:"—"})]}),c&&u.jsx(nn,{node:c,graph:r,nestId:e,hopDepth:f,onHopDepth:o,neighborhood:O,nodesById:Ge,onOpenTag:n,onOpenDocument:s}),u.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[u.jsx(q,{color:W.root,label:"Nest"}),u.jsx(q,{color:W.folder,label:"Folder"}),u.jsx(q,{color:W.doc,label:"Document"}),u.jsx(q,{color:"#ef4444",label:"Orphan document"}),ke&&u.jsx(q,{color:W.tag,label:"Category / tag"}),je&&u.jsx(q,{color:W.steward,label:"Steward"})]})]})]})]})}function xe({label:e,onClick:t,children:n}){return u.jsx("button",{type:"button","aria-label":e,title:e,onClick:t,className:"flex h-7 w-7 items-center justify-center rounded border border-border bg-card text-foreground shadow-sm hover:bg-accent",children:n})}function nn({node:e,graph:t,nestId:n,hopDepth:s,onHopDepth:i,neighborhood:r,nodesById:h,onOpenTag:x,onOpenDocument:v}){const l=e.kind==="doc"?t==null?void 0:t.nodes.find(o=>o.id===e.id):null,y=l&&t?t.links.filter(o=>o.source===l.id||o.target===l.id).length:0,_=Ee(e),p=r?[...r].map(o=>h.get(o)).filter(o=>!!o).map(Ee).filter(o=>!!o):[],c=p.join(" | "),k=typeof window<"u"?window.location.origin:"",f=_?`curl -X POST ${k}/nests/${n}/context \\
|
|
22
22
|
-H "Content-Type: application/json" \\
|
|
23
23
|
-H "Authorization: Bearer <api-key>" \\
|
|
24
|
-
-d ${en(JSON.stringify({selector:_,hops:s}))}`:null;return u.jsxs("div",{className:"border border-border rounded-lg bg-card p-3 text-sm space-y-2",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium mb-1 break-all",children:e.name}),u.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:e.kind})]}),l&&v&&u.jsx(Pe,{size:"sm",variant:"outline",className:"w-full h-7 text-xs",onClick:()=>v(l.id),children:"Open document"}),l&&u.jsxs("div",{className:"space-y-1 text-xs",children:[l.tags.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1",children:l.tags.map(o=>u.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(o),disabled:!x,className:"rounded bg-amber-50 text-amber-700 px-1.5 py-0.5 hover:bg-amber-100 disabled:hover:bg-amber-50 disabled:cursor-default",title:x?`Show #${o} documents`:`#${o}`,children:["#",o]},o))}),u.jsx("div",{className:"text-muted-foreground",children:y===0?"No wikilinks":`${y} wikilink${y===1?"":"s"}`})]}),u.jsxs("div",{className:"border-t pt-2 space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-xs font-medium",children:"Query this selection"}),u.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:["hops",u.jsx("select",{className:"border border-border rounded bg-card px-1 py-0.5 text-xs",value:s,onChange:o=>i(Number(o.target.value)),children:[0,1,2,3].map(o=>u.jsx("option",{value:o,children:o},o))})]})]}),_&&u.jsx(ge,{label:"Selector",value:_}),f&&u.jsx(ge,{label:`API call (this node + ${s} hop${s===1?"":"s"})`,value:f}),p.length>1&&u.jsx(ge,{label:`Highlighted set (${p.length} nodes, exact — use hops: 0)`,value:c}),!_&&p.length===0&&u.jsx("p",{className:"text-xs text-muted-foreground",children:"No selector for this node kind — select a document or tag."})]})]})}function ge({label:e,value:t}){const[n,s]=A.useState(!1),i=async()=>{await
|
|
24
|
+
-d ${en(JSON.stringify({selector:_,hops:s}))}`:null;return u.jsxs("div",{className:"border border-border rounded-lg bg-card p-3 text-sm space-y-2",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium mb-1 break-all",children:e.name}),u.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:e.kind})]}),l&&v&&u.jsx(Pe,{size:"sm",variant:"outline",className:"w-full h-7 text-xs",onClick:()=>v(l.id),children:"Open document"}),l&&u.jsxs("div",{className:"space-y-1 text-xs",children:[l.tags.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1",children:l.tags.map(o=>u.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(o),disabled:!x,className:"rounded bg-amber-50 text-amber-700 px-1.5 py-0.5 hover:bg-amber-100 disabled:hover:bg-amber-50 disabled:cursor-default",title:x?`Show #${o} documents`:`#${o}`,children:["#",o]},o))}),u.jsx("div",{className:"text-muted-foreground",children:y===0?"No wikilinks":`${y} wikilink${y===1?"":"s"}`})]}),u.jsxs("div",{className:"border-t pt-2 space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-xs font-medium",children:"Query this selection"}),u.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:["hops",u.jsx("select",{className:"border border-border rounded bg-card px-1 py-0.5 text-xs",value:s,onChange:o=>i(Number(o.target.value)),children:[0,1,2,3].map(o=>u.jsx("option",{value:o,children:o},o))})]})]}),_&&u.jsx(ge,{label:"Selector",value:_}),f&&u.jsx(ge,{label:`API call (this node + ${s} hop${s===1?"":"s"})`,value:f}),p.length>1&&u.jsx(ge,{label:`Highlighted set (${p.length} nodes, exact — use hops: 0)`,value:c}),!_&&p.length===0&&u.jsx("p",{className:"text-xs text-muted-foreground",children:"No selector for this node kind — select a document or tag."})]})]})}function ge({label:e,value:t}){const[n,s]=A.useState(!1),i=async()=>{await et(t)&&(s(!0),setTimeout(()=>s(!1),1500))};return u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[u.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:e}),u.jsx("button",{type:"button","aria-label":`Copy ${e}`,onClick:i,className:"flex h-5 w-5 items-center justify-center rounded hover:bg-accent shrink-0",children:n?u.jsx(Ke,{className:"h-3 w-3 text-green-600"}):u.jsx(qe,{className:"h-3 w-3"})})]}),u.jsx("pre",{className:"bg-muted rounded px-2 py-1.5 text-[10px] font-mono whitespace-pre-wrap break-all max-h-28 overflow-y-auto",children:t})]})}function me({label:e,items:t,empty:n,onSelect:s,selectTitle:i}){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),t.length===0?u.jsx("div",{className:"text-xs text-muted-foreground",children:n}):u.jsxs("ul",{className:"mt-0.5 space-y-0.5",children:[t.slice(0,8).map((r,h)=>u.jsx("li",{className:"text-xs text-amber-700 break-all",children:s?u.jsx("button",{type:"button",onClick:()=>s(h),title:i==null?void 0:i(h),className:"text-left hover:underline",children:r}):r},h)),t.length>8&&u.jsxs("li",{className:"text-xs text-muted-foreground",children:["+",t.length-8," more"]})]})]})}function q({color:e,label:t}){return u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{background:e}}),t]})}function ln(){const e=tt();return u.jsx(tn,{nestId:e.nestId,nestName:e.nestName,onOpenTag:t=>e.openNest({tags:[t]}),onOpenDocument:e.openDocument,onBack:e.leaveNest})}export{ln as default};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import{c as pt,r as se,Q as Bt,d7 as Vt,d8 as Xt,d9 as Jt,j as s,B as ue,D as Ve,z as Xe,G as Je,H as Qe,J as dt,az as Pt,aE as ut,cG as Qt,da as er,af as tr,db as Ze,cE as rr,dc as nr,w as sr,L as De,M as ht,I as Ke,K as ft,dd as ir,cY as ar,cO as or,Y as mt,l as ze,u as Ut,b_ as Pe,b$ as lr,c1 as cr,c0 as dr,c2 as Ue,a6 as ur,de as hr,b1 as Ye,a_ as at,df as We,T as fr,Z as mr,ar as pr,bO as wt,E as gr,aq as kt,bE as jt,ad as xr,F as Nt,U as St,f as ot,i as Ce,ag as vr,c5 as Ct,dg as _r,dh as br,di as yr,dj as wr,dk as kr,dl as jr,C as Nr,dm as Sr,d3 as Cr}from"./index-WYDmEOfO.js";import{E as At}from"./earth-BXhVPvCR.js";import{C as Et,n as $e,R as Ar,D as Er}from"./count-skeleton-DToLM74B.js";import{P as zr}from"./page-title-DVq4qvMR.js";import{A as Ir,a as Dr,b as Or,c as Rr,d as Fr,e as Tr,f as Br,g as Pr}from"./alert-dialog-BvF3NFr7.js";import{F as Oe,A as lt}from"./folder-input-m8UBV4fA.js";import{T as Be}from"./trash-2-B0HyPTnI.js";import{C as Ur}from"./circle-check-Bw_aTXiH.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 Lr=[["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"}]],Mr=pt("archive-restore",Lr);/**
|
|
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 Zr=[["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"}]],Wr=pt("bookmark",Zr);/**
|
|
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 $r=[["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"}]],Hr=pt("folder-sync",$r),zt=typeof window<"u"?window.location.origin:"http://localhost:3838";function qr({nests:M,onManageKeys:V}){const[p,S]=se.useState(!1),{authenticated:x,authMode:c}=Bt(),o=c==="open",r=x&&!o,{nestCount:a,documentCount:v}=Vt(M),y=Xt(zt),_=Jt(zt,o);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border bg-gradient-to-br from-blue-50 to-indigo-50 p-4 dark:from-slate-900 dark:to-slate-900/40 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(At,{className:"h-5 w-5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Your whole brain"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[a," ",a===1?"nest":"nests"," ·"," ",v.toLocaleString()," ",v===1?"document":"documents"," — connect an AI to all of it at once."]})]})]}),s.jsxs(ue,{className:"shrink-0",onClick:()=>S(!0),children:[s.jsx(At,{className:"mr-2 h-4 w-4"}),"Connect all my nests"]})]}),s.jsx(Ve,{open:p,onOpenChange:S,children:s.jsxs(Xe,{className:"max-w-lg",children:[s.jsxs(Je,{children:[s.jsx(Qe,{children:"Connect all my nests"}),s.jsx(dt,{children:"One connection your AI reads every nest through — it picks the right one for each question."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Server (MCP) endpoint"}),s.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/40 p-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate text-xs",children:y}),s.jsx(ue,{variant:"ghost",size:"sm","aria-label":"Copy endpoint",onClick:()=>ut(y,"Endpoint copied"),children:s.jsx(Pt,{className:"h-3.5 w-3.5"})})]})]}),r&&s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Your API key"}),s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border bg-muted/40 p-2.5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[s.jsx(Qt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsx("span",{children:"Paste in the key you already use — any of your keys works here and on every nest. Need a new one?"})]}),V&&s.jsx(ue,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>{S(!1),V()},children:"Manage API keys"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Or paste this into your AI"}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 text-[11px] leading-relaxed",children:_}),s.jsxs(ue,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>ut(_,"Prompt copied"),children:[s.jsx(er,{className:"mr-1.5 h-3.5 w-3.5"}),'Copy "chat with all my nests"']})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-emerald-200 bg-emerald-50 p-2.5 text-xs text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/40 dark:text-emerald-200",children:[s.jsx(tr,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsx("span",{children:"Search and list across all nests at once, or target a specific nest. Create, update, delete, move, and submit for review — just name the nest. Approval and sharing stay in each nest's Connect panel."})]})]})]})})]})}const He="mine";function It(M){return M.is_owner??(M.permission??"owner")==="owner"}function Gr(M,V){switch(V){case"mine":return!M.discovered;case"owned":return It(M);case"shared":return!It(M)&&!M.discovered;case"org":return M.visibility==="org";case"public":return M.visibility==="public";default:return!0}}function Kr(M){return M!=="unsynced"}function Yr(M,V,p){if(V!=="all"&&V!=="mine"&&V!=="unsynced")return[];const S=p.trim().toLowerCase();return S?M.filter(x=>x.label.toLowerCase().includes(S)||x.name.toLowerCase().includes(S)):M}function Vr(M,V,p){const S=V.trim().toLowerCase();return[...S?M.filter(c=>(c.name??"").toLowerCase().includes(S)):M].sort((c,o)=>p==="name"?String(c.name??"").localeCompare(String(o.name??"")):String(o.archived_at??"").localeCompare(String(c.archived_at??"")))}function qe(M){throw new Error('Could not dynamically require "'+M+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ct={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 Dt;function Xr(){return Dt||(Dt=1,(function(M,V){(function(p){M.exports=p()})(function(){return(function p(S,x,c){function o(v,y){if(!x[v]){if(!S[v]){var _=typeof qe=="function"&&qe;if(!y&&_)return _(v,!0);if(r)return r(v,!0);var b=new Error("Cannot find module '"+v+"'");throw b.code="MODULE_NOT_FOUND",b}var n=x[v]={exports:{}};S[v][0].call(n.exports,function(h){var i=S[v][1][h];return o(i||h)},n,n.exports,p,S,x,c)}return x[v].exports}for(var r=typeof qe=="function"&&qe,a=0;a<c.length;a++)o(c[a]);return o})({1:[function(p,S,x){var c=p("./utils"),o=p("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";x.encode=function(a){for(var v,y,_,b,n,h,i,u=[],l=0,g=a.length,w=g,C=c.getTypeOf(a)!=="string";l<a.length;)w=g-l,_=C?(v=a[l++],y=l<g?a[l++]:0,l<g?a[l++]:0):(v=a.charCodeAt(l++),y=l<g?a.charCodeAt(l++):0,l<g?a.charCodeAt(l++):0),b=v>>2,n=(3&v)<<4|y>>4,h=1<w?(15&y)<<2|_>>6:64,i=2<w?63&_:64,u.push(r.charAt(b)+r.charAt(n)+r.charAt(h)+r.charAt(i));return u.join("")},x.decode=function(a){var v,y,_,b,n,h,i=0,u=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);i<a.length;)v=r.indexOf(a.charAt(i++))<<2|(b=r.indexOf(a.charAt(i++)))>>4,y=(15&b)<<4|(n=r.indexOf(a.charAt(i++)))>>2,_=(3&n)<<6|(h=r.indexOf(a.charAt(i++))),g[u++]=v,n!==64&&(g[u++]=y),h!==64&&(g[u++]=_);return g}},{"./support":30,"./utils":32}],2:[function(p,S,x){var c=p("./external"),o=p("./stream/DataWorker"),r=p("./stream/Crc32Probe"),a=p("./stream/DataLengthProbe");function v(y,_,b,n,h){this.compressedSize=y,this.uncompressedSize=_,this.crc32=b,this.compression=n,this.compressedContent=h}v.prototype={getContentWorker:function(){var y=new o(c.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),_=this;return y.on("end",function(){if(this.streamInfo.data_length!==_.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)}},v.createWorkerFrom=function(y,_,b){return y.pipe(new r).pipe(new a("uncompressedSize")).pipe(_.compressWorker(b)).pipe(new a("compressedSize")).withStreamInfo("compression",_)},S.exports=v},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(p,S,x){var c=p("./stream/GenericWorker");x.STORE={magic:"\0\0",compressWorker:function(){return new c("STORE compression")},uncompressWorker:function(){return new c("STORE decompression")}},x.DEFLATE=p("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(p,S,x){var c=p("./utils"),o=(function(){for(var r,a=[],v=0;v<256;v++){r=v;for(var y=0;y<8;y++)r=1&r?3988292384^r>>>1:r>>>1;a[v]=r}return a})();S.exports=function(r,a){return r!==void 0&&r.length?c.getTypeOf(r)!=="string"?(function(v,y,_,b){var n=o,h=b+_;v^=-1;for(var i=b;i<h;i++)v=v>>>8^n[255&(v^y[i])];return-1^v})(0|a,r,r.length,0):(function(v,y,_,b){var n=o,h=b+_;v^=-1;for(var i=b;i<h;i++)v=v>>>8^n[255&(v^y.charCodeAt(i))];return-1^v})(0|a,r,r.length,0):0}},{"./utils":32}],5:[function(p,S,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(p,S,x){var c=null;c=typeof Promise<"u"?Promise:p("lie"),S.exports={Promise:c}},{lie:37}],7:[function(p,S,x){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=p("pako"),r=p("./utils"),a=p("./stream/GenericWorker"),v=c?"uint8array":"array";function y(_,b){a.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=b,this.meta={}}x.magic="\b\0",r.inherits(y,a),y.prototype.processChunk=function(_){this.meta=_.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 _=this;this._pako.onData=function(b){_.push({data:b,meta:_.meta})}},x.compressWorker=function(_){return new y("Deflate",_)},x.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(p,S,x){function c(n,h){var i,u="";for(i=0;i<h;i++)u+=String.fromCharCode(255&n),n>>>=8;return u}function o(n,h,i,u,l,g){var w,C,N=n.file,B=n.compression,R=g!==v.utf8encode,Z=r.transformTo("string",g(N.name)),F=r.transformTo("string",v.utf8encode(N.name)),q=N.comment,ee=r.transformTo("string",g(q)),f=r.transformTo("string",v.utf8encode(q)),I=F.length!==N.name.length,t=f.length!==q.length,D="",X="",L="",ie=N.dir,W=N.date,re={crc32:0,compressedSize:0,uncompressedSize:0};h&&!i||(re.crc32=n.crc32,re.compressedSize=n.compressedSize,re.uncompressedSize=n.uncompressedSize);var z=0;h&&(z|=8),R||!I&&!t||(z|=2048);var E=0,ne=0;ie&&(E|=16),l==="UNIX"?(ne=798,E|=(function(G,de){var xe=G;return G||(xe=de?16893:33204),(65535&xe)<<16})(N.unixPermissions,ie)):(ne=20,E|=(function(G){return 63&(G||0)})(N.dosPermissions)),w=W.getUTCHours(),w<<=6,w|=W.getUTCMinutes(),w<<=5,w|=W.getUTCSeconds()/2,C=W.getUTCFullYear()-1980,C<<=4,C|=W.getUTCMonth()+1,C<<=5,C|=W.getUTCDate(),I&&(X=c(1,1)+c(y(Z),4)+F,D+="up"+c(X.length,2)+X),t&&(L=c(1,1)+c(y(ee),4)+f,D+="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(C,2),K+=c(re.crc32,4),K+=c(re.compressedSize,4),K+=c(re.uncompressedSize,4),K+=c(Z.length,2),K+=c(D.length,2),{fileRecord:_.LOCAL_FILE_HEADER+K+Z+D,dirRecord:_.CENTRAL_FILE_HEADER+c(ne,2)+K+c(ee.length,2)+"\0\0\0\0"+c(E,4)+c(u,4)+Z+D+ee}}var r=p("../utils"),a=p("../stream/GenericWorker"),v=p("../utf8"),y=p("../crc32"),_=p("../signature");function b(n,h,i,u){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=i,this.encodeFileName=u,this.streamFiles=n,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(n){var h=n.meta.percent||0,i=this.entriesCount,u=this._sources.length;this.accumulate?this.contentBuffer.push(n):(this.bytesWritten+=n.data.length,a.prototype.push.call(this,{data:n.data,meta:{currentFile:this.currentFile,percent:i?(h+100*(i-u-1))/i:100}}))},b.prototype.openedSource=function(n){this.currentSourceOffset=this.bytesWritten,this.currentFile=n.file.name;var h=this.streamFiles&&!n.file.dir;if(h){var i=o(n,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(n){this.accumulate=!1;var h=this.streamFiles&&!n.file.dir,i=o(n,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),h)this.push({data:(function(u){return _.DATA_DESCRIPTOR+c(u.crc32,4)+c(u.compressedSize,4)+c(u.uncompressedSize,4)})(n),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},b.prototype.flush=function(){for(var n=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var i=this.bytesWritten-n,u=(function(l,g,w,C,N){var B=r.transformTo("string",N(C));return _.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,i,n,this.zipComment,this.encodeFileName);this.push({data:u,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(n){this._sources.push(n);var h=this;return n.on("data",function(i){h.processChunk(i)}),n.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),n.on("error",function(i){h.error(i)}),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(n){var h=this._sources;if(!a.prototype.error.call(this,n))return!1;for(var i=0;i<h.length;i++)try{h[i].error(n)}catch{}return!0},b.prototype.lock=function(){a.prototype.lock.call(this);for(var n=this._sources,h=0;h<n.length;h++)n[h].lock()},S.exports=b},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(p,S,x){var c=p("../compressions"),o=p("./ZipFileWorker");x.generateWorker=function(r,a,v){var y=new o(a.streamFiles,v,a.platform,a.encodeFileName),_=0;try{r.forEach(function(b,n){_++;var h=(function(g,w){var C=g||w,N=c[C];if(!N)throw new Error(C+" is not a valid compression method !");return N})(n.options.compression,a.compression),i=n.options.compressionOptions||a.compressionOptions||{},u=n.dir,l=n.date;n._compressWorker(h,i).withStreamInfo("file",{name:b,dir:u,date:l,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(y)}),y.entriesCount=_}catch(b){y.error(b)}return y}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(p,S,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=p("./object")).loadAsync=p("./load"),c.support=p("./support"),c.defaults=p("./defaults"),c.version="3.10.1",c.loadAsync=function(o,r){return new c().loadAsync(o,r)},c.external=p("./external"),S.exports=c},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(p,S,x){var c=p("./utils"),o=p("./external"),r=p("./utf8"),a=p("./zipEntries"),v=p("./stream/Crc32Probe"),y=p("./nodejsUtils");function _(b){return new o.Promise(function(n,h){var i=b.decompressed.getContentWorker().pipe(new v);i.on("error",function(u){h(u)}).on("end",function(){i.streamInfo.crc32!==b.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):n()}).resume()})}S.exports=function(b,n){var h=this;return n=c.extend(n||{},{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,n.optimizedBinaryString,n.base64).then(function(i){var u=new a(n);return u.load(i),u}).then(function(i){var u=[o.Promise.resolve(i)],l=i.files;if(n.checkCRC32)for(var g=0;g<l.length;g++)u.push(_(l[g]));return o.Promise.all(u)}).then(function(i){for(var u=i.shift(),l=u.files,g=0;g<l.length;g++){var w=l[g],C=w.fileNameStr,N=c.resolve(w.fileNameStr);h.file(N,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:n.createFolders}),w.dir||(h.file(N).unsafeOriginalName=C)}return u.zipComment.length&&(h.comment=u.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(p,S,x){var c=p("../utils"),o=p("../stream/GenericWorker");function r(a,v){o.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(v)}c.inherits(r,o),r.prototype._bindStream=function(a){var v=this;(this._stream=a).pause(),a.on("data",function(y){v.push({data:y,meta:{percent:0}})}).on("error",function(y){v.isPaused?this.generatedError=y:v.error(y)}).on("end",function(){v.isPaused?v._upstreamEnded=!0:v.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)},S.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(p,S,x){var c=p("readable-stream").Readable;function o(r,a,v){c.call(this,a),this._helper=r;var y=this;r.on("data",function(_,b){y.push(_)||y._helper.pause(),v&&v(b)}).on("error",function(_){y.emit("error",_)}).on("end",function(){y.push(null)})}p("../utils").inherits(o,c),o.prototype._read=function(){this._helper.resume()},S.exports=o},{"../utils":32,"readable-stream":16}],14:[function(p,S,x){S.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(p,S,x){function c(N,B,R){var Z,F=r.getTypeOf(B),q=r.extend(R||{},y);q.date=q.date||new Date,q.compression!==null&&(q.compression=q.compression.toUpperCase()),typeof q.unixPermissions=="string"&&(q.unixPermissions=parseInt(q.unixPermissions,8)),q.unixPermissions&&16384&q.unixPermissions&&(q.dir=!0),q.dosPermissions&&16&q.dosPermissions&&(q.dir=!0),q.dir&&(N=l(N)),q.createFolders&&(Z=u(N))&&g.call(this,Z,!0);var ee=F==="string"&&q.binary===!1&&q.base64===!1;R&&R.binary!==void 0||(q.binary=!ee),(B instanceof _&&B.uncompressedSize===0||q.dir||!B||B.length===0)&&(q.base64=!1,q.binary=!0,B="",q.compression="STORE",F="string");var f=null;f=B instanceof _||B instanceof a?B:h.isNode&&h.isStream(B)?new i(N,B):r.prepareContent(N,B,q.binary,q.optimizedBinaryString,q.base64);var I=new b(N,f,q);this.files[N]=I}var o=p("./utf8"),r=p("./utils"),a=p("./stream/GenericWorker"),v=p("./stream/StreamHelper"),y=p("./defaults"),_=p("./compressedObject"),b=p("./zipObject"),n=p("./generate"),h=p("./nodejsUtils"),i=p("./nodejs/NodejsStreamInputAdapter"),u=function(N){N.slice(-1)==="/"&&(N=N.substring(0,N.length-1));var B=N.lastIndexOf("/");return 0<B?N.substring(0,B):""},l=function(N){return N.slice(-1)!=="/"&&(N+="/"),N},g=function(N,B){return B=B!==void 0?B:y.createFolders,N=l(N),this.files[N]||c.call(this,N,null,{dir:!0,createFolders:B}),this.files[N]};function w(N){return Object.prototype.toString.call(N)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(N){var B,R,Z;for(B in this.files)Z=this.files[B],(R=B.slice(this.root.length,B.length))&&B.slice(0,this.root.length)===this.root&&N(R,Z)},filter:function(N){var B=[];return this.forEach(function(R,Z){N(R,Z)&&B.push(Z)}),B},file:function(N,B,R){if(arguments.length!==1)return N=this.root+N,c.call(this,N,B,R),this;if(w(N)){var Z=N;return this.filter(function(q,ee){return!ee.dir&&Z.test(q)})}var F=this.files[this.root+N];return F&&!F.dir?F:null},folder:function(N){if(!N)return this;if(w(N))return this.filter(function(F,q){return q.dir&&N.test(F)});var B=this.root+N,R=g.call(this,B),Z=this.clone();return Z.root=R.name,Z},remove:function(N){N=this.root+N;var B=this.files[N];if(B||(N.slice(-1)!=="/"&&(N+="/"),B=this.files[N]),B&&!B.dir)delete this.files[N];else for(var R=this.filter(function(F,q){return q.name.slice(0,N.length)===N}),Z=0;Z<R.length;Z++)delete this.files[R[Z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(N){var B,R={};try{if((R=r.extend(N||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");r.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var Z=R.comment||this.comment||"";B=n.generateWorker(this,R,Z)}catch(F){(B=new a("error")).error(F)}return new v(B,R.type||"string",R.mimeType)},generateAsync:function(N,B){return this.generateInternalStream(N).accumulate(B)},generateNodeStream:function(N,B){return(N=N||{}).type||(N.type="nodebuffer"),this.generateInternalStream(N).toNodejsStream(B)}};S.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(p,S,x){S.exports=p("stream")},{stream:void 0}],17:[function(p,S,x){var c=p("./DataReader");function o(r){c.call(this,r);for(var a=0;a<this.data.length;a++)r[a]=255&r[a]}p("../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),v=r.charCodeAt(1),y=r.charCodeAt(2),_=r.charCodeAt(3),b=this.length-4;0<=b;--b)if(this.data[b]===a&&this.data[b+1]===v&&this.data[b+2]===y&&this.data[b+3]===_)return b-this.zero;return-1},o.prototype.readAndCheckSignature=function(r){var a=r.charCodeAt(0),v=r.charCodeAt(1),y=r.charCodeAt(2),_=r.charCodeAt(3),b=this.readData(4);return a===b[0]&&v===b[1]&&y===b[2]&&_===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},S.exports=o},{"../utils":32,"./DataReader":18}],18:[function(p,S,x){var c=p("../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,v=0;for(this.checkOffset(r),a=this.index+r-1;a>=this.index;a--)v=(v<<8)+this.byteAt(a);return this.index+=r,v},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))}},S.exports=o},{"../utils":32}],19:[function(p,S,x){var c=p("./Uint8ArrayReader");function o(r){c.call(this,r)}p("../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},S.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(p,S,x){var c=p("./DataReader");function o(r){c.call(this,r)}p("../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},S.exports=o},{"../utils":32,"./DataReader":18}],21:[function(p,S,x){var c=p("./ArrayReader");function o(r){c.call(this,r)}p("../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},S.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(p,S,x){var c=p("../utils"),o=p("../support"),r=p("./ArrayReader"),a=p("./StringReader"),v=p("./NodeBufferReader"),y=p("./Uint8ArrayReader");S.exports=function(_){var b=c.getTypeOf(_);return c.checkSupport(b),b!=="string"||o.uint8array?b==="nodebuffer"?new v(_):o.uint8array?new y(c.transformTo("uint8array",_)):new r(c.transformTo("array",_)):new a(_)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(p,S,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(p,S,x){var c=p("./GenericWorker"),o=p("../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})},S.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(p,S,x){var c=p("./GenericWorker"),o=p("../crc32");function r(){c.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}p("../utils").inherits(r,c),r.prototype.processChunk=function(a){this.streamInfo.crc32=o(a.data,this.streamInfo.crc32||0),this.push(a)},S.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(p,S,x){var c=p("../utils"),o=p("./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 v=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=v+a.data.length}o.prototype.processChunk.call(this,a)},S.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(p,S,x){var c=p("../utils"),o=p("./GenericWorker");function r(a){o.call(this,"DataWorker");var v=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(y){v.dataIsReady=!0,v.data=y,v.max=y&&y.length||0,v.type=c.getTypeOf(y),v.isPaused||v._tickAndRepeat()},function(y){v.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,v=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,v);break;case"uint8array":a=this.data.subarray(this.index,v);break;case"array":case"nodebuffer":a=this.data.slice(this.index,v)}return this.index=v,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},S.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(p,S,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}},S.exports=c},{}],29:[function(p,S,x){var c=p("../utils"),o=p("./ConvertWorker"),r=p("./GenericWorker"),a=p("../base64"),v=p("../support"),y=p("../external"),_=null;if(v.nodestream)try{_=p("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(h,i){return new y.Promise(function(u,l){var g=[],w=h._internalType,C=h._outputType,N=h._mimeType;h.on("data",function(B,R){g.push(B),i&&i(R)}).on("error",function(B){g=[],l(B)}).on("end",function(){try{var B=(function(R,Z,F){switch(R){case"blob":return c.newBlob(c.transformTo("arraybuffer",Z),F);case"base64":return a.encode(Z);default:return c.transformTo(R,Z)}})(C,(function(R,Z){var F,q=0,ee=null,f=0;for(F=0;F<Z.length;F++)f+=Z[F].length;switch(R){case"string":return Z.join("");case"array":return Array.prototype.concat.apply([],Z);case"uint8array":for(ee=new Uint8Array(f),F=0;F<Z.length;F++)ee.set(Z[F],q),q+=Z[F].length;return ee;case"nodebuffer":return Buffer.concat(Z);default:throw new Error("concat : unsupported type '"+R+"'")}})(w,g),N);u(B)}catch(R){l(R)}g=[]}).resume()})}function n(h,i,u){var l=i;switch(i){case"blob":case"arraybuffer":l="uint8array";break;case"base64":l="string"}try{this._internalType=l,this._outputType=i,this._mimeType=u,c.checkSupport(l),this._worker=h.pipe(new o(l)),h.lock()}catch(g){this._worker=new r("error"),this._worker.error(g)}}n.prototype={accumulate:function(h){return b(this,h)},on:function(h,i){var u=this;return h==="data"?this._worker.on(h,function(l){i.call(u,l.data,l.meta)}):this._worker.on(h,function(){c.delay(i,arguments,u)}),this},resume:function(){return c.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(c.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new _(this,{objectMode:this._outputType!=="nodebuffer"},h)}},S.exports=n},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(p,S,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=!!p("readable-stream").Readable}catch{x.nodestream=!1}},{"readable-stream":16}],31:[function(p,S,x){for(var c=p("./utils"),o=p("./support"),r=p("./nodejsUtils"),a=p("./stream/GenericWorker"),v=new Array(256),y=0;y<256;y++)v[y]=252<=y?6:248<=y?5:240<=y?4:224<=y?3:192<=y?2:1;v[254]=v[254]=1;function _(){a.call(this,"utf-8 decode"),this.leftOver=null}function b(){a.call(this,"utf-8 encode")}x.utf8encode=function(n){return o.nodebuffer?r.newBufferFrom(n,"utf-8"):(function(h){var i,u,l,g,w,C=h.length,N=0;for(g=0;g<C;g++)(64512&(u=h.charCodeAt(g)))==55296&&g+1<C&&(64512&(l=h.charCodeAt(g+1)))==56320&&(u=65536+(u-55296<<10)+(l-56320),g++),N+=u<128?1:u<2048?2:u<65536?3:4;for(i=o.uint8array?new Uint8Array(N):new Array(N),g=w=0;w<N;g++)(64512&(u=h.charCodeAt(g)))==55296&&g+1<C&&(64512&(l=h.charCodeAt(g+1)))==56320&&(u=65536+(u-55296<<10)+(l-56320),g++),u<128?i[w++]=u:(u<2048?i[w++]=192|u>>>6:(u<65536?i[w++]=224|u>>>12:(i[w++]=240|u>>>18,i[w++]=128|u>>>12&63),i[w++]=128|u>>>6&63),i[w++]=128|63&u);return i})(n)},x.utf8decode=function(n){return o.nodebuffer?c.transformTo("nodebuffer",n).toString("utf-8"):(function(h){var i,u,l,g,w=h.length,C=new Array(2*w);for(i=u=0;i<w;)if((l=h[i++])<128)C[u++]=l;else if(4<(g=v[l]))C[u++]=65533,i+=g-1;else{for(l&=g===2?31:g===3?15:7;1<g&&i<w;)l=l<<6|63&h[i++],g--;1<g?C[u++]=65533:l<65536?C[u++]=l:(l-=65536,C[u++]=55296|l>>10&1023,C[u++]=56320|1023&l)}return C.length!==u&&(C.subarray?C=C.subarray(0,u):C.length=u),c.applyFromCharCode(C)})(n=c.transformTo(o.uint8array?"uint8array":"array",n))},c.inherits(_,a),_.prototype.processChunk=function(n){var h=c.transformTo(o.uint8array?"uint8array":"array",n.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var i=h;(h=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),h.set(i,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var u=(function(g,w){var C;for((w=w||g.length)>g.length&&(w=g.length),C=w-1;0<=C&&(192&g[C])==128;)C--;return C<0||C===0?w:C+v[g[C]]>w?C:w})(h),l=h;u!==h.length&&(o.uint8array?(l=h.subarray(0,u),this.leftOver=h.subarray(u,h.length)):(l=h.slice(0,u),this.leftOver=h.slice(u,h.length))),this.push({data:x.utf8decode(l),meta:n.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:x.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},x.Utf8DecodeWorker=_,c.inherits(b,a),b.prototype.processChunk=function(n){this.push({data:x.utf8encode(n.data),meta:n.meta})},x.Utf8EncodeWorker=b},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(p,S,x){var c=p("./support"),o=p("./base64"),r=p("./nodejsUtils"),a=p("./external");function v(i){return i}function y(i,u){for(var l=0;l<i.length;++l)u[l]=255&i.charCodeAt(l);return u}p("setimmediate"),x.newBlob=function(i,u){x.checkSupport("blob");try{return new Blob([i],{type:u})}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return l.append(i),l.getBlob(u)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(i,u,l){var g=[],w=0,C=i.length;if(C<=l)return String.fromCharCode.apply(null,i);for(;w<C;)u==="array"||u==="nodebuffer"?g.push(String.fromCharCode.apply(null,i.slice(w,Math.min(w+l,C)))):g.push(String.fromCharCode.apply(null,i.subarray(w,Math.min(w+l,C)))),w+=l;return g.join("")},stringifyByChar:function(i){for(var u="",l=0;l<i.length;l++)u+=String.fromCharCode(i[l]);return u},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(i){var u=65536,l=x.getTypeOf(i),g=!0;if(l==="uint8array"?g=_.applyCanBeUsed.uint8array:l==="nodebuffer"&&(g=_.applyCanBeUsed.nodebuffer),g)for(;1<u;)try{return _.stringifyByChunk(i,l,u)}catch{u=Math.floor(u/2)}return _.stringifyByChar(i)}function n(i,u){for(var l=0;l<i.length;l++)u[l]=i[l];return u}x.applyFromCharCode=b;var h={};h.string={string:v,array:function(i){return y(i,new Array(i.length))},arraybuffer:function(i){return h.string.uint8array(i).buffer},uint8array:function(i){return y(i,new Uint8Array(i.length))},nodebuffer:function(i){return y(i,r.allocBuffer(i.length))}},h.array={string:b,array:v,arraybuffer:function(i){return new Uint8Array(i).buffer},uint8array:function(i){return new Uint8Array(i)},nodebuffer:function(i){return r.newBufferFrom(i)}},h.arraybuffer={string:function(i){return b(new Uint8Array(i))},array:function(i){return n(new Uint8Array(i),new Array(i.byteLength))},arraybuffer:v,uint8array:function(i){return new Uint8Array(i)},nodebuffer:function(i){return r.newBufferFrom(new Uint8Array(i))}},h.uint8array={string:b,array:function(i){return n(i,new Array(i.length))},arraybuffer:function(i){return i.buffer},uint8array:v,nodebuffer:function(i){return r.newBufferFrom(i)}},h.nodebuffer={string:b,array:function(i){return n(i,new Array(i.length))},arraybuffer:function(i){return h.nodebuffer.uint8array(i).buffer},uint8array:function(i){return n(i,new Uint8Array(i.length))},nodebuffer:v},x.transformTo=function(i,u){if(u=u||"",!i)return u;x.checkSupport(i);var l=x.getTypeOf(u);return h[l][i](u)},x.resolve=function(i){for(var u=i.split("/"),l=[],g=0;g<u.length;g++){var w=u[g];w==="."||w===""&&g!==0&&g!==u.length-1||(w===".."?l.pop():l.push(w))}return l.join("/")},x.getTypeOf=function(i){return typeof i=="string"?"string":Object.prototype.toString.call(i)==="[object Array]"?"array":c.nodebuffer&&r.isBuffer(i)?"nodebuffer":c.uint8array&&i instanceof Uint8Array?"uint8array":c.arraybuffer&&i instanceof ArrayBuffer?"arraybuffer":void 0},x.checkSupport=function(i){if(!c[i.toLowerCase()])throw new Error(i+" is not supported by this platform")},x.MAX_VALUE_16BITS=65535,x.MAX_VALUE_32BITS=-1,x.pretty=function(i){var u,l,g="";for(l=0;l<(i||"").length;l++)g+="\\x"+((u=i.charCodeAt(l))<16?"0":"")+u.toString(16).toUpperCase();return g},x.delay=function(i,u,l){setImmediate(function(){i.apply(l||null,u||[])})},x.inherits=function(i,u){function l(){}l.prototype=u.prototype,i.prototype=new l},x.extend=function(){var i,u,l={};for(i=0;i<arguments.length;i++)for(u in arguments[i])Object.prototype.hasOwnProperty.call(arguments[i],u)&&l[u]===void 0&&(l[u]=arguments[i][u]);return l},x.prepareContent=function(i,u,l,g,w){return a.Promise.resolve(u).then(function(C){return c.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new a.Promise(function(N,B){var R=new FileReader;R.onload=function(Z){N(Z.target.result)},R.onerror=function(Z){B(Z.target.error)},R.readAsArrayBuffer(C)}):C}).then(function(C){var N=x.getTypeOf(C);return N?(N==="arraybuffer"?C=x.transformTo("uint8array",C):N==="string"&&(w?C=o.decode(C):l&&g!==!0&&(C=(function(B){return y(B,c.uint8array?new Uint8Array(B.length):new Array(B.length))})(C))),C):a.Promise.reject(new Error("Can't read the data of '"+i+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(p,S,x){var c=p("./reader/readerFor"),o=p("./utils"),r=p("./signature"),a=p("./zipEntry"),v=p("./support");function y(_){this.files=[],this.loadOptions=_}y.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){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(_)+")")}},isSignature:function(_,b){var n=this.reader.index;this.reader.setIndex(_);var h=this.reader.readString(4)===b;return this.reader.setIndex(n),h},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 _=this.reader.readData(this.zipCommentLength),b=v.uint8array?"uint8array":"array",n=o.transformTo(b,_);this.zipComment=this.loadOptions.decodeFileName(n)},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 _,b,n,h=this.zip64EndOfCentralSize-44;0<h;)_=this.reader.readInt(2),b=this.reader.readInt(4),n=this.reader.readData(b),this.zip64ExtensibleData[_]={id:_,length:b,value:n}},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 _,b;for(_=0;_<this.files.length;_++)b=this.files[_],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(_=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);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 _=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(_<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(_);var b=_;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,(_=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(_),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 n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var h=b-n;if(0<h)this.isSignature(b,r.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(_){this.reader=c(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},S.exports=y},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(p,S,x){var c=p("./reader/readerFor"),o=p("./utils"),r=p("./compressedObject"),a=p("./crc32"),v=p("./utf8"),y=p("./compressions"),_=p("./support");function b(n,h){this.options=n,this.loadOptions=h}b.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(n){var h,i;if(n.skip(22),this.fileNameLength=n.readInt(2),i=n.readInt(2),this.fileName=n.readData(this.fileNameLength),n.skip(i),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((h=(function(u){for(var l in y)if(Object.prototype.hasOwnProperty.call(y,l)&&y[l].magic===u)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,h,n.readData(this.compressedSize))},readCentralPart:function(n){this.versionMadeBy=n.readInt(2),n.skip(2),this.bitFlag=n.readInt(2),this.compressionMethod=n.readString(2),this.date=n.readDate(),this.crc32=n.readInt(4),this.compressedSize=n.readInt(4),this.uncompressedSize=n.readInt(4);var h=n.readInt(2);if(this.extraFieldsLength=n.readInt(2),this.fileCommentLength=n.readInt(2),this.diskNumberStart=n.readInt(2),this.internalFileAttributes=n.readInt(2),this.externalFileAttributes=n.readInt(4),this.localHeaderOffset=n.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");n.skip(h),this.readExtraFields(n),this.parseZIP64ExtraField(n),this.fileComment=n.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var n=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),n==0&&(this.dosPermissions=63&this.externalFileAttributes),n==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var n=c(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=n.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=n.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=n.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=n.readInt(4))}},readExtraFields:function(n){var h,i,u,l=n.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});n.index+4<l;)h=n.readInt(2),i=n.readInt(2),u=n.readData(i),this.extraFields[h]={id:h,length:i,value:u};n.setIndex(l)},handleUTF8:function(){var n=_.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=v.utf8decode(this.fileName),this.fileCommentStr=v.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var i=o.transformTo(n,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var u=this.findExtraFieldUnicodeComment();if(u!==null)this.fileCommentStr=u;else{var l=o.transformTo(n,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(l)}}},findExtraFieldUnicodePath:function(){var n=this.extraFields[28789];if(n){var h=c(n.value);return h.readInt(1)!==1||a(this.fileName)!==h.readInt(4)?null:v.utf8decode(h.readData(n.length-5))}return null},findExtraFieldUnicodeComment:function(){var n=this.extraFields[25461];if(n){var h=c(n.value);return h.readInt(1)!==1||a(this.fileComment)!==h.readInt(4)?null:v.utf8decode(h.readData(n.length-5))}return null}},S.exports=b},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(p,S,x){function c(h,i,u){this.name=h,this.dir=u.dir,this.date=u.date,this.comment=u.comment,this.unixPermissions=u.unixPermissions,this.dosPermissions=u.dosPermissions,this._data=i,this._dataBinary=u.binary,this.options={compression:u.compression,compressionOptions:u.compressionOptions}}var o=p("./stream/StreamHelper"),r=p("./stream/DataWorker"),a=p("./utf8"),v=p("./compressedObject"),y=p("./stream/GenericWorker");c.prototype={internalStream:function(h){var i=null,u="string";try{if(!h)throw new Error("No output type specified.");var l=(u=h.toLowerCase())==="string"||u==="text";u!=="binarystring"&&u!=="text"||(u="string"),i=this._decompressWorker();var g=!this._dataBinary;g&&!l&&(i=i.pipe(new a.Utf8EncodeWorker)),!g&&l&&(i=i.pipe(new a.Utf8DecodeWorker))}catch(w){(i=new y("error")).error(w)}return new o(i,u,"")},async:function(h,i){return this.internalStream(h).accumulate(i)},nodeStream:function(h,i){return this.internalStream(h||"nodebuffer").toNodejsStream(i)},_compressWorker:function(h,i){if(this._data instanceof v&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var u=this._decompressWorker();return this._dataBinary||(u=u.pipe(new a.Utf8EncodeWorker)),v.createWorkerFrom(u,h,i)},_decompressWorker:function(){return this._data instanceof v?this._data.getContentWorker():this._data instanceof y?this._data:new r(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],b=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},n=0;n<_.length;n++)c.prototype[_[n]]=b;S.exports=c},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(p,S,x){(function(c){var o,r,a=c.MutationObserver||c.WebKitMutationObserver;if(a){var v=0,y=new a(h),_=c.document.createTextNode("");y.observe(_,{characterData:!0}),o=function(){_.data=v=++v%2}}else if(c.setImmediate||c.MessageChannel===void 0)o="document"in c&&"onreadystatechange"in c.document.createElement("script")?function(){var i=c.document.createElement("script");i.onreadystatechange=function(){h(),i.onreadystatechange=null,i.parentNode.removeChild(i),i=null},c.document.documentElement.appendChild(i)}:function(){setTimeout(h,0)};else{var b=new c.MessageChannel;b.port1.onmessage=h,o=function(){b.port2.postMessage(0)}}var n=[];function h(){var i,u;r=!0;for(var l=n.length;l;){for(u=n,n=[],i=-1;++i<l;)u[i]();l=n.length}r=!1}S.exports=function(i){n.push(i)!==1||r||o()}}).call(this,typeof Ze<"u"?Ze:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(p,S,x){var c=p("immediate");function o(){}var r={},a=["REJECTED"],v=["FULFILLED"],y=["PENDING"];function _(l){if(typeof l!="function")throw new TypeError("resolver must be a function");this.state=y,this.queue=[],this.outcome=void 0,l!==o&&i(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 n(l,g,w){c(function(){var C;try{C=g(w)}catch(N){return r.reject(l,N)}C===l?r.reject(l,new TypeError("Cannot resolve promise with itself")):r.resolve(l,C)})}function h(l){var g=l&&l.then;if(l&&(typeof l=="object"||typeof l=="function")&&typeof g=="function")return function(){g.apply(l,arguments)}}function i(l,g){var w=!1;function C(R){w||(w=!0,r.reject(l,R))}function N(R){w||(w=!0,r.resolve(l,R))}var B=u(function(){g(N,C)});B.status==="error"&&C(B.value)}function u(l,g){var w={};try{w.value=l(g),w.status="success"}catch(C){w.status="error",w.value=C}return w}(S.exports=_).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})})},_.prototype.catch=function(l){return this.then(null,l)},_.prototype.then=function(l,g){if(typeof l!="function"&&this.state===v||typeof g!="function"&&this.state===a)return this;var w=new this.constructor(o);return this.state!==y?n(w,this.state===v?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){n(this.promise,this.onFulfilled,l)},b.prototype.callRejected=function(l){r.reject(this.promise,l)},b.prototype.otherCallRejected=function(l){n(this.promise,this.onRejected,l)},r.resolve=function(l,g){var w=u(h,g);if(w.status==="error")return r.reject(l,w.value);var C=w.value;if(C)i(l,C);else{l.state=v,l.outcome=g;for(var N=-1,B=l.queue.length;++N<B;)l.queue[N].callFulfilled(g)}return l},r.reject=function(l,g){l.state=a,l.outcome=g;for(var w=-1,C=l.queue.length;++w<C;)l.queue[w].callRejected(g);return l},_.resolve=function(l){return l instanceof this?l:r.resolve(new this(o),l)},_.reject=function(l){var g=new this(o);return r.reject(g,l)},_.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,C=!1;if(!w)return this.resolve([]);for(var N=new Array(w),B=0,R=-1,Z=new this(o);++R<w;)F(l[R],R);return Z;function F(q,ee){g.resolve(q).then(function(f){N[ee]=f,++B!==w||C||(C=!0,r.resolve(Z,N))},function(f){C||(C=!0,r.reject(Z,f))})}},_.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,C=!1;if(!w)return this.resolve([]);for(var N=-1,B=new this(o);++N<w;)R=l[N],g.resolve(R).then(function(Z){C||(C=!0,r.resolve(B,Z))},function(Z){C||(C=!0,r.reject(B,Z))});var R;return B}},{immediate:36}],38:[function(p,S,x){var c={};(0,p("./lib/utils/common").assign)(c,p("./lib/deflate"),p("./lib/inflate"),p("./lib/zlib/constants")),S.exports=c},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(p,S,x){var c=p("./zlib/deflate"),o=p("./utils/common"),r=p("./utils/strings"),a=p("./zlib/messages"),v=p("./zlib/zstream"),y=Object.prototype.toString,_=0,b=-1,n=0,h=8;function i(l){if(!(this instanceof i))return new i(l);this.options=o.assign({level:b,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:n,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 v,this.strm.avail_out=0;var w=c.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(w!==_)throw new Error(a[w]);if(g.header&&c.deflateSetHeader(this.strm,g.header),g.dictionary){var C;if(C=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,C))!==_)throw new Error(a[w]);this._dict_set=!0}}function u(l,g){var w=new i(g);if(w.push(l,!0),w.err)throw w.msg||a[w.err];return w.result}i.prototype.push=function(l,g){var w,C,N=this.strm,B=this.options.chunkSize;if(this.ended)return!1;C=g===~~g?g:g===!0?4:0,typeof l=="string"?N.input=r.string2buf(l):y.call(l)==="[object ArrayBuffer]"?N.input=new Uint8Array(l):N.input=l,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new o.Buf8(B),N.next_out=0,N.avail_out=B),(w=c.deflate(N,C))!==1&&w!==_)return this.onEnd(w),!(this.ended=!0);N.avail_out!==0&&(N.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(o.shrinkBuf(N.output,N.next_out))):this.onData(o.shrinkBuf(N.output,N.next_out)))}while((0<N.avail_in||N.avail_out===0)&&w!==1);return C===4?(w=c.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===_):C!==2||(this.onEnd(_),!(N.avail_out=0))},i.prototype.onData=function(l){this.chunks.push(l)},i.prototype.onEnd=function(l){l===_&&(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=i,x.deflate=u,x.deflateRaw=function(l,g){return(g=g||{}).raw=!0,u(l,g)},x.gzip=function(l,g){return(g=g||{}).gzip=!0,u(l,g)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(p,S,x){var c=p("./zlib/inflate"),o=p("./utils/common"),r=p("./utils/strings"),a=p("./zlib/constants"),v=p("./zlib/messages"),y=p("./zlib/zstream"),_=p("./zlib/gzheader"),b=Object.prototype.toString;function n(i){if(!(this instanceof n))return new n(i);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},i||{});var u=this.options;u.raw&&0<=u.windowBits&&u.windowBits<16&&(u.windowBits=-u.windowBits,u.windowBits===0&&(u.windowBits=-15)),!(0<=u.windowBits&&u.windowBits<16)||i&&i.windowBits||(u.windowBits+=32),15<u.windowBits&&u.windowBits<48&&(15&u.windowBits)==0&&(u.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,u.windowBits);if(l!==a.Z_OK)throw new Error(v[l]);this.header=new _,c.inflateGetHeader(this.strm,this.header)}function h(i,u){var l=new n(u);if(l.push(i,!0),l.err)throw l.msg||v[l.err];return l.result}n.prototype.push=function(i,u){var l,g,w,C,N,B,R=this.strm,Z=this.options.chunkSize,F=this.options.dictionary,q=!1;if(this.ended)return!1;g=u===~~u?u:u===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof i=="string"?R.input=r.binstring2buf(i):b.call(i)==="[object ArrayBuffer]"?R.input=new Uint8Array(i):R.input=i,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new o.Buf8(Z),R.next_out=0,R.avail_out=Z),(l=c.inflate(R,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&F&&(B=typeof F=="string"?r.string2buf(F):b.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,l=c.inflateSetDictionary(this.strm,B)),l===a.Z_BUF_ERROR&&q===!0&&(l=a.Z_OK,q=!1),l!==a.Z_STREAM_END&&l!==a.Z_OK)return this.onEnd(l),!(this.ended=!0);R.next_out&&(R.avail_out!==0&&l!==a.Z_STREAM_END&&(R.avail_in!==0||g!==a.Z_FINISH&&g!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=r.utf8border(R.output,R.next_out),C=R.next_out-w,N=r.buf2string(R.output,w),R.next_out=C,R.avail_out=Z-C,C&&o.arraySet(R.output,R.output,w,C,0),this.onData(N)):this.onData(o.shrinkBuf(R.output,R.next_out)))),R.avail_in===0&&R.avail_out===0&&(q=!0)}while((0<R.avail_in||R.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),!(R.avail_out=0))},n.prototype.onData=function(i){this.chunks.push(i)},n.prototype.onEnd=function(i){i===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg},x.Inflate=n,x.inflate=h,x.inflateRaw=function(i,u){return(u=u||{}).raw=!0,h(i,u)},x.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(p,S,x){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";x.assign=function(a){for(var v=Array.prototype.slice.call(arguments,1);v.length;){var y=v.shift();if(y){if(typeof y!="object")throw new TypeError(y+"must be non-object");for(var _ in y)y.hasOwnProperty(_)&&(a[_]=y[_])}}return a},x.shrinkBuf=function(a,v){return a.length===v?a:a.subarray?a.subarray(0,v):(a.length=v,a)};var o={arraySet:function(a,v,y,_,b){if(v.subarray&&a.subarray)a.set(v.subarray(y,y+_),b);else for(var n=0;n<_;n++)a[b+n]=v[y+n]},flattenChunks:function(a){var v,y,_,b,n,h;for(v=_=0,y=a.length;v<y;v++)_+=a[v].length;for(h=new Uint8Array(_),v=b=0,y=a.length;v<y;v++)n=a[v],h.set(n,b),b+=n.length;return h}},r={arraySet:function(a,v,y,_,b){for(var n=0;n<_;n++)a[b+n]=v[y+n]},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(p,S,x){var c=p("./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),v=0;v<256;v++)a[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;function y(_,b){if(b<65537&&(_.subarray&&r||!_.subarray&&o))return String.fromCharCode.apply(null,c.shrinkBuf(_,b));for(var n="",h=0;h<b;h++)n+=String.fromCharCode(_[h]);return n}a[254]=a[254]=1,x.string2buf=function(_){var b,n,h,i,u,l=_.length,g=0;for(i=0;i<l;i++)(64512&(n=_.charCodeAt(i)))==55296&&i+1<l&&(64512&(h=_.charCodeAt(i+1)))==56320&&(n=65536+(n-55296<<10)+(h-56320),i++),g+=n<128?1:n<2048?2:n<65536?3:4;for(b=new c.Buf8(g),i=u=0;u<g;i++)(64512&(n=_.charCodeAt(i)))==55296&&i+1<l&&(64512&(h=_.charCodeAt(i+1)))==56320&&(n=65536+(n-55296<<10)+(h-56320),i++),n<128?b[u++]=n:(n<2048?b[u++]=192|n>>>6:(n<65536?b[u++]=224|n>>>12:(b[u++]=240|n>>>18,b[u++]=128|n>>>12&63),b[u++]=128|n>>>6&63),b[u++]=128|63&n);return b},x.buf2binstring=function(_){return y(_,_.length)},x.binstring2buf=function(_){for(var b=new c.Buf8(_.length),n=0,h=b.length;n<h;n++)b[n]=_.charCodeAt(n);return b},x.buf2string=function(_,b){var n,h,i,u,l=b||_.length,g=new Array(2*l);for(n=h=0;n<l;)if((i=_[n++])<128)g[h++]=i;else if(4<(u=a[i]))g[h++]=65533,n+=u-1;else{for(i&=u===2?31:u===3?15:7;1<u&&n<l;)i=i<<6|63&_[n++],u--;1<u?g[h++]=65533:i<65536?g[h++]=i:(i-=65536,g[h++]=55296|i>>10&1023,g[h++]=56320|1023&i)}return y(g,h)},x.utf8border=function(_,b){var n;for((b=b||_.length)>_.length&&(b=_.length),n=b-1;0<=n&&(192&_[n])==128;)n--;return n<0||n===0?b:n+a[_[n]]>b?n:b}},{"./common":41}],43:[function(p,S,x){S.exports=function(c,o,r,a){for(var v=65535&c|0,y=c>>>16&65535|0,_=0;r!==0;){for(r-=_=2e3<r?2e3:r;y=y+(v=v+o[a++]|0)|0,--_;);v%=65521,y%=65521}return v|y<<16|0}},{}],44:[function(p,S,x){S.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(p,S,x){var c=(function(){for(var o,r=[],a=0;a<256;a++){o=a;for(var v=0;v<8;v++)o=1&o?3988292384^o>>>1:o>>>1;r[a]=o}return r})();S.exports=function(o,r,a,v){var y=c,_=v+a;o^=-1;for(var b=v;b<_;b++)o=o>>>8^y[255&(o^r[b])];return-1^o}},{}],46:[function(p,S,x){var c,o=p("../utils/common"),r=p("./trees"),a=p("./adler32"),v=p("./crc32"),y=p("./messages"),_=0,b=4,n=0,h=-2,i=-1,u=4,l=2,g=8,w=9,C=286,N=30,B=19,R=2*C+1,Z=15,F=3,q=258,ee=q+F+1,f=42,I=113,t=1,D=2,X=3,L=4;function ie(e,T){return e.msg=y[T],T}function W(e){return(e<<1)-(4<e?9:0)}function re(e){for(var T=e.length;0<=--T;)e[T]=0}function z(e){var T=e.state,O=T.pending;O>e.avail_out&&(O=e.avail_out),O!==0&&(o.arraySet(e.output,T.pending_buf,T.pending_out,O,e.next_out),e.next_out+=O,T.pending_out+=O,e.total_out+=O,e.avail_out-=O,T.pending-=O,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 ne(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 G(e,T){var O,m,d=e.max_chain_length,j=e.strstart,P=e.prev_length,U=e.nice_match,A=e.strstart>e.w_size-ee?e.strstart-(e.w_size-ee):0,$=e.window,Y=e.w_mask,H=e.prev,te=e.strstart+q,ce=$[j+P-1],oe=$[j+P];e.prev_length>=e.good_match&&(d>>=2),U>e.lookahead&&(U=e.lookahead);do if($[(O=T)+P]===oe&&$[O+P-1]===ce&&$[O]===$[j]&&$[++O]===$[j+1]){j+=2,O++;do;while($[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&$[++j]===$[++O]&&j<te);if(m=q-(te-j),j=te-q,P<m){if(e.match_start=T,U<=(P=m))break;ce=$[j+P-1],oe=$[j+P]}}while((T=H[T&Y])>A&&--d!=0);return P<=e.lookahead?P:e.lookahead}function de(e){var T,O,m,d,j,P,U,A,$,Y,H=e.w_size;do{if(d=e.window_size-e.lookahead-e.strstart,e.strstart>=H+(H-ee)){for(o.arraySet(e.window,e.window,H,H,0),e.match_start-=H,e.strstart-=H,e.block_start-=H,T=O=e.hash_size;m=e.head[--T],e.head[T]=H<=m?m-H:0,--O;);for(T=O=H;m=e.prev[--T],e.prev[T]=H<=m?m-H:0,--O;);d+=H}if(e.strm.avail_in===0)break;if(P=e.strm,U=e.window,A=e.strstart+e.lookahead,$=d,Y=void 0,Y=P.avail_in,$<Y&&(Y=$),O=Y===0?0:(P.avail_in-=Y,o.arraySet(U,P.input,P.next_in,Y,A),P.state.wrap===1?P.adler=a(P.adler,U,Y,A):P.state.wrap===2&&(P.adler=v(P.adler,U,Y,A)),P.next_in+=Y,P.total_in+=Y,Y),e.lookahead+=O,e.lookahead+e.insert>=F)for(j=e.strstart-e.insert,e.ins_h=e.window[j],e.ins_h=(e.ins_h<<e.hash_shift^e.window[j+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[j+F-1])&e.hash_mask,e.prev[j&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=j,j++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<ee&&e.strm.avail_in!==0)}function xe(e,T){for(var O,m;;){if(e.lookahead<ee){if(de(e),e.lookahead<ee&&T===_)return t;if(e.lookahead===0)break}if(O=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,O=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),O!==0&&e.strstart-O<=e.w_size-ee&&(e.match_length=G(e,O)),e.match_length>=F)if(m=r._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,O=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 m=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(m&&(E(e,!1),e.strm.avail_out===0))return t}return e.insert=e.strstart<F-1?e.strstart:F-1,T===b?(E(e,!0),e.strm.avail_out===0?X:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:D}function ae(e,T){for(var O,m,d;;){if(e.lookahead<ee){if(de(e),e.lookahead<ee&&T===_)return t;if(e.lookahead===0)break}if(O=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,O=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=F-1,O!==0&&e.prev_length<e.max_lazy_match&&e.strstart-O<=e.w_size-ee&&(e.match_length=G(e,O),e.match_length<=5&&(e.strategy===1||e.match_length===F&&4096<e.strstart-e.match_start)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){for(d=e.strstart+e.lookahead-F,m=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),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+F-1])&e.hash_mask,O=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=F-1,e.strstart++,m&&(E(e,!1),e.strm.avail_out===0))return t}else if(e.match_available){if((m=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&&(m=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,T===b?(E(e,!0),e.strm.avail_out===0?X:L):e.last_lit&&(E(e,!1),e.strm.avail_out===0)?t:D}function le(e,T,O,m,d){this.good_length=e,this.max_lazy=T,this.nice_length=O,this.max_chain=m,this.func=d}function me(){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*R),this.dyn_dtree=new o.Buf16(2*(2*N+1)),this.bl_tree=new o.Buf16(2*(2*B+1)),re(this.dyn_ltree),re(this.dyn_dtree),re(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(Z+1),this.heap=new o.Buf16(2*C+1),re(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*C+1),re(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 pe(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?f:I,e.adler=T.wrap===2?0:1,T.last_flush=_,r._tr_init(T),n):ie(e,h)}function be(e){var T=pe(e);return T===n&&(function(O){O.window_size=2*O.w_size,re(O.head),O.max_lazy_match=c[O.level].max_lazy,O.good_match=c[O.level].good_length,O.nice_match=c[O.level].nice_length,O.max_chain_length=c[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=F-1,O.match_available=0,O.ins_h=0})(e.state),T}function we(e,T,O,m,d,j){if(!e)return h;var P=1;if(T===i&&(T=6),m<0?(P=0,m=-m):15<m&&(P=2,m-=16),d<1||w<d||O!==g||m<8||15<m||T<0||9<T||j<0||u<j)return ie(e,h);m===8&&(m=9);var U=new me;return(e.state=U).strm=e,U.wrap=P,U.gzhead=null,U.w_bits=m,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+F-1)/F),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=j,U.method=O,be(e)}c=[new le(0,0,0,0,function(e,T){var O=65535;for(O>e.pending_buf_size-5&&(O=e.pending_buf_size-5);;){if(e.lookahead<=1){if(de(e),e.lookahead===0&&T===_)return t;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var m=e.block_start+O;if((e.strstart===0||e.strstart>=m)&&(e.lookahead=e.strstart-m,e.strstart=m,E(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-ee&&(E(e,!1),e.strm.avail_out===0))return t}return e.insert=0,T===b?(E(e,!0),e.strm.avail_out===0?X:L):(e.strstart>e.block_start&&(E(e,!1),e.strm.avail_out),t)}),new le(4,4,8,4,xe),new le(4,5,16,8,xe),new le(4,6,32,32,xe),new le(4,4,16,16,ae),new le(8,16,32,32,ae),new le(8,16,128,128,ae),new le(8,32,128,256,ae),new le(32,128,258,1024,ae),new le(32,258,258,4096,ae)],x.deflateInit=function(e,T){return we(e,T,g,15,8,0)},x.deflateInit2=we,x.deflateReset=be,x.deflateResetKeep=pe,x.deflateSetHeader=function(e,T){return e&&e.state?e.state.wrap!==2?h:(e.state.gzhead=T,n):h},x.deflate=function(e,T){var O,m,d,j;if(!e||!e.state||5<T||T<0)return e?ie(e,h):h;if(m=e.state,!e.output||!e.input&&e.avail_in!==0||m.status===666&&T!==b)return ie(e,e.avail_out===0?-5:h);if(m.strm=e,O=m.last_flush,m.last_flush=T,m.status===f)if(m.wrap===2)e.adler=0,ne(m,31),ne(m,139),ne(m,8),m.gzhead?(ne(m,(m.gzhead.text?1:0)+(m.gzhead.hcrc?2:0)+(m.gzhead.extra?4:0)+(m.gzhead.name?8:0)+(m.gzhead.comment?16:0)),ne(m,255&m.gzhead.time),ne(m,m.gzhead.time>>8&255),ne(m,m.gzhead.time>>16&255),ne(m,m.gzhead.time>>24&255),ne(m,m.level===9?2:2<=m.strategy||m.level<2?4:0),ne(m,255&m.gzhead.os),m.gzhead.extra&&m.gzhead.extra.length&&(ne(m,255&m.gzhead.extra.length),ne(m,m.gzhead.extra.length>>8&255)),m.gzhead.hcrc&&(e.adler=v(e.adler,m.pending_buf,m.pending,0)),m.gzindex=0,m.status=69):(ne(m,0),ne(m,0),ne(m,0),ne(m,0),ne(m,0),ne(m,m.level===9?2:2<=m.strategy||m.level<2?4:0),ne(m,3),m.status=I);else{var P=g+(m.w_bits-8<<4)<<8;P|=(2<=m.strategy||m.level<2?0:m.level<6?1:m.level===6?2:3)<<6,m.strstart!==0&&(P|=32),P+=31-P%31,m.status=I,K(m,P),m.strstart!==0&&(K(m,e.adler>>>16),K(m,65535&e.adler)),e.adler=1}if(m.status===69)if(m.gzhead.extra){for(d=m.pending;m.gzindex<(65535&m.gzhead.extra.length)&&(m.pending!==m.pending_buf_size||(m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),z(e),d=m.pending,m.pending!==m.pending_buf_size));)ne(m,255&m.gzhead.extra[m.gzindex]),m.gzindex++;m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),m.gzindex===m.gzhead.extra.length&&(m.gzindex=0,m.status=73)}else m.status=73;if(m.status===73)if(m.gzhead.name){d=m.pending;do{if(m.pending===m.pending_buf_size&&(m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),z(e),d=m.pending,m.pending===m.pending_buf_size)){j=1;break}j=m.gzindex<m.gzhead.name.length?255&m.gzhead.name.charCodeAt(m.gzindex++):0,ne(m,j)}while(j!==0);m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),j===0&&(m.gzindex=0,m.status=91)}else m.status=91;if(m.status===91)if(m.gzhead.comment){d=m.pending;do{if(m.pending===m.pending_buf_size&&(m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),z(e),d=m.pending,m.pending===m.pending_buf_size)){j=1;break}j=m.gzindex<m.gzhead.comment.length?255&m.gzhead.comment.charCodeAt(m.gzindex++):0,ne(m,j)}while(j!==0);m.gzhead.hcrc&&m.pending>d&&(e.adler=v(e.adler,m.pending_buf,m.pending-d,d)),j===0&&(m.status=103)}else m.status=103;if(m.status===103&&(m.gzhead.hcrc?(m.pending+2>m.pending_buf_size&&z(e),m.pending+2<=m.pending_buf_size&&(ne(m,255&e.adler),ne(m,e.adler>>8&255),e.adler=0,m.status=I)):m.status=I),m.pending!==0){if(z(e),e.avail_out===0)return m.last_flush=-1,n}else if(e.avail_in===0&&W(T)<=W(O)&&T!==b)return ie(e,-5);if(m.status===666&&e.avail_in!==0)return ie(e,-5);if(e.avail_in!==0||m.lookahead!==0||T!==_&&m.status!==666){var U=m.strategy===2?(function(A,$){for(var Y;;){if(A.lookahead===0&&(de(A),A.lookahead===0)){if($===_)return t;break}if(A.match_length=0,Y=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,Y&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,$===b?(E(A,!0),A.strm.avail_out===0?X:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:D})(m,T):m.strategy===3?(function(A,$){for(var Y,H,te,ce,oe=A.window;;){if(A.lookahead<=q){if(de(A),A.lookahead<=q&&$===_)return t;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=F&&0<A.strstart&&(H=oe[te=A.strstart-1])===oe[++te]&&H===oe[++te]&&H===oe[++te]){ce=A.strstart+q;do;while(H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&H===oe[++te]&&te<ce);A.match_length=q-(ce-te),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=F?(Y=r._tr_tally(A,1,A.match_length-F),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(Y=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),Y&&(E(A,!1),A.strm.avail_out===0))return t}return A.insert=0,$===b?(E(A,!0),A.strm.avail_out===0?X:L):A.last_lit&&(E(A,!1),A.strm.avail_out===0)?t:D})(m,T):c[m.level].func(m,T);if(U!==X&&U!==L||(m.status=666),U===t||U===X)return e.avail_out===0&&(m.last_flush=-1),n;if(U===D&&(T===1?r._tr_align(m):T!==5&&(r._tr_stored_block(m,0,0,!1),T===3&&(re(m.head),m.lookahead===0&&(m.strstart=0,m.block_start=0,m.insert=0))),z(e),e.avail_out===0))return m.last_flush=-1,n}return T!==b?n:m.wrap<=0?1:(m.wrap===2?(ne(m,255&e.adler),ne(m,e.adler>>8&255),ne(m,e.adler>>16&255),ne(m,e.adler>>24&255),ne(m,255&e.total_in),ne(m,e.total_in>>8&255),ne(m,e.total_in>>16&255),ne(m,e.total_in>>24&255)):(K(m,e.adler>>>16),K(m,65535&e.adler)),z(e),0<m.wrap&&(m.wrap=-m.wrap),m.pending!==0?n:1)},x.deflateEnd=function(e){var T;return e&&e.state?(T=e.state.status)!==f&&T!==69&&T!==73&&T!==91&&T!==103&&T!==I&&T!==666?ie(e,h):(e.state=null,T===I?ie(e,-3):n):h},x.deflateSetDictionary=function(e,T){var O,m,d,j,P,U,A,$,Y=T.length;if(!e||!e.state||(j=(O=e.state).wrap)===2||j===1&&O.status!==f||O.lookahead)return h;for(j===1&&(e.adler=a(e.adler,T,Y,0)),O.wrap=0,Y>=O.w_size&&(j===0&&(re(O.head),O.strstart=0,O.block_start=0,O.insert=0),$=new o.Buf8(O.w_size),o.arraySet($,T,Y-O.w_size,O.w_size,0),T=$,Y=O.w_size),P=e.avail_in,U=e.next_in,A=e.input,e.avail_in=Y,e.next_in=0,e.input=T,de(O);O.lookahead>=F;){for(m=O.strstart,d=O.lookahead-(F-1);O.ins_h=(O.ins_h<<O.hash_shift^O.window[m+F-1])&O.hash_mask,O.prev[m&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=m,m++,--d;);O.strstart=m,O.lookahead=F-1,de(O)}return O.strstart+=O.lookahead,O.block_start=O.strstart,O.insert=O.lookahead,O.lookahead=0,O.match_length=O.prev_length=F-1,O.match_available=0,e.next_in=U,e.input=A,e.avail_in=P,O.wrap=j,n},x.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(p,S,x){S.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(p,S,x){S.exports=function(c,o){var r,a,v,y,_,b,n,h,i,u,l,g,w,C,N,B,R,Z,F,q,ee,f,I,t,D;r=c.state,a=c.next_in,t=c.input,v=a+(c.avail_in-5),y=c.next_out,D=c.output,_=y-(o-c.avail_out),b=y+(c.avail_out-257),n=r.dmax,h=r.wsize,i=r.whave,u=r.wnext,l=r.window,g=r.hold,w=r.bits,C=r.lencode,N=r.distcode,B=(1<<r.lenbits)-1,R=(1<<r.distbits)-1;e:do{w<15&&(g+=t[a++]<<w,w+=8,g+=t[a++]<<w,w+=8),Z=C[g&B];t:for(;;){if(g>>>=F=Z>>>24,w-=F,(F=Z>>>16&255)===0)D[y++]=65535&Z;else{if(!(16&F)){if((64&F)==0){Z=C[(65535&Z)+(g&(1<<F)-1)];continue t}if(32&F){r.mode=12;break e}c.msg="invalid literal/length code",r.mode=30;break e}q=65535&Z,(F&=15)&&(w<F&&(g+=t[a++]<<w,w+=8),q+=g&(1<<F)-1,g>>>=F,w-=F),w<15&&(g+=t[a++]<<w,w+=8,g+=t[a++]<<w,w+=8),Z=N[g&R];r:for(;;){if(g>>>=F=Z>>>24,w-=F,!(16&(F=Z>>>16&255))){if((64&F)==0){Z=N[(65535&Z)+(g&(1<<F)-1)];continue r}c.msg="invalid distance code",r.mode=30;break e}if(ee=65535&Z,w<(F&=15)&&(g+=t[a++]<<w,(w+=8)<F&&(g+=t[a++]<<w,w+=8)),n<(ee+=g&(1<<F)-1)){c.msg="invalid distance too far back",r.mode=30;break e}if(g>>>=F,w-=F,(F=y-_)<ee){if(i<(F=ee-F)&&r.sane){c.msg="invalid distance too far back",r.mode=30;break e}if(I=l,(f=0)===u){if(f+=h-F,F<q){for(q-=F;D[y++]=l[f++],--F;);f=y-ee,I=D}}else if(u<F){if(f+=h+u-F,(F-=u)<q){for(q-=F;D[y++]=l[f++],--F;);if(f=0,u<q){for(q-=F=u;D[y++]=l[f++],--F;);f=y-ee,I=D}}}else if(f+=u-F,F<q){for(q-=F;D[y++]=l[f++],--F;);f=y-ee,I=D}for(;2<q;)D[y++]=I[f++],D[y++]=I[f++],D[y++]=I[f++],q-=3;q&&(D[y++]=I[f++],1<q&&(D[y++]=I[f++]))}else{for(f=y-ee;D[y++]=D[f++],D[y++]=D[f++],D[y++]=D[f++],2<(q-=3););q&&(D[y++]=D[f++],1<q&&(D[y++]=D[f++]))}break}}break}}while(a<v&&y<b);a-=q=w>>3,g&=(1<<(w-=q<<3))-1,c.next_in=a,c.next_out=y,c.avail_in=a<v?v-a+5:5-(a-v),c.avail_out=y<b?b-y+257:257-(y-b),r.hold=g,r.bits=w}},{}],49:[function(p,S,x){var c=p("../utils/common"),o=p("./adler32"),r=p("./crc32"),a=p("./inffast"),v=p("./inftrees"),y=1,_=2,b=0,n=-2,h=1,i=852,u=592;function l(f){return(f>>>24&255)+(f>>>8&65280)+((65280&f)<<8)+((255&f)<<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(f){var I;return f&&f.state?(I=f.state,f.total_in=f.total_out=I.total=0,f.msg="",I.wrap&&(f.adler=1&I.wrap),I.mode=h,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(i),I.distcode=I.distdyn=new c.Buf32(u),I.sane=1,I.back=-1,b):n}function C(f){var I;return f&&f.state?((I=f.state).wsize=0,I.whave=0,I.wnext=0,w(f)):n}function N(f,I){var t,D;return f&&f.state?(D=f.state,I<0?(t=0,I=-I):(t=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?n:(D.window!==null&&D.wbits!==I&&(D.window=null),D.wrap=t,D.wbits=I,C(f))):n}function B(f,I){var t,D;return f?(D=new g,(f.state=D).window=null,(t=N(f,I))!==b&&(f.state=null),t):n}var R,Z,F=!0;function q(f){if(F){var I;for(R=new c.Buf32(512),Z=new c.Buf32(32),I=0;I<144;)f.lens[I++]=8;for(;I<256;)f.lens[I++]=9;for(;I<280;)f.lens[I++]=7;for(;I<288;)f.lens[I++]=8;for(v(y,f.lens,0,288,R,0,f.work,{bits:9}),I=0;I<32;)f.lens[I++]=5;v(_,f.lens,0,32,Z,0,f.work,{bits:5}),F=!1}f.lencode=R,f.lenbits=9,f.distcode=Z,f.distbits=5}function ee(f,I,t,D){var X,L=f.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new c.Buf8(L.wsize)),D>=L.wsize?(c.arraySet(L.window,I,t-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(D<(X=L.wsize-L.wnext)&&(X=D),c.arraySet(L.window,I,t-D,X,L.wnext),(D-=X)?(c.arraySet(L.window,I,t-D,D,0),L.wnext=D,L.whave=L.wsize):(L.wnext+=X,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=X))),0}x.inflateReset=C,x.inflateReset2=N,x.inflateResetKeep=w,x.inflateInit=function(f){return B(f,15)},x.inflateInit2=B,x.inflate=function(f,I){var t,D,X,L,ie,W,re,z,E,ne,K,G,de,xe,ae,le,me,pe,be,we,e,T,O,m,d=0,j=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(!f||!f.state||!f.output||!f.input&&f.avail_in!==0)return n;(t=f.state).mode===12&&(t.mode=13),ie=f.next_out,X=f.output,re=f.avail_out,L=f.next_in,D=f.input,W=f.avail_in,z=t.hold,E=t.bits,ne=W,K=re,T=b;e:for(;;)switch(t.mode){case h:if(t.wrap===0){t.mode=13;break}for(;E<16;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(2&t.wrap&&z===35615){j[t.check=0]=255&z,j[1]=z>>>8&255,t.check=r(t.check,j,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){f.msg="incorrect header check",t.mode=30;break}if((15&z)!=8){f.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){f.msg="invalid window size",t.mode=30;break}t.dmax=1<<e,f.adler=t.check=1,t.mode=512&z?10:12,E=z=0;break;case 2:for(;E<16;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(t.flags=z,(255&t.flags)!=8){f.msg="unknown compression method",t.mode=30;break}if(57344&t.flags){f.msg="unknown header flags set",t.mode=30;break}t.head&&(t.head.text=z>>8&1),512&t.flags&&(j[0]=255&z,j[1]=z>>>8&255,t.check=r(t.check,j,2,0)),E=z=0,t.mode=3;case 3:for(;E<32;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}t.head&&(t.head.time=z),512&t.flags&&(j[0]=255&z,j[1]=z>>>8&255,j[2]=z>>>16&255,j[3]=z>>>24&255,t.check=r(t.check,j,4,0)),E=z=0,t.mode=4;case 4:for(;E<16;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}t.head&&(t.head.xflags=255&z,t.head.os=z>>8),512&t.flags&&(j[0]=255&z,j[1]=z>>>8&255,t.check=r(t.check,j,2,0)),E=z=0,t.mode=5;case 5:if(1024&t.flags){for(;E<16;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}t.length=z,t.head&&(t.head.extra_len=z),512&t.flags&&(j[0]=255&z,j[1]=z>>>8&255,t.check=r(t.check,j,2,0)),E=z=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&(W<(G=t.length)&&(G=W),G&&(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,D,L,G,e)),512&t.flags&&(t.check=r(t.check,D,G,L)),W-=G,L+=G,t.length-=G),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(W===0)break e;for(G=0;e=D[L+G++],t.head&&e&&t.length<65536&&(t.head.name+=String.fromCharCode(e)),e&&G<W;);if(512&t.flags&&(t.check=r(t.check,D,G,L)),W-=G,L+=G,e)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=8;case 8:if(4096&t.flags){if(W===0)break e;for(G=0;e=D[L+G++],t.head&&e&&t.length<65536&&(t.head.comment+=String.fromCharCode(e)),e&&G<W;);if(512&t.flags&&(t.check=r(t.check,D,G,L)),W-=G,L+=G,e)break e}else t.head&&(t.head.comment=null);t.mode=9;case 9:if(512&t.flags){for(;E<16;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(z!==(65535&t.check)){f.msg="header crc mismatch",t.mode=30;break}E=z=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),f.adler=t.check=0,t.mode=12;break;case 10:for(;E<32;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}f.adler=t.check=l(z),E=z=0,t.mode=11;case 11:if(t.havedict===0)return f.next_out=ie,f.avail_out=re,f.next_in=L,f.avail_in=W,t.hold=z,t.bits=E,2;f.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(W===0)break e;W--,z+=D[L++]<<E,E+=8}switch(t.last=1&z,E-=1,3&(z>>>=1)){case 0:t.mode=14;break;case 1:if(q(t),t.mode=20,I!==6)break;z>>>=2,E-=2;break e;case 2:t.mode=17;break;case 3:f.msg="invalid block type",t.mode=30}z>>>=2,E-=2;break;case 14:for(z>>>=7&E,E-=7&E;E<32;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if((65535&z)!=(z>>>16^65535)){f.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(G=t.length){if(W<G&&(G=W),re<G&&(G=re),G===0)break e;c.arraySet(X,D,L,G,ie),W-=G,L+=G,re-=G,ie+=G,t.length-=G;break}t.mode=12;break;case 17:for(;E<14;){if(W===0)break e;W--,z+=D[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){f.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(W===0)break e;W--,z+=D[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,O={bits:t.lenbits},T=v(0,t.lens,0,19,t.lencode,0,t.work,O),t.lenbits=O.bits,T){f.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have<t.nlen+t.ndist;){for(;le=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,me=65535&d,!((ae=d>>>24)<=E);){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(me<16)z>>>=ae,E-=ae,t.lens[t.have++]=me;else{if(me===16){for(m=ae+2;E<m;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(z>>>=ae,E-=ae,t.have===0){f.msg="invalid bit length repeat",t.mode=30;break}e=t.lens[t.have-1],G=3+(3&z),z>>>=2,E-=2}else if(me===17){for(m=ae+3;E<m;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}E-=ae,e=0,G=3+(7&(z>>>=ae)),z>>>=3,E-=3}else{for(m=ae+7;E<m;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}E-=ae,e=0,G=11+(127&(z>>>=ae)),z>>>=7,E-=7}if(t.have+G>t.nlen+t.ndist){f.msg="invalid bit length repeat",t.mode=30;break}for(;G--;)t.lens[t.have++]=e}}if(t.mode===30)break;if(t.lens[256]===0){f.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,O={bits:t.lenbits},T=v(y,t.lens,0,t.nlen,t.lencode,0,t.work,O),t.lenbits=O.bits,T){f.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,O={bits:t.distbits},T=v(_,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,O),t.distbits=O.bits,T){f.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<=W&&258<=re){f.next_out=ie,f.avail_out=re,f.next_in=L,f.avail_in=W,t.hold=z,t.bits=E,a(f,K),ie=f.next_out,X=f.output,re=f.avail_out,L=f.next_in,D=f.input,W=f.avail_in,z=t.hold,E=t.bits,t.mode===12&&(t.back=-1);break}for(t.back=0;le=(d=t.lencode[z&(1<<t.lenbits)-1])>>>16&255,me=65535&d,!((ae=d>>>24)<=E);){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(le&&(240&le)==0){for(pe=ae,be=le,we=me;le=(d=t.lencode[we+((z&(1<<pe+be)-1)>>pe)])>>>16&255,me=65535&d,!(pe+(ae=d>>>24)<=E);){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}z>>>=pe,E-=pe,t.back+=pe}if(z>>>=ae,E-=ae,t.back+=ae,t.length=me,le===0){t.mode=26;break}if(32&le){t.back=-1,t.mode=12;break}if(64&le){f.msg="invalid literal/length code",t.mode=30;break}t.extra=15&le,t.mode=22;case 22:if(t.extra){for(m=t.extra;E<m;){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}t.length+=z&(1<<t.extra)-1,z>>>=t.extra,E-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;le=(d=t.distcode[z&(1<<t.distbits)-1])>>>16&255,me=65535&d,!((ae=d>>>24)<=E);){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}if((240&le)==0){for(pe=ae,be=le,we=me;le=(d=t.distcode[we+((z&(1<<pe+be)-1)>>pe)])>>>16&255,me=65535&d,!(pe+(ae=d>>>24)<=E);){if(W===0)break e;W--,z+=D[L++]<<E,E+=8}z>>>=pe,E-=pe,t.back+=pe}if(z>>>=ae,E-=ae,t.back+=ae,64&le){f.msg="invalid distance code",t.mode=30;break}t.offset=me,t.extra=15&le,t.mode=24;case 24:if(t.extra){for(m=t.extra;E<m;){if(W===0)break e;W--,z+=D[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){f.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(re===0)break e;if(G=K-re,t.offset>G){if((G=t.offset-G)>t.whave&&t.sane){f.msg="invalid distance too far back",t.mode=30;break}de=G>t.wnext?(G-=t.wnext,t.wsize-G):t.wnext-G,G>t.length&&(G=t.length),xe=t.window}else xe=X,de=ie-t.offset,G=t.length;for(re<G&&(G=re),re-=G,t.length-=G;X[ie++]=xe[de++],--G;);t.length===0&&(t.mode=21);break;case 26:if(re===0)break e;X[ie++]=t.length,re--,t.mode=21;break;case 27:if(t.wrap){for(;E<32;){if(W===0)break e;W--,z|=D[L++]<<E,E+=8}if(K-=re,f.total_out+=K,t.total+=K,K&&(f.adler=t.check=t.flags?r(t.check,X,K,ie-K):o(t.check,X,K,ie-K)),K=re,(t.flags?z:l(z))!==t.check){f.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(W===0)break e;W--,z+=D[L++]<<E,E+=8}if(z!==(4294967295&t.total)){f.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 n}return f.next_out=ie,f.avail_out=re,f.next_in=L,f.avail_in=W,t.hold=z,t.bits=E,(t.wsize||K!==f.avail_out&&t.mode<30&&(t.mode<27||I!==4))&&ee(f,f.output,f.next_out,K-f.avail_out)?(t.mode=31,-4):(ne-=f.avail_in,K-=f.avail_out,f.total_in+=ne,f.total_out+=K,t.total+=K,t.wrap&&K&&(f.adler=t.check=t.flags?r(t.check,X,K,f.next_out-K):o(t.check,X,K,f.next_out-K)),f.data_type=t.bits+(t.last?64:0)+(t.mode===12?128:0)+(t.mode===20||t.mode===15?256:0),(ne==0&&K===0||I===4)&&T===b&&(T=-5),T)},x.inflateEnd=function(f){if(!f||!f.state)return n;var I=f.state;return I.window&&(I.window=null),f.state=null,b},x.inflateGetHeader=function(f,I){var t;return f&&f.state?(2&(t=f.state).wrap)==0?n:((t.head=I).done=!1,b):n},x.inflateSetDictionary=function(f,I){var t,D=I.length;return f&&f.state?(t=f.state).wrap!==0&&t.mode!==11?n:t.mode===11&&o(1,I,D,0)!==t.check?-3:ee(f,I,D,D)?(t.mode=31,-4):(t.havedict=1,b):n},x.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(p,S,x){var c=p("../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],v=[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];S.exports=function(y,_,b,n,h,i,u,l){var g,w,C,N,B,R,Z,F,q,ee=l.bits,f=0,I=0,t=0,D=0,X=0,L=0,ie=0,W=0,re=0,z=0,E=null,ne=0,K=new c.Buf16(16),G=new c.Buf16(16),de=null,xe=0;for(f=0;f<=15;f++)K[f]=0;for(I=0;I<n;I++)K[_[b+I]]++;for(X=ee,D=15;1<=D&&K[D]===0;D--);if(D<X&&(X=D),D===0)return h[i++]=20971520,h[i++]=20971520,l.bits=1,0;for(t=1;t<D&&K[t]===0;t++);for(X<t&&(X=t),f=W=1;f<=15;f++)if(W<<=1,(W-=K[f])<0)return-1;if(0<W&&(y===0||D!==1))return-1;for(G[1]=0,f=1;f<15;f++)G[f+1]=G[f]+K[f];for(I=0;I<n;I++)_[b+I]!==0&&(u[G[_[b+I]]++]=I);if(R=y===0?(E=de=u,19):y===1?(E=o,ne-=257,de=r,xe-=257,256):(E=a,de=v,-1),f=t,B=i,ie=I=z=0,C=-1,N=(re=1<<(L=X))-1,y===1&&852<re||y===2&&592<re)return 1;for(;;){for(Z=f-ie,q=u[I]<R?(F=0,u[I]):u[I]>R?(F=de[xe+u[I]],E[ne+u[I]]):(F=96,0),g=1<<f-ie,t=w=1<<L;h[B+(z>>ie)+(w-=g)]=Z<<24|F<<16|q|0,w!==0;);for(g=1<<f-1;z&g;)g>>=1;if(g!==0?(z&=g-1,z+=g):z=0,I++,--K[f]==0){if(f===D)break;f=_[b+u[I]]}if(X<f&&(z&N)!==C){for(ie===0&&(ie=X),B+=t,W=1<<(L=f-ie);L+ie<D&&!((W-=K[L+ie])<=0);)L++,W<<=1;if(re+=1<<L,y===1&&852<re||y===2&&592<re)return 1;h[C=z&N]=X<<24|L<<16|B-i|0}}return z!==0&&(h[B+z]=f-ie<<24|64<<16|0),l.bits=X,0}},{"../utils/common":41}],51:[function(p,S,x){S.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(p,S,x){var c=p("../utils/common"),o=0,r=1;function a(d){for(var j=d.length;0<=--j;)d[j]=0}var v=0,y=29,_=256,b=_+1+y,n=30,h=19,i=2*b+1,u=15,l=16,g=7,w=256,C=16,N=17,B=18,R=[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],Z=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ee=new Array(2*(b+2));a(ee);var f=new Array(2*n);a(f);var I=new Array(512);a(I);var t=new Array(256);a(t);var D=new Array(y);a(D);var X,L,ie,W=new Array(n);function re(d,j,P,U,A){this.static_tree=d,this.extra_bits=j,this.extra_base=P,this.elems=U,this.max_length=A,this.has_stree=d&&d.length}function z(d,j){this.dyn_tree=d,this.max_code=0,this.stat_desc=j}function E(d){return d<256?I[d]:I[256+(d>>>7)]}function ne(d,j){d.pending_buf[d.pending++]=255&j,d.pending_buf[d.pending++]=j>>>8&255}function K(d,j,P){d.bi_valid>l-P?(d.bi_buf|=j<<d.bi_valid&65535,ne(d,d.bi_buf),d.bi_buf=j>>l-d.bi_valid,d.bi_valid+=P-l):(d.bi_buf|=j<<d.bi_valid&65535,d.bi_valid+=P)}function G(d,j,P){K(d,P[2*j],P[2*j+1])}function de(d,j){for(var P=0;P|=1&d,d>>>=1,P<<=1,0<--j;);return P>>>1}function xe(d,j,P){var U,A,$=new Array(u+1),Y=0;for(U=1;U<=u;U++)$[U]=Y=Y+P[U-1]<<1;for(A=0;A<=j;A++){var H=d[2*A+1];H!==0&&(d[2*A]=de($[H]++,H))}}function ae(d){var j;for(j=0;j<b;j++)d.dyn_ltree[2*j]=0;for(j=0;j<n;j++)d.dyn_dtree[2*j]=0;for(j=0;j<h;j++)d.bl_tree[2*j]=0;d.dyn_ltree[2*w]=1,d.opt_len=d.static_len=0,d.last_lit=d.matches=0}function le(d){8<d.bi_valid?ne(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 me(d,j,P,U){var A=2*j,$=2*P;return d[A]<d[$]||d[A]===d[$]&&U[j]<=U[P]}function pe(d,j,P){for(var U=d.heap[P],A=P<<1;A<=d.heap_len&&(A<d.heap_len&&me(j,d.heap[A+1],d.heap[A],d.depth)&&A++,!me(j,U,d.heap[A],d.depth));)d.heap[P]=d.heap[A],P=A,A<<=1;d.heap[P]=U}function be(d,j,P){var U,A,$,Y,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?G(d,A,j):(G(d,($=t[A])+_+1,j),(Y=R[$])!==0&&K(d,A-=D[$],Y),G(d,$=E(--U),P),(Y=Z[$])!==0&&K(d,U-=W[$],Y)),H<d.last_lit;);G(d,w,j)}function we(d,j){var P,U,A,$=j.dyn_tree,Y=j.stat_desc.static_tree,H=j.stat_desc.has_stree,te=j.stat_desc.elems,ce=-1;for(d.heap_len=0,d.heap_max=i,P=0;P<te;P++)$[2*P]!==0?(d.heap[++d.heap_len]=ce=P,d.depth[P]=0):$[2*P+1]=0;for(;d.heap_len<2;)$[2*(A=d.heap[++d.heap_len]=ce<2?++ce:0)]=1,d.depth[A]=0,d.opt_len--,H&&(d.static_len-=Y[2*A+1]);for(j.max_code=ce,P=d.heap_len>>1;1<=P;P--)pe(d,$,P);for(A=te;P=d.heap[1],d.heap[1]=d.heap[d.heap_len--],pe(d,$,1),U=d.heap[1],d.heap[--d.heap_max]=P,d.heap[--d.heap_max]=U,$[2*A]=$[2*P]+$[2*U],d.depth[A]=(d.depth[P]>=d.depth[U]?d.depth[P]:d.depth[U])+1,$[2*P+1]=$[2*U+1]=A,d.heap[1]=A++,pe(d,$,1),2<=d.heap_len;);d.heap[--d.heap_max]=d.heap[1],(function(oe,ve){var Se,he,je,fe,ke,Re,Ne=ve.dyn_tree,Le=ve.max_code,rt=ve.stat_desc.static_tree,nt=ve.stat_desc.has_stree,st=ve.stat_desc.extra_bits,Fe=ve.stat_desc.extra_base,Ae=ve.stat_desc.max_length,k=0;for(fe=0;fe<=u;fe++)oe.bl_count[fe]=0;for(Ne[2*oe.heap[oe.heap_max]+1]=0,Se=oe.heap_max+1;Se<i;Se++)Ae<(fe=Ne[2*Ne[2*(he=oe.heap[Se])+1]+1]+1)&&(fe=Ae,k++),Ne[2*he+1]=fe,Le<he||(oe.bl_count[fe]++,ke=0,Fe<=he&&(ke=st[he-Fe]),Re=Ne[2*he],oe.opt_len+=Re*(fe+ke),nt&&(oe.static_len+=Re*(rt[2*he+1]+ke)));if(k!==0){do{for(fe=Ae-1;oe.bl_count[fe]===0;)fe--;oe.bl_count[fe]--,oe.bl_count[fe+1]+=2,oe.bl_count[Ae]--,k-=2}while(0<k);for(fe=Ae;fe!==0;fe--)for(he=oe.bl_count[fe];he!==0;)Le<(je=oe.heap[--Se])||(Ne[2*je+1]!==fe&&(oe.opt_len+=(fe-Ne[2*je+1])*Ne[2*je],Ne[2*je+1]=fe),he--)}})(d,j),xe($,ce,d.bl_count)}function e(d,j,P){var U,A,$=-1,Y=j[1],H=0,te=7,ce=4;for(Y===0&&(te=138,ce=3),j[2*(P+1)+1]=65535,U=0;U<=P;U++)A=Y,Y=j[2*(U+1)+1],++H<te&&A===Y||(H<ce?d.bl_tree[2*A]+=H:A!==0?(A!==$&&d.bl_tree[2*A]++,d.bl_tree[2*C]++):H<=10?d.bl_tree[2*N]++:d.bl_tree[2*B]++,$=A,ce=(H=0)===Y?(te=138,3):A===Y?(te=6,3):(te=7,4))}function T(d,j,P){var U,A,$=-1,Y=j[1],H=0,te=7,ce=4;for(Y===0&&(te=138,ce=3),U=0;U<=P;U++)if(A=Y,Y=j[2*(U+1)+1],!(++H<te&&A===Y)){if(H<ce)for(;G(d,A,d.bl_tree),--H!=0;);else A!==0?(A!==$&&(G(d,A,d.bl_tree),H--),G(d,C,d.bl_tree),K(d,H-3,2)):H<=10?(G(d,N,d.bl_tree),K(d,H-3,3)):(G(d,B,d.bl_tree),K(d,H-11,7));$=A,ce=(H=0)===Y?(te=138,3):A===Y?(te=6,3):(te=7,4)}}a(W);var O=!1;function m(d,j,P,U){K(d,(v<<1)+(U?1:0),3),(function(A,$,Y,H){le(A),ne(A,Y),ne(A,~Y),c.arraySet(A.pending_buf,A.window,$,Y,A.pending),A.pending+=Y})(d,j,P)}x._tr_init=function(d){O||((function(){var j,P,U,A,$,Y=new Array(u+1);for(A=U=0;A<y-1;A++)for(D[A]=U,j=0;j<1<<R[A];j++)t[U++]=A;for(t[U-1]=A,A=$=0;A<16;A++)for(W[A]=$,j=0;j<1<<Z[A];j++)I[$++]=A;for($>>=7;A<n;A++)for(W[A]=$<<7,j=0;j<1<<Z[A]-7;j++)I[256+$++]=A;for(P=0;P<=u;P++)Y[P]=0;for(j=0;j<=143;)ee[2*j+1]=8,j++,Y[8]++;for(;j<=255;)ee[2*j+1]=9,j++,Y[9]++;for(;j<=279;)ee[2*j+1]=7,j++,Y[7]++;for(;j<=287;)ee[2*j+1]=8,j++,Y[8]++;for(xe(ee,b+1,Y),j=0;j<n;j++)f[2*j+1]=5,f[2*j]=de(j,5);X=new re(ee,R,_+1,b,u),L=new re(f,Z,0,n,u),ie=new re(new Array(0),F,0,h,g)})(),O=!0),d.l_desc=new z(d.dyn_ltree,X),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,ae(d)},x._tr_stored_block=m,x._tr_flush_block=function(d,j,P,U){var A,$,Y=0;0<d.level?(d.strm.data_type===2&&(d.strm.data_type=(function(H){var te,ce=4093624447;for(te=0;te<=31;te++,ce>>>=1)if(1&ce&&H.dyn_ltree[2*te]!==0)return o;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return r;for(te=32;te<_;te++)if(H.dyn_ltree[2*te]!==0)return r;return o})(d)),we(d,d.l_desc),we(d,d.d_desc),Y=(function(H){var te;for(e(H,H.dyn_ltree,H.l_desc.max_code),e(H,H.dyn_dtree,H.d_desc.max_code),we(H,H.bl_desc),te=h-1;3<=te&&H.bl_tree[2*q[te]+1]===0;te--);return H.opt_len+=3*(te+1)+5+5+4,te})(d),A=d.opt_len+3+7>>>3,($=d.static_len+3+7>>>3)<=A&&(A=$)):A=$=P+5,P+4<=A&&j!==-1?m(d,j,P,U):d.strategy===4||$===A?(K(d,2+(U?1:0),3),be(d,ee,f)):(K(d,4+(U?1:0),3),(function(H,te,ce,oe){var ve;for(K(H,te-257,5),K(H,ce-1,5),K(H,oe-4,4),ve=0;ve<oe;ve++)K(H,H.bl_tree[2*q[ve]+1],3);T(H,H.dyn_ltree,te-1),T(H,H.dyn_dtree,ce-1)})(d,d.l_desc.max_code+1,d.d_desc.max_code+1,Y+1),be(d,d.dyn_ltree,d.dyn_dtree)),ae(d),U&&le(d)},x._tr_tally=function(d,j,P){return d.pending_buf[d.d_buf+2*d.last_lit]=j>>>8&255,d.pending_buf[d.d_buf+2*d.last_lit+1]=255&j,d.pending_buf[d.l_buf+d.last_lit]=255&P,d.last_lit++,j===0?d.dyn_ltree[2*P]++:(d.matches++,j--,d.dyn_ltree[2*(t[P]+_+1)]++,d.dyn_dtree[2*E(j)]++),d.last_lit===d.lit_bufsize-1},x._tr_align=function(d){K(d,2,3),G(d,w,ee),(function(j){j.bi_valid===16?(ne(j,j.bi_buf),j.bi_buf=0,j.bi_valid=0):8<=j.bi_valid&&(j.pending_buf[j.pending++]=255&j.bi_buf,j.bi_buf>>=8,j.bi_valid-=8)})(d)}},{"../utils/common":41}],53:[function(p,S,x){S.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(p,S,x){(function(c){(function(o,r){if(!o.setImmediate){var a,v,y,_,b=1,n={},h=!1,i=o.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(o);u=u&&u.setTimeout?u:o,a={}.toString.call(o.process)==="[object process]"?function(C){process.nextTick(function(){g(C)})}:(function(){if(o.postMessage&&!o.importScripts){var C=!0,N=o.onmessage;return o.onmessage=function(){C=!1},o.postMessage("","*"),o.onmessage=N,C}})()?(_="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(C){o.postMessage(_+C,"*")}):o.MessageChannel?((y=new MessageChannel).port1.onmessage=function(C){g(C.data)},function(C){y.port2.postMessage(C)}):i&&"onreadystatechange"in i.createElement("script")?(v=i.documentElement,function(C){var N=i.createElement("script");N.onreadystatechange=function(){g(C),N.onreadystatechange=null,v.removeChild(N),N=null},v.appendChild(N)}):function(C){setTimeout(g,0,C)},u.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var N=new Array(arguments.length-1),B=0;B<N.length;B++)N[B]=arguments[B+1];var R={callback:C,args:N};return n[b]=R,a(b),b++},u.clearImmediate=l}function l(C){delete n[C]}function g(C){if(h)setTimeout(g,0,C);else{var N=n[C];if(N){h=!0;try{(function(B){var R=B.callback,Z=B.args;switch(Z.length){case 0:R();break;case 1:R(Z[0]);break;case 2:R(Z[0],Z[1]);break;case 3:R(Z[0],Z[1],Z[2]);break;default:R.apply(r,Z)}})(N)}finally{l(C),h=!1}}}}function w(C){C.source===o&&typeof C.data=="string"&&C.data.indexOf(_)===0&&g(+C.data.slice(_.length))}})(typeof self>"u"?c===void 0?this:c:self)}).call(this,typeof Ze<"u"?Ze:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ct)),ct.exports}var Jr=Xr();const Qr=rr(Jr);function en(M,V){const p=M.replace(/\r\n/g,`
|
|
28
|
+
`),S=r=>/^---\n[\s\S]*?\n---\n/.test(r);if(!p.startsWith("---")||!p.includes(`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
`))return[{path:V,content:M}];const x=[];for(const r of p.split(`
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
`))S(r)||x.length===0?x.push(r):x[x.length-1]+=`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
${r}`;if(x.length<2)return[{path:V,content:M}];const c=(r,a)=>{var y,_;return(((_=(y=r.match(new RegExp(`^${a}:\\s*(.*)$`,"m")))==null?void 0:y[1])==null?void 0:_.trim())??"").replace(/^"(.*)"$/,"$1").trim()},o=new Map;return x.map((r,a)=>{var n;const v=((n=r.match(/^---\n([\s\S]*?)\n---\n/))==null?void 0:n[1])??"";let y=(c(v,"id")||c(v,"title")||`document-${a+1}`).trim();y=y.replace(/\.md$/i,"");const _=(o.get(y)??0)+1;return o.set(y,_),{path:`${_>1?`${y}-${_}`:y}.md`,content:r}})}function tn(M,V=[]){let p=[];function S(c,o){const r=se.createContext(o);r.displayName=c+"Context";const a=p.length;p=[...p,o];const v=_=>{var l;const{scope:b,children:n,...h}=_,i=((l=b==null?void 0:b[M])==null?void 0:l[a])||r,u=se.useMemo(()=>h,Object.values(h));return s.jsx(i.Provider,{value:u,children:n})};v.displayName=c+"Provider";function y(_,b){var i;const n=((i=b==null?void 0:b[M])==null?void 0:i[a])||r,h=se.useContext(n);if(h)return h;if(o!==void 0)return o;throw new Error(`\`${_}\` must be used within \`${c}\``)}return[v,y]}const x=()=>{const c=p.map(o=>se.createContext(o));return function(r){const a=(r==null?void 0:r[M])||c;return se.useMemo(()=>({[`__scope${M}`]:{...r,[M]:a}}),[r,a])}};return x.scopeName=M,[S,rn(x,...V)]}function rn(...M){const V=M[0];if(M.length===1)return V;const p=()=>{const S=M.map(x=>({useScope:x(),scopeName:x.scopeName}));return function(c){const o=S.reduce((r,{useScope:a,scopeName:v})=>{const _=a(c)[`__scope${v}`];return{...r,..._}},{});return se.useMemo(()=>({[`__scope${V.scopeName}`]:o}),[o])}};return p.scopeName=V.scopeName,p}var nn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lt=nn.reduce((M,V)=>{const p=nr(`Primitive.${V}`),S=se.forwardRef((x,c)=>{const{asChild:o,...r}=x,a=o?p:V;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(a,{...r,ref:c})});return S.displayName=`Primitive.${V}`,{...M,[V]:S}},{}),gt="Progress",xt=100,[sn]=tn(gt),[an,on]=sn(gt),Mt=se.forwardRef((M,V)=>{const{__scopeProgress:p,value:S=null,max:x,getValueLabel:c=ln,...o}=M;(x||x===0)&&!Ot(x)&&console.error(cn(`${x}`,"Progress"));const r=Ot(x)?x:xt;S!==null&&!Rt(S,r)&&console.error(dn(`${S}`,"Progress"));const a=Rt(S,r)?S:null,v=et(a)?c(a,r):void 0;return s.jsx(an,{scope:p,value:a,max:r,children:s.jsx(Lt.div,{"aria-valuemax":r,"aria-valuemin":0,"aria-valuenow":et(a)?a:void 0,"aria-valuetext":v,role:"progressbar","data-state":$t(a,r),"data-value":a??void 0,"data-max":r,...o,ref:V})})});Mt.displayName=gt;var Zt="ProgressIndicator",Wt=se.forwardRef((M,V)=>{const{__scopeProgress:p,...S}=M,x=on(Zt,p);return s.jsx(Lt.div,{"data-state":$t(x.value,x.max),"data-value":x.value??void 0,"data-max":x.max,...S,ref:V})});Wt.displayName=Zt;function ln(M,V){return`${Math.round(M/V*100)}%`}function $t(M,V){return M==null?"indeterminate":M===V?"complete":"loading"}function et(M){return typeof M=="number"}function Ot(M){return et(M)&&!isNaN(M)&&M>0}function Rt(M,V){return et(M)&&!isNaN(M)&&M<=V&&M>=0}function cn(M,V){return`Invalid prop \`max\` of value \`${M}\` supplied to \`${V}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${xt}\`.`}function dn(M,V){return`Invalid prop \`value\` of value \`${M}\` supplied to \`${V}\`. The \`value\` prop must be:
|
|
41
|
+
- a positive number
|
|
42
|
+
- less than the value passed to \`max\` (or ${xt} if no \`max\` prop is set)
|
|
43
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
44
|
+
|
|
45
|
+
Defaulting to \`null\`.`}var Ht=Mt,un=Wt;const qt=se.forwardRef(({className:M,value:V,...p},S)=>s.jsx(Ht,{ref:S,className:sr("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",M),...p,children:s.jsx(un,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(V||0)}%)`}})}));qt.displayName=Ht.displayName;const tt=/\.(md|markdown|ya?ml|txt|json)$/i;function vt(M){return M===".versions"||M===".context"?!1:M.startsWith(".")||M==="node_modules"||M==="_suggestions"}const hn=new Set(["INDEX.MD","CONTEXT.MD","CLAUDE.MD","GEMINI.MD","AGENTS.MD","QWEN.MD","README.MD"]);function fn(M){return M.filter(V=>{const p=V.path.split("/"),S=p[p.length-1];return!S.endsWith(".md")||hn.has(S.toUpperCase())?!1:!p.some(x=>x.startsWith(".")||x==="node_modules")}).length}async function Gt(M,V,p=32){const S=[];for(let x=0;x<M.length;x+=p)S.push(...await Promise.all(M.slice(x,x+p).map(V)));return S}async function mn(M,V,p){const S=[],x=async(c,o)=>{const r=[];for await(const a of c.values()){const v=o?`${o}/${a.name}`:a.name;a.kind==="directory"?vt(a.name)||r.push({handle:a,rel:v}):tt.test(a.name)&&S.push({handle:a,rel:v})}await Promise.all(r.map(a=>x(a.handle,a.rel)))};await x(M,V),p.push(...await Gt(S,async({handle:c,rel:o})=>({path:o,content:await(await c.getFile()).text()})))}async function pn(M,V){const p=await Qr.loadAsync(M);for(const S of Object.values(p.files)){if(S.dir)continue;const x=S.name.split("/");x.some(vt)||!tt.test(x[x.length-1])||V.push({path:S.name,content:await S.async("string")})}}async function gn(M){const V=[];for(const p of Array.from(M)){const S=p.webkitRelativePath.split("/");S.shift();const x=S.join("/");!x||S.some(vt)||!tt.test(p.name)||V.push({file:p,rel:x})}return Gt(V,async({file:p,rel:S})=>({path:S,content:await p.text()}))}function xn({isOpen:M,onClose:V,onImported:p}){const[S,x]=se.useState("folder"),[c,o]=se.useState(""),[r,a]=se.useState(null),[v,y]=se.useState(""),[_,b]=se.useState(!1),[n,h]=se.useState(!1),[i,u]=se.useState(null),[l,g]=se.useState(null),w=se.useRef(null),C=se.useRef(null),N=()=>{x("folder"),o(""),a(null),y(""),g(null),b(!1),h(!1),u(null)},B=f=>{f!==S&&(x(f),a(null),o(""),g(null))},R=()=>{n||(N(),V())},Z=async()=>{var t;g(null);const f=window.showDirectoryPicker;if(typeof f!="function"){(t=w.current)==null||t.click();return}let I;try{I=await f()}catch(D){if((D==null?void 0:D.name)==="AbortError")return;console.error("[ImportFolderModal] showDirectoryPicker failed",D),g("Couldn't open that folder");return}b(!0);try{const D=[];await mn(I,"",D),o(I.name),a(D),y(X=>X||I.name)}catch(D){console.error("[ImportFolderModal] scan failed",D),g("Couldn't read that folder")}finally{b(!1)}},F=async f=>{const I=f.target.files;if(!(!I||!I.length)){b(!0),g(null);try{const t=I[0].webkitRelativePath.split("/")[0]||"Imported",D=await gn(I);o(t),a(D),y(X=>X||t)}catch(t){console.error("[ImportFolderModal] scan failed",t),g("Couldn't read that folder")}finally{b(!1),f.target.value=""}}},q=async f=>{const I=f.target.files?Array.from(f.target.files):[];if(I.length){b(!0),g(null);try{const t=[];let D="Imported";for(const X of I)if(X.name.toLowerCase().endsWith(".zip"))await pn(X,t),D=X.name.replace(/\.zip$/i,"")||D;else if(/\.(md|markdown)$/i.test(X.name))for(const L of en(await X.text(),X.name))t.push(L);else tt.test(X.name)&&t.push({path:X.name,content:await X.text()});o(D),a(t),y(X=>X||D)}catch(t){console.error("[ImportFolderModal] file read failed",t),g("Couldn't read that selection")}finally{b(!1),f.target.value=""}}},ee=async()=>{if(r){h(!0),u(null),g(null);try{const{rejected:f}=await ir(v.trim()||c,r,(I,t)=>u({done:I,total:t}));if(p(),f.length){h(!1),u(null),g(`Imported, but ${f.length} file${f.length===1?"":"s"} could not be read or ${f.length===1?"was":"were"} too large: ${f.slice(0,5).join(", ")}`+(f.length>5?`, and ${f.length-5} more`:""));return}R()}catch(f){console.error("[ImportFolderModal] import failed",f),g((f==null?void 0:f.message)||"Import failed"),h(!1),u(null)}}};return s.jsx(Ve,{open:M,onOpenChange:f=>!f&&R(),children:s.jsxs(Xe,{className:"sm:max-w-[480px]",children:[s.jsx(Je,{children:s.jsxs(Qe,{className:"flex items-center gap-2",children:[s.jsx(Oe,{className:"h-5 w-5"}),"Import into a new nest"]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Import a folder from your computer, or a nest ",s.jsx("code",{children:".zip"})," (or markdown files) exported from another host. Files are uploaded into a new nest — your originals are left untouched."]}),s.jsx("input",{ref:f=>{w.current=f,f&&(f.setAttribute("webkitdirectory",""),f.setAttribute("directory",""))},type:"file",multiple:!0,className:"hidden",onChange:F}),s.jsx("input",{ref:C,type:"file",multiple:!0,accept:".zip,.md,.markdown,.yaml,.yml,.txt,.json",className:"hidden",onChange:q}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Import source",children:[{id:"folder",label:"Folder"},{id:"file",label:"File / .zip"}].map(f=>s.jsxs("label",{className:`flex flex-1 items-center gap-2 rounded-md border px-3 py-2 text-sm cursor-pointer transition-colors ${S===f.id?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:bg-secondary/50"}`,children:[s.jsx("input",{type:"radio",name:"import-source",className:"accent-primary",checked:S===f.id,onChange:()=>B(f.id),disabled:_||n}),f.label]},f.id))}),s.jsxs(ue,{className:"w-full",variant:"outline",onClick:S==="folder"?Z:()=>{var f;g(null),(f=C.current)==null||f.click()},disabled:_||n,children:[_?s.jsx(De,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Oe,{className:"h-4 w-4 mr-2"}),S==="folder"?"Choose folder":"Choose .zip or files"]}),r&&(()=>{const f=fn(r);return s.jsxs("p",{className:"break-words text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:c})," — ",f," document",f===1?"":"s",s.jsxs("span",{className:"text-xs",children:[" · ",r.length," file",r.length===1?"":"s"," scanned"]})]})})()]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ht,{children:"Nest name"}),s.jsx(Ke,{placeholder:c||"My Folder",value:v,onChange:f=>y(f.target.value)})]}),n&&s.jsxs("div",{className:"space-y-1",children:[s.jsx(qt,{value:i&&i.total>0&&i.done<i.total?Math.round(i.done/i.total*100):void 0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:i&&i.done<i.total?`Uploading ${i.done} of ${i.total} files…`:"Registering documents…"})]}),l&&s.jsx("p",{className:"text-sm text-destructive",children:l})]}),s.jsxs(ft,{children:[s.jsx(ue,{variant:"outline",onClick:R,disabled:n,children:"Cancel"}),s.jsxs(ue,{onClick:ee,disabled:!r||_||n,children:[n?s.jsx(De,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Import"]})]})]})})}const Ge=24,Ft="cn:dashboard:nestScope",vn=["all","mine","owned","shared","org","public","synced","unsynced"];function En(){var Fe,Ae;const{openNest:M,manageKeys:V}=ar(),{adminStatus:p,authMode:S,isAdmin:x}=Bt(),c=((Fe=p==null?void 0:p.me)==null?void 0:Fe.email)??null,{data:o,isLoading:r,refetch:a}=or(),v=(o==null?void 0:o.nests)??[],{data:y}=mt(ze.health()),_=S==="open"||x||(y==null?void 0:y.nest_creation)==="everyone",b=(Ae=p==null?void 0:p.admin)==null?void 0:Ae.email,[n,h]=se.useState(!1),{data:i,isLoading:u}=mt({...ze.nestList(!0),enabled:n}),l=(i==null?void 0:i.nests)??[],[g,w]=se.useState(""),[C,N]=se.useState("archived"),B=se.useMemo(()=>Vr(l,g,C),[l,g,C]),[R,Z]=se.useState(null),[F,q]=se.useState(!1),[ee,f]=se.useState(""),[I,t]=se.useState("activity"),[D,X]=se.useState(()=>{try{const k=localStorage.getItem(Ft);if(k&&vn.includes(k))return k}catch{}return He}),L=k=>{X(k);try{localStorage.setItem(Ft,k)}catch{}},[ie,W]=se.useState(Ge),re=se.useMemo(()=>{if(!Kr(D))return[];const k=ee.trim().toLowerCase();return[...v.filter(Q=>Gr(Q,D)?k?(Q.name??"").toLowerCase().includes(k)||(Q.description??"").toLowerCase().includes(k):!0:!1)].sort((Q,ge)=>{const ye=+!!ge.pinned-+!!Q.pinned;return ye!==0?ye:I==="name"?String(Q.name??"").localeCompare(String(ge.name??"")):String(ge.last_activity??ge.created_at??"").localeCompare(String(Q.last_activity??Q.created_at??""))})},[v,ee,D,I]),z=re.slice(0,ie),E=ee.trim()!==""||D!==He||I!=="activity",ne=()=>{f(""),L(He),t("activity")},K=se.useMemo(()=>v.filter(k=>!!k.discovered).length,[v]),G=Ut(),[de,xe]=se.useState([]),ae=se.useMemo(()=>Yr(de,D,ee),[de,D,ee]),[le,me]=se.useState({}),[pe,be]=se.useState({}),[we,e]=se.useState(!1),[T,O]=se.useState(!1),[m,d]=se.useState(""),[j,P]=se.useState(""),[U,A]=se.useState(null),[$,Y]=se.useState(new Set),[H,te]=se.useState(null),[ce,oe]=se.useState(null),[ve,Se]=se.useState(null),[he,je]=se.useState(null),fe=typeof window<"u"?window.location.origin:"http://localhost:3838",ke=async()=>{G.fetchQuery(ze.unsynced()).then(k=>xe(k.folders)).catch(()=>xe([])),await a()},Re=async k=>{me(J=>({...J,[k]:!0})),be(J=>{const Q={...J};return delete Q[k],Q});try{await br(k),await ke()}catch(J){console.error("[Dashboard] syncUnsyncedFolder failed",k,J);const Q=J instanceof Error?J.message:"Failed to sync folder";be(ge=>({...ge,[k]:Q}))}finally{me(J=>{const Q={...J};return delete Q[k],Q})}},Ne=async k=>{me(J=>({...J,[k]:!0})),be(J=>{const Q={...J};return delete Q[k],Q});try{await yr(k),xe(J=>J.filter(Q=>Q.name!==k)),je(null)}catch(J){console.error("[Dashboard] deleteUnsyncedFolder failed",k,J);const Q=J instanceof Error?J.message:"Failed to delete folder";be(ge=>({...ge,[k]:Q})),je(null)}finally{me(J=>{const Q={...J};return delete Q[k],Q})}};se.useEffect(()=>{ke()},[c]);const Le=async k=>{k.preventDefault();const J=$e(m);if(J){A(J);return}A(null);try{const{nest:Q}=await wr(m.trim(),j.trim());d(""),P(""),e(!1),ke(),M(Q.id,Q.name,!0,Q.user_id===We)}catch(Q){console.error("[Dashboard] createNest failed",Q),A(Q instanceof Error?Q.message:"Failed to create nest")}},rt=async(k,J)=>{if($.has(k))return;Y(ge=>new Set(ge).add(k));const Q=ge=>G.setQueryData(ze.nestList().queryKey,ye=>ye&&{...ye,nests:ye.nests.map(Ie=>Ie.id===k?{...Ie,pinned:ge}:Ie)});Q(J);try{await kr(k,J)}catch(ge){Q(!J),Ce.error((ge==null?void 0:ge.message)??`Failed to ${J?"pin":"unpin"} this nest`)}finally{Y(ge=>{const ye=new Set(ge);return ye.delete(k),ye})}},nt=(k,J,Q=!1)=>{te({id:k,name:J,isImported:Q})},st=(k,J)=>{oe({id:k,name:J})};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Pe,{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border-blue-200",children:[s.jsx(lr,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx(cr,{className:"text-lg",children:"Your Community Server"}),s.jsxs(dr,{children:["Running at"," ",s.jsx("code",{className:"text-xs bg-white/60 px-1.5 py-0.5 rounded font-mono",children:fe}),s.jsx(_n,{value:fe})]})]}),s.jsxs("div",{className:"flex gap-6 text-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold",children:r?s.jsx(Et,{}):v.length}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"Nests"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold",children:r?s.jsx(Et,{}):v.reduce((k,J)=>k+Number(J.document_count??0),0)}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"Documents"})]})]})]})}),s.jsx(Ue,{className:"pt-0",children:s.jsxs("div",{className:"grid md:grid-cols-2 gap-3 text-xs",children:[s.jsx(Tt,{icon:s.jsx(ur,{className:"h-4 w-4"}),title:"Hootie",desc:"Settings → Vault → Remote Server → paste URL"}),s.jsx(Tt,{icon:s.jsx(hr,{className:"h-4 w-4"}),title:"Claude Desktop",desc:"Add MCP endpoint per nest via Connect button"})]})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(zr,{icon:Ye,title:"Nests",description:"Shared knowledge vaults for your team",className:"mb-0",actions:_&&s.jsxs(s.Fragment,{children:[s.jsxs(ue,{variant:"outline",onClick:()=>O(!0),children:[s.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Import Folder"]}),s.jsxs(ue,{onClick:()=>e(!0),children:[s.jsx(at,{className:"h-4 w-4 mr-2"}),"New Nest"]})]})}),s.jsx(bn,{nests:v,onOpen:k=>M(k.id,k.name,k.is_owner??!1,k.user_id===We),onDeclined:()=>a()}),v.length>0&&s.jsx(qr,{nests:v,onManageKeys:V}),s.jsx(Ve,{open:we,onOpenChange:k=>{k||(e(!1),A(null))},children:s.jsxs(Xe,{className:"sm:max-w-[480px]",children:[s.jsxs(Je,{children:[s.jsx(Qe,{children:"New nest"}),s.jsx(dt,{children:"A nest holds a set of documents and the governance around them."})]}),s.jsxs("form",{onSubmit:Le,className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ht,{children:"Name"}),s.jsx(Ke,{placeholder:"Team Knowledge",value:m,onChange:k=>{d(k.target.value),U&&A(null)},"aria-invalid":!!U,autoFocus:!0}),(U??(m?$e(m):null))&&s.jsx("p",{className:"text-xs text-destructive",children:U??$e(m)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ht,{children:"Description (optional)"}),s.jsx(fr,{placeholder:"Shared docs for the engineering team",value:j,onChange:k=>P(k.target.value),rows:3})]}),s.jsxs(ft,{children:[s.jsx(ue,{type:"button",variant:"outline",onClick:()=>{e(!1),A(null)},children:"Cancel"}),s.jsx(ue,{type:"submit",disabled:!!$e(m),children:"Create Nest"})]})]})]})}),!r&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!n&&v.length>5&&s.jsxs(s.Fragment,{children:[s.jsx(Ke,{value:ee,onChange:k=>{f(k.target.value),W(Ge)},placeholder:"Filter nests by name or description…",className:"h-9 max-w-xs","data-testid":"nest-filter-input"}),s.jsxs("select",{value:D,onChange:k=>{L(k.target.value),W(Ge)},className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Filter nests by access","data-testid":"nest-scope-select",children:[s.jsx("option",{value:"mine",children:"My nests"}),s.jsx("option",{value:"all",children:"All nests"}),s.jsx("option",{value:"owned",children:"Owned by me"}),s.jsx("option",{value:"shared",children:"Shared with me"}),s.jsx("option",{value:"org",children:"Organization"}),s.jsx("option",{value:"public",children:"Public"}),(de.length>0||D==="synced"||D==="unsynced")&&s.jsxs(s.Fragment,{children:[s.jsx("option",{value:"synced",children:"Synced nests only"}),s.jsx("option",{value:"unsynced",children:"Unsynced folders only"})]})]}),s.jsxs("select",{value:I,onChange:k=>t(k.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Sort nests","data-testid":"nest-sort-select",children:[s.jsx("option",{value:"activity",children:"Recent activity"}),s.jsx("option",{value:"name",children:"Name (A–Z)"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[re.length+ae.length," of"," ",v.length+de.length]}),E&&s.jsx(ue,{variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:ne,"data-testid":"nest-clear-filters",children:"Clear filters"})]}),s.jsxs("label",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(lt,{className:"h-4 w-4"}),"Archived",s.jsx(mr,{checked:n,onCheckedChange:h,"aria-label":"Show archived nests","data-testid":"nest-archived-switch"})]})]}),n?s.jsx("div",{className:"space-y-4","data-testid":"archived-nests",children:u?s.jsxs("div",{className:"flex items-center gap-2 py-10 justify-center text-sm text-muted-foreground",children:[s.jsx(De,{className:"h-4 w-4 animate-spin"}),"Loading archived nests…"]}):l.length===0?s.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[s.jsx(lt,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),s.jsx("p",{className:"text-sm font-medium",children:"No archived nests"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Archiving a nest puts it here instead of deleting it — the option is in the delete dialog on any nest you own."})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"These nests are read-only. They don't appear on your dashboard, answer agents over MCP, or serve published links until restored."}),l.length>5&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Ke,{value:g,onChange:k=>w(k.target.value),placeholder:"Filter archived nests by name…",className:"h-9 max-w-xs","data-testid":"archived-filter-input"}),s.jsxs("select",{value:C,onChange:k=>N(k.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm","aria-label":"Sort archived nests","data-testid":"archived-sort-select",children:[s.jsx("option",{value:"archived",children:"Date archived"}),s.jsx("option",{value:"name",children:"Name (A–Z)"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[B.length," of ",l.length]}),g.trim()!==""&&s.jsx(ue,{variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>w(""),"data-testid":"archived-clear-filter",children:"Clear filter"})]}),B.length===0?s.jsxs("div",{className:"rounded-lg border border-dashed py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium",children:"Nothing matches this filter"}),s.jsx(ue,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>w(""),children:"Clear filter"})]}):s.jsx("div",{className:"space-y-2",children:B.map(k=>{const J=()=>M(k.id,k.name,k.is_owner??!1,k.user_id===We,!0);return s.jsxs("div",{role:"button",tabIndex:0,onClick:J,onKeyDown:Q=>{(Q.key==="Enter"||Q.key===" ")&&Q.target===Q.currentTarget&&(Q.preventDefault(),J())},className:"flex items-center gap-3 rounded-lg border px-4 py-3 hover:bg-secondary/50 cursor-pointer",children:[s.jsx(lt,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-sm font-medium",children:k.name}),s.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[k.archived_at?`Archived ${pr(k.archived_at)}`:"Archived",k.description?` — ${k.description}`:""]})]}),k.is_owner&&s.jsxs(s.Fragment,{children:[s.jsxs(ue,{variant:"outline",size:"sm",onClick:Q=>{Q.stopPropagation(),Z({id:k.id,name:k.name})},"data-testid":"restore-nest",children:[s.jsx(Mr,{className:"h-3.5 w-3.5 mr-1.5"}),"Restore"]}),s.jsx(ue,{variant:"ghost",size:"sm",className:"text-red-700 hover:text-red-800",onClick:Q=>{Q.stopPropagation(),te({id:k.id,name:k.name,isImported:!!k.is_imported})},children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})]},k.id)})})]})}):r?s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):D===He&&ee.trim()===""&&re.length+ae.length===0&&K>0?s.jsx(Pe,{children:s.jsxs(Ue,{className:"text-center py-12",children:[s.jsx(Ye,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),s.jsx("p",{className:"font-medium",children:"No nests of your own yet"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[_?"Create one, or browse":"Browse"," the ",K," nest",K===1?"":"s"," others have opened up on this server."]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[_&&s.jsxs(ue,{onClick:()=>e(!0),children:[s.jsx(at,{className:"h-4 w-4 mr-2"}),"Create Nest"]}),s.jsx(ue,{variant:"outline",onClick:()=>L("all"),"data-testid":"nest-browse-discovered",children:"Browse all nests"})]})]})}):v.length+de.length>0&&re.length+ae.length===0?s.jsx(Pe,{children:s.jsxs(Ue,{className:"text-center py-12",children:[s.jsx("p",{className:"font-medium",children:"Nothing matches this filter"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[v.length+de.length," item",v.length+de.length===1?" is":"s are"," hidden by the current filter."]}),s.jsx(ue,{variant:"outline",onClick:ne,children:"Clear filters"})]})}):z.length===0&&de.length===0?s.jsx(Pe,{children:s.jsxs(Ue,{className:"text-center py-12",children:[s.jsx(Ye,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),_?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"No nests yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first nest to start sharing knowledge with your team"}),s.jsxs(ue,{onClick:()=>e(!0),children:[s.jsx(at,{className:"h-4 w-4 mr-2"}),"Create First Nest"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"You don't have access to any nests yet."}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Ask ",b||"your admin"," to share one."]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[ae.map(k=>{const J=!!le[k.name],Q=pe[k.name];return s.jsx("div",{className:"relative text-left p-4 rounded-lg border border-dashed border-blue-300 bg-blue-50/40",children:s.jsxs("div",{className:"flex items-start gap-3 pr-2",children:[s.jsx("div",{className:"p-2 rounded-md bg-blue-100",children:s.jsx(wt,{className:"h-5 w-5 text-blue-700"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-medium truncate",children:k.label}),s.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",title:k.name,children:k.name}),s.jsxs("p",{className:"text-sm text-muted-foreground truncate mt-1",children:[k.mdCount," markdown file",k.mdCount===1?"":"s"," waiting to sync"]}),s.jsx("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200",title:"Folder is on disk but not registered as a nest",children:[s.jsx(wt,{className:"h-3 w-3"}),"Unsynced"]})}),s.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[s.jsx(ue,{size:"sm",onClick:()=>Re(k.name),disabled:J,children:J?s.jsxs(s.Fragment,{children:[s.jsx(De,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Syncing…"]}):s.jsxs(s.Fragment,{children:[s.jsx(Hr,{className:"h-3.5 w-3.5 mr-2"}),"Sync to Nest"]})}),s.jsxs(ue,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>je({name:k.name,label:k.label}),disabled:J,title:"Delete this folder from the server",children:[s.jsx(Be,{className:"h-3.5 w-3.5 mr-2"}),"Delete"]})]}),Q&&s.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1 break-words",title:Q,children:Q})]})]})},`unsynced:${k.name}`)}),z.map(k=>{var bt,yt;const J=k.user_id===We,Q=()=>M(k.id,k.name,k.is_owner??(k.permission??"owner")==="owner",J),ge=k.permission??"owner",ye=k.is_owner??ge==="owner",Ie=!ye,Te=ye||J&&S!=="open"&&x,Kt=ye||Array.isArray(k.roles)&&k.roles.includes("admin")||J&&S!=="open"&&x,Me=Array.isArray(k.roles)?k.roles:[],it=Me.includes("admin")?"admin":Me.includes("editor")?"editor":Me.includes("reviewer")?"reviewer":Me.includes("viewer")?"viewer":ge==="admin"?"admin":ge==="write"?"editor":ge==="read"?"viewer":null,Yt=jr(it,Te),Ee=it?{admin:{label:"Admin",Icon:jt,cls:"bg-purple-50 text-purple-700 border-purple-200",title:"Admin — full access except deleting the nest"},editor:{label:"Editor",Icon:kt,cls:"bg-indigo-50 text-indigo-700 border-indigo-200",title:"Editor — you can read and edit documents"},reviewer:{label:"Reviewer",Icon:Ur,cls:"bg-amber-50 text-amber-700 border-amber-200",title:"Reviewer — you can approve or reject submissions"},viewer:{label:"Viewer",Icon:gr,cls:"bg-slate-50 text-slate-700 border-slate-200",title:"View only — you can read but not edit"}}[it]:null,_t=(Ee==null?void 0:Ee.Icon)??null;return s.jsxs("div",{role:"button",tabIndex:0,onClick:Q,onKeyDown:_e=>{(_e.key==="Enter"||_e.key===" ")&&(_e.preventDefault(),Q())},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 ${J?"border-dashed border-amber-300":"border-border"}`,children:[s.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-0.5",children:[Kt&&s.jsx("button",{type:"button","aria-label":`Rename nest ${k.name}`,title:"Rename nest",onClick:_e=>{_e.stopPropagation(),Se({id:k.id,name:k.name,description:k.description??null})},className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(kt,{className:"h-3.5 w-3.5"})}),(Te||Yt)&&s.jsx("button",{type:"button","aria-label":Te?`Delete nest ${k.name}`:`Request removal of nest ${k.name}`,title:Te?"Delete nest":"Request nest removal",onClick:_e=>{_e.stopPropagation(),Te?nt(k.id,k.name,!!k.is_imported):st(k.id,k.name)},className:"p-1.5 rounded-md text-muted-foreground hover:text-red-600 hover:bg-red-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Be,{className:"h-3.5 w-3.5"})}),s.jsx("button",{type:"button","aria-label":k.pinned?`Unpin nest ${k.name}`:`Pin nest ${k.name}`,"aria-pressed":!!k.pinned,title:k.pinned?"Unpin — stop keeping this nest at the top":"Pin — keep this nest at the top for you",disabled:$.has(k.id),onClick:_e=>{_e.stopPropagation(),rt(k.id,!k.pinned)},className:`p-1.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 ${k.pinned?"text-amber-500 hover:text-amber-600 hover:bg-amber-50":"text-muted-foreground hover:text-foreground hover:bg-secondary"}`,"data-testid":"pin-nest",children:s.jsx(Wr,{className:`h-3.5 w-3.5 ${k.pinned?"fill-current":""}`})})]}),s.jsxs("div",{className:"flex items-start gap-3 pr-20",children:[s.jsx("div",{className:`p-2 rounded-md ${J?"bg-amber-100":"bg-primary/10"}`,children:J?s.jsx(xr,{className:"h-5 w-5 text-amber-700"}):s.jsx(Nt,{className:"h-5 w-5 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-medium truncate",title:k.name,children:k.name}),k.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate mt-0.5",title:k.description,children:k.description}),Ie&&s.jsxs("p",{className:"flex items-center gap-1 mt-1 text-xs text-blue-700 truncate",title:k.owner_email?`Shared by ${k.owner_email}`:"Shared with you",children:[s.jsx(St,{className:"h-3 w-3 shrink-0"}),s.jsxs("span",{className:"truncate",children:["Shared by"," ",s.jsx("span",{className:"font-medium",children:k.owner_email||"unknown user"})]})]}),k.is_imported?s.jsxs("p",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground truncate",title:`Imported ${ot(k.created_at)}`,children:[s.jsx(Oe,{className:"h-3 w-3 shrink-0"}),s.jsxs("span",{className:"truncate",children:["Imported by"," ",s.jsx("span",{className:"font-medium",children:k.is_owner?"you":k.owner_email||"unknown user"})," ","· ",ot(k.created_at)]})]}):null,s.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",title:"Documents",children:[s.jsx(Nt,{className:"h-3 w-3"}),k.document_count??0]}),(((bt=k.collaborator_emails)==null?void 0:bt.length)??0)>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Shared with",children:[s.jsx(St,{className:"h-3 w-3 mr-0.5"}),k.collaborator_emails.slice(0,4).map(_e=>s.jsx("span",{title:`Shared with ${_e}`,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:_e.slice(0,2)},_e)),k.collaborator_emails.length>4&&s.jsxs("span",{className:"text-[10px]",children:["+",k.collaborator_emails.length-4]})]}),(((yt=k.steward_emails)==null?void 0:yt.length)??0)>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Stewards",children:[s.jsx(jt,{className:"h-3 w-3 mr-0.5 text-emerald-600"}),k.steward_emails.slice(0,4).map(_e=>s.jsx("span",{title:`Steward: ${_e}`,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:_e.slice(0,2)},_e)),k.steward_emails.length>4&&s.jsxs("span",{className:"text-[10px]",children:["+",k.steward_emails.length-4]})]}),J&&!k.stewardship_enabled&&s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-200",title:"Owned by the anonymous admin — no stewardship applied",children:"Ungoverned"}),J&&k.stewardship_enabled&&s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-50 text-emerald-800 border border-emerald-200",title:"Stewardship is enabled — drafts require review before AI use",children:"Governed"}),Ie&&Ee&&_t&&s.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border ${Ee.cls}`,title:Ee.title,children:[s.jsx(_t,{className:"h-3 w-3"}),Ee.label]}),s.jsx("span",{className:`px-1.5 py-0.5 rounded ${k.visibility==="public"?"bg-green-100 text-green-700":k.visibility==="org"?"bg-blue-100 text-blue-700":"bg-secondary text-secondary-foreground"}`,children:k.visibility==="org"?"Organization":k.visibility==="public"?"Public":"Private"}),k.is_imported?s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200",title:"Imported from a folder — its files were copied into the workspace",children:[s.jsx(Oe,{className:"h-3 w-3"}),"Imported"]}):null,s.jsx("span",{children:ot(k.created_at)})]})]})]})]},k.id)})]}),re.length>z.length&&s.jsx("div",{className:"flex justify-center",children:s.jsxs(ue,{variant:"outline",onClick:()=>W(k=>k+Ge),"data-testid":"nest-show-more",children:["Show more (",re.length-z.length," left)"]})})]})]}),ve&&s.jsx(Ar,{nestId:ve.id,nestName:ve.name,nestDescription:ve.description,open:!0,onOpenChange:k=>{k||Se(null)},onRenamed:k=>{G.setQueryData(ze.nestList().queryKey,J=>J&&{...J,nests:J.nests.map(Q=>Q.id===k.id?{...Q,name:k.name,slug:k.slug,description:k.description}:Q)}),Se(null)}}),H&&s.jsx(Er,{nestId:H.id,nestName:H.name,isImported:H.isImported,open:!0,onOpenChange:k=>{k||te(null)},onDeleted:async()=>{te(null),await ke()},onArchived:n?void 0:async()=>{te(null),Ce.success(`"${H.name}" archived — find it under Archived`),await ke()}}),ce&&s.jsx(vr,{open:!0,onOpenChange:k=>!k&&oe(null),title:`Request removal of "${ce.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 k=>{await Ct(ce.id,"nest_archive",ce.id,k),Ce.success("Archive requested — a nest admin will review it")},onConfirm:async k=>{await Ct(ce.id,"nest",ce.id,k),Ce.success("Deletion requested — a nest admin will review it")}}),s.jsx(Ir,{open:!!R,onOpenChange:k=>{!k&&!F&&Z(null)},children:s.jsxs(Dr,{children:[s.jsxs(Or,{children:[s.jsxs(Rr,{children:["Restore “",R==null?void 0:R.name,"”?"]}),s.jsx(Fr,{children:"It goes back exactly as it was — same documents, versions and stewards. It returns to your dashboard, becomes writable again, and its published links and MCP access start answering."})]}),s.jsxs(Tr,{children:[s.jsx(Br,{disabled:F,children:"Cancel"}),s.jsx(Pr,{disabled:F,onClick:async k=>{if(k.preventDefault(),!!R){q(!0);try{await _r(R.id),Ce.success(`"${R.name}" restored`),Z(null),await ke()}catch(J){Ce.error((J==null?void 0:J.message)??"Failed to restore this nest")}finally{q(!1)}}},children:F?s.jsxs(s.Fragment,{children:[s.jsx(De,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Restoring..."]}):"Restore nest"})]})]})}),s.jsx(Ve,{open:!!he,onOpenChange:k=>{!k&&he&&le[he.name]||k||je(null)},children:s.jsxs(Xe,{className:"sm:max-w-[440px]",children:[s.jsxs(Je,{children:[s.jsxs(Qe,{className:"flex items-center gap-2 text-red-700",children:[s.jsx(Be,{className:"h-4 w-4"}),"Delete folder"]}),s.jsxs(dt,{children:["Permanently delete"," ",s.jsx("strong",{className:"text-foreground",children:he==null?void 0:he.label})," ","and its files from the server. This can't be undone. The folder won't be synced into a nest."]})]}),s.jsxs(ft,{className:"gap-2",children:[s.jsx(ue,{variant:"outline",onClick:()=>je(null),disabled:!!he&&!!le[he.name],children:"Cancel"}),s.jsx(ue,{variant:"destructive",onClick:()=>he&&Ne(he.name),disabled:!!he&&!!le[he.name],children:he&&le[he.name]?s.jsxs(s.Fragment,{children:[s.jsx(De,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Deleting…"]}):s.jsxs(s.Fragment,{children:[s.jsx(Be,{className:"h-3.5 w-3.5 mr-2"}),"Delete folder"]})})]})]})}),s.jsx(xn,{isOpen:T,onClose:()=>O(!1),onImported:ke})]})}function Tt({icon:M,title:V,desc:p,mono:S}){return s.jsxs("div",{className:"flex items-start gap-2 p-2 rounded bg-white/40",children:[s.jsx("div",{className:"text-muted-foreground mt-0.5",children:M}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium text-foreground",children:V}),s.jsx("div",{className:`text-muted-foreground ${S?"font-mono text-[10px]":""} truncate`,children:p})]})]})}function _n({value:M}){const[V,p]=se.useState(!1);return s.jsx("button",{onClick:async S=>{S.stopPropagation(),await ut(M)&&(p(!0),setTimeout(()=>p(!1),1200))},className:"ml-1 inline-flex items-center hover:text-foreground",children:V?s.jsx(Nr,{className:"h-3 w-3 text-green-600"}):s.jsx(Pt,{className:"h-3 w-3"})})}function bn({nests:M,onOpen:V,onDeclined:p}){const S=Ut(),{data:x}=mt(ze.unreadNotifications()),[c,o]=se.useState(null),r=((x==null?void 0:x.notifications)??[]).filter(n=>n.kind==="nest_invite"),a=M.filter(n=>r.some(h=>h.nest_id===n.id));if(a.length===0)return null;const v=n=>Cr(r.filter(h=>h.nest_id===n).map(h=>h.id)),y=()=>S.invalidateQueries({queryKey:ze.unreadNotifications().queryKey}),_=async n=>{o(n.id),await v(n.id).catch(()=>{}),await y(),o(null),V(n)},b=async n=>{o(n.id);try{const{left:h}=await Sr(n.id);h?(Ce.success(`Declined ${n.name}`),p()):Ce.info(`${n.name} was shared with your team, so it stays in your list.`)}catch(h){Ce.error((h==null?void 0:h.message)||"Couldn't decline this invite")}finally{await y(),o(null)}};return s.jsx(Pe,{className:"border-primary/30 bg-primary/5",children:s.jsxs(Ue,{className:"py-4 space-y-2",children:[s.jsx("p",{className:"font-medium text-sm",children:"Pending invites"}),a.map(n=>{var h;return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border bg-background p-3",children:[s.jsx(Ye,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium truncate",children:n.name}),s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:(h=r.find(i=>i.nest_id===n.id))==null?void 0:h.message})]}),s.jsx(ue,{size:"sm",disabled:c===n.id,onClick:()=>_(n),children:"Accept"}),s.jsx(ue,{size:"sm",variant:"outline",disabled:c===n.id,onClick:()=>b(n),children:"Decline"})]},n.id)})]})})}export{En as default};
|