1import{c as ye,j as t,r as y,S as tt,X as gt,B as Xr,U as dr,W as ur,C as mt,a as aa,b as Fu,P as Iu,d as Ff,e as Gs,f as hr,g as Kr,h as Rr,i as Pu,s as If,k as Du,l as en,m as Di,n as Hr,T as Pn,o as Pr,p as uo,q as ho,t as Pf,u as Df,v as Rf,w as Of,x as Kt,M as Mn,y as Ri,A as Mt,z as na,D as Ps,E as Or,F as Dn,G as Oi,H as ol,I as xi,J as Lf,K as Li,L as Ds,N as Dr,O as Bf,Q as ll,R as Ru,V as Ou,Y as fo,Z as Lu,_ as dl,$ as Mf,a0 as zf,a1 as Uf,a2 as Hf,a3 as Wf,a4 as Vf,a5 as qf,a6 as $f,a7 as Uc}from"./authRedirects-BCk9_Xbw.js";/** 2 * @license lucide-react v0.468.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 Hc=ye("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** 7 * @license lucide-react v0.468.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 gi=ye("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** 12 * @license lucide-react v0.468.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 Bu=ye("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** 17 * @license lucide-react v0.468.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Mu=ye("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 22 * @license lucide-react v0.468.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const Gf=ye("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** 27 * @license lucide-react v0.468.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const Xf=ye("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** 32 * @license lucide-react v0.468.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const Kf=ye("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** 37 * @license lucide-react v0.468.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const Yf=ye("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** 42 * @license lucide-react v0.468.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const zu=ye("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** 47 * @license lucide-react v0.468.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */const Sn=ye("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}
51],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** 52 * @license lucide-react v0.468.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */const Jf=ye("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** 57 * @license lucide-react v0.468.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */const Qf=ye("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** 62 * @license lucide-react v0.468.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */const Zf=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 67 * @license lucide-react v0.468.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */const po=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 72 * @license lucide-react v0.468.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */const zt=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 77 * @license lucide-react v0.468.0 - ISC 78 * 79 * This source code is licensed under the ISC license. 80 * See the LICENSE file in the root directory of this source tree. 81 */const Bi=ye("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** 82 * @license lucide-react v0.468.0 - ISC 83 * 84 * This source code is licensed under the ISC license. 85 * See the LICENSE file in the root directory of this source tree. 86 */const ep=ye("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** 87 * @license lucide-react v0.468.0 - ISC 88 * 89 * This source code is licensed under the ISC license. 90 * See the LICENSE file in the root directory of this source tree. 91 */const ul=ye("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** 92 * @license lucide-react v0.468.0 - ISC 93 * 94 * This source code is licensed under the ISC license. 95 * See the LICENSE file in the root directory of this source tree. 96 */const tp=ye("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** 97 * @license lucide-react v0.468.0 - ISC 98 * 99 * This source code is licensed under the ISC license. 100 * See the LICENSE file in the root directory of this source tree. 101 */const Ta=ye("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** 102 * @license lucide-react v0.468.0 - ISC 103 * 104 * This source code is licensed under the ISC license. 105 * See the LICENSE file in the root directory of this source tree. 106 */const Uu=ye("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** 107 * @license lucide-react v0.468.0 - ISC 108 * 109 * This source code is licensed under the ISC license. 110 * See the LICENSE file in the root directory of this source tree. 111 */const os=ye("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** 112 * @license lucide-react v0.468.0 - ISC 113 * 114 * This source code is licensed under the ISC license. 115 * See the LICENSE file in the root directory of this source tree. 116 */const rp=ye("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** 117 * @license lucide-react v0.468.0 - ISC 118 * 119 * This source code is licensed under the ISC license. 120 * See the LICENSE file in the root directory of this source tree. 121 */const Rs=ye("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}
121],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** 122 * @license lucide-react v0.468.0 - ISC 123 * 124 * This source code is licensed under the ISC license. 125 * See the LICENSE file in the root directory of this source tree. 126 */const hl=ye("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** 127 * @license lucide-react v0.468.0 - ISC 128 * 129 * This source code is licensed under the ISC license. 130 * See the LICENSE file in the root directory of this source tree. 131 */const Hu=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** 132 * @license lucide-react v0.468.0 - ISC 133 * 134 * This source code is licensed under the ISC license. 135 * See the LICENSE file in the root directory of this source tree. 136 */const vi=ye("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** 137 * @license lucide-react v0.468.0 - ISC 138 * 139 * This source code is licensed under the ISC license. 140 * See the LICENSE file in the root directory of this source tree. 141 */const Os=ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** 142 * @license lucide-react v0.468.0 - ISC 143 * 144 * This source code is licensed under the ISC license. 145 * See the LICENSE file in the root directory of this source tree. 146 */const Wu=ye("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** 147 * @license lucide-react v0.468.0 - ISC 148 * 149 * This source code is licensed under the ISC license. 150 * See the LICENSE file in the root directory of this source tree. 151 */const Tt=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** 152 * @license lucide-react v0.468.0 - ISC 153 * 154 * This source code is licensed under the ISC license. 155 * See the LICENSE file in the root directory of this source tree. 156 */const ap=ye("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** 157 * @license lucide-react v0.468.0 - ISC 158 * 159 * This source code is licensed under the ISC license. 160 * See the LICENSE file in the root directory of this source tree. 161 */const np=ye("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** 162 * @license lucide-react v0.468.0 - ISC 163 * 164 * This source code is licensed under the ISC license. 165 * See the LICENSE file in the root directory of this source tree. 166 */const sp=ye("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** 167 * @license lucide-react v0.468.0 - ISC 168 * 169 * This source code is licensed under the ISC license. 170 * See the LICENSE file in the root directory of this source tree. 171 */const ip=ye("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** 172 * @license lucide-react v0.468.0 - ISC 173 * 174 * This source code is licensed under the ISC license. 175 * See the LICENSE file in the root directory of this source tree. 176 */const cp=ye("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** 177 * @license lucide-react v0.468.0 - ISC 178 * 179 * This source code is licensed under the ISC license. 180 * See the LICENSE file in the root directory of this source tree. 181 */const Nn=ye("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** 182 * @license lucide-react v0.468.0 - ISC 183 * 184 * This source code is licensed under the ISC license. 185 * See the LICENSE file in the root directory of this source tree. 186 */const Vu=ye("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** 187 * @license lucide-react v0.468.0 - ISC 188 * 189 * This source code is licensed under the ISC license. 190 * See the LICENSE file in the root directory of this source tree.
191 */const op=ye("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 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 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** 192 * @license lucide-react v0.468.0 - ISC 193 * 194 * This source code is licensed under the ISC license. 195 * See the LICENSE file in the root directory of this source tree. 196 */const zn=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** 197 * @license lucide-react v0.468.0 - ISC 198 * 199 * This source code is licensed under the ISC license. 200 * See the LICENSE file in the root directory of this source tree. 201 */const lp=ye("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** 202 * @license lucide-react v0.468.0 - ISC 203 * 204 * This source code is licensed under the ISC license. 205 * See the LICENSE file in the root directory of this source tree. 206 */const dp=ye("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** 207 * @license lucide-react v0.468.0 - ISC 208 * 209 * This source code is licensed under the ISC license. 210 * See the LICENSE file in the root directory of this source tree. 211 */const qu=ye("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** 212 * @license lucide-react v0.468.0 - ISC 213 * 214 * This source code is licensed under the ISC license. 215 * See the LICENSE file in the root directory of this source tree. 216 */const up=ye("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** 217 * @license lucide-react v0.468.0 - ISC 218 * 219 * This source code is licensed under the ISC license. 220 * See the LICENSE file in the root directory of this source tree. 221 */const $u=ye("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** 222 * @license lucide-react v0.468.0 - ISC 223 * 224 * This source code is licensed under the ISC license. 225 * See the LICENSE file in the root directory of this source tree. 226 */const Cn=ye("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** 227 * @license lucide-react v0.468.0 - ISC 228 * 229 * This source code is licensed under the ISC license. 230 * See the LICENSE file in the root directory of this source tree. 231 */const hp=ye("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** 232 * @license lucide-react v0.468.0 - ISC 233 * 234 * This source code is licensed under the ISC license. 235 * See the LICENSE file in the root directory of this source tree. 236 */const fp=ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 237 * @license lucide-react v0.468.0 - ISC 238 * 239 * This source code is licensed under the ISC license. 240 * See the LICENSE file in the root directory of this source tree. 241 */const pp=ye("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** 242 * @license lucide-react v0.468.0 - ISC 243 * 244 * This source code is licensed under the ISC license. 245 * See the LICENSE file in the root directory of this source tree. 246 */const Yi=ye("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** 247 * @license lucide-react v0.468.0 - ISC 248 * 249 * This source code is licensed under the ISC license. 250 * See the LICENSE file in the root directory of this source tree. 251 */const fr=ye("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** 252 * @license lucide-react v0.468.0 - ISC 253 * 254 * This source code is licensed under the ISC license. 255 * See the LICENSE file in the root directory of this source tree. 256 */const mp=ye("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** 257 * @license lucide-react v0.468.0 - ISC 258 * 259 * This source code is licensed under the ISC license. 260 * See the LICENSE file in the root directory of this source tree.
261 */const Wa=ye("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** 262 * @license lucide-react v0.468.0 - ISC 263 * 264 * This source code is licensed under the ISC license. 265 * See the LICENSE file in the root directory of this source tree. 266 */const xp=ye("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** 267 * @license lucide-react v0.468.0 - ISC 268 * 269 * This source code is licensed under the ISC license. 270 * See the LICENSE file in the root directory of this source tree. 271 */const gr=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 272 * @license lucide-react v0.468.0 - ISC 273 * 274 * This source code is licensed under the ISC license. 275 * See the LICENSE file in the root directory of this source tree. 276 */const $a=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** 277 * @license lucide-react v0.468.0 - ISC 278 * 279 * This source code is licensed under the ISC license. 280 * See the LICENSE file in the root directory of this source tree. 281 */const Gu=ye("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** 282 * @license lucide-react v0.468.0 - ISC 283 * 284 * This source code is licensed under the ISC license. 285 * See the LICENSE file in the root directory of this source tree. 286 */const Ls=ye("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** 287 * @license lucide-react v0.468.0 - ISC 288 * 289 * This source code is licensed under the ISC license. 290 * See the LICENSE file in the root directory of this source tree. 291 */const gp=ye("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** 292 * @license lucide-react v0.468.0 - ISC 293 * 294 * This source code is licensed under the ISC license. 295 * See the LICENSE file in the root directory of this source tree. 296 */const Va=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** 297 * @license lucide-react v0.468.0 - ISC 298 * 299 * This source code is licensed under the ISC license. 300 * See the LICENSE file in the root directory of this source tree. 301 */const Wc=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** 302 * @license lucide-react v0.468.0 - ISC 303 * 304 * This source code is licensed under the ISC license. 305 * See the LICENSE file in the root directory of this source tree. 306 */const Xa=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** 307 * @license lucide-react v0.468.0 - ISC 308 * 309 * This source code is licensed under the ISC license. 310 * See the LICENSE file in the root directory of this source tree. 311 */const vp=ye("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** 312 * @license lucide-react v0.468.0 - ISC 313 * 314 * This source code is licensed under the ISC license. 315 * See the LICENSE file in the root directory of this source tree. 316 */const mo=ye("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 317 * @license lucide-react v0.468.0 - ISC 318 * 319 * This source code is licensed under the ISC license. 320 * See the LICENSE file in the root directory of this source tree. 321 */const qr=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 322 * @license lucide-react v0.468.0 - ISC 323 * 324 * This source code is licensed under the ISC license. 325 * See the LICENSE file in the root directory of this source tree. 326 */const yp=ye("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** 327 * @license lucide-react v0.468.0 - ISC 328 * 329 * This source code is licensed under the ISC license. 330 * See the LICENSE file in the root directory of this source tree. 331 */const En=ye("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** 332 * @license lucide-react v0.468.0 - ISC 333 * 334 * This source code is licensed under the ISC license. 335 * See the LICENSE file in the root directory of this source tree. 336 */const _p=ye("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** 337 * @license lucide-react v0.468.0 - ISC 338 * 339 * This source code is licensed under the ISC license. 340 * See the LICENSE file in the root directory of this source tree. 341 */const St=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** 342 * @license lucide-react v0.468.0 - ISC 343 * 344 * This source code is licensed under the ISC license. 345 * See the LICENSE file in the root directory of this source tree. 346 */const xo=ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** 347 * @license lucide-react v0.468.0 - ISC 348 * 349 * This source code is licensed under the ISC license. 350 * See the LICENSE file in the root directory of this source tree. 351 */const xa=ye("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** 352 * @license lucide-react v0.468.0 - ISC 353 * 354 * This source code is licensed under the ISC license. 355 * See the LICENSE file in the root directory of this source tree. 356 */const Yr=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 357 * @license lucide-react v0.468.0 - ISC 358 * 359 * This source code is licensed under the ISC license. 360 * See the LICENSE file in the root directory of this source tree. 361 */const Un=ye("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** 362 * @license lucide-react v0.468.0 - ISC 363 * 364 * This source code is licensed under the ISC license. 365 * See the LICENSE file in the root directory of this source tree. 366 */const bp=ye("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** 367 * @license lucide-react v0.468.0 - ISC 368 * 369 * This source code is licensed under the ISC license. 370 * See the LICENSE file in the root directory of this source tree. 371 */const jp=ye("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** 372 * @license lucide-react v0.468.0 - ISC 373 * 374 * This source code is licensed under the ISC license. 375 * See the LICENSE file in the root directory of this source tree. 376 */const go=ye("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** 377 * @license lucide-react v0.468.0 - ISC 378 * 379 * This source code is licensed under the ISC license. 380 * See the LICENSE file in the root directory of this source tree. 381 */const wp=ye("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
381y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** 382 * @license lucide-react v0.468.0 - ISC 383 * 384 * This source code is licensed under the ISC license. 385 * See the LICENSE file in the root directory of this source tree. 386 */const ta=ye("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** 387 * @license lucide-react v0.468.0 - ISC 388 * 389 * This source code is licensed under the ISC license. 390 * See the LICENSE file in the root directory of this source tree. 391 */const Xu=ye("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** 392 * @license lucide-react v0.468.0 - ISC 393 * 394 * This source code is licensed under the ISC license. 395 * See the LICENSE file in the root directory of this source tree. 396 */const ha=ye("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** 397 * @license lucide-react v0.468.0 - ISC 398 * 399 * This source code is licensed under the ISC license. 400 * See the LICENSE file in the root directory of this source tree. 401 */const kp=ye("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** 402 * @license lucide-react v0.468.0 - ISC 403 * 404 * This source code is licensed under the ISC license. 405 * See the LICENSE file in the root directory of this source tree. 406 */const Sp=ye("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** 407 * @license lucide-react v0.468.0 - ISC 408 * 409 * This source code is licensed under the ISC license. 410 * See the LICENSE file in the root directory of this source tree. 411 */const Np=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** 412 * @license lucide-react v0.468.0 - ISC 413 * 414 * This source code is licensed under the ISC license. 415 * See the LICENSE file in the root directory of this source tree. 416 */const gs=ye("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 417 * @license lucide-react v0.468.0 - ISC 418 * 419 * This source code is licensed under the ISC license. 420 * See the LICENSE file in the root directory of this source tree. 421 */const Jn=ye("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** 422 * @license lucide-react v0.468.0 - ISC 423 * 424 * This source code is licensed under the ISC license. 425 * See the LICENSE file in the root directory of this source tree. 426 */const Rn=ye("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 427 * @license lucide-react v0.468.0 - ISC 428 * 429 * This source code is licensed under the ISC license. 430 * See the LICENSE file in the root directory of this source tree. 431 */const fl=ye("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** 432 * @license lucide-react v0.468.0 - ISC 433 * 434 * This source code is licensed under the ISC license. 435 * See the LICENSE file in the root directory of this source tree. 436 */const vs=ye("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** 437 * @license lucide-react v0.468.0 - ISC 438 * 439 * This source code is licensed under the ISC license. 440 * See the LICENSE file in the root directory of this source tree. 441 */const pl=ye("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** 442 * @license lucide-react v0.468.0 - ISC 443 * 444 * This source code is licensed under the ISC license. 445 * See the LICENSE file in the root directory of this source tree. 446 */const Cp=ye("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** 447 * @license lucide-react v0.468.0 - ISC 448 * 449 * This source code is licensed under the ISC license. 450 * See the LICENSE file in the root directory of this source tree. 451 */const Ep=ye("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** 452 * @license lucide-react v0.468.0 - ISC 453 * 454 * This source code is licensed under the ISC license. 455 * See the LICENSE file in the root directory of this source tree. 456 */const Tp=ye("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** 457 * @license lucide-react v0.468.0 - ISC 458 * 459 * This source code is licensed under the ISC license. 460 * See the LICENSE file in the root directory of this source tree. 461 */const Ap=ye("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** 462 * @license lucide-react v0.468.0 - ISC 463 * 464 * This source code is licensed under the ISC license. 465 * See the LICENSE file in the root directory of this source tree. 466 */const Fp=ye("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** 467 * @license lucide-react v0.468.0 - ISC 468 * 469 * This source code is licensed under the ISC license. 470 * See the LICENSE file in the root directory of this source tree. 471 */const Ip=ye("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.5
4715 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]),Bs="/assets/smartbizhelper-ai-logo-ewWov30S.png",Pp="/assets/ness-wave-transparent-BFa5WRhA.png",Dp="https://www.goldendevco.com";function ml(){return t.jsx("a",{href:Dp,target:"_blank",rel:"noopener noreferrer",children:"Golden Devco, Inc."})}const Rp="SmartBizHelper⢠â A product of",Op="© 2026";function Ra({className:e=""}){const r=["portal-ownership-footer",e].filter(Boolean).join(" ");return t.jsxs("footer",{className:r,"aria-label":"SmartBizHelper ownership",children:[t.jsxs("nav",{className:"portal-public-links","aria-label":"Help and policies",children:[t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/terms",children:"Terms"}),t.jsx("a",{href:"/privacy",children:"Privacy"}),t.jsx("a",{href:"/data-deletion",children:"Data Deletion"})]}),t.jsxs("span",{children:[Rp," ",t.jsx(ml,{})]}),t.jsxs("small",{children:[Op," ",t.jsx(ml,{})]})]})}const Ku=[["view_review","View review queue"],["approve","Approve"],["reject","Reject"]],xl=Object.fromEntries(Ku.map(([e])=>[e,!1]));function Xs(e,r,a,n){var c;const s=r===a?"Explicit":"Inherited",i=(c=n.find(o=>o.id===r))==null?void 0:c.display_name;return`${s} ${e?"ON":"OFF"}${s==="Inherited"&&i?` · ${i}`:""}`}function Lp({supabase:e}){var V;const[r,a]=y.useState(null),[n,s]=y.useState(""),[i,c]=y.useState("grants"),[o,l]=y.useState(""),[d,u]=y.useState(!1),[h,f]=y.useState(""),[m,x]=y.useState(""),[p,g]=y.useState(null),[w,S]=y.useState({scope_key:"",scope_type:"state",display_name:"",parent_key:"US-SE",country_code:"US",subdivision_code:"",locality_code:""}),[b,j]=y.useState({approaching:30,closing:7}),[k,N]=y.useState(""),[C,P]=y.useState({user_id:"",...xl}),T=(r==null?void 0:r.scopes.find(I=>I.id===n))??null,L=(r==null?void 0:r.types.find(I=>I.type_key===i))??null,M=((V=r==null?void 0:r.configurations.find(I=>I.scope_id===n&&I.type_key===i))==null?void 0:V.configuration)??null,E=r==null?void 0:r.type_sources.find(I=>I.type_key===i&&I.source_id===o),W=(r==null?void 0:r.sources.find(I=>I.id===o))??null,ee=r==null?void 0:r.deadline_policies.find(I=>I.type_key===i),ce=y.useMemo(()=>(r==null?void 0:r.sources)??[],[r]),ue=y.useCallback(async()=>{x("");const I=await e.rpc("sbh_admin_discovery_v1_control_center");if(I.error){a(null),x(I.error.message||"Platform-owner access is required to load Discovery controls.");return}const D=I.data;a(D),s(z=>{var Y,re;return z&&D.scopes.some(oe=>oe.id===z)?z:((Y=D.scopes.find(oe=>oe.scope_key==="US-GA"))==null?void 0:Y.id)??((re=D.scopes.find(oe=>oe.scope_type!=="global"))==null?void 0:re.id)??""}),c(z=>z&&D.types.some(Y=>Y.type_key===z)?z:"grants");const K=D.deadline_policies.find(z=>z.type_key===i);K&&j({approaching:K.approaching_days,closing:K.closing_soon_days})},[e,i]);y.useEffect(()=>{ue()},[ue]),y.useEffect(()=>{let I=!0;return!n||!i||!o?(g(null),()=>{I=!1}):(e.rpc("sbh_discovery_resolve_configuration",{p_scope_id:n,p_type_key:i,p_source_id:o}).then(D=>{I&&g(D.error?null:D.data)}),()=>{I=!1})},[e,n,i,o,r==null?void 0:r.source_overrides,r==null?void 0:r.type_sources]);async function te(I,D,K){u(!0),f(""),x("");const z=await e.rpc(I,D);z.error?x(z.error.message||"Discovery control update was denied."):(f(K),await ue()),u(!1)}const fe=M==null?void 0:M.geography,q=M==null?void 0:M.type_control;y.useEffect(()=>{N((q==null?void 0:q.cadence_minutes)==null?"":String(q.cadence_minutes))},[n,i,q==null?void 0:q.cadence_minutes]);const J=(I,D)=>void te("sbh_admin_discovery_v1_set_geo_type",{p_scope_id:n,p_type_key:i,p_setting:I,p_value:D},`${I} control saved.`);async function le(I){!n||!i||!o||await te("sbh_admin_discovery_v1_set_source",{p_scope_id:n,p_type_key:i,p_source_id:o,p_enabled:I,p_cadence_minutes:null},`Source is ${I==="inherit"?"inherited":`explicitly ${I.toUpperCase()}`}.`)}async function A(I){if(I.preventDefault(),!n||!i)return;const{user_id:D,view_review:K,approve:z,reject:Y}=C;await te("sbh_admin_discovery_v1_assign_moderator",{p_user_id:D,p_scope_id:n,p_type_key:i,p_capabilities:{view_review:K,approve:z,reject:Y},p_active:!0},"Geography + Discovery type moderator assignment saved."),P({user_id:"",...xl})}return r?t.jsxs("section",{className:"admin-panel discovery-v1-panel",id:"global-discovery-v1-console","data-automation-hook":"global-discovery.v1-controls",children:[t.jsxs("header",{className:"discovery-v1-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"U.S. V1 · international-ready model"}),t.jsx("h2",{children:"Global Discovery control plane"}),t.jsx("p",{children:"Production starts at Georgia. Every type, geography, source, cadence and review switch is server-resolved; OFF means NATE does not fetch. New geography and type controls start explicitly OFF until the Platform Owner chooses otherwise."})]}),t.jsx("button",{type:"button",className:"admin-panel-heading-action",onClick:()=>void ue(),"aria-label":"Refresh Discovery V1 controls",title:"Refresh",children:t.jsx(St,{size:20})})]}),t.jsxs("div",{className:"discovery-v1-master",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Master Global Discovery kill switch"}),t.jsx("span",{children:r.master_enabled?"ON â scoped controls still apply":"OFF â every NATE run is denied"})]}),t.jsx("button",{type:"button",className:r.master_enabled?"danger-action":"admin-save",disabled:d,onClick:()=>{const I=!r.master_enabled;I&&!window.confirm("Turn on the master Discovery kill switch? All V1 geography, type, queue and source controls must still authorize a run.")||te("sbh_admin_discovery_set_master",{p_enabled:I},`Master kill switch is ${I?"ON":"OFF"}.`)},children:r.master_enabled?"Turn master OFF":"Master OFF · enable"})]}),t.jsxs("div",{className:"discovery-v1-grid",children:[t.jsxs("label",{children:["Geography",t.jsx("select",{value:n,onChange:I=>s(I.target.value),children:r.scopes.filter(I=>I.scope_type!=="global").map(I=>t.jsxs("option",{value:I.id,children:[I.display_name," · ",I.scope_type.replaceAll("_"," ")]},I.id))})]}),t.jsxs("label",{children:["Discovery type",t.jsx("select",{value:i,onChange:I=>{c(I.target.value);const D=r.deadline_policies.find(K=>K.type_key===I.target.value);D&&j({approaching:D.approaching_days,closing:D.closing_soon_days})},children:r.types.map(I=>t.jsxs("option",{value:I.type_key,children:[I.display_name,I.family==="event"?" · future/Event":""]},I.type_key))})]}),T&&t.jsxs("div",{className:"discovery-v1-control",children:[t.jsx("strong",{children:"Geographic Discovery"}),t.jsx("span",{children:Xs(!!(fe!=null&&fe.value),(fe==null?void 0:fe.source_scope_id)??null,T.id,r.scopes)}),t.jsxs("div",{children:[t.jsx("button",{disabled:d||T.scope_type==="global",onClick:()=>
471void te("sbh_admin_discovery_v1_set_scope",{p_scope_id:T.id,p_enabled:!0},`${T.display_name} set explicitly ON.`),children:"Explicit ON"}),t.jsx("button",{disabled:d||T.scope_type==="global",onClick:()=>void te("sbh_admin_discovery_v1_set_scope",{p_scope_id:T.id,p_enabled:!1},`${T.display_name} set explicitly OFF.`),children:"Explicit OFF"}),t.jsx("button",{disabled:d||T.scope_type==="global",onClick:()=>void te("sbh_admin_discovery_v1_set_scope",{p_scope_id:T.id,p_enabled:null},`${T.display_name} now inherits.`),children:"Use inherited"})]})]}),L&&t.jsxs("div",{className:"discovery-v1-control",children:[t.jsxs("strong",{children:[L.display_name," · type-level switch"]}),t.jsx("span",{children:L.operational_enabled?"Enabled for scoped configuration":"OFF · type is not operational"}),t.jsx("button",{disabled:d,onClick:()=>{const I=!L.operational_enabled;I&&!window.confirm(`Make ${L.display_name} available for explicit geographic enablement?`)||te("sbh_admin_discovery_v1_set_type",{p_type_key:i,p_enabled:I},`${L.display_name} ${I?"available":"OFF"}.`)},children:L.operational_enabled?"Turn type OFF":"Enable type availability"})]}),L&&T&&t.jsxs("div",{className:"discovery-v1-control discovery-v1-span",children:[t.jsxs("strong",{children:[T.display_name," à ",L.display_name]}),t.jsxs("span",{children:["Type: ",Xs(!!(q!=null&&q.enabled),(q==null?void 0:q.enabled_source_scope_id)??null,T.id,r.scopes)," · Review queue: ",Xs(!!(q!=null&&q.review_queue_enabled),(q==null?void 0:q.review_source_scope_id)??null,T.id,r.scopes)," · ",q!=null&&q.paused?"PAUSED":"not paused"]}),t.jsx("div",{className:"discovery-v1-setting-row",children:[["enabled","Discovery type"],["review_queue","Review queue"],["paused","Pause/resume"]].map(([I,D])=>t.jsxs("fieldset",{children:[t.jsx("legend",{children:D}),t.jsx("button",{type:"button",disabled:d,onClick:()=>J(I,"on"),children:"Explicit ON"}),t.jsx("button",{type:"button",disabled:d,onClick:()=>J(I,"off"),children:"Explicit OFF"}),t.jsx("button",{type:"button",disabled:d,onClick:()=>J(I,"inherit"),children:"Inherit"})]},I))}),t.jsxs("label",{children:["Type cadence override (minutes)",t.jsx("input",{type:"number",min:"15",max:"10080",value:k,placeholder:"Inherited / manual only",onChange:I=>N(I.target.value),onBlur:()=>void te("sbh_admin_discovery_v1_set_geo_cadence",{p_scope_id:n,p_type_key:i,p_cadence_minutes:k?Number(k):null},"Type cadence override saved.")}),t.jsx("span",{children:q!=null&&q.cadence_minutes?`Effective cadence: every ${q.cadence_minutes} minutes`:"No effective cadence: manual execution only; no schedule is configured."})]})]})]}),t.jsxs("div",{className:"discovery-v1-card",children:[t.jsx("h3",{children:"Approved source and scoped source control"}),t.jsxs("div",{className:"discovery-v1-grid",children:[t.jsxs("label",{children:["Source",t.jsxs("select",{value:o,onChange:I=>l(I.target.value),children:[t.jsx("option",{value:"",children:"Choose source"}),ce.map(I=>t.jsxs("option",{value:I.id,children:[I.name," · ",I.terms_status,I.enabled?" · registry ON":" · registry OFF"]},I.id))]})]}),W&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"discovery-v1-control",children:[t.jsx("strong",{children:"Source registry"}),t.jsx("span",{children:W.terms_status==="approved"?W.enabled?"Approved and enabled":"Terms approved · registry OFF":`Unavailable: ${W.terms_status}`}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:!!W.enabled,disabled:d||W.terms_status!=="approved",onChange:I=>void te("sbh_admin_discovery_v1_set_source_registry",{p_source_id:o,p_enabled:I.target.checked},"Source registry state saved.")}),"Enable approved source globally"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:!!(E!=null&&E.enabled),disabled:d||W.terms_status!=="approved",onChange:I=>void te("sbh_admin_discovery_v1_set_type_source",{p_type_key:i,p_source_id:o,p_enabled:I.target.checked},"Source/type allowlist saved.")}),"Allow this approved source for the selected type"]})]}),t.jsxs("div",{className:"discovery-v1-control",children:[t.jsx("strong",{children:"Geographic source state"}),t.jsx("span",{children:p!=null&&p.source?Xs(!!p.source.enabled,p.source.source_scope_id??null,
471n,r.scopes):"No geographic override · inherited OFF"}),t.jsxs("div",{children:[t.jsx("button",{type:"button",disabled:d||!(E!=null&&E.enabled)||!W.enabled||W.terms_status!=="approved",onClick:()=>void le("on"),children:"Explicit ON"}),t.jsx("button",{type:"button",disabled:d||!E,onClick:()=>void le("off"),children:"Explicit OFF"}),t.jsx("button",{type:"button",disabled:d||!E,onClick:()=>void le("inherit"),children:"Use inherited"})]}),t.jsxs("label",{children:["Source cadence override (minutes)",t.jsx("input",{type:"number",min:"15",max:"10080",placeholder:String((q==null?void 0:q.cadence_minutes)??"Inherit / manual only"),onBlur:I=>{var K;const D=I.target.value?Number(I.target.value):null;!n||!i||!o||!E||te("sbh_admin_discovery_v1_set_source",{p_scope_id:n,p_type_key:i,p_source_id:o,p_enabled:((K=p==null?void 0:p.source)==null?void 0:K.source_scope_id)===n?p.source.enabled?"on":"off":"inherit",p_cadence_minutes:D},"Source cadence override saved.")}})]})]})]})]})]}),t.jsxs("div",{className:"discovery-v1-grid",children:[t.jsxs("form",{className:"discovery-v1-card",onSubmit:I=>{I.preventDefault(),te("sbh_admin_discovery_v1_upsert_scope",{p_scope_key:w.scope_key,p_scope_type:w.scope_type,p_display_name:w.display_name,p_parent_key:w.parent_key,p_country_code:w.country_code||null,p_subdivision_code:w.subdivision_code||null,p_locality_code:w.locality_code||null},"Geographic scope created with inherited effective OFF defaults.")},children:[t.jsx("h3",{children:"Add geography · OFF by inheritance"}),t.jsxs("label",{children:["Scope key",t.jsx("input",{required:!0,value:w.scope_key,onChange:I=>S({...w,scope_key:I.target.value})})]}),t.jsxs("label",{children:["Level",t.jsxs("select",{value:w.scope_type,onChange:I=>S({...w,scope_type:I.target.value}),children:[t.jsx("option",{value:"country",children:"Country"}),t.jsx("option",{value:"us_region",children:"U.S. Region"}),t.jsx("option",{value:"state",children:"State"}),t.jsx("option",{value:"admin_region",children:"Administrative Region / Province"}),t.jsx("option",{value:"metro",children:"Metro / Region"}),t.jsx("option",{value:"locality",children:"Locality"})]})]}),t.jsxs("label",{children:["Name",t.jsx("input",{required:!0,value:w.display_name,onChange:I=>S({...w,display_name:I.target.value})})]}),t.jsxs("label",{children:["Parent",t.jsx("select",{value:w.parent_key,onChange:I=>S({...w,parent_key:I.target.value}),children:r.scopes.map(I=>t.jsxs("option",{value:I.scope_key,children:[I.display_name," · ",I.scope_type]},I.scope_key))})]}),t.jsxs("label",{children:["Country code",t.jsx("input",{maxLength:2,value:w.country_code,onChange:I=>S({...w,country_code:I.target.value.toUpperCase()})})]}),t.jsxs("label",{children:["State / subdivision code",t.jsx("input",{value:w.subdivision_code,onChange:I=>S({...w,subdivision_code:I.target.value.toUpperCase()})})]}),t.jsx("button",{className:"admin-save",disabled:d,children:"Create scope"})]}),L&&t.jsxs("form",{className:"discovery-v1-card",onSubmit:I=>{I.preventDefault(),te("sbh_admin_discovery_v1_set_deadline_policy",{p_type_key:i,p_approaching_days:b.approaching,p_closing_soon_days:b.closing},"Deadline lifecycle thresholds saved.")},children:[t.jsxs("h3",{children:[L.display_name," deadline awareness"]}),t.jsx("p",{children:"Candidate state is derived as Open â Deadline Approaching â Closing Soon â Closed/Expired. Expired items are excluded from actionable public reads."}),t.jsxs("label",{children:["Deadline approaching (days)",t.jsx("input",{type:"number",min:"1",max:"365",value:b.approaching,onChange:I=>j({...b,approaching:Number(I.target.value)})})]}),t.jsxs("label",{children:["Closing soon (days)",t.jsx("input",{type:"number",min:"1",max:"90",value:b.closing,onChange:I=>j({...b,closing:Number(I.target.value)})})]}),t.jsx("button",{className:"admin-save",disabled:d||b.closing>=b.approaching,children:"Save thresholds"}),ee&&t.jsxs("span",{children:["Current: ",ee.approaching_days," / ",ee.closing_soon_days," days"]})]})]}),t.jsxs("form",{className:"discovery-v1-card",onSubmit:I=>void A(I),children:[t.jsx("h3",{children:"Assign moderator by geography + Discovery type"}),t.jsx("p",{children:"Ambassador status grants no authority. The database enforces each selected review capability at the exact scope and type."}),t.jsxs("div",{className:"discovery-v1-grid",children:[t.jsxs("label",{children:["Moderator user UUID",t.jsx("input",{required:!0,value:C.user_id,onChange:I=>P({...C,user_id:I.target.value})})]}),t.jsxs("div",{className:"discovery-v1-control",children:[t.jsxs("strong",{children:[T==null?void 0:T.display_name," · ",L==null?void 0:L.display_name]}),t.jsx("div",{className:"discovery-v1-setting-row",children:Ku.map(([I,D])=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:C[I],onChange:K=>P({...C,[I]:K.target.checked})}),D]},I))})]})]}),t.jsx("button",{className:"admin-save",disabled:d||!n||!i,children:"Save least-privilege assignment"}),t.jsx("div",{className:"discovery-v1-moderators",children:r.moderators.map(I=>t.jsxs("span",{children:[t.jsx(tt,{size:14}),I.user_id," · ",I.scope_name," · ",I.type_name," · ",I.active?"active":"removed",I.active&&t.jsx("button",{type:"button",disabled:d,onClick:()=>
471void te("sbh_admin_discovery_v1_assign_moderator",{p_user_id:I.user_id,p_scope_id:I.scope_id,p_type_key:I.type_key,p_capabilities:{view_review:I.can_view_review,approve:I.can_approve,reject:I.can_reject},p_active:!1},"Moderator assignment removed."),children:"Remove"})]},I.id))})]}),h&&t.jsx("p",{className:"discovery-v1-success",role:"status",children:h}),m&&t.jsx("p",{className:"discovery-v1-error",role:"alert",children:m})]}):t.jsx("section",{className:"admin-panel discovery-v1-panel",id:"global-discovery-v1-console","data-automation-hook":"global-discovery.v1-controls",children:t.jsxs("div",{className:"admin-empty",children:[t.jsx($a,{}),t.jsx("strong",{children:"Global Discovery V1 controls unavailable"}),t.jsx("span",{children:m||"The controls remain fail-closed until the reviewed V1 migration is deployed and this authenticated platform-owner session is authorized."})]})})}const Bp=[{key:"smart_inventory",name:"Smart Inventory",group:"Smart Suites",description:"Inventory, purchasing, forecasting, and connected commerce.",enabled:!0},{key:"smart_sku",name:"Smart SKU",group:"Smart Suites",description:"SKU creation and product setup.",enabled:!0},{key:"smart_crm",name:"Smart CRM",group:"Smart Suites",description:"Customer and business relationship tools.",enabled:!0},{key:"smart_finance",name:"Smart Finance",group:"Smart Suites",description:"Financial clarity, planning, and reporting.",enabled:!0},{key:"smart_loyalty",name:"Smart Loyalty",group:"Smart Suites",description:"Customer loyalty and rewards.",enabled:!0},{key:"smart_scanner",name:"Smart Scanner",group:"Smart Suites",description:"Camera, barcode, and product recognition workflows.",enabled:!0},{key:"smart_content",name:"Smart Content",group:"Smart Suites",description:"Content planning, approval, and publishing.",enabled:!0},{key:"smart_clips",name:"Smart Clips",group:"Smart Suites",description:"Short-form video clipping and rendering.",enabled:!0},{key:"smart_websites",name:"Smart Websites",group:"Smart Suites",description:"Website design and management.",enabled:!0},{key:"global_discovery",name:"Opportunities & Events",group:"Community",description:"Opportunity and event discovery.",enabled:!0},{key:"barterplace",name:"BarterPlace",group:"Community",description:"Business-to-business marketplace experiences.",enabled:!0},{key:"client_portal",name:"Client Portal",group:"Platform",description:"Authenticated SmartBizHelper workspace and Lobby.",enabled:!0},{key:"api_integrations",name:"APIs & Integrations",group:"Platform",description:"Connected platform APIs, webhooks, and integrations.",enabled:!0}],Vc={unknown:"Status unavailable",operational:"Operational",degraded:"Degraded performance",partial_outage:"Partial outage",major_outage:"Major outage",maintenance:"Maintenance"};function Mp(){return Bp.map(e=>({...e,health:"unknown",checkedAt:null}))}const zp=3600*1e3;function Up(e,r=Date.now()){return e.map(a=>{const n=a.checked_at?Date.parse(a.checked_at):NaN,s=Number.isFinite(n)&&r-n<=zp;return{key:a.key,name:a.name,group:a.group,description:a.description,enabled:a.enabled,health:a.health!=="operational"||s?a.health:"unknown",checkedAt:a.checked_at??null}})}function Hp(e){const r={operational:0,unknown:1,maintenance:2,degraded:3,partial_outage:4,major_outage:5};return e.filter(a=>a.enabled).reduce((a,n)=>r[n.health]>r[a]?n.health:a,"operational")}const Wp=["operational","degraded","partial_outage","major_outage"],Vp=["degraded","partial_outage","major_outage","maintenance"],qp=["investigating","identified","monitoring","resolved"],Qn=e=>Vc[e]??e;function $p({supabase:e}){const[r,a]=y.useState(null),[n,s]=y.useState(!1),[i,c]=y.useState(null),[o,l]=y.useState({}),[d,u]=y.useState({}),[h,f]=y.useState({title:"",impact:"degraded",message:"",components:[]}),m=y.useCallback(async()=>{if(!e)return;const{data:p,error:g}=await e.rpc("sbh_admin_status_operations");if(g){s(!0),a(null);return}s(!1),a(p)},[e]);y.useEffect(()=>{m()},[m]);async function x(p,g,w){const{error:S}=await e.rpc(p,g);c(S?`Failed: ${S.message}`:w),S||await m()}return n||!r?t.jsx("section",{className:"admin-panel",id:"status-operations","data-automation-hook":"status.operations",children:t.jsx("div",{className:"admin-panel-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Status"}),t.jsx("h2",{children:"Status Operations"}),t.jsx("p",{children:n?"Platform admin access required.":"Loadingâ¦"})]})})}):t.jsxs("section",{className:"admin-panel",id:"status-operations","data-automation-hook":"status.operations",children:[t.jsx("div",{className:"admin-panel-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Status"}),t.jsx("h2",{children:"Status Operations"}),t.jsx("p",{children:"Detected health comes from automatic probes. An admin override or maintenance state replaces it publicly and is audited."})]})}),i&&t.jsx("p",{role:"status",children:i}),t.jsx("div",{className:"status-ops-table",style:{overflowX:"auto"},children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Component"}),t.jsx("th",{children:"Detected (automatic)"}),t.jsx("th",{children:"Published"}),t.jsx("th",{children:"Override / maintenance"})]})}),t.jsx("tbody",{children:r.components.map(p=>t.jsxs("tr",{children:[t.jsx("td",{children:p.name}),t.jsx("td",{children:p.last_checked_at?Qn(p.detected_health):"Status unavailable"}),t.jsxs("td",{children:[Qn(p.published_health),p.override_health&&t.jsxs("small",{children:[" (admin override",p.override_reason?`: ${p.override_reason}`:"",")"]})]}),t.jsxs("td",{children:[t.jsx("select",{"aria-label":`Override for ${p.name}`,value:d[p.key]??"degraded",onChange:g=>u({...d,[p.key]:g.target.value}),children:Wp.map(g=>t.jsx("option",{value:g,children:Qn(g)},g))}),t.jsx("input",{"aria-label":`Reason for ${p.name}`,placeholder:"Reason",value:o[p.key]??"",onChange:g=>l({...o,[p.key]:g.target.value})}),t.jsx("button",{type:"button",onClick:()=>x("sbh_admin_set_status_override",{p_component_key:p.key,p_health:d[p.key]??"degraded",p_reason:o[p.key]??null},`Override set for ${p.name}.`),children:"Set override"}),t.jsx("button",{type:"button",onClick:()=>x("sbh_admin_set_status_maintenance",{p_component_key:p.key,p_active:!0,p_reason:o[p.key]??null},`Maintenance started for ${p.name}.`),children:"Start maintenance"}),p.override_health&&t.jsx("button",{type:"button",onClick:()=>x(p.override_health==="maintenance"?"sbh_admin_set_status_maintenance":"sbh_admin_set_status_override",p.override_health==="maintenance"?{p_component_key:p.key,p_active:!1,p_reason:null}:{p_component_key:p.key,p_health:null,p_reason:null},`Cleared for ${p.name}.`),children:"Clear"})]})]},p.key))})]})}),t.jsx("h3",{children:"Incidents"}),r.open_incidents.length===0&&t.jsx("p",{children:"No open incidents."}),r.open_incidents.map(p=>t.jsxs("div",{children:[t.jsx("strong",{children:p.title})," â ",p.status," (",Qn(p.impact),")",qp.filter(g=>g!==p.status).map(g=>t.jsx("button",{type:"button",onClick:()=>x("sbh_admin_update_status_incident",{p_incident_id:p.id,p_status:g,p_message:null},`Incident ${g}.`),children:g},g))]}
471,p.id)),t.jsxs("form",{onSubmit:p=>{p.preventDefault(),x("sbh_admin_open_status_incident",{p_title:h.title,p_impact:h.impact,p_message:h.message,p_component_keys:h.components},"Incident opened.")},children:[t.jsx("input",{"aria-label":"Incident title",placeholder:"Title",value:h.title,onChange:p=>f({...h,title:p.target.value})}),t.jsx("select",{"aria-label":"Incident impact",value:h.impact,onChange:p=>f({...h,impact:p.target.value}),children:Vp.map(p=>t.jsx("option",{value:p,children:Qn(p)},p))}),t.jsx("input",{"aria-label":"Incident message",placeholder:"Public message",value:h.message,onChange:p=>f({...h,message:p.target.value})}),t.jsx("select",{"aria-label":"Affected components",multiple:!0,value:h.components,onChange:p=>f({...h,components:Array.from(p.target.selectedOptions,g=>g.value)}),children:r.components.map(p=>t.jsx("option",{value:p.key,children:p.name},p.key))}),t.jsx("button",{type:"submit",children:"Open incident"})]})]})}const Gp=["All","Requires Local Lab","Available Avengers","Assigned/Active Avengers","ACK Pending","Waiting on Shaun","Blocked","Ready for QA","Green/Recently Completed"],Xp=[["HANK_CLOUD",'ACK this Mission Control wake test. Respond "Hank online." Complete this test without modifying repository code, configuration, infrastru
471cture, or application/business data.'],["FRANK_CLOUD",'ACK this Mission Control wake test. Respond "Frank online." Complete this test without modifying repository code, configuration, infrastructure, or application/business data.'],["TANK_CLOUD",'ACK this Mission Control wake test. Respond "Tank online." Complete this test without modifying repository code, configuration, infrastructure, or application/business data.'],["CLAUDE_CLOUD",'ACK this Mission Control wake test. Respond "Claude online." Complete this test without modifying repository code, configuration, infrastructure, or application/business data.'],["DEX_CLOUD",'ACK this Mission Control Production wake test. Respond "Dex online." Complete the test without modifying repository code, configuration, infrastructure, credentials, or application/business data.'],["CATALINA_CLOUD",'ACK this Mission Control Production wake test. Respond "Cat online." Complete the test without modifying repository code, configuration, infrastructure, credentials, or application/business data.']],Yu=(e,r)=>{var n;const a=(n=e==null?void 0:e.data)==null?void 0:n.error;return typeof a=="string"&&/^[A-Z0-9_:-]{1,96}$/.test(a)?a:r};async function Kp(e,r,a){var i;const n=crypto.randomUUID(),s=await e.functions.invoke("mission-control-rest",{body:{operation:"submit_mission",request_id:n,correlation_id:n,payload:{objective:a,project:"Mission Control Production roll call",lane:"CLOUD AVENGER",avenger_key:r,execution_profile:"provider_managed"}}});if(s.error||((i=s.data)==null?void 0:i.ok)!==!0)throw new Error(Yu(s,"MISSION_SUBMISSION_FAILED"));return s.data.result}function Yp(e,r){switch(r){case"Requires Local Lab":return e.requires_local_lab;case"Available Avengers":return e.availability==="AVAILABLE";case"Assigned/Active Avengers":return["ASSIGNED","ACTIVE"].includes(e.availability);case"ACK Pending":return e.ack_status==="PENDING"&&!["COMPLETE","STOPPED","CANCELLED","REJECTED","DEAD_LETTER"].includes(e.job_status);case"Waiting on Shaun":return e.job_status==="WAITING_FOR_HUMAN"||!!e.human_gate;case"Blocked":return["BLOCKED","STALLED","LAUNCH_FAILED","FAILED","DEAD_LETTER"].includes(e.job_status);case"Ready for QA":return e.job_status==="READY FOR QA";case"Green/Recently Completed":return["GREEN","COMPLETE"].includes(e.job_status);default:return!0}}function Jp(e,r,a){let n=!1,s=0,i=null,c=null,o=null;const l=()=>{i&&(e.removeChannel(i),i=null),c&&(clearInterval(c),c=null)},d=async()=>{const h=++s;l(),r(null),a("Connecting");let f=!1,m=!1;const x=async()=>{var p,g,w,S;if(!(n||h!==s)){if(f){m=!0;return}f=!0;try{const b=await e.auth.getSession();if(n||h!==s)return;if(b.error||!((g=(p=b.data)==null?void 0:p.session)!=null&&g.access_token))throw new Error("AUTH");const j=crypto.randomUUID(),k=await e.functions.invoke("mission-control-rest",{headers:{Authorization:"Bearer "+b.data.session.access_token},body:{operation:"get_operational_state",request_id:j,correlation_id:j,payload:{}}});if(n||h!==s)return;const N=(w=k.data)==null?void 0:w.result;if(k.error||((S=k.data)==null?void 0:S.ok)!==!0||!Array.isArray(N==null?void 0:N.missions)||!Array.isArray(N==null?void 0:N.availability))throw new Error(Yu(k,"READ"));r(N)}catch(b){!n&&h===s&&(r(null),a(`Unavailable â ${b instanceof Error?b.message:"READ"}`))}finally{f=!1,m&&!n&&h===s&&(m=!1,x())}}};if(o=x,await x(),!(n||h!==s)){c=setInterval(()=>void x(),3e4);try{const p=await e.rpc("mission_control_realtime_topic");if(n||h!==s)return;if(p.error||typeof p.data!="string"||!p.data.startsWith("mission-control:"))throw new Error("TOPIC");if(await e.realtime.setAuth(),n||h!==s)return;i=e.channel(p.data,{config:{private:!0}}).on("broadcast",{event:"invalidate"},()=>void x()).subscribe(g=>{n||h!==s||(a(g==="SUBSCRIBED"?"Live":"Refreshing every 30 seconds"),g==="SUBSCRIBED"&&x())})}catch{!n&&h===s&&a("Refreshing every 30 seconds")}}},u=e.auth.onAuthStateChange(()=>{queueMicrotask(()=>{n||d()})});return d(),{refresh:()=>o==null?void 0:o(),dispose:()=>{n=!0,s++,l(),u.data.subscription.unsubscribe(),r(null)}}}const Ht=e=>e==null||e===""?"â":String(e);function Qp({supabase:e,platformAdmin:r}){const[a,n]=y.useState(null),[s,i]=y.useState("Connecting"),[c,o]=y.useState("All"),[l,d]=y.useState(null),[u,h]=y.useState(!1),[f,m]=y.useState(null),[x,p]=y.useState(null),g=y.useRef(null);y.useEffect(()=>{if(!e){i("Unavailable"),n(null);return}return g.current=Jp(e,n,i),()=>{var k;(k=g.current)==null||k.dispose(),g.current=null}},[e]);const w=async()=>{var k,N,C;if(!(!r||u||!e)){h(!0),d(null);try{const P=await e.functions.invoke("mission-control-authority-provision",{body:{}});if(P.error||((k=P.data)==null?void 0:k.ok)!==!0)throw new Error(((N=P.data)==null?void 0:N.error)??"AUTHORITY_PROVISIONING_FAILED");
471d({tone:"success",text:"Mission Control authority is active for this verified session."}),await((C=g.current)==null?void 0:C.refresh())}catch(P){const T=P instanceof Error?P.message:"AUTHORITY_PROVISIONING_FAILED";d({tone:"error",text:`Mission Control activation failed: ${T}`})}finally{h(!1)}}},S=async(k,N)=>{var C;if(!(!r||x||!e)){p(k),m(null);try{const P=await Kp(e,k,N),T=typeof(P==null?void 0:P.mission_id)=="string"?P.mission_id:"accepted";m({key:k,tone:"success",text:`${k} mission accepted by Mission Control (${T}).`}),await((C=g.current)==null?void 0:C.refresh())}catch(P){m({key:k,tone:"error",text:`${k} mission failed: ${P instanceof Error?P.message:"MISSION_SUBMISSION_FAILED"}`})}finally{p(null)}}},b=y.useMemo(()=>(a==null?void 0:a.missions.filter(k=>Yp(k,c)))??[],[a,c]),j=(a==null?void 0:a.availability.filter(k=>c==="Available Avengers"?k.availability==="AVAILABLE":c==="Assigned/Active Avengers"?["ASSIGNED","ACTIVE"].includes(k.availability):!0))??[];return t.jsxs("article",{className:"admin-panel",id:"mission-control",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Mission Control"}),t.jsxs("p",{children:[s," · Updated ",Ht(a==null?void 0:a.generated_at)]})]}),t.jsxs("div",{className:"admin-panel-heading-actions",children:[t.jsx("button",{type:"button",onClick:()=>{var k;return void((k=g.current)==null?void 0:k.refresh())},children:"Refresh"}),r&&t.jsx("button",{type:"button",onClick:()=>void w(),disabled:u||!e,children:u?"Activatingâ¦":"Activate Mission Control"})]})]}),l&&t.jsx("div",{className:l.tone==="error"?"error-box":"success-box",role:"status","aria-live":"polite",children:l.text}),r&&t.jsxs("div",{className:"mission-control-roll-call","aria-label":"Production roll call controls",children:[t.jsx("strong",{children:"Harmless Production roll call"}),t.jsx("span",{children:"Each control submits one server-authorized, provider-managed acceptance mission."}),t.jsx("div",{children:Xp.map(([k,N])=>t.jsx("button",{type:"button",disabled:!!x||!e,onClick:()=>void S(k,N),children:x===k?"Submittingâ¦":`Run ${k}`},k))}),f&&t.jsx("p",{className:f.tone==="error"?"error-box":"success-box",role:"status","aria-live":"polite",children:f.text})]}),t.jsxs("label",{children:["View ",t.jsx("select",{value:c,onChange:k=>o(k.target.value),children:Gp.map(k=>t.jsx("option",{children:k},k))})]}),a?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"admin-list",children:j.map(k=>t.jsx("div",{className:"admin-list-row",children:t.jsxs("div",{children:[t.jsx("strong",{children:k.avenger_key}),t.jsxs("span",{children:[k.availability," · Since ",Ht(k.availability_since)]})]})},k.avenger_key))}),b.length?t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Mission / owner"}),t.jsx("th",{children:"Lane / lab"}),t.jsx("th",{children:"Status / availability"}),t.jsx("th",{children:"ACK"}),t.jsx("th",{children:"Dates"}),t.jsx("th",{children:"Next / dependency"}),t.jsx("th",{children:"Build / evidence"})]})}),t.jsx("tbody",{children:b.map(k=>t.jsxs("tr",{children:[t.jsxs("td",{children:[t.jsx("strong",{children:k.workstream}),t.jsx("br",{}),k.owner," · Priority ",Ht(k.priority),t.jsx("br",{}),t.jsxs("small",{children:["Mission ",k.mission_id,t.jsx("br",{}),"Run ",Ht(k.run_id)]})]}),t.jsxs("td",{children:[k.lane,t.jsx("br",{}),"Requires Local Lab: ",k.requires_local_lab?"YES":"NO"]}),t.jsxs("td",{children:[k.job_status==="COMPLETE"?"COMPLETE â certification separate":k.job_status,t.jsx("br",{}),k.availability,t.jsx("br",{}),"Since ",Ht(k.availability_since)]}),t.jsxs("td",{children:[k.ack_status,t.jsx("br",{}),Ht(k.ack_by),t.jsx("br",{}),Ht(k.ack_time),t.jsx("br",{}),"Latency ",Ht(k.ack_latency_ms)," ms"]}),t.jsxs("td",{children:["Entered ",Ht(k.date_entered),t.jsx("br",{}),"Completed ",Ht(k.date_completed),t.jsx("br",{}),"Updated ",Ht(k.last_updated)]}),t.jsxs("td",{children:[Ht(k.next_action),t.jsx("br",{}),"Blocked by ",Ht(k.blocked_by),t.jsx("br",{}),"Human gate ",Ht(k.human_gate)]}),t.jsxs("td",{children:[Ht(k.pr),t.jsx("br",{}),Ht(k.branch),t.jsx("br",{}),Ht(k.sha),t.jsx("br",{}),Ht(k.environment),t.jsx("br",{}),Ht(k.evidence_reference)]})]},k.mission_id))})]})}):t.jsx("p",{children:"No missions in this view."})]}):t.jsx("p",{role:"status",children:"Mission Control state is unavailable."})]})}const Zp="customer-portal-assets",em="smartbizhelper/ness/poses/transparent/v1",tm=`${em}/Ness_Holding_Laptop_Transparent.png.png`;function Ju(e,r=tm){const[a,n]=y.useState({url:null,loading:!!e,error:null});return y.useEffect(()=>{let s=!0,i;async function c(){var l;if(!e){n({url:null,loading:!1,error:"Ness is available after the secure Lobby connection is ready."});return}const o=await e.storage.from(Zp).createSignedUrl(r,3600);if(s){if(o.error||!((l=o.data)!=null&&l.signedUrl)){n({url:null,loading:!1,error:"Ness could not be loaded. Try refreshing the Lobby."});return}n({url:o.data.signedUrl,loading:!1,error:null}),i=window.setTimeout(()=>{c()},2700*1e3)}}return n(o=>({...o,loading:!0,error:null})),c(),()=>{s=!1,i!==void 0&&window.clearTimeout(i)}},[r,e]),a}const ga="sbh:portal-navigation";function Aa(e,r=!1){const a=new URL(e,window.location.href);if(a.origin!==window.location.origin){window.location.assign(a.href);return}const n=`${a.pathname}${a.search}${a.hash}`;r?window.history.replaceState({},"",n):window.history.pushState({},"",n),window.dispatchEvent(new Event(ga))}function as(e,r){e.preventDefault(),Aa(r)}const rm=[{key:"inventory",name:"Smart Inventory Tracker",status:"Available",detail:"Tenant workspace surface"},{key:"sku",name:"Smart SKU Creator",status:"Available",detail:"Tenant workspace surface"}
471,{key:"crm",name:"Smart CRM",status:"Foundation",detail:"Platform extension point"},{key:"content",name:"Smart Content Auto-Poster",status:"Foundation",detail:"Protected automation path"},{key:"simulators",name:"Smart AI Simulators",status:"Beta",detail:"Controlled beta surface"},{key:"smart-scanner",name:"Smart Scanner",status:"Foundation",detail:"Shared capture and review service"},{key:"marketplace",name:"Bizz2Bizz BarterPlace",status:"Available",detail:"Free business-to-business trade discovery"},{key:"smart_finance",name:"Smart Finance",status:"Foundation",detail:"Protected workspace coming soon"}],gl={inventory:"/?area=inventory",sku:"/?workspace=admin&area=sku","grant-watch":"/?workspace=admin&area=grant-watch",marketplace:"/?area=marketplace",smart_finance:"/?area=smart-finance",finance:"/?area=smart-finance"},am=[{id:"sallie",name:"Sallie",role:"Operations & Architecture",renewalDate:"",monthlyCost:"",usage:0,usageLabel:"Connected through ChatGPT"},{id:"dex",name:"Dex",role:"Engineering",renewalDate:"",monthlyCost:"",usage:0,usageLabel:"Enter current usage"},{id:"claude",name:"Claude",role:"Independent Auditor",renewalDate:"",monthlyCost:"",usage:0,usageLabel:"Enter current usage"},{id:"jenny",name:"Jenny",role:"Creative Director",renewalDate:"",monthlyCost:"",usage:0,usageLabel:"Offline"}],nm=[{id:"1",source:"Upwork",title:"Morning scan ready for connection",value:"â",status:"Scan"},{id:"2",source:"Fiverr",title:"Lead feed not connected yet",value:"â",status:"Planned"},{id:"3",source:"Shopify Dev",title:"Opportunity feed not connected yet",value:"â",status:"Planned"}];function vl(e,r){try{const a=window.localStorage.getItem(e);return a?JSON.parse(a):r}catch{return r}}function yl(e,r){window.localStorage.setItem(e,JSON.stringify(r))}function Ks(e){if(!e)return"Recently";const r=new Date(e);return Number.isNaN(r.getTime())?"Recently":r.toLocaleString()}function _l(e,r){return{inventory:"Smart Inventory Tracker",smart_inventory:"Smart Inventory Tracker",sku:"Smart SKU Creator",smart_sku:"Smart SKU Creator",content:"Smart Content Auto-Poster",smart_content_engine:"Smart Content Auto-Poster",simulators:"Smart AI Simulators",smart_sim:"Smart AI Simulators",lobby:"The Lobby",marketplace:"Bizz2Bizz BarterPlace",smart_finance:"Smart Finance",finance:"Smart Finance",grant_watch:"Opportunities",events_calendar:"Events Calendar"}[e]??r}function sm({supabase:e,email:r}){const[a,n]=y.useState(()=>vl("sbh-ai-avengers",am)),[s,i]=y.useState(()=>vl("sbh-job-leads",nm)),[c,o]=y.useState([]),[l,d]=y.useState({portal:"Checking",supabase:"Checking",github:"Linked",smartOps:"Checking"}),[u,h]=y.useState(null),[f,m]=y.useState(!1),[x,p]=y.useState({id:"",source:"Upwork",title:"",value:"",status:"New"}),[g,w]=y.useState(new Date),[S,b]=y.useState({programs:[],suites:[],enrollments:[]}),[j,k]=y.useState(null),[N,C]=y.useState(rm),[P,T]=y.useState([]),[L,M]=y.useState(!0),[E,W]=y.useState({tenantId:"",programId:"",startsAt:new Date().toISOString().slice(0,16),endsAt:"",suites:[],suiteWindows:{},creditGrant:"100",notes:""}),[ee,ce]=y.useState(null),[ue,te]=y.useState({sources:[],failed_scans:[],open_reviews:[]}),[fe,q]=y.useState(null),[J,le]=y.useState(!1),[A,V]=y.useState(null),[I,D]=y.useState([]),[K,z]=y.useState({scope_key:"",scope_type:"country",display_name:"",parent_key:"global",country_code:"",subdivision_code:"",locality_code:""}),[Y,re]=y.useState({user_id:"",scope_id:"",view_review:!0,approve:!1,reject:!1,edit_candidate:!1,manage_sources:!1,manage_settings:!1,manage_cadence:!1}),[oe,Ce]=y.useState({scope_id:"",source_id:"",enabled:!1,cadence_minutes:""}),[F,se]=y.useState({limits:[],categories:[],open_reports:[],featured_active:[],events:[]}),[he,je]=y.useState(!1),[ve,ne]=y.useState(()=>new Date),[Z,xe]=y.useState({plans:[],credit_packs:[],suite_packages:[]}),[be,De]=y.useState({tenantId:"",credits:"25",expiresAt:"",reason:""}),[Te,ze]=y.useState(null),[We,ot]=y.useState({total_scans:0,successful_scans:0,needs_review:0,failed_scans:0,average_confidence:0,ocr_queue:0,ai_queue:0,document_breakdown:[],recent_scans:[]}),[it,Zt]=y.useState({notifications:{unread:0,critical:0,today:0},messaging:{active_conversations:0,messages_today:0,pending_connections:0},featured_events:{pending_approval:0,active:0,expiring_soon:0},health:{}}),[Le,vt]=y.useState({total_contacts:0,new_this_week:0,pending_connections:0,recent_scans:0,conference_contacts:0,duplicate_suggestions:0}),[Me,nt]=y.useState({count:0,leads:[]}),[Ge,Ze]=y.useState(Iu),[It,de]=y.useState(null),[Ee,we]=y.useState(null);async function Oe(){e&&Ze(await Pu(e,{force:!0}))}async function Ue(v,X){if(e){if(!X&&(v==="existing_login"||v==="public_website")){const G=Gs[v];if(!window.confirm(`Turning OFF "${G}" will immediately block ${v==="existing_login"?"normal user sign-in":"the public website"} for everyone except platform admins. Continue?`))return}de(v),we(null);try{const G=await If(e,v,X);Ze(G),we({tone:"success",text:`${Gs[v]}
471 is now ${X?"ON":"OFF"}.`})}catch(G){we({tone:"error",text:G instanceof Error?G.message:"Could not change this control."})}finally{de(null)}}}async function Xe(){var G,Q;if(!e)return;const v=await e.rpc("sbh_admin_beta_catalog");if(v.error)return ce(v.error.message);b(v.data??{programs:[],suites:[],enrollments:[]});const X=(Q=(G=v.data)==null?void 0:G.programs)==null?void 0:Q[0];X&&!E.programId&&W(ae=>({...ae,programId:X.id}))}async function et(){var X,G,Q;if(!e)return;const v=await e.rpc("sbh_admin_platform_overview");if(!v.error){if(k((X=v.data)==null?void 0:X.metrics),Array.isArray((G=v.data)==null?void 0:G.suites)&&v.data.suites.length){const ae=v.data.suites.map(me=>({key:me.suite_key,name:_l(me.suite_key,me.display_name),status:me.status==="active"?"Available":me.status==="paused"?"Maintenance":"Planned",detail:me.status==="active"?"Catalog active":`Catalog ${me.status}`}));ae.some(me=>["smart_finance","finance"].includes(me.key))||ae.push({key:"smart_finance",name:"Smart Finance",status:"Foundation",detail:"Protected workspace coming soon"}),C(ae)}Array.isArray((Q=v.data)==null?void 0:Q.recent_incidents)&&(o(v.data.recent_incidents),d(ae=>({...ae,smartOps:v.data.recent_incidents.length?"Connected":"Operational"})))}}async function ie(){if(!e){M(!1);return}M(!0);const v=await e.rpc("sbh_admin_tenant_directory");!v.error&&Array.isArray(v.data)&&T(v.data),M(!1)}async function Ae(){if(!e)return;const v=await e.rpc("sbh_admin_grant_watch_console");!v.error&&v.data&&te(v.data)}async function Pe(){if(!e)return;const v=await e.rpc("sbh_admin_discovery_control_center");!v.error&&v.data&&q(v.data)}async function Re(v,X,G){if(e){le(!0),V(null);try{const Q=await e.rpc(v,X);if(Q.error)throw new Error(Q.error.message);V(G),await Pe()}catch(Q){V(Q instanceof Error?Q.message:"Discovery control failed; no client-side fallback was applied.")}finally{le(!1)}}}async function ct(v,X=null,G="pending_review",Q=null){if(!e||!v)return;const ae=await e.rpc("sbh_discovery_review_queue",{p_scope_id:v,p_kind:X,p_status:G,p_source_id:Q,p_limit:50});if(ae.error){V(ae.error.message),D([]);return}D(ae.data??[])}async function ft(v,X){const G={...v,...X};await Re("sbh_admin_discovery_update_scope",{p_scope_id:v.id,p_discovery_enabled:!!G.discovery_enabled,p_opportunities_enabled:!!G.opportunities_enabled,p_events_enabled:!!G.events_enabled,p_review_queue_enabled:!!G.review_queue_enabled,p_paused:G.paused,p_cadence_minutes:G.cadence_minutes},"Geographic Discovery settings saved.")}async function qt(){if(!e)return;const v=await e.rpc("sbh_admin_events_console");!v.error&&v.data&&se(v.data)}async function lt(){if(!e)return;const v=await e.rpc("sbh_portal_package_pricing");!v.error&&v.data&&xe(v.data)}async function ca(){if(!e)return;const v=await e.rpc("sbh_admin_scanner_overview");!v.error&&v.data&&ot(v.data)}async function ja(){if(!e)return;const v=await e.rpc("sbh_admin_platform_services_overview");!v.error&&v.data&&Zt(v.data)}async function Ma(){if(!e)return;const v=await e.rpc("sbh_admin_contacts_overview");!v.error&&v.data&&vt(v.data)}async function xn(){if(!e)return;const v=await e.rpc("portal_admin_front_door_waitlist");!v.error&&v.data&&nt({count:Number(v.data.count??0),leads:Array.isArray(v.data.leads)?v.data.leads:[]})}const Gn=y.useMemo(()=>{const v=new Date(ve.getFullYear(),ve.getMonth(),1),X=new Date(ve.getFullYear(),ve.getMonth()+1,0).getDate(),G=v.getDay();return Array.from({length:Math.ceil((G+X)/7)*7},(Q,ae)=>{const me=ae-G+1;return me<1||me>X?null:new Date(ve.getFullYear(),ve.getMonth(),me)})},[ve]),Xn=y.useMemo(()=>F.events.reduce((v,X)=>{const G=new Date(X.starts_at).toDateString();return(v[G]??(v[G]=[])).push(X),v},{}),[F.events]);async function O(v){var G;if(v.preventDefault(),ce(null),!e)return ce("Supabase is not configured.");const X=await e.rpc("sbh_admin_beta_assign",{p_payload:{tenant_id:Number(E.tenantId),beta_program_id:E.programId,starts_at:new Date(E.startsAt).toISOString(),ends_at:E.endsAt?new Date(E.endsAt).toISOString():void 0,suite_keys:E.suites,suite_windows:Object.fromEntries(E.suites.map(Q=>{var ae,me;return[Q,{starts_at:new Date(((ae=E.suiteWindows[Q])==null?void 0:ae.startsAt)||E.startsAt).toISOString(),ends_at:(me=E.suiteWindows[Q])!=null&&me.endsAt?new Date(E.suiteWindows[Q].endsAt).toISOString():E.endsAt?new Date(E.endsAt).toISOString():null}]})),credit_grant:Number(E.creditGrant),internal_notes:E.notes,assignment_reason:"SBH administrator beta activation"}});if(X.error)return ce(X.error.message);ce(`Beta enrollment ${((G=X.data)==null?void 0:G.enrollment_id)??"created"} activated.`),await Xe()}async function _(v,X){if(!e)return;ce(null);const G=X==="extend"?window.prompt("New expiration (ISO timestamp)"):null,Q=await e.rpc("sbh_admin_beta_transition",{p_enrollment_id:v,p_action:X,p_ends_at:G||null,p_conversion_plan_key:null,p_reason:`Admin action: ${X}`});if(Q.error)return ce(Q.error.message);ce(`Beta access ${X} completed.`),await Xe()}async function R(v){if(v.preventDefault(),ze(null),!e)return ze("Supabase is not configured.");const X=Number(be.credits);if(!Number.isInteger(X)||X<=0)return ze("Enter a positive whole-number credit amount.");const G=await e.rpc("sbh_admin_grant_smart_credits",{p_client_id:Number(be.tenantId),p_amount:X,p_expires_at:be.expiresAt?new Date(be.expiresAt).toISOString():null,p_reason:be.reason,p_idempotency_key:`admin-promo-${Date.now()}-${Math.random().toString(36).slice(2,10)}`});if(G.error)return ze(G.error.message);ze(`${X} Smart Credits issued to Tenant ${be.tenantId}.`),De(Q=>({...Q,reason:""}))}const B=async()=>
471{if(d(X=>({...X,portal:"Online",supabase:"Checking",smartOps:"Checking"})),!e){d(X=>({...X,supabase:"Not configured",smartOps:"Unavailable"}));return}const v=await e.from("portal_inventory_items").select("id",{count:"exact",head:!0});d(X=>({...X,supabase:v.error?"Attention":"Operational"})),await et(),await xn(),w(new Date)};y.useEffect(()=>{B(),Xe(),ie(),Ae(),Pe(),qt(),lt(),ca(),ja(),Ma(),Oe(),xn()},[]),y.useMemo(()=>{const v=a.filter(X=>X.usage>0);return v.length?Math.round(v.reduce((X,G)=>X+G.usage,0)/v.length):0},[a]);function U(v){const X=a.map(G=>G.id===v.id?v:G);n(X),yl("sbh-ai-avengers",X),h(null)}function H(){if(!x.title.trim())return;const v=[{...x,id:crypto.randomUUID()},...s];i(v),yl("sbh-job-leads",v),p({id:"",source:"Upwork",title:"",value:"",status:"New"}),m(!1)}return t.jsxs("div",{className:"admin-command-center",children:[t.jsxs("header",{className:"admin-topbar",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper command center"}),t.jsx("h1",{children:"Welcome back, Shaun! ð"}),t.jsx("p",{className:"muted",children:"Clients, projects, platform health, and workspace controls in one place."})]}),t.jsxs("div",{className:"admin-profile",children:[t.jsx("button",{className:"admin-icon-button",onClick:()=>void B(),title:"Refresh dashboard",children:t.jsx(St,{size:18})}),t.jsx(aa,{size:20}),t.jsx("img",{src:"/shaun-headshot.jpg",alt:"Shaun Golden"}),t.jsxs("div",{children:[t.jsx("strong",{children:"Shaun Golden"}),t.jsx("span",{children:r})]})]})]}),t.jsxs("section",{className:"admin-kpis",id:"reports","data-automation-hook":"admin.kpis",children:[t.jsxs("article",{children:[t.jsx(dr,{}),t.jsx("span",{children:"Active Tenants"}),t.jsx("strong",{children:(j==null?void 0:j.active_tenants)??"â"}),t.jsx("small",{children:j?`${j.total_tenants} total tenant records`:"Platform overview pending"})]}),t.jsxs("article",{children:[t.jsx(Bi,{}),t.jsx("span",{children:"Monthly Revenue"}),t.jsx("strong",{children:"â"}),t.jsx("small",{children:"Ready for billing feed"})]}),t.jsxs("article",{children:[t.jsx(Vu,{}),t.jsx("span",{children:"Open Projects"}),t.jsx("strong",{children:"4"}),t.jsx("small",{children:"GitHub connected below"})]}),t.jsxs("article",{children:[t.jsx(tt,{}),t.jsx("span",{children:"System Health"}),t.jsx("strong",{children:l.supabase==="Operational"?"Good":"Review"}),t.jsxs("small",{children:["Last refresh ",g.toLocaleTimeString()]})]})]}),t.jsx($p,{supabase:e}),t.jsx(Qp,{supabase:e,platformAdmin:!0}),t.jsxs("section",{className:"admin-panel platform-access-panel",id:"platform-access-controls","data-automation-hook":"platform.access.controls",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Launch safety"}),t.jsx("h2",{children:"Platform Access Controls"}),t.jsx("p",{children:"Server-enforced kill switches. Changes take effect immediately, everywhere, without a redeploy."})]}),t.jsx($a,{size:22})]}),Ee&&t.jsx("div",{className:Ee.tone==="error"?"error-box":"success-box",role:"status",children:Ee.text}),t.jsx("div",{className:"platform-access-grid",children:Ff.map(v=>{const X=Ge[v],G=It===v,Q=v==="existing_login"||v==="public_website";return t.jsxs("div",{className:"platform-access-row",children:[t.jsxs("div",{children:[t.jsx("b",{children:Gs[v]}),Q&&t.jsxs("small",{children:[t.jsx(gs,{size:12})," disabling this affects live access immediately"]})]}),t.jsxs("label",{className:`platform-access-switch${X?" on":""}`,children:[t.jsx("input",{type:"checkbox",checked:X,disabled:G,onChange:ae=>void Ue(v,ae.target.checked),"aria-label":`${Gs[v]}: ${X?"ON":"OFF"}`}),t.jsx("span",{children:G?"Workingâ¦":X?"ON":"OFF"})]})]},v)})})]}),t.jsxs("section",{className:"admin-platform-overview",id:"platform-overview","data-automation-hook":"platform.overview",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Platform control plane"}),t.jsx("h2",{children:"Smart Suite Management"}),t.jsx("p",{children:"One inventory of platform capabilities, with status labels that separate available surfaces from planned foundations."})]}),t.jsx(Xr,{size:22})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:(j==null?void 0:j.active_users)??"â"})," active users"]}),t.jsxs("span",{children:[t.jsx("b",{children:(j==null?void 0:j.new_signups_30d)??"â"}
471)," new signups / 30d"]}),t.jsxs("span",{children:[t.jsx("b",{children:(j==null?void 0:j.smart_credit_balance)??"â"})," Smart Credits outstanding"]}),t.jsxs("span",{children:[t.jsx("b",{children:(j==null?void 0:j.open_smart_ops_incidents)??"â"})," open Smart Ops alerts"]})]}),t.jsx("div",{className:"suite-status-grid",children:N.map(v=>{var X,G;return t.jsxs("article",{className:"suite-status-card","data-automation-hook":`suite.${v.key}`,children:[t.jsxs("div",{children:[t.jsx("strong",{children:v.name}),t.jsx("span",{children:v.detail})]}),t.jsxs("div",{className:"suite-status-actions",children:[t.jsx("b",{className:`suite-status suite-status-${(((X=v.status)==null?void 0:X.trim())||"unknown").toLowerCase()}`,children:((G=v.status)==null?void 0:G.trim())||"Unknown"}),gl[v.key]&&v.status==="Available"&&t.jsxs("a",{href:gl[v.key],"aria-label":`Open ${v.name}`,children:[t.jsx(Tt,{size:14}),t.jsx("span",{children:"Open"})]})]})]},v.key)})})]}),t.jsxs("section",{className:"admin-panel tenant-directory-panel",id:"front-door-waitlist","data-automation-hook":"front-door.waitlist",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Front door demand"}),t.jsx("h2",{children:"Get notified leads"}),t.jsx("p",{children:"Visitors who asked to hear when public account creation opens."})]}),t.jsx(dr,{size:22})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:Me.count})," total sign-ups"]}),t.jsx("span",{children:"Unique emails enforced"}),t.jsx("span",{children:"Source and timestamp captured"})]}),Me.leads.length?t.jsx("div",{className:"admin-list",children:Me.leads.slice(0,8).map(v=>t.jsxs("div",{className:"admin-list-row",children:[t.jsx(dr,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:v.full_name}),t.jsxs("span",{children:[v.email," · ",v.interest_key.replaceAll("_"," ")]})]}),t.jsx("small",{children:Ks(v.created_at)})]},v.id))}):t.jsx("p",{className:"muted",children:"No waitlist submissions yet."})]}),t.jsxs("section",{className:"admin-main-grid platform-services-grid",id:"platform-services","data-automation-hook":"platform.services",children:[t.jsxs("article",{className:"admin-panel projects-panel",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Live service"}),t.jsx("h2",{children:"Notifications"}),t.jsx("p",{children:"Bell delivery and unread workspace activity."})]}),t.jsx(aa,{size:20})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:it.notifications.unread})," unread"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.notifications.critical})," critical"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.notifications.today})," today"]})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Live service"}),t.jsx("h2",{children:"Messaging"}),t.jsx("p",{children:"Authorized conversations and connections."})]}),t.jsx(Va,{size:20})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:it.messaging.active_conversations})," active"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.messaging.messages_today})," messages today"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.messaging.pending_connections})," pending connections"]})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Revenue surface"}),t.jsx("h2",{children:"Featured Events"}),t.jsx("p",{children:"Approval, placement, and renewal visibility."})]}),t.jsx(mt,{size:20})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:it.featured_events.pending_approval})," pending"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.featured_events.active})," active"]}),t.jsxs("span",{children:[t.jsx("b",{children:it.featured_events.expiring_soon})," expiring"]})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Control plane"}),t.jsx("h2",{children:"Platform Health"}),t.jsx("p",{children:"Live status from protected service contracts."})]}),t.jsx(Hc,{size:20})]}),t.jsx("div",{className:"health-summary-grid",children:Object.entries(it.health).map(([v,X])=>t.jsxs("span",{children:[t.jsx("b",{children:v.replaceAll("_"," ")}),t.jsx("em",{children:X})]},v))})]})]}
471),t.jsxs("section",{className:"admin-panel tenant-directory-panel",id:"smart-contacts","data-automation-hook":"smart-contacts.admin-console",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Core platform service"}),t.jsx("h2",{children:"Smart Contacts"}),t.jsx("p",{children:"Tenant-safe relationship identity, Smart Cards, conference capture, and future Scanner routing."})]}),t.jsx(dr,{size:22})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:Le.total_contacts})," total contacts"]}),t.jsxs("span",{children:[t.jsx("b",{children:Le.new_this_week})," new this week"]}),t.jsxs("span",{children:[t.jsx("b",{children:Le.pending_connections})," pending connections"]}),t.jsxs("span",{children:[t.jsx("b",{children:Le.recent_scans})," recent scans"]}),t.jsxs("span",{children:[t.jsx("b",{children:Le.conference_contacts})," conference contacts"]}),t.jsxs("span",{children:[t.jsx("b",{children:Le.duplicate_suggestions})," duplicate suggestions"]})]})]}),t.jsxs("section",{className:"admin-main-grid admin-primary-grid","aria-label":"Platform access controls",children:[t.jsxs("article",{className:"admin-panel projects-panel beta-access-panel",id:"beta-access-primary",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Beta Access"}),t.jsx("p",{children:"Explicit suite assignment for invite-only Beta Partners. No wildcard access."})]}),t.jsx(tt,{size:20})]}),t.jsxs("form",{className:"beta-access-form",onSubmit:v=>void O(v),children:[t.jsxs("label",{children:["Tenant ID",t.jsx("input",{required:!0,inputMode:"numeric",value:E.tenantId,onChange:v=>W({...E,tenantId:v.target.value}),placeholder:"Business client ID"})]}),t.jsxs("label",{children:["Beta program",t.jsxs("select",{required:!0,value:E.programId,onChange:v=>W({...E,programId:v.target.value}),children:[t.jsx("option",{value:"",children:"Select program"}),S.programs.map(v=>t.jsxs("option",{value:v.id,children:[v.name," · ",v.status]},v.id))]})]}),t.jsxs("div",{className:"beta-date-grid",children:[t.jsxs("label",{children:["Starts",t.jsx("input",{required:!0,type:"datetime-local",value:E.startsAt,onChange:v=>W({...E,startsAt:v.target.value})})]}),t.jsxs("label",{children:["Expires",t.jsx("input",{required:!0,type:"datetime-local",value:E.endsAt,onChange:v=>W({...E,endsAt:v.target.value})})]})]}),t.jsxs("fieldset",{children:[t.jsx("legend",{children:"Assigned suites and test windows"}),t.jsx("div",{className:"beta-suite-grid",children:S.suites.map(v=>{var X,G;return t.jsxs("div",{className:"beta-suite-option",children:[t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:E.suites.includes(v.suite_key),onChange:Q=>W(ae=>({...ae,suites:Q.target.checked?[...ae.suites,v.suite_key]:ae.suites.filter(me=>me!==v.suite_key),suiteWindows:Q.target.checked?{...ae.suiteWindows,[v.suite_key]:{startsAt:ae.startsAt,endsAt:ae.endsAt}}:Object.fromEntries(Object.entries(ae.suiteWindows).filter(([me])=>me!==v.suite_key))}))}),v.display_name]}),E.suites.includes(v.suite_key)&&t.jsxs("div",{className:"beta-suite-window",children:[t.jsxs("label",{children:["Starts",t.jsx("input",{required:!0,type:"datetime-local",value:((X=E.suiteWindows[v.suite_key])==null?void 0:X.startsAt)??E.startsAt,onChange:Q=>W(ae=>({...ae,suiteWindows:{...ae.suiteWindows,[v.suite_key]:{...ae.suiteWindows[v.suite_key],startsAt:Q.target.value}}}))})]}),t.jsxs("label",{children:["Expires",t.jsx("input",{required:!0,type:"datetime-local",value:((G=E.suiteWindows[v.suite_key])==null?void 0:G.endsAt)??E.endsAt,onChange:Q=>W(ae=>({...ae,suiteWindows:{...ae.suiteWindows,[v.suite_key]:{...ae.suiteWindows[v.suite_key],endsAt:Q.target.value}}}))})]})]})]},v.suite_key)})})]}),t.jsxs("label",{children:["Promotional credits",t.jsx("input",{type:"number",min:"0",max:"10000",value:E.creditGrant,onChange:v=>W({...E,creditGrant:v.target.value})})]}),t.jsxs("label",{children:["Internal notes",t.jsx("textarea",{value:E.notes,onChange:v=>W({...E,notes:v.target.value}),placeholder:"Internal pilot note"})]}),t.jsx("button",{className:"admin-save",type:"submit",disabled:!E.suites.length,children:"Activate Beta Partner"}),ee&&t.jsx("div",{className:"success-box",children:ee})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",id:"wallet-admin-primary",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Smart Wallet Administration"}),t.jsx("p",{children:"Read-only platform visibility; grants, revocations, packs, and promo codes remain audited controls."})]}),t.jsx(ur,{size:20})]}),t.jsx("div",{className:"admin-list",children:t.jsxs("div",{className:"admin-list-row",children:[t.jsx(ur,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:"Platform Smart Credits"}),t.jsx("span",{children:"Across visible tenant wallets"})]}),t.jsx("b",{children:(j==null?void 0:j.smart_credit_balance)??"â"})]})}),t.jsxs("form",{className:"wallet-promotion-form",onSubmit:v=>void R(v),children:[t.jsxs("div",{className:"wallet-form-heading",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Issue promotion credits"}),t.jsx("p",{children:"Grant credits to one tenant. The server validates platform-admin access and records the grant in the wallet ledger."})]}),t.jsx(tt,{size:18})]}),t.jsxs("label",{children:["Tenant ID",t.jsx("input",{required:!0,inputMode:"numeric",value:be.tenantId,onChange:v=>De({...be,tenantId:v.target.value}),placeholder:"Business client ID"})]}),t.jsxs("label",{children:["Smart Credits",t.jsx("input",{required:!0,type:"number",min:"1",max:"1000000",step:"1",value:be.credits,onChange:v=>De({...be,credits:v.target.value})})]}),t.jsxs("label",{children:["Expires (optional)",t.jsx("input",{type:"datetime-local",value:be.expiresAt,onChange:v=>De({...be,expiresAt:v.target.value})})]}),t.jsxs("label",{children:["Promotion reason",t.jsx("input",{value:be.reason,onChange:v=>De({...be,reason:v.target.value}),placeholder:"Launch promotion"})]}),t.jsx("button",{className:"admin-save",type:"submit",children:"Issue Smart Credits"}),Te&&t.jsx("div",{className:"success-box",children:Te})]})]}),t.jsxs("article",{className:"admin-panel projects-panel pricing-reference-panel",id:"package-pricing",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Package Pricing Reference"}),t.jsx("p",{children:"Current plan and Smart Credit pricing from the production catalog."})]}),t.jsx(vi,{size:20})]}),t.jsxs("div",{className:"pricing-reference-grid",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Membership plans"}),Z.plans.map(v=>{const X=Z.plans.find(ae=>ae.plan_key===v.upgrade_from_plan_key),G=X?v.monthly_price_cents-X.monthly_price_cents:null,Q=X?v.annual_price_cents-X.annual_price_cents:null;return t.jsxs("div",{className:"pricing-row",children:[t.jsx("strong",{children:v.display_name}),t.jsxs("span",{children:["$",(v.monthly_price_cents/100).toFixed(0),"/mo · $",(v.annual_price_cents/100).toFixed(0),"/yr"]}),t.jsx("small",{children:v.included_with_smart_suite?"Included with any Smart Suite subscription":X&&G!==null&&Q!==null?`Upgrade difference from ${X.display_name}: $${(G/100).toFixed(0)}/mo · $${(Q/100).toFixed(0)}/yr`:`${v.annual_bonus_credits} annual bonus credits`})]},v.plan_key)})]}),t.jsxs("div",{children:[t.jsx("h3",{children:"Smart Credit packs"}),Z.credit_packs.map(v=>t.jsxs("div",{className:"pricing-row",children:[t.jsxs("strong",{children:[v.credits," Smart Credits"]}),t.jsxs("span",{children:["$",(v.price_cents/100).toFixed(0)]}),t.jsxs("small",{children:[v.payment_provider," checkout"]})]},v.pack_key))]}),t.jsxs("div",{children:[t.jsx("h3",{children:"Smart Suite packages"}),(Z.suite_packages??[]).map(v=>t.jsxs("div",{className:"pricing-row",children:[t.jsx("strong",{children:v.is_plan_upgrade?"Business Pro upgrade":v.suite_keys.map(X=>X==="smart_inventory"?"Smart Inventory Tracker":X==="smart_sku"?"Smart SKU Creator":X).join(" + ")}),t.jsxs("span",{children:[v.billing_interval==="annual"?"Annual":"Monthly"," · $",(v.price_cents/100).toFixed(0)]}),t.jsx("small",{children:v.is_plan_upgrade?"Difference-only upgrade · Shopify checkout":"Business Plus included · Shopify checkout"})]},v.item_key))]})]})]})]}
471),t.jsxs("section",{className:"admin-panel tenant-directory-panel",id:"clients","data-automation-hook":"tenant.directory",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Platform-wide controls"}),t.jsx("h2",{children:"Tenant Management"}),t.jsx("p",{children:"Read-only tenant directory. Suspend, restore, billing, and support impersonation remain behind separate audited controls."})]}),t.jsx(hr,{size:22})]}),L?t.jsxs("div",{className:"admin-empty tenant-empty",children:[t.jsx(St,{className:"spin"}),t.jsx("span",{children:"Loading tenant directoryâ¦"})]}):P.length===0?t.jsxs("div",{className:"admin-empty tenant-empty",children:[t.jsx(dr,{}),t.jsx("strong",{children:"No tenant records returned"}),t.jsx("span",{children:"Check the platform-admin RPC and local fixture state."})]}):t.jsx("div",{className:"tenant-table-wrap",children:t.jsxs("table",{className:"tenant-table",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Business"}),t.jsx("th",{children:"Status"}),t.jsx("th",{children:"Users"}),t.jsx("th",{children:"Membership"}),t.jsx("th",{children:"Credits"}),t.jsx("th",{children:"Suites"}),t.jsx("th",{children:"Controls"})]})}),t.jsx("tbody",{children:P.map(v=>{var X,G,Q,ae;return t.jsxs("tr",{children:[t.jsxs("td",{children:[t.jsx("strong",{children:v.name}),t.jsxs("small",{children:[v.slug," · Tenant ",v.tenant_id]})]}),t.jsx("td",{children:t.jsx("span",{className:`tenant-status tenant-status-${(((X=v.status)==null?void 0:X.trim())||"unknown").toLowerCase()}`,children:((G=v.status)==null?void 0:G.trim())||"Unknown"})}),t.jsxs("td",{children:[v.active_users," active ",t.jsxs("small",{children:["/ ",v.total_users," total"]})]}),t.jsxs("td",{children:[((Q=v.plan)==null?void 0:Q.plan_key)??"Not configured",t.jsx("small",{children:((ae=v.plan)==null?void 0:ae.status)??"â"})]}),t.jsx("td",{children:v.smart_credits}),t.jsx("td",{children:t.jsx("small",{children:(v.assigned_suites??[]).length?(v.assigned_suites??[]).join(", "):"Plan entitlements / none"})}),t.jsx("td",{children:t.jsxs("div",{className:"tenant-control-buttons",children:[t.jsx("button",{type:"button",disabled:!0,title:"Mutation contract pending","data-automation-hook":"tenant.suspend",children:"Suspend"}),t.jsx("button",{type:"button",disabled:!0,title:"Audited support mode pending","data-automation-hook":"tenant.open-workspace",children:"Open"})]})})]},v.tenant_id)})})]})})]}),t.jsxs("section",{className:"admin-panel tenant-directory-panel",id:"grant-watch-console","data-automation-hook":"grant-watch.admin-console",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Opportunities operations"}),t.jsx("h2",{children:"Source Health & Review Queue"}),t.jsx("p",{children:"Read-only source status, failed scans, and manual-review records. Publishing and review decisions remain separate audited actions."})]}),t.jsx(tt,{size:22})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:ue.sources.length})," configured sources"]}),t.jsxs("span",{children:[t.jsx("b",{children:ue.failed_scans.length})," failed or partial scans"]}),t.jsxs("span",{children:[t.jsx("b",{children:ue.open_reviews.length})," open reviews"]})]}),t.jsx("div",{className:"admin-list",children:ue.sources.length?ue.sources.map(v=>t.jsxs("div",{className:"admin-list-row",children:[t.jsx(os,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:v.display_name}),t.jsxs("span",{children:[v.source_key," · Last check ",Ks(v.last_checked_at??void 0)]})]}),t.jsx("b",{children:v.health_status??v.status})]},v.source_key)):t.jsxs("div",{className:"admin-empty",children:[t.jsx(os,{}),t.jsx("strong",{children:"Opportunities console pending local migration"}),t.jsx("span",{children:"Apply Phase 12I to populate source health and review records."})]})})]}),t.jsx(Lp,{supabase:e}),t.jsxs("section",{hidden:!0,className:"admin-panel tenant-directory-panel discovery-control-center",id:"global-discovery-console","data-automation-hook":"global-discovery.control-center",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Geographic control plane"}),t.jsx("h2",{children:"Global Discovery"}),t.jsx("p",{children:"Each new scope starts OFF. NATE must receive an authoritative allowed run-plan for an exact scope, source, and content kind before it can fetch; every ingestion write is pending review only."})]}),t.jsx("button",{type:"button",className:"admin-panel-heading-action",onClick:()=>void Pe(),"aria-label":"Refresh Global Discovery controls",title:"Refresh Global Discovery controls",children:t.jsx(St,{size:20})})]}),fe?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"discovery-kill-switch",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Master Global Discovery kill switch"}),t.jsx("span",{children:fe.master_enabled?"ON â scoped controls still apply":"OFF â all new ingestion runs are blocked"})]}),t.jsx("button",{type:"button",className:fe.master_enabled?"danger-action":"admin-save",disabled:J,onClick:()=>{const v=!fe.master_enabled;v&&!window.confirm("Enable the global Discovery master switch? Geography, source, kind, and review controls must still be enabled separately.")||Re("sbh_admin_discovery_set_master",{p_enabled:v},`Global Discovery master switch is now ${v?"ON":"OFF"}.`)},children:fe.master_enabled?"Turn OFF":"Enable master switch"})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:fe.scopes.length})," geographic scopes"]}),t.jsxs("span",{children:[t.jsx("b",{children:fe.sources.filter(v=>v.enabled).length})," enabled scope/source links"]}),t.jsxs("span",{children:[t.jsx("b",{children:fe.moderators.filter(v=>v.active).length})," active moderator assignments"]}),t.jsxs("span",{children:[t.jsx("b",{children:fe.runs.filter(v=>v.status==="running").length})," running jobs"]})]}),t.jsx("div",{className:"discovery-scope-list",children:fe.scopes.map(v=>{const X=fe.counts.find(Q=>Q.scope_id===v.id),G=fe.scopes.find(Q=>Q.id===v.parent_id);return t.jsxs("article",{className:"discovery-scope-card",children:[t.jsxs("div",{className:"discovery-scope-heading",children:[t.jsxs("div",{children:[t.jsx("strong",{children:v.display_name}),t.jsxs("span",{children:[v.scope_type," · ",v.scope_key," · ",G?`inherits through ${G.display_name}`:"root scope"]})]}),t.jsx("span",{className:v.paused||!v.discovery_enabled?"tenant-status tenant-status-suspended":"tenant-status tenant-status-active",children:v.paused?"Paused":v.discovery_enabled?"Discovery ON":"Discovery OFF"})]}),t.jsxs("div",{className:"discovery-scope-flags",children:[[["discovery_enabled","Discovery"],["opportunities_enabled","Opportunities"],["events_enabled","Events"],["review_queue_enabled","Review queue"]].map(([Q,ae])=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:!!v[Q],disabled:J,onChange:me=>void ft(v,{[Q]:me.target.checked})}),ae]},Q)),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:v.paused,disabled:J,onChange:Q=>void ft(v,{paused:Q.target.checked})}),"Pause while preserving settings"]})]}),t.jsxs("div",{className:"discovery-scope-summary",children:[t.jsxs("span",{children:[(X==null?void 0:X.pending)??0," pending · ",(X==null?void 0:X.approved)??0," approved · ",(X==null?void 0:X.rejected)??
4710," rejected"]}),t.jsxs("label",{children:["Cadence (minutes)",t.jsx("input",{type:"number",min:"15",max:"10080",value:v.cadence_minutes??"",placeholder:"Inherited",onChange:Q=>{const ae=Q.target.value;q(me=>me&&{...me,scopes:me.scopes.map(ke=>ke.id===v.id?{...ke,cadence_minutes:ae===""?null:Number(ae)}:ke)})}})]}),t.jsx("button",{type:"button",disabled:J,onClick:()=>void ft(v,{cadence_minutes:v.cadence_minutes}),children:"Save cadence"}),t.jsx("button",{type:"button",onClick:()=>void ct(v.id),children:"Open review queue"})]})]},v.id)})}),t.jsxs("form",{className:"discovery-control-form",onSubmit:v=>{v.preventDefault(),Re("sbh_admin_discovery_upsert_scope",{p_scope_key:K.scope_key,p_scope_type:K.scope_type,p_display_name:K.display_name,p_parent_key:K.parent_key,p_country_code:K.country_code||null,p_subdivision_code:K.subdivision_code||null,p_locality_code:K.locality_code||null},"Geographic scope created OFF by default.")},children:[t.jsx("h3",{children:"Add geographic scope"}),t.jsxs("label",{children:["Scope key",t.jsx("input",{required:!0,value:K.scope_key,onChange:v=>z({...K,scope_key:v.target.value})})]}),t.jsxs("label",{children:["Level",t.jsxs("select",{value:K.scope_type,onChange:v=>z({...K,scope_type:v.target.value}),children:[t.jsx("option",{value:"country",children:"Country"}),t.jsx("option",{value:"admin_region",children:"Administrative region"}),t.jsx("option",{value:"metro",children:"Metro / region"}),t.jsx("option",{value:"locality",children:"Locality"})]})]}),t.jsxs("label",{children:["Name",t.jsx("input",{required:!0,value:K.display_name,onChange:v=>z({...K,display_name:v.target.value})})]}),t.jsxs("label",{children:["Parent",t.jsx("select",{value:K.parent_key,onChange:v=>z({...K,parent_key:v.target.value}),children:fe.scopes.map(v=>t.jsx("option",{value:v.scope_key,children:v.display_name},v.scope_key))})]}),t.jsxs("label",{children:["ISO 3166-1 country code",t.jsx("input",{maxLength:2,value:K.country_code,onChange:v=>z({...K,country_code:v.target.value.toUpperCase()})})]}),t.jsxs("label",{children:["Administrative code",t.jsx("input",{value:K.subdivision_code,onChange:v=>z({...K,subdivision_code:v.target.value})})]}),t.jsxs("label",{children:["Locality code",t.jsx("input",{value:K.locality_code,onChange:v=>z({...K,locality_code:v.target.value})})]}),t.jsx("button",{className:"admin-save",disabled:J,children:"Create OFF scope"})]}),t.jsxs("form",{className:"discovery-control-form",onSubmit:v=>{v.preventDefault(),Re("sbh_admin_discovery_set_source",{p_scope_id:oe.scope_id,p_source_id:oe.source_id,p_enabled:oe.enabled,p_cadence_minutes:oe.cadence_minutes?Number(oe.cadence_minutes):null,p_settings:{}},"Scope source configuration saved.")},children:[t.jsx("h3",{children:"Configure source for a scope"}),t.jsxs("label",{children:["Geography",t.jsxs("select",{required:!0,value:oe.scope_id,onChange:v=>Ce({...oe,scope_id:v.target.value}),children:[t.jsx("option",{value:"",children:"Select"}),fe.scopes.map(v=>t.jsx("option",{value:v.id,children:v.display_name},v.id))]})]}),t.jsxs("label",{children:["Approved source",t.jsxs("select",{required:!0,value:oe.source_id,onChange:v=>Ce({...oe,source_id:v.target.value}),children:[t.jsx("option",{value:"",children:"Select"}),fe.source_catalog.filter(v=>v.terms_status==="approved").map(v=>t.jsxs("option",{value:v.id,children:[v.name," · ",v.id]},v.id))]})]}),t.jsxs("label",{children:["Source enabled",t.jsx("input",{type:"checkbox",checked:oe.enabled,onChange:v=>Ce({...oe,enabled:v.target.checked})})]}),t.jsxs("label",{children:["Cadence override",t.jsx("input",{type:"number",min:"15",max:"10080",value:oe.cadence_minutes,placeholder:"Inherit scope cadence",onChange:v=>Ce({...oe,cadence_minutes:v.target.value})})]}),t.jsx("button",{className:"admin-save",disabled:J||!oe.scope_id||!oe.source_id,children:"Save source"})]}),t.jsxs("form",{className:"discovery-control-form",onSubmit:v=>{v.preventDefault();const{user_id:X,scope_id:G,...Q}=Y;Re("sbh_admin_discovery_assign_moderator",{p_user_id:X,p_scope_id:G,p_capabilities:Q,p_active:!0},"Scoped moderator assignment saved and audited.")},children:[t.jsx("h3",{children:"Appoint scoped moderator"}),t.jsx("p",{children:"Server authorization is independent of this UI. Ambassador status grants no capabilities."}),t.jsxs("label",{children:["User UUID",t.jsx("input",{required:!0,value:Y.user_id,onChange:v=>re({...Y,user_id:v.target.value})})]}),t.jsxs("label",{children:["Geographic scope",t.jsxs("select",{required:!0,value:Y.scope_id,onChange:v=>re({...Y,scope_id:v.target.value}),children:[t.jsx("option",{value:"",children:"Select"}),fe.scopes.map(v=>t.jsx("option",{value:v.id,children:v.display_name},v.id))]})]}),t.jsx("div",{className:"discovery-scope-flags",children:[["view_review","View/review"],["approve","Approve"],["reject","Reject"],["edit_candidate","Edit candidate"],["manage_sources","Manage sources"],["manage_settings","Manage settings"],["manage_cadence","Manage cadence"]].map(([v,X])=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Y[v],onChange:G=>re({...Y,[v]:G.target.checked})}),X]},v))}),t.jsx("button",{className:"admin-save",disabled:J||!Y.scope_id,children:"Save moderator assignment"})]}),t.jsxs("div",{className:"discovery-review-panel",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Review queue"}),t.jsx("p",{children:"Approvals and rejections are recorded through the scope-authorized RPC; all decisions are audited."})]}),t.jsxs("select",{"aria-label":"Review queue geography",onChange:v=>void ct(v.target.value),children:[t.jsx("option",{value:"",children:"Choose geography"}),fe.scopes.map(v=>t.jsx("option",{value:v.id,children:v.display_name},v.id))]}),t.jsx("div",{className:"admin-list",children:I.map(v=>t.jsxs("div",{className:"admin-list-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:v.title}),t.jsxs("span",{children:[v.kind," · ",v.source_id," · ",[v.city,v.regi
471on,v.country].filter(Boolean).join(", ")||"Geography classified"]})]}),t.jsxs("div",{className:"tenant-control-buttons",children:[t.jsx("button",{type:"button",onClick:()=>void Re("sbh_discovery_review_action",{p_item_id:v.id,p_action:"approve",p_notes:null},"Candidate approved through audited review."),children:"Approve"}),t.jsx("button",{type:"button",onClick:()=>void Re("sbh_discovery_review_action",{p_item_id:v.id,p_action:"reject",p_notes:null},"Candidate rejected through audited review."),children:"Reject"})]})]},v.id))}),A&&t.jsx("div",{role:"status",className:"success-box",children:A})]}),t.jsxs("p",{className:"discovery-safety-note",children:[t.jsx($a,{size:16})," This build does not schedule scans, create production candidates, appoint moderators, or publish content. All newly created scopes, source links, and the global master switch remain OFF until an authorized operator changes them."]})]}):t.jsxs("div",{className:"admin-empty",children:[t.jsx($a,{}),t.jsx("strong",{children:"Discovery control plane unavailable"}),t.jsx("span",{children:"Controls remain fail-closed until the reviewed local migration is deployed and the platform-admin RPC authorizes this session."})]})]}),t.jsxs("section",{className:"admin-panel tenant-directory-panel",id:"events-console","data-automation-hook":"events.admin-console",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Events Calendar operations"}),t.jsx("h2",{children:"Allowances, Featured Placement & Moderation"}),t.jsx("p",{children:"Administrative configuration and queue visibility for the reusable events service."})]}),t.jsx("button",{type:"button",className:"admin-panel-heading-action","aria-label":he?"Close Events Calendar":"Open Events Calendar",title:he?"Close Events Calendar":"Open Events Calendar",onClick:()=>je(v=>!v),children:t.jsx(mt,{size:22})})]}),t.jsxs("div",{className:"platform-metric-strip",children:[t.jsxs("span",{children:[t.jsx("b",{children:F.limits.length})," membership limits"]}),t.jsxs("span",{children:[t.jsx("b",{children:F.categories.length})," categories"]}),t.jsxs("span",{children:[t.jsx("b",{children:F.open_reports.length})," open reports"]}),t.jsxs("span",{children:[t.jsx("b",{children:F.featured_active.length})," featured placements"]})]}),t.jsx("div",{className:"admin-list",children:F.limits.length?F.limits.map(v=>t.jsxs("div",{className:"admin-list-row",children:[t.jsx(ur,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:v.plan_key}),t.jsxs("span",{children:[v.monthly_event_allowance," events · ",v.monthly_featured_allowance," featured / month"]})]}),t.jsxs("b",{children:[v.extra_event_credit_cost," credits / extra"]})]},v.plan_key)):t.jsxs("div",{className:"admin-empty",children:[t.jsx(mt,{}),t.jsx("strong",{children:"Events admin controls pending local migration"}),t.jsx("span",{children:"Apply Phase 13I to populate allowance and moderation controls."})]})}),he&&t.jsxs("div",{className:"admin-events-calendar","data-automation-hook":"events.admin-calendar",children:[t.jsxs("div",{className:"admin-events-calendar-heading",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Platform Events Calendar"}),t.jsx("p",{children:"All tenant events are visible here only to the authenticated platform administrator. This view does not switch workspaces."})]}),t.jsxs("div",{className:"admin-events-calendar-nav",children:[t.jsx("button",{type:"button",onClick:()=>ne(new Date(ve.getFullYear(),ve.getMonth()-1,1)),"aria-label":"Previous month",children:"â¹"}),t.jsx("strong",{children:ve.toLocaleDateString("en-US",{month:"long",year:"numeric"})}),t.jsx("button",{type:"button",onClick:()=>ne(new Date(ve.getFullYear(),ve.getMonth()+1,1)),"aria-label":"Next month",children:"âº"})]})]}),t.jsx("div",{className:"admin-events-weekdays",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(v=>t.jsx("span",{children:v},v))}),t.jsx("div",{className:"admin-events-grid",children:Gn.map((v,X)=>t.jsx("div",{className:`admin-events-cell${v?"":" empty"}`,children:v&&t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:v.getDate()}),(Xn[v.toDateString()]??[]).map(G=>t.jsx("span",{className:`admin-calendar-event status-${G.status}`,title:`${G.title} · ${G.host_business_name}`,children:G.title},G.id))]})},(v==null?void 0:v.toISOString())??`empty-${X}`))}),!F.events.length&&t.jsxs("div",{className:"admin-calendar-empty",children:[t.jsx(mt,{size:20}),t.jsx("span",{children:"No event records are currently available."})]})]})]}),t.jsxs("section",{className:"admin-main-grid",children:[t.jsxs("article",{className:"admin-panel projects-panel beta-access-panel",id:"beta-access",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Beta Access"}),t.jsx("p",{children:"Explicit suite assignment for invite-only Beta Partners. No wildcard access."})]}),t.jsx(tt,{size:20})]}),t.jsxs("form",{className:"beta-access-form",onSubmit:v=>void O(v),children:[t.jsxs("label",{children:["Tenant ID",t.jsx("input",{required:!0,inputMode:"numeric",value:E.tenantId,onChange:v=>W({...E,tenantId:v.target.value}),placeholder:"Business client ID"})]}),t.jsxs("label",{children:["Beta program",t.jsxs("select",{required:!0,value:E.programId,onChange:v=>W({...E,programId:v.target.value}),children:[t.jsx("option",{value:"",children:"Select program"}),S.programs.map(v=>t.jsxs("option",{value:v.id,children:[v.name," · ",v.status]},v.id))]})]}),t.jsxs("div",{className:"beta-date-grid",children:[t.jsxs("label",{children:["Starts",t.jsx("input",{required:!0,type:"datetime-local",value:E.startsAt,onChange:v=>W({...E,startsAt:v.target.value})})]}),t.jsxs("label",{children:["Expires",t.jsx("input",{required:!0,type:"datetime-local",value:E.endsAt,onChange:v=>W({...E,endsAt:v.target.value})})]})]}),t.jsxs("fieldset",{children:[t.jsx("legend",{children:"Assigned suites"}),t.jsx("div",{className:"beta-suite-grid",children:S.suites.map(v=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:E.suites.includes(v.suite_key),onChange:X=>W({...E,suites:X.target.checked?[...E.suites,v.suite_key]:E.suites.filter(G=>G!==v.suite_key)})}),v.display_name]},v.suite_key))})]}),t.jsxs("label",{children:["Promotional credits",t.jsx("input",{type:"number",min:"0",max:"10000",value:E.creditGrant,onChange:v=>W({...E,creditGrant:v.target.value})})]}),t.jsxs("label",{children:["Internal notes",t.jsx("textarea",{value:E.notes,onChange:v=>W({...E,notes:v.target.value}),placeholder:"Internal pilot note"})]}),t.jsx("button",{className:"admin-save",type:"submit",disabled:!E.suites.length,children:"Activate Beta Partner"}),ee&&t.jsx("div",{className:"success-box",children:ee})]}),t.jsx("div",{className:"admin-list",children:S.enrollments.slice(0,5).map(v=>{var X;return t.jsxs("div",{className:"admin-list-row",children:[t.jsx(tt,{size:18}),t.jsxs("div",{children:[t.jsxs("strong",{children:["Tenant ",v.tenant_id," · ",v.program_name]}),t.jsxs("span",{children:[v.status," · ",((X=v.suites)==null?void 0:X.join(", "))||"No suites"]}),t.jsx("small",{children:Ks(v.ends_at)}),t.jsxs("div",{className:"beta-transition-actions",children:[t.jsx("button",{type:"button",onClick:()=>void _(v.id,"suspend"),children:"Suspend"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"revoke"),children:"Revoke"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"extend"),children:"Extend"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"reactivate"),children:"Reactivate"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"convert_free"),children:"Free"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"convert_plus_monthly"),children:"Plus/mo"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"convert_plus_annual"),children:"Plus/yr"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"convert_pro_monthly"),children:"Pro/mo"}),t.jsx("button",{type:"button",onClick:()=>void _(v.id,"convert_pro_annual"),children:"Pro/yr"})]})]})]},v.id)})})]}),t.jsxs("article",{className:"admin-panel leads-panel",id:"leads",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Job Leads"}),t.jsx("p",{children:"Upwork, Fiverr, Shopify Dev, direct, and referrals."})]}),t.jsxs("button",{onClick:()=>m(!0),children:[t.jsx(qr,{size:16})," Add lead"]})]}),t.jsxs("div",{className:"lead-source-row",children:[t.jsx("span",{children:"Upwork"}),t.jsx("span",{children:"Fiverr"}),t.jsx("span",{children:"Shopify Dev"}),t.jsx("span",{children:"Direct"})]}),t.jsx("div",{className:"admin-list",children:s.slice(0,6).map(v=>t.jsxs("div",{className:"admin-list-row",children:[t.jsx("div",{className:"source-dot",children:v.source.slice(0,2).toUpperCase()}),t.jsxs("div",{children:[t.jsx("strong",{children:v.title}),t.jsxs("span",{children:[v.source," · ",v.status]})]}),t.jsx("b",{children:v.value||"â"})]},v.id))})]}),t.jsxs("article",{className:"admin-panel clients-panel",id:"lobby-marketplace","data-automation-hook":"lobby-marketplace.admin",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Lobby & Bizz2Bizz BarterPlace"}),t.jsx("p",{children:"Platform surfaces remain tenant-scoped; support mode is not active."})]}),t.jsx(Tt,{size:20})]}),t.jsxs("div",{className:"client-row",children:[t.jsx("div",{className:"client-logo",children:"L"}),t.jsxs("div",{children:[t.jsx("strong",{children:"The Lobby"}),t.jsx("span",{children:"Community feed · tenant authorization required"})]}),t.jsxs("a",{href:"/?area=lobby",onClick:v=>as(v,"/?area=lobby"),"aria-label":"Open The Lobby",children:[t.jsx(Tt,{size:15})," Open"]})]}),t.jsxs("div",{className:"client-row",children:[t.jsx("div",{className:"client-logo",children:"B2B"}),t.jsxs("div",{children:[t.jsx("strong",{children:"Bizz2Bizz BarterPlace"}),t.jsx("span",{children:"Free business trade listings · tenant authorization required"})]}),t.jsxs("a",{href:"/?area=marketplace",onClick:v=>as(v,"/?area=marketplace"),"aria-label":"Open Bizz2Bizz BarterPlace",children:[t.jsx(Tt,{size:15})," Open"]})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",id:"wallet-admin","data-automation-hook":"wallet.admin",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Smart Wallet Administration"}),t.jsx("p",{children:"Read-only platform visibility; grants, revocations, packs, and promo codes remain audited controls."})]}),t.jsx(ur,{size:20})]}),t.jsx("div",{className:"admin-list",children:t.jsxs("div",{className:"admin-list-row",children:[t.jsx(ur,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:"Platform Smart Credits"}),t.jsx("span",{children:"Across visible tenant wallets"})]}),t.jsx("b",{children:(j==null?void 0:j.smart_credit_balance)??"â"})]})})]}),t.jsxs("article",{className:"admin-panel alerts-panel",id:"alerts-tasks",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Alerts & Tasks"}),t.jsx("p",{children:"Smart Ops incident feed."})]}),t.jsx(Hc,{size:19})]}),c.length?t.jsx("div",{className:"admin-list",children:c.map((v,X)=>t.jsxs("div",{className:"admin-list-row",children:[t.jsx(gs,{size:18}),t.jsxs("div",{children:[t.jsx("strong",{children:v.title??`${v.source??"Smart Ops"} incident`}),t.jsxs("span",{children:[v.severity??v.status??"Open"," · ",Ks(v.created_at)]})]})]},String(v.id??X)))}):t.jsxs("div",{className:"admin-empty",children:[t.jsx(Kr,{}),t.jsx("strong",{children:"No visible Smart Ops incidents"}),t.jsx("span",{children:l.smartOps})]})]}),t.jsxs("article",{className:"admin-panel projects-panel",id:"projects",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Open Projects"}),t.jsx("p",{children:"Direct access to the working repository."})]}),t.jsxs("a",{href:"https://github.com/goldendevco/nate-core",target:"_blank",rel:"noreferrer",children:["GitHub ",t.jsx(Tt,{size:14})]})]}),[["Smart Workspace / Portal","portal/",82],["Smart Ops Stage 4B","workflows/",100],["Smart SKU Creator","workflows/smart-sku/",null],["Smart Content - Auto Poster","content-library/",null],["Smart CRM","workflows/smart_crm/",null],["Content Library","content-library/",null],["Smart Pitch Simulator","workflows/",58],["Website Factory","workflows/",48]].map(([v,X,G])=>t.jsxs("a",{className:"project-row",href:`https://github.com/goldendevco/nate-core/tree/main/${X}`,target:"_blank",rel:"noreferrer",children:[t.jsxs("div",{children:[t.jsx("strong",{children:v}),t.jsx("span",{children:X})]}),t.jsxs("div",{className:"progress",children:[t.jsx("i",{style:{width:`${G??0}%`}}),t.jsx("small",{children:G==null?"Linked":`${G}%`})]}),t.jsx(zt,{size:17})]},String(v)))]}),t.jsxs("article",{className:"admin-panel health-panel",id:"system-health",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"System Health"}),t.jsx("p",{children:"Live where available; connected links everywhere else."})]}),t.jsx("button",{className:"health-refresh-button",onClick:()=>void B(),title:"Refresh Health","aria-label":"Refresh Health",children:t.jsx(St,{size:16})})]}),t.jsxs("div",{className:"health-row",children:[t.jsx(os,{}),t.jsx("span",{children:"Render Portal"}),t.jsx("b",{children:l.portal})]}),t.jsxs("div",{className:"health-row",children:[t.jsx(bp,{}),t.jsx("span",{children:"Supabase Database"}),t.jsx("b",{children:l.supabase})]}),t.jsxs("div",{className:"health-row",children:[t.jsx(tt,{}),t.jsx("span",{children:"Smart Ops"}),t.jsx("b",{children:l.smartOps})]}),t.jsxs("div",{className:"health-row",children:[t.jsx(rp,{}),t.jsx("span",{children:"n8n / Nate"}),t.jsx("b",{children:"Stage 4B complete"})]})]}),t.jsxs("article",{className:"admin-panel scanner-panel",id:"smart-scanner",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Platform service"}),t.jsx("h2",{children:"Smart Scanner"}),t.jsx("p",{children:"Capture once, classify, review, and route across suites."})]}),t.jsxs("a",{className:"admin-panel-link",href:"/?area=scanner&workspace=admin",onClick:v=>as(v,"/?area=scanner&workspace=admin"),children:["Open review queue ",t.jsx(zt,{size:16})]})]}),t.jsxs("div",{className:"scanner-status-grid",children:[t.jsxs("div",{children:[t.jsx("strong",{children:We.total_scans}),t.jsx("span",{children:"Total scans"})]}),t.jsxs("div",{children:[t.jsx("strong",{children:We.successful_scans}),t.jsx("span",{children:"Successful"})]}),t.jsxs("div",{children:[t.jsx("strong",{children:We.needs_review}),t.jsx("span",{children:"Needs review"})]}),t.jsxs("div",{children:[t.jsx("strong",{children:We.failed_scans}),t.jsx("span",{children:"Failed"})]})]}),t.jsxs("div",{className:"scanner-health-row",children:[t.jsxs("span",{children:["OCR queue ",We.ocr_queue]}),t.jsxs("span",{children:["AI queue ",We.ai_queue]}),t.jsx("b",{children:We.total_scans?`${Math.round(We.average_confidence*100)}% confidence`:"Ready for first scan"})]}),We.document_breakdown.length?t.jsx("div",{className:"scanner-breakdown",children:We.document_breakdown.slice(0,5).map(v=>t.jsxs("span",{children:[_l(v.document_type,v.document_type)," · ",v.count]},v.document_type))}):t.jsxs("div",{className:"admin-empty scanner-empty",children:[t.jsx(xa,{}),t.jsx("strong",{children:"Scanner foundation is ready"}),t.jsx("span",{children:"Upload and processing adapters can now use the protected API contract."})]})]}),t.jsxs("article",{className:"admin-panel avengers-panel",id:"ai-avengers",children:[t.jsxs("div",{className:"admin-panel-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"AI Avengers"}),t.jsx("p",{children:"Subscriptions, renewals, cost, and working usage."})]}),t.jsx(Kf,{size:20})]}),t.jsx("div",{className:"avenger-grid",children:a.map(v=>t.jsxs("div",{className:"avenger-card",children:[t.jsxs("div",{className:"avenger-card-top",children:[t.jsx("div",{className:"avenger-avatar",children:v.name.slice(0,1)}),t.jsxs("div",{children:[t.jsx("strong",{children:v.name}),t.jsx("span",{children:v.role})]}),t.jsx("button",{onClick:()=>h(v),children:t.jsx(Xa,{size:14})})]}),t.jsx("div",{className:"usage-bar",children:t.jsx("i",{style:{width:`${Math.min(100
471,Math.max(0,v.usage))}%`}})}),t.jsxs("div",{className:"avenger-meta",children:[t.jsxs("span",{children:["Usage ",t.jsx("b",{children:v.usage?`${v.usage}%`:"Not entered"})]}),t.jsxs("span",{children:["Renews ",t.jsx("b",{children:v.renewalDate||"Not entered"})]}),t.jsxs("span",{children:["Cost ",t.jsx("b",{children:v.monthlyCost||"Not entered"})]})]}),t.jsx("small",{children:v.usageLabel})]},v.id))})]})]}),t.jsxs("section",{className:"admin-quick-access",id:"settings","aria-labelledby":"command-center-settings-title",children:[t.jsxs("header",{children:[t.jsx("p",{className:"eyebrow",children:"Command Center"}),t.jsx("h2",{id:"command-center-settings-title",children:"Settings & quick actions"}),t.jsx("p",{children:"Manage platform access, refresh operational status, and maintain agent usage without leaving the Command Center."})]}),t.jsxs("a",{href:"/?workspace=admin&area=workspace§ion=platform-access-controls",onClick:v=>as(v,"/?workspace=admin&area=workspace§ion=platform-access-controls"),children:[t.jsx($a,{}),t.jsx("span",{children:"Platform Access Controls"})]}),t.jsxs("button",{type:"button",onClick:()=>h(a.find(v=>v.id==="dex")??null),children:[t.jsx(vi,{}),t.jsx("span",{children:"Update Dex Usage"})]}),t.jsxs("button",{type:"button",onClick:()=>h(a.find(v=>v.id==="claude")??null),children:[t.jsx(Rr,{}),t.jsx("span",{children:"Update Claude Usage"})]}),t.jsxs("button",{type:"button",onClick:()=>void B(),children:[t.jsx(St,{}),t.jsx("span",{children:"Refresh Health"})]})]}),u&&t.jsx("div",{className:"admin-modal-backdrop",children:t.jsxs("form",{className:"admin-modal",onSubmit:v=>{v.preventDefault(),U(u)},children:[t.jsxs("div",{className:"admin-modal-title",children:[t.jsxs("h2",{children:["Edit ",u.name]}),t.jsx("button",{type:"button",onClick:()=>h(null),children:t.jsx(gt,{})})]}),t.jsxs("label",{children:["Renewal date",t.jsx("input",{type:"date",value:u.renewalDate,onChange:v=>h({...u,renewalDate:v.target.value})})]}),t.jsxs("label",{children:["Monthly cost",t.jsx("input",{value:u.monthlyCost,placeholder:"$20 / month",onChange:v=>h({...u,monthlyCost:v.target.value})})]}),t.jsxs("label",{children:["Current usage percentage",t.jsx("input",{type:"number",min:"0",max:"100",value:u.usage,onChange:v=>h({...u,usage:Number(v.target.value)})})]}),t.jsxs("label",{children:["Usage note",t.jsx("input",{value:u.usageLabel,onChange:v=>h({...u,usageLabel:v.target.value})})]}),t.jsx("button",{className:"admin-save",type:"submit",children:"Save changes"})]})}),f&&t.jsx("div",{className:"admin-modal-backdrop",children:t.jsxs("form",{className:"admin-modal",onSubmit:v=>{v.preventDefault(),H()},children:[t.jsxs("div",{className:"admin-modal-title",children:[t.jsx("h2",{children:"Add Job Lead"}),t.jsx("button",{type:"button",onClick:()=>m(!1),children:t.jsx(gt,{})})]}),t.jsxs("label",{children:["Source",t.jsxs("select",{value:x.source,onChange:v=>p({...x,source:v.target.value}),children:[t.jsx("option",{children:"Upwork"}),t.jsx("option",{children:"Fiverr"}),t.jsx("option",{children:"Shopify Dev"}),t.jsx("option",{children:"Direct"}),t.jsx("option",{children:"Referral"})]})]}),t.jsxs("label",{children:["Opportunity",t.jsx("input",{required:!0,value:x.title,onChange:v=>p({...x,title:v.target.value})})]}),t.jsxs("label",{children:["Value",t.jsx("input",{value:x.value,placeholder:"$500â$1,000",onChange:v=>p({...x,value:v.target.value})})]}),t.jsxs("label",{children:["Status",t.jsxs("select",{value:x.status,onChange:v=>p({...x,status:v.target.value}),children:[t.jsx("option",{children:"New"}),t.jsx("option",{children:"Reviewing"}),t.jsx("option",{children:"Proposal"}),t.jsx("option",{children:"Won"}),t.jsx("option",{children:"Passed"})]})]}),t.jsx("button",{className:"admin-save",type:"submit",children:"Add lead"})]})})]})}function bl(){const e=new URLSearchParams(window.location.search);return e.get("area")==="settings"?"settings":e.get("section")||"platform-overview"}function im({onSignOut:e,supabase:r,mobileOpen:a=!1,onClose:n=()=>{},activePage:s="workspace"}){const i=Ju(r),c=[["Dashboard","platform-overview",zn],["Platform Access Controls","platform-access-controls",$a],["The Lobby","lobby-marketplace",Tt],["Bizz2Bizz BarterPlace","marketplace",Tt],["Smart Scanner","smart-scanner",xa],["Smart Inventory Tracker","inventory",Xr],["Smart SKU Creator","sku",xa],["Tenant Management","clients",dr],["Wallet Administration","wallet-admin-primary",ur],["Global Discovery","global-discovery-v1-console",os],["Opportunities & Events","events-console",mt],["Alerts & Tasks","alerts-tasks",aa],["Projects","projects",Vu],["Settings","settings",Fu]],[o,l]=y.useState(bl);y.useEffect(()=>{const h=()=>{const f=bl();l(f),requestAnimationFrame(()=>{var m;return(m=document.getElementById(f))==null?void 0:m.scrollIntoView({block:"start"})})};return window.addEventListener("popstate",h),window.addEventListener(ga,h),o!=="platform-overview"&&requestAnimationFrame(()=>{var f;return(f=document.getElementById(o))==null?void 0:f.scrollIntoView({block:"start"})}),()=>{window.removeEventListener("popstate",h),window.removeEventListener(ga,h)}},[]);const d=h=>{const f=new URLSearchParams(window.location.search);f.set("workspace","admin"),f.set("area","workspace"),f.set("section",h),l(h),n(),Aa(`${window.location.pathname}?${f.toString()}`)},u=(h,f,m,x)=>t.jsxs("a",{className:`admin-sidebar-link${s===f?" active":""}`,href:x,onClick:p=>{n(),as(p,x)},"aria-current":s===f?"page":void 0,children:[t.jsx(m,{size:18}),t.jsx("span",{children:h})]},h);return t.jsxs("aside",{id:"admin-command-center-sidebar",className:`admin-sidebar${a?" open":""}`,"aria-label":"Command Center sidebar",children:[t.jsxs("div",{className:"admin-sidebar-brand",children:[t.jsx("img",{src:Bs,alt:"SmartBizHelper"}),t.jsx("span",{children:"Command Center"}),t.jsx("button",{className:"admin-sidebar-close",type:"button",onClick:n,"aria-label":"Close Command Center navigation",children:t.jsx(gt,{})})]}),t.jsx("nav",{"aria-label":"Command Center navigation",children:c.map(([h,f,m])=>h==="The Lobby"?u(h,"lobby",m,"/?area=lobby"):h==="Bizz2Bizz BarterPlace"?u(h,"marketplace",m,"/?area=marketplace"):h==="Smart Scanner"?u(h,"scanner",m,"/?area=scanner&workspace=admin"):h==="Smart SKU Creator"?u(h,"sku",m,"/?workspace=admin&area=sku"):h==="Opportunities & Events"?u(h,"events",m,"/?area=events"):h==="Smart Inventory Tracker"?t.jsxs("button",{className:"admin-sidebar-link",type:"button",title:"Select a tenant before opening inventory",onClick:()=>d("clients"),children:[t.jsx(m,{size:18}),t.jsx("span",{children:h})]},h):t.jsxs("button",{className:s==="workspace"&&o===f?"active":"","aria-current":s==="workspace"&&o===f?"page":void 0,type:"button",onClick:()=>d(f),children:[t.jsx(m,{size:18}),t.jsx("span",{children:h})]},h))}),t.jsxs("section",{className:"lobby-ness-card admin-ness-card","aria-labelledby":"admin-ness-title","aria-busy":i.loading,children:[i.url?t.jsx("img",{src:i.url,alt:"Ness, the SmartBizHelper guide"}):t.jsx("div",{className:"lobby-ness-placeholder","aria-hidden":"true",children:"N"}),t.jsxs("div",{children:[t.jsx("strong",{id:"admin-ness-title",children:"Need a hand?"}),t.jsx("p",{children:i.error||"Ness is here to help you find your next move."})]})]}),t.jsxs("div",{className:"lobby-sidebar-footer admin-sidebar-footer",children:[t.jsxs("div",{className:"lobby-sidebar-account",children:[t.jsx("span",{children:"SmartBizHelper Platform Admin"}),t.jsx("button",{onClick:e,type:"button",children:"Sign out"})]}),t.jsx(Ra,{className:"portal-ownership-footer-sidebar"})]})]})}function cm({supabase:e}){const[r,a]=y.useState(null);return y.useEffect(()=>{e&&e.rpc("portal_get_my_beta_access").then(({data:n})=>a(n))},[e]),r!=null&&r.is_beta_partner?t.jsxs("section",{className:"panel beta-status-card",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Invite-only membership"}),t.jsx("h2",{children:"Beta Partner"}),t.jsx("p",{className:"muted",children:"Your beta suites are assigned explicitly by SmartBizHelper."})]}),t.jsx(tt,{})]}),r.enrollments.map((n,s)=>t.jsxs("div",{className:"beta-status-row",children:[t.jsx("strong",{children:n.program_name}),t.jsxs("span",{children:[n.effective_status??n.status," · access ends ",new Date(n.ends_at).toLocaleDateString()]}),t.jsx("div",{children:n.effective_status==="expired"?null:n.suites.map(i=>t.jsx("span",{className:"plan-current",children:i.suite_key},i.suite_key))})]},`${n.program_name}-${s}`))]}):null}const om=[{key:"sbh",name:"Executive Black & Gold",group:"Business",swatches:["#0b1220","#f4b942","#f4f7fb"]},{key:"navy_gold",name:"Navy & Gold",group:"Business",swatches:["#071a33","#d4a72c","#f5f7fb"]},{key:"slate",name:"Slate & Steel",group:"Business",swatches:["#273244","#7fa1c3","#f1f4f7"]},{key:"emerald",name:"Emerald Executive",group:"Business",swatches:["#123a31","#35b77c","#f0f8f4"]},{key:"burgundy",name:"Burgundy & Rose Gold",group:"Business",swatches:["#4a1723","#c98b78","#faf2f3"]},{key:"light_neutral",name:"Warm Neutral",group:"Business",swatches:["#4a433c","#a88761","#faf8f4"]},{key:"coral",name:"Coral & Cream",group:"Business",swatches:["#7f2f24","#f26b4f","#fff4ec"]},{key:"cardinal_gold",name:"Cardinal & Gold",group:"College-inspired",swatches:["#7a0019","#f2b705","#fff8e7"]},{key:"orange_navy",name:"Orange & Navy",group:"College-inspired",swatches:["#0b1f3a","#f47a1f","#fff5ec"]},{key:"purple_gold",name:"Purple & Gold",group:"College-inspired",swatches:["#2f195f","#f0c419","#faf6e8"]},{key:"scarlet_gray",name:"Scarlet & Gray",group:"College-inspired",swatches:["#7f1021","#a7adb4","#f5f6f7"]},{key:"red_black",name:"Red, Black & White",group:"College-inspired",swatches:["#ba0c2f","#000000","#ffffff"]},{key:"royal_orange",name:"Royal Blue & Orange",group:"College-inspired",swatches:["#123b7a","#f57c00","#f3f7fd"]},{key:"green_gold",name:"Green & Gold",group:"College-inspired",swatches:["#123b2a","#d4af37","#f4f8f2"]},{key:"midnight_green",name:"Midnight Green",group:"Pro-inspired",swatches:["#063b36","#9fd8c7","#eef8f6"]},{key:"purple_black",name:"Purple & Black",group:"Pro-inspired",swatches:["#17131f","#7f4fc9","#f4f0fa"]},{key:"red_gold",name:"Red & Gold",group:"Pro-inspired",swatches:["#7a1017","#d7a928","#fff8e8"]},{key:"falcon_red_black",name:"Red, Black & Silver",group:"Pro-inspired",swatches:["#a71930","#000000","#a5acaf"]},{key:"silver_navy",name:"Silver & Navy",group:"Pro-inspired",swatches:["#041e42","#869397","#f5f6f7"]},{key:"teal_black",name:"Teal & Black",group:"Pro-inspired",swatches:["#101719","#1aa6a6","#edf9f9"]},{key:"silver_black",name:"Silver & Black",group:"Pro-inspired",swatches:["#111318","#aeb4bc","#f4f5f6"]},{key:"aqua_orange",name:"Aqua & Orange",group:"Pro-inspired",swatches:["#075b63","#ef6c35","#eefafa"]},{key:"bakery_cream",name:"Bakery Cream",group:"Industry",swatches:["#4a2f24","#d39b62","#fff6e9"]},{key:"medical_teal",name:"Medical Teal",group:"Industry",swatches:["#0d4650","#3fb9b2","#f0fbfa"]},{key:"construction_orange",name:"Construction Orange",group:"Industry",swatches:["#252a31","#f28c28","#fff6e9"]},{key:"law_navy",name:"Law Office Navy",group:"Industry",swatches:["#111f35","#b4935a","#f7f5f1"]},{key:"high_contrast",name:"High Contrast",group:"Accessibility",swatches:["#000000","#ffd400","#ffffff"]},{key:"dark_plus",name:"Dark Mode Plus",group:"Accessibility",swatches:["#090b10","#6fb8ff","#eaf4ff"]}],lm=["Business","College-inspired","Pro-inspired","Industry","Accessibility"];function Qu(e,r){return!e||!r?null:e.storage.from("workspace-branding").getPublicUrl(r).data.publicUrl}function Ka(e){document.documentElement.dataset.workspaceTheme=e||"sbh"}function dm({supabase:e,branding:r,onBrandingChange:a}){const[n,s]=y.useState(""),[i,c]=y.useState("sbh"),[o,l]=y.useState(null),[d,u]=y.useState(!1),[h,f]=y.useState(null),[m,x]=y.useState(null);y.useEffect(()=>{r&&(s(r.company_display_name??""),c(r.theme_key??"sbh"),l(r.logo_path??null))},[r]);const p=y.useMemo(()=>Qu(e,o),[e,o]);async function g(b){var P,T;const j=(P=b.target.files)==null?void 0:P[0];if(!j||!e||!r)return;if(f(null),x(null),j.size>2*1024*1024)return f("Logo must be 2 MB or smaller.");if(!["image/png","image/jpeg","image/webp","image/svg+xml"].includes(j.t
471ype))return f("Use a PNG, JPG, WEBP, or SVG logo.");u(!0);const k=((T=j.name.split(".").pop())==null?void 0:T.toLowerCase())||"png",N=`${r.client_id}/workspace-logo.${k}`,{error:C}=await e.storage.from("workspace-branding").upload(N,j,{upsert:!0,contentType:j.type});if(u(!1),C)return f(C.message);l(N),x("Logo uploaded. Save branding to publish it across the workspace.")}async function w(b){if(b.preventDefault(),!e||!(r!=null&&r.can_edit))return;u(!0),f(null),x(null);const j=n.trim(),{data:k,error:N}=await e.rpc("portal_update_workspace_branding",{p_company_display_name:j||null,p_logo_path:o,p_theme_key:i});if(u(!1),N)return f(N.message);const C=k??{},P={...r,...C,company_display_name:C.company_display_name??j,logo_path:C.logo_path??o,theme_key:C.theme_key??i};Ka(P.theme_key),a(P),x("Workspace branding saved.")}function S(){s((r==null?void 0:r.company_display_name)??""),l(null),c("sbh"),Ka("sbh")}return r?t.jsxs(t.Fragment,{children:[t.jsx("header",{className:"page-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Workspace preferences"}),t.jsx("h1",{children:"Branding"}),t.jsx("p",{className:"muted",children:"Match your company, organization, or favorite color combination while keeping every screen clean and readable."})]})}),t.jsxs("form",{onSubmit:w,children:[t.jsxs("section",{className:"branding-grid",children:[t.jsxs("div",{className:"panel branding-controls",children:[t.jsx("h2",{children:"Company identity"}),t.jsxs("label",{children:["Company display name",t.jsx("input",{value:n,onChange:b=>s(b.target.value),disabled:!r.can_edit})]}),t.jsxs("div",{className:"logo-field",children:[t.jsx("span",{children:"Company logo"}),t.jsxs("div",{className:"logo-upload-row",children:[p?t.jsx("img",{src:p,alt:"Workspace logo preview"}):t.jsx("div",{className:"logo-placeholder",children:"No logo"}),t.jsxs("label",{className:"secondary-button upload-button",children:[t.jsx(hp,{size:17})," Upload logo",t.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp,image/svg+xml",onChange:g,disabled:!r.can_edit||d})]})]}),t.jsx("small",{children:"PNG, JPG, WEBP, or SVG. Maximum 2 MB."})]})]}),t.jsxs("div",{className:"panel branding-preview","data-preview-theme":i,children:[t.jsx("p",{className:"eyebrow",children:"Live preview"}),t.jsxs("div",{className:"preview-shell",children:[t.jsxs("div",{className:"preview-sidebar",children:[p?t.jsx("img",{src:p,alt:""}):t.jsx("strong",{children:n||"Your Company"}),t.jsx("span",{children:"Workspace"}),t.jsx("span",{children:"Inventory"}),t.jsx("span",{children:"Smart SKU"})]}),t.jsxs("div",{className:"preview-main",children:[t.jsx("small",{children:"Operations command center"}),t.jsx("h2",{children:n||"Your Company"}),t.jsxs("div",{className:"preview-cards",children:[t.jsx("i",{}),t.jsx("i",{}),t.jsx("i",{})]})]})]})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Color theme packs"}),t.jsx("p",{className:"muted",children:"Choose from professional, sports-inspired, industry, and accessibility palettes. Theme names use color combinations onlyâno team branding or logos."})]})}),lm.map(b=>t.jsxs("section",{className:"theme-group",children:[t.jsx("h3",{children:b}),t.jsx("div",{className:"theme-grid",children:om.filter(j=>j.group===b).map(j=>t.jsxs("button",{type:"button",className:i===j.key?"theme-option selected":"theme-option",onClick:()=>{c(j.key),Ka(j.key)},disabled:!r.can_edit,children:[t.jsx("span",{className:"theme-swatches",children:j.swatches.map(k=>t.jsx("i",{style:{background:k}},k))}),t.jsx("strong",{children:j.name})]},j.key))})]},b))]}),h&&t.jsx("div",{className:"error-box",children:h}),m&&t.jsx("div",{className:"success-box",children:m}),t.jsxs("div",{className:"branding-actions",children:[t.jsxs("button",{type:"button",className:"secondary-button",onClick:S,disabled:!r.can_edit||d,children:[t.jsx(xo,{size:16})," Reset to SBH"]}),t.jsx("button",{type:"submit",className:"primary-button",disabled:!r.can_edit||d,children:d?"Savingâ¦":"Save branding"})]}),!r.can_edit&&t.jsx("p",{className:"muted",children:"Only workspace owners and admins can change branding."})]})]}):t.jsx("section",{className:"panel",children:t.jsx("p",{children:"Loading workspace brandingâ¦"})})}let Ys;function Mi(){return Ys!==void 0||(Ys=Du("https://igvskwjrroiivfrtmawd.supabase.co","sb_publishable_EuxB7NlknSsbvouGZUP_qA_1H7OTUui")),Ys}const Zu=[{id:"welcome",label:"Welcome",icon:dp},{id:"onboarding",label:"Start Here",icon:Kr}
471,{id:"lobby",label:"The Lobby",icon:Tt,entitlement:"suite:lobby"},{id:"workspace",label:"Workspace",icon:zn},{id:"directory",label:"Business Directory",icon:hr},{id:"messages",label:"Bizz2Bizz Connect",icon:Va,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"marketplace",label:"Bizz2Bizz BarterPlace",icon:en},{id:"web-design",label:"Smart Websites",icon:Di},{id:"smart-content",label:"Smart Content",icon:Ls},{id:"smart-finance",label:"Smart Finance",icon:Bi},{id:"inventory",label:"Smart Inventory Tracker",icon:Xr,requiresRole:["owner","admin","manager","staff","viewer"],entitlement:"suite:smart_inventory"},{id:"scanner",label:"Smart Scanner",icon:xa,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"sku",label:"Smart SKU Creator",icon:xa,requiresRole:["owner","admin","manager"],entitlement:"suite:smart_sku"},{id:"contacts",label:"Smart Contacts",icon:dr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"reports",label:"Reports & Trends",icon:Rr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"items",label:"My Items",icon:Hr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"sync",label:"Sync Inventory",icon:St,requiresRole:["owner","admin","manager","staff"]},{id:"purchase",label:"Purchase Plans",icon:en,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"forecasting",label:"Forecasting",icon:Pn,requiresRole:["owner","admin","manager"]},{id:"vendors",label:"Vendors",icon:hr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"recipes",label:"Recipes & Products",icon:Pr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"training",label:"Training & SOPs",icon:Pr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"meetings",label:"Meetings",icon:Sn,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"grant-watch",label:"Opportunities & Events",icon:fr,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"team",label:"Team Access",icon:dr,requiresRole:["owner","admin","manager"]},{id:"plan",label:"Plan & Credits",icon:ur},{id:"smart-card",label:"Smart Card",icon:Rs,requiresRole:["owner"]},{id:"notifications",label:"Notifications",icon:aa,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"support",label:"Support",icon:uo},{id:"settings",label:"Settings",icon:ho,requiresRole:["owner","admin"]}];function um(e,r,a){const n=e.clientId===0&&e.role==="unknown",s=new Set(["lobby","web-design","smart-content","smart-finance","directory","marketplace","events","plan","sync","inventory","items","sku","scanner","contacts","smart-card","notifications","messages","purchase","reports","forecasting","vendors","recipes","training","meetings","grant-watch","support","settings"]);return Zu.filter(i=>!(["welcome","onboarding"].includes(i.id)&&["owner","admin"].includes(e.role)||n&&!s.has(i.id)||!n&&i.requiresRole&&!i.requiresRole.includes(e.role)||i.permission&&(!r.known||!r.granted.has(i.permission))||i.entitlement&&(!a.known||!a.granted.has(i.entitlement))))}function hm(){const e=new URLSearchParams(window.location.search),r=e.get("workspace")==="tenant";if(r&&!/^\d+$/.test(e.get("tenant")??""))return"lobby";const a=e.get("area");return a==="events"?"events":a==="smart-sku"||a==="smart_sku"?"sku":a&&Zu.some(n=>n.id===a)?a:r?"workspace":"lobby"}const eh=y.createContext(null);function fm(e){const r=String(e??"").toLowerCase();return["owner","admin","manager","staff","viewer","team_member","inventory_counter","training_only"].includes(r)?r:"unknown"}function pm({session:e,children:r,platformAdminLobby:a=!1}){var l,d;const n=Mi(),s=a&&((l=e.user.app_metadata)==null?void 0:l.sbh_admin)===!0&&n?{session:e,supabase:n,identity:{authUserId:e.user.id,email:e.user.email??"",portalUserId:0,clientId:0,locationId:null,role:"unknown",fullName:((d=e.user.user_metadata)==null?void 0:d.full_name)??"Platform Admin"},branding:{client_id:0,company_display_name:"SmartBizHelper",logo_path:null,theme_key:"sbh",can_edit:!1},permissions:{known:!0,granted:new Set},entitlements:{known:!0,granted:new Set(["suite:lobby","suite:marketplace","suite:smart_inventory","suite:smart_sku"])}}
471:null,[i,c]=y.useState(()=>s?{value:s,error:null,loading:!1}:{value:null,error:null,loading:!0});y.useEffect(()=>{let u=!0;async function h(){var T,L,M,E,W,ee;if(s||c(ce=>ce.value?ce:{value:null,error:null,loading:!0}),!n)return c({value:null,error:"Portal environment variables are not configured.",loading:!1});const f=new URLSearchParams(window.location.search),m=f.get("workspace")==="tenant"?Number(f.get("tenant")):null,x=ce=>{window.location.replace(`${window.location.pathname}?area=lobby`),c({value:null,error:ce,loading:!1})};if(f.get("workspace")==="tenant"&&(m===null||!Number.isInteger(m)||m<=0))return x("A valid tenant must be selected explicitly.");if(s){Ka("sbh"),c({value:s,error:null,loading:!1});return}try{await Pf({supabase:n,userId:e.user.id,userEmail:e.user.email,invoke:Df})}catch(ce){return u?c({value:null,error:`Your Workspace setup is saved and can be retried safely. ${ce instanceof Error?ce.message:"Provisioning did not complete."}`,loading:!1}):void 0}if(m){const ce=await n.rpc("portal_validate_tenant_access",{p_tenant_id:m});if(ce.error||((T=ce.data)==null?void 0:T.allowed)!==!0)return x(((L=ce.error)==null?void 0:L.message)??"This tenant is not authorized for the current account.")}let[p,g]=await Promise.all([n.rpc("portal_get_my_profile_worldwide"),n.rpc("portal_get_workspace_branding")]);if((p.error||!((M=p.data)!=null&&M.portal_user_id))&&((E=e.user.user_metadata)==null?void 0:E.onboarding_mode)==="business")try{await Rf({supabase:n,userId:e.user.id,invoke:Of}),[p,g]=await Promise.all([n.rpc("portal_get_my_profile_worldwide"),n.rpc("portal_get_workspace_branding")])}catch(ce){return u?c({value:null,error:`Your Workspace setup is saved and can be retried safely. ${ce instanceof Error?ce.message:"Provisioning did not complete."}`,loading:!1}):void 0}if(!u)return;const S=p.data,b=g.data;if(p.error||g.error||!S||!S.portal_user_id||!S.client_id||!b)return c({value:null,error:((W=p.error)==null?void 0:W.message)??((ee=g.error)==null?void 0:ee.message)??"Active tenant context is unavailable.",loading:!1});const j={authUserId:e.user.id,email:e.user.email??"",portalUserId:Number(S.portal_user_id),clientId:Number(S.client_id),locationId:S.default_location_id==null?null:Number(S.default_location_id),role:fm(S.role),fullName:S.full_name?String(S.full_name):null};if(m&&(!j.clientId||j.clientId!==m||j.role==="unknown"))return x("The requested tenant does not match the authenticated membership.");Ka(b.theme_key);const k={known:!1,granted:new Set},N=["lobby","marketplace","smart_inventory","smart_sku"],C=await Promise.all(N.map(ce=>n.rpc("sbh_resolve_suite_entitlement",{p_tenant_id:Number(S.client_id),p_suite_key:ce}))),P={known:C.every(ce=>!ce.error),granted:new Set(C.flatMap((ce,ue)=>{var te;return((te=ce.data)==null?void 0:te.allowed)===!0?[`suite:${N[ue]}`]:[]}))};c({value:{session:e,supabase:n,identity:j,branding:b,permissions:k,entitlements:P},error:null,loading:!1})}return h(),()=>{u=!1}},[e,n,a]);const o=i.value;return i.loading?t.jsxs("div",{className:"app-shell shell-transition","aria-busy":"true","aria-label":"Loading workspace content",children:[t.jsxs("aside",{className:"sidebar","aria-hidden":"true",children:[t.jsx("div",{className:"sidebar-brand",children:t.jsx("img",{src:Bs,alt:"",className:"brand-logo-small"})}),t.jsxs("nav",{children:[t.jsxs("span",{className:"nav-link active",children:[t.jsx("i",{className:"shell-transition-dot"}),"Workspace"]}),t.jsxs("span",{className:"nav-link",children:[t.jsx("i",{className:"shell-transition-dot"}),"Community"]}),t.jsxs("span",{className:"nav-link",children:[t.jsx("i",{className:"shell-transition-dot"}),"Settings"]})]})]}),t.jsxs("div",{className:"main-shell",children:[t.jsxs("div",{className:"shell-transition-topbar",children:[t.jsx("span",{}),t.jsx("span",{})]}),t.jsx("main",{className:"content",children:t.jsxs("div",{className:"lobby-columns",children:[t.jsx("section",{className:"lobby-center-column",children:t.jsxs("div",{className:"panel shell-transition-panel",children:[t.jsx("span",{className:"shell-transition-line wide"}),t.jsx("span",{className:"shell-transition-line"}),t.jsx("span",{className:"shell-transition-line short"}),t.jsx("p",{children:"Loading secure workspace contentâ¦"})]})}),t.jsx("aside",{className:"lobby-intelligence-rail","aria-hidden":"true",children:t.jsxs("section",{className:"lobby-rail-card shell-transition-panel",children:[t.jsx("span",{className:"shell-transition-line"}),t.jsx("span",{className:"shell-transition-line short"})]})})]})})]})]}):i.error||!o?t.jsx("main",{className:"login-shell",children:t.jsxs("section",{className:"login-card",children:[t.jsx("h1",{children:"Worksp
471ace unavailable"}),t.jsx("p",{className:"muted",children:i.error??"Tenant context is unavailable."})]})}):t.jsx(eh.Provider,{value:o,children:r})}function Hn(){const e=y.useContext(eh);if(!e)throw new Error("useWorkspaceShell must be used inside WorkspaceShellProvider");return e}function mm(){const{identity:e,permissions:r,entitlements:a}=Hn();return y.useMemo(()=>um(e,r,a),[e,r,a])}const jl=`${"https://igvskwjrroiivfrtmawd.supabase.co".replace(/\/$/,"")}/functions/v1/inventory-connectors`;function xm({supabase:e,locations:r}){const{identity:a,session:n}=Hn(),s=["owner","admin"].includes(a.role),[i,c]=y.useState(null),[o,l]=y.useState([]),[d,u]=y.useState(""),[h,f]=y.useState(""),[m,x]=y.useState(!1),[p,g]=y.useState(null),[w,S]=y.useState(null);async function b(P){if(!s)return;const T=e.from("inventory_pos_connections").select("id,status,environment,connected_at,last_sync_at,writeback_enabled").eq("client_id",a.clientId).eq("provider","square").in("status",["active","reauth_required","error"]).order("connected_at",{ascending:!1}).limit(1),L=P?await T.eq("id",P).maybeSingle():await T.maybeSingle();if(L.error)return g("Square connection status is temporarily unavailable.");c(L.data)}y.useEffect(()=>{const P=new URLSearchParams(window.location.search),T=P.get("square"),L=P.get("connection_id");T==="connected"&&S("Square authorization succeeded. Discover and map the seller location to continue."),T==="error"&&g(`Square authorization did not finish (${P.get("error_code")||"unknown_error"}).`),T&&(P.delete("square"),P.delete("connection_id"),P.delete("error_code"),window.history.replaceState({},"",`${window.location.pathname}?${P.toString()}${window.location.hash}`)),b(L)},[s,a.clientId]);async function j(P,T){if(!jl.startsWith("https://"))throw new Error("Portal connector URL is not configured.");const L=await fetch(`${jl}${P}`,{method:"POST",headers:{apikey:"sb_publishable_EuxB7NlknSsbvouGZUP_qA_1H7OTUui",authorization:`Bearer ${n.access_token}`,"content-type":"application/json"},body:JSON.stringify(T)}),M=await L.json().catch(()=>({}));if(!L.ok||M.ok!==!0)throw new Error(String(M.error_code??"connector_request_failed"));return M}async function k(){x(!0),g(null),S(null);try{const P=await j("/oauth/square/start",{client_id:a.clientId}),T=String(P.authorization_url??"");if(!T.startsWith("https://connect.squareup.com/oauth2/authorize"))throw new Error("production_authorization_url_required");window.location.assign(T)}catch(P){g(`Square connection could not start (${P instanceof Error?P.message:"unknown_error"}).`),x(!1)}}async function N(){if(i){x(!0),g(null),S(null);try{const P=await j("/square/sync",{client_id:a.clientId,connection_id:i.id}),T=Array.isArray(P.locations)?P.locations:[];l(T);const L=T.find(M=>M.active&&!M.enabled);L&&u(L.externalLocationId),S(P.sync==="mapping_required"?"Square is connected. Choose the exact SmartBizHelper location for each seller location.":"Square catalog and inventory observations are current."),await b(i.id)}catch(P){g(`Square location discovery failed (${P instanceof Error?P.message:"unknown_error"}).`)}finally{x(!1)}}}async function C(){if(!i||!d||!h)return g("Choose both locations before saving.");x(!0),g(null),S(null);try{await j("/square/mappings",{client_id:a.clientId,connection_id:i.id,mappings:[{external_location_id:d,sbh_location_id:Number(h),enabled:!0}]}),S("Location mapping saved. Running the first read-only catalog and inventory sync."),await N()}catch(P){g(`Square location mapping failed (${P instanceof Error?P.message:"unknown_error"}).`),x(!1)}}return s?t.jsxs("section",{className:"panel square-connection-panel","data-automation-hook":"inventory.square-connection",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Point of sale connection"}),t.jsx("h2",{children:"Square"}),t.jsx("p",{className:"muted",children:"Owner-authorized, read-only catalog and inventory observation. SmartBizHelper quantities remain authoritative."})]}),t.jsx(tt,{size:24})]}),t.jsxs("div",{className:"square-connection-status",children:[t.jsx("span",{className:(i==null?void 0:i.status)==="active"?"badge ok":"badge untracked",children:(i==null?void 0:i.status)==="active"?"Connected":"Not connected"}),t.jsxs("span",{children:["Inventory writeback: ",t.jsx("strong",{children:"Off"})]}),(i==null?void 0:i.last_sync_at)&&t.jsxs("span",{children:["Last read: ",new Date(i.last_sync_at).toLocaleStr
471ing()]})]}),p&&t.jsx("div",{className:"error-box",children:p}),w&&t.jsxs("div",{className:"success-box",children:[t.jsx(Kt,{size:17})," ",w]}),t.jsxs("div",{className:"inline-actions",children:[t.jsxs("button",{type:"button",className:"primary-inline",disabled:m,onClick:()=>void k(),children:[m?t.jsx(gr,{className:"spin",size:17}):t.jsx(Wa,{size:17}),i?"Reconnect Square":"Connect Square"]}),i&&t.jsxs("button",{type:"button",className:"secondary-button",disabled:m,onClick:()=>void N(),children:[t.jsx(St,{size:17})," Discover locations / sync"]})]}),o.some(P=>!P.enabled)&&t.jsxs("div",{className:"square-location-mapping",children:[t.jsxs("label",{children:[t.jsx(Mn,{size:16})," Square seller location",t.jsxs("select",{value:d,onChange:P=>u(P.target.value),children:[t.jsx("option",{value:"",children:"Choose Square location"}),o.filter(P=>P.active&&!P.enabled).map(P=>t.jsx("option",{value:P.externalLocationId,children:P.name},P.externalLocationId))]})]}),t.jsxs("label",{children:["SmartBizHelper location",t.jsxs("select",{value:h,onChange:P=>f(P.target.value),children:[t.jsx("option",{value:"",children:"Choose SBH location"}),r.filter(P=>P.status!=="inactive").map(P=>t.jsx("option",{value:P.id,children:P.location_name},P.id))]})]}),t.jsx("button",{type:"button",className:"primary-inline",disabled:m||!d||!h,onClick:()=>void C(),children:"Save explicit mapping"})]})]}):null}function gm(e){const r=Array.isArray(e)?e[0]:e;if(!r||typeof r!="object")return null;const a=r,n=Number(a.id);return!Number.isFinite(n)||typeof a.include_in_email_reports!="boolean"||typeof a.updated_at!="string"?null:{id:n,include_in_email_reports:a.include_in_email_reports,updated_at:a.updated_at}}function Ua(e){return String(e.status??e.inventory_status??"untracked").toLowerCase()}function Sr(e){return String(e.item_name??e.name??"Inventory item")}function qc(e){const r=String(e.inventory_area??"unassigned");return["bakery","coffee_shop","shared","unassigned"].includes(r)?r:"unassigned"}function gn(e){const r=qc(e);return r==="coffee_shop"?"Coffee Shop":r==="unassigned"?"Unassigned":r.charAt(0).toUpperCase()+r.slice(1)}function Ha(e){return String(e.inventory_source_mode??"manual-only")}function wl(e){const r=new Date(e);return Number.isNaN(r.getTime())?e:r.toLocaleString()}function kl(e){return e.include_in_email_reports!==!1}function vm(e){const r=String(e.inventory_type??"").trim().toUpperCase();return r==="RECIPE_COMPONENT"||r==="OPERATING_SUPPLY"?"not_required":"unavailable"}function Sl(e){const r=new URLSearchParams(window.location.search);return r.set("area",e),`${window.location.pathname}?${r.toString()}`}function Nl({data:e,supabase:r,mode:a="inventory"}){var Xe,et;const n=a==="my_items",[s,i]=y.useState(""),[c,o]=y.useState("all"),[l,d]=y.useState("all"),[u,h]=y.useState("all"),[f,m]=y.useState(new Set),[x,p]=y.useState("unassigned"),[g,w]=y.useState(!1),[S,b]=y.useState(null),[j,k]=y.useState("stock"),[N,C]=y.useState({}),[P,T]=y.useState(""),[L,M]=y.useState("Stock count"),[E,W]=y.useState(""),[ee,ce]=y.useState(""),[ue,te]=y.useState(""),[fe,q]=y.useState([]),[J,le]=y.useState(!1),[A,V]=y.useState(!1),[I,D]=y.useState(null),[K,z]=y.useState(null),[Y,re]=y.useState(null),[oe,Ce]=y.useState(null),[F,se]=y.useState("idle"),[he,je]=y.useState(null),[ve,ne]=y.useState(!1),Z=y.useMemo(()=>e.inventoryRows.map(ie=>({...ie,...N[String(ie.id)]??{}})),[e.inventoryRows,N]),xe=y.useMemo(()=>l==="all"?Z:Z.filter(ie=>String(ie.location_id??"")===l),[Z,l]),be=y.useMemo(()=>xe.filter(ie=>(u==="all"||qc(ie)===u)&&(c==="all"||Ua(ie).includes(c))&&`${Sr(ie)} ${gn(ie)} ${Ha(ie)} ${String(ie.sku??"")} ${String(ie.category??"")} ${String(ie.location_name??"")}`.toLowerCase().includes(s.toLowerCase())),[xe,s,c,u]),De=y.useMemo(()=>be.map(ie=>Number(ie.id)).filter(Number.isFinite),[be]),Te=De.length>0&&De.every(ie=>f.has(ie)),ze=S?vm(S):"blocked",We=(Xe=fe.find(ie=>ie.last_verified_at))==null?void 0:Xe.last_verified_quantity,ot=(et=fe.find(ie=>ie.last_verified_at))==null?void 0:et.last_verified_at,it=y.useMemo(()=>xe.reduce((ie,Ae)=>{const Pe=Ua(Ae);return ie[Pe]=(ie[Pe]??0)+1,ie},{}),[xe]),Zt=y.useMemo(()=>xe.filter(ie=>["out","low","untracked"].includes(Ua(ie))).slice(0,5),[xe]);y.useEffect(()=>{m(new Set)},[l]);async function Le(ie){if(!r)return;le(!0);const{data:Ae,error:Pe}=await r.rpc("portal_get_inventory_history",{p_item_id:ie});if(le(!1),Pe)return z(Pe.message);q(Ae??[])}
471function vt(ie){const Ae={...ie,...N[String(ie.id)]??{}};b(Ae),k("stock"),T(String(Ae.qty_on_hand??Ae.current_quantity??0)),M("Stock count"),W(""),ce(String(Ae.par_level??Ae.max_par??0)),te(String(Ae.preferred_vendor??Ae.vendor_name??"")),q([]),z(null),re(null),Ce(null),Ae.id&&Le(Number(Ae.id))}function Me(){A||(b(null),z(null),re(null),Ce(null))}function nt(ie){const Ae={status:ie.status,buy_qty:ie.buy_qty,reorder_qty:ie.reorder_qty,updated_at:ie.updated_at};ie.qty_on_hand!==void 0&&(Ae.qty_on_hand=ie.qty_on_hand),ie.par_level!==void 0&&(Ae.par_level=ie.par_level),"preferred_vendor"in ie&&(Ae.preferred_vendor=ie.preferred_vendor),C(Pe=>({...Pe,[String(ie.id)]:{...Pe[String(ie.id)]??{},...Ae}})),b(Pe=>Pe&&{...Pe,...Ae})}function Ge(ie){m(Ae=>{const Pe=new Set(Ae);return Pe.has(ie)?Pe.delete(ie):Pe.add(ie),Pe})}function Ze(){m(ie=>{const Ae=new Set(ie);return Te?De.forEach(Pe=>Ae.delete(Pe)):De.forEach(Pe=>Ae.add(Pe)),Ae})}async function It(){if(!r)return z("Portal connection is not configured.");if(l==="all")return z("Choose one location before assigning an area.");const ie=Z.filter(lt=>f.has(Number(lt.id))),Ae=new Set(ie.map(lt=>lt.location_id==null?"null":String(lt.location_id)));if(Ae.size!==1||Ae.has("null"))return z("Select items from one active location before assigning an area.");const Pe=Number(l);if([...Ae][0]!==l)return z("Select items only from the active location before assigning an area.");const Re=[...f];if(!Re.length)return z("Select at least one item first.");w(!0),z(null),re(null);const{data:ct,error:ft}=await r.rpc("portal_bulk_assign_inventory_area",{p_item_ids:Re,p_location_id:Pe,p_inventory_area:x});if(w(!1),ft)return z(ft.message);const qt=Array.isArray(ct==null?void 0:ct.item_ids)?ct.item_ids.map(lt=>Number(lt)):Re;C(lt=>{const ca={...lt};return qt.forEach(ja=>{ca[String(ja)]={...ca[String(ja)]??{},inventory_area:x,updated_at:new Date().toISOString()}}),ca}),m(new Set),re(`${qt.length} item${qt.length===1?"":"s"} assigned to ${gn({inventory_area:x})}.`)}async function de(ie){if(!r||!ie.id)return z("This inventory item is missing its database ID.");const Ae=String(ie.id),Pe=!kl({...ie,...N[Ae]??{}});D(Ae),z(null),re(null);const{data:Re,error:ct}=await r.rpc("portal_set_inventory_email_visibility",{p_item_id:Number(ie.id),p_include_in_email_reports:Pe});if(D(null),ct)return z(ct.message);const ft=gm(Re);if(!ft)return z("Visibility update returned an invalid response.");const qt={include_in_email_reports:ft.include_in_email_reports,updated_at:ft.updated_at};C(lt=>({...lt,[Ae]:{...lt[Ae]??{},...qt}})),b(lt=>lt&&String(lt.id)===Ae?{...lt,...qt}:lt),re(`${Sr(ie)} will ${ft.include_in_email_reports?"show in":"stay hidden from"} the daily inventory email.`)}async function Ee(ie){if(ie.preventDefault(),z(null),re(null),!r)return z("Portal connection is not configured.");if(!(S!=null&&S.id))return z("This inventory item is missing its database ID.");const Ae=Number(P);if(!Number.isFinite(Ae)||Ae<0)return z("Enter a quantity of zero or greater.");if(!L.trim())return z("Select an adjustment reason.");if(V(!0),Ha(S)==="pos-connected"){const{error:ft}=await r.rpc("portal_record_physical_count",{p_item_id:Number(S.id),p_observed_quantity:Ae,p_reason:L,p_apply_to_stock:!1,p_evidence:{note:E.trim()||null,capture:"portal"}});if(V(!1),ft)return z(ft.message);re(`${Sr(S)} physical count was recorded for reconciliation. POS quantity remains authoritative.`),W(""),await Le(Number(S.id));return}const{data:Pe,error:Re}=await r.rpc("portal_adjust_inventory",{p_item_id:Number(S.id),p_new_quantity:Ae,p_reason:L,p_note:E.trim()||null});if(V(!1),Re)return z(Re.message);const ct=Pe;
471nt(ct),T(String(ct.qty_on_hand??Ae)),re(`${Sr(S)} stock was updated in the Workspace.`),W(""),await Le(Number(S.id))}async function we(ie){if(ie.preventDefault(),z(null),re(null),!r)return z("Portal connection is not configured.");if(!(S!=null&&S.id))return z("This inventory item is missing its database ID.");const Ae=Number(ee);if(!Number.isFinite(Ae)||Ae<0)return z("Enter a PAR level of zero or greater.");V(!0);const{data:Pe,error:Re}=await r.rpc("portal_update_inventory_item",{p_item_id:Number(S.id),p_par_level:Ae,p_preferred_vendor:ue.trim()||null});if(V(!1),Re)return z(Re.message);nt(Pe),re(`${Sr(S)} settings were updated.`),await Le(Number(S.id))}async function Oe(){var ct;if(!r){se("failed"),je("Portal connection is not configured.");return}ne(!1),se("sending"),je(null);const{data:ie,error:Ae}=await r.functions.invoke("manual-updated-report",{body:{}});let Pe=ie;const Re=Ae?Number((ct=Ae.context)==null?void 0:ct.status):0;if(!Pe&&Ae){const ft=Ae.context;if(ft)try{Pe=await ft.json()}catch{}}if(Re===429||(Pe==null?void 0:Pe.status)==="cooldown_active"||(Pe==null?void 0:Pe.error_code)==="COOLDOWN_ACTIVE"){se("cooldown_active"),je("Cooldown active. Try again after 60 seconds.");return}if(!Pe){se("failed"),je("Send failed. The updated report was not confirmed.");return}if(Pe.status==="unauthorized"||["UNAUTHORIZED","REPORT_PERMISSION_DENIED","CLIENT_MEMBERSHIP_DENIED","LOCATION_ACCESS_DENIED"].includes(String(Pe.error_code))){se("unauthorized"),je("You are not authorized to send an updated report for this location.");return}if(!Pe.ok||Pe.status!=="sent"){se("failed"),je(Pe.message||"Send failed. The updated report was not confirmed.");return}se("sent"),je("Updated report sent.")}async function Ue(ie){if(!r||!(S!=null&&S.id)||!ie.adjustment_id||!ie.can_undo)return;const Ae=ie.previous_value??"the prior quantity",Pe=ie.new_value??"the current quantity";if(!window.confirm(`Restore ${Sr(S)} from ${Pe} back to ${Ae} in both the Workspace and Clover?`))return;V(!0),z(null),re(null);const{data:Re,error:ct}=await r.functions.invoke("portal-inventory-pos-sync",{body:{action:"undo_inventory_quantity",adjustment_id:ie.adjustment_id,idempotency_key:crypto.randomUUID()}});if(V(!1),ct)return z("The previous quantity could not be restored. Review the item history and try again.");if(!(Re!=null&&Re.ok)||Re.status!=="succeeded")return z((Re==null?void 0:Re.message)||"The previous quantity could not be restored.");const ft=Number(Re.quantity),qt={qty_on_hand:ft,updated_at:new Date().toISOString()};C(lt=>({...lt,[String(S.id)]:{...lt[String(S.id)]??{},...qt}})),b(lt=>lt&&{...lt,...qt}),T(String(ft)),re(Re.message||`${Sr(S)} was restored to ${ft} in the Workspace and Clover.`),await Le(Number(S.id))}return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:n?"Smart Inventory Tracker · Item controls":"Smart Inventory Tracker"}),t.jsx("h1",{children:n?"My Items":"Smart Inventory Tracker"}),t.jsx("p",{className:"muted",children:n?"View and update active Smart Inventory Tracker items.":"Review quantities, PAR levels, vendors, and restock status."})]}),!n&&t.jsxs("div",{className:"heading-actions",children:[t.jsxs("button",{className:"secondary-button",type:"button",onClick:()=>ne(!0),disabled:F==="sending","data-automation-hook":"inventory.send-updated-report",children:[t.jsx(Ri,{size:17})," ",F==="sending"?"Sendingâ¦":"Send Updated Report"]}),t.jsxs("a",{className:"secondary-button",href:Sl("sync"),"data-automation-hook":"inventory.open-sync",children:[t.jsx(St,{size:17})," Sync inventory"]}),t.jsxs("button",{className:"primary-inline","data-automation-hook":"inventory.add-item",onClick:()=>Ce("Add Item is ready to open Smart SKU single-item setup."),children:[t.jsx(qr,{size:18})," Add item"]})]})]}),he&&t.jsx("div",{className:F==="sent"?"success-box":F==="unauthorized"||F==="failed"?"error-box":"success-box",children:he}),oe&&t.jsxs("div",{className:"success-box",children:[t.jsx(Kt,{size:17})," ",oe]}),Y&&!S&&t.jsxs("div",{className:"success-box",children:[t.jsx(Kt,{size:17})," ",Y]}),K&&!S&&t.jsx("div",{className:"error-box",children:K}),!n&&r&&t.jsx(xm,{supabase:r,locations:e.locations}),ve&&t.jsx("div",{className:"adjustment-backdrop",role:"presentation",onMouseDown:ie=>{ie.target===ie.currentTarget&&ne(!1)},children:t.jsxs("section",{className:"adjustment-modal",role:"dialog","aria-modal":"true","aria-labelledby":"manual-report-confirm-title",children:[t.jsxs("div",{className:"adjustment-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Updated
471inventory report"}),t.jsx("h2",{id:"manual-report-confirm-title",children:"Send the latest report?"}),t.jsx("p",{className:"muted",children:"This sends current inventory and sales to the configured authorized recipients."})]}),t.jsx("button",{className:"icon-button",type:"button",onClick:()=>ne(!1),"aria-label":"Close confirmation",children:t.jsx(gt,{size:20})})]}),t.jsx("div",{className:"adjustment-form",children:t.jsxs("div",{className:"adjustment-actions",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:()=>ne(!1),children:"Cancel"}),t.jsx("button",{type:"button",className:"primary-button",onClick:()=>void Oe(),"data-automation-hook":"inventory.confirm-send-updated-report",children:"Send Updated Report"})]})})]})}),n?t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"filter-row",children:t.jsxs("label",{children:["Location",t.jsxs("select",{value:l,onChange:ie=>d(ie.target.value),"aria-label":"Filter inventory by location",children:[t.jsx("option",{value:"all",children:"All Locations"}),e.locations.map(ie=>t.jsx("option",{value:String(ie.id),children:ie.location_name},ie.id))]})]})}),n&&t.jsx("div",{className:"inventory-area-tabs",role:"tablist","aria-label":"Inventory area",children:["all","bakery","coffee_shop","shared","unassigned"].map(ie=>t.jsx("button",{type:"button",className:u===ie?"active":"",onClick:()=>h(ie),children:ie==="all"?"All Items":gn({inventory_area:ie})},ie))}),n&&t.jsxs("div",{className:"bulk-area-toolbar",children:[t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Te,onChange:Ze,disabled:!De.length})," Select visible"]}),t.jsxs("span",{children:[f.size," selected"]}),t.jsxs("select",{value:x,onChange:ie=>p(ie.target.value),"aria-label":"Assign selected items to area",children:[t.jsx("option",{value:"bakery",children:"Bakery"}),t.jsx("option",{value:"coffee_shop",children:"Coffee Shop"}),t.jsx("option",{value:"shared",children:"Shared"}),t.jsx("option",{value:"unassigned",children:"Unassigned"})]}),t.jsx("button",{type:"button",className:"primary-inline",onClick:()=>void It(),disabled:g||!f.size||l==="all",children:g?"Assigningâ¦":"Assign area"})]}),t.jsxs("div",{className:"filter-row",children:[t.jsxs("label",{className:"search-box",children:[t.jsx(Yr,{size:18}),t.jsx("input",{value:s,onChange:ie=>i(ie.target.value),placeholder:"Search items, SKU, or category"})]}),t.jsxs("select",{value:c,onChange:ie=>o(ie.target.value),children:[t.jsx("option",{value:"all",children:"All statuses"}),t.jsx("option",{value:"out",children:"Out"}),t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"ok",children:"OK"}),t.jsx("option",{value:"untracked",children:"Untracked"})]})]}),e.loading?t.jsx("p",{children:"Loading inventoryâ¦"}):be.length===0?t.jsxs("div",{className:"empty-state",children:[t.jsx(Xr,{size:30}),t.jsx("h3",{children:"No matching items"}),t.jsx("p",{children:"Try a different search or filter."})]}):t.jsx("div",{className:"table-wrap",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[n&&t.jsx("th",{"aria-label":"Select"}),t.jsx("th",{children:"Item"}),n&&t.jsx("th",{children:"Location"}),t.jsx("th",{children:"Area"}),t.jsx("th",{children:"Authority"}),t.jsx("th",{children:"SKU"}),t.jsx("th",{children:"Category"}),t.jsx("th",{children:"On hand"}),t.jsx("th",{children:"PAR"}),t.jsx("th",{children:"Vendor"}),t.jsx("th",{children:"Status"}),t.jsx("th",{children:"Email"}),t.jsx("th",{children:"Action"})]})}),t.jsx("tbody",{children:be.map((ie,Ae)=>{const Pe=kl(ie),Re=String(ie.id??Ae);return t.jsxs("tr",{children:[n&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:f.has(Number(ie.id)),onChange:()=>Ge(Number(ie.id)),"aria-label":`Select ${Sr(ie)}`})}),t.jsx("td",{children:t.jsx("strong",{children:Sr(ie)})}),n&&t.jsx("td",{children:String(ie.location_name??"Unassigned location")}),t.jsx("td",{children:gn(ie)}),t.jsx("td",{children:Ha(ie)}),t.jsx("td",{children:String(ie.sku??"â")}),t.jsx("td",{children:String(ie.category??"â")}),t.jsx("td",{children:String(ie.qty_on_hand??ie.current_quantity??"â")}),t.jsx("td",{children:String(ie.par_level??ie.max_par??"â")}
471),t.jsx("td",{children:String(ie.preferred_vendor??ie.vendor_name??"â")}),t.jsx("td",{children:t.jsx("span",{className:`badge ${Ua(ie)}`,children:Ua(ie)})}),t.jsx("td",{children:t.jsxs("button",{type:"button",className:`email-toggle ${Pe?"on":"off"}`,role:"switch","aria-checked":Pe,"aria-label":`${Pe?"Hide":"Show"} ${Sr(ie)} in daily inventory email`,disabled:I===Re,onClick:()=>void de(ie),children:[t.jsx("span",{className:"email-toggle-track",children:t.jsx("span",{className:"email-toggle-thumb"})}),t.jsx("span",{children:I===Re?"Savingâ¦":Pe?"Shown":"Hidden"})]})}),t.jsx("td",{children:t.jsxs("button",{className:"row-action",onClick:()=>vt(ie),children:[t.jsx(Xa,{size:15})," ",n?"View / Edit Item":"Manage"]})})]},Re)})})]})})]}):t.jsxs("section",{className:"inventory-command-center",children:[t.jsx("div",{className:"inventory-summary-grid","aria-label":"Inventory status totals",children:[{key:"all",label:"All items",value:Z.length},{key:"out",label:"Out of stock",value:it.out??0},{key:"low",label:"Low stock",value:it.low??0},{key:"ok",label:"Healthy",value:it.ok??0},{key:"untracked",label:"Untracked",value:it.untracked??0}].map(ie=>t.jsxs("article",{className:`inventory-summary-card ${ie.key}`,children:[t.jsx("span",{children:ie.label}),t.jsx("strong",{children:ie.value})]},ie.key))}),t.jsxs("div",{className:"inventory-command-grid",children:[t.jsxs("section",{className:"panel inventory-alerts",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Needs attention"}),t.jsx("h2",{children:"Inventory alerts"})]}),t.jsx(gs,{size:22})]}),e.loading?t.jsx("p",{children:"Loading alerts..."}):Zt.length===0?t.jsx("p",{className:"muted",children:"No stock alerts in the current authorized location."}):t.jsx("div",{className:"inventory-alert-list",children:Zt.map(ie=>t.jsxs("div",{className:"inventory-alert",children:[t.jsx("span",{className:`badge ${Ua(ie)}`,children:Ua(ie)}),t.jsx("strong",{children:Sr(ie)}),t.jsxs("span",{className:"muted",children:["On hand ",String(ie.qty_on_hand??ie.current_quantity??"-")]})]},String(ie.id)))})]}),t.jsxs("section",{className:"panel inventory-overview",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Authorized scope"}),t.jsx("h2",{children:"Area overview"})]}),t.jsx(Xr,{size:22})]}),t.jsx("div",{className:"inventory-area-overview",children:["bakery","coffee_shop","shared","unassigned"].map(ie=>t.jsxs("div",{children:[t.jsx("span",{children:gn({inventory_area:ie})}),t.jsx("strong",{children:xe.filter(Ae=>qc(Ae)===ie).length})]},ie))}),t.jsxs("a",{className:"command-link",href:Sl("items"),children:["Open My Items for detailed controls ",t.jsx(Mt,{size:16})]})]})]}),t.jsx("p",{className:"muted command-center-note",children:"Use My Items for quantities, area filters, Show/Hide, bulk assignment, and item editing. Sync actions remain on the dedicated Sync Inventory route."})]}),S&&t.jsx("div",{className:"adjustment-backdrop",role:"presentation",onMouseDown:ie=>{ie.target===ie.currentTarget&&Me()},children:t.jsxs("section",{className:"adjustment-modal item-manager-modal",role:"dialog","aria-modal":"true","aria-labelledby":"adjustment-title",children:[t.jsxs("div",{className:"adjustment-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Item controls"}),t.jsx("h2",{id:"adjustment-title",children:Sr(S)}),t.jsxs("p",{className:"muted",children:[gn(S)," · ",Ha(S)," · ",String(S.sku??"No SKU")," · On hand: ",String(S.qty_on_hand??0)," · PAR: ",String(S.par_level??0)]})]}),t.jsx("button",{className:"icon-button",type:"button",onClick:Me,"aria-label":"Close item controls",children:t.jsx(gt,{size:20})})]}),t.jsxs("div",{className:"manager-tabs",role:"tablist",children:[t.jsxs("button",{type:"button",className:j==="stock"?"active":"",onClick:()=>{k("stock"),z(null),re(null),Ce(null)},children:[t.jsx(ta,{size:17})," Stock"]}),t.jsxs("button",{type:"button",className:j==="settings"?"active":"",onClick:()=>{k("settings"),z(null),re(null),Ce(null)},children:[t.jsx(jp,{size:17})," PAR & Vendor"]}),t.jsxs("button",{type:"button",className:j==="history"?"active":"",onClick:()=>{k("history"),z(null),re(null),Ce(null)},children:[t.jsx(Ta,{size:17})," History"]})]}),j==="stock"&&t.jsxs("form",{onSubmit:Ee,className:"adjustment-form",children:[t.jsxs("label",{children:[Ha(S)==="pos-connected"?"Verified physical count":"New on-hand quantity",t.jsx("input",{type:"number",min:"0",step:"0.01",value:P,onChange:ie=>T(ie.target.value),autoFocus:!0,required:!0})]}),t.jsxs("label",{children:["Reason",t.jsxs("select",{value:L,onChange:ie=>M(ie.target.value),required:!0,children:[t.jsx("option",{children:"Stock count"}),t.jsx("option",{children:"Inventory received"}),t.jsx("option",{children:"Used or sold"}),t.jsx("option",{children:"Waste or damage"}),t.jsx("option",{children:"Correction"})]})]}),t.jsxs("label",{children:["Note ",t.jsx("span",{className:"optional",children:"Optional"}),t.jsx("textarea",{value:E,onChange:ie=>W(ie.target.value),rows:3,placeholder:"Add useful context for the audit trail"})]}),K&&t.jsx("div",{className:"error-box",children:K}),Y&&t.jsx("div",{className:"success-box",children:Y}),oe&&t.jsx("div",{className:"success-box",children:oe}),t.jsxs("p",{className:"manager-help",children:[t.jsx("strong",{children:Ha(S)==="pos-connected"?"Save records a physical count for POS reconciliation.":"Save applies only to this physical stock row."})," ",Ha(S)==="pos-connected"?"Clover/Nate remains quantity-authoritative; the verified count is audited separately.":"Shared stock remains one common pool, while Bakery and Coffee Shop rows stay independent."]}),t.jsx("p",{className:"manager-help",children:"Updates coming from Clover may take a few minutes to appear while the inventory workflow finishes processing."}),ze==="not_required"&&t.jsx("p",{className:"manager-help",children:"Internal inventory item â no POS sync required."}),ze==="unavailable"&&t.jsx("p",{className:"manager-help",children:"Clover sync is temporarily unavailable until the certified portal-inventory-pos-sync backend is deployed. Worksp
471ace-only inventory updates remain available."}),t.jsxs("div",{className:"adjustment-actions",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:Me,disabled:A,children:"Close"}),t.jsx("button",{type:"submit",className:"secondary-button",disabled:A,"data-automation-hook":"inventory.save-workspace",children:A?"Savingâ¦":"Save Stock"})]})]}),j==="settings"&&t.jsxs("form",{onSubmit:we,className:"adjustment-form",children:[t.jsxs("label",{children:["PAR level",t.jsx("input",{type:"number",min:"0",step:"0.01",value:ee,onChange:ie=>ce(ie.target.value),autoFocus:!0,required:!0})]}),t.jsxs("label",{children:["Preferred vendor ",t.jsx("span",{className:"optional",children:"Optional"}),t.jsx("input",{type:"text",value:ue,onChange:ie=>te(ie.target.value),placeholder:"Example: Sam's Club"})]}),t.jsx("p",{className:"manager-help",children:"Changing PAR immediately recalculates status and suggested purchase quantity."}),K&&t.jsx("div",{className:"error-box",children:K}),Y&&t.jsx("div",{className:"success-box",children:Y}),t.jsxs("div",{className:"adjustment-actions",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:Me,disabled:A,children:"Close"}),t.jsx("button",{type:"submit",className:"primary-button",disabled:A,"data-automation-hook":"inventory.save-settings",children:A?"Savingâ¦":"Save settings"})]})]}),j==="history"&&t.jsxs("div",{className:"history-panel",children:[ot&&t.jsxs("div",{className:"success-box",children:[t.jsx(tt,{size:17}),t.jsxs("span",{children:["Last physically verified count: ",t.jsx("strong",{children:String(We??"â")})," · ",wl(ot)]})]}),K&&t.jsx("div",{className:"error-box",children:K}),Y&&t.jsx("div",{className:"success-box",children:Y}),J?t.jsx("p",{className:"muted",children:"Loading historyâ¦"}):fe.length===0?t.jsxs("div",{className:"history-empty",children:[t.jsx(Ta,{size:28}),t.jsx("strong",{children:"No changes recorded yet"}),t.jsx("span",{children:"Stock adjustments and item setting changes will appear here."})]}):t.jsx("div",{className:"history-list",children:fe.map((ie,Ae)=>t.jsxs("article",{className:`history-entry ${ie.is_reverted?"reverted":""}`,children:[t.jsx("div",{className:"history-dot"}),t.jsxs("div",{children:[t.jsxs("div",{className:"history-heading",children:[t.jsxs("strong",{children:[ie.event_label,ie.is_reverted?" · Undone":""]}),t.jsx("time",{children:wl(ie.event_at)})]}),t.jsxs("p",{children:[t.jsx("span",{children:ie.previous_value??"â"}),t.jsx("b",{children:"â"}),t.jsx("span",{children:ie.new_value??"â"})]}),ie.detail&&t.jsx("small",{children:ie.detail}),ie.can_undo&&t.jsxs("button",{type:"button",className:"row-action",disabled:A,onClick:()=>void Ue(ie),children:[t.jsx(xo,{size:15})," ",A?"Restoringâ¦":"Undo this change"]})]})]},`${ie.event_at}-${Ae}`))}),t.jsx("p",{className:"manager-help",children:"Undo is available only for the latest unchanged quantity update. If either side has changed since then, Smart Inventory stops the restore and asks you to review the history or verify the physical count."}),t.jsx("div",{className:"adjustment-actions",children:t.jsx("button",{type:"button",className:"secondary-button",onClick:Me,disabled:A,children:"Close"})})]})]})})]})}function th(e){const[r,a]=y.useState([]),[n,s]=y.useState([]),[i,c]=y.useState([]),[o,l]=y.useState([]),[d,u]=y.useState([]),[h,f]=y.useState([]),[m,x]=y.useState(!0),[p,g]=y.useState(null),[w,S]=y.useState(0),b=y.useCallback(()=>S(j=>j+1),[]);return y.useEffect(()=>{let j=!0;return x(!0),g(null),Promise.all([e.rpc("sbh_get_content_placements",{p_surface:"lobby_spotlight",p_limit:8,p_cycle_bucket:null}),e.rpc("sbh_get_content_placements",{p_surface:"right_rail",p_limit:3,p_cycle_bucket:null}),e.from("portal_community_events").select("id,title,starts_at,location_text,host_business_name").eq("status","published").order("starts_at",{ascending:!0}).limit(5),e.from("discovery_items").select("id,title,summary,publisher,deadline_at,region,review_status,last_verified_at,canonical_url,source_url,source:discovery_sources(name)").eq("kind","opportunity").eq("category","grant").eq("approved_public",!0).in("status",["open","forecasted","unknown"]).order("deadline_at",{ascending:!0,nullsFirst:!1}).limit(5),e.rpc("portal_search_business_directory",{p_filters:{search:"",include_remote:!0,radius_km:2e4}}),e.from("portal_marketplace_listings").select("listing_id,title,business_name,price_display,price_amount,published_at").order("published_at",{ascending:!1}).limit(5)]).then(([k,N,C,P,T,L])=>{if(!j)return;a(k.data??[]),s(N.data??[]),c(C.data??[]),l(P.data??[]),u((Array.isArray(T.data)?T.data:[]).slice(0,5)),f(L.data??[]);const M=[k.error&&"Community Spotlight",N.error&&"featured placement",C.error&&"events",P.error&&"opportunities",T.error&&"directory",L.error&&"marketplace"].filter(
471Boolean);g(M.length?`Some Lobby sections could not be loaded: ${M.join(", ")}.`:null),x(!1)}),()=>{j=!1}},[w,e]),{items:r,featuredItems:n,events:i,opportunities:o,businesses:d,listings:h,loading:m,error:p,reload:b}}function ym(e){if(!e)return null;try{const r=new URL(e);return r.protocol==="https:"||r.protocol==="http:"?r.href:null}catch{return null}}function _m({tone:e}){return e==="event"?t.jsx(mt,{size:30}):e==="marketplace"?t.jsx(Ps,{size:30}):e==="grant"?t.jsx(fr,{size:30}):e==="business"?t.jsx(ha,{size:30}):t.jsx(Or,{size:30})}function bm({supabase:e,onNavigate:r}){const a=th(e),n=y.useRef(null),s=i=>{var c;return(c=n.current)==null?void 0:c.scrollBy({left:i*Math.max(260,n.current.clientWidth*.82),behavior:"smooth"})};return t.jsxs("section",{className:"lobby-spotlight","aria-labelledby":"lobby-spotlight-title",children:[t.jsxs("header",{className:"lobby-section-heading",children:[t.jsxs("div",{children:[t.jsx("span",{className:"lobby-heading-icon",children:t.jsx(na,{size:17})}),t.jsx("h1",{id:"lobby-spotlight-title",children:"Community Spotlight"})]}),t.jsxs("div",{className:"lobby-spotlight-actions",children:[t.jsx("button",{type:"button",className:"lobby-spotlight-scroll",onClick:()=>s(-1),"aria-label":"Scroll Community Spotlight left",children:t.jsx(po,{size:17})}),t.jsx("button",{type:"button",className:"lobby-spotlight-scroll",onClick:()=>s(1),"aria-label":"Scroll Community Spotlight right",children:t.jsx(zt,{size:17})}),t.jsxs("button",{type:"button",onClick:()=>r("directory"),children:["View community ",t.jsx("span",{"aria-hidden":"true",children:"â"})]})]})]}),a.error&&t.jsxs("div",{className:"lobby-inline-status",role:"status",children:[t.jsx("span",{children:a.error}),t.jsx("button",{type:"button",onClick:a.reload,children:"Try again"})]}),a.loading?t.jsxs("div",{className:"lobby-spotlight-loading","aria-label":"Loading Community Spotlight",children:[t.jsx(gr,{className:"spin",size:24}),t.jsx("span",{children:"Loading Community Spotlightâ¦"})]}):a.items.length?t.jsx("div",{ref:n,className:"lobby-spotlight-grid","aria-label":"Community Spotlight carousel",children:a.items.map(i=>{const c=ym(i.image_url);return t.jsxs("button",{className:`lobby-spotlight-card ${i.tone}`,type:"button",onClick:()=>r(i.destination),"aria-label":`${i.kind}: ${i.title}`,children:[t.jsxs("span",{className:"lobby-spotlight-visual",children:[c?t.jsx("img",{src:c,alt:""}):t.jsx(_m,{tone:i.tone}),t.jsx("small",{children:i.kind})]}),t.jsxs("span",{className:"lobby-spotlight-copy",children:[t.jsx("strong",{children:i.title}),t.jsx("span",{children:i.detail}),t.jsx("b",{children:i.meta})]})]},i.id)})}):t.jsxs("div",{className:"lobby-spotlight-empty",children:[t.jsx(na,{size:24}),t.jsxs("div",{children:[t.jsx("strong",{children:"Community highlights will appear here."}),t.jsx("span",{children:"Featured events, businesses, opportunities, and Bizz2Bizz trade listings appear when available."})]}),t.jsx("button",{type:"button",onClick:()=>r("directory"),children:"Explore the directory"})]})]})}const jm=new Set(["image/jpeg","image/png","image/webp"]);function wm(e){return e instanceof Error?e.message:String(e??"The Lobby action could not be completed.")}function km({supabase:e,session:r,onNavigate:a=n=>window.location.assign("/?area="+n)}){const{identity:n}=Hn(),[s,i]=y.useState([]),[c,o]=y.useState({}),[l,d]=y.useState(""),[u,h]=y.useState("members"),[f,m]=y.useState([]),[x,p]=y.useState(""),[g,w]=y.useState(!0),[S,b]=y.useState(!1),[j,k]=y.useState(!1),[N,C]=y.useState(null),[P,T]=y.useState(null),[L,M]=y.useState(!0),[E,W]=y.useState(0),[ee,ce]=y.useState(null),[ue,te]=y.useState(""),[fe,q]=y.useState("all"),[J,le]=y.useState(!1),A=y.useRef(null),V=!!e,I=r.user.email??"Signed-in member",D=((n==null?void 0:n.fullName)||I).charAt(0).toUpperCase(),K=y.useMemo(()=>f.length?String(f.length)+" image"+(f.length===1?"":"s")+" ready":"Add photos or external link",[f.length]),z=y.useMemo(()=>f.map(ne=>({name:ne.name,url:URL.createObjectURL(ne)})),[f]);y.useEffect(()=>()=>z.forEach(ne=>URL.revokeObjectURL(ne.url)),[z]);const Y=y.useMemo(()=>fe==="all"?s:s.filter(ne=>ne.visibility===fe),[fe,s]);async function re(ne=0){var De;if(!e){w(!1),C("The Lobby data connection is not configured.");return}const Z=await e.rpc("portal_get_lobby_content_feed",{p_limit:20});if(Z.error){C(Z.error.message),M(!1),w(!1);return}const xe=Z.data??[];i(Te=>ne===0?xe:[...Te,...xe]),W(ne+xe.length),M(!1),w(!1);const be=xe.filter(Te=>!Te.is_auto_surface).map(Te=>Te.id);if(be.length){const Te=await e.from("community_post_media").select("post_id,storage_path,media_type,original_name,alt_text").in("post_id",be).order("sort_order");if(!Te.error){const ze={};for(const We of Te.data??[])(ze[De=We.post_id]??(ze[De]=[])).push(We);o(We=>({...We,...ze}))}}}y.useEffect(()=>{let ne=!0;return(async()=>!e||!ne||await re(0))(),()=>{ne=!1}},[e]);async function oe(ne){const Z=Array.from(ne.target.files??[]),xe=Z.find(De=>!jm.has(De.type)||De.size>8388608),be=Z.filter(De=>De.type.startsWith("image/"));if(xe){C(xe.name+" is not an approved file or exceeds the media limit.");return}if(be.length>6){C("A post may contain at most 6 images.");return}C(null),m(Z)}function Ce(ne){m(Z=>Z.filter(xe=>xe.name!==ne))}async function F(ne){if(ne.preventDefault(),!e||!l.trim()&&!f.length&&!x.trim())return C("Write something, add an image, or attach a link before publishing.");k(!0),C(null),T(null);try{const Z=crypto.randomUUID(),xe=await e.rpc("portal_create_lobby_post_mvp",{p_payload:{body:l.trim(),external_url:x.trim(),visibility:u,publish_mode:"now",client_request_id:Z,media:f.map(Te=>({name:Te.name,media_type:"image"}))}});if(xe.error)throw xe.error;const be=String(xe.data.post_id??"");if(!be)throw new Error("The Lobby did not return a post id.");if(!n)throw new Error("The active business could not be confirmed.");const De=[];for(const Te of f){const ze=new FormData;ze.append("post_id",be),ze.append("file",Te,Te.name);const We=await e.functions.invoke("community-media-upload",{body:ze});if(We.error)throw We.error;const ot=We.data;if(!ot.storage_path)throw new Error("The image upload was not confirmed.");De.push({storage_path:ot.storage_path,media_type:"image",name:Te.name,alt_text:"",size_bytes:Number(ot.size_bytes??Te.size),mime_type:ot.mime_type??Te.type,file_extension:ot.file_extension??"bin",duration_seconds:null})}if(De.length){const Te=await e.rpc("portal_attach_lobby_post_media_mvp",{p_post_id:be,p_media:De});if(Te.error)throw Te.error}if(x.trim()){const Te=await e.rpc("portal_attach_lobby_external_mvp",{p_post_id:be,p_url:x.trim(),p_attachment_type:"external_link"});if(Te.error)throw Te.error}d(""),m([]),p(""),T("Posted to The Lobby."),await re(0)}catch(Z){C(wm(Z))}finally{k(!1)}}async function se(ne,Z){if(!e)return;const xe=Z==="reaction"?await e.rpc("portal_toggle_lobby_reaction_mvp",{p_post_id:ne,p_reaction:"like"}):await e.rpc("portal_toggle_lobby_save_mvp",{p_post_id:ne});xe.error?C(xe.error.message):await re(0)}async function he(ne,Z){if(ne.preventDefault(),!e||!ue.trim())return;k(!0);const xe=await e.rpc("portal_comment_lobby_post_mvp",{p_post_id:Z,p_body:ue.trim()});xe.error?C(xe.error.message):(te(""),ce(null),await re(0)),k(!1)}async function je(ne){if(!e||!window.confirm("Remove this post from The Lobby?"))return;const Z=await e.rpc("portal_delete_lobby_post_mvp",{p_post_id:ne});Z.error?C(Z.error.message):await re(0)}async function ve(ne){var be;if(!e)return;const Z=window.prompt("Edit post text",((be=s.find(De=>De.id===ne))==null?void 0:be.body)??"");if(Z===null)return;const xe=await e.rpc("portal_update_lobby_post_mvp",{p_post_id:ne,p_body:Z});xe.error?C(xe.error.message):await re(0)}return t.jsxs("div",{className:"lobby-app-view",children:[e&&t.jsx(bm,{supabase:e,onNavigate:a}),t.jsxs("section",{className:"panel lobby-composer-panel","aria-labelledby":"lobby-composer-title",children:[t.jsxs("div",{className:"lobby-composer-row",children:[t.jsx("div",{className:"avatar lobby-viewer-avatar","aria-hidden":"true",children:D}),t.jsxs("div",{className:"lobby-composer-prompt",children:[t.jsx("h2",{id:"lobby-composer-title",children:"Share with your business community"}
471),t.jsx("textarea",{ref:A,value:l,onChange:ne=>d(ne.target.value),maxLength:5e3,placeholder:"Whatâs happening with your business today?","aria-label":"Post text"})]})]}),t.jsxs("form",{onSubmit:F,children:[t.jsx("input",{className:"lobby-link-input",value:x,onChange:ne=>p(ne.target.value),type:"url",inputMode:"url",placeholder:"Optional YouTube, TikTok, or website link","aria-label":"External link"}),t.jsxs("div",{className:"lobby-composer-tools","aria-label":"Post content options",children:[t.jsxs("label",{className:"lobby-composer-tool photo",children:[t.jsx(Cn,{size:19}),t.jsx("span",{children:"Photo / Video"}),t.jsx("input",{hidden:!0,type:"file",multiple:!0,accept:"image/jpeg,image/png,image/webp",onChange:ne=>void oe(ne)})]}),t.jsxs("span",{className:"lobby-composer-tool event",children:[t.jsx(mt,{size:19}),t.jsx("span",{children:"Event"})]}),t.jsxs("span",{className:"lobby-composer-tool product",children:[t.jsx(Ps,{size:19}),t.jsx("span",{children:"Product"})]}),t.jsxs("span",{className:"lobby-composer-tool service",children:[t.jsx(zu,{size:19}),t.jsx("span",{children:"Service"})]}),t.jsxs("span",{className:"lobby-composer-tool promotion",children:[t.jsx(Ls,{size:19}),t.jsx("span",{children:"Promotion"})]}),t.jsxs("span",{className:"lobby-composer-tool poll",children:[t.jsx(Rr,{size:19}),t.jsx("span",{children:"Poll"})]})]}),t.jsxs("div",{className:"lobby-composer-actions",children:[t.jsxs("select",{value:u,onChange:ne=>h(ne.target.value),"aria-label":"Post visibility",children:[t.jsx("option",{value:"members",children:"Members"}),t.jsx("option",{value:"public",children:"Public"}),t.jsx("option",{value:"connections",children:"Connections"}),t.jsx("option",{value:"team",children:"My team"})]}),t.jsxs("button",{className:"lobby-filter-toggle",type:"button","aria-expanded":J,onClick:()=>le(ne=>!ne),children:[t.jsx(ta,{size:16})," Feed"]}),t.jsx("span",{className:"muted",children:K}),t.jsxs("button",{className:"primary-inline",disabled:j||!V,children:[j?t.jsx(gr,{className:"spin",size:16}):t.jsx(Un,{size:16})," Publish"]})]}),J&&t.jsxs("div",{className:"lobby-customize-panel",children:[t.jsx("label",{htmlFor:"feed-filter",children:"Show posts"}),t.jsxs("select",{id:"feed-filter",value:fe,onChange:ne=>q(ne.target.value),children:[t.jsx("option",{value:"all",children:"All available posts"}),t.jsx("option",{value:"public",children:"Public posts"}),t.jsx("option",{value:"members",children:"Member posts"}),t.jsx("option",{value:"connections",children:"Connections"}),t.jsx("option",{value:"team",children:"My team"})]}),t.jsx("span",{children:"Filters this authenticated feed on this device."})]}),f.length>0&&t.jsx("div",{className:"lobby-file-previews","aria-label":"Selected media",children:f.map(ne=>{var Z;return t.jsxs("div",{children:[t.jsx("img",{src:(Z=z.find(xe=>xe.name===ne.name))==null?void 0:Z.url,alt:""}),t.jsxs("span",{children:[t.jsx(Cn,{size:15})," ",ne.name," · ",(ne.size/1048576).toFixed(1)," MB"]}),t.jsx("button",{type:"button",onClick:()=>Ce(ne.name),"aria-label":"Remove "+ne.name,children:"Remove"})]},ne.name)})})]})]}),N&&t.jsxs("div",{className:"error-box lobby-recoverable-error",role:"alert",children:[t.jsx("span",{children:N}),t.jsx("button",{type:"button",onClick:()=>{C(null),w(!0),re(0)},children:"Try again"})]}),P&&t.jsxs("div",{className:"success-box",role:"status",children:[t.jsx(Kt,{size:16})," ",P]}),g?t.jsxs("section",{className:"panel lobby-empty-state",children:[t.jsx(gr,{className:"spin"}),t.jsx("p",{children:"Loading the protected feedâ¦"})]}):Y.length?t.jsx("section",{className:"lobby-feed","aria-label":"The Lobby feed",children:Y.map(ne=>t.jsxs("article",{className:"panel lobby-post",children:[t.jsxs("header",{className:"lobby-post-header",children:[t.jsx("div",{className:"avatar",children:(ne.business_name||"B").charAt(0)}),t.jsxs("div",{children:[t.jsx("strong",{children:ne.business_name}),t.jsxs("span",{children:[ne.is_auto_surface?"Community spotlight":ne.author_preferred_name||ne.author_name||"Business member"," · ",new Date(ne.created_at).toLocaleString()]})]}),!ne.is_auto_surface&&t.jsx("button",{className:"icon-button",type:"button","aria-label":"Post options",children:t.jsx(Wu,{size:18})})]}),t.jsx("p",{className:"lobby-post-body",children:ne.body}),(c[ne.id]??[]).map(Z=>t.jsx("div",{className:"lobby-media",children:t.jsxs("span",{children:[t.jsx(Cn,{size:18})," ",Z.original_name||"Image attached"]})},Z.storage_path)),(ne.attachments??[]).map(Z=>t.jsxs("a",{className:"lobby-external-card",href:Z.canonical_url||Z.original_url||"#",target:"_blank",rel:"noreferrer","aria-label":"Open "+(Z.provider||"external")+" link",children:[t.jsx("strong",{children:Z.provider==="youtube"?"YouTube video":Z.provider==="tiktok"?"TikTok video":"External link"}),t.jsx("span",{children:Z.title||Z.canonical_url||Z.original_url})]}
471,Z.id)),ne.is_auto_surface?t.jsx("footer",{className:"lobby-post-actions",children:t.jsxs("button",{type:"button",onClick:()=>ne.source_destination&&a(ne.source_destination),children:[t.jsx(Bu,{size:16})," Open ",ne.source_type==="bizz2bizz"?"Bizz2Bizz listing":ne.source_type==="event"?"event":"opportunity"]})}):t.jsxs(t.Fragment,{children:[t.jsxs("footer",{className:"lobby-post-actions",children:[t.jsxs("button",{type:"button",onClick:()=>void se(ne.id,"reaction"),children:[t.jsx($u,{size:16,fill:ne.viewer_reacted?"currentColor":"none"})," ",ne.reaction_count||"Like"]}),t.jsxs("button",{type:"button",onClick:()=>ce(ee===ne.id?null:ne.id),children:[t.jsx(Dn,{size:16})," ",ne.comment_count||"Comment"]}),t.jsxs("button",{type:"button",onClick:()=>void se(ne.id,"save"),children:[t.jsx(Xf,{size:16,fill:ne.viewer_saved?"currentColor":"none"})," ",ne.viewer_saved?"Saved":"Save"]}),t.jsxs("button",{type:"button",onClick:()=>void ve(ne.id),children:[t.jsx(Wc,{size:16})," Edit"]}),t.jsxs("button",{type:"button",onClick:()=>void je(ne.id),children:[t.jsx(Np,{size:16})," Remove"]})]}),ee===ne.id&&t.jsxs("form",{className:"lobby-comment-form",onSubmit:Z=>void he(Z,ne.id),children:[t.jsx("input",{value:ue,onChange:Z=>te(Z.target.value),placeholder:"Add a comment","aria-label":"Add a comment",maxLength:2e3}),t.jsx("button",{className:"primary-inline",disabled:j,children:"Post"})]})]})]},ne.id))}):t.jsxs("section",{className:"panel lobby-empty-state",children:[t.jsx(Dn,{size:30}),t.jsx("h2",{children:s.length?"No posts match this feed filter.":"The Lobby is ready for your first post."}),t.jsx("p",{className:"muted",children:s.length?"Choose another feed view to see available posts.":"Published posts from authorized businesses will appear here."})]}),L&&!g&&t.jsx("button",{className:"secondary-button lobby-load-more",type:"button",disabled:S,onClick:async()=>{b(!0),await re(E),b(!1)},children:S?"Loadingâ¦":"Load more"})]})}const Sm="/assets/launch-website-package-C93KPSE2.png",Nm="/assets/growth-website-package-C6ubPFVr.png",Cm="/assets/professional-website-package-DRlH-l5D.png",Em="/assets/enterprise-website-automation-package-DsNc0BlR.png",Tm="/assets/website-rescue-migration-service-CIx8tFMw.png",Am="/assets/landing-promo-page-DvtKg6Om.png",Fm="/assets/one-page-starter-website-DUW5pBIl.png",Js="/assets/smart-credits-starter-C3HHN46a.png",Qs="/assets/smart-credits-builder-TgM5DWgE.png",Zs="/assets/smart-credits-growth-DzFUmI27.png",ei="/assets/smart-credits-business-DdwtaDOs.png",ti="/assets/smart-credits-pro-CF7n_C3F.png",rh=[{handle:"landing-page-promo-page",name:"Landing Page / Promo Page",price:249,checkoutUrl:"https://book.stripe.com/bJe14g5ve2LQ8bLg7tdEs00",image:Am,imageAlt:"Landing Page and Promo Page service from SmartBizHelper",summary:"A focused page for a campaign, launch, special offer, event, or single customer action.",highlights:["One clear campaign goal","Mobile-first layout","Fast promotional destination"],eyebrow:"Promote"},{handle:"website-rescue-migration-service",name:"Website Rescue & Migration Service",price:299,checkoutUrl:"https://book.stripe.com/28E7sE2j2gCG8bL3kHdEs02",image:Tm,imageAlt:"Website Rescue and Migration Service from SmartBizHelper",summary:"Help moving a troubled or outdated site toward a stable, maintainable SmartBizHelper experience.",highlights:["Migration planning","Experience cleanup","A safer path forward"],eyebrow:"Rescue"},{handle:"one-page-starter-website",name:"One-Page Starter Website",price:299,checkoutUrl:"https://book.stripe.com/3cI14gaPy0DIbnX08vdEs01",image:Fm,imageAlt:"One-Page Starter Website from SmartBizHelper",summary:"A streamlined first website for a new business that needs a credible online presence without extra complexity.",highlights:["Everything essential on one page","Clear contact path","Responsive from day one"],eyebrow:"Start"},{handle:"launch-website-package",name:"Launch Website Package",price:499,checkoutUrl:"https://book.stripe.com/9B6eV6aPy86aajTg7tdEs03",image:Sm,imageAlt:"Launch Website Package from SmartBizHelper",summary:"A polished business website foundation built to help customers find you and take the next step.",highlights:["Professional launch-ready presence","Mobile-friendly customer journey","Built for growing businesses"],eyebrow:"Launch"},{handle:"growth-website-package",name:"Growth Website Package",price:999,checkoutUrl:"https://book.stripe.com/4gM00c0aU2LQfEdg7tdEs04",image:Nm,imageAlt:"Growth Website Package from SmartBizHelper",summary:"A broader website experience for businesses ready to turn more traffic into calls, bookings, and sales.",highlights:["Expanded service presentation","Conversion-focused page structure","Room for the next stage of growth"],eyebrow:"Grow"},{handle:"business-pro-website-package",name:"Professional Website Package",price:1999,checkoutUrl:"https://book.stripe.com/14A4gscXG86afEddZldEs05",image:Cm,imageAlt:"Professional Website Package from SmartBizHelper",summary:"A premium digital home for established brands that need stronger storytelling and a deeper customer journey.",highlights:["Premium multi-page experience","Stronger brand and service storytelling","Responsive professional presentation"],eyebrow:"Professional"},{handle:"enterprise-website-automation-package",name:"Enterprise Website & Automation Package",price:4999,checkoutUrl:"https://book.stripe.com/dRm4gsaPydqu9fP6wTdEs06",image:Em,imageAlt:"Enterprise Website and Automation Package from SmartBizHelper",summary:"A flagship website and automation engagement for businesses coordinating complex customer and operating workflows.",highlights:["High-touch website delivery","Automation-ready customer flows","Built for complex operations"],eyebrow:"Enterprise"}],Cl={credits_2500:{src:Js,alt:"Smart Credits Starter Pack"},smart_credits_25:{src:Js,alt:"Smart Credits Starter Pack"},"smart-credits-25":{src:Js,alt:"Smart Credits Starter Pack"},starter:{src:Js,alt:"Smart Credits Starter Pack"},credits_5250:{src:Qs,alt:"Smart Credits Builder Pack"},smart_credits_75:{src:Qs,alt:"Smart Credits Builder Pack"},"smart-credits-75":{src:Qs,alt:"Smart Credits Builder Pack"},builder:{src:Qs,alt:"Smart Credits Builder Pack"},credits_11000:{src:Zs,alt:"Smart Credits Growth Pack"},smart_credits_175:{src:Zs,alt:"Smart Credits Growth Pack"},"smart-credits-175":{src:Zs,alt:"Smart Credits Growth Pack"},growth:{src:Zs,alt:"Smart Credits Growth Pack"},credits_28750:{src:ei,alt:"Smart Credits Business Pack"},smart_credits_400:{src:ei,alt:"Smart Credits Business Pack"},"smart-credits-400":{src:ei,alt:"Smart Credits Business Pack"},business:{src:ei,alt:"Smart Credits Business Pack"},credits_60000:{src:ti,alt:"Smart Credits Pro Pack"},smart_credits_pro_pack:{src:ti,alt:"Smart Credits Pro Pack"},"smart-credits-pro-pack":{src:ti,alt:"Smart Credits Pro Pack"},pro:{src:ti,alt:"Smart Credits Pro Pack"}};function Im(e){const r=e.trim().toLowerCase().replace(/\s+/g,"_");return Cl[r]??Cl[e.trim().toLowerCase()]}function Pm(e){return e===0?"$0":`$${(e/100).toFixed(0)}`}function Dm(e,r,a){return e==="business_pro"&&a==="business_plus"?`membership_business_pro_upgrade_${r}`:`membership_${e}_${r}`}function El(e){return e?{"smart-inventory":"Smart Inventory","smart-sku":"Smart SKU","smart-ops":"Smart Ops","smart-crm":"Smart CRM","smart-content-autoposter":"Smart Content Auto-Poster","smart-websites":"Smart Websites"}[e]??null:null}function Rm({supabase:e}){const[r,a]=y.useState(null),[n,s]=y.useState(null),[i,c]=y.useState(null),[o,l]=y.useState("monthly"),[d,u]=y.useState(!1),[h,f]=y.useState(!0),[m,x]=y.useState(null),[p,g]=y.useState(null),[w]=y.useState(()=>{try{return sessionStorage.getItem("sbh_suite_upgrade_intent")}catch{return null}});async function S(){if(f(!0),x(null),!e){f(!1),x("Your secure portal connection is unavailable. Please refresh and try again.");return}try{const[k,N,C]=await Promise.all([e.rpc("portal_get_my_plan_wallet"),e.rpc("portal_get_my_beta_access"),e.rpc("portal_get_billing_summary")]);k.error?(a(null),x(k.error.message)):k.data?a(k.data):(a(null),x("No plan and wallet state was returned for this workspace.")),N.error||c(N.data),C.error||s(C.data)}
471catch(k){a(null),x(k instanceof Error?k.message:"Plan and Smart Credits could not be loaded.")}finally{f(!1)}}y.useEffect(()=>{S()},[e]);async function b(k){var T;if(!e||!r)return;u(!0),x(null),g(null);const N=await e.rpc("portal_select_pending_plan",{p_plan_key:k,p_billing_interval:o});if(N.error){u(!1),x(N.error.message);return}if(k==="free_business"){u(!1),g("Free Business is active."),await S();return}const C=await e.rpc("portal_create_stripe_checkout_intent",{p_item_key:Dm(k,o,r.subscription.plan_key)});if(u(!1),C.error){x(C.error.message);return}const P=(T=C.data)==null?void 0:T.checkout_url;if(!P){x("Stripe checkout is not configured for this membership yet.");return}window.location.assign(P)}async function j(k){var T;if(!e)return;if(k.status!=="configured"){x("This Smart Credit pack is not available for checkout yet.");return}const N=k.item_key||k.pack_key;u(!0),x(null),g(null);const C=await e.rpc("portal_create_stripe_checkout_intent",{p_item_key:N});if(u(!1),C.error){x(C.error.message);return}const P=(T=C.data)==null?void 0:T.checkout_url;if(!P){x("Stripe checkout is not configured for this Smart Credit pack yet.");return}window.location.assign(P)}return h?t.jsxs("section",{className:"panel plan-loading",children:[t.jsx(gr,{className:"spin"})," Loading plan and Smart Creditsâ¦"]}):r?t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Membership and wallet"}),t.jsx("h1",{children:"Plan & Smart Credits"}),t.jsx("p",{className:"muted",children:"Memberships and Smart Credits are separate purchases. Business Plus is included with any Smart Suite subscription."})]}),t.jsxs("div",{className:"plan-billing-toggle",children:[t.jsx("button",{className:o==="monthly"?"selected":"",onClick:()=>l("monthly"),children:"Monthly"}),t.jsx("button",{className:o==="annual"?"selected":"",onClick:()=>l("annual"),children:"Annual"})]})]}),m&&t.jsx("div",{className:"error-box",children:m}),p&&t.jsx("div",{className:"success-box",children:p}),El(w)&&t.jsx("section",{className:"panel suite-upgrade-intent",role:"status",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Package upgrade"}),t.jsxs("h2",{children:["Add ",El(w)," to your package"]}),t.jsx("p",{className:"muted",children:"Choose the membership or suite option below that fits your business. Checkout and entitlement activation remain protected by the verified billing flow."})]})}),t.jsxs("section",{className:"plan-summary-grid",children:[t.jsxs("article",{className:"panel plan-summary-card",children:[t.jsx(vi,{}),t.jsx("span",{children:"Current plan"}),t.jsx("strong",{children:r.plan.display_name}),t.jsx("small",{children:r.subscription.status==="pending_payment"?"Paid selection pending verified Stripe payment":"Active entitlement"})]}),t.jsxs("article",{className:"panel plan-summary-card",children:[t.jsx(ur,{}),t.jsx("span",{children:"Smart Credits balance"}),t.jsx("strong",{children:r.wallet.balance}),t.jsxs("small",{children:[r.wallet.purchased_credits," purchased · ",r.wallet.earned_credits," earned"]})]}),t.jsxs("article",{className:"panel plan-summary-card",children:[t.jsx(Ta,{}),t.jsx("span",{children:"Lobby posts"}),t.jsxs("strong",{children:[r.usage.lobby_posts_used," / ",r.plan.lobby_posts_per_period]}),t.jsxs("small",{children:["Allowance period ends ",r.usage.period_end]})]}),t.jsxs("article",{className:"panel plan-summary-card",children:[t.jsx(ur,{}),t.jsx("span",{children:"BarterPlace listings"}),t.jsxs("strong",{children:[r.usage.active_marketplace_listings," / ",r.plan.active_marketplace_listings]}),t.jsx("small",{children:"Active trade listings in this business"})]}),t.jsxs("article",{className:"panel plan-summary-card",children:[t.jsx(vi,{}),t.jsx("span",{children:"Billing status"}),t.jsx("strong",{children:(n==null?void 0:n.status)??"not configured"}),t.jsx("small",{children:n!=null&&n.renewal_at?`Renews ${new Date(n.renewal_at).toLocaleDateString()}`:"Verified billing events control access"}),(n==null?void 0:n.manage_billing_url)&&t.jsx("a",{className:"secondary-button",href:n.manage_billing_url,children:"Manage Billing"}),(n==null?void 0:n.update_payment_method_url)&&t.jsx("a",{className:"secondary-button",href:n.update_payment_method_url,children:"Update Payment Method"})]})]}),t.jsx("section",{className:"plan-grid",children:r.plans.map(k=>{const N=r.subscription.plan_key===k.plan_key||r.subscription.pending_plan_key===k.plan_key,C=o==="annual"?k.annual_price_cents:k.monthly_price_cents,P=r.plans.find(M=>M.plan_key===k.upgrade_from_plan_key),T=P?k.monthly_price_cents-P.monthly_price_cents:null,L=P?k.annual_price_cents-P.annual_price_cents:null;return t.jsxs("article",{className:N?"panel plan-card selected":"panel plan-card",children:[t.jsxs("div",{className:"plan-card-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:k.plan_key==="free_business"?"Start safely":"Membership"}),t.jsx("h2",{children:k.display_name})]}),N&&t.jsxs("span",{className:"plan-current",children:[t.jsx(Kt,{size:14})," ",r.subscription.plan_key===k.plan_key?"Current":"Selected"]})]}),t.jsxs("strong",{className:"plan-price",children:[Pm(C),t.jsx("small",{children:o==="annual"?"/year":"/month"})]}),k.included_with_smart_suite&&t.jsx("p",{className:"plan-bonus",children:"Included with any Smart Suite subscription"}),P&&T!==null&&L!==null&&t.jsxs("p",{className:"plan-bonus",children:["Upgrade difference: $",(o==="annual"?L:T)/100,"/ ",o==="annual"?"year":"month"]}),o==="annual"&&k.annual_bonus_credits>0&&t.jsxs("p",{className:"plan-bonus",children:["+",k.annual_bonus_credits," annual bonus Smart Credits"]}),t.jsxs("ul",{children:[t.jsxs("li",{children:[k.lobby_posts_per_period," Lobby posts per allowance peri
471od"]}),t.jsxs("li",{children:[k.active_marketplace_listings," active BarterPlace listings"]})]}),t.jsx("button",{className:"primary-inline",onClick:()=>void b(k.plan_key),disabled:d||N,children:d?t.jsx(gr,{className:"spin",size:15}):N?"Selected":k.plan_key==="free_business"?"Use Free Business":"Continue to Stripe"}),k.plan_key!=="free_business"&&t.jsx("small",{className:"pending-copy",children:"Paid access activates only after SmartBizHelper verifies Stripe payment."})]},k.plan_key)})}),t.jsxs("section",{className:"wallet-section-grid",children:[t.jsxs("section",{className:"panel wallet-packs-panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Smart Credit packs"}),t.jsx("p",{className:"muted",children:"Buy credits separately from your membership."})]})}),t.jsx("div",{className:"credit-pack-grid",children:[...r.credit_packs].sort((k,N)=>k.price_cents-N.price_cents).map(k=>{const N=Im(k.pack_key),C=(N==null?void 0:N.src)??k.artwork_url;return t.jsxs("article",{className:"credit-pack",children:[C&&t.jsx("img",{className:"credit-pack-artwork",src:C,alt:(N==null?void 0:N.alt)??`${k.credits.toLocaleString()} Smart Credit pack`,loading:"lazy"}),t.jsx("strong",{children:k.credits.toLocaleString()}),t.jsx("span",{children:"Smart Credits"}),t.jsxs("b",{children:["$",(k.price_cents/100).toFixed(0)]}),t.jsx("button",{className:"secondary-button",onClick:()=>void j(k),disabled:d||k.status!=="configured",children:k.status==="configured"?"Buy with Stripe":"Stripe setup pending"})]},k.pack_key)})})]}),t.jsxs("section",{className:"panel wallet-expiry-panel",children:[t.jsx("h2",{children:"Credits expiring soon"}),r.wallet.lots.length?t.jsx("ul",{className:"credit-lot-list",children:r.wallet.lots.map((k,N)=>t.jsxs("li",{children:[t.jsxs("span",{children:[k.remaining_credits.toLocaleString()," credits · ",k.source.replace("_"," ")]}),t.jsxs("small",{children:["Expires ",new Date(k.expires_at).toLocaleDateString()]})]},`${k.source}-${k.expires_at}-${N}`))}):t.jsx("p",{className:"muted",children:"No active credits are scheduled to expire."})]})]}),t.jsxs("section",{className:"wallet-detail-grid",children:[t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Wallet summary"}),t.jsxs("div",{className:"wallet-stats",children:[t.jsxs("span",{children:[t.jsx("b",{children:r.wallet.balance.toLocaleString()}),"Balance"]}),t.jsxs("span",{children:[t.jsx("b",{children:r.wallet.purchased_credits.toLocaleString()}),"Purchased credits"]}),t.jsxs("span",{children:[t.jsx("b",{children:r.wallet.earned_credits.toLocaleString()}),"Earned credits"]})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Transaction history"}),r.wallet.transactions.length?t.jsx("ul",{className:"credit-lot-list",children:r.wallet.transactions.slice(0,12).map((k,N)=>t.jsxs("li",{children:[t.jsxs("span",{children:[k.transaction_type.replace("_"," ")," · ",k.credits>0?"+":"",k.credits.toLocaleString()]}),t.jsx("small",{children:new Date(k.created_at).toLocaleString()})]},`${k.created_at}-${N}`))}):t.jsx("p",{className:"muted",children:"No wallet transactions yet."})]})]})]}):t.jsxs("section",{className:"panel plan-loading",children:[t.jsx("strong",{children:"Plan and Smart Credits are unavailable."}),t.jsx("p",{className:"muted",children:m??"No wallet state was returned for this workspace."}),t.jsx("button",{className:"primary-inline",onClick:()=>void S(),children:"Try again"})]})}function Om({trust:e,compact:r=!1}){if(!e)return null;const a=[e.verified?{label:"Verified Business",Icon:Mu}:null,e.recommendations_received?{label:`${e.recommendations_received} recommendation${e.recommendations_received===1?"":"s"}`,Icon:Sp}:null,e.completed_barter_exchanges?{label:`${e.completed_barter_exchanges} completed barter exchange${e.completed_barter_exchanges===1?"":"s"}`,Icon:qu}:null].filter(Boolean);return t.jsx("div",{className:r?"business-trust-signals compact":"business-trust-signals","aria-label":"Business trust signals",children:a.map(({label:n,Icon:s})=>t.jsxs("span",{title:"Based on approved SBH activity",children:[t.jsx(s,{size:14})," ",n]},n))})}function Lm({supabase:e,onConnect:r,onWarmIntroduction:a,onOpenDestination:n}){var u,h,f,m;const[s,i]=y.useState(null),[c,o]=y.useState([]);y.useEffect(()=>{let x=!0;
471return e.rpc("portal_get_ness_engagement_context").then(p=>{x&&!p.error&&i(p.data)}),()=>{x=!1}},[e]);async function l(x){o(g=>[...g,x]),(await e.rpc("portal_dismiss_engagement_alert",{p_alert_id:x})).error&&o(g=>g.filter(w=>w!==x))}if(!s)return null;const d=(s.alerts??[]).filter(x=>!c.includes(x.id));return t.jsxs("section",{className:"engagement-signals panel","aria-labelledby":"engagement-signals-title",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"NESS community signals"}),t.jsx("h2",{id:"engagement-signals-title",children:"You may want to connectâ¦"}),t.jsx("p",{className:"muted",children:"Suggestions use transparent community relevance and never expose private contact details."})]}),t.jsx(qu,{size:25})]}),(s.smart_connections??[]).length>0&&t.jsx("div",{className:"engagement-suggestion-list",children:(u=s.smart_connections)==null?void 0:u.map(x=>t.jsxs("article",{className:"engagement-suggestion",children:[t.jsxs("div",{children:[t.jsx("strong",{children:x.business_name}),x.category&&t.jsx("span",{children:x.category}),t.jsx("p",{children:x.reason})]}),t.jsxs("div",{className:"engagement-suggestion-actions",children:[t.jsxs("button",{type:"button",className:"directory-primary-action",onClick:()=>r(x),children:[t.jsx(vs,{size:15})," Connect"]}),x.mutual_introducer_client_id&&t.jsx("button",{type:"button",className:"directory-secondary-action",onClick:()=>a(x),children:"Request warm intro"})]})]},x.client_id))}),(s.smart_connections??[]).length===0&&t.jsx("p",{className:"muted",children:"Connection suggestions will appear as relevant, permission-safe activity becomes available."}),t.jsxs("div",{className:"engagement-trust-summary",children:[t.jsx(tt,{size:17}),t.jsxs("span",{children:[(h=s.reputation)!=null&&h.verified?"Your business is verified":"Verification can unlock protected connection requests"," · ",((f=s.reputation)==null?void 0:f.recommendations_received)??0," public recommendation",((m=s.reputation)==null?void 0:m.recommendations_received)===1?"":"s"]})]}),d.length>0&&t.jsxs("div",{className:"engagement-alerts","aria-label":"Follow alerts",children:[t.jsxs("h3",{children:[t.jsx(aa,{size:17})," Follow alerts"]}),d.map(x=>t.jsxs("article",{className:"engagement-alert",children:[t.jsxs("button",{type:"button",className:"engagement-alert-content",onClick:()=>n(x.destination),children:[t.jsx("strong",{children:x.title}),t.jsx("span",{children:x.body})]}),t.jsx("button",{className:"engagement-dismiss",type:"button","aria-label":`Dismiss ${x.title}`,onClick:()=>void l(x.id),children:t.jsx(gt,{size:16})})]},x.id))]})]})}function $c(e){if(!e)return null;try{const r=new URL(e);return r.protocol==="https:"||r.protocol==="http:"?r.href:null}catch{return null}}function Bm(e){var n,s,i;const r=[];((n=e.verification_status)==null?void 0:n.toLowerCase())==="verified"&&r.push({label:"Verified",tone:"verified"});const a=(s=e.sponsor_tier)==null?void 0:s.toLowerCase();return a==="featured"&&r.push({label:"Featured",tone:"featured"}),a==="premium_storefront"&&r.push({label:"Premium",tone:"sponsored"}),a&&!["free","featured","premium_storefront"].includes(a)&&r.push({label:"Sponsored",tone:"sponsored"}),(i=e.tags)!=null&&i.some(c=>c.trim().toLowerCase()==="sbh official")&&r.push({label:"SBH Official",tone:"official"}),r}function ah({row:e,detail:r=!1}){const a=$c(e.cover_path),n=$c(e.logo_path);return t.jsxs("div",{className:r?"directory-profile-art":"directory-card-art",children:[a?t.jsx("img",{className:"directory-cover",src:a,alt:`${e.display_name} business`}):t.jsx("div",{className:"directory-cover-fallback","aria-hidden":"true",children:t.jsx(fp,{size:r?34:27})}),t.jsx("div",{className:"directory-logo",children:n?t.jsx("img",{src:n,alt:`${e.display_name} logo`}):t.jsx("span",{"aria-hidden":"true",children:e.display_name.trim().charAt(0).toUpperCase()||"B"})})]})}function nh({row:e}){const r=Bm(e);return r.length?t.jsx("div",{className:"directory-badges","aria-label":"Business status",children:r.map(a=>t.jsxs("span",{className:`directory-badge ${a.tone}`,children:[a.tone==="verified"&&t.jsx(tt,{size:12}),a.tone==="featured"&&t.jsx(Or,{size:12}),a.label]},a.label))}):null}function Mm({row:e,recommendationCount:r,trust:a,onBack:n,onConnect:s,onRecommend:i,onFollow:c}){var u;
471const o=(e.services??[]).filter(Boolean),l=(e.tags??[]).filter(h=>h.trim().toLowerCase()!=="sbh official"),d=["premium_storefront","featured"].includes(((u=e.sponsor_tier)==null?void 0:u.toLowerCase())??"");return t.jsxs("section",{className:"directory-profile","aria-labelledby":"directory-profile-title",children:[t.jsxs("button",{className:"directory-back",type:"button",onClick:n,children:[t.jsx(Oi,{size:17})," Back to businesses"]}),t.jsx(ah,{row:e,detail:!0}),t.jsxs("div",{className:"directory-profile-body",children:[t.jsx(nh,{row:e}),t.jsx("p",{className:"eyebrow",children:d?"Premium Business Page":"Free Business Card"}),t.jsx("h2",{id:"directory-profile-title",children:e.display_name}),t.jsx("p",{className:"directory-profile-headline",children:e.headline||e.primary_category||"Published SmartBizHelper business"}),t.jsxs("div",{className:"directory-profile-meta",children:[t.jsxs("span",{children:[t.jsx(Mn,{size:15})," ",e.display_location||(e.serves_remotely?"Remote / service area":"Location available on request")]}),e.primary_category&&t.jsxs("span",{children:[t.jsx(hr,{size:15})," ",e.primary_category]})]}),t.jsx("p",{className:"directory-profile-story",children:d?e.description||"This business has published a premium profile for the SmartBizHelper community.":e.headline||"This business has published a basic card for the SmartBizHelper community."}),t.jsx("p",{className:"muted",children:r?`${r} business recommendation${r===1?"":"s"}`:"No public business recommendations yet"}),t.jsx(Om,{trust:a}),d&&(o.length>0||l.length>0)&&t.jsxs("div",{className:"directory-profile-details",children:[o.length>0&&t.jsxs("div",{children:[t.jsx("h3",{children:"Services"}),t.jsx("ul",{children:o.map(h=>t.jsxs("li",{children:[t.jsx(Kt,{size:14})," ",h]},h))})]}),l.length>0&&t.jsxs("div",{children:[t.jsx("h3",{children:"What theyâre known for"}),t.jsx("div",{className:"directory-tags",children:l.map(h=>t.jsx("span",{children:h},h))})]})]}),t.jsxs("div",{className:"directory-profile-actions",children:[t.jsxs("button",{className:"directory-primary-action",type:"button",disabled:e.connection_status==="blocked",onClick:()=>s(e),children:[t.jsx(vs,{size:16})," Connect with Business"]}),t.jsx("button",{className:"directory-secondary-action",type:"button",onClick:()=>i(e),children:"Recommend"}),t.jsx("button",{className:"directory-secondary-action",type:"button",onClick:()=>c(e),children:"Follow"})]})]})]})}function Tl({supabase:e,mode:r}){var D,K;const[a,n]=y.useState(""),[s,i]=y.useState("all"),[c,o]=y.useState(!1),[l,d]=y.useState([]),[u,h]=y.useState(!0),[f,m]=y.useState(null),[x,p]=y.useState(null),[g,w]=y.useState(null),[S,b]=y.useState(0),[j,k]=y.useState(null),[N,C]=y.useState(null),[P,T]=y.useState(0),[L,M]=y.useState(null),E=12;async function W(z=S){if(!e){m("The community data connection is not configured."),h(!1);return}if(h(!0),m(null),p(null),r==="directory"){const Y=await e.rpc("portal_search_business_directory",{p_filters:{search:a.trim(),category:s,verified_only:c,include_remote:!0,radius_km:2e4}});Y.error?m(Y.error.message):d(Y.data??[])}else{const Y=await e.from("portal_marketplace_listings").select("*").order("published_at",{ascending:!1}).range(z*E,z*E+E-1);Y.error?m(Y.error.message):d(Y.data??[])}h(!1)}async function ee(){if(!e||r!=="directory")return;const z=await e.rpc("portal_get_directory_commerce_state");!z.error&&z.data&&k(z.data)}y.useEffect(()=>{w(null),T(0),M(null),W(S),ee()},[r,S]),y.useEffect(()=>{!g||!e||e.rpc("portal_get_business_reputation",{p_client_id:g.client_id}).then(z=>{if(!z.error){const Y=z.data;M(Y),T(Number((Y==null?void 0:Y.recommendations_received)??0))}})},[g,e]);const ce=y.useMemo(()=>r==="directory"?[...new Set(l.map(z=>z.primary_category).filter(z=>!!z))].sort():[],[r,l]);function ue(z){z.preventDefault(),b(0),w(null),W(0)}function te(z){const Y=new URLSearchParams(window.location.search);Y.set("area","messages"),Y.set("conversation",z),Aa(`${window.location.pathname}?${Y.toString()}`)}async function fe(z,Y,re,oe){var se,he;if(!e)return;const Ce=await e.rpc("portal_start_bizz2bizz_connect",{p_target_client_id:z,p_context_type:re,p_context_id:oe}),F=(se=Ce.data)==null?void 0:se.conversation_id;if(Ce.error||!F){m(((he=Ce.error)==null?void 0:he.message)||"Bizz2Bizz Connect is unavailable right now.");return}p(`Opening Bizz2Bizz Connect with ${Y}.`),te(F)}async function q(z){if(!e)return;
471const Y=window.prompt(`Why do you recommend ${z.display_name}? (optional)`);if(Y===null)return;const re=await e.rpc("portal_recommend_business",{p_target_client_id:z.client_id,p_note:Y});re.error?m(re.error.message):(T(oe=>oe+1),p(`Recommendation recorded for ${z.display_name}.`))}async function J(z){if(!e)return;const Y=await e.rpc("portal_follow_business",{p_target_client_id:z.client_id});Y.error?m(Y.error.message):p(`Following ${z.display_name}.`)}async function le(z,Y,re){var F,se;if(!e)return;const oe=await e.rpc("portal_request_warm_introduction",{p_target_client_id:z,p_introducer_client_id:Y}),Ce=(F=oe.data)==null?void 0:F.conversation_id;if(oe.error||!Ce){m(((se=oe.error)==null?void 0:se.message)||"A warm introduction is unavailable right now.");return}p(`Opening a protected warm introduction request for ${re}.`),te(Ce)}function A(z){const Y=new URLSearchParams(window.location.search);Y.set("area",z),Aa(`${window.location.pathname}?${Y.toString()}`)}async function V(z){if(!e)return;const Y=window.prompt("What would you like to offer in trade?","Iâm interested in this offer and would like to propose a business trade.");if(!Y)return;const re=await e.rpc("portal_create_marketplace_inquiry",{p_listing_id:z.listing_id,p_message:Y,p_preferred_response:"message"});re.error?m(re.error.message):p("Your trade proposal was sent to the business.")}async function I(z){var oe,Ce;if(!e||!(j!=null&&j.can_purchase))return;C(z),m(null),p(null);const Y=await e.rpc("portal_create_directory_checkout",{p_item_key:z}),re=$c(((oe=Y.data)==null?void 0:oe.checkout_url)??null);if(Y.error||!re){m(((Ce=Y.error)==null?void 0:Ce.message)||"Secure Stripe checkout is not available for this Directory tier yet."),C(null);return}p("Opening secure Stripe checkout. Paid access activates only after verified payment."),window.location.assign(re)}return r==="directory"&&g?t.jsxs("div",{className:"community-discovery-page",children:[t.jsx(Mm,{row:g,recommendationCount:P,trust:L,onBack:()=>w(null),onConnect:z=>void fe(z.client_id,z.display_name,"directory",z.business_profile_id),onRecommend:z=>void q(z),onFollow:z=>void J(z)}),f&&t.jsx("div",{className:"error-box directory-status",role:"alert",children:f}),x&&t.jsx("div",{className:"success-box directory-status",role:"status",children:x})]}):t.jsxs("div",{className:`community-discovery-page community-${r}`,children:[t.jsxs("header",{className:"directory-hero page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper community"}),t.jsx("h1",{children:r==="directory"?"Business Directory":"SmartBizHelper â Bizz2Bizz BarterPlace"}),t.jsx("p",{children:r==="directory"?"Meet trusted businesses, discover what they do, and make your next valuable connection.":"Trade products and services directly with other businesses. Participation is free; no ecommerce checkout is used."})]}),r==="directory"&&t.jsxs("div",{className:"directory-hero-mark","aria-hidden":"true",children:[t.jsx(hr,{size:34}),t.jsxs("span",{children:["Community",t.jsx("br",{}),"with purpose"]})]})]}),r==="directory"&&e&&t.jsx(Lm,{supabase:e,onConnect:z=>void fe(z.client_id,z.business_name,"directory",`suggestion:${z.client_id}`),onWarmIntroduction:z=>{z.mutual_introducer_client_id&&le(z.client_id,z.mutual_introducer_client_id,z.business_name)},onOpenDestination:A}),r==="directory"&&j&&t.jsxs("section",{className:"directory-commerce","aria-labelledby":"directory-commerce-title",children:[t.jsxs("div",{className:"directory-commerce-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Your Directory presence"}),t.jsx("h2",{id:"directory-commerce-title",children:"Choose the visibility that fits your business"})]}),t.jsx("span",{children:"Stripe-verified access"})]}),(j.premium_paused||j.featured_paused)&&t.jsxs("div",{className:"directory-commerce-paused",role:"status",children:[t.jsx("strong",{children:"Premium features paused"}),t.jsx("span",{children:"Your saved Directory content is preserved. Restore verified Stripe billing to reactivate it."})]}),t.jsxs("div",{className:"directory-tier-grid",children:[t.jsxs("article",{className:!j.premium_active&&!j.featured_active?"current":"",children:[t.jsx("p",{className:"eyebrow",children:"Free"}),t.jsx("h3",{children:"Business Card"}),t.jsx("strong",{children:"$0"}),t.jsx("p",{children:"Business details, logo, short introduction, QR-ready identity, and basic Directory presence."}),t.jsx("span",{children:!j.premium_active&&!j.featured_active?"Current Directory tier":"Included foundation"})]}),t.jsxs("article",{className:j.premium_active&&!j.featured_active?"current":"",children:[t.jsx("p",{className:"eyebrow",children:"Premium"}),t.jsx("h3",{children:"Premium Business Page"}),t.jsxs("strong",{children:["$19.99 ",t.jsx("small",{children:"/ month"})]}),t.jsx("p",{children:"A polished standardized one-page profile with richer details, images, and contact actionsânot a custom website."}),t.jsx("button",{type:"button",disabled:!j.can_purchase||j.premium_active||j.premium_paused||N!==null,onClick:()=>void I("directory_premium_page_monthly"),children:j.premium_active?"Premium active":j.premium_paused?"Payment recovery needed":((D=j.latest_intents)==null?void 0:D.directory_premium_page_monthly)==="pending"?"Continue checkout":N==="directory_premium_page_monthly"?"Opening Stripeâ¦":"Upgrade with Stripe"}),j.premium_paused&&t.jsx("p",{className:"muted",children:"Your subscription payment needs attention. Contact support to update your payment method â starting a new checkout here would create a second, duplicate subscription rather than recover this one."})]}),t.jsxs("article",{className:j.featured_active?"current featured":"featured",children:[t.jsx("p",{className:"eyebrow",children:"Featured"}),t.jsx("h3",{children:"Featured Business"}),t.jsxs("strong",{children:["$79 ",t.jsx("small",{children:"/ month"})]}),t.jsx("p",{children:"Includes the Premium Business Page plus enhanced visibility on Business Directory discovery surfaces."}),t.jsx("button",{type:"button",disabled:!j.can_purchase||j.featured_active||j.featured_paused||j.premium_active&&!j.featured_active||N!==null,onClick:()=>void I("directory_featured_business_monthly"),children:j.featured_active?"Featured active":j.featured_paused?"Payment recovery needed":j.premium_active?"Cancel Premium first":((K=j.latest_intents)==null?void 0:K.directory_featured_business_monthly)==="pending"?"Continue checkout":N==="directory_featured_business_monthly"?"Opening Stripeâ¦":"Become featured"}),j.featured_paused&&t.jsx("p",{className:"muted",children:"Your subscription payment needs attention. Contact support to update your payment method â starting a new checkout here would create a second, duplicate subscription rather than recover this one."}),!j.featured_paused&&j.premium_active&&!j.featured_active&&t.jsx("p",{className:"muted",children:"Cancel your Premium Business Page subscription first to avoid being billed for both plans."})]})]}),!j.can_purchase&&t.jsx("p",{className:"directory-commerce-owner-note",children:"Only a business owner or admin can start a paid Directory checkout."})]}),t.jsxs("form",{className:"directory-filters",onSubmit:ue,"aria-label":`${r} filters`,children:[t.jsxs("label",{className:"directory-search",children:[t.jsx("span",{className:"sr-only",children:"Search"}),t.jsx(Yr,{size:18}),t.jsx("input",{value:a,onChange:z=>n(z.target.value),placeholder:r==="directory"?"Search businesses, services, or categories":"Search trade offers and needs"})]}
471),r==="directory"&&t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"directory-select",children:[t.jsx("span",{className:"sr-only",children:"Category"}),t.jsxs("select",{value:s,onChange:z=>i(z.target.value),children:[t.jsx("option",{value:"all",children:"All categories"}),ce.map(z=>t.jsx("option",{children:z},z))]})]}),t.jsxs("label",{className:"directory-verified",children:[t.jsx("input",{type:"checkbox",checked:c,onChange:z=>o(z.target.checked)}),t.jsx(tt,{size:16})," Verified only"]})]}),t.jsx("button",{className:"directory-search-action",type:"submit",children:"Search"})]}),f&&t.jsxs("div",{className:"error-box directory-status",role:"alert",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>void W(),children:"Try again"})]}),x&&t.jsx("div",{className:"success-box directory-status",role:"status",children:x}),u?t.jsxs("section",{className:"directory-state","aria-live":"polite",children:[t.jsx(gr,{className:"spin"}),t.jsx("h2",{children:r==="directory"?"Opening the directoryâ¦":"Opening Bizz2Bizz BarterPlaceâ¦"}),t.jsx("p",{children:r==="directory"?"Loading published community profiles.":"Loading published business trade listings."})]}):l.length?r==="directory"?t.jsx("section",{className:"directory-card-grid","aria-label":"Published businesses",children:l.slice(S*E,S*E+E).map(z=>{var Y;return t.jsxs("article",{className:"directory-card",children:[t.jsx(ah,{row:z}),t.jsxs("div",{className:"directory-card-body",children:[t.jsx(nh,{row:z}),t.jsx("p",{className:"directory-category",children:z.primary_category||"Published business"}),t.jsx("h2",{children:z.display_name}),t.jsx("p",{className:"directory-headline",children:z.headline||"Part of the SmartBizHelper business community."}),t.jsxs("span",{className:"directory-location",children:[t.jsx(Mn,{size:14})," ",z.display_location||(z.serves_remotely?"Remote / service area":"Location available on request")]}),t.jsx("p",{className:"directory-story",children:z.description||"Open this profile to learn more about the business."}),t.jsxs("div",{className:"directory-card-actions",children:[t.jsxs("button",{className:"directory-primary-action",type:"button",onClick:()=>w(z),children:[["premium_storefront","featured"].includes(((Y=z.sponsor_tier)==null?void 0:Y.toLowerCase())??"")?"View premium page":"View business card"," ",t.jsx(Tt,{size:15})]}),t.jsxs("button",{className:"directory-secondary-action",type:"button",disabled:z.connection_status==="blocked",onClick:()=>void fe(z.client_id,z.display_name,"directory",z.business_profile_id),children:[t.jsx(vs,{size:15})," Connect with Business"]})]})]})]},z.business_profile_id)})}):t.jsx("section",{className:"tool-grid community-card-grid","aria-label":"Published Bizz2Bizz trade listings",children:l.map(z=>t.jsxs("article",{className:"tool-card barterplace-card",children:[t.jsx(Ps,{size:24}),t.jsxs("p",{className:"eyebrow",children:["Offering · ",z.listing_type]}),t.jsx("h2",{children:z.title}),t.jsx("p",{children:z.business_name}),t.jsx("p",{children:z.description||"This business is open to a direct trade proposal."}),t.jsxs("dl",{className:"barterplace-details",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Looking for"}),t.jsx("dd",{children:"Business trade proposals"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Service area"}),t.jsx("dd",{children:z.service_area||"Confirm with business"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Barter options"}),t.jsx("dd",{children:"Full or partial barter · confirm in proposal"})]})]}),t.jsxs("div",{className:"directory-card-actions",children:[t.jsx("button",{className:"primary-inline",type:"button",onClick:()=>void V(z),children:"Propose Trade"}),t.jsxs("button",{className:"directory-secondary-action",type:"button",onClick:()=>void fe(z.client_id,z.business_name,"marketplace",z.listing_id),children:[t.jsx(vs,{size:15})," Connect with Business"]})]})]},z.listing_id))}):t.jsxs("section",{className:"directory-state",children:[t.jsx(hr,{size:32}),t.jsx("h2",{children:r==="directory"?"No published records match this search.":"No published trade listings match this search."}),t.jsx("p",{children:r==="directory"?"Try a broader category or search. Businesses appear here only after their owner publishes them.":"Try a broader search. Trade listings appear only after a business publishes them."}),t.jsx("button",{type:"button",onClick:()=>{n(""),i("all"),o(!1)},children:"Clear filters"})]}),!u&&l.length>0&&t.jsxs("div",{className:"community-pagination",children:[t.jsx("button",{className:"secondary-button",disabled:S===0,onClick:()=>b(z=>Math.max(0,z-1)),children:"Previous"}),t.jsxs("span",{children:["Page ",S+1]}),t.jsx("button",{className:"secondary-button",disabled:l.length<E,onClick:()=>b(z=>z+1),children:"Next"})]})]})}/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var yi={};yi.version="0.18.5";var sh=1252,zm=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],vo={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},yo=function(e){zm.indexOf(e)!=-1&&(sh=vo[0]=e)};function Um(){yo(1252)}var Wr=function(e){yo(e)};function _o(){Wr(1200),Um()}function Al(e){for(var r=[],a=0,n=e.length;a<n;++a)r[a]=e.charCodeAt(a);return r}function Hm(e){for(var r=[],a=0;a<e.length>>1;++a)r[a]=String.fromCharCode(e.charCodeAt(2*a)+(e.charCodeAt(2*a+1)<<8));return r.join("")}function ih(e){for(var r=[],a=0;a<e.length>>1;++a)r[a]=String.fromCharCode(e.charCodeAt(2*a+1)+(e.charCodeAt(2*a)<<8));return r.join("")}var ns=function(e){var r=e.charCodeAt(0),a=e.charCodeAt(1);return r==255&&a==254?Hm(e.slice(2)):r==254&&a==255?ih(e.slice(2)):r==65279?e.slice(1):e},ri=function(r){return String.fromCharCode(r)},Fl=function(r){return String.fromCharCode(r)},ys,Ca="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
471+/=";function _s(e){for(var r="",a=0,n=0,s=0,i=0,c=0,o=0,l=0,d=0;d<e.length;)a=e.charCodeAt(d++),i=a>>2,n=e.charCodeAt(d++),c=(a&3)<<4|n>>4,s=e.charCodeAt(d++),o=(n&15)<<2|s>>6,l=s&63,isNaN(n)?o=l=64:isNaN(s)&&(l=64),r+=Ca.charAt(i)+Ca.charAt(c)+Ca.charAt(o)+Ca.charAt(l);return r}function kr(e){var r="",a=0,n=0,s=0,i=0,c=0,o=0,l=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var d=0;d<e.length;)i=Ca.indexOf(e.charAt(d++)),c=Ca.indexOf(e.charAt(d++)),a=i<<2|c>>4,r+=String.fromCharCode(a),o=Ca.indexOf(e.charAt(d++)),n=(c&15)<<4|o>>2,o!==64&&(r+=String.fromCharCode(n)),l=Ca.indexOf(e.charAt(d++)),s=(o&3)<<6|l,l!==64&&(r+=String.fromCharCode(s));return r}var Je=(function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node})(),ya=(function(){if(typeof Buffer<"u"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch{e=!0}return e?function(r,a){return a?new Buffer(r,a):new Buffer(r)}:Buffer.from.bind(Buffer)}return function(){}})();function Fa(e){return Je?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}function Il(e){return Je?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}var jr=function(r){return Je?ya(r,"binary"):r.split("").map(function(a){return a.charCodeAt(0)&255})};function zi(e){if(typeof ArrayBuffer>"u")return jr(e);for(var r=new ArrayBuffer(e.length),a=new Uint8Array(r),n=0;n!=e.length;++n)a[n]=e.charCodeAt(n)&255;return r}function Oa(e){if(Array.isArray(e))return e.map(function(n){return String.fromCharCode(n)}).join("");for(var r=[],a=0;a<e.length;++a)r[a]=String.fromCharCode(e[a]);return r.join("")}function Wm(e){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(e)}function bo(e){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(e instanceof ArrayBuffer)return bo(new Uint8Array(e));for(var r=new Array(e.length),a=0;a<e.length;++a)r[a]=e[a];return r}var Gt=Je?function(e){return Buffer.concat(e.map(function(r){return Buffer.isBuffer(r)?r:ya(r)}))}:function(e){if(typeof Uint8Array<"u"){var r=0,a=0;for(r=0;r<e.length;++r)a+=e[r].length;var n=new Uint8Array(a),s=0;for(r=0,a=0;r<e.length;a+=s,++r)if(s=e[r].length,e[r]instanceof Uint8Array)n.set(e[r],a);else{if(typeof e[r]=="string")throw"wtf";n.set(new Uint8Array(e[r]),a)}return n}return[].concat.apply([],e.map(function(i){return Array.isArray(i)?i:[].slice.call(i)}))};function Vm(e){for(var r=[],a=0,n=e.length+250,s=Fa(e.length+255),i=0;i<e.length;++i){var c=e.charCodeAt(i);if(c<128)s[a++]=c;else if(c<2048)s[a++]=192|c>>6&31,s[a++]=128|c&63;else if(c>=55296&&c<57344){c=(c&1023)+64;var o=e.charCodeAt(++i)&1023;s[a++]=240|c>>8&7,s[a++]=128|c>>2&63,s[a++]=128|o>>6&15|(c&3)<<4,s[a++]=128|o&63}else s[a++]=224|c>>12&15,s[a++]=128|c>>6&63,s[a++]=128|c&63;a>n&&(r.push(s.slice(0,a)),a=0,s=Fa(65535),n=65530)}return r.push(s.slice(0,a)),Gt(r)}var pr=/\u0000/g,ss=/[\u0001-\u0006]/g;function Tn(e){for(var r="",a=e.length-1;a>=0;)r+=e.charAt(a--);return r}function Vr(e,r){var a=""+e;return a.length>=r?a:Et("0",r-a.length)+a}function jo(e,r){var a=""+e;return a.length>=r?a:Et(" ",r-a.length)+a}function _i(e,r){var a=""+e;return a.length>=r?a:a+Et(" ",r-a.length)}function qm(e,r){var a=""+Math.round(e);return a.length>=r?a:Et("0",r-a.length)+a}function $m(e,r){var a=""+e;return a.length>=r?a:Et("0",r-a.length)+a}var Pl=Math.pow(2,32);function vn(e,r){if(e>Pl||e<-Pl)return qm(e,r);var a=Math.round(e);return $m(a,r)}function bi(e,r){return r=r||0,e.length>=7+r&&(e.charCodeAt(r)|32)===103&&(e.charCodeAt(r+1)|32)===101&&(e.charCodeAt(r+2)|32)===110&&(e.charCodeAt(r+3)|32)===101&&(e.charCodeAt(r+4)|32)===114&&(e.charCodeAt(r+5)|32)===97&&(e.charCodeAt(r+6)|32)===108}var Dl=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],Ji=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function Gm(e){return e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11
vendor: 4,092 bytes, line 471
471]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"ä¸å/ä¸å "hh"æ"mm"å"ss"ç§ "',e}var He={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"ä¸å/ä¸å "hh"æ"mm"å"ss"ç§ "'},Rl={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},Xm={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function ji(e,r,a){for(var n=e<0?-1:1,s=e*n,i=0,c=1,o=0,l=1,d=0,u=0,h=Math.floor(s);d<r&&(h=Math.floor(s),o=h*c+i,u=h*d+l,!(s-h<5e-8));)s=1/(s-h),i=c,c=o,l=d,d=u;if(u>r&&(d>r?(u=l,o=i):(u=d,o=c)),!a)return[0,n*o,u];var f=Math.floor(n*o/u);return[f,n*o-f*u,u]}function Ga(e,r,a){if(e>2958465||e<0)return null;var n=e|0,s=Math.floor(86400*(e-n)),i=0,c=[],o={D:n,T:s,u:86400*(e-n)-s,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(o.u)<1e-6&&(o.u=0),r&&r.date1904&&(n+=1462),o.u>.9999&&(o.u=0,++s==86400&&(o.T=s=0,++n,++o.D)),n===60)c=a?[1317,10,29]:[1900,2,29],i=3;else if(n===0)c=a?[1317,8,29]:[1900,1,0],i=6;else{n>60&&--n;var l=new Date(1900,0,1);l.setDate(l.getDate()+n-1),c=[l.getFullYear(),l.getMonth()+1,l.getDate()],i=l.getDay(),n<60&&(i=(i+6)%7),a&&(i=ex(l,c))}return o.y=c[0],o.m=c[1],o.d=c[2],o.S=s%60,s=Math.floor(s/60),o.M=s%60,s=Math.floor(s/60),o.H=s,o.q=i,o}var ch=new Date(1899,11,31,0,0,0),Km=ch.getTime(),Ym=new Date(1900,2,1,0,0,0);function oh(e,r){var a=e.getTime();return r?a-=1461*24*60*60*1e3:e>=Ym&&(a+=1440*60*1e3),(a-(Km+(e.getTimezoneOffset()-ch.getTimezoneOffset())*6e4))/(1440*60*1e3)}function wo(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function Jm(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function Qm(e){var r=e<0?12:11,a=wo(e.toFixed(12));return a.length<=r||(a=e.toPrecision(10),a.length<=r)?a:e.toExponential(5)}function Zm(e){var r=wo(e.toFixed(11));return r.length>(e<0?12:11)||r==="0"||r==="-0"?e.toPrecision(6):r}function bs(e){var r=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),a;return r>=-4&&r<=-1?a=e.toPrecision(10+r):Math.abs(r)<=9?a=Qm(e):r===10?a=e.toFixed(10).substr(0,12):a=Zm(e),wo(Jm(a.toUpperCase()))}function tn(e,r){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):bs(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return Br(14,oh(e,r&&r.date1904),r)}throw new Error("unsupported value in General format: "+e)}function ex(e,r){r[0]-=581;var a=e.getDay();return e<60&&(a=(a+6)%7),a}function tx(e,r,a,n){var s="",i=0,c=0,o=a.y,l,d=0;switch(e){case 98:o=a.y+543;case 121:switch(r.length){case 1:case 2:l=o%100,d=2;break;default:l=o%1e4,d=4;break}break;case 109:switch(r.length){case 1:case 2:l=a.m,d=r.length;break;case 3:return Ji[a.m-1][1];case 5:return Ji[a.m-1][0];default:return Ji[a.m-1][2]}break;
vendor: 19,729 bytes, line 471
471case 100:switch(r.length){case 1:case 2:l=a.d,d=r.length;break;case 3:return Dl[a.q][0];default:return Dl[a.q][1]}break;case 104:switch(r.length){case 1:case 2:l=1+(a.H+11)%12,d=r.length;break;default:throw"bad hour format: "+r}break;case 72:switch(r.length){case 1:case 2:l=a.H,d=r.length;break;default:throw"bad hour format: "+r}break;case 77:switch(r.length){case 1:case 2:l=a.M,d=r.length;break;default:throw"bad minute format: "+r}break;case 115:if(r!="s"&&r!="ss"&&r!=".0"&&r!=".00"&&r!=".000")throw"bad second format: "+r;return a.u===0&&(r=="s"||r=="ss")?Vr(a.S,r.length):(n>=2?c=n===3?1e3:100:c=n===1?10:1,i=Math.round(c*(a.S+a.u)),i>=60*c&&(i=0),r==="s"?i===0?"0":""+i/c:(s=Vr(i,2+n),r==="ss"?s.substr(0,2):"."+s.substr(2,r.length-1)));case 90:switch(r){case"[h]":case"[hh]":l=a.D*24+a.H;break;case"[m]":case"[mm]":l=(a.D*24+a.H)*60+a.M;break;case"[s]":case"[ss]":l=((a.D*24+a.H)*60+a.M)*60+Math.round(a.S+a.u);break;default:throw"bad abstime format: "+r}d=r.length===3?1:2;break;case 101:l=o,d=1;break}var u=d>0?Vr(l,d):"";return u}function Ea(e){var r=3;if(e.length<=r)return e;for(var a=e.length%r,n=e.substr(0,a);a!=e.length;a+=r)n+=(n.length>0?",":"")+e.substr(a,r);return n}var lh=/%/g;function rx(e,r,a){var n=r.replace(lh,""),s=r.length-n.length;return fa(e,n,a*Math.pow(10,2*s))+Et("%",s)}function ax(e,r,a){for(var n=r.length-1;r.charCodeAt(n-1)===44;)--n;return fa(e,r.substr(0,n),a/Math.pow(10,3*(r.length-n)))}function dh(e,r){var a,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(r==0)return"0.0E+0";if(r<0)return"-"+dh(e,-r);var s=e.indexOf(".");s===-1&&(s=e.indexOf("E"));var i=Math.floor(Math.log(r)*Math.LOG10E)%s;if(i<0&&(i+=s),a=(r/Math.pow(10,i)).toPrecision(n+1+(s+i)%s),a.indexOf("e")===-1){var c=Math.floor(Math.log(r)*Math.LOG10E);for(a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+i):a+="E+"+(c-i);a.substr(0,2)==="0.";)a=a.charAt(0)+a.substr(2,s)+"."+a.substr(2+s),a=a.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,d,u){return l+d+u.substr(0,(s+i)%s)+"."+u.substr(i)+"E"})}else a=r.toExponential(n);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}var uh=/# (\?+)( ?)\/( ?)(\d+)/;function nx(e,r,a){var n=parseInt(e[4],10),s=Math.round(r*n),i=Math.floor(s/n),c=s-i*n,o=n;return a+(i===0?"":""+i)+" "+(c===0?Et(" ",e[1].length+1+e[4].length):jo(c,e[1].length)+e[2]+"/"+e[3]+Vr(o,e[4].length))}function sx(e,r,a){return a+(r===0?"":""+r)+Et(" ",e[1].length+2+e[4].length)}var hh=/^#*0*\.([0#]+)/,fh=/\).*[0#]/,ph=/\(###\) ###\\?-####/;function or(e){for(var r="",a,n=0;n!=e.length;++n)switch(a=e.charCodeAt(n)){case 35:break;case 63:r+=" ";break;case 48:r+="0";break;default:r+=String.fromCharCode(a)}return r}function Ol(e,r){var a=Math.pow(10,r);return""+Math.round(e*a)/a}function Ll(e,r){var a=e-Math.floor(e),n=Math.pow(10,r);return r<(""+Math.round(a*n)).length?0:Math.round(a*n)}function ix(e,r){return r<(""+Math.round((e-Math.floor(e))*Math.pow(10,r))).length?1:0}function cx(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Cr(e,r,a){if(e.charCodeAt(0)===40&&!r.match(fh)){var n=r.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Cr("n",n,a):"("+Cr("n",n,-a)+")"}if(r.charCodeAt(r.length-1)===44)return ax(e,r,a);if(r.indexOf("%")!==-1)return rx(e,r,a);if(r.indexOf("E")!==-1)return dh(r,a);if(r.charCodeAt(0)===36)return"$"+Cr(e,r.substr(r.charAt(1)==" "?2:1),a);var s,i,c,o,l=Math.abs(a),d=a<0?"-":"";if(r.match(/^00+$/))return d+vn(l,r.length);if(r.match(/^[#?]+$/))return s=vn(a,0),s==="0"&&(s=""),s.length>r.length?s:or(r.substr(0,r.length-s.length))+s;if(i=r.match(uh))return nx(i,l,d);if(r.match(/^#+0+$/))return d+vn(l,r.length-r.indexOf("0"));if(i=r.match(hh))return s=Ol(a,i[1].length).replace(/^([^\.]+)$/,"$1."+or(i[1])).replace(/\.$/,"."+or(i[1])).replace(/\.(\d*)$/,function(x,p){return"."+p+Et("0",or(i[1]).length-p.length)}),r.indexOf("0.")!==-1?s:s.replace(/^0\./,".");if(r=r.replace(/^#+([0.])/,"$1"),i=r.match(/^(0*)\.(#*)$/))return d+Ol(l,i[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=r.match(/^#{1,3},##0(\.?)$/))return d+Ea(vn(l,0));if(i=r.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Cr(e,r,-a):Ea(""+(Math.floor(a)+ix(a,i[1].length)))+"."+Vr(Ll(a,i[1].length),i[1].length);if(i=r.match(/^#,#*,#0/))return Cr(e,r.replace(/^#,#*,/,""),a);if(i=r.match(/^([0#]+)(\\?-([0#]+))+$/))return s=Tn(Cr(e,r.replace(/[\\-]/g,""),a)),c=0,Tn(Tn(r.replace(/\\/g,"")).replace(/[0#]/g,function(x){return c<s.length?s.charAt(c++):x==="0"?"0":""}));if(r.match(ph))return s=Cr(e,"##########",a),"("+s.substr(0,3)+") "+s.substr(3,3)+"-"+s.substr(6);var u="";if(i=r.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(i[4].length,7),o=ji(l,Math.pow(10,c)-1,!1),s=""+d,u=fa("n",i[1],o[1]),u.charAt(u.length-1)==" "&&(u=u.substr(0,u.length-1)+"0"),s+=u+i[2]+"/"+i[3],u=_i(o[2],c),u.length<i[4].length&&(u=or(i[4].substr(i[4].length-u.length))+u),s+=u,s;if(i=r.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(i[1].length,i[4].length),7),o=ji(l,Math.pow(10,c)-1,!0),d+(o[0]||(o[1]?"":"0"))+" "+(o[1]?jo(o[1],c)+i[2]+"/"+i[3]+_i(o[2],c):Et(" ",2*c+1+i[2].length+i[3].length));if(i=r.match(/^[#0?]+$/))return s=vn(a,0),r.length<=s.length?s:or(r.substr(0,r.length-s.length))+s;if(i=r.match(/^([#0?]+)\.([#0]+)$/)){s=""+a.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),c=s.indexOf(".");var h=r.indexOf(".")-c,f=r.length-s.length-h;return or(r.substr(0,h)+s+r.substr(r.length-f))}if(i=r.match(/^00,000\.([#0]*0)$/))return c=Ll(a,i[1].length),a<0?"-"+Cr(e,r,-a):Ea(cx(a)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(x){return"00,"+(x.length<3?Vr(0,3-x.length):"")+x})+"."+Vr(c,i[1].length);switch(r){case"###,##0.00":return Cr(e,"#,##0.00",a);case"###,###":case"##,###":case"#,###":var m=Ea(vn(l,0));return m!=="0"?d+m:"";case"###,###.00":return Cr(e,"###,##0.00",a).replace(/^0\./,".");case"#,###.00":return Cr(e,"#,##0.00",a).replace(/^0\./,".")}throw new Error("unsupported format |"+r+"|")}function ox(e,r,a){for(var n=r.length-1;r.charCodeAt(n-1)===44;)--n;return fa(e,r.substr(0,n),a/Math.pow(10,3*(r.length-n)))}function lx(e,r,a){var n=r.replace(lh,""),s=r.length-n.length;return fa(e,n,a*Math.pow(10,2*s))+Et("%",s)}function mh(e,r){var a,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(r==0)return"0.0E+0";if(r<0)return"-"+mh(e,-r);var s=e.indexOf(".");s===-1&&(s=e.indexOf("E"));var i=Math.floor(Math.log(r)*Math.LOG10E)%s;if(i<0&&(i+=s),a=(r/Math.pow(10,i)).toPrecision(n+1+(s+i)%s),!a.match(/[Ee]/)){var c=Math.floor(Math.log(r)*Math.LOG10E);a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+i):a+="E+"+(c-i),a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,d,u){return l+d+u.substr(0,(s+i)%s)+"."+u.substr(i)+"E"})}else a=r.toExponential(n);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}function Zr(e,r,a){if(e.charCodeAt(0)===40&&!r.match(fh)){var n=r.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Zr("n",n,a):"("+Zr("n",n,-a)+")"}if(r.charCodeAt(r.length-1)===44)return ox(e,r,a);if(r.indexOf("%")!==-1)return lx(e,r,a);if(r.indexOf("E")!==-1)return mh(r,a);if(r.charCodeAt(0)===36)return"$"+Zr(e,r.substr(r.charAt(1)==" "?2:1),a);var s,i,c,o,l=Math.abs(a),d=a<0?"-":"";if(r.match(/^00+$/))return d+Vr(l,r.length);if(r.match(/^[#?]+$/))return s=""+a,a===0&&(s=""),s.length>r.length?s:or(r.substr(0,r.length-s.length))+s;if(i=r.match(uh))return sx(i,l,d);if(r.match(/^#+0+$/))return d+Vr(l,r.length-r.indexOf("0"));if(i=r.match(hh))return s=(""+a).replace(/^([^\.]+)$/,"$1."+or(i[1])).replace(/\.$/,"."+or(i[1])),s=s.replace(/\.(\d*)$/,function(x,p){return"."+p+Et("0",or(i[1]).length-p.length)}),r.indexOf("0.")!==-1?s:s.replace(/^0\./,".");if(r=r.replace(/^#+([0.])/,"$1"),i=r.match(/^(0*)\.(#*)$/))return d+(""+l).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=r.match(/^#{1,3},##0(\.?)$/))return d+Ea(""+l);if(i=r.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Zr(e,r,-a):Ea(""+a)+"."+Et("0",i[1].length);if(i=r.match(/^#,#*,#0/))return Zr(e,r.replace(/^#,#*,/,""),a);if(i=r.match(/^([0#]+)(\\?-([0#]+))+$/))return s=Tn(Zr(e,r.replace(/[\\-]/g,""),a)),c=0,Tn(Tn(r.replace(/\\/g,"")).replace(/[0#]/g,function(x){return c<s.length?s.charAt(c++):x==="0"?"0":""}));if(r.match(ph))return s=Zr(e,"##########",a),"("+s.substr(0,3)+") "+s.substr(3,3)+"-"+s.substr(6);var u="";if(i=r.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(i[4].length,7),o=ji(l,Math.pow(10,c)-1,!1),s=""+d,u=fa("n",i[1],o[1]),u.charAt(u.length-1)==" "&&(u=u.substr(0,u.length-1)+"0"),s+=u+i[2]+"/"+i[3],u=_i(o[2],c),u.length<i[4].length&&(u=or(i[4].substr(i[4].length-u.length))+u),s+=u,s;if(i=r.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(i[1].length,i[4].length),7),o=ji(l,Math.pow(10,c)-1,!0),d+(o[0]||(o[1]?"":"0"))+" "+(o[1]?jo(o[1],c)+i[2]+"/"+i[3]+_i(o[2],c):Et(" ",2*c+1+i[2].length+i[3].length));if(i=r.match(/^[#0?]+$/))return s=""+a,r.length<=s.length?s:or(r.substr(0,r.length-s.length))+s;if(i=r.match(/^([#0]+)\.([#0]+)$/)){s=""+a.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),c=s.indexOf(".");var h=r.indexOf(".")-c,f=r.length-s.length-h;return or(r.substr(0,h)+s+r.substr(r.length-f))}if(i=r.match(/^00,000\.([#0]*0)$/))return a<0?"-"+Zr(e,r,-a):Ea(""+a).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(x){return"00,"+(x.length<3?Vr(0,3-x.length):"")+x})+"."+Vr(0,i[1].length);switch(r){case"###,###":case"##,###":case"#,###":var m=Ea(""+l);return m!=="0"?d+m:"";default:if(r.match(/\.[0#?]*$/))return Zr(e,r.slice(0,r.lastIndexOf(".")),a)+or(r.slice(r.lastIndexOf(".")))}throw new Error("unsupported format |"+r+"|")}function fa(e,r,a){return(a|0)===a?Zr(e,r,a):Cr(e,r,a)}function dx(e){for(var r=[],a=!1,n=0,s=0;n<e.length;++n)switch(e.charCodeAt(n)){case 34:a=!a;break;case 95:case 42:case 92:++n;break;case 59:r[r.length]=e.substr(s,n-s),s=n+1}if(r[r.length]=e.substr(s),a===!0)throw new Error("Format |"+e+"| unterminated string ");return r}var xh=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function Wn(e){for(var r=0,a="",n="";r<e.length;)switch(a=e.charAt(r)){case"G":bi(e,r)&&(r+=6),r++;break;case'"':for(;e.charCodeAt(++r)!==34&&r<e.length;);++r;break;case"\\":r+=2;break;case"_":r+=2;break;case"@":++r;break;case"B":case"b":if(e.charAt(r+1)==="1"||e.charAt(r+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"ä¸":if(e.substr(r,3).toUpperCase()==="A/P"||e.substr(r,5).toUpperCase()==="AM/PM"||e.substr(r,5).toUpperCase()==="ä¸å/ä¸å")return!0;++r;break;case"[":for(n=a;e.charAt(r++)!=="]"&&r<e.length;)n+=e.charAt(r);if(n.match(xh))return!0;break;case".":case"0":case"#":for(;r<e.length&&("0#?.,E+-%".indexOf(a=e.charAt(++r))>-1||a=="\\"&&e.charAt(r+1)=="-"&&"0#".indexOf(e.charAt(r+2))>-1););break;case"?":for(;e.charAt(++r)===a;);break;case"*":++r,(e.charAt(r)==" "||e.charAt(r)=="*")&&++r;break;case"(":case")":++r;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;r<e.length&&"0123456789".indexOf(e.charAt(++r))>-1;);break;case" ":++r;break;default:++r;break}return!1}function ux(e,r,a,n){for(var s=[],i="",c=0,o="",l="t",d,u,h,f="H";c<e.length;)switch(o=e.charAt(c)){case"G":if(!bi(e,c))throw new Error("unrecognized character "+o+" in "+e);s[s.length]={t:"G",v:"General"},c+=7;break;case'"':for(i="";(h=e.charCodeAt(++c))!==34&&c<e.length;)i+=String.fromCharCode(h);s[s.length]={t:"t",v:i},++c;break;case"\\":var m=e.charAt(++c),x=m==="("||m===")"?m:"t";s[s.length]={t:x,v:m},++c;break;case"_":s[s.length]={t:"t",v:" "},c+=2;break;case"@":s[s.length]={t:"T",v:r},++c;break;case"B":case"b":if(e.charAt(c+1)==="1"||e.charAt(c+1)==="2"){if(d==null&&(d=Ga(r,a,e.charAt(c+1)==="2"),d==null))return"";s[s.length]={t:"X",v:e.substr(c,2)},l=o,c+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":o=o.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(r<0||d==null&&(d=Ga(r,a),d==null))return"";for(i=o;++c<e.length&&e.charAt(c).toLowerCase()===o;)i+=o;o==="m"&&l.toLowerCase()==="h"&&(o="M"),o==="h"&&(o=f),s[s.length]={t:o,v:i},l=o;break;case"A":case"a":case"ä¸":var p={t:o,v:o};if(d==null&&(d=Ga(r,a)),e.substr(c,3).toUpperCase()==="A/P"?(d!=null&&(p.v=d.H>=12?"P":"A"),p.t="T",f="h",c+=3):e.substr(c,5).toUpperCase()==="AM/PM"?(d!=null&&(p.v=d.H>=12?"PM":"AM"),p.t="T",c+=5,f="h"):e.substr(c,5).toUpperCase()==="ä¸å/ä¸å"?(d!=null&&(p.v=d.H>=12?"ä¸å":"ä¸å"),p.t="T",c+=5,f="h"):(p.t="t",++c),d==null&&p.t==="T")return"";s[s.length]=p,l=o;break;case"[":for(i=o;e.charAt(c++)!=="]"&&c<e.length;)i+=e.charAt(c);if(i.slice(-1)!=="]")throw'unterminated "[" block: |'+i+"|";if(i.match(xh)){if(d==null&&(d=Ga(r,a),d==null))return"";s[s.length]={t:"Z",v:i.toLowerCase()},l=i.charAt(1)}else i.indexOf("$")>-1&&(i=(i.match(/\$([^-\[\]]*)/)||[])[1]||"$",Wn(e)||(s[s.length]={t:"t",v:i}));break;case".":if(d!=null){for(i=o;++c<e.length&&(o=e.charAt(c))==="0";)i+=o;s[s.length]={t:"s",v:i};break}case"0":case"#":for(i=o;++c<e.length&&"0#?.,E+-%".indexOf(o=e.charAt(c))>-1;)i+=o;s[s.length]={t:"n",v:i};break;case"?":for(i=o;e.charAt(++c)===o;)i+=o;s[s.length]={t:o,v:i},l=o;break;case"*":++c,(e.charAt(c)==" "||e.charAt(c)=="*")&&++c;break;case"(":case")":s[s.length]={t:n===1?"t":o,v:o},++c;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(i=o;c<e.length&&"0123456789".indexOf(e.charAt(++c))>-1;)i+=e.charAt(c);s[s.length]={t:"D",v:i};break;case" ":s[s.length]={t:o,v:o},++c;break;case"$":s[s.length]={t:"t",v:"$"},++c;break;default:if(",$-+/():!^&'~{}<>=â¬acfijklopqrtuvwxzP".indexOf(o)===-1)throw new Error("unrecognized character "+o+" in "+e);s[s.length]={t:"t",v:o},++c;break}var g=0,w=0,S;for(c=s.length-1,l="t";c>=0;--c)switch(s[c].t){case"h":case"H":s[c].t=f,l="h",g<1&&(g=1);break;case"s":(S=s[c].v.match(/\.0+$/))&&(w=Math.max(w,S[0].length-1)),g<3&&(g=3);case"d":case"y":case"M":case"e":l=s[c].t;break;case"m":l==="s"&&(s[c].t="M",g<2&&(g=2));break;case"X":break;case"Z":g<1&&s[c].v.match(/[Hh]/)&&(g=1),g<2&&s[c].v.match(/[Mm]/)&&(g=2),g<3&&s[c].v.match(/[Ss]/)&&(g=3)}switch(g){case 0:break;case 1:d.u>=.5&&(d.u=0,++d.S),d.S>=60&&(d.S=0,++d.M),d.M>=60&&(d.M=0,++d.H);break;case 2:d.u>=.5&&(d.u=0,++d.S),d.S>=60&&(d.S=0,++d.M);break}var b="",j;for(c=0;c<s.length;++c)switch(s[c].t){case"t":case"T":case" ":case"D":break;case"X":s[c].v="",s[c].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":s[c].v=tx(s[c].t.charCodeAt(0),s[c].v,d,w),s[c].t="t";break;case"n":case"?":for(j=c+1;s[j]!=null&&((o=s[j].t)==="?"||o==="D"||(o===" "||o==="t")&&s[j+1]!=null&&(s[j+1].t==="?"||s[j+1].t==="t"&&s[j+1].v==="/")||s[c].t==="("&&(o===" "||o==="n"||o===")")||o==="t"&&(s[j].v==="/"||s[j].v===" "&&s[j+1]!=null&&s[j+1].t=="?"));)s[c].v+=s[j].v,s[j]={v:"",t:";"},++j;b+=s[c].v,c=j-1;break;case"G":s[c].t="t",s[c].v=tn(r,a);break}var k="",N,C;if(b.length>0){b.charCodeAt(0)==40?(N=r<0&&b.charCodeAt(0)===45?-r:r,C=fa("n",b,N)):(N=r<0&&n>1?-r:r,C=fa("n",b,N),N<0&&s[0]&&s[0].t=="t"&&(C=C.substr(1),s[0].v="-"+s[0].v)),j=C.length-1;var P=s.length;for(c=0;c<s.length;++c)if(s[c]!=null&&s[c].t!="t"&&s[c].v.indexOf(".")>-1){P=c;break}var T=s.length;if(P===s.length&&C.indexOf("E")===-1){for(c=s.length-1;c>=0;--c)s[c]==null||"n?".indexOf(s[c].t)===-1||(j>=s[c].v.length-1?(j-=s[c].v.length,s[c].v=C.substr(j+1,s[c].v.length)):j<0?s[c].v="":(s[c].v=C.substr(0,j+1),j=-1),s[c].t="t",T=c);j>=0&&T<s.length&&(s[T].v=C.substr(0,j+1)+s[T].v)}else if(P!==s.length&&C.indexOf("E")===-1){for(j=C.indexOf(".")-1,c=P;c>=0;--c)if(!(s[c]==null||"n?".indexOf(s[c].t)===-1)){for(u=s[c].v.indexOf(".")>-1&&c===P?s[c].v.indexOf(".")-1:s[c].v.length-1,k=s[c].v.substr(u+1);u>=0;--u)j>=0&&(s[c].v.charAt(u)==="0"||s[c].v.charAt(u)==="#")&&(k=C.charAt(j--)+k);s[c].v=k,s[c].t="t",T=c}for(j>=0&&T<s.length&&(s[T].v=C.substr(0,j+1)+s[T].v),j=C.indexOf(".")+1,c=P;c<s.length;++c)if(!(s[c]==null||"n?(".indexOf(s[c].t)===-1&&c!==P)){for(u=s[c].v.indexOf(".")>-1&&c===P?s[c].v.indexOf(".")+1:0,k=s[c].v.substr(0,u);u<s[c].v.length;++u)j<C.length&&(k+=C.charAt(j++));s[c].v=k,s[c].t="t",T=c}}}for(c=0;c<s.length;++c)s[c]!=null&&"n?".indexOf(s[c].t)>-1&&(N=n>1&&r<0&&c>0&&s[c-1].v==="-"?-r:r,s[c].v=fa(s[c].t,s[c].v,N),s[c].t="t");var L="";for(c=0;c!==s.length;++c)s[c]!=null&&(L+=s[c].v);return L}var Bl=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function Ml(e,r){if(r==null)return!1;var a=parseFloat(r[2]);switch(r[1]){case"=":if(e==a)return!0;break;case">":if(e>a)return!0;break;case"<":if(e<a)return!0;break;case"<>":if(e!=a)return!0;break;case">=":if(e>=a)return!0;break;case"<=":if(e<=a)return!0;break}return!1}function hx(e,r){var a=dx(e),n=a.length,s=a[n-1].indexOf("@");if(n<4&&s>-1&&--n,a.length>4)throw new Error("cannot find right format for |"+a.join("|")+"|");if(typeof r!="number")return[4,a.length===4||s>-1?a[a.length-1]:"@"];switch(a.length){case 1:a=s>-1?["General","General","General",a[0]]:[a[0],a[0],a[0],"@"];break;case 2:a=s>-1?[a[0],a[0],a[0],a[1]]:[a[0],a[1],a[0],"@"];break;case 3:a=s>-1?[a[0],a[1],a[0],a[2]]:[a[0],a[1],a[2],"@"];break}var i=r>0?a[0]:r<0?a[1]:a[2];if(a[0].indexOf("[")===-1&&a[1].indexOf("[")===-1)return[n,i];if(a[0].match(/\[[=<>]/)!=null||a[1].match(/\[[=<>]/)!=null){var c=a[0].match(Bl),o=a[1].match(Bl);return Ml(r,c)?[n,a[0]]:Ml(r,o)?[n,a[1]]:[n,a[c!=null&&o!=null?2:1]]}return[n,i]}function Br(e,r,a){a==null&&(a={});var n="";switch(typeof e){case"string":e=="m/d/yy"&&a.dateNF?n=a.dateNF:n=e;break;case"number":e==14&&a.dateNF?n=a.dateNF:n=(a.table!=null?a.table:He)[e],n==null&&(n=a.table&&a.table[Rl[e]]||He[Rl[e]]),n==null&&(n=Xm[e]||"General");break}if(bi(n,0))return tn(r,a);r instanceof Date&&(r=oh(r,a.date1904));var s=hx(n,r);if(bi(s[1]))return tn(r,a);if(r===!0)r="TRUE";else if(r===!1)r="FALSE";else if(r===""||r==null)return"";return ux(s[1],r,a,s[0])}function pa(e,r){if(typeof r!="number"){r=+r||-1;for(var a=0;a<392;++a){if(He[a]==null){r<0&&(r=a);continue}if(He[a]==e){r=a;break}}r<0&&(r=391)}return He[r]=e,r}function Ui(e){for(var r=0;r!=392;++r)e[r]!==void 0&&pa(e[r],r)}function Vn(){He=Gm()}var fx={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},gh=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function px(e){var r=typeof e=="number"?He[e]:e;return r=r.replace(gh,"(\\d+)"),new RegExp("^"+r+"$")}function mx(e,r,a){var n=-1,s=-1,i=-1,c=-1,o=-1,l=-1;
vendor: 4,589 bytes, line 471
471(r.match(gh)||[]).forEach(function(h,f){var m=parseInt(a[f+1],10);switch(h.toLowerCase().charAt(0)){case"y":n=m;break;case"d":i=m;break;case"h":c=m;break;case"s":l=m;break;case"m":c>=0?o=m:s=m;break}}),l>=0&&o==-1&&s>=0&&(o=s,s=-1);var d=(""+(n>=0?n:new Date().getFullYear())).slice(-4)+"-"+("00"+(s>=1?s:1)).slice(-2)+"-"+("00"+(i>=1?i:1)).slice(-2);d.length==7&&(d="0"+d),d.length==8&&(d="20"+d);var u=("00"+(c>=0?c:0)).slice(-2)+":"+("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2);return c==-1&&o==-1&&l==-1?d:n==-1&&s==-1&&i==-1?u:d+"T"+u}var xx=(function(){var e={};e.version="1.2.0";function r(){for(var C=0,P=new Array(256),T=0;T!=256;++T)C=T,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,C=C&1?-306674912^C>>>1:C>>>1,P[T]=C;return typeof Int32Array<"u"?new Int32Array(P):P}var a=r();function n(C){var P=0,T=0,L=0,M=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(L=0;L!=256;++L)M[L]=C[L];for(L=0;L!=256;++L)for(T=C[L],P=256+L;P<4096;P+=256)T=M[P]=T>>>8^C[T&255];var E=[];for(L=1;L!=16;++L)E[L-1]=typeof Int32Array<"u"?M.subarray(L*256,L*256+256):M.slice(L*256,L*256+256);return E}var s=n(a),i=s[0],c=s[1],o=s[2],l=s[3],d=s[4],u=s[5],h=s[6],f=s[7],m=s[8],x=s[9],p=s[10],g=s[11],w=s[12],S=s[13],b=s[14];function j(C,P){for(var T=P^-1,L=0,M=C.length;L<M;)T=T>>>8^a[(T^C.charCodeAt(L++))&255];return~T}function k(C,P){for(var T=P^-1,L=C.length-15,M=0;M<L;)T=b[C[M++]^T&255]^S[C[M++]^T>>8&255]^w[C[M++]^T>>16&255]^g[C[M++]^T>>>24]^p[C[M++]]^x[C[M++]]^m[C[M++]]^f[C[M++]]^h[C[M++]]^u[C[M++]]^d[C[M++]]^l[C[M++]]^o[C[M++]]^c[C[M++]]^i[C[M++]]^a[C[M++]];for(L+=15;M<L;)T=T>>>8^a[(T^C[M++])&255];return~T}function N(C,P){for(var T=P^-1,L=0,M=C.length,E=0,W=0;L<M;)E=C.charCodeAt(L++),E<128?T=T>>>8^a[(T^E)&255]:E<2048?(T=T>>>8^a[(T^(192|E>>6&31))&255],T=T>>>8^a[(T^(128|E&63))&255]):E>=55296&&E<57344?(E=(E&1023)+64,W=C.charCodeAt(L++)&1023,T=T>>>8^a[(T^(240|E>>8&7))&255],T=T>>>8^a[(T^(128|E>>2&63))&255],T=T>>>8^a[(T^(128|W>>6&15|(E&3)<<4))&255],T=T>>>8^a[(T^(128|W&63))&255]):(T=T>>>8^a[(T^(224|E>>12&15))&255],T=T>>>8^a[(T^(128|E>>6&63))&255],T=T>>>8^a[(T^(128|E&63))&255]);return~T}return e.table=a,e.bstr=j,e.buf=k,e.str=N,e})(),Be=(function(){var r={};r.version="1.2.1";function a(O,_){for(var R=O.split("/"),B=_.split("/"),U=0,H=0,v=Math.min(R.length,B.length);U<v;++U){if(H=R[U].length-B[U].length)return H;if(R[U]!=B[U])return R[U]<B[U]?-1:1}return R.length-B.length}function n(O){if(O.charAt(O.length-1)=="/")return O.slice(0,-1).indexOf("/")===-1?O:n(O.slice(0,-1));var _=O.lastIndexOf("/");return _===-1?O:O.slice(0,_+1)}function s(O){if(O.charAt(O.length-1)=="/")return s(O.slice(0,-1));var _=O.lastIndexOf("/");return _===-1?O:O.slice(_+1)}function i(O,_){typeof _=="string"&&(_=new Date(_));var R=_.getHours();R=R<<6|_.getMinutes(),R=R<<5|_.getSeconds()>>>1,O.write_shift(2,R);var B=_.getFullYear()-1980;B=B<<4|_.getMonth()+1,B=B<<5|_.getDate(),O.write_shift(2,B)}function c(O){var _=O.read_shift(2)&65535,R=O.read_shift(2)&65535,B=new Date,U=R&31;R>>>=5;var H=R&15;R>>>=4,B.setMilliseconds(0),B.setFullYear(R+1980),B.setMonth(H-1),B.setDate(U);var v=_&31;_>>>=5;var X=_&63;return _>>>=6,B.setHours(_),B.setMinutes(X),B.setSeconds(v<<1),B}function o(O){Jt(O,0);for(var _={},R=0;O.l<=O.length-4;){var B=O.read_shift(2),U=O.read_shift(2),H=O.l+U,v={};switch(B){case 21589:R=O.read_shift(1),R&1&&(v.mtime=O.read_shift(4)),U>5&&(R&2&&(v.atime=O.read_shift(4)),R&4&&(v.ctime=O.read_shift(4))),v.mtime&&(v.mt=new Date(v.mtime*1e3));break}O.l=H,_[B]=v}return _}var l;function d(){return l||(l={})}function u(O,_){if(O[0]==80&&O[1]==75)return Xe(O,_);if((O[0]|32)==109&&(O[1]|32)==105)return lt(O,_);if(O.length<512)throw new Error("CFB file size "+O.length+" < 512");var R=3,B=512,U=0,H=0,v=0,X=0,G=0,Q=[],ae=O.slice(0,512);Jt(ae,0);var me=h(ae);switch(R=me[0],R){case 3:B=512;break;case 4:B=4096;break;case 0:if(me[1]==0)return Xe(O,_);default:throw new Error("Major Version: Expected 3 or 4 saw "+R)}B!==512&&(ae=O.slice(0,B),Jt(ae,28));var ke=O.slice(0,B);f(ae,R);var Ie=ae.read_shift(4,"i");if(R===3&&Ie!==0)throw new Error("# Directory Sectors: Expected 0 saw "+Ie);ae.l+=4,v=ae.read_shift(4,"i"),ae.l+=4,ae.chk("00100000","Mini Stream Cutoff Size: "),X=ae.read_shift(4,"i"),U=ae.read_shift(4,"i"),G=ae.read_shift(4,"i"),H=ae.read_shift(4,"i");for(var _e=-1,Fe=0;Fe<109&&(_e=ae.read_shift(4,"i"),!(_e<0));++Fe)Q[Fe]=_e;var $e=m(O,B);g(G,H,$e,B,Q);var yt=S($e,v,Q,B);yt[v].name="!Directory",U>
vendor: 1,043 bytes, line 471
4710&&X!==W&&(yt[X].name="!MiniFAT"),yt[Q[0]].name="!FAT",yt.fat_addrs=Q,yt.ssz=B;var _t={},Ut=[],bt=[],Kn=[];b(v,yt,$e,Ut,U,_t,bt,X),x(bt,Kn,Ut),Ut.shift();var Yn={FileIndex:bt,FullPaths:Kn};return _&&_.raw&&(Yn.raw={header:ke,sectors:$e}),Yn}function h(O){if(O[O.l]==80&&O[O.l+1]==75)return[0,0];O.chk(ee,"Header Signature: "),O.l+=16;var _=O.read_shift(2,"u");return[O.read_shift(2,"u"),_]}function f(O,_){var R=9;switch(O.l+=2,R=O.read_shift(2)){case 9:if(_!=3)throw new Error("Sector Shift: Expected 9 saw "+R);break;case 12:if(_!=4)throw new Error("Sector Shift: Expected 12 saw "+R);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+R)}O.chk("0600","Mini Sector Shift: "),O.chk("000000000000","Reserved: ")}function m(O,_){for(var R=Math.ceil(O.length/_)-1,B=[],U=1;U<R;++U)B[U-1]=O.slice(U*_,(U+1)*_);return B[R-1]=O.slice(R*_),B}function x(O,_,R){for(var B=0,U=0,H=0,v=0,X=0,G=R.length,Q=[],ae=[];B<G;++B)Q[B]=ae[B]=B,_[B]=R[B];for(;X<ae.length;++X)B=ae[X],U=O[B].L,H=O[B].R,v=O[B].C,Q[B]===B&&(U!==-1&&Q[U]!==U&&(Q[B]=
vendor: 5,354 bytes, line 471
471Q[U]),H!==-1&&Q[H]!==H&&(Q[B]=Q[H])),v!==-1&&(Q[v]=B),U!==-1&&B!=Q[B]&&(Q[U]=Q[B],ae.lastIndexOf(U)<X&&ae.push(U)),H!==-1&&B!=Q[B]&&(Q[H]=Q[B],ae.lastIndexOf(H)<X&&ae.push(H));for(B=1;B<G;++B)Q[B]===B&&(H!==-1&&Q[H]!==H?Q[B]=Q[H]:U!==-1&&Q[U]!==U&&(Q[B]=Q[U]));for(B=1;B<G;++B)if(O[B].type!==0){if(X=B,X!=Q[X])do X=Q[X],_[B]=_[X]+"/"+_[B];while(X!==0&&Q[X]!==-1&&X!=Q[X]);Q[B]=-1}for(_[0]+="/",B=1;B<G;++B)O[B].type!==2&&(_[B]+="/")}function p(O,_,R){for(var B=O.start,U=O.size,H=[],v=B;R&&U>0&&v>=0;)H.push(_.slice(v*E,v*E+E)),U-=E,v=qa(R,v*4);return H.length===0?pe(0):Gt(H).slice(0,O.size)}function g(O,_,R,B,U){var H=W;if(O===W){if(_!==0)throw new Error("DIFAT chain shorter than expected")}else if(O!==-1){var v=R[O],X=(B>>>2)-1;if(!v)return;for(var G=0;G<X&&(H=qa(v,G*4))!==W;++G)U.push(H);g(qa(v,B-4),_-1,R,B,U)}}function w(O,_,R,B,U){var H=[],v=[];U||(U=[]);var X=B-1,G=0,Q=0;for(G=_;G>=0;){U[G]=!0,H[H.length]=G,v.push(O[G]);var ae=R[Math.floor(G*4/B)];if(Q=G*4&X,B<4+Q)throw new Error("FAT boundary crossed: "+G+" 4 "+B);if(!O[ae])break;G=qa(O[ae],Q)}return{nodes:H,data:Jl([v])}}function S(O,_,R,B){var U=O.length,H=[],v=[],X=[],G=[],Q=B-1,ae=0,me=0,ke=0,Ie=0;for(ae=0;ae<U;++ae)if(X=[],ke=ae+_,ke>=U&&(ke-=U),!v[ke]){G=[];var _e=[];for(me=ke;me>=0;){_e[me]=!0,v[me]=!0,X[X.length]=me,G.push(O[me]);var Fe=R[Math.floor(me*4/B)];if(Ie=me*4&Q,B<4+Ie)throw new Error("FAT boundary crossed: "+me+" 4 "+B);if(!O[Fe]||(me=qa(O[Fe],Ie),_e[me]))break}H[ke]={nodes:X,data:Jl([G])}}return H}function b(O,_,R,B,U,H,v,X){for(var G=0,Q=B.length?2:0,ae=_[O].data,me=0,ke=0,Ie;me<ae.length;me+=128){var _e=ae.slice(me,me+128);Jt(_e,64),ke=_e.read_shift(2),Ie=Ao(_e,0,ke-Q),B.push(Ie);var Fe={name:Ie,type:_e.read_shift(1),color:_e.read_shift(1),L:_e.read_shift(4,"i"),R:_e.read_shift(4,"i"),C:_e.read_shift(4,"i"),clsid:_e.read_shift(16),state:_e.read_shift(4,"i"),start:0,size:0},$e=_e.read_shift(2)+_e.read_shift(2)+_e.read_shift(2)+_e.read_shift(2);$e!==0&&(Fe.ct=j(_e,_e.l-8));var yt=_e.read_shift(2)+_e.read_shift(2)+_e.read_shift(2)+_e.read_shift(2);yt!==0&&(Fe.mt=j(_e,_e.l-8)),Fe.start=_e.read_shift(4,"i"),Fe.size=_e.read_shift(4,"i"),Fe.size<0&&Fe.start<0&&(Fe.size=Fe.type=0,Fe.start=W,Fe.name=""),Fe.type===5?(G=Fe.start,U>0&&G!==W&&(_[G].name="!StreamData")):Fe.size>=4096?(Fe.storage="fat",_[Fe.start]===void 0&&(_[Fe.start]=w(R,Fe.start,_.fat_addrs,_.ssz)),_[Fe.start].name=Fe.name,Fe.content=_[Fe.start].data.slice(0,Fe.size)):(Fe.storage="minifat",Fe.size<0?Fe.size=0:G!==W&&Fe.start!==W&&_[G]&&(Fe.content=p(Fe,_[G].data,(_[X]||{}).data))),Fe.content&&Jt(Fe.content,0),H[Ie]=Fe,v.push(Fe)}}function j(O,_){return new Date((br(O,_+4)/1e7*Math.pow(2,32)+br(O,_)/1e7-11644473600)*1e3)}function k(O,_){return d(),u(l.readFileSync(O),_)}function N(O,_){var R=_&&_.type;switch(R||Je&&Buffer.isBuffer(O)&&(R="buffer"),R||"base64"){case"file":return k(O,_);case"base64":return u(jr(kr(O)),_);case"binary":return u(jr(O),_)}return u(O,_)}function C(O,_){var R=_||{},B=R.root||"Root Entry";if(O.FullPaths||(O.FullPaths=[]),O.FileIndex||(O.FileIndex=[]),O.FullPaths.length!==O.FileIndex.length)throw new Error("inconsistent CFB structure");O.FullPaths.length===0&&(O.FullPaths[0]=B+"/",O.FileIndex[0]={name:B,type:5}),R.CLSID&&(O.FileIndex[0].clsid=R.CLSID),P(O)}function P(O){var _="�Sh33tJ5";if(!Be.find(O,"/"+_)){var R=pe(4);R[0]=55,R[1]=R[3]=50,R[2]=54,O.FileIndex.push({name:_,type:2,content:R,size:4,L:69,R:69,C:69}),O.FullPaths.push(O.FullPaths[0]+_),T(O)}}function T(O,_){C(O);for(var R=!1,B=!1,U=O.FullPaths.length-1;U>=0;--U){var H=O.FileIndex[U];switch(H.type){case 0:B?R=!0:(O.FileIndex.pop(),O.FullPaths.pop());break;case 1:case 2:case 5:B=!0,isNaN(H.R*H.L*H.C)&&(R=!0),H.R>-1&&H.L>-1&&H.R==H.L&&(R=!0);break;default:R=!0;break}}if(!(!R&&!_)){var v=new Date(1987,1,19),X=0,G=Object.create?Object.create(null):{},Q=[];for(U=0;U<O.FullPaths.length;++U)G[O.FullPaths[U]]=!0,O.FileIndex[U].type!==0&&Q.push([O.FullPaths[U],O.FileIndex[U]]);for(U=0;U<Q.length;++U){var ae=n(Q[U][0]);B=G[ae],B||(Q.push([ae,{name:s(ae).replace("/",""),type:1,clsid:ue,ct:v,mt:v,content:null}]),G[ae]=!0)}for(Q.sort(function(Ie,_e){return a(Ie[0],_e[0])}),O.FullPaths=[],O.FileIndex=[],U=0;U<Q.length;++U)O.FullPaths[U]=Q[U][0],O.FileIndex[U]=Q[U][1];for(U=0;U<Q.length;++U){var me=O.FileIndex[U],ke=O.FullPaths[U];if(me.name=s(ke).replace("/",""),me.L=me.R=me.C=-(me.color=1),me.size=me.content?me.content.length:0,me.start=0,me.clsid=me.clsid||ue,U===0)me.C=Q.length>1?1:-1,me.size=0,me.type=5;else if(ke.slice(-1)=="/"){for(X=U+1;X<Q.length&&n(O.FullPaths[X])!=ke;++X);for(me.C=X>=Q.length?-1:X,X=U+1;X<Q.length&&n(O.FullPaths[X])!=n(ke);++X);me.R=X>=Q.length?-1:X,me.type=1}else n(O.FullPaths[U+1]||"")==n(ke)&&(me.R=U+1),me.type=2}}}function L(O,_){var R=_||{};if(R.fileType=="mad")return ca(O,R);switch(T(O),R.fileType){case"zip":return ie(O,R)}var B=(function(Ie){for(var _e=0,Fe=0,$e=0;$e<Ie.FileIndex.length;++$e){var yt=Ie.FileIndex[$e];if(yt.content){var _t=yt.content.length;_t>0&&(_t<4096?_e+=_t+63>>6:Fe+=_t+511>>9)}}for(var Ut=Ie.FullPaths.length+3>>2,bt=_e+7>>3,Kn=_e+127>>7,Yn=bt+Fe+Ut+Kn,za=Yn+127>>7,Ki=za<=109?0:Math.ceil((za-109)/127);Yn+za+Ki+127>>7>za;)Ki=++za<=109?0:Math.ceil((za-109)/127);var oa=[1,Ki,za,Kn,Ut,Fe,_e,0];return Ie.FileIndex[0].size=_e<<6,oa[7]=(Ie.FileIndex[0].start=oa[0]+oa[1]+oa[2]+oa[3]+oa[4]+oa[5])+(oa[6]+7>>3),oa}
vendor: 9,600 bytes, line 471
471)(O),U=pe(B[7]<<9),H=0,v=0;{for(H=0;H<8;++H)U.write_shift(1,ce[H]);for(H=0;H<8;++H)U.write_shift(2,0);for(U.write_shift(2,62),U.write_shift(2,3),U.write_shift(2,65534),U.write_shift(2,9),U.write_shift(2,6),H=0;H<3;++H)U.write_shift(2,0);for(U.write_shift(4,0),U.write_shift(4,B[2]),U.write_shift(4,B[0]+B[1]+B[2]+B[3]-1),U.write_shift(4,0),U.write_shift(4,4096),U.write_shift(4,B[3]?B[0]+B[1]+B[2]-1:W),U.write_shift(4,B[3]),U.write_shift(-4,B[1]?B[0]-1:W),U.write_shift(4,B[1]),H=0;H<109;++H)U.write_shift(-4,H<B[2]?B[1]+H:-1)}if(B[1])for(v=0;v<B[1];++v){for(;H<236+v*127;++H)U.write_shift(-4,H<B[2]?B[1]+H:-1);U.write_shift(-4,v===B[1]-1?W:v+1)}var X=function(Ie){for(v+=Ie;H<v-1;++H)U.write_shift(-4,H+1);Ie&&(++H,U.write_shift(-4,W))};for(v=H=0,v+=B[1];H<v;++H)U.write_shift(-4,te.DIFSECT);for(v+=B[2];H<v;++H)U.write_shift(-4,te.FATSECT);X(B[3]),X(B[4]);for(var G=0,Q=0,ae=O.FileIndex[0];G<O.FileIndex.length;++G)ae=O.FileIndex[G],ae.content&&(Q=ae.content.length,!(Q<4096)&&(ae.start=v,X(Q+511>>9)));for(X(B[6]+7>>3);U.l&511;)U.write_shift(-4,te.ENDOFCHAIN);for(v=H=0,G=0;G<O.FileIndex.length;++G)ae=O.FileIndex[G],ae.content&&(Q=ae.content.length,!(!Q||Q>=4096)&&(ae.start=v,X(Q+63>>6)));for(;U.l&511;)U.write_shift(-4,te.ENDOFCHAIN);for(H=0;H<B[4]<<2;++H){var me=O.FullPaths[H];if(!me||me.length===0){for(G=0;G<17;++G)U.write_shift(4,0);for(G=0;G<3;++G)U.write_shift(4,-1);for(G=0;G<12;++G)U.write_shift(4,0);continue}ae=O.FileIndex[H],H===0&&(ae.start=ae.size?ae.start-1:W);var ke=H===0&&R.root||ae.name;if(Q=2*(ke.length+1),U.write_shift(64,ke,"utf16le"),U.write_shift(2,Q),U.write_shift(1,ae.type),U.write_shift(1,ae.color),U.write_shift(-4,ae.L),U.write_shift(-4,ae.R),U.write_shift(-4,ae.C),ae.clsid)U.write_shift(16,ae.clsid,"hex");else for(G=0;G<4;++G)U.write_shift(4,0);U.write_shift(4,ae.state||0),U.write_shift(4,0),U.write_shift(4,0),U.write_shift(4,0),U.write_shift(4,0),U.write_shift(4,ae.start),U.write_shift(4,ae.size),U.write_shift(4,0)}for(H=1;H<O.FileIndex.length;++H)if(ae=O.FileIndex[H],ae.size>=4096)if(U.l=ae.start+1<<9,Je&&Buffer.isBuffer(ae.content))ae.content.copy(U,U.l,0,ae.size),U.l+=ae.size+511&-512;else{for(G=0;G<ae.size;++G)U.write_shift(1,ae.content[G]);for(;G&511;++G)U.write_shift(1,0)}for(H=1;H<O.FileIndex.length;++H)if(ae=O.FileIndex[H],ae.size>0&&ae.size<4096)if(Je&&Buffer.isBuffer(ae.content))ae.content.copy(U,U.l,0,ae.size),U.l+=ae.size+63&-64;else{for(G=0;G<ae.size;++G)U.write_shift(1,ae.content[G]);for(;G&63;++G)U.write_shift(1,0)}if(Je)U.l=U.length;else for(;U.l<U.length;)U.write_shift(1,0);return U}function M(O,_){var R=O.FullPaths.map(function(G){return G.toUpperCase()}),B=R.map(function(G){var Q=G.split("/");return Q[Q.length-(G.slice(-1)=="/"?2:1)]}),U=!1;_.charCodeAt(0)===47?(U=!0,_=R[0].slice(0,-1)+_):U=_.indexOf("/")!==-1;var H=_.toUpperCase(),v=U===!0?R.indexOf(H):B.indexOf(H);if(v!==-1)return O.FileIndex[v];var X=!H.match(ss);for(H=H.replace(pr,""),X&&(H=H.replace(ss,"!")),v=0;v<R.length;++v)if((X?R[v].replace(ss,"!"):R[v]).replace(pr,"")==H||(X?B[v].replace(ss,"!"):B[v]).replace(pr,"")==H)return O.FileIndex[v];return null}var E=64,W=-2,ee="d0cf11e0a1b11ae1",ce=[208,207,17,224,161,177,26,225],ue="00000000000000000000000000000000",te={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:W,FREESECT:-1,HEADER_SIGNATURE:ee,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:ue,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function fe(O,_,R){d();var B=L(O,R);l.writeFileSync(_,B)}function q(O){for(var _=new Array(O.length),R=0;R<O.length;++R)_[R]=String.fromCharCode(O[R]);return _.join("")}function J(O,_){var R=L(O,_);switch(_&&_.type||"buffer"){case"file":return d(),l.writeFileSync(_.filename,R),R;case"binary":return typeof R=="string"?R:q(R);case"base64":return _s(typeof R=="string"?R:q(R));case"buffer":if(Je)return Buffer.isBuffer(R)?R:ya(R);case"array":return typeof R=="string"?jr(R):R}return R}var le;function A(O){try{var _=O.InflateRaw,R=new _;if(R._processChunk(new Uint8Array([3,0]),R._finishFlushFlag),R.bytesRead)le=O;else throw new Error("zlib does not expose bytesRead")}catch(B){console.error("cannot use native zlib: "+(B.message||B))}}function V(O,_){if(!le)return Oe(O,_);var R=le.InflateRaw,B=new R,U=B._processChunk(O.slice(O.l),B._finishFlushFlag);return O.l+=B.bytesRead,U}function I(O){return le?le.deflateRawSync(O):Me(O)}var D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=[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],z=[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];function Y(O){var _=(O<<1|O<<11)&139536|(O<<5|O<<15)&558144;return(_>>16|_>>8|_)&255}for(var re=typeof Uint8Array<"u",oe=re?new Uint8Array(256):[],Ce=0;Ce<256;++Ce)oe[Ce]=Y(Ce);function F(O,_){var R=oe[O&255];return _<=8?R>>>8-_:(R=R<<8|oe[O>>8&255],_<=16?R>>>16-_:(R=R<<8|oe[O>>16&255],R>>>24-_))}function se(O,_){var R=_&7,B=_>>>3;return(O[B]|(R<=6?0:O[B+1]<<8))>>>R&3}function he(O,_){var R=_&7,B=_>>>3;return(O[B]|(R<=5?0:O[B+1]<<8))>>>R&7}function je(O,_){var R=_&7,B=_>>>3;return(O[B]|(R<=4?0:O[B+1]<<8))>>>R&15}function ve(O,_){var R=_&7,B=_>>>3;return(O[B]|(R<=3?0:O[B+1]<<8))>>>R&31}function ne(O,_){var R=_&7,B=_>>>3;return(O[B]|(R<=1?0:O[B+1]<<8))>>>R&127}function Z(O,_,R){var B=_&7,U=_>>>3,H=(1<<R)-1,v=O[U]>>>B;return R<8-B||(v|=O[U+1]<<8-B,R<16-B)||(v|=O[U+2]<<16-B,R<24-B)||(v|=O[U+3]<<24-B),v&H}function xe(O,_,R){var B=_&7,U=_>>>3;return B<=5?O[U]|=(R&7)<<B:(O[U]|=R<<B&255,O[U+1]=(R&7)>>8-B),_+3}function be(O,_,R){var B=_&7,U=_>>>3;return R=(R&1)<<B,O[U]|=R,_+1}function De(O,_,R){var B=_&7,U=_>>>3;return R<<=B,O[U]|=R&255,R>>>=8,O[U+1]=R,_+8}function Te(O,_,R){var B=_&7,U=_>>>3;return R<<=B,O[U]|=R&255,R>>>=8,O[U+1]=R&255,O[U+2]=R>>>8,_+16}function ze(O,_){var R=O.length,B=2*R>_?2*R:_+5,U=0;if(R>=_)return O;if(Je){var H=Il(B);if(O.copy)O.copy(H);else for(;U<O.length;++U)H[U]=O[U];return H}else if(re){var v=new Uint8Array(B);if(v.set)v.set(O);else for(;U<R;++U)v[U]=O[U];return v}return O.length=B,O}function We(O){for(var _=new Array(O),R=0;R<O;++R)_[R]=0;return _}function ot(O,_,R){var B=1,U=0,H=0,v=0,X=0,G=O.length,Q=re?new Uint16Array(32):We(32);for(H=0;H<32;++H)Q[H]=0;for(H=G;H<R;++H)O[H]=0;G=O.length;var ae=re?new Uint16Array(G):We(G);for(H=0;H<G;++H)Q[U=O[H]]++,B<U&&(B=U),ae[H]=0;for(Q[0]=0,H=1;H<=B;++H)Q[H+16]=X=X+Q[H-1]<<1;for(H=0;H<G;++H)X=O[H],X!=0&&(ae[H]=Q[X+16]++);var me=0;for(H=0;H<G;++H)if(me=O[H],me!=0)for(X=F(ae[H],B)>>B-me,v=(1<<B+4-me)-1;v>=0;--v)_[X|v<<me]=me&15|H<<4;return B}var it=re?new Uint16Array(512):We(512),Zt=re?new Uint16Array(32):We(32);if(!re){for(var Le=0;Le<512;++Le)it[Le]=0;for(Le=0;Le<32;++Le)Zt[Le]=0}(function(){for(var O=[],_=0;_<32;_++)O.push(5);ot(O,Zt,32);var R=[];for(_=0;_<=143;_++)R.push(8);for(;_<=255;_++)R.push(9);for(;_<=279;_++)R.push(7);for(;_<=287;_++)R.push(8);ot(R,it,288)})();var vt=(function(){for(var _=re?new Uint8Array(32768):[],R=0,B=0;R<z.length-1;++R)for(;B<z[R+1];++B)_[B]=R;for(;B<32768;++B)_[B]=29;var U=re?new Uint8Array(259):[];for(R=0,B=0;R<K.length-1;++R)for(;B<K[R+1];++B)U[B]=R;function H(X,G){for(var Q=0;Q<X.length;){var ae=Math.min(65535,X.length-Q),me=Q+ae==X.length;for(G.write_shift(1,+me),G.write_shift(2,ae),G.write_shift(2,~ae&65535);ae-- >0;)G[G.l++]=X[Q++]}return G.l}function v(X,G){for(var Q=0,ae=0,me=re?new Uint16Array(32768):[];ae<X.length;){var ke=Math.min(65535,X.length-ae);if(ke<10){for(Q=xe(G,Q,+(ae+ke==X.length)),Q&7&&(Q+=8-(Q&7)),G.l=Q/8|0,G.write_shift(2,ke),G.write_shift(2,~ke&65535);ke-- >0;)G[G.l++]=X[ae++];Q=G.l*8;continue}Q=xe(G,Q,+(ae+ke==X.length)+2);for(var Ie=0;ke-- >0;){var _e=X[ae];Ie=(Ie<<5^_e)&32767;var Fe=-1,$e=0;if((Fe=me[Ie])&&(Fe|=ae&-32768,Fe>ae&&(Fe-=32768),Fe<ae))for(;X[Fe+$e]==X[ae+$e]&&$e<250;)++$e;if($e>2){_e=U[$e],_e<=22?Q=De(G,Q,oe[_e+1]>>1)-1:(De(G,Q,3),Q+=5,De(G,Q,oe[_e-23]>>5),Q+=3);var yt=_e<8?0:_e-4>>2;yt>0&&(Te(G,Q,$e-K[_e]),Q+=yt),_e=_[ae-Fe],Q=De(G,Q,oe[_e]>>3),Q-=3;var _t=_e<4?0:_e-2>>1;_t>0&&(Te(G,Q,ae-Fe-z[_e]),Q+=_t);for(var Ut=0;Ut<$e;++Ut)me[Ie]=ae&32767,Ie=(Ie<<5^X[ae])&32767,++ae;ke-=$e-1}else _e<=143?_e=_e+48:Q=be(G,Q,1),Q=De(G,Q,oe[_e]),me[Ie]=ae&32767,++ae}Q=De(G,Q,0)-1}return G.l=(Q+7)/8|0,G.l}return function(G,Q){return G.length<8?H(G,Q):v(G,Q)}})();function Me(O){var _=pe(50+Math.floor(O.length*1.1)),R=vt(O,_);return _.slice(0,R)}var nt=re?new Uint16Array(32768):We(32768),Ge=re?new Uint16Array(32768):We(32768),Ze=re?new Uint16Array(128):We(128),It=1,de=1;function Ee(O,_){var R=ve(O,_)+257;_+=5;var B=ve(O,_)+1;_+=5;var U=je(O,_)+4;_+=4;for(var H=0,v=re?new Uint8Array(19):We(19),X=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],G=1,Q=re?new Uint8Array(8):We(8),ae=re?new Uint8Array(8):We(8),me=v.length,ke=0;ke<U;++ke)v[D[ke]]=H=he(O,_),G<H&&(G=H),Q[H]++,_+=3;var Ie=0;for(Q[0]=0,ke=1;ke<=G;++ke)ae[ke]=Ie=Ie+Q[ke-1]<<1;for(ke=0;ke<me;++ke)(Ie=v[ke])!=0&&(X[ke]=ae[Ie]++);var _e=0;for(ke=0;ke<me;++ke)if(_e=v[ke],_e!=0){Ie=oe[X[ke]]>>8-_e;for(var Fe=(1<<7-_e)-1;Fe>=0;--Fe)Ze[Ie|Fe<<_e]=_e&7|ke<<3}var $e=[];for(G=1;$e.length<R+B;)switch(Ie=Ze[ne(O,_)],_+=Ie&7,Ie>>>=3){case 16:for(H=3+se(O,_),_+=2,Ie=$e[$e.length-1];H-- >0;)$e.push(Ie);break;case 17:for(H=3+he(O,_),_+=3;H-- >0;)$e.push(0);break;case 18:for(H=11+ne(O,_),_+=7;H-- >0;)$e.push(0);break;default:$e.push(Ie),G<Ie&&(G=Ie);break}var yt=$e.slice(0,R),_t=$e.slice(R);for(ke=R;ke<286;++ke)yt[ke]=0;for(ke=B;ke<30;++ke)_t[ke]=0;return It=ot(yt,nt,286),de=ot(_t,Ge,30),_}function we(O,_){if(O[0]==3&&!(O[1]&3))return[Fa(_),2];for(var R=0,B=0,U=Il(_||1<<18),H=0,v=U.length>>>0,X=0,G=0;(B&1)==0;){if(B=he(O,R),R+=3,B>>>1)B>>
vendor: 15,732 bytes, lines 471-481
4711==1?(X=9,G=5):(R=Ee(O,R),X=It,G=de);else{R&7&&(R+=8-(R&7));var Q=O[R>>>3]|O[(R>>>3)+1]<<8;if(R+=32,Q>0)for(!_&&v<H+Q&&(U=ze(U,H+Q),v=U.length);Q-- >0;)U[H++]=O[R>>>3],R+=8;continue}for(;;){!_&&v<H+32767&&(U=ze(U,H+32767),v=U.length);var ae=Z(O,R,X),me=B>>>1==1?it[ae]:nt[ae];if(R+=me&15,me>>>=4,(me>>>8&255)===0)U[H++]=me;else{if(me==256)break;me-=257;var ke=me<8?0:me-4>>2;ke>5&&(ke=0);var Ie=H+K[me];ke>0&&(Ie+=Z(O,R,ke),R+=ke),ae=Z(O,R,G),me=B>>>1==1?Zt[ae]:Ge[ae],R+=me&15,me>>>=4;var _e=me<4?0:me-2>>1,Fe=z[me];for(_e>0&&(Fe+=Z(O,R,_e),R+=_e),!_&&v<Ie&&(U=ze(U,Ie+100),v=U.length);H<Ie;)U[H]=U[H-Fe],++H}}}return _?[U,R+7>>>3]:[U.slice(0,H),R+7>>>3]}function Oe(O,_){var R=O.slice(O.l||0),B=we(R,_);return O.l+=B[1],B[0]}function Ue(O,_){if(O)typeof console<"u"&&console.error(_);else throw new Error(_)}function Xe(O,_){var R=O;Jt(R,0);var B=[],U=[],H={FileIndex:B,FullPaths:U};C(H,{root:_.root});for(var v=R.length-4;(R[v]!=80||R[v+1]!=75||R[v+2]!=5||R[v+3]!=6)&&v>=0;)--v;R.l=v+4,R.l+=4;var X=R.read_shift(2);R.l+=6;var G=R.read_shift(4);for(R.l=G,v=0;v<X;++v){R.l+=20;var Q=R.read_shift(4),ae=R.read_shift(4),me=R.read_shift(2),ke=R.read_shift(2),Ie=R.read_shift(2);R.l+=8;var _e=R.read_shift(4),Fe=o(R.slice(R.l+me,R.l+me+ke));R.l+=me+ke+Ie;var $e=R.l;R.l=_e+4,et(R,Q,ae,H,Fe),R.l=$e}return H}function et(O,_,R,B,U){O.l+=2;var H=O.read_shift(2),v=O.read_shift(2),X=c(O);if(H&8257)throw new Error("Unsupported ZIP encryption");for(var G=O.read_shift(4),Q=O.read_shift(4),ae=O.read_shift(4),me=O.read_shift(2),ke=O.read_shift(2),Ie="",_e=0;_e<me;++_e)Ie+=String.fromCharCode(O[O.l++]);if(ke){var Fe=o(O.slice(O.l,O.l+ke));(Fe[21589]||{}).mt&&(X=Fe[21589].mt),((U||{})[21589]||{}).mt&&(X=U[21589].mt)}O.l+=ke;var $e=O.slice(O.l,O.l+Q);switch(v){case 8:$e=V(O,ae);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+v)}var yt=!1;H&8&&(G=O.read_shift(4),G==134695760&&(G=O.read_shift(4),yt=!0),Q=O.read_shift(4),ae=O.read_shift(4)),Q!=_&&Ue(yt,"Bad compressed size: "+_+" != "+Q),ae!=R&&Ue(yt,"Bad uncompressed size: "+R+" != "+ae),Ma(B,Ie,$e,{unsafe:!0,mt:X})}function ie(O,_){var R=_||{},B=[],U=[],H=pe(1),v=R.compression?8:0,X=0,G=0,Q=0,ae=0,me=0,ke=O.FullPaths[0],Ie=ke,_e=O.FileIndex[0],Fe=[],$e=0;for(G=1;G<O.FullPaths.length;++G)if(Ie=O.FullPaths[G].slice(ke.length),_e=O.FileIndex[G],!(!_e.size||!_e.content||Ie=="�Sh33tJ5")){var yt=ae,_t=pe(Ie.length);for(Q=0;Q<Ie.length;++Q)_t.write_shift(1,Ie.charCodeAt(Q)&127);_t=_t.slice(0,_t.l),Fe[me]=xx.buf(_e.content,0);var Ut=_e.content;v==8&&(Ut=I(Ut)),H=pe(30),H.write_shift(4,67324752),H.write_shift(2,20),H.write_shift(2,X),H.write_shift(2,v),_e.mt?i(H,_e.mt):H.write_shift(4,0),H.write_shift(-4,Fe[me]),H.write_shift(4,Ut.length),H.write_shift(4,_e.content.length),H.write_shift(2,_t.length),H.write_shift(2,0),ae+=H.length,B.push(H),ae+=_t.length,B.push(_t),ae+=Ut.length,B.push(Ut),H=pe(46),H.write_shift(4,33639248),H.write_shift(2,0),H.write_shift(2,20),H.write_shift(2,X),H.write_shift(2,v),H.write_shift(4,0),H.write_shift(-4,Fe[me]),H.write_shift(4,Ut.length),H.write_shift(4,_e.content.length),H.write_shift(2,_t.length),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(4,0),H.write_shift(4,yt),$e+=H.l,U.push(H),$e+=_t.length,U.push(_t),++me}return H=pe(22),H.write_shift(4,101010256),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(2,me),H.write_shift(2,me),H.write_shift(4,$e),H.write_shift(4,ae),H.write_shift(2,0),Gt([Gt(B),Gt(U),H])}var Ae={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function Pe(O,_){if(O.ctype)return O.ctype;var R=O.name||"",B=R.match(/\.([^\.]+)$/);return B&&Ae[B[1]]||_&&(B=(R=_).match(/[\.\\]([^\.\\])+$/),B&&Ae[B[1]])?Ae[B[1]]:"application/octet-stream"}function Re(O){for(var _=_s(O),R=[],B=0;B<_.length;B+=76)R.push(_.slice(B,B+76));return R.join(`\r 472`)+`\r 473`}function ct(O){var _=O.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(Q){var ae=Q.charCodeAt(0).toString(16).toUpperCase();return"="+(ae.length==1?"0"+ae:ae)});_=_.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),_.charAt(0)==` 474`&&(_="=0D"+_.slice(1)),_=_.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,` 475=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var R=[],B=_.split(`\r 476`),U=0;U<B.length;++U){var H=B[U];if(H.length==0){R.push("");continue}for(var v=0;v<H.length;){var X=76,G=H.slice(v,v+X);G.charAt(X-1)=="="?X--:G.charAt(X-2)=="="?X-=2:G.charAt(X-3)=="="&&(X-=3),G=H.slice(v,v+X),v+=X,v<H.length&&(G+="="),R.push(G)}}return R.join(`\r 477`)}function ft(O){for(var _=[],R=0;R<O.length;++R){for(var B=O[R];R<=O.length&&B.charAt(B.length-1)=="=";)B=B.slice(0,B.length-1)+O[++R];_.push(B)}for(var U=0;U<_.length;++U)_[U]=_[U].replace(/[=][0-9A-Fa-f]{2}/g,function(H){return String.fromCharCode(parseInt(H.slice(1),16))});return jr(_.join(`\r 478`))}function qt(O,_,R){for(var B="",U="",H="",v,X=0;X<10;++X){var G=_[X];if(!G||G.match(/^\s*$/))break;var Q=G.match(/^(.*?):\s*([^\s].*)$/);if(Q)switch(Q[1].toLowerCase()){case"content-location":B=Q[2].trim();break;case"content-type":H=Q[2].trim();break;case"content-transfer-encoding":U=Q[2].trim();break}}switch(++X,U.toLowerCase()){case"base64":v=jr(kr(_.slice(X).join("")));break;case"quoted-printable":v=ft(_.slice(X));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+U)}var ae=Ma(O,B.slice(R.length),v,{unsafe:!0});H&&(ae.ctype=H)}function lt(O,_){if(q(O.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var R=_&&_.root||"",B=(Je&&Buffer.isBuffer(O)?O.toString("binary"):q(O)).split(`\r 479`),U=0,H="";for(U=0;U<B.length;++U)if(H=B[U],!!/^Content-Location:/i.test(H)&&(H=H.slice(H.indexOf("file")),R||(R=H.slice(0,H.lastIndexOf("/")+1)),H.slice(0,R.length)!=R))for(;R.length>0&&(R=R.slice(0,R.length-1),R=R.slice(0,R.lastIndexOf("/")+1),H.slice(0,R.length)!=R););var v=(B[1]||"").match(/boundary="(.*?)"/);if(!v)throw new Error("MAD cannot find boundary");var X="--"+(v[1]||""),G=[],Q=[],ae={FileIndex:G,FullPaths:Q};C(ae);var me,ke=0;for(U=0;U<B.length;++U){var Ie=B[U];Ie!==X&&Ie!==X+"--"||(ke++&&qt(ae,B.slice(me,U),R),me=U)}return ae}function ca(O,_){var R=_||{},B=R.boundary||"SheetJS";B="------="+B;for(var U=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+B.slice(2)+'"',"","",""],H=O.FullPaths[0],v=H,X=O.FileIndex[0],G=1;G<O.FullPaths.length;++G)if(v=O.FullPaths[G].slice(H.length),X=O.FileIndex[G],!(!X.size||!X.content||v=="�Sh33tJ5")){v=v.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function($e){return"_x"+$e.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function($e){return"_u"+$e.charCodeAt(0).toString(16)+"_"});for(var Q=X.content,ae=Je&&Buffer.isBuffer(Q)?Q.toString("binary"):q(Q),me=0,ke=Math.min(1024,ae.length),Ie=0,_e=0;_e<=ke;++_e)(Ie=ae.charCodeAt(_e))>=32&&Ie<128&&++me;var Fe=me>=ke*4/5;U.push(B),U.push("Content-Location: "+(R.root||"file:///C:/SheetJS/")+v),U.push("Content-Transfer-Encoding: "+(Fe?"quoted-printable":"base64")),U.push("Content-Type: "+Pe(X,v)),U.push(""),U.push(Fe?ct(ae):Re(ae))}return U.push(B+`--\r 480`),U.join(`\r 481`)}function ja(O){var _={};return C(_,O),_}function Ma(O,_,R,B){var U=B&&B.unsafe;U||C(O);var H=!U&&Be.find(O,_);if(!H){var v=O.FullPaths[0];_.slice(0,v.length)==v?v=_:(v.slice(-1)!="/"&&(v+="/"),v=(v+_).replace("//","/")),H={name:s(_),type:2},O.FileIndex.push(H),O.FullPaths.push(v),U||Be.utils.cfb_gc(O)}return H.content=R,H.size=R?R.length:0,B&&(B.CLSID&&(H.clsid=B.CLSID),B.mt&&(H.mt=B.mt),B.ct&&(H.ct=B.ct)),H}function xn(O,_){C(O);var R=Be.find(O,_);if(R){for(var B=0;B<O.FileIndex.length;++B)if(O.FileIndex[B]==R)return O.FileIndex.splice(B,1),O.FullPaths.splice(B,1),!0}return!1}function Gn(O,_,R){C(O);var B=Be.find(O,_);if(B){for(var U=0;U<O.FileIndex.length;++U)if(O.FileIndex[U]==B)return O.FileIndex[U].name=s(R),O.FullPaths[U]=R,!0}return!1}function Xn(O){T(O,!0)}return r.find=M,r.read=N,r.parse=u,r.write=J,r.writeFile=fe,r.utils={cfb_new:ja,cfb_add:Ma,cfb_del:xn,cfb_mov:Gn,cfb_gc:Xn,ReadShift:ls,CheckField:Mh,prep_blob:Jt,bconcat:Gt,use_zlib:A,_deflateRaw:Me,_inflateRaw:Oe,consts:te},r})();function gx(e){return typeof e=="string"?zi(e):Array.isArray(e)?Wm(e):e}function Ms(e,r,a){if(typeof Deno<"u"){if(a&&typeof r=="string")switch(a){case"utf8":r=new TextEncoder(a).encode(r);break;case"binary":r=zi(r);break;default:throw new Error("Unsupported encoding "+a)}return Deno.writeFileSync(e,r)}var n=a=="utf8"?ra(r):r;if(typeof IE_SaveFile<"u")return IE_SaveFile(n,e);if(typeof Blob<"u"){var s=new Blob([gx(n)],{type:"application/octet-stream"});if(typeof navigator<"u"&&navigator.msSaveBlob)return navigator.msSaveBlob(s,e);if(typeof saveAs<"u")return saveAs(s,e);if(typeof URL<"u"&&typeof document<"u"&&document.createElement&&URL.createObjectURL){var i=URL.createObjectURL(s);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(i)},6e4),chrome.downloads.download({url:i,filename:e,saveAs:!0});var c=document.createElement("a");if(c.download!=null)return c.download=e,c.href=i,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(i)},6e4),i}}if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var o=File(e);return o.open("w"),o.encoding="binary",Array.isArray(r)&&(r=Oa(r)),o.write(r),o.close(),r}catch(l){if(!l.message||!l.message.match(/onstruct/))throw l}throw new Error("cannot save file "+e)}function vx(e){if(typeof Deno<"u")return Deno.readFileSync(e);if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var r=File(e);r.open("r"),r.encoding="binary";var a=r.read();return r.close(),a}catch(n){if(!n.message||!n.message.match(/onstruct/))throw n}throw new Error("Cannot access file "+e)}function Ft(e){for(var r=Object.keys(e),a=[],n=0;n<r.length;++n)Object.prototype.hasOwnProperty.call(e,r[n])&&a.push(r[n]);return a}function zl(e,r){for(var a=[],n=Ft(e),s=0;s!==n.length;++s)a[e[n[s]][r]]==null&&(a[e[n[s]][r]]=n[s]);return a}function Hi(e){for(var r=[],a=Ft(e),n=0;n!==a.length;++n)r[e[a[n]]]=a[n];return r}function Wi(e){for(var r=[],a=Ft(e),n=0;n!==a.length;++n)r[e[a[n]]]=parseInt(a[n],10);return r}function yx(e){for(var r=[],a=Ft(e),n=0;n!==a.length;++n)r[e[a[n]]]==null&&(r[e[a[n]]]=[]),r[e[a[n]]].push(a[n]);return r}var wi=new Date(1899,11,30,0,0,0);function Vt(e,r){var a=e.getTime(),n=wi.getTime()+(e.getTimezoneOffset()-wi.getTimezoneOffset())*6e4;return(a-n)/(1440*60*1e3)}var vh=new Date,_x=wi.getTime()+(vh.getTimezoneOffset()-wi.getTimezoneOffset())*6e4,Ul=vh.getTimezoneOffset();function Vi(e){var r=new Date;return r.setTime(e*24*60*60*1e3+_x),r.getTimezoneOffset()!==Ul&&r.setTime(r.getTime()+(r.getTimezoneOffset()-Ul)*6e4),r}function bx(e){var r=0,a=0,n=!1,s=e.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!s)throw new Error("|"+e+"| is not an ISO8601 Duration");for(var i=1;i!=s.length;++i)if(s[i]){switch(a=1,i>3&&(n=!0),s[i].slice(s[i].length-1)){case"Y":throw new Error("Unsupported ISO Duration Field: "+s[i].slice(s[i].length-1));case"D":a*=24;case"H":a*=60;case"M":if(n)a*=60;else throw new Error("Unsupported ISO Duration Field: M")}r+=a*parseInt(s[i],10)}return r}var Hl=new Date("2017-02-19T19:06:09.000Z"),yh=isNaN(Hl.getFullYear())?new Date("2/19/17"):Hl,jx=yh.getFullYear()==2017;function wt(e,r){var a=new Date(e);if(jx)return r>0?a.setTime(a.getTime()+a.getTimezoneOffset()*60*1e3):r<0&&a.setTime(a.getTime()-a.getTimezoneOffset()*60*1e3),a;if(e instanceof Date)return e;if(yh.getFullYear()==1917&&!isNaN(a.getFullYear())){var n=a.getFullYear();return e.indexOf(""+n)>-1||a.setFullYear(a.getFullYear()+100),a}var s=e.match(/\d+/g)||["2017","2","19","0","0","0"],i=new Date(+s[0],+s[1]-1,+s[2],+s[3]||0,+s[4]||0,+s[5]||0);return e.indexOf("Z")>-1&&(i=new Date(i.getTime()-i.getTimezoneOffset()*60*1e3)),i}function rn(e,r){if(Je&&Buffer.isBuffer(e)){if(r){if(e[0]==255&&e[1]==254)return ra(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)return ra(ih(e.slice(2).toString("binary")))}return e.toString("binary")}if(typeof TextDecoder<"u")try{if(r){if(e[0]==255&&e[1]==254)return ra(new TextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)return ra(new TextDecoder("utf-16be").decode(e.slice(2)))}var a={"â¬":"Â","â":"Â",Æ:"Â","â":"Â","â¦":" ","â ":"Â","â¡":"Â","Ë":"Â","â°":"Â",Å :"Â","â¹":"Â",Å:"Â",Ž:"Â","â":"Â","â":"Â","â":"Â","â":"Â","â¢":"Â","â":"Â","â":"Â","Ë":"Â","â¢":"Â",Å¡:"Â","âº":"Â",Å:"Â",ž:"Â",Ÿ:"Â"};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[â¬âÆââ¦â â¡Ëâ°Å â¹ÅŽâââââ¢ââËâ¢Å¡âºÅžŸ]/g,function(i){return a[i]||i})}catch{}for(var n=[],s=0;s!=e.length;++s)n.push(String.fromCharCode(e[s]));return n.join("")}function kt(e){if(typeof JSON<"u"&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if(typeof e!="object"||e==null)return e;if(e instanceof Date)return new Date(e.getTime());var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=kt(e[a]));return r}function Et(e,r){for(var a="";a.length<r;)a+=e;return a}function $r(e){var r=Number(e);if(!isNaN(r))return isFinite(r)?r:NaN;if(!/\d/.test(e))return r;var a=1,n=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return a*=100,""});return!isNaN(r=Number(n))||(n=n.replace(/[(](.*)[)]/,function(s,i){return a=-a,i}),!isNaN(r=Number(n)))?r/a:r}var wx=["january","february","march","april","may","june","july","august","september","october","november","december"];function On(e){var r=new Date(e),a=new Date(NaN),n=r.getYear(),s=r.getMonth(),i=r.getDate();if(isNaN(i))return a;var c=e.toLowerCase();if(c.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(c=c.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),c.length>3&&wx.indexOf(c)==-1)return a}else if(c.match(/[a-z]/))return a;return n<0||n>8099?a:(s>0||i>1)&&n!=101?r:e.match(/[^-0-9:,\/\\]/)?a:r}var kx=(function(){var e="abacaba".split(/(:?b)/i).length==5;return function(a,n,s){if(e||typeof n=="string")return a.split(n);for(var i=a.split(n),c=[i[0]],o=1;o<i.length;++o)c.push(s),c.push(i[o]);return c}})();function _h(e){return e?e.content&&e.type?rn(e.content,!0):e.data?ns(e.data):e.asNodeBuffer&&Je?ns(e.asNodeBuffer().toString("binary")):e.asBinary?ns(e.asBinary()):e._data&&e._data.getContent?ns(rn(Array.prototype.slice.call(e._data.getContent(),0))):null:null}function bh(e){if(!e)return null;if(e.data)return Al(e.data);if(e.asNodeBuffer&&Je)return e.asNodeBuffer();if(e._data&&e._data.getContent){var r=e._data.getContent();return typeof r=="string"?Al(r):Array.prototype.slice.call(r)}return e.content&&e.type?e.content:null}function Sx(e){return e&&e.name.slice(-4)===".bin"?bh(e):_h(e)}function Fr(e,r){for(var a=e.FullPaths||Ft(e.files),n=r.toLowerCase().replace(/[\/]/g,"\\"),s=n.replace(/\\/g,"/"),i=0;i<a.length;++i){var c=a[i].replace(/^Root Entry[\/]/,"").toLowerCase();if(n==c||s==c)return e.files?e.files[a[i]]:e.FileIndex[i]}return null}function ko(e,r){var a=Fr(e,r);if(a==null)throw new Error("Cannot find file "+r+" in zip");return a}function Lt(e,r,a){if(!a)return Sx(ko(e,r));if(!r)return null;try{return Lt(e,r)}catch{return null}}function wr(e,r,a){if(!a)return _h(ko(e,r));if(!r)return null;try{return wr(e,r)}catch{return null}}function Nx(e,r,a){return bh(ko(e,r))}function Wl(e){for(var r=e.FullPaths||Ft(e.files),a=[],n=0;n<r.length;++n)r[n].slice(-1)!="/"&&a.push(r[n].replace(/^Root Entry[\/]/,""));return a.sort()}
481function Ye(e,r,a){if(e.FullPaths){if(typeof a=="string"){var n;return Je?n=ya(a):n=Vm(a),Be.utils.cfb_add(e,r,n)}Be.utils.cfb_add(e,r,a)}else e.file(r,a)}function So(){return Be.utils.cfb_new()}function jh(e,r){switch(r.type){case"base64":return Be.read(e,{type:"base64"});case"binary":return Be.read(e,{type:"binary"});case"buffer":case"array":return Be.read(e,{type:"buffer"})}throw new Error("Unrecognized type "+r.type)}function is(e,r){if(e.charAt(0)=="/")return e.slice(1);var a=r.split("/");r.slice(-1)!="/"&&a.pop();for(var n=e.split("/");n.length!==0;){var s=n.shift();s===".."?a.pop():s!=="."&&a.push(s)}return a.join("/")}var Rt=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r 482`,Cx=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g,Vl=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg,Ex=/<[^>]*>/g,cr=Rt.match(Vl)?Vl:Ex,Tx=/<\w*:/,Ax=/<(\/?)\w+:/;function qe(e,r,a){for(var n={},s=0,i=0;s!==e.length&&!((i=e.charCodeAt(s))===32||i===10||i===13);++s);if(r||(n[0]=e.slice(0,s)),s===e.length)return n;var c=e.match(Cx),o=0,l="",d=0,u="",h="",f=1;if(c)for(d=0;d!=c.length;++d){for(h=c[d],i=0;i!=h.length&&h.charCodeAt(i)!==61;++i);for(u=h.slice(0,i).trim();h.charCodeAt(i+1)==32;)++i;for(f=(s=h.charCodeAt(i+1))==34||s==39?1:0,l=h.slice(i+1+f,h.length-f),o=0;o!=u.length&&u.charCodeAt(o)!==58;++o);if(o===u.length)u.indexOf("_")>0&&(u=u.slice(0,u.indexOf("_"))),n[u]=l,n[u.toLowerCase()]=l;else{var m=(o===5&&u.slice(0,5)==="xmlns"?"xmlns":"")+u.slice(o+1);if(n[m]&&u.slice(o-3,o)=="ext")continue;n[m]=l,n[m.toLowerCase()]=l}}return n}function sa(e){return e.replace(Ax,"<$1")}var wh={""":'"',"'":"'",">":">","<":"<","&":"&"},No=Hi(wh),rt=(function(){var e=/&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig,r=/_x([\da-fA-F]{4})_/ig;return function a(n){var s=n+"",i=s.indexOf("<![CDATA[");if(i==-1)return s.replace(e,function(o,l){return wh[o]||String.fromCharCode(parseInt(l,o.indexOf("x")>-1?16:10))||o}).replace(r,function(o,l){return String.fromCharCode(parseInt(l,16))});var c=s.indexOf("]]>");return a(s.slice(0,i))+s.slice(i+9,c)+a(s.slice(c+3))}})(),Co=/[&<>'"]/g,Fx=/[\u0000-\u0008\u000b-\u001f]/g;function ht(e){var r=e+"";return r.replace(Co,function(a){return No[a]}
482).replace(Fx,function(a){return"_x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+"_"})}function ql(e){return ht(e).replace(/ /g,"_x0020_")}var kh=/[\u0000-\u001f]/g;function Eo(e){var r=e+"";return r.replace(Co,function(a){return No[a]}).replace(/\n/g,"<br/>").replace(kh,function(a){return"&#x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+";"})}function Ix(e){var r=e+"";return r.replace(Co,function(a){return No[a]}).replace(kh,function(a){return"&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"})}var $l=(function(){var e=/&#(\d+);/g;function r(a,n){return String.fromCharCode(parseInt(n,10))}return function(n){return n.replace(e,r)}})();function Px(e){return e.replace(/(\r\n|[\r\n])/g," ")}function jt(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function Qi(e){for(var r="",a=0,n=0,s=0,i=0,c=0,o=0;a<e.length;){if(n=e.charCodeAt(a++),n<128){r+=String.fromCharCode(n);continue}if(s=e.charCodeAt(a++),n>191&&n<224){c=(n&31)<<6,c|=s&63,r+=String.fromCharCode(c);continue}if(i=e.charCodeAt(a++),n<240){r+=String.fromCharCode((n&15)<<12|(s&63)<<6|i&63);continue}c=e.charCodeAt(a++),o=((n&7)<<18|(s&63)<<12|(i&63)<<6|c&63)-65536,r+=String.fromCharCode(55296+(o>>>10&1023)),r+=String.fromCharCode(56320+(o&1023))}return r}function Gl(e){var r=Fa(2*e.length),a,n,s=1,i=0,c=0,o;for(n=0;n<e.length;n+=s)s=1,(o=e.charCodeAt(n))<128?a=o:o<224?(a=(o&31)*64+(e.charCodeAt(n+1)&63),s=2):o<240?(a=(o&15)*4096+(e.charCodeAt(n+1)&63)*64+(e.charCodeAt(n+2)&63),s=3):(s=4,a=(o&7)*262144+(e.charCodeAt(n+1)&63)*4096+(e.charCodeAt(n+2)&63)*64+(e.charCodeAt(n+3)&63),a-=65536,c=55296+(a>>>10&1023),a=56320+(a&1023)),c!==0&&(r[i++]=c&255,r[i++]=c>>>8,c=0),r[i++]=a%256,r[i++]=a>>>8;return r.slice(0,i).toString("ucs2")}function Xl(e){return ya(e,"binary").toString("utf8")}var ai="foo bar bazâÂÂð£",xt=Je&&(Xl(ai)==Qi(ai)&&Xl||Gl(ai)==Qi(ai)&&Gl)||Qi,ra=Je?function(e){return ya(e,"utf8").toString("binary")}:function(e){for(var r=[],a=0,n=0,s=0;a<e.length;)switch(n=e.charCodeAt(a++),!0){case n<128:r.push(String.fromCharCode(n));break;case n<2048:r.push(String.fromCharCode(192+(n>>6))),r.push(String.fromCharCode(128+(n&63)));break;case(n>=55296&&n<57344):n-=55296,s=e.charCodeAt(a++)-56320+(n<<10),r.push(String.fromCharCode(240+(s>>18&7))),r.push(String.fromCharCode(144+(s>>12&63))),r.push(String.fromCharCode(128+(s>>6&63))),r.push(String.fromCharCode(128+(s&63)));break;default:r.push(String.fromCharCode(224+(n>>12))),r.push(String.fromCharCode(128+(n>>6&63))),r.push(String.fromCharCode(128+(n&63)))}return r.join("")},js=(function(){var e={};return function(a,n){var s=a+"|"+(n||"");return e[s]?e[s]:e[s]=new RegExp("<(?:\\w+:)?"+a+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?'+a+">",n||"")}})(),Sh=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(r){return[new RegExp("&"+r[0]+";","ig"),r[1]]});return function(a){for(var n=a.replace(/^[\t\n\r ]+/,"").replace(/[\t\n\r ]+$/,"").replace(/>\s+/g,">").replace(/\s+</g,"<").replace(/[\t\n\r ]+/g," ").replace(/<\s*[bB][rR]\s*\/?>/g,` 483`).replace(/<[^>]*>/g,""),s=0;s<e.length;++s)n=n.replace(e[s][0],e[s][1]);return n}})(),Dx=(function(){var e={};return function(a){return e[a]!==void 0?e[a]:e[a]=new RegExp("<(?:vt:)?"+a+">([\\s\\S]*?)</(?:vt:)?"+a+">","g")}})(),Rx=/<\/?(?:vt:)?variant>/g,Ox=/<(?:vt:)([^>]*)>([\s\S]*)</;function Kl(e,r){var a=qe(e),n=e.match(Dx(a.baseType))||[],s=[];if(n.length!=a.size){if(r.WTF)throw new Error("unexpected vector length "+n.length+" != "+a.size);return s}return n.forEach(function(i){var c=i.replace(Rx,"").match(Ox);c&&s.push({v:xt(c[2]),t:c[1]})}),s}var Nh=/(^\s|\s$|\n)/;function Qt(e,r){return"<"+e+(r.match(Nh)?' xml:space="preserve"':"")+">"+r+"</"+e+">"}function ws(e){return Ft(e).map(function(r){return" "+r+'="'+e[r]+'"'}).join("")}function Se(e,r,a){return"<"+e+(a!=null?ws(a):"")+(r!=null?(r.match(Nh)?' xml:space="preserve"':"")+">"+r+"</"+e:"/")+">"}function Gc(e,r){try{return e.toISOString().replace(/\.\d*/,"")}catch(a){if(r)throw a}return""}function Lx(e,r){switch(typeof e){case"string":var a=Se("vt:lpwstr",ht(e));return a=a.replace(/"/g,"_x0022_"),a;case"number":return Se((e|0)==e?"vt:i4":"vt:r8",ht(String(e)));case"boolean":return Se("vt:bool",e?"true":"false")}if(e instanceof Date)return Se("vt:filetime",Gc(e));throw new Error("Unable to serialize "+e)}function To(e){if(Je&&Buffer.isBuffer(e))return e.toString("utf8");if(typeof e=="string")return e;if(typeof Uint8Array<"u"&&e instanceof Uint8Array)return xt(Oa(bo(e)));throw new Error("Bad input format: expected Buffer or string")}var ks=/<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>
483/mg,Wt={CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",CT:"http://schemas.openxmlformats.org/package/2006/content-types",RELS:"http://schemas.openxmlformats.org/package/2006/relationships",TCMNT:"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"},on=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"],_r={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};function Bx(e,r){for(var a=1-2*(e[r+7]>>>7),n=((e[r+7]&127)<<4)+(e[r+6]>>>4&15),s=e[r+6]&15,i=5;i>=0;--i)s=s*256+e[r+i];return n==2047?s==0?a*(1/0):NaN:(n==0?n=-1022:(n-=1023,s+=Math.pow(2,52)),a*Math.pow(2,n-52)*s)}function Mx(e,r,a){var n=(r<0||1/r==-1/0?1:0)<<7,s=0,i=0,c=n?-r:r;isFinite(c)?c==0?s=i=0:(s=Math.floor(Math.log(c)/Math.LN2),i=c*Math.pow(2,52-s),s<=-1023&&(!isFinite(i)||i<Math.pow(2,52))?s=-1022:(i-=Math.pow(2,52),s+=1023)):(s=2047,i=isNaN(r)?26985:0);for(var o=0;o<=5;++o,i/=256)e[a+o]=i&255;e[a+6]=(s&15)<<4|i&15,e[a+7]=s>>4|n}var Yl=function(e){for(var r=[],a=10240,n=0;n<e[0].length;++n)if(e[0][n])for(var s=0,i=e[0][n].length;s<i;s+=a)r.push.apply(r,e[0][n].slice(s,s+a));return r},Jl=Je?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(r){return Buffer.isBuffer(r)?r:ya(r)})):Yl(e)}:Yl,Ql=function(e,r,a){for(var n=[],s=r;s<a;s+=2)n.push(String.fromCharCode(ua(e,s)));return n.join("").replace(pr,"")},Ao=Je?function(e,r,a){return Buffer.isBuffer(e)?e.toString("utf16le",r,a).replace(pr,""):Ql(e,r,a)}:Ql,Zl=function(e,r,a){for(var n=[],s=r;s<r+a;++s)n.push(("0"+e[s].toString(16)).slice(-2));return n.join("")},Ch=Je?function(e,r,a){return Buffer.isBuffer(e)?e.toString("hex",r,r+a):Zl(e,r,a)}:Zl,ed=function(e,r,a){for(var n=[],s=r;s<a;s++)n.push(String.fromCharCode(jn(e,s)));return n.join("")},zs=Je?function(r,a,n){return Buffer.isBuffer(r)?r.toString("utf8",a,n):ed(r,a,n)}:ed,Eh=function(e,r){var a=br(e,r);return a>0?zs(e,r+4,r+4+a-1):""},Th=Eh,Ah=function(e,r){var a=br(e,r);return a>0?zs(e,r+4,r+4+a-1):""},Fh=Ah,Ih=function(e,r){var a=2*br(e,r);return a>0?zs(e,r+4,r+4+a-1):""},Ph=Ih,Dh=function(r,a){var n=br(r,a);return n>0?Ao(r,a+4,a+4+n):""},Rh=Dh,Oh=function(e,r){var a=br(e,r);return a>0?zs(e,r+4,r+4+a):""},Lh=Oh,Bh=function(e,r){return Bx(e,r)},ki=Bh,Fo=function(r){return Array.isArray(r)||typeof Uint8Array<"u"&&r instanceof Uint8Array};Je&&(Th=function(r,a){if(!Buffer.isBuffer(r))return Eh(r,a);var n=r.readUInt32LE(a);return n>0?r.toString("utf8",a+4,a+4+n-1):""},Fh=function(r,a){if(!Buffer.isBuffer(r))return Ah(r,a);var n=r.readUInt32LE(a);return n>0?r.toString("utf8",a+4,a+4+n-1):""},Ph=function(r,a){if(!Buffer.isBuffer(r))return Ih(r,a);var n=2*r.readUInt32LE(a);return r.toString("utf16le",a+4,a+4+n-1)},Rh=function(r,a){if(!Buffer.isBuffer(r))return Dh(r,a);var n=r.readUInt32LE(a);return r.toString("utf16le",a+4,a+4+n)},Lh=function(r,a){if(!Buffer.isBuffer(r))return Oh(r,a);var n=r.readUInt32LE(a);return r.toString("utf8",a+4,a+4+n)},ki=function(r,a){return Buffer.isBuffer(r)?r.readDoubleLE(a):Bh(r,a)},Fo=function(r){return Buffer.isBuffer(r)||Array.isArray(r)||typeof Uint8Array<"u"&&r instanceof Uint8Array});var jn=function(e,r){return e[r]},ua=function(e,r){return e[r+1]*256+e[r]},zx=function(e,r){var a=e[r+1]*256+e[r];return a<32768?a:(65535-a+1)*-1},br=function(e,r){return e[r+3]*(1<<24)+(e[r+2]<<16)+(e[r+1]<<8)+e[r]},qa=function(e,r){return e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]},Ux=function(e,r){return e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]};function ls(e,r){var a="",n,s,i=[],c,o,l,d;switch(r){case"dbcs":if(d=this.l,Je&&Buffer.isBuffer(this))a=this.slice(this.l,this.l+2*e).toString("utf16le");else for(l=0;l<e;++l)a+=String.fromCharCode(ua(this,d)),d+=2;e*=2;break;
vendor: 2,276 bytes, line 483
483case"utf8":a=zs(this,this.l,this.l+e);break;case"utf16le":e*=2,a=Ao(this,this.l,this.l+e);break;case"wstr":return ls.call(this,e,"dbcs");case"lpstr-ansi":a=Th(this,this.l),e=4+br(this,this.l);break;case"lpstr-cp":a=Fh(this,this.l),e=4+br(this,this.l);break;case"lpwstr":a=Ph(this,this.l),e=4+2*br(this,this.l);break;case"lpp4":e=4+br(this,this.l),a=Rh(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+br(this,this.l),a=Lh(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,a="";(c=jn(this,this.l+e++))!==0;)i.push(ri(c));a=i.join("");break;case"_wstr":for(e=0,a="";(c=ua(this,this.l+e))!==0;)i.push(ri(c)),e+=2;e+=2,a=i.join("");break;case"dbcs-cont":for(a="",d=this.l,l=0;l<e;++l){if(this.lens&&this.lens.indexOf(d)!==-1)return c=jn(this,d),this.l=d+1,o=ls.call(this,e-l,c?"dbcs-cont":"sbcs-cont"),i.join("")+o;i.push(ri(ua(this,d))),d+=2}a=i.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(a="",d=this.l,l=0;l!=e;++l){if(this.lens&&this.lens.indexOf(d)!==-1)return c=jn(this,d),this.l=d+1,o=ls.call(this,e-l,c?"dbcs-cont":"sbcs-cont"),i.join("")+o;i.push(ri(jn(this,d))),d+=1}a=i.join("");break;default:switch(e){case 1:return n=jn(this,this.l),this.l++,n;case 2:return n=(r==="i"?zx:ua)(this,this.l),this.l+=2,n;case 4:case-4:return r==="i"||(this[this.l+3]&128)===0?(n=(e>0?qa:Ux)(this,this.l),this.l+=4,n):(s=br(this,this.l),this.l+=4,s);case 8:case-8:if(r==="f")return e==8?s=ki(this,this.l):s=ki([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,s;e=8;case 16:a=Ch(this,this.l,e);break}}return this.l+=e,a}var Hx=function(e,r,a){e[a]=r&255,e[a+1]=r>>>8&255,e[a+2]=r>>>16&255,e[a+3]=r>>>24&255},Wx=function(e,r,a){e[a]=r&255,e[a+1]=r>>8&255,e[a+2]=r>>16&255,e[a+3]=r>>24&255},Vx=function(e,r,a){e[a]=r&255,e[a+1]=r>>>8&255};function qx(e,r,a){var n=0,s=0;if(a==="dbcs"){for(s=0;s!=r.length;++s)Vx(this,r.charCodeAt(s),this.l+2*s);n=2*r.length}else if(a==="sbcs"){for(r=r.replace(/[^\x00-\x7F]/g,"_"),s=0;s!=r.length;++s)this[this.l+s]=r.charCodeAt(s)&255;n=r.length}else if(a==="hex"){for(;s<e;++s)this[this.l++]=parseInt(r.slice(2*s,2*s+2),16)||0;return this}else if(a==="utf16le"){var i=Math.min(this.l+e,this.length);for(s=0;s<Math.min(r.length,e);++s){var c=r.charCodeAt(s);
483this[this.l++]=c&255,this[this.l++]=c>>8}for(;this.l<i;)this[this.l++]=0;return this}else switch(e){case 1:n=1,this[this.l]=r&255;break;case 2:n=2,this[this.l]=r&255,r>>>=8,this[this.l+1]=r&255;break;case 3:n=3,this[this.l]=r&255,r>>>=8,this[this.l+1]=r&255,r>>>=8,this[this.l+2]=r&255;break;case 4:n=4,Hx(this,r,this.l);break;case 8:if(n=8,a==="f"){Mx(this,r,this.l);break}case 16:break;case-4:n=4,Wx(this,r,this.l);break}return this.l+=n,this}function Mh(e,r){var a=Ch(this,this.l,e.length>>1);if(a!==e)throw new Error(r+"Expected "+e+" saw "+a);this.l+=e.length>>1}function Jt(e,r){e.l=r,e.read_shift=ls,e.chk=Mh,e.write_shift=qx}function ir(e,r){e.l+=r}function pe(e){var r=Fa(e);return Jt(r,0),r}function _a(e,r,a){if(e){var n,s,i;Jt(e,e.l||0);for(var c=e.length,o=0,l=0;e.l<c;){o=e.read_shift(1),o&128&&(o=(o&127)+((e.read_shift(1)&127)<<7));var d=As[o]||As[65535];for(n=e.read_shift(1),i=n&127,s=1;s<4&&n&128;++s)i+=((n=e.read_shift(1))&127)<<7*s;l=e.l+i;var u=d.f&&d.f(e,i,a);if(e.l=l,r(u,d,o))return}}}function xr(){var e=[],r=Je?256:2048,a=function(d){var u=pe(d);return Jt(u,0),u},n=a(r),s=function(){n&&(n.length>n.l&&(n=n.slice(0,n.l),n.l=n.length),n.length>0&&e.push(n),n=null)},i=function(d){return n&&d<n.length-n.l?n:(s(),n=a(Math.max(d+1,r)))},c=function(){return s(),Gt(e)},o=function(d){s(),n=d,n.l==null&&(n.l=n.length),i(r)};return{next:i,push:o,end:c,_bufs:e}}function ge(e,r,a,n){var s=+r,i;if(!isNaN(s)){n||(n=As[s].p||(a||[]).length||0),i=1+(s>=128?1:0)+1,n>=128&&++i,n>=16384&&++i,n>=2097152&&++i;var c=e.next(i);s<=127?c.write_shift(1,s):(c.write_shift(1,(s&127)+128),c.write_shift(1,s>>7));for(var o=0;o!=4;++o)if(n>=128)c.write_shift(1,(n&127)+128),n>>=7;else{c.write_shift(1,n);break}n>0&&Fo(a)&&e.push(a)}}function ds(e,r,a){var n=kt(e);if(r.s?(n.cRel&&(n.c+=r.s.c),n.rRel&&(n.r+=r.s.r)):(n.cRel&&(n.c+=r.c),n.rRel&&(n.r+=r.r)),!a||a.biff<12){for(;n.c>=256;)n.c-=256;for(;n.r>=65536;)n.r-=65536}return n}function td(e,r,a){var n=kt(e);return n.s=ds(n.s,r.s,a),n.e=ds(n.e,r.s,a),n}function us(e,r){if(e.cRel&&e.c<0)for(e=kt(e);e.c<0;)e.c+=r>8?16384:256;if(e.rRel&&e.r<0)for(e=kt(e);e.r<0;)e.r+=r>8?1048576:r>5?65536:16384;var a=Ve(e);return!e.cRel&&e.cRel!=null&&(a=Xx(a)),!e.rRel&&e.rRel!=null&&(a=$x(a)),a}function Zi(e,r){return e.s.r==0&&!e.s.rRel&&e.e.r==(r.biff>=12?1048575:r.biff>=8?65536:16384)&&!e.e.rRel?(e.s.cRel?"":"$")+Nt(e.s.c)+":"+(e.e.cRel?"":"$")+Nt(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(r.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+Dt(e.s.r)+":"+(e.e.rRel?"":"$")+Dt(e.e.r):us(e.s,r.biff)+":"+us(e.e,r.biff)}function Io(e){return parseInt(Gx(e),10)-1}function Dt(e){return""+(e+1)}function $x(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function Gx(e){return e.replace(/\$(\d+)$/,"$1")}function Po(e){for(var r=Kx(e),a=0,n=0;n!==r.length;++n)a=26*a+r.charCodeAt(n)-64;return a-1}function Nt(e){if(e<0)throw new Error("invalid column "+e);var r="";for(++e;e;e=Math.floor((e-1)/26))r=String.fromCharCode((e-1)%26+65)+r;return r}function Xx(e){return e.replace(/^([A-Z])/,"$$$1")}function Kx(e){return e.replace(/^\$([A-Z])/,"$1")}function Yx(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function Ct(e){for(var r=0,a=0,n=0;n<e.length;++n){var s=e.charCodeAt(n);s>=48&&s<=57?r=10*r+(s-48):s>=65&&s<=90&&(a=26*a+(s-64))}return{c:a-1,r:r-1}}function Ve(e){for(var r=e.c+1,a="";r;r=(r-1)/26|0)a=String.fromCharCode((r-1)%26+65)+a;return a+(e.r+1)}function vr(e){var r=e.indexOf(":");return r==-1?{s:Ct(e),e:Ct(e)}:{s:Ct(e.slice(0,r)),e:Ct(e.slice(r+1))}}function Ke(e,r){return typeof r>"u"||typeof r=="number"?Ke(e.s,e.e):(typeof e!="string"&&(e=Ve(e)),typeof r!="string"&&(r=Ve(r)),e==r?e:e+":"+r)}function at(e){var r={s:{c:0,r:0},e:{c:0,r:0}},a=0,n=0,s=0,i=e.length;for(a=0;n<i&&!((s=e.charCodeAt(n)-64)<1||s>26);++n)a=26*a+s;for(r.s.c=--a,a=0;n<i&&!((s=e.charCodeAt(n)-48)<0||s>9);++n)a=10*a+s;if(r.s.r=--a,n===i||s!=10)return r.e.c=r.s.c,r.e.r=r.s.r,r;for(++n,a=0;n!=i&&!((s=e.charCodeAt(n)-64)<1||s>26);++n)a=26*a+s;for(r.e.c=--a,a=0;n!=i&&!((s=e.charCodeAt(n)-48)<0||s>9);++n)a=10*a+s;return r.e.r=--a,r}
vendor: 6,487 bytes, line 483
483function rd(e,r){var a=e.t=="d"&&r instanceof Date;if(e.z!=null)try{return e.w=Br(e.z,a?Vt(r):r)}catch{}try{return e.w=Br((e.XF||{}).numFmtId||(a?14:0),a?Vt(r):r)}catch{return""+r}}function va(e,r,a){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&a&&a.dateNF&&(e.z=a.dateNF),e.t=="e"?ba[e.v]||e.v:r==null?rd(e,e.v):rd(e,r))}function La(e,r){var a=r&&r.sheet?r.sheet:"Sheet1",n={};return n[a]=e,{SheetNames:[a],Sheets:n}}function zh(e,r,a){var n=a||{},s=e?Array.isArray(e):n.dense,i=e||(s?[]:{}),c=0,o=0;if(i&&n.origin!=null){if(typeof n.origin=="number")c=n.origin;else{var l=typeof n.origin=="string"?Ct(n.origin):n.origin;c=l.r,o=l.c}i["!ref"]||(i["!ref"]="A1:A1")}var d={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(i["!ref"]){var u=at(i["!ref"]);d.s.c=u.s.c,d.s.r=u.s.r,d.e.c=Math.max(d.e.c,u.e.c),d.e.r=Math.max(d.e.r,u.e.r),c==-1&&(d.e.r=c=u.e.r+1)}for(var h=0;h!=r.length;++h)if(r[h]){if(!Array.isArray(r[h]))throw new Error("aoa_to_sheet expects an array of arrays");for(var f=0;f!=r[h].length;++f)if(!(typeof r[h][f]>"u")){var m={v:r[h][f]},x=c+h,p=o+f;if(d.s.r>x&&(d.s.r=x),d.s.c>p&&(d.s.c=p),d.e.r<x&&(d.e.r=x),d.e.c<p&&(d.e.c=p),r[h][f]&&typeof r[h][f]=="object"&&!Array.isArray(r[h][f])&&!(r[h][f]instanceof Date))m=r[h][f];else if(Array.isArray(m.v)&&(m.f=r[h][f][1],m.v=m.v[0]),m.v===null)if(m.f)m.t="n";else if(n.nullError)m.t="e",m.v=0;else if(n.sheetStubs)m.t="z";else continue;else typeof m.v=="number"?m.t="n":typeof m.v=="boolean"?m.t="b":m.v instanceof Date?(m.z=n.dateNF||He[14],n.cellDates?(m.t="d",m.w=Br(m.z,Vt(m.v))):(m.t="n",m.v=Vt(m.v),m.w=Br(m.z,m.v))):m.t="s";if(s)i[x]||(i[x]=[]),i[x][p]&&i[x][p].z&&(m.z=i[x][p].z),i[x][p]=m;else{var g=Ve({c:p,r:x});i[g]&&i[g].z&&(m.z=i[g].z),i[g]=m}}}return d.s.c<1e7&&(i["!ref"]=Ke(d)),i}function qn(e,r){return zh(null,e,r)}function Jx(e){return e.read_shift(4,"i")}function Gr(e,r){return r||(r=pe(4)),r.write_shift(4,e),r}function sr(e){var r=e.read_shift(4);return r===0?"":e.read_shift(r,"dbcs")}function Xt(e,r){var a=!1;return r==null&&(a=!0,r=pe(4+2*e.length)),r.write_shift(4,e.length),e.length>0&&r.write_shift(0,e,"dbcs"),a?r.slice(0,r.l):r}function Qx(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function Zx(e,r){return r||(r=pe(4)),r.write_shift(2,0),r.write_shift(2,0),r}function Do(e,r){var a=e.l,n=e.read_shift(1),s=sr(e),i=[],c={t:s,h:s};if((n&1)!==0){for(var o=e.read_shift(4),l=0;l!=o;++l)i.push(Qx(e));c.r=i}else c.r=[{ich:0,ifnt:0}];return e.l=a+r,c}function eg(e,r){var a=!1;return r==null&&(a=!0,r=pe(15+4*e.t.length)),r.write_shift(1,0),Xt(e.t,r),a?r.slice(0,r.l):r}var tg=Do;function rg(e,r){var a=!1;return r==null&&(a=!0,r=pe(23+4*e.t.length)),r.write_shift(1,1),Xt(e.t,r),r.write_shift(4,1),Zx({},r),a?r.slice(0,r.l):r}function Mr(e){var r=e.read_shift(4),a=e.read_shift(2);return a+=e.read_shift(1)<<16,e.l++,{c:r,iStyleRef:a}}function ln(e,r){return r==null&&(r=pe(8)),r.write_shift(-4,e.c),r.write_shift(3,e.iStyleRef||e.s),r.write_shift(1,0),r}function dn(e){var r=e.read_shift(2);return r+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:r}}function un(e,r){return r==null&&(r=pe(4)),r.write_shift(3,e.iStyleRef||e.s),r.write_shift(1,0),r}var ag=sr,Uh=Xt;function Ro(e){var r=e.read_shift(4);return r===0||r===4294967295?"":e.read_shift(r,"dbcs")}function Si(e,r){var a=!1;return r==null&&(a=!0,r=pe(127)),r.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&r.write_shift(0,e,"dbcs"),a?r.slice(0,r.l):r}var ng=sr,Xc=Ro,Oo=Si;function Lo(e){var r=e.slice(e.l,e.l+4),a=r[0]&1,n=r[0]&2;e.l+=4;var s=n===0?ki([0,0,0,0,r[0]&252,r[1],r[2],r[3]],0):qa(r,0)>>2;return a?s/100:s}function Hh(e,r){r==null&&(r=pe(4));var a=0,n=0,s=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?n=1:s==(s|0)&&s>=-536870912&&s<1<<29&&(n=1,a=1),n)r.write_shift(-4,((a?s:e)<<2)+(a+2));else throw new Error("unsupported RkNumber "+e)}function Wh(e){var r={s:{},e:{}};return r.s.r=e.read_shift(4),r.e.r=e.read_shift(4),r.s.c=e.read_shift(4),r.e.c=e.read_shift(4),r}function sg(e,r){return r||(r=pe(16)),r.write_shift(4,e.s.r),r.write_shift(4,e.e.r),r.write_shift(4,e.s.c),r.write_shift(4,e.e.c),r}var hn=Wh,$n=sg;function nr(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function an(e,r){return(r||pe(8)).write_shift(8,e,"f")}function ig(e){var r={},a=e.read_shift(1),n=a>>>1,s=e.read_shift(1),i=e.read_shift(2,"i"),c=e.read_shift(1),o=e.read_shift(1),l=e.read_shift(1);switch(e.l++,n){case 0:r.auto=1;break;case 1:r.index=s;var d=Ya[s];d&&(r.rgb=Ns(d));break;case 2:r.rgb=Ns([c,o,l]);break;case 3:r.theme=s;break}return i!=0&&(r.tint=i>0?i/32767:i/32768),r}function Ni(e,r){if(r||(r=pe(8)),!e||e.auto)return r.write_shift(4,0),r.write_shift(4,0),r;e.index!=null?(r.write_shift(1,2),r.write_shift(1,e.index)):e.theme!=null?(r.write_shift(1,6),r.write_shift(1,e.theme)):(r.write_shift(1,5),r.write_shift(1,0));var a=e.tint||0;if(a>0?a*=32767:a<0&&(a*=32768),r.write_shift(2,a),!e.rgb||e.theme!=null)r.write_shift(2,0),r.write_shift(1,0),r.write_shift(1,0);else{var n=e.rgb||"FFFFFF";typeof n=="number"&&(n=("000000"+n.toString(16)).slice(-6)),r.write_shift(1,parseInt(n.slice(0,2),16)),r.write_shift(1,parseInt(n.slice(2,4),16)),r.write_shift(1,parseInt(n.slice(4,6),16)),r.write_shift(1,255)}return r}function cg(e){var r=e.read_shift(1);e.l++;var a={fBold:r&1,fItalic:r&2,fUnderline:r&4,fStrikeout:r&8,fOutline:r&16,fShadow:r&32,fCondense:r&64,fExtend:r&128};return a}function og(e,r){r||(r=pe(2));var a=(e.italic?2:0)|(e.strike?8:0)|(e.outline?16:0)|(e.shadow?32:0)|(e.condense?64:0)|(e.extend?128:0);return r.write_shift(1,a),r.write_shift(1,0),r}function Vh(e,r){var a={2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"},n=e.read_shift(4);switch(n){case 0:return"";case 4294967295:case 4294967294:return a[e.read_shift(4)]||""}if(n>400)throw new Error("Unsupported Clipboard: "+n.toString(16));return e.l-=4,e.read_shift(0,r==1?"lpstr":"lpwstr")}function lg(e){return Vh(e,1)}function dg(e){return Vh(e,2)}var Bo=2,mr=3,ni=11,ad=12,Ci=19,si=64,ug=65,hg=71,fg=4108,pg=4126,$t=80,qh=81,mg=[$t,qh],Kc={1:{n:"CodePage",t:Bo},2:{n:"Category",t:$t},3:{n:"PresentationFormat",t:$t},4:{n:"ByteCount",t:mr},5:{n:"LineCount",t:mr},6:{n:"ParagraphCount",t:mr},7:{n:"SlideCount",t:mr},8:{n:"NoteCount",t:mr},9:{n:"HiddenCount",t:mr},10:{n:"MultimediaClipCount",t:mr},11:{n:"ScaleCrop",t:ni},12:{n:"HeadingPairs",t:fg},13:{n:"TitlesOfParts",t:pg},14:{n:"Manager",t:$t},15:{n:"Company",t:$t},16:{n:"LinksUpToDate",t:ni},17:{n:"CharacterCount",t:mr},19:{n:"SharedDoc",t:ni}
vendor: 10,856 bytes, line 483
483,22:{n:"HyperlinksChanged",t:ni},23:{n:"AppVersion",t:mr,p:"version"},24:{n:"DigSig",t:ug},26:{n:"ContentType",t:$t},27:{n:"ContentStatus",t:$t},28:{n:"Language",t:$t},29:{n:"Version",t:$t},255:{},2147483648:{n:"Locale",t:Ci},2147483651:{n:"Behavior",t:Ci},1919054434:{}},Yc={1:{n:"CodePage",t:Bo},2:{n:"Title",t:$t},3:{n:"Subject",t:$t},4:{n:"Author",t:$t},5:{n:"Keywords",t:$t},6:{n:"Comments",t:$t},7:{n:"Template",t:$t},8:{n:"LastAuthor",t:$t},9:{n:"RevNumber",t:$t},10:{n:"EditTime",t:si},11:{n:"LastPrinted",t:si},12:{n:"CreatedDate",t:si},13:{n:"ModifiedDate",t:si},14:{n:"PageCount",t:mr},15:{n:"WordCount",t:mr},16:{n:"CharCount",t:mr},17:{n:"Thumbnail",t:hg},18:{n:"Application",t:$t},19:{n:"DocSecurity",t:mr},255:{},2147483648:{n:"Locale",t:Ci},2147483651:{n:"Behavior",t:Ci},1919054434:{}},nd={1:"US",2:"CA",3:"",7:"RU",20:"EG",30:"GR",31:"NL",32:"BE",33:"FR",34:"ES",36:"HU",39:"IT",41:"CH",43:"AT",44:"GB",45:"DK",46:"SE",47:"NO",48:"PL",49:"DE",52:"MX",55:"BR",61:"AU",64:"NZ",66:"TH",81:"JP",82:"KR",84:"VN",86:"CN",90:"TR",105:"JS",213:"DZ",216:"MA",218:"LY",351:"PT",354:"IS",358:"FI",420:"CZ",886:"TW",961:"LB",962:"JO",963:"SY",964:"IQ",965:"KW",966:"SA",971:"AE",972:"IL",974:"QA",981:"IR",65535:"US"},xg=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"];function gg(e){return e.map(function(r){return[r>>16&255,r>>8&255,r&255]})}var vg=gg([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ya=kt(vg),ba={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},$h={"#NULL!":0,"#DIV/0!":7,"#VALUE!":15,"#REF!":23,"#NAME?":29,"#NUM!":36,"#N/A":42,"#GETTING_DATA":43,"#WTF?":255},Jc={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.sheet.macroEnabled.main+xml":"workbooks","application/vnd.ms-excel.sheet.binary.macroEnabled.main":"workbooks","application/vnd.ms-excel.addin.macroEnabled.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets","application/vnd.ms-excel.worksheet":"sheets","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":"charts","application/vnd.ms-excel.chartsheet":"charts","application/vnd.ms-excel.macrosheet+xml":"macros","application/vnd.ms-excel.macrosheet":"macros","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":"dialogs","application/vnd.ms-excel.dialogsheet":"dialogs","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":"strs","application/vnd.ms-excel.sharedStrings":"strs","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles","application/vnd.ms-excel.styles":"styles","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":"comments","application/vnd.ms-excel.comments":"comments","application/vnd.ms-excel.threadedcomments+xml":"threadedcomments","application/vnd.ms-excel.person+xml":"people","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"metadata","application/vnd.ms-excel.sheetMetadata":"metadata","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.ms-office.chartcolorstyle+xml":"TODO","application/vnd.ms-office.chartstyle+xml":"TODO","application/vnd.ms-office.chartex+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"links","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"links","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.openxmlformats-officedocument.themeOverride+xml":"TODO","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"TODO","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"drawings","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO","image/png":"TODO",sheet:"js"},ii={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},metadata:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",xlsb:"application/vnd.ms-excel.sheetMetadata"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};function Mo(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function yg(e){var r=Mo();if(!e||!e.match)return r;var a={};if((e.match(cr)||[]).forEach(function(n){var s=qe(n);switch(s[0].replace(Tx,"<")){case"<?xml":break;case"<Types":r.xmlns=s["xmlns"+(s[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":a[s.Extension]=s.ContentType;break;case"<Override":r[Jc[s.ContentType]]!==void 0&&r[Jc[s.ContentType]].push(s.PartName);break}}),r.xmlns!==Wt.CT)throw new Error("Unknown Namespace: "+r.xmlns);return r.calcchain=r.calcchains.length>0?r.calcchains[0]:"",r.sst=r.strs.length>0?r.strs[0]:"",r.style=r.styles.length>0?r.styles[0]:"",r.defaults=a,delete r.calcchains,r}function Gh(e,r){var a=yx(Jc),n=[],s;n[n.length]=Rt,n[n.length]=Se("Types",null,{xmlns:Wt.CT,"xmlns:xsd":Wt.xsd,"xmlns:xsi":Wt.xsi}),n=n.concat([["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["data","application/vnd.openxmlformats-officedocument.model+data"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["t
483if","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels","application/vnd.openxmlformats-package.relationships+xml"]].map(function(l){return Se("Default",null,{Extension:l[0],ContentType:l[1]})}));var i=function(l){e[l]&&e[l].length>0&&(s=e[l][0],n[n.length]=Se("Override",null,{PartName:(s[0]=="/"?"":"/")+s,ContentType:ii[l][r.bookType]||ii[l].xlsx}))},c=function(l){(e[l]||[]).forEach(function(d){n[n.length]=Se("Override",null,{PartName:(d[0]=="/"?"":"/")+d,ContentType:ii[l][r.bookType]||ii[l].xlsx})})},o=function(l){(e[l]||[]).forEach(function(d){n[n.length]=Se("Override",null,{PartName:(d[0]=="/"?"":"/")+d,ContentType:a[l][0]})})};return i("workbooks"),c("sheets"),c("charts"),o("themes"),["strs","styles"].forEach(i),["coreprops","extprops","custprops"].forEach(o),o("vba"),o("comments"),o("threadedcomments"),o("drawings"),c("metadata"),o("people"),n.length>2&&(n[n.length]="</Types>",n[1]=n[1].replace("/>",">")),n.join("")}var Qe
vendor: 2,399 bytes, line 483
483={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",XMISS:"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",XLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",CXML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",CXMLP:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",CMNT:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",SST:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",STY:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",THEME:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",CHART:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",CHARTEX:"http://schemas.microsoft.com/office/2014/relationships/chartEx",CS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",MS:"http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet",IMG:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",DRAW:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",XLMETA:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",TCMNT:"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",PEOPLE:"http://schemas.microsoft.com/office/2017/10/relationships/person",
vendor: 20,642 bytes, lines 483-493
483VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function Ss(e){var r=e.lastIndexOf("/");return e.slice(0,r+1)+"_rels/"+e.slice(r+1)+".rels"}function hs(e,r){var a={"!id":{}};if(!e)return a;r.charAt(0)!=="/"&&(r="/"+r);var n={};return(e.match(cr)||[]).forEach(function(s){var i=qe(s);if(i[0]==="<Relationship"){var c={};c.Type=i.Type,c.Target=i.Target,c.Id=i.Id,i.TargetMode&&(c.TargetMode=i.TargetMode);var o=i.TargetMode==="External"?i.Target:is(i.Target,r);a[o]=c,n[i.Id]=c}}),a["!id"]=n,a}function An(e){var r=[Rt,Se("Relationships",null,{xmlns:Wt.RELS})];return Ft(e["!id"]).forEach(function(a){r[r.length]=Se("Relationship",null,e["!id"][a])}),r.length>2&&(r[r.length]="</Relationships>",r[1]=r[1].replace("/>",">")),r.join("")}function ut(e,r,a,n,s,i){if(s||(s={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),r<0)for(r=e["!idx"];e["!id"]["rId"+r];++r);if(e["!idx"]=r+1,s.Id="rId"+r,s.Type=n,s.Target=a,[Qe.HLINK,Qe.XPATH,Qe.XMISS].indexOf(s.Type)>-1&&(s.TargetMode="External"),e["!id"][s.Id])throw new Error("Cannot rewrite rId "+r);return e["!id"][s.Id]=s,e[("/"+s.Target).replace("//","/")]=s,r}var _g="application/vnd.oasis.opendocument.spreadsheet";function bg(e,r){for(var a=To(e),n,s;n=ks.exec(a);)switch(n[3]){case"manifest":break;case"file-entry":if(s=qe(n[0],!1),s.path=="/"&&s.type!==_g)throw new Error("This OpenDocument is not a spreadsheet");break;case"encryption-data":case"algorithm":case"start-key-generation":case"key-derivation":throw new Error("Unsupported ODS Encryption");default:if(r&&r.WTF)throw n}}function jg(e){var r=[Rt];r.push(`<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"> 484`),r.push(` <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/> 485`);for(var a=0;a<e.length;++a)r.push(' <manifest:file-entry manifest:full-path="'+e[a][0]+'" manifest:media-type="'+e[a][1]+`"/> 486`);return r.push("</manifest:manifest>"),r.join("")}function sd(e,r,a){return[' <rdf:Description rdf:about="'+e+`"> 487`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(a||"odf")+"#"+r+`"/> 488`,` </rdf:Description> 489`].join("")}function wg(e,r){return[' <rdf:Description rdf:about="'+e+`"> 490`,' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+r+`"/> 491`,` </rdf:Description> 492`].join("")}function kg(e){var r=[Rt];r.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> 493`);for(var a=0;a!=e.length;++a)r.push(sd(e[a][0],e[a][1])),r.push(wg("",e[a][0]));return r.push(sd("","Document","pkg")),r.push("</rdf:RDF>"),r.join("")}function Xh(){return'<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>SheetJS '+yi.version+"</meta:generator></office:meta></office:document-meta>"}var Lr=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]],Sg=(function(){for(var e=new Array(Lr.length),r=0;r<Lr.length;++r){var a=Lr[r],n="(?:"+a[0].slice(0,a[0].indexOf(":"))+":)"+a[0].slice(a[0].indexOf(":")+1);e[r]=new RegExp("<"+n+"[^>]*>([\\s\\S]*?)</"+n+">")}return e})();function Kh(e){var r={};e=xt(e);for(var a=0;a<Lr.length;++a){var n=Lr[a],s=e.match(Sg[a]);s!=null&&s.length>0&&(r[n[1]]=rt(s[1])),n[2]==="date"&&r[n[1]]&&(r[n[1]]=wt(r[n[1]]))}return r}function ec(e,r,a,n,s){s[e]!=null||r==null||r===""||(s[e]=r,r=ht(r),n[n.length]=a?Se(e,r,a):Qt(e,r))}function Yh(e,r){var a=r||{},n=[Rt,Se("cp:coreProperties",null,{"xmlns:cp":Wt.CORE_PROPS,"xmlns:dc":Wt.dc,"xmlns:dcterms":Wt.dcterms,"xmlns:dcmitype":Wt.dcmitype,"xmlns:xsi":Wt.xsi})],s={};if(!e&&!a.Props)return n.join("");e&&(e.CreatedDate!=null&&ec("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:Gc(e.CreatedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},n,s),e.ModifiedDate!=null&&ec("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:Gc(e.ModifiedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},n,s));for(var i=0;i!=Lr.length;++i){var c=Lr[i],o=a.Props&&a.Props[c[1]]!=null?a.Props[c[1]]:e?e[c[1]]:null;o===!0?o="1":o===!1?o="0":typeof o=="number"&&(o=String(o)),o!=null&&ec(c[0],o,null,n,s)}return n.length>2&&(n[n.length]="</cp:coreProperties>",n[1]=n[1].replace("/>",">")),n.join("")}var Ja=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]],Jh=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function Qh(e,r,a,n){var s=[];if(typeof e=="string")s=Kl(e,n);else for(var i=0;i<e.length;++i)s=s.concat(e[i].map(function(u){return{v:u}}));var c=typeof r=="string"?Kl(r,n).map(function(u){return u.v}):r,o=0,l=0;if(c.length>0)for(var d=0;d!==s.length;d+=2){switch(l=+s[d+1].v,s[d].v){case"Worksheets":case"å·¥ä½è¡¨":case"ÐиÑÑÑ":case"Ø£ÙØ±Ø§Ù Ø§ÙØ¹Ù Ù":case"ã¯ã¼ã¯ã·ã¼ã":case"××××× ×ת ×¢××××":case"Arbeitsblätter":case"ÃalıÅma Sayfaları":case"Feuilles de calcul":case"Fogli di lavoro":case"Folhas de cálculo":case"Planilhas":case"Regneark":case"Hojas de cálculo":case"Werkbladen":a.Worksheets=l,a.SheetNames=c.slice(o,o+l);break;case"Named Ranges":case"Rangos con nombre":case"ååä»ãä¸è¦§":case"Benannte Bereiche":case"Navngivne omrÃ¥der":a.NamedRanges=l,a.DefinedNames=c.slice(o,o+l);break;case"Charts":case"Diagramme":a.Chartsheets=l,a.ChartNames=c.slice(o,o+l);break}o+=l}}function Ng(e,r,a){var n={};return r||(r={}),e=xt(e),Ja.forEach(function(s){var i=(e.match(js(s[0]))||[])[1];switch(s[2]){case"string":i&&(r[s[1]]=rt(i));break;case"bool":r[s[1]]=i==="true";break;case"raw":var c=e.match(new RegExp("<"+s[0]+"[^>]*>([\\s\\S]*?)</"+s[0]+">"));c&&c.length>0&&(n[s[1]]=c[1]);break}}),n.HeadingPairs&&n.TitlesOfParts&&Qh(n.HeadingPairs,n.TitlesOfParts,r,a),r}function Zh(e){var r=[],a=Se;return e||(e={}),e.Application="SheetJS",r[r.length]=Rt,r[r.length]=Se("Properties",null,{xmlns:Wt.EXT_PROPS,"xmlns:vt":Wt.vt}),Ja.forEach(function(n){if(e[n[1]]!==void 0){var s;switch(n[2]){case"string":s=ht(String(e[n[1]]));break;case"bool":s=e[n[1]]?"true":"false";break}s!==void 0&&(r[r.length]=a(n[0],s))}}),r[r.length]=a("HeadingPairs",a("vt:vector",a("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+a("vt:variant",a("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),r[r.length]=a("TitlesOfParts",a("vt:vector",e.SheetNames.map(function(n){return"<vt:lpstr>"+ht(n)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),r.length>2&&(r[r.length]="</Properties>",r[1]=r[1].replace("/>",">")),r.join("")}var Cg=/<[^>]+>[^<]*/g;function Eg(e,r){var a={},n="",s=e.match(Cg);if(s)for(var i=0;i!=s.length;++i){var c=s[i],o=qe(c);switch(o[0]){case"<?xml":break;case"<Properties":break;case"<property":n=rt(o.name);break;case"</property>":n=null;break;default:if(c.indexOf("<vt:")===0){var l=c.split(">"),d=l[0].slice(4),u=l[1];switch(d){case"lpstr":case"bstr":case"lpwstr":a[n]=rt(u);break;case"bool":a[n]=jt(u);break;case"i1":case"i2":case"i4":case"i8":case"int":case"uint":a[n]=parseInt(u,10);break;case"r4":case"r8":case"decimal":a[n]=parseFloat(u);break;case"filetime":case"date":a[n]=wt(u);break;case"cy":case"error":a[n]=rt(u);break;default:if(d.slice(-1)=="/")break;r.WTF&&typeof console<"u"&&console.warn("Unexpected",c,d,l)}}else if(c.slice(0,2)!=="</"){if(r.WTF)throw new Error(c)}}}return a}function e0(e){var r=[Rt,Se("Properties",null,{xmlns:Wt.CUST_PROPS,"xmlns:vt":Wt.vt})];if(!e)return r.join("");var a=1;return Ft(e).forEach(function(s){++a,r[r.length]=Se("property",Lx(e[s]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:a,name:ht(s)})}),r.length>2&&(r[r.length]="</Properties>",r[1]=r[1].replace("/>",">")),r.join("")}var Qc={Title:"Title",Subject:"Subject",Author:"Author",Keywords:"Keywords",Comments:"Description",LastAuthor:"LastAuthor",RevNumber:"Revision",Application:"AppName",LastPrinted:"LastPrinted",CreatedDate:"Created",ModifiedDate:"LastSaved",Category:"Category",Manager:"Manager",Company:"Company",AppVersion:"Version",ContentStatus:"ContentStatus",Identifier:"Identifier",Language:"Language"},tc;function Tg(e,r,a){tc||(tc=Hi(Qc)),r=tc[r]||r,e[r]=a}function Ag(e,r){var a=[];return Ft(Qc).map(function(n){for(var s=0;s<Lr.length;++s)if(Lr[s][1]==n)return Lr[s];for(s=0;s<Ja.length;++s)if(Ja[s][1]==n)return Ja[s];throw n}).forEach(function(n){if(e[n[1]]!=null){var s=r&&r.Props&&r.Props[n[1]]!=null?r.Props[n[1]]:e[n[1]];switch(n[2]){case"date":s=new Date(s).toISOString().replace(/\.\d*Z/,"Z");break}typeof s=="number"?s=String(s):s===!0||s===!1?s=s?"1":"0":s instanceof Date&&(s=new Date(s).toISOString().replace(/\.\d*Z/,"")),a.push(Qt(Qc[n[1]]||n[1],s))}}),Se("DocumentProperties",a.join(""),{xmlns:_r.o})}function Fg(e,r){var a=["Worksheets","SheetNames"],n="CustomDocumentProperties",s=[];return e&&Ft(e).forEach(function(i){if(Object.prototype.hasOwnProperty.call(e,i)){for(var c=0;c<Lr.length;++c)if(i==Lr[c][1])return;for(c=0;c<Ja.length;++c)if(i==Ja[c][1])return;for(c=0;c<a.length;++c)if(i==a[c])return;var o=e[i],l="string";typeof o=="number"?(l="float",o=String(o)):o===!0||o===!1?(l="boolean",o=o?"1":"0"):o=String(o),s.push(Se(ql(i),o,{"dt:dt":l}))}}),r&&Ft(r).forEach(function(i){if(Object.prototype.hasOwnProperty.call(r,i)&&!(e&&Object.prototype.hasOwnProperty.call(e,i))){var c=r[i],o="string";typeof c=="number"?(o="float",c=String(c)):c===!0||c===!1?(o="boolean",c=c?"1":"0"):c instanceof Date?(o="dateTime.tz",c=c.toISOString()):c=String(c),s.push(Se(ql(i),c,{"dt:dt":o}))}}),"<"+n+' xmlns="'+_r.o+'">'+s.join("")+"</"+n+">"}function zo(e){var r=e.read_shift(4),a=e.read_shift(4);return new Date((a/1e7*Math.pow(2,32)+r/1e7-11644473600)*1e3).toISOString().replace(/\.000/,"")}function Ig(e){var r=typeof e=="string"?new Date(Date.parse(e)):e,a=r.getTime()/1e3+11644473600,n=a%Math.pow(2,32),s=(a-n)/Math.pow(2,32);n*=1e7,s*=1e7;var i=n/Math.pow(2,32)|0;i>0&&(n=n%Math.pow(2,32),s+=i);var c=pe(8);return c.write_shift(4,n),c.write_shift(4,s),c}function t0(e,r,a){var n=e.l,s=e.read_shift(0,"lpstr-cp");if(a)for(;e.l-n&3;)++e.l;return s}function r0(e,r,a){var n=e.read_shift(0,"lpwstr");return n}function a0(e,r,a){return r===31?r0(e):t0(e,r,a)}function Zc(e,r,a){return a0(e,r,a===!1?0:4)}function Pg(e,r){if(!r)throw new Error("VtUnalignedString must have positive length");return a0(e,r,0)}function Dg(e){for(var r=e.read_shift(4),a=[],n=0;n!=r;++n){var s=e.l;a[n]=e.read_shift(0,"lpwstr").replace(pr,""),e.l-s&2&&(e.l+=2)}return a}function Rg(e){for(var r=e.read_shift(4),a=[],n=0;n!=r;++n)a[n]=e.read_shift(0,"lpstr-cp").replace(pr,"");return a}function Og(e){var r=e.l,a=Ei(e,qh);e[e.l]==0&&e[e.l+1]==0&&e.l-r&2&&(e.l+=2);var n=Ei(e,mr);return[a,n]}function Lg(e){for(var r=e.read_shift(4),a=[],n=0;n<r/2;++n)a.push(Og(e));return a}function id(e,r){for(var a=e.read_shift(4),n={},s=0;s!=a;++s){var i=e.read_shift(4),c=e.read_shift(4);n[i]=e.read_shift(c,r===1200?"utf16le":"utf8").replace(pr,"").replace(ss,"!"),r===1200&&c%2&&(e.l+=2)}return e.l&3&&(e.l=e.l>>3<<2),n}function n0(e){var r=e.read_shift(4),a=e.slice(e.l,e.l+r);return e.l+=r,(r&3)>0&&(e.l+=4-(r&3)&3),a}function Bg(e){var r={};return r.Size=e.read_shift(4),e.l+=r.Size+3-(r.Size-1)%4,r}function Ei(e,r,a){var n=e.read_shift(2),s,i=a||{};if(e.l+=2,r!==ad&&n!==r&&mg.indexOf(r)===-1&&!((r&65534)==4126&&(n&65534)==4126))throw new Error("Expected type "+r+" saw "+n);switch(r===ad?n:r){case 2:return s=e.read_shift(2,"i"),i.raw||(e.l+=2),s;case 3:return s=e.read_shift(4,"i"),s;case 11:return e.read_shift(4)!==0;case 19:return s=e.read_shift(4),s;case 30:return t0(e,n,4).replace(pr,"");case 31:return r0(e);case 64:return zo(e);case 65:return n0(e);case 71:return Bg(e);case 80:return Zc(e,n,!i.raw).replace(pr,"");case 81:return Pg(e,n).replace(pr,"");case 4108:return Lg(e);case 4126:case 4127:return n==4127?Dg(e):Rg(e);default:throw new Error("TypedPropertyValue unrecognized type "+r+" "+n)}}function cd(e,r){var a=pe(4),n=pe(4);switch(a.write_shift(4,e==80?31:e),e){case 3:n.write_shift(-4,r);break;case 5:n=pe(8),n.write_shift(8,r,"f");break;case 11:n.write_shift(4,r?1:0);break;case 64:n=Ig(r);break;case 31:case 80:for(n=pe(4+2*(r.length+1)+(r.length%2?0:2)),n.write_shift(4,r.length+1),n.write_shift(0,r,"dbcs");n.l!=n.length;)n.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+r)}return Gt([a,n])}function od(e,r){var a=e.l,n=e.read_shift(4),s=e.read_shift(4),i=[],c=0,o=0,l=-1,d={};for(c=0;c!=s;++c){var u=e.read_shift(4),h=e.read_shift(4);i[c]=[u,h+a]}i.sort(function(S,b){return S[1]-b[1]});var f={};for(c=0;c!=s;++c){if(e.l!==i[c][1]){var m=!0;if(c>0&&r)switch(r[i[c-1][0]].t){case 2:e.l+2===i[c][1]&&(e.l+=2,m=!1);break;case 80:e.l<=i[c][1]&&(e.l=i[c][1],m=!1);break;case 4108:e.l<=i[c][1]&&(e.l=i[c][1],m=!1);break}if((!r||c==0)&&e.l<=i[c][1]&&(m=!1,e.l=i[c][1]),m)throw new Error("Read Error: Expected address "+i[c][1]+" at "+e.l+" :"+c)}if(r){var x=r[i[c][0]];if(f[x.n]=Ei(e,x.t,{raw:!0}),x.p==="version"&&(f[x.n]=String(f[x.n]>>16)+"."+("0000"+String(f[x.n]&65535)).slice(-4)),x.n=="CodePage")switch(f[x.n]){case 0:f[x.n]=1252;case 874:case 932:case 936:case 949:case 950:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 1e4:case 1200:case 1201:case 1252:case 65e3:case-536:case 65001:case-535:Wr(o=f[x.n]>>>0&65535);break;default:throw new Error("Unsupported CodePage: "+f[x.n])}}else if(i[c][0]===1){if(o=f.CodePage=Ei(e,Bo),Wr(o),l!==-1){var p=e.l;e.l=i[l][1],d=id(e,o),e.l=p}}else if(i[c][0]===0){if(o===0){l=c,e.l=i[c+1][1];continue}d=id(e,o)}else{var g=d[i[c][0]],w;switch(e[e.l]){case 65:e.l+=4,w=n0(e);break;case 30:e.l+=4,w=Zc(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 31:e.l+=4,w=Zc(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 3:e.l+=4,w=e.read_shift(4,"i");break;case 19:e.l+=4,w=e.read_shift(4);break;case 5:e.l+=4,w=e.read_shift(8,"f");break;case 11:e.l+=4,w=Pt(e,4);break;case 64:e.l+=4,w=wt(zo(e));break;default:throw new Error("unparsed value: "+e[e.l])}f[g]=w}}return e.l=a+n,f}var s0=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function Mg(e){switch(typeof e){case"boolean":return 11;case"number":return(e|0)==e?3:5;case"string":return 31;case"object":if(e instanceof Date)return 64;break}return-1}function ld(e,r,a){var n=pe(8),s=[],i=[],c=8,o=0,l=pe(8),d=pe(8);if(l.write_shift(4,2),l.write_shift(4,1200),d.write_shift(4,1),i.push(l),s.push(d),c+=8+l.length,!r){d=pe(8),d.write_shift(4,0),s.unshift(d);var u=[pe(4)];for(u[0].write_shift(4,e.length),o=0;o<e.length;++o){var h=e[o][0];for(l=pe(8+2*(h.length+1)+(h.length%2?0:2)),l.write_shift(4,o+2),l.write_shift(4,h.length+1),l.write_shift(0,h,"dbcs");l.l!=l.length;)l.write_shift(1,0);u.push(l)}l=Gt(u),i.unshift(l),c+=8+l.length}for(o=0;o<e.length;++o)if(!(r&&!r[e[o][0]])&&!(s0.indexOf(e[o][0])>-1||Jh.indexOf(e[o][0])>-1)&&e[o][1]!=null){var f=e[o][1],m=0;if(r){m=+r[e[o][0]];var x=a[m];if(x.p=="version"&&typeof f=="string"){var p=f.split(".");f=(+p[0]<<16)+(+p[1]||0)}l=cd(x.t,f)}else{var g=Mg(f);g==-1&&(g=31,f=String(f)),l=cd(g,f)}i.push(l),d=pe(8),d.write_shift(4,r?m:2+o),s.push(d),c+=8+l.length}var w=8*(i.length+1);for(o=0;o<i.length;++o)s[o].write_shift(4,w),w+=i[o].length;return n.write_shift(4,c),n.write_shift(4,i.length),Gt([n].concat(s).concat(i))}function dd(e,r,a){var n=e.content;if(!n)return{};Jt(n,0);var s,i,c,o,l=0;n.chk("feff","Byte Order: "),n.read_shift(2);var d=n.read_shift(4),u=n.read_shift(16);if(u!==Be.utils.consts.HEADER_CLSID&&u!==a)throw new Error("Bad PropertySet CLSID "+u);if(s=n.read_shift(4),s!==1&&s!==2)throw new Error("Unrecognized #Sets: "+s);if(i=n.read_shift(16),o=n.read_shift(4),s===1&&o!==n.l)throw new Error("Length mismatch: "+o+" !== "+n.l);s===2&&(c=n.read_shift(16),l=n.read_shift(4));var h=od(n,r),f={SystemIdentifier:d};for(var m in h)f[m]=h[m];if(f.FMTID=i,s===1)return f;if(l-n.l==2&&(n.l+=2),n.l!==l)throw new Error("Length mismatch 2: "+n.l+" !== "+l);var x;try{x=od(n,null)}catch{}for(m in x)f[m]=x[m];return f.FMTID=[i,c],f}function ud(e,r,a,n,s,i){var c=pe(s?68:48),o=[c];c.write_shift(2,65534),c.write_shift(2,0),c.write_shift(4,842412599),c.write_shift(16,Be.utils.consts.HEADER_CLSID,"hex"),c.write_shift(4,s?2:1),c.write_shift(16,r,"hex"),c.write_shift(4,s?68:48);var l=ld(e,a,n);if(o.push(l),s){var d=ld(s,null,null);c.write_shift(16,i,"hex"),c.write_shift(4,68+l.length),o.push(d)}return Gt(o)}function wa(e,r){return e.read_shift(r),null}function zg(e,r){r||(r=pe(e));for(var a=0;a<e;++a)r.write_shift(1,0);return r}function Ug(e,r,a){for(var n=[],s=e.l+r;e.l<s;)n.push(a(e,s-e.l));if(s!==e.l)throw new Error("Slurp error");return n}function Pt(e,r){return e.read_shift(r)===1}function lr(e,r){return r||(r=pe(2)),r.write_shift(2,+!!e),r}function Bt(e){return e.read_shift(2,"u")}function Ir(e,r){return r||(r=pe(2)),r.write_shift(2,e),r}function i0(e,r){return Ug(e,r,Bt)}function Hg(e){var r=e.read_shift(1),a=e.read_shift(1);return a===1?r:r===1}function c0(e,r,a){return a||(a=pe(2)),a.write_shift(1,r=="e"?+e:+!!e),a.write_shift(1,r=="e"?1:0),a}function Us(e,r,a){var n=e.read_shift(a&&a.biff>=12?2:1),s="sbcs-cont";if(a&&a.biff>=8,!a||a.biff==8){var i=e.read_shift(1);i&&(s="dbcs-cont")}else a.biff==12&&(s="wstr");a.biff>=2&&a.biff<=5&&(s="cpstr");var c=n?e.read_shift(n,s):"";return c}function Wg(e){var r=e.read_shift(2),a=e.read_shift(1),n=a&4,s=a&8,i=1+(a&1),c=0,o,l={};s&&(c=e.read_shift(2)),n&&(o=e.read_shift(4));var d=i==2?"dbcs-cont":"sbcs-cont",u=r===0?"":e.read_shift(r,d);return s&&(e.l+=4*c),n&&(e.l+=o),l.t=u,s||(l.raw="<t>"+l.t+"</t>",l.r=l.t),l}function Vg(e){var r=e.t||"",a=pe(3);a.write_shift(2,r.length),a.write_shift(1,1);var n=pe(2*r.length);n.write_shift(2*r.length,r,"utf16le");var s=[a,n];return Gt(s)}function nn(e,r,a){var n;if(a){if(a.biff>=2&&a.biff<=5)return e.read_shift(r,"cpstr");if(a.biff>=12)return e.read_shift(r,"dbcs-cont")}var s=e.read_shift(1);return s===0?n=e.read_shift(r,"sbcs-cont"):n=e.read_shift(r,"dbcs-cont"),n}function Hs(e,r,a){var n=e.read_shift(a&&a.biff==2?1:2);return n===0?(e.l++,""):nn(e,n,a)}function fn(e,r,a){if(a.biff>5)return Hs(e,r,a);var n=e.read_shift(1);return n===0?(e.l++,""):e.read_shift(n,a.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function o0(e,r,a){return a||(a=pe(3+2*e.length)),a.write_shift(2,e.length),a.write_shift(1,1),a.write_shift(31,e,"utf16le"),a}function qg(e){var r=e.read_shift(1);e.l++;var a=e.read_shift(2);return e.l+=2,[r,a]}function $g(e){var r=e.read_shift(4),a=e.l,n=!1;r>24&&(e.l+=r-24,e.read_shift(16)==="795881f43b1d7f48af2c825dc4852763"&&(n=!0),e.l=a);var s=e.read_shift((n?r-24:r)>>1,"utf16le").replace(pr,"");return n&&(e.l+=24),s}function Gg(e){for(var r=e.read_shift(2),a="";r-- >0;)a+="../";var n=e.read_shift(0,"lpstr-ansi");if(e.l+=2,e.read_shift(2)!=57005)throw new Error("Bad FileMoniker");var s=e.read_shift(4);if(s===0)return a+n.replace(/\\/g,"/");var i=e.read_shift(4);if(e.read_shift(2)!=3)throw new Error("Bad FileMoniker");var c=e.read_shift(i>>1,"utf16le").replace(pr,"");return a+c}function Xg(e,r){var a=e.read_shift(16);switch(a){case"e0c9ea79f9bace118c8200aa004ba90b":return $g(e);case"0303000000000000c000000000000046":return Gg(e);default:throw new Error("Unsupported Moniker "+a)}}function ci(e){var r=e.read_shift(4),a=r>0?e.read_shift(r,"utf16le").replace(pr,""):"";return a}function hd(e,r){r||(r=pe(6+e.length*2)),r.write_shift(4,1+e.length);for(var a=0;a<e.length;++a)r.write_shift(2,e.charCodeAt(a));return r.write_shift(2,0),r}function Kg(e,r){var a=e.l+r,n=e.read_shift(4);if(n!==2)throw new Error("Unrecognized streamVersion: "+n);var s=e.read_shift(2);e.l+=2;var i,c,o,l,d="",u,h;s&16&&(i=ci(e,a-e.l)),s&128&&(c=ci(e,a-e.l)),(s&257)===257&&(o=ci(e,a-e.l)),(s&257)===1&&(l=Xg(e,a-e.l)),s&8&&(d=ci(e,a-e.l)),s&32&&(u=e.read_shift(16)),s&64&&(h=zo(e)),e.l=a;var f=c||o||l||"";
493f&&d&&(f+="#"+d),f||(f="#"+d),s&2&&f.charAt(0)=="/"&&f.charAt(1)!="/"&&(f="file://"+f);var m={Target:f};return u&&(m.guid=u),h&&(m.time=h),i&&(m.Tooltip=i),m}function Yg(e){var r=pe(512),a=0,n=e.Target;n.slice(0,7)=="file://"&&(n=n.slice(7));var s=n.indexOf("#"),i=s>-1?31:23;switch(n.charAt(0)){case"#":i=28;break;case".":i&=-3;break}r.write_shift(4,2),r.write_shift(4,i);var c=[8,6815827,6619237,4849780,83];for(a=0;a<c.length;++a)r.write_shift(4,c[a]);if(i==28)n=n.slice(1),hd(n,r);else if(i&2){for(c="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),a=0;a<c.length;++a)r.write_shift(1,parseInt(c[a],16));var o=s>-1?n.slice(0,s):n;for(r.write_shift(4,2*(o.length+1)),a=0;a<o.length;++a)r.write_shift(2,o.charCodeAt(a));r.write_shift(2,0),i&8&&hd(s>-1?n.slice(s+1):"",r)}else{for(c="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),a=0;a<c.length;++a)r.write_shift(1,parseInt(c[a],16));for(var l=0;n.slice(l*3,l*3+3)=="../"||n.slice(l*3,l*3+3)=="..\\";)++l;for(r.write_shift(2,l),r.write_shift(4,n.length-3*l+1),a=0;a<n.length-3*l;++a)r.write_shift(1,n.charCodeAt(a+3*l)&255);for(r.write_shift(1,0),r.write_shift(2,65535),r.write_shift(2,57005),a=0;a<6;++a)r.write_shift(4,0)}return r.slice(0,r.l)}function l0(e){var r=e.read_shift(1),a=e.read_shift(1),n=e.read_shift(1),s=e.read_shift(1);return[r,a,n,s]}function d0(e,r){var a=l0(e);return a[3]=0,a}function ia(e){var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(2);return{r,c:a,ixfe:n}}function sn(e,r,a,n){return n||(n=pe(6)),n.write_shift(2,e),n.write_shift(2,r),n.write_shift(2,a||0),n}function Jg(e){var r=e.read_shift(2),a=e.read_shift(2);return e.l+=8,{type:r,flags:a}}function Qg(e,r,a){return r===0?"":fn(e,r,a)}function Zg(e,r,a){var n=a.biff>8?4:2,s=e.read_shift(n),i=e.read_shift(n,"i"),c=e.read_shift(n,"i");return[s,i,c]}function u0(e){var r=e.read_shift(2),a=Lo(e);return[r,a]}function ev(e,r,a){e.l+=4,r-=4;var n=e.l+r,s=Us(e,r,a),i=e.read_shift(2);if(n-=e.l,i!==n)throw new Error("Malformed AddinUdf: padding = "+n+" != "+i);return e.l+=i,s}function qi(e){var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(2),s=e.read_shift(2);return{s:{c:n,r},e:{c:s,r:a}}}function h0(e,r){return r||(r=pe(8)),r.write_shift(2,e.s.r),r.write_shift(2,e.e.r),r.write_shift(2,e.s.c),r.write_shift(2,e.e.c),r}function f0(e){var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(1),s=e.read_shift(1);return{s:{c:n,r},e:{c:s,r:a}}}var tv=f0;function p0(e){e.l+=4;var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(2);return e.l+=12,[a,r,n]}function rv(e){var r={};return e.l+=4,e.l+=16,r.fSharedNote=e.read_shift(2),e.l+=4,r}function av(e){var r={};return e.l+=4,e.cf=e.read_shift(2),r}function er(e){e.l+=2,e.l+=e.read_shift(2)}var nv={0:er,4:er,5:er,6:er,7:av,8:er,9:er,10:er,11:er,12:er,13:rv,14:er,15:er,16:er,17:er,18:er,19:er,20:er,21:p0};function sv(e,r){for(var a=e.l+r,n=[];e.l<a;){var s=e.read_shift(2);e.l-=2;try{n.push(nv[s](e,a-e.l))}catch{return e.l=a,n}}return e.l!=a&&(e.l=a),n}function oi(e,r){var a={BIFFVer:0,dt:0};switch(a.BIFFVer=e.read_shift(2),r-=2,r>=2&&(a.dt=e.read_shift(2),e.l-=2),a.BIFFVer){case 1536:case 1280:case 1024:case 768:case 512:case 2:case 7:break;default:if(r>6)throw new Error("Unexpected BIFF Ver "+a.BIFFVer)}return e.read_shift(r),a}function Uo(e,r,a){var n=1536,s=16;switch(a.bookType){case"biff8":break;case"biff5":n=1280,s=8;break;case"biff4":n=4,s=6;break;case"biff3":n=3,s=6;break;case"biff2":n=2,s=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var i=pe(s);return i.write_shift(2,n),i.write_shift(2,r),s>4&&i.write_shift(2,29282),s>6&&i.write_shift(2,1997),s>8&&(i.write_shift(2,49161),i.write_shift(2,1),i.write_shift(2,1798),i.write_shift(2,0)),i}function iv(e,r){return r===0||e.read_shift(2),1200}function cv(e,r,a){if(a.enc)return e.l+=r,"";var n=e.l,s=fn(e,0,a);return e.read_shift(r+n-e.l),s}function ov(e,r){var a=!r||r.biff==8,n=pe(a?112:54);for(n.write_shift(r.biff==8?2:1,7),a&&n.write_shift(1,0),n.write_shift(4,859007059),n.write_shift(4,5458548|(a?0:536870912));n.l<n.length;)n.write_shift(1,a?0:32);return n}function lv(e,r,a){var n=a&&a.biff==8||r==2?e.read_shift(2):(e.l+=r,0);return{fDialog:n&16,fBelow:n&64,fRight:n&128}}function dv(e,r,a){var n=e.read_shift(4),s=e.read_shift(1)&3,i=e.read_shift(1);switch(i){case 0:i="Worksheet";break;case 1:i="Macrosheet";break;case 2:i="Chartsheet";break;case 6:i="VBAModule";break}var c=Us(e,0,a);return c.length===0&&(c="Sheet1"),{pos:n,hs:s,dt:i,name:c}}function uv(e,r){var a=!r||r.biff>=8?2:1,n=pe(8+a*e.name.length);n.write_shift(4,e.pos),n.write_shift(1,e.hs||0),n.write_shift(1,e.dt),n.write_shift(1,e.name.length),r.biff>=8&&n.write_shift(1,1),n.write_shift(a*e.name.length,e.name,r.biff<8?"sbcs":"utf16le");var s=n.slice(0,n.l);
vendor: 11,116 bytes, line 493
493return s.l=n.l,s}function hv(e,r){for(var a=e.l+r,n=e.read_shift(4),s=e.read_shift(4),i=[],c=0;c!=s&&e.l<a;++c)i.push(Wg(e));return i.Count=n,i.Unique=s,i}function fv(e,r){var a=pe(8);a.write_shift(4,e.Count),a.write_shift(4,e.Unique);for(var n=[],s=0;s<e.length;++s)n[s]=Vg(e[s]);var i=Gt([a].concat(n));return i.parts=[a.length].concat(n.map(function(c){return c.length})),i}function pv(e,r){var a={};return a.dsst=e.read_shift(2),e.l+=r-2,a}function mv(e){var r={};r.r=e.read_shift(2),r.c=e.read_shift(2),r.cnt=e.read_shift(2)-r.c;var a=e.read_shift(2);e.l+=4;var n=e.read_shift(1);return e.l+=3,n&7&&(r.level=n&7),n&32&&(r.hidden=!0),n&64&&(r.hpt=a/20),r}function xv(e){var r=Jg(e);if(r.type!=2211)throw new Error("Invalid Future Record "+r.type);var a=e.read_shift(4);return a!==0}function gv(e){return e.read_shift(2),e.read_shift(4)}function fd(e,r,a){var n=0;a&&a.biff==2||(n=e.read_shift(2));var s=e.read_shift(2);a&&a.biff==2&&(n=1-(s>>15),s&=32767);var i={Unsynced:n&1,DyZero:(n&2)>>1,ExAsc:(n&4)>>2,ExDsc:(n&8)>>3};return[i,s]}function vv(e){var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(2),s=e.read_shift(2),i=e.read_shift(2),c=e.read_shift(2),o=e.read_shift(2),l=e.read_shift(2),d=e.read_shift(2);return{Pos:[r,a],Dim:[n,s],Flags:i,CurTab:c,FirstTab:o,Selected:l,TabRatio:d}}function yv(){var e=pe(18);return e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,29280),e.write_shift(2,17600),e.write_shift(2,56),e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,1),e.write_shift(2,500),e}function _v(e,r,a){if(a&&a.biff>=2&&a.biff<5)return{};var n=e.read_shift(2);return{RTL:n&64}}function bv(e){var r=pe(18),a=1718;return e&&e.RTL&&(a|=64),r.write_shift(2,a),r.write_shift(4,0),r.write_shift(4,64),r.write_shift(4,0),r.write_shift(4,0),r}function jv(){}function wv(e,r,a){var n={dyHeight:e.read_shift(2),fl:e.read_shift(2)};switch(a&&a.biff||8){case 2:break;case 3:case 4:e.l+=2;break;default:e.l+=10;break}return n.name=Us(e,0,a),n}function kv(e,r){var a=e.name||"Arial",n=r&&r.biff==5,s=n?15+a.length:16+2*a.length,i=pe(s);return i.write_shift(2,e.sz*20),i.write_shift(4,0),i.write_shift(2,400),i.write_shift(4,0),i.write_shift(2,0),i.write_shift(1,a.length),n||i.write_shift(1,1),i.write_shift((n?1:2)*a.length,a,n?"sbcs":"utf16le"),i}function Sv(e){var r=ia(e);return r.isst=e.read_shift(4),r}function Nv(e,r,a,n){var s=pe(10);return sn(e,r,n,s),s.write_shift(4,a),s}function Cv(e,r,a){a.biffguess&&a.biff==2&&(a.biff=5);var n=e.l+r,s=ia(e);a.biff==2&&e.l++;var i=Hs(e,n-e.l,a);return s.val=i,s}function Ev(e,r,a,n,s){var i=!s||s.biff==8,c=pe(8+ +i+(1+i)*a.length);return sn(e,r,n,c),c.write_shift(2,a.length),i&&c.write_shift(1,1),c.write_shift((1+i)*a.length,a,i?"utf16le":"sbcs"),c}function Tv(e,r,a){var n=e.read_shift(2),s=fn(e,0,a);return[n,s]}function Av(e,r,a,n){var s=a&&a.biff==5;n||(n=pe(s?3+r.length:5+2*r.length)),n.write_shift(2,e),n.write_shift(s?1:2,r.length),s||n.write_shift(1,1),n.write_shift((s?1:2)*r.length,r,s?"sbcs":"utf16le");var i=n.length>n.l?n.slice(0,n.l):n;return i.l==null&&(i.l=i.length),i}var Fv=fn;function pd(e,r,a){var n=e.l+r,s=a.biff==8||!a.biff?4:2,i=e.read_shift(s),c=e.read_shift(s),o=e.read_shift(2),l=e.read_shift(2);return e.l=n,{s:{r:i,c:o},e:{r:c,c:l}}}function Iv(e,r){var a=r.biff==8||!r.biff?4:2,n=pe(2*a+6);return n.write_shift(a,e.s.r),n.write_shift(a,e.e.r+1),n.write_shift(2,e.s.c),n.write_shift(2,e.e.c+1),n.write_shift(2,0),n}function Pv(e){var r=e.read_shift(2),a=e.read_shift(2),n=u0(e);return{r,c:a,ixfe:n[0],rknum:n[1]}}function Dv(e,r){for(var a=e.l+r-2,n=e.read_shift(2),s=e.read_shift(2),i=[];e.l<a;)i.push(u0(e));if(e.l!==a)throw new Error("MulRK read error");var c=e.read_shift(2);if(i.length!=c-s+1)throw new Error("MulRK length mismatch");return{r:n,c:s,C:c,rkrec:i}}function Rv(e,r){for(var a=e.l+r-2,n=e.read_shift(2),s=e.read_shift(2),i=[];e.l<a;)i.push(e.read_shift(2));if(e.l!==a)throw new Error("MulBlank read error");var c=e.read_shift(2);if(i.length!=c-s+1)throw new Error("MulBlank length mismatch");return{r:n,c:s,C:c,ixfe:i}}function Ov(e,r,a,n){var s={},i=e.read_shift(4),c=e.read_shift(4),o=e.read_shift(4),l=e.read_shift(2);return s.patternType=xg[o>>26],n.cellStyles&&(s.alc=i&7,s.fWrap=i>>3&1,s.alcV=i>>4&7,s.fJustLast=i>>7&1,s.trot=i>>8&255,s.cIndent=i>>16&15,s.fShrinkToFit=i>>20&1,s.iReadOrder=i>>22&2,s.fAtrNum=i>>26&1,s.fAtrFnt=i>>27&1,s.fAtrAlc=i>>28&1,s.fAtrBdr=i>>29&1,s.fAtrPat=i>>30&1,s.fAtrProt=i>>31&1,s.dgLeft=c&15,s.dgRight=c>>4&15,s.dgTop=c>>8&15,s.dgBottom=c>>12&15,s.icvLeft=c>>16&127,s.icvRight=c>>23&127,s.grbitDiag=c>>30&3,s.icvTop=o&127,s.icvBottom=o>>7&127,s.icvDiag=o>>14&127,s.dgDiag=o>>21&15,s.icvFore=l&127,s.icvBack=l>>7&127,s.fsxButton=l>>14&1),s}function Lv(e,r,a){var n={};return n.ifnt=e.read_shift(2),n.numFmtId=e.read_shift(2),n.flags=e.read_shift(2),n.fStyle=n.flags>>2&1,r-=6,n.data=Ov(e,r,n.fStyle,a),n}function md(e,r,a,n){var s=a&&a.biff==5;n||(n=pe(s?16:20)),n.write_shift(2,0),e.style?(n.write_shift(2,e.numFmtId||0),n.write_shift(2,65524)):(n.write_shift(2,e.numFmtId||0),n.write_shift(2,r<<4));var i=0;return e.numFmtId>0&&s&&(i|=1024),n.write_shift(4,i),n.write_shift(4,0),s||n.write_shift(4,0),n.write_shift(2,0),n}function Bv(e){e.l+=4;var r=[e.read_shift(2),e.read_shift(2)];if(r[0]!==0&&r[0]--,r[1]!==0&&r[1]--,r[0]>7||r[1]>7)throw new Error("Bad Gutters: "+r.join("|"));return r}function Mv(e){var r=pe(8);return r.write_shift(4,0),r.write_shift(2,0),r.write_shift(2,0),r}function xd(e,r,a){var n=ia(e);(a.biff==2||r==9)&&++e.l;var s=Hg(e);return n.val=s,n.t=s===!0||s===!1?"b":"e",n}function zv(e,r,a,n,s,i){var c=pe(8);return sn(e,r,n,c),c0(a,i,c),c}function Uv(e,r,a){a.biffguess&&a.biff==2&&(a.biff=5);var n=ia(e),s=nr(e);return n.val=s,n}function Hv(e,r,a,n){var s=pe(14);return sn(e,r,n,s),an(a,s),s}var gd=Qg;function Wv(e,r,a){var n=e.l+r,s=e.read_shift(2),i=e.read_shift(2);if(a.sbcch=i,i==1025||i==14849)return[i,s];if(i<1||i>255)throw new Error("Unexpected SupBook type: "+i);for(var c=nn(e,i),o=[];n>e.l;)o.push(Hs(e));return[i,s,c,o]}function vd(e,r,a){var n=e.read_shift(2),s,i={fBuiltIn:n&1,fWantAdvise:n>>>1&1,fWantPict:n>>>2&1,fOle:n>>>3&1,fOleLink:n>>>4&1,cf:n>>>5&1023,fIcon:n>>>15&1};return a.sbcch===14849&&(s=ev(e,r-2,a)),i.body=s||e.read_shift(r-2),typeof s=="string"&&(i.Name=s),i}var Vv=["_xlnm.Consolidate_Area","_xlnm.Auto_Open","_xlnm.Auto_Close","_xlnm.Extract","_xlnm.Database","_xlnm.Criteria","_xlnm.Print_Area","_xlnm.Print_Titles","_xlnm.Recorder","_xlnm.Data_Form","_xlnm.Auto_Activate","_xlnm.Auto_Deactivate","_xlnm.Sheet_Title","_xlnm._FilterDatabase"];function yd(e,r,a){var n=e.l+r,s=e.read_shift(2),i=e.read_shift(1),c=e.read_shift(1),o=e.read_shift(a&&a.biff==2?1:2),l=0;(!a||a.biff>=5)&&(a.biff!=5&&(e.l+=2),l=e.read_shift(2),a.biff==5&&(e.l+=2),e.l+=4);var d=nn(e,c,a);s&32&&(d=Vv[d.charCodeAt(0)]);var u=n-e.l;a&&a.biff==2&&--u;var h=n==e.l||o===0||!(u>0)?[]:sj(e,u,a,o);return{chKey:i,Name:d,itab:l,rgce:h}}function m0(e,r,a){if(a.biff<8)return qv(e,r,a);for(var n=[],s=e.l+r,i=e.read_shift(a.biff>8?4:2);i--!==0;)n.push(Zg(e,a.biff>8?12:6,a));if(e.l!=s)throw new Error("Bad ExternSheet: "+e.l+" != "+s);return n}function qv(e,r,a){e[e.l+1]==3&&e[e.l]++;var n=Us(e,r,a);return n.charCodeAt(0)==3?n.slice(1):n}function $v(e,r,a){if(a.biff<8){e.l+=r;return}var n=e.read_shift(2),s=e.read_shift(2),i=nn(e,n,a),c=nn(e,s,a);return[i,c]}function Gv(e,r,a){var n=f0(e);e.l++;var s=e.read_shift(1);return r-=8,[ij(e,r,a),s,n]}function _d(e,r,a){var n=tv(e);switch(a.biff){case 2:e.l++,r-=7;break;case 3:case 4:e.l+=2,r-=8;break;default:e.l+=6,r-=12}return[n,aj(e,r,a)]}function Xv(e){var r=e.read_shift(4)!==0,a=e.read_shift(4)!==0,n=e.read_shift(4);return[r,a,n]}function Kv(e,r,a){if(!(a.biff<8)){var n=e.read_shift(2),s=e.read_shift(2),i=e.read_shift(2),c=e.read_shift(2),o=fn(e,0,a);return a.biff<8&&e.read_shift(1),[{r:n,c:s},o,c,i]}}function Yv(e,r,a){return Kv(e,r,a)}function Jv(e,r){for(var a=[],n=e.read_shift(2);n--;)a.push(qi(e));return a}function Qv(e){var r=pe(2+e.length*8);r.write_shift(2,e.length);for(var a=0;a<e.length;++a)h0(e[a],r);return r}function Zv(e,r,a){if(a&&a.biff<8)return t1(e,r,a);var n=p0(e),s=sv(e,r-22,n[1]);return{cmo:n,ft:s}}var e1={8:function(e,r){var a=e.l+r;e.l+=10;var n=e.read_shift(2);e.l+=4,e.l+=2,e.l+=2,e.l+=2,e.l+=4;var s=e.read_shift(1);return e.l+=s,e.l=a,{fmt:n}}};function t1(e,r,a){e.l+=4;var n=e.read_shift(2),s=e.read_shift(2),i=e.read_shift(2);e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=6,r-=36;var c=[];return c.push((e1[n]||ir)(e,r,a)),{cmo:[s,n,i],ft:c}}function r1(e,r,a){var n=e.l,s="";try{e.l+=4;var i=(a.lastobj||{cmo:[0,0]}).cmo[1],c;[0,5,7,11,12,14].indexOf(i)==-1?e.l+=6:c=qg(e,6,a);var o=e.read_shift(2);e.read_shift(2),Bt(e,2);var l=e.read_shift(2);e.l+=l;for(var d=1;d<e.lens.length-1;++d){if(e.l-n!=e.lens[d])throw new Error("TxO: bad continue record");var u=e[e.l],h=nn(e,e.lens[d+1]-e.lens[d]-1);if(s+=h,s.length>=(u?o:2*o))break}if(s.length!==o&&s.length!==o*2)throw new Error("cchText: "+o+" != "+s.length);return e.l=n+r,{t:s}}catch{return e.l=n+r,{t:s}}}function a1(e,r){var a=qi(e);e.l+=16;var n=Kg(e,r-24);return[a,n]}function n1(e){var r=pe(24),a=Ct(e[0]);r.write_shift(2,a.r),r.write_shift(2,a.r),r.write_shift(2,a.c),r.write_shift(2,a.c);for(var n="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),s=0;s<16;++s)r.write_shift(1,parseInt(n[s],16));return Gt([r,Yg(e[1])])}function s1(e,r){e.read_shift(2);var a=qi(e),n=e.read_shift((r-10)/2,"dbcs-cont");return n=n.replace(pr,""),[a,n]}function i1(e){var r=e[1].Tooltip,a=pe(10+2*(r.length+1));a.write_shift(2,2048);var n=Ct(e[0]);a.write_shift(2,n.r),a.write_shift(2,n.r),a.write_shift(2,n.c),a.write_shift(2,n.c);for(var s=0;s<r.length;++s)a.write_shift(2,r.charCodeAt(s));return a.write_shift(2,0),a}function c1(e){var r=[0,0],a;return a=e.read_shift(2),r[0]=nd[a]||a,a=e.read_shift(2),r[1]=nd[a]||a,r}function o1(e){return e||(e=pe(4)),e.write_shift(2,1),e.write_shift(2,1),e}function l1(e){for(var r=e.read_shift(2),a=[];r-- >0;)a.push(d0(e));return a}function d1(e){for(var r=e.read_shift(2),a=[];r-- >0;)a.push(d0(e));return a}function u1(e){e.l+=2;var r={cxfs:0,crc:0};return r.cxfs=e.read_shift(2),r.crc=e.read_shift(4),r}function x0(e,r,a){if(!a.cellStyles)return ir(e,r);var n=a&&a.biff>=12?4:2,s=e.read_shift(n),i=e.read_shift(n),c=e.read_shift(n),o=e.read_shift(n),l=e.read_shift(2);n==2&&(e.l+=2);var d={s,e:i,w:c,ixfe:o,flags:l};return(a.biff>=5||!a.biff)&&(d.level=l>>8&7),d}function h1(e,r){var a=pe(12);a.write_shift(2,r),a.write_shift(2,r),a.write_shift(2,e.width*256),a.write_shift(2,0);var n=0;return e.hidden&&(n|=1),a.write_shift(1,n),n=e.level||0,a.write_shift(1,n),a.write_shift(2,0),a}function f1(e,r){var a={};return r<32||(e.l+=16,a.header=nr(e),a.footer=nr(e),e.l+=2),a}function p1(e,r,a){var n={area:!1};if(a.biff!=5)return e.l+=r,n;var s=e.read_shift(1);return e.l+=3,s&16&&(n.area=!0),n}function m1(e){for(var r=pe(2*e),a=0;a<e;++a)r.write_shift(2,a+1);return r}var x1=ia,g1=i0,v1=Hs;function y1(e){var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(4),s={fmt:r,env:a,len:n,data:e.slice(e.l,e.l+n)};return e.l+=n,s}
vendor: 6,006 bytes, line 493
493function _1(e,r,a){a.biffguess&&a.biff==5&&(a.biff=2);var n=ia(e);++e.l;var s=fn(e,r-7,a);return n.t="str",n.val=s,n}function b1(e){var r=ia(e);++e.l;var a=nr(e);return r.t="n",r.val=a,r}function j1(e,r,a){var n=pe(15);return $s(n,e,r),n.write_shift(8,a,"f"),n}function w1(e){var r=ia(e);++e.l;var a=e.read_shift(2);return r.t="n",r.val=a,r}function k1(e,r,a){var n=pe(9);return $s(n,e,r),n.write_shift(2,a),n}function S1(e){var r=e.read_shift(1);return r===0?(e.l++,""):e.read_shift(r,"sbcs-cont")}function N1(e,r){e.l+=6,e.l+=2,e.l+=1,e.l+=3,e.l+=1,e.l+=r-13}function C1(e,r,a){var n=e.l+r,s=ia(e),i=e.read_shift(2),c=nn(e,i,a);return e.l=n,s.t="str",s.val=c,s}var E1=[2,3,48,49,131,139,140,245],eo=(function(){var e={1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127,8:865,9:437,10:850,11:437,13:437,14:850,15:437,16:850,17:437,18:850,19:932,20:850,21:437,22:850,23:865,24:437,25:437,26:850,27:437,28:863,29:850,31:852,34:852,35:852,36:860,37:850,38:866,55:850,64:852,77:936,78:949,79:950,80:874,87:1252,88:1252,89:1252,108:863,134:737,135:852,136:857,204:1257,255:16969},r=Hi({1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127});function a(o,l){var d=[],u=Fa(1);switch(l.type){case"base64":u=jr(kr(o));break;case"binary":u=jr(o);break;case"buffer":case"array":u=o;break}Jt(u,0);var h=u.read_shift(1),f=!!(h&136),m=!1,x=!1;switch(h){case 2:break;case 3:break;case 48:m=!0,f=!0;break;case 49:m=!0,f=!0;break;case 131:break;case 139:break;case 140:x=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+h.toString(16))}var p=0,g=521;h==2&&(p=u.read_shift(2)),u.l+=3,h!=2&&(p=u.read_shift(4)),p>1048576&&(p=1e6),h!=2&&(g=u.read_shift(2));var w=u.read_shift(2),S=l.codepage||1252;h!=2&&(u.l+=16,u.read_shift(1),u[u.l]!==0&&(S=e[u[u.l]]),u.l+=1,u.l+=2),x&&(u.l+=36);for(var b=[],j={},k=Math.min(u.length,h==2?521:g-10-(m?264:0)),N=x?32:11;u.l<k&&u[u.l]!=13;)switch(j={},j.name=ys.utils.decode(S,u.slice(u.l,u.l+N)).replace(/[\u0000\r\n].*$/g,""),u.l+=N,j.type=String.fromCharCode(u.read_shift(1)),h!=2&&!x&&(j.offset=u.read_shift(4)),j.len=u.read_shift(1),h==2&&(j.offset=u.read_shift(2)),j.dec=u.read_shift(1),j.name.length&&b.push(j),h!=2&&(u.l+=x?13:14),j.type){case"B":(!m||j.len!=8)&&l.WTF&&console.log("Skipping "+j.name+":"+j.type);break;case"G":case"P":l.WTF&&console.log("Skipping "+j.name+":"+j.type);break;case"+":case"0":case"@":case"C":case"D":case"F":case"I":case"L":case"M":case"N":case"O":case"T":case"Y":break;default:throw new Error("Unknown Field Type: "+j.type)}if(u[u.l]!==13&&(u.l=g-1),u.read_shift(1)!==13)throw new Error("DBF Terminator not found "+u.l+" "+u[u.l]);u.l=g;var C=0,P=0;for(d[0]=[],P=0;P!=b.length;++P)d[0][P]=b[P].name;for(;p-- >0;){if(u[u.l]===42){u.l+=w;continue}for(++u.l,d[++C]=[],P=0,P=0;P!=b.length;++P){var T=u.slice(u.l,u.l+b[P].len);u.l+=b[P].len,Jt(T,0);var L=ys.utils.decode(S,T);switch(b[P].type){case"C":L.trim().length&&(d[C][P]=L.replace(/\s+$/,""));break;case"D":L.length===8?d[C][P]=new Date(+L.slice(0,4),+L.slice(4,6)-1,+L.slice(6,8)):d[C][P]=L;break;case"F":d[C][P]=parseFloat(L.trim());break;case"+":case"I":d[C][P]=x?T.read_shift(-4,"i")^2147483648:T.read_shift(4,"i");break;case"L":switch(L.trim().toUpperCase()){case"Y":case"T":d[C][P]=!0;break;case"N":case"F":d[C][P]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+L+"|")}break;case"M":if(!f)throw new Error("DBF Unexpected MEMO for type "+h.toString(16));d[C][P]="##MEMO##"+(x?parseInt(L.trim(),10):T.read_shift(4));break;case"N":L=L.replace(/\u0000/g,"").trim(),L&&L!="."&&(d[C][P]=+L||0);break;case"@":d[C][P]=new Date(T.read_shift(-8,"f")-621356832e5);break;case"T":d[C][P]=new Date((T.read_shift(4)-2440588)*864e5+T.read_shift(4));break;case"Y":d[C][P]=T.read_shift(4,"i")/1e4+T.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":d[C][P]=-T.read_shift(-8,"f");break;case"B":if(m&&b[P].len==8){d[C][P]=T.read_shift(8,"f");break}case"G":case"P":T.l+=b[P].len;break;case"0":if(b[P].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+b[P].type)}}}if(h!=2&&u.l<u.length&&u[u.l++]!=26)throw new Error("DBF EOF Marker missing "+(u.l-1)+" of "+u.length+" "+u[u.l-1].toString(16));return l&&l.sheetRows&&(d=d.slice(0,l.sheetRows)),l.DBF=b,d}function n(o,l){var d=l||{};d.dateNF||(d.dateNF="yyyymmdd");var u=qn(a(o,d),d);return u["!cols"]=d.DBF.map(function(h){return{wch:h.len,DBF:h}}),delete d.DBF,u}function s(o,l){try{return La(n(o,l),l)}catch(d){if(l&&l.WTF)throw d}return{SheetNames:[],Sheets:{}}}var i={B:8,C:250,L:1,D:8,"?":0,"":0};function c(o,l){var d=l||{};if(+d.codepage>=0&&Wr(+d.codepage),d.type=="string")throw new Error("Cannot write DBF to JS string");var u=xr(),h=Fi(o,{header:1,raw:!0,cellDates:!0}),f=h[0],m=h.slice(1),x=o["!cols"]||[],p=0,g=0,w=0,S=1;for(p=0;p<f.length;++p){if(((x[p]||{}).DBF||{}).name){f[p]=x[p].DBF.name,++w;continue}if(f[p]!=null){if(++w,typeof f[p]=="number"&&(f[p]=f[p].toString(10)),typeof f[p]!="string")throw new Error("DBF Invalid column name "+f[p]+" |"+typeof f[p]+"|");if(f.indexOf(f[p])!==p){for(g=0;g<1024;++g)if(f.indexOf(f[p]+"_"+g)==-1){f[p]+="_"+g;break}}}}var b=at(o["!ref"]),j=[],k=[],N=[];for(p=0;p<=b.e.c-b.s.c;++p){var C="",P="",T=0,L=[];for(g=0;g<m.length;++g)m[g][p]!=null&&L.push(m[g][p]);if(L.length==0||f[p]==null){j[p]="?";continue}for(g=0;g<L.length;++g){switch(typeof L[g]){case"number":P="B";break;case"string":P="C";break;case"boolean":P="L";break;case"object":P=L[g]instanceof Date?"D":"C";break;default:P="C"}T=Math.max(T,String(L[g]).length),C=C&&C!=P?"C":P}T>250&&(T=250),P=((x[p]||{}).DBF||{}).type,P=="C"&&x[p].DBF.len>T&&(T=x[p].DBF.len),C=="B"&&P=="N"&&(C="N",N[p]=x[p].DBF.dec,T=x[p].DBF.len),k[p
vendor: 8,620 bytes, lines 493-497
493]=C=="C"||P=="N"?T:i[C]||0,S+=k[p],j[p]=C}var M=u.next(32);for(M.write_shift(4,318902576),M.write_shift(4,m.length),M.write_shift(2,296+32*w),M.write_shift(2,S),p=0;p<4;++p)M.write_shift(4,0);for(M.write_shift(4,0|(+r[sh]||3)<<8),p=0,g=0;p<f.length;++p)if(f[p]!=null){var E=u.next(32),W=(f[p].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);E.write_shift(1,W,"sbcs"),E.write_shift(1,j[p]=="?"?"C":j[p],"sbcs"),E.write_shift(4,g),E.write_shift(1,k[p]||i[j[p]]||0),E.write_shift(1,N[p]||0),E.write_shift(1,2),E.write_shift(4,0),E.write_shift(1,0),E.write_shift(4,0),E.write_shift(4,0),g+=k[p]||i[j[p]]||0}var ee=u.next(264);for(ee.write_shift(4,13),p=0;p<65;++p)ee.write_shift(4,0);for(p=0;p<m.length;++p){var ce=u.next(S);for(ce.write_shift(1,0),g=0;g<f.length;++g)if(f[g]!=null)switch(j[g]){case"L":ce.write_shift(1,m[p][g]==null?63:m[p][g]?84:70);break;case"B":ce.write_shift(8,m[p][g]||0,"f");break;case"N":var ue="0";for(typeof m[p][g]=="number"&&(ue=m[p][g].toFixed(N[g]||0)),w=0;w<k[g]-ue.length;++w)ce.write_shift(1,32);ce.write_shift(1,ue,"sbcs");break;case"D":m[p][g]?(ce.write_shift(4,("0000"+m[p][g].getFullYear()).slice(-4),"sbcs"),ce.write_shift(2,("00"+(m[p][g].getMonth()+1)).slice(-2),"sbcs"),ce.write_shift(2,("00"+m[p][g].getDate()).slice(-2),"sbcs")):ce.write_shift(8,"00000000","sbcs");break;case"C":var te=String(m[p][g]!=null?m[p][g]:"").slice(0,k[g]);for(ce.write_shift(1,te,"sbcs"),w=0;w<k[g]-te.length;++w)ce.write_shift(1,32);break}}return u.next(1).write_shift(1,26),u.end()}return{to_workbook:s,to_sheet:n,from_sheet:c}})(),g0=(function(){var e={AA:"Ã",BA:"Ã",CA:"Ã",DA:195,HA:"Ã",JA:197,AE:"Ã",BE:"Ã",CE:"Ã",HE:"Ã",AI:"Ã",BI:"Ã",CI:"Ã",HI:"Ã",AO:"Ã",BO:"Ã",CO:"Ã",DO:213,HO:"Ã",AU:"Ã",BU:"Ã",CU:"Ã",HU:"Ã",Aa:"à ",Ba:"á",Ca:"â",Da:227,Ha:"ä",Ja:229,Ae:"è",Be:"é",Ce:"ê",He:"ë",Ai:"ì",Bi:"Ã",Ci:"î",Hi:"ï",Ao:"ò",Bo:"ó",Co:"ô",Do:245,Ho:"ö",Au:"ù",Bu:"ú",Cu:"û",Hu:"ü",KC:"Ã",Kc:"ç",q:"æ",z:"Å",a:"Ã",j:"Å",DN:209,Dn:241,Hy:255,S:169,c:170,R:174,"B ":180,0:176,1:177,2:178,3:179,5:181,6:182,7:183,Q:185,k:186,b:208,i:216,l:222,s:240,y:248,"!":161,'"':162,"#":163,"(":164,"%":165,"'":167,"H ":168,"+":171,";":187,"<":188,"=":189,">":190,"?":191,"{":223},r=new RegExp("\x1BN("+Ft(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),a=function(f,m){var x=e[m];return typeof x=="number"?Fl(x):x},n=function(f,m,x){var p=m.charCodeAt(0)-32<<4|x.charCodeAt(0)-48;return p==59?f:Fl(p)};e["|"]=254;function s(f,m){switch(m.type){case"base64":return i(kr(f),m);case"binary":return i(f,m);case"buffer":return i(Je&&Buffer.isBuffer(f)?f.toString("binary"):Oa(f),m);case"array":return i(rn(f),m)}throw new Error("Unrecognized type "+m.type)}function i(f,m){var x=f.split(/[\n\r]+/),p=-1,g=-1,w=0,S=0,b=[],j=[],k=null,N={},C=[],P=[],T=[],L=0,M;for(+m.codepage>=0&&Wr(+m.codepage);w!==x.length;++w){L=0;var E=x[w].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,n).replace(r,a),W=E.replace(/;;/g,"\0").split(";").map(function(D){return D.replace(/\u0000/g,";")}),ee=W[0],ce;if(E.length>0)switch(ee){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":W[1].charAt(0)=="P"&&j.push(E.slice(3).replace(/;;/g,";"));break;case"C":var ue=!1,te=!1,fe=!1,q=!1,J=-1,le=-1;for(S=1;S<W.length;++S)switch(W[S].charAt(0)){case"A":break;case"X":g=parseInt(W[S].slice(1))-1,te=!0;break;case"Y":for(p=parseInt(W[S].slice(1))-1,te||(g=0),M=b.length;M<=p;++M)b[M]=[];break;case"K":ce=W[S].slice(1),ce.charAt(0)==='"'?ce=ce.slice(1,ce.length-1):ce==="TRUE"?ce=!0:ce==="FALSE"?ce=!1:isNaN($r(ce))?isNaN(On(ce).getDate())||(ce=wt(ce)):(ce=$r(ce),k!==null&&Wn(k)&&(ce=Vi(ce))),ue=!0;break;case"E":q=!0;var A=Fn(W[S].slice(1),{r:p,c:g});b[p][g]=[b[p][g],A];break;case"S":fe=!0,b[p][g]=[b[p][g],"S5S"];break;case"G":break;case"R":J=parseInt(W[S].slice(1))-1;break;case"C":le=parseInt(W[S].slice(1))-1;break;default:if(m&&m.WTF)throw new Error("SYLK bad record "+E)}if(ue&&(b[p][g]&&b[p][g].length==2?b[p][g][0]=ce:b[p][g]=ce,k=null),fe){if(q)throw new Error("SYLK shared formula cannot have own formula");var V=J>-1&&b[J][le];if(!V||!V[1])throw new Error("SYLK shared formula cannot find base");b[p][g][1]=R0(V[1],{r:p-J,c:g-le})}break;case"F":var I=0;for(S=1;S<W.length;++S)switch(W[S].charAt(0)){case"X":g=parseInt(W[S].slice(1))-1,++I;break;case"Y":for(p=parseInt(W[S].slice(1))-1,M=b.length;M<=p;++M)b[M]=[];break;case"M":L=parseInt(W[S].slice(1))/20;break;case"F":break;case"G":break;case"P":k=j[parseInt(W[S].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(T=W[S].slice(1).split(" "),M=parseInt(T[0],10);M<=parseInt(T[1],10);++M)L=parseInt(T[2],10),P[M-1]=L===0?{hidden:!0}:{wch:L},Ia(P[M-1]);break;case"C":g=parseInt(W[S].slice(1))-1,P[g]||(P[g]={});break;case"R":p=parseInt(W[S].slice(1))-1,C[p]||(C[p]={}),L>0?(C[p].hpt=L,C[p].hpx=Bn(L)):L===0&&(C[p].hidden=!0);break;default:if(m&&m.WTF)throw new Error("SYLK bad record "+E)}I<1&&(k=null);break;default:if(m&&m.WTF)throw new Error("SYLK bad record "+E)}}return C.length>0&&(N["!rows"]=C),P.length>0&&(N["!cols"]=P),m&&m.sheetRows&&(b=b.slice(0,m.sheetRows)),[b,N]}function c(f,m){var x=s(f,m),p=x[0],g=x[1],w=qn(p,m);return Ft(g).forEach(function(S){w[S]=g[S]}),w}function o(f,m){return La(c(f,m),m)}function l(f,m,x,p){var g="C;Y"+(x+1)+";X"+(p+1)+";K";switch(f.t){case"n":g+=f.v||0,f.f&&!f.F&&(g+=";E"+Go(f.f,{r:x,c:p}));break;case"b":g+=f.v?"TRUE":"FALSE";break;case"e":g+=f.w||f.v;break;case"d":g+='"'+(f.w||f.v)+'"';break;case"s":g+='"'+f.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return g}function d(f,m){m.forEach(function(x,p){var g="F;W"+(p+1)+" "+(p+1)+" ";x.hidden?g+="0":(typeof x.width=="number"&&!x.wpx&&(x.wpx=Cs(x.width)),typeof x.wpx=="number"&&!x.wch&&(x.wch=Es(x.wpx)),typeof x.wch=="number"&&(g+=Math.round(x.wch))),g.charAt(g.length-1)!=" "&&f.push(g)})}function u(f,m){m.forEach(function(x,p){var g="F;";x.hidden?g+="M0;":x.hpt?g+="M"+20*x.hpt+";":x.hpx&&(g+="M"+20*Ts(x.hpx)+";"),g.length>2&&f.push(g+"R"+(p+1))})}function h(f,m){var x=["ID;PWXL;N;E"],p=[],g=at(f["!ref"]),w,S=Array.isArray(f),b=`\r 494`;x.push("P;PGeneral"),x.push("F;P0;DG0G8;M255"),f["!cols"]&&d(x,f["!cols"]),f["!rows"]&&u(x,f["!rows"]),x.push("B;Y"+(g.e.r-g.s.r+1)+";X"+(g.e.c-g.s.c+1)+";D"+[g.s.c,g.s.r,g.e.c,g.e.r].join(" "));for(var j=g.s.r;j<=g.e.r;++j)for(var k=g.s.c;k<=g.e.c;++k){var N=Ve({r:j,c:k});w=S?(f[j]||[])[k]:f[N],!(!w||w.v==null&&(!w.f||w.F))&&p.push(l(w,f,j,k))}return x.join(b)+b+p.join(b)+b+"E"+b}return{to_workbook:o,to_sheet:c,from_sheet:h}})(),v0=(function(){function e(i,c){switch(c.type){case"base64":return r(kr(i),c);case"binary":return r(i,c);case"buffer":return r(Je&&Buffer.isBuffer(i)?i.toString("binary"):Oa(i),c);case"array":return r(rn(i),c)}throw new Error("Unrecognized type "+c.type)}function r(i,c){for(var o=i.split(` 495`),l=-1,d=-1,u=0,h=[];u!==o.length;++u){if(o[u].trim()==="BOT"){h[++l]=[],d=0;continue}if(!(l<0)){var f=o[u].trim().split(","),m=f[0],x=f[1];++u;for(var p=o[u]||"";(p.match(/["]/g)||[]).length&1&&u<o.length-1;)p+=` 496`+o[++u];switch(p=p.trim(),+m){case-1:if(p==="BOT"){h[++l]=[],d=0;continue}else if(p!=="EOD")throw new Error("Unrecognized DIF special command "+p);break;case 0:p==="TRUE"?h[l][d]=!0:p==="FALSE"?h[l][d]=!1:isNaN($r(x))?isNaN(On(x).getDate())?h[l][d]=x:h[l][d]=wt(x):h[l][d]=$r(x),++d;break;case 1:p=p.slice(1,p.length-1),p=p.replace(/""/g,'"'),p&&p.match(/^=".*"$/)&&(p=p.slice(2,-1)),h[l][d++]=p!==""?p:null;break}if(p==="EOD")break}}return c&&c.sheetRows&&(h=h.slice(0,c.sheetRows)),h}function a(i,c){return qn(e(i,c),c)}function n(i,c){return La(a(i,c),c)}var s=(function(){var i=function(l,d,u,h,f){l.push(d),l.push(u+","+h),l.push('"'+f.replace(/"/g,'""')+'"')},c=function(l,d,u,h){l.push(d+","+u),l.push(d==1?'"'+h.replace(/"/g,'""')+'"':h)};return function(l){var d=[],u=at(l["!ref"]),h,f=Array.isArray(l);i(d,"TABLE",0,1,"sheetjs"),i(d,"VECTORS",0,u.e.r-u.s.r+1,""),i(d,"TUPLES",0,u.e.c-u.s.c+1,""),i(d,"DATA",0,0,"");for(var m=u.s.r;m<=u.e.r;++m){c(d,-1,0,"BOT");for(var x=u.s.c;x<=u.e.c;++x){var p=Ve({r:m,c:x});if(h=f?(l[m]||[])[x]:l[p],!h){c(d,1,0,"");continue}switch(h.t){case"n":var g=h.w;!g&&h.v!=null&&(g=h.v),g==null?h.f&&!h.F?c(d,1,0,"="+h.f):c(d,1,0,""):c(d,0,g,"V");break;case"b":c(d,0,h.v?1:0,h.v?"TRUE":"FALSE");break;case"s":c(d,1,0,isNaN(h.v)?h.v:'="'+h.v+'"');break;case"d":h.w||(h.w=Br(h.z||He[14],Vt(wt(h.v)))),c(d,0,h.w,"V");break;default:c(d,1,0,"")}}}c(d,-1,0,"EOD");var w=`\r 497`,S=d.join(w);return S}})();return{to_workbook:n,to_sheet:a,from_sheet:s}})(),y0=(function(){function e(h){return h.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n
vendor: 2,136 bytes, lines 497-505
497/g,` 498`)}function r(h){return h.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function a(h,f){for(var m=h.split(` 499`),x=-1,p=-1,g=0,w=[];g!==m.length;++g){var S=m[g].trim().split(":");if(S[0]==="cell"){var b=Ct(S[1]);if(w.length<=b.r)for(x=w.length;x<=b.r;++x)w[x]||(w[x]=[]);switch(x=b.r,p=b.c,S[2]){case"t":w[x][p]=e(S[3]);break;case"v":w[x][p]=+S[3];break;case"vtf":var j=S[S.length-1];case"vtc":switch(S[3]){case"nl":w[x][p]=!!+S[4];break;default:w[x][p]=+S[4];break}S[2]=="vtf"&&(w[x][p]=[w[x][p],j])}}}return f&&f.sheetRows&&(w=w.slice(0,f.sheetRows)),w}function n(h,f){return qn(a(h,f),f)}function s(h,f){return La(n(h,f),f)}var i=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(` 500`),c=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(` 501`)+` 502`,o=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(` 503`),l="--SocialCalcSpreadsheetControlSave--";function d(h){if(!h||!h["!ref"])return"";for(var f=[],m=[],x,p="",g=vr(h["!ref"]),w=Array.isArray(h),S=g.s.r;S<=g.e.r;++S)for(var b=g.s.c;b<=g.e.c;++b)if(p=Ve({r:S,c:b}),x=w?(h[S]||[])[b]:h[p],!(!x||x.v==null||x.t==="z")){switch(m=["cell",p,"t"],x.t){case"s":case"str":m.push(r(x.v));break;case"n":x.f?(m[2]="vtf",m[3]="n",m[4]=x.v,m[5]=r(x.f)):(m[2]="v",m[3]=x.v);break;case"b":m[2]="vt"+(x.f?"f":"c"),m[3]="nl",m[4]=x.v?"1":"0",m[5]=r(x.f||(x.v?"TRUE":"FALSE"));break;case"d":var j=Vt(wt(x.v));m[2]="vtc",m[3]="nd",m[4]=""+j,m[5]=x.w||Br(x.z||He[14],j);break;case"e":continue}f.push(m.join(":"))}return f.push("sheet:c:"+(g.e.c-g.s.c+1)+":r:"+(g.e.r-g.s.r+1)+":tvf:1"),f.push("valueformat:1:text-wiki"),f.join(` 504`)}function u(h){return[i,c,o,c,d(h),l].join(` 505`)}return{to_workbook:s,to_sheet:n,from_sheet:u}})(),Ln=(function(){function e(u,h,f,m,x){x.raw?h[f][m]=u:u===""||(u==="TRUE"?h[f][m]=!0:u==="FALSE"?h[f][m]=!1:isNaN($r(u))?isNaN(On(u).getDate())?h[f][m]=u:h[f][m]=wt(u):h[f][m]=$r(u))}function r(u,h){var f=h||{},m=[];if(!u||u.length===0)return m;for(var x=u.split(/[\r\n]/),p=x.length-1;p>=0&&x[p].length===0;)--p;for(var g=10,w=0,S=0;
vendor: 1,334 bytes, lines 505-506
505S<=p;++S)w=x[S].indexOf(" "),w==-1?w=x[S].length:w++,g=Math.max(g,w);for(S=0;S<=p;++S){m[S]=[];var b=0;for(e(x[S].slice(0,g).trim(),m,S,b,f),b=1;b<=(x[S].length-g)/10+1;++b)e(x[S].slice(g+(b-1)*10,g+b*10).trim(),m,S,b,f)}return f.sheetRows&&(m=m.slice(0,f.sheetRows)),m}var a={44:",",9:" ",59:";",124:"|"},n={44:3,9:2,59:1,124:0};function s(u){for(var h={},f=!1,m=0,x=0;m<u.length;++m)(x=u.charCodeAt(m))==34?f=!f:!f&&x in a&&(h[x]=(h[x]||0)+1);x=[];for(m in h)Object.prototype.hasOwnProperty.call(h,m)&&x.push([h[m],m]);if(!x.length){h=n;for(m in h)Object.prototype.hasOwnProperty.call(h,m)&&x.push([h[m],m])}return x.sort(function(p,g){return p[0]-g[0]||n[p[1]]-n[g[1]]}),a[x.pop()[1]]||44}function i(u,h){var f=h||{},m="",x=f.dense?[]:{},p={s:{c:0,r:0},e:{c:0,r:0}};u.slice(0,4)=="sep="?u.charCodeAt(5)==13&&u.charCodeAt(6)==10?(m=u.charAt(4),u=u.slice(7)):u.charCodeAt(5)==13||u.charCodeAt(5)==10?(m=u.charAt(4),u=u.slice(6)):m=s(u.slice(0,1024)):f&&f.FS?m=f.FS:m=s(u.slice(0,1024));var g=0,w=0,S=0,b=0,j=0,k=m.charCodeAt(0),N=!1,C=0,P=u.charCodeAt(0);u=u.replace(/\r\n/mg,` 506`);var T=f.dateNF!=null?px(f.dateNF):null;function L(){var M=u.slice(b,j),E={};if(M.charAt(0)=='"'&&M.charAt(M.length-1)=='"'&&(M=M.slice(1,-1).replace(/""/g,'"')),M.length===0)E.t="z";else if(f.raw)E.t="s",E.v=M;else if(M.trim().length===0)E.t="s",E.v=M;
vendor: 7,472 bytes, lines 506-507
506else if(M.charCodeAt(0)==61)M.charCodeAt(1)==34&&M.charCodeAt(M.length-1)==34?(E.t="s",E.v=M.slice(2,-1).replace(/""/g,'"')):W_(M)?(E.t="n",E.f=M.slice(1)):(E.t="s",E.v=M);else if(M=="TRUE")E.t="b",E.v=!0;else if(M=="FALSE")E.t="b",E.v=!1;else if(!isNaN(S=$r(M)))E.t="n",f.cellText!==!1&&(E.w=M),E.v=S;else if(!isNaN(On(M).getDate())||T&&M.match(T)){E.z=f.dateNF||He[14];var W=0;T&&M.match(T)&&(M=mx(M,f.dateNF,M.match(T)||[]),W=1),f.cellDates?(E.t="d",E.v=wt(M,W)):(E.t="n",E.v=Vt(wt(M,W))),f.cellText!==!1&&(E.w=Br(E.z,E.v instanceof Date?Vt(E.v):E.v)),f.cellNF||delete E.z}else E.t="s",E.v=M;if(E.t=="z"||(f.dense?(x[g]||(x[g]=[]),x[g][w]=E):x[Ve({c:w,r:g})]=E),b=j+1,P=u.charCodeAt(b),p.e.c<w&&(p.e.c=w),p.e.r<g&&(p.e.r=g),C==k)++w;else if(w=0,++g,f.sheetRows&&f.sheetRows<=g)return!0}e:for(;j<u.length;++j)switch(C=u.charCodeAt(j)){case 34:P===34&&(N=!N);break;case k:case 10:case 13:if(!N&&L())break e;break}return j-b>0&&L(),x["!ref"]=Ke(p),x}function c(u,h){return!(h&&h.PRN)||h.FS||u.slice(0,4)=="sep="||u.indexOf(" ")>=0||u.indexOf(",")>=0||u.indexOf(";")>=0?i(u,h):qn(r(u,h),h)}function o(u,h){var f="",m=h.type=="string"?[0,0,0,0]:tl(u,h);switch(h.type){case"base64":f=kr(u);break;case"binary":f=u;break;case"buffer":h.codepage==65001?f=u.toString("utf8"):h.codepage&&typeof ys<"u"||(f=Je&&Buffer.isBuffer(u)?u.toString("binary"):Oa(u));break;case"array":f=rn(u);break;case"string":f=u;break;default:throw new Error("Unrecognized type "+h.type)}return m[0]==239&&m[1]==187&&m[2]==191?f=xt(f.slice(3)):h.type!="string"&&h.type!="buffer"&&h.codepage==65001?f=xt(f):h.type=="binary"&&typeof ys<"u",f.slice(0,19)=="socialcalc:version:"?y0.to_sheet(h.type=="string"?f:xt(f),h):c(f,h)}function l(u,h){return La(o(u,h),h)}function d(u){for(var h=[],f=at(u["!ref"]),m,x=Array.isArray(u),p=f.s.r;p<=f.e.r;++p){for(var g=[],w=f.s.c;w<=f.e.c;++w){var S=Ve({r:p,c:w});if(m=x?(u[p]||[])[w]:u[S],!m||m.v==null){g.push(" ");continue}for(var b=(m.w||(va(m),m.w)||"").slice(0,10);b.length<10;)b+=" ";g.push(b+(w===0?" ":""))}h.push(g.join(""))}return h.join(` 507`)}return{to_workbook:l,to_sheet:o,from_sheet:d}})();function T1(e,r){var a=r||{},n=!!a.WTF;a.WTF=!0;try{var s=g0.to_workbook(e,a);return a.WTF=n,s}catch(i){if(a.WTF=n,!i.message.match(/SYLK bad record ID/)&&n)throw i;return Ln.to_workbook(e,r)}}var Qa=(function(){function e(A,V,I){if(A){Jt(A,A.l||0);for(var D=I.Enum||J;A.l<A.length;){var K=A.read_shift(2),z=D[K]||D[65535],Y=A.read_shift(2),re=A.l+Y,oe=z.f&&z.f(A,Y,I);if(A.l=re,V(oe,z,K))return}}}function r(A,V){switch(V.type){case"base64":return a(jr(kr(A)),V);case"binary":return a(jr(A),V);case"buffer":case"array":return a(A,V)}throw"Unsupported type "+V.type}function a(A,V){if(!A)return A;var I=V||{},D=I.dense?[]:{},K="Sheet1",z="",Y=0,re={},oe=[],Ce=[],F={s:{r:0,c:0},e:{r:0,c:0}},se=I.sheetRows||0;if(A[2]==0&&(A[3]==8||A[3]==9)&&A.length>=16&&A[14]==5&&A[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(A[2]==2)I.Enum=J,e(A,function(ne,Z,xe){switch(xe){case 0:I.vers=ne,ne>=4096&&(I.qpro=!0);break;case 6:F=ne;break;case 204:ne&&(z=ne);break;case 222:z=ne;break;case 15:case 51:I.qpro||(ne[1].v=ne[1].v.slice(1));case 13:case 14:case 16:xe==14&&(ne[2]&112)==112&&(ne[2]&15)>1&&(ne[2]&15)<15&&(ne[1].z=I.dateNF||He[14],I.cellDates&&(ne[1].t="d",ne[1].v=Vi(ne[1].v))),I.qpro&&ne[3]>Y&&(D["!ref"]=Ke(F),re[K]=D,oe.push(K),D=I.dense?[]:{},F={s:{r:0,c:0},e:{r:0,c:0}},Y=ne[3],K=z||"Sheet"+(Y+1),z="");var be=I.dense?(D[ne[0].r]||[])[ne[0].c]:D[Ve(ne[0])];if(be){be.t=ne[1].t,be.v=ne[1].v,ne[1].z!=null&&(be.z=ne[1].z),ne[1].f!=null&&(be.f=ne[1].f);break}I.dense?(D[ne[0].r]||(D[ne[0].r]=[]),D[ne[0].r][ne[0].c]=ne[1]):D[Ve(ne[0])]=ne[1];break}},I);else if(A[2]==26||A[2]==14)I.Enum=le,A[2]==14&&(I.qpro=!0,A.l=0),e(A,function(ne,Z,xe){switch(xe){case 204:K=ne;break;case 22:ne[1].v=ne[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(ne[3]>Y&&(D["!ref"]=Ke(F),re[K]=D,oe.push(K),D=I.dense?[]:{},F={s:{r:0,c:0},e:{r:0,c:0}},Y=ne[3],K="Sheet"+(Y+1)),se>0&&ne[0].r>=se)break;I.dense?(D[ne[0].r]||(D[ne[0].r]=[]),D[ne[0].r][ne[0].c]=ne[1]):D[Ve(ne[0])]=ne[1],F.e.c<ne[0].c&&(F.e.c=ne[0].c),F.e.r<ne[0].r&&(F.e.r=ne[0].r);break;case 27:ne[14e3]&&(Ce[ne[14e3][0]]=ne[14e3][1]);break;case 1537:Ce[ne[0]]=ne[1],ne[0]==Y&&(K=ne[1]);break}},I);else throw new Error("Unrecognized LOTUS BOF "+A[2]);if(D["!ref"]=Ke(F),re[z||K]=D,oe.push(z||K),!Ce.length)return{SheetNames:oe,Sheets:re};for(var he={},je=[],ve=0;ve<Ce.length;++ve)re[oe[ve]]?(je.push(Ce[ve]||oe[ve]),he[Ce[ve]]=re[Ce[ve]]||re[oe[ve]]):(je.push(Ce[ve]),he[Ce[ve]]={"!ref":"A1"});return{SheetNames:je,Sheets:he}}function n(A,V){var I=V||{};if(+I.codepage>=0&&Wr(+I.codepage),I.type=="string")throw new Error("Cannot write WK1 to JS string");var D=xr(),K=at(A["!ref"]),z=Array.isArray(A),Y=[];Ne(D,0,i(1030)),Ne(D,6,l(K));for(var re=Math.min(K.e.r,8191),oe=K.s.r;oe<=re;++oe)for(var Ce=Dt(oe),F=K.s.c;F<=K.e.c;++F){oe===K.s.r&&(Y[F]=Nt(F));var se=Y[F]+Ce,he=z?(A[oe]||[])[F]:A[se];if(!(!he||he.t=="z"))if(he.t=="n")(he.v|0)==he.v&&he.v>=-32768&&he.v<=32767?Ne(D,13,m(oe,F,he.v)):Ne(D,14,p(oe,F,he.v));else{var je=va(he);Ne(D,15,h(oe,F,je.slice(0,239)))}}return Ne(D,1),D.end()}function s(A,V){var I=V||{};if(+I.codepage>=0&&Wr(+I.codepage),I.type=="string")throw new Error("Cannot write WK3 to JS string");var D=xr();Ne(D,0,c(A));for(var K=0,z=0;K<A.SheetNames.length;++K)(A.Sheets[A.SheetNames[K]]||{})["!ref"]&&Ne(D,27,q(A.SheetNames[K],z++));var Y=0;for(K=0;K<A.SheetNames.length;++K){var re=A.Sheets[A.SheetNames[K]];if(!(!re||!re["!ref"])){for(var oe=at(re["!ref"]),Ce=Array.isArray(re),F=[],se=Math.min(oe.e.r,8191),he=oe.s.r;he<=se;++he)for(var je=Dt(he),ve=oe.s.c;ve<=oe.e.c;++ve){he===oe.s.r&&(F[ve]=Nt(ve));var ne=F[ve]+je,Z=Ce?(re[he]||[])[ve]:re[ne];if(!(!Z||Z.t=="z"))if(Z.t=="n")Ne(D,23,L(he,ve,Y,Z.v));else{var xe=va(Z);Ne(D,22,C(he,ve,Y,xe.slice(0,239)))}}++Y}}return Ne(D,1),D.end()}function i(A){var V=pe(2);return V.write_shift(2,A),V}function c(A){var V=pe(26);V.write_shift(2,4096),V.write_shift(2,4),V.write_shift(4,0);for(var I=0,D=0,K=0,z=0;z<A.SheetNames.length;++z){var Y=A.SheetNames[z],re=A.Sheets[Y];if(!(!re||!re["!ref"])){++K;var oe=vr(re["!ref"]);I<oe.e.r&&(I=oe.e.r),D<oe.e.c&&(D=oe.e.c)}}return I>8191&&(I=8191),V.write_shift(2,I),V.write_shift(1,K),V.write_shift(1,D),V.write_shift(2,0),V.write_shift(2,0),V.write_shift(1,1),V.write_shift(1,2),V.write_shift(4,0),V.write_shift(4,0),V}function o(A,V,I){var D={s:{c:0,r:0},e:{c:0,r:0}};return V==8&&I.qpro?(D.s.c=A.read_shift(1),A.l++,D.s.r=A.read_shift(2),D.e.c=A.read_shift(1),A.l++,D.e.r=A.read_shift(2),D):(D.s.c=A.read_shift(2),D.s.r=A.read_shift(2),V==12&&I.qpro&&(A.l+=2),D.e.c=A.read_shift(2),D.e.r=A.read_shift(2),V==12&&I.qpro&&(A.l+=2),D.s.c==65535&&(D.s.c=D.e.c=D.s.r=D.e.r=0),D)}function l(A){var V=pe(8);return V.write_shift(2,A.s.c),V.write_shift(2,A.s.r),V.write_shift(2,A.e.c),V.write_shift(2,A.e.r),V}function d(A,V,I){var D=[{c:0,r:0},{t:"n",v:0},0,0];return I.qpro&&I.vers!=20768?(D[0].c=A.read_shift(1),D[3]=A.read_shift(1),D[0].r=A.read_shift(2),A.l+=2):(D[2]=A.read_shift(1),D[0].c=A.read_shift(2),D[0].r=A.read_shift(2)),D}function u(A,V,I){var D=A.l+V,K=d(A,V,I);if(K[1].t="s",I.vers==20768){A.l++;var z=A.read_shift(1);return K[1].v=A.read_shift(z,"utf8"),K}return I.qpro&&A.l++,K[1].v=A.read_shift(D-A.l,"cstr"),K}function h(A,V,I){var D=pe(7+I.length);D.write_shift(1,255),D.write_shift(2,V),D.write_shift(2,A),D.write_shift(1,39);for(var K=0;K<D.length;
vendor: 2,996 bytes, line 507
507++K){var z=I.charCodeAt(K);D.write_shift(1,z>=128?95:z)}return D.write_shift(1,0),D}function f(A,V,I){var D=d(A,V,I);return D[1].v=A.read_shift(2,"i"),D}function m(A,V,I){var D=pe(7);return D.write_shift(1,255),D.write_shift(2,V),D.write_shift(2,A),D.write_shift(2,I,"i"),D}function x(A,V,I){var D=d(A,V,I);return D[1].v=A.read_shift(8,"f"),D}function p(A,V,I){var D=pe(13);return D.write_shift(1,255),D.write_shift(2,V),D.write_shift(2,A),D.write_shift(8,I,"f"),D}function g(A,V,I){var D=A.l+V,K=d(A,V,I);if(K[1].v=A.read_shift(8,"f"),I.qpro)A.l=D;else{var z=A.read_shift(2);j(A.slice(A.l,A.l+z),K),A.l+=z}return K}function w(A,V,I){var D=V&32768;return V&=-32769,V=(D?A:0)+(V>=8192?V-16384:V),(D?"":"$")+(I?Nt(V):Dt(V))}var S={51:["FALSE",0],52:["TRUE",0],70:["LEN",1],80:["SUM",69],81:["AVERAGEA",69],82:["COUNTA",69],83:["MINA",69],84:["MAXA",69],111:["T",1]},b=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function j(A,V){Jt(A,0);for(var I=[],D=0,K="",z="",Y="",re="";A.l<A.length;){var oe=A[A.l++];switch(oe){case 0:I.push(A.read_shift(8,"f"));break;case 1:z=w(V[0].c,A.read_shift(2),!0),K=w(V[0].r,A.read_shift(2),!1),I.push(z+K);break;case 2:{var Ce=w(V[0].c,A.read_shift(2),!0),F=w(V[0].r,A.read_shift(2),!1);z=w(V[0].c,A.read_shift(2),!0),K=w(V[0].r,A.read_shift(2),!1),I.push(Ce+F+":"+z+K)}break;case 3:if(A.l<A.length){console.error("WK1 premature formula end");return}break;case 4:I.push("("+I.pop()+")");break;case 5:I.push(A.read_shift(2));break;case 6:{for(var se="";oe=A[A.l++];)se+=String.fromCharCode(oe);I.push('"'+se.replace(/"/g,'""')+'"')}break;case 8:I.push("-"+I.pop());break;case 23:I.push("+"+I.pop());break;case 22:I.push("NOT("+I.pop()+")");break;case 20:case 21:re=I.pop(),Y=I.pop(),I.push(["AND","OR"][oe-20]+"("+Y+","+re+")");break;default:if(oe<32&&b[oe])re=I.pop(),Y=I.pop(),I.push(Y+b[oe]+re);else if(S[oe]){if(D=S[oe][1],D==69&&(D=A[A.l++]),D>I.length){console.error("WK1 bad formula parse 0x"+oe.toString(16)+":|"+I.join("|")+"|");return}var he=I.slice(-D);I.length-=D,I.push(S[oe][0]+"("+he.join(",")+")")}else return oe<=7?console.error("WK1 invalid opcode "+oe.toString(16)):oe<=24?console.error("WK1 unsupported op "+oe.toString(16)):oe<=30?console.error("WK1 invalid opcode "+oe.toString(16)):oe<=115?console.error("WK1 unsupported function opcode "+oe.toString(16)):console.error("WK1 unrecognized opcode "+oe.toString(16))}}I.length==1?V[1].f=""+I[0]:console.error("WK1 bad formula parse |"+I.join("|")+"|")}function k(A){var V=[{c:0,r:0},{t:"n",v:0},0];return V[0].r=A.read_shift(2),V[3]=A[A.l++],V[0].c=A[A.l++],V}function N(A,V){var I=k(A);return I[1].t="s",I[1].v=A.read_shift(V-4,"cstr"),I}function C(A,V,I,D){var K=pe(6+D.length);K.write_shift(2,A),K.write_shift(1,I),K.write_shift(1,V),K.write_shift(1,39);for(var z=0;z<D.length;++z){var Y=D.charCodeAt(z);K.write_shift(1,Y>=128?95:Y)}return K.write_shift(1,0),K}function P(A,V){var I=k(A);I[1].v=A.read_shift(2);var D=I[1].v>>
vendor: 4,482 bytes, line 507
5071;if(I[1].v&1)switch(D&7){case 0:D=(D>>3)*5e3;break;case 1:D=(D>>3)*500;break;case 2:D=(D>>3)/20;break;case 3:D=(D>>3)/200;break;case 4:D=(D>>3)/2e3;break;case 5:D=(D>>3)/2e4;break;case 6:D=(D>>3)/16;break;case 7:D=(D>>3)/64;break}return I[1].v=D,I}function T(A,V){var I=k(A),D=A.read_shift(4),K=A.read_shift(4),z=A.read_shift(2);if(z==65535)return D===0&&K===3221225472?(I[1].t="e",I[1].v=15):D===0&&K===3489660928?(I[1].t="e",I[1].v=42):I[1].v=0,I;var Y=z&32768;return z=(z&32767)-16446,I[1].v=(1-Y*2)*(K*Math.pow(2,z+32)+D*Math.pow(2,z)),I}function L(A,V,I,D){var K=pe(14);if(K.write_shift(2,A),K.write_shift(1,I),K.write_shift(1,V),D==0)return K.write_shift(4,0),K.write_shift(4,0),K.write_shift(2,65535),K;var z=0,Y=0,re=0,oe=0;return D<0&&(z=1,D=-D),Y=Math.log2(D)|0,D/=Math.pow(2,Y-31),oe=D>>>0,(oe&2147483648)==0&&(D/=2,++Y,oe=D>>>0),D-=oe,oe|=2147483648,oe>>>=0,D*=Math.pow(2,32),re=D>>>0,K.write_shift(4,re),K.write_shift(4,oe),Y+=16383+(z?32768:0),K.write_shift(2,Y),K}function M(A,V){var I=T(A);return A.l+=V-14,I}function E(A,V){var I=k(A),D=A.read_shift(4);return I[1].v=D>>6,I}function W(A,V){var I=k(A),D=A.read_shift(8,"f");return I[1].v=D,I}function ee(A,V){var I=W(A);return A.l+=V-10,I}function ce(A,V){return A[A.l+V-1]==0?A.read_shift(V,"cstr"):""}function ue(A,V){var I=A[A.l++];I>V-1&&(I=V-1);for(var D="";D.length<I;)D+=String.fromCharCode(A[A.l++]);return D}function te(A,V,I){if(!(!I.qpro||V<21)){var D=A.read_shift(1);A.l+=17,A.l+=1,A.l+=2;var K=A.read_shift(V-21,"cstr");return[D,K]}}function fe(A,V){for(var I={},D=A.l+V;A.l<D;){var K=A.read_shift(2);if(K==14e3){for(I[K]=[0,""],I[K][0]=A.read_shift(2);A[A.l];)I[K][1]+=String.fromCharCode(A[A.l]),A.l++;A.l++}}return I}function q(A,V){var I=pe(5+A.length);I.write_shift(2,14e3),I.write_shift(2,V);for(var D=0;D<A.length;++D){var K=A.charCodeAt(D);I[I.l++]=K>127?95:K}return I[I.l++]=0,I}var J={0:{n:"BOF",f:Bt},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f:o},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f},14:{n:"NUMBER",f:x},15:{n:"LABEL",f:u},16:{n:"FORMULA",f:g},24:{n:"TABLE"},25:{n:"ORANGE"},26:{n:"PRANGE"},27:{n:"SRANGE"},28:{n:"FRANGE"},29:{n:"KRANGE1"},32:{n:"HRANGE"},35:{n:"KRANGE2"},36:{n:"PROTEC"},37:{n:"FOOTER"},38:{n:"HEADER"},39:{n:"SETUP"},40:{n:"MARGINS"},41:{n:"LABELFMT"},42:{n:"TITLES"},43:{n:"SHEETJS"},45:{n:"GRAPH"},46:{n:"NGRAPH"},47:{n:"CALCCOUNT"},48:{n:"UNFORMATTED"},49:{n:"CURSORW12"},50:{n:"WINDOW"},51:{n:"STRING",f:u},55:{n:"PASSWORD"},56:{n:"LOCKED"},60:{n:"QUERY"},61:{n:"QUERYNAME"},62:{n:"PRINT"},63:{n:"PRINTNAME"},64:{n:"GRAPH2"},65:{n:"GRAPHNAME"},66:{n:"ZOOM"},67:{n:"SYMSPLIT"},68:{n:"NSROWS"},69:{n:"NSCOLS"},70:{n:"RULER"},71:{n:"NNAME"},72:{n:"ACOMM"},73:{n:"AMACRO"},74:{n:"PARSE"},102:{n:"PRANGES??"},103:{n:"RRANGES??"},104:{n:"FNAME??"},105:{n:"MRANGES??"},204:{n:"SHEETNAMECS",f:ce},222:{n:"SHEETNAMELP",f:ue},65535:{n:""}},le={0:{n:"BOF"},1:{n:"EOF"},2:{n:"PASSWORD"},3:{n:"CALCSET"},4:{n:"WINDOWSET"},5:{n:"SHEETCELLPTR"},6:{n:"SHEETLAYOUT"},7:{n:"COLUMNWIDTH"},8:{n:"HIDDENCOLUMN"},9:{n:"USERRANGE"},10:{n:"SYSTEMRANGE"},11:{n:"ZEROFORCE"},12:{n:"SORTKEYDIR"},13:{n:"FILESEAL"},14:{n:"DATAFILLNUMS"},15:{n:"PRINTMAIN"},16:{n:"PRINTSTRING"},17:{n:"GRAPHMAIN"},18:{n:"GRAPHSTRING"},19:{n:"??"},20:{n:"ERRCELL"},21:{n:"NACELL"},22:{n:"LABEL16",f:N},23:{n:"NUMBER17",f:T},24:{n:"NUMBER18",f:P},25:{n:"FORMULA19",f:M},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:fe},28:{n:"DTLABELMISC"},29:{n:"DTLABELCELL"},30:{n:"GRAPHWINDOW"},31:{n:"CPA"},32:{n:"LPLAUTO"},33:{n:"QUERY"},34:{n:"HIDDENSHEET"},35:{n:"??"},37:{n:"NUMBER25",f:E},38:{n:"??"},39:{n:"NUMBER27",f:W},40:{n:"FORMULA28",f:ee},142:{n:"??"},147:{n:"??"},150:{n:"??"},151:{n:"??"},152:{n:"??"},153:{n:"??"},154:{n:"??"},155:{n:"??"},156:{n:"??"},163:{n:"??"},174:{n:"??"},175:{n:"??"},176:{n:"??"},177:{n:"??"},184:{n:"??"},185:{n:"??"},186:{n:"??"},187:{n:"??"},188:{n:"??"},195:{n:"??"},201:{n:"??"},204:{n:"SHEETNAMECS",f:ce},205:{n:"??"},206:{n:"??"},207:{n:"??"},208:{n:"??"},256:{n:"??"},259:{n:"??"},260:{n:"??"},261:{n:"??"},262:{n:"??"},263:{n:"??"},265:{n:"??"},266:{n:"??"},267:{n:"??"},268:{n:"??"},270:{n:"??"},271:{n:"??"},384:{n:"??"},389:{n:"??"},390:{n:"??"},393:{n:"??"},396:{n:"??"},512:{n:"??"},514:{n:"??"},513:{n:"??"},516:{n:"??"},517:{n:"??"},640:{n:"??"},641:{n:"??"},642:{n:"??"},643:{n:"??"},644:{n:"??"},645:{n:"??"},646:{n:"??"},647:{n:"??"},648:{n:"??"},658:{n:"??"}
vendor: 2,265 bytes, line 507
507,659:{n:"??"},660:{n:"??"},661:{n:"??"},662:{n:"??"},665:{n:"??"},666:{n:"??"},768:{n:"??"},772:{n:"??"},1537:{n:"SHEETINFOQP",f:te},1600:{n:"??"},1602:{n:"??"},1793:{n:"??"},1794:{n:"??"},1795:{n:"??"},1796:{n:"??"},1920:{n:"??"},2048:{n:"??"},2049:{n:"??"},2052:{n:"??"},2688:{n:"??"},10998:{n:"??"},12849:{n:"??"},28233:{n:"??"},28484:{n:"??"},65535:{n:""}};return{sheet_to_wk1:n,book_to_wk3:s,to_workbook:r}})();function A1(e){var r={},a=e.match(cr),n=0,s=!1;if(a)for(;n!=a.length;++n){var i=qe(a[n]);switch(i[0].replace(/\w*:/g,"")){case"<condense":break;case"<extend":break;case"<shadow":if(!i.val)break;case"<shadow>":case"<shadow/>":r.shadow=1;break;case"</shadow>":break;case"<charset":if(i.val=="1")break;r.cp=vo[parseInt(i.val,10)];break;case"<outline":if(!i.val)break;case"<outline>":case"<outline/>":r.outline=1;break;case"</outline>":break;case"<rFont":r.name=i.val;break;case"<sz":r.sz=i.val;break;case"<strike":if(!i.val)break;case"<strike>":case"<strike/>":r.strike=1;break;case"</strike>":break;case"<u":if(!i.val)break;switch(i.val){case"double":r.uval="double";break;case"singleAccounting":r.uval="single-accounting";break;case"doubleAccounting":r.uval="double-accounting";break}case"<u>":case"<u/>":r.u=1;break;case"</u>":break;case"<b":if(i.val=="0")break;case"<b>":case"<b/>":r.b=1;break;case"</b>":break;case"<i":if(i.val=="0")break;case"<i>":case"<i/>":r.i=1;break;case"</i>":break;case"<color":i.rgb&&(r.color=i.rgb.slice(2,8));break;case"<color>":case"<color/>":case"</color>":break;case"<family":r.family=i.val;break;case"<family>":case"<family/>":case"</family>":break;case"<vertAlign":r.valign=i.val;break;case"<vertAlign>":case"<vertAlign/>":case"</vertAlign>":break;case"<scheme":break;case"<scheme>":case"<scheme/>":case"</scheme>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;default:if(i[0].charCodeAt(1)!==47&&!s)throw new Error("Unrecognized rich format "+i[0])}}return r}var F1=(function(){var e=js("t"),r=js("rPr");function a(i){var c=i.match(e);if(!c)return{t:"s",v:""};var o={t:"s",v:rt(c[1])},l=i.match(r);return l&&(o.s=A1(l[1])),o}var n=/<(?:\w+:)?r>/g,s=/<\/(?:\w+:)?r>/;return function(c){return c.replace(n,"").split(s).map(a).filter(function(o){return o.v})}}
vendor: 8,479 bytes, line 507
507)(),I1=(function(){var r=/(\r\n|\n)/g;function a(s,i,c){var o=[];s.u&&o.push("text-decoration: underline;"),s.uval&&o.push("text-underline-style:"+s.uval+";"),s.sz&&o.push("font-size:"+s.sz+"pt;"),s.outline&&o.push("text-effect: outline;"),s.shadow&&o.push("text-shadow: auto;"),i.push('<span style="'+o.join("")+'">'),s.b&&(i.push("<b>"),c.push("</b>")),s.i&&(i.push("<i>"),c.push("</i>")),s.strike&&(i.push("<s>"),c.push("</s>"));var l=s.valign||"";return l=="superscript"||l=="super"?l="sup":l=="subscript"&&(l="sub"),l!=""&&(i.push("<"+l+">"),c.push("</"+l+">")),c.push("</span>"),s}function n(s){var i=[[],s.v,[]];return s.v?(s.s&&a(s.s,i[0],i[2]),i[0].join("")+i[1].replace(r,"<br/>")+i[2].join("")):""}return function(i){return i.map(n).join("")}})(),P1=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,D1=/<(?:\w+:)?r>/,R1=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;function Ho(e,r){var a=r?r.cellHTML:!0,n={};return e?(e.match(/^\s*<(?:\w+:)?t[^>]*>/)?(n.t=rt(xt(e.slice(e.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")),n.r=xt(e),a&&(n.h=Eo(n.t))):e.match(D1)&&(n.r=xt(e),n.t=rt(xt((e.replace(R1,"").match(P1)||[]).join("").replace(cr,""))),a&&(n.h=I1(F1(n.r)))),n):{t:""}}var O1=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/,L1=/<(?:\w+:)?(?:si|sstItem)>/g,B1=/<\/(?:\w+:)?(?:si|sstItem)>/;function M1(e,r){var a=[],n="";if(!e)return a;var s=e.match(O1);if(s){n=s[2].replace(L1,"").split(B1);for(var i=0;i!=n.length;++i){var c=Ho(n[i].trim(),r);c!=null&&(a[a.length]=c)}s=qe(s[1]),a.Count=s.count,a.Unique=s.uniqueCount}return a}var z1=/^\s|\s$|[\t\n\r]/;function _0(e,r){if(!r.bookSST)return"";var a=[Rt];a[a.length]=Se("sst",null,{xmlns:on[0],count:e.Count,uniqueCount:e.Unique});for(var n=0;n!=e.length;++n)if(e[n]!=null){var s=e[n],i="<si>";s.r?i+=s.r:(i+="<t",s.t||(s.t=""),s.t.match(z1)&&(i+=' xml:space="preserve"'),i+=">"+ht(s.t)+"</t>"),i+="</si>",a[a.length]=i}return a.length>2&&(a[a.length]="</sst>",a[1]=a[1].replace("/>",">")),a.join("")}function U1(e){return[e.read_shift(4),e.read_shift(4)]}function H1(e,r){var a=[],n=!1;return _a(e,function(i,c,o){switch(o){case 159:a.Count=i[0],a.Unique=i[1];break;case 19:a.push(i);break;case 160:return!0;case 35:n=!0;break;case 36:n=!1;break;default:if(c.T,!n||r.WTF)throw new Error("Unexpected record 0x"+o.toString(16))}}),a}function W1(e,r){return r||(r=pe(8)),r.write_shift(4,e.Count),r.write_shift(4,e.Unique),r}var V1=eg;function q1(e){var r=xr();ge(r,159,W1(e));for(var a=0;a<e.length;++a)ge(r,19,V1(e[a]));return ge(r,160),r.end()}function b0(e){for(var r=[],a=e.split(""),n=0;n<a.length;++n)r[n]=a[n].charCodeAt(0);return r}function ma(e,r){var a={};return a.Major=e.read_shift(2),a.Minor=e.read_shift(2),r>=4&&(e.l+=r-4),a}function $1(e){var r={};return r.id=e.read_shift(0,"lpp4"),r.R=ma(e,4),r.U=ma(e,4),r.W=ma(e,4),r}function G1(e){for(var r=e.read_shift(4),a=e.l+r-4,n={},s=e.read_shift(4),i=[];s-- >0;)i.push({t:e.read_shift(4),v:e.read_shift(0,"lpp4")});if(n.name=e.read_shift(0,"lpp4"),n.comps=i,e.l!=a)throw new Error("Bad DataSpaceMapEntry: "+e.l+" != "+a);return n}function X1(e){var r=[];e.l+=4;for(var a=e.read_shift(4);a-- >0;)r.push(G1(e));return r}function K1(e){var r=[];e.l+=4;for(var a=e.read_shift(4);a-- >0;)r.push(e.read_shift(0,"lpp4"));return r}function Y1(e){var r={};return e.read_shift(4),e.l+=4,r.id=e.read_shift(0,"lpp4"),r.name=e.read_shift(0,"lpp4"),r.R=ma(e,4),r.U=ma(e,4),r.W=ma(e,4),r}function J1(e){var r=Y1(e);if(r.ename=e.read_shift(0,"8lpp4"),r.blksz=e.read_shift(4),r.cmode=e.read_shift(4),e.read_shift(4)!=4)throw new Error("Bad !Primary record");return r}function j0(e,r){var a=e.l+r,n={};n.Flags=e.read_shift(4)&63,e.l+=4,n.AlgID=e.read_shift(4);var s=!1;switch(n.AlgID){case 26126:case 26127:case 26128:s=n.Flags==36;break;case 26625:s=n.Flags==4;break;case 0:s=n.Flags==16||n.Flags==4||n.Flags==36;break;default:throw"Unrecognized encryption algorithm: "+n.AlgID}if(!s)throw new Error("Encryption Flags/AlgID mismatch");return n.AlgIDHash=e.read_shift(4),n.KeySize=e.read_shift(4),n.ProviderType=e.read_shift(4),e.l+=8,n.CSPName=e.read_shift(a-e.l>>1,"utf16le"),e.l=a,n}function w0(e,r){var a={},n=e.l+r;return e.l+=4,a.Salt=e.slice(e.l,e.l+16),e.l+=16,a.Verifier=e.slice(e.l,e.l+16),e.l+=16,e.read_shift(4),a.VerifierHash=e.slice(e.l,n),e.l=n,a}function Q1(e){var r=ma(e);switch(r.Minor){case 2:return[r.Minor,Z1(e)];case 3:return[r.Minor,ey()];case 4:return[r.Minor,ty(e)]}throw new Error("ECMA-376 Encrypted file unrecognized Version: "+r.Minor)}function Z1(e){var r=e.read_shift(4);if((r&63)!=36)throw new Error("EncryptionInfo mismatch");var a=e.read_shift(4),n=j0(e,a),s=w0(e,e.length-e.l);return{t:"Std",h:n,v:s}}function ey(){throw new Error("File is password-protected: ECMA-376 Extensible")}function ty(e){var r=["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"];e.l+=4;var a=e.read_shift(e.length-e.l,"utf8"),n={};return a.replace(cr,function(i){var c=qe(i);switch(sa(c[0])){case"<?xml":break;case"<encryption":case"</encryption>":break;case"<keyData":r.forEach(function(o){n[o]=c[o]});break;case"<dataIntegrity":n.encryptedHmacKey=c.encryptedHmacKey,n.encryptedHmacValue=c.encryptedHmacValue;break;case"<keyEncryptors>":case"<keyEncryptors":n.encs=[];break;case"</keyEncryptors>":break;case"<keyEncryptor":n.uri=c.uri;break;case"</keyEncryptor>":break;case"<encryptedKey":n.encs.push(c);break;default:throw c[0]}}),n}function ry(e,r){var a={},n=a.EncryptionVersionInfo=ma(e,4);if(r-=4,n.Minor!=2)throw new Error("unrecognized minor version code: "+n.Minor);if(n.Major>4||n.Major<2)throw new Error("unrecognized major version code: "+n.Major);a.Flags=e.read_shift(4),r-=4;var s=e.read_shift(4);return r-=4,a.EncryptionHeader=j0(e,s),r-=s,a.EncryptionVerifier=w0(e,r),a}function ay(e){var r={},a=r.EncryptionVersionInfo=ma(e,4);if(a.Major!=1||a.Minor!=1)throw"unrecognized version code "+a.Major+" : "+a.Minor;return r.Salt=e.read_shift(16),r.EncryptedVerifier=e.read_shift(16),r.EncryptedVerifierHash=e.read_shift(16),r}function Wo(e){var r=0,a,n=b0(e),s=n.length+1,i,c,o,l,d;for(a=Fa(s),a[0]=n.length,i=1;i!=s;++i)a[i]=n[i-1];for(i=s-1;i>=0;--i)c=a[i],o=(r&16384)===0?0:1,l=r<<1&32767,d=o|l,r=d^c;return r^52811}var k0=(function(){var e=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0],r=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],a=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628],n=function(c){return(c/2|c*128)&255},s=function(c,o){return n(c^o)},i=function(c){for(var o=r[c.length-1],l=104,d=c.length-1;d>=0;--d)for(var u=c[d],h=0;h!=7;++h)u&64&&(o^=a[l]),u*=2,--l;return o};return function(c){for(var o=b0(c),l=i(o),d=o.length,u=Fa(16),h=0;h!=16;++h)u[h]=0;var f,m,x;for((d&1)===1&&(f=l>>8,u[d]=s(e[0],f),--d,f=l&255,m=o[o.length-1],u[d]=s(m,f));d>0;)--d,f=l>>8,u[d]=s(o[d],f),--d,f=l&255,u[d]=s(o[d],f);for(d=15,x=15-o.length;x>0;)f=l>>8,u[d]=s(e[x],f),--d,--x,f=l&255,u[d]=s(o[d],f),--d,--x;return u}})(),ny=function(e,r,a,n,s){s||(s=r),n||(n=k0(e));var i,c;for(i=0;i!=r.length;++i)c=r[i],c^=n[a],c=(c>>5|c<<3)&255,s[i]=c,++a;return[s,a,n]},sy=function(e){var r=0,a=k0(e);return function(n){var s=ny("",n,r,a);return r=s[1],s[0]}};function iy(e,r,a,n){var s={key:Bt(e),verificationBytes:Bt(e)};return a.password&&(s.verifier=Wo(a.password)),n.valid=s.verificationBytes===s.verifier,n.valid&&(n.insitu=sy(a.password)),s}function cy(e,r,a){var n=a||{};return n.Info=e.read_shift(2),e.l-=2,n.Info===1?n.Data=ay(e):n.Data=ry(e,r),n}function oy(e,r,a){var n={Type:a.biff>=8?e.read_shift(2):0};return n.Type?cy(e,r-2,n):iy(e,a.biff>=8?r:r-2,a,n),n}var S0=(function(){function e(s,i){switch(i.type){case"base64":return r(kr(s),i);case"binary":return r(s,i);case"buffer":return r(Je&&Buffer.isBuffer(s)?s.toString("binary"):Oa(s),i);case"array":return r(rn(s),i)}throw new Error("Unrecognized type "+i.type)}function r(s,i){var c=i||{},o=c.dense?[]:{},l=s.match(/\\trowd.*?\\row\b/g);
507if(!l.length)throw new Error("RTF missing table");var d={s:{c:0,r:0},e:{c:0,r:l.length-1}};return l.forEach(function(u,h){Array.isArray(o)&&(o[h]=[]);for(var f=/\\\w+\b/g,m=0,x,p=-1;x=f.exec(u);){switch(x[0]){case"\\cell":var g=u.slice(m,f.lastIndex-x[0].length);if(g[0]==" "&&(g=g.slice(1)),++p,g.length){var w={v:g,t:"s"};Array.isArray(o)?o[h][p]=w:o[Ve({r:h,c:p})]=w}break}m=f.lastIndex}p>d.e.c&&(d.e.c=p)}),o["!ref"]=Ke(d),o}function a(s,i){return La(e(s,i),i)}function n(s){for(var i=["{\\rtf1\\ansi"],c=at(s["!ref"]),o,l=Array.isArray(s),d=c.s.r;d<=c.e.r;++d){i.push("\\trowd\\trautofit1");for(var u=c.s.c;u<=c.e.c;++u)i.push("\\cellx"+(u+1));for(i.push("\\pard\\intbl"),u=c.s.c;u<=c.e.c;++u){var h=Ve({r:d,c:u});o=l?(s[d]||[])[u]:s[h],!(!o||o.v==null&&(!o.f||o.F))&&(i.push(" "+(o.w||(va(o),o.w))),i.push("\\cell"))}i.push("\\pard\\intbl\\row")}return i.join("")+"}"}return{to_workbook:a,to_sheet:e,from_sheet:n}})();function ly(e){var r=e.slice(e[0]==="#"?1:0).slice(0,6);return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}function Ns(e){for(var r=0,a=1;r!=3;++r)a=a*256+(e[r]>255?255:e[r]<0?0:e[r]);return a.toString(16).toUpperCase().slice(1)}function dy(e){var r=e[0]/255,a=e[1]/255,n=e[2]/255,s=Math.max(r,a,n),i=Math.min(r,a,n),c=s-i;if(c===0)return[0,0,r];var o=0,l=0,d=s+i;switch(l=c/(d>1?2-d:d),s){case r:o=((a-n)/c+6)%6;break;case a:o=(n-r)/c+2;break;case n:o=(r-a)/c+4;break}return[o/6,l,d/2]}function uy(e){var r=e[0],a=e[1],n=e[2],s=a*2*(n<.5?n:1-n),i=n-s/2,c=[i,i,i],o=6*r,l;if(a!==0)switch(o|0){case 0:case 6:l=s*o,c[0]+=s,c[1]+=l;break;case 1:l=s*(2-o),c[0]+=l,c[1]+=s;break;case 2:l=s*(o-2),c[1]+=s,c[2]+=l;break;case 3:l=s*(4-o),c[1]+=l,c[2]+=s;break;case 4:l=s*(o-4),c[2]+=s,c[0]+=l;break;case 5:l=s*(6-o),c[2]+=l,c[0]+=s;break}for(var d=0;d!=3;++d)c[d]=Math.round(c[d]*255);return c}function Ti(e,r){if(r===0)return e;var a=dy(ly(e));return r<0?a[2]=a[2]*(1+r):a[2]=1-(1-a[2])*(1-r),Ns(uy(a))}var N0=6,hy=15,fy=1,ar=N0;function Cs(e){return Math.floor((e+Math.round(128/ar)/256)*ar)}function Es(e){return Math.floor((e-5)/ar*100+.5)/100}function Ai(e){return Math.round((e*ar+5)/ar*256)/256}function rc(e){return Ai(Es(Cs(e)))}function Vo(e){var r=Math.abs(e-rc(e)),a=ar;if(r>.005)for(ar=fy;ar<hy;++ar)Math.abs(e-rc(e))<=r&&(r=Math.abs(e-rc(e)),a=ar);ar=a}function Ia(e){e.width?(e.wpx=Cs(e.width),e.wch=Es(e.wpx),e.MDW=ar):e.wpx?(e.wch=Es(e.wpx),e.width=Ai(e.wch),e.MDW=ar):typeof e.wch=="number"&&(e.width=Ai(e.wch),e.wpx=Cs(e.width),e.MDW=ar),e.customWidth&&delete e.customWidth}var py=96,C0=py;function Ts(e){return e*96/C0}function Bn(e){return e*C0/96}var my={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};function xy(e,r,a,n){r.Borders=[];var s={},i=!1;(e[0].match(cr)||[]).forEach(function(c){var o=qe(c);switch(sa(o[0])){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":case"<border/>":s={},o.diagonalUp&&(s.diagonalUp=jt(o.diagonalUp)),o.diagonalDown&&(s.diagonalDown=jt(o.diagonalDown)),r.Borders.push(s);break;case"</border>":break;case"<left/>":break;case"<left":case"<left>":break;case"</left>":break;case"<right/>":break;case"<right":case"<right>":break;case"</right>":break;case"<top/>":break;case"<top":case"<top>":break;case"</top>":break;case"<bottom/>":break;case"<bottom":case"<bottom>":break;case"</bottom>":break;case"<diagonal":case"<diagonal>":case"<diagonal/>":break;case"</diagonal>":break;case"<horizontal":case"<horizontal>":case"<horizontal/>":break;case"</horizontal>":break;case"<vertical":case"<vertical>":case"<vertical/>":break;case"</vertical>":break;case"<start":case"<start>":case"<start/>":break;case"</start>":break;case"<end":case"<end>":case"<end/>":break;case"</end>":break;case"<color":case"<color>":break;case"<color/>":case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+o[0]+" in borders")}})}function gy(e,r,a,n){r.Fills=[];var s={},i=!1;
vendor: 5,918 bytes, line 507
507(e[0].match(cr)||[]).forEach(function(c){var o=qe(c);switch(sa(o[0])){case"<fills":case"<fills>":case"</fills>":break;case"<fill>":case"<fill":case"<fill/>":s={},r.Fills.push(s);break;case"</fill>":break;case"<gradientFill>":break;case"<gradientFill":case"</gradientFill>":r.Fills.push(s),s={};break;case"<patternFill":case"<patternFill>":o.patternType&&(s.patternType=o.patternType);break;case"<patternFill/>":case"</patternFill>":break;case"<bgColor":s.bgColor||(s.bgColor={}),o.indexed&&(s.bgColor.indexed=parseInt(o.indexed,10)),o.theme&&(s.bgColor.theme=parseInt(o.theme,10)),o.tint&&(s.bgColor.tint=parseFloat(o.tint)),o.rgb&&(s.bgColor.rgb=o.rgb.slice(-6));break;case"<bgColor/>":case"</bgColor>":break;case"<fgColor":s.fgColor||(s.fgColor={}),o.theme&&(s.fgColor.theme=parseInt(o.theme,10)),o.tint&&(s.fgColor.tint=parseFloat(o.tint)),o.rgb!=null&&(s.fgColor.rgb=o.rgb.slice(-6));break;case"<fgColor/>":case"</fgColor>":break;case"<stop":case"<stop/>":break;case"</stop>":break;case"<color":case"<color/>":break;case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+o[0]+" in fills")}})}function vy(e,r,a,n){r.Fonts=[];var s={},i=!1;(e[0].match(cr)||[]).forEach(function(c){var o=qe(c);switch(sa(o[0])){case"<fonts":case"<fonts>":case"</fonts>":break;case"<font":case"<font>":break;case"</font>":case"<font/>":r.Fonts.push(s),s={};break;case"<name":o.val&&(s.name=xt(o.val));break;case"<name/>":case"</name>":break;case"<b":s.bold=o.val?jt(o.val):1;break;case"<b/>":s.bold=1;break;case"<i":s.italic=o.val?jt(o.val):1;break;case"<i/>":s.italic=1;break;case"<u":switch(o.val){case"none":s.underline=0;break;case"single":s.underline=1;break;case"double":s.underline=2;break;case"singleAccounting":s.underline=33;break;case"doubleAccounting":s.underline=34;break}break;case"<u/>":s.underline=1;break;case"<strike":s.strike=o.val?jt(o.val):1;break;case"<strike/>":s.strike=1;break;case"<outline":s.outline=o.val?jt(o.val):1;break;case"<outline/>":s.outline=1;break;case"<shadow":s.shadow=o.val?jt(o.val):1;break;case"<shadow/>":s.shadow=1;break;case"<condense":s.condense=o.val?jt(o.val):1;break;case"<condense/>":s.condense=1;break;case"<extend":s.extend=o.val?jt(o.val):1;break;case"<extend/>":s.extend=1;break;case"<sz":o.val&&(s.sz=+o.val);break;case"<sz/>":case"</sz>":break;case"<vertAlign":o.val&&(s.vertAlign=o.val);break;case"<vertAlign/>":case"</vertAlign>":break;case"<family":o.val&&(s.family=parseInt(o.val,10));break;case"<family/>":case"</family>":break;case"<scheme":o.val&&(s.scheme=o.val);break;case"<scheme/>":case"</scheme>":break;case"<charset":if(o.val=="1")break;o.codepage=vo[parseInt(o.val,10)];break;case"<color":if(s.color||(s.color={}),o.auto&&(s.color.auto=jt(o.auto)),o.rgb)s.color.rgb=o.rgb.slice(-6);else if(o.indexed){s.color.index=parseInt(o.indexed,10);var l=Ya[s.color.index];s.color.index==81&&(l=Ya[1]),l||(l=Ya[1]),s.color.rgb=l[0].toString(16)+l[1].toString(16)+l[2].toString(16)}else o.theme&&(s.color.theme=parseInt(o.theme,10),o.tint&&(s.color.tint=parseFloat(o.tint)),o.theme&&a.themeElements&&a.themeElements.clrScheme&&(s.color.rgb=Ti(a.themeElements.clrScheme[s.color.theme].rgb,s.color.tint||0)));break;case"<color/>":case"</color>":break;case"<AlternateContent":i=!0;break;case"</AlternateContent>":i=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+o[0]+" in fonts")}})}function yy(e,r,a){r.NumberFmt=[];for(var n=Ft(He),s=0;s<n.length;++s)r.NumberFmt[n[s]]=He[n[s]];var i=e[0].match(cr);if(i)for(s=0;s<i.length;++s){var c=qe(i[s]);switch(sa(c[0])){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{var o=rt(xt(c.formatCode)),l=parseInt(c.numFmtId,10);if(r.NumberFmt[l]=o,l>0){if(l>392){for(l=392;l>60&&r.NumberFmt[l]!=null;--l);r.NumberFmt[l]=o}pa(o,l)}}break;case"</numFmt>":break;default:if(a.WTF)throw new Error("unrecognized "+c[0]+" in numFmts")}}}function _y(e){var r=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(a){for(var n=a[0];n<=a[1];++n)e[n]!=null&&(r[r.length]=Se("numFmt",null,{numFmtId:n,formatCode:ht(e[n])}))}),r.length===1?"":(r[r.length]="</numFmts>",r[0]=Se("numFmts",null,{count:r.length-2}).replace("/>",">"),r.join(""))}var li=["numFmtId","fillId","fontId","borderId","xfId"],di=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"];function by(e,r,a){r.CellXf=[];var n,s=!1;(e[0].match(cr)||[]).forEach(function(i){var c=qe(i),o=0;switch(sa(c[0])){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":case"<xf/>":for(n=c,delete n[0],o=0;o<li.length;++o)n[li[o]]&&(n[li[o]]=parseInt(n[li[o]],10));for(o=0;o<di.length;++o)n[di[o]]&&(n[di[o]]=jt(n[di[o]]));if(r.NumberFmt&&n.numFmtId>392){for(o=392;o>60;--o)if(r.NumberFmt[n.numFmtId]==r.NumberFmt[o]){n.numFmtId=o;break}}r.CellXf.push(n);break;case"</xf>":break;case"<alignment":case"<alignment/>":var l={};c.vertical&&(l.vertical=c.vertical),c.horizontal&&(l.horizontal=c.horizontal),c.textRotation!=null&&(l.textRotation=c.textRotation),c.indent&&(l.indent=c.indent),c.wrapText&&(l.wrapText=jt(c.wrapText)),n.alignment=l;break;case"</alignment>":break;case"<protection":break;case"</protection>":case"<protection/>":break;case"<AlternateContent":s=!0;break;case"</AlternateContent>":s=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;default:if(a&&a.WTF&&!s)throw new Error("unrecognized "+c[0]+" in cellXfs")}})}function jy(e){var r=[];return r[r.length]=Se("cellXfs",null),e.forEach(function(a){r[r.length]=Se("xf",null,a)}),r[r.length]="</cellXfs>",r.length===2?"":(r[0]=Se("cellXfs",null,{count:r.length-2}).replace("/>",">"),r.join(""))}
vendor: 4,518 bytes, line 507
507var wy=(function(){var r=/<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/,a=/<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/,n=/<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/,s=/<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/,i=/<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;return function(o,l,d){var u={};if(!o)return u;o=o.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");var h;return(h=o.match(r))&&yy(h,u,d),(h=o.match(s))&&vy(h,u,l,d),(h=o.match(n))&&gy(h,u,l,d),(h=o.match(i))&&xy(h,u,l,d),(h=o.match(a))&&by(h,u,d),u}})();function E0(e,r){var a=[Rt,Se("styleSheet",null,{xmlns:on[0],"xmlns:vt":Wt.vt})],n;return e.SSF&&(n=_y(e.SSF))!=null&&(a[a.length]=n),a[a.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',a[a.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',a[a.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',a[a.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(n=jy(r.cellXfs))&&(a[a.length]=n),a[a.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',a[a.length]='<dxfs count="0"/>',a[a.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',a.length>2&&(a[a.length]="</styleSheet>",a[1]=a[1].replace("/>",">")),a.join("")}function ky(e,r){var a=e.read_shift(2),n=sr(e);return[a,n]}function Sy(e,r,a){a||(a=pe(6+4*r.length)),a.write_shift(2,e),Xt(r,a);var n=a.length>a.l?a.slice(0,a.l):a;return a.l==null&&(a.l=a.length),n}function Ny(e,r,a){var n={};n.sz=e.read_shift(2)/20;var s=cg(e);s.fItalic&&(n.italic=1),s.fCondense&&(n.condense=1),s.fExtend&&(n.extend=1),s.fShadow&&(n.shadow=1),s.fOutline&&(n.outline=1),s.fStrikeout&&(n.strike=1);var i=e.read_shift(2);switch(i===700&&(n.bold=1),e.read_shift(2)){case 1:n.vertAlign="superscript";break;case 2:n.vertAlign="subscript";break}var c=e.read_shift(1);c!=0&&(n.underline=c);var o=e.read_shift(1);o>0&&(n.family=o);var l=e.read_shift(1);switch(l>0&&(n.charset=l),e.l++,n.color=ig(e),e.read_shift(1)){case 1:n.scheme="major";break;case 2:n.scheme="minor";break}return n.name=sr(e),n}function Cy(e,r){r||(r=pe(153)),r.write_shift(2,e.sz*20),og(e,r),r.write_shift(2,e.bold?700:400);var a=0;e.vertAlign=="superscript"?a=1:e.vertAlign=="subscript"&&(a=2),r.write_shift(2,a),r.write_shift(1,e.underline||0),r.write_shift(1,e.family||0),r.write_shift(1,e.charset||0),r.write_shift(1,0),Ni(e.color,r);var n=0;return n=2,r.write_shift(1,n),Xt(e.name,r),r.length>r.l?r.slice(0,r.l):r}var Ey=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],ac,Ty=ir;function bd(e,r){r||(r=pe(84)),ac||(ac=Hi(Ey));var a=ac[e.patternType];a==null&&(a=40),r.write_shift(4,a);var n=0;if(a!=40)for(Ni({auto:1},r),Ni({auto:1},r);n<12;++n)r.write_shift(4,0);else{for(;n<4;++n)r.write_shift(4,0);for(;n<12;++n)r.write_shift(4,0)}return r.length>r.l?r.slice(0,r.l):r}function Ay(e,r){var a=e.l+r,n=e.read_shift(2),s=e.read_shift(2);return e.l=a,{ixfe:n,numFmtId:s}}function T0(e,r,a){a||(a=pe(16)),a.write_shift(2,r||0),a.write_shift(2,e.numFmtId||0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(1,0),a.write_shift(1,0);var n=0;return a.write_shift(1,n),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(1,0),a}function Zn(e,r){return r||(r=pe(10)),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(4,0),r.write_shift(4,0),r}var Fy=ir;function Iy(e,r){return r||(r=pe(51)),r.write_shift(1,0),Zn(null,r),Zn(null,r),Zn(null,r),Zn(null,r),Zn(null,r),r.length>r.l?r.slice(0,r.l):r}function Py(e,r){return r||(r=pe(52)),r.write_shift(4,e.xfId),r.write_shift(2,1),r.write_shift(1,0),r.write_shift(1,0),Si(e.name||"",r),r.length>r.l?r.slice(0,r.l):r}function Dy(e,r,a){var n=pe(2052);return n.write_shift(4,e),Si(r,n),Si(a,n),n.length>n.l?n.slice(0,n.l):n}function Ry(e,r,a){var n={};n.NumberFmt=[];for(var s in He)n.NumberFmt[s]=He[s];n.CellXf=[],n.Fonts=[];var i=[],c=!1;return _a(e,function(l,d,u){switch(u){case 44:n.NumberFmt[l[0]]=l[1],pa(l[1],l[0]);break;case 43:n.Fonts.push(l),l.color.theme!=null&&r&&r.themeElements&&r.themeElements.clr
vendor: 4,128 bytes, line 507
507Scheme&&(l.color.rgb=Ti(r.themeElements.clrScheme[l.color.theme].rgb,l.color.tint||0));break;case 1025:break;case 45:break;case 46:break;case 47:i[i.length-1]==617&&n.CellXf.push(l);break;case 48:case 507:case 572:case 475:break;case 1171:case 2102:case 1130:case 512:case 2095:case 3072:break;case 35:c=!0;break;case 36:c=!1;break;case 37:i.push(u),c=!0;break;case 38:i.pop(),c=!1;break;default:if(d.T>0)i.push(u);else if(d.T<0)i.pop();else if(!c||a.WTF&&i[i.length-1]!=37)throw new Error("Unexpected record 0x"+u.toString(16))}}),n}function Oy(e,r){if(r){var a=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var s=n[0];s<=n[1];++s)r[s]!=null&&++a}),a!=0&&(ge(e,615,Gr(a)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var s=n[0];s<=n[1];++s)r[s]!=null&&ge(e,44,Sy(s,r[s]))}),ge(e,616))}}function Ly(e){var r=1;ge(e,611,Gr(r)),ge(e,43,Cy({sz:12,color:{theme:1},name:"Calibri",family:2})),ge(e,612)}function By(e){var r=2;ge(e,603,Gr(r)),ge(e,45,bd({patternType:"none"})),ge(e,45,bd({patternType:"gray125"})),ge(e,604)}function My(e){var r=1;ge(e,613,Gr(r)),ge(e,46,Iy()),ge(e,614)}function zy(e){var r=1;ge(e,626,Gr(r)),ge(e,47,T0({numFmtId:0},65535)),ge(e,627)}function Uy(e,r){ge(e,617,Gr(r.length)),r.forEach(function(a){ge(e,47,T0(a,0))}),ge(e,618)}function Hy(e){var r=1;ge(e,619,Gr(r)),ge(e,48,Py({xfId:0,name:"Normal"})),ge(e,620)}function Wy(e){var r=0;ge(e,505,Gr(r)),ge(e,506)}function Vy(e){var r=0;ge(e,508,Dy(r,"TableStyleMedium9","PivotStyleMedium4")),ge(e,509)}function qy(e,r){var a=xr();return ge(a,278),Oy(a,e.SSF),Ly(a),By(a),My(a),zy(a),Uy(a,r.cellXfs),Hy(a),Wy(a),Vy(a),ge(a,279),a.end()}var $y=["</a:lt1>","</a:dk1>","</a:lt2>","</a:dk2>","</a:accent1>","</a:accent2>","</a:accent3>","</a:accent4>","</a:accent5>","</a:accent6>","</a:hlink>","</a:folHlink>"];function Gy(e,r,a){r.themeElements.clrScheme=[];var n={};(e[0].match(cr)||[]).forEach(function(s){var i=qe(s);switch(i[0]){case"<a:clrScheme":case"</a:clrScheme>":break;case"<a:srgbClr":n.rgb=i.val;break;case"<a:sysClr":n.rgb=i.lastClr;break;case"<a:dk1>":case"</a:dk1>":case"<a:lt1>":case"</a:lt1>":case"<a:dk2>":case"</a:dk2>":case"<a:lt2>":case"</a:lt2>":case"<a:accent1>":case"</a:accent1>":case"<a:accent2>":case"</a:accent2>":case"<a:accent3>":case"</a:accent3>":case"<a:accent4>":case"</a:accent4>":case"<a:accent5>":case"</a:accent5>":case"<a:accent6>":case"</a:accent6>":case"<a:hlink>":case"</a:hlink>":case"<a:folHlink>":case"</a:folHlink>":i[0].charAt(1)==="/"?(r.themeElements.clrScheme[$y.indexOf(i[0])]=n,n={}):n.name=i[0].slice(3,i[0].length-1);break;default:if(a&&a.WTF)throw new Error("Unrecognized "+i[0]+" in clrScheme")}})}function Xy(){}function Ky(){}var Yy=/<a:clrScheme([^>]*)>[\s\S]*<\/a:clrScheme>/,Jy=/<a:fontScheme([^>]*)>[\s\S]*<\/a:fontScheme>/,Qy=/<a:fmtScheme([^>]*)>[\s\S]*<\/a:fmtScheme>/;function Zy(e,r,a){r.themeElements={};var n;[["clrScheme",Yy,Gy],["fontScheme",Jy,Xy],["fmtScheme",Qy,Ky]].forEach(function(s){if(!(n=e.match(s[1])))throw new Error(s[0]+" not found in themeElements");s[2](n,r,a)})}var e_=/<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;function A0(e,r){(!e||e.length===0)&&(e=qo());var a,n={};if(!(a=e.match(e_)))throw new Error("themeElements not found in theme");return Zy(a[0],n,r),n.raw=e,n}function qo(e,r){if(r&&r.themeXLSX)return r.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var a=[Rt];return a[a.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',a[a.length]="<a:themeElements>",a[a.length]='<a:clrScheme name="Office">',a[a.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',a[a.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',a[a.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',a[a.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',a[a.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',a[a.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',a[a.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',a[a.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',a[a.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>
507',a[a.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',a[a.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',a[a.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',a[a.length]="</a:clrScheme>",a[a.length]='<a:fontScheme name="Office">',a[a.length]="<a:majorFont>",a[a.length]='<a:latin typeface="Cambria"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface="ï¼ï¼³ ï¼°ã´ã·ãã¯"/>',a[a.length]='<a:font script="Hang" typeface="ë§ì ê³ ë"/>',a[a.length]='<a:font script="Hans" typeface="å®ä½"/>',a[a.length]='<a:font script="Hant" typeface="æ°ç´°æé«"/>',a[a.length]='<a:font script="Arab" typeface="Times New Roman"/>',a[a.length]='<a:font script="Hebr" typeface="Times New Roman"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="MoolBoran"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Times New Roman"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:majorFont>",a[a.length]="<a:minorFont>",a[a.length]='<a:latin typeface="Calibri"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface="ï¼ï¼³ ï¼°ã´ã·ãã¯"/>',a[a.length]='<a:font script="Hang" typeface="ë§ì ê³ ë"/>',a[a.length]='<a:font script="Hans" typeface="å®ä½"/>',a[a.length]='<a:font script="Hant" typeface="æ°ç´°æé«"/>',a[a.length]='<a:font script="Arab" typeface="Arial"/>',a[a.length]='<a:font script="Hebr" typeface="Arial"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="DaunPenh"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Arial"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>
507',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:minorFont>",a[a.length]="</a:fontScheme>",a[a.length]='<a:fmtScheme name="Office">',a[a.length]="<a:fillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="1"/>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="0"/>',a[a.length]="</a:gradFill>",a[a.length]="</a:fillStyleLst>",a[a.length]="<a:lnStyleLst>",a[a.length]='<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]="</a:lnStyleLst>",a[a.length]="<a:effectStyleLst>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]='<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>',a[a.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',a[a.length]="</a:effectStyle>",a[a.length]="</a:effectStyleLst>",a[a.length]="<a:bgFillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/>
507</a:path>',a[a.length]="</a:gradFill>",a[a.length]="</a:bgFillStyleLst>",a[a.length]="</a:fmtScheme>",a[a.length]="</a:themeElements>",a[a.length]="<a:objectDefaults>",a[a.length]="<a:spDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>',a[a.length]="</a:spDef>",a[a.length]="<a:lnDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>',a[a.length]="</a:lnDef>",a[a.length]="</a:objectDefaults>",a[a.length]="<a:extraClrSchemeLst/>",a[a.length]="</a:theme>",a.join("")}function t_(e,r,a){var n=e.l+r,s=e.read_shift(4);if(s!==124226){if(!a.cellStyles){e.l=n;return}var i=e.slice(e.l);e.l=n;var c;try{c=jh(i,{type:"array"})}catch{return}var o=wr(c,"theme/theme/theme1.xml",!0);if(o)return A0(o,a)}}function r_(e){return e.read_shift(4)}function a_(e){var r={};switch(r.xclrType=e.read_shift(2),r.nTintShade=e.read_shift(2),r.xclrType){case 0:e.l+=4;break;case 1:r.xclrValue=n_(e,4);break;case 2:r.xclrValue=l0(e);break;case 3:r.xclrValue=r_(e);break;case 4:e.l+=4;break}return e.l+=8,r}function n_(e,r){return ir(e,r)}function s_(e,r){return ir(e,r)}function i_(e){var r=e.read_shift(2),a=e.read_shift(2)-4,n=[r];switch(r){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:n[1]=a_(e);break;case 6:n[1]=s_(e,a);break;case 14:case 15:n[1]=e.read_shift(a===1?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+r+" "+a)}return n}function c_(e,r){var a=e.l+r;e.l+=2;var n=e.read_shift(2);e.l+=2;for(var s=e.read_shift(2),i=[];s-- >0;)i.push(i_(e,a-e.l));return{ixfe:n,ext:i}}function o_(e,r){r.forEach(function(a){a[0]})}function l_(e,r){return{flags:e.read_shift(4),version:e.read_shift(4),name:sr(e)}}function d_(e){var r=pe(12+2*e.name.length);return r.write_shift(4,e.flags),r.write_shift(4,e.version),Xt(e.name,r),r.slice(0,r.l)}function u_(e){for(var r=[],a=e.read_shift(4);a-- >0;)r.push([e.read_shift(4),e.read_shift(4)]);return r}function h_(e){var r=pe(4+8*e.length);r.write_shift(4,e.length);for(var a=0;a<e.length;++a)r.write_shift(4,e[a][0]),r.write_shift(4,e[a][1]);return r}function f_(e,r){var a=pe(8+2*r.length);return a.write_shift(4,e),Xt(r,a),a.slice(0,a.l)}function p_(e){return e.l+=4,e.read_shift(4)!=0}function m_(e,r){var a=pe(8);return a.write_shift(4,e),a.write_shift(4,1),a}function x_(e,r,a){var n={Types:[],Cell:[],Value:[]},s=a||{},i=[],c=!1,o=2;return _a(e,function(l,d,u){switch(u){case 335:n.Types.push({name:l.name});break;case 51:l.forEach(function(h){o==1?n.Cell.push({type:n.Types[h[0]-1].name,index:h[1]}):o==0&&n.Value.push({type:n.Types[h[0]-1].name,index:h[1]})});break;case 337:o=l?1:0;break;case 338:o=2;break;case 35:i.push(u),c=!0;break;case 36:i.pop(),c=!1;break;default:if(!d.T){if(!c||s.WTF&&i[i.length-1]!=35)throw new Error("Unexpected record 0x"+u.toString(16))}}}),n}function g_(){var e=xr();return ge(e,332),ge(e,334,Gr(1)),ge(e,335,d_({name:"XLDAPR",version:12e4,flags:3496657072})),ge(e,336),ge(e,339,f_(1,"XLDAPR")),ge(e,52),ge(e,35,Gr(514)),ge(e,4096,Gr(0)),ge(e,4097,Ir(1)),ge(e,36),ge(e,53),ge(e,340),ge(e,337,m_(1)),ge(e,51,h_([[1,0]])),ge(e,338),ge(e,333),e.end()}function v_(e,r,a){var n={Types:[],Cell:[],Value:[]};if(!e)return n;var s=!1,i=2,c;return e.replace(cr,function(o){var l=qe(o);switch(sa(l[0])){case"<?xml":break;case"<metadata":case"</metadata>":break;case"<metadataTypes":case"</metadataTypes>":break;case"<metadataType":n.Types.push({name:l.name});break;case"</metadataType>":break;case"<futureMetadata":for(var d=0;d<n.Types.length;++d)n.Types[d].name==l.name&&(c=n.Types[d]);break;case"</futureMetadata>":break;case"<bk>":break;case"</bk>":break;case"<rc":i==1?n.Cell.push({type:n.Types[l.t-1].name,index:+l.v}):i==0&&n.Value.push({type:n.Types[l.t-1].name,index:+l.v});break;case"</rc>":break;case"<cellMetadata":i=1;break;case"</cellMetadata>":i=2;break;case"<valueMetadata":i=0;break;case"</valueMetadata>":i=2;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":s=!0;break;case"</ext>":s=!1;break;case"<rvb":if(!c)break;c.offsets||(c.offsets=[]),c.offsets.push(+l.i);break;default:if(!s&&a.WTF)throw new Error("unrecognized "+l[0]+" in metadata")}return o}
vendor: 4,206 bytes, lines 507-525
507),n}function F0(){var e=[Rt];return e.push(`<metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" xmlns:xda="http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray"> 508 <metadataTypes count="1"> 509 <metadataType name="XLDAPR" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1" cellMeta="1"/> 510 </metadataTypes> 511 <futureMetadata name="XLDAPR" count="1"> 512 <bk> 513 <extLst> 514 <ext uri="{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}"> 515 <xda:dynamicArrayProperties fDynamic="1" fCollapsed="0"/> 516 </ext> 517 </extLst> 518 </bk> 519 </futureMetadata> 520 <cellMetadata count="1"> 521 <bk> 522 <rc t="1" v="0"/> 523 </bk> 524 </cellMetadata> 525</metadata>`),e.join("")}function y_(e){var r=[];if(!e)return r;var a=1;return(e.match(cr)||[]).forEach(function(n){var s=qe(n);switch(s[0]){case"<?xml":break;case"<calcChain":case"<calcChain>":case"</calcChain>":break;case"<c":delete s[0],s.i?a=s.i:s.i=a,r.push(s);break}}),r}function __(e){var r={};r.i=e.read_shift(4);var a={};a.r=e.read_shift(4),a.c=e.read_shift(4),r.r=Ve(a);var n=e.read_shift(1);return n&2&&(r.l="1"),n&8&&(r.a="1"),r}function b_(e,r,a){var n=[];return _a(e,function(i,c,o){switch(o){case 63:n.push(i);break;default:if(!c.T)throw new Error("Unexpected record 0x"+o.toString(16))}}),n}function j_(e,r,a,n){if(!e)return e;var s=n||{},i=!1;_a(e,function(o,l,d){switch(d){case 359:case 363:case 364:case 366:case 367:case 368:case 369:case 370:case 371:case 472:case 577:case 578:case 579:case 580:case 581:case 582:case 583:case 584:case 585:case 586:case 587:break;case 35:i=!0;break;case 36:i=!1;break;default:if(!l.T){if(!i||s.WTF)throw new Error("Unexpected record 0x"+d.toString(16))}}},s)}function w_(e,r){if(!e)return"??";var a=(e.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];return r["!id"][a].Target}var kn=1024;function I0(e,r){for(var a=[21600,21600],n=["m0,0l0",a[1],a[0],a[1],a[0],"0xe"].join(","),s=[Se("xml",null,{"xmlns:v":_r.v,"xmlns:o":_r.o,"xmlns:x":_r.x,"xmlns:mv":_r.mv}).replace(/\/>/,">"),Se("o:shapelayout",Se("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),Se("v:shapetype",[Se("v:stroke",null,{joinstyle:"miter"}),Se("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:a.join(","),path:n})];kn<e*1e3;)kn+=1e3;return r.forEach(function(i){var c=Ct(i[0]),o={color2:"#BEFF82",type:"gradient"};o.type=="gradient"&&(o.angle="-180");var l=o.type=="gradient"?Se("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,d=Se("v:fill",l,o),u={on:"t",obscured:"t"};++kn,s=s.concat(["<v:shape"+ws({id:"_x0000_s"+kn,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(i[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",d,Se("v:shadow",null,u),Se("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Qt("x:Anchor",[c.c+1,0,c.r+1,0,c.c+3,20,c.r+5,20].join(",")),Qt("x:AutoFill","False"),Qt("x:Row",String(c.r)),Qt("x:Column",String(c.c)),i[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),s.push("</xml>"),s.join("")}function jd(e,r,a,n){var s=Array.isArray(e),i;r.forEach(function(c){var o=Ct(c.ref);if(s?(e[o.r]||(e[o.r]=[]),i=e[o.r][o.c]):i=e[c.ref],!i){i={t:"z"},s?e[o.r][o.c]=i:e[c.ref]=i;var l=at(e["!ref"]||"BDWGO1000001:A1");l.s.r>o.r&&(l.s.r=o.r),l.e.r<o.r&&(l.e.r=o.r),l.s.c>o.c&&(l.s.c=o.c),l.e.c<o.c&&(l.e.c=o.c);var d=Ke(l);d!==e["!ref"]&&(e["!ref"]=d)}i.c||(i.c=[]);var u={a:c.author,t:c.t,r:c.r,T:a};c.h&&(u.h=c.h);for(var h=i.c.length-1;h>=0;--h){if(!a&&i.c[h].T)return;a&&!i.c[h].T&&i.c.splice(h,1)}if(a&&n){for(h=0;h<n.length;++h)if(u.a==n[h].id){u.a=n[h].name||u.a;break}}i.c.push(u)})}function k_(e,r){if(e.match(/<(?:\w+:)?comments *\/>/))return[];var a=[],n=[],s=e.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);s&&s[1]&&s[1].split(/<\/\w*:?author>
vendor: 4,475 bytes, lines 525-533
525/).forEach(function(c){if(!(c===""||c.trim()==="")){var o=c.match(/<(?:\w+:)?author[^>]*>(.*)/);o&&a.push(o[1])}});var i=e.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);return i&&i[1]&&i[1].split(/<\/\w*:?comment>/).forEach(function(c){if(!(c===""||c.trim()==="")){var o=c.match(/<(?:\w+:)?comment[^>]*>/);if(o){var l=qe(o[0]),d={author:l.authorId&&a[l.authorId]||"sheetjsghost",ref:l.ref,guid:l.guid},u=Ct(l.ref);if(!(r.sheetRows&&r.sheetRows<=u.r)){var h=c.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/),f=!!h&&!!h[1]&&Ho(h[1])||{r:"",t:"",h:""};d.r=f.r,f.r=="<t></t>"&&(f.t=f.h=""),d.t=(f.t||"").replace(/\r\n/g,` 526`).replace(/\r/g,` 527`),r.cellHTML&&(d.h=f.h),n.push(d)}}}}),n}function P0(e){var r=[Rt,Se("comments",null,{xmlns:on[0]})],a=[];return r.push("<authors>"),e.forEach(function(n){n[1].forEach(function(s){var i=ht(s.a);a.indexOf(i)==-1&&(a.push(i),r.push("<author>"+i+"</author>")),s.T&&s.ID&&a.indexOf("tc="+s.ID)==-1&&(a.push("tc="+s.ID),r.push("<author>tc="+s.ID+"</author>"))})}),a.length==0&&(a.push("SheetJ5"),r.push("<author>SheetJ5</author>")),r.push("</authors>"),r.push("<commentList>"),e.forEach(function(n){var s=0,i=[];if(n[1][0]&&n[1][0].T&&n[1][0].ID?s=a.indexOf("tc="+n[1][0].ID):n[1].forEach(function(l){l.a&&(s=a.indexOf(ht(l.a))),i.push(l.t||"")}),r.push('<comment ref="'+n[0]+'" authorId="'+s+'"><text>'),i.length<=1)r.push(Qt("t",ht(i[0]||"")));else{for(var c=`Comment: 528 `+i[0]+` 529`,o=1;o<i.length;++o)c+=`Reply: 530 `+i[o]+` 531`;r.push(Qt("t",ht(c)))}r.push("</text></comment>")}),r.push("</commentList>"),r.length>2&&(r[r.length]="</comments>",r[1]=r[1].replace("/>",">")),r.join("")}function S_(e,r){var a=[],n=!1,s={},i=0;return e.replace(cr,function(o,l){var d=qe(o);switch(sa(d[0])){case"<?xml":break;case"<ThreadedComments":break;case"</ThreadedComments>":break;case"<threadedComment":s={author:d.personId,guid:d.id,ref:d.ref,T:1};break;case"</threadedComment>":s.t!=null&&a.push(s);break;case"<text>":case"<text":i=l+o.length;break;case"</text>":s.t=e.slice(i,l).replace(/\r\n/g,` 532`).replace(/\r/g,` 533`);break;case"<mentions":case"<mentions>":n=!0;break;case"</mentions>":n=!1;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&r.WTF)throw new Error("unrecognized "+d[0]+" in threaded comments")}return o}),a}function N_(e,r,a){var n=[Rt,Se("ThreadedComments",null,{xmlns:Wt.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(s){var i="";(s[1]||[]).forEach(function(c,o){if(!c.T){delete c.ID;return}c.a&&r.indexOf(c.a)==-1&&r.push(c.a);var l={ref:s[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+a.tcid++).slice(-12)+"}"};o==0?i=l.id:l.parentId=i,c.ID=l.id,c.a&&(l.personId="{54EE7950-7262-4200-6969-"+("000000000000"+r.indexOf(c.a)).slice(-12)+"}"),n.push(Se("threadedComment",Qt("text",c.t||""),l))})}),n.push("</ThreadedComments>"),n.join("")}function C_(e,r){var a=[],n=!1;return e.replace(cr,function(i){var c=qe(i);switch(sa(c[0])){case"<?xml":break;case"<personList":break;case"</personList>":break;case"<person":a.push({name:c.displayname,id:c.id});break;case"</person>":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&r.WTF)throw new Error("unrecognized "+c[0]+" in threaded comments")}return i}),a}function E_(e){var r=[Rt,Se("personList",null,{xmlns:Wt.TCMNT,"xmlns:x":on[0]}).replace(/[\/]>/,">")];return e.forEach(function(a,n){r.push(Se("person",null,{displayName:a,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:a,providerId:"None"}))}),r.push("</personList>"),r.join("")}function T_(e){var r={};r.iauthor=e.read_shift(4);var a=hn(e);return r.rfx=a.s,r.ref=Ve(a.s),e.l+=16,r}function A_(e,r){return r==null&&(r=pe(36)),r.write_shift(4,e[1].iauthor),$n(e[0],r),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r}var F_=sr;function I_(e){return Xt(e.slice(0,54))}function P_(e,r){var a=[],n=[],s={},i=!1;return _a(e,function(o,l,d){switch(d){case 632:n.push(o);break;case 635:s=o;break;case 637:s.t=o.t,s.h=o.h,s.r=o.r;break;case 636:if(s.author=n[s.iauthor],delete s.iauthor,r.sheetRows&&s.rfx&&r.sheetRows<=s.rfx.r)break;s.t||(s.t=""),delete s.rfx,a.push(s);break;case 3072:break;case 35:i=!0;break;case 36:i=!1;break;case 37:break;case 38:break;default:if(!l.T){if(!i||r.WTF)throw new Error("Unexpected record 0x"+d.toString(16))}}}),a}function D_(e){var r=xr(),a=[];
533return ge(r,628),ge(r,630),e.forEach(function(n){n[1].forEach(function(s){a.indexOf(s.a)>-1||(a.push(s.a.slice(0,54)),ge(r,632,I_(s.a)))})}),ge(r,631),ge(r,633),e.forEach(function(n){n[1].forEach(function(s){s.iauthor=a.indexOf(s.a);var i={s:Ct(n[0]),e:Ct(n[0])};ge(r,635,A_([i,s])),s.t&&s.t.length>0&&ge(r,637,rg(s)),ge(r,636),delete s.iauthor})}),ge(r,634),ge(r,629),r.end()}var R_="application/vnd.ms-office.vbaProject";function O_(e){var r=Be.utils.cfb_new({root:"R"});return e.FullPaths.forEach(function(a,n){if(!(a.slice(-1)==="/"||!a.match(/_VBA_PROJECT_CUR/))){var s=a.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/,"");Be.utils.cfb_add(r,s,e.FileIndex[n].content)}}),Be.write(r)}function L_(e,r){r.FullPaths.forEach(function(a,n){if(n!=0){var s=a.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");s.slice(-1)!=="/"&&Be.utils.cfb_add(e,s,r.FileIndex[n].content)}})}var D0=["xlsb","xlsm","xlam","biff8","xla"];function B_(){return{"!type":"dialog"}}function M_(){return{"!type":"dialog"}}function z_(){return{"!type":"macro"}}function U_(){return{"!type":"macro"}}var Fn=(function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,r={r:0,c:0};function a(n,s,i,c){var o=!1,l=!1;i.length==0?l=!0:i.charAt(0)=="["&&(l=!0,i=i.slice(1,-1)),c.length==0?o=!0:c.charAt(0)=="["&&(o=!0,c=c.slice(1,-1));var d=i.length>0?parseInt(i,10)|0:0,u=c.length>0?parseInt(c,10)|0:0;return o?u+=r.c:--u,l?d+=r.r:--d,s+(o?"":"$")+Nt(u)+(l?"":"$")+Dt(d)}return function(s,i){return r=i,s.replace(e,a)}})(),$o=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g,Go=(function(){return function(r,a){return r.replace($o,function(n,s,i,c,o,l){var d=Po(c)-(i?0:a.c),u=Io(l)-(o?0:a.r),h=u==0?"":o?u+1:"["+u+"]",f=d==0?"":i?d+1:"["+d+"]";return s+"R"+h+"C"+f})}})();function R0(e,r){return e.replace($o,function(a,n,s,i,c,o){return n+(s=="$"?s+i:Nt(Po(i)+r.c))+(c=="$"?c+o:Dt(Io(o)+r.r))})}function H_(e,r,a){var n=vr(r),s=n.s,i=Ct(a),c={r:i.r-s.r,c:i.c-s.c};return R0(e,c)}function W_(e){return e.length!=1}function wd(e){return e.replace(/_xlfn\./g,"")}function Ot(e){e.l+=1}function Pa(e,r){var a=e.read_shift(2);return[a&16383,a>>14&1,a>>15&1]}function O0(e,r,a){var n=2;if(a){if(a.biff>=2&&a.biff<=5)return L0(e);a.biff==12&&(n=4)}var s=e.read_shift(n),i=e.read_shift(n),c=Pa(e),o=Pa(e);return{s:{r:s,c:c[0],cRel:c[1],rRel:c[2]},e:{r:i,c:o[0],cRel:o[1],rRel:o[2]}}}function L0(e){var r=Pa(e),a=Pa(e),n=e.read_shift(1),s=e.read_shift(1);return{s:{r:r[0],c:n,cRel:r[1],rRel:r[2]},e:{r:a[0],c:s,cRel:a[1],rRel:a[2]}}}function V_(e,r,a){if(a.biff<8)return L0(e);var n=e.read_shift(a.biff==12?4:2),s=e.read_shift(a.biff==12?4:2),i=Pa(e),c=Pa(e);return{s:{r:n,c:i[0],cRel:i[1],rRel:i[2]},e:{r:s,c:c[0],cRel:c[1],rRel:c[2]}}}function B0(e,r,a){if(a&&a.biff>=2&&a.biff<=5)return q_(e);var n=e.read_shift(a&&a.biff==12?4:2),s=Pa(e);return{r:n,c:s[0],cRel:s[1],rRel:s[2]}}function q_(e){var r=Pa(e),a=e.read_shift(1);return{r:r[0],c:a,cRel:r[1],rRel:r[2]}}function $_(e){var r=e.read_shift(2),a=e.read_shift(2);return{r,c:a&255,fQuoted:!!(a&16384),cRel:a>>15,rRel:a>>15}}function G_(e,r,a){var n=a&&a.biff?a.biff:8;if(n>=2&&n<=5)return X_(e);var s=e.read_shift(n>=12?4:2),i=e.read_shift(2),c=(i&16384)>>14,o=(i&32768)>>15;if(i&=16383,o==1)for(;s>524287;)s-=1048576;if(c==1)for(;i>8191;)i=i-16384;return{r:s,c:i,cRel:c,rRel:o}}function X_(e){var r=e.read_shift(2),a=e.read_shift(1),n=(r&32768)>>15,s=(r&16384)>>14;return r&=16383,n==1&&r>=8192&&(r=r-16384),s==1&&a>=128&&(a=a-256),{r,c:a,cRel:s,rRel:n}}function K_(e,r,a){var n=(e[e.l++]&96)>>5,s=O0(e,a.biff>=2&&a.biff<=5?6:8,a);return[n,s]}function Y_(e,r,a){var n=(e[e.l++]&96)>>5,s=e.read_shift(2,"i"),i=8;if(a)switch(a.biff){case 5:e.l+=12,i=6;break;case 12:i=12;break}var c=O0(e,i,a);return[n,s,c]}function J_(e,r,a){var n=(e[e.l++]&96)>>5;return e.l+=a&&a.biff>8?12:a.biff<8?6:8,[n]}function Q_(e,r,a){var n=(e[e.l++]&96)>>5,s=e.read_shift(2),i=8;if(a)switch(a.biff){case 5:e.l+=12,i=6;break;case 12:i=12;break}return e.l+=i,[n,s]}function Z_(e,r,a){var n=(e[e.l++]&96)>>5,s=V_(e,r-1,a);return[n,s]}function eb(e,r,a){var n=(e[e.l++]&96)>>5;return e.l+=a.biff==2?6:a.biff==12?14:7,[n]}function kd(e){var r=e[e.l+1]&1,a=1;return e.l+=4,[r,a]}function tb(e,r,a){e.l+=2;for(var n=e.read_shift(a&&a.biff==2?1:2),s=[],i=0;i<=n;++i)s.push(e.read_shift(a&&a.biff==2?1:2));return s}function rb(e,r,a){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(a&&a.biff==2?1:2)]}function ab(e,r,a){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(a&&a.biff==2?1:2)]}function nb(e){var r=e[e.l+1]&255?1:0;return e.l+=2,[r,e.read_shift(2)]}
533function sb(e,r,a){var n=e[e.l+1]&255?1:0;return e.l+=a&&a.biff==2?3:4,[n]}function M0(e){var r=e.read_shift(1),a=e.read_shift(1);return[r,a]}function ib(e){return e.read_shift(2),M0(e)}function cb(e){return e.read_shift(2),M0(e)}function ob(e,r,a){var n=(e[e.l]&96)>>5;e.l+=1;var s=B0(e,0,a);return[n,s]}function lb(e,r,a){var n=(e[e.l]&96)>>5;e.l+=1;var s=G_(e,0,a);return[n,s]}function db(e,r,a){var n=(e[e.l]&96)>>5;e.l+=1;var s=e.read_shift(2);a&&a.biff==5&&(e.l+=12);var i=B0(e,0,a);return[n,s,i]}function ub(e,r,a){var n=(e[e.l]&96)>>5;e.l+=1;var s=e.read_shift(a&&a.biff<=3?1:2);return[pj[s],H0[s],n]}function hb(e,r,a){var n=e[e.l++],s=e.read_shift(1),i=a&&a.biff<=3?[n==88?-1:0,e.read_shift(1)]:fb(e);return[s,(i[0]===0?H0:fj)[i[1]]]}function fb(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function pb(e,r,a){e.l+=a&&a.biff==2?3:4}function mb(e,r,a){if(e.l++,a&&a.biff==12)return[e.read_shift(4,"i"),0];var n=e.read_shift(2),s=e.read_shift(a&&a.biff==2?1:2);return[n,s]}function xb(e){return e.l++,ba[e.read_shift(1)]}function gb(e){return e.l++,e.read_shift(2)}function vb(e){return e.l++,e.read_shift(1)!==0}function yb(e){return e.l++,nr(e)}function _b(e,r,a){return e.l++,Us(e,r-1,a)}function bb(e,r){var a=[e.read_shift(1)];if(r==12)switch(a[0]){case 2:a[0]=4;break;case 4:a[0]=16;break;case 0:a[0]=1;break;case 1:a[0]=2;break}switch(a[0]){case 4:a[1]=Pt(e,1)?"TRUE":"FALSE",r!=12&&(e.l+=7);break;case 37:case 16:a[1]=ba[e[e.l]],e.l+=r==12?4:8;break;case 0:e.l+=8;break;case 1:a[1]=nr(e);break;case 2:a[1]=fn(e,0,{biff:r>0&&r<8?2:r});break;default:throw new Error("Bad SerAr: "+a[0])}return a}function jb(e,r,a){for(var n=e.read_shift(a.biff==12?4:2),s=[],i=0;i!=n;++i)s.push((a.biff==12?hn:qi)(e));return s}function wb(e,r,a){var n=0,s=0;a.biff==12?(n=e.read_shift(4),s=e.read_shift(4)):(s=1+e.read_shift(1),n=1+e.read_shift(2)),a.biff>=2&&a.biff<8&&(--n,--s==0&&(s=256));for(var i=0,c=[];i!=n&&(c[i]=[]);++i)for(var o=0;o!=s;++o)c[i][o]=bb(e,a.biff);return c}function kb(e,r,a){var n=e.read_shift(1)>>>5&3,s=!a||a.biff>=8?4:2,i=e.read_shift(s);switch(a.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[n,0,i]}function Sb(e,r,a){if(a.biff==5)return Nb(e);var n=e.read_shift(1)>>>5&3,s=e.read_shift(2),i=e.read_shift(4);return[n,s,i]}function Nb(e){var r=e.read_shift(1)>>>5&3,a=e.read_shift(2,"i");e.l+=8;var n=e.read_shift(2);return e.l+=12,[r,a,n]}function Cb(e,r,a){var n=e.read_shift(1)>>>5&3;e.l+=a&&a.biff==2?3:4;var s=e.read_shift(a&&a.biff==2?1:2);return[n,s]}function Eb(e,r,a){var n=e.read_shift(1)>>>5&3,s=e.read_shift(a&&a.biff==2?1:2);return[n,s]}function Tb(e,r,a){var n=e.read_shift(1)>>>5&3;return e.l+=4,a.biff<8&&e.l--,a.biff==12&&(e.l+=2),[n]}function Ab(e,r,a){var n=(e[e.l++]&96)>>5,s=e.read_shift(2),i=4;if(a)switch(a.biff){case 5:i=15;break;case 12:i=6;break}return e.l+=i,[n,s]}var Fb=ir,Ib=ir,Pb=ir;function Ws(e,r,a){return e.l+=2,[$_(e)]}function Xo(e){return e.l+=6,[]}var Db=Ws,Rb=Xo,Ob=Xo,Lb=Ws;function z0(e){return e.l+=2,[Bt(e),e.read_shift(2)&1]}var Bb=Ws,Mb=z0,zb=Xo,Ub=Ws,Hb=Ws,Wb=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function Vb(e){e.l+=2;var r=e.read_shift(2),a=e.read_shift(2),n=e.read_shift(4),s=e.read_shift(2),i=e.read_shift(2),c=Wb[a>>2&31];return{ixti:r,coltype:a&3,rt:c,idx:n,c:s,C:i}}function qb(e){return e.l+=2,[e.read_shift(4)]}function $b(e,r,a){return e.l+=5,e.l+=2,e.l+=a.biff==2?1:4,["PTGSHEET"]}function Gb(e,r,a){return e.l+=a.biff==2?4:5,["PTGENDSHEET"]}function Xb(e){var r=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[r,a]}function Kb(e){var r=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[r,a]}function Yb(e){return e.l+=4,[0,0]}var Sd={1:{n:"PtgExp",f:mb},2:{n:"PtgTbl",f:Pb},3:{n:"PtgAdd",f:Ot},4:{n:"PtgSub",f:Ot},5:{n:"PtgMul",f:Ot},6:{n:"PtgDiv",f:Ot},7:{n:"PtgPower",f:Ot},8:{n:"PtgConcat",f:Ot},9:{n:"PtgLt",f:Ot},10:{n:"PtgLe",f:Ot},11:{n:"PtgEq",f:Ot},12:{n:"PtgGe",f:Ot},13:{n:"PtgGt",f:Ot},14:{n:"PtgNe",f:Ot},15:{n:"PtgIsect",f:Ot},16:{n:"PtgUnion",f:Ot},17:{n:"PtgRange",f:Ot},18:{n:"PtgUplus",f:Ot},19:{n:"PtgUminus",f:Ot},20:{n:"PtgPercent",f:Ot},21:{n:"PtgParen",f:Ot},22:{n:"PtgMissArg",f:Ot},23:{n:"PtgStr",f:_b},26:{n:"PtgSheet",f:$b},27:{n:"PtgEndSheet",f:Gb},28:{n:"PtgErr",f:xb},29:{n:"PtgBool",f:vb},30:{n:"PtgInt",f:gb},31:{n:"PtgNum",f:yb},32:{n:"PtgArray",f:eb}
vendor: 9,442 bytes, line 533
533,33:{n:"PtgFunc",f:ub},34:{n:"PtgFuncVar",f:hb},35:{n:"PtgName",f:kb},36:{n:"PtgRef",f:ob},37:{n:"PtgArea",f:K_},38:{n:"PtgMemArea",f:Cb},39:{n:"PtgMemErr",f:Fb},40:{n:"PtgMemNoMem",f:Ib},41:{n:"PtgMemFunc",f:Eb},42:{n:"PtgRefErr",f:Tb},43:{n:"PtgAreaErr",f:J_},44:{n:"PtgRefN",f:lb},45:{n:"PtgAreaN",f:Z_},46:{n:"PtgMemAreaN",f:Xb},47:{n:"PtgMemNoMemN",f:Kb},57:{n:"PtgNameX",f:Sb},58:{n:"PtgRef3d",f:db},59:{n:"PtgArea3d",f:Y_},60:{n:"PtgRefErr3d",f:Ab},61:{n:"PtgAreaErr3d",f:Q_},255:{}},Jb={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61},Qb={1:{n:"PtgElfLel",f:z0},2:{n:"PtgElfRw",f:Ub},3:{n:"PtgElfCol",f:Db},6:{n:"PtgElfRwV",f:Hb},7:{n:"PtgElfColV",f:Lb},10:{n:"PtgElfRadical",f:Bb},11:{n:"PtgElfRadicalS",f:zb},13:{n:"PtgElfColS",f:Rb},15:{n:"PtgElfColSV",f:Ob},16:{n:"PtgElfRadicalLel",f:Mb},25:{n:"PtgList",f:Vb},29:{n:"PtgSxName",f:qb},255:{}},Zb={0:{n:"PtgAttrNoop",f:Yb},1:{n:"PtgAttrSemi",f:sb},2:{n:"PtgAttrIf",f:ab},4:{n:"PtgAttrChoose",f:tb},8:{n:"PtgAttrGoto",f:rb},16:{n:"PtgAttrSum",f:pb},32:{n:"PtgAttrBaxcel",f:kd},33:{n:"PtgAttrBaxcel",f:kd},64:{n:"PtgAttrSpace",f:ib},65:{n:"PtgAttrSpaceSemi",f:cb},128:{n:"PtgAttrIfError",f:nb},255:{}};function Vs(e,r,a,n){if(n.biff<8)return ir(e,r);for(var s=e.l+r,i=[],c=0;c!==a.length;++c)switch(a[c][0]){case"PtgArray":a[c][1]=wb(e,0,n),i.push(a[c][1]);break;case"PtgMemArea":a[c][2]=jb(e,a[c][1],n),i.push(a[c][2]);break;case"PtgExp":n&&n.biff==12&&(a[c][1][1]=e.read_shift(4),i.push(a[c][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+a[c][0]}return r=s-e.l,r!==0&&i.push(ir(e,r)),i}function qs(e,r,a){for(var n=e.l+r,s,i,c=[];n!=e.l;)r=n-e.l,i=e[e.l],s=Sd[i]||Sd[Jb[i]],(i===24||i===25)&&(s=(i===24?Qb:Zb)[e[e.l+1]]),!s||!s.f?ir(e,r):c.push([s.n,s.f(e,r,a)]);return c}function ej(e){for(var r=[],a=0;a<e.length;++a){for(var n=e[a],s=[],i=0;i<n.length;++i){var c=n[i];if(c)switch(c[0]){case 2:s.push('"'+c[1].replace(/"/g,'""')+'"');break;default:s.push(c[1])}else s.push("")}r.push(s.join(","))}return r.join(";")}var tj={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function rj(e,r){if(!e&&!(r&&r.biff<=5&&r.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function U0(e,r,a){if(!e)return"SH33TJSERR0";if(a.biff>8&&(!e.XTI||!e.XTI[r]))return e.SheetNames[r];if(!e.XTI)return"SH33TJSERR6";var n=e.XTI[r];if(a.biff<8)return r>1e4&&(r-=65536),r<0&&(r=-r),r==0?"":e.XTI[r-1];if(!n)return"SH33TJSERR1";var s="";if(a.biff>8)switch(e[n[0]][0]){case 357:return s=n[1]==-1?"#REF":e.SheetNames[n[1]],n[1]==n[2]?s:s+":"+e.SheetNames[n[2]];case 358:return a.SID!=null?e.SheetNames[a.SID]:"SH33TJSSAME"+e[n[0]][0];case 355:default:return"SH33TJSSRC"+e[n[0]][0]}switch(e[n[0]][0][0]){case 1025:return s=n[1]==-1?"#REF":e.SheetNames[n[1]]||"SH33TJSERR3",n[1]==n[2]?s:s+":"+e.SheetNames[n[2]];case 14849:return e[n[0]].slice(1).map(function(i){return i.Name}).join(";;");default:return e[n[0]][0][3]?(s=n[1]==-1?"#REF":e[n[0]][0][3][n[1]]||"SH33TJSERR4",n[1]==n[2]?s:s+":"+e[n[0]][0][3][n[2]]):"SH33TJSERR2"}}function Nd(e,r,a){var n=U0(e,r,a);return n=="#REF"?n:rj(n,a)}function rr(e,r,a,n,s){var i=s&&s.biff||8,c={s:{c:0,r:0}},o=[],l,d,u,h=0,f=0,m,x="";if(!e[0]||!e[0][0])return"";for(var p=-1,g="",w=0,S=e[0].length;w<S;++w){var b=e[0][w];switch(b[0]){case"PtgUminus":o.push("-"+o.pop());break;case"PtgUplus":o.push("+"+o.pop());break;case"PtgPercent":o.push(o.pop()+"%");break;case"PtgAdd":case"PtgConcat":case"PtgDiv":case"PtgEq":case"PtgGe":case"PtgGt":case"PtgLe":case"PtgLt":case"PtgMul":case"PtgNe":case"PtgPower":case"PtgSub":if(l=o.pop(),d=o.pop(),p>=0){switch(e[0][p][1][0]){case 0:g=Et(" ",e[0][p][1][1]);break;case 1:g=Et("\r",e[0][p][1][1]);break;default:if(g="",s.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}d=d+g,p=-1}o.push(d+tj[b[0]]+l);break;case"PtgIsect":l=o.pop(),d=o.pop(),o.push(d+" "+l);break;case"PtgUnion":l=o.pop(),d=o.pop(),o.push(d+","+l);break;case"PtgRange":l=o.pop(),d=o.pop(),o.push(d+":"+l);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":u=ds(b[1][1],c,s),o.push(us(u,i));break;case"PtgRefN":u=a?ds(b[1][1],a,s):b[1][1],o.push(us(u,i));break;case"PtgRef3d":h=b[1][1],u=ds(b[1][2],c,s),x=Nd(n,h,s),o.push(x+"!"+us(u,i));break;case"PtgFunc":case"PtgFuncVar":var j=b[1][0],k=b[1][1];j||(j=0),j&=127;var N=j==0?[]:o.slice(-j);o.length-=j,k==="User"&&(k=N.shift()),o.push(k+"("+N.join(",")+")");break;case"PtgBool":o.push(b[1]?"TRUE":"FALSE");break;case"PtgInt":o.push(b[1]);break;case"PtgNum":o.push(String(b[1]));break;case"PtgStr":o.push('"'+b[1].replace(/"/g,'""')+'"');break;case"PtgErr":o.push(b[1]);break;case"PtgAreaN":m=td(b[1][1],a?{s:a}:c,s),o.push(Zi(m,s));break;case"PtgArea":m=td(b[1][1],c,s),o.push(Zi(m,s));break;case"PtgArea3d":h=b[1][1],m=b[1][2],x=Nd(n,h,s),o.push(x+"!"+Zi(m,s));break;case"PtgAttrSum":o.push("SUM("+o.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":f=b[1][2];var C=(n.names||[])[f-1]||(n[0]||[])[f],P=C?C.Name:"SH33TJSNAME"+String(f);P&&P.slice(0,6)=="_xlfn."&&!s.xlfn&&(P=P.slice(6)),o.push(P);break;case"PtgNameX":var T=b[1][1];f=b[1][2];var L;if(s.biff<=5)T<0&&(T=-T),n[T]&&(L=n[T][f]);else{var M="";if(((n[T]||[])[0]||[])[0]==14849||(((n[T]||[])[0]||[])[0]==1025?n[T][f]&&n[T][f].itab>0&&(M=n.SheetNames[n[T][f].itab-1]+"!"):M=n.SheetNames[f-1]+"!"),n[T]&&n[T][f])M+=n[T][f].Name;else if(n[0]&&n[0][f])M+=n[0][f].Name;else{var E=(U0(n,T,s)||"").split(";;");E[f-1]?M=E[f-1]:M+="SH33TJSERRX"}o.push(M);break}L||(L={Name:"SH33TJSERRY"}),o.push(L.Name);break;case"PtgParen":var W="(",ee=")";if(p>=0){switch(g="",e[0][p][1][0]){case 2:W=Et(" ",e[0][p][1][1])+W;break;case 3:W=Et("\r",e[0][p][1][1])+W;break;case 4:ee=Et(" ",e[0][p][1][1])+ee;break;case 5:ee=Et("\r",e[0][p][1][1])+ee;break;default:if(s.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}p=-1}o.push(W+o.pop()+ee);break;case"PtgRefErr":o.push("#REF!");break;case"PtgRefErr3d":o.push("#REF!");break;case"PtgExp":u={c:b[1][1],r:b[1][0]};var ce={c:a.c,r:a.r};if(n.sharedf[Ve(u)]){var ue=n.sharedf[Ve(u)];o.push(rr(ue,c,ce,n,s))}else{var te=!1;for(l=0;l!=n.arrayf.length;++l)if(d=n.arrayf[l],!(u.c<d[0].s.c||u.c>d[0].e.c)&&!(u.r<d[0].s.r||u.r>d[0].e.r)){o.push(rr(d[1],c,ce,n,s)),te=!0;break}te||o.push(b[1])}break;case"PtgArray":o.push("{"+ej(b[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":p=w;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":o.push("");break;case"PtgAreaErr":o.push("#REF!");break;case"PtgAreaErr3d":o.push("#REF!");break;case"PtgList":o.push("Table"+b[1].idx+"[#"+b[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":break;case"PtgMemFunc":break;case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":throw new Error("Unrecognized Formula Token: "+String(b));default:throw new Error("Unrecognized Formula Token: "+String(b))}var fe=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(s.biff!=3&&p>=0&&fe.indexOf(e[0][w][0])==-1){b=e[0][p];var q=!0;switch(b[1][0]){case 4:q=!1;case 0:g=Et(" ",b[1][1]);break;case 5:q=!1;case 1:g=Et("\r",b[1][1]);break;default:if(g="",s.WTF)throw new Error("Unexpected PtgAttrSpaceType "+b[1][0])}o.push((q?g:"")+o.pop()+(q?"":g)),p=-1}}if(o.length>1&&s.WTF)throw new Error("bad formula stack");return o[0]}function aj(e,r,a){var n=e.l+r,s=a.biff==2?1:2,i,c=e.read_shift(s);if(c==65535)return[[],ir(e,r-2)];var o=qs(e,c,a);return r!==c+s&&(i=Vs(e,r-c-s,o,a)),e.l=n,[o,i]}function nj(e,r,a){var n=e.l+r,s=a.biff==2?1:2,i,c=e.read_shift(s);if(c==65535)return[[],ir(e,r-2)];var o=qs(e,c,a);return r!==c+s&&(i=Vs(e,r-c-s,o,a)),e.l=n,[o,i]}function sj(e,r,a,n){var s=e.l+r,i=qs(e,n,a),c;return s!==e.l&&(c=Vs(e,s-e.l,i,a)),[i,c]}function ij(e,r,a){var n=e.l+r,s,i=e.read_shift(2),c=qs(e,i,a);return i==65535?[[],ir(e,r-2)]:(r!==i+2&&(s=Vs(e,n-i-2,c,a)),[c,s])}function cj(e){var r;if(ua(e,e.l+6)!==65535)return[nr(e),"n"];switch(e[e.l]){case 0:return e.l+=8,["String","s"];case 1:return r=e[e.l+2]===1,e.l+=8,[r,"b"];case 2:return r=e[e.l+2],e.l+=8,[r,"e"];case 3:return e.l+=8,["","s"]}return[]}function oj(e){if(e==null){var r=pe(8);return r.write_shift(1,3),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,65535),r}else if(typeof e=="number")return an(e);return an(0)}function nc(e,r,a){var n=e.l+r,s=ia(e);a.biff==2&&++e.l;var i=cj(e),c=e.read_shift(1);a.biff!=2&&(e.read_shift(1),a.biff>=5&&e.read_shift(4));var o=nj(e,n-e.l,a);return{cell:s,val:i[0],formula:o,shared:c>>3&1,tt:i[1]}}function lj(e,r,a,n,s){var i=sn(r,a,s),c=oj(e.v),o=pe(6),l=33;o.write_shift(2,l),o.write_shift(4,0);for(var d=pe(e.bf.length),u=0;u<e.bf.length;++u)d[u]=e.bf[u];var h=Gt([i,c,o,d]);return h}function $i(e,r,a){var n=e.read_shift(4),s=qs(e,n,a),i=e.read_shift(4),c=i>0?Vs(e,i,s,a):null;return[s,c]}var dj=$i,Gi=$i,uj=$i,hj=$i,fj
vendor: 7,369 bytes, line 533
533={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"}
533,H0={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284
vendor: 7,042 bytes, line 533
533:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},pj={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0};function Cd(e){return e.slice(0,3)=="of:"&&(e=e.slice(3)),e.charCodeAt(0)==61&&(e=e.slice(1),e.charCodeAt(0)==61&&(e=e.slice(1))),e=e.replace(/COM\.MICROSOFT\./g,""),e=e.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g,function(r,a){return a.replace(/\./g,"")}),e=e.replace(/\[.(#[A-Z]*[?!])\]/g,"$1"),e.replace(/[;~]/g,",").replace(/\|/g,";")}function mj(e){var r="of:="+e.replace($o,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return r.replace(/;/g,"|").replace(/,/g,";")}function sc(e){var r=e.split(":"),a=r[0].split(".")[0];return[a,r[0].split(".")[1]+(r.length>1?":"+(r[1].split(".")[1]||r[1].split(".")[0]):"")]}function xj(e){return e.replace(/\./,"!")}var fs={},In={},ps=typeof Map<"u";function Ko(e,r,a){var n=0,s=e.length;if(a){if(ps?a.has(r):Object.prototype.hasOwnProperty.call(a,r)){for(var i=ps?a.get(r):a[r];n<i.length;++n)if(e[i[n]].t===r)return e.Count++,i[n]}}else for(;n<s;++n)if(e[n].t===r)return e.Count++,n;return e[s]={t:r},e.Count++,e.Unique++,a&&(ps?(a.has(r)||a.set(r,[]),a.get(r).push(s)):(Object.prototype.hasOwnProperty.call(a,r)||(a[r]=[]),a[r].push(s))),s}function Xi(e,r){var a={min:e+1,max:e+1},n=-1;return r.MDW&&(ar=r.MDW),r.width!=null?a.customWidth=1:r.wpx!=null?n=Es(r.wpx):r.wch!=null&&(n=r.wch),n>-1?(a.width=Ai(n),a.customWidth=1):r.width!=null&&(a.width=r.width),r.hidden&&(a.hidden=!0),r.level!=null&&(a.outlineLevel=a.level=r.level),a}function Za(e,r){if(e){var a=[.7,.7,.75,.75,.3,.3];r=="xlml"&&(a=[1,1,1,1,.5,.5]),e.left==null&&(e.left=a[0]),e.right==null&&(e.right=a[1]),e.top==null&&(e.top=a[2]),e.bottom==null&&(e.bottom=a[3]),e.header==null&&(e.header=a[4]),e.footer==null&&(e.footer=a[5])}}function Ba(e,r,a){var n=a.revssf[r.z!=null?r.z:"General"],s=60,i=e.length;if(n==null&&a.ssf){for(;s<392;++s)if(a.ssf[s]==null){pa(r.z,s),a.ssf[s]=r.z,a.revssf[r.z]=n=s;break}}for(s=0;s!=i;++s)if(e[s].numFmtId===n)return s;return e[i]={numFmtId:n,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},i}function W0(e,r,a,n,s,i){try{n.cellNF&&(e.z=He[r])}catch(o){if(n.WTF)throw o}if(!(e.t==="z"&&!n.cellStyles)){if(e.t==="d"&&typeof e.v=="string"&&(e.v=wt(e.v)),(!n||n.cellText!==!1)&&e.t!=="z")try{if(He[r]==null&&pa(fx[r]||"General",r),e.t==="e")e.w=e.w||ba[e.v];else if(r===0)if(e.t==="n")(e.v|0)===e.v?e.w=e.v.toString(10):e.w=bs(e.v);else if(e.t==="d"){var c=Vt(e.v);(c|0)===c?e.w=c.toString(10):e.w=bs(c)}else{if(e.v===void 0)return"";e.w=tn(e.v,In)}else e.t==="d"?e.w=Br(r,Vt(e.v),In):e.w=Br(r,e.v,In)}catch(o){if(n.WTF)throw o}if(n.cellStyles&&a!=null)try{e.s=i.Fills[a],e.s.fgColor&&e.s.fgColor.theme&&!e.s.fgColor.rgb&&(e.s.fgColor.rgb=Ti(s.themeElements.clr
vendor: 5,103 bytes, line 533
533Scheme[e.s.fgColor.theme].rgb,e.s.fgColor.tint||0),n.WTF&&(e.s.fgColor.raw_rgb=s.themeElements.clrScheme[e.s.fgColor.theme].rgb)),e.s.bgColor&&e.s.bgColor.theme&&(e.s.bgColor.rgb=Ti(s.themeElements.clrScheme[e.s.bgColor.theme].rgb,e.s.bgColor.tint||0),n.WTF&&(e.s.bgColor.raw_rgb=s.themeElements.clrScheme[e.s.bgColor.theme].rgb))}catch(o){if(n.WTF&&i.Fills)throw o}}}function gj(e,r,a){if(e&&e["!ref"]){var n=at(e["!ref"]);if(n.e.c<n.s.c||n.e.r<n.s.r)throw new Error("Bad range ("+a+"): "+e["!ref"])}}function vj(e,r){var a=at(r);a.s.r<=a.e.r&&a.s.c<=a.e.c&&a.s.r>=0&&a.s.c>=0&&(e["!ref"]=Ke(a))}var yj=/<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g,_j=/<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/,bj=/<(?:\w:)?hyperlink [^>]*>/mg,jj=/"(\w*:\w*)"/,wj=/<(?:\w:)?col\b[^>]*[\/]?>/g,kj=/<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g,Sj=/<(?:\w:)?pageMargins[^>]*\/>/g,V0=/<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/,Nj=/<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/,Cj=/<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/;function Ej(e,r,a,n,s,i,c){if(!e)return e;n||(n={"!id":{}});var o=r.dense?[]:{},l={s:{r:2e6,c:2e6},e:{r:0,c:0}},d="",u="",h=e.match(_j);h?(d=e.slice(0,h.index),u=e.slice(h.index+h[0].length)):d=u=e;var f=d.match(V0);f?Yo(f[0],o,s,a):(f=d.match(Nj))&&Aj(f[0],f[1]||"",o,s,a);var m=(d.match(/<(?:\w*:)?dimension/)||{index:-1}).index;if(m>0){var x=d.slice(m,m+50).match(jj);x&&vj(o,x[1])}var p=d.match(Cj);p&&p[1]&&Wj(p[1],s);var g=[];if(r.cellStyles){var w=d.match(wj);w&&Bj(g,w)}h&&$j(h[1],o,r,l,i,c);var S=u.match(kj);S&&(o["!autofilter"]=zj(S[0]));var b=[],j=u.match(yj);if(j)for(m=0;m!=j.length;++m)b[m]=at(j[m].slice(j[m].indexOf('"')+1));var k=u.match(bj);k&&Rj(o,k,n);var N=u.match(Sj);if(N&&(o["!margins"]=Oj(qe(N[0]))),!o["!ref"]&&l.e.c>=l.s.c&&l.e.r>=l.s.r&&(o["!ref"]=Ke(l)),r.sheetRows>0&&o["!ref"]){var C=at(o["!ref"]);r.sheetRows<=+C.e.r&&(C.e.r=r.sheetRows-1,C.e.r>l.e.r&&(C.e.r=l.e.r),C.e.r<C.s.r&&(C.s.r=C.e.r),C.e.c>l.e.c&&(C.e.c=l.e.c),C.e.c<C.s.c&&(C.s.c=C.e.c),o["!fullref"]=o["!ref"],o["!ref"]=Ke(C))}return g.length>0&&(o["!cols"]=g),b.length>0&&(o["!merges"]=b),o}function Tj(e){if(e.length===0)return"";for(var r='<mergeCells count="'+e.length+'">',a=0;a!=e.length;++a)r+='<mergeCell ref="'+Ke(e[a])+'"/>';return r+"</mergeCells>"}function Yo(e,r,a,n){var s=qe(e);a.Sheets[n]||(a.Sheets[n]={}),s.codeName&&(a.Sheets[n].CodeName=rt(xt(s.codeName)))}function Aj(e,r,a,n,s){Yo(e.slice(0,e.indexOf(">")),a,n,s)}function Fj(e,r,a,n,s){var i=!1,c={},o=null;if(n.bookType!=="xlsx"&&r.vbaraw){var l=r.SheetNames[a];try{r.Workbook&&(l=r.Workbook.Sheets[a].CodeName||l)}catch{}i=!0,c.codeName=ra(ht(l))}if(e&&e["!outline"]){var d={summaryBelow:1,summaryRight:1};e["!outline"].above&&(d.summaryBelow=0),e["!outline"].left&&(d.summaryRight=0),o=(o||"")+Se("outlinePr",null,d)}!i&&!o||(s[s.length]=Se("sheetPr",o,c))}var Ij=["objects","scenarios","selectLockedCells","selectUnlockedCells"],Pj=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function Dj(e){var r={sheet:1};return Ij.forEach(function(a){e[a]!=null&&e[a]&&(r[a]="1")}),Pj.forEach(function(a){e[a]!=null&&!e[a]&&(r[a]="0")}),e.password&&(r.password=Wo(e.password).toString(16).toUpperCase()),Se("sheetProtection",null,r)}function Rj(e,r,a){for(var n=Array.isArray(e),s=0;s!=r.length;++s){var i=qe(xt(r[s]),!0);if(!i.ref)return;var c=((a||{})["!id"]||[])[i.id];c?(i.Target=c.Target,i.location&&(i.Target+="#"+rt(i.location))):(i.Target="#"+rt(i.location),c={Target:i.Target,TargetMode:"Internal"}),i.Rel=c,i.tooltip&&(i.Tooltip=i.tooltip,delete i.tooltip);for(var o=at(i.ref),l=o.s.r;l<=o.e.r;++l)for(var d=o.s.c;d<=o.e.c;++d){var u=Ve({c:d,r:l});n?(e[l]||(e[l]=[]),e[l][d]||(e[l][d]={t:"z",v:void 0}),e[l][d].l=i):(e[u]||(e[u]={t:"z",v:void 0}),e[u].l=i)}}}function Oj(e){var r={};return["left","right","top","bottom","header","footer"].forEach(function(a){e[a]&&(r[a]=parseFloat(e[a]))}),r}function Lj(e){return Za(e),Se("pageMargins",null,e)}function Bj(e,r){for(var a=!1,n=0;n!=r.length;++n){var s=qe(r[n],!0);s.hidden&&(s.hidden=jt(s.hidden));var i=parseInt(s.min,10)-1,c=parseInt(s.max,10)-1;for(s.outlineLevel&&(s.level=+s.outlineLevel||0),delete s.min,delete s.max,s.width=+s.width,!a&&s.width&&(a=!0,Vo(s.width)),Ia(s);i<=c;)e[i++]=kt(s)}}function Mj(e,r){for(var a=["<cols>"],n,s=0;s!=r.length;++s)(n=r[s])&&(a[a.length]=Se("col",null,Xi(s,n)));return a[a.length]="</cols>",a.join("")}function zj(e){var r={ref:(e.match(/ref="([^"]*)"/)||[])[1]};return r}function Uj(e,r,a,n){var s=typeof e.ref=="string"?e.ref:Ke(e.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var i=a.Workbook.Names,c=vr(s);c.s.r==c.e.r&&(c.e.r=vr(r["!ref"]).e.r,s=Ke(c));for(var o=0;o<i.length;++o){var l=i[o];if(l.Name=="_xlnm._FilterDatabase"&&l.Sheet==n){l.Ref="'"+a.SheetNames[n]+"'!"+s;break}}return o==i.length&&i.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+a.SheetNames[n]+"'!"+s}),Se("autoFilter",null,{ref:s})}
vendor: 7,870 bytes, lines 533-534
533var Hj=/<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/;function Wj(e,r){r.Views||(r.Views=[{}]),(e.match(Hj)||[]).forEach(function(a,n){var s=qe(a);r.Views[n]||(r.Views[n]={}),+s.zoomScale&&(r.Views[n].zoom=+s.zoomScale),jt(s.rightToLeft)&&(r.Views[n].RTL=!0)})}function Vj(e,r,a,n){var s={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(s.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),Se("sheetViews",Se("sheetView",null,s),{})}function qj(e,r,a,n){if(e.c&&a["!comments"].push([r,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var s="",i=e.t,c=e.v;if(e.t!=="z")switch(e.t){case"b":s=e.v?"1":"0";break;case"n":s=""+e.v;break;case"e":s=ba[e.v];break;case"d":n&&n.cellDates?s=wt(e.v,-1).toISOString():(e=kt(e),e.t="n",s=""+(e.v=Vt(wt(e.v)))),typeof e.z>"u"&&(e.z=He[14]);break;default:s=e.v;break}var o=Qt("v",ht(s)),l={r},d=Ba(n.cellXfs,e,n);switch(d!==0&&(l.s=d),e.t){case"n":break;case"d":l.t="d";break;case"b":l.t="b";break;case"e":l.t="e";break;case"z":break;default:if(e.v==null){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(n&&n.bookSST){o=Qt("v",""+Ko(n.Strings,e.v,n.revStrings)),l.t="s";break}l.t="str";break}if(e.t!=i&&(e.t=i,e.v=c),typeof e.f=="string"&&e.f){var u=e.F&&e.F.slice(0,r.length)==r?{t:"array",ref:e.F}:null;o=Se("f",ht(e.f),u)+(e.v!=null?o:"")}return e.l&&a["!links"].push([r,e.l]),e.D&&(l.cm=1),Se("c",o,l)}var $j=(function(){var e=/<(?:\w+:)?c[ \/>]/,r=/<\/(?:\w+:)?row>/,a=/r=["']([^"']*)["']/,n=/<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/,s=/ref=["']([^"']*)["']/,i=js("v"),c=js("f");return function(l,d,u,h,f,m){for(var x=0,p="",g=[],w=[],S=0,b=0,j=0,k="",N,C,P=0,T=0,L,M,E=0,W=0,ee=Array.isArray(m.CellXf),ce,ue=[],te=[],fe=Array.isArray(d),q=[],J={},le=!1,A=!!u.sheetStubs,V=l.split(r),I=0,D=V.length;I!=D;++I){p=V[I].trim();var K=p.length;if(K!==0){var z=0;e:for(x=0;x<K;++x)switch(p[x]){case">":if(p[x-1]!="/"){++x;break e}if(u&&u.cellStyles){if(C=qe(p.slice(z,x),!0),P=C.r!=null?parseInt(C.r,10):P+1,T=-1,u.sheetRows&&u.sheetRows<P)continue;J={},le=!1,C.ht&&(le=!0,J.hpt=parseFloat(C.ht),J.hpx=Bn(J.hpt)),C.hidden=="1"&&(le=!0,J.hidden=!0),C.outlineLevel!=null&&(le=!0,J.level=+C.outlineLevel),le&&(q[P-1]=J)}break;case"<":z=x;break}if(z>=x)break;if(C=qe(p.slice(z,x),!0),P=C.r!=null?parseInt(C.r,10):P+1,T=-1,!(u.sheetRows&&u.sheetRows<P)){h.s.r>P-1&&(h.s.r=P-1),h.e.r<P-1&&(h.e.r=P-1),u&&u.cellStyles&&(J={},le=!1,C.ht&&(le=!0,J.hpt=parseFloat(C.ht),J.hpx=Bn(J.hpt)),C.hidden=="1"&&(le=!0,J.hidden=!0),C.outlineLevel!=null&&(le=!0,J.level=+C.outlineLevel),le&&(q[P-1]=J)),g=p.slice(x).split(e);for(var Y=0;Y!=g.length&&g[Y].trim().charAt(0)=="<";++Y);for(g=g.slice(Y),x=0;x!=g.length;++x)if(p=g[x].trim(),p.length!==0){if(w=p.match(a),S=x,b=0,j=0,p="<c "+(p.slice(0,1)=="<"?">":"")+p,w!=null&&w.length===2){for(S=0,k=w[1],b=0;b!=k.length&&!((j=k.charCodeAt(b)-64)<1||j>26);++b)S=26*S+j;--S,T=S}else++T;for(b=0;b!=p.length&&p.charCodeAt(b)!==62;++b);if(++b,C=qe(p.slice(0,b),!0),C.r||(C.r=Ve({r:P-1,c:T})),k=p.slice(b),N={t:""},(w=k.match(i))!=null&&w[1]!==""&&(N.v=rt(w[1])),u.cellFormula){if((w=k.match(c))!=null&&w[1]!==""){if(N.f=rt(xt(w[1])).replace(/\r\n/g,` 534`),u.xlfn||(N.f=wd(N.f)),w[0].indexOf('t="array"')>-1)N.F=(k.match(s)||[])[1],N.F.indexOf(":")>-1&&ue.push([at(N.F),N.F]);else if(w[0].indexOf('t="shared"')>-1){M=qe(w[0]);var re=rt(xt(w[1]));u.xlfn||(re=wd(re)),te[parseInt(M.si,10)]=[M,re,C.r]}}else(w=k.match(/<f[^>]*\/>/))&&(M=qe(w[0]),te[M.si]&&(N.f=H_(te[M.si][1],te[M.si][2],C.r)));var oe=Ct(C.r);for(b=0;b<ue.length;++b)oe.r>=ue[b][0].s.r&&oe.r<=ue[b][0].e.r&&oe.c>=ue[b][0].s.c&&oe.c<=ue[b][0].e.c&&(N.F=ue[b][1])}if(C.t==null&&N.v===void 0)if(N.f||N.F)N.v=0,N.t="n";else if(A)N.t="z";else continue;else N.t=C.t||"n";switch(h.s.c>T&&(h.s.c=T),h.e.c<T&&(h.e.c=T),N.t){case"n":if(N.v==""||N.v==null){if(!A)continue;N.t="z"}else N.v=parseFloat(N.v);break;case"s":if(typeof N.v>"u"){if(!A)continue;N.t="z"}else L=fs[parseInt(N.v,10)],N.v=L.t,N.r=L.r,u.cellHTML&&(N.h=L.h);break;case"str":N.t="s",N.v=N.v!=null?xt(N.v):"",u.cellHTML&&(N.h=Eo(N.v));break;case"inlineStr":w=k.match(n),N.t="s",w!=null&&(L=Ho(w[1]))?(N.v=L.t,u.cellHTML&&(N.h=L.h)):N.v="";break;case"b":N.v=jt(N.v);break;case"d":u.cellDates?N.v=wt(N.v,1):(N.v=Vt(wt(N.v,1)),N.t="n");break;case"e":(!u||u.cellText!==!1)&&(N.w=N.v),N.v=$h[N.v];break}if(E=W=0,ce=null,ee&&C.s!==void 0&&(ce=m.CellXf[C.s],ce!=null&&(ce.numFmtId!=null&&(E=ce.numFmtId),u.cellStyles&&ce.fillId!=null&&(W=ce.fillId))),W0(N,E,W,u,f,m),u.cellDates&&ee&&N.t=="n"&&Wn(He[E])&&(N.t="d",N.v=Vi(N.v)),C.cm&&u.xlmeta){var Ce=(u.xlmeta.Cell||[])[+C.cm-1];Ce&&Ce.type=="XLDAPR"&&(N.D=!0)}if(fe){var F=Ct(C.r);d[F.r]||(d[F.r]=[]),d[F.r][F.c]=N}else d[C.r]=N}}}}q.length>0&&(d["!rows"]=q)}})();function Gj(e,r,a,n){var s=[],i=[],c=at(e["!ref"]),o="",l,d="",u=[],h=0,f=0,m=e["!rows"],x=Array.isArray(e),p={r:d},g,w=-1;for(f=c.s.c;f<=c.e.c;++f)u[f]=Nt(f);for(h=c.s.r;h<=c.e.r;++h){for(i=[],d=Dt(h),f=c.s.c;f<=c.e.c;++f){l=u[f]+d;var S=x?(e[h]||[])[f]:e[l];S!==void 0&&(o=qj(S,l,e,r))!=null&&i.push(o)}(i.length>0||m&&m[h])&&(p={r:d},m&&m[h]&&(g=m[h],g.hidden&&(p.hidden=1),w=-1,g.hpx?w=Ts(g.hpx):g.hpt&&(w=g.hpt),w>-1&&(p.ht=w,p.customHeight=1),g.level&&(p.outlineLevel=g.level)),s[s.length]=Se("row",i.join(""),p))}if(m)for(;h<m.length;++h)m&&m[h]&&(p={r:h+1},g=m[h],g.hidden&&(p.hidden=1),w=-1,g.hpx?w=Ts(g.hpx):g.hpt&&(w=g.hpt),w>-1&&(p.ht=w,p.customHeight=1),g.level&&(p.outlineLevel=g.level),s[s.length]=Se("row","",p));return s.join("")}function q0(e,r,a,n){var s=[Rt,Se("worksheet",null,{xmlns:on[0],"xmlns:r":Wt.r})],i=a.SheetNames[e],c=0,o="",l=a.Sheets[i];l==null&&(l={});var d=l["!ref"]||"A1",u=at(d);if(u.e.c>16383||u.e.r>1048575){if(r.WTF)throw new Error("Range "+d+" exceeds format limit A1:XFD1048576");u.e.c=Math.min(u.e.c,16383),u.e.r=Math.min(u.e.c,1048575),d=Ke(u)}n||(n={}),l["!comments"]=[];var h=[];Fj(l,a,e,r,s),s[s.length]=Se("dimension",null,{ref:d}),s[s.length]=Vj(l,r,e,a),r.sheetFormat&&(s[s.length]=Se("sheetFormatPr",null,{defaultRowHeight:r.sheetFormat.defaultRowHeight||"16",baseColWidth:r.sheetFormat.baseColWidth||"10",outlineLevelRow:r.sheetFormat.outlineLevelRow||"7"})),l["!cols"]!=null&&l["!cols"].length>0&&(s[s.length]=Mj(l,l["!cols"])),s[c=s.length]="<sheetData/>",l["!links"]=[],l["!ref"]!=null&&(o=Gj(l,r),o.length>0&&(s[s.length]=o)),s.length>c+1&&(s[s.length]="</sheetData>",s[c]=s[c].replace("/>",">")),l["!protect"]&&(s[s.length]=Dj(l["!protect"])),l["!autofilter"]!=null&&(s[s.length]=Uj(l["!autofilter"],l,a,e)),l["!merges"]!=null&&l["!merges"].length>0&&(s[s.length]=Tj(l["!merges"]));var f=-1,m,x=-1;return l["!links"].length>0&&(s[s.length]="<hyperlinks>",l["!links"].forEach(function(p){p[1].Target&&(m={ref:p[0]},p[1].Target.charAt(0)!="#"&&(x=ut(n,-1,ht(p[1].Target).replace(/#.*$/,""),Qe.HLINK),m["r:id"]="rId"+x),(f=p[1].Target.indexOf("#"))>-1&&(m.location=ht(p[1].Target.slice(f+1))),p[1].Tooltip&&(m.tooltip=ht(p[1].Tooltip)),s[s.length]=Se("hyperlink",null,m))}),s[s.length]="</hyperlinks>"),delete l["!links"],l["!margins"]!=null&&(s[s.length]=Lj(l["!margins"])),(!r||r.ignoreEC||r.ignoreEC==null)&&(s[s.length]=Qt("ignoredErrors",Se("ignoredError",null,{numberStoredAsText:1,sqref:d}))),h.length>0&&(x=ut(n,-1,"../drawings/drawing"+(e+1)+".xml",Qe.DRAW),s[s.length]=Se("drawing",null,{"r:id":"rId"+x}),l["!drawing"]=h),l["!comments"].length>0&&(x=ut(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",Qe.VML),s[s.length]=Se("legacyDrawing",null,{"r:id":"rId"+x}),l["!legacy"]=x),s.length>1&&(s[s.length]="</worksheet>",s[1]=s[1].replace("/>",">")),s.join("")}function Xj(e,r){var a={},n=e.l+r;a.r=e.read_shift(4),e.l+=4;var s=e.read_shift(2);e.l+=1;var i=e.read_shift(1);return e.l=n,i&7&&(a.level=i&7),i&16&&(a.hidden=!0),i&32&&(a.hpt=s/20),a}function Kj(e,r,a){var n=pe(145),s=(a["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var i=320;
vendor: 4,662 bytes, line 534
534s.hpx?i=Ts(s.hpx)*20:s.hpt&&(i=s.hpt*20),n.write_shift(2,i),n.write_shift(1,0);var c=0;s.level&&(c|=s.level),s.hidden&&(c|=16),(s.hpx||s.hpt)&&(c|=32),n.write_shift(1,c),n.write_shift(1,0);var o=0,l=n.l;n.l+=4;for(var d={r:e,c:0},u=0;u<16;++u)if(!(r.s.c>u+1<<10||r.e.c<u<<10)){for(var h=-1,f=-1,m=u<<10;m<u+1<<10;++m){d.c=m;var x=Array.isArray(a)?(a[d.r]||[])[d.c]:a[Ve(d)];x&&(h<0&&(h=m),f=m)}h<0||(++o,n.write_shift(4,h),n.write_shift(4,f))}var p=n.l;return n.l=l,n.write_shift(4,o),n.l=p,n.length>n.l?n.slice(0,n.l):n}function Yj(e,r,a,n){var s=Kj(n,a,r);(s.length>17||(r["!rows"]||[])[n])&&ge(e,0,s)}var Jj=hn,Qj=$n;function Zj(){}function e2(e,r){var a={},n=e[e.l];return++e.l,a.above=!(n&64),a.left=!(n&128),e.l+=18,a.name=ag(e),a}function t2(e,r,a){a==null&&(a=pe(84+4*e.length));var n=192;r&&(r.above&&(n&=-65),r.left&&(n&=-129)),a.write_shift(1,n);for(var s=1;s<3;++s)a.write_shift(1,0);return Ni({auto:1},a),a.write_shift(-4,-1),a.write_shift(-4,-1),Uh(e,a),a.slice(0,a.l)}function r2(e){var r=Mr(e);return[r]}function a2(e,r,a){return a==null&&(a=pe(8)),ln(r,a)}function n2(e){var r=dn(e);return[r]}function s2(e,r,a){return a==null&&(a=pe(4)),un(r,a)}function i2(e){var r=Mr(e),a=e.read_shift(1);return[r,a,"b"]}function c2(e,r,a){return a==null&&(a=pe(9)),ln(r,a),a.write_shift(1,e.v?1:0),a}function o2(e){var r=dn(e),a=e.read_shift(1);return[r,a,"b"]}function l2(e,r,a){return a==null&&(a=pe(5)),un(r,a),a.write_shift(1,e.v?1:0),a}function d2(e){var r=Mr(e),a=e.read_shift(1);return[r,a,"e"]}function u2(e,r,a){return a==null&&(a=pe(9)),ln(r,a),a.write_shift(1,e.v),a}function h2(e){var r=dn(e),a=e.read_shift(1);return[r,a,"e"]}function f2(e,r,a){return a==null&&(a=pe(8)),un(r,a),a.write_shift(1,e.v),a.write_shift(2,0),a.write_shift(1,0),a}function p2(e){var r=Mr(e),a=e.read_shift(4);return[r,a,"s"]}function m2(e,r,a){return a==null&&(a=pe(12)),ln(r,a),a.write_shift(4,r.v),a}function x2(e){var r=dn(e),a=e.read_shift(4);return[r,a,"s"]}function g2(e,r,a){return a==null&&(a=pe(8)),un(r,a),a.write_shift(4,r.v),a}function v2(e){var r=Mr(e),a=nr(e);return[r,a,"n"]}function y2(e,r,a){return a==null&&(a=pe(16)),ln(r,a),an(e.v,a),a}function $0(e){var r=dn(e),a=nr(e);return[r,a,"n"]}function _2(e,r,a){return a==null&&(a=pe(12)),un(r,a),an(e.v,a),a}function b2(e){var r=Mr(e),a=Lo(e);return[r,a,"n"]}function j2(e,r,a){return a==null&&(a=pe(12)),ln(r,a),Hh(e.v,a),a}function w2(e){var r=dn(e),a=Lo(e);return[r,a,"n"]}function k2(e,r,a){return a==null&&(a=pe(8)),un(r,a),Hh(e.v,a),a}function S2(e){var r=Mr(e),a=Do(e);return[r,a,"is"]}function N2(e){var r=Mr(e),a=sr(e);return[r,a,"str"]}function C2(e,r,a){return a==null&&(a=pe(12+4*e.v.length)),ln(r,a),Xt(e.v,a),a.length>a.l?a.slice(0,a.l):a}function E2(e){var r=dn(e),a=sr(e);return[r,a,"str"]}function T2(e,r,a){return a==null&&(a=pe(8+4*e.v.length)),un(r,a),Xt(e.v,a),a.length>a.l?a.slice(0,a.l):a}function A2(e,r,a){var n=e.l+r,s=Mr(e);s.r=a["!row"];var i=e.read_shift(1),c=[s,i,"b"];if(a.cellFormula){e.l+=2;var o=Gi(e,n-e.l,a);c[3]=rr(o,null,s,a.supbooks,a)}else e.l=n;return c}function F2(e,r,a){var n=e.l+r,s=Mr(e);s.r=a["!row"];var i=e.read_shift(1),c=[s,i,"e"];if(a.cellFormula){e.l+=2;var o=Gi(e,n-e.l,a);c[3]=rr(o,null,s,a.supbooks,a)}else e.l=n;return c}function I2(e,r,a){var n=e.l+r,s=Mr(e);s.r=a["!row"];var i=nr(e),c=[s,i,"n"];if(a.cellFormula){e.l+=2;var o=Gi(e,n-e.l,a);c[3]=rr(o,null,s,a.supbooks,a)}else e.l=n;return c}function P2(e,r,a){var n=e.l+r,s=Mr(e);s.r=a["!row"];var i=sr(e),c=[s,i,"str"];if(a.cellFormula){e.l+=2;var o=Gi(e,n-e.l,a);c[3]=rr(o,null,s,a.supbooks,a)}else e.l=n;return c}var D2=hn,R2=$n;function O2(e,r){return r==null&&(r=pe(4)),r.write_shift(4,e),r}function L2(e,r){var a=e.l+r,n=hn(e),s=Ro(e),i=sr(e),c=sr(e),o=sr(e);e.l=a;var l={rfx:n,relId:s,loc:i,display:o};return c&&(l.Tooltip=c),l}function B2(e,r){var a=pe(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));$n({s:Ct(e[0]),e:Ct(e[0])},a),Oo("rId"+r,a);var n=e[1].Target.indexOf("#"),s=n==-1?"":e[1].Target.slice(n+1);return Xt(s||"",a),Xt(e[1].Tooltip||"",a),Xt("",a),a.slice(0,a.l)}function M2(){}function z2(e,r,a){var n=e.l+r,s=Wh(e),i=e.read_shift(1),c=[s];if(c[2]=i,a.cellFormula){var o=dj(e,n-e.l,a);c[1]=o}else e.l=n;return c}function U2(e,r,a){var n=e.l+r,s=hn(e),i=[s];if(a.cellFormula){var c=hj(e,n-e.l,a);i[1]=c,e.l=n}else e.l=n;return i}function H2(e,r,a){a==null&&(a=pe(18));var n=Xi(e,r);a.write_shift(-4,e),a.write_shift(-4,e),a.write_shift(4,(n.width||10)*256),a.write_shift(4,0);var s=0;return r.hidden&&(s|=1),typeof n.width=="number"&&(s|=2),r.level&&(s|=r.level<<8),a.write_shift(2,s),a}var G0=["left","right","top","bottom","header","footer"];function W2(e){var r={};
vendor: 8,472 bytes, line 534
534return G0.forEach(function(a){r[a]=nr(e)}),r}function V2(e,r){return r==null&&(r=pe(48)),Za(e),G0.forEach(function(a){an(e[a],r)}),r}function q2(e){var r=e.read_shift(2);return e.l+=28,{RTL:r&32}}function $2(e,r,a){a==null&&(a=pe(30));var n=924;return(((r||{}).Views||[])[0]||{}).RTL&&(n|=32),a.write_shift(2,n),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(2,0),a.write_shift(2,100),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(4,0),a}function G2(e){var r=pe(24);return r.write_shift(4,4),r.write_shift(4,1),$n(e,r),r}function X2(e,r){return r==null&&(r=pe(66)),r.write_shift(2,e.password?Wo(e.password):0),r.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(a){a[1]?r.write_shift(4,e[a[0]]!=null&&!e[a[0]]?1:0):r.write_shift(4,e[a[0]]!=null&&e[a[0]]?0:1)}),r}function K2(){}function Y2(){}function J2(e,r,a,n,s,i,c){if(!e)return e;var o=r||{};n||(n={"!id":{}});var l=o.dense?[]:{},d,u={s:{r:2e6,c:2e6},e:{r:0,c:0}},h=!1,f=!1,m,x,p,g,w,S,b,j,k,N=[];o.biff=12,o["!row"]=0;var C=0,P=!1,T=[],L={},M=o.supbooks||s.supbooks||[[]];if(M.sharedf=L,M.arrayf=T,M.SheetNames=s.SheetNames||s.Sheets.map(function(fe){return fe.name}),!o.supbooks&&(o.supbooks=M,s.Names))for(var E=0;E<s.Names.length;++E)M[0][E+1]=s.Names[E];var W=[],ee=[],ce=!1;As[16]={n:"BrtShortReal",f:$0};var ue;if(_a(e,function(q,J,le){if(!f)switch(le){case 148:d=q;break;case 0:m=q,o.sheetRows&&o.sheetRows<=m.r&&(f=!0),j=Dt(g=m.r),o["!row"]=m.r,(q.hidden||q.hpt||q.level!=null)&&(q.hpt&&(q.hpx=Bn(q.hpt)),ee[q.r]=q);break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 13:case 14:case 15:case 16:case 17:case 18:case 62:switch(x={t:q[2]},q[2]){case"n":x.v=q[1];break;case"s":b=fs[q[1]],x.v=b.t,x.r=b.r;break;case"b":x.v=!!q[1];break;case"e":x.v=q[1],o.cellText!==!1&&(x.w=ba[x.v]);break;case"str":x.t="s",x.v=q[1];break;case"is":x.t="s",x.v=q[1].t;break}if((p=c.CellXf[q[0].iStyleRef])&&W0(x,p.numFmtId,null,o,i,c),w=q[0].c==-1?w+1:q[0].c,o.dense?(l[g]||(l[g]=[]),l[g][w]=x):l[Nt(w)+j]=x,o.cellFormula){for(P=!1,C=0;C<T.length;++C){var A=T[C];m.r>=A[0].s.r&&m.r<=A[0].e.r&&w>=A[0].s.c&&w<=A[0].e.c&&(x.F=Ke(A[0]),P=!0)}!P&&q.length>3&&(x.f=q[3])}if(u.s.r>m.r&&(u.s.r=m.r),u.s.c>w&&(u.s.c=w),u.e.r<m.r&&(u.e.r=m.r),u.e.c<w&&(u.e.c=w),o.cellDates&&p&&x.t=="n"&&Wn(He[p.numFmtId])){var V=Ga(x.v);V&&(x.t="d",x.v=new Date(V.y,V.m-1,V.d,V.H,V.M,V.S,V.u))}ue&&(ue.type=="XLDAPR"&&(x.D=!0),ue=void 0);break;case 1:case 12:if(!o.sheetStubs||h)break;x={t:"z",v:void 0},w=q[0].c==-1?w+1:q[0].c,o.dense?(l[g]||(l[g]=[]),l[g][w]=x):l[Nt(w)+j]=x,u.s.r>m.r&&(u.s.r=m.r),u.s.c>w&&(u.s.c=w),u.e.r<m.r&&(u.e.r=m.r),u.e.c<w&&(u.e.c=w),ue&&(ue.type=="XLDAPR"&&(x.D=!0),ue=void 0);break;case 176:N.push(q);break;case 49:ue=((o.xlmeta||{}).Cell||[])[q-1];break;case 494:var I=n["!id"][q.relId];for(I?(q.Target=I.Target,q.loc&&(q.Target+="#"+q.loc),q.Rel=I):q.relId==""&&(q.Target="#"+q.loc),g=q.rfx.s.r;g<=q.rfx.e.r;++g)for(w=q.rfx.s.c;w<=q.rfx.e.c;++w)o.dense?(l[g]||(l[g]=[]),l[g][w]||(l[g][w]={t:"z",v:void 0}),l[g][w].l=q):(S=Ve({c:w,r:g}),l[S]||(l[S]={t:"z",v:void 0}),l[S].l=q);break;case 426:if(!o.cellFormula)break;T.push(q),k=o.dense?l[g][w]:l[Nt(w)+j],k.f=rr(q[1],u,{r:m.r,c:w},M,o),k.F=Ke(q[0]);break;case 427:if(!o.cellFormula)break;L[Ve(q[0].s)]=q[1],k=o.dense?l[g][w]:l[Nt(w)+j],k.f=rr(q[1],u,{r:m.r,c:w},M,o);break;case 60:if(!o.cellStyles)break;for(;q.e>=q.s;)W[q.e--]={width:q.w/256,hidden:!!(q.flags&1),level:q.level},ce||(ce=!0,Vo(q.w/256)),Ia(W[q.e+1]);break;case 161:l["!autofilter"]={ref:Ke(q)};break;case 476:l["!margins"]=q;break;case 147:s.Sheets[a]||(s.Sheets[a]={}),q.name&&(s.Sheets[a].CodeName=q.name),(q.above||q.left)&&(l["!outline"]={above:q.above,left:q.left});break;case 137:s.Views||(s.Views=[{}]),s.Views[0]||(s.Views[0]={}),q.RTL&&(s.Views[0].RTL=!0);break;case 485:break;case 64:case 1053:break;case 151:break;case 152:case 175:case 644:case 625:case 562:case 396:case 1112:case 1146:case 471:case 1050:case 649:case 1105:case 589:case 607:case 564:case 1055:case 168:case 174:case 1180:case 499:case 507:case 550:case 171:case 167:case 1177:case 169:case 1181:case 551:case 552:case 661:case 639:case 478:case 537:case 477:case 536:case 1103:case 680:case 1104:case 1024:case 663:case 535:case 678:case 504:case 1043:case 428:case 170:case 3072:case 50:case 2070:case 1045:break;case 35:h=!0;break;case 36:h=!1;break;case 37:h=!0;break;case 38:h=!1;break;default:if(!J.T){if(!h||o.WTF)throw new Error("Unexpected record 0x"+le.toString(16))}}},o),delete o.supbooks,delete o["!row"],!l["!ref"]&&(u.s.r<2e6||d&&(d.e.r>0||d.e.c>0||d.s.r>0||d.s.c>0))&&(l["!ref"]=Ke(d||u)),o.sheetRows&&l["!ref"]){var te=at(l["!ref"]);o.sheetRows<=+te.e.r&&(te.e.r=o.sheetRows-1,te.e.r>u.e.r&&(te.e.r=u.e.r),te.e.r<te.s.r&&(te.s.r=te.e.r),te.e.c>u.e.c&&(te.e.c=u.e.c),te.e.c<te.s.c&&(te.s.c=te.e.c),l["!fullref"]=l["!ref"],l["!ref"]=Ke(te))}return N.length>0&&(l["!merges"]=N),W.length>0&&(l["!cols"]=W),ee.length>0&&(l["!rows"]=ee),l}function Q2(e,r,a,n,s,i,c){if(r.v===void 0)return!1;var o="";switch(r.t){case"b":o=r.v?"1":"0";break;case"d":r=kt(r),r.z=r.z||He[14],r.v=Vt(wt(r.v)),r.t="n";break;case"n":case"e":o=""+r.v;break;default:o=r.v;break}var l={r:a,c:n};switch(l.s=Ba(s.cellXfs,r,s),r.l&&i["!links"].push([Ve(l),r.l]),r.c&&i["!comments"].push([Ve(l),r.c]),r.t){case"s":case"str":return s.bookSST?(o=Ko(s.Strings,r.v,s.revStrings),l.t="s",l.v=o,c?ge(e,18,g2(r,l)):ge(e,7,m2(r,l))):(l.t="str",c?ge(e,17,T2(r,l)):ge(e,6,C2(r,l))),!0;case"n":return r.v==(r.v|0)&&r.v>-1e3&&r.v<1e3?c?ge(e,13,k2(r,l)):ge(e,2,j2(r,l)):c?ge(e,16,_2(r,l)):ge(e,5,y2(r,l)),!0;case"b":return l.t="b",c?ge(e,15,l2(r,l)):ge(e,4,c2(r,l)),!0;case"e":return l.t="e",c?ge(e,14,f2(r,l)):ge(e,3,u2(r,l)),!0}return c?ge(e,12,s2(r,l)):ge(e,1,a2(r,l)),!0}function Z2(e,r,a,n){var s=at(r["!ref"]||"A1"),i,c="",o=[];ge(e,145);var l=Array.isArray(r),d=s.e.r;r["!rows"]&&(d=Math.max(s.e.r,r["!rows"].length-1));for(var u=s.s.r;u<=d;++u){c=Dt(u),Yj(e,r,s,u);var h=!1;if(u<=s.e.r)for(var f=s.s.c;f<=s.e.c;++f){u===s.s.r&&(o[f]=Nt(f)),i=o[f]+c;var m=l?(r[u]||[])[f]:r[i];if(!m){h=!1;continue}h=Q2(e,m,u,f,n,r,h)}}ge(e,146)}function ew(e,r){!r||!r["!merges"]||(ge(e,177,O2(r["!merges"].length)),r["!merges"].forEach(function(a){ge(e,176,R2(a))}),ge(e,178))}function tw(e,r){!r||!r["!cols"]||(ge(e,390),r["!cols"].forEach(function(a,n){a&&ge(e,60,H2(n,a))}),ge(e,391))}function rw(e,r){!r||!r["!ref"]||(ge(e,648),ge(e,649,G2(at(r["!ref"]))),ge(e,650))}function aw(e,r,a){r["!links"].forEach(function(n){if(n[1].Target){var s=ut(a,-1,n[1].Target.replace(/#.*$/,""),Qe.HLINK);ge(e,494,B2(n,s))}}),delete r["!links"]}function nw(e,r,a,n){if(r["!comments"].length>0){var s=ut(n,-1,"../drawings/vmlDrawing"+(a+1)+".vml",Qe.VML);ge(e,551,Oo("rId"+s)),r["!legacy"]=s}}function sw(e,r,a,n){if(r["!autofilter"]){var s=r["!autofilter"],i=typeof s.ref=="string"?s.ref:Ke(s.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var c=a.Workbook.Names,o=vr(i);o.s.r==o.e.r&&(o.e.r=vr(r["!ref"]).e.r,i=Ke(o));for(var l=0;l<c.length;++l){var d=c[l];if(d.Name=="_xlnm._FilterDatabase"&&d.Sheet==n){d.Ref="'"+a.SheetNames[n]+"'!"+i;break}}l==c.length&&c.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+a.SheetNames[n]+"'!"+i}),ge(e,161,$n(at(i))),ge(e,162)}}function iw(e,r,a){ge(e,133),ge(e,137,$2(r,a)),ge(e,138),ge(e,134)}function cw(e,r){r["!protect"]&&ge(e,535,X2(r["!protect"]))}function ow(e,r,a,n){var s=xr(),i=a.SheetNames[e],c=a.Sheets[i]||{},o=i;try{a&&a.Workbook&&(o=a.Workbook.Sheets[e].CodeName||o)}catch{}var l=at(c["!ref"]||"A1");if(l.e.c>16383||l.e.r>1048575){if(r.WTF)throw new Error("Range "+(c["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");l.e.c=Math.min(l.e.c,16383),l.e.r=Math.min(l.e.c,1048575)}return c["!links"]=[],c["!comments"]=[],ge(s,129),(a.vbaraw||c["!outline"])&&ge(s,147,t2(o,c["!outline"])),ge(s,148,Qj(l)),iw(s,c,a.Workbook),tw(s,c),Z2(s,c,e,r),cw(s,c),sw(s,c,a,e),ew(s,c),aw(s,c,n),c["!margins"]&&ge(s,476,V2(c["!margins"])),(!r||r.ignoreEC||r.ignoreEC==null)&&rw(s,c),nw(s,c,e,n),ge(s,130),s.end()}function lw(e){var r=[],a=e.match(/^<c:numCache>/),n;(e.match(/<c:pt idx="(\d*)">(.*?)<\/c:pt>
534/mg)||[]).forEach(function(i){var c=i.match(/<c:pt idx="(\d*?)"><c:v>(.*)<\/c:v><\/c:pt>/);c&&(r[+c[1]]=a?+c[2]:c[2])});var s=rt((e.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/)||["","General"])[1]);return(e.match(/<c:f>(.*?)<\/c:f>/mg)||[]).forEach(function(i){n=i.replace(/<.*?>/g,"")}),[r,s,n]}function dw(e,r,a,n,s,i){var c=i||{"!type":"chart"};if(!e)return i;var o=0,l=0,d="A",u={s:{r:2e6,c:2e6},e:{r:0,c:0}};return(e.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(h){var f=lw(h);u.s.r=u.s.c=0,u.e.c=o,d=Nt(o),f[0].forEach(function(m,x){c[d+Dt(x)]={t:"n",v:m,z:f[1]},l=x}),u.e.r<l&&(u.e.r=l),++o}),o>0&&(c["!ref"]=Ke(u)),c}function uw(e,r,a,n,s){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},c,o=e.match(V0);return o&&Yo(o[0],i,s,a),(c=e.match(/drawing r:id="(.*?)"/))&&(i["!rel"]=c[1]),n["!id"][i["!rel"]]&&(i["!drawel"]=n["!id"][i["!rel"]]),i}function hw(e,r){e.l+=10;var a=sr(e);return{name:a}}function fw(e,r,a,n,s){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},c=!1;return _a(e,function(l,d,u){switch(u){case 550:i["!rel"]=l;break;case 651:s.Sheets[a]||(s.Sheets[a]={}),l.name&&(s.Sheets[a].CodeName=l.name);break;case 562:case 652:case 669:case 679:case 551:case 552:case 476:case 3072:break;case 35:c=!0;break;case 36:c=!1;break;case 37:break;case 38:break;default:if(!(d.T>0)){if(!(d.T<0)){if(!c||r.WTF)throw new Error("Unexpected record 0x"+u.toString(16))}}}},r),n["!id"][i["!rel"]]&&(i["!drawel"]=n["!id"][i["!rel"]]),i}var Jo=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]],pw=[["activeTab",0,"int"],["autoFilterDateGrouping",!0,"bool"],["firstSheet",0,"int"],["minimized",!1,"bool"],["showHorizontalScroll",!0,"bool"],["showSheetTabs",!0,"bool"],["showVerticalScroll",!0,"bool"],["tabRatio",600,"int"],["visibility","visible"]],mw=[],xw=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];function Ed(e,r){for(var a=0;a!=e.length;++a)for(var n=e[a],s=0;s!=r.length;++s){var i=r[s];if(n[i[0]]==null)n[i[0]]=i[1];else switch(i[2]){case"bool":typeof n[i[0]]=="string"&&(n[i[0]]=jt(n[i[0]]));break;case"int":typeof n[i[0]]=="string"&&(n[i[0]]=parseInt(n[i[0]],10));break}}}function Td(e,r){for(var a=0;a!=r.length;++a){var n=r[a];if(e[n[0]]==null)e[n[0]]=n[1];else switch(n[2]){case"bool":typeof e[n[0]]=="string"&&(e[n[0]]=jt(e[n[0]]));break;case"int":typeof e[n[0]]=="string"&&(e[n[0]]=parseInt(e[n[0]],10));break}}}function X0(e){Td(e.WBProps,Jo),Td(e.CalcPr,xw),Ed(e.WBView,pw),Ed(e.Sheets,mw),In.date1904=jt(e.WBProps.date1904)}function gw(e){return!e.Workbook||!e.Workbook.WBProps?"false":jt(e.Workbook.WBProps.date1904)?"true":"false"}var vw="][*?/\\".split("");function K0(e,r){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var a=!0;return vw.forEach(function(n){if(e.indexOf(n)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),a}function yw(e,r,a){e.forEach(function(n,s){K0(n);for(var i=0;i<s;++i)if(n==e[i])throw new Error("Duplicate Sheet Name: "+n);if(a){var c=r&&r[s]&&r[s].CodeName||n;if(c.charCodeAt(0)==95&&c.length>22)throw new Error("Bad Code Name: Worksheet"+c)}})}function _w(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var r=e.Workbook&&e.Workbook.Sheets||[];yw(e.SheetNames,r,!!e.vbaraw);for(var a=0;a<e.SheetNames.length;++a)gj(e.Sheets[e.SheetNames[a]],e.SheetNames[a],a)}var bw=/<\w+:workbook/;function jw(e,r){if(!e)throw new Error("Could not find file");var a={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},Names:[],xmlns:""},n=!1,s="xmlns",i={},c=0;if(e.replace(cr,function(l,d){var u=qe(l);switch(sa(u[0])){case"<?xml":break;case"<workbook":l.match(bw)&&(s="xmlns"+l.match(/<(\w+):/)[1]),a.xmlns=u[s];break;case"</workbook>":break;case"<fileVersion":delete u[0],a.AppVersion=u;break;case"<fileVersion/>":case"</fileVersion>":break;case"<fileSharing":break;case"<fileSharing/>":break;
vendor: 22,285 bytes, lines 534-536
534case"<workbookPr":case"<workbookPr/>":Jo.forEach(function(h){if(u[h[0]]!=null)switch(h[2]){case"bool":a.WBProps[h[0]]=jt(u[h[0]]);break;case"int":a.WBProps[h[0]]=parseInt(u[h[0]],10);break;default:a.WBProps[h[0]]=u[h[0]]}}),u.codeName&&(a.WBProps.CodeName=xt(u.codeName));break;case"</workbookPr>":break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews":case"<bookViews>":case"</bookViews>":break;case"<workbookView":case"<workbookView/>":delete u[0],a.WBView.push(u);break;case"</workbookView>":break;case"<sheets":case"<sheets>":case"</sheets>":break;case"<sheet":switch(u.state){case"hidden":u.Hidden=1;break;case"veryHidden":u.Hidden=2;break;default:u.Hidden=0}delete u.state,u.name=rt(xt(u.name)),delete u[0],a.Sheets.push(u);break;case"</sheet>":break;case"<functionGroups":case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":case"</externalReferences>":case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames>":case"<definedNames":n=!0;break;case"</definedNames>":n=!1;break;case"<definedName":i={},i.Name=xt(u.name),u.comment&&(i.Comment=u.comment),u.localSheetId&&(i.Sheet=+u.localSheetId),jt(u.hidden||"0")&&(i.Hidden=!0),c=d+l.length;break;case"</definedName>":i.Ref=rt(xt(e.slice(c,d))),a.Names.push(i);break;case"<definedName/>":break;case"<calcPr":delete u[0],a.CalcPr=u;break;case"<calcPr/>":delete u[0],a.CalcPr=u;break;case"</calcPr>":break;case"<oleSize":break;case"<customWorkbookViews>":case"</customWorkbookViews>":case"<customWorkbookViews":break;case"<customWorkbookView":case"</customWorkbookView>":break;case"<pivotCaches>":case"</pivotCaches>":case"<pivotCaches":break;case"<pivotCache":break;case"<smartTagPr":case"<smartTagPr/>":break;case"<smartTagTypes":case"<smartTagTypes>":case"</smartTagTypes>":break;case"<smartTagType":break;case"<webPublishing":case"<webPublishing/>":break;case"<fileRecoveryPr":case"<fileRecoveryPr/>":break;case"<webPublishObjects>":case"<webPublishObjects":case"</webPublishObjects>":break;case"<webPublishObject":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;case"<ArchID":break;case"<AlternateContent":case"<AlternateContent>":n=!0;break;case"</AlternateContent>":n=!1;break;case"<revisionPtr":break;default:if(!n&&r.WTF)throw new Error("unrecognized "+u[0]+" in workbook")}return l}),on.indexOf(a.xmlns)===-1)throw new Error("Unknown Namespace: "+a.xmlns);return X0(a),a}function Y0(e){var r=[Rt];r[r.length]=Se("workbook",null,{xmlns:on[0],"xmlns:r":Wt.r});var a=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(Jo.forEach(function(o){e.Workbook.WBProps[o[0]]!=null&&e.Workbook.WBProps[o[0]]!=o[1]&&(n[o[0]]=e.Workbook.WBProps[o[0]])}),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),r[r.length]=Se("workbookPr",null,n);var s=e.Workbook&&e.Workbook.Sheets||[],i=0;if(s&&s[0]&&s[0].Hidden){for(r[r.length]="<bookViews>",i=0;i!=e.SheetNames.length&&!(!s[i]||!s[i].Hidden);++i);i==e.SheetNames.length&&(i=0),r[r.length]='<workbookView firstSheet="'+i+'" activeTab="'+i+'"/>',r[r.length]="</bookViews>"}for(r[r.length]="<sheets>",i=0;i!=e.SheetNames.length;++i){var c={name:ht(e.SheetNames[i].slice(0,31))};if(c.sheetId=""+(i+1),c["r:id"]="rId"+(i+1),s[i])switch(s[i].Hidden){case 1:c.state="hidden";break;case 2:c.state="veryHidden";break}r[r.length]=Se("sheet",null,c)}return r[r.length]="</sheets>",a&&(r[r.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(o){var l={name:o.Name};o.Comment&&(l.comment=o.Comment),o.Sheet!=null&&(l.localSheetId=""+o.Sheet),o.Hidden&&(l.hidden="1"),o.Ref&&(r[r.length]=Se("definedName",ht(o.Ref),l))}),r[r.length]="</definedNames>"),r.length>2&&(r[r.length]="</workbook>",r[1]=r[1].replace("/>",">")),r.join("")}function ww(e,r){var a={};return a.Hidden=e.read_shift(4),a.iTabID=e.read_shift(4),a.strRelID=Xc(e),a.name=sr(e),a}function kw(e,r){return r||(r=pe(127)),r.write_shift(4,e.Hidden),r.write_shift(4,e.iTabID),Oo(e.strRelID,r),Xt(e.name.slice(0,31),r),r.length>r.l?r.slice(0,r.l):r}function Sw(e,r){var a={},n=e.read_shift(4);a.defaultThemeVersion=e.read_shift(4);var s=r>8?sr(e):"";return s.length>0&&(a.CodeName=s),a.autoCompressPictures=!!(n&65536),a.backupFile=!!(n&64),a.checkCompatibility=!!(n&4096),a.date1904=!!(n&1),a.filterPrivacy=!!(n&8),a.hidePivotFieldList=!!(n&1024),a.promptedSolutions=!!(n&16),a.publishItems=!!(n&2048),a.refreshAllConnections=!!(n&262144),a.saveExternalLinkValues=!!(n&128),a.showBorderUnselectedTables=!!(n&4),a.showInkAnnotation=!!(n&32),a.showObjects=["all","placeholders","none"][n>>13&3],a.showPivotChartFilter=!!(n&32768),a.updateLinks=["userSet","never","always"][n>>8&3],a}function Nw(e,r){r||(r=pe(72));var a=0;return e&&e.filterPrivacy&&(a|=8),r.write_shift(4,a),r.write_shift(4,0),Uh(e&&e.CodeName||"ThisWorkbook",r),r.slice(0,r.l)}function Cw(e,r){var a={};return e.read_shift(4),a.ArchID=e.read_shift(4),e.l+=r-8,a}function Ew(e,r,a){var n=e.l+r;e.l+=4,e.l+=1;var s=e.read_shift(4),i=ng(e),c=uj(e,0,a),o=Ro(e);e.l=n;var l={Name:i,Ptg:c};return s<268435455&&(l.Sheet=s),o&&(l.Comment=o),l}function Tw(e,r){var a={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""},n=[],s=!1;r||(r={}),r.biff=12;var i=[],c=[[]];return c.SheetNames=[],c.XTI=[],As[16]={n:"BrtFRTArchID$",f:Cw},_a(e,function(l,d,u){switch(u){case 156:c.SheetNames.push(l.name),a.Sheets.push(l);break;case 153:a.WBProps=l;break;case 39:l.Sheet!=null&&(r.SID=l.Sheet),l.Ref=rr(l.Ptg,null,null,c,r),delete r.SID,delete l.Ptg,i.push(l);break;case 1036:break;case 357:case 358:case 355:case 667:c[0].length?c.push([u,l]):c[0]=[u,l],c[c.length-1].XTI=[];break;case 362:c.length===0&&(c[0]=[],c[0].XTI=[]),c[c.length-1].XTI=c[c.length-1].XTI.concat(l),c.XTI=c.XTI.concat(l);break;case 361:break;case 2071:case 158:case 143:case 664:case 353:break;case 3072:case 3073:case 534:case 677:case 157:case 610:case 2050:case 155:case 548:case 676:case 128:case 665:case 2128:case 2125:case 549:case 2053:case 596:case 2076:case 2075:case 2082:case 397:case 154:case 1117:case 553:case 2091:break;case 35:n.push(u),s=!0;break;case 36:n.pop(),s=!1;break;case 37:n.push(u),s=!0;break;case 38:n.pop(),s=!1;break;case 16:break;default:if(!d.T){if(!s||r.WTF&&n[n.length-1]!=37&&n[n.length-1]!=35)throw new Error("Unexpected record 0x"+u.toString(16))}}},r),X0(a),a.Names=i,a.supbooks=c,a}function Aw(e,r){ge(e,143);for(var a=0;a!=r.SheetNames.length;++a){var n=r.Workbook&&r.Workbook.Sheets&&r.Workbook.Sheets[a]&&r.Workbook.Sheets[a].Hidden||0,s={Hidden:n,iTabID:a+1,strRelID:"rId"+(a+1),name:r.SheetNames[a]};ge(e,156,kw(s))}ge(e,144)}function Fw(e,r){r||(r=pe(127));for(var a=0;a!=4;++a)r.write_shift(4,0);return Xt("SheetJS",r),Xt(yi.version,r),Xt(yi.version,r),Xt("7262",r),r.length>r.l?r.slice(0,r.l):r}function Iw(e,r){r||(r=pe(29)),r.write_shift(-4,0),r.write_shift(-4,460),r.write_shift(4,28800),r.write_shift(4,17600),r.write_shift(4,500),r.write_shift(4,e),r.write_shift(4,e);var a=120;return r.write_shift(1,a),r.length>r.l?r.slice(0,r.l):r}function Pw(e,r){if(!(!r.Workbook||!r.Workbook.Sheets)){for(var a=r.Workbook.Sheets,n=0,s=-1,i=-1;n<a.length;++n)!a[n]||!a[n].Hidden&&s==-1?s=n:a[n].Hidden==1&&i==-1&&(i=n);i>s||(ge(e,135),ge(e,158,Iw(s)),ge(e,136))}}function Dw(e,r){var a=xr();return ge(a,131),ge(a,128,Fw()),ge(a,153,Nw(e.Workbook&&e.Workbook.WBProps||null)),Pw(a,e),Aw(a,e),ge(a,132),a.end()}function Rw(e,r,a){return r.slice(-4)===".bin"?Tw(e,a):jw(e,a)}function Ow(e,r,a,n,s,i,c,o){return r.slice(-4)===".bin"?J2(e,n,a,s,i,c,o):Ej(e,n,a,s,i,c,o)}function Lw(e,r,a,n,s,i,c,o){return r.slice(-4)===".bin"?fw(e,n,a,s,i):uw(e,n,a,s,i)}function Bw(e,r,a,n,s,i,c,o){return r.slice(-4)===".bin"?z_():U_()}function Mw(e,r,a,n,s,i,c,o){return r.slice(-4)===".bin"?B_():M_()}function zw(e,r,a,n){return r.slice(-4)===".bin"?Ry(e,a,n):wy(e,a,n)}function Uw(e,r,a){return A0(e,a)}function Hw(e,r,a){return r.slice(-4)===".bin"?H1(e,a):M1(e,a)}function Ww(e,r,a){return r.slice(-4)===".bin"?P_(e,a):k_(e,a)}function Vw(e,r,a){return r.slice(-4)===".bin"?b_(e):y_(e)}function qw(e,r,a,n){return a.slice(-4)===".bin"?j_(e,r,a,n):void 0}function $w(e,r,a){return r.slice(-4)===".bin"?x_(e,r,a):v_(e,r,a)}function Gw(e,r,a){return(r.slice(-4)===".bin"?Dw:Y0)(e)}function Xw(e,r,a,n,s){return(r.slice(-4)===".bin"?ow:q0)(e,a,n,s)}function Kw(e,r,a){return(r.slice(-4)===".bin"?qy:E0)(e,a)}function Yw(e,r,a){return(r.slice(-4)===".bin"?q1:_0)(e,a)}function Jw(e,r,a){return(r.slice(-4)===".bin"?D_:P0)(e)}function Qw(e){return(e.slice(-4)===".bin"?g_:F0)()}var J0=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g,Q0=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;function zr(e,r){var a=e.split(/\s+/),n=[];if(n[0]=a[0],a.length===1)return n;var s=e.match(J0),i,c,o,l;if(s)for(l=0;l!=s.length;++l)i=s[l].match(Q0),(c=i[1].indexOf(":"))===-1?n[i[1]]=i[2].slice(1,i[2].length-1):(i[1].slice(0,6)==="xmlns:"?o="xmlns"+i[1].slice(6):o=i[1].slice(c+1),n[o]=i[2].slice(1,i[2].length-1));return n}function Zw(e){var r=e.split(/\s+/),a={};if(r.length===1)return a;var n=e.match(J0),s,i,c,o;if(n)for(o=0;o!=n.length;++o)s=n[o].match(Q0),(i=s[1].indexOf(":"))===-1?a[s[1]]=s[2].slice(1,s[2].length-1):(s[1].slice(0,6)==="xmlns:"?c="xmlns"+s[1].slice(6):c=s[1].slice(i+1),a[c]=s[2].slice(1,s[2].length-1));return a}var ms;function ek(e,r){var a=ms[e]||rt(e);return a==="General"?tn(r):Br(a,r)}function tk(e,r,a,n){var s=n;switch((a[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":s=jt(n);break;case"i2":case"int":s=parseInt(n,10);break;case"r4":case"float":s=parseFloat(n);break;case"date":case"dateTime.tz":s=wt(n);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw new Error("bad custprop:"+a[0])}e[rt(r)]=s}function rk(e,r,a){if(e.t!=="z"){if(!a||a.cellText!==!1)try{e.t==="e"?e.w=e.w||ba[e.v]:r==="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=bs(e.v):e.w=tn(e.v):e.w=ek(r||"General",e.v)}catch(i){if(a.WTF)throw i}try{var n=ms[r]||r||"General";if(a.cellNF&&(e.z=n),a.cellDates&&e.t=="n"&&Wn(n)){var s=Ga(e.v);s&&(e.t="d",e.v=new Date(s.y,s.m-1,s.d,s.H,s.M,s.S,s.u))}}catch(i){if(a.WTF)throw i}}}function ak(e,r,a){if(a.cellStyles&&r.Interior){var n=r.Interior;n.Pattern&&(n.patternType=my[n.Pattern]||n.Pattern)}e[r.ID]=r}function nk(e,r,a,n,s,i,c,o,l,d){var u="General",h=n.StyleID,f={};d=d||{};var m=[],x=0;for(h===void 0&&o&&(h=o.StyleID),h===void 0&&c&&(h=c.StyleID);i[h]!==void 0&&(i[h].nf&&(u=i[h].nf),i[h].Interior&&m.push(i[h].Interior),!!i[h].Parent);)h=i[h].Parent;switch(a.Type){case"Boolean":n.t="b",n.v=jt(e);break;case"String":n.t="s",n.r=$l(rt(e)),n.v=e.indexOf("<")>-1?rt(r||e).replace(/<.*?>/g,""):n.r;break;case"DateTime":e.slice(-1)!="Z"&&(e+="Z"),n.v=(wt(e)-new Date(Date.UTC(1899,11,30)))/(1440*60*1e3),n.v!==n.v?n.v=rt(e):n.v<60&&(n.v=n.v-1),(!u||u=="General")&&(u="yyyy-mm-dd");case"Number":n.v===void 0&&(n.v=+e),n.t||(n.t="n");break;case"Error":n.t="e",n.v=$h[e],d.cellText!==!1&&(n.w=e);break;default:e==""&&r==""?n.t="z":(n.t="s",n.v=$l(r||e));break}if(rk(n,u,d),d.cellFormula!==!1)if(n.Formula){var p=rt(n.Formula);p.charCodeAt(0)==61&&(p=p.slice(1)),n.f=Fn(p,s),delete n.Formula,n.ArrayRange=="RC"?n.F=Fn("RC:RC",s):n.ArrayRange&&(n.F=Fn(n.ArrayRange,s),l.push([at(n.F),n.F]))}else for(x=0;x<l.length;++x)s.r>=l[x][0].s.r&&s.r<=l[x][0].e.r&&s.c>=l[x][0].s.c&&s.c<=l[x][0].e.c&&(n.F=l[x][1]);d.cellStyles&&(m.forEach(function(g){!f.patternType&&g.patternType&&(f.patternType=g.patternType)}),n.s=f),n.StyleID!==void 0&&(n.ixfe=n.StyleID)}function sk(e){e.t=e.v||"",e.t=e.t.replace(/\r\n/g,` 535`).replace(/\r/g,` 536`),e.v=e.w=e.ixfe=void 0}function ic(e,r){var a=r||{};Vn();var n=ns(To(e));(a.type=="binary"||a.type=="array"||a.type=="base64")&&(n=xt(n));var s=n.slice(0,1024).toLowerCase(),i=!1;if(s=s.replace(/".*?"/g,""),(s.indexOf(">")&1023)>Math.min(s.indexOf(",")&1023,s.indexOf(";")&1023)){var c=kt(a);return c.type="string",Ln.to_workbook(n,c)}if(s.indexOf("<?xml")==-1&&["html","table","head","meta","script","style","div"].forEach(function(Z){s.indexOf("<"+Z)>=0&&(i=!0)}),i)return Vk(n,a);ms={"General Number":"General","General Date":He[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":He[15],"Short Date":He[14],"Long Time":He[19],"Medium Time":He[18],"Short Time":He[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:He[2],Standard:He[4],Percent:He[10],Scientific:He[11],"Yes/No":'"Yes";"Yes";"No";@',"True/False":'"True";"True";"False";@',"On/Off":'"Yes";"Yes";"No";@'};var o,l=[],d,u={},h=[],f=a.dense?[]:{},m="",x={},p={},g=zr('<Data ss:Type="String">'),w=0,S=0,b=0,j={s:{r:2e6,c:2e6},e:{r:0,c:0}},k={},N={},C="",P=0,T=[],L={},M={},E=0,W=[],ee=[],ce={},ue=[],te,fe=!1,q=[],J=[],le={},A=0,V=0,I={Sheets:[],WBProps:{date1904:!1}},D={};ks.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"");for(var K="";o=ks.exec(n);)switch(o[3]=(K=o[3]).toLowerCase()){case"data":if(K=="data"){if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else o[0].charAt(o[0].length-2)!=="/"&&l.push([o[3],!0]);break}if(l[l.length-1][1])break;o[1]==="/"?nk(n.slice(w,o.index),C,g,l[l.length-1][0]=="comment"?ce:x,{c:S,r:b},k,ue[S],p,q,a):(C="",g=zr(o[0]),w=o.index+o[0].length);break;case"cell":if(o[1]==="/")if(ee.length>0&&(x.c=ee),(!a.sheetRows||a.sheetRows>b)&&x.v!==void 0&&(a.dense?(f[b]||(f[b]=[]),f[b][S]=x):f[Nt(S)+Dt(b)]=x),x.HRef&&(x.l={Target:rt(x.HRef)},x.HRefScreenTip&&(x.l.Tooltip=x.HRefScreenTip),delete x.HRef,delete x.HRefScreenTip),(x.MergeAcross||x.MergeDown)&&(A=S+(parseInt(x.MergeAcross,10)|0),V=b+(parseInt(x.MergeDown,10)|0),T.push({s:{c:S,r:b},e:{c:A,r:V}})),!a.sheetStubs)x.MergeAcross?S=A+1:++S;else if(x.MergeAcross||x.MergeDown){for(var z=S;z<=A;++z)for(var Y=b;Y<=V;++Y)(z>S||Y>b)&&(a.dense?(f[Y]||(f[Y]=[]),f[Y][z]={t:"z"}):f[Nt(z)+Dt(Y)]={t:"z"});S=A+1}else++S;else x=Zw(o[0]),x.Index&&(S=+x.Index-1),S<j.s.c&&(j.s.c=S),S>j.e.c&&(j.e.c=S),o[0].slice(-2)==="/>"&&++S,ee=[];break;case"row":o[1]==="/"||o[0].slice(-2)==="/>"?(b<j.s.r&&(j.s.r=b),b>j.e.r&&(j.e.r=b),o[0].slice(-2)==="/>"&&(p=zr(o[0]),p.Index&&(b=+p.Index-1)),S=0,++b):(p=zr(o[0]),p.Index&&(b=+p.Index-1),le={},(p.AutoFitHeight=="0"||p.Height)&&(le.hpx=parseInt(p.Height,10),le.hpt=Ts(le.hpx),J[b]=le),p.Hidden=="1"&&(le.hidden=!0,J[b]=le));break;case"worksheet":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"));h.push(m),j.s.r<=j.e.r&&j.s.c<=j.e.c&&(f["!ref"]=Ke(j),a.sheetRows&&a.sheetRows<=j.e.r&&(f["!fullref"]=f["!ref"],j.e.r=a.sheetRows-1,f["!ref"]=Ke(j))),T.length&&(f["!merges"]=T),ue.length>0&&(f["!cols"]=ue),J.length>0&&(f["!rows"]=J),u[m]=f}else j={s:{r:2e6,c:2e6},e:{r:0,c:0}},b=S=0,l.push([o[3],!1]),d=zr(o[0]),m=rt(d.Name),f=a.dense?[]:{},T=[],q=[],J=[],D={name:m,Hidden:0},I.Sheets.push(D);break;case"table":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else{if(o[0].slice(-2)=="/>")break;l.push([o[3],!1]),ue=[],fe=!1}break;case"style":o[1]==="/"?ak(k,N,a):N=zr(o[0]);break;case"numberformat":N.nf=rt(zr(o[0]).Format||"General"),ms[N.nf]&&(N.nf=ms[N.nf]);for(var re=0;re!=392&&He[re]!=N.nf;++re);if(re==392){for(re=57;re!=392;++re)if(He[re]==null){pa(N.nf,re);break}}break;case"column":if(l[l.length-1][0]!=="table")break;if(te=zr(o[0]),te.Hidden&&(te.hidden=!0,delete te.Hidden),te.Width&&(te.wpx=parseInt(te.Width,10)),!fe&&te.wpx>10){fe=!0,ar=N0;for(var oe=0;oe<ue.length;++oe)ue[oe]&&Ia(ue[oe])}fe&&Ia(te),ue[te.Index-1||ue.length]=te;for(var Ce=0;Ce<+te.Span;++Ce)ue[ue.length]=kt(te);break;case"namedrange":if(o[1]==="/")break;I.Names||(I.Names=[]);var F=qe(o[0]),se={Name:F.Name,Ref:Fn(F.RefersTo.slice(1),{r:0,c:0})};I.Sheets.length>0&&(se.Sheet=I.Sheets.length-1),I.Names.push(se);break;case"namedcell":break;case"b":break;case"i":break;case"u":break;case"s":break;case"em":break;case"h2":break;case"h3":break;case"sub":break;case"sup":break;case"span":break;case"alignment":break;case"borders":break;case"border":break;case"font":if(o[0].slice(-2)==="/>")break;o[1]==="/"?C+=n.slice(P,o.index):P=o.index+o[0].length;break;case"interior":if(!a.cellStyles)break;N.Interior=zr(o[0]);break;case"protection":break;case"author":case"title":case"description":case"created":case"keywords":case"subject":case"category":case"company":case"lastauthor":case"lastsaved":case"lastprinted":case"version":case"revision":case"totaltime":case"hyperlinkbase":case"manager":case"contentstatus":case"identifier":case"language":case"appname":if(o[0].slice(-2)==="/>")break;o[1]==="/"?Tg(L,K,n.slice(E,o.index)):E=o.index+o[0].length;break;case"paragraphs":break;case"styles":case"workbook":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else l.push([o[3],!1]);break;case"comment":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"));sk(ce),ee.push(ce)}else l.push([o[3],!1]),d=zr(o[0]),ce={a:d.Author};break;case"autofilter":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else if(o[0].charAt(o[0].length-2)!=="/"){var he=zr(o[0]);f["!autofilter"]={ref:Fn(he.Range).replace(/\$/g,"")},l.push([o[3],!0])}break;case"name":break;case"datavalidation":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else o[0].charAt(o[0].length-2)!=="/"&&l.push([o[3],!0]);break;case"pixelsperinch":break;case"componentoptions":case"documentproperties":case"customdocumentproperties":case"officedocumentsettings":case"pivottable":case"pivotcache":case"names":case"mapinfo":case"pagebreaks":case"querytable":case"sorting":case"schema":case"conditionalformatting":case"smarttagtype":case"smarttags":case"excelworkbook":case"workbookoptions":case"worksheetoptions":if(o[1]==="/"){if((d=l.pop())[0]!==o[3])throw new Error("Bad state: "+d.join("|"))}else o[0].charAt(o[0].length-2)!=="/"&&l.push([o[3],!0]);break;case"null":break;default:if(l.length==0&&o[3]=="document"||l.length==0&&o[3]=="uof")return Dd(n,a);var je=!0;switch(l[l.length-1][0]){case"officedocumentsettings":switch(o[3]){case"allowpng":break;case"removepersonalinformation":break;case"downloadcomponents":break;case"locationofcomponents":break;case"colors":break;case"color":break;case"index":break;case"rgb":break;case"targetscreensize":break;case"readonlyrecommended":break;default:je=!1}break;case"componentoptions":switch(o[3]){case"toolbar":break;case"hideofficelogo":break;case"spreadsheetautofit":break;case"label":break;case"caption":break;case"maxheight":break;case"maxwidth":break;case"nextsheetnumber":break;default:je=!1}break;case"excelworkbook":switch(o[3]){case"date1904":I.WBProps.date1904=!0;break;case"windowheight":break;case"windowwidth":break;case"windowtopx":break;case"windowtopy":break;case"tabratio":break;case"protectstructure":break;case"protectwindow":break;case"protectwindows":break;case"activesheet":break;case"displayinknotes":break;case"firstvisiblesheet":break;case"supbook":break;case"sheetname":break;case"sheetindex":break;case"sheetindexfirst":break;case"sheetindexlast":break;case"dll":break;case"acceptlabelsinformulas":break;case"donotsavelinkvalues":break;case"iteration":break;case"maxiterations":break;case"maxchange":break;case"path":break;case"xct":break;case"count":break;case"selectedsheets":break;case"calculation":break;case"uncalced":break;case"startupprompt":break;case"crn":break;case"externname":break;case"formula":break;case"colfirst":break;case"collast":break;case"wantadvise":break;case"boolean":break;case"error":break;case"text":break;case"ole":break;case"noautorecover":break;case"publishobjects":break;case"donotcalculatebeforesave":break;case"number":break;case"refmoder1c1":break;case"embedsavesmarttags":break;default:je=!1}break;case"workbookoptions":switch(o[3]){case"owcversion":break;case"height":break;case"width":break;default:je=!1}break;case"worksheetoptions":switch(o[3]){case"visible":if(o[0].slice(-2)!=="/>")if(o[1]==="/")switch(n.slice(E,o.index)){case"SheetHidden":D.Hidden=1;break;case"SheetVeryHidden":D.Hidden=2;break}else E=o.index+o[0].length;break;case"header":f["!margins"]||Za(f["!margins"]={},"xlml"),isNaN(+qe(o[0]).Margin)||(f["!margins"].header=+qe(o[0]).Margin);break;case"footer":f["!margins"]||Za(f["!margins"]={},"xlml"),isNaN(+qe(o[0]).Margin)||(f["!margins"].footer=+qe(o[0]).Margin);break;case"pagemargins":var ve=qe(o[0]);f["!margins"]||Za(f["!margins"]={},"xlml"),isNaN(+ve.Top)||(f["!margins"].top=+ve.Top),isNaN(+ve.Left)||(f["!margins"].left=+ve.Left),isNaN(+ve.Right)||(f["!margins"].right=+ve.Right),isNaN(+ve.Bottom)||(f["!margins"].bottom=+ve.Bottom);break;case"displayrighttoleft":I.Views||(I.Views=[]),I.Views[0]||(I.Views[0]={}),I.Views[0].RTL=!0;break;case"freezepanes":break;case"frozennosplit":break;case"splithorizontal":case"splitvertical":break;case"donotdisplaygridlines":break;case"activerow":break;case"activecol":break;case"toprowbottompane":break;case"leftcolumnrightpane":break;case"unsynced":break;case"print":break;case"printerrors":break;case"panes":break;case"scale":break;case"pane":break;case"number":break;case"layout":break;case"pagesetup":break;case"selected":break;case"protectobjects":break;case"enableselection":break;case"protectscenarios":break;case"validprinterinfo":break;case"horizontalresolution":break;case"verticalresolution":break;case"numberofcopies":break;case"activepane":break;case"toprowvisible":break;case"leftcolumnvisible":break;case"fittopage":break;case"rangeselection":break;case"papersizeindex":break;case"pagelayoutzoom":break;case"pagebreakzoom":break;case"filteron":break;case"fitwidth":break;case"fitheight":break;case"commentslayout":break;case"zoom":break;case"lefttoright":break;case"gridlines":break;case"allowsort":break;case"allowfilter":break;case"allowinsertrows":break;case"allowdeleterows":break;case"allowinsertcols":break;case"allowdeletecols":break;case"allowinserthyperlinks":break;case"allowformatcells":break;case"allowsizecols":break;case"allowsizerows":break;case"nosummaryrowsbelowdetail":f["!outline"]||(f["!outline"]={}),f["!outline"].above=!0;break;case"tabcolorindex":break;case"donotdisplayheadings":break;case"showpagelayoutzoom":break;case"nosummarycolumnsrightdetail":f["!outline"]||(f["!outline"]={}
536),f["!outline"].left=!0;break;case"blackandwhite":break;case"donotdisplayzeros":break;case"displaypagebreak":break;case"rowcolheadings":break;case"donotdisplayoutline":break;case"noorientation":break;case"allowusepivottables":break;case"zeroheight":break;case"viewablerange":break;case"selection":break;case"protectcontents":break;default:je=!1}break;case"pivottable":case"pivotcache":switch(o[3]){case"immediateitemsondrop":break;case"showpagemultipleitemlabel":break;case"compactrowindent":break;case"location":break;case"pivotfield":break;case"orientation":break;case"layoutform":break;case"layoutsubtotallocation":break;case"layoutcompactrow":break;case"position":break;case"pivotitem":break;case"datatype":break;case"datafield":break;case"sourcename":break;case"parentfield":break;case"ptlineitems":break;case"ptlineitem":break;case"countofsameitems":break;case"item":break;case"itemtype":break;case"ptsource":break;case"cacheindex":break;case"consolidationreference":break;case"filename":break;case"reference":break;case"nocolumngrand":break;case"norowgrand":break;case"blanklineafteritems":break;case"hidden":break;case"subtotal":break;case"basefield":break;case"mapchilditems":break;case"function":break;case"refreshonfileopen":break;case"printsettitles":break;case"mergelabels":break;case"defaultversion":break;case"refreshname":break;case"refreshdate":break;case"refreshdatecopy":break;case"versionlastrefresh":break;case"versionlastupdate":break;case"versionupdateablemin":break;case"versionrefreshablemin":break;case"calculation":break;default:je=!1}break;case"pagebreaks":switch(o[3]){case"colbreaks":break;case"colbreak":break;case"rowbreaks":break;case"rowbreak":break;case"colstart":break;case"colend":break;case"rowend":break;default:je=!1}break;case"autofilter":switch(o[3]){case"autofiltercolumn":break;case"autofiltercondition":break;case"autofilterand":break;case"autofilteror":break;default:je=!1}break;case"querytable":switch(o[3]){case"id":break;case"autoformatfont":break;case"autoformatpattern":break;case"querysource":break;case"querytype":break;case"enableredirections":break;case"refreshedinxl9":break;case"urlstring":break;case"htmltables":break;case"connection":break;case"commandtext":break;case"refreshinfo":break;case"notitles":break;case"nextid":break;case"columninfo":break;case"overwritecells":break;case"donotpromptforfile":break;case"textwizardsettings":break;case"source":break;case"number":break;case"decimal":break;case"thousandseparator":break;case"trailingminusnumbers":break;case"formatsettings":break;case"fieldtype":break;case"delimiters":break;case"tab":break;case"comma":break;case"autoformatname":break;case"versionlastedit":break;case"versionlastrefresh":break;default:je=!1}break;case"datavalidation":switch(o[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;case"cellrangelist":break;default:je=!1}break;case"sorting":case"conditionalformatting":switch(o[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"cellrangelist":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;default:je=!1}break;case"mapinfo":case"schema":case"data":switch(o[3]){case"map":break;case"entry":break;case"range":break;case"xpath":break;case"field":break;case"xsdtype":break;case"filteron":break;case"aggregate":break;case"elementtype":break;case"attributetype":break;case"schema":case"element":case"complextype":case"datatype":case"all":case"attribute":case"extends":break;case"row":break;default:je=!1}break;case"smarttags":break;default:je=!1;break}if(je||o[3].match(/!\[CDATA/))break;if(!l[l.length-1][1])throw"Unrecognized tag: "+o[3]+"|"+l.join("|");if(l[l.length-1][0]==="customdocumentproperties"){if(o[0].slice(-2)==="/>")break;o[1]==="/"?tk(M,K,W,n.slice(E,o.index)):(W=o,E=o.index+o[0].length);break}if(a.WTF)throw"Unrecognized tag: "+o[3]+"|"+l.join("|")}var ne={};return!a.bookSheets&&!a.bookProps&&(ne.Sheets=u),ne.SheetNames=h,ne.Workbook=I,ne.SSF=kt(He),ne.Props=L,ne.Custprops=M,ne}function to(e,r){switch(Zo(r=r||{}),r.type||"base64"){case"base64":return ic(kr(e),r);case"binary":case"buffer":case"file":return ic(e,r);case"array":return ic(Oa(e),r)}}function ik(e,r){var a=[];return e.Props&&a.push(Ag(e.Props,r)),e.Custprops&&a.push(Fg(e.Props,e.Custprops)),a.join("")}function ck(){return""}function ok(e,r){var a=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];
vendor: 4,078 bytes, line 536
536return r.cellXfs.forEach(function(n,s){var i=[];i.push(Se("NumberFormat",null,{"ss:Format":ht(He[n.numFmtId])}));var c={"ss:ID":"s"+(21+s)};a.push(Se("Style",i.join(""),c))}),Se("Styles",a.join(""))}function Z0(e){return Se("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+Go(e.Ref,{r:0,c:0})})}function lk(e){if(!((e||{}).Workbook||{}).Names)return"";for(var r=e.Workbook.Names,a=[],n=0;n<r.length;++n){var s=r[n];s.Sheet==null&&(s.Name.match(/^_xlfn\./)||a.push(Z0(s)))}return Se("Names",a.join(""))}function dk(e,r,a,n){if(!e||!((n||{}).Workbook||{}).Names)return"";for(var s=n.Workbook.Names,i=[],c=0;c<s.length;++c){var o=s[c];o.Sheet==a&&(o.Name.match(/^_xlfn\./)||i.push(Z0(o)))}return i.join("")}function uk(e,r,a,n){if(!e)return"";var s=[];if(e["!margins"]&&(s.push("<PageSetup>"),e["!margins"].header&&s.push(Se("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&s.push(Se("Footer",null,{"x:Margin":e["!margins"].footer})),s.push(Se("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),s.push("</PageSetup>")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[a])if(n.Workbook.Sheets[a].Hidden)s.push(Se("Visible",n.Workbook.Sheets[a].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var i=0;i<a&&!(n.Workbook.Sheets[i]&&!n.Workbook.Sheets[i].Hidden);++i);i==a&&s.push("<Selected/>")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&s.push("<DisplayRightToLeft/>"),e["!protect"]&&(s.push(Qt("ProtectContents","True")),e["!protect"].objects&&s.push(Qt("ProtectObjects","True")),e["!protect"].scenarios&&s.push(Qt("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?s.push(Qt("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&s.push(Qt("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(c){e["!protect"][c[0]]&&s.push("<"+c[1]+"/>")})),s.length==0?"":Se("WorksheetOptions",s.join(""),{xmlns:_r.x})}function hk(e){return e.map(function(r){var a=Px(r.t||""),n=Se("ss:Data",a,{xmlns:"http://www.w3.org/TR/REC-html40"});return Se("Comment",n,{"ss:Author":r.a})}).join("")}function fk(e,r,a,n,s,i,c){if(!e||e.v==null&&e.f==null)return"";var o={};if(e.f&&(o["ss:Formula"]="="+ht(Go(e.f,c))),e.F&&e.F.slice(0,r.length)==r){var l=Ct(e.F.slice(r.length+1));o["ss:ArrayRange"]="RC:R"+(l.r==c.r?"":"["+(l.r-c.r)+"]")+"C"+(l.c==c.c?"":"["+(l.c-c.c)+"]")}if(e.l&&e.l.Target&&(o["ss:HRef"]=ht(e.l.Target),e.l.Tooltip&&(o["x:HRefScreenTip"]=ht(e.l.Tooltip))),a["!merges"])for(var d=a["!merges"],u=0;u!=d.length;++u)d[u].s.c!=c.c||d[u].s.r!=c.r||(d[u].e.c>d[u].s.c&&(o["ss:MergeAcross"]=d[u].e.c-d[u].s.c),d[u].e.r>d[u].s.r&&(o["ss:MergeDown"]=d[u].e.r-d[u].s.r));var h="",f="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":h="Number",f=String(e.v);break;case"b":h="Boolean",f=e.v?"1":"0";break;case"e":h="Error",f=ba[e.v];break;case"d":h="DateTime",f=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||He[14]);break;case"s":h="String",f=Ix(e.v||"");break}var m=Ba(n.cellXfs,e,n);o["ss:StyleID"]="s"+(21+m),o["ss:Index"]=c.c+1;var x=e.v!=null?f:"",p=e.t=="z"?"":'<Data ss:Type="'+h+'">'+x+"</Data>";return(e.c||[]).length>0&&(p+=hk(e.c)),Se("Cell",p,o)}function pk(e,r){var a='<Row ss:Index="'+(e+1)+'"';return r&&(r.hpt&&!r.hpx&&(r.hpx=Bn(r.hpt)),r.hpx&&(a+=' ss:AutoFitHeight="0" ss:Height="'+r.hpx+'"'),r.hidden&&(a+=' ss:Hidden="1"')),a+">"}function mk(e,r,a,n){if(!e["!ref"])return"";var s=at(e["!ref"]),i=e["!merges"]||[],c=0,o=[];e["!cols"]&&e["!cols"].forEach(function(g,w){Ia(g);var S=!!g.width,b=Xi(w,g),j={"ss:Index":w+1};
vendor: 29,154 bytes, line 536
536S&&(j["ss:Width"]=Cs(b.width)),g.hidden&&(j["ss:Hidden"]="1"),o.push(Se("Column",null,j))});for(var l=Array.isArray(e),d=s.s.r;d<=s.e.r;++d){for(var u=[pk(d,(e["!rows"]||[])[d])],h=s.s.c;h<=s.e.c;++h){var f=!1;for(c=0;c!=i.length;++c)if(!(i[c].s.c>h)&&!(i[c].s.r>d)&&!(i[c].e.c<h)&&!(i[c].e.r<d)){(i[c].s.c!=h||i[c].s.r!=d)&&(f=!0);break}if(!f){var m={r:d,c:h},x=Ve(m),p=l?(e[d]||[])[h]:e[x];u.push(fk(p,x,e,r,a,n,m))}}u.push("</Row>"),u.length>2&&o.push(u.join(""))}return o.join("")}function xk(e,r,a){var n=[],s=a.SheetNames[e],i=a.Sheets[s],c=i?dk(i,r,e,a):"";return c.length>0&&n.push("<Names>"+c+"</Names>"),c=i?mk(i,r,e,a):"",c.length>0&&n.push("<Table>"+c+"</Table>"),n.push(uk(i,r,e,a)),n.join("")}function gk(e,r){r||(r={}),e.SSF||(e.SSF=kt(He)),e.SSF&&(Vn(),Ui(e.SSF),r.revssf=Wi(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF,r.cellXfs=[],Ba(r.cellXfs,{},{revssf:{General:0}}));var a=[];a.push(ik(e,r)),a.push(ck()),a.push(""),a.push("");for(var n=0;n<e.SheetNames.length;++n)a.push(Se("Worksheet",xk(n,r,e),{"ss:Name":ht(e.SheetNames[n])}));return a[2]=ok(e,r),a[3]=lk(e),Rt+Se("Workbook",a.join(""),{xmlns:_r.ss,"xmlns:o":_r.o,"xmlns:x":_r.x,"xmlns:ss":_r.ss,"xmlns:dt":_r.dt,"xmlns:html":_r.html})}function vk(e){var r={},a=e.content;if(a.l=28,r.AnsiUserType=a.read_shift(0,"lpstr-ansi"),r.AnsiClipboardFormat=lg(a),a.length-a.l<=4)return r;var n=a.read_shift(4);if(n==0||n>40||(a.l-=4,r.Reserved1=a.read_shift(0,"lpstr-ansi"),a.length-a.l<=4)||(n=a.read_shift(4),n!==1907505652)||(r.UnicodeClipboardFormat=dg(a),n=a.read_shift(4),n==0||n>40))return r;a.l-=4,r.Reserved2=a.read_shift(0,"lpwstr")}var yk=[60,1084,2066,2165,2175];function _k(e,r,a,n,s){var i=n,c=[],o=a.slice(a.l,a.l+i);if(s&&s.enc&&s.enc.insitu&&o.length>0)switch(e){case 9:case 521:case 1033:case 2057:case 47:case 405:case 225:case 406:case 312:case 404:case 10:break;case 133:break;default:s.enc.insitu(o)}c.push(o),a.l+=i;for(var l=ua(a,a.l),d=ro[l],u=0;d!=null&&yk.indexOf(l)>-1;)i=ua(a,a.l+2),u=a.l+4,l==2066?u+=4:(l==2165||l==2175)&&(u+=12),o=a.slice(u,a.l+4+i),c.push(o),a.l+=4+i,d=ro[l=ua(a,a.l)];var h=Gt(c);Jt(h,0);var f=0;h.lens=[];for(var m=0;m<c.length;++m)h.lens.push(f),f+=c[m].length;if(h.length<n)throw"XLS Record 0x"+e.toString(16)+" Truncated: "+h.length+" < "+n;return r.f(h,h.length,s)}function Jr(e,r,a){if(e.t!=="z"&&e.XF){var n=0;try{n=e.z||e.XF.numFmtId||0,r.cellNF&&(e.z=He[n])}catch(i){if(r.WTF)throw i}if(!r||r.cellText!==!1)try{e.t==="e"?e.w=e.w||ba[e.v]:n===0||n=="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=bs(e.v):e.w=tn(e.v):e.w=Br(n,e.v,{date1904:!!a,dateNF:r&&r.dateNF})}catch(i){if(r.WTF)throw i}if(r.cellDates&&n&&e.t=="n"&&Wn(He[n]||String(n))){var s=Ga(e.v);s&&(e.t="d",e.v=new Date(s.y,s.m-1,s.d,s.H,s.M,s.S,s.u))}}}function ui(e,r,a){return{v:e,ixfe:r,t:a}}function bk(e,r){var a={opts:{}},n={},s=r.dense?[]:{},i={},c={},o=null,l=[],d="",u={},h,f="",m,x,p,g,w={},S=[],b,j,k=[],N=[],C={Sheets:[],WBProps:{date1904:!1},Views:[{}]},P={},T=function(Me){return Me<8?Ya[Me]:Me<64&&N[Me-8]||Ya[Me]},L=function(Me,nt,Ge){var Ze=nt.XF.data;if(!(!Ze||!Ze.patternType||!Ge||!Ge.cellStyles)){nt.s={},nt.s.patternType=Ze.patternType;var It;(It=Ns(T(Ze.icvFore)))&&(nt.s.fgColor={rgb:It}),(It=Ns(T(Ze.icvBack)))&&(nt.s.bgColor={rgb:It})}},M=function(Me,nt,Ge){if(!(le>1)&&!(Ge.sheetRows&&Me.r>=Ge.sheetRows)){if(Ge.cellStyles&&nt.XF&&nt.XF.data&&L(Me,nt,Ge),delete nt.ixfe,delete nt.XF,h=Me,f=Ve(Me),(!c||!c.s||!c.e)&&(c={s:{r:0,c:0},e:{r:0,c:0}}),Me.r<c.s.r&&(c.s.r=Me.r),Me.c<c.s.c&&(c.s.c=Me.c),Me.r+1>c.e.r&&(c.e.r=Me.r+1),Me.c+1>c.e.c&&(c.e.c=Me.c+1),Ge.cellFormula&&nt.f){for(var Ze=0;Ze<S.length;++Ze)if(!(S[Ze][0].s.c>Me.c||S[Ze][0].s.r>Me.r)&&!(S[Ze][0].e.c<Me.c||S[Ze][0].e.r<Me.r)){nt.F=Ke(S[Ze][0]),(S[Ze][0].s.c!=Me.c||S[Ze][0].s.r!=Me.r)&&delete nt.f,nt.f&&(nt.f=""+rr(S[Ze][1],c,Me,q,E));break}}Ge.dense?(s[Me.r]||(s[Me.r]=[]),s[Me.r][Me.c]=nt):s[f]=nt}},E={enc:!1,sbcch:0,snames:[],sharedf:w,arrayf:S,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,cellStyles:!!r&&!!r.cellStyles,WTF:!!r&&!!r.wtf};r.password&&(E.password=r.password);var W,ee=[],ce=[],ue=[],te=[],fe=!1,q=[];q.SheetNames=E.snames,q.sharedf=E.sharedf,q.arrayf=E.arrayf,q.names=[],q.XTI=[];var J=0,le=0,A=0,V=[],I=[],D;E.codepage=1200,Wr(1200);for(var K=!1;e.l<e.length-1;){var z=e.l,Y=e.read_shift(2);if(Y===0&&J===10)break;var re=e.l===e.length?0:e.read_shift(2),oe=ro[Y];if(oe&&oe.f){if(r.bookSheets&&J===133&&Y!==133)break;if(J=Y,oe.r===2||oe.r==12){var Ce=e.read_shift(2);if(re-=2,!E.enc&&Ce!==Y&&((Ce&255)<<8|Ce>>8)!==Y)throw new Error("rt mismatch: "+Ce+"!="+Y);oe.r==12&&(e.l+=10,re-=10)}var F={};if(Y===10?F=oe.f(e,re,E):F=_k(Y,oe,e,re,E),le==0&&[9,521,1033,2057].indexOf(J)===-1)continue;switch(Y){case 34:a.opts.Date1904=C.WBProps.date1904=F;break;case 134:a.opts.WriteProtect=!0;break;case 47:if(E.enc||(e.l=0),E.enc=F,!r.password)throw new Error("File is password-protected");if(F.valid==null)throw new Error("Encryption scheme unsupported");if(!F.valid)throw new Error("Password is incorrect");break;case 92:E.lastuser=F;break;case 66:var se=Number(F);switch(se){case 21010:se=1200;break;case 32768:se=1e4;break;case 32769:se=1252;break}Wr(E.codepage=se),K=!0;break;case 317:E.rrtabid=F;break;case 25:E.winlocked=F;break;case 439:a.opts.RefreshAll=F;break;case 12:a.opts.CalcCount=F;break;case 16:a.opts.CalcDelta=F;break;case 17:a.opts.CalcIter=F;break;case 13:a.opts.CalcMode=F;break;case 14:a.opts.CalcPrecision=F;break;case 95:a.opts.CalcSaveRecalc=F;break;case 15:E.CalcRefMode=F;break;case 2211:a.opts.FullCalc=F;break;case 129:F.fDialog&&(s["!type"]="dialog"),F.fBelow||((s["!outline"]||(s["!outline"]={})).above=!0),F.fRight||((s["!outline"]||(s["!outline"]={})).left=!0);break;case 224:k.push(F);break;case 430:q.push([F]),q[q.length-1].XTI=[];break;case 35:case 547:q[q.length-1].push(F);break;case 24:case 536:D={Name:F.Name,Ref:rr(F.rgce,c,null,q,E)},F.itab>0&&(D.Sheet=F.itab-1),q.names.push(D),q[0]||(q[0]=[],q[0].XTI=[]),q[q.length-1].push(F),F.Name=="_xlnm._FilterDatabase"&&F.itab>0&&F.rgce&&F.rgce[0]&&F.rgce[0][0]&&F.rgce[0][0][0]=="PtgArea3d"&&(I[F.itab-1]={ref:Ke(F.rgce[0][0][1][2])});break;case 22:E.ExternCount=F;break;case 23:q.length==0&&(q[0]=[],q[0].XTI=[]),q[q.length-1].XTI=q[q.length-1].XTI.concat(F),q.XTI=q.XTI.concat(F);break;case 2196:if(E.biff<8)break;D!=null&&(D.Comment=F[1]);break;case 18:s["!protect"]=F;break;case 19:F!==0&&E.WTF&&console.error("Password verifier: "+F);break;case 133:i[F.pos]=F,E.snames.push(F.name);break;case 10:{if(--le)break;if(c.e){if(c.e.r>0&&c.e.c>0){if(c.e.r--,c.e.c--,s["!ref"]=Ke(c),r.sheetRows&&r.sheetRows<=c.e.r){var he=c.e.r;c.e.r=r.sheetRows-1,s["!fullref"]=s["!ref"],s["!ref"]=Ke(c),c.e.r=he}c.e.r++,c.e.c++}ee.length>0&&(s["!merges"]=ee),ce.length>0&&(s["!objects"]=ce),ue.length>0&&(s["!cols"]=ue),te.length>0&&(s["!rows"]=te),C.Sheets.push(P)}d===""?u=s:n[d]=s,s=r.dense?[]:{}}break;case 9:case 521:case 1033:case 2057:{if(E.biff===8&&(E.biff={9:2,521:3,1033:4}[Y]||{512:2,768:3,1024:4,1280:5,1536:8,2:2,7:2}[F.BIFFVer]||8),E.biffguess=F.BIFFVer==0,F.BIFFVer==0&&F.dt==4096&&(E.biff=5,K=!0,Wr(E.codepage=28591)),E.biff==8&&F.BIFFVer==0&&F.dt==16&&(E.biff=2),le++)break;if(s=r.dense?[]:{},E.biff<8&&!K&&(K=!0,Wr(E.codepage=r.codepage||1252)),E.biff<5||F.BIFFVer==0&&F.dt==4096){d===""&&(d="Sheet1"),c={s:{r:0,c:0},e:{r:0,c:0}};var je={pos:e.l-re,name:d};i[je.pos]=je,E.snames.push(d)}else d=(i[z]||{name:""}).name;F.dt==32&&(s["!type"]="chart"),F.dt==64&&(s["!type"]="macro"),ee=[],ce=[],E.arrayf=S=[],ue=[],te=[],fe=!1,P={Hidden:(i[z]||{hs:0}).hs,name:d}}break;case 515:case 3:case 2:s["!type"]=="chart"&&(r.dense?(s[F.r]||[])[F.c]:s[Ve({c:F.c,r:F.r})])&&++F.c,b={ixfe:F.ixfe,XF:k[F.ixfe]||{},v:F.val,t:"n"},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r);break;case 5:case 517:b={ixfe:F.ixfe,XF:k[F.ixfe],v:F.val,t:F.t},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r);break;case 638:b={ixfe:F.ixfe,XF:k[F.ixfe],v:F.rknum,t:"n"},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r);break;case 189:for(var ve=F.c;ve<=F.C;++ve){var ne=F.rkrec[ve-F.c][0];b={ixfe:ne,XF:k[ne],v:F.rkrec[ve-F.c][1],t:"n"},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:ve,r:F.r},b,r)}break;case 6:case 518:case 1030:{if(F.val=="String"){o=F;break}if(b=ui(F.val,F.cell.ixfe,F.tt),b.XF=k[b.ixfe],r.cellFormula){var Z=F.formula;if(Z&&Z[0]&&Z[0][0]&&Z[0][0][0]=="PtgExp"){var xe=Z[0][0][1][0],be=Z[0][0][1][1],De=Ve({r:xe,c:be});w[De]?b.f=""+rr(F.formula,c,F.cell,q,E):b.F=((r.dense?(s[xe]||[])[be]:s[De])||{}).F}else b.f=""+rr(F.formula,c,F.cell,q,E)}A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M(F.cell,b,r),o=F}break;case 7:case 519:if(o)o.val=F,b=ui(F,o.cell.ixfe,"s"),b.XF=k[b.ixfe],r.cellFormula&&(b.f=""+rr(o.formula,c,o.cell,q,E)),A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M(o.cell,b,r),o=null;else throw new Error("String record expects Formula");break;case 33:case 545:{S.push(F);var Te=Ve(F[0].s);if(m=r.dense?(s[F[0].s.r]||[])[F[0].s.c]:s[Te],r.cellFormula&&m){if(!o||!Te||!m)break;m.f=""+rr(F[1],c,F[0],q,E),m.F=Ke(F[0])}}break;case 1212:{if(!r.cellFormula)break;if(f){if(!o)break;w[Ve(o.cell)]=F[0],m=r.dense?(s[o.cell.r]||[])[o.cell.c]:s[Ve(o.cell)],(m||{}).f=""+rr(F[0],c,h,q,E)}}break;case 253:b=ui(l[F.isst].t,F.ixfe,"s"),l[F.isst].h&&(b.h=l[F.isst].h),b.XF=k[b.ixfe],A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r);break;case 513:r.sheetStubs&&(b={ixfe:F.ixfe,XF:k[F.ixfe],t:"z"},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r));break;case 190:if(r.sheetStubs)for(var ze=F.c;ze<=F.C;++ze){var We=F.ixfe[ze-F.c];b={ixfe:We,XF:k[We],t:"z"},A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:ze,r:F.r},b,r)}break;case 214:case 516:case 4:b=ui(F.val,F.ixfe,"s"),b.XF=k[b.ixfe],A>0&&(b.z=V[b.ixfe>>8&63]),Jr(b,r,a.opts.Date1904),M({c:F.c,r:F.r},b,r);break;case 0:case 512:le===1&&(c=F);break;case 252:l=F;break;case 1054:if(E.biff==4){V[A++]=F[1];for(var ot=0;ot<A+163&&He[ot]!=F[1];++ot);ot>=163&&pa(F[1],A+163)}else pa(F[1],F[0]);break;case 30:{V[A++]=F;for(var it=0;it<A+163&&He[it]!=F;++it);it>=163&&pa(F,A+163)}break;case 229:ee=ee.concat(F);break;case 93:ce[F.cmo[0]]=E.lastobj=F;break;case 438:E.lastobj.TxO=F;break;case 127:E.lastobj.ImData=F;break;case 440:for(g=F[0].s.r;g<=F[0].e.r;++g)for(p=F[0].s.c;p<=F[0].e.c;++p)m=r.dense?(s[g]||[])[p]:s[Ve({c:p,r:g})],m&&(m.l=F[1]);break;case 2048:for(g=F[0].s.r;g<=F[0].e.r;++g)for(p=F[0].s.c;p<=F[0].e.c;++p)m=r.dense?(s[g]||[])[p]:s[Ve({c:p,r:g})],m&&m.l&&(m.l.Tooltip=F[1]);break;case 28:{if(E.biff<=5&&E.biff>=2)break;m=r.dense?(s[F[0].r]||[])[F[0].c]:s[Ve(F[0])];var Zt=ce[F[2]];m||(r.dense?(s[F[0].r]||(s[F[0].r]=[]),m=s[F[0].r][F[0].c]={t:"z"}):m=s[Ve(F[0])]={t:"z"},c.e.r=Math.max(c.e.r,F[0].r),c.s.r=Math.min(c.s.r,F[0].r),c.e.c=Math.max(c.e.c,F[0].c),c.s.c=Math.min(c.s.c,F[0].c)),m.c||(m.c=[]),x={a:F[1],t:Zt.TxO.t},m.c.push(x)}break;case 2173:o_(k[F.ixfe],F.ext);break;case 125:{if(!E.cellStyles)break;for(;F.e>=F.s;)ue[F.e--]={width:F.w/256,level:F.level||0,hidden:!!(F.flags&1)},fe||(fe=!0,Vo(F.w/256)),Ia(ue[F.e+1])}break;case 520:{var Le={};F.level!=null&&(te[F.r]=Le,Le.level=F.level),F.hidden&&(te[F.r]=Le,Le.hidden=!0),F.hpt&&(te[F.r]=Le,Le.hpt=F.hpt,Le.hpx=Bn(F.hpt))}break;case 38:case 39:case 40:case 41:s["!margins"]||Za(s["!margins"]={}),s["!margins"][{38:"left",39:"right",40:"top",41:"bottom"}[Y]]=F;break;case 161:s["!margins"]||Za(s["!margins"]={}),s["!margins"].header=F.header,s["!margins"].footer=F.footer;break;case 574:F.RTL&&(C.Views[0].RTL=!0);break;case 146:N=F;break;case 2198:W=F;break;case 140:j=F;break;case 442:d?P.CodeName=F||P.name:C.WBProps.CodeName=F||"ThisWorkbook";break}}else oe||console.error("Missing Info for XLS Record 0x"+Y.toString(16)),e.l+=re}return a.SheetNames=Ft(i).sort(function(vt,Me){return Number(vt)-Number(Me)}).map(function(vt){return i[vt].name}),r.bookSheets||(a.Sheets=n),!a.SheetNames.length&&u["!ref"]?(a.SheetNames.push("Sheet1"),a.Sheets&&(a.Sheets.Sheet1=u)):a.Preamble=u,a.Sheets&&I.forEach(function(vt,Me){a.Sheets[a.SheetNames[Me]]["!autofilter"]=vt}),a.Strings=l,a.SSF=kt(He),E.enc&&(a.Encryption=E.enc),W&&(a.Themes=W),a.Metadata={},j!==void 0&&(a.Metadata.Country=j),q.names.length>0&&(C.Names=q.names),a.Workbook=C,a}var xs={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function jk(e,r,a){var n=Be.find(e,"/!DocumentSummaryInformation");if(n&&n.size>0)try{var s=dd(n,Kc,xs.DSI);for(var i in s)r[i]=s[i]}catch(d){if(a.WTF)throw d}var c=Be.find(e,"/!SummaryInformation");if(c&&c.size>0)try{var o=dd(c,Yc,xs.SI);for(var l in o)r[l]==null&&(r[l]=o[l])}catch(d){if(a.WTF)throw d}r.HeadingPairs&&r.TitlesOfParts&&(Qh(r.HeadingPairs,r.TitlesOfParts,r,a),delete r.HeadingPairs,delete r.TitlesOfParts)}function wk(e,r){var a=[],n=[],s=[],i=0,c,o=zl(Kc,"n"),l=zl(Yc,"n");if(e.Props)for(c=Ft(e.Props),i=0;i<c.length;++i)(Object.prototype.hasOwnProperty.call(o,c[i])?a:Object.prototype.hasOwnProperty.call(l,c[i])?n:s).push([c[i],e.Props[c[i]]]);if(e.Custprops)for(c=Ft(e.Custprops),i=0;i<c.length;++i)Object.prototype.hasOwnProperty.call(e.Props||{},c[i])||(Object.prototype.hasOwnProperty.call(o,c[i])?a:Object.prototype.hasOwnProperty.call(l,c[i])?n:s).push([c[i],e.Custprops[c[i]]]);var d=[];for(i=0;i<s.length;++i)s0.indexOf(s[i][0])>-1||Jh.indexOf(s[i][0])>-1||s[i][1]!=null&&d.push(s[i]);n.length&&Be.utils.cfb_add(r,"/�SummaryInformation",ud(n,xs.SI,l,Yc)),(a.length||d.length)&&Be.utils.cfb_add(r,"/�DocumentSummaryInformation",ud(a,xs.DSI,o,Kc,d.length?d:null,xs.UDI))}function ef(e,r){r||(r={}),Zo(r),_o(),r.codepage&&yo(r.codepage);var a,n;if(e.FullPaths){if(Be.find(e,"/encryption"))throw new Error("File is password-protected");a=Be.find(e,"!CompObj"),n=Be.find(e,"/Workbook")||Be.find(e,"/Book")}else{switch(r.type){case"base64":e=jr(kr(e));break;case"binary":e=jr(e);break;case"buffer":break;case"array":Array.isArray(e)||(e=Array.prototype.slice.call(e));break}Jt(e,0),n={content:e}}var s,i;if(a&&vk(a),r.bookProps&&!r.bookSheets)s={};else{var c=Je?"buffer":"array";if(n&&n.content)s=bk(n.content,r);else if((i=Be.find(e,"PerfectOffice_MAIN"))&&i.content)s=Qa.to_workbook(i.content,(r.type=c,r));else if((i=Be.find(e,"NativeContent_MAIN"))&&i.content)s=Qa.to_workbook(i.content,(r.type=c,r));else throw(i=Be.find(e,"MN0"))&&i.content?new Error("Unsupported Works 4 for Mac file"):new Error("Cannot find Workbook stream");r.bookVBA&&e.FullPaths&&Be.find(e,"/_VBA_PROJECT_CUR/VBA/dir")&&(s.vbaraw=O_(e))}var o={};return e.FullPaths&&jk(e,o,r),s.Props=s.Custprops=o,r.bookFiles&&(s.cfb=e),s}function kk(e,r){var a=r||{},n=Be.utils.cfb_new({root:"R"}),s="/Workbook";switch(a.bookType||"xls"){case"xls":a.bookType="biff8";case"xla":a.bookType||(a.bookType="xla");case"biff8":s="/Workbook",a.biff=8;break;case"biff5":s="/Book",a.biff=5;break;default:throw new Error("invalid type "+a.bookType+" for XLS CFB")}return Be.utils.cfb_add(n,s,tf(e,a)),a.biff==8&&(e.Props||e.Custprops)&&wk(e,n),a.biff==8&&e.vbaraw&&L_(n,Be.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var As={0:{f:Xj},1:{f:r2},2:{f:b2},3:{f:d2},4:{f:i2},5:{f:v2},6:{f:N2},7:{f:p2},8:{f:P2},9:{f:I2},10:{f:A2},11:{f:F2},12:{f:n2},13:{f:w2},14:{f:h2},15:{f:o2},16:{f:$0},17:{f:E2},18:{f:x2},19:{f:Do},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:Ew},40:{},42:{},43:{f:Ny},44:{f:ky},45:{f:Ty},46:{f:Fy},47:{f:Ay},48:{},49:{f:Jx},50:{},51:{f:u_},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:x0},62:{f:S2},63:{f:__},64:{f:K2},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:ir,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:q2},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:e2},148:{f:Jj,p:16},151:{f:M2},152:{},153:{f:Sw},154:{},155:{},156:{f:ww},157:{},158:{},159:{T:1,f:U1},160:{T:-1},161:{T:1,f:hn},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:D2},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:l_},336:{T:-1},337:{f:p_,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:Xc},357:{},358:{},359:{},360:{T:1},361:{},362:{f:m0},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:z2},427:{f:U2},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:W2},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:Zj},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:L2},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:Xc},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:F_},633:{T:1},634:{T:-1},635:{T:1,f:T_},636:{T:-1},637:{f:tg},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:hw},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:Y2},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}},ro={6:{f:nc},10:{f:wa},12:{f:Bt},13:{f:Bt},14:{f:Pt},15:{f:Pt},16:{f:nr},17:{f:Pt},18:{f:Pt},19:{f:Bt},20:{f:gd},21:{f:gd},23:{f:m0},24:{f:yd},25:{f:Pt},26:{},27:{},28:{f:Yv},29:{},34:{f:Pt},35:{f:vd},38:{f:nr},39:{f:nr},40:{f:nr},41:{f:nr},42:{f:Pt},43:{f:Pt},47:{f:oy},49:{f:wv},51:{f:Bt},60:{},61:{f:vv},64:{f:Pt},65:{f:jv},66:{f:Bt},77:{},80:{},81:{},82:{},85:{f:Bt},89:{},90:{},91:{},92:{f:cv},93:{f:Zv},94:{},95:{f:Pt},96:{},97:{},99:{f:Pt},125:{f:x0},128:{f:Bv},129:{f:lv},130:{f:Bt},131:{f:Pt},132:{f:Pt},133:{f:dv},134:{},140:{f:c1},141:{f:Bt},144:{},146:{f:d1},151:{},152:{},153:{},154:{},155:{},156:{f:Bt},157:{},158:{},160:{f:g1},161:{f:f1},174:{},175:{},176:{},177:{},178:{},180:{},181:{},182:{},184:{},185:{},189:{f:Dv},190:{f:Rv},193:{f:wa},197:{},198:{},199:{},200:{},201:{},202:{f:Pt},203:{},204:{},205:{},206:{},207:{},208:{},209:{},210:{},211:{},213:{},215:{},216:{},217:{},218:{f:Bt},220:{},221:{f:Pt},222:{},224:{f:Lv},225:{f:iv},226:{f:wa},227:{},229:{f:Jv},233:{},235:{},236:{},237:{},239:{},240:{},241:{},242:{},244:{},245:{},246:{},247:{},248:{},249:{},251:{},252:{f:hv},253:{f:Sv},255:{f:pv},256:{},259:{},290:{},311:{},312:{},315:{},317:{f:i0},318:{},319:{},320:{},330:{},331:{},333:{},334:{},335:{},336:{},337:{},338:{},339:{},340:{},351:{},352:{f:Pt},353:{f:wa},401:{},402:{},403:{},404:{},405:{},406:{},407:{},408:{},425:{},426:{},427:{},428:{},429:{},430:{f:Wv},431:{f:Pt},432:{},433:{},434:{},437:{},438:{f:r1},439:{f:Pt},440:{f:a1},441:{},442:{f:Hs},443:{},444:{f:Bt},445:{},446:{},448:{f:wa},449:{f:gv,r:2},450:{f:wa},512:{f:pd},513:{f:x1},515:{f:Uv},516:{f:Cv},517:{f:xd},519:{f:v1},520:{f:mv},523:{},545:{f:_d},549:{f:fd},566:{},574:{f:_v},638:{f:Pv},659:{},1048:{},1054:{f:Tv},1084:{},1212:{f:Gv},2048:{f:s1},2049:{},2050:{},2051:{},2052:{},2053:{},2054:{},2055:{},2056:{},2057:{f:oi},2058:{},2059:{},2060:{},2061:{},2062:{},2063:{},2064:{},2066:{},2067:{},2128:{},2129:{},2130:{},2131:{},2132:{},2133:{},2134:{},2135:{},2136:{},2137:{},2138:{},2146:{},2147:{r:12},2148:{},2149:{},2150:{},2151:{f:wa},2152:{},2154:{},2155:{},2156:{},2161:{},2162:{},2164:{},2165:{},2166:{},2167:{},2168:{},2169:{},2170:{},2171:{},2172:{f:u1,r:12},2173:{f:c_,r:12},2174:{},2175:{},2180:{},2181:{},2182:{},2183:{},2184:{},2185:{},2186:{},2187:{},2188:{f:Pt,r:12},2189:{},2190:{r:12},2191:{},2192:{},2194:{},2195:{},2196:{f:$v,r:12},2197:{},2198:{f:t_,r:12},2199:{},2200:{},2201:{},2202:{f:Xv,r:12},2203:{f:wa},2204:{},2205:{},2206:{},2207:{},2211:{f:xv},2212:{},2213:{},2214:{},2215:{},4097:{},4098:{},4099:{},4102:{},4103:{},4105:{},4106:{},4107:{},4108:{},4109:{},4116:{},4117:{},4118:{},4119:{},4120:{},4121:{},4122:{},4123:{},4124:{},4125:{},4126:{},4127:{},4128:{},4129:{},4130:{},4132:{},4133:{},4134:{f:Bt},4135:{},4146:{},4147:{},4148:{},4149:{},4154:{},4156:{},4157:{},4158:{},4159:{},4160:{},4161:{},4163:{},4164:{f:p1},4165:{},4166:{},4168:{},4170:{},4171:{},4174:{},4175:{},4176:{},4177:{},4187:{},4188:{f:l1},4189:{},4191:{},4192:{},4193:{},4194:{},4195:{},4196:{},4197:{},4198:{},4199:{},4200:{},0:{f:pd},1:{},2:{f:w1},3:{f:b1},4:{f:_1},5:{f:xd},7:{f:S1},8:{},9:{f:oi},11:{},22:{f:Bt},30:{f:Fv},31:{},32:{},33:{f:_d},36:{},37:{f:fd},50:{f:N1},62:{},52:{},67:{},68:{f:Bt},69:{},86:{},126:{},127:{f:y1},135:{},136:{},137:{},145:{},148:{},149:{},150:{},169:{},171:{},188:{},191:{},192:{},194:{},195:{},214:{f:C1},223:{},234:{},354:{},421:{},518:{f:nc},521:{f:oi},536:{f:yd},547:{f:vd},561:{},579:{},1030:{f:nc},1033:{f:oi},1091:{},2157:{},2163:{},2177:{},2240:{},2241:{},2242:{},2243:{},2244:{},2245:{},2246:{},2247:{},2248:{},2249:{},2250:{},2251:{},2262:{r:12},29282:{}};function Ne(e,r,a,n){var s=r;if(!isNaN(s)){var i=n||(a||[]).length||0,c=e.next(4);c.write_shift(2,s),c.write_shift(2,i),i>0&&Fo(a)&&e.push(a)}}function Sk(e,r,a,n){var s=(a||[]).length||0;if(s<=8224)return Ne(e,r,a,s);var i=r;if(!isNaN(i)){for(var c=a.parts||[],o=0,l=0,d=0;d+(c[o]||8224)<=8224;)d+=c[o]||8224,o++;var u=e.next(4);for(u.write_shift(2,i),u.write_shift(2,d),e.push(a.slice(l,l+d)),l+=d;l<s;){for(u=e.next(4),u.write_shift(2,60),d=0;d+(c[o]||8224)<=8224;)d+=c[o]||8224,o++;u.write_shift(2,d),e.push(a.slice(l,l+d)),l+=d}}}function $s(e,r,a){return e||(e=pe(7)),e.write_shift(2,r),e.write_shift(2,a),e.write_shift(2,0),e.write_shift(1,0),e}function Nk(e,r,a,n){var s=pe(9);return $s(s,e,r),c0(a,n||"b",s),s}function Ck(e,r,a){var n=pe(8+2*a.length);return $s(n,e,r),n.write_shift(1,a.length),n.write_shift(a.length,a,"sbcs"),n.l<n.length?n.slice(0,n.l):n}function Ek(e,r,a,n){if(r.v!=null)switch(r.t){case"d":case"n":var s=r.t=="d"?Vt(wt(r.v)):r.v;s==(s|0)&&s>=0&&s<65536?Ne(e,2,k1(a,n,s)):Ne(e,3,j1(a,n,s));return;case"b":case"e":Ne(e,5,Nk(a,n,r.v,r.t));return;case"s":case"str":Ne(e,4,Ck(a,n,(r.v||"").slice(0,255)));return}Ne(e,1,$s(null,a,n))}function Tk(e,r,a,n){var s=Array.isArray(r),i=at(r["!ref"]||"A1"),c,o="",l=[];if(i.e.c>255||i.e.r>16383){if(n.WTF)throw new Error("Range "+(r["!ref"]||"A1")+" exceeds format limit A1:IV16384");i.e.c=Math.min(i.e.c,255),i.e.r=Math.min(i.e.c,16383),c=Ke(i)}for(var d=i.s.r;d<=i.e.r;++d){o=Dt(d);for(var u=i.s.c;u<=i.e.c;++u){d===i.s.r&&(l[u]=Nt(u)),c=l[u]+o;var h=s?(r[d]||[])[u]:r[c];h&&Ek(e,h,d,u)}}}function Ak(e,r){for(var a=r||{},n=xr(),s=0,i=0;i<e.SheetNames.length;++i)e.SheetNames[i]==a.sheet&&(s=i);if(s==0&&a.sheet&&e.SheetNames[0]!=a.sheet)throw new Error("Sheet not found: "+a.sheet);return Ne(n,a.biff==4?1033:a.biff==3?521:9,Uo(e,16,a)),Tk(n,e.Sheets[e.SheetNames[s]],s,a),Ne(n,10),n.end()}function Fk(e,r,a){Ne(e,49,kv({sz:12,name:"Arial"},a))}
vendor: 1,895 bytes, line 536
536function Ik(e,r,a){r&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var s=n[0];s<=n[1];++s)r[s]!=null&&Ne(e,1054,Av(s,r[s],a))})}function Pk(e,r){var a=pe(19);a.write_shift(4,2151),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,1),a.write_shift(4,0),Ne(e,2151,a),a=pe(39),a.write_shift(4,2152),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,0),a.write_shift(4,0),a.write_shift(2,1),a.write_shift(4,4),a.write_shift(2,0),h0(at(r["!ref"]||"A1"),a),a.write_shift(4,4),Ne(e,2152,a)}function Dk(e,r){for(var a=0;a<16;++a)Ne(e,224,md({numFmtId:0,style:!0},0,r));r.cellXfs.forEach(function(n){Ne(e,224,md(n,0,r))})}function Rk(e,r){for(var a=0;a<r["!links"].length;++a){var n=r["!links"][a];Ne(e,440,n1(n)),n[1].Tooltip&&Ne(e,2048,i1(n))}delete r["!links"]}function Ok(e,r){if(r){var a=0;r.forEach(function(n,s){++a<=256&&n&&Ne(e,125,h1(Xi(s,n),s))})}}function Lk(e,r,a,n,s){var i=16+Ba(s.cellXfs,r,s);if(r.v==null&&!r.bf){Ne(e,513,sn(a,n,i));return}if(r.bf)Ne(e,6,lj(r,a,n,s,i));else switch(r.t){case"d":case"n":var c=r.t=="d"?Vt(wt(r.v)):r.v;Ne(e,515,Hv(a,n,c,i));break;case"b":case"e":Ne(e,517,zv(a,n,r.v,i,s,r.t));break;case"s":case"str":if(s.bookSST){var o=Ko(s.Strings,r.v,s.revStrings);Ne(e,253,Nv(a,n,o,i))}else Ne(e,516,Ev(a,n,(r.v||"").slice(0,255),i,s));break;default:Ne(e,513,sn(a,n,i))}}function Bk(e,r,a){var n=xr(),s=a.SheetNames[e],i=a.Sheets[s]||{},c=(a||{}).Workbook||{},o=(c.Sheets||[])[e]||{},l=Array.isArray(i),d=r.biff==8,u,h="",f=[],m=at(i["!ref"]||"A1"),x=d?65536:16384;if(m.e.c>255||m.e.r>=x){if(r.WTF)throw new Error("Range "+(i["!ref"]||"A1")+" exceeds format limit A1:IV16384");m.e.c=Math.min(m.e.c,255),m.e.r=Math.min(m.e.c,x-1)}Ne(n,2057,Uo(a,16,r)),Ne(n,13,Ir(1)),Ne(n,12,Ir(100)),Ne(n,15,lr(!0)),Ne(n,17,lr(!1)),Ne(n,16,an(.001)),Ne(n,95,lr(!0)),Ne(n,42,lr(!1)),Ne(n,43,lr(!1)),Ne(n,130,Ir(1)),Ne(n,128,Mv()
vendor: 4,236 bytes, line 536
536),Ne(n,131,lr(!1)),Ne(n,132,lr(!1)),d&&Ok(n,i["!cols"]),Ne(n,512,Iv(m,r)),d&&(i["!links"]=[]);for(var p=m.s.r;p<=m.e.r;++p){h=Dt(p);for(var g=m.s.c;g<=m.e.c;++g){p===m.s.r&&(f[g]=Nt(g)),u=f[g]+h;var w=l?(i[p]||[])[g]:i[u];w&&(Lk(n,w,p,g,r),d&&w.l&&i["!links"].push([u,w.l]))}}var S=o.CodeName||o.name||s;return d&&Ne(n,574,bv((c.Views||[])[0])),d&&(i["!merges"]||[]).length&&Ne(n,229,Qv(i["!merges"])),d&&Rk(n,i),Ne(n,442,o0(S)),d&&Pk(n,i),Ne(n,10),n.end()}function Mk(e,r,a){var n=xr(),s=(e||{}).Workbook||{},i=s.Sheets||[],c=s.WBProps||{},o=a.biff==8,l=a.biff==5;if(Ne(n,2057,Uo(e,5,a)),a.bookType=="xla"&&Ne(n,135),Ne(n,225,o?Ir(1200):null),Ne(n,193,zg(2)),l&&Ne(n,191),l&&Ne(n,192),Ne(n,226),Ne(n,92,ov("SheetJS",a)),Ne(n,66,Ir(o?1200:1252)),o&&Ne(n,353,Ir(0)),o&&Ne(n,448),Ne(n,317,m1(e.SheetNames.length)),o&&e.vbaraw&&Ne(n,211),o&&e.vbaraw){var d=c.CodeName||"ThisWorkbook";Ne(n,442,o0(d))}Ne(n,156,Ir(17)),Ne(n,25,lr(!1)),Ne(n,18,lr(!1)),Ne(n,19,Ir(0)),o&&Ne(n,431,lr(!1)),o&&Ne(n,444,Ir(0)),Ne(n,61,yv()),Ne(n,64,lr(!1)),Ne(n,141,Ir(0)),Ne(n,34,lr(gw(e)=="true")),Ne(n,14,lr(!0)),o&&Ne(n,439,lr(!1)),Ne(n,218,Ir(0)),Fk(n,e,a),Ik(n,e.SSF,a),Dk(n,a),o&&Ne(n,352,lr(!1));var u=n.end(),h=xr();o&&Ne(h,140,o1()),o&&a.Strings&&Sk(h,252,fv(a.Strings)),Ne(h,10);var f=h.end(),m=xr(),x=0,p=0;for(p=0;p<e.SheetNames.length;++p)x+=(o?12:11)+(o?2:1)*e.SheetNames[p].length;var g=u.length+x+f.length;for(p=0;p<e.SheetNames.length;++p){var w=i[p]||{};Ne(m,133,uv({pos:g,hs:w.Hidden||0,dt:0,name:e.SheetNames[p]},a)),g+=r[p].length}var S=m.end();if(x!=S.length)throw new Error("BS8 "+x+" != "+S.length);var b=[];return u.length&&b.push(u),S.length&&b.push(S),f.length&&b.push(f),Gt(b)}function zk(e,r){var a=r||{},n=[];e&&!e.SSF&&(e.SSF=kt(He)),e&&e.SSF&&(Vn(),Ui(e.SSF),a.revssf=Wi(e.SSF),a.revssf[e.SSF[65535]]=0,a.ssf=e.SSF),a.Strings=[],a.Strings.Count=0,a.Strings.Unique=0,el(a),a.cellXfs=[],Ba(a.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var s=0;s<e.SheetNames.length;++s)n[n.length]=Bk(s,a,e);return n.unshift(Mk(e,n,a)),Gt(n)}function tf(e,r){for(var a=0;a<=e.SheetNames.length;++a){var n=e.Sheets[e.SheetNames[a]];if(!(!n||!n["!ref"])){var s=vr(n["!ref"]);s.e.c>255&&typeof console<"u"&&console.error&&console.error("Worksheet '"+e.SheetNames[a]+"' extends beyond column IV (255). Data may be lost.")}}var i=r||{};switch(i.biff||2){case 8:case 5:return zk(e,r);case 4:case 3:case 2:return Ak(e,r)}throw new Error("invalid type "+i.bookType+" for BIFF")}function Ad(e,r){var a=r||{},n=a.dense?[]:{};e=e.replace(/<!--.*?-->/g,"");var s=e.match(/<table/i);if(!s)throw new Error("Invalid HTML: could not find <table>");var i=e.match(/<\/table/i),c=s.index,o=i&&i.index||e.length,l=kx(e.slice(c,o),/(:?<tr[^>]*>)/i,"<tr>"),d=-1,u=0,h=0,f=0,m={s:{r:1e7,c:1e7},e:{r:0,c:0}},x=[];for(c=0;c<l.length;++c){var p=l[c].trim(),g=p.slice(0,3).toLowerCase();if(g=="<tr"){if(++d,a.sheetRows&&a.sheetRows<=d){--d;break}u=0;continue}if(!(g!="<td"&&g!="<th")){var w=p.split(/<\/t[dh]>/i);for(o=0;o<w.length;++o){var S=w[o].trim();if(S.match(/<t[dh]/i)){for(var b=S,j=0;b.charAt(0)=="<"&&(j=b.indexOf(">"))>-1;)b=b.slice(j+1);for(var k=0;k<x.length;++k){var N=x[k];N.s.c==u&&N.s.r<d&&d<=N.e.r&&(u=N.e.c+1,k=-1)}var C=qe(S.slice(0,S.indexOf(">")));f=C.colspan?+C.colspan:1,((h=+C.rowspan)>1||f>1)&&x.push({s:{r:d,c:u},e:{r:d+(h||1)-1,c:u+f-1}});var P=C.t||C["data-t"]||"";if(!b.length){u+=f;continue}if(b=Sh(b),m.s.r>d&&(m.s.r=d),m.e.r<d&&(m.e.r=d),m.s.c>u&&(m.s.c=u),m.e.c<u&&(m.e.c=u),!b.length){u+=f;continue}var T={t:"s",v:b};a.raw||!b.trim().length||P=="s"||(b==="TRUE"?T={t:"b",v:!0}:b==="FALSE"?T={t:"b",v:!1}:isNaN($r(b))?isNaN(On(b).getDate())||(T={t:"d",v:wt(b)},a.cellDates||(T={t:"n",v:Vt(T.v)}),T.z=a.dateNF||He[14]):T={t:"n",v:$r(b)}),a.dense?(n[d]||(n[d]=[]),n[d][u]=T):n[Ve({r:d,c:u})]=T,u+=f}}}}return n["!ref"]=Ke(m),x.length&&(n["!merges"]=x),n}function Uk(e,r,a,n){for(var s=e["!merges"]||[],i=[],c=r.s.c;c<=r.e.c;++c){for(var o=0,l=0,d=0;d<s.length;++d)if(!(s[d].s.r>a||s[d].s.c>c)&&!(s[d].e.r<a||s[d].e.c<c)){if(s[d].s.r<a||s[d].s.c<c){o=-1;break}o=s[d].e.r-s[d].s.r+1,l=s[d].e.c-s[d].s.c+1;break}if(!(o<0)){var u=Ve({r:a,c}),h=n.dense?(e[a]||[])[c]:e[u],f=h&&h.v!=null&&(h.h||Eo(h.w||(va(h),h.w)||""))||"",m={};o>
vendor: 8,444 bytes, lines 536-537
5361&&(m.rowspan=o),l>1&&(m.colspan=l),n.editable?f='<span contenteditable="true">'+f+"</span>":h&&(m["data-t"]=h&&h.t||"z",h.v!=null&&(m["data-v"]=h.v),h.z!=null&&(m["data-z"]=h.z),h.l&&(h.l.Target||"#").charAt(0)!="#"&&(f='<a href="'+h.l.Target+'">'+f+"</a>")),m.id=(n.id||"sjs")+"-"+u,i.push(Se("td",f,m))}}var x="<tr>";return x+i.join("")+"</tr>"}var Hk='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',Wk="</body></html>";function Vk(e,r){var a=e.match(/<table[\s\S]*?>[\s\S]*?<\/table>/gi);if(!a||a.length==0)throw new Error("Invalid HTML: could not find <table>");if(a.length==1)return La(Ad(a[0],r),r);var n=al();return a.forEach(function(s,i){nl(n,Ad(s,r),"Sheet"+(i+1))}),n}function qk(e,r,a){var n=[];return n.join("")+"<table"+(a&&a.id?' id="'+a.id+'"':"")+">"}function rf(e,r){var a=r||{},n=a.header!=null?a.header:Hk,s=a.footer!=null?a.footer:Wk,i=[n],c=vr(e["!ref"]);a.dense=Array.isArray(e),i.push(qk(e,c,a));for(var o=c.s.r;o<=c.e.r;++o)i.push(Uk(e,c,o,a));return i.push("</table>"+s),i.join("")}function af(e,r,a){var n=a||{},s=0,i=0;if(n.origin!=null)if(typeof n.origin=="number")s=n.origin;else{var c=typeof n.origin=="string"?Ct(n.origin):n.origin;s=c.r,i=c.c}var o=r.getElementsByTagName("tr"),l=Math.min(n.sheetRows||1e7,o.length),d={s:{r:0,c:0},e:{r:s,c:i}};if(e["!ref"]){var u=vr(e["!ref"]);d.s.r=Math.min(d.s.r,u.s.r),d.s.c=Math.min(d.s.c,u.s.c),d.e.r=Math.max(d.e.r,u.e.r),d.e.c=Math.max(d.e.c,u.e.c),s==-1&&(d.e.r=s=u.e.r+1)}var h=[],f=0,m=e["!rows"]||(e["!rows"]=[]),x=0,p=0,g=0,w=0,S=0,b=0;for(e["!cols"]||(e["!cols"]=[]);x<o.length&&p<l;++x){var j=o[x];if(Fd(j)){if(n.display)continue;m[p]={hidden:!0}}var k=j.children;for(g=w=0;g<k.length;++g){var N=k[g];if(!(n.display&&Fd(N))){var C=N.hasAttribute("data-v")?N.getAttribute("data-v"):N.hasAttribute("v")?N.getAttribute("v"):Sh(N.innerHTML),P=N.getAttribute("data-z")||N.getAttribute("z");for(f=0;f<h.length;++f){var T=h[f];T.s.c==w+i&&T.s.r<p+s&&p+s<=T.e.r&&(w=T.e.c+1-i,f=-1)}b=+N.getAttribute("colspan")||1,((S=+N.getAttribute("rowspan")||1)>1||b>1)&&h.push({s:{r:p+s,c:w+i},e:{r:p+s+(S||1)-1,c:w+i+(b||1)-1}});var L={t:"s",v:C},M=N.getAttribute("data-t")||N.getAttribute("t")||"";C!=null&&(C.length==0?L.t=M||"z":n.raw||C.trim().length==0||M=="s"||(C==="TRUE"?L={t:"b",v:!0}:C==="FALSE"?L={t:"b",v:!1}:isNaN($r(C))?isNaN(On(C).getDate())||(L={t:"d",v:wt(C)},n.cellDates||(L={t:"n",v:Vt(L.v)}),L.z=n.dateNF||He[14]):L={t:"n",v:$r(C)})),L.z===void 0&&P!=null&&(L.z=P);var E="",W=N.getElementsByTagName("A");if(W&&W.length)for(var ee=0;ee<W.length&&!(W[ee].hasAttribute("href")&&(E=W[ee].getAttribute("href"),E.charAt(0)!="#"));++ee);E&&E.charAt(0)!="#"&&(L.l={Target:E}),n.dense?(e[p+s]||(e[p+s]=[]),e[p+s][w+i]=L):e[Ve({c:w+i,r:p+s})]=L,d.e.c<w+i&&(d.e.c=w+i),w+=b}}++p}return h.length&&(e["!merges"]=(e["!merges"]||[]).concat(h)),d.e.r=Math.max(d.e.r,p-1+s),e["!ref"]=Ke(d),p>=l&&(e["!fullref"]=Ke((d.e.r=o.length-x+p-1+s,d))),e}function nf(e,r){var a=r||{},n=a.dense?[]:{};return af(n,e,r)}function $k(e,r){return La(nf(e,r),r)}function Fd(e){var r="",a=Gk(e);return a&&(r=a(e).getPropertyValue("display")),r||(r=e.style&&e.style.display),r==="none"}function Gk(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}function Xk(e){var r=e.replace(/[\t\r\n]/g," ").trim().replace(/ +/g," ").replace(/<text:s\/>/g," ").replace(/<text:s text:c="(\d+)"\/>/g,function(n,s){return Array(parseInt(s,10)+1).join(" ")}).replace(/<text:tab[^>]*\/>/g," ").replace(/<text:line-break\/>/g,` 537`),a=rt(r.replace(/<[^>]*>/g,""));return[a]}var Id={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"],era:["e","ee"],quarter:["\\Qm",'m\\"th quarter"']};function sf(e,r){var a=r||{},n=To(e),s=[],i,c,o={name:""},l="",d=0,u,h,f={},m=[],x=a.dense?[]:{},p,g,w={value:""},S="",b=0,j=[],k=-1,N=-1,C={s:{r:1e6,c:1e7},e:{r:0,c:0}},P=0,T={},L=[],M={},E=0,W=0,ee=[],ce=1,ue=1,te=[],fe={Names:[]},q={},J=["",""],le=[],A={},V="",I=0,D=!1,K=!1,z=0;for(ks.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");p=ks.exec(n);)switch(p[3]=p[3].replace(/_.*$/,"")){case"table":case"å·¥ä½è¡¨":p[1]==="/"?(C.e.c>=C.s.c&&C.e.r>=C.s.r?x["!ref"]=Ke(C):x["!ref"]="A1:A1",a.sheetRows>0&&a.sheetRows<=C.e.r&&(x["!fullref"]=x["!ref"],C.e.r=a.sheetRows-1,x["!ref"]=Ke(C)),L.length&&(x["!merges"]=L),ee.length&&(x["!rows"]=ee),u.name=u.åç§°||u.name,typeof JSON<"u"&&JSON.stringify(u),m.push(u.name),f[u.name]=x,K=!1):p[0].charAt(p[0].length-2)!=="/"&&(u=qe(p[0],!1),k=N=-1,C.s.r=C.s.c=1e7,C.e.r=C.e.c=0,x=a.dense?[]:{},L=[],ee=[],K=!0);break;case"table-row-group":p[1]==="/"?--P:++P;break;case"table-row":case"è¡":if(p[1]==="/"){k+=ce,ce=1;break}if(h=qe(p[0],!1),h.è¡å·?k=h.è¡å·-1:k==-1&&(k=0),ce=+h["number-rows-repeated"]||1,ce<10)for(z=0;z<ce;++z)P>0&&(ee[k+z]={level:P});N=-1;break;case"covered-table-cell":p[1]!=="/"&&++N,a.sheetStubs&&(a.dense?(x[k]||(x[k]=[]),x[k][N]={t:"z"}):x[Ve({r:k,c:N})]={t:"z"}),S="",j=[];break;case"table-cell":case"æ°æ®":if(p[0].charAt(p[0].length-2)==="/")++N,w=qe(p[0],!1),ue=parseInt(w["number-columns-repeated"]||"1",10),g={t:"z",v:null},w.formula&&a.cellFormula!=!1&&(g.f=Cd(rt(w.formula))),(w.æ°æ®ç±»å||w["value-type"])=="string"&&(g.t="s",g.v=rt(w["string-value"]||""),a.dense?(x[k]||(x[k]=[]),x[k][N]=g):x[Ve({r:k,c:N})]=g),N+=ue-1;else if(p[1]!=="/"){++N,S="",b=0,j=[],ue=1;var Y=ce?k+ce-1:k;if(N>C.e.c&&(C.e.c=N),N<C.s.c&&(C.s.c=N),k<C.s.r&&(C.s.r=k),Y>C.e.r&&(C.e.r=Y),w=qe(p[0],!1),le=[],A={},g={t:w.æ°æ®ç±»å||w["value-type"],v:null},a.cellFormula)if(w.formula&&(w.formula=rt(w.formula)),w["number-matrix-columns-spanned"]&&w["number-matrix-rows-spanned"]&&(E=parseInt(w["number-matrix-rows-spanned"],10)||0,W=parseInt(w["number-matrix-columns-spanned"],10)||0,M={s:{r:k,c:N},e:{r:k+E-1,c:N+W-1}},g.F=Ke(M),te.push([M,g.F])),w.formula)g.f=Cd(w.formula);else for(z=0;z<te.length;++z)k>=te[z][0].s.r&&k<=te[z][0].e.r&&N>=te[z][0].s.c&&N<=te[z][0].e.c&&(g.F=te[z][1]);switch((w["number-columns-spanned"]||w["number-rows-spanned"])&&(E=parseInt(w["number-rows-spanned"],10)||0,W=parseInt(w["number-columns-spanned"],10)||0,M={s:{r:k,c:N},e:{r:k+E-1,c:N+W-1}},L.push(M)),w["number-columns-repeated"]&&(ue=parseInt(w["number-columns-repeated"],10)),g.t){case"boolean":g.t="b",g.v=jt(w["boolean-value"]);break;case"float":g.t="n",g.v=parseFloat(w.value);break;case"percentage":g.t="n",g.v=parseFloat(w.value);break;case"currency":g.t="n",g.v=parseFloat(w.value);break;case"date":g.t="d",g.v=wt(w["date-value"]),a.cellDates||(g.t="n",g.v=Vt(g.v)),g.z="m/d/yy";break;case"time":g.t="n",g.v=bx(w["time-value"])/86400,a.cellDates&&(g.t="d",g.v=Vi(g.v)),g.z="HH:MM:SS";break;case"number":g.t="n",g.v=parseFloat(w.æ°æ®æ°å¼);break;default:if(g.t==="string"||g.t==="text"||!g.t)g.t="s",w["string-value"]!=null&&(S=rt(w["string-value"]),j=[]);else throw new Error("Unsupported value type "+g.t)}}else{if(D=!1,g.t==="s"&&(g.v=S||"",j.length&&(g.R=j),D=b==0),q.Target&&(g.l=q),le.length>0&&(g.c=le,le=[]),S&&a.cellText!==!1&&(g.w=S),D&&(g.t="z",delete g.v),(!D||a.sheetStubs)&&!(a.sheetRows&&a.sheetRows<=k))for(var re=0;re<ce;++re){if(ue=parseInt(w["number-columns-repeated"]||"1",10),a.dense)for(x[k+re]||(x[k+re]=[]),x[k+re][N]=re==0?g:kt(g);--ue>0;)x[k+re][N+ue]=kt(g);else for(x[Ve({r:k+re,c:N})]=g;--ue>0;)x[Ve({r:k+re,c:N+ue})]=kt(g);C.e.c<=N&&(C.e.c=N)}ue=parseInt(w["number-columns-repeated"]||"1",10),N+=ue-1,ue=0,g={},S="",j=[]}q={};break;case"document":case"document-content":case"çµåè¡¨æ ¼ææ¡£":case"spreadsheet":case"主ä½":case"scripts":case"styles":case"font-face-decls":case"master-styles":if(p[1]==="/"){if((i=s.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&s.push([p[3],!0]);break;case"annotation":if(p[1]==="/"){if((i=s.pop())[0]!==p[3])throw"Bad state: "+i;A.t=S,j.length&&(A.R=j),A.a=V,le.push(A)}else p[0].charAt(p[0].length-2)!=="/"&&s.push([p[3],!1]);V="",I=0,S="",b=0,j=[];break;case"creator":p[1]==="/"?V=n.slice(I,p.index):I=p.index+p[0].length;break;case"meta":case"å æ°æ®":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-
537pilot-tables":case"list-style":case"form":case"dde-links":case"event-listeners":case"chart":if(p[1]==="/"){if((i=s.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&s.push([p[3],!1]);S="",b=0,j=[];break;case"scientific-number":break;case"currency-symbol":break;case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if(p[1]==="/"){if(T[o.name]=l,(i=s.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&(l="",o=qe(p[0],!1),s.push([p[3],!0]));break;case"script":break;case"libraries":break;case"automatic-styles":break;case"default-style":case"page-layout":break;case"style":break;case"map":break;case"font-face":break;case"paragraph-properties":break;case"table-properties":break;case"table-column-properties":break;case"table-row-properties":break;case"table-cell-properties":break;case"number":switch(s[s.length-1][0]){case"time-style":case"date-style":c=qe(p[0],!1),l+=Id[p[3]][c.style==="long"?1:0];break}break;case"fraction":break;case"day":case"month":case"year":case"era":case"day-of-week":case"week-of-year":case"quarter":case"hours":case"minutes":case"seconds":case"am-pm":switch(s[s.length-1][0]){case"time-style":case"date-style":c=qe(p[0],!1),l+=Id[p[3]][c.style==="long"?1:0];break}break;case"boolean-style":break;case"boolean":break;case"text-style":break;case"text":if(p[0].slice(-2)==="/>")break;if(p[1]==="/")switch(s[s.length-1][0]){case"number-style":case"date-style":case"time-style":l+=n.slice(d,p.index);break}else d=p.index+p[0].length;break;case"named-range":c=qe(p[0],!1),J=sc(c["cell-range-address"]);var oe={Name:c.name,Ref:J[0]+"!"+J[1]};K&&(oe.Sheet=m.length),fe.Names.push(oe);break;case"text-content":break;case"text-properties":break;case"embedded-text":break;case"body":case"çµåè¡¨æ ¼":break;case"forms":break;case"table-column":break;case"table-header-rows":break;case"table-rows":break;case"table-column-group":break;case"table-header-columns":break;case"table-columns":break;case"null-date":break;case"graphic-properties":break;case"calculation-settings":break;case"named-expressions":break;case"label-range":break;case"label-ranges":break;case"named-expression":break;case"sort":break;case"sort-by":break;case"sort-groups":break;case"tab":break;case"line-break":break;case"span":break;case"p":case"ææ¬ä¸²":if(["master-styles"].indexOf(s[s.length-1][0])>-1)break;if(p[1]==="/"&&(!w||!w["string-value"])){var Ce=Xk(n.slice(b,p.index));S=(S.length>0?S+` 538`:"")+Ce[0]}else qe(p[0],!1),b=p.index+p[0].length;break;case"s":break;case"database-range":if(p[1]==="/")break;try{J=sc(qe(p[0])["target-range-address"]),f[J[0]]["!autofilter"]={ref:J[1]}}catch{}break;case"date":break;case"object":break;case"title":case"æ é¢":break;case"desc":break;case"binary-data":break;case"table-source":break;case"scenario":break;case"iteration":break;case"content-validations":break;case"content-validation":break;case"help-message":break;case"error-message":break;case"database-ranges":break;case"filter":break;case"filter-and":break;case"filter-or":break;case"filter-condition":break;case"list-level-style-bullet":break;case"list-level-style-number":break;case"list-level-properties":break;case"sender-firstname":case"sender-lastname":case"sender-initials":case"sender-title":case"sender-position":case"sender-email":case"sender-phone-private":case"sender-fax":case"sender-company":case"sender-phone-work":case"sender-street":case"sender-city":case"sender-postal-code":case"sender-country":case"sender-state-or-province":case"author-name":case"author-initials":case"chapter":case"file-name":case"template-name":case"sheet-name":break;case"event-listener":break;case"initial-creator":case"creation-date":case"print-date":case"generator":case"document-statistic":case"user-defined":case"editing-duration":case"editing-cycles":break;case"config-item":break;case"page-number":break;case"page-count":break;case"time":break;case"cell-range-source":break;case"detective":break;case"operation":break;case"highlighted-range":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-
538pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":break;case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":break;case"properties":break;case"property":break;case"a":if(p[1]!=="/"){if(q=qe(p[0],!1),!q.href)break;q.Target=rt(q.href),delete q.href,q.Target.charAt(0)=="#"&&q.Target.indexOf(".")>-1?(J=sc(q.Target.slice(1)),q.Target="#"+J[0]+"!"+J[1]):q.Target.match(/^\.\.[\\\/]/)&&(q.Target=q.Target.slice(3))}break;case"table-protection":break;case"data-pilot-grand-total":break;case"office-document-common-attrs":break;default:switch(p[2]){case"dc:":case"calcext:":case"loext:":case"ooo:":case"chartooo:":case"draw:":case"style:":case"chart:":case"form:":case"uof:":case"表:":case"å:":break;default:if(a.WTF)throw new Error(p)}}var F={Sheets:f,SheetNames:m,Workbook:fe};return a.bookSheets&&delete F.Sheets,F}function Pd(e,r){r=r||{},Fr(e,"META-INF/manifest.xml")&&bg(Lt(e,"META-INF/manifest.xml"),r);var a=wr(e,"content.xml");if(!a)throw new Error("Missing content.xml in ODS / UOF file");var n=sf(xt(a),r);return Fr(e,"meta.xml")&&(n.Props=Kh(Lt(e,"meta.xml"))),n}function Dd(e,r){return sf(e,r)}var Kk=(function(){var e=["<office:master-styles>",'<style:master-page style:name="mp1" style:page-layout-name="mp1">',"<style:header/>",'<style:header-left style:display="false"/>',"<style:footer/>",'<style:footer-left style:display="false"/>',"</style:master-page>","</office:master-styles>"].join(""),r="<office:document-styles "+ws({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";return function(){return Rt+r}})(),Rd=(function(){var e=function(i){return ht(i).replace(/ +/g,function(c){return'<text:s text:c="'+c.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},r=` <table:table-cell /> 539`,a=` <table:covered-table-cell/> 540`,n=function(i,c,o){var l=[];l.push(' <table:table table:name="'+ht(c.SheetNames[o])+`" table:style-name="ta1"> 541`);var d=0,u=0,h=vr(i["!ref"]||"A1"),f=i["!merges"]||[],m=0,x=Array.isArray(i);if(i["!cols"])for(u=0;u<=h.e.c;++u)l.push(" <table:table-column"+(i["!cols"][u]?' table:style-name="co'+i["!cols"][u].ods+'"':"")+`></table:table-column> 542`);var p="",g=i["!rows"]||[];for(d=0;d<h.s.r;++d)p=g[d]?' table:style-name="ro'+g[d].ods+'"':"",l.push(" <table:table-row"+p+`></table:table-row> 543`);for(;d<=h.e.r;++d){for(p=g[d]?' table:style-name="ro'+g[d].ods+'"':"",l.push(" <table:table-row"+p+`> 544`),u=0;u<h.s.c;++u)l.push(r);for(;u<=h.e.c;++u){var w=!1,S={},b="";for(m=0;m!=f.length;++m)if(!(f[m].s.c>u)&&!(f[m].s.r>d)&&!(f[m].e.c<u)&&!(f[m].e.r<d)){(f[m].s.c!=u||f[m].s.r!=d)&&(w=!0),S["table:number-columns-spanned"]=f[m].e.c-f[m].s.c+1,S["table:number-rows-spanned"]=f[m].e.r-f[m].s.r+1;break}if(w){l.push(a);continue}var j=Ve({r:d,c:u}),k=x?(i[d]||[])[u]:i[j];if(k&&k.f&&(S["table:formula"]=ht(mj(k.f)),k.F&&k.F.slice(0,j.length)==j)){var N=vr(k.F);S["table:number-matrix-columns-spanned"]=N.e.c-N.s.c+1,S["table:number-matrix-rows-spanned"]=N.e.r-N.s.r+1}if(!k){l.push(r);continue}switch(k.t){case"b":b=k.v?"TRUE":"FALSE",S["office:value-type"]="boolean",S["office:boolean-value"]=k.v?"true":"false";break;case"n":b=k.w||String(k.v||0),S["office:value-type"]="float",S["office:value"]=k.v||0;break;case"s":case"str":b=k.v==null?"":k.v,S["office:value-type"]="string";break;case"d":b=k.w||wt(k.v).toISOString(),S["office:value-type"]="date",S["office:date-value"]=wt(k.v).toISOString(),S["table:style-name"]="ce1";break;default:l.push(r);continue}var C=e(b);if(k.l&&k.l.Target){var P=k.l.Target;P=P.charAt(0)=="#"?"#"+xj(P.slice(1)):P,P.charAt(0)!="#"&&!P.match(/^\w+:/)&&(P="../"+P),C=Se("text:a",C,{"xlink:href":P.replace(/&/g,"&")})}l.push(" "+Se("table:table-cell",Se("text:p",C,{}),S)+` 545`)}l.push(` </table:table-row> 546`)}return l.push(` </table:table> 547`),l.join("")},s=function(i,c){i.push(` <office:automatic-styles> 548`),i.push(` <number:date-style style:name="N37" number:automatic-order="true"> 549`),i.push(` <number:month number:style="long"/> 550`),i.push(` <number:text>/</number:text> 551`),i.push(` <number:day number:style="long"/> 552`),i.push(` <number:text>/</number:text> 553`),i.push(` <number:year/> 554`),i.push(` </number:date-style> 555`);var o=0;c.SheetNames.map(function(d){return c.Sheets[d]}
vendor: 14,977 bytes, lines 555-572
555).forEach(function(d){if(d&&d["!cols"]){for(var u=0;u<d["!cols"].length;++u)if(d["!cols"][u]){var h=d["!cols"][u];if(h.width==null&&h.wpx==null&&h.wch==null)continue;Ia(h),h.ods=o;var f=d["!cols"][u].wpx+"px";i.push(' <style:style style:name="co'+o+`" style:family="table-column"> 556`),i.push(' <style:table-column-properties fo:break-before="auto" style:column-width="'+f+`"/> 557`),i.push(` </style:style> 558`),++o}}});var l=0;c.SheetNames.map(function(d){return c.Sheets[d]}).forEach(function(d){if(d&&d["!rows"]){for(var u=0;u<d["!rows"].length;++u)if(d["!rows"][u]){d["!rows"][u].ods=l;var h=d["!rows"][u].hpx+"px";i.push(' <style:style style:name="ro'+l+`" style:family="table-row"> 559`),i.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+h+`"/> 560`),i.push(` </style:style> 561`),++l}}}),i.push(` <style:style style:name="ta1" style:family="table" style:master-page-name="mp1"> 562`),i.push(` <style:table-properties table:display="true" style:writing-mode="lr-tb"/> 563`),i.push(` </style:style> 564`),i.push(` <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/> 565`),i.push(` </office:automatic-styles> 566`)};return function(c,o){var l=[Rt],d=ws({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),u=ws({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});o.bookType=="fods"?(l.push("<office:document"+d+u+`> 567`),l.push(Xh().replace(/office:document-meta/g,"office:meta"))):l.push("<office:document-content"+d+`> 568`),s(l,c),l.push(` <office:body> 569`),l.push(` <office:spreadsheet> 570`);for(var h=0;h!=c.SheetNames.length;++h)l.push(n(c.Sheets[c.SheetNames[h]],c,h));return l.push(` </office:spreadsheet> 571`),l.push(` </office:body> 572`),o.bookType=="fods"?l.push("</office:document>"):l.push("</office:document-content>"),l.join("")}})();function cf(e,r){if(r.bookType=="fods")return Rd(e,r);var a=So(),n="",s=[],i=[];return n="mimetype",Ye(a,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",Ye(a,n,Rd(e,r)),s.push([n,"text/xml"]),i.push([n,"ContentFile"]),n="styles.xml",Ye(a,n,Kk(e,r)),s.push([n,"text/xml"]),i.push([n,"StylesFile"]),n="meta.xml",Ye(a,n,Rt+Xh()),s.push([n,"text/xml"]),i.push([n,"MetadataFile"]),n="manifest.rdf",Ye(a,n,kg(i)),s.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",Ye(a,n,jg(s)),a}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function cn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ao(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):xt(Oa(e))}function Yk(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):jr(ra(e))}function Jk(e,r){e:for(var a=0;a<=e.length-r.length;++a){for(var n=0;n<r.length;++n)if(e[a+n]!=r[n])continue e;return!0}return!1}function Da(e){var r=e.reduce(function(s,i){return s+i.length},0),a=new Uint8Array(r),n=0;return e.forEach(function(s){a.set(s,n),n+=s.length}),a}function Od(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function Qk(e,r){for(var a=(e[r+15]&127)<<7|e[r+14]>>1,n=e[r+14]&1,s=r+13;s>=r;--s)n=n*256+e[s];return(e[r+15]&128?-n:n)*Math.pow(10,a-6176)}function Zk(e,r,a){var n=Math.floor(a==0?0:Math.LOG10E*Math.log(Math.abs(a)))+6176-20,s=a/Math.pow(10,n-6176);e[r+15]|=n>>7,e[r+14]|=(n&127)<<1;for(var i=0;s>=1;++i,s/=256)e[r+i]=s&255;e[r+15]|=a>=0?0:128}function Fs(e,r){var a=r?r[0]:0,n=e[a]&127;e:if(e[a++]>=128&&(n|=(e[a]&127)<<7,e[a++]<128||(n|=(e[a]&127)<<14,e[a++]<128)||(n|=(e[a]&127)<<21,e[a++]<128)||(n+=(e[a]&127)*Math.pow(2,28),++a,e[a++]<128)||(n+=(e[a]&127)*Math.pow(2,35),++a,e[a++]<128)||(n+=(e[a]&127)*Math.pow(2,42),++a,e[a++]<128)))break e;return r&&(r[0]=a),n}function dt(e){var r=new Uint8Array(7);r[0]=e&127;var a=1;e:if(e>127){if(r[a-1]|=128,r[a]=e>>7&127,++a,e<=16383||(r[a-1]|=128,r[a]=e>>14&127,++a,e<=2097151)||(r[a-1]|=128,r[a]=e>>21&127,++a,e<=268435455)||(r[a-1]|=128,r[a]=e/256>>>21&127,++a,e<=34359738367)||(r[a-1]|=128,r[a]=e/65536>>>21&127,++a,e<=4398046511103))break e;r[a-1]|=128,r[a]=e/16777216>>>21&127,++a}return r.slice(0,a)}function At(e){var r=0,a=e[r]&127;e:if(e[r++]>=128){if(a|=(e[r]&127)<<7,e[r++]<128||(a|=(e[r]&127)<<14,e[r++]<128)||(a|=(e[r]&127)<<21,e[r++]<128))break e;a|=(e[r]&127)<<28}return a}function st(e){for(var r=[],a=[0];a[0]<e.length;){var n=a[0],s=Fs(e,a),i=s&7;s=Math.floor(s/8);var c=0,o;if(s==0)break;switch(i){case 0:{for(var l=a[0];e[a[0]++]>=128;);o=e.slice(l,a[0])}break;case 5:c=4,o=e.slice(a[0],a[0]+c),a[0]+=c;break;case 1:c=8,o=e.slice(a[0],a[0]+c),a[0]+=c;break;case 2:c=Fs(e,a),o=e.slice(a[0],a[0]+c),a[0]+=c;break;case 3:case 4:default:throw new Error("PB Type ".concat(i," for Field ").concat(s," at offset ").concat(n))}var d={data:o,type:i};r[s]==null?r[s]=[d]:r[s].push(d)}return r}function Yt(e){var r=[];return e.forEach(function(a,n){a.forEach(function(s){s.data&&(r.push(dt(n*8+s.type)),s.type==2&&r.push(dt(s.data.length)),r.push(s.data))})}),Da(r)}function Qo(e,r){return(e==null?void 0:e.map(function(a){return r(a.data)}))||[]}function Er(e){for(var r,a=[],n=[0];n[0]<e.length;){var s=Fs(e,n),i=st(e.slice(n[0],n[0]+s));n[0]+=s;var c={id:At(i[1][0].data),messages:[]};i[2].forEach(function(o){var l=st(o.data),d=At(l[3][0].data);c.messages.push({meta:l,data:e.slice(n[0],n[0]+d)}),n[0]+=d}),(r=i[3])!=null&&r[0]&&(c.merge=At(i[3][0].data)>>>0>0),a.push(c)}return a}function yn(e){var r=[];return e.forEach(function(a){var n=[];n[1]=[{data:dt(a.id),type:0}],n[2]=[],a.merge!=null&&(n[3]=[{data:dt(+!!a.merge),type:0}]);var s=[];a.messages.forEach(function(c){s.push(c.data),c.meta[3]=[{type:0,data:dt(c.data.length)}],n[2].push({data:Yt(c.meta),type:2})});var i=Yt(n);r.push(dt(i.length)),r.push(i),s.forEach(function(c){return r.push(c)})}),Da(r)}function eS(e,r){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var a=[0],n=Fs(r,a),s=[];a[0]<r.length;){var i=r[a[0]]&3;if(i==0){var c=r[a[0]++]>>2;if(c<60)++c;else{var o=c-59;c=r[a[0]],o>1&&(c|=r[a[0]+1]<<8),o>2&&(c|=r[a[0]+2]<<16),o>3&&(c|=r[a[0]+3]<<24),c>>>=0,c++,a[0]+=o}s.push(r.slice(a[0],a[0]+c)),a[0]+=c;continue}else{var l=0,d=0;if(i==1?(d=(r[a[0]]>>2&7)+4,l=(r[a[0]++]&224)<<3,l|=r[a[0]++]):(d=(r[a[0]++]>>2)+1,i==2?(l=r[a[0]]|r[a[0]+1]<<8,a[0]+=2):(l=(r[a[0]]|r[a[0]+1]<<8|r[a[0]+2]<<16|r[a[0]+3]<<24)>>>0,a[0]+=4)),s=[Da(s)],l==0)throw new Error("Invalid offset 0");if(l>s[0].length)throw new Error("Invalid offset beyond length");if(d>=l)for(s.push(s[0].slice(-l)),d-=l;d>=s[s.length-1].length;)s.push(s[s.length-1]),d-=s[s.length-1].length;s.push(s[0].slice(-l,-l+d))}}var u=Da(s);if(u.length!=n)throw new Error("Unexpected length: ".concat(u.length," != ").concat(n));return u}function Tr(e){for(var r=[],a=0;a<e.length;){var n=e[a++],s=e[a]|e[a+1]<<8|e[a+2]<<16;a+=3,r.push(eS(n,e.slice(a,a+s))),a+=s}if(a!==e.length)throw new Error("data is not a valid framed stream!");return Da(r)}function _n(e){for(var r=[],a=0;a<e.length;){var n=Math.min(e.length-a,268435455),s=new Uint8Array(4);r.push(s);var i=dt(n),c=i.length;r.push(i),n<=60?(c++,r.push(new Uint8Array([n-1<<2]))):n<=256?(c+=2,r.push(new Uint8Array([240,n-1&255]))):n<=65536?(c+=3,r.push(new Uint8Array([244,n-1&255,n-1>>8&255]))):n<=16777216?(c+=4,r.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(c+=5,r.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),r.push(e.slice(a,a+n)),c+=n,s[0]=0,s[1]=c&255,s[2]=c>>8&255,s[3]=c>>16&255,a+=n}return Da(r)}function tS(e,r,a,n){var s=cn(e),i=s.getUint32(4,!0),c=(n>1?12:8)+Od(i&(n>1?3470:398))*4,o=-1,l=-1,d=NaN,u=new Date(2001,0,1);i&512&&(o=s.getUint32(c,!0),c+=4),c+=Od(i&(n>1?12288:4096))*4,i&16&&(l=s.getUint32(c,!0),c+=4),i&32&&(d=s.getFloat64(c,!0),c+=8),i&64&&(u.setTime(u.getTime()+s.getFloat64(c,!0)*1e3),c+=8);var h;switch(e[2]){case 0:break;case 2:h={t:"n",v:d};break;case 3:h={t:"s",v:r[l]};break;case 5:h={t:"d",v:u};break;case 6:h={t:"b",v:d>0};break;case 7:h={t:"n",v:d/86400};break;case 8:h={t:"e",v:0};break;case 9:if(o>-1)h={t:"s",v:a[o]};else if(l>-1)h={t:"s",v:r[l]};else if(!isNaN(d))h={t:"n",v:d};else throw new Error("Unsupported cell type ".concat(e.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(e.slice(0,4)))}return h}function rS(e,r,a){var n=cn(e),s=n.getUint32(8,!0),i=12,c=-1,o=-1,l=NaN,d=NaN,u=new Date(2001,0,1);s&1&&(l=Qk(e,i),i+=16),s&2&&(d=n.getFloat64(i,!0),i+=8),s&4&&(u.setTime(u.getTime()+n.getFloat64(i,!0)*1e3),i+=8),s&8&&(o=n.getUint32(i,!0),i+=4),s&16&&(c=n.getUint32(i,!0),i+=4);var h;switch(e[1]){case 0:break;case 2:h={t:"n",v:l};break;case 3:h={t:"s",v:r[o]};break;case 5:h={t:"d",v:u};break;case 6:h={t:"b",v:d>0};break;case 7:h={t:"n",v:d/86400};break;case 8:h={t:"e",v:0};break;case 9:if(c>-1)h={t:"s",v:a[c]};else throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(s&31," : ").concat(e.slice(0,4)));break;case 10:h={t:"n",v:l};break;default:throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(s&31," : ").concat(e.slice(0,4)))}return h}function cc(e,r){var a=new Uint8Array(32),n=cn(a),s=12,i=0;switch(a[0]=5,e.t){case"n":a[1]=2,Zk(a,s,e.v),i|=1,s+=16;break;case"b":a[1]=6,n.setFloat64(s,e.v?1:0,!0),i|=2,s+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[1]=3,n.setUint32(s,r.indexOf(e.v),!0),i|=8,s+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,i,!0),a.slice(0,s)}function oc(e,r){var a=new Uint8Array(32),n=cn(a),s=12,i=0;switch(a[0]=3,e.t){case"n":a[2]=2,n.setFloat64(s,e.v,!0),i|=32,s+=8;break;case"b":a[2]=6,n.setFloat64(s,e.v?1:0,!0),i|=32,s+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[2]=3,n.setUint32(s,r.indexOf(e.v),!0),i|=16,s+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,i,!0),a.slice(0,s)}function aS(e,r,a){switch(e[0]){case 0:case 1:case 2:case 3:return tS(e,r,a,e[0]);case 5:return rS(e,r,a);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function tr(e){var r=st(e);return Fs(r[1][0].data)}function Ld(e,r){var a=st(r.data),n=At(a[1][0].data),s=a[3],i=[];return(s||[]).forEach(function(c){var o=st(c.data),l=At(o[1][0].data)>>>0;switch(n){case 1:i[l]=ao(o[3][0].data);break;case 8:{var d=e[tr(o[9][0].data)][0],u=st(d.data),h=e[tr(u[1][0].data)][0],f=At(h.meta[1][0].data);if(f!=2001)throw new Error("2000 unexpected reference to ".concat(f));var m=st(h.data);i[l]=m[3].map(function(x){return ao(x.data)}).join("")}break}}),i}function nS(e,r){var a,n,s,i,c,o,l,d,u,h,f,m,x,p,g=st(e),w=At(g[1][0].data)>>>0,S=At(g[2][0].data)>>>0,b=((n=(a=g[8])==null?void 0:a[0])==null?void 0:n.data)&&At(g[8][0].data)>0||!1,j,k;if((i=(s=g[7])==null?void 0:s[0])!=null&&i.data&&r!=0)j=(o=(c=g[7])==null?void 0:c[0])==null?void 0:o.data,k=(d=(l=g[6])==null?void 0:l[0])==null?void 0:d.data;else if((h=(u=g[4])==null?void 0:u[0])!=null&&h.data&&r!=1)j=(m=(f=g[4])==null?void 0:f[0])==null?void 0:m.data,k=(p=(x=g[3])==null?void 0:x[0])==null?void 0:p.data;else throw"NUMBERS Tile missing ".concat(r," cell storage");for(var N=b?4:1,C=cn(j),P=[],T=0;T<j.length/2;++T){var L=C.getUint16(T*2,!0);L<65535&&P.push([T,L])}if(P.length!=S)throw"Expected ".concat(S," cells, found ").concat(P.length);var M=[];for(T=0;T<P.length-1;++T)M[P[T][0]]=k.subarray(P[T][1]*N,P[T+1][1]*N);return P.length>=1&&(M[P[P.length-1][0]]=k.subarray(P[P.length-1][1]*N)),{R:w,cells:M}}function sS(e,r){var a,n=st(r.data),s=(a=n==null?void 0:n[7])!=null&&a[0]?At(n[7][0].data)>>>0>0?1:0:-1,i=Qo(n[5],function(c){return nS(c,s)});return{nrows:At(n[4][0].data)>>>0,data:i.reduce(function(c,o){return c[o.R]||(c[o.R]=[]),o.cells.forEach(function(l,d){if(c[o.R][d])throw new Error("Duplicate cell r=".concat(o.R," c=").concat(d));c[o.R][d]=l}),c},[])}}function iS(e,r,a){var n,s=st(r.data),i={s:{r:0,c:0},e:{r:0,c:0}};if(i.e.r=(At(s[6][0].data)>>>0)-1,i.e.r<0)throw new Error("Invalid row varint ".concat(s[6][0].data));if(i.e.c=(At(s[7][0].data)>>>0)-1,i.e.c<0)throw new Error("Invalid col varint ".concat(s[7][0].data));a["!ref"]=Ke(i);var c=st(s[4][0].data),o=Ld(e,e[tr(c[4][0].data)][0]),l=(n=c[17])!=null&&n[0]?Ld(e,e[tr(c[17][0].data)][0]):[],d=st(c[3][0].data),u=0;d[1].forEach(function(h){var f=st(h.data),m=e[tr(f[2][0].data)][0],x=At(m.meta[1][0].data);if(x!=6002)throw new Error("6001 unexpected reference to ".concat(x));var p=sS(e,m);p.data.forEach(function(g,w){g.forEach(function(S,b){var j=Ve({r:u+w,c:b}),k=aS(S,o,l);k&&(a[j]=k)})}),u+=p.nrows})}function cS(e,r){var a=st(r.data),n={"!ref":"A1"},s=e[tr(a[2][0].data)],i=At(s[0].meta[1][0].data);if(i!=6001)throw new Error("6000 unexpected reference to ".concat(i));return iS(e,s[0],n),n}function oS(e,r){var a,n=st(r.data),s={name:(a=n[1])!=null&&a[0]?ao(n[1][0].data):"",sheets:[]},i=Qo(n[2],tr);
572return i.forEach(function(c){e[c].forEach(function(o){var l=At(o.meta[1][0].data);l==6e3&&s.sheets.push(cS(e,o))})}),s}function lS(e,r){var a=al(),n=st(r.data),s=Qo(n[1],tr);if(s.forEach(function(i){e[i].forEach(function(c){var o=At(c.meta[1][0].data);if(o==2){var l=oS(e,c);l.sheets.forEach(function(d,u){nl(a,d,u==0?l.name:l.name+"_"+u,!0)})}})}),a.SheetNames.length==0)throw new Error("Empty NUMBERS file");return a}function lc(e){var r,a,n,s,i={},c=[];if(e.FullPaths.forEach(function(l){if(l.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),e.FileIndex.forEach(function(l){if(l.name.match(/\.iwa$/)){var d;try{d=Tr(l.content)}catch(h){return console.log("?? "+l.content.length+" "+(h.message||h))}var u;try{u=Er(d)}catch(h){return console.log("## "+(h.message||h))}u.forEach(function(h){i[h.id]=h.messages,c.push(h.id)})}}),!c.length)throw new Error("File has no messages");var o=((s=(n=(a=(r=i==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.meta)==null?void 0:n[1])==null?void 0:s[0].data)&&At(i[1][0].meta[1][0].data)==1&&i[1][0];if(o||c.forEach(function(l){i[l].forEach(function(d){var u=At(d.meta[1][0].data)>>>0;if(u==1)if(!o)o=d;else throw new Error("Document has multiple roots")})}),!o)throw new Error("Cannot find Document root");return lS(i,o)}function dS(e,r,a){var n,s,i,c;if(!((n=e[6])!=null&&n[0])||!((s=e[7])!=null&&s[0]))throw"Mutation only works on post-BNC storages!";var o=((c=(i=e[8])==null?void 0:i[0])==null?void 0:c.data)&&At(e[8][0].data)>0||!1;if(o)throw"Math only works with normal offsets";for(var l=0,d=cn(e[7][0].data),u=0,h=[],f=cn(e[4][0].data),m=0,x=[],p=0;p<r.length;++p){if(r[p]==null){d.setUint16(p*2,65535,!0),f.setUint16(p*2,65535);continue}d.setUint16(p*2,u,!0),f.setUint16(p*2,m,!0);var g,w;switch(typeof r[p]){case"string":g=cc({t:"s",v:r[p]},a),w=oc({t:"s",v:r[p]},a);break;case"number":g=cc({t:"n",v:r[p]},a),w=oc({t:"n",v:r[p]},a);break;case"boolean":g=cc({t:"b",v:r[p]},a),w=oc({t:"b",v:r[p]},a);break;default:throw new Error("Unsupported value "+r[p])}h.push(g),u+=g.length,x.push(w),m+=w.length,++l}for(e[2][0].data=dt(l);p<e[7][0].data.length/2;++p)d.setUint16(p*2,65535,!0),f.setUint16(p*2,65535,!0);return e[6][0].data=Da(h),e[3][0].data=Da(x),l}
572function uS(e,r){if(!r||!r.numbers)throw new Error("Must pass a `numbers` option -- check the README");var a=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var n=vr(a["!ref"]);n.s.r=n.s.c=0;var s=!1;n.e.c>9&&(s=!0,n.e.c=9),n.e.r>49&&(s=!0,n.e.r=49),s&&console.error("The Numbers writer is currently limited to ".concat(Ke(n)));var i=Fi(a,{range:n,header:1}),c=["~Sh33tJ5~"];i.forEach(function(V){return V.forEach(function(I){typeof I=="string"&&c.push(I)})});var o={},l=[],d=Be.read(r.numbers,{type:"base64"});d.FileIndex.map(function(V,I){return[V,d.FullPaths[I]]}).forEach(function(V){var I=V[0],D=V[1];if(I.type==2&&I.name.match(/\.iwa/)){var K=I.content,z=Tr(K),Y=Er(z);Y.forEach(function(re){l.push(re.id),o[re.id]={deps:[],location:D,type:At(re.messages[0].meta[1][0].data)}})}}),l.sort(function(V,I){return V-I});var u=l.filter(function(V){return V>1}).map(function(V){return[V,dt(V)]});d.FileIndex.map(function(V,I){return[V,d.FullPaths[I]]}).forEach(function(V){var I=V[0];if(V[1],!!I.name.match(/\.iwa/)){var D=Er(Tr(I.content));D.forEach(function(K){K.messages.forEach(function(z){u.forEach(function(Y){K.messages.some(function(re){return At(re.meta[1][0].data)!=11006&&Jk(re.data,Y[1])})&&o[Y[0]].deps.push(K.id)})})})}});for(var h=Be.find(d,o[1].location),f=Er(Tr(h.content)),m,x=0;x<f.length;++x){var p=f[x];p.id==1&&(m=p)}var g=tr(st(m.messages[0].data)[1][0].data);for(h=Be.find(d,o[g].location),f=Er(Tr(h.content)),x=0;x<f.length;++x)p=f[x],p.id==g&&(m=p);for(g=tr(st(m.messages[0].data)[2][0].data),h=Be.find(d,o[g].location),f=Er(Tr(h.content)),x=0;x<f.length;++x)p=f[x],p.id==g&&(m=p);for(g=tr(st(m.messages[0].data)[2][0].data),h=Be.find(d,o[g].location),f=Er(Tr(h.content)),x=0;x<f.length;++x)p=f[x],p.id==g&&(m=p);var w=st(m.messages[0].data);{w[6][0].data=dt(n.e.r+1),w[7][0].data=dt(n.e.c+1);var S=tr(w[46][0].data),b=Be.find(d,o[S].location),j=Er(Tr(b.content));{for(var k=0;k<j.length&&j[k].id!=S;++k);if(j[k].id!=S)throw"Bad ColumnRowUIDMapArchive";var N=st(j[k].messages[0].data);N[1]=[],N[2]=[],N[3]=[];for(var C=0;C<=n.e.c;++C){var P=[];P[1]=P[2]=[{type:0,data:dt(C+420690)}],N[1].push({type:2,data:Yt(P)}),N[2].push({type:0,data:dt(C)}),N[3].push({type:0,data:dt(C)})}N[4]=[],N[5]=[],N[6]=[];for(var T=0;T<=n.e.r;++T)P=[],P[1]=P[2]=[{type:0,data:dt(T+726270)}],N[4].push({type:2,data:Yt(P)}),N[5].push({type:0,data:dt(T)}),N[6].push({type:0,data:dt(T)});j[k].messages[0].data=Yt(N)}b.content=_n(yn(j)),b.size=b.content.length,delete w[46];var L=st(w[4][0].data);{L[7][0].data=dt(n.e.r+1);var M=st(L[1][0].data),E=tr(M[2][0].data);b=Be.find(d,o[E].location),j=Er(Tr(b.content));{if(j[0].id!=E)throw"Bad HeaderStorageBucket";var W=st(j[0].messages[0].data);for(T=0;T<i.length;++T){var ee=st(W[2][0].data);ee[1][0].data=dt(T),ee[4][0].data=dt(i[T].length),W[2][T]={type:W[2][0].type,data:Yt(ee)}}j[0].messages[0].data=Yt(W)}b.content=_n(yn(j)),b.size=b.content.length;var ce=tr(L[2][0].data);b=Be.find(d,o[ce].location),j=Er(Tr(b.content));{if(j[0].id!=ce)throw"Bad HeaderStorageBucket";for(W=st(j[0].messages[0].data),C=0;C<=n.e.c;++C)ee=st(W[2][0].data),ee[1][0].data=dt(C),ee[4][0].data=dt(n.e.r+1),W[2][C]={type:W[2][0].type,data:Yt(ee)};j[0].messages[0].data=Yt(W)}b.content=_n(yn(j)),b.size=b.content.length;var ue=tr(L[4][0].data);(function(){for(var V=Be.find(d,o[ue].location),I=Er(Tr(V.content)),D,K=0;K<I.length;++K){var z=I[K];z.id==ue&&(D=z)}var Y=st(D.messages[0].data);{Y[3]=[];var re=[];c.forEach(function(F,se){re[1]=[{type:0,data:dt(se)}],re[2]=[{type:0,data:dt(1)}],re[3]=[{type:2,data:Yk(F)}],Y[3].push({type:2,data:Yt(re)})})}D.messages[0].data=Yt(Y);var oe=yn(I),Ce=_n(oe);V.content=Ce,V.size=V.content.length})();var te=st(L[3][0].data);{var fe=te[1][0];delete te[2];var q=st(fe.data);{var J=tr(q[2][0].data);(function(){for(var V=Be.find(d,o[J].location),I=Er(Tr(V.content)),D,K=0;K<I.length;++K){var z=I[K];z.id==J&&(D=z)}var Y=st(D.messages[0].data);{delete Y[6],delete te[7];var re=new Uint8Array(Y[5][0].data);Y[5]=[];for(var oe=0,Ce=0;Ce<=n.e.r;++Ce){var F=st(re);oe+=dS(F,i[Ce],c),F[1][0].data=dt(Ce),Y[5].push({data:Yt(F),type:2})}Y[1]=[{type:0,data:dt(n.e.c+1)}],Y[2]=[{type:0,data:dt(n.e.r+1)}],Y[3]=[{type:0,data:dt(oe)}],Y[4]=[{type:0,data:dt(n.e.r+1)}]}D.messages[0].data=Yt(Y);var se=yn(I),he=_n(se);V.content=he,V.size=V.content.length})()}fe.data=Yt(q)}L[3][0].data=Yt(te)}w[4][0].data=Yt(L)}m.messages[0].data=Yt(w);var le=yn(f),A=_n(le);return h.content=A,h.size=h.content.length,d}function of(e){return function(a){for(var n=0;n!=e.length;++n){var s=e[n];a[s[0]]===void 0&&(a[s[0]]=s[1]),s[2]==="n"&&(a[s[0]]=Number(a[s[0]]))}}}function Zo(e){of([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0
vendor: 4,601 bytes, line 572
572],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(e)}function el(e){of([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function hS(e){return Qe.WS.indexOf(e)>-1?"sheet":e==Qe.CS?"chart":e==Qe.DS?"dialog":e==Qe.MS?"macro":e&&e.length?e:"sheet"}function fS(e,r){if(!e)return 0;try{e=r.map(function(n){return n.id||(n.id=n.strRelID),[n.name,e["!id"][n.id].Target,hS(e["!id"][n.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function pS(e,r,a,n,s,i,c,o,l,d,u,h){try{i[n]=hs(wr(e,a,!0),r);var f=Lt(e,r),m;switch(o){case"sheet":m=Ow(f,r,s,l,i[n],d,u,h);break;case"chart":if(m=Lw(f,r,s,l,i[n],d,u,h),!m||!m["!drawel"])break;var x=is(m["!drawel"].Target,r),p=Ss(x),g=w_(wr(e,x,!0),hs(wr(e,p,!0),x)),w=is(g,x),S=Ss(w);m=dw(wr(e,w,!0),w,l,hs(wr(e,S,!0),w),d,m);break;case"macro":m=Bw(f,r,s,l,i[n],d,u,h);break;case"dialog":m=Mw(f,r,s,l,i[n],d,u,h);break;default:throw new Error("Unrecognized sheet type "+o)}c[n]=m;var b=[];i&&i[n]&&Ft(i[n]).forEach(function(j){var k="";if(i[n][j].Type==Qe.CMNT){k=is(i[n][j].Target,r);var N=Ww(Lt(e,k,!0),k,l);if(!N||!N.length)return;jd(m,N,!1)}i[n][j].Type==Qe.TCMNT&&(k=is(i[n][j].Target,r),b=b.concat(S_(Lt(e,k,!0),l)))}),b&&b.length&&jd(m,b,!0,l.people||[])}catch(j){if(l.WTF)throw j}}function Nr(e){return e.charAt(0)=="/"?e.slice(1):e}function mS(e,r){if(Vn(),r=r||{},Zo(r),Fr(e,"META-INF/manifest.xml")||Fr(e,"objectdata.xml"))return Pd(e,r);if(Fr(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof lc<"u"){if(e.FileIndex)return lc(e);var a=Be.utils.cfb_new();return Wl(e).forEach(function(ee){Ye(a,ee,Nx(e,ee))}),lc(a)}throw new Error("Unsupported NUMBERS file")}if(!Fr(e,"[Content_Types].xml"))throw Fr(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Fr(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var n=Wl(e),s=yg(wr(e,"[Content_Types].xml")),i=!1,c,o;if(s.workbooks.length===0&&(o="xl/workbook.xml",Lt(e,o,!0)&&s.workbooks.push(o)),s.workbooks.length===0){if(o="xl/workbook.bin",!Lt(e,o,!0))throw new Error("Could not find workbook");s.workbooks.push(o),i=!0}s.workbooks[0].slice(-3)=="bin"&&(i=!0);var l={},d={};if(!r.bookSheets&&!r.bookProps){if(fs=[],s.sst)try{fs=Hw(Lt(e,Nr(s.sst)),s.sst,r)}catch(ee){if(r.WTF)throw ee}r.cellStyles&&s.themes.length&&(l=Uw(wr(e,s.themes[0].replace(/^\//,""),!0)||"",s.themes[0],r)),s.style&&(d=zw(Lt(e,Nr(s.style)),s.style,l,r))}s.links.map(function(ee){try{var ce=hs(wr(e,Ss(Nr(ee))),ee);return qw(Lt(e,Nr(ee)),ce,ee,r)}catch{}});var u=Rw(Lt(e,Nr(s.workbooks[0])),s.workbooks[0],r),h={},f="";s.coreprops.length&&(f=Lt(e,Nr(s.coreprops[0]),!0),f&&(h=Kh(f)),s.extprops.length!==0&&(f=Lt(e,Nr(s.extprops[0]),!0),f&&Ng(f,h,r)));var m={};(!r.bookSheets||r.bookProps)&&s.custprops.length!==0&&(f=wr(e,Nr(s.custprops[0]),!0),f&&(m=Eg(f,r)));var x={};if((r.bookSheets||r.bookProps)&&(u.Sheets?c=u.Sheets.map(function(ce){return ce.name}):h.Worksheets&&h.SheetNames.length>0&&(c=h.SheetNames),r.bookProps&&(x.Props=h,x.Custprops=m),r.bookSheets&&typeof c<"u"&&(x.SheetNames=c),r.bookSheets?x.SheetNames:r.bookProps))return x;c={};var p={};r.bookDeps&&s.calcchain&&(p=Vw(Lt(e,Nr(s.calcchain)),s.calcchain));var g=0,w={},S,b;{var j=u.Sheets;h.Worksheets=j.length,h.SheetNames=[];for(var k=0;k!=j.length;++k)h.SheetNames[k]=j[k].name}var N=i?"bin":"xml",C=s.workbooks[0].lastIndexOf("/"),P=(s.workbooks[0].slice(0,C+1)+"_rels/"+s.workbooks[0].slice(C+1)+".rels").replace(/^\//,"");Fr(e,P)||(P="xl/_rels/workbook."+N+".rels");var T=hs(wr(e,P,!0),P.replace(/_rels.*/,"s5s"));(s.metadata||[]).length>=1&&(r.xlmeta=$w(Lt(e,Nr(s.metadata[0])),s.metadata[0],r)),(s.people||[]).length>=1&&(r.people=C_(Lt(e,Nr(s.people[0])),r)),T&&(T=fS(T,u.Sheets));var L=Lt(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(g=0;g!=h.Worksheets;++g){var M="sheet";if(T&&T[g]?(S="xl/"+T[g][1].replace(/[\/]?xl\//,""),Fr(e,S)||(S=T[g][1]),Fr(e,S)||(S=P.replace(/_rels\/.*$/,"")+T[g][1]),M=T[g][2]):(S="xl/worksheets/sheet"+(g+1-L)+"."+N,S=S.replace(/sheet0\./,"sheet.")),b=S.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),r&&r.sheets!=null)switch(typeof r.sheets){case"number":if(g!=r.sheets)continue e;break;case"string":if(h.SheetNames[g].toLowerCase()!=r.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(r.sheets)){for(var E=!1,W=0;W!=r.sheets.length;++W)typeof r.sheets[W]=="number"&&r.sheets[W]==g&&(E=1),typeof r.sheets[W]=="str
572ing"&&r.sheets[W].toLowerCase()==h.SheetNames[g].toLowerCase()&&(E=1);if(!E)continue e}}pS(e,S,b,h.SheetNames[g],g,w,c,M,r,u,l,d)}return x={Directory:s,Workbook:u,Props:h,Custprops:m,Deps:p,Sheets:c,SheetNames:h.SheetNames,Strings:fs,Styles:d,Themes:l,SSF:kt(He)},r&&r.bookFiles&&(e.files?(x.keys=n,x.files=e.files):(x.keys=[],x.files={},e.FullPaths.forEach(function(ee,ce){ee=ee.replace(/^Root Entry[\/]/,""),x.keys.push(ee),x.files[ee]=e.FileIndex[ce]}))),r&&r.bookVBA&&(s.vba.length>0?x.vbaraw=Lt(e,Nr(s.vba[0]),!0):s.defaults&&s.defaults.bin===R_&&(x.vbaraw=Lt(e,"xl/vbaProject.bin",!0))),x}function xS(e,r){var a=r||{},n="Workbook",s=Be.find(e,n);try{if(n="/!DataSpaces/Version",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);if($1(s.content),n="/!DataSpaces/DataSpaceMap",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);var i=X1(s.content);if(i.length!==1||i[0].comps.length!==1||i[0].comps[0].t!==0||i[0].name!=="StrongEncryptionDataSpace"||i[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);var c=K1(s.content);if(c.length!=1||c[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);J1(s.content)}catch{}if(n="/EncryptionInfo",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);var o=Q1(s.content);if(n="/EncryptedPackage",s=Be.find(e,n),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(o[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(o[1],s.content,a.password||"",a);if(o[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(o[1],s.content,a.password||"",a);throw new Error("File is password-protected")}function gS(e,r){return r.bookType=="ods"?cf(e,r):r.bookType=="numbers"?uS(e,r):r.bookType=="xlsb"?vS(e,r):yS(e,r)}function vS(e,r){kn=1024,e&&!e.SSF&&(e.SSF=kt(He)),e&&e.SSF&&(Vn(),Ui(e.SSF),r.revssf=Wi(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,ps?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var a=r.bookType=="xlsb"?"bin":"xml",n=D0.indexOf(r.bookType)>-1,s=Mo();el(r=r||{});var i=So(),c="",o=0;if(r.cellXfs=[],Ba(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Ye(i,c,Yh(e.Props,r)),s.coreprops.push(c),ut(r.rels,2,c,Qe.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],d=0;d<e.SheetNames.length;++d)(e.Workbook.Sheets[d]||{}).Hidden!=2&&l.push(e.SheetNames[d]);e.Props.SheetNames=l}for(e.Props.Worksheets=e.Props.SheetNames.length,Ye(i,c,Zh(e.Props)),s.extprops.push(c),ut(r.rels,3,c,Qe.EXT_PROPS),e.Custprops!==e.Props&&Ft(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Ye(i,c,e0(e.Custprops)),s.custprops.push(c),ut(r.rels,4,c,Qe.CUST_PROPS)),o=1;o<=e.SheetNames.length;++o){var u={"!id":{}},h=e.Sheets[e.SheetNames[o-1]],f=(h||{})["!type"]||"sheet";switch(f){case"chart":default:c="xl/worksheets/sheet"+o+"."+a,Ye(i,c,Xw(o-1,c,r,e,u)),s.sheets.push(c),ut(r.wbrels,-1,"worksheets/sheet"+o+"."+a,Qe.WS[0])}if(h){var m=h["!comments"],x=!1,p="";m&&m.length>0&&(p="xl/comments"+o+"."+a,Ye(i,p,Jw(m,p)),s.comments.push(p),ut(u,-1,"../comments"+o+"."+a,Qe.CMNT),x=!0),h["!legacy"]&&x&&Ye(i,"xl/drawings/vmlDrawing"+o+".vml",I0(o,h["!comments"])),delete h["!comments"],delete h["!legacy"]}u["!id"].rId1&&Ye(i,Ss(c),An(u))}return r.Strings!=null&&r.Strings.length>0&&(c="xl/sharedStrings."+a,Ye(i,c,Yw(r.Strings,c,r)),s.strs.push(c),ut(r.wbrels,-1,"sharedStrings."+a,Qe.SST)),c="xl/workbook."+a,Ye(i,c,Gw(e,c)),s.workbooks.push(c),ut(r.rels,1,c,Qe.WB),c="xl/theme/theme1.xml",Ye(i,c,qo(e.Themes,r)),s.themes.push(c),ut(r.wbrels,-1,"theme/theme1.xml",Qe.THEME),c="xl/styles."+a,Ye(i,c,Kw(e,c,r)),s.styles.push(c),ut(r.wbrels,-1,"styles."+a,Qe.STY),e.vbaraw&&n&&(c="xl/vbaProject.bin",Ye(i,c,e.vbaraw),s.vba.push(c),ut(r.wbrels,-1,"vbaProject.bin",Qe.VBA)),c="xl/metadata."+a,Ye(i,c,Qw(c)),s.metadata.push(c),ut(r.wbrels,-1,"metadata."+a,Qe.XLMETA),Ye(i,"[Content_Types].xml",Gh(s,r)),Ye(i,"_rels/.rels",An(r.rels)),Ye(i,"xl/_rels/workbook."+a+".rels",An(r.wbrels)),delete r.revssf,delete r.ssf,i}
vendor: 7,544 bytes, line 572
572function yS(e,r){kn=1024,e&&!e.SSF&&(e.SSF=kt(He)),e&&e.SSF&&(Vn(),Ui(e.SSF),r.revssf=Wi(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,ps?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var a="xml",n=D0.indexOf(r.bookType)>-1,s=Mo();el(r=r||{});var i=So(),c="",o=0;if(r.cellXfs=[],Ba(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Ye(i,c,Yh(e.Props,r)),s.coreprops.push(c),ut(r.rels,2,c,Qe.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],d=0;d<e.SheetNames.length;++d)(e.Workbook.Sheets[d]||{}).Hidden!=2&&l.push(e.SheetNames[d]);e.Props.SheetNames=l}e.Props.Worksheets=e.Props.SheetNames.length,Ye(i,c,Zh(e.Props)),s.extprops.push(c),ut(r.rels,3,c,Qe.EXT_PROPS),e.Custprops!==e.Props&&Ft(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Ye(i,c,e0(e.Custprops)),s.custprops.push(c),ut(r.rels,4,c,Qe.CUST_PROPS));var u=["SheetJ5"];for(r.tcid=0,o=1;o<=e.SheetNames.length;++o){var h={"!id":{}},f=e.Sheets[e.SheetNames[o-1]],m=(f||{})["!type"]||"sheet";switch(m){case"chart":default:c="xl/worksheets/sheet"+o+"."+a,Ye(i,c,q0(o-1,r,e,h)),s.sheets.push(c),ut(r.wbrels,-1,"worksheets/sheet"+o+"."+a,Qe.WS[0])}if(f){var x=f["!comments"],p=!1,g="";if(x&&x.length>0){var w=!1;x.forEach(function(S){S[1].forEach(function(b){b.T==!0&&(w=!0)})}),w&&(g="xl/threadedComments/threadedComment"+o+"."+a,Ye(i,g,N_(x,u,r)),s.threadedcomments.push(g),ut(h,-1,"../threadedComments/threadedComment"+o+"."+a,Qe.TCMNT)),g="xl/comments"+o+"."+a,Ye(i,g,P0(x)),s.comments.push(g),ut(h,-1,"../comments"+o+"."+a,Qe.CMNT),p=!0}f["!legacy"]&&p&&Ye(i,"xl/drawings/vmlDrawing"+o+".vml",I0(o,f["!comments"])),delete f["!comments"],delete f["!legacy"]}h["!id"].rId1&&Ye(i,Ss(c),An(h))}return r.Strings!=null&&r.Strings.length>0&&(c="xl/sharedStrings."+a,Ye(i,c,_0(r.Strings,r)),s.strs.push(c),ut(r.wbrels,-1,"sharedStrings."+a,Qe.SST)),c="xl/workbook."+a,Ye(i,c,Y0(e)),s.workbooks.push(c),ut(r.rels,1,c,Qe.WB),c="xl/theme/theme1.xml",Ye(i,c,qo(e.Themes,r)),s.themes.push(c),ut(r.wbrels,-1,"theme/theme1.xml",Qe.THEME),c="xl/styles."+a,Ye(i,c,E0(e,r)),s.styles.push(c),ut(r.wbrels,-1,"styles."+a,Qe.STY),e.vbaraw&&n&&(c="xl/vbaProject.bin",Ye(i,c,e.vbaraw),s.vba.push(c),ut(r.wbrels,-1,"vbaProject.bin",Qe.VBA)),c="xl/metadata."+a,Ye(i,c,F0()),s.metadata.push(c),ut(r.wbrels,-1,"metadata."+a,Qe.XLMETA),u.length>1&&(c="xl/persons/person.xml",Ye(i,c,E_(u)),s.people.push(c),ut(r.wbrels,-1,"persons/person.xml",Qe.PEOPLE)),Ye(i,"[Content_Types].xml",Gh(s,r)),Ye(i,"_rels/.rels",An(r.rels)),Ye(i,"xl/_rels/workbook."+a+".rels",An(r.wbrels)),delete r.revssf,delete r.ssf,i}function tl(e,r){var a="";switch((r||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":a=kr(e.slice(0,12));break;case"binary":a=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(r&&r.type||"undefined"))}return[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3),a.charCodeAt(4),a.charCodeAt(5),a.charCodeAt(6),a.charCodeAt(7)]}function _S(e,r){return Be.find(e,"EncryptedPackage")?xS(e,r):ef(e,r)}function bS(e,r){var a,n=e,s=r||{};return s.type||(s.type=Je&&Buffer.isBuffer(e)?"buffer":"base64"),a=jh(n,s),mS(a,s)}function lf(e,r){var a=0;e:for(;a<e.length;)switch(e.charCodeAt(a)){case 10:case 13:case 32:++a;break;case 60:return to(e.slice(a),r);default:break e}return Ln.to_workbook(e,r)}function jS(e,r){var a="",n=tl(e,r);switch(r.type){case"base64":a=kr(e);break;case"binary":a=e;break;case"buffer":a=e.toString("binary");break;case"array":a=rn(e);break;default:throw new Error("Unrecognized type "+r.type)}return n[0]==239&&n[1]==187&&n[2]==191&&(a=xt(a)),r.type="binary",lf(a,r)}function wS(e,r){var a=e;return r.type=="base64"&&(a=kr(a)),a=ys.utils.decode(1200,a.slice(2),"str"),r.type="binary",lf(a,r)}function kS(e){return e.match(/[^\x00-\x7F]/)?ra(e):e}function dc(e,r,a,n){return n?(a.type="string",Ln.to_workbook(e,a)):Ln.to_workbook(r,a)}function no(e,r){_o();var a=r||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return no(new Uint8Array(e),(a=kt(a),a.type="array",a));typeof Uint8Array<"u"&&e instanceof Uint8Array&&!a.type&&(a.type=typeof Deno<"u"?"buffer":"array");var n=e,s=[0,0,0,0],i=!1;if(a.cellStyles&&(a.cellNF=!0,a.sheetStubs=!0),In={},a.dateNF&&(In.dateNF=a.dateNF),a.type||(a.type=Je&&Buffer.isBuffer(e)?"buffer":"base64"),a.type=="file"&&(a.type=Je?"buffer":"binary",n=vx(e),typeof Uint8Array<"u"&&!Je&&(a.type="array")),a.type=="string"&&(i=!0,a.type="binary",a.codepage=65001,n=kS(e)),a.type=="array"&&typeof Uint8Array<"u"&&e instanceof Uint8Array&&typeof ArrayBuffer<"u"){var c=new ArrayBuffer(3),o=new Uint8Array(c);if(o.foo="bar",!o.foo)return a=kt(a),a.type="array",no(bo(n),a)}switch((s=tl(n,a))[0]){case 208:if(s[1]===207&&s[2]===17&&s[3]===224&&s[4]===161&&s[5]===177&&s[6]===26&&s[7]===225)return _S(Be.read(n,a),a);break;case 9:if(s[1]<=8)return ef(n,a);break;case 60:return to(n,a);case 73:if(s[1]===73&&s[2]===42&&s[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(s[1]===68)return T1(n,a);break;case 84:if(s[1]===65&&s[2]===66&&s[3]===76)return v0.to_workbook(n,a);break;case 80:return s[1]===75&&s[2]<9&&s[3]<9?bS(n,a):dc(e,n,a,i);case 239:return s[3]===60?to(n,a):dc(e,n,a,i);case 255:if(s[1]===254)return wS(n,a);if(s[1]===0&&s[2]===2&&s[3]===0)return Qa.to_workbook(n,a);break;case 0:if(s[1]===0&&(s[2]>=2&&s[3]===0||s[2]===0&&(s[3]===8||s[3]===9)))return Qa.to_workbook(n,a);break;case 3:case 131:case 139:case 140:return eo.to_workbook(n,a);case 123:if(s[1]===92&&s[2]===114&&s[3]===116)return S0.to_workbook(n,a);break;case 10:case 13:case 32:return jS(n,a);case 137:if(s[1]===80&&s[2]===78&&s[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return E1.indexOf(s[0])>-1&&s[2]<=12&&s[3]<=31?eo.to_workbook(n,a):dc(e,n,a,i)}function df(e,r){switch(r.type){case"base64":case"binary":break;case"buffer":case"array":r.type="";break;case"file":return Ms(r.file,Be.write(e,{type:Je?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");default:throw new Error("Unrecognized type "+r.type)}return Be.write(e,r)}function SS(e,r){var a=kt(r||{}),n=gS(e,a);return NS(n,a)}function NS(e,r){var a={},n=Je?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(r.compression&&(a.compression="DEFLATE"),r.password)a.type=n;else switch(r.type){case"base64":a.type="base64";break;case"binary":a.type="string";break;case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");case"buffer":case"file":a.type=n;break;default:throw new Error("Unrecognized type "+r.type)}var s=e.FullPaths?Be.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[a.type]||a.type,compression:!!r.compression}):e.generate(a);if(typeof Deno<"u"&&typeof s=="string"){if(r.type=="binary"||r.type=="base64")return s;s=new Uint8Array(zi(s))}return r.password&&typeof encrypt_agile<"u"?df(encrypt_agile(s,r.password),r):r.type==="file"?Ms(r.file,s):r.type=="string"?xt(s):s}function CS(e,r){var a=r||{},n=kk(e,a);return df(n,a)}function ea(e,r,a){a||(a="");var n=a+e;switch(r.type){case"base64":return _s(ra(n));case"binary":return ra(n);case"string":return e;case"file":return Ms(r.file,n,"utf8");case"buffer":return Je?ya(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):ea(n,{type:"binary"}
vendor: 5,001 bytes, line 572
572).split("").map(function(s){return s.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function ES(e,r){switch(r.type){case"base64":return _s(e);case"binary":return e;case"string":return e;case"file":return Ms(r.file,e,"binary");case"buffer":return Je?ya(e,"binary"):e.split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function hi(e,r){switch(r.type){case"string":case"base64":case"binary":for(var a="",n=0;n<e.length;++n)a+=String.fromCharCode(e[n]);return r.type=="base64"?_s(a):r.type=="string"?xt(a):a;case"file":return Ms(r.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+r.type)}}function uf(e,r){_o(),_w(e);var a=kt(r||{});if(a.cellStyles&&(a.cellNF=!0,a.sheetStubs=!0),a.type=="array"){a.type="binary";var n=uf(e,a);return a.type="array",zi(n)}var s=0;if(a.sheet&&(typeof a.sheet=="number"?s=a.sheet:s=e.SheetNames.indexOf(a.sheet),!e.SheetNames[s]))throw new Error("Sheet not found: "+a.sheet+" : "+typeof a.sheet);switch(a.bookType||"xlsb"){case"xml":case"xlml":return ea(gk(e,a),a);case"slk":case"sylk":return ea(g0.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"htm":case"html":return ea(rf(e.Sheets[e.SheetNames[s]],a),a);case"txt":return ES(hf(e.Sheets[e.SheetNames[s]],a),a);case"csv":return ea(rl(e.Sheets[e.SheetNames[s]],a),a,"\uFEFF");case"dif":return ea(v0.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"dbf":return hi(eo.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"prn":return ea(Ln.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"rtf":return ea(S0.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"eth":return ea(y0.from_sheet(e.Sheets[e.SheetNames[s]],a),a);case"fods":return ea(cf(e,a),a);case"wk1":return hi(Qa.sheet_to_wk1(e.Sheets[e.SheetNames[s]],a),a);case"wk3":return hi(Qa.book_to_wk3(e,a),a);case"biff2":a.biff||(a.biff=2);case"biff3":a.biff||(a.biff=3);case"biff4":return a.biff||(a.biff=4),hi(tf(e,a),a);case"biff5":a.biff||(a.biff=5);case"biff8":case"xla":case"xls":return a.biff||(a.biff=8),CS(e,a);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return SS(e,a);default:throw new Error("Unrecognized bookType |"+a.bookType+"|")}}function TS(e){if(!e.bookType){var r={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},a=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();a.match(/^\.[a-z]+$/)&&(e.bookType=a.slice(1)),e.bookType=r[e.bookType]||e.bookType}}function AS(e,r,a){var n={};return n.type="file",n.file=r,TS(n),uf(e,n)}function FS(e,r,a,n,s,i,c,o){var l=Dt(a),d=o.defval,u=o.raw||!Object.prototype.hasOwnProperty.call(o,"raw"),h=!0,f=s===1?[]:{};if(s!==1)if(Object.defineProperty)try{Object.defineProperty(f,"__rowNum__",{value:a,enumerable:!1})}catch{f.__rowNum__=a}else f.__rowNum__=a;if(!c||e[a])for(var m=r.s.c;m<=r.e.c;++m){var x=c?e[a][m]:e[n[m]+l];if(x===void 0||x.t===void 0){if(d===void 0)continue;i[m]!=null&&(f[i[m]]=d);continue}var p=x.v;switch(x.t){case"z":if(p==null)break;continue;case"e":p=p==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+x.t)}if(i[m]!=null){if(p==null)if(x.t=="e"&&p===null)f[i[m]]=null;else if(d!==void 0)f[i[m]]=d;else if(u&&p===null)f[i[m]]=null;else continue;else f[i[m]]=u&&(x.t!=="n"||x.t==="n"&&o.rawNumbers!==!1)?p:va(x,p,o);p!=null&&(h=!1)}}return{row:f,isempty:h}}function Fi(e,r){if(e==null||e["!ref"]==null)return[];var a={t:"n",v:0},n=0,s=1,i=[],c=0,o="",l={s:{r:0,c:0},e:{r:0,c:0}},d=r||{},u=d.range!=null?d.range:e["!ref"];switch(d.header===1?n=1:d.header==="A"?n=2:Array.isArray(d.header)?n=3:d.header==null&&(n=0),typeof u){case"string":l=at(u);break;case"number":l=at(e["!ref"]),l.s.r=u;break;default:l=u}n>0&&(s=0);var h=Dt(l.s.r),f=[],m=[],x=0,p=0,g=Array.isArray(e),w=l.s.r,S=0,b={};g&&!e[w]&&(e[w]=[]);var j=d.skipHidden&&e["!cols"]||[],k=d.skipHidden&&e["!rows"]||[];for(S=l.s.c;S<=l.e.c;++S)if(!(j[S]||{}).hidden)switch(f[S]=Nt(S),a=g?e[w][S]:e[f[S]+h],n){case 1:i[S]=S-l.s.c;break;case 2:i[S]=f[S];break;case 3:i[S]=d.header[S-l.s.c];break;default:if(a==null&&(a={w:"__EMPTY",t:"s"}),o=c=va(a,null,d),p=b[c]||0,!p)b[c]=1;else{do o=c+"_"+p++;while(b[o]);b[c]=p,b[o]=1}i[S]=o}for(w=l.s.r+s;w<=l.e.r;++w)if(!(k[w]||{}).hidden){var N=FS(e,l,w,f,n,i,g,d);(N.isempty===!1||(n===1?d.blankrows!==!1:d.blankrows))&&(m[x++]=N.row)}return m.length=x,m}var Bd=/"/g;function IS(e,r,a,n,s,i,c,o){for(var l=!0,d=[],u="",h=Dt(a),f=r.s.c;f<=r.e.c;++f)if(n[f]){var m=o.dense?(e[a]||[])[f]:e[n[f]+h];if(m==null)u="";else if(m.v!=null){l=!1,u=""+(o.rawNumbers&&m.t=="n"?m.v:va(m,null,o));for(var x=0,p=0;x!==u.length;++x)if((p=u.charCodeAt(x))===s||p===i||p===34||o.forceQuotes){u='"'+u.replace(Bd,'""')+'"';break}u=="ID"&&(u='"ID"')}else m.f!=null&&!m.F?(l=!1,u="="+m.f,u.indexOf(",")>=0&&(u='"'+u.replace(Bd,'""')+'"')):u="";d.push(u)}return o.blankrows===!1&&l?null:d.join(c)}function rl(e,r){var a=[],n=r??{};if(e==null||e["!ref"]==null)return"";var s=at(e["!ref"]),i=n.FS!==void 0?n.FS:",",c=i.charCodeAt(0),o=n.RS!==void 0?n.RS:`
573`,l=o.charCodeAt(0),d=new RegExp((i=="|"?"\\|":i)+"+$"),u="",h=[];n.dense=Array.isArray(e);for(var f=n.skipHidden&&e["!cols"]||[],m=n.skipHidden&&e["!rows"]||[],x=s.s.c;x<=s.e.c;++x)(f[x]||{}).hidden||(h[x]=Nt(x));for(var p=0,g=s.s.r;g<=s.e.r;++g)(m[g]||{}).hidden||(u=IS(e,s,g,h,c,l,i,n),u!=null&&(n.strip&&(u=u.replace(d,"")),(u||n.blankrows!==!1)&&a.push((p++?o:"")+u)));return delete n.dense,a.join("")}function hf(e,r){r||(r={}),r.FS=" ",r.RS=` 574`;var a=rl(e,r);return a}function PS(e){var r="",a,n="";if(e==null||e["!ref"]==null)return[];var s=at(e["!ref"]),i="",c=[],o,l=[],d=Array.isArray(e);for(o=s.s.c;o<=s.e.c;++o)c[o]=Nt(o);for(var u=s.s.r;u<=s.e.r;++u)for(i=Dt(u),o=s.s.c;o<=s.e.c;++o)if(r=c[o]+i,a=d?(e[u]||[])[o]:e[r],n="",a!==void 0){if(a.F!=null){if(r=a.F,!a.f)continue;n=a.f,r.indexOf(":")==-1&&(r=r+":"+r)}if(a.f!=null)n=a.f;else{if(a.t=="z")continue;if(a.t=="n"&&a.v!=null)n=""+a.v;else if(a.t=="b")n=a.v?"TRUE":"FALSE";else if(a.w!==void 0)n="'"+a.w;else{if(a.v===void 0)continue;a.t=="s"?n="'"+a.v:n=""+a.v}}l[l.length]=r+"="+n}return l}function ff(e,r,a){var n=a||{},s=+!n.skipHeader,i=e||{},c=0,o=0;if(i&&n.origin!=null)if(typeof n.origin=="number")c=n.origin;else{var l=typeof n.origin=="string"?Ct(n.origin):n.origin;c=l.r,o=l.c}var d,u={s:{c:0,r:0},e:{c:o,r:c+r.length-1+s}};if(i["!ref"]){var h=at(i["!ref"]);u.e.c=Math.max(u.e.c,h.e.c),u.e.r=Math.max(u.e.r,h.e.r),c==-1&&(c=h.e.r+1,u.e.r=c+r.length-1+s)}else c==-1&&(c=0,u.e.r=r.length-1+s);var f=n.header||[],m=0;r.forEach(function(p,g){Ft(p).forEach(function(w){(m=f.indexOf(w))==-1&&(f[m=f.length]=w);var S=p[w],b="z",j="",k=Ve({c:o+m,r:c+g+s});d=Is(i,k),S&&typeof S=="object"&&!(S instanceof Date)?i[k]=S:(typeof S=="number"?b="n":typeof S=="boolean"?b="b":typeof S=="string"?b="s":S instanceof Date?(b="d",n.cellDates||(b="n",S=Vt(S)),j=n.dateNF||He[14]):S===null&&n.nullError&&(b="e",S=0),d?(d.t=b,d.v=S,delete d.w,delete d.R,j&&(d.z=j)):i[k]=d={t:b,v:S},j&&(d.z=j))})}),u.e.c=Math.max(u.e.c,o+f.length-1);var x=Dt(c);if(s)for(m=0;m<f.length;++m)i[Nt(m+o)+x]={t:"s",v:f[m]};return i["!ref"]=Ke(u),i}function DS(e,r){return ff(null,e,r)}function Is(e,r,a){if(typeof r=="string"){if(Array.isArray(e)){var n=Ct(r);return e[n.r]||(e[n.r]=[]),e[n.r][n.c]||(e[n.r][n.c]={t:"z"})}return e[r]||(e[r]={t:"z"})}return typeof r!="number"?Is(e,Ve(r)):Is(e,Ve({r,c:a||0}))}function RS(e,r){if(typeof r=="number"){if(r>=0&&e.SheetNames.length>r)return r;throw new Error("Cannot find sheet # "+r)}else if(typeof r=="string"){var a=e.SheetNames.indexOf(r);if(a>-1)return a;throw new Error("Cannot find sheet name |"+r+"|")}else throw new Error("Cannot find sheet |"+r+"|")}function al(){return{SheetNames:[],Sheets:{}}}function nl(e,r,a,n){var s=1;if(!a)for(;s<=65535&&e.SheetNames.indexOf(a="Sheet"+s)!=-1;++s,a=void 0);if(!a||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(a)>=0){var i=a.match(/(^.*?)(\d+)$/);s=i&&+i[2]||0;var c=i&&i[1]||a;for(++s;s<=65535&&e.SheetNames.indexOf(a=c+s)!=-1;++s);}if(K0(a),e.SheetNames.indexOf(a)>=0)throw new Error("Worksheet with name |"+a+"| already exists!");return e.SheetNames.push(a),e.Sheets[a]=r,a}function OS(e,r,a){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=RS(e,r);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),a){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+a)}e.Workbook.Sheets[n].Hidden=a}function LS(e,r){return e.z=r,e}function pf(e,r,a){return r?(e.l={Target:r},a&&(e.l.Tooltip=a)):delete e.l,e}function BS(e,r,a){return pf(e,"#"+r,a)}function MS(e,r,a){e.c||(e.c=[]),e.c.push({t:r,a:a||"SheetJS"})}function zS(e,r,a,n){for(var s=typeof r!="string"?r:at(r),i=typeof r=="string"?r:Ke(r),c=s.s.r;c<=s.e.r;++c)for(var o=s.s.c;o<=s.e.c;++o){var l=Is(e,c,o);l.t="n",l.F=i,delete l.v,c==s.s.r&&o==s.s.c&&(l.f=a,n&&(l.D=!0))}return e}var fi={encode_col:Nt,encode_row:Dt,encode_cell:Ve,encode_range:Ke,decode_col:Po,decode_row:Io,split_cell:Yx,decode_cell:Ct,decode_range:vr,format_cell:va,sheet_add_aoa:zh,sheet_add_json:ff,sheet_add_dom:af,aoa_to_sheet:qn,json_to_sheet:DS,table_to_sheet:nf,table_to_book:$k,sheet_to_csv:rl,sheet_to_txt:hf,sheet_to_json:Fi,sheet_to_html:rf,sheet_to_formulae:PS,sheet_to_row_object_array:Fi,sheet_get_cell:Is,book_new:al,book_append_sheet:nl,book_set_sheet_visibility:OS,cell_set_number_format:LS,cell_set_hyperlink:pf,cell_set_internal_link:BS,cell_add_comment:MS,sheet_set_array_formula:zS,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const uc={sku:"",vendorId:"",cost:"",vendorUrl:"",vendorSku:"",vendorItemName:"",vendorPackSize:""},US={sku:"",item_name:"",category:"",unit_of_measure:"",vendor_id:"",cost:"",vendor_product_url:"",vendor_sku:"",vendor_item_name:"",vendor_pack_size:"",notes:"",inventory_area:"",inventory_source_mode:"",canonical_product_id:""},HS={sku:["sku","internal sku","item sku","product sku"],item_name:["item","item name","product","product name","name"],category:["category","department","group"],unit_of_measure:["unit","uom","unit of measure"],vendor_id:["vendor id"],cost:["cost","unit cost","price"],vendor_product_url:["vendor url","product url","order url","url"],vendor_sku:["vend
574or sku","supplier sku","vendor item number"],vendor_item_name:["vendor item name","supplier item name"],vendor_pack_size:["pack size","case size","vendor pack size"],notes:["notes","note","description"],inventory_area:["inventory area","area","department area"],inventory_source_mode:["inventory source mode","source mode","authority mode"],canonical_product_id:["canonical product id","canonical id","product identity"]};function yr(e){return e==null||e===""?"â":String(e)}function WS(e){return String(e??"").trim().toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ")}function Md(e,r){const a=Object.fromEntries(Object.entries(e).map(([s,i])=>[WS(s),i])),n=HS[r].find(s=>s in a);return n?String(a[n]??"").trim():""}function mf({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState([]),[i,c]=y.useState(""),[o,l]=y.useState(null),[d,u]=y.useState(uc),[h,f]=y.useState(!0),[m,x]=y.useState(!1),[p,g]=y.useState(null),[w,S]=y.useState(null),[b,j]=y.useState([]),[k,N]=y.useState("SKU"),[C,P]=y.useState(""),[T,L]=y.useState(!1),[M,E]=y.useState(!1),[W,ee]=y.useState(""),[ce,ue]=y.useState(""),[te,fe]=y.useState([]),[q,J]=y.useState([]),le=y.useRef(0);async function A(){var je;const F=++le.current;if(!M){f(!0);return}if(!e){g("Portal connection is not configured."),f(!1);return}if(T&&!W){a([]),s([]),J([]),ue(""),f(!1);return}if(f(!0),g(null),T){const ve=await e.rpc("portal_list_smart_sku_context",{p_tenant_id:Number(W)});if(F!==le.current)return;if(ve.error){g(ve.error.message),f(!1);return}const ne=ve.data;a(ne.items??[]),s(ne.vendors??[]),J(ne.locations??[]),ue(Z=>(ne.locations??[]).some(xe=>String(xe.id)===Z)?Z:""),f(!1);return}const[se,he]=await Promise.all([e.from("portal_smart_inventory_items").select("*").order("item_name").limit(1e3),e.from("smart_inventory_vendors").select("id,vendor_name").eq("active",!0).order("vendor_name")]);F===le.current&&(a(se.data??[]),s(he.data??[]),g(((je=se.error??he.error)==null?void 0:je.message)??null),f(!1))}y.useEffect(()=>{let F=!0;return E(!1),L(!1),ee(""),ue(""),a([]),s([]),J([]),fe([]),e==null||e.auth.getSession().then(async se=>{var je,ve;if(!F)return;const he=((ve=(je=se.data.session)==null?void 0:je.user.app_metadata)==null?void 0:ve.sbh_admin)===!0;if(L(he),E(!0),he){const ne=await e.rpc("sbh_admin_smart_sku_tenants");F&&!ne.error&&fe(ne.data??[])}}),e||E(!0),()=>{F=!1,le.current+=1}},[e]),y.useEffect(()=>{A()},[e,M,T,W]),y.useEffect(()=>{j([]),P(""),l(null),u(uc)},[W]);const V=y.useMemo(()=>{const F=i.trim().toLowerCase();return F?r.filter(se=>`${yr(se.item_name)} ${yr(se.sku)} ${yr(se.vendor_name)} ${yr(se.vendor_sku)}`.toLowerCase().includes(F)):r},[i,r]);function I(F){l(F),u({sku:String(F.sku??""),vendorId:F.vendor_id?String(F.vendor_id):"",cost:F.cost==null?"":String(F.cost),vendorUrl:String(F.vendor_product_url??""),vendorSku:String(F.vendor_sku??""),vendorItemName:String(F.vendor_item_name??""),vendorPackSize:String(F.vendor_pack_size??"")}),g(null),S(null)}function D(){m||(l(null),u(uc),g(null),S(null))}async function K(F){if(F.preventDefault(),!e||!(o!=null&&o.id))return;const se=d.sku.trim().toUpperCase(),he=d.cost.trim()===""?null:Number(d.cost);if(!se)return g("Internal SKU is required.");if(he!==null&&(!Number.isFinite(he)||he<0))return g("Cost must be zero or greater.");x(!0),g(null),S(null);const je={p_item_id:Number(o.id),p_vendor_id:d.vendorId?Number(d.vendorId):null,p_cost:he,p_vendor_product_url:d.vendorUrl.trim()||null,p_vendor_sku:d.vendorSku.trim()||null,p_vendor_item_name:d.vendorItemName.trim()||null,p_vendor_pack_size:d.vendorPackSize.trim()||null,p_sku:se},{data:ve,error:ne}=T?await e.rpc("portal_update_smart_sku_context",{...je,p_tenant_id:Number(W)}):await e.rpc("portal_update_smart_inventory_item",je);if(x(!1),ne)return g(ne.message.includes("already exists")?"That internal SKU is already assigned to another item at this location.":ne.message);const Z=ve;a(xe=>xe.map(be=>String(be.id)===String(Z.id)?Z:be)),l(Z),u(xe=>({...xe,sku:String(Z.sku??se)})),S("Item details were saved and synced to Smart Inventory.")}function z(F,se){const he=k.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"-").replace(/^-|-$/g,"")||"SKU";let je=F+1,ve=`${he}-${String(je).padStart(4,"0")}`;for(;se.has(ve);)je+=1,ve=`${he}-${String(je).padStart(4,"0")}`;return se.add(ve),ve}async function Y(F){var he;const se=(he=F.target.files)==null?void 0:he[0];if(se){g(null),S(null),P(se.name);try{const je=no(await se.arrayBuffer(),{type:"array"}),ve=je.Sheets[je.SheetNames[0]],ne=fi.sheet_to_json(ve,{defval:""}).filter(be=>Object.values(be).some(De=>String(De).trim()));if(!ne.length)throw new Error("No product rows were found in the first worksheet.");const Z=new Set(r.map(be=>String(be.sku??"").toUpperCase())),xe=ne.slice(0,1e3).map((be,De)=>{const Te={...US};Object.keys(Te).forEach(ot=>{Te[ot]=Md(be,ot)}),Te.sku=(Te.sku||z(De,Z)).toUpperCase();
574const ze=Md(be,"vendor_item_name")||String(be.Vendor??be.vendor??""),We=n.find(ot=>ot.vendor_name.toLowerCase()===ze.trim().toLowerCase());return We&&(Te.vendor_id=String(We.id)),Te});j(xe),S(`${xe.length} rows organized and ready for review. Nothing has been saved yet.`)}catch(je){g(je instanceof Error?je.message:"Unable to read that spreadsheet.")}F.target.value=""}}function re(F,se,he){j(je=>je.map((ve,ne)=>ne===F?{...ve,[se]:se==="sku"?he.toUpperCase():he}:ve))}function oe(){const F=fi.json_to_sheet([{"Internal SKU":"","Item Name":"Example Product",Category:"Supplies",Unit:"each",Vendor:"",Cost:"","Vendor URL":"","Vendor SKU":"","Vendor Item Name":"","Pack Size":"","Inventory Area":"bakery","Inventory Source Mode":"manual-only","Canonical Product ID":"",Notes:""}]),se=fi.book_new();fi.book_append_sheet(se,F,"Smart SKU Import"),AS(se,"smart-sku-import-template.xlsx")}async function Ce(){if(!e||!b.length)return;const F=b.findIndex(Z=>!Z.sku.trim()||!Z.item_name.trim()||!["bakery","coffee_shop","shared"].includes(Z.inventory_area)||!["pos-connected","manual-only","hybrid/read-only","imported"].includes(Z.inventory_source_mode));if(F>=0)return g(`Row ${F+1} needs SKU, Item Name, explicit area, and explicit authority mode.`);const se=b.map(Z=>Z.sku.trim().toUpperCase()).find((Z,xe,be)=>be.indexOf(Z)!==xe);if(se)return g(`Duplicate SKU ${se} appears more than once in the preview.`);if(T&&!ce)return g("Select the exact tenant location before importing.");x(!0),g(null),S(null);const he=b.map(Z=>({...Z,sku:Z.sku.trim().toUpperCase(),item_name:Z.item_name.trim(),vendor_id:Z.vendor_id||null,cost:Z.cost||null,source_reference:C||"spreadsheet"})),{data:je,error:ve}=T?await e.rpc("portal_bulk_import_smart_sku_context",{p_tenant_id:Number(W),p_location_id:Number(ce),p_rows:he}):await e.rpc("portal_bulk_import_smart_sku",{p_rows:he});if(x(!1),ve)return g(ve.message);const ne=je;S(`Import complete: ${ne.inserted??0} new products and ${ne.updated??0} existing products updated.`),j([]),P(""),await A()}return t.jsxs(t.Fragment,{children:[t.jsx("header",{className:"page-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Item setup"}),t.jsx("h1",{children:"Smart SKU Creator"}),t.jsx("p",{className:"muted",children:"Create and manage product SKUs individually or organize an Excel/CSV catalog in bulk before saving it to Smart Inventory Tracker."})]})}),T&&t.jsxs("section",{className:"panel",children:[t.jsxs("label",{children:["Command Center tenant",t.jsxs("select",{value:W,onChange:F=>{ee(F.target.value),ue("")},children:[t.jsx("option",{value:"",children:"Select a tenant"}),te.map(F=>t.jsxs("option",{value:F.id,children:[F.name," · ",F.id]},F.id))]})]}),t.jsxs("label",{children:["Import location",t.jsxs("select",{value:ce,onChange:F=>ue(F.target.value),disabled:!W,children:[t.jsx("option",{value:"",children:"Select a location"}),q.map(F=>t.jsxs("option",{value:F.id,children:[F.name," · ",F.id]},F.id))]})]}),t.jsx("p",{className:"muted",children:"The tenant and import location are validated server-side. Bulk imports never fall back to a JWT tenant or an arbitrary branch."})]}),t.jsxs("section",{className:"panel bulk-import-panel",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Bulk upload"}),t.jsx("p",{className:"muted",children:"Upload Excel or CSV. Smart SKU matches common column names, generates missing SKUs, and stages everything for review."})]}),t.jsxs("button",{type:"button",className:"secondary-button import-button",onClick:oe,children:[t.jsx(Os,{size:17})," Download template"]})]}),t.jsxs("div",{className:"bulk-controls",children:[t.jsxs("label",{children:["SKU prefix",t.jsx("input",{value:k,onChange:F=>N(F.target.value.toUpperCase()),placeholder:"Example: LM-SUP"})]}),t.jsxs("label",{className:"primary-button import-button",children:[t.jsx(Rn,{size:17})," Upload Excel or CSV",t.jsx("input",{type:"file",accept:".xlsx,.xls,.csv",onChange:Y})]})]}),b.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"import-summary",children:[t.jsx(cp,{size:18}),t.jsx("strong",{children:C}),t.jsxs("span",{children:[b.length," staged rows"]}),t.jsx("span",{children:"Review and edit before importing."})]}),t.jsx("div",{className:"table-wrap import-table",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"#"}),t.jsx("th",{children:"Internal SKU"}),t.jsx("th",{children:"Item Name"}),t.jsx("th",{children:"Area"}),t.jsx("th",{children:"Authority"}),t.jsx("th",{children:"Category"}),t.jsx("th",{children:"Unit"}),t.jsx("th",{children:"Vendor"}),t.jsx("th",{children:"Cost"}),t.jsx("th",{children:"Vendor URL"}),t.jsx("th",{children:"Pack"})]})}),t.jsx("tbody",{children:b.map((F,se)=>t.jsxs("tr",{children:[t.jsx("td",{children:se+1}),t.jsx("td",{children:t.jsx("input",{value:F.sku,onChange:he=>re(se,"sku",he.target.value)})}),t.jsx("td",{children:t.jsx("input",{value:F.item_name,onChange:he=>re(se,"item_name",he.target.value)})}),t.jsx("td",{children:t.jsxs("select",{value:F.inventory_area,onChange:he=>re(se,"inventory_area",he.target.value),children:[t.jsx("option",{value:"",children:"Choose area"}),t.jsx("option",{value:"bakery",children:"Bakery"}),t.jsx("option",{value:"coffee_shop",children:"Coffee Shop"}),t.jsx("option",{value:"shared",children:"Shared"})]})}),t.jsx("td",{children:t.jsxs("select",{value:F.inventory_source_mode,onCh
574ange:he=>re(se,"inventory_source_mode",he.target.value),children:[t.jsx("option",{value:"",children:"Choose authority"}),t.jsx("option",{value:"pos-connected",children:"POS-connected"}),t.jsx("option",{value:"manual-only",children:"Manual-only"}),t.jsx("option",{value:"hybrid/read-only",children:"Hybrid/read-only"}),t.jsx("option",{value:"imported",children:"Imported"})]})}),t.jsx("td",{children:t.jsx("input",{value:F.category,onChange:he=>re(se,"category",he.target.value)})}),t.jsx("td",{children:t.jsx("input",{value:F.unit_of_measure,onChange:he=>re(se,"unit_of_measure",he.target.value)})}),t.jsx("td",{children:t.jsxs("select",{value:F.vendor_id,onChange:he=>re(se,"vendor_id",he.target.value),children:[t.jsx("option",{value:"",children:"No vendor"}),n.map(he=>t.jsx("option",{value:he.id,children:he.vendor_name},he.id))]})}),t.jsx("td",{children:t.jsx("input",{type:"number",min:"0",step:"0.01",value:F.cost,onChange:he=>re(se,"cost",he.target.value)})}),t.jsx("td",{children:t.jsx("input",{type:"url",value:F.vendor_product_url,onChange:he=>re(se,"vendor_product_url",he.target.value)})}),t.jsx("td",{children:t.jsx("input",{value:F.vendor_pack_size,onChange:he=>re(se,"vendor_pack_size",he.target.value)})})]},`${F.sku}-${se}`))})]})}),t.jsxs("div",{className:"import-actions",children:[t.jsx("button",{className:"secondary-button",onClick:()=>j([]),disabled:m,children:"Cancel preview"}),t.jsx("button",{className:"primary-button",onClick:Ce,disabled:m,children:m?"Importingâ¦":`Import ${b.length} rows`})]})]})]}),p&&t.jsx("div",{className:"error-box",children:p}),w&&t.jsx("div",{className:"success-box",children:w}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"filter-row",children:t.jsxs("label",{className:"search-box",children:[t.jsx(Yr,{size:18}),t.jsx("input",{value:i,onChange:F=>c(F.target.value),placeholder:"Search item, SKU, or vendor"})]})}),h?t.jsx("p",{children:"Loading Smart SKU itemsâ¦"}):t.jsx("div",{className:"table-wrap",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Item"}),t.jsx("th",{children:"Area"}),t.jsx("th",{children:"Authority"}),t.jsx("th",{children:"Internal SKU"}),t.jsx("th",{children:"Vendor"}),t.jsx("th",{children:"Vendor SKU"}),t.jsx("th",{children:"Pack"}),t.jsx("th",{children:"Cost"}),t.jsx("th",{children:"Order"}),t.jsx("th",{children:"Action"})]})}),t.jsx("tbody",{children:V.map(F=>t.jsxs("tr",{children:[t.jsxs("td",{children:[t.jsx("strong",{children:yr(F.item_name)}),t.jsx("small",{className:"table-subtext",children:yr(F.vendor_item_name)})]}),t.jsx("td",{children:yr(F.inventory_area)}),t.jsx("td",{children:yr(F.inventory_source_mode)}),t.jsx("td",{children:yr(F.sku)}),t.jsx("td",{children:yr(F.vendor_name)}),t.jsx("td",{children:yr(F.vendor_sku)}),t.jsx("td",{children:yr(F.vendor_pack_size)}),t.jsx("td",{children:F.cost==null?"â":`$${Number(F.cost).toFixed(2)}`}),t.jsx("td",{children:F.vendor_product_url?t.jsxs("a",{className:"order-link",href:String(F.vendor_product_url),target:"_blank",rel:"noreferrer",children:["Open ",t.jsx(Tt,{size:14})]}):"â"}),t.jsx("td",{children:t.jsxs("button",{className:"row-action",onClick:()=>I(F),children:[t.jsx(Xa,{size:15})," Edit"]})})]},String(F.id)))})]})})]}),o&&t.jsx("div",{className:"adjustment-backdrop",role:"presentation",onMouseDown:F=>{F.target===F.currentTarget&&D()},children:t.jsxs("section",{className:"adjustment-modal smart-sku-modal",role:"dialog","aria-modal":"true",children:[t.jsxs("div",{className:"adjustment-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Item and vendor setup"}),t.jsx("h2",{children:yr(o.item_name)}),t.jsx("p",{className:"muted",children:"SKU changes are synchronized and recorded in the audit history."})]}),t.jsx("button",{className:"icon-button",type:"button",onClick:D,children:t.jsx(gt,{size:20})})]}),t.jsxs("form",{className:"adjustment-form smart-sku-form",onSubmit:K,children:[t.jsxs("label",{className:"wide-field",children:["Internal SKU",t.jsx("input",{value:d.sku,onChange:F=>u(se=>({...se,sku:F.target.value.toUpperCase()})),required:!0})]}),t.jsxs("label",{children:["Vendor",t.jsxs("select",{value:d.vendorId,onChange:F=>u(se=>({...se,vendorId:F.target.value}
574)),children:[t.jsx("option",{value:"",children:"No vendor assigned"}),n.map(F=>t.jsx("option",{value:F.id,children:F.vendor_name},F.id))]})]}),t.jsxs("label",{children:["Cost",t.jsx("input",{type:"number",min:"0",step:"0.01",value:d.cost,onChange:F=>u(se=>({...se,cost:F.target.value}))})]}),t.jsxs("label",{className:"wide-field",children:["Vendor product URL",t.jsx("input",{type:"url",value:d.vendorUrl,onChange:F=>u(se=>({...se,vendorUrl:F.target.value}))})]}),t.jsxs("label",{children:["Vendor SKU",t.jsx("input",{value:d.vendorSku,onChange:F=>u(se=>({...se,vendorSku:F.target.value}))})]}),t.jsxs("label",{children:["Vendor item name",t.jsx("input",{value:d.vendorItemName,onChange:F=>u(se=>({...se,vendorItemName:F.target.value}))})]}),t.jsxs("label",{className:"wide-field",children:["Pack size",t.jsx("input",{value:d.vendorPackSize,onChange:F=>u(se=>({...se,vendorPackSize:F.target.value}))})]}),t.jsxs("div",{className:"adjustment-actions wide-field",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:D,disabled:m,children:"Close"}),t.jsx("button",{type:"submit",className:"primary-button",disabled:m,children:m?"Savingâ¦":"Save item details"})]})]})]})})]})}function VS(e,r){const a=(e==null?void 0:e.name)??"";return a==="NotAllowedError"||a==="PermissionDeniedError"?"permission_denied":a==="NotFoundError"||a==="DevicesNotFoundError"?"no_camera":a==="NotSupportedError"||a==="SecurityError"?"permission_unavailable":a==="AbortError"?"cancelled":"no_camera"}function zd(e){e==null||e.getTracks().forEach(r=>r.stop())}const qS=new Set(["receipt","invoice","recipe","ingredient_list"]);function $S({supabase:e}){var Zt,Le,vt,Me,nt,Ge,Ze,It;const[r,a]=y.useState([]),[n,s]=y.useState(null),[i,c]=y.useState(null),[o,l]=y.useState("{}"),[d,u]=y.useState(null),[h,f]=y.useState(!1),[m,x]=y.useState(!1),[p,g]=y.useState(!1),[w,S]=y.useState([]),[b,j]=y.useState(""),[k,N]=y.useState([]),[C,P]=y.useState("manual_review"),[T,L]=y.useState(null),[M,E]=y.useState([]),[W,ee]=y.useState(null),[ce,ue]=y.useState(!1),[te,fe]=y.useState(""),q=y.useRef(null),J=y.useRef(null),le=y.useRef(null),A=y.useRef("");y.useEffect(()=>()=>{le.current&&window.clearTimeout(le.current),zd(q.current)},[]);const[V,I]=y.useState([]);async function D(){var we;if(!p)return e;if(!b)return null;const{data:de}=await e.auth.getSession(),Ee=(we=de.session)==null?void 0:we.access_token;return Ee?Du("https://igvskwjrroiivfrtmawd.supabase.co","sb_publishable_EuxB7NlknSsbvouGZUP_qA_1H7OTUui",{global:{headers:{Authorization:`Bearer ${Ee}`,"x-sbh-scanner-tenant-id":b}},auth:{persistSession:!1,autoRefreshToken:!1}}):null}async function K(){const de=await D();if(!de){a([]);return}const Ee=await de.from("sbh_scanner_route_configs").select("document_type,destination_key,display_name").eq("is_active",!0).order("priority");Ee.error||N(Ee.data??[]);const we=await de.from("portal_inventory_items").select("id,item_name,sku,qty_on_hand").order("item_name").limit(1e3);we.error||I(we.data??[]);const Oe=await de.from("sbh_scanner_history").select("id,original_filename,document_type,status,confidence,recommended_destination,created_at,reviewed_structured_data").in("status",["queued","processing","pending_review","failed"]).order("created_at",{ascending:!1}).limit(50);if(Oe.error){u(Oe.error.message);return}const Ue=Oe.data??[],Xe=Ue.map(Re=>Re.id);let et=[],ie=[];if(Xe.length){const Re=await de.from("sbh_scanner_files").select("scan_id,storage_path,bucket_id,mime_type").in("scan_id",Xe);if(Re.error){u(Re.error.message);return}ie=Re.data??[];const ct=await de.from("sbh_scanner_results").select("scan_id,attempt_number,structured_data").in("scan_id",Xe).order("attempt_number",{ascending:!1});if(ct.error){u(ct.error.message);return}et=ct.data??[]}const Ae=new Map,Pe=new Map(ie.map(Re=>[Re.scan_id,Re]));for(const Re of et)!Ae.has(Re.scan_id)&&Re.structured_data&&Ae.set(Re.scan_id,Re.structured_data);a(Ue.map(Re=>{var ct,ft,qt;return{...Re,source_path:((ct=Pe.get(Re.id))==null?void 0:ct.storage_path)??null,source_bucket:((ft=Pe.get(Re.id))==null?void 0:ft.bucket_id)??null,source_mime_type:((qt=Pe.get(Re.id))==null?void 0:qt.mime_type)??null,extracted_structured_data:Ae.get(Re.id)??null}}))}y.useEffect(()=>{async function de(){var Ue,Xe;const{data:Ee}=await e.auth.getSession(),we=((Xe=(Ue=Ee.session)==null?void 0:Ue.user.app_metadata)==null?void 0:Xe.sbh_admin)===!0;if(g(we),!we)return;const Oe=await e.rpc("sbh_admin_scanner_tenants");if(Oe.error){u(Oe.error.message);return}S(Oe.data??[])}de()},[]),y.useEffect(()=>{K()},[p,b]);function z(de){var Xe;
574P(ve(de.recommended_destination??((Xe=k.find(et=>et.document_type===de.document_type))==null?void 0:Xe.destination_key)??"manual_review"));const Ee=de.reviewed_structured_data??de.extracted_structured_data??{};l(JSON.stringify(Ee,null,2));const we=ne(Ee),Oe=Ee._scannerReview,Ue=Oe&&typeof Oe=="object"&&Array.isArray(Oe.includedLineItemIndexes)?new Set(Oe.includedLineItemIndexes.filter(et=>typeof et=="number")):null;E(Array.isArray(we)?we.map(et=>et&&typeof et=="object"?et:{name:String(et??"")}).filter(et=>!!je(et).trim()).map((et,ie)=>({value:et,included:Ue?Ue.has(ie):!0,destinationItemId:Oe&&typeof Oe=="object"&&typeof Oe.destinationItemIdsByLineIndex=="object"&&Number(Oe.destinationItemIdsByLineIndex[String(ie)]??0)||null})):[])}y.useEffect(()=>{if(!n)return;const de=r.find(we=>we.id===n.id);if(!de){s(null),c(null);return}(de.status!==n.status||de.document_type!==n.document_type||de.confidence!==n.confidence||de.recommended_destination!==n.recommended_destination||de.extracted_structured_data!==n.extracted_structured_data||de.reviewed_structured_data!==n.reviewed_structured_data)&&(s(de),z(de))},[r]);function Y(){le.current&&window.clearTimeout(le.current),le.current=null,zd(q.current),q.current=null,ue(!1)}async function re(de){var Xe;const Ee=await D();if(!Ee)return;const we=await Ee.from("sbh_scanner_history").select("id,original_filename,document_type,status,confidence,recommended_destination,created_at,reviewed_structured_data").eq("id",de).maybeSingle(),Oe=await Ee.from("sbh_scanner_results").select("structured_data").eq("scan_id",de).order("attempt_number",{ascending:!1}).limit(1).maybeSingle();if(we.error||!we.data)return;const Ue={...we.data,extracted_structured_data:((Xe=Oe.data)==null?void 0:Xe.structured_data)??null};s(Ue),z(Ue)}async function oe(de){const Ee=de.replace(/\D/g,"");if(Ee.length<8||Ee.length>14){ee("Enter a barcode of 8 to 14 digits. Nothing was saved.");return}if(A.current===Ee)return;A.current=Ee,Y();const we=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="),Xe=>Xe.charCodeAt(0)),Oe=new File([we],`${Ee}.png`,{type:"image/png"}),Ue=await se(Oe,"barcode");Ue?await re(Ue):A.current=""}async function Ce(de){const Ee=window.BarcodeDetector;if(!Ee){ee("This browser cannot read barcodes automatically. Enter the UPC below. The camera stays open until you close it.");return}const we=new Ee({formats:["upc_a","upc_e","ean_13","ean_8","code_128","qr_code"]}),Oe=async()=>{var Ue;if(q.current){try{const et=(Ue=(await we.detect(de)).find(ie=>ie.rawValue&&/\d{8,14}/.test(ie.rawValue)))==null?void 0:Ue.rawValue;if(et){await oe(et);return}}catch{ee("Barcode reading paused. You can enter the UPC or try the camera again.");return}le.current=window.setTimeout(()=>void Oe(),350)}};le.current=window.setTimeout(()=>void Oe(),350)}async function F(){var de;if(ee(null),Y(),!((de=navigator.mediaDevices)!=null&&de.getUserMedia)){ee("Camera permission is unavailable in this browser. Enter the barcode below or upload a photo.");return}try{const Ee=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1});q.current=Ee,ue(!0),window.setTimeout(()=>{const we=J.current;!we||!q.current||(we.srcObject=q.current,we.play().then(()=>void Ce(we)).catch(()=>ee("Camera preview could not start. You can enter the barcode below.")))},0)}catch(Ee){const we=VS(Ee instanceof Error?Ee:null);ee(we==="permission_denied"?"Camera permission was denied. Enter the barcode or upload a photo, then try the camera again.":we==="no_camera"?"No camera was found. Enter the barcode or upload a photo.":we==="cancelled"?"Camera start was cancelled.":we==="permission_unavailable"?"Camera permission is unavailable in this browser. Enter the barcode or upload a photo.":"Camera could not start. Enter the barcode or upload a photo."),Y()}}async function se(de,Ee){var et,ie;f(!0),u(null);const{data:we}=await e.auth.getSession(),Oe=new FormData;Oe.append("file",de),Oe.append("source_kind",Ee??(de.type==="application/pdf"?"pdf":"image"));const Ue=await fetch("https://igvskwjrroiivfrtmawd.supabase.co/functions/v1/smart-scanner/upload",{method:"POST",headers:{apikey:"sb_publishable_EuxB7NlknSsbvouGZUP_qA_1H7OTUui",Authorization:`Bearer ${((et=we.session)==null?void 0:et.access_token)??""}
574`,...p&&b?{"x-sbh-scanner-tenant-id":b}:{}},body:Oe}),Xe=await Ue.json().catch(()=>({}));if(f(!1),!Ue.ok)return u(String(Xe.error_code??"Upload failed.")),null;if(Xe.scan_id){const Ae=await e.functions.invoke("smart-scanner-worker",{body:{scan_id:Xe.scan_id},headers:p&&b?{"x-sbh-scanner-tenant-id":b}:void 0});Ae.error?u(`Scan queued, but processing could not start: ${Ae.error.message}`):((ie=Ae.data)==null?void 0:ie.status)==="failed"?u(`Scan processing failed: ${String(Ae.data.error_code??"PROCESSING_FAILED")}`):u(Ee==="barcode"?"Barcode received. Nothing is written until you confirm the result.":"Processing⦠Your document will appear in the Review queue when it is ready.")}else u("Scan uploaded, but no scan ID was returned.");return await K(),typeof Xe.scan_id=="string"?Xe.scan_id:null}function he(de,Ee){const we=M.map((Oe,Ue)=>Ue===de?{...Oe,included:Ee}:Oe);E(we)}function je(de){return String(de.item_name??de.name??de.description??de.itemCode??de.productIdentifier??"Unlabeled item")}function ve(de){const Ee=String(de??"").trim().toLowerCase().replace(/[ -]+/g,"_");return Ee==="smart_inventory_tracker"?"smart_inventory":Ee||"manual_review"}function ne(de){const Ee=["lineItems","line_items","items","purchases"];for(const we of Ee)if(Array.isArray(de[we]))return de[we];for(const we of["document","receipt","data","extracted","structuredData"]){const Oe=de[we];if(Oe&&typeof Oe=="object"&&!Array.isArray(Oe)){const Ue=ne(Oe);if(Ue)return Ue}}return null}async function Z(de){if(s(de),L(null),c(null),z(de),!de.source_path||!de.source_bucket)return;const Ee=await D();if(!Ee)return;const we=await Ee.storage.from(de.source_bucket).createSignedUrl(de.source_path,300);if(we.error){u(`Original document preview unavailable: ${we.error.message}`);return}c(we.data.signedUrl)}function xe(){try{const de=JSON.parse(o);return!de||Array.isArray(de)||typeof de!="object"?(u("Structured data must be a JSON object."),null):de}catch{return u("Structured data must be valid JSON."),null}}async function be(){if(!n)return;if(n.status!=="pending_review"){L(`This scan is ${n.status}; corrections are available after OCR/AI processing completes.`);return}const de=xe();if(!de)return;const Ee=C==="smart_inventory"&&M.length>0?{...de,_scannerReview:{includedLineItemIndexes:M.flatMap((Ue,Xe)=>Ue.included?[Xe]:[]),destinationItemIdsByLineIndex:Object.fromEntries(M.flatMap((Ue,Xe)=>Ue.included&&Ue.destinationItemId?[[Xe,Ue.destinationItemId]]:[]))}}:de,we=await D();if(!we)return u("Select a business workspace first.");const Oe=await we.rpc("sbh_scanner_save_review",{p_scan_id:n.id,p_corrected_values:Ee,p_changed_fields:Object.keys(Ee)});Oe.error?L(Oe.error.message):L("Review correction saved."),Oe.error||K()}function De(de){const Ee=(de==null?void 0:de.reviewed_structured_data)??(de==null?void 0:de.extracted_structured_data),we=Ee==null?void 0:Ee._productRecognition;return we&&typeof we=="object"?we:null}function Te(de){var we;const Ee=(we=De(de))==null?void 0:we.identity;return Ee&&typeof Ee=="object"&&!Array.isArray(Ee)?Ee:null}function ze(de){return!!Te(de)||(de==null?void 0:de.document_type)==="product_label"}async function We(de){if(!n||m)return;if(de==="approve"&&n.status!=="pending_review"){L(`This scan is ${n.status}; approve becomes available after OCR/AI processing completes.`);return}const Ee=de==="approve"||de==="rescan"&&ze(n)?xe():null;if(de==="approve"&&!Ee)return;const we=Ee&&C==="smart_inventory"&&M.length>0?{...Ee,lineItems:M.filter(ie=>ie.included).map(ie=>ie.value)}:Ee,Oe=await D();if(!Oe)return u("Select a business workspace first.");x(!0),L(de==="approve"?"Confirming...":de==="rescan"?"Preparing rescan...":"Marking wrong item...");const Ue=De(n),Xe=de==="approve"&&Ue?"sbh_scanner_confirm_product":de==="approve"?"sbh_scanner_approve":"sbh_scanner_reject",et=await Oe.rpc(Xe,de==="approve"&&Ue?{p_scan_id:n.id,p_destination_key:C,p_reviewed_structured_data:we}:de==="approve"?{p_scan_id:n.id,p_destination_key:C,p_reviewed_structured_data:we}:{p_scan_id:n.id,p_reason:de==="rescan"?"RESCAN_REQUESTED":"WRONG_ITEM"});if(et.error){x(!1),de==="approve"&&C==="smart_inventory"?(u("Could not send selected items to Smart Inventory. Nothing was added. Retry."),L("Needs attention - Smart Inventory did not accept the selected items.")):L(et.error.message),K();return}if(de==="approve"&&C==="smart_inventory"&&n.document_type&&qS.has(n.document_type)){const ie=n.document_type==="recipe"||n.document_type==="ingredient_list"?"recipe":"receipt";u(`Approved and routed - added to Smart Inventory as a ${ie}.`)}else u(de==="rescan"?"Rescan requested. Capture the product again when ready.":de==="reject"&&Ue?"Marked wrong item. No product was retained.":`Scan ${de}d.`);x(!1),s(null),K()}function ot(de){return{smart_inventory:"Smart Inventory",smart_finance:"Smart Finance",smart_sku_creator:"Smart SKU Creator",smart_contacts:"Smart Contacts",manual_review:"Manual Review"}[de]??de}const it=n?k.filter(de=>de.document_type===n.document_type):[];return t.jsxs(t.Fragment,{children:[t.jsx("header",{className:"page-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Smart Scanner"}),t.jsx("h1",{children:"Smart Scanner"}),t.jsx("p",{className:"muted",children:"Scan a product barcode or capture a business document. Nothing is written until you confirm it."})]})}),t.jsxs("section",{className:"panel scanner-choice","aria-labelledby":"product-scanner-title",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Product Scanner"}),t.jsx("h2",{id:"product-scanner-title",children:"Product Scanner"}),t.jsx("p",{className:"muted",children:"Scan a barcode or product with your camera."})]})}
574),t.jsxs("div",{className:"scanner-choice-actions",children:[t.jsx("button",{type:"button",className:"primary-inline module-action-button",onClick:()=>void F(),children:"Use camera"}),t.jsxs("form",{className:"scanner-barcode-entry",onSubmit:de=>{de.preventDefault(),oe(te)},children:[t.jsxs("label",{children:["Enter barcode / UPC",t.jsx("input",{inputMode:"numeric",autoComplete:"off",value:te,onChange:de=>fe(de.target.value),placeholder:"012345678905"})]}),t.jsx("button",{type:"submit",className:"secondary-button",disabled:h,children:"Look up barcode"})]})]}),W&&t.jsx("p",{role:"alert",children:W}),ce&&t.jsxs("div",{className:"scanner-camera",role:"dialog","aria-label":"Product camera",children:[t.jsx("video",{ref:J,playsInline:!0,muted:!0,autoPlay:!0}),t.jsx("button",{type:"button",className:"secondary-button",onClick:Y,children:"Close camera"})]})]}),t.jsxs("section",{className:"panel scanner-choice","aria-labelledby":"document-intelligence-title",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Document Intelligence"}),t.jsx("h2",{id:"document-intelligence-title",children:"Document Intelligence"}),t.jsx("p",{className:"muted",children:"Scan or upload receipts, invoices, labels, cards, and business documents."})]})}),t.jsxs("div",{className:"scanner-choice-actions",children:[t.jsxs("label",{className:"primary-inline module-action-button",children:[t.jsx(Rn,{size:16})," ",h?"Uploadingâ¦":"Upload document",t.jsx("input",{hidden:!0,disabled:h||p&&!b,type:"file",accept:"image/*,application/pdf",onChange:de=>{var we;const Ee=(we=de.target.files)==null?void 0:we[0];Ee&&se(Ee),de.currentTarget.value=""}})]}),t.jsxs("button",{className:"secondary-button module-action-button",onClick:()=>void K(),children:[t.jsx(St,{size:16})," Refresh"]})]})]}),p&&t.jsx("section",{className:"panel",children:t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Acting as SBH Support"}),t.jsx("p",{className:"muted",children:"Select the business that owns this scan and its support history."})]}),t.jsxs("label",{children:["Select business",t.jsxs("select",{value:b,onChange:de=>{j(de.target.value),s(null),u(null)},children:[t.jsx("option",{value:"",children:"Choose a business"}),w.map(de=>t.jsx("option",{value:de.id,children:de.name},de.id))]})]})]})}),d&&t.jsx("div",{className:"success-box",children:d}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Review queue"}),t.jsx("p",{className:"muted",children:"Nothing is written to business records until you approve it."})]})}),r.length?t.jsx("div",{className:"attention-list",children:r.map(de=>t.jsxs("button",{className:"attention-row scanner-review-row",onClick:()=>void Z(de),children:[t.jsxs("div",{children:[t.jsx("strong",{children:de.original_filename}),t.jsxs("span",{children:[de.document_type??"Classifying"," · ",de.recommended_destination??"Manual review"]})]}),t.jsxs("div",{className:"row-numbers",children:[t.jsx("span",{children:de.confidence==null?"â":`${Math.round(de.confidence*100)}% confidence`}),t.jsx("b",{className:`badge ${de.status}`,children:de.status})]})]},de.id))}):t.jsxs("div",{className:"empty-state",children:[t.jsx(ip,{size:30}),t.jsx("h3",{children:"No scans yet"}),t.jsx("p",{children:"Upload a receipt, invoice, label, card, or business document to begin."})]})]}),n&&t.jsx("div",{className:"admin-modal-backdrop",children:t.jsxs("section",{className:"admin-modal scanner-review-modal",children:[t.jsxs("div",{className:"admin-modal-title",children:[t.jsx("h2",{children:ze(n)?"Confirm recognized product":`Review ${n.original_filename}`}),t.jsx("button",{type:"button",onClick:()=>{s(null),c(null)},children:t.jsx(gt,{})})]}),t.jsxs("p",{className:"muted",children:[n.document_type??"Unknown"," · ",n.confidence==null?"No confidence score":`${Math.round(n.confidence*100)}% confidence`," · ",n.recommended_destination??"Manual review"]}),ze(n)&&Te(n)&&t.jsxs("div",{className:"panel",children:[t.jsx("strong",{style:{color:"#101828",display:"block",whiteSpace:"normal",overflowWrap:"anywhere"},children:String(((Zt=Te(n))==null?void 0:Zt.name)??"Unknown product")}
574),typeof((Le=Te(n))==null?void 0:Le.imageUrl)=="string"&&String((vt=Te(n))==null?void 0:vt.imageUrl).startsWith("https://")?t.jsx("img",{alt:"",src:String((Me=Te(n))==null?void 0:Me.imageUrl),style:{display:"block",maxWidth:"100%",maxHeight:120,objectFit:"contain",marginTop:8}}):null,t.jsx("p",{className:"muted",children:[(nt=Te(n))==null?void 0:nt.brand,(Ge=Te(n))==null?void 0:Ge.size,(Ze=Te(n))==null?void 0:Ze.barcode].filter(Boolean).map(String).join(" · ")}),t.jsx("small",{className:"muted",children:"Recognition/provider evidence is not authoritative. Confirm only when the displayed product matches the scan."})]}),T&&t.jsx("p",{className:"muted",role:"alert",children:T}),!ze(n)&&(it.length>0?t.jsxs("label",{children:["Send confirmed document to",t.jsx("select",{value:C,onChange:de=>P(de.target.value),children:it.map(de=>t.jsx("option",{value:de.destination_key,children:de.display_name},de.destination_key))})]}):t.jsxs("p",{className:"muted",children:["Destination: ",ot(C)]})),t.jsx("div",{className:"scanner-source-preview",children:i?(It=n.source_mime_type)!=null&&It.startsWith("image/")?t.jsx("img",{src:i,alt:`Original ${n.original_filename}`,style:{width:"100%",maxHeight:360,objectFit:"contain",borderRadius:12,background:"#08111d"}}):n.source_mime_type==="application/pdf"?t.jsx("iframe",{src:i,title:`Original ${n.original_filename}`,style:{width:"100%",height:360,border:0,borderRadius:12,background:"#fff"}}):t.jsx("a",{href:i,target:"_blank",rel:"noreferrer",children:"Open original document"}):t.jsx("p",{className:"muted",children:"Loading original document previewâ¦"})}),!ze(n)&&C==="smart_inventory"&&M.length>0&&t.jsxs("div",{className:"scanner-line-items",children:[t.jsx("strong",{children:"Smart Inventory line items"}),t.jsx("p",{className:"muted",children:"Choose which receipt lines should be added to inventory. The original receipt remains available for Finance."}),M.map((de,Ee)=>t.jsxs("label",{className:"scanner-line-item",children:[t.jsx("input",{type:"checkbox",checked:de.included,onChange:we=>he(Ee,we.target.checked)}),t.jsxs("span",{children:[t.jsx("strong",{children:je(de.value)}),de.included&&t.jsxs(t.Fragment,{children:[t.jsxs("select",{"aria-label":"Destination inventory item",value:de.destinationItemId??"",onChange:we=>E(Oe=>Oe.map((Ue,Xe)=>Xe===Ee?{...Ue,destinationItemId:we.target.value?Number(we.target.value):null}:Ue)),children:[t.jsx("option",{value:"",children:"Choose destination item"}),V.map(we=>t.jsxs("option",{value:we.id,children:[we.item_name,we.sku?" · "+we.sku:""]},we.id))]}),t.jsx("input",{"aria-label":"Manual destination item name",placeholder:"Or enter destination item name",value:de.manualDestinationName??"",onChange:we=>E(Oe=>Oe.map((Ue,Xe)=>Xe===Ee?{...Ue,manualDestinationName:we.target.value}:Ue))}),t.jsxs("small",{children:[de.value.quantity==null?"Quantity not detected":`Qty ${String(de.value.quantity)}`,de.value.unitPrice==null?"":` · ${String(de.value.unitPrice)}`]})]})]})]},`${Ee}-${je(de.value)}`))]}),!ze(n)&&t.jsxs("label",{children:["Edit extracted fields",t.jsx("textarea",{rows:12,value:o,onChange:de=>l(de.target.value)})]}),t.jsxs("div",{className:"module-header-actions",children:[!ze(n)&&t.jsx("button",{className:"secondary-button",disabled:m,onClick:()=>void be(),children:"Save correction"}),ze(n)?t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:"primary-inline scanner-approve-button",disabled:m,onClick:()=>void We("approve"),children:[t.jsx(Kt,{size:16})," Confirm"]}),t.jsxs("button",{className:"secondary-button",disabled:m,onClick:()=>void We("reject"),children:[t.jsx(gt,{size:16})," Wrong item"]}),t.jsxs("button",{className:"secondary-button",disabled:m,onClick:()=>void We("rescan"),children:[t.jsx(St,{size:16})," Rescan"]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:"primary-inline scanner-approve-button",disabled:m,onClick:()=>void We("approve"),children:[t.jsx(Kt,{size:16})," Confirm"]}),t.jsxs("button",{className:"secondary-button",disabled:m,onClick:()=>void We("reject"),children:[t.jsx(gt,{size:16})," Not Correct"]}),t.jsxs("button",{className:"secondary-button",disabled:m,onClick:()=>void We("rescan"),children:[t.jsx(St,{size:16})," Rescan"]})]})]})]})})]})}function GS(e){var r;return e?String(((r=e.details)==null?void 0:r.event_name)??e.event_title).replace(/^Met at /,""):""}
574function es(e){return String(e.display_name??"Unnamed contact")}function so(e){const r=String((e==null?void 0:e.message)??"");return/does not exist|schema cache|42P01|PGRST205/i.test(r)}function ka(e){const r=e;return so(r)?"Certified Smart CRM tables are source-controlled but not applied in this database yet.":(r==null?void 0:r.code)==="42501"||/permission|policy|authorized|scope mismatch|unavailable/i.test((r==null?void 0:r.message)??"")?"This CRM record is outside your authorized workspace scope.":(r==null?void 0:r.message)||"Smart CRM could not load this workspace. Try again."}function Ud(){const e=new URLSearchParams(window.location.search).get("crm_section");return e==="companies"||e==="pipeline"||e==="followups"?e:"contacts"}function XS(e){const r=[];let a="",n=[],s=!1;for(let i=0;i<e.length;i+=1){const c=e[i];if(s){c==='"'&&e[i+1]==='"'?(a+='"',i+=1):c==='"'?s=!1:a+=c;continue}c==='"'?s=!0:c===","?(n.push(a),a=""):c===` 575`||c==="\r"?(c==="\r"&&e[i+1]===` 576`&&(i+=1),n.push(a),a="",n.some(o=>o.trim())&&r.push(n),n=[]):a+=c}return n.push(a),n.some(i=>i.trim())&&r.push(n),r}function KS({supabase:e,canEditSmartCard:r=!1,onOpenSmartCard:a}){const{identity:n,session:s}=Hn(),[i,c]=y.useState([]),[o,l]=y.useState({}),[d,u]=y.useState([]),[h,f]=y.useState([]),[m,x]=y.useState([]),[p,g]=y.useState([]),[w,S]=y.useState([]),[b,j]=y.useState([]),[k,N]=y.useState([]),[C,P]=y.useState({}),[T,L]=y.useState(!1),[M,E]=y.useState(null),[W,ee]=y.useState(Ud),[ce,ue]=y.useState(""),[te,fe]=y.useState(""),[q,J]=y.useState(null),[le,A]=y.useState(null),[V,I]=y.useState(!0),[D,K]=y.useState([]),[z,Y]=y.useState(!1),[re,oe]=y.useState(!1),Ce=y.useRef(null),[F,se]=y.useState({displayName:"",businessName:"",email:"",phone:"",ownership:"business"}),[he,je]=y.useState({displayName:"",businessName:"",email:"",phone:""}),[ve,ne]=y.useState({name:"",industry:"",email:""}),[Z,xe]=y.useState({name:"Sales",stages:"Lead,Qualified,Proposal,Won,Lost"}),[be,De]=y.useState({name:"",pipelineId:"",stageId:"",contactId:"",companyId:"",amount:""}),[Te,ze]=y.useState({title:"",contactId:"",dueAt:"",priority:"normal"}),[We,ot]=y.useState(""),[it,Zt]=y.useState(null),[Le,vt]=y.useState({email:!1,sms:!1,phone:!1,marketingEmail:!1,marketingSms:!1,service:!0,dnc:!1,source:""}),[Me,nt]=y.useState(null),[Ge,Ze]=y.useState({eventId:"",eventName:"",metOn:new Date().toISOString().slice(0,10),location:"",notes:"",source:"manual",followUpAt:""}),It=y.useCallback(async()=>{var Ut;I(!0),J(null);const[_,R,B,U,H,v,X,G,Q,ae,me,ke]=await Promise.all([e.from("sbh_contacts").select("*").order("updated_at",{ascending:!1}).limit(200),e.from("sbh_contact_timeline").select("id,contact_id,event_type,event_title,details,occurred_at").order("occurred_at",{ascending:!1}).limit(1e3),e.from("portal_community_events").select("id,title,starts_at,location_text").eq("status","published").order("starts_at",{ascending:!1}).limit(200),e.from("sbh_conference_sessions").select("id,event_name,event_date,location").order("event_date",{ascending:!1}).limit(200),e.from("sbh_crm_companies").select("*").order("name").limit(200),e.from("sbh_crm_pipelines").select("*").order("name").limit(50),e.from("sbh_crm_pipeline_stages").select("*").order("stage_order").limit(200),e.from("portal_sbh_crm_pipeline").select("*").order("updated_at",{ascending:!1}).limit(200),e.from("sbh_crm_tasks").select("*").order("due_at",{ascending:!0}).limit(200),e.from("sbh_crm_followup_recommendations").select("*").eq("status","open").limit(50),e.from("sbh_crm_attachments").select("*").order("created_at",{ascending:!1}).limit(100),e.from("sbh_crm_contact_preferences").select("*").limit(400)]),Ie=_.error??R.error;if(Ie){J(ka(Ie)),c([]),l({}),I(!1);return}const _e=H.error??v.error??X.error??G.error??Q.error??ae.error??me.error??ke.error;L(!!(_e&&so(_e))),_e&&!so(_e)&&J(ka(_e)),c(_.data??[]);const Fe={};for(const bt of R.data??[])(Fe[Ut=bt.contact_id]??(Fe[Ut]=[])).push(bt);l(Fe),u(H.data??[]),f(v.data??[]),x(X.data??[]),g(G.data??[]),S(Q.data??[]),j(ae.data??[]),N(me.data??[]);const $e={};for(const bt of ke.data??[])$e[String(bt.contact_id)]=bt;P($e);const yt=(B.data??[]).map(bt=>({id:String(bt.id),title:String(bt.title),starts_at:bt.starts_at?String(bt.starts_at):void 0,location_text:bt.location_text?String(bt.location_text):null})),_t=(U.data??[]).map(bt=>({id:String(bt.id),title:String(bt.event_name),starts_at:bt.event_date?String(bt.event_date):void 0,location_text:bt.location?String(bt.location):null}));K([...yt,..._t]),I(!1)},[e]);y.useEffect(()=>{It()},[It]),y.useEffect(()=>{const _=()=>ee(Ud());return window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)},[]),y.useEffect(()=>{var B;if(!M)return;(B=Ce.current)==null||B.focus();const _=C[String(M.id)];vt({email:!!(_!=null&&_.email_allowed),sms:!!(_!=null&&_.sms_allowed),phone:!!(_!=null&&_.phone_allowed),marketingEmail:!!(_!=null&&_.marketing_email_allowed),marketingSms:!!(_!=null&&_.marketing_sms_allowed),service:_?!!_.service_messages_allowed:!0,dnc:!!(_!=null&&_.do_not_contact),source:String((_==null?void 0:_.consent_source)??"")}),je({displayName:String(M.display_name??""),businessName:String(M.business_name??""),email:String(M.email??""),phone:String(M.phone??"")}),nt(null);const R=U=>{U.key==="Escape"&&E(null)};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[M,C]);const de=y.useMemo(()=>i.filter(_=>{const R=`${_.display_name??""} ${_.business_name??""} ${_.email??""}`.toLowerCase().includes(ce.toLowerCase()),B=o[String(_.id)]??[],U=!te||B.some(H=>GS(H).toLowerCase().includes(te.toLowerCase()));return R&&U}),[i,ce,te,o]),Ee=y.useMemo(()=>{const _=Date.now();return i.flatMap(R=>(o[String(R.id)]??[]).flatMap(B=>{var v;const U=(v=B.details)==null?void 0:v.follow_up_at;
576if(typeof U!="string"||!U)return[];const H=new Date(U);return Number.isNaN(H.getTime())?[]:[{contact:R,timeline:B,dueAt:H,overdue:H.getTime()<_}]})).sort((R,B)=>R.dueAt.getTime()-B.dueAt.getTime())},[i,o]),we=Ee.filter(_=>_.overdue).length+w.filter(_=>_.status!=="completed"&&_.due_at&&new Date(String(_.due_at)).getTime()<Date.now()).length,Oe=M?k.filter(_=>_.entity_type==="contact"&&String(_.entity_id)===String(M.id)):[],Ue=m.filter(_=>String(_.pipeline_id)===be.pipelineId);function Xe(_){ee(_);const R=new URLSearchParams(window.location.search);R.set("crm_section",_),window.history.pushState({},"",`${window.location.pathname}?${R.toString()}`)}function et(_){E(_),Ze({eventId:"",eventName:"",metOn:new Date().toISOString().slice(0,10),location:"",notes:"",source:"manual",followUpAt:""}),Y(!1)}async function ie(_,R){oe(!0),J(null),A(null);try{const B=await R();B!=null&&B.error?J(ka(B.error)):(A(_),await It())}catch(B){J(ka(B))}finally{oe(!1)}}async function Ae(_){if(_.preventDefault(),!F.displayName.trim())return J("A contact name is required.");await ie("Contact saved to this workspace.",async()=>{const R=await e.rpc("sbh_create_contact",{p_payload:{display_name:F.displayName.trim(),business_name:F.businessName.trim()||null,email:F.email.trim()||null,phone:F.phone.trim()||null,ownership:F.ownership,source:"manual",tags:[]}});return R.error||se({displayName:"",businessName:"",email:"",phone:"",ownership:"business"}),R})}async function Pe(_){if(_.preventDefault(),!M||!he.displayName.trim())return J("A contact name is required.");await ie("Contact details updated.",async()=>{const R=await e.rpc("sbh_update_contact",{p_contact_id:String(M.id),p_payload:{display_name:he.displayName.trim(),business_name:he.businessName.trim()||null,email:he.email.trim()||null,phone:he.phone.trim()||null}});return R.error||E(B=>B&&{...B,display_name:he.displayName.trim(),business_name:he.businessName.trim()||null,email:he.email.trim()||null,phone:he.phone.trim()||null}),R})}async function Re(_){if(!M)return;const R=_?"sbh_archive_contact":"sbh_restore_contact";await ie(_?"Contact archived.":"Contact restored.",async()=>{const B=await e.rpc(R,{p_contact_id:String(M.id)});return B.error||E(U=>U&&{...U,status:_?"archived":"active"}),B})}function ct(_){const R=D.find(B=>B.id===_);Ze(B=>({...B,eventId:_,eventName:(R==null?void 0:R.title)??B.eventName,location:(R==null?void 0:R.location_text)??B.location}))}async function ft(){M&&await ie(`Meeting context saved: Met at ${Ge.eventName}.`,async()=>{const _=await e.rpc("sbh_add_contact_meeting_context",{p_contact_id:String(M.id),p_event_id:Ge.eventId||null,p_event_name:Ge.eventName,p_met_on:Ge.metOn||null,p_location:Ge.location||null,p_notes:Ge.notes||null,p_capture_source:Ge.source,p_follow_up_at:Ge.followUpAt?new Date(Ge.followUpAt).toISOString():null});return _.error||Y(!1),_})}async function qt(_){_.preventDefault(),await ie("Company saved to this workspace.",async()=>{const R=await e.rpc("sbh_crm_create_company",{p_name:ve.name.trim(),p_industry:ve.industry.trim()||null,p_email:ve.email.trim()||null});return R.error||ne({name:"",industry:"",email:""}),R})}async function lt(_){_.preventDefault();const R=Z.stages.split(",").map((B,U)=>({name:B.trim(),probability:Math.min(100,U*25),is_won:B.trim().toLowerCase()==="won",is_lost:B.trim().toLowerCase()==="lost"})).filter(B=>B.name);await ie("Pipeline saved to this workspace.",async()=>{const B=await e.rpc("sbh_crm_create_pipeline",{p_name:Z.name.trim(),p_stages:R});return B.error||xe({name:"Sales",stages:"Lead,Qualified,Proposal,Won,Lost"}),B})}async function ca(_){_.preventDefault(),await ie("Opportunity saved to this workspace.",async()=>{const R=await e.rpc("sbh_crm_create_opportunity",{p_payload:{name:be.name.trim(),pipeline_id:be.pipelineId,stage_id:be.stageId,contact_id:be.contactId||null,company_id:be.companyId||null,amount:be.amount||"0"}});return R.error||De({name:"",pipelineId:be.pipelineId,stageId:"",contactId:"",companyId:"",amount:""}),R})}async function ja(_){_.preventDefault(),await ie("Task saved to this workspace.",async()=>{const R=await e.rpc("sbh_crm_create_task",{p_payload:{title:Te.title.trim(),contact_id:Te.contactId,due_at:Te.dueAt?new Date(Te.dueAt).toISOString():null,priority:Te.priority}});return R.error||ze({title:"",contactId:"",dueAt:"",priority:"normal"}),R})}async function Ma(_){_.preventDefault(),M&&await ie("Consent preferences saved.",async()=>e.rpc("sbh_crm_set_contact_preferences",{p_contact_id:String(M.id),p_email_allowed:Le.email,p_sms_allowed:Le.sms,p_phone_allowed:Le.phone,p_marketing_email_allowed:Le.marketingEmail,p_marketing_sms_allowed:Le.marketingSms,p_service_messages_allowed:Le.service,p_do_not_contact:Le.dnc,p_preferred_channel:"none",p_consent_source:Le.source.trim()||null}))}async function xn(){if(!M)return;const _=await e.rpc("sbh_crm_can_contact",{p_contact_id:String(M.id),p_channel:"email",p_purpose:"marketing"});if(_.error)return J(ka(_.error));const R=_.data;nt(R!=null&&R.allowed?"Marketing email is currently allowed.":`Marketing email blocked: ${(R==null?void 0:R.reason)??"fail closed"}.`)}async function Gn(_){_.preventDefault();const R=XS(We);if(R.length<2)return J("CSV dry-run needs a header row and at least one data row.");const B=R[0].map(X=>X.trim().toLowerCase()),U=R.slice(1).map(X=>{const G={};return B.forEach((Q,ae)=>{["display_name","email","phone","business_name"].includes(Q)&&(G[Q]=X[ae]??"")}),G});oe(!0),J(null),A(null),Zt(null);const H=await e.rpc("sbh_crm_create_import_dry_run",{p_source_name:"portal.csv",p_rows:U});if(oe(!1),H.error)return J(ka(H.error));const v=H.data;Zt(`Dry-run ${(v==null?void 0:v.mode)??"dry_run"}: ${(v==null?void 0:v.rows)??0} rows, ${(v==null?void 0:v.issues)??0} issues. Batch ${(v==null?void 0:v.batch_id)??"n/a"}. No contacts were created.`),A("CSV dry-run stored as a review-only batch.")}async function Xn(_){if(!M||!n.clientId||!s.user.id)return J("Tenant identity is required before an attachment can be registered.");
576if(!["text/plain","text/csv","application/pdf","image/png","image/jpeg"].includes(_.type)||_.size>10485760)return J("Attachments must be PDF, CSV, TXT, PNG, or JPEG and 10 MB or smaller.");const B=`${n.clientId}/${s.user.id}/${crypto.randomUUID()}-${_.name.replace(/[^\w.\-]+/g,"_")}`;oe(!0),J(null),A(null);const U=await e.storage.from("crm-attachments").upload(B,_,{upsert:!1,contentType:_.type});if(U.error)return oe(!1),J(ka(U.error));const H=await e.rpc("sbh_crm_register_attachment",{p_payload:{entity_type:"contact",entity_id:String(M.id),object_path:B,file_name:_.name,mime_type:_.type,byte_size:_.size}});if(oe(!1),H.error)return J(ka(H.error));A("Attachment registered for this contact."),await It()}const O=M?o[String(M.id)]??[]:[];return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading crm-page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Customer relationships"}),t.jsx("h1",{children:"Smart CRM"}),t.jsx("p",{className:"muted",children:"Contacts, companies, pipeline, consent, and workspace-safe follow-up in one tenant-scoped destination."})]}),t.jsxs("div",{className:"module-header-actions",children:[r&&t.jsxs("button",{className:"primary-inline",type:"button",onClick:a,children:[t.jsx(En,{size:16})," Open Smart Card"]}),t.jsxs("button",{className:"secondary-button",type:"button",onClick:()=>void It(),disabled:V,children:[t.jsx(St,{size:16})," Refresh"]})]})]}),t.jsx("nav",{className:"crm-section-tabs","aria-label":"Smart CRM sections",children:[["contacts","Contacts",hl],["companies","Companies",hr],["pipeline","Pipeline",Yi],["followups","Tasks & follow-ups",Sn]].map(([_,R,B])=>t.jsxs("button",{type:"button",className:W===_?"active":"","aria-current":W===_?"page":void 0,onClick:()=>Xe(_),children:[t.jsx(B,{size:17}),R,_==="followups"&&we>0?t.jsx("span",{children:we}):null]},_))}),q&&t.jsxs("div",{className:"error-box crm-state-message",role:"alert",children:[t.jsx(gs,{size:18}),t.jsx("span",{children:q}),t.jsx("button",{type:"button",className:"secondary-button",onClick:()=>void It(),children:"Try again"})]}),le&&t.jsxs("div",{className:"success-box crm-state-message",role:"status",children:[t.jsx(Kr,{size:18}),le]}),V?t.jsxs("section",{className:"panel crm-loading",role:"status","aria-live":"polite","aria-busy":"true",children:[t.jsx(St,{className:"spin"}),t.jsx("p",{children:"Loading your tenant-scoped CRM workspaceâ¦"})]}):t.jsxs(t.Fragment,{children:[W==="contacts"&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"panel contact-create-panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Add a contact"}),t.jsx("p",{className:"muted",children:"Create a tenant-scoped relationship record. Scanner and loyalty adapters remain separate."})]})}),t.jsxs("form",{className:"contact-create-form",onSubmit:Ae,children:[t.jsxs("label",{htmlFor:"crm-contact-name",children:["Name",t.jsx("input",{id:"crm-contact-name",required:!0,value:F.displayName,onChange:_=>se({...F,displayName:_.target.value}),placeholder:"Full name"})]}),t.jsxs("label",{htmlFor:"crm-contact-business",children:["Business",t.jsx("input",{id:"crm-contact-business",value:F.businessName,onChange:_=>se({...F,businessName:_.target.value}),placeholder:"Business name"})]}),t.jsxs("label",{htmlFor:"crm-contact-email",children:["Email",t.jsx("input",{id:"crm-contact-email",type:"email",value:F.email,onChange:_=>se({...F,email:_.target.value}),placeholder:"[email protected]"})]}),t.jsxs("label",{htmlFor:"crm-contact-phone",children:["Phone",t.jsx("input",{id:"crm-contact-phone",value:F.phone,onChange:_=>se({...F,phone:_.target.value}),placeholder:"Phone"})]}),t.jsxs("label",{htmlFor:"crm-contact-ownership",children:["Workspace visibility",t.jsxs("select",{id:"crm-contact-ownership",value:F.ownership,onChange:_=>se({...F,ownership:_.target.value}),children:[t.jsx("option",{value:"business",children:"Business"}),t.jsx("option",{value:"personal",children:"Personal"}),t.jsx("option",{value:"shared_workspace",children:"Shared workspace"})]})]}),t.jsx("button",{className:"primary-inline",disabled:re,children:re?"Savingâ¦":"Save contact"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsxs("div",{className:"panel-title crm-list-heading",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Contacts"}),t.jsx("p",{className:"muted",children:"Personal, business, and shared workspace contacts stay tenant-scoped."})]}),t.jsxs("label",{className:"search-field",children:[t.jsx(Yr,{size:17}),t.jsx("span",{className:"sr-only",children:"Search contacts"}),t.jsx("input",{"aria-label":"Search contacts",placeholder:"Search contacts",value:ce,onChange:_=>ue(_.target.value)})]})]}),t.jsxs("div",{className:"contact-filter-row",children:[t.jsxs("label",{htmlFor:"crm-event-filter",children:["Filter by event",t.jsx("input",{id:"crm-event-filter",placeholder:"Event name",value:te,onChange:_=>fe(_.target.value)})]}),te&&t.jsx("button",{type:"button",className:"text-button",onClick:()=>fe(""),children:"Clear filter"})]}),de.length?t.jsx("div",{className:"attention-list",children:de.map(_=>{const R=(o[String(_.id)]??[]).find(B=>B.event_type==="relationship.met_at_event");return t.jsxs("button",{type:"button",className:"attention-row contact-row",onClick:()=>et(_),children:[t.jsxs("div",{children:[t.jsx("strong",{children:es(_)}),t.jsx("span",{children:String(_.business_name??_.email??"No business details")}),R&&t.jsx("b",{className:"contact-meeting-context",children:R.event_title})]}),t.jsxs("div",{className:"row-numbers",children:[t.jsxs("span",{children:[String(_.ownership??"business")," · ",String(_.source??"manual")]}),t.jsx(ol,{size:16})]})]},String(_.id))})}):t.jsxs("div",{className:"empty-state",children:[t.jsx(hl,{size:30}),t.jsx("h3",{children:i.length?"No matching contacts":"No contacts yet"}),t.jsx("p",{children:i.length?"Try a different search or event filter.":"Approved Smart Scanner business cards and manually added contacts will appear here."})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"CSV dry-run import"}),t.jsx("p",{className:"muted",children:"Quoted fields are parsed locally. The server never trusts a CSV tenant or loyalty ID, and this path cannot commit contacts."})]})}),T?t.jsx(pi,{compact:!0,icon:Rn,title:"Import contract is source-controlled",copy:"Apply the unhosted sbh_crm_* migration in a disposable database to activate dry-run batches."}):t.jsxs("form",{className:"crm-import-form",onSubmit:Gn,children:[t.jsxs("label",{htmlFor:"crm-csv",children:["CSV with display_name,email,phone,business_name",t.jsx("textarea",{id:"crm-csv",value:We,onChange:_=>
576ot(_.target.value),placeholder:`display_name,email,phone 577"Jane Doe",[email protected],5551234`})]}),t.jsx("button",{className:"primary-inline",disabled:re||!We.trim(),children:re?"Validatingâ¦":"Run dry-run"})]}),it&&t.jsx("p",{className:"muted",role:"status",children:it})]})]}),W==="companies"&&(T?t.jsx(pi,{icon:hr,title:"Company tables are certified but not applied yet",copy:"The tenant-scoped sbh_crm_companies contract is source-controlled. Apply the unhosted migration in a disposable database before creating companies. Business names on contacts remain relationship context, not company records."}):t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Add a company"}),t.jsx("p",{className:"muted",children:"Creates a tenant-owned company through sbh_crm_create_company. Loyalty and provider identity records are not written."})]})}),t.jsxs("form",{className:"contact-create-form",onSubmit:qt,children:[t.jsxs("label",{htmlFor:"crm-company-name",children:["Name",t.jsx("input",{id:"crm-company-name",required:!0,value:ve.name,onChange:_=>ne({...ve,name:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-company-industry",children:["Industry",t.jsx("input",{id:"crm-company-industry",value:ve.industry,onChange:_=>ne({...ve,industry:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-company-email",children:["Email",t.jsx("input",{id:"crm-company-email",type:"email",value:ve.email,onChange:_=>ne({...ve,email:_.target.value})})]}),t.jsx("button",{className:"primary-inline",disabled:re,children:re?"Savingâ¦":"Save company"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Companies"}),d.length?t.jsx("div",{className:"attention-list",children:d.map(_=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:String(_.name)}),t.jsx("span",{children:String(_.industry??_.email??"No industry details")})]}),t.jsx("span",{children:String(_.status??"active")})]},String(_.id)))}):t.jsxs("div",{className:"empty-state",children:[t.jsx(hr,{size:30}),t.jsx("h3",{children:"No companies yet"}),t.jsx("p",{children:"Create a company record instead of grouping free-text contact business names."})]})]})]})),W==="pipeline"&&(T?t.jsx(pi,{icon:Yi,title:"Pipeline contract is certified but not applied yet",copy:"Opportunities use portal_sbh_crm_pipeline and sbh_crm_create_opportunity. Apply the unhosted migration before creating stages or deals."}):t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Create a pipeline"}),t.jsx("p",{className:"muted",children:"Workspace managers can define 1â20 stages. Viewers cannot mutate pipeline data."})]})}),t.jsxs("form",{className:"contact-create-form",onSubmit:lt,children:[t.jsxs("label",{htmlFor:"crm-pipeline-name",children:["Name",t.jsx("input",{id:"crm-pipeline-name",required:!0,value:Z.name,onChange:_=>xe({...Z,name:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-pipeline-stages",children:["Stages",t.jsx("input",{id:"crm-pipeline-stages",required:!0,value:Z.stages,onChange:_=>xe({...Z,stages:_.target.value})})]}),t.jsx("button",{className:"primary-inline",disabled:re,children:re?"Savingâ¦":"Save pipeline"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Add an opportunity"}),t.jsx("p",{className:"muted",children:"Requires a contact or company plus a tenant-scoped stage."})]})}),t.jsxs("form",{className:"contact-create-form",onSubmit:ca,children:[t.jsxs("label",{htmlFor:"crm-opp-name",children:["Name",t.jsx("input",{id:"crm-opp-name",required:!0,value:be.name,onChange:_=>De({...be,name:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-opp-pipeline",children:["Pipeline",t.jsxs("select",{id:"crm-opp-pipeline",required:!0,value:be.pipelineId,onChange:_=>De({...be,pipelineId:_.target.value,stageId:""}),children:[t.jsx("option",{value:"",children:"Choose pipeline"}),h.map(_=>t.jsx("option",{value:String(_.id),children:String(_.name)}
577,String(_.id)))]})]}),t.jsxs("label",{htmlFor:"crm-opp-stage",children:["Stage",t.jsxs("select",{id:"crm-opp-stage",required:!0,value:be.stageId,onChange:_=>De({...be,stageId:_.target.value}),children:[t.jsx("option",{value:"",children:"Choose stage"}),Ue.map(_=>t.jsx("option",{value:String(_.id),children:String(_.name)},String(_.id)))]})]}),t.jsxs("label",{htmlFor:"crm-opp-contact",children:["Contact",t.jsxs("select",{id:"crm-opp-contact",value:be.contactId,onChange:_=>De({...be,contactId:_.target.value}),children:[t.jsx("option",{value:"",children:"Optional contact"}),i.map(_=>t.jsx("option",{value:String(_.id),children:es(_)},String(_.id)))]})]}),t.jsxs("label",{htmlFor:"crm-opp-company",children:["Company",t.jsxs("select",{id:"crm-opp-company",value:be.companyId,onChange:_=>De({...be,companyId:_.target.value}),children:[t.jsx("option",{value:"",children:"Optional company"}),d.map(_=>t.jsx("option",{value:String(_.id),children:String(_.name)},String(_.id)))]})]}),t.jsxs("label",{htmlFor:"crm-opp-amount",children:["Amount",t.jsx("input",{id:"crm-opp-amount",value:be.amount,onChange:_=>De({...be,amount:_.target.value})})]}),t.jsx("button",{className:"primary-inline",disabled:re,children:re?"Savingâ¦":"Save opportunity"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Pipeline"}),p.length?t.jsx("div",{className:"attention-list",children:p.map(_=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:String(_.name)}),t.jsxs("span",{children:[String(_.pipeline_name??"")," · ",String(_.stage_name??"")]})]}),t.jsxs("span",{children:[String(_.status??"open")," · ",String(_.amount??"0")]})]},String(_.id)))}):t.jsxs("div",{className:"empty-state",children:[t.jsx(Yi,{size:30}),t.jsx("h3",{children:"No opportunities yet"}),t.jsx("p",{children:"Create a pipeline and then add a tenant-scoped opportunity."})]})]})]})),W==="followups"&&t.jsxs("section",{className:"crm-followup-grid",children:[t.jsxs("section",{className:"panel",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Follow-up tasks"}),t.jsx("p",{className:"muted",children:"Derived timeline reminders plus persisted sbh_crm_tasks."})]}),t.jsxs("strong",{className:"crm-overdue-count",children:[we," overdue"]})]}),T?t.jsx(pi,{compact:!0,icon:Sn,title:"Persisted tasks wait for the applied schema",copy:"Timeline follow-ups below still work. Apply the unhosted migration to create assigned tasks."}):t.jsxs("form",{className:"contact-create-form",onSubmit:ja,children:[t.jsxs("label",{htmlFor:"crm-task-title",children:["Title",t.jsx("input",{id:"crm-task-title",required:!0,value:Te.title,onChange:_=>ze({...Te,title:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-task-contact",children:["Contact",t.jsxs("select",{id:"crm-task-contact",required:!0,value:Te.contactId,onChange:_=>ze({...Te,contactId:_.target.value}),children:[t.jsx("option",{value:"",children:"Choose contact"}),i.map(_=>t.jsx("option",{value:String(_.id),children:es(_)},String(_.id)))]})]}),t.jsxs("label",{htmlFor:"crm-task-due",children:["Due",t.jsx("input",{id:"crm-task-due",type:"datetime-local",value:Te.dueAt,onChange:_=>ze({...Te,dueAt:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-task-priority",children:["Priority",t.jsxs("select",{id:"crm-task-priority",value:Te.priority,onChange:_=>ze({...Te,priority:_.target.value}),children:[t.jsx("option",{value:"normal",children:"Normal"}),t.jsx("option",{value:"high",children:"High"}),t.jsx("option",{value:"urgent",children:"Urgent"})]})]}),t.jsx("button",{className:"primary-inline",disabled:re,children:re?"Savingâ¦":"Save task"})]}),w.length?t.jsx("div",{className:"crm-followup-list",children:w.map(_=>t.jsxs("button",{type:"button",onClick:()=>{const R=i.find(B=>String(B.id)===String(_.contact_id));R&&et(R)},children:[t.jsx("span",{className:_.due_at&&new Date(String(_.due_at)).getTime()<Date.now()&&_.status!=="completed"?"crm-due overdue":"crm-due",children:String(_.status)}),t.jsx("strong",{children:String(_.title)}),t.jsx("small",{children:_.due_at?new Date(String(_.due_at)).toLocaleStr
577ing():"No due date"})]},String(_.id)))}):null,Ee.length?t.jsx("div",{className:"crm-followup-list",children:Ee.map(_=>t.jsxs("button",{type:"button",onClick:()=>et(_.contact),children:[t.jsx("span",{className:_.overdue?"crm-due overdue":"crm-due",children:_.overdue?"Overdue":"Upcoming"}),t.jsx("strong",{children:es(_.contact)}),t.jsxs("small",{children:[_.dueAt.toLocaleString()," · ",_.timeline.event_title]})]},`${_.timeline.id}-${_.dueAt.toISOString()}`))}):w.length?null:t.jsxs("div",{className:"empty-state",children:[t.jsx(Kr,{size:30}),t.jsx("h3",{children:"No follow-up reminders"}),t.jsx("p",{children:"Add a follow-up date when recording meeting context, or create a persisted task."})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Recommendations"}),t.jsxs("div",{className:"crm-recommendation",children:[t.jsx(Sn,{size:22}),t.jsxs("div",{children:[t.jsx("strong",{children:"Review overdue follow-ups first"}),t.jsx("p",{className:"muted",children:"Browser-derived reminders stay local. Persisted recommendations come from sbh_crm_generate_followup_recommendations and never send messages."})]})]}),b.length?t.jsx("div",{className:"crm-followup-list",children:b.map(_=>t.jsxs("div",{children:[t.jsx("strong",{children:String(_.suggested_action)}),t.jsx("small",{children:String(_.reason)})]},String(_.id)))}):t.jsx("p",{className:"muted",children:"No persisted recommendations yet."}),t.jsx("button",{className:"secondary-button",type:"button",disabled:re||T,onClick:()=>void ie("Recommendations refreshed.",async()=>e.rpc("sbh_crm_generate_followup_recommendations")),children:"Refresh recommendations"})]})]})]}),M&&t.jsx("div",{className:"admin-modal-backdrop",role:"presentation",onMouseDown:_=>{_.target===_.currentTarget&&E(null)},children:t.jsxs("section",{className:"admin-modal contact-detail-modal",role:"dialog","aria-modal":"true","aria-labelledby":"contact-detail-title",children:[t.jsxs("div",{className:"admin-modal-title",children:[t.jsx("h2",{id:"contact-detail-title",children:es(M)}),t.jsx("button",{ref:Ce,type:"button",onClick:()=>E(null),"aria-label":"Close contact",children:t.jsx(gt,{})})]}),t.jsxs("p",{className:"muted",children:[String(M.business_name??"")," · ",String(M.email??M.phone??"No contact details")]}),t.jsxs("div",{className:"metric-grid",children:[t.jsxs("div",{className:"panel",children:[t.jsx(xi,{}),t.jsx("p",{children:"Status"}),t.jsx("strong",{children:String(M.status??"active")})]}),t.jsxs("div",{className:"panel",children:[t.jsx(ol,{}),t.jsx("p",{children:"Ownership"}),t.jsx("strong",{children:String(M.ownership??"business")})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h3",{children:"Edit contact"}),t.jsx("p",{className:"muted",children:"Updates remain inside the current tenant and preserve contact ownership."})]})}),t.jsxs("form",{className:"contact-create-form",onSubmit:Pe,children:[t.jsxs("label",{htmlFor:"crm-edit-contact-name",children:["Name",t.jsx("input",{id:"crm-edit-contact-name",required:!0,value:he.displayName,onChange:_=>je({...he,displayName:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-edit-contact-business",children:["Business",t.jsx("input",{id:"crm-edit-contact-business",value:he.businessName,onChange:_=>je({...he,businessName:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-edit-contact-email",children:["Email",t.jsx("input",{id:"crm-edit-contact-email",type:"email",value:he.email,onChange:_=>je({...he,email:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-edit-contact-phone",children:["Phone",t.jsx("input",{id:"crm-edit-contact-phone",value:he.phone,onChange:_=>je({...he,phone:_.target.value})})]}),t.jsxs("div",{className:"smart-card-actions",children:[t.jsx("button",{className:"primary-inline",disabled:re,children:"Save changes"}),String(M.status??"active")==="archived"?t.jsx("button",{className:"secondary-button",type:"button",disabled:re,onClick:()=>void Re(!1),children:"Restore contact"}):t.jsx("button",{className:"secondary-button",type:"button",disabled:re,onClick:()=>void Re(!0),children:"Archive contact"})]})]})]}),t.jsxs("section",{className:"contact-timeline",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Relationship timeline"}),t.jsx("p",{className:"muted",children:"Private notes stay with your workspace."})]}),t.jsx("button",{className:"primary-inline",type:"button",onClick:()=>Y(!0),children:"Where did we meet?"})]}),O.length?O.map(_=>{var R,B,U,H;return t.jsxs("article",{children:[t.jsx("strong",{children:_.event_title}),t.jsxs("span",{children:[new Date(_.occurred_at).toLocaleDateString()," · ",String(((R=_.details)==null?void 0:R.location)??((B=_.details)==null?void 0:B.capture_source)??"Recorded")]}
577),typeof((U=_.details)==null?void 0:U.follow_up_at)=="string"&&_.details.follow_up_at?t.jsxs("b",{className:"contact-followup-date",children:["Follow up ",new Date(_.details.follow_up_at).toLocaleString()]}):null,(H=_.details)!=null&&H.notes?t.jsx("p",{children:String(_.details.notes)}):null]},_.id)}):t.jsx("p",{className:"muted",children:"No relationship history recorded yet."})]}),t.jsxs("section",{className:"panel crm-consent-panel",children:[t.jsx("h3",{children:"Consent and fatigue"}),t.jsx("p",{className:"muted",children:"Defaults stay denied. Enabling a channel requires a consent source. This records a decision; it does not send email or SMS."}),T?t.jsx("p",{className:"muted",children:"Consent RPCs activate after the unhosted sbh_crm_* migration is applied."}):t.jsxs("form",{className:"crm-consent-form",onSubmit:Ma,children:[t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.email,onChange:_=>vt({...Le,email:_.target.checked})})," Email"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.sms,onChange:_=>vt({...Le,sms:_.target.checked})})," SMS"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.phone,onChange:_=>vt({...Le,phone:_.target.checked})})," Phone"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.marketingEmail,onChange:_=>vt({...Le,marketingEmail:_.target.checked})})," Marketing email"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.marketingSms,onChange:_=>vt({...Le,marketingSms:_.target.checked})})," Marketing SMS"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.service,onChange:_=>vt({...Le,service:_.target.checked})})," Service messages"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:Le.dnc,onChange:_=>vt({...Le,dnc:_.target.checked})})," Do not contact"]}),t.jsxs("label",{htmlFor:"crm-consent-source",children:["Consent source",t.jsx("input",{id:"crm-consent-source",value:Le.source,onChange:_=>vt({...Le,source:_.target.value}),placeholder:"verbal, form, import review"})]}),t.jsxs("div",{className:"smart-card-actions",children:[t.jsx("button",{className:"primary-inline",disabled:re,children:"Save preferences"}),t.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void xn(),children:"Check marketing eligibility"})]})]}),Me&&t.jsx("p",{className:"muted",role:"status",children:Me})]}),t.jsxs("section",{className:"crm-attachments panel",children:[t.jsxs("div",{children:[t.jsx(op,{size:22}),t.jsx("h3",{children:"Attachments"})]}),T?t.jsx("p",{className:"muted",children:"Attachment registration waits for the applied crm-attachments contract."}):t.jsxs(t.Fragment,{children:[Oe.length?t.jsx("ul",{className:"crm-attachment-list",children:Oe.map(_=>t.jsxs("li",{children:[String(_.file_name)," · ",String(_.mime_type)]},String(_.id)))}):t.jsx("p",{className:"muted",children:"No attachments registered for this contact."}),t.jsxs("label",{className:"secondary-button crm-upload-label",children:[t.jsx(Rn,{size:16})," Upload attachment",t.jsx("input",{hidden:!0,type:"file",accept:".txt,.csv,.pdf,.png,.jpg,.jpeg,text/plain,text/csv,application/pdf,image/png,image/jpeg",onChange:_=>{var B;const R=(B=_.target.files)==null?void 0:B[0];_.target.value="",R&&Xn(R)}})]})]})]}),z&&t.jsxs("section",{className:"meeting-context-form",children:[t.jsx("h3",{children:"Record meeting context"}),t.jsxs("label",{htmlFor:"crm-meeting-event",children:["Search platform events",t.jsxs("select",{id:"crm-meeting-event",value:Ge.eventId,onChange:_=>ct(_.target.value),children:[t.jsx("option",{value:"",children:"Choose an event or enter one below"}),D.map(_=>t.jsxs("option",{value:_.id,children:[_.title,_.starts_at?` · ${_.starts_at.slice(0,10)}`:""]},_.id))]})]}),t.jsxs("label",{htmlFor:"crm-meeting-name",children:["Other event",t.jsx("input",{id:"crm-meeting-name",value:Ge.eventName,onChange:_=>Ze({...Ge,eventName:_.target.value}),placeholder:"Event name"})]}),t.jsxs("div",{className:"meeting-grid",children:[t.jsxs("label",{htmlFor:"crm-meeting-date",children:["Date met",t.jsx("input",{id:"crm-meeting-date",type:"date",value:Ge.metOn,onChange:_=>Ze({...Ge,metOn:_.target.value})})]}),t.jsxs("label",{htmlFor:"crm-meeting-location",children:["Location",t.jsx("input",{id:"crm-meeting-location",value:Ge.location,onChange:_=>Ze({...Ge,location:_.target.value}),placeholder:"Location"})]})]}),t.jsxs("label",{htmlFor:"crm-meeting-notes",children:["Notes",t.jsx("textarea",{id:"crm-meeting-notes",value:Ge.notes,onChange:_=>Ze({...Ge,notes:_.target.value}),maxLength:2e3,placeholder:"What should you remember?"})]}),t.jsxs("label",{htmlFor:"crm-meeting-source",children:["Capture source",t.jsxs("select",{id:"crm-meeting-source",value:Ge.source,onCh
vendor: 25,212 bytes, lines 577-583
577ange:_=>Ze({...Ge,source:_.target.value}),children:[t.jsx("option",{value:"manual",children:"Manual"}),t.jsx("option",{value:"smart_card",children:"Smart Card"}),t.jsx("option",{value:"scanner",children:"Scanner"}),t.jsx("option",{value:"import",children:"Import"}),t.jsx("option",{value:"conference_mode",children:"Conference mode"})]})]}),t.jsxs("label",{htmlFor:"crm-meeting-followup",children:["Optional follow-up reminder",t.jsx("input",{id:"crm-meeting-followup",type:"datetime-local",value:Ge.followUpAt,onChange:_=>Ze({...Ge,followUpAt:_.target.value})})]}),t.jsxs("div",{className:"smart-card-actions",children:[t.jsx("button",{className:"secondary-button",type:"button",onClick:()=>Y(!1),children:"Cancel"}),t.jsx("button",{className:"primary-inline",type:"button",disabled:!Ge.eventName.trim()||re,onClick:()=>void ft(),children:re?"Savingâ¦":"Save meeting context"})]})]})]})})]})}function pi({icon:e,title:r,copy:a,compact:n=!1}){return t.jsxs("section",{className:n?"crm-contract-gate compact":"panel crm-contract-gate",children:[t.jsx(e,{size:28}),t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Contract gate"}),t.jsx("h2",{children:r}),t.jsx("p",{className:"muted",children:a})]})]})}var bn={},hc,Hd;function YS(){return Hd||(Hd=1,hc=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),hc}var fc={},Sa={},Wd;function pn(){if(Wd)return Sa;Wd=1;let e;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Sa.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},Sa.getSymbolTotalCodewords=function(n){return r[n]},Sa.getBCHDigit=function(a){let n=0;for(;a!==0;)n++,a>>>=1;return n},Sa.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},Sa.isKanjiModeEnabled=function(){return typeof e<"u"},Sa.toSJIS=function(n){return e(n)},Sa}var pc={},Vd;function sl(){return Vd||(Vd=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function r(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+a)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,s){if(e.isValid(n))return n;try{return r(n)}catch{return s}}})(pc)),pc}var mc,qd;function JS(){if(qd)return mc;qd=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(r){const a=Math.floor(r/8);return(this.buffer[a]>>>7-r%8&1)===1},put:function(r,a){for(let n=0;n<a;n++)this.putBit((r>>>a-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),r&&(this.buffer[a]|=128>>>this.length%8),this.length++}},mc=e,mc}var xc,$d;function QS(){if($d)return xc;$d=1;function e(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}return e.prototype.set=function(r,a,n,s){const i=r*this.size+a;this.data[i]=n,s&&(this.reservedBit[i]=!0)},e.prototype.get=function(r,a){return this.data[r*this.size+a]},e.prototype.xor=function(r,a,n){this.data[r*this.size+a]^=n},e.prototype.isReserved=function(r,a){return this.reservedBit[r*this.size+a]},xc=e,xc}var gc={},Gd;function ZS(){return Gd||(Gd=1,(function(e){const r=pn().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const s=Math.floor(n/7)+2,i=r(n),c=i===145?26:Math.ceil((i-13)/(2*s-2))*2,o=[i-7];for(let l=1;l<s-1;l++)o[l]=o[l-1]-c;return o.push(6),o.reverse()},e.getPositions=function(n){const s=[],i=e.getRowColCoords(n),c=i.length;for(let o=0;o<c;o++)for(let l=0;l<c;l++)o===0&&l===0||o===0&&l===c-1||o===c-1&&l===0||s.push([i[o],i[l]]);return s}})(gc)),gc}var vc={},Xd;function eN(){if(Xd)return vc;Xd=1;const e=pn().getSymbolSize,r=7;return vc.getPositions=function(n){const s=e(n);return[[0,0],[s-r,0],[0,s-r]]},vc}var yc={},Kd;function tN(){return Kd||(Kd=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const r={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const i=s.size;let c=0,o=0,l=0,d=null,u=null;for(let h=0;h<i;h++){o=l=0,d=u=null;for(let f=0;f<i;f++){let m=s.get(h,f);m===d?o++:(o>=5&&(c+=r.N1+(o-5)),d=m,o=1),m=s.get(f,h),m===u?l++:(l>=5&&(c+=r.N1+(l-5)),u=m,l=1)}o>=5&&(c+=r.N1+(o-5)),l>=5&&(c+=r.N1+(l-5))}return c},e.getPenaltyN2=function(s){const i=s.size;let c=0;for(let o=0;o<i-1;o++)for(let l=0;l<i-1;l++){const d=s.get(o,l)+s.get(o,l+1)+s.get(o+1,l)+s.get(o+1,l+1);(d===4||d===0)&&c++}return c*r.N2},e.getPenaltyN3=function(s){const i=s.size;let c=0,o=0,l=0;for(let d=0;d<i;d++){o=l=0;for(let u=0;u<i;u++)o=o<<1&2047|s.get(d,u),u>=10&&(o===1488||o===93)&&c++,l=l<<1&2047|s.get(u,d),u>=10&&(l===1488||l===93)&&c++}return c*r.N3},e.getPenaltyN4=function(s){let i=0;const c=s.data.length;for(let l=0;l<c;l++)i+=s.data[l];return Math.abs(Math.ceil(i*100/c/5)-10)*r.N4};function a(n,s,i){switch(n){case e.Patterns.PATTERN000:return(s+i)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return i%3===0;case e.Patterns.PATTERN011:return(s+i)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(i/3))%2===0;case e.Patterns.PATTERN101:return s*i%2+s*i%3===0;case e.Patterns.PATTERN110:return(s*i%2+s*i%3)%2===0;case e.Patterns.PATTERN111:return(s*i%3+(s+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(s,i){const c=i.size;for(let o=0;o<c;o++)for(let l=0;l<c;l++)i.isReserved(l,o)||i.xor(l,o,a(s,l,o))},e.getBestMask=function(s,i){const c=Object.keys(e.Patterns).length;let o=0,l=1/0;for(let d=0;d<c;d++){i(d),e.applyMask(d,s);const u=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(d,s),u<l&&(l=u,o=d)}return o}})(yc)),yc}var mi={},Yd;function xf(){if(Yd)return mi;Yd=1;const e=sl(),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return mi.getBlocksCount=function(s,i){switch(i){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},mi.getTotalCodewordsCount=function(s,i){switch(i){case e.L:return a[(s-1)*4+0];case e.M:return a[(s-1)*4+1];case e.Q:return a[(s-1)*4+2];case e.H:return a[(s-1)*4+3];default:return}},mi}var _c={},ts={},Jd;function rN(){if(Jd)return ts;Jd=1;const e=new Uint8Array(512),r=new Uint8Array(256);return(function(){let n=1;for(let s=0;s<255;s++)e[s]=n,r[n]=s,n<<=1,n&256&&(n^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),ts.log=function(n){if(n<1)throw new Error("log("+n+")");return r[n]},ts.exp=function(n){return e[n]},ts.mul=function(n,s){return n===0||s===0?0:e[r[n]+r[s]]},ts}var Qd;function aN(){return Qd||(Qd=1,(function(e){const r=rN();e.mul=function(n,s){const i=new Uint8Array(n.length+s.length-1);for(let c=0;c<n.length;c++)for(let o=0;o<s.length;o++)i[c+o]^=r.mul(n[c],s[o]);return i},e.mod=function(n,s){let i=new Uint8Array(n);for(;i.length-s.length>=0;){const c=i[0];for(let l=0;l<s.length;l++)i[l]^=r.mul(s[l],c);let o=0;for(;o<i.length&&i[o]===0;)o++;i=i.slice(o)}return i},e.generateECPolynomial=function(n){let s=new Uint8Array([1]);for(let i=0;i<n;i++)s=e.mul(s,new Uint8Array([1,r.exp(i)]));return s}})(_c)),_c}var bc,Zd;function nN(){if(Zd)return bc;Zd=1;const e=aN();function r(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return r.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},r.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(n.length+this.degree);s.set(n);const i=e.mod(s,this.genPoly),c=this.degree-i.length;if(c>0){const o=new Uint8Array(this.degree);return o.set(i,c),o}return i},bc=r,bc}var jc={},wc={},kc={},eu;function gf(){return eu||(eu=1,kc.isValid=function(r){return!isNaN(r)&&r>=1&&r<=40}),kc}var Qr={},tu;function vf(){if(tu)return Qr;tu=1;const e="[0-9]+",r="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r 578]))+`;Qr.KANJI=new RegExp(a,"g"),Qr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Qr.BYTE=new RegExp(n,"g"),Qr.NUMERIC=new RegExp(e,"g"),Qr.ALPHANUMERIC=new RegExp(r,"g");const s=new RegExp("^"+a+"$"),i=new RegExp("^"+e+"$"),c=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Qr.testKanji=function(l){return s.test(l)},Qr.testNumeric=function(l){return i.test(l)},Qr.testAlphanumeric=function(l){return c.test(l)},Qr}var ru;function mn(){return ru||(ru=1,(function(e){const r=gf(),a=vf();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,c){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!r.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?i.ccBits[0]:c<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return a.testNumeric(i)?e.NUMERIC:a.testAlphanumeric(i)?e.ALPHANUMERIC:a.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function n(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(i,c){if(e.isValid(i))return i;try{return n(i)}catch{return c}}})(wc)),wc}var au;function sN(){return au||(au=1,(function(e){const r=pn(),a=xf(),n=sl(),s=mn(),i=gf(),c=7973,o=r.getBCHDigit(c);function l(f,m,x){for(let p=1;p<=40;p++)if(m<=e.getCapacity(p,x,f))return p}function d(f,m){return s.getCharCountIndicator(f,m)+4}function u(f,m){let x=0;return f.forEach(function(p){const g=d(p.mode,m);x+=g+p.getBitsLength()}),x}function h(f,m){for(let x=1;x<=40;x++)if(u(f,x)<=e.getCapacity(x,m,s.MIXED))return x}e.from=function(m,x){return i.isValid(m)?parseInt(m,10):x},e.getCapacity=function(m,x,p){if(!i.isValid(m))throw new Error("Invalid QR Code version");typeof p>"u"&&(p=s.BYTE);const g=r.getSymbolTotalCodewords(m),w=a.getTotalCodewordsCount(m,x),S=(g-w)*8;if(p===s.MIXED)return S;const b=S-d(p,m);switch(p){case s.NUMERIC:return Math.floor(b/10*3);case s.ALPHANUMERIC:return Math.floor(b/11*2);case s.KANJI:return Math.floor(b/13);case s.BYTE:default:return Math.floor(b/8)}},e.getBestVersionForData=function(m,x){let p;const g=n.from(x,n.M);if(Array.isArray(m)){if(m.length>1)return h(m,g);if(m.length===0)return 1;p=m[0]}else p=m;return l(p.mode,p.getLength(),g)},e.getEncodedBits=function(m){if(!i.isValid(m)||m<7)throw new Error("Invalid QR Code version");let x=m<<12;for(;r.getBCHDigit(x)-o>=0;)x^=c<<r.getBCHDigit(x)-o;return m<<12|x}})(jc)),jc}var Sc={},nu;function iN(){if(nu)return Sc;nu=1;const e=pn(),r=1335,a=21522,n=e.getBCHDigit(r);return Sc.getEncodedBits=function(i,c){const o=i.bit<<3|c;let l=o<<10;for(;e.getBCHDigit(l)-n>=0;)l^=r<<e.getBCHDigit(l)-n;return(o<<10|l)^a},Sc}var Nc={},Cc,su;function cN(){if(su)return Cc;su=1;const e=mn();function r(a){this.mode=e.NUMERIC,this.data=a.toString()}return r.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let s,i,c;for(s=0;s+3<=this.data.length;s+=3)i=this.data.substr(s,3),c=parseInt(i,10),n.put(c,10);const o=this.data.length-s;o>0&&(i=this.data.substr(s),c=parseInt(i,10),n.put(c,o*3+1))},Cc=r,Cc}var Ec,iu;function oN(){if(iu)return Ec;iu=1;const e=mn(),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(n){this.mode=e.ALPHANUMERIC,this.data=n}return a.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(s){let i;for(i=0;i+2<=this.data.length;i+=2){let c=r.indexOf(this.data[i])*45;c+=r.indexOf(this.data[i+1]),s.put(c,11)}this.data.length%2&&s.put(r.indexOf(this.data[i]),6)},Ec=a,Ec}var Tc,cu;function lN(){if(cu)return Tc;cu=1;const e=mn();function r(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return r.getBitsLength=function(n){return n*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(a){for(let n=0,s=this.data.length;n<s;n++)a.put(this.data[n],8)},Tc=r,Tc}var Ac,ou;function dN(){if(ou)return Ac;ou=1;const e=mn(),r=pn();function a(n){this.mode=e.KANJI,this.data=n}return a.getBitsLength=function(s){return s*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(n){let s;for(s=0;s<this.data.length;s++){let i=r.toSJIS(this.data[s]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+` 579Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13)}},Ac=a,Ac}var Fc={exports:{}},lu;function uN(){return lu||(lu=1,(function(e){var r={single_source_shortest_paths:function(a,n,s){var i={},c={};c[n]=0;var o=r.PriorityQueue.make();o.push(n,0);for(var l,d,u,h,f,m,x,p,g;!o.empty();){l=o.pop(),d=l.value,h=l.cost,f=a[d]||{};for(u in f)f.hasOwnProperty(u)&&(m=f[u],x=h+m,p=c[u],g=typeof c[u]>"u",(g||p>x)&&(c[u]=x,o.push(u,x),i[u]=d))}if(typeof s<"u"&&typeof c[s]>"u"){var w=["Could not find a path from ",n," to ",s,"."].join("");throw new Error(w)}return i},extract_shortest_path_from_predecessor_list:function(a,n){for(var s=[],i=n;i;)s.push(i),a[i],i=a[i];return s.reverse(),s},find_path:function(a,n,s){var i=r.single_source_shortest_paths(a,n,s);return r.extract_shortest_path_from_predecessor_list(i,s)},PriorityQueue:{make:function(a){var n=r.PriorityQueue,s={},i;a=a||{};for(i in n)n.hasOwnProperty(i)&&(s[i]=n[i]);return s.queue=[],s.sorter=a.sorter||n.default_sorter,s},default_sorter:function(a,n){return a.cost-n.cost},push:function(a,n){var s={value:a,cost:n};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=r})(Fc)),Fc.exports}var du;function hN(){return du||(du=1,(function(e){const r=mn(),a=cN(),n=oN(),s=lN(),i=dN(),c=vf(),o=pn(),l=uN();function d(w){return unescape(encodeURIComponent(w)).length}function u(w,S,b){const j=[];let k;for(;(k=w.exec(b))!==null;)j.push({data:k[0],index:k.index,mode:S,length:k[0].length});return j}function h(w){const S=u(c.NUMERIC,r.NUMERIC,w),b=u(c.ALPHANUMERIC,r.ALPHANUMERIC,w);let j,k;return o.isKanjiModeEnabled()?(j=u(c.BYTE,r.BYTE,w),k=u(c.KANJI,r.KANJI,w)):(j=u(c.BYTE_KANJI,r.BYTE,w),k=[]),S.concat(b,j,k).sort(function(C,P){return C.index-P.index}).map(function(C){return{data:C.data,mode:C.mode,length:C.length}})}function f(w,S){switch(S){case r.NUMERIC:return a.getBitsLength(w);case r.ALPHANUMERIC:return n.getBitsLength(w);case r.KANJI:return i.getBitsLength(w);case r.BYTE:return s.getBitsLength(w)}}function m(w){return w.reduce(function(S,b){const j=S.length-1>=0?S[S.length-1]:null;return j&&j.mode===b.mode?(S[S.length-1].data+=b.data,S):(S.push(b),S)},[])}function x(w){const S=[];for(let b=0;b<w.length;b++){const j=w[b];switch(j.mode){case r.NUMERIC:S.push([j,{data:j.data,mode:r.ALPHANUMERIC,length:j.length},{data:j.data,mode:r.BYTE,length:j.length}]);break;case r.ALPHANUMERIC:S.push([j,{data:j.data,mode:r.BYTE,length:j.length}]);break;case r.KANJI:S.push([j,{data:j.data,mode:r.BYTE,length:d(j.data)}]);break;case r.BYTE:S.push([{data:j.data,mode:r.BYTE,length:d(j.data)}])}}return S}function p(w,S){const b={},j={start:{}};let k=["start"];for(let N=0;N<w.length;N++){const C=w[N],P=[];for(let T=0;T<C.length;T++){const L=C[T],M=""+N+T;P.push(M),b[M]={node:L,lastCount:0},j[M]={};for(let E=0;E<k.length;E++){const W=k[E];b[W]&&b[W].node.mode===L.mode?(j[W][M]=f(b[W].lastCount+L.length,L.mode)-f(b[W].lastCount,L.mode),b[W].lastCount+=L.length):(b[W]&&(b[W].lastCount=L.length),j[W][M]=f(L.length,L.mode)+4+r.getCharCountIndicator(L.mode,S))}}k=P}for(let N=0;N<k.length;N++)j[k[N]].end=0;return{map:j,table:b}}function g(w,S){let b;const j=r.getBestModeForData(w);if(b=r.from(S,j),b!==r.BYTE&&b.bit<j.bit)throw new Error('"'+w+'" cannot be encoded with mode '+r.toString(b)+`. 580 Suggested mode is: `+r.toString(j));switch(b===r.KANJI&&!o.isKanjiModeEnabled()&&(b=r.BYTE),b){case r.NUMERIC:return new a(w);case r.ALPHANUMERIC:return new n(w);case r.KANJI:return new i(w);case r.BYTE:return new s(w)}}e.fromArray=function(S){return S.reduce(function(b,j){return typeof j=="string"?b.push(g(j,null)):j.data&&b.push(g(j.data,j.mode)),b},[])},e.fromString=function(S,b){const j=h(S,o.isKanjiModeEnabled()),k=x(j),N=p(k,b),C=l.find_path(N.map,"start","end"),P=[];for(let T=1;T<C.length-1;T++)P.push(N.table[C[T]].node);return e.fromArray(m(P))},e.rawSplit=function(S){return e.fromArray(h(S,o.isKanjiModeEnabled()))}})(Nc)),Nc}var uu;function fN(){if(uu)return fc;uu=1;const e=pn(),r=sl(),a=JS(),n=QS(),s=ZS(),i=eN(),c=tN(),o=xf(),l=nN(),d=sN(),u=iN(),h=mn(),f=hN();function m(N,C){const P=N.size,T=i.getPositions(C);for(let L=0;L<T.length;L++){const M=T[L][0],E=T[L][1];for(let W=-1;W<=7;W++)if(!(M+W<=-1||P<=M+W))for(let ee=-1;ee<=7;ee++)E+ee<=-1||P<=E+ee||(W>=0&&W<=6&&(ee===0||ee===6)||ee>=0&&ee<=6&&(W===0||W===6)||W>=2&&W<=4&&ee>=2&&ee<=4?N.set(M+W,E+ee,!0,!0):N.set(M+W,E+ee,!1,!0))}}function x(N){const C=N.size;for(let P=8;P<C-8;P++){const T=P%2===0;N.set(P,6,T,!0),N.set(6,P,T,!0)}}function p(N,C){const P=s.getPositions(C);for(let T=0;T<P.length;T++){const L=P[T][0],M=P[T][1];for(let E=-2;E<=2;E++)for(let W=-2;W<=2;W++)E===-2||E===2||W===-2||W===2||E===0&&W===0?N.set(L+E,M+W,!0,!0):N.set(L+E,M+W,!1,!0)}}function g(N,C){const P=N.size,T=d.getEncodedBits(C);let L,M,E;for(let W=0;W<18;W++)L=Math.floor(W/3),M=W%3+P-8-3,E=(T>>W&1)===1,N.set(L,M,E,!0),N.set(M,L,E,!0)}function w(N,C,P){const T=N.size,L=u.getEncodedBits(C,P);let M,E;for(M=0;M<15;M++)E=(L>>M&1)===1,M<6?N.set(M,8,E,!0):M<8?N.set(M+1,8,E,!0):N.set(T-15+M,8,E,!0),M<8?N.set(8,T-M-1,E,!0):M<9?N.set(8,15-M-1+1,E,!0):N.set(8,15-M-1,E,!0);N.set(T-8,8,1,!0)}function S(N,C){const P=N.size;let T=-1,L=P-1,M=7,E=0;for(let W=P-1;W>0;W-=2)for(W===6&&W--;;){for(let ee=0;ee<2;ee++)if(!N.isReserved(L,W-ee)){let ce=!1;E<C.length&&(ce=(C[E]>>>M&1)===1),N.set(L,W-ee,ce),M--,M===-1&&(E++,M=7)}if(L+=T,L<0||P<=L){L-=T,T=-T;break}}}function b(N,C,P){const T=new a;P.forEach(function(ee){T.put(ee.mode.bit,4),T.put(ee.getLength(),h.getCharCountIndicator(ee.mode,N)),ee.write(T)});const L=e.getSymbolTotalCodewords(N),M=o.getTotalCodewordsCount(N,C),E=(L-M)*8;for(T.getLengthInBits()+4<=E&&T.put(0,4);T.getLengthInBits()%8!==0;)T.putBit(0);const W=(E-T.getLengthInBits())/8;for(let ee=0;ee<W;ee++)T.put(ee%2?17:236,8);return j(T,N,C)}function j(N,C,P){const T=e.getSymbolTotalCodewords(C),L=o.getTotalCodewordsCount(C,P),M=T-L,E=o.getBlocksCount(C,P),W=T%E,ee=E-W,ce=Math.floor(T/E),ue=Math.floor(M/E),te=ue+1,fe=ce-ue,q=new l(fe);let J=0;const le=new Array(E),A=new Array(E);let V=0;const I=new Uint8Array(N.buffer);for(let re=0;re<E;re++){const oe=re<ee?ue:te;le[re]=I.slice(J,J+oe),A[re]=q.encode(le[re]),J+=oe,V=Math.max(V,oe)}const D=new Uint8Array(T);let K=0,z,Y;for(z=0;z<V;z++)for(Y=0;Y<E;Y++)z<le[Y].length&&(D[K++]=le[Y][z]);for(z=0;z<fe;z++)for(Y=0;Y<E;Y++)D[K++]=A[Y][z];return D}function k(N,C,P,T){let L;if(Array.isArray(N))L=f.fromArray(N);else if(typeof N=="string"){let ce=C;if(!ce){const ue=f.rawSplit(N);ce=d.getBestVersionForData(ue,P)}L=f.fromString(N,ce||40)}else throw new Error("Invalid data");const M=d.getBestVersionForData(L,P);if(!M)throw new Error("The amount of data is too big to be stored in a QR Code");if(!C)C=M;else if(C<M)throw new Error(` 581The chosen QR Code version cannot contain this amount of data. 582Minimum version required to store current data is: `+M+`. 583`);const E=b(C,P,L),W=e.getSymbolSize(C),ee=new n(W);return m(ee,C),x(ee),p(ee,C),w(ee,P,0),C>=7&&g(ee,C),S(ee,E),isNaN(T)&&(T=c.getBestMask(ee,w.bind(null,ee,P))),c.applyMask(T,ee),w(ee,P,T),{modules:ee,version:C,errorCorrectionLevel:P,maskPattern:T,segments:L}}return fc.create=function(C,P){if(typeof C>"u"||C==="")throw new Error("No input text");let T=r.M,L,M;return typeof P<"u"&&(T=r.from(P.errorCorrectionLevel,r.M),L=d.from(P.version),M=c.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),k(C,L,T,M)},fc}var Ic={},Pc={},hu;function yf(){return hu||(hu=1,(function(e){function r(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let n=a.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+a);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(i){return[i,i]}))),n.length===6&&n.push("F","F");const s=parseInt(n.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const s=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,i=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:i,scale:i?4:c,margin:s,color:{dark:r(n.color.dark||"#000000ff"),light:r(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,s){return s.width&&s.width>=n+s.margin*2?s.width/(n+s.margin*2):s.scale},e.getImageWidth=function(n,s){const i=e.getScale(n,s);return Math.floor((n+s.margin*2)*i)},e.qrToImageData=function(n,s,i){const c=s.modules.size,o=s.modules.data,l=e.getScale(c,i),d=Math.floor((c+i.margin*2)*l),u=i.margin*l,h=[i.color.light,i.color.dark];for(let f=0;f<d;f++)for(let m=0;m<d;m++){let x=(f*d+m)*4,p=i.color.light;if(f>=u&&m>=u&&f<d-u&&m<d-u){const g=Math.floor((f-u)/l),w=Math.floor((m-u)/l);p=h[o[g*c+w]?1:0]}n[x++]=p.r,n[x++]=p.g,n[x++]=p.b,n[x]=p.a}}})(Pc)),Pc}var fu;function pN(){return fu||(fu=1,(function(e){const r=yf();function a(s,i,c){s.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=c,i.width=c,i.style.height=c+"px",i.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,c,o){let l=o,d=c;typeof l>"u"&&(!c||!c.getContext)&&(l=c,c=void 0),c||(d=n()),l=r.getOptions(l);const u=r.getImageWidth(i.modules.size,l),h=d.getContext("2d"),f=h.createImageData(u,u);return r.qrToImageData(f.data,i,l),a(h,d,u),h.putImageData(f,0,0),d},e.renderToDataURL=function(i,c,o){let l=o;typeof l>"u"&&(!c||!c.getContext)&&(l=c,c=void 0),l||(l={});const d=e.render(i,c,l),u=l.type||"image/png",h=l.rendererOpts||{};return d.toDataURL(u,h.quality)}})(Ic)),Ic}var Dc={},pu;function mN(){if(pu)return Dc;pu=1;const e=yf();function r(s,i){const c=s.a/255,o=i+'="'+s.hex+'"';return c<1?o+" "+i+'-opacity="'+c.toFixed(2).slice(1)+'"':o}function a(s,i,c){let o=s+i;return typeof c<"u"&&(o+=" "+c),o}function n(s,i,c){let o="",l=0,d=!1,u=0;for(let h=0;h<s.length;h++){const f=Math.floor(h%i),m=Math.floor(h/i);
583!f&&!d&&(d=!0),s[h]?(u++,h>0&&f>0&&s[h-1]||(o+=d?a("M",f+c,.5+m+c):a("m",l,0),l=0,d=!1),f+1<i&&s[h+1]||(o+=a("h",u),u=0)):l++}return o}return Dc.render=function(i,c,o){const l=e.getOptions(c),d=i.modules.size,u=i.modules.data,h=d+l.margin*2,f=l.color.light.a?"<path "+r(l.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",m="<path "+r(l.color.dark,"stroke")+' d="'+n(u,d,l.margin)+'"/>',x='viewBox="0 0 '+h+" "+h+'"',g='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+x+' shape-rendering="crispEdges">'+f+m+`</svg> 584`;return typeof o=="function"&&o(null,g),g},Dc}var mu;function xN(){if(mu)return bn;mu=1;const e=YS(),r=fN(),a=pN(),n=mN();function s(i,c,o,l,d){const u=[].slice.call(arguments,1),h=u.length,f=typeof u[h-1]=="function";if(!f&&!e())throw new Error("Callback required as last argument");if(f){if(h<2)throw new Error("Too few arguments provided");h===2?(d=o,o=c,c=l=void 0):h===3&&(c.getContext&&typeof d>"u"?(d=l,l=void 0):(d=l,l=o,o=c,c=void 0))}else{if(h<1)throw new Error("Too few arguments provided");return h===1?(o=c,c=l=void 0):h===2&&!c.getContext&&(l=o,o=c,c=void 0),new Promise(function(m,x){try{const p=r.create(o,l);m(i(p,c,l))}catch(p){x(p)}})}try{const m=r.create(o,l);d(null,i(m,c,l))}catch(m){d(m)}}return bn.create=r.create,bn.toCanvas=s.bind(null,a.render),bn.toDataURL=s.bind(null,a.renderToDataURL),bn.toString=s.bind(null,function(i,c,o){return n.render(i,o)}),bn}var gN=xN();const _f=Lf(gN),vN={unverified:"Not verified",pending_review:"Pending review",verified:"Verified Business",rejected:"Review needed",suspended:"Verification suspended"};function yN({supabase:e}){const[r,a]=y.useState(null),[n,s]=y.useState(null),[i,c]=y.useState(!0),[o,l]=y.useState(!1),d=async()=>{c(!0);const f=await e.rpc("portal_get_my_business_verification");f.error?s("Verification controls become available after the reviewed verification migration is applied."):a(f.data),c(!1)};y.useEffect(()=>{d()},[e]);const u=async()=>{l(!0),s(null);const f=await e.rpc("portal_request_business_verification");f.error?s(f.error.message):(s("Your verification request is queued for an authorized SBH review."),await d()),l(!1)},h=(r==null?void 0:r.status)??"unverified";return t.jsxs("section",{className:"panel","aria-labelledby":"business-verification-title",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Trust and access"}),t.jsx("h2",{id:"business-verification-title",children:"Business Verification"}),t.jsx("p",{className:"muted",children:"Verification is free and separate from subscription status. It is required only to start new Bizz2Bizz Connect conversations."})]}),h==="verified"?t.jsx(Mu,{color:"#16794b",size:25}):h==="suspended"?t.jsx(wp,{color:"#b42318",size:25}):t.jsx(Ta,{color:"#a96f00",size:25})]}),i?t.jsx("p",{className:"muted",children:"Checking verification statusâ¦"}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{children:[t.jsx("strong",{children:vN[h]}),r!=null&&r.requested_at?` · requested ${new Date(r.requested_at).toLocaleDateString()}`:""]}),h==="verified"?t.jsx("p",{className:"success-box",children:"Your business can initiate Bizz2Bizz Connect conversations."}):h==="pending_review"?t.jsx("p",{className:"muted",children:"An authorized SBH moderator will review the completed business profile and verified account email."}):h==="suspended"?t.jsx("p",{className:"error-box",children:"New Connect initiation is unavailable while verification is suspended. Contact SBH support for next steps."}):t.jsx("button",{type:"button",className:"primary-inline",disabled:!(r!=null&&r.can_request)||o,onClick:()=>void u(),children:o?"Submittingâ¦":h==="rejected"?"Request another review":"Request verification"})]}),n&&t.jsx("p",{className:n.includes("queued")?"success-box":"muted",role:"status",children:n})]})}const bf={display_name:"",business_name:"",title:"",phone:"",email:"",address:"",website:"",booking_link:"",social_links:{},profile_photo_path:null,company_logo_path:null,qr_token:null,is_published:!1,phone_public:!1,email_public:!1,address_public:!1,website_public:!1,booking_link_public:!1,social_links_public:!1,profile_photo_public:!1,company_logo_public:!1,token_revoked_at:null},_N=[["phone_public","Phone"],["email_public","Email"],["address_public","Address"],["website_public","Website"],["booking_link_public","Booking link"],["social_links_public","Social links"],["profile_photo_public","Profile photo"],["company_logo_public","Company logo"]];function bN(e){return{...bf,...e??{}}}function jN(e){return e?window.location.origin+"/card/"+e:null}function wN({supabase:e}){const[r,a]=y.useState(bf),[n,s]=y.useState(!0),[i,c]=y.useState(!1),[o,l]=y.useState(null),[d,u]=y.useState(null),[h,f]=y.useState(null),m=y.useMemo(()=>jN(r.qr_token),[r.qr_token]);y.useEffect(()=>{async function j(){s(!0);const k=await e.from("sbh_smart_cards").select("id,display_name,business_name,title,phone,email,address,website,booking_link,social_links,profile_photo_path,company_logo_path,qr_token,is_published,phone_public,email_public,address_public,website_public,booking_link_public,social_links_public,profile_photo_public,company_logo_public,token_revoked_at").eq("profile_type","work").is("profile_name",null).maybeSingle();k.error?u(k.error.message):a(bN(k.data)),s(!1)}j()},[e]),y.useEffect(()=>{if(!m||!r.is_published){f(null);return}_f.toDataURL(m,{width:240,margin:2,errorCorrectionLevel:"M"}).then(f).catch(()=>f(null))},[m,r.is_published]);async function x(j=r){c(!0),u(null),l(null);const k=await e.rpc("sbh_upsert_smart_card",{p_payload:{...j,profile_type:"work"}});k.error?u(k.error.message):(a(N=>({...N,...k.data})),l("Smart Card saved.")),c(!1)}async function p(){const j=await e.rpc("sbh_rotate_smart_card_token");if(j.error)return u(j.error.message);const k=j.data;a(N=>({...N,qr_token:k.token??null,is_published:!1,token_revoked_at:null})),l("A new public token was generated. The previous link is invali
584d.")}async function g(){const j=await e.rpc("sbh_revoke_smart_card_token");if(j.error)return u(j.error.message);a(k=>({...k,is_published:!1,token_revoked_at:new Date().toISOString()})),l("Public access was revoked.")}async function w(j,k){var L;const N=(L=k.target.files)==null?void 0:L[0];if(!N)return;if(!/^(image\/jpeg|image\/png|image\/webp)$/.test(N.type)||N.size>5*1024*1024){u("Use a JPEG, PNG, or WebP image up to 5 MB.");return}const C=await e.rpc("sbh_prepare_smart_card_media",{p_kind:j});if(C.error)return u(C.error.message);const P=C.data,T=await e.storage.from(P.bucket_id).upload(P.storage_path,N,{contentType:N.type,upsert:!1});if(T.error)return u(T.error.message);a(M=>({...M,[j==="profile_photo"?"profile_photo_path":"company_logo_path"]:P.storage_path})),l("Private media uploaded. Save the card to attach it.")}async function S(){m&&(await navigator.clipboard.writeText(m),l("Public card link copied."))}async function b(){m&&(navigator.share?await navigator.share({title:r.display_name||"Smart Card",url:m}):await S())}return n?t.jsx("section",{className:"panel",children:t.jsx("p",{className:"muted",children:"Loading Smart Cardâ¦"})}):t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Identity profile"}),t.jsx("h1",{children:"Smart Card"}),t.jsx("p",{className:"muted",children:"Your primary work card is private until you publish it."})]}),t.jsx(tt,{size:28,color:"#a96f00"})]}),d&&t.jsx("div",{className:"error-box",children:d}),o&&t.jsx("div",{className:"success-box",children:o}),t.jsx(yN,{supabase:e}),t.jsxs("section",{className:"panel smart-card-editor",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Work card"}),t.jsx("p",{className:"muted",children:"One work card per user and tenant. Future card types remain schema-compatible."})]}),t.jsx("span",{className:"badge "+(r.is_published?"ok":"untracked"),children:r.is_published?"Published":"Private"})]}),t.jsxs("div",{className:"smart-card-form-grid",children:[t.jsxs("label",{children:["Display name",t.jsx("input",{value:r.display_name,onChange:j=>a({...r,display_name:j.target.value}),maxLength:200})]}),t.jsxs("label",{children:["Business",t.jsx("input",{value:r.business_name,onChange:j=>a({...r,business_name:j.target.value}),maxLength:200})]}),t.jsxs("label",{children:["Title",t.jsx("input",{value:r.title,onChange:j=>a({...r,title:j.target.value}),maxLength:160})]}),t.jsxs("label",{children:["Phone",t.jsx("input",{value:r.phone,onChange:j=>a({...r,phone:j.target.value}),inputMode:"tel",maxLength:40})]}),t.jsxs("label",{children:["Email",t.jsx("input",{value:r.email,onChange:j=>a({...r,email:j.target.value}),type:"email",maxLength:320})]}),t.jsxs("label",{children:["Website",t.jsx("input",{value:r.website,onChange:j=>a({...r,website:j.target.value}),type:"url",placeholder:"https://",maxLength:2048})]}),t.jsxs("label",{className:"full",children:["Address",t.jsx("textarea",{value:r.address,onChange:j=>a({...r,address:j.target.value}),maxLength:500})]}),t.jsxs("label",{children:["Booking link",t.jsx("input",{value:r.booking_link,onChange:j=>a({...r,booking_link:j.target.value}),type:"url",placeholder:"https://",maxLength:2048})]}),t.jsxs("label",{children:["Social link",t.jsx("input",{value:Object.values(r.social_links)[0]??"",onChange:j=>a({...r,social_links:j.target.value?{primary:j.target.value}:{}}),type:"url",placeholder:"https://",maxLength:2048})]})]}),t.jsxs("div",{className:"smart-card-media-grid",children:[t.jsxs("label",{className:"media-upload",children:[t.jsx(Cn,{size:20}),"Profile photo",t.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:j=>void w("profile_photo",j)})]}),t.jsxs("label",{className:"media-upload",children:[t.jsx(Cn,{size:20}),"Company logo",t.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:j=>void w("company_logo",j)})]})]}),t.jsxs("fieldset",{className:"visibility-fieldset",children:[t.jsx("legend",{children:"Public fields"}),t.jsx("p",{className:"muted",children:"These fields remain private unless individually enabled and the card is published."}),t.jsx("div",{className:"visibility-grid",children:_N.map(([j,k])=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:!!r[j],onChange:N=>a({...r,[j]:N.target.checked})}),k]},String(j)))})]}),t.jsxs("div",{className:"smart-card-actions",children:[t.jsxs("button",{className:"primary-inline",disabled:i||!r.display_name,onClick:()=>void x(),children:[t.jsx(xi,{size:16}),i?"Savingâ¦":"Save"]}),t.jsx("button",{className:"secondary-button",disabled:i||!r.display_name,onClick:()=>void x({...r,is_published:!r.is_published}),children:r.is_published?"Unpublish":"Publish card"}),t.jsxs("button",{className:"secondary-button",disabled:!r.id,onClick:()=>void p(),children:[t.jsx(xo,{size:16}),"Rotate link"]}),t.jsx("button",{className:"secondary-button",disabled:!r.id||!r.is_published,onClick:()=>void g(),children:"Revoke access"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Public link tools"}),t.jsx("p",{className:"muted",children:"Only available after publication."})]}),t.jsx(En,{size:24,color:"#a96f00"})]}),m&&r.is_published?t.jsxs("div",{className:"smart-card-link-tools",children:[t.jsx("code",{children:m}),t.jsxs("div",{className:"smart-card-actions",children:[t.jsxs("button",{className:"secondary-button",onClick:()=>void S(),children:[t.jsx(Hu,{size:16}),"Copy link"]}),t.jsxs("button",{className:"secondary-button",onClick:()=>void b(),children:[t.jsx(go,{size:16}),"Share"]}),t.jsxs("a",{className:"secondary-button",href:"https://igvskwjrroiivfrtmawd.supabase.co/functions/v1/smart-card-public/vcard?token="+encodeURIComponent(r.qr_token??""),children:[t.jsx(Xu,{size:16}),"Download vCard"]}),t.jsxs("a",{className:"secondary-button",href:m,target:"_blank",rel:"noreferrer",children:[t.jsx(Tt,{size:16}),"Open card"]})]}),h?t.jsxs("div",{className:"qr-panel",children:[t.jsx("img",{src:h,alt:"QR code for public Smart Card"}),t.jsxs("a",{className:"secondary-button",href:h,download:"smart-card-qr.png",children:[t.jsx(Os,{size:16}),"Download QR"]})]}):t.jsxs("div",{className:"qr-placeholder",children:[t.jsx(En,{size:26}),t.jsx("span",{children:"Generating QR codeâ¦"})]})]}):t.jsxs("div",{className:"empty-state",children:[t.jsx(En,{size:30}),t.jsx("h3",{children:"Nothing public yet"}),t.jsx("p",{children:"Save and publish the card to activate its stable link and QR code."})]})]})]})}function xu(e,r){return`https://igvskwjrroiivfrtmawd.supabase.co/functions/v1/smart-card-public${e}?token=${encodeURIComponent(r)}`}function kN({token:e}){const[r,a]=y.useState(null),[n,s]=y.useState(null),[i,c]=y.useState(!0),[o,l]=y.useState(null);y.useEffect(()=>{fetch(xu("",e),{headers:{apikey:"sb_publishable_EuxB7NlknSsbvouGZUP_qA_1H7OTUui"}}).then(async h=>{const f=await h.json().catch(()=>({}));if(!h.ok)throw new Error(String(f.error_code??"CARD_NOT_FOUND"));a(f.card)}).catch(()=>s("This Smart Card is unavailable or private.")).finally(()=>c(!1))},[e]);const d=y.useMemo(()=>xu("/vcard",e),[e]);async function u(){r&&(navigator.share?await navigator.share({title:r.displayName,text:r.businessName??r.title??"SmartBizHelper Smart Card",url:r.publicUrl}):(await navigator.clipboard.writeText(r.publicUrl),l("Card link copied.")))}return i?t.jsx("main",{className:"public-card-shell",children:t.jsx("section",{className:"public-card-panel",children:t.jsx("p",{className:"muted",children:"Loading Smart Cardâ¦"})})}):n||!r?t.jsx("main",{className:"public-card-shell",children:t.jsxs("section",{className:"public-card-panel public-card-empty",children:[t.jsx(xi,{size:42}),t.jsx("h1",{children:"Smart Card unavailable"}),t.jsx("p",{children:n??"This card is not available."})]})}):t.jsx("main",{className:"public-card-shell",children:t.jsxs("section",{className:"public-card-panel",children:[t.jsxs("div",{className:"public-card-brand",children:["SmartBiz",t.jsx("span",{children:"Helper"})]}),r.companyLogoUrl&&t.jsx("img",{className:"public-card-logo",src:r.companyLogoUrl,alt:"Company logo"}),r.profilePhotoUrl?t.jsx("img",{className:"public-card-photo",src:r.profilePhotoUrl,alt:""}):t.jsx("div",{className:"public-card-photo placeholder",children:t.jsx(xi,{size:42})}),t.jsx("h1",{children:r.displayName}),r.title&&t.jsx("p",{className:"public-card-title",children:r.title}),r.businessName&&t.jsx("h2",{children:r.businessName}
584),t.jsxs("div",{className:"public-card-details",children:[r.phone&&t.jsxs("a",{href:`tel:${r.phone}`,children:[t.jsx(vp,{size:18}),r.phone]}),r.email&&t.jsxs("a",{href:`mailto:${r.email}`,children:[t.jsx(Ri,{size:18}),r.email]}),r.address&&t.jsxs("span",{children:[t.jsx(Mn,{size:18}),r.address]}),r.website&&t.jsxs("a",{href:r.website,target:"_blank",rel:"noreferrer",children:[t.jsx(lp,{size:18}),"Website"]})]}),t.jsxs("div",{className:"public-card-actions",children:[t.jsxs("a",{className:"public-card-primary",href:d,children:[t.jsx(Os,{size:18}),"Save contact"]}),t.jsxs("button",{className:"public-card-secondary",onClick:()=>void u(),children:[t.jsx(go,{size:18}),"Share"]}),r.bookingLink&&t.jsxs("a",{className:"public-card-secondary",href:r.bookingLink,target:"_blank",rel:"noreferrer",children:[t.jsx(Jf,{size:18}),"Book"]})]}),Object.keys(r.socialLinks).length>0&&t.jsx("div",{className:"public-card-socials",children:Object.entries(r.socialLinks).map(([h,f])=>t.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:h},h))}),o&&t.jsx("div",{className:"success-box",children:o})]})})}const SN=[{label:"AI-discovered",title:"Neighborhood retail grant",copy:"A potential funding match surfaced for independent storefronts.",icon:Or},{label:"SBH Member",title:"Founder finance roundtable",copy:"A peer-led working session for practical cash-flow decisions.",icon:mt},{label:"SBH Official",title:"Small business systems clinic",copy:"A guided session from the SmartBizHelper team.",icon:hr},{label:"Sponsored / Featured",title:"Local services spotlight",copy:"Clearly labeled partner placement for the community.",icon:Ls}],NN=[["workspace","SmartBizHelper Workspace"],["smart_inventory","Smart Inventory"],["smart_crm","Smart CRM"],["smart_sims","Smart Sims"],["smart_websites","Smart Websites"],["smart_finance","Smart Finance"],["opportunities","Opportunities & Events"],["other","Something else"]];function CN({supabase:e,onClose:r}){const[a,n]=y.useState(""),[s,i]=y.useState(""),[c,o]=y.useState("workspace"),[l,d]=y.useState("idle"),[u,h]=y.useState(null);async function f(m){var p;if(m.preventDefault(),h(null),!e)return h("Waitlist sign-up is temporarily unavailable. Please try again soon.");d("busy");const x=await e.rpc("portal_submit_front_door_waitlist",{p_full_name:a,p_email:s,p_interest_key:c,p_source:"front_door"});if(x.error){d("error"),h(x.error.message.includes("valid email")?"Enter a valid email address.":"We couldn't save that yet. Please try again.");return}d(((p=x.data)==null?void 0:p.status)==="already_registered"?"duplicate":"success")}return t.jsx("div",{className:"front-waitlist-backdrop",role:"presentation",onMouseDown:m=>{m.target===m.currentTarget&&r()},children:t.jsxs("section",{className:"front-waitlist-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"waitlist-title",children:[t.jsx("button",{className:"front-guest-close",type:"button",onClick:r,"aria-label":"Close notification sign-up",children:t.jsx(gt,{})}),l==="success"||l==="duplicate"?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"front-kicker",children:"Youâre on the list"}),t.jsx("h2",{id:"waitlist-title",children:"Weâll let you know
584when we open."}),t.jsx("p",{children:l==="duplicate"?"That email is already registered for launch updates.":"Thanks. Weâll send one update when the SmartBizHelper experience you selected is ready."}),t.jsx("button",{className:"front-primary",type:"button",onClick:r,children:"Back to SmartBizHelper"})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"front-kicker",children:"SmartBizHelper is opening thoughtfully"}),t.jsx("h2",{id:"waitlist-title",children:"Get notified when we open."}),t.jsx("p",{children:"Public account creation is currently closed. Leave your details and tell us what you want to explore first."}),t.jsxs("form",{onSubmit:f,className:"front-waitlist-form",children:[t.jsxs("label",{children:[t.jsx("span",{children:"Name"}),t.jsx("input",{value:a,onChange:m=>n(m.target.value),autoComplete:"name",maxLength:120,required:!0})]}),t.jsxs("label",{children:[t.jsx("span",{children:"Email"}),t.jsx("input",{type:"email",value:s,onChange:m=>i(m.target.value),autoComplete:"email",maxLength:320,required:!0})]}),t.jsxs("label",{children:[t.jsx("span",{children:"What are you most interested in?"}),t.jsx("select",{value:c,onChange:m=>o(m.target.value),children:NN.map(([m,x])=>t.jsx("option",{value:m,children:x},m))})]}),u&&t.jsx("div",{className:"error-message",role:"alert",children:u}),t.jsx("button",{className:"front-primary",type:"submit",disabled:l==="busy",children:l==="busy"?"Savingâ¦":"Notify me when it opens"}),t.jsx("small",{children:"Weâll only use this to share SmartBizHelper opening updates."})]})]})]})})}function EN({guestMode:e=!1,access:r,supabase:a}){const[n,s]=y.useState(!1),i=(r==null?void 0:r.guest_mode)??!0,[c,o]=y.useState(e&&i),[l,d]=y.useState(!1),u=(r==null?void 0:r.new_signups)??!1,h=u?"/onboarding.html?persona=owner":"#waitlist",f=m=>{u||(m.preventDefault(),d(!0))};return t.jsxs("main",{className:"front-door",children:[t.jsxs("header",{className:"front-nav",children:[t.jsx("a",{className:"front-brand front-current-logo",href:"/","aria-label":"SmartBizHelper home",children:t.jsx("img",{src:Li,alt:"SmartBizHelper"})}),t.jsx("button",{className:"front-menu","aria-label":"Toggle navigation",onClick:()=>s(m=>!m),children:n?t.jsx(gt,{}):t.jsx(Ds,{})}),t.jsxs("nav",{className:n?"open":"",children:[t.jsx("a",{href:"#solutions",children:"Solutions"}),t.jsx("a",{href:"#community",children:"Community"}),t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{className:"front-signin",href:"/?auth=login",children:"Sign in"}),t.jsxs("a",{className:"front-nav-cta",href:h,onClick:f,children:[u?"Start with Ness":"Get notified when we open"," ",t.jsx(Mt,{size:16})]})]})]}),t.jsxs("section",{className:"front-hero",children:[t.jsxs("div",{className:"front-copy",children:[t.jsx("p",{className:"front-kicker",children:"Intelligence for independent business"}),t.jsxs("h1",{children:["Run the business.",t.jsx("br",{}),t.jsx("span",{children:"See the whole picture."})]}),t.jsx("p",{className:"front-lede",children:"SmartBizHelper brings your operations, decisions, and next opportunities into one calm, connected workspaceâguided by Ness."}),t.jsxs("div",{className:"front-actions",children:[t.jsxs("a",{className:"front-primary",href:h,onClick:f,children:[u?"Start with Ness":"Get notified when we open"," ",t.jsx(Mt,{size:18})]}),t.jsx("a",{className:"front-guest",href:"/?guest=1",children:"Explore as a guest"})]}),t.jsxs("div",{className:"front-trust",children:[t.jsxs("span",{children:[t.jsx(Kt,{})," No card required"]}),t.jsxs("span",{children:[t.jsx(Dr,{})," Your preview stays private"]})]})]}),t.jsxs("div",{className:"front-ness","aria-label":"Ness, your SmartBizHelper guide",children:[t.jsx("div",{className:"front-halo"}),t.jsx("img",{src:Bf,alt:"Ness holding a SmartBizHelper tablet"}),t.jsxs("aside",{children:[t.jsx("span",{children:"MEET YOUR BUSINESS GUIDE"}),t.jsx("strong",{children:"Ness turns your story into a practical first workspace."}),t.jsxs("a",{href:"/onboarding.html?persona=owner",children:["Begin the conversation ",t.jsx(Mt,{size:15})]})]})]})]}),t.jsxs("section",{className:"front-personas","aria-labelledby":"front-personas-title",children:[t.jsxs("header",{children:[t.jsx("p",{className:"front-kicker",children:"Choose your way in"}),t.jsx("h2",{id:"front-personas-title",children:"The right experience starts with the right role."}),t.jsx("p",{children:"Each path protects the access, information, and tools meant for you."})]}),t.jsxs("div",{children:[t.jsxs("a",{href:u?"/onboarding.html?persona=owner":"#waitlist",onClick:f,children:[t.jsx(hr,{}),t.jsx("span",{children:"BUSINESS OWNER / FOUNDER"}),t.jsx("b",{children:"Shape my business Workspace"}),t.jsx("small",{children:"Ness-led business interview and personalized operating view."}),t.jsxs("em",{children:[u?"Start owner setup":"Get notified when we open"," ",t.jsx(Mt,{})]})]}),t.jsxs("a",{href:u?"/onboarding.html?persona=employee":"#waitlist",onClick:f,children:[t.jsx(Di,{}),t.jsx("span",{children:"EMPLOYEE / TEAM MEMBER"}
584),t.jsx("b",{children:"Join an existing Workspace"}),t.jsx("small",{children:"Accept an invitation or prepare a bounded access request."}),t.jsxs("em",{children:[u?"Join my team":"Get notified when we open"," ",t.jsx(Mt,{})]})]}),t.jsxs("a",{href:u?"/onboarding.html?persona=community":"#waitlist",onClick:f,children:[t.jsx(na,{}),t.jsx("span",{children:"INDIVIDUAL / COMMUNITY MEMBER"}),t.jsx("b",{children:"Build my community profile"}),t.jsx("small",{children:"Discover businesses, events, opportunities, and connections."}),t.jsxs("em",{children:[u?"Enter the community":"Get notified when we open"," ",t.jsx(Mt,{})]})]})]}),t.jsxs("nav",{children:[t.jsx("a",{href:"/?guest=1",children:"Browse as a guest"}),t.jsx("a",{href:"/?auth=login",children:"Sign in to an existing account"})]})]}),t.jsxs("section",{className:"front-proof",children:[t.jsx("p",{children:"ONE CONNECTED VIEW"}),t.jsxs("div",{children:[t.jsx("span",{children:"Operations"}),t.jsx("i",{}),t.jsx("span",{children:"Customers"}),t.jsx("i",{}),t.jsx("span",{children:"Cash flow"}),t.jsx("i",{}),t.jsx("span",{children:"Growth"})]})]}),t.jsxs("section",{className:"front-solutions",id:"solutions",children:[t.jsxs("header",{children:[t.jsx("p",{className:"front-kicker",children:"Built around the way you work"}),t.jsx("h2",{children:"A command center, not another pile of tools."}),t.jsx("p",{children:"Start with the essentials. Add depth when the business is ready."})]}),t.jsxs("div",{className:"front-solution-grid",children:[t.jsxs("article",{children:[t.jsx(ha,{}),t.jsx("span",{children:"CORE OPERATIONS"}),t.jsx("h3",{children:"Workspace"}),t.jsx("p",{children:"Inventory, purchasing, forecasting, vendors, recipes, team access, and the daily signals that deserve attention."}),t.jsxs("a",{href:h,onClick:f,children:[u?"Shape my workspace":"Get notified when we open"," ",t.jsx(Mt,{})]})]}),t.jsxs("article",{children:[t.jsx(ll,{}),t.jsx("span",{children:"MARKET PRESENCE"}),t.jsx("h3",{children:"Smart Websites"}),t.jsx("p",{children:"Website design, redesign, launch, content, maintenance, and related tools."}),t.jsxs("a",{href:"/?guest=1&area=web-design",children:["Explore Smart Websites ",t.jsx(Mt,{})]})]}),t.jsxs("article",{children:[t.jsx(ur,{}),t.jsx("span",{children:"FINANCIAL CLARITY"}),t.jsx("h3",{children:"Smart Finance"}),t.jsx("p",{children:"See todayâs financial picture, improve planning, and know the questions worth asking next."}),t.jsxs("a",{href:"/?guest=1&area=smart-finance",children:["Explore Smart Finance ",t.jsx(Mt,{})]})]})]})]}),c&&i&&t.jsxs("section",{className:"front-guest-panel",id:"guest-preview",children:[t.jsx("button",{className:"front-guest-close",onClick:()=>o(!1),"aria-label":"Close guest preview",children:t.jsx(gt,{})}),t.jsxs("div",{children:[t.jsx("p",{className:"front-kicker",children:"Guest preview"}),t.jsx("h2",{children:"Explore before you commit."}),t.jsx("p",{children:"This browser-only preview uses illustrative fixtures. Nothing is connected, saved, or presented as your live business data."})]}),t.jsxs("div",{className:"front-guest-metrics",children:[t.jsxs("article",{children:[t.jsx("span",{children:"Todayâs focus"}),t.jsx("strong",{children:"3 decisions"}),t.jsx("small",{children:"illustrative"})]}),t.jsxs("article",{children:[t.jsx("span",{children:"Inventory watch"}),t.jsx("strong",{children:"8 items"}),t.jsx("small",{children:"illustrative"})]}),t.jsxs("article",{children:[t.jsx("span",{children:"Next opportunity"}),t.jsx("strong",{children:"1 match"}),t.jsx("small",{children:"illustrative"})]})]}),t.jsxs("div",{className:"front-guest-services",style:{gridColumn:"1 / -1",display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(240px,1fr))",gap:10},children:[t.jsxs("article",{id:"web-design",style:{display:"flex",alignItems:"center",gap:13,padding:17,border:"1px solid rgba(255,255,255,.13)",borderRadius:13,background:"rgba(255,255,255,.04)"},children:[t.jsx(ll,{color:"#efb52e"}),t.jsxs("div",{children:[t.jsx("span",{children:"SMART WEBSITES PREVIEW"}),t.jsx("br",{}),t.jsx("b",{children:"Website design, redesign, launch, content, maintenance, and related tools."})]})]}),t.jsxs("article",{id:"smart-finance",style:{display:"flex",alignItems:"center",gap:13,padding:17,border:"1px solid rgba(255,255,255,.13)",borderRadius:13,background:"rgba(255,255,255,.04)"},children:[t.jsx(ur,{color:"#efb52e"}),t.jsxs("div",{children:[t.jsx("span",{children:"SMART FINANCE PREVIEW"}),t.jsx("br",{}),t.jsx("b",{children:"Cash-flow, margin, and planning questions in one calm view."})]})]})]}),t.jsxs("div",{className:"front-guest-links",children:[t.jsxs("a",{href:"/onboarding.html",children:["Choose my account type ",t.jsx(Mt,{})]}),t.jsx("a",{href:"/?auth=login",children:"I already have an account"})]})]}),t.jsxs("section",{className:"front-community",id:"community",children:[t.jsxs("header",{children:[t.jsx("p",{className:"front-kicker",children:"A useful business ecosystem"}),t.jsx("h2",{children:"Know where each opportunity comes from."})]}),t.jsx("div",{children:SN.map(({label:m,title:x,copy:p,icon:g})=>t.jsxs("article",{children:[t.jsx(g,{}),t.jsx("span",{children:m}),t.jsx("h3",{children:x}),t.jsx("p",{children:p})]},m))})]}),t.jsxs("section",{className:"front-closing",children:[t.jsx(Gf,{}),t.jsxs("div",{children:[t.jsx("p",{className:"front-kicker",children:"A more useful next move"}),t.jsx("h2",{children:u?"Give Ness ten minutes. Get a clearer first workspace.":"Be first to know when SmartBizHelper opens."})]}),t.jsxs("a",{href:h,onClick:f,children:[u?"Start with Ness":"Get notified when we open"," ",t.jsx(Mt,{})]})]}),t.jsxs("footer",{className:"front-footer",children:[t.jsxs("div",{className:"front-brand",children:[t.jsx("span",{children:"SBH"}),t.jsx("b",{children:"SmartBizHelper"})]}),t.jsx("p",{children:"Your Business. Our Purpose."}),t.jsxs("nav",{children:[t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/status",children:"Status"}),t.jsx("a",{href:"/developers",children:"Developers"}),t.jsx("a",{href:"/terms",children:"Terms"}),t.jsx("a",{href:"/privacy",children:"Privacy"}),t.jsx("a",{href:"/data-deletion",children:"Data Deletion"}),t.jsx("a",{href:"/acceptable-use",children:"Acceptable Use"}),t.jsx("a",{href:"/refunds",children:"Refunds"}),t.jsx("a",{href:"/ai-disclosure",children:"AI Disclosure"})]})]}),l&&t.jsx(CN,{supabase:a??null,onClose:()=>d(!1)})]})}function TN(){const[e,r]=y.useState(Mp()),[a,n]=y.useState([]),[s,i]=y.useState(!1);y.useEffect(()=>{const l=Mi();if(!l)return;let d=!0;return l.rpc("portal_public_status_snapshot").then(({data:u,error:h})=>{var m;if(!d||h||!u)return;const f=u;
584(m=f.components)!=null&&m.length&&(r(Up(f.components)),n(f.incidents??[]),i(!0))}),()=>{d=!1}},[]);const c=Hp(e),o=y.useMemo(()=>[...new Set(e.map(l=>l.group))],[e]);return t.jsxs("main",{className:"status-page",children:[t.jsxs("header",{className:"status-nav",children:[t.jsx("a",{href:"/",children:t.jsx("img",{src:Li,alt:"SmartBizHelper"})}),t.jsxs("nav",{children:[t.jsx("a",{href:"/developers",children:"Developers"}),t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/?auth=login",children:"Sign in"})]})]}),t.jsxs("section",{className:"status-hero",children:[t.jsx("p",{children:"SMARTBIZHELPER STATUS"}),t.jsx("h1",{children:"Know whatâs working."}),t.jsxs("div",{className:"status-overall "+c,children:[c==="operational"?t.jsx(Kr,{}):t.jsx(gs,{}),t.jsxs("div",{children:[t.jsx("strong",{children:Vc[c]}),t.jsx("span",{children:s?"Current published service health":"Live service health could not be retrieved"})]})]}),t.jsxs("small",{children:[t.jsx(Ta,{})," ",s?"Live status registry connected.":"Live status is temporarily unavailable. No service health is being asserted."]})]}),t.jsx("section",{className:"status-groups",children:o.map(l=>t.jsxs("article",{children:[t.jsxs("header",{children:[t.jsx("h2",{children:l}),t.jsxs("span",{children:[e.filter(d=>d.group===l).length," components"]})]}),e.filter(d=>d.group===l).map(d=>t.jsxs("div",{className:"status-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:d.name}),t.jsx("small",{children:d.description})]}),t.jsxs("span",{className:"health "+d.health,children:[t.jsx("i",{}),d.enabled?Vc[d.health]:"Not publicly enabled"]})]},d.key))]},l))}),t.jsxs("section",{className:"status-history",children:[t.jsx(Hc,{}),t.jsxs("div",{children:[t.jsx("h2",{children:"Incident history"}),a.length?a.map(l=>t.jsxs("div",{children:[t.jsx("strong",{children:l.title}),t.jsx("p",{children:l.message}),t.jsxs("small",{children:[l.status," · ",new Date(l.started_at).toLocaleString()]})]},l.id)):t.jsx("p",{children:"No recent published incidents."})]})]}),t.jsxs("footer",{children:[t.jsx(tt,{}),t.jsx("span",{children:"Status is separate from suite enable/disable controls."}),t.jsx("a",{href:"/developers",children:"Developer resources â"})]})]})}const AN=[{icon:Ru,title:"Authentication",copy:"Build against scoped, authenticated SmartBizHelper services. Never expose privileged service credentials in client applications."},{icon:Yf,title:"API overview",copy:"A stable home for supported API surfaces, request conventions, errors, pagination, and versioning as public contracts are released."},{icon:Fp,title:"Webhooks",copy:"Event-driven integration guidance, signature verification, retry behavior, idempotency, and delivery troubleshooting."},{icon:Xr,title:"Connectors",copy:"Integration guidance for commerce and business systems supported by SmartBizHelper."},{icon:Pr,title:"Examples & SDKs",copy:"Reference flows and examples will be published here only after their interfaces are certified for external use."},{icon:_p,title:"Changelog",copy:"Track developer-facing additions, behavior changes, deprecations, and migration guidance."}];function FN(){return t.jsxs("main",{className:"developers-page",children:[t.jsxs("header",{className:"dev-nav",children:[t.jsx("a",{href:"/",children:t.jsx("img",{src:Li,alt:"SmartBizHelper"})}),t.jsxs("nav",{children:[t.jsx("a",{href:"/status",children:"Status"}),t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/?auth=login",children:"Sign in"})]})]}),t.jsxs("section",{className:"dev-hero",children:[t.jsx("p",{children:"SMARTBIZHELPER DEVELOPERS"}),t.jsx("h1",{children:"Build with the business platform."}),t.jsx("p",{children:"One front door for SmartBizHelper APIs, connectors, webhooks, integration guidance, and platform health."}),t.jsxs("div",{children:[t.jsxs("a",{className:"dev-primary",href:"#resources",children:["Explore resources ",t.jsx(Mt,{})]}),t.jsx("a",{href:"/status",children:"View platform status"})]})]}),t.jsx("section",{id:"resources",className:"dev-grid",children:AN.map(({icon:e,title:r,copy:a})=>t.jsxs("article",{children:[t.jsx(e,{}),t.jsx("h2",{children:r}),t.jsx("p",{children:a}),t.jsx("span",{children:"Documentation coming with certified public interfaces"})]},r))}),t.jsxs("section",{className:"dev-contract",children:[t.jsx(tt,{}),t.jsxs("div",{children:[t.jsx("p",{children:"DEVELOPER CONTRACT"}),t.jsx("h2",{children:"Document what is real. Never invent an API."}),t.jsx("p",{children:"This page intentionally distinguishes the developer front door from released API documentation. Endpoints, credentials, schemas, SDKs, sandbox access, and examples are published only after their underlying interfaces are certified."})]})]}),t.jsxs("footer",{children:[t.jsx("span",{children:"SmartBizHelper Developer Platform"}),t.jsx("a",{href:"/status",children:"Platform status â"}),t.jsx("a",{href:"/help",children:"Support â"})]})]})}const IN={terms:{title:"Terms of Service",summary:"A business-ready draft describing the rules and boundaries for using SmartBizHelper."},privacy:{title:"Privacy Policy",summary:"A business-ready draft describing product-supported data use and privacy boundaries."},"acceptable-use":{title:"Acceptable Use Policy",summary:"The conduct and security standards that keep SmartBizHelper safe for every business."},refunds:{title:"Refund & Cancellation Policy",summary:"A conservative draft covering plan changes, credits, refunds, and consumed services."},"ai-disclosure":{title:"AI & Automation Disclosure",summary:"How to use assisted outputs responsibly when SmartBizHelper helps with business work."}};function PN(){return t.jsxs("div",{className:"public-policy-draft",role:"note",children:[t.jsx(tt,{size:18}),t.jsx("span",{children:"DRAFT â pending independent legal and business review. This page is not final legal advice or a final commitment."})]})}function jf({title:e,summary:r,help:a=!1}){return t.jsxs("header",{className:"public-policy-header",children:[t.jsxs("a",{className:"public-policy-back",href:"/",children:[t.jsx(Oi,{size:16})," Back to SmartBizHelper"]}),t.jsx("p",{className:"eyebrow",children:a?"SmartBizHelper support":"SmartBizHelper public information"}),t.jsx("h1",{children:e}),t.jsx("p",{className:"public-policy-summary",children:r})]})}function wf(){return t.jsxs("nav",{className:"public-policy-nav","aria-label":"Public information",children:[t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/terms",children:"Terms"}),t.jsx("a",{href:"/privacy",children:"Privacy"}),t.jsx("a",{href:"/data-deletion",children:"Data Deletion"}),t.jsx("a",{href:"/acceptable-use",children:"Acceptable Use"}),t.jsx("a",{href:"/refunds",children:"Refunds"}),t.jsx("a",{href:"/ai-disclosure",children:"AI Disclosure"})]})}function rs({kind:e,children:r}){const a=IN[e];return t.jsx("main",{className:"public-policy-shell",children:t.jsxs("div",{className:"public-policy-card",children:[t.jsx(jf,{title:a.title,summary:a.summary}),t.jsx(PN,{}),t.jsx(wf,{}),t.jsx("article",{className:"public-policy-content",children:r}),t.jsx(Ra,{className:"public-policy-footer"})]})})}function DN({kind:e}){return e==="terms"?t.jsxs(rs,{kind:e,children:[t.jsx("h2",{children:"Using SmartBizHelper"}
584),t.jsx("p",{children:"SmartBizHelper provides workspace tools, public discovery surfaces, and other services as shown in the product. You must provide accurate information, keep account credentials secure, and use the platform only for lawful business purposes."}),t.jsx("h2",{children:"Business Workspaces and teams"}),t.jsx("p",{children:"A Business Workspace is controlled by its owner or authorized administrator. Team members receive only the access their role and workspace permissions allow. Do not share accounts, attempt to access another tenant, or bypass permissions."}),t.jsx("h2",{children:"Services, subscriptions, and credits"}),t.jsx("p",{children:"Paid plans, services, and Smart Credits are offered only where displayed and are subject to applicable checkout terms. Availability, pricing, entitlements, and provider handoffs may change; no uninterrupted availability is promised."}),t.jsx("h2",{children:"Integrations and submitted content"}),t.jsx("p",{children:"Connections to payment, POS, or other third-party providers depend on those providers. You are responsible for the accuracy, rights, and lawful use of business data, documents, content, and instructions submitted to the platform."}),t.jsx("h2",{children:"AI-assisted features"}),t.jsx("p",{children:"Recommendations, extraction, classification, forecasting, content assistance, and operational suggestions may be incomplete or incorrect. Review consequential decisions and content before publishing, sending, purchasing, or taking action."}),t.jsx("h2",{children:"Ownership, suspension, and limits"}),t.jsx("p",{children:"SmartBizHelper, its software, branding, platform features, and related intellectual property are owned by or licensed to the applicable SmartBizHelper operating entity and its affiliates, except for customer-owned content and third-party materials. Access may be suspended or terminated for security, misuse, nonpayment, or other policy reasons. Services are provided with limitations and disclaimers to be finalized through independent review."}),t.jsxs("div",{className:"public-policy-placeholder",children:[t.jsx("strong",{children:"Internal review note â remove before publication"}),t.jsx("p",{children:"Governing-law jurisdiction â Shaun/counsel decision required."}),t.jsx("p",{children:"Dispute-resolution venue and process â Shaun/counsel decision required."})]})]}):e==="privacy"?t.jsxs(rs,{kind:e,children:[t.jsx("h2",{children:"Information used to provide the service"}),t.jsx("p",{children:"Depending on the features you use, SmartBizHelper may process account and workspace details, business and location information, uploaded documents or content, POS or integration data, usage and security logs, and communications or support requests."}),t.jsx("h2",{children:"How information is used"}),t.jsx("p",{children:"Information is used to authenticate users, provide tenant-scoped workspace features, operate requested integrations, support billing and credits where enabled, improve reliability and security, respond to support requests, and provide requested recommendations or automation."}),t.jsx("h2",{children:"Service providers and integrations"}),t.jsx("p",{children:"SmartBizHelper may rely on providers that host the application, authenticate accounts, process payments, provide infrastructure, or support connected integrations. Connected third parties process information under their own terms and availability."}),t.jsx("h2",{children:"Security and choices"}),t.jsx("p",{children:"Access controls, authentication, tenant permissions, and database policies are used where supported by the product. Keep credentials private and review connected-provider permissions."}),t.jsx("h2",{children:"Retention and sharing"}),t.jsx("p",{children:"Information may be retained for periods reasonably necessary to provide requested services, maintain security, meet operational requirements, resolve disputes, and satisfy applicable legal obligations. This draft does not yet make a final representation regarding specific retention periods, advertising-related data practices, certifications, or jurisdiction-specific privacy rights. Those items remain subject to business and legal review before final publication."}),t.jsxs("div",{className:"public-policy-placeholder",children:[t.jsx("strong",{children:"Internal review note â remove before publication"}),t.jsx("p",{children:"Legal entity, contact channel, jurisdiction, and rights-request process â Shaun/counsel decision required."}),t.jsx("p",{children:"Final provider list and retention language â Shaun business decision required."})]})]}):e==="acceptable-use"?t.jsxs(rs,{kind:e,children:[t.jsx("h2",{children:"Do not use SmartBizHelper to"}),t.jsxs("ul",{children:[t.jsx("li",{children:"access accounts, workspaces, locations, or data without authorization;"}),t.jsx("li",{children:"submit unlawful, infringing, harmful, deceptive, or abusive content;"}),t.jsx("li",{children:"misuse credentials, scrape or enumerate tenants, or probe security controls;"}),t.jsx("li",{children:"bypass authentication, RLS, role permissions, usage limits, or tenant boundaries;"}),t.jsx("li",{children:"run malicious automation, interfere with service operation, or burden connected providers; or"}),t.jsx("li",{children:"harass, threaten, impersonate, or violate the rights of other people or businesses."})]}),t.jsx("p",{children:"We may investigate suspected misuse and restrict access when necessary to protect users, data, providers, or the platform."})]}):e==="refunds"?t.jsxs(rs,{kind:e,children:[t.jsx("h2",{children:"Draft handling"}),t.jsx("p",{children:"Cancellation, plan changes, Smart Credits, refunds, and consumed services are handled according to the offer and checkout flow shown at purchase. A cancellation request may affect future billing without reversing services or credits already consumed."}),t.jsx("p",{children:"Refund eligibility for unused credits, partially completed services, third-party charges, and provider fees depends on the applicable offer and the final SmartBizHelper refund policy. These rules are still pending business and legal approval. Contact support promptly with account and purchase details so the request can be reviewed."}),t.jsxs("div",{className:"public-policy-placeholder",children:[t.jsx("strong",{children:"Internal review note â remove before publication"}),t.jsx("p",{children:"Cancellation timing, refund eligibility, credit expiry, and consumed-service treatment â Shaun business decision required."}),t.jsx("p",{children:"Required notices and jurisdiction-specific rights â Shaun/counsel decision required."})]})]}):t.jsxs(rs,{kind:e,children:[t.jsx("h2",{children:"Where assistance may appear"}),t.jsx("p",{children:"Supported SmartBizHelper features may use automated assistance for recommendations, document extraction or classification, forecasting, content assistance, CRM or operational suggestions, and other clearly labeled workflows. Availability depends on workspace access, entitlements, and current product configuration."}),t.jsx("h2",{children:"Review before action"}),t.jsx("p",{children:"Automated outputs can be incomplete, outdated, biased, or wrong. You remain responsible for reviewing consequential decisions, inventory or financial actions, customer communications, published content, and any other action taken from an assisted output."}),t.jsx("h2",{children:"Human control and data boundaries"}),t.jsx("p",{children:"Use only information you are authorized to submit. Do not treat an automated suggestion as legal, financial, medical, employment, or other professional advice."})]})}function RN(){return t.jsx("main",{className:"public-policy-shell",children:t.jsxs("div",{className:"public-policy-card",children:[t.jsx(jf,{help:!0,title:"How can we help?",summary:"Find the supported entry points for getting started with SmartBizHelper."}),t.jsx(wf,{}),t.jsxs("article",{className:"public-policy-content",children:[t.jsxs("section",{className:"public-help-item",children:[t.jsx(uo,{size:22}),t.jsxs("div",{children:[t.jsx("h2",{children:"Account and onboarding"}),t.jsx("p",{children:"Use the sign-in page to access your workspace, reset a password, or set up a profile or team connection when invited."}),t.jsxs("a",{className:"public-policy-action",href:"/?auth=login",children:["Open sign in ",t.jsx(Tt,{size:15})]})]})]}),t.jsxs("section",{className:"public-help-item",children:[t.jsx(Nn,{size:22}
584),t.jsxs("div",{children:[t.jsx("h2",{children:"Workspace guidance"}),t.jsx("p",{children:"After sign-in, the portal provides tenant-scoped Workspace, training, support, inventory, and other available tools according to your role."}),t.jsxs("a",{className:"public-policy-action",href:"/?auth=login",children:["Open Support Center ",t.jsx(Tt,{size:15})]})]})]}),t.jsxs("section",{className:"public-help-item",children:[t.jsx(tt,{size:22}),t.jsxs("div",{children:[t.jsx("h2",{children:"Billing and policies"}),t.jsxs("p",{children:["Review the ",t.jsx("a",{href:"/refunds",children:"Refund & Cancellation Policy"}),", ",t.jsx("a",{href:"/terms",children:"Terms"}),", and ",t.jsx("a",{href:"/privacy",children:"Privacy"})," drafts. Checkout provider terms control the purchase flow shown for each offer."]})]})]}),t.jsxs("div",{className:"public-policy-placeholder",children:[t.jsx("strong",{children:"Internal review note â remove before publication"}),t.jsx("p",{children:"Final public support contact channel and any response-time language â Shaun business decision required. No SLA is promised here."})]})]}),t.jsx(Ra,{className:"public-policy-footer"})]})})}function ON(){return t.jsxs("nav",{className:"public-policy-nav","aria-label":"Public information",children:[t.jsx("a",{href:"/help",children:"Help"}),t.jsx("a",{href:"/terms",children:"Terms"}),t.jsx("a",{href:"/privacy",children:"Privacy"}),t.jsx("a",{href:"/data-deletion",children:"Data Deletion"}),t.jsx("a",{href:"/acceptable-use",children:"Acceptable Use"}),t.jsx("a",{href:"/refunds",children:"Refunds"}),t.jsx("a",{href:"/ai-disclosure",children:"AI Disclosure"})]})}function LN(){return t.jsx("main",{className:"public-policy-shell",children:t.jsxs("div",{className:"public-policy-card",children:[t.jsxs("header",{className:"public-policy-header",children:[t.jsxs("a",{className:"public-policy-back",href:"/",children:[t.jsx(Oi,{size:16})," Back to SmartBizHelper"]}),t.jsx("p",{className:"eyebrow",children:"SmartBizHelper · Golden Devco, Inc."}),t.jsx("h1",{children:"Meta data deletion instructions"}),t.jsx("p",{className:"public-policy-summary",children:"How to request deletion of data associated with a Facebook, Instagram, or Threads connection."})]}),t.jsx(ON,{}),t.jsxs("article",{className:"public-policy-content",children:[t.jsxs("div",{className:"public-help-item",children:[t.jsx(tt,{size:22}),t.jsxs("div",{children:[t.jsx("h2",{children:"Request deletion through SmartBizHelper support"}),t.jsxs("p",{children:["To request deletion of data associated with a SmartBizHelper Meta connection, visit ",t.jsx("a",{href:"/help",children:"SmartBizHelper Help"})," and use the available support route. If you have a SmartBizHelper account, you can sign in to use the Support Center."]}),t.jsxs("a",{className:"public-policy-action",href:"/help",children:["Open SmartBizHelper Help ",t.jsx(Tt,{size:15})]})]})]}),t.jsx("h2",{children:"What to include"}),t.jsx("p",{children:"Include enough information for SmartBizHelper to identify the connection, without sending passwords, access tokens, or other sensitive credentials:"}),t.jsxs("ul",{children:[t.jsx("li",{children:"the name and sign-in email associated with your SmartBizHelper account, if applicable;"}),t.jsx("li",{children:"your business or workspace name;"}),t.jsx("li",{children:"the connected Meta service: Facebook, Instagram, or Threads;"}),t.jsx("li",{children:"the Page, professional/business account, or Threads account name or public URL; and"}),t.jsx("li",{children:"any other connection details or approximate connection date that may help identify the request."})]}),t.jsx("h2",{children:"Disconnecting or revoking a connection"}),t.jsx("p",{children:"Disconnecting or revoking a Meta connection makes that connection unavailable for SmartBizHelper features that depend on it. You can also review or revoke access from the relevant Meta account settings. A connection change does not by itself serve as a request to delete all other SmartBizHelper account or workspace information; use the support route above for a deletion request."}),t.jsx("h2",{children:"What happens to a deletion request"}),t.jsx("p",{children:"SmartBizHelper support uses the information you provide to identify the relevant connection and review the request. This page is instructions only; it does not claim an automated Meta deletion callback or promise a particular response time, retention period, or outcome beyond the review of the request."}),t.jsxs("div",{className:"public-policy-placeholder",children:[t.jsx("strong",{children:"Need help identifying a connection?"}),t.jsxs("p",{children:["Use ",t.jsx("a",{href:"/help",children:"SmartBizHelper Help"})," and provide the service name and account details you can safely share."]})]}),t.jsxs("p",{children:["For related information, read the ",t.jsx("a",{href:"/privacy",children:"Privacy Policy"})," and ",t.jsx("a",{href:"/terms",children:"Terms of Service"}),"."]}),t.jsxs("div",{className:"public-help-item",children:[t.jsx(uo,{size:22}),t.jsxs("div",{children:[t.jsx("h2",{children:"Safety reminder"}),t.jsx("p",{children:"Never include a Meta password or access token in a support request."})]})]})]}),t.jsx(Ra,{className:"public-policy-footer"})]})})}function kf({guest:e=!1,onSignIn:r}){return t.jsxs("section",{className:"smart-finance-preview","aria-labelledby":"smart-finance-title",children:[t.jsxs("div",{className:"smart-finance-hero",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"eyebrow",children:[t.jsx(Or,{size:15})," Smart Finance"]}),t.jsx("h1",{id:"smart-finance-title",children:"Clearer financial decisions, in the same business workspace."}),t.jsx("p",{children:"Smart Finance is being prepared as a secure financial planning experience for SmartBizHelper members. This preview contains
584no customer financial data and does not perform financial transactions."})]}),t.jsx("span",{className:"smart-finance-badge",children:"Coming soon"})]}),t.jsxs("div",{className:"smart-finance-capabilities","aria-label":"Planned Smart Finance capabilities",children:[t.jsxs("article",{children:[t.jsx(ur,{}),t.jsx("h2",{children:"Cash-flow visibility"}),t.jsx("p",{children:"A clearer view of money moving through the business."})]}),t.jsxs("article",{children:[t.jsx(Rr,{}),t.jsx("h2",{children:"Forecasting support"}),t.jsx("p",{children:"Planning signals designed to help owners look ahead."})]}),t.jsxs("article",{children:[t.jsx(fr,{}),t.jsx("h2",{children:"Business-ready guidance"}),t.jsx("p",{children:"Financial context presented alongside the rest of the SmartBizHelper platform."})]})]}),t.jsxs("div",{className:"smart-finance-boundary",children:[t.jsx(Dr,{size:19}),t.jsxs("div",{children:[t.jsx("strong",{children:e?"Public overview only":"Protected workspace not activated"}),t.jsx("p",{children:e?"Sign in when you are ready to access your authorized business workspace. No private financial data is exposed here.":"The financial workspace remains closed until its protected runtime and permission model are production-ready."})]}),e&&r&&t.jsxs("button",{type:"button",onClick:r,children:["Sign in ",t.jsx(Mt,{size:16})]})]})]})}const BN="/assets/ness-holding-laptop-transparent-CPON8Nri.png";function MN(){const e=new URLSearchParams(window.location.search).get("consultation");return rh.find(r=>r.handle===e)??null}function zN(e){const r=new URLSearchParams(window.location.search);return r.delete("guest"),r.set("auth","login"),r.set("area","web-design"),r.set("consultation",e.handle),`${window.location.pathname}?${r.toString()}`}function Sf({guest:e=!1,onSignIn:r,supabase:a=Mi()}){const[n,s]=y.useState(()=>e?null:MN()),[i,c]=y.useState(""),[o,l]=y.useState(!1),[d,u]=y.useState(null),[h,f]=y.useState(null);function m(){s(null),c("");const p=new URLSearchParams(window.location.search);p.delete("consultation"),window.history.replaceState({},"",`${window.location.pathname}?${p.toString()}`)}async function x(p){if(p.preventDefault(),!a||!n)return f("Sign in to send a protected consultation request.");l(!0),f(null);const[g,w]=await Promise.all([a.rpc("current_portal_client_id"),a.rpc("current_portal_location_id")]),S=g.error??w.error;if(S||!g.data)return l(!1),f((S==null?void 0:S.message)??"Your protected workspace could not be resolved.");const b=[`Package interest: ${n.name}`,`Starting price shown: $${n.price.toLocaleString()}`,i.trim()&&`Client notes: ${i.trim()}`].filter(Boolean).join(` 585`),j=await a.from("support_tickets").insert({client_id:g.data,location_id:w.data??null,subject:`Smart Websites consultation â ${n.name}`,description:b,priority:"normal",category:"general",source:"portal",metadata:{created_from:"smart_websites",package_handle:n.handle,package_name:n.name,starting_price:n.price}});if(l(!1),j.error)return f("Your consultation request could not be sent. Please try again or use Support.");u(`${n.name} consultation request received. A SmartBizHelper owner will follow up to confirm scope, timing, and next steps.`),m()}return t.jsxs("div",{className:"web-design-storefront",children:[t.jsxs("section",{className:"web-design-hero","aria-labelledby":"web-design-title",children:[t.jsxs("div",{className:"web-design-hero-copy",children:[t.jsxs("p",{className:"eyebrow",children:[t.jsx(Or,{size:15})," SmartBizHelper Smart Websites"]}),t.jsx("h1",{id:"web-design-title",children:"A website that works as hard as your business."}),t.jsx("p",{children:"Choose the right starting point, then book a consultation with the package already selected. Weâll confirm scope, timing, and the approved payment step together."}),t.jsxs("div",{className:"web-design-hero-actions",children:[t.jsxs("a",{href:"#web-design-packages",className:"web-design-primary",children:["Explore packages ",t.jsx(Mt,{size:17})]}),t.jsxs("a",{href:"#web-design-work",className:"web-design-work-link",children:["View our work ",t.jsx(Mt,{size:17})]}),e&&r&&t.jsx("button",{type:"button",onClick:r,children:"Already a client? Sign in"})]})]}),t.jsx("div",{className:"web-design-hero-ness","aria-label":"Ness, the SmartBizHelper Smart Websites guide",children:t.jsx("img",{src:BN,alt:"Ness holding a SmartBizHelper tablet"})})]}),t.jsxs("section",{className:"web-design-featured-work",id:"web-design-work","aria-labelledby":"web-design-work-title",children:[t.jsxs("div",{className:"web-design-featured-work-copy",children:[t.jsx("p",{className:"eyebrow",children:"Featured work"}),t.jsx("h2",{id:"web-design-work-title",children:"Built for real businesses, designed to stand out."}),t.jsx("p",{children:"Explore two live SmartBizHelper sites created for distinctive brands and real customer journeys."})]}),t.jsxs("div",{className:"web-design-work-links",children:[t.jsxs("a",{href:"https://www.lilmamasweets.com/",target:"_blank",rel:"noreferrer","aria-label":"Visit Lil Mama's Sweets and Treats live website",children:[t.jsx("span",{children:"Bakery · Coffee shop · Ecommerce"}),t.jsx("strong",{children:"Lil Mama's Sweets & Treats"}),t.jsxs("small",{children:["View live site ",t.jsx(Tt,{size:15})]})]}),t.jsxs("a",{href:"https://www.sajules.com/",target:"_blank",rel:"noreferrer","aria-label":"Visit Sa Jules live website",children:[t.jsx("span",{children:"Author · Poet · Actress · Coach"}),t.jsx("strong",{children:"Sa Jules"}),t.jsxs("small",{children:["View live site ",t.jsx(Tt,{size:15})]})]})]})]}),t.jsxs("section",{className:"web-design-intro","aria-labelledby":"web-design-packages-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Find your fit"}),t.jsx("h2",{id:"web-design-packages-title",children:"Website packages and services"})]}),t.jsx("p",{children:"Seven practical ways to launch, grow, upgrade, or rescue your customer experience."})]}),d&&t.jsx("div",{className:"web-design-consultation-success",role:"status",children:d}),t.jsxs("p",{className:"web-design-consultation-clarity",children:[t.jsx(mt,{size:18})," Final scope, timing, and payment are confirmed after your consultation."]}),t.jsx("section",{className:"web-design-grid",id:"web-design-packages","aria-label":"SmartBizHelper Smart Websites packages",children:rh.map(p=>t.jsxs("article",{className:"web-design-card",id:`web-design-package-${p.handle}`,children:[t.jsx("div",{className:"web-design-card-art",children:t.jsx("img",{src:p.image,alt:p.imageAlt,loading:"lazy"})}),t.jsxs("div",{className:"web-design-card-body",children:[t.jsx("p",{className:"eyebrow",children:p.eyebrow}),t.jsx("h3",{children:p.name}),t.jsx("p",{children:p.summary}),t.jsx("ul",{children:p.highlights.map(g=>t.jsxs("li",{children:[t.jsx(Kr,{size:15})," ",g]},g))}),t.jsxs("div",{className:"web-design-card-footer",children:[t.jsxs("span",{children:["Starting at ",t.jsxs("strong",{children:["$",p.price.toLocaleStr
585ing()]})]}),e?t.jsxs("a",{href:zN(p),"aria-label":`Book a consultation for ${p.name}`,children:[t.jsx(mt,{size:16})," Book a Consultation"]}):t.jsxs("button",{type:"button",onClick:()=>{s(p),f(null)},"aria-label":`Book a consultation for ${p.name}`,children:[t.jsx(mt,{size:16})," Book a Consultation"]})]})]})]},p.handle))}),n&&t.jsx("div",{className:"web-design-consultation-backdrop",role:"presentation",children:t.jsxs("form",{className:"web-design-consultation-modal",onSubmit:x,"aria-labelledby":"web-design-consultation-title",children:[t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Selected package"}),t.jsx("h2",{id:"web-design-consultation-title",children:n.name}),t.jsxs("p",{children:["Starting at $",n.price.toLocaleString()]})]}),t.jsx("button",{type:"button",onClick:m,"aria-label":"Close consultation request",children:t.jsx(gt,{size:19})})]}),t.jsx("p",{children:"Tell us anything that will help the consultation. No payment is collected here."}),t.jsxs("label",{children:["What would you like us to know? ",t.jsx("span",{children:"Optional"}),t.jsx("textarea",{rows:5,maxLength:3e3,value:i,onChange:p=>c(p.target.value),placeholder:"Goals, timing, current website, or questions"})]}),h&&t.jsx("div",{className:"error-box",role:"alert",children:h}),t.jsxs("button",{className:"web-design-consultation-submit",disabled:o,children:[t.jsx(Un,{size:16})," ",o?"Sending requestâ¦":"Request Consultation"]}),t.jsx("small",{children:"Final scope, timing, and payment are confirmed after your consultation."})]})})]})}const UN="/assets/ness-presenting-transparent-DDWwpNL-.png",HN=[[tt,"Connect securely","Authorize only the social accounts you choose through each provider's secure sign-in."],[gp,"Plan the campaign","Turn a business goal into a practical channel-by-channel content plan."],[Uu,"Create or upload","Draft with Ness, repurpose approved material, or bring your own photos and videos."],[np,"Review and approve","Keep people in control with a clear approval step before anything can publish."],[Sn,"Schedule and publish","Coordinate approved posts when connected-channel publishing is certified."],[Rr,"Measure results","Bring performance signals back into the next plan instead of starting over."]],WN=[[ap,"Facebook"],[pp,"Instagram"],[xp,"LinkedIn"],[Ip,"YouTube"],[ep,"TikTok"]],VN=[{name:"Starter",price:"$29",copy:"A focused starting point for a small business building a steady rhythm.",features:["Campaign planning workspace","Approval-first workflow","Smart Credits eligible usage"],featured:!1},{name:"Growth",price:"$79",copy:"More room to repurpose ideas and coordinate a growing content calendar.",features:["Everything in Starter","Expanded planning and repurposing","Smart Credits eligible usage"],featured:!0},{name:"Pro",price:"$149",copy:"For teams that need a broader publishing plan and clearer oversight.",features:["Everything in Growth","Team-ready review flow","Smart Credits eligible usage"],featured:!1}];function Nf({guest:e=!1,onStart:r}){return t.jsxs("div",{className:"smart-content-page",children:[t.jsxs("section",{className:"smart-content-hero","aria-labelledby":"smart-content-title",children:[t.jsxs("div",{className:"smart-content-hero-copy",children:[t.jsxs("p",{className:"smart-content-kicker",children:[t.jsx(Or,{size:16})," Marketing momentum, guided by Ness"]}),t.jsxs("h1",{id:"smart-content-title",children:["Smart Content ",t.jsx("span",{children:"AutoPoster"})]}),t.jsx("p",{className:"smart-content-lede",children:"Plan, create, repurpose, schedule, approve, and publish content across the social channels your business connectsâall from one calm workspace."}),t.jsxs("div",{className:"smart-content-actions",children:[t.jsxs("button",{type:"button",className:"smart-content-primary",onClick:()=>r("Smart Content AutoPoster"),children:["Start with Smart Content ",t.jsx(zt,{size:18})]}),t.jsx("a",{className:"smart-content-secondary",href:"#how-it-works",children:"See how it works"})]}),t.jsxs("div",{className:"smart-content-readiness",role:"note",children:[t.jsx(Dr,{size:17}),t.jsxs("span",{children:[t.jsx("strong",{children:"Product preview"})," Live social connections and publishing remain unavailable until provider apps, OAuth permissions, and runtime certification are complete."]})]})]}),t.jsxs("div",{className:"smart-content-ness","aria-label":"Ness, your SmartBizHelper guide",children:[t.jsx("i",{}),t.jsx("i",{}),t.jsx("img",{src:UN,alt:"Ness presenting the Smart Content workspace"}),t.jsxs("div",{className:"smart-content-ness-note",children:[t.jsx(Tp,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Ness keeps the work moving."}),"You keep the final say."]})]})]})]}),t.jsxs("section",{className:"smart-content-bridge","aria-labelledby":"smart-content-bridge-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"smart-content-section-label",children:"The problem"}),t.jsx("h2",{id:"smart-content-bridge-title",children:"Good ideas get buried under the work of posting."}),t.jsx("p",{children:"Small teams juggle scattered drafts, changing formats, approval texts, upload limits, and five different calendars. Consistency becomes another full-time job."})]}),t.jsxs("div",{className:"smart-content-bridge-card",children:[t.jsx(Or,{size:24}),t.jsx("h3",{children:"SBH builds the bridge"}),t.jsx("p",{children:"Bring the plan, content, approvals, and schedule together. Ness helps turn one useful idea into channel-ready work while preserving your voice and control."})]})]}),t.jsxs("section",{className:"smart-content-section",id:"how-it-works","aria-labelledby":"smart-content-how-title",children:[t.jsxs("header",{children:[t.jsx("p",{className:"smart-content-section-label",children:"How it works"}),t.jsx("h2",{id:"smart-content-how-title",children:"One clear path from idea to insight"}),t.jsx("p",{children:"Every stage is visible, and nothing publishes without the required connection and approval."})]}),t.jsx("ol",{className:"smart-content-steps",children:HN.map(([a,n,s],i)=>t.jsxs("li",{children:[t.jsx("span",{children:String(i+1).padStart(2,"0")}),t.jsx(a,{size:22}),t.jsx("h3",{children:n}),t.jsx("p",{children:s})]},n))})]}),t.jsxs("section",{className:"smart-content-section smart-content-channels","aria-labelledby":"smart-content-channels-title",children:[t.jsxs("header",{children:[t.jsx("p",{className:"smart-content-section-label",children:"Connected reach"}),t.jsx("h2",{id:"smart-content-channels-title",children:"Meet customers where they already spend time"}),t.jsx("p",{children:"Your business keeps ownership of every social account. SmartBizHelper connects only through authorization you control."})]}),t.jsxs("div",{className:"smart-content-channel-grid",children:[WN.map(([a,n])=>t.jsxs("article",{children:[t.jsx(a,{size:24}),t.jsx("strong",{children:n}),t.jsxs("span",{children:[t.jsx(Dr,{size:13})," Planned"]})]},n)),t.jsxs("article",{className:"deferred",children:[t.jsx(Un,{size:24}),t.jsx("strong",{children:"X"}),t.jsx("span",{children:"Coming later"})]})]}),t.jsxs("div",{className:"smart-content-storage",children:[t.jsx(up,{size:22}),t.jsxs("div",{children:[t.jsx("strong",{children:"Your media can stay yours, too."}),t.jsx("p",{children:"Larger photos and video can remain in client-controlled storage such as Google Drive, then be selected for approved campaigns."})]}),t.jsx(os,{size:28})]})]}),t.jsxs("section",{className:"smart-content-section smart-content-pricing","aria-labelledby":"smart-content-pricing-title",children:[t.jsxs("header",{children:[t.jsx("p",{className:"smart-content-section-label",children:"Planning prices"}),t.jsx("h2",{id:"smart-content-pricing-title",children:"Choose the pace that fits your business"}),t.jsx("p",{children:"These are the current planning prices. Final included usage and Smart Credits limits will be confirmed before purchase."})]}),t.jsx("div",{className:"smart-content-plan-grid",children:VN.map(a=>t.jsxs("article",{className:a.featured?"featured":"",children:[a.featured&&t.jsx("span",{className:"smart-content-plan-badge",children:"Popular starting point"}),t.jsx("h3",{children:a.name}),t.jsxs("p",{className:"smart-content-price",children:[t.jsx("strong",{children:a.price}),t.jsx("span",{children:"/month"})]}),t.jsx("p",{children:a.copy}),t.jsx("ul",{children:a.features.map(n=>t.jsxs("li",{children:[t.jsx(Kt,{size:16}),n]},n))}),t.jsxs("button",{type:"button",onClick:()=>r(`${a.name} plan`),children:["Start with ",a.name]})]},a.name))}),t.jsxs("p",{className:"smart-content-credit-note",children:[t.jsx(Or,{size:16})," Smart Credits may support eligible creation and automation usage. Final allowances are not yet promised."]})]}),t.jsxs("section",{className:"smart-content-locked","aria-labelledby":"smart-content-locked-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"smart-content-section-label",children:"Connection readiness"}),t.jsx("h2",{id:"smart-content-locked-title",children:"Your accounts stay disconnected until you authorize them."}),t.jsx("p",{children:e?"Sign in to enter the protected setup path. Provider connections are not open in this preview.":"Provider setup is not open yet. Ask the SmartBizHelper team to include your business in the connection-readiness process."})]}),t.jsxs("div",{className:"smart-content-locked-state",children:[t.jsx(Dr,{size:24}),t.jsxs("div",{children:[t.jsx("strong",{children:"No social accounts connected"}),t.jsx("span",{children:"No credentials are stored in this page and no publishing action is enabled."})]})]}),t.jsxs("button",{type:"button",className:"smart-content-primary",onClick:()=>r("connection readiness"),children:[e?"Sign in to get started":"Contact the SmartBizHelper team",t.jsx(zt,{size:18})]})]})]})}const qN=[],$N=["Programs","Competitions","Contracts & RFPs","Accelerators","Local support"];function la(e){return typeof e=="string"?e.trim():""}function GN(e){const r=la(e);if(!r)return null;try{const a=new URL(r);return a.protocol==="http:"||a.protocol==="https:"?a.href:null}catch{return null}}function XN(e){const r=new Date(la(e));return Number.isNaN(r.getTime())?"Date to be confirmed":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}).format(r)}function KN(e){return e.flatMap((r,a)=>{const n=la(r.title);if(!n)return[];const s=la(r.format).toLowerCase(),i=la(r.location_text),c=s==="virtual"||s==="online"||/\b(virtual|online)\b/i.test(i);return[{id:la(r.id)||`public-event-${a}`,kind:"event",title:n,summary:la(r.description)||"Published community event. Confirm current details before attending.",category:la(r.category)||"Community event",source:la(r.host_business_name)||"SmartBizHelper Community",canonicalUrl:GN(r.registration_url),scope:c?"online":"nationwide",isVirtual:c,metadataLabel:"Starts",metadataValue:XN(r.starts_at)}]})}function YN({section:e,onSectionChange:r,eventsEnabled:a=!0,events:n=[],eventsLoading:s=!1,eventsError:i=null,onRetryEvents:c}){const[o,l]=y.useState(""),[d,u]=y.useState(""),[h,f]=y.useState(""),m=e==="events"?"event":"opportunity",x=y.useMemo(()=>m==="event"?KN(n):qN,[n,m]),p=y.useMemo(()=>x.filter(g=>
585{if(m==="event"&&!a||g.kind!==m||o&&g.scope!==o||d==="virtual"&&!g.isVirtual||d==="in-person"&&g.isVirtual)return!1;const w=h.trim().toLowerCase();return!w||`${g.title} ${g.summary} ${g.source} ${g.category}`.toLowerCase().includes(w)}),[a,d,m,h,x,o]);return t.jsxs("section",{className:"opportunity-events-page","aria-labelledby":"opportunity-events-title",children:[t.jsxs("header",{className:"opportunity-events-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper discovery"}),t.jsx("h1",{id:"opportunity-events-title",children:"Opportunities & Events"}),t.jsx("p",{children:"Public, read-only discovery from authoritative sources. Verify eligibility and dates before acting."})]}),t.jsx("span",{children:e==="events"&&a&&s?"Loading eventsâ¦":e==="events"&&a&&i?"Events unavailable":`${p.length} public items`})]}),t.jsxs("nav",{className:"opportunities-events-tabs","aria-label":"Opportunities and Events sections",children:[t.jsxs("button",{type:"button",className:e==="opportunities"?"active":"","aria-current":e==="opportunities"?"page":void 0,onClick:()=>r("opportunities"),children:[t.jsx(fr,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Opportunities"}),t.jsx("small",{children:"Government grants and future programs"})]})]}),t.jsxs("button",{type:"button",className:e==="events"?"active":"","aria-current":e==="events"?"page":void 0,onClick:()=>r("events"),children:[t.jsx(mt,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Events"}),t.jsx("small",{children:"Calendar, Upcoming, and Today"})]})]})]}),e==="opportunities"?t.jsxs("nav",{className:"opportunity-category-strip","aria-label":"Opportunity categories",children:[t.jsxs("button",{type:"button",className:"active","aria-current":"page",children:[t.jsx(fr,{size:16})," Government grants"]}),$N.map(g=>t.jsxs("span",{children:[g,t.jsx("small",{children:"Planned"})]},g))]}):t.jsxs("div",{className:"public-event-view-strip","aria-label":"Public event views",children:[t.jsxs("span",{className:"active",children:[t.jsx(mt,{size:16})," Upcoming"]}),t.jsx("span",{children:"Today"}),t.jsx("small",{children:"Sign in for the full Events Calendar and event management."})]}),e==="events"&&!a&&t.jsxs("div",{className:"opportunity-events-access-note",role:"status",children:[t.jsx(mt,{size:20}),t.jsxs("div",{children:[t.jsx("strong",{children:"Events are currently in controlled beta."}),t.jsx("p",{children:"Sign in with an authorized workspace to use the full calendar, Upcoming and Today views, event search, submissions, and management."})]})]}),t.jsxs("div",{className:"opportunity-events-filters","aria-label":`${e==="events"?"Event":"Opportunity"} filters`,"aria-disabled":e==="events"&&(!a||s||!!i),children:[t.jsxs("label",{className:"opportunity-events-search",children:[t.jsx("span",{children:"Search"}),t.jsxs("div",{children:[t.jsx(Yr,{size:16}),t.jsx("input",{value:h,onChange:g=>f(g.target.value),placeholder:`Search ${e}`})]})]}),t.jsxs("label",{children:["Geography",t.jsxs("select",{"aria-label":"Discovery geography",value:o,onChange:g=>l(g.target.value),children:[t.jsx("option",{value:"",children:"All regions"}),t.jsx("option",{value:"nationwide",children:"Nationwide"}),t.jsx("option",{value:"online",children:"Online"})]})]}),t.jsxs("label",{children:["Format",t.jsxs("select",{"aria-label":"Discovery format",value:d,onChange:g=>u(g.target.value),children:[t.jsx("option",{value:"",children:"Any"}),t.jsx("option",{value:"virtual",children:"Online / virtual"}),t.jsx("option",{value:"in-person",children:"In person"})]})]})]}),t.jsx("div",{className:"opportunity-events-grid","aria-live":"polite","aria-busy":e==="events"&&a&&s,children:e==="events"&&a&&s?t.jsxs("div",{className:"opportunity-events-feed-status loading",role:"status",children:[t.jsx(gr,{className:"spin",size:28}),t.jsxs("div",{children:[t.jsx("h2",{children:"Loading published eventsâ¦"}),t.jsx("p",{children:"Weâre checking the public Events feed."})]})]}):e==="events"&&a&&i?t.jsxs("div",{className:"opportunity-events-feed-status error",role:"alert",children:[t.jsx(Ou,{size:28}),t.jsxs("div",{children:[t.jsx("h2",{children:"Events couldnât be loaded"}),t.jsx("p",{children:i}),t.jsxs("button",{type:"button",onClick:c,children:[t.jsx(St,{size:16})," Try again"]})]})]}):p.length?p.map(g=>{const w=g.kind==="opportunity"?fr:mt;return t.jsxs("article",{children:[t.jsxs("div",{className:"opportunity-events-card-top",children:[t.jsxs("span",{children:[t.jsx(w,{size:16})," ",g.kind==="opportunity"?"Opportunity":"Event"]}),t.jsx("small",{children:g.category})]}),t.jsx("h2",{children:g.title}),t.jsx("p",{children:g.summary}),t.jsxs("dl",{children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Source"}),t.jsx("dd",{children:g.source})]}),t.jsxs("div",{children:[t.jsx("dt",{children:g.metadataLabel}),t.jsx("dd",{children:g.metadataValue})]})]}),g.canonicalUrl&&t.jsxs("a",{href:g.canonicalUrl,target:"_blank",rel:"noopener noreferrer",children:["Open authoritative source ",t.jsx(Tt,{size:15})]})]},g.id)}):t.jsxs("div",{className:"opportunity-events-empty",children:[t.jsx(Yr,{size:28}),t.jsx("h2",{children:e==="events"&&!a?"No public event access in this environment":e==="events"&&!n.length?"No published events are available yet"
585:"No reviewed opportunities are available yet"}),t.jsx("p",{children:e==="events"&&!a?"The Events section remains available here without exposing protected calendar data or actions.":e==="events"&&!n.length?"Published community events will appear here as soon as they are available.":"No demo or fallback opportunities are shown as live. Reviewed source-linked opportunities will appear when the public discovery contract is enabled."})]})}),t.jsx("p",{className:"guest-boundary",children:"Guest Mode is read-only. Sign in to use event submission, registration, management, and tenant-authorized features."})]})}function gu(e){switch(e){case"marketplace":return"module_marketplace";case"events":return"module_events";case"directory":return"module_directory";case"suites":return"module_feature_previews";default:return null}}function Rc({label:e}){return t.jsxs("section",{className:"guest-lobby-area panel","aria-labelledby":"guest-area-title",children:[t.jsxs("header",{children:[t.jsx("span",{className:"lobby-heading-icon",children:t.jsx(Dr,{size:18})}),t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Public guest access"}),t.jsx("h1",{id:"guest-area-title",children:e})]})]}),t.jsx("p",{className:"guest-boundary",children:Lu})]})}const cs=[{id:"lobby",label:"The Lobby",icon:zn},{id:"web-design",label:"Smart Websites",icon:Di},{id:"smart-content",label:"Smart Content",icon:Ls},{id:"smart-finance",label:"Smart Finance",icon:Bi},{id:"opportunities",label:"Opportunities & Events",icon:fr},{id:"directory",label:"Business Directory",icon:dr},{id:"marketplace",label:"Bizz2Bizz BarterPlace",icon:ha},{id:"suites",label:"Feature Previews",icon:mp}],Oc=["lobby","directory","marketplace","events","suites"];function vu(){const e=new URLSearchParams(window.location.search),r=e.get("area");return r==="events"?{area:"opportunities",hubSection:"events"}:r==="grant-watch"?{area:"opportunities",hubSection:"opportunities"}:r==="opportunities"?{area:"opportunities",hubSection:e.get("section")==="events"?"events":"opportunities"}:{area:cs.some(a=>a.id===r)?r:"lobby",hubSection:"opportunities"}}const Lc={lobby:[],"web-design":[],"smart-content":[],"smart-finance":[],opportunities:[],directory:[],marketplace:[],events:[],suites:[]},JN=[{label:"Workspace",icon:Xr},{label:"Smart Inventory",icon:Xr},{label:"Smart Scanner",icon:xa},{label:"Smart Wallet",icon:ur},{label:"Smart CRM",icon:Rs},{label:"Smart Sims",icon:Or},{label:"Reports",icon:Rr},{label:"Bizz2Bizz Connect",icon:Dn},{label:"Settings",icon:ho}];function Ii(e){return String(e.name??e.title??e.body??"Public item")}function io(e){return String(e.headline??e.description??e.category??e.status??"")}function il(e){const r=e.starts_at??e.published_at;if(!r)return"";const a=new Date(String(r));return Number.isNaN(a.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(a)}function QN({supabase:e,access:r,onSignIn:a}){var te,fe,q;const n=vu(),[s,i]=y.useState(n.area),[c,o]=y.useState(n.hubSection),[l,d]=y.useState(Lc),[u,h]=y.useState([]),[f,m]=y.useState(null),[x,p]=y.useState(!0),[g,w]=y.useState(!0),[S,b]=y.useState(null),[j,k]=y.useState(0),[N,C]=y.useState(!1),[P,T]=y.useState(!1),[L,M]=y.useState("");y.useEffect(()=>{const J=()=>{const le=vu();i(le.area),o(le.hubSection),M("")};return window.addEventListener("popstate",J),window.addEventListener(ga,J),()=>{window.removeEventListener("popstate",J),window.removeEventListener(ga,J)}},[]),y.useEffect(()=>{let J=!0;return p(!0),w(!0),b(null),m(null),e?(Promise.all([...Oc.map(async le=>{var V;const A=await e.rpc("sbh_guest_browse_gated",{p_area:le});return{id:le,items:((V=A.data)==null?void 0:V.items)??[],error:A.error}}),e.rpc("sbh_get_content_placements",{p_surface:"lobby_spotlight",p_limit:8,p_cycle_bucket:null}).then(le=>({id:"spotlight",items:le.data??[],error:le.error}))]).then(le=>{if(!J)return;const A={...Lc};for(const D of le.slice(0,Oc.length))A[D.id]=D.items;const V=le[Oc.length],I=le.find(D=>D.id==="events");d(A),h((V==null?void 0:V.items)??[]),m(le.some(D=>D.error)?"Some public Lobby content could not be loaded.":null),b(I!=null&&I.error?"We couldn't load published events. Please try again.":null),w(!1),p(!1)}),()=>{J=!1}):(d(Lc),m("The public Lobby connection is not configured in this environment."),b("Events could not be loaded because the public connection is unavailable."),w(!1),p(!1),()=>{J=!1})},[j,e]);const E=J=>{const le=new URLSearchParams(window.location.search);le.set("guest","1"),J==="events"||J==="grant-watch"?(le.set("area","opportunities"),le.set("section",J==="events"?"events":"opportunities")):(le.set("area",J),J==="opportunities"?le.set("section","opportunities"):le.delete("section")),C(!1),Aa(`${window.location.pathname}?${le.toString()}`)},W=J=>E(J==="events"?"events":"grant-watch"),ee=y.useMemo(()=>{const J=L.trim().toLowerCase();return J?l[s].filter(le=>(Ii(le)+" "+io(le)).toLowerCase().includes(J)):l[s]},[s,l,L]),ce=t.jsxs("aside",{className:"lobby-intelligence-rail guest-lobby-rail","aria-label":"Lobby intelligence",children:[t.jsxs("section",{className:"lobby-rail-card lobby-glance-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"At a Glance"}),t.jsx(Dr,{size:18})]}),t.jsxs("div",{className:"lobby-glance-list",children:[t.jsxs("button",{className:"lobby-marketplace-row",type:"button",onClick:a,children:[t.jsx("i",{className:"lobby-rail-icon credits",children:t.jsx(ur,{size:16})}),t.jsxs("span",{children:[t.jsx("b",{children:"Smart Credits"}),t.jsx("small",{children:"Sign in to view your balance"})]}),t.jsx(Dr,{size:15})]}),t.jsxs("button",{className:"lobby-marketplace-row",type:"button",onClick:()=>E("marketplace"),children:[t.jsx("i",{className:"lobby-rail-icon marketplace",children:t.jsx(ha,{size:16})}),t.jsxs("span",{children:[t.jsx("b",{children:"Bizz2Bizz BarterPlace"}),t.jsx("small",{children:"Browse free business trade listings"})]}),t.jsx(zt,{size:16})]})]})]}),f&&t.jsxs("div",{className:"lobby-rail-status",role:"status",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>k(J=>J+1),children:"Try again"})]}),x?t.jsxs("div",{className:"lobby-rail-loading",children:[t.jsx(gr,{className:"spin"}),t.jsx("span",{children:"Loading public Lobby intelligenceâ¦"})]}):t.jsxs(t.Fragment,{children:[t.jsx(Bc,{title:"Upcoming Events",icon:mt,items:l.events,empty:"No public events are available yet.",onOpen:()=>E("events")}),t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Opportunities"}),t.jsx(fr,{size:18})]}),t.jsxs("button",{className:"guest-locked-card",type:"button",onClick:a,children:[t.jsx(Dr,{size:17}),t.jsxs("span",{children:[t.jsx("strong",{children:"Protected preview"}),t.jsx("small",{children:"Sign in to review source-linked opportunities."})]})]})]}
585),t.jsx(Bc,{title:"Featured Businesses",icon:na,items:l.directory,empty:"No published businesses are available.",onOpen:()=>E("directory")}),t.jsx(Bc,{title:"BarterPlace Highlights",icon:ha,items:l.marketplace,empty:"No public trade listings are available.",onOpen:()=>E("marketplace")})]})]}),ue=((te=cs.find(J=>J.id===s))==null?void 0:te.icon)??zn;return t.jsxs("div",{className:"app-shell lobby-shell guest-lobby-shell",children:[t.jsxs("div",{className:"lobby-shell-dedicated",children:[t.jsxs("aside",{className:N?"lobby-sidebar open":"lobby-sidebar","aria-label":"SmartBizHelper guest navigation",children:[t.jsxs("div",{className:"lobby-sidebar-brand",children:[t.jsx("img",{src:Bs,alt:"SmartBizHelper"}),t.jsx("button",{type:"button",className:"icon-button lobby-sidebar-close",onClick:()=>C(!1),"aria-label":"Close Lobby navigation",children:t.jsx(gt,{})})]}),t.jsxs("nav",{children:[cs.map(J=>{const le=J.icon,A=s===J.id;return t.jsxs("button",{type:"button",className:"lobby-sidebar-link"+(A?" active":""),onClick:()=>E(J.id),"aria-current":A?"page":void 0,children:[t.jsx(le,{size:19}),t.jsx("span",{children:J.label}),t.jsx(zt,{size:14})]},J.id)}),JN.map(J=>{const le=J.icon;return t.jsxs("button",{type:"button",className:"lobby-sidebar-link unavailable",onClick:a,title:J.label+" â Sign in required",children:[t.jsx(le,{size:19}),t.jsx("span",{children:J.label}),t.jsx("small",{children:"Locked"})]},J.label)})]}),t.jsxs("section",{className:"lobby-ness-card","aria-labelledby":"guest-ness-title",children:[t.jsx("div",{className:"lobby-ness-placeholder","aria-hidden":"true",children:"N"}),t.jsxs("div",{children:[t.jsx("strong",{id:"guest-ness-title",children:"Have a business?"}),t.jsx("p",{children:"Tell Ness about it before you create an account."}),t.jsx("a",{href:"/onboarding.html",children:"Tell NESS About Your Business"})]})]}),t.jsxs("div",{className:"lobby-sidebar-footer",children:[t.jsxs("div",{className:"lobby-sidebar-account",children:[t.jsx("span",{children:"Guest visitor"}),t.jsx("button",{type:"button",onClick:a,children:"Sign in"})]}),t.jsx(Ra,{className:"portal-ownership-footer-sidebar"})]})]}),N&&t.jsx("button",{className:"lobby-shell-scrim",type:"button","aria-label":"Close Lobby navigation",onClick:()=>C(!1)})]}),t.jsxs("div",{className:"main-shell lobby-dedicated-main",children:[t.jsxs("header",{className:"lobby-global-header",children:[t.jsx("button",{className:"lobby-header-icon lobby-mobile-menu",type:"button",onClick:()=>C(!0),"aria-label":"Open Lobby navigation",children:t.jsx(Ds,{size:21})}),t.jsxs("label",{className:"lobby-global-search",children:[t.jsx(Yr,{size:18}),t.jsx("input",{value:L,onChange:J=>M(J.target.value),"aria-label":"Search public SmartBizHelper content",placeholder:"Search SmartBizHelperâ¦"})]}),t.jsxs("div",{className:"lobby-global-actions",children:[t.jsxs("button",{className:"lobby-create-button",type:"button",onClick:a,children:[t.jsx(qr,{size:18})," Create"]}),t.jsx("button",{className:"lobby-header-icon lobby-discover-launcher",type:"button",onClick:()=>T(!0),"aria-label":"Open Discover",children:t.jsx(fo,{size:20})}),t.jsx("button",{className:"lobby-header-icon",type:"button",onClick:a,"aria-label":"Sign in to view notifications",children:t.jsx(aa,{size:20})}),t.jsx("button",{className:"lobby-header-icon smart-card-launcher",type:"button",onClick:a,"aria-label":"Sign in to open an SBH Smart Card",children:t.jsx(Rs,{size:20})}),t.jsxs("button",{className:"lobby-profile-button",type:"button",onClick:a,"aria-label":"Create an account or sign in",children:[t.jsx("span",{children:"G"}),t.jsxs("small",{children:[t.jsx("b",{children:"Guest visitor"}),t.jsx("em",{children:"Read-only Lobby"})]}),t.jsx(Zf,{size:15})]})]})]}),t.jsxs("main",{className:"content lobby-main-content",children:[t.jsxs("div",{className:"guest-lobby-banner",role:"status",children:[t.jsxs("span",{children:[t.jsx(Dr,{size:16})," Youâre exploring the public, read-only Lobby."]}),t.jsx("button",{type:"button",onClick:a,children:"Create an account or sign in"})]}),t.jsxs("div",{className:"lobby-columns",children:[t.jsx("section",{className:"lobby-center-column",children:s==="lobby"?t.jsx(eC,{loading:x,error:f,items:ee,spotlight:u,onNavigate:E,onSignIn:a,onRetry:()=>k(J=>J+1)}):s==="web-design"?r.module_smart_websites?t.jsx(Sf,{guest:!0,onSignIn:a}):t.jsx(Rc,{label:"Smart Websites"}):s==="smart-content"?t.jsx(Nf,{guest:!0,onStart:a}):s==="smart-finance"?r.module_smart_finance?t.jsx(kf,{guest:!0,onSignIn:a}):t.jsx(Rc,{label:"Smart Finance"}):s==="opportunities"?t.jsx(YN,{section:c,onSectionChange:W,eventsEnabled:r.module_events,events:l.events,eventsLoading:g,eventsError:S,onRetryEvents:()=>k(J=>J+1)}):gu(s)&&!r[gu(s)]?t.jsx(Rc,{label:((fe=cs.find(J=>J.id===s))==null?void 0:fe.label)??s}):t.jsxs("section",{className:"guest-lobby-area panel","aria-labelledby":"guest-area-title",children:[t.jsxs("header",{children:[t.jsx("span",{className:"lobby-heading-icon",children:t.jsx(ue,{size:18})}),t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Public guest access"}),t.jsx("h1",{id:"guest-area-title",children:(q=cs.find(J=>J.id===s))==null?void 0:q.label}),t.jsx("p",{children:"Browsing intentionally public and demo-safe SmartBizHelper content."})]})]}),f&&t.jsxs("div",{className:"guest-error",role:"alert",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>k(J=>J+1),children:"Try again"})]}),t.jsx("div",{className:"guest-results","aria-live":"polite","aria-busy":x,children:x?t.jsxs("div",{className:"guest-empty",children:[t.jsx(gr,{className:"spin"}),t.jsx("span",{children:"Loading public contentâ¦"})]}):ee.length?ee.map((J,le)=>t.jsxs("article",{children:[t.jsx(ue,{size:20}),t.jsxs("div",{children:[t.jsx("strong",{children:Ii(J)}),t.jsx("span",{children:io(J)||il(J)})]})]},String(J.id??le))):t.jsxs("div",{className:"guest-empty",children:[t.jsx(ue,{size:24}),t.jsx("span",{children:"No public items are available in this area yet."})]})}),t.jsx("p",{className:"guest-boundary",children:"Guest access never opens tenant inventory, CRM records, account settings, purchases, private workspace data, or write actions."})]})}),ce]})]})]}),P&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"smart-card-backdrop",type:"button","aria-label":"Close Discover",onClick:()=>T(!1)}),t.jsxs("aside",{className:"discover-drawer","aria-label":"Discover",children:[t.jsxs("header",{children:[t.jsx("h2",{children:"Discover"}),t.jsx("button",{className:"icon-button",type:"button",onClick:()=>T(!1),"aria-label":"Close Discover",children:t.jsx(gt,{})})]}),ce]})]})]})}
585function Bc({title:e,icon:r,items:a,empty:n,onOpen:s}){return t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:e}),t.jsxs("button",{className:"lobby-rail-heading-action",type:"button",onClick:s,"aria-label":`Open ${e} in Opportunities and Events`,children:["View all ",t.jsx(zt,{size:14})]})]}),a.length?t.jsx("div",{className:"lobby-rail-list",children:a.slice(0,3).map((i,c)=>t.jsxs("button",{className:"lobby-rail-simple-row guest-rail-button",type:"button",onClick:s,children:[t.jsx("i",{className:"lobby-rail-icon",children:t.jsx(r,{size:15})}),t.jsxs("div",{children:[t.jsx("strong",{children:Ii(i)}),t.jsx("span",{children:io(i)||il(i)||"Public content"})]})]},String(i.id??c)))}):t.jsx("p",{className:"lobby-rail-empty",children:n})]})}function ZN({tone:e}){return e==="event"?t.jsx(mt,{size:30}):e==="marketplace"?t.jsx(Ps,{size:30}):e==="grant"?t.jsx(fr,{size:30}):e==="business"?t.jsx(ha,{size:30}):t.jsx(Or,{size:30})}function eC({loading:e,error:r,items:a,spotlight:n,onNavigate:s,onSignIn:i,onRetry:c}){const o=y.useRef(null),l=d=>{var u;return(u=o.current)==null?void 0:u.scrollBy({left:d*Math.max(260,o.current.clientWidth*.82),behavior:"smooth"})};return t.jsxs("div",{className:"lobby-app-view",children:[t.jsxs("section",{className:"lobby-spotlight","aria-labelledby":"guest-spotlight-title",children:[t.jsxs("header",{className:"lobby-section-heading",children:[t.jsxs("div",{children:[t.jsx("span",{className:"lobby-heading-icon",children:t.jsx(na,{size:17})}),t.jsx("h1",{id:"guest-spotlight-title",children:"Community Spotlight"})]}),t.jsxs("div",{className:"lobby-spotlight-actions",children:[t.jsx("button",{type:"button",className:"lobby-spotlight-scroll",onClick:()=>l(-1),"aria-label":"Scroll Community Spotlight left",children:t.jsx(po,{size:17})}),t.jsx("button",{type:"button",className:"lobby-spotlight-scroll",onClick:()=>l(1),"aria-label":"Scroll Community Spotlight right",children:t.jsx(zt,{size:17})}),t.jsxs("button",{type:"button",onClick:()=>s("directory"),children:["View community ",t.jsx("span",{"aria-hidden":"true",children:"â"})]})]})]}),e?t.jsxs("div",{className:"lobby-spotlight-loading",children:[t.jsx(gr,{className:"spin",size:24}),t.jsx("span",{children:"Loading public community highlightsâ¦"})]}):n.length?t.jsx("div",{ref:o,className:"lobby-spotlight-grid","aria-label":"Community Spotlight carousel",children:n.map(d=>t.jsxs("button",{className:"lobby-spotlight-card "+d.tone,type:"button",onClick:()=>s(d.destination),children:[t.jsxs("span",{className:"lobby-spotlight-visual",children:[t.jsx(ZN,{tone:d.tone}),t.jsx("small",{children:d.kind})]}),t.jsxs("span",{className:"lobby-spotlight-copy",children:[t.jsx("strong",{children:d.title}),t.jsx("span",{children:d.detail||"Public SmartBizHelper content"}),t.jsx("b",{children:d.meta||"Explore"})]})]},d.id))}):t.jsxs("div",{className:"lobby-spotlight-empty",children:[t.jsx(na,{size:24}),t.jsxs("div",{children:[t.jsx("strong",{children:"Community highlights will appear here."}),t.jsx("span",{children:"Only intentionally public content is shown in guest mode."})]}),t.jsx("button",{type:"button",onClick:()=>s("directory"),children:"Explore the directory"})]})]}),t.jsxs("section",{className:"panel lobby-composer-panel guest-composer-panel","aria-labelledby":"guest-composer-title",children:[t.jsxs("div",{className:"lobby-composer-row",children:[t.jsx("div",{className:"avatar lobby-viewer-avatar","aria-hidden":"true",children:"G"}),t.jsxs("div",{className:"lobby-composer-prompt",children:[t.jsx("h2",{id:"guest-composer-title",children:"Join the SmartBizHelper community"}),t.jsx("button",{className:"guest-composer-prompt-button",type:"button",onClick:i,children:"Sign in to share whatâs happening with your business"})]})]}),t.jsx("div",{className:"lobby-composer-tools","aria-label":"Post options available after sign-in",children:[[Cn,"Photo / Video","photo"],[mt,"Event","event"],[Ps,"Product","product"],[zu,"Service","service"],[Or,"Promotion","promotion"],[Rr,"Poll","poll"]].map(([d,u,h])=>{const f=d;return t.jsxs("button",{className:"lobby-composer-tool "+h,type:"button",onClick:i,children:[t.jsx(f,{size:19}),t.jsx("span",{children:String(u)})]},String(u))})}),t.jsxs("button",{className:"primary-inline guest-publish-cta",type:"button",onClick:i,children:[t.jsx(Un,{size:16})," Sign in to publish"]})]}),r&&t.jsxs("div",{className:"error-box lobby-recoverable-error",role:"alert",children:[t.jsx("span",{children:r}),t.jsx("button",{type:"button",onClick:c,children:"Try again"})]}),e?t.jsxs("section",{className:"panel lobby-empty-state",children:[t.jsx(gr,{className:"spin"}),t.jsx("p",{children:"Loading the public feedâ¦"})]}):a.length?t.jsx("section",{className:"lobby-feed","aria-label":"Public Lobby feed",children:a.map((d,u)=>t.jsxs("article",{className:"panel lobby-post",children:[t.jsxs("header",{className:"lobby-post-header",children:[t.jsx("div",{className:"avatar",children:"S"}),t.jsxs("div",{children:[t.jsx("strong",{children:"SmartBizHelper Community"}),t.jsx("span",{children:il(d)||"Public post"})]}),t.jsx("button",{className:"icon-button",type:"button",onClick:i,"aria-label":"Sign in for post options",children:t.jsx(Wu,{size:18})})]}),t.jsx("p",{className:"lobby-post-body",children:Ii(d)}),t.jsxs("footer",{className:"lobby-post-actions",children:[t.jsxs("button",{type:"button",onClick:i,children:[t.jsx($u,{size:16})," Like"]}),t.jsxs("button",{type:"button",onClick:i,children:[t.jsx(Dn,{size:16})," Comment"]}),t.jsxs("button",{type:"button",onClick:i,children:[t.jsx(Dr,{size:16})," Sign in to interact"]})]})]},String(d.id??u)))}):t.jsxs("section",{className:"panel lobby-empty-state",children:[t.jsx(Dn,{size:30}),t.jsx("h2",{children:"No public Lobby posts are available yet."}),t.jsx("p",{className:"muted",children:"Guest mode only shows posts intentionally published for the public."})]})]})}function tC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState(null),[i,c]=y.useState("all");async function o(){const h=await e.from("portal_notifications").select("id,title,body,category_key,priority,read_at,created_at").is("ar
585chived_at",null).order("created_at",{ascending:!1}).limit(50);h.error?s(h.error.message):a(h.data??[])}y.useEffect(()=>{o();const h=e.channel("portal-notifications").on("postgres_changes",{event:"*",schema:"public",table:"portal_notifications"},()=>void o()).subscribe();return()=>{e.removeChannel(h)}},[e]);async function l(h){const f=await e.rpc("sbh_mark_notification_read",{p_notification_id:h,p_archived:!1});f.error?s(f.error.message):o()}async function d(){const h=r.filter(f=>!f.read_at);for(const f of h)await l(f.id)}const u=i==="unread"?r.filter(h=>!h.read_at):r;return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Smart Notification Service"}),t.jsx("h1",{children:"Notifications"}),t.jsx("p",{className:"muted",children:"Live messages from your protected workspace services."})]}),t.jsx(aa,{size:24})]}),n&&t.jsx("div",{className:"error-box",children:n}),t.jsxs("section",{className:"panel",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Notification center"}),t.jsxs("p",{className:"muted",children:[r.filter(h=>!h.read_at).length," unread"]})]}),t.jsxs("div",{className:"inline-actions",children:[t.jsx("button",{className:i==="all"?"primary-inline":"secondary-button",onClick:()=>c("all"),children:"Recent"}),t.jsx("button",{className:i==="unread"?"primary-inline":"secondary-button",onClick:()=>c("unread"),children:"Unread"}),t.jsxs("button",{className:"secondary-button",onClick:()=>void d(),disabled:!r.some(h=>!h.read_at),children:[t.jsx(Qf,{size:15})," Mark all read"]})]})]}),t.jsx("div",{className:"attention-list",children:u.length?u.map(h=>t.jsxs("div",{className:`attention-row ${h.read_at?"":"unread"}`,children:[t.jsxs("div",{children:[t.jsx("strong",{children:h.title}),t.jsxs("span",{children:[h.category_key," · ",h.priority," · ",new Date(h.created_at).toLocaleString()]}),t.jsx("p",{children:h.body})]}),!h.read_at&&t.jsxs("button",{className:"row-action",onClick:()=>void l(h.id),children:[t.jsx(Kt,{size:14})," Mark read"]})]},h.id)):t.jsxs("div",{className:"empty-state",children:[t.jsx(aa,{size:30}),t.jsx("h3",{children:i==="unread"?"You're all caught up":"No notifications yet"}),t.jsx("p",{children:"Protected platform services will post updates here."})]})})]})]})}function rC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState([]),[i,c]=y.useState([]),[o,l]=y.useState([]),[d,u]=y.useState(null),[h,f]=y.useState(""),[m,x]=y.useState(null),[p,g]=y.useState(""),[w,S]=y.useState(!1),[b,j]=y.useState(""),[k,N]=y.useState("workspace"),[C,P]=y.useState([]),T=y.useRef(!1);async function L(){const A=await e.from("sbh_workspace_conversations").select("id,title,conversation_type,updated_at,archived_at,muted").order("updated_at",{ascending:!1});A.error?x(A.error.message):a(A.data??[])}async function M(){const A=await e.rpc("sbh_list_workspace_people");A.error||s(A.data??[])}async function E(){const A=await e.rpc("sbh_list_business_connections");A.error||c(A.data??[])}async function W(A){const V=await e.from("sbh_workspace_messages").select("id,sender_portal_user_id,body,created_at").eq("conversation_id",A).order("created_at",{ascending:!0}).limit(200);if(V.error)x(V.error.message);else{const I=V.data??[];l(I);const D=I[I.length-1];D&&e.rpc("sbh_mark_workspace_message_read",{p_message_id:D.id})}}y.useEffect(()=>{L(),M(),E();const A=e.channel("workspace-messages").on("postgres_changes",{event:"*",schema:"public",table:"sbh_workspace_messages"},()=>{L(),d&&W(d)}).subscribe();return()=>{e.removeChannel(A)}},[e,d]),y.useEffect(()=>{if(T.current)return;const A=new URLSearchParams(window.location.search).get("conversation");A&&r.some(V=>V.id===A)&&(T.current=!0,u(A),W(A))},[r]);async function ee(A){var D;A.preventDefault();const V=await e.rpc("sbh_create_workspace_conversation",{p_title:b.trim(),p_conversation_type:k,p_participant_ids:C});if(V.error)return x(V.error.message);x("Conversation created."),S(!1),j(""),P([]),await L();const I=(D=V.data)==null?void 0:D.conversation_id;I&&(u(I),await W(I))}async function ce(){var V;if(!d||!h.trim())return;const A=await e.rpc("sbh_send_workspace_message",{p_conversation_id:d,p_body:h.trim()});x(((V=A.error)==null?void 0:V.message)??"Message sent."),A.error||(f(""),await L(),await W(d))}async function ue(A,V,I){const D=await e.rpc("sbh_set_workspace_conversation_state",{p_conversation_id:A.id,p_archived:V,p_muted:I});D.error?x(D.error.message):(x(V?"Conversation archived.":I?"Conversation muted.":"Conversation updated."),await L())}async function te(A,V){const I=await e.rpc("sbh_decide_business_connection",{p_connection_id:A.id,p_decision:V});I.error?x(I.error.message):(x(`Connection ${V}d.`),E())}const fe=y.useMemo(()=>r.filter(A=>`${A.title??""} ${A.conversation_type}`.toLowerCase().includes(p.toLowerCase())),[r,p]),q=d?r.find(A=>A.id===d):null,J=i.filter(A=>A.status==="accepted").length,le=i.filter(A=>A.status==="pending").length;return t.jsxs("div",{className:"bizz-connect-page",children:[t.jsxs("header",{className:"page-heading bizz-connect-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Bizz2Bizz Connect"}),t.jsx("h1",{children:"Bizz2Bizz Connect"}),t.jsx("p",{className:"muted",children:"Private business conversations built around verified connections."})]}),t.jsxs("div",{className:"bizz-connect-trust",children:[t.jsx(tt,{size:17}),t.jsx("span",{children:"Protected conversations"})]})]}),m&&t.jsx("div",{className:"success-box",children:m}),t.jsxs("section",{className:`bizz-connect-shell${q?" has-active":""}`,children:[t.jsxs("section",{className:"panel bizz-connect-panel bizz-connect-inbox",children:[t.jsxs("div",{className:"bizz-connect-toolbar",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Inbox"}),t.jsxs("p",{className:"muted",children:[r.length," conversation",r.length===1?"":"s"," · ",J," connection",J===1?"":"s"]})]}),t.jsxs("button",{className:"secondary-button bizz-connect-team-button",onClick:()=>S(!0),children:[t.jsx(Va,{size:15})," New team thread"]})]}),t.jsxs("label",{className:"search-field bizz-connect-search",children:[t.jsx(Yr,{size:16}),t.jsx("input",{value:p,onChange:A=>g(A.target.value),placeholder:"Search conversations"})]}),t.jsx("div",{className:"bizz-connect-conversation-list",children:fe.length?fe.map(A=>t.jsxs("article",{className:`bizz-conversation-row${d===A.id?" selected":""}`,children:[t.jsxs("button",{className:"conversation-select",onClick:()=>{u(A.id),W(A.id)},children:[t.jsx("span",{className:"bizz-conversation-avatar","aria-hidden":"true",children:t.jsx(Va,{size:16})}),t.jsxs("span",{className:"bizz-conversation-copy",children:[t.jsx("strong",{children:A.title||"Bizz2Bizz Connect"}),t.jsxs("small",{children:[A.conversation_type==="workspace"?"Team conversation":A.conversation_type," · ",new Date(A.updated_at).toLocaleStr
585ing()]}),A.muted&&t.jsx("em",{children:"Muted"})]})]}),t.jsxs("div",{className:"inline-actions bizz-conversation-actions",children:[t.jsx("button",{className:"row-action","aria-label":A.muted?"Unmute conversation":"Mute conversation",title:A.muted?"Unmute":"Mute",onClick:()=>void ue(A,!1,!A.muted),children:A.muted?t.jsx(Ep,{size:14}):t.jsx(Cp,{size:14})}),t.jsx("button",{className:"row-action","aria-label":"Archive conversation",title:"Archive",onClick:()=>void ue(A,!0,A.muted),children:t.jsx(gi,{size:14})})]})]},A.id)):t.jsxs("div",{className:"empty-state bizz-connect-empty",children:[t.jsx(Va,{size:34}),t.jsx("h3",{children:p?"No conversations match your search":"Your Bizz2Bizz inbox is ready"}),t.jsx("p",{children:p?"Try another business name or conversation title.":"Start with a verified business in the Directory or BarterPlace. Once connected, the conversation will appear here."}),!p&&t.jsxs("div",{className:"bizz-connect-empty-actions",children:[t.jsx("a",{className:"secondary-button",href:"?area=directory",children:"Browse Directory"}),t.jsx("a",{className:"secondary-button",href:"?area=marketplace",children:"Open BarterPlace"})]})]})}),t.jsxs("div",{className:"connection-list bizz-connect-connections",children:[t.jsxs("div",{className:"bizz-connect-section-title",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Business connections"}),t.jsx("p",{className:"muted",children:le?`${le} request${le===1?"":"s"} waiting`:"Verified connections appear here."})]}),t.jsx(dr,{size:18})]}),i.length?i.map(A=>t.jsxs("div",{className:"bizz-connection-row",children:[t.jsx("span",{className:"bizz-connection-avatar","aria-hidden":"true",children:A.other_business_name.trim().charAt(0).toUpperCase()||"B"}),t.jsxs("div",{className:"bizz-connection-copy",children:[t.jsx("strong",{children:A.other_business_name}),t.jsx("span",{children:A.status==="accepted"?"Connected":A.status})]}),A.status==="pending"&&t.jsxs("div",{className:"inline-actions",children:[t.jsxs("button",{className:"row-action",onClick:()=>void te(A,"accept"),children:[t.jsx(Kt,{size:14})," Accept"]}),t.jsxs("button",{className:"row-action",onClick:()=>void te(A,"decline"),children:[t.jsx(gt,{size:14})," Decline"]})]})]},A.id)):t.jsxs("div",{className:"bizz-connect-connection-empty",children:[t.jsx(dr,{size:19}),t.jsx("span",{children:"No business connections yet."})]})]})]}),t.jsxs("section",{className:"panel bizz-connect-panel bizz-connect-thread",children:[t.jsxs("div",{className:"bizz-thread-header",children:[t.jsxs("button",{className:"bizz-thread-back",type:"button",onClick:()=>u(null),children:[t.jsx(Oi,{size:17})," Inbox"]}),t.jsxs("div",{children:[t.jsx("h2",{children:(q==null?void 0:q.title)||"Select a conversation"}),t.jsx("p",{className:"muted",children:q?"Private Bizz2Bizz conversation":"Choose a conversation from your inbox to view the thread."})]}),q&&t.jsxs("span",{className:"bizz-thread-protected",children:[t.jsx(tt,{size:14})," Protected"]})]}),t.jsx("div",{className:"message-thread bizz-message-thread",children:q&&o.length?o.map(A=>t.jsxs("article",{className:"message-bubble bizz-message-bubble",children:[t.jsx("p",{children:A.body}),t.jsxs("small",{children:[new Date(A.created_at).toLocaleString()," · delivered"]})]},A.id)):q?t.jsxs("div",{className:"empty-state bizz-thread-empty",children:[t.jsx(Va,{size:30}),t.jsx("h3",{children:"Start the conversation"}),t.jsx("p",{children:"No messages yet. Send the first message below."})]}):t.jsxs("div",{className:"empty-state bizz-thread-empty",children:[t.jsx(Va,{size:34}),t.jsx("h3",{children:"No conversation selected"}),t.jsx("p",{children:"Pick a conversation from the inbox. On mobile, the thread opens as its own focused view."})]})}),t.jsxs("div",{className:"bizz-compose",children:[t.jsx("textarea",{rows:4,value:h,onChange:A=>f(A.target.value),placeholder:q?"Write a messageâ¦":"Select a conversation first",disabled:!q}),t.jsxs("div",{className:"message-compose-footer",children:[t.jsx("span",{className:"muted",children:"Messages are visible only to authorized participants."}),t.jsxs("button",{className:"primary-inline",onClick:()=>void ce(),disabled:!q||!h.trim(),children:[t.jsx(Un,{size:16})," Send message"]})]})]})]})]}),w&&t.jsx("div",{className:"modal-backdrop",children:t.jsxs("form",{className:"panel modal-card",onSubmit:ee,children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"New team thread"}),t.jsx("p",{className:"muted",children:"Create an internal workspace conversation. Business-to-business conversations start from a verified Directory or BarterPlace connection."})]}),t.jsx("button",{type:"button",className:"icon-button",onClick:()=>S(!1),children:t.jsx(gt,{size:18})})]}),t.jsxs("label",{children:["Title",t.jsx("input",{required:!0,value:b,onChange:A=>j(A.target.value),placeholder:"Team planning"})]}),t.jsxs("label",{children:["Type",t.jsxs("select",{value:k,onChange:A=>N(A.target.value),children:[t.jsx("option",{value:"workspace",children:"Worksp
585ace"}),t.jsx("option",{value:"department",children:"Department"}),t.jsx("option",{value:"context",children:"Suite context"})]})]}),t.jsxs("fieldset",{children:[t.jsx("legend",{children:"Participants"}),n.map(A=>t.jsxs("label",{className:"checkbox-row",children:[t.jsx("input",{type:"checkbox",checked:C.includes(A.id),onChange:V=>P(I=>V.target.checked?[...I,A.id]:I.filter(D=>D!==A.id))}),A.preferred_name||A.full_name||`Portal user ${A.id}`," · ",A.role||"member"]},A.id))]}),t.jsx("button",{className:"primary-inline",type:"submit",children:"Create team thread"})]})})]})}const yu={ask_ness:"Ask Ness",pay_it_forward:"Pay It Forward",portal:"Portal",reports:"Reports",smart_inventory:"Smart Inventory",support:"Support"},aC=[["general","General"],["portal_access","Portal access"],["smart_inventory","Smart Inventory"],["ask_ness","Ask Ness"],["reports","Reports"],["pay_it_forward","Pay It Forward"],["billing","Billing"]];function nC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState([]),[i,c]=y.useState(""),[o,l]=y.useState(""),[d,u]=y.useState("all"),[h,f]=y.useState(!0),[m,x]=y.useState(null),[p,g]=y.useState(""),[w,S]=y.useState(""),[b,j]=y.useState("general"),[k,N]=y.useState("normal"),[C,P]=y.useState(null),[T,L]=y.useState(!1);async function M(){if(!e){x("Portal environment variables are not configured."),f(!1);return}f(!0);const[te,fe]=await Promise.all([e.from("faq_articles").select("id, title, slug, category, body").eq("active",!0).eq("visibility","authenticated").order("category").order("title"),e.from("portal_support_ticket_summary").select("id, subject, status, priority, category, created_at, updated_at, comment_count, last_comment_at").order("updated_at",{ascending:!1})]),q=te.error??fe.error;x((q==null?void 0:q.message)??null),a(te.data??[]),s(fe.data??[]),f(!1)}y.useEffect(()=>{M()},[]);const E=y.useMemo(()=>[...new Set(r.map(te=>te.category))].sort(),[r]),W=y.useMemo(()=>{const te=i.trim().toLowerCase();return r.filter(fe=>{const q=d==="all"||fe.category===d,J=`${fe.title} ${fe.body} ${fe.category}`.toLowerCase();return q&&(!te||J.includes(te))})},[r,i,d]),ee=y.useMemo(()=>{const te=o.toLowerCase().split(/\W+/).filter(fe=>fe.length>2);return te.length===0?[]:r.map(fe=>{const q=`${fe.title} ${fe.body} ${fe.category}`.toLowerCase(),J=te.reduce((le,A)=>le+(q.includes(A)?1:0),0);return{faq:fe,score:J}}).filter(({score:fe})=>fe>0).sort((fe,q)=>q.score-fe.score).slice(0,3).map(({faq:fe})=>fe)},[r,o]);function ce(){var fe;const te=o.trim();te&&(g(te.length>90?`${te.slice(0,87)}â¦`:te),S(`Ask Ness could not fully resolve this question: 586 587${te}`),j("ask_ness"),N("normal"),(fe=document.getElementById("support-ticket-form"))==null||fe.scrollIntoView({behavior:"smooth"}))}async function ue(te){if(te.preventDefault(),P(null),!e){P("Portal environment variables are not configured.");return}L(!0);const[fe,q]=await Promise.all([e.rpc("current_portal_client_id"),e.rpc("current_portal_location_id")]),J=fe.error??q.error;if(J||!fe.data){L(!1),P((J==null?void 0:J.message)??"Your portal client could not be resolved.");return}const{error:le}=await e.from("support_tickets").insert({client_id:fe.data,location_id:q.data??null,subject:p.trim(),description:w.trim(),priority:k,category:b,source:"portal",metadata:{created_from:"portal_support_center"}});if(L(!1),le){P(le.message);return}g(""),S(""),j("general"),N("normal"),P("Support ticket created. Ness will route it for follow-up."),await M()}return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SUPPORT CENTER"}),t.jsx("h1",{children:"How can we help?"})]}),t.jsx("span",{className:"status-pill",children:"FAQ + ticket support live"})]}),t.jsxs("section",{className:"panel support-hero",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Start with the knowledge base."}),t.jsx("p",{className:"muted",children:"Search approved portal guidance, ask Ness, or open a tenant-secured support ticket."})]}),t.jsx("input",{className:"support-search",value:i,onChange:te=>c(te.target.value),placeholder:"Search password, inventory, reportsâ¦"})]}),m&&t.jsx("div",{className:"error-box",children:m}),t.jsxs("section",{className:"support-layout",children:[t.jsxs("aside",{className:"panel support-categories",children:[t.jsx("button",{className:d==="all"?"category-chip active":"category-chip",onClick:()=>u("all"),children:"All topics"}),E.map(te=>t.jsx("button",{className:d===te?"category-chip active":"category-chip",onClick:()=>u(te),children:t.jsx("strong",{children:yu[te]??te.replace(/_/g," ")})},te))]}),t.jsxs("section",{className:"panel faq-list",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Frequently asked questions"}),t.jsx("p",{className:"muted",children:"Approved articles from Supabase."})]}),t.jsxs("span",{className:"status-pill",children:[W.length," results"]})]}),h?t.jsx("p",{children:"Loading FAQsâ¦"}):W.length===0?t.jsx("p",{className:"muted",children:"No FAQs matched that search."}):W.map(te=>t.jsxs("details",{className:"faq-card",children:[t.jsx("summary",{children:t.jsx("strong",{children:te.title})}),t.jsx("p",{children:te.body}),t.jsx("div",{className:"tag-row",children:t.jsx("span",{children:yu[te.category]??te.category.replace(/_/g," ")})})]},te.id))]})]}),t.jsxs("section",{className:"panel ticket-panel",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"ASK NESS"}),t.jsx("h2",{children:"Ask a support question"}),t.jsx("p",{className:"muted",children:"Ness checks the approved FAQ library first. This browser-side MVP does not change business data."})]}),t.jsxs("div",{className:"ticket-form",children:[t.jsx("label",{children:"Question"}),t.jsx("textarea",{value:o,onChange:te=>l(te.target.value),placeholder:"What do you need help with?",rows:3}),o.trim()&&ee.length===0&&t.jsx("div",{className:"error-box",children:"Ness did not find a strong FAQ match. You can route this question into a support ticket."}),ee.map(te=>t.jsxs("article",{className:"faq-card",children:[t.jsx("h3",{children:te.title}),t.jsx("p",{children:te.body})]},`ness-${te.id}`)),t.jsx("button",{type:"button",className:"secondary-button",onClick:ce,disabled:!o.trim(),children:"Send unresolved question to support"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Your support tickets"}),t.jsx("p",{className:"muted",children:"Tenant-scoped summary from Supabase RLS."})]}),t.jsxs("span",{className:"status-pill",children:[n.length," tickets"]})]}),h?t.jsx("p",{children:"Loading ticketsâ¦"}):n.length===0?t.jsx("p",{className:"muted",children:"No support tickets yet."}):t.jsx("div",{className:"table-wrap",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Subject"}),t.jsx("th",{children:"Category"}),t.jsx("th",{children:"Priority"}),t.jsx("th",{children:"Status"}),t.jsx("th",{children:"Comments"}),t.jsx("th",{children:"Updated"})]})}),t.jsx("tbody",{children:n.map(te=>t.jsxs("tr",{children:[t.jsx("td",{children:te.subject}),t.jsx("td",{children:te.category.replace(/_/g," ")}),t.jsx("td",{children:te.priority}),t.jsx("td",{children:te.status.replace(/_/g," ")}),t.jsx("td",{children:te.comment_count??0}),t.jsx("td",{children:new Date(te.updated_at).toLocaleDateString()})]},te.id))})]})})]}),t.jsxs("section",{className:"panel ticket-panel",id:"support-ticket-form",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Need human help?"}),t.jsx("p",{className:"muted",children:"Create a support ticket tied to your authenticated portal client and permitted location."})]}),t.jsxs("form",{onSubmit:ue,className:"ticket-form",children:[t.jsx("label",{children:"Subject"}),t.jsx("input",{value:p,onChange:te=>g(te.target.value),placeholder:"What do you need help with?",required:!0}),t.jsx("label",{children:"Description"}),t.jsx("textarea",{value:w,onChange:te=>S(te.target.value),placeholder:"Tell us what happened, what you expected, and when it occurred.",rows:5,required:!0}),t.jsx("label",{children:"Category"}),t.jsx("select",{value:b,onChange:te=>j(te.target.value),children:aC.map(([te,fe])=>t.jsx("option",{value:te,children:fe},te))}),t.jsx("label",{children:"Priority"}),t.jsxs("select",{value:k,onChange:te=>N(te.target.value),children:[t.jsx("option",{value:"normal",children:"Normal"}),t.jsx("option",{value:"high",children:"High"}),t.jsx("option",{value:"urgent",children:"Urgent"})]}),C&&t.jsx("div",{className:C.includes("created")?"success-box":"error-box",children:C}),t.jsx("button",{className:"primary-button",disabled:T,children:T?"Creating ticketâ¦":"Create support ticket"})]})]})]})}const sC="https://api.smartbizhelper.ai";function iC({session:e,onRefreshInventory:r}){const[a,n]=y.useState("idle"),[s,i]=y.useState(""),[c,o]=y.useState(()=>window.localStorage.getItem("sbh-last-inventory-sync"));async function l(){n("syncing"),i("");try{const u=await fetch(sC,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({action:"sync_inventory",requested_at:new Date().toISOString()})}),h=await u.json().catch(()=>({}));if(!u.ok||(h==null?void 0:h.ok)===!1)throw new Error((h==null?void 0:h.message)||(h==null?void 0:h.error)||"The inventory sync could not be completed.");await r();const f=new Date().toISOString();window.localStorage.setItem("sbh-last-inventory-sync",f),o(f),i((h==null?void 0:h.summary)||"Your latest inventory counts are now available in the workspace."),n("success")}catch(u){i(u instanceof Error?u.message:"The inventory sync could not be completed."),n("error")}}
587const d=c?new Date(c).toLocaleString():"No manual sync has been run yet";return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading sync-page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Up-to-the-minute inventory"}),t.jsx("h1",{children:"Sync Inventory"}),t.jsx("p",{className:"muted",children:"Send pending Workspace counts to Clover, then refresh inventory."})]}),t.jsxs("div",{className:"sync-last-run",children:[t.jsx(Ta,{size:18}),t.jsx("span",{children:"Last manual sync"}),t.jsx("strong",{children:d})]})]}),t.jsxs("section",{className:"panel sync-inventory-card",children:[t.jsx("div",{className:"sync-icon",children:t.jsx(St,{size:34})}),t.jsxs("div",{children:[t.jsx("h2",{children:"Need the latest count right now?"}),t.jsx("p",{children:"This sends pending Workspace changes to Clover first, confirms them, then refreshes the Workspace from Clover."}),t.jsxs("div",{className:"sync-security-note",children:[t.jsx(tt,{size:18}),t.jsx("span",{children:"Your request is securely limited to your business workspace."})]})]}),t.jsx("button",{className:"primary-inline sync-button",onClick:()=>n("confirm"),children:"Sync Now"})]}),a==="confirm"&&t.jsx("div",{className:"sync-modal-backdrop",children:t.jsxs("section",{className:"sync-modal",role:"dialog","aria-modal":"true","aria-labelledby":"sync-confirm-title",children:[t.jsx("button",{className:"sync-modal-close",onClick:()=>n("idle"),"aria-label":"Close",children:t.jsx(gt,{})}),t.jsx("div",{className:"sync-icon",children:t.jsx(St,{size:30})}),t.jsx("h2",{id:"sync-confirm-title",children:"Send Workspace changes to Clover and refresh?"}),t.jsx("p",{children:"This usually takes less than a minute. You can stay on this screen while your workspace updates."}),t.jsxs("div",{className:"sync-modal-actions",children:[t.jsx("button",{className:"secondary-button",onClick:()=>n("idle"),children:"Cancel"}),t.jsx("button",{className:"primary-inline",onClick:()=>void l(),children:"Sync Now"})]})]})}),a==="syncing"&&t.jsx("div",{className:"sync-modal-backdrop",children:t.jsxs("section",{className:"sync-modal",role:"status",children:[t.jsx(St,{className:"sync-spinner",size:42}),t.jsx("h2",{children:"Syncing inventoryâ¦"}),t.jsxs("div",{className:"sync-steps",children:[t.jsx("span",{children:"Connecting to your checkout system"}),t.jsx("span",{children:"Writing Workspace changes to Clover"}),t.jsx("span",{children:"Confirming Clover quantities"}),t.jsx("span",{children:"Refreshing your workspace"})]})]})}),a==="success"&&t.jsx("div",{className:"sync-modal-backdrop",children:t.jsxs("section",{className:"sync-modal",role:"status",children:[t.jsx(Kr,{className:"sync-success-icon",size:46}),t.jsx("h2",{children:"Inventory Updated"}),t.jsx("p",{children:s}),t.jsx("button",{className:"primary-inline",onClick:()=>n("idle"),children:"Done"})]})}),a==="not-connected"&&t.jsx("div",{className:"sync-modal-backdrop",children:t.jsxs("section",{className:"sync-modal",role:"dialog","aria-modal":"true",children:[t.jsx("button",{className:"sync-modal-close",onClick:()=>n("idle"),"aria-label":"Close",children:t.jsx(gt,{})}),t.jsx(tt,{size:42}),t.jsx("h2",{children:"Secure connection is being prepared"}),t.jsx("p",{children:"The Sync Inventory screen is ready. SmartBizHelper is finishing the protected connection to your inventory workflow before this button is activated."}),t.jsx("button",{className:"primary-inline",onClick:()=>n("idle"),children:"Got It"})]})}),a==="error"&&t.jsx("div",{className:"sync-modal-backdrop",children:t.jsxs("section",{className:"sync-modal",role:"alertdialog","aria-modal":"true",children:[t.jsx("button",{className:"sync-modal-close",onClick:()=>n("idle"),"aria-label":"Close",children:t.jsx(gt,{})}),t.jsx("h2",{children:"Inventory sync needs attention"}),t.jsx("p",{children:s}),t.jsxs("div",{className:"sync-modal-actions",children:[t.jsx("button",{className:"secondary-button",onClick:()=>n("idle"),children:"Close"}),t.jsx("button",{className:"primary-inline",onClick:()=>void l(),children:"Try Again"})]})]})})]})}function cC(e){return e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}
587function oC(e){try{const r=new URL(e.trim());if(r.hostname==="youtu.be")return r.pathname.slice(1).split("/")[0]||null;if(r.hostname.endsWith("youtube.com"))return r.searchParams.get("v")??r.pathname.split("/").pop()??null}catch{return null}return null}function lC({supabase:e,branding:r}){const[a,n]=y.useState([]),[s,i]=y.useState([]),[c,o]=y.useState([]),[l,d]=y.useState([]),[u,h]=y.useState(null),[f,m]=y.useState(""),[x,p]=y.useState(""),[g,w]=y.useState("General"),[S,b]=y.useState(""),[j,k]=y.useState(null),[N,C]=y.useState("user"),[P,T]=y.useState(""),[L,M]=y.useState(""),[E,W]=y.useState(""),[ee,ce]=y.useState(""),[ue,te]=y.useState(!0),[fe,q]=y.useState(!1),[J,le]=y.useState(!0),[A,V]=y.useState(null),[I,D]=y.useState(null),K=!!(r!=null&&r.can_edit);async function z(){if(!e)return;le(!0);const[Z,xe,be,De]=await Promise.all([e.from("workspace_sop_documents").select("id,title,category,status,current_version_number,archived_at").order("updated_at",{ascending:!1}),e.from("workspace_training_courses").select("id,title,description,video_url,status,is_required,archived_at").order("updated_at",{ascending:!1}),e.rpc("portal_list_my_sop_assignments"),e.rpc("portal_list_my_training")]);le(!1);
587const Te=[Z.error,xe.error,be.error,De.error].filter(Boolean);Te.length&&!Z.data&&!xe.data&&V(Te.map(ze=>ze==null?void 0:ze.message).join("; ")),n(Z.data??[]),i(xe.data??[]),o(be.data??[]),d(De.data??[])}y.useEffect(()=>{z()},[e]);function Y(){h(null),m(""),p(""),w("General"),b(""),k(null),C("user"),T(""),M(""),W(""),ce(""),te(!0),V(null)}function re(Z){var be;const xe=((be=Z.target.files)==null?void 0:be[0])??null;k(xe),xe&&!f&&m(xe.name.replace(/\.[^.]+$/,""))}async function oe(Z){if(Z.preventDefault(),!(!e||!r||!u||!K)){q(!0),V(null),D(null);try{if(!f.trim())throw new Error("Enter a title.");if(u==="training"){if(!oC(S))throw new Error("Enter a valid YouTube link.");const{error:xe}=await e.rpc("portal_create_training_course",{p_title:f.trim(),p_description:x.trim()||null,p_video_url:S.trim(),p_location_id:E?Number(E):null,p_required:ue,p_duration_seconds:null});if(xe)throw xe;D("Training course created. Watch tracking is not claimed; completion is manual.")}else{if(!j)throw new Error("Choose an SOP document.");if(j.size>20*1024*1024)throw new Error("SOP files must be 20 MB or smaller.");const xe=`${r.client_id}/${Date.now()}-${cC(j.name)}`,be=await e.storage.from("workspace-training").upload(xe,j,{contentType:j.type||void 0,upsert:!1});if(be.error)throw be.error;const De=await e.rpc("portal_create_sop_draft",{p_title:f.trim(),p_description:x.trim()||null,p_category:g.trim()||"General",p_location_id:E?Number(E):null,p_effective_date:null,p_file_url:xe,p_content:null}),Te=Array.isArray(De.data)?De.data[0]:De.data;if(De.error||!(Te!=null&&Te.sop_id)||!(Te!=null&&Te.version_id))throw await e.storage.from("workspace-training").remove([xe]),De.error??new Error("SOP draft creation failed.");const ze=await e.rpc("portal_publish_sop_version",{p_sop_id:Te.sop_id,p_version_id:Te.version_id});if(ze.error)throw await e.storage.from("workspace-training").remove([xe]),ze.error;D("SOP version 1 published.")}Y(),await z()}catch(xe){V(xe instanceof Error?xe.message:"The operation failed.")}finally{q(!1)}}}async function Ce(Z){var De;if(!e||!K||!Z.current_version_number)return;const xe=await e.from("workspace_sop_versions").select("id").eq("sop_id",Z.id).eq("version_number",Z.current_version_number).single();if(xe.error||!xe.data)return V(((De=xe.error)==null?void 0:De.message)??"Published version not found.");const be=await e.rpc("portal_assign_sop_scope",{p_sop_id:Z.id,p_sop_version_id:xe.data.id,p_scope_type:N,p_user_id:N==="user"&&P||null,p_role_name:N==="role"&&L||null,p_location_id:E?Number(E):null,p_required:ue,p_due_date:ee||null});if(be.error)return V(be.error.message);D("SOP assignment created."),await z()}async function F(Z){if(!e||!K)return;const xe=await e.rpc("portal_assign_training_scope",{p_course_id:Z.id,p_scope_type:N,p_user_id:N==="user"&&P||null,p_role_name:N==="role"&&L||null,p_location_id:E?Number(E):null,p_due_date:ee||null});if(xe.error)return V(xe.error.message);D("Training assignment created."),await z()}async function se(Z){if(!e)return;const xe=await e.rpc("portal_acknowledge_sop",{p_assignment_id:Z});if(xe.error)return V(xe.error.message);D("Acknowledged assigned SOP version."),await z()}async function he(Z){if(!e)return;const xe=await e.rpc("portal_complete_training",{p_assignment_id:Z,p_notes:"Manual completion"});if(xe.error)return V(xe.error.message);D("Training marked complete manually."),await z()}async function je(Z){if(!e||!K)return;const xe=await e.rpc("portal_archive_sop",{p_sop_id:Z});if(xe.error)return V(xe.error.message);D("SOP archived; versions and acknowledgments remain preserved."),await z()}async function ve(Z){if(!e||!K)return;const xe=await e.rpc("portal_archive_training",{p_course_id:Z});if(xe.error)return V(xe.error.message);D("Training archived; completion history remains preserved."),await z()}async function ne(Z){if(!e||!Z)return V("This SOP has no stored file.");const xe=await e.storage.from("workspace-training").createSignedUrl(Z,600);if(xe.error)return V(xe.error.message);window.open(xe.data.signedUrl,"_blank","noopener,noreferrer")}return y.useMemo(()=>new Set(c.map(Z=>Z.sop_id)),[c]),t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading training-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"People and knowledge"}),t.jsx("h1",{children:"Training & SOPs"}),t.jsx("p",{className:"muted",children:"Versioned procedures, assigned learning, and retained history."})]}),K&&t.jsxs("div",{className:"training-add-actions",children:[t.jsxs("button",{className:"secondary-button",onClick:()=>h("training"),children:[t.jsx(Wa,{size:17})," Add training"]}),t.jsxs("button",{className:"primary-button",onClick:()=>h("sop"),children:[t.jsx(Uu,{size:17})," Create SOP"]})]})]}),A&&t.jsx("div",{className:"error-box",children:A}),I&&t.jsx("div",{className:"success-box",children:I}),t.jsxs("section",{className:"training-metrics",children:[t.jsxs("div",{className:"training-metric",children:[t.jsx(Pr,{size:22}),t.jsxs("span",{children:[t.jsx("strong",{children:a.length+s.length}),"Resources"]})]}),t.jsxs("div",{className:"training-metric",children:[t.jsx(Nn,{size:22}),t.jsxs("span",{children:[t.jsx("strong",{children:c.filter(Z=>!Z.acknowledged_at).length}),"SOPs awaiting acknowledgment"]})]}),t.jsxs("div",{className:"training-metric",children:[t.jsx(Kr,{size:22}),t.jsxs("span",{children:[t.jsx("strong",{children:l.filter(Z=>Z.completed_at).length}),"Training complete"]})]})]}),t.jsxs("section",{className:"panel training-library",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Assigned to me"}),t.jsx("p",{className:"muted",children:"Assignments are resolved server-side by member, role, location, or tenant."})]})}),J?t.jsx("p",{className:"muted",children:"Loading assignmentsâ¦"}):t.jsxs("div",{className:"training-grid",children:[c.map(Z=>t.jsxs("article",{className:"training-card",children:[t.jsxs("div",{className:"sop-cover",children:[t.jsx(Nn,{size:40}),t.jsxs("span",{children:["Version ",Z.version_number]})]}),t.jsxs("div",{className:"training-card-body",children:[t.jsxs("span",{className:"training-category",children:[Z.required?"Required":"Optional",Z.overdue?" · Overdue":""]}),t.jsx("h3",{children:Z.title}),t.jsxs("p",{children:["Assigned version ",Z.version_number,Z.acknowledged_at?` · Acknowledged ${new Date(Z.acknowledged_at).toLocaleStr
587ing()}`:""]}),t.jsxs("div",{className:"training-card-actions",children:[t.jsx("button",{onClick:()=>void ne(Z.file_url),children:"View SOP"}),!Z.acknowledged_at&&t.jsx("button",{onClick:()=>void se(Z.assignment_id),children:"Acknowledge version"})]})]})]},`sop-${Z.assignment_id}`)),l.map(Z=>t.jsxs("article",{className:"training-card",children:[t.jsxs("div",{className:"sop-cover",children:[t.jsx(Pr,{size:40}),t.jsx("span",{children:"Manual completion"})]}),t.jsxs("div",{className:"training-card-body",children:[t.jsxs("span",{className:"training-category",children:[Z.required?"Required":"Optional",Z.overdue?" · Overdue":""]}),t.jsx("h3",{children:Z.title}),t.jsx("p",{children:Z.completed_at?`Completed ${new Date(Z.completed_at).toLocaleString()}`:"Not completed"}),t.jsxs("div",{className:"training-card-actions",children:[Z.video_url&&t.jsx("a",{href:Z.video_url,target:"_blank",rel:"noreferrer",children:"Open training link"}),!Z.completed_at&&t.jsx("button",{onClick:()=>void he(Z.assignment_id),children:"Mark complete"})]})]})]},`training-${Z.assignment_id}`)),!c.length&&!l.length&&t.jsx("p",{className:"muted",children:"No active assignments."})]})]}),K&&t.jsxs("section",{className:"panel training-library",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Manager library and history"}),t.jsx("p",{className:"muted",children:"Published, archived, and versioned records remain in Supabase history."})]})}),t.jsxs("div",{className:"training-grid",children:[a.map(Z=>t.jsxs("article",{className:"training-card",children:[t.jsxs("div",{className:"sop-cover",children:[t.jsx(Nn,{size:40}),t.jsx("span",{children:Z.status})]}),t.jsxs("div",{className:"training-card-body",children:[t.jsx("h3",{children:Z.title}),t.jsxs("p",{children:[Z.category??"General"," · current version ",Z.current_version_number??"draft"]}),t.jsxs("div",{className:"training-card-actions",children:[t.jsxs("button",{onClick:()=>void Ce(Z),disabled:Z.status==="archived",children:[t.jsx(qr,{size:14})," Assign"]}),Z.status!=="archived"&&t.jsxs("button",{onClick:()=>void je(Z.id),children:[t.jsx(gi,{size:14})," Archive"]})]})]})]},`manager-sop-${Z.id}`)),s.map(Z=>t.jsxs("article",{className:"training-card",children:[t.jsxs("div",{className:"sop-cover",children:[t.jsx(Pr,{size:40}),t.jsx("span",{children:Z.status})]}),t.jsxs("div",{className:"training-card-body",children:[t.jsx("h3",{children:Z.title}),t.jsx("p",{children:Z.description??"Manual completion; no watch percentage claimed."}),t.jsxs("div",{className:"training-card-actions",children:[t.jsxs("button",{onClick:()=>void F(Z),disabled:Z.status==="archived",children:[t.jsx(qr,{size:14})," Assign"]}),Z.status!=="archived"&&t.jsxs("button",{onClick:()=>void ve(Z.id),children:[t.jsx(gi,{size:14})," Archive"]})]})]})]},`manager-training-${Z.id}`))]})]}),u&&t.jsx("div",{className:"adjustment-backdrop",role:"presentation",children:t.jsxs("section",{className:"adjustment-modal training-modal",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"adjustment-header",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Canonical Supabase contract"}),t.jsx("h2",{children:u==="sop"?"Create and publish SOP":"Create training course"})]})}),t.jsxs("form",{className:"adjustment-form training-form",onSubmit:oe,children:[t.jsxs("label",{className:"wide-field",children:["Title",t.jsx("input",{value:f,onChange:Z=>m(Z.target.value),required:!0})]}),u==="sop"&&t.jsxs(t.Fragment,{children:[t.jsxs("label",{children:["Category",t.jsx("input",{value:g,onChange:Z=>w(Z.target.value)})]}),t.jsxs("label",{className:"wide-field",children:["SOP file",t.jsx("input",{type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt",onChange:re,required:!0})]})]}),u==="training"&&t.jsxs("label",{className:"wide-field",children:["Training link",t.jsx("input",{type:"url",value:S,onChange:Z=>b(Z.target.value),required:!0})]}),t.jsxs("label",{className:"wide-field",children:["Description",t.jsx("textarea",{value:x,onChange:Z=>p(Z.target.value),rows:3})]}),u==="training"&&t.jsxs("label",{children:["Required ",t.jsx("input",{type:"checkbox",checked:ue,onChange:Z=>te(Z.target.checked)})]}),t.jsxs("div",{className:"adjustment-actions wide-field",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:Y,children:"Cancel"}),t.jsx("button",{className:"primary-button",disabled:fe,children:fe?"Savingâ¦":"Save"})]})]})]})}),t.jsxs("section",{className:"panel training-library",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Assignment controls"}),t.jsx("p",{className:"muted",children:"Managers can select a target scope before using Assign on a library item."})]})}),t.jsxs("div",{className:"adjustment-form training-form",children:[t.jsxs("label",{children:["Scope",t.jsxs("select",{value:N,onChange:Z=>C(Z.target.value),children:[t.jsx("option",{value:"user",children:"Individual member"}),t.jsx("option",{value:"role",children:"Role"}),t.jsx("option",{value:"location",children:"Location"}),t.jsx("option",{value:"tenant",children:"Whole tenant"})]})]}),N==="user"&&t.jsxs("label",{children:["Member auth ID",t.jsx("input",{value:P,onChange:Z=>T(Z.target.value),placeholder:"UUID"})]}),N==="role"&&t.jsxs("label",{children:["Role",t.jsx("input",{value:L,onChange:Z=>M(Z.target.value),placeholder:"staff"})]}),N==="location"&&t.jsxs("label",{children:["Location ID",t.jsx("input",{value:E,onChange:Z=>W(Z.target.value),inputMode:"numeric"})]}),t.jsxs("label",{children:["Due date",t.jsx("input",{type:"date",value:ee,onChange:Z=>ce(Z.target.value)})]}),t.jsxs("label",{children:["Required ",t.jsx("input",{type:"checkbox",checked:ue,onChange:Z=>te(Z.target.checked)})]})]})]})]})}function dC({supabase:e,branding:r}){const[a,n]=y.useState([]),[s,i]=y.useState(null),[c,o]=y.useState(null),[l,d]=y.useState([]),[u,h]=y.useState(!1),[f,m]=y.useState(""),[x,p]=y.useState(""),[g,w]=y.useState(""),[S,b]=y.useState(""),[j,k]=y.useState(""),[N,C]=y.useState(""),[P,T]=y.useState(Intl.DateTimeFormat().resolvedOptions().timeZone),[L,M]=y.useState("tenant"),[E,W]=y.useState(""),[ee,ce]=y.useState(""),[ue,te]=y.useState(""),[fe,q]=y.useState(!1),[J,le]=y.useState(null),[A,V]=y.useState(null),I=!!(r!=null&&r.can_edit);async function D(){if(!e)return;const se=await e.rpc("portal_list_my_meetings");se.error?le(se.error.message):n(se.data??[])}y.useEffect(()=>{D()},[e]);function K(){h(!1),i(null),m(""),p(""),w(""),b(""),k(""),C(""),le(null)}function z(se){i(se.meeting_id),h(!0),m(se.title),p(se.description??""),w(se.join_url??""),b(se.host_url??""),k(se.scheduled_start?new Date(se.scheduled_start).toISOString().slice(0,16):""),C(se.scheduled_end?new Date(se.scheduled_end).toISOString().slice(0,16):""),T(se.timezone)}async function Y(se){if(se.preventDefault(),!e||s===null)return;q(!0),le(null);const he=await e.rpc("portal_update_meeting",{p_meeting_id:s,p_title:f.trim(),p_description:x.trim()||null,p_agenda:null,p_join_url:g.trim()||null,p_host_url:S.trim()||null});if(he.error)return q(!1),le(he.error.message);if(j&&N){const je=await e.rpc("portal_schedule_meeting",{p_meeting_id:s,p_start:new Date(j).toISOString(),p_end:new Date(N).toISOString(),p_timezone:P});if(je.error)return q(!1),le(je.error.message)}q(!1),V("Meeting updated."),K(),await D()}async function re(se){if(!e)return;const he=await e.rpc("portal_list_meeting_responses",{p_meeting_id:se});if(he.error)return le(he.error.message);o(se),d(he.data??[])}async function oe(se){if(se.preventDefault(),!e||!f.trim())return;q(!0),le(null),V(null);const he=await e.rpc("portal_create_meeting_draft",{p_title:f.trim(),p_description:x.trim()||null,p_agenda:null,p_location_id:ue?Number(ue):null,p_provider:"manual",p_join_url:g.trim()||null,p_host_url:S.trim()||null,p_timezone:P,p_scheduled_start:j?new Date(j).toISOString():null,p_scheduled_end:N?new Date(N).toISOString():null});if(he.error)return q(!1),le(he.error.message);const je=Number(he.data);if(j&&N){const ve=await e.rpc("portal_schedule_meeting",{p_meeting_id:je,p_start:new Date(j).toISOString(),p_end:new Date(N).toISOString(),p_timezone:P});if(ve.error)return q(!1),le(ve.error.message)}if(L){const ve=await e.rpc("portal_invite_meeting",{p_meeting_id:je,p_scope_type:L,p_user_id:L==="user"&&E||null,p_role_name:L==="role"&&ee||null,p_location_id:L==="location"&&ue?Number(ue):null});if(ve.error)return q(!1),le(ve.error.message)}q(!1),V("Meeting saved. Zoom creation remains pending provider integration; this record uses a manual URL."),K(),await D()}async function Ce(se,he){if(!e)return;const je=await e.rpc("portal_respond_meeting",{p_meeting_id:se,p_response:he});je.error?le(je.error.message):(V("Response saved."),await D())}async function F(se,he){if(!e)return;const je=await e.rpc(he==="cancel"?"portal_cancel_meeting":"portal_archive_meeting",{p_meeting_id:se});je.error?le(je.error.message):(V(he==="cancel"?"Meeting cancelled; history retained.":"Meeting archived; history retained."),await D())}return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Team coordination"}),t.jsx("h1",{children:"Meetings"}),t.jsx("p",{className:"muted",children:"Provider-neutral meeting records with manual Zoom-ready links until credentials are connected."})]}),I&&t.jsxs("button",{className:"primary-inline",onClick:()=>h(!0),children:[t.jsx(qr,{size:17})," Create meeting"]})]}),J&&t.jsx("div",{className:"error-box",children:J}),A&&t.jsx("div",{className:"success-box",children:A}),u&&t.jsx("div",{className:"adjustment-backdrop",children:t.jsxs("section",{className:"adjustment-modal training-modal",role:"dialog","aria-modal":"true",children:[t.jsxs("div",{className:"adjustment-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Manual provider mode"}),t.jsx("h2",{children:s===null?"Create meeting":"Edit meeting"})]}),t.jsx("button",{className:"icon-button",onClick:K,children:t.jsx(ul,{size:20})})]}),t.jsxs("form",{className:"adjustment-form training-form",onSubmit:s===null?oe:Y,children:[t.jsxs("label",{className:"wide-field",children:["Title",t.jsx("input",{value:f,onChange:se=>m(se.target.value),required:!0})]}),t.jsxs("label",{className:"wide-field",children:["Description",t.jsx("textarea",{value:x,onChange:se=>p(se.target.value),rows:3})]}),t.jsxs("label",{children:["Join URL",t.jsx("input",{type:"url",value:g,onChange:se=>w(se.target.value),placeholder:"Manual Zoom URL (optional)"})]}),t.jsxs("label",{children:["Host URL",t.jsx("input",{type:"url",value:S,onChange:se=>
587b(se.target.value),placeholder:"Organizer-only host URL"})]}),t.jsxs("label",{children:["Start",t.jsx("input",{type:"datetime-local",value:j,onChange:se=>k(se.target.value)})]}),t.jsxs("label",{children:["End",t.jsx("input",{type:"datetime-local",value:N,onChange:se=>C(se.target.value)})]}),t.jsxs("label",{children:["Timezone",t.jsx("input",{value:P,onChange:se=>T(se.target.value)})]}),t.jsxs("label",{children:["Invite scope",t.jsxs("select",{value:L,onChange:se=>M(se.target.value),children:[t.jsx("option",{value:"tenant",children:"Whole tenant"}),t.jsx("option",{value:"user",children:"Individual member"}),t.jsx("option",{value:"role",children:"Role"}),t.jsx("option",{value:"location",children:"Location"})]})]}),s===null&&L==="user"&&t.jsxs("label",{children:["Member auth ID",t.jsx("input",{value:E,onChange:se=>W(se.target.value),placeholder:"UUID"})]}),s===null&&L==="role"&&t.jsxs("label",{children:["Role",t.jsx("input",{value:ee,onChange:se=>ce(se.target.value),placeholder:"staff"})]}),s===null&&L==="location"&&t.jsxs("label",{children:["Location ID",t.jsx("input",{value:ue,onChange:se=>te(se.target.value)})]}),t.jsxs("div",{className:"adjustment-actions wide-field",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:K,children:"Cancel"}),t.jsx("button",{className:"primary-button",disabled:fe,children:fe?"Savingâ¦":s===null?"Save meeting":"Save changes"})]})]})]})}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Meeting schedule"}),t.jsx("p",{className:"muted",children:"Host-only metadata is hidden from invited staff."})]})}),a.length?t.jsx("div",{className:"training-grid",children:a.map(se=>t.jsxs("article",{className:"training-card",children:[t.jsxs("div",{className:"sop-cover",children:[t.jsx(mt,{size:40}),t.jsx("span",{children:se.status})]}),t.jsxs("div",{className:"training-card-body",children:[t.jsx("h3",{children:se.title}),t.jsxs("p",{children:[se.description??"No description"," · ",se.scheduled_start?new Date(se.scheduled_start).toLocaleString([],{timeZone:se.timezone}):"Unscheduled"," · ",se.timezone]}),t.jsxs("p",{className:"training-category",children:[se.provider==="manual"?"Manual URL · Zoom integration pending":se.provider," · Response: ",se.response]}),t.jsxs("div",{className:"training-card-actions",children:[se.join_url&&t.jsxs("a",{href:se.join_url,target:"_blank",rel:"noreferrer",children:["Join meeting ",t.jsx(Tt,{size:14})]}),!se.is_organizer&&se.status!=="cancelled"&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>void Ce(se.meeting_id,"accepted"),children:[t.jsx(Kt,{size:14})," Accept"]}),t.jsx("button",{onClick:()=>void Ce(se.meeting_id,"tentative"),children:"Tentative"}),t.jsx("button",{onClick:()=>void Ce(se.meeting_id,"declined"),children:"Decline"})]}),se.is_organizer&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>z(se),children:"Edit"}),t.jsx("button",{onClick:()=>void re(se.meeting_id),children:"Responses"})]}),se.is_organizer&&se.status!=="cancelled"&&t.jsxs("button",{onClick:()=>void F(se.meeting_id,"cancel"),children:[t.jsx(ul,{size:14})," Cancel"]}),se.is_organizer&&t.jsxs("button",{onClick:()=>void F(se.meeting_id,"archive"),children:[t.jsx(gi,{size:14})," Archive"]}),c===se.meeting_id&&t.jsxs("div",{className:"meeting-response-dashboard",children:[t.jsxs("strong",{children:["Responses (",l.length,")"]}),l.length?t.jsx("ul",{children:l.map(he=>t.jsxs("li",{children:[he.full_name??he.email??he.user_id,": ",he.response]},he.user_id))}):t.jsx("p",{children:"No individual responses yet."})]})]})]})]},se.meeting_id))}):t.jsx("p",{className:"muted",children:"No meetings are visible in your tenant or invitation scope."})]})]})}function uC(e){return new Intl.DateTimeFormat("en-US",{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function hC(e){if(typeof e!="string")return null;try{const r=new URL(e);return r.protocol==="https:"||r.protocol==="http:"?r.href:null}catch{return null}}function fC({supabase:e,canManage:r}){const[a,n]=y.useState([]),[s,i]=y.useState(""),[c,o]=y.useState("month"),[l,d]=y.useState(()=>new Date),[u,h]=y.useState(null),[f,m]=y.useState(!1),[x,p]=y.useState(!1),[g,w]=y.useState(!0),[S,b]=y.useState(null),[j,k]=y.useState(null),[N,C]=y.useState(!1),[P,T]=y.useState(null),[L,M]=y.useState(""),[E,W]=y.useState(!1),[ee,ce]=y.useState({title:"",description:"",starts_at:"",ends_at:"",format:"virtual",visibility:"members",registration_url:""});async function ue(){w(!0),k(null);const[D,K]=await Promise.all([e.from("portal_community_events").select("id,client_id,host_business_name,title,de
587scription,starts_at,ends_at,timezone,format,status,visibility,registration_url,location_text,going_count,interested_count").order("starts_at",{ascending:!0}).limit(100),e.rpc("portal_discover_items",{p_preferences:{worldwide:!0},p_kind:"event",p_limit:100})]);if(D.error)C(/relation .* does not exist|schema cache/i.test(D.error.message)),k(/relation .* does not exist|schema cache/i.test(D.error.message)?null:D.error.message),n([]);else{const z=K.error?[]:(K.data??[]).filter(Y=>Y.start_at).map(Y=>({id:String(Y.id),client_id:0,host_business_name:String(Y.organizer||Y.publisher||Y.source_name||"External organizer"),title:String(Y.title),description:String(Y.summary||""),starts_at:String(Y.start_at),ends_at:Y.end_at?String(Y.end_at):null,timezone:"UTC",format:Y.is_virtual?"virtual":"in_person",status:"published",visibility:"public",registration_url:hC(Y.canonical_url),location_text:Y.is_virtual?"Online":[Y.city,Y.region,Y.country].filter(Boolean).join(", ")||"See authoritative source",going_count:0,interested_count:0,source_kind:"external",source_name:String(Y.source_name||"Authoritative source"),recommendation_reasons:Array.isArray(Y.recommendation_reasons)?Y.recommendation_reasons.map(String):[]}));C(!1),n([...(D.data??[]).map(Y=>({...Y,source_kind:"member"})),...z])}w(!1)}async function te(){const D=await e.rpc("portal_get_my_event_entitlements");!D.error&&D.data&&h(D.data)}async function fe(){const D=await e.rpc("portal_get_featured_event_purchase_state");if(!D.error&&D.data){const K=D.data;T(K),M(z=>{var Y;return z&&K.eligible_events.some(re=>re.id===z)?z:((Y=K.eligible_events[0])==null?void 0:Y.id)??""})}}y.useEffect(()=>{ue(),te(),fe()},[e]);const q=y.useMemo(()=>a.filter(D=>{const z=`${D.title} ${D.description} ${D.host_business_name}`.toLowerCase().includes(s.toLowerCase()),Y=new Date(D.starts_at),re=Y.getFullYear()===l.getFullYear()&&Y.getMonth()===l.getMonth();return z&&(c==="month"?re:c==="upcoming"?Y.getTime()>=Date.now():Y.toDateString()===new Date().toDateString())}),[l,a,s,c]),J=y.useMemo(()=>{const D=new Date(l.getFullYear(),l.getMonth(),1),K=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),z=D.getDay();return Array.from({length:Math.ceil((z+K)/7)*7},(Y,re)=>{const oe=re-z+1;return oe<1||oe>K?null:new Date(l.getFullYear(),l.getMonth(),oe)})},[l]),le=y.useMemo(()=>q.reduce((D,K)=>{const z=new Date(K.starts_at).toDateString();return(D[z]??(D[z]=[])).push(K),D},{}),[q]);async function A(D){D.preventDefault(),p(!0),k(null);const K=await e.rpc("portal_create_community_event",{p_payload:{...ee,starts_at:new Date(ee.starts_at).toISOString(),ends_at:ee.ends_at?new Date(ee.ends_at).toISOString():null,status:"draft",publish_to_lobby:!1,location:null}});if(p(!1),K.error)return k(K.error.message);b("Draft created. Review it before publishing."),m(!1),ce({title:"",description:"",starts_at:"",ends_at:"",format:"virtual",visibility:"members",registration_url:""}),await ue(),await te()}async function V(D){p(!0),k(null);const K=await e.rpc("portal_upsert_community_event_rsvp",{p_event_id:D,p_status:"going"});if(p(!1),K.error)return k(K.error.message);b("Registration saved."),await ue()}async function I(){var Y,re;if(!L||!(P!=null&&P.can_purchase))return;W(!0),k(null),b(null);const D=await e.rpc("portal_create_featured_event_checkout",{p_event_id:L}),K=(Y=D.data)==null?void 0:Y.checkout_url;let z=null;try{const oe=new URL(K??"");z=oe.protocol==="https:"?oe.href:null}catch{z=null}if(D.error||!z){k(((re=D.error)==null?void 0:re.message)||"Secure Stripe checkout is not available for this event yet."),W(!1);return}b("Opening secure Stripe checkout. Featured placement starts only after verified payment and approval."),window.location.assign(z)}return t.jsxs("div",{className:"events-page","data-automation-hook":"events.calendar",children:[t.jsxs("header",{className:"page-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper community"}),t.jsx("h1",{children:"Events Calendar"}),t.jsx("p",{className:"muted",children:"View the actual month calendar, discover events, and manage your event-post allowance."})]}),t.jsxs("div",{className:"events-header-actions",children:[u&&t.jsxs("span",{className:"event-quota-chip",children:[u.used," / ",u.monthly_allowance," included · ",u.wallet_balance," credits"]}),r&&!N?t.jsxs("button",{className:"primary-inline",onClick:()=>m(!0),children:[t.jsx(qr,{size:16})," Create event"]}):t.jsx("span",{className:"date-chip",children:"View-only access"})]})]}),S&&t.jsx("div",{className:"success-box",children:S}),j&&t.jsx("div",{className:"error-box",children:j}),r&&P&&t.jsxs("section",{className:"featured-event-checkout","aria-labelledby":"featured-event-checkout-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Featured visibility"}),t.jsx("h2",{id:"featured-event-checkout-title",children:"Feature an event for 7 days"}),t.jsx("p",{children:"Select an eligible published event. The $19.99 one-time purchase affects featured placement only; your event remains on the calendar after placement expires."})]}),P.can_purchase&&P.eligible_events.length?t.jsxs("div",{className:"featured-event-checkout-action",children:[t.jsxs("label",{children:[t.jsx("span",{children:"Eligible event"}),t.jsx("select",{value:L,onChange:D=>M(D.target.value),children:P.eligible_events.map(D=>t.jsx("option",{value:D.id,children:D.title},D.id))})]}),t.jsx("button",{className:"primary-inline",type:"button",onClick:()=>void I(),disabled:E||!L,children:E?"Opening Stripeâ¦":"Feature for $19.99"})]}):t.jsx("p",{className:"featured-event-checkout-status",children:P.pending_events.length?`${P.pending_events[0].title} has checkout pending verification.`:P.can_purchase?"Publish an eligible future event to feature it."
587:"Only a business owner or admin can purchase featured placement."})]}),N&&t.jsx("div",{className:"success-box",children:"Events Calendar is ready for the community event foundation. No events are available in this workspace yet."}),t.jsxs("section",{className:"events-toolbar",children:[t.jsxs("label",{className:"search-box",children:[t.jsx(Yr,{size:17}),t.jsx("input",{value:s,onChange:D=>i(D.target.value),placeholder:"Search events or businesses"})]}),t.jsxs("div",{className:"event-view-tabs",children:[t.jsx("button",{className:c==="month"?"active":"",onClick:()=>o("month"),children:"Month"}),t.jsx("button",{className:c==="upcoming"?"active":"",onClick:()=>o("upcoming"),children:"Upcoming"}),t.jsx("button",{className:c==="today"?"active":"",onClick:()=>o("today"),children:"Today"})]})]}),c==="month"?t.jsxs("section",{className:"calendar-panel",children:[t.jsxs("div",{className:"calendar-heading",children:[t.jsx("button",{className:"calendar-nav",onClick:()=>d(new Date(l.getFullYear(),l.getMonth()-1,1)),"aria-label":"Previous month",children:t.jsx(po,{size:18})}),t.jsx("h2",{children:l.toLocaleDateString("en-US",{month:"long",year:"numeric"})}),t.jsx("button",{className:"calendar-nav",onClick:()=>d(new Date(l.getFullYear(),l.getMonth()+1,1)),"aria-label":"Next month",children:t.jsx(zt,{size:18})})]}),t.jsx("div",{className:"calendar-weekdays",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(D=>t.jsx("span",{children:D},D))}),t.jsx("div",{className:"calendar-grid",children:J.map((D,K)=>t.jsx("div",{className:`calendar-cell${D?"":" empty"}`,children:D&&t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:D.getDate()}),(le[D.toDateString()]??[]).map(z=>t.jsxs("div",{className:`calendar-event ${z.status}`,title:z.title,children:[z.title,z.source_kind==="external"?" · Discovered":""]},z.id))]})},(D==null?void 0:D.toISOString())??`empty-${K}`))}),!g&&!q.length&&t.jsxs("div",{className:"calendar-empty",children:[t.jsx(mt,{size:24}),t.jsx("span",{children:"No events are scheduled for this month."})]})]}):t.jsx("section",{className:"events-grid",children:g?t.jsxs("div",{className:"events-empty",children:[t.jsx(Ta,{className:"spin",size:34}),t.jsx("h2",{children:"Loading events"}),t.jsx("p",{children:"Checking your authorized calendar view."})]}):q.length?q.map(D=>t.jsxs("article",{className:"event-card",children:[t.jsxs("div",{className:"event-card-date",children:[t.jsx("strong",{children:new Date(D.starts_at).toLocaleDateString("en-US",{month:"short"})}),t.jsx("span",{children:new Date(D.starts_at).getDate()})]}),t.jsxs("div",{className:"event-card-body",children:[t.jsxs("div",{className:"event-card-top",children:[t.jsx("span",{className:"event-category",children:D.source_kind==="external"?`Discovered · ${D.source_name}`:D.host_business_name}),t.jsx("span",{className:`event-status ${D.status}`,children:D.source_kind==="external"?"external":D.status})]}),t.jsx("h2",{children:D.title}),t.jsx("p",{children:D.description||"No description provided."}),t.jsxs("div",{className:"event-meta",children:[t.jsxs("span",{children:[t.jsx(Ta,{size:14})," ",uC(D.starts_at)]}),t.jsxs("span",{children:[t.jsx(Mn,{size:14})," ",D.location_text||(D.format==="virtual"?"Online":"Location to be announced")]})]}),t.jsxs("div",{className:"event-actions",children:[D.source_kind!=="external"&&D.status==="published"&&t.jsxs("button",{onClick:()=>void V(D.id),disabled:x,children:[t.jsx(dr,{size:14})," Register"]}),D.registration_url&&t.jsx("a",{href:D.registration_url,target:"_blank",rel:"noreferrer",children:D.source_kind==="external"?"Open authoritative registration":"Registration link"})]})]})]},D.id)):t.jsxs("div",{className:"events-empty",children:[t.jsx(mt,{size:34}),t.jsx("h2",{children:"No events found"}),t.jsx("p",{children:N?"The community event foundation has not been activated yet.":r?"Try another search or create the first event for your business community.":"No authorized upcoming events are available in this workspace."})]})}),f&&t.jsx("div",{className:"event-modal-backdrop",role:"presentation",children:t.jsxs("form",{className:"event-modal",onSubmit:A,children:[t.jsxs("div",{className:"event-modal-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Business workspace"}),t.jsx("h2",{children:"Create event"})]}),t.jsx("button",{type:"button",className:"icon-button",onClick:()=>m(!1),children:t.jsx(gt,{})})]}),t.jsxs("label",{children:["Title",t.jsx("input",{required:!0,minLength:2,maxLength:160,value:ee.title,onChange:D=>ce({...ee,title:D.target.value})})]}),t.jsxs("label",{children:["Description",t.jsx("textarea",{maxLength:1e4,rows:4,value:ee.description,onChange:D=>ce({...ee,description:D.target.value})})]}),t.jsxs("div",{className:"event-form-grid",children:[t.jsxs("label",{children:["Format",t.jsxs("select",{value:ee.format,onChange:D=>ce({...ee,format:D.target.value}),children:[t.jsx("option",{value:"virtual",children:"Online"}),t.jsx("option",{value:"in_person",children:"In person"}),t.jsx("option",{value:"hybrid",children:"Hybrid"})]})]}),t.jsxs("label",{children:["Visibility",t.jsxs("select",{value:ee.visibility,onChange:D=>ce({...ee,visibility:D.target.value}),children:[t.jsx("option",{value:"members",children:"Members"}),t.jsx("option",{value:"public",children:"Public"}),t.jsx("option",{value:"team",children:"Team"})]})]})]}),t.jsxs("div",{className:"event-form-grid",children:[t.jsxs("label",{children:["Starts",t.jsx("input",{required:!0,type:"datetime-local",value:ee.starts_at,onChange:D=>ce({...ee,starts_at:D.target.value})})]}),t.jsxs("label",{children:["Ends",t.jsx("input",{type:"datetime-local",value:ee.ends_at,onChange:D=>ce({...ee,ends_at:D.target.value})})]})]}),t.jsxs("label",{children:["Registration URL ",t.jsx("span",{className:"optional",children:"Optional"}),t.jsx("input",{type:"url",value:ee.registration_url,onChange:D=>ce({...ee,registration_url:D.target.value}),placeholder:"https://"})]}),t.jsxs("div",{className:"event-modal-actions",children:[t.jsx("button",{type:"button",className:"secondary-button",onClick:()=>m(!1),children:"Cancel"}),t.jsx("button",{className:"primary-inline",disabled:x,children:x?"Savingâ¦":"Save draft"})]})]})})]})}function pC(e){if(!e)return"No deadline listed";const r=new Date(e);return Number.isNaN(r.getTime())?"No deadline listed":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(r)}function _u(e){var a;const r=Array.isArray(e.source)?e.source[0]:e.source;return((a=r==null?void 0:r.name)==null?void 0:a.trim())||"Official source"}function bu(e){return e.review_status==="verified"&&!!e.last_verified_at}
587function mC(e){try{const r=new URL(e);return["http:","https:"].includes(r.protocol)?r.toString():null}catch{return null}}const xC=["Programs","Contracts & RFPs","Accelerators","Local support"],Cf=[{value:"US-GA",label:"Georgia"},{value:"US-SC",label:"South Carolina"},{value:"US-NC",label:"North Carolina"},{value:"US-FL",label:"Florida"},{value:"US-TX",label:"Texas"},{value:"US-CA",label:"California"},{value:"US-NY",label:"New York"}],Ef=[{value:"north-america",label:"North America"},{value:"caribbean",label:"Caribbean"},{value:"latin-america",label:"Latin America"},{value:"west-africa",label:"West Africa"},{value:"east-africa",label:"East Africa"},{value:"central-africa",label:"Central Africa"},{value:"southern-africa",label:"Southern Africa"},{value:"north-africa-mena",label:"North Africa / MENA"},{value:"europe",label:"Europe"},{value:"south-asia",label:"South Asia"},{value:"southeast-asia",label:"Southeast Asia"},{value:"east-asia",label:"East Asia"},{value:"oceania-pacific",label:"Oceania / Pacific"}];function gC(e,r){if(r==="all")return!0;if(r==="georgia")return/georgia|\bga\b/i.test(e.region??"");const a=e.region??"",n=e.structured_metadata??{};if(r==="us")return e.country==="US"||a==="US"||a.startsWith("US-");if(r==="global")return["world_region","worldwide","online"].includes(String(e.geographic_scope??""))||!!n.world_region;const s=Cf.find(c=>c.value===r);if(s)return a===s.value||a===s.value.slice(3)||new RegExp(`\\b${s.label}\\b|\\b${s.value.slice(3)}\\b`,"i").test(a);const i=Ef.find(c=>c.value===r);return!!(i&&n.world_region===i.label)}function vC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState(!0),[i,c]=y.useState(null),[o,l]=y.useState(""),[d,u]=y.useState("all"),[h,f]=y.useState("grant"),[m,x]=y.useState("all"),[p,g]=y.useState("open"),[w,S]=y.useState(""),[b,j]=y.useState(""),[k,N]=y.useState("all");async function C(){s(!0),c(null);const L=await e.from("discovery_items").select("id,title,summary,publisher,category,discovery_type_id,deadline_at,pitch_date,geographic_scope,country,region,city,delivery_mode,award,application_url,structured_metadata,review_status,last_verified_at,canonical_url,source_url,source:discovery_sources(name)").eq("kind","opportunity").eq("category",h).eq("approved_public",!0).in("status",["open","forecasted","unknown","closed","expired","completed","cancelled"]).order("deadline_at",{ascending:!0,nullsFirst:!1}).limit(50);L.error?(c("Opportunities could not be loaded. Try again; other Command Center areas remain available."),a([])):a(L.data??[]),s(!1)}y.useEffect(()=>{C()},[e,h]),y.useEffect(()=>{u("all")},[h]);const P=y.useMemo(()=>r.filter(L=>{var le;const M=`${L.title} ${L.summary} ${L.publisher??""}`.toLowerCase(),E=!o.trim()||M.includes(o.trim().toLowerCase()),W=L.structured_metadata??{},ee=m==="all"||L.delivery_mode===m,ce=["closed","expired","completed","cancelled"].includes(String(L.status??"").toLowerCase())||!!(L.deadline_at&&new Date(L.deadline_at)<new Date),ue=p==="all"||(p==="open"?!ce:ce),te=Array.isArray(W.industry_eligibility)?W.industry_eligibility.map(String):[],fe=!w.trim()||te.some(A=>A.toLowerCase().includes(w.trim().toLowerCase())),q=!b||Number(((le=L.award)==null?void 0:le.amount)??0)>=Number(b),J=k==="all"||W.match_classification===k;return E&&gC(L,d)&&ee&&ue&&fe&&q&&J}),[m,d,w,b,r,o,k,p]),T=r.filter(bu).length;return t.jsxs("div",{className:"grant-watch-page","data-automation-hook":"grant-watch.page",children:[t.jsxs("header",{className:"page-heading grant-watch-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper intelligence"}),t.jsx("h1",{children:"Opportunities"}),t.jsx("p",{className:"muted",children:"Credible, reviewed grants and pitch competitions linked to their official sources."})]}),t.jsxs("button",{className:"secondary-button",onClick:()=>void C(),disabled:n,children:[t.jsx(St,{size:16})," ",n?"Refreshing":"Refresh opportunities"]})]}),t.jsxs("nav",{className:"opportunity-category-strip","aria-label":"Opportunity categories",children:[t.jsxs("button",{type:"button",className:h==="grant"?"active":"","aria-current":h==="grant"?"page":void 0,onClick:()=>f("grant"),children:[t.jsx(fr,{size:16})," Government grants"]}),t.jsxs("button",{type:"button",className:h==="pitch_prize"?"active":"","aria-current":h==="pitch_prize"?"page":void 0,onClick:()=>f("pitch_prize"),children:[t.jsx(Jn,{size:16})," Pitch Competitions"]}),xC.map(L=>t.jsxs("span",{title:`${L} will be added from a reviewed source later`,children:[L,t.jsx("small",{children:"Planned"})]},L))]}),t.jsxs("section",{className:"opportunity-summary","aria-label":"Opportunity feed summary",children:[t.jsxs("article",{children:[h==="pitch_prize"?t.jsx(Jn,{size:20}):t.jsx(fr,{size:20}),t.jsxs("span",{children:["Open ",h==="pitch_prize"?"pitch competitions":"grant leads"]}),t.jsx("strong",{children:r.length})]}),t.jsxs("article",{children:[t.jsx(tt,{size:20}),t.jsx("span",{children:"Human-verified"}),t.jsx("strong",{children:T})]}),t.jsxs("article",{children:[t.jsx(mt,{size:20}),t.jsx("span",{children:"Geography"}),t.jsx("strong",{children:h==="pitch_prize"?"State / Global":"U.S. / Georgia"})]})]}),t.jsxs("section",{className:"opportunity-toolbar","aria-label":"Filter opportunities",children:[t.jsxs("label",{children:[t.jsx(Yr,{size:17}),t.jsx("span",{className:"sr-only",children:"Search opportunities"}),t.jsx("input",{value:o,onChange:L=>l(L.target.value),placeholder:"Search title, organizer, or industry"})]}),t.jsxs("select",{value:d,onChange:L=>u(L.target.value),"aria-label":"Filter opportunity geography",children:[t.jsx("option",{value:"all",children:h==="grant"?"United States":"All configured geographies"}),h==="grant"?t.jsx("option",{value:"georgia",children:"Georgia relevant"}):t.jsxs(t.Fragment,{children:[t.jsx("option",{value:"us",children:"United States"}),Cf.map(L=>t.jsx("option",{value:L.value,children:L.label},L.value)),t.jsx("option",{value:"global",children:"Global regions / worldwide"}),Ef.map(L=>t.jsx("option",{value:L.value,children:L.label},L.value))]})]}),h==="pitch_prize"&&t.jsxs(t.Fragment,{children:[t.jsxs("select",{value:m,onChange:L=>x(L.target.value),"aria-label":"Filter delivery mode",children:[t.jsx("option",{value:"all",children:"Any delivery mode"}),t.jsx("option",{value:"virtual",children:"Virtual"}),t.jsx("option",{value:"physical",children:"In person"}),t.jsx("option",{value:"hybrid",children:"Hybrid"})]}),t.jsxs("select",{value:p,onChange:L=>g(L.target.value),"aria-label":"Filter open or closed",children:[t.jsx("option",{value:"open",children:"Open"}),t.jsx("option",{value:"closed",children:"Closed / historical"}),t.jsx("option",{value:"all",children:"Any status"})]})]})]}),h==="pitch_prize"&&t.jsxs("details",{className:"pitch-advanced-filters",children:[t.jsx("summary",{children:"More pitch filters"}),t.jsxs("div",{children:[t.jsxs("label",{children:["Industry",t.jsx("input",{value:w,onChange:L=>S(L.target.value),placeholder:"e.g. food, health, AI"})]}),t.jsxs("label",{children:["Minimum prize/value",t.jsx("input",{type:"number",min:"0",value:b,onChange:L=>j(L.target.value)})]}),t.jsxs("label",{children:["Eligibility relevance",t.jsxs("select",{value:k,onChange:L=>N(L.target.value),children:[t.jsx("option",{value:"all",children:"Any relevance"}),t.jsx("option",{value:"likely_match",children:"Likely match"}),t.jsx("option",{value:"possible_match",children:"Possible match"}),t.jsx("option",{value:"likely_not_eligible",children:"Likely not eligible"}),t.jsx("option",{value:"insufficient_information",children:"Insufficient information"})]})]})]})]}),i&&t.jsxs("div",{className:"error-box",role:"alert",children:[i," ",t.jsx("button",{type:"button",onClick:()=>void C(),children:"Try again"})]}),n?t.jsxs("section",{className:"opportunity-loading","aria-live":"polite",children:[t.jsx(gr,{className:"spin"}),t.jsxs("div",{children:[t.jsx("strong",{children:"Loading opportunities"}),t.jsx("span",{children:"Checking reviewed, source-linked recordsâ¦"})]})]}):P.length?t.jsx("section",{className:"grant-match-list","aria-label":"Opportunity results",children:P.map(L=>{var ee,ce;const M=mC(L.canonical_url||L.source_url),E=bu(L),W=(ee=L.award)==null?void 0:ee.amount;return t.jsxs("article",{className:"grant-match-card",children:[t.jsxs("div",{className:"grant-match-card-top",children:[t.jsxs("div",{children:[t.jsx("span",{className:`grant-strength ${E?"verified":"unverified"}`,children:E?"Verified":"Needs verification"}),t.jsx("h2",{children:L.title}),t.jsxs("p",{children:[L.publisher||_u(L),L.region?` · ${L.region}`:L.country?` · ${L.country}`:""]})]}),h==="pitch_prize"?t.jsx(Jn,{size:24}):t.jsx(fr,{size:24})]}),t.jsx("p",{children:L.summary||"Review the official notice for details and eligibility."}),t.jsxs("div",{className:"grant-match-meta",children:[W!=null&&t.jsxs("span",{children:[t.jsx(Jn,{size:14})," ",new Intl.NumberFormat("en-US",{style:"currency",currency:((ce=L.award)==null?void 0:ce.currency)||"USD",maximumFractionDigits:0}).format(W)]}),t.jsxs("span",{children:[t.jsx(mt,{size:14})," ",pC(L.deadline_at)]}),t.jsxs("span",{children:[t.jsx(Mn,{size:14})," ",L.delivery_mode||L.city||L.region||"Location not stated"]}),t.jsxs("span",{children:[t.jsx(tt,{size:14})," ",_u(L)]}),M&&t.jsxs("a",{href:M,target:"_blank",rel:"noreferrer",children:["View official notice ",t.jsx(Bu,{size:14})]})]}),h==="pitch_prize"&&t.jsxs("button",{className:"pitch-practice-button",type:"button",disabled:!0,title:"Simulator destination remains off until separately certified",children:[t.jsx(kp,{size:15})," Practice for this Pitch"]})]},L.id)})}):t.jsxs("section",{className:"grant-watch-empty","aria-live":"polite",children:[h==="pitch_prize"?t.jsx(Jn,{size:30}):t.jsx(fr,{size:30}),t.jsx("h2",{children:"No matching opportunities"}),t.jsx("p",{children:r.length?"Try broader filters.":h==="pitch_prize"?"No reviewed pitch competitions are published right now. Disabled or unapproved sources never appear here.":"No reviewed opportunities are published right now. Refresh later; no demo or fallback grants are shown as live."})]})]})}function yC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState(""),[i,c]=y.useState(""),[o,l]=y.useState("pending_review"),[d,u]=y.useState(""),[h,f]=y.useState([]),[m,x]=y.useState(""),[p,g]=y.useState(!1);async function w(){const N=await e.rpc("sbh_discovery_my_v1_assignments");if(N.error){x("Moderator assignments could not be verified. No queue data was loaded.");return}const C=Array.isArray(N.data)?N.data:[];a(C);const P=C.find(T=>T.can_view_review);P&&(s(T=>T||P.scope_id),c(T=>T||P.type_key))}async function S(){if(!n||!i)return;g(!0),x("");
587const N=await e.rpc("sbh_discovery_review_queue_v1",{p_scope_id:n,p_type_key:i,p_status:o,p_limit:50});N.error?(f([]),x("This queue is unavailable for the current assignment or scope settings.")):f(N.data??[]),g(!1)}async function b(N,C){g(!0),x(""),(await e.rpc("sbh_discovery_review_action_v1",{p_item_id:N.id,p_type_key:i,p_action:C,p_notes:null})).error&&x("The server denied this review action or the candidate has already changed."),await S()}async function j(N){const C=window.prompt("Edit candidate title",N.title);if(C===null||!C.trim())return;g(!0);const P=await e.rpc("sbh_discovery_edit_candidate",{p_item_id:N.id,p_patch:{title:C.trim()}});x(P.error?"The server denied this candidate edit.":"Candidate edit saved and audited."),await S()}y.useEffect(()=>{w()},[]),y.useEffect(()=>{S()},[n,i,o]);const k=r.find(N=>N.scope_id===n&&N.type_key===i&&N.can_view_review);return r.length?t.jsxs("section",{className:"discovery-moderator-queue","aria-labelledby":"discovery-moderator-title",children:[t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Assigned Discovery moderation"}),t.jsxs("h2",{id:"discovery-moderator-title",children:[t.jsx(tt,{size:20})," Regional review queue"]}),t.jsx("p",{children:"Only scopes and capabilities granted to this signed-in account are returned by the server. Ambassador status does not grant access."})]}),t.jsx("button",{type:"button",onClick:()=>void S(),disabled:p,"aria-label":"Refresh review queue",children:t.jsx(St,{size:17})})]}),t.jsxs("div",{className:"discovery-moderator-filters",children:[t.jsxs("label",{children:["Geography",t.jsx("select",{value:n,onChange:N=>{s(N.target.value),c("")},children:[...new Map(r.filter(N=>N.can_view_review).map(N=>[N.scope_id,N])).values()].map(N=>t.jsx("option",{value:N.scope_id,children:N.scope_name},N.scope_id))})]}),t.jsxs("label",{children:["Discovery type",t.jsx("select",{value:i,onChange:N=>c(N.target.value),children:r.filter(N=>N.scope_id===n&&N.can_view_review).map(N=>t.jsx("option",{value:N.type_key,children:N.type_name},N.type_key))})]}),t.jsxs("label",{children:["Status",t.jsxs("select",{value:o,onChange:N=>l(N.target.value),children:[t.jsx("option",{value:"pending_review",children:"Pending review"}),t.jsx("option",{value:"verified",children:"Approved"}),t.jsx("option",{value:"rejected",children:"Rejected"})]})]})]}),k?h.length?t.jsx("div",{className:"discovery-moderator-items",children:h.map(N=>t.jsxs("article",{children:[t.jsxs("div",{children:[t.jsx("strong",{children:N.title}),t.jsxs("span",{children:[k.type_name," · ",N.source_id," · ",[N.city,N.region,N.country].filter(Boolean).join(", ")||"Geographic classification"," · ",N.review_status]})]}),t.jsxs("div",{className:"discovery-moderator-actions",children:[N.review_status==="pending_review"&&k.can_edit_candidate&&t.jsx("button",{type:"button",disabled:p,onClick:()=>void j(N),children:"Edit"}),N.review_status==="pending_review"&&k.can_approve&&t.jsx("button",{type:"button",disabled:p,onClick:()=>void b(N,"approve"),children:"Approve"}),N.review_status==="pending_review"&&k.can_reject&&t.jsx("button",{type:"button",disabled:p,onClick:()=>void b(N,"reject"),children:"Reject"})]})]},N.id))}):t.jsxs("p",{className:"discovery-moderator-empty",children:[t.jsx(tt,{size:17})," ",p?"Loading authorized queueâ¦":"No candidates match this exact assigned geography/type."]}):t.jsxs("p",{className:"discovery-moderator-empty",children:[t.jsx($a,{size:17})," No exact geography + Discovery type review assignment is available."]}),m&&t.jsx("p",{role:"status",className:"discovery-moderator-message",children:m})]}):null}function ju(e){const r=new URLSearchParams(window.location.search);r.set("area",e==="events"?"events":"grant-watch"),Aa(`${window.location.pathname}?${r.toString()}`)}function _C({supabase:e,canManage:r,section:a}){return t.jsxs("section",{className:"opportunities-events-hub","aria-labelledby":"opportunities-events-hub-title",children:[t.jsxs("header",{className:"opportunities-events-hub-heading",children:[t.jsx("p",{className:"eyebrow",children:"SmartBizHelper discovery"}),t.jsx("h1",{id:"opportunities-events-hub-title",children:"Opportunities & Events"}),t.jsx("p",{children:"One place for credible business opportunities and the full community events calendar."})]}),t.jsxs("nav",{className:"opportunities-events-tabs","aria-label":"Opportunities and Events sections",children:[t.jsxs("button",{type:"button",className:a==="opportunities"?"active":"","aria-current":a==="opportunities"?"page":void 0,onClick:()=>ju("opportunities"),children:[t.jsx(fr,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Opportunities"}),t.jsx("small",{children:"Government grants and future programs"})]})]}),t.jsxs("button",{type:"button",className:a==="events"?"active":"","aria-current":a==="events"?"page":void 0,onClick:()=>ju("events"),children:[t.jsx(mt,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Events"}),t.jsx("small",{children:"Calendar, Upcoming, and Today"})]})]})]}),a==="events"?t.jsx(fC,{supabase:e,canManage:r}):t.jsx(vC,{supabase:e}),t.jsx(yC,{supabase:e})]})}const bC="https://www.lilmamasweets.com/",Mc=[{key:"profile",label:"Complete Profile",detail:"Make sure your name and role are ready.",page:"welcome"}
587,{key:"sops",label:"Read SOPs",detail:"Review the procedures assigned to you.",page:"training"},{key:"training",label:"Complete Training",detail:"Finish the training assigned to your role.",page:"training"},{key:"inventory",label:"Inventory Basics",detail:"Open Smart Inventory and learn the daily starting point.",page:"inventory"},{key:"team",label:"Meet the Team",detail:"Visit the team workspace and shared business tools.",page:"lobby"}];function wu(e){return`sbh_workspace_onboarding_${e}`}function jC({onNavigate:e,isPrivileged:r=!1}){return t.jsxs("section",{className:"workspace-onboarding-page",children:[t.jsxs("div",{className:"workspace-onboarding-hero",children:[t.jsx("p",{className:"eyebrow",children:"Lil Mama's Workspace"}),t.jsx("h1",{children:"Welcome to your workspace."}),t.jsx("p",{children:"Everything you need for your day is here: team guidance, SOPs, training, meetings, and Smart Inventory."}),t.jsxs("button",{className:"primary-inline",type:"button",onClick:()=>e(r?"workspace":"onboarding"),children:[r?"Open Workspace":"Begin Onboarding"," ",t.jsx(Mt,{size:17})]})]}),t.jsxs("section",{className:"workspace-onboarding-card panel",children:[t.jsx("div",{className:"workspace-onboarding-icon",children:t.jsx(na,{size:25})}),t.jsxs("div",{children:[t.jsx("h2",{children:r?"Owner access is ready":"Start with the basics"}),t.jsx("p",{className:"muted",children:r?"Your owner/admin role already has workspace access. Use the portal tools directly; the guided checklist is for team members and clients.":"Use the short Start Here checklist to get familiar with how Lil Mama's team works. You can return to it any time."})]})]}),t.jsxs("a",{className:"workspace-return-link",href:bC,target:"_blank",rel:"noreferrer",children:[t.jsx(Tt,{size:16})," Return to Lil Mama's Website"]})]})}function wC({userId:e,onNavigate:r}){const[a,n]=y.useState(()=>{try{return JSON.parse(localStorage.getItem(wu(e))??"[]")}catch{return[]}}),s=y.useMemo(()=>Math.round(a.length/Mc.length*100),[a]),[i,c]=y.useState(s===100);function o(l){const d=a.includes(l)?a.filter(u=>u!==l):[...a,l];n(d),localStorage.setItem(wu(e),JSON.stringify(d)),c(d.length===Mc.length)}return i?t.jsx("section",{className:"workspace-onboarding-page",children:t.jsxs("div",{className:"workspace-completion-card panel",children:[t.jsx("div",{className:"workspace-success-mark",children:t.jsx(Kr,{size:40})}),t.jsx("p",{className:"eyebrow",children:"Onboarding complete"}),t.jsx("h1",{children:"You're all set!"}),t.jsx("p",{className:"muted",children:"Your Start Here checklist is complete. You can enter the workspace or jump straight into Smart Inventory."}),t.jsxs("div",{className:"workspace-completion-actions",children:[t.jsxs("button",{className:"primary-inline",type:"button",onClick:()=>r("workspace"),children:["Enter Workspace ",t.jsx(Mt,{size:17})]}),t.jsxs("button",{className:"secondary-button",type:"button",onClick:()=>r("inventory"),children:[t.jsx(Hr,{size:17})," Smart Inventory quick-start"]})]})]})}):t.jsxs("section",{className:"workspace-onboarding-page",children:[t.jsxs("header",{className:"workspace-onboarding-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Start Here"}),t.jsx("h1",{children:"Your onboarding checklist"}),t.jsx("p",{className:"muted",children:"Complete these five basics at your own pace."})]}),t.jsxs("div",{className:"workspace-progress",children:[t.jsxs("strong",{children:[s,"%"]}),t.jsx("span",{children:"complete"}),t.jsx("i",{children:t.jsx("b",{style:{width:`${s}%`}})})]})]}),t.jsx("section",{className:"panel workspace-checklist",children:Mc.map(l=>t.jsxs("article",{className:a.includes(l.key)?"workspace-checklist-item complete":"workspace-checklist-item",children:[t.jsx("button",{className:"workspace-check",type:"button","aria-label":`${a.includes(l.key)?"Mark incomplete":"Mark complete"}: ${l.label}`,onClick:()=>o(l.key),children:a.includes(l.key)?t.jsx(Kt,{size:17}):null}),t.jsxs("div",{children:[t.jsx("h2",{children:l.label}),t.jsx("p",{className:"muted",children:l.detail})]}
587),t.jsxs("button",{className:"workspace-checklist-link",type:"button",onClick:()=>r(l.page),children:["Open ",t.jsx(Mt,{size:15})]})]},l.key))}),t.jsxs("section",{className:"workspace-onboarding-card panel",children:[t.jsx(tp,{size:24}),t.jsx("p",{className:"muted",children:"Progress is saved for this signed-in employee on this device."})]})]})}const kC={AUTH_REQUIRED:"Sign in again before creating a team invitation.",AUTH_INVALID:"Your session has expired. Sign in again, then retry the invitation.",NOT_AUTHORIZED:"Only a workspace owner or admin can invite team members.",INVALID_EMAIL:"Enter a valid email address.",INVALID_LOCATION:"Your active workspace location could not be verified. Refresh the page and try again.",INVALID_INVITATION:"Review the invitation role and access settings, then try again.",INVITATION_UNAVAILABLE:"An invitation cannot be created for that email.",DUPLICATE_INVITATION:"A pending invitation already exists for that email. Use Resend invitation instead.",EMAIL_DELIVERY_UNCONFIGURED:"Invitation email delivery is temporarily unavailable. Please contact SmartBizHelper support.",DELIVERY_FAILED:"The invitation was created, but the email could not be delivered. Check the address and retry delivery.",DELIVERY_AUDIT_FAILED:"The email provider accepted the invitation, but SmartBizHelper could not confirm delivery. Contact support before retrying.",ORIGIN_NOT_ALLOWED:"This SmartBizHelper address is not authorized to send invitations."};async function SC(e){const r=e&&typeof e=="object"?e.context:null;if(!r||typeof r!="object")return null;const a=r;try{const n=typeof a.clone=="function"?a.clone():a,s=typeof n.json=="function"?await n.json():null;return s&&typeof s=="object"?s:null}catch{return null}}async function ku(e,r){const n=(r&&typeof r=="object"?r:null)??await SC(e),s=String((n==null?void 0:n.error_code)??"INVITATION_SERVICE_UNREACHABLE"),i=Number.isInteger(n==null?void 0:n.invitation_id);return{code:s,invitationCreated:i,retryable:i&&s==="DELIVERY_FAILED",message:(n==null?void 0:n.message)||kC[s]||"SmartBizHelper could not reach the invitation service. Check your connection and try again."}}const NC={items:{eyebrow:"Item controls",title:"My Items",description:"Control what appears in the Workspace, inventory emails, and purchase plans.",icon:Hr,actions:[{label:"Add Item",hook:"my-items.add-item",icon:qr,primary:!0},{label:"Bulk Edit",hook:"my-items.bulk-edit",icon:ta}],cards:[{title:"Item visibility",copy:"Show or hide products without deleting inventory history.",icon:dl,actions:[{label:"Show Item",hook:"my-items.show-item",icon:dl},{label:"Hide Item",hook:"my-items.hide-item",icon:Mf}]},{title:"Daily inventory report",copy:"Choose which items appear in the daily Smart Inventory email.",icon:Ri,actions:[{label:"Include in Report",hook:"my-items.include-report",icon:Kt},{label:"Remove from Report",hook:"my-items.remove-report",icon:fl}]},{title:"Reorder settings",copy:"Update PAR levels, thresholds, categories, vendors, and order links.",icon:ta,actions:[{label:"Update PAR",hook:"my-items.update-par",icon:ta},{label:"Assign Vendor",hook:"my-items.assign-vendor",icon:hr},{label:"Add Order Link",hook:"my-items.add-order-link",icon:Wa},{label:"Edit Item",hook:"my-items.edit-item",icon:Xa}]}]},forecasting:{eyebrow:"Demand planning",title:"Forecasting",description:"Turn sales, recipes, seasonality, and current stock into an actionable plan.",icon:Pn,actions:[{label:"Run Forecast",hook:"forecast.run",icon:mo,primary:!0},{label:"Choose Forecast Period",hook:"forecast.choose-period",icon:mt}],cards:[{title:"Suggested needs",copy:"Review forecasted ingredient, packaging, and finished-product needs.",icon:Pn,actions:[{label:"Review Suggested Needs",hook:"forecast.review-needs",icon:Nn},{label:"Add to Purchase Plan",hook:"forecast.add-to-purchase-plan",icon:en}]},{title:"Forecast controls",copy:"Connection points for recipe usage, sales history, events, and overrides.",icon:ta,actions:[{label:"Recipe Inputs",hook:"forecast.recipe-inputs",icon:Pr},{label:"Seasonal Events",hook:"forecast.seasonal-events",icon:mt},{label:"Refresh Data",hook:"forecast.refresh-data",icon:St}]}]},vendors:{eyebrow:"Supplier management",title:"Vendors",description:"Manage supplier details, ordering links, pack sizes, pricing, and assigned products.",icon:hr,actions:[{label:"Add Vendor",hook:"vendors.add",icon:qr,primary:!0},{label:"Import Vendors",hook:"vendors.import",icon:Rn}],cards:[{title:"Vendor directory",copy:"Create and maintain supplier contact and ordering information.",icon:hr,actions:[{label:"Edit Vendor",hook:"vendors.edit",icon:Xa},{label:"Open Vendor Website",hook:"vendors.open-website",icon:Wa},{label:"View Items",hook:"vendors.view-items",icon:Hr}]},{title:"Product assignments",copy:"Connect products to preferred vendors and vendor-specific item details.",icon:Hr,actions:[{label:"Assign Products",hook:"vendors.assign-products",icon:Wa},{label:"Update Pricing",hook:"vendors.update-pricing",icon:ta},{label:"Update Pack Sizes",hook:"vendors.update-pack-sizes",icon:Hr}]}]},recipes:{eyebrow:"Production intelligence",title:"Recipes & Products",description:"Connect finished products to ingredients so inventory and forecasting understand production needs.",icon:Pr,actions:[{label:"Add Recipe",hook:"recipes.add",icon:qr,primary:!0},{label:"Upload Recipe",hook:"recipes.upload",icon:Rn}
587,{label:"Add Finished Product",hook:"products.add",icon:Hr}],cards:[{title:"Recipe builder",copy:"Create ingredient quantities, yield, units, and production instructions.",icon:Pr,actions:[{label:"Edit Ingredients",hook:"recipes.edit-ingredients",icon:Xa},{label:"Set Yield",hook:"recipes.set-yield",icon:ta},{label:"Attach Instructions",hook:"recipes.attach-instructions",icon:Nn}]},{title:"POS product connection",copy:"Map finished products and menu items to the recipes that consume inventory.",icon:Wa,actions:[{label:"Connect to POS Item",hook:"recipes.connect-pos",icon:Wa},{label:"Review Product Map",hook:"recipes.review-product-map",icon:Hr}]}]},team:{eyebrow:"People and permissions",title:"Team Access",description:"Invite staff and control the locations and Workspace tools each person can use.",icon:dr,actions:[{label:"Invite Team Member",hook:"team.invite",icon:vs,primary:!0},{label:"Export Team List",hook:"team.export",icon:Os}],cards:[{title:"Access controls",copy:"Assign roles, locations, and module-level permissions.",icon:dr,actions:[{label:"Edit Permissions",hook:"team.edit-permissions",icon:ta},{label:"Assign Location",hook:"team.assign-location",icon:hr},{label:"Deactivate Access",hook:"team.deactivate",icon:fl}]},{title:"Training and meetings",copy:"Connect team members to assigned training, SOPs, and live meetings.",icon:pl,actions:[{label:"Assign Training",hook:"team.assign-training",icon:Pr},{label:"Schedule Meeting",hook:"team.schedule-meeting",icon:mt},{label:"Join Meeting",hook:"team.join-meeting",icon:pl}]}]}};function CC({supabase:e,onNavigate:r}){const[a,n]=y.useState(null),[s,i]=y.useState([]),[c,o]=y.useState(28),[l,d]=y.useState(!0),[u,h]=y.useState(null),[f,m]=y.useState(null);async function x(g=c){if(!e){d(!1),h("Portal environment is not configured.");return}d(!0),h(null),m(null);const{data:w,error:S}=await e.rpc("portal_get_forecast_alert_summary",{p_lookback_days:g});if(S){d(!1),h(S.message);return}n(w??null);const{data:b,error:j}=await e.from("smart_inventory_forecast_daily").select("id,inventory_item_id,forecast_date,avg_daily_usage,current_qty,par_level,projected_days_remaining,recommended_reorder_qty,confidence_score").eq("forecast_date",new Date().toISOString().slice(0,10)).gt("recommended_reorder_qty",0).order("recommended_reorder_qty",{ascending:!1}).limit(50);if(d(!1),j){h(j.message),i([]);return}i(b??[]),m(`Forecast refreshed using ${g} days of history.`)}y.useEffect(()=>{x(28)},[e]);const p=Math.round(Number((a==null?void 0:a.confidence_score)??0)*100);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading module-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Demand planning"}),t.jsx("h1",{children:"Forecasting"}),t.jsx("p",{className:"muted",children:"Live supply forecasts from current stock and inventory history. Recipe-driven demand can be layered in as recipe mapping is completed."})]}),t.jsx("div",{className:"module-header-actions",children:t.jsxs("button",{type:"button",className:"primary-inline module-action-button",onClick:()=>void x(),disabled:l,children:[t.jsx(mo,{size:17}),l?"Runningâ¦":"Run Forecast"]})})]}),u&&t.jsx("div",{className:"error-box",children:u}),f&&t.jsxs("div",{className:"success-box module-ready-message",children:[t.jsx(Kt,{size:17}),f]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Forecast controls"}),t.jsx("p",{className:"muted",children:"Change the history window, then rerun the forecast."})]})}),t.jsx("div",{className:"form-grid",children:t.jsxs("label",{children:["History window",t.jsxs("select",{value:c,onChange:g=>o(Number(g.target.value)),children:[t.jsx("option",{value:7,children:"7 days"}),t.jsx("option",{value:14,children:"14 days"}),t.jsx("option",{value:28,children:"28 days"}),t.jsx("option",{value:60,children:"60 days"}),t.jsx("option",{value:90,children:"90 days"})]})]})}),t.jsxs("div",{className:"module-header-actions",children:[t.jsxs("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>r==null?void 0:r("recipes"),children:[t.jsx(Pr,{size:17}),"Recipe Inputs"]}
587),t.jsxs("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>r==null?void 0:r("events"),children:[t.jsx(mt,{size:17}),"Seasonal Events"]}),t.jsxs("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>void x(),disabled:l,children:[t.jsx(St,{size:17}),"Refresh Data"]}),t.jsxs("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>r==null?void 0:r("purchase"),children:[t.jsx(en,{size:17}),"Purchase Plan"]})]})]}),t.jsxs("section",{className:"metric-grid",children:[t.jsxs("article",{className:"metric-card",children:[t.jsx("p",{children:"Forecast Alerts"}),t.jsx("strong",{children:(a==null?void 0:a.alert_count)??"â"}),t.jsx("span",{children:"Items with recommended reorder quantity"})]}),t.jsxs("article",{className:"metric-card",children:[t.jsx("p",{children:"Urgent"}),t.jsx("strong",{children:(a==null?void 0:a.urgent_count)??"â"}),t.jsx("span",{children:"Projected at risk now or within 3 days"})]}),t.jsxs("article",{className:"metric-card",children:[t.jsx("p",{children:"Confidence"}),t.jsx("strong",{children:a?`${p}%`:"â"}),t.jsx("span",{children:"Improves as inventory history builds"})]})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Suggested needs"}),t.jsx("p",{className:"muted",children:"Current forecast alerts, ordered by recommended reorder quantity."})]})}),l?t.jsx("p",{children:"Refreshing forecastâ¦"}):s.length===0?t.jsx("p",{className:"muted",children:"No forecast reorder alerts are currently available."}):t.jsx("div",{className:"responsive-table",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Item ID"}),t.jsx("th",{children:"On hand"}),t.jsx("th",{children:"PAR"}),t.jsx("th",{children:"Days remaining"}),t.jsx("th",{children:"Suggested reorder"}),t.jsx("th",{children:"Confidence"})]})}),t.jsx("tbody",{children:s.map(g=>t.jsxs("tr",{children:[t.jsx("td",{children:g.inventory_item_id}),t.jsx("td",{children:g.current_qty??"â"}),t.jsx("td",{children:g.par_level??"â"}),t.jsx("td",{children:g.projected_days_remaining??"â"}),t.jsx("td",{children:t.jsx("strong",{children:g.recommended_reorder_qty})}),t.jsxs("td",{children:[Math.round(Number(g.confidence_score??0)*100),"%"]})]},g.id))})]})})]})]})}function EC({supabase:e}){const[r,a]=y.useState([]),[n,s]=y.useState(!0),[i,c]=y.useState(null),[o,l]=y.useState(null),[d,u]=y.useState(!1),[h,f]=y.useState(""),[m,x]=y.useState(""),[p,g]=y.useState("team_member"),[w,S]=y.useState("read_only"),[b,j]=y.useState(!1),[k,N]=y.useState(null);async function C(){if(!e){s(!1),c("Portal environment is not configured.");return}s(!0),c(null);const{data:E,error:W}=await e.rpc("portal_list_my_team_members");W?(c(W.message),a([])):a(E??[]),s(!1)}y.useEffect(()=>{C()},[e]);async function P(E=!1){if(!e)return c("Portal environment is not configured.");const W=E?(k==null?void 0:k.email)??"":h.trim().toLowerCase(),ee=E?(k==null?void 0:k.invitedName)??"":m.trim(),ce=E?(k==null?void 0:k.role)??p:p,ue=E?(k==null?void 0:k.access)??w:w,te=E?k==null?void 0:k.locationId:void 0;if(!W)return c("Enter an email address.");j(!0),c(null),l(null);const{data:fe,error:q}=te?{data:te,error:null}:await e.rpc("current_portal_location_id");if(q||fe==null){j(!1),c((q==null?void 0:q.message)??"A valid active workspace location is required before sending an invitation.");return}const J=`sbh-team-invite-request:${W}`,le=E?crypto.randomUUID():sessionStorage.getItem(J)??crypto.randomUUID();E||sessionStorage.setItem(J,le),E||N(null);const{data:A,error:V}=await e.functions.invoke("portal-team-invite-delivery",{body:{request_id:le,email:W,location_id:Number(fe),role:ce,access_level:ue,invited_name:ee||null,expires_in_days:7,resend:E}});if(j(!1),V){const D=await ku(V,A);D.invitationCreated&&sessionStorage.removeItem(J),D.retryable&&N({email:W,invitedName:ee,role:ce,access:ue,locationId:Number(fe)}),c(D.message);return}const I=A;if(!I.ok){const D=await ku(null,I);c(D.message);return}sessionStorage.removeItem(J),l(I.delivery_status==="sent"?`Invitation email sent to ${W}.`:"Invitation delivery already completed."),N({email:W,invitedName:ee,role:ce,access:ue,locationId:Number(fe)}),E||(f(""),x(""),u(!1)),C()}async function T(E){E.preventDefault(),await P(!1)}async function L(E,W,ee,ce){if(!e)return;j(!0),c(null),l(null);const{error:ue}=await e.rpc("portal_manage_team_member",{p_portal_user_id:E.portal_user_id,p_role:W,p_access_level:ee,p_location_id:E.default_location_id,p_is_active:ce,p_reason:"Updated
587in Team Access"});if(j(!1),ue){c(ue.message.includes("non-2xx")?"Email delivery is not configured or unavailable. Add the Resend API key and verified sender before sending.":ue.message);return}l(`${E.full_name} access updated.`),C()}function M(){const E=r.map(ue=>[ue.full_name,ue.email,ue.role,ue.location_name??"",ue.is_active?"active":"inactive"].join(",")),W=new Blob([["Name,Email,Role,Location,Status",...E].join(` 588`)],{type:"text/csv"}),ee=URL.createObjectURL(W),ce=document.createElement("a");ce.href=ee,ce.download="team-access.csv",ce.click(),URL.revokeObjectURL(ee)}return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading module-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"People and permissions"}),t.jsx("h1",{children:"Team Access"}),t.jsx("p",{className:"muted",children:"Tenant- and location-scoped access from Supabase. Server checks decide what each role may change."})]}),t.jsxs("div",{className:"module-header-actions",children:[t.jsx("button",{type:"button",className:"secondary-button module-action-button",onClick:M,disabled:!r.length,children:"Download team list"}),t.jsx("button",{type:"button",className:"primary-inline module-action-button",onClick:()=>u(E=>!E),disabled:!e,children:"Invite Team Member"})]})]}),i&&t.jsxs("div",{className:"error-box",role:"alert",children:[i,k&&t.jsx("button",{type:"button",className:"secondary-button",onClick:()=>void P(!0),disabled:b,children:b?"Sendingâ¦":"Retry delivery"})]}),o&&t.jsxs("div",{className:"success-box module-ready-message",role:"status",children:[o,k&&t.jsx("button",{type:"button",className:"secondary-button",onClick:()=>void P(!0),disabled:b,children:b?"Sendingâ¦":"Resend invitation"})]}),d&&t.jsxs("form",{className:"panel",onSubmit:T,children:[t.jsx("h2",{children:"Invite a team member"}),t.jsx("p",{className:"muted",children:"The server assigns the invitation to the caller's active tenant and default location."}),t.jsxs("div",{className:"form-grid",children:[t.jsxs("label",{children:["Email",t.jsx("input",{type:"email",value:h,onChange:E=>f(E.target.value),required:!0})]}),t.jsxs("label",{children:["Full name",t.jsx("input",{value:m,onChange:E=>x(E.target.value)})]}),t.jsxs("label",{children:["Role",t.jsxs("select",{value:p,onChange:E=>g(E.target.value),children:[t.jsx("option",{value:"team_member",children:"Team member"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"inventory_counter",children:"Inventory counter"}),t.jsx("option",{value:"training_only",children:"Training only"})]})]}),t.jsxs("label",{children:["Inventory access",t.jsxs("select",{value:w,onChange:E=>S(E.target.value),children:[t.jsx("option",{value:"read_only",children:"Read only"}),t.jsx("option",{value:"read_write",children:"Read and write"}),t.jsx("option",{value:"inventory_adjust",children:"Inventory adjust"}),t.jsx("option",{value:"training_only",children:"Training only"})]})]})]}),t.jsx("button",{className:"primary-inline",disabled:b,children:b?"Creatingâ¦":"Create invitation"})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Team members"}),t.jsx("p",{className:"muted",children:"Private records are returned only for the authenticated actor's authorized tenant scope."})]})}),n?t.jsx("p",{children:"Loading team accessâ¦"}):r.length===0?t.jsx("p",{className:"muted",children:"No team members are visible in this scope."}):t.jsx("div",{className:"responsive-table",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Name"}),t.jsx("th",{children:"Role"}),t.jsx("th",{children:"Location"}),t.jsx("th",{children:"Profile"}),t.jsx("th",{children:"Status"}),t.jsx("th",{children:"Access"}),t.jsx("th",{})]})}),t.jsx("tbody",{children:r.map(E=>t.jsxs("tr",{children:[t.jsxs("td",{children:[t.jsx("strong",{children:E.full_name}),t.jsx("small",{children:E.email})]}),t.jsx("td",{children:t.jsxs("select",{defaultValue:E.role,id:`role-${E.portal_user_id}`,children:[t.jsx("option",{value:"owner",children:"Owner"}),t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"team_member",children:"Team member"}),t.jsx("option",{value:"inventory_counter",children:"Inventory counter"}),t.jsx("option",{value:"training_only",children:"Training only"})]})}),t.jsx("td",{children:E.location_name??"Unassigned"}),t.jsx("td",{children:E.profile_completed?"Complete":"Incomplete"}),t.jsx("td",{children:E.is_active?"Active":"Inactive"}),t.jsx("td",{children:t.jsxs("select",{defaultValue:E.access_level??"read_only",id:`access-${E.portal_user_id}`,children:[t.jsx("option",{value:"read_only",children:"Read only"}),t.jsx("option",{value:"read_write",children:"Read/write"}),t.jsx("option",{value:"inventory_adjust",children:"Inventory adjust"}),t.jsx("option",{value:"training_only",children:"Training only"})]})}),t.jsx("td",{children:t.jsx("button",{type:"button",className:"secondary-button",disabled:b,onClick:()=>{const W=document.getElementById(`role-${E.portal_user_id}`).value,ee=document.getElementById(`access-${E.portal_user_id}`).value;L(E,W,ee,!E.is_active)},children:E.is_active?"Save / Deactivate":"Activate"})})]}
588,E.portal_user_id))})]})})]})]})}function TC({supabase:e}){const[r,a]=y.useState(null),[n,s]=y.useState(""),[i,c]=y.useState(!1),[o,l]=y.useState(null),[d,u]=y.useState(null);function h(){a(null),s(""),u(null)}async function f(m){if(m.preventDefault(),!e||!r)return u("Sign in to send a protected Smart Content request.");c(!0),u(null);const[x,p]=await Promise.all([e.rpc("current_portal_client_id"),e.rpc("current_portal_location_id")]),g=x.error??p.error;if(g||!x.data){c(!1),u((g==null?void 0:g.message)??"Your protected workspace could not be resolved.");return}const w=await e.from("support_tickets").insert({client_id:x.data,location_id:p.data??null,subject:`Smart Content AutoPoster request â ${r}`,description:[`Smart Content interest: ${r}`,n.trim()&&`Client notes: ${n.trim()}`].filter(Boolean).join(` 589`),priority:"normal",category:"general",source:"portal",metadata:{created_from:"smart_content_autoposter",product:"smart_content",interest:r}});if(c(!1),w.error)return u("Your Smart Content request could not be sent. Please try again.");l(`Your ${r} request was received. The SmartBizHelper team will follow up with protected onboarding steps.`),h()}return t.jsxs(t.Fragment,{children:[t.jsx(Nf,{onStart:m=>{a(m??"Smart Content AutoPoster"),l(null),u(null)}}),t.jsx(AC,{supabase:e}),o&&t.jsx("div",{className:"smart-content-request-success",role:"status",children:o}),r&&t.jsx("div",{className:"smart-content-request-backdrop",role:"presentation",children:t.jsxs("form",{className:"smart-content-request-modal",onSubmit:f,"aria-labelledby":"smart-content-request-title",children:[t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx("p",{className:"smart-content-section-label",children:"Protected request"}),t.jsx("h2",{id:"smart-content-request-title",children:"Start with Smart Content"}),t.jsxs("p",{children:["Your interest: ",t.jsx("strong",{children:r})]})]}),t.jsx("button",{type:"button",onClick:h,"aria-label":"Close Smart Content request",children:t.jsx(gt,{size:19})})]}),t.jsx("p",{children:"Tell us what you want Smart Content to help with. No social account is connected and no publishing is enabled here."}),t.jsxs("label",{children:["What would you like us to know? ",t.jsx("span",{children:"Optional"}),t.jsx("textarea",{rows:5,maxLength:3e3,value:n,onChange:m=>s(m.target.value),placeholder:"Channels, campaign goals, timing, or questions"})]}),d&&t.jsx("div",{className:"error-box",role:"alert",children:d}),t.jsxs("button",{className:"smart-content-request-submit",disabled:i,children:[t.jsx(Un,{size:16}),i?"Sending requestâ¦":"Request Smart Content onboarding"]}),t.jsx("small",{children:"This request stays tied to your authenticated business and permitted location."})]})})]})}function AC({supabase:e}){const[r,a]=y.useState("checking"),[n,s]=y.useState(!1),[i,c]=y.useState(null);async function o(h){if(!e)return c("Sign in to manage the protected YouTube connection."),null;s(!0),c(null);const f=await e.functions.invoke(`smart-content-youtube-oauth?action=${h}`,{body:{}});return s(!1),f.error?(c("YouTube connection is unavailable. Please try again."),null):f.data}y.useEffect(()=>{let h=!0;return o("status").then(f=>{h&&a(f!=null&&f.connection?"connected":"not_connected")}),()=>{h=!1}},[e]);async function l(){const h=await o("start");typeof(h==null?void 0:h.authorization_url)=="string"&&window.location.assign(h.authorization_url)}async function d(){const h=await o("disconnect");(h==null?void 0:h.status)==="revoked"&&a("not_connected")}async function u(){const h=await o("refresh");(h==null?void 0:h.status)==="connected"&&a("connected")}return t.jsxs("section",{className:"panel smart-content-youtube-connection","aria-labelledby":"smart-content-youtube-title",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"YouTube publishing"}),t.jsx("h2",{id:"smart-content-youtube-title",children:"Connect your dedicated YouTube channel"}),t.jsxs("p",{className:"muted",children:["Google consent requests only ",t.jsx("code",{children:"youtube.upload"}),". Tokens stay in the server credential store; this browser receives no client secret or token."]})]}),t.jsx("strong",{children:r==="connected"?"Connected":r==="checking"?"Checkingâ¦":"Not connected"})]}),i&&t.jsx("div",{className:"error-box",role:"alert",children:i}),t.jsxs("div",{className:"module-header-actions",children:[t.jsx("button",{type:"button",className:"primary-inline module-action-button",onClick:()=>void l(),disabled:n||!e,children:n?"Workingâ¦":r==="connected"?"Reconnect YouTube":"Connect YouTube"}),r==="connected"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>void u(),disabled:n,children:"Refresh token"}),t.jsx("button",{type:"button",className:"secondary-button module-action-button",onClick:()=>void d(),disabled:n,children:"Disconnect"})]})]})]})}function FC({module:e,onNavigate:r,supabase:a}){if(e==="smart-content")return t.jsx(TC,{supabase:a??null});if(e==="team")return t.jsx(EC,{supabase:a??null});if(e==="forecasting")return t.jsx(CC,{supabase:a??null,onNavigate:r});const n=NC[e],[s,i]=y.useState(null);function c(l){if(l.hook==="my-items.add-item"){r==null||r("sku");return}if(l.hook==="forecast.add-to-purchase-plan"){r==null||r("purchase");return}if(l.hook==="team.assign-training"){r==null||r("training");return}if(l.hook==="team.schedule-meeting"||l.hook==="team.join-meeting"){r==null||r("meetings");return}i(`${l.label} is ready for Dex to connect.`)}const o=n.icon;return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading module-heading",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:n.eyebrow}),t.jsx("h1",{children:n.title}),t.jsx("p",{className:"muted",children:n.description})]}),t.jsx("div",{className:"module-header-actions",children:n.actions.map(l=>t.jsx(co,{action:l,onClick:()=>c(l)},l.hook))})]}),s&&t.jsxs("div",{className:"success-box module-ready-message",children:[t.jsx(Kt,{size:17})," ",s]}),t.jsxs("section",{className:"module-intro panel",children:[t.jsx("div",{className:"module-intro-icon",children:t.jsx(o,{size:28})}),t.jsxs("div",{children:[t.jsx("strong",{children:"Front-end connection points are in place"}),t.jsxs("p",{className:"muted",children:["Each control includes a stable ",t.jsx("code",{children:"data-automation-hook"})," value for workflow and Edge Function wiring."]})]})]}),t.jsx("section",{className:"module-card-grid",children:n.cards.map(l=>{const d=l.icon;return t.jsxs("article",{className:"panel module-action-card",children:[t.jsxs("div",{className:"module-card-heading",children:[t.jsx("span",{children:t.jsx(d,{size:22})}),t.jsxs("div",{children:[t.jsx("h2",{children:l.title}),t.jsx("p",{className:"muted",children:l.copy})]})]}),t.jsx("div",{className:"module-button-grid",children:l.actions.map(u=>t.jsx(co,{action:u,onClick:()=>c(u)},u.hook))})]}
589,l.title)})})]})}function IC(){const[e,r]=y.useState(null),a=[{label:"Generate Report",hook:"reports.generate",icon:mo,primary:!0},{label:"Download",hook:"reports.download",icon:sp},{label:"Email Report",hook:"reports.email",icon:Ri},{label:"Print",hook:"reports.print",icon:yp}];return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"report-control-bar",children:[t.jsxs("label",{children:["Report period",t.jsxs("select",{"data-automation-hook":"reports.period",children:[t.jsx("option",{children:"Today"}),t.jsx("option",{children:"Last 7 days"}),t.jsx("option",{children:"Last 30 days"}),t.jsx("option",{children:"Custom range"})]})]}),t.jsx("div",{className:"module-header-actions",children:a.map(n=>t.jsx(co,{action:n,onClick:()=>r(`${n.label} is ready for Dex to connect.`)},n.hook))})]}),e&&t.jsxs("div",{className:"success-box module-ready-message",children:[t.jsx(Kt,{size:17})," ",e]})]})}function co({action:e,onClick:r}){const a=e.icon;return t.jsxs("button",{type:"button",className:e.primary?"primary-inline module-action-button":"secondary-button module-action-button","data-automation-hook":e.hook,onClick:r,children:[t.jsx(a,{size:17})," ",e.label]})}function Tf({session:e,identity:r,companyName:a,businessLogoUrl:n,onNavigate:s,onOpenSmartCard:i,onOpenDiscover:c,onOpenLobbyNavigation:o,smartCardLauncherRef:l}){const d=(r.fullName||e.user.email||"SBH").split(/\s+/).map(h=>h[0]).join("").slice(0,2).toUpperCase(),u=()=>{const h=document.querySelector('textarea[aria-label="Post text"]');if(!h)return s("lobby");h.scrollIntoView({behavior:"smooth",block:"center"}),h.focus()};return t.jsxs("header",{className:"lobby-global-header",children:[o&&t.jsx("button",{className:"lobby-header-icon lobby-mobile-menu",type:"button",onClick:o,"aria-label":"Open Lobby navigation",title:"Open Lobby navigation",children:t.jsx(Ds,{size:21})}),t.jsxs("label",{className:"lobby-global-search",children:[t.jsx(Yr,{size:18}),t.jsx("input",{"aria-label":"Search SmartBizHelper",placeholder:"Search SmartBizHelperâ¦"})]}),t.jsxs("div",{className:"lobby-global-actions",children:[t.jsxs("button",{className:"lobby-create-button",type:"button",onClick:u,children:[t.jsx(qr,{size:18})," Create"]}),c&&t.jsx("button",{className:"lobby-header-icon lobby-discover-launcher",type:"button",onClick:c,"aria-label":"Open Discover",title:"Open Discover",children:t.jsx(fo,{size:20})}),t.jsx("button",{className:"lobby-header-icon",type:"button",onClick:()=>s("notifications"),"aria-label":"Open notifications",title:"Notifications",children:t.jsx(aa,{size:20})}),t.jsxs("button",{ref:l,className:"lobby-business-card-launcher",type:"button",onClick:i,"aria-label":"Open Business Card",title:"Open Business Card",children:[t.jsx(Rs,{size:20}),t.jsx("span",{children:"Business Card"})]}),t.jsx("span",{className:"lobby-account-mark",title:a,"aria-label":a,children:n?t.jsx("img",{src:n,alt:""}):d})]})]})}const PC=(e,r)=>`https://igvskwjrroiivfrtmawd.supabase.co/functions/v1/smart-card-public${e}?token=${encodeURIComponent(r)}`;function DC({supabase:e,canEdit:r,onClose:a,onNavigate:n}){const[s,i]=y.useState(null),[c,o]=y.useState(!0),[l,d]=y.useState(null),[u,h]=y.useState(null),[f,m]=y.useState(!1),x=y.useRef(null),p=y.useRef(null);y.useEffect(()=>{var j;(j=x.current)==null||j.focus();const b=k=>{if(k.key==="Escape"&&a(),k.key==="Tab"&&p.current){const N=p.current.querySelectorAll("button,a,input,select,textarea,[tabindex]:not([tabindex='-1'])");if(!N.length)return;const C=N[0],P=N[N.length-1];k.shiftKey&&document.activeElement===C?(k.preventDefault(),P.focus()):!k.shiftKey&&document.activeElement===P&&(k.preventDefault(),C.focus())}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)}
589,[a]),y.useEffect(()=>{(async()=>{const b=await e.from("sbh_smart_cards").select("display_name,business_name,title,phone,email,website,qr_token,is_published,token_revoked_at").eq("profile_type","work").is("profile_name",null).maybeSingle();i(b.data),o(!1)})()},[e]);const g=s!=null&&s.is_published&&s.qr_token&&!s.token_revoked_at?`${window.location.origin}/card/${s.qr_token}`:null;y.useEffect(()=>{if(!g){h(null);return}_f.toDataURL(g,{width:300,margin:2,errorCorrectionLevel:"M"}).then(h).catch(()=>h(null))},[g]);async function w(){g&&(navigator.share?await navigator.share({title:(s==null?void 0:s.display_name)||"SBH Smart Card",url:g}):(await navigator.clipboard.writeText(g),d("Smart Card link copied.")))}async function S(){g&&(await navigator.clipboard.writeText(g),d("Smart Card link copied."))}return t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"smart-card-backdrop",type:"button","aria-label":"Close Smart Card",onClick:a}),t.jsxs("aside",{className:`smart-card-drawer${f?" expanded":""}`,ref:p,role:"dialog","aria-modal":"true","aria-labelledby":"smart-card-drawer-title",children:[t.jsxs("header",{className:"smart-card-drawer-header",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Identity profile"}),t.jsx("h2",{id:"smart-card-drawer-title",children:"SBH Smart Card"})]}),t.jsx("button",{ref:x,className:"icon-button drawer-close",type:"button",onClick:a,"aria-label":"Close Smart Card",children:t.jsx(gt,{})})]}),c?t.jsx("p",{className:"muted",children:"Loading your Smart Cardâ¦"}):s?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"smart-card-type-selector",children:["Card type",t.jsxs("select",{defaultValue:"work","aria-label":"Smart Card type",children:[t.jsx("option",{value:"work",children:"Work card"}),t.jsx("option",{value:"personal",disabled:!0,children:"Personal card â coming soon"}),t.jsx("option",{value:"event",disabled:!0,children:"Event card â coming soon"})]})]}),t.jsxs("div",{className:"drawer-card-preview",children:[t.jsxs("div",{className:"drawer-card-mark",children:["SBH ",t.jsx("span",{children:"SmartBizHelper"})]}),t.jsx("strong",{children:s.display_name||"Your name"}),t.jsx("span",{children:s.title||"Your title"}),t.jsx("b",{children:s.business_name||"Your business"}),s.is_published?t.jsx("em",{children:"Published"}):t.jsx("em",{className:"private",children:"Private"})]}),g?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"drawer-qr",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Ready to share"}),t.jsx("p",{className:"muted",children:"Present your card or let someone scan the QR code."})]}),u&&t.jsx("img",{src:u,alt:"QR code for SBH Smart Card"})]}),t.jsxs("div",{className:"smart-card-drawer-actions smart-card-primary-actions",children:[t.jsxs("button",{className:"primary-inline",onClick:()=>void w(),children:[t.jsx(go,{size:16})," Share"]}),t.jsxs("a",{className:"secondary-button",href:PC("/vcard",s.qr_token??""),children:[t.jsx(Os,{size:16})," Download / Save"]})]}),t.jsxs("div",{className:"smart-card-drawer-actions smart-card-secondary-actions",children:[t.jsxs("button",{className:"secondary-button",onClick:()=>void S(),children:[t.jsx(Hu,{size:16})," Copy link"]}),t.jsxs("a",{className:"secondary-button",href:g,target:"_blank",rel:"noreferrer",children:[t.jsx(Tt,{size:16})," Open card"]})]})]}):t.jsxs("div",{className:"smart-card-drawer-empty",children:[t.jsx(En,{size:30}),t.jsx("h3",{children:"Private by default"}),t.jsx("p",{children:"Publish the work card to activate its public link and QR code."})]}),t.jsxs("button",{className:"smart-card-expand-toggle",type:"button","aria-expanded":f,onClick:()=>m(b=>!b),children:[f?"Show presentation only":"More card tools",t.jsx("span",{"aria-hidden":"true",children:f?"â":"â"})]}),f&&t.jsxs("section",{className:"smart-card-expanded-tools","aria-label":"Additional Smart Card tools",children:[t.jsxs("div",{children:[t.jsx("h3",{children:"Manage your identity card"}),t.jsx("p",{className:"muted",children:"Editing and relationship tools stay here so the card remains ready to present."})]}),t.jsxs("div",{className:"smart-card-drawer-actions",children:[t.jsxs("button",{className:"secondary-button",onClick:()=>n("smart-card"),disabled:!r,children:[t.jsx(Wc,{size:16})," Edit Smart Card"]}),t.jsxs("button",{className:"secondary-button",onClick:()=>n("contacts"),children:[t.jsx(na,{size:16})," Recent connections"]})]}),t.jsxs("div",{className:"smart-card-secondary-info",children:[t.jsx("strong",{children:"Card statistics"}),t.jsx("span",{children:"Sharing statistics will appear here as card analytics are enabled."})]})]})]}):t.jsxs("div",{className:"smart-card-drawer-empty",children:[t.jsx(En,{size:38}),t.jsx("h3",{children:"Create your work card"}),t.jsx("p",{children:"Your Smart Card is private until you choose to publish it."}),r?t.jsxs("button",{className:"primary-inline",onClick:()=>n("smart-card"),children:[t.jsx(Wc,{size:16})," Open editor"]}):t.jsx("p",{className:"muted",children:"Your workspace owner manages this card."})]}),l&&t.jsx("div",{className:"success-box",role:"status",children:l}),t.jsxs("p",{className:"drawer-security-note",children:[t.jsx(Xu,{size:15})," Private fields never appear before publication."]})]})]})}function Su(e){if(!e)return"Date pending";const r=new Date(e);return Number.isNaN(r.getTime())?"Date pending":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(r)}function Nu(e,r){return(e==null?void 0:e.trim())||r}function Cu({supabase:e,marketplaceAvailable:r,onOpenWallet:a,onOpenMarketplace:n,onOpenEvents:s,onOpenOpportunities:i}){const c=th(e),[o,l]=y.useState(void 0);y.useEffect(()=>{let f=!0;return l(void 0),e.rpc("portal_get_my_plan_wallet").then(m=>{var p,g;if(!f)return;const x=Number((g=(p=m.data)==null?void 0:p.wallet)==null?void 0:g.balance);l(!m.error&&Number.isFinite(x)?x:null)}),()=>{f=!1}},[e]);const d=c.error?c.error.replace(/^Some Lobby sections could not be loaded:\s*/i,"").replace(/\.$/,"").split(", ").filter(
589Boolean):[],u=d.some(f=>f.toLowerCase()==="marketplace"),h=d.filter(f=>f.toLowerCase()!=="marketplace");return t.jsxs("aside",{className:"lobby-intelligence-rail","aria-label":"Lobby intelligence","aria-busy":c.loading,children:[t.jsxs("section",{className:"lobby-rail-card lobby-glance-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"At a Glance"}),t.jsx(tt,{size:18})]}),t.jsx("div",{className:"lobby-glance-list",children:t.jsxs("button",{className:"lobby-wallet-row",type:"button",onClick:a,"aria-label":"Open Smart Wallet",children:[t.jsx("i",{className:"lobby-rail-icon credits",children:t.jsx(ur,{size:16})}),t.jsxs("span",{children:[t.jsx("b",{children:"Smart Wallet"}),t.jsx("small",{children:o===null?"Balance unavailable":"Available Smart Credits"})]}),t.jsx("strong",{className:"lobby-glance-value",children:o===void 0?"â¦":o===null?"â":o.toLocaleString()}),t.jsx(zt,{size:15,"aria-hidden":"true"})]})})]}),t.jsxs("section",{className:"lobby-rail-card lobby-marketplace-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Bizz2Bizz BarterPlace"}),t.jsxs("button",{className:"lobby-rail-heading-action",type:"button",onClick:n,disabled:!r,"aria-label":"Open Bizz2Bizz BarterPlace",children:["View all ",t.jsx(zt,{size:14})]})]}),u?t.jsxs("div",{className:"lobby-marketplace-unavailable",children:[t.jsx(ha,{size:18}),t.jsx("span",{children:"BarterPlace listings could not be loaded."}),t.jsx("button",{type:"button",onClick:c.reload,children:"Try again"})]}):c.listings.length?t.jsx("div",{className:"lobby-rail-list",children:c.listings.slice(0,3).map((f,m)=>t.jsxs("article",{className:"lobby-rail-simple-row",children:[t.jsx("i",{className:"lobby-rail-icon marketplace",children:t.jsx(ha,{size:15})}),t.jsxs("div",{children:[t.jsx("strong",{children:Nu(f.title,"Published trade listing")}),t.jsx("span",{children:f.business_name||"SmartBizHelper business"})]})]},String(f.listing_id??m)))}):t.jsxs("button",{className:"lobby-marketplace-empty",type:"button",onClick:n,disabled:!r,children:[t.jsx(ha,{size:18}),t.jsxs("span",{children:[t.jsx("b",{children:"Bizz2Bizz BarterPlace"}),t.jsx("small",{children:r?"Discover free business trade listings":"Access required"})]}),t.jsx(zt,{size:15})]})]}),h.length>0&&t.jsxs("div",{className:"lobby-rail-status",role:"status",children:[t.jsx("span",{children:`Some Lobby sections could not be loaded: ${h.join(", ")}.`}),t.jsx("button",{type:"button",onClick:c.reload,children:"Try again"})]}),c.loading?t.jsxs("div",{className:"lobby-rail-loading",children:[t.jsx(gr,{className:"spin"}),t.jsx("span",{children:"Loading Lobby intelligenceâ¦"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Featured Now"}),t.jsx(tt,{size:18})]}),c.featuredItems.length?t.jsx("div",{className:"lobby-rail-list",children:c.featuredItems.map(f=>t.jsxs("article",{className:"lobby-rail-simple-row",children:[t.jsx("i",{className:"lobby-rail-icon businesses",children:t.jsx(tt,{size:15})}),t.jsxs("div",{children:[t.jsx("strong",{children:f.title}),t.jsxs("span",{children:[f.kind," · ",f.meta]})]})]},f.id))}):t.jsx("p",{className:"lobby-rail-empty",children:"Featured placements will appear when eligible."})]}),t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Upcoming Events"}),t.jsxs("button",{className:"lobby-rail-heading-action",type:"button",onClick:s,"aria-label":"Open Events section",children:["View all ",t.jsx(zt,{size:14})]})]}),c.events.length?t.jsx("div",{className:"lobby-rail-list",children:c.events.slice(0,3).map(f=>t.jsxs("article",{className:"lobby-rail-row",children:[t.jsxs("div",{className:"lobby-date-tile",children:[t.jsx("strong",{children:Su(f.starts_at).split(" ")[0]}),t.jsx("b",{children:new Date(f.starts_at).getDate()})]}),t.jsxs("div",{children:[t.jsx("strong",{children:f.title}),t.jsx("span",{children:f.location_text||f.host_business_name||"Community event"})]})]},f.id))}):t.jsx("p",{className:"lobby-rail-empty",children:"No published events are available yet."})]}),t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Opportunities"}),t.jsxs("button",{className:"lobby-rail-heading-action",type:"button",onClick:i,"aria-label":"Open Opportunities",children:["View all ",t.jsx(zt,{size:14})]})]}),c.opportunities.length?t.jsx("div",{className:"lobby-rail-list",children:c.opportunities.slice(0,3).map(f=>t.jsxs("article",{className:"lobby-rail-simple-row",children:[t.jsx("i",{className:"lobby-rail-icon grants",children:t.jsx(fr,{size:15})}),t.jsxs("div",{children:[t.jsx("strong",{children:f.title}),t.jsxs("span",{children:[f.publisher||"Official source"," · ",Su(f.deadline_at)]}),t.jsx("small",{children:f.review_status==="verified"&&f.last_verified_at?"Verified":"Source-linked lead"})]})]},f.id))}):t.jsx("p",{className:"lobby-rail-empty",children:"No reviewed opportunities are published right now."})]}),t.jsxs("section",{className:"lobby-rail-card",children:[t.jsxs("div",{className:"lobby-rail-heading",children:[t.jsx("h2",{children:"Featured Businesses"}),t.jsx(na,{size:18})]}),c.businesses.length?t.jsx("div",{className:"lobby-rail-list",children:c.businesses.slice(0,3).map((f,m)=>t.jsxs("article",{className:"lobby-rail-simple-row",children:[t.jsx("i",{className:"lobby-rail-icon businesses",children:t.jsx(na,{size:15})}),t.jsxs("div",{children:[t.jsx("strong",{children:Nu(f.business_name??f.name,"Published business")}),t.jsx("span",{children:f.category||"Community member"})]})]},String(f.client_id??f.business_id??m)))}):t.jsx("p",{className:"lobby-rail-empty",children:"No published businesses are available."})]})]})]})}
589const RC=[{id:"lobby",label:"The Lobby",icon:zn},{id:"workspace",label:"Workspace",icon:Xr},{id:"directory",label:"Business Directory",icon:dr},{id:"messages",label:"Bizz2Bizz Connect",icon:Dn},{id:"web-design",label:"Smart Websites",icon:Di},{id:"smart-content",label:"Smart Content",icon:Ls},{id:"smart-finance",label:"Smart Finance",icon:Bi},{id:"inventory",label:"Smart Inventory",icon:Xr,entitlement:"suite:smart_inventory"},{id:"scanner",label:"Smart Scanner",icon:xa},{id:"sku",label:"Smart SKU Creator",icon:xa,entitlement:"suite:smart_sku",requiresRole:["owner","admin","manager"]},{id:"contacts",label:"Smart CRM",icon:Rs,requiresRole:["owner","admin","manager","staff","viewer"]},{id:"lobby",label:"Smart Sims",icon:Or,status:"soon"},{id:"reports",label:"Reports",icon:Rr},{id:"settings",label:"Settings",icon:ho}];function OC(e,r){return e.status==="soon"?"Coming Soon":e.status==="preview"||e.entitlement&&!r.has(e.entitlement)?"Preview":null}function LC({children:e,supabase:r,session:a,identity:n,companyName:s,businessLogoUrl:i,activePage:c,grantedEntitlements:o,onNavigate:l,onOpenSmartCard:d,smartCardLauncherRef:u,onSignOut:h}){const[f,m]=y.useState(!1),[x,p]=y.useState(!1),g=Ju(r),w=n.clientId===0&&n.role==="unknown";if(!r)return t.jsx(t.Fragment,{children:e});const S=b=>{b.status||b.entitlement&&!o.has(b.entitlement)||(m(!1),l(b.id))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"lobby-shell-dedicated",children:[t.jsxs("aside",{className:f?"lobby-sidebar open":"lobby-sidebar","aria-label":"SmartBizHelper Lobby navigation",children:[t.jsxs("div",{className:"lobby-sidebar-brand",children:[t.jsx("img",{src:Bs,alt:"SmartBizHelper"}),t.jsx("button",{type:"button",className:"icon-button lobby-sidebar-close",onClick:()=>m(!1),"aria-label":"Close Lobby navigation",children:t.jsx(gt,{})})]}),t.jsx("nav",{children:RC.filter(b=>!b.requiresRole||w||b.requiresRole.includes(n.role)).map(b=>
589{const j=b.icon,k=OC(b,o),N=!k&&(b.id===c||b.id==="grant-watch"&&c==="events");return t.jsxs("button",{type:"button",className:`lobby-sidebar-link${N?" active":""}${k?" unavailable":""}`,onClick:()=>S(b),"aria-current":N?"page":void 0,"aria-disabled":!!k,title:k?`${b.label} â ${k}`:b.label,children:[t.jsx(j,{size:19}),t.jsx("span",{children:b.label}),k?t.jsx("small",{children:k}):t.jsx(zt,{size:14})]},b.label)})}),t.jsxs("section",{className:"lobby-ness-card","aria-labelledby":"lobby-ness-title","aria-busy":g.loading,children:[g.url?t.jsx("img",{src:g.url,alt:"Ness, the SmartBizHelper guide"}):t.jsx("div",{className:"lobby-ness-placeholder","aria-hidden":"true",children:"N"}),t.jsxs("div",{children:[t.jsx("strong",{id:"lobby-ness-title",children:"Need a hand?"}),t.jsx("p",{children:g.error||"Ness is here to help you find your next move."}),t.jsx("button",{type:"button",onClick:()=>l("messages"),children:"Ask Ness"})]})]}),t.jsxs("div",{className:"lobby-sidebar-footer",children:[t.jsxs("div",{className:"lobby-sidebar-account",children:[t.jsx("span",{children:n.fullName||s}),t.jsx("button",{type:"button",onClick:h,children:"Sign out"})]}),t.jsx(Ra,{className:"portal-ownership-footer-sidebar"})]})]}),f&&t.jsx("button",{className:"lobby-shell-scrim",type:"button","aria-label":"Close Lobby navigation",onClick:()=>m(!1)})]}),t.jsxs("div",{className:"main-shell lobby-dedicated-main",children:[t.jsx(Tf,{session:a,identity:n,companyName:s,businessLogoUrl:i,onNavigate:l,onOpenSmartCard:d,smartCardLauncherRef:u,onOpenDiscover:()=>p(!0),onOpenLobbyNavigation:()=>m(!0)}),t.jsx("main",{className:"content lobby-main-content",children:t.jsxs("div",{className:"lobby-columns",children:[t.jsxs("button",{className:"lobby-mobile-intelligence",type:"button",onClick:()=>p(!0),"aria-expanded":x,"aria-controls":"lobby-mobile-intelligence-drawer",children:[t.jsx(fo,{size:18}),t.jsxs("span",{children:[t.jsx("strong",{children:"Lobby intelligence"}),t.jsx("small",{children:"Events, opportunities, businesses, and marketplace highlights"})]}),t.jsx(zt,{size:16,"aria-hidden":"true"})]}),t.jsx("section",{className:"lobby-center-column",children:e}),t.jsx(Cu,{supabase:r,marketplaceAvailable:!0,onOpenWallet:()=>l("plan"),onOpenMarketplace:()=>l("marketplace"),onOpenEvents:()=>l("events"),onOpenOpportunities:()=>l("grant-watch")})]})})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"smart-card-backdrop",type:"button","aria-label":"Close Lobby intelligence",onClick:()=>p(!1)}),t.jsxs("aside",{id:"lobby-mobile-intelligence-drawer",className:"discover-drawer","aria-label":"Lobby intelligence",children:[t.jsxs("header",{children:[t.jsx("h2",{children:"Lobby intelligence"}),t.jsx("button",{className:"icon-button",type:"button",onClick:()=>p(!1),"aria-label":"Close Lobby intelligence",children:t.jsx(gt,{})})]}),t.jsx(Cu,{supabase:r,marketplaceAvailable:!0,onOpenWallet:()=>{p(!1),l("plan")},onOpenMarketplace:()=>{p(!1),l("marketplace")},onOpenEvents:()=>{p(!1),l("events")},onOpenOpportunities:()=>{p(!1),l("grant-watch")}})]})]})]})}function BC({supabase:e,identity:r}){const[a,n]=y.useState([]),[s,i]=y.useState(!1),[c,o]=y.useState(null);return y.useRef(null),null}function Pi({message:e="Preparing your secure workspace"}){return t.jsx("main",{className:"portal-boot","aria-live":"polite","aria-busy":"true",children:t.jsxs("section",{className:"portal-boot-card",children:[t.jsx("img",{src:"/sbh-logo.png",alt:"SmartBizHelper"}),t.jsxs("span",{className:"portal-boot-mark","aria-hidden":"true",children:[t.jsx("i",{}),t.jsx("i",{}),t.jsx("i",{})]}),t.jsx("p",{children:e}),t.jsx("small",{children:"Your business. Our purpose."})]})})}const oo="SmartBizHelper",Eu="SmartBizHelper authenticator";function MC(e,r){try{const a=new URL(e);if(a.protocol!=="otpauth:"||a.hostname!=="totp")return!1;const n=decodeURIComponent(a.pathname.replace(/^\//,"")),s=n.indexOf(":");if(s<0)return!1;const i=n.slice(0,s),c=n.slice(s+1);return a.searchParams.get("issuer")===oo&&i===oo&&c.toLowerCase()===r.trim().toLowerCase()}catch{return!1}}function zC(e,r){return r||["owner","admin","staff"].includes((e??"").toLowerCase())}function UC({supabase:e,session:r,children:a,onSignOut:n}){const[s,i]=y.useState("loading"),[c,o]=y.useState(!1),[l,d]=y.useState(null),[u,h]=y.useState(null),[f,m]=y.useState(null),[x,p]=y.useState(""),[g,w]=y.useState(null),[S,b]=y.useState(!1),j=y.useRef(!1),k=y.useRef(null);async function N(){var ue,te,fe,q,J;w(null);const T=((ue=r.user.app_metadata)==null?void 0:ue.sbh_admin)===!0,L=T?{data:{role:"platform_admin"},error:null}:await e.rpc("portal_get_my_profile_worldwide");if(L.error||!L.data){i("blocked"),w("Secure account policy could not be confirmed. Access stays closed until your workspace identity is available.");return}const M=zC(String(L.data.role??""),T);o(M);const E=await e.auth.mfa.getAuthenticatorAssuranceLevel();if(E.error){i("blocked"),w("Secure sign-in assurance could not be confirmed.");return}const W=await e.auth.mfa.listFactors();if(W.error){i("blocked"),w("Authenticator status could not be loaded. Access stays closed until it can be verified.");return}const ee=(((te=W.data)==null?void 0:te.totp)??[]).find(le=>le.status==="verified")??null;if(d(ee),E.data.currentLevel==="aal2"){i("optional");return}if(!ee){if(!M){i("optional");return}const le=(fe=r.user.email)==null?void 0:fe.trim();if(!le){i("blocked"),w("Authenticator enrollment requires an email identifier on this account.");return}if(j.current)return;j.current=!0;const A=await e.auth.mfa.enroll({factorType:"totp",friendlyName:Eu,issuer:oo});if(j.current=!1,A.error||!A.data){i("blocked"),w(((q=A.error)==null?void 0:q.message)??"Authenticator enrollment could not start.");return}if(!MC(A.data.totp.uri,le)){const V=await e.auth.mfa.unenroll({factorId:A.data.id});i("blocked"),w(V.error?"Authenticator enrollment branding could not be verified, and its unverified factor could not be removed. Sign out and contact support.":"Authenticator enrollment branding could not be verified. No factor was enrolled.");return}d({id:A.data.id,factor_type:"totp",status:"unverified",friendly_name:Eu}),h(A.data.totp.qr_code),i("setup");return}const ce=await e.auth.mfa.challenge({factorId:ee.id});if(ce.error||!ce.data){i("blocked"),w(((J=ce.error)==null?void 0:J.message)??"Authenticator challenge could not start.");return}m(ce.data.id),i("challenge")}y.useEffect(()=>{k.current!==r.user.id&&(k.current=r.user.id,N())},[r.user.id]);async function C(){var M;if(!l||!x.trim())return;b(!0),w(null);let T=f;if(!T){const E=await e.auth.mfa.challenge({factorId:l.id});if(E.error||!E.data){b(!1),w(((M=E.error)==null?void 0:M.message)??"Authenticator challenge could not start.");return}T=E.data.id,m(T)}const L=await e.auth.mfa.verify({factorId:l.id,challengeId:T,code:x.trim()});if(b(!1),L.error){w("That authenticator code was not accepted. Check the time on your device and try again.");return}p(""),h(null),i("optional")}async function P(){await C()}return s==="optional"?t.jsx(t.Fragment,{children:a}):s==="loading"?t.jsx(Pi,{message:"Confirming your account protection"}):t.jsx("main",{className:"mfa-shell",children:t.jsxs("section",{className:"mfa-card","aria-live":"polite",children:[t.jsx("p",{className:"eyebrow",children:c?"Required security step":"Authenticator setup"}),t.jsx("h1",{children:s==="setup"?"Protect this account":s==="challenge"?"Enter your authenticator code":"Secure sign-in unavailable"}),s==="setup"?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"muted",children:"Admin and staff access requires a TOTP authenticator before entering the Portal. Scan this QR code with your authenticator app, then enter the six-digit code."}),u&&t.jsx("img",{className:"mfa-qr",src:u,alt:"QR code for SmartBizHelper authenticator enrollment"}),t.jsxs("label",{className:"mfa-code-field",children:["Authenticator code",t.jsx("input",{inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]*",maxLength:6,value:x,onChange:T=>p(T.target.value.replace(/\D/g,""))})]}),t.jsx("button",{className:"primary-button",disabled:S||x.length<6,onClick:()=>void P(),children:S?"Verifyingâ¦":"Verify and continue"})]}):s==="challenge"?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"muted",children:"Confirm the code from your enrolled authenticator app to continue."}),t.jsxs("label",{className:"mfa-code-field",children:["Authenticator code",t.jsx("input",{autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]*",maxLength:6,value:x,onChange:T=>p(T.target.value.replace(/\D/g,"")),onKeyDown:T=>{T.key==="Enter"&&C()}})]}),t.jsx("button",{className:"primary-button",disabled:S||x.length<6,onClick:()=>void C(),children:S?"Verifyingâ¦":"Verify and continue"})]}):t.jsx("p",{className:"error-box",children:g??"Access is unavailable."}),g&&s!=="blocked"&&t.jsx("p",{className:"error-box",children:g}),t.jsxs("div",{className:"mfa-recovery",children:[t.jsx("strong",{children:"Need recovery?"}),t.jsx("p",{children:"Do not share or store authenticator secrets. Sign out and use the approved password-reset flow, or contact your workspace administrator for Supabase Auth factor recovery."})]}),t.jsx("button",{className:"text-button",onClick:()=>void n(),children:"Sign out"})]})})}function HC(){var a;const e=(a=new URLSearchParams(window.location.search).get("invite"))==null?void 0:a.trim(),r
589=new URL("/onboarding.html",Hf);return e?r.searchParams.set("invite",e):r.searchParams.set("persona","employee"),r.toString()}function WC({supabase:e,session:r,children:a,onSignOut:n}){var h;const s=((h=r.user.app_metadata)==null?void 0:h.sbh_admin)===!0,[i,c]=y.useState(0),[o,l]=y.useState(s?{mode:"ready"}:{mode:"checking"}),d=y.useMemo(()=>!!zf(),[r.user.id,i]);if(y.useEffect(()=>{if(s){l({mode:"ready"});return}let f=!0;return l({mode:"checking"}),Uf({supabase:e,userId:r.user.id,userEmail:r.user.email,getProfile:async m=>{const{data:x,error:p}=await m.rpc("portal_get_my_profile_worldwide");return{data:x,error:p}},preview:Wf,accept:Vf,getProvisioningState:async(m,x)=>{const{data:p,error:g}=await m.rpc("portal_verify_my_invitation_provisioning",{p_token:x});return{data:p,error:g}}}).then(m=>{f&&l(m.status==="ready"?{mode:"ready"}:{mode:"finish",reason:m.reason})}).catch(m=>{f&&l({mode:"error",message:m instanceof Error?m.message:"Invitation setup could not be completed."})}),()=>{f=!1}},[e,r.user.id,r.user.email,s,i]),o.mode==="ready")return t.jsx(t.Fragment,{children:a});if(o.mode==="checking")return t.jsx(Pi,{message:"Confirming your Workspace invitation"});const u=o.mode==="finish"&&o.reason==="identity_mismatch";return t.jsx("main",{className:"mfa-shell",children:t.jsxs("section",{className:"mfa-card","aria-live":"polite",children:[t.jsx("p",{className:"eyebrow",children:"Invitation and Workspace access"}),t.jsx("h1",{children:"Finish invitation setup"}),o.mode==="error"?t.jsxs("div",{className:"error-box",children:[t.jsx(Ou,{size:20}),t.jsx("span",{children:o.message})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"muted",children:"Your confirmed account is secure, but its Workspace invitation has not finished connecting yet. Access remains closed until the invitation is revalidated and provisioned."}),t.jsxs("div",{className:"mfa-recovery",children:[t.jsxs("strong",{children:[t.jsx(tt,{size:16})," Server-verified access"]}),t.jsx("p",{children:"Tenant, location, role, and permissions will be read only from the pending employer invitation."})]}),u&&t.jsx("p",{className:"error-box",children:"This browserâs saved invitation belongs to a different signed-in email. Sign out, then use the email address that received the invitation."})]}),t.jsxs("a",{className:"primary-button invitation-finish-link",href:HC(),children:[t.jsx(Ru,{size:18}),d?"Resume invitation setup":"Open invitation setup",t.jsx(Mt,{size:18})]}),o.mode==="error"&&t.jsxs("button",{className:"text-button invitation-retry",type:"button",onClick:()=>c(f=>f+1),children:[t.jsx(St,{size:16})," Retry secure setup"]}),t.jsxs("button",{className:"text-button",type:"button",onClick:()=>void n(),children:[t.jsx(Gu,{size:16})," Sign out / switch account"]})]})})}function zc({title:e="Not open yet"}){return t.jsx("main",{className:"controlled-beta-notice",children:t.jsxs("section",{children:[t.jsx("span",{children:t.jsx(Dr,{size:22})}),t.jsx("h1",{children:e}),t.jsx("p",{children:Lu}),t.jsx("a",{href:"/",children:"Return home"})]})})}const pt=Mi(),VC=new Set(["[email protected]","[email protected]"]);function Af(e){var r;return VC.has((e.user.email??"").toLowerCase())&&((r=e.user.app_metadata)==null?void 0:r.sbh_admin)===!0}function qC(){const[e,r]=y.useState(Iu),[a,n]=y.useState(!1);return y.useEffect(()=>{let s=!0;return Pu(pt).then(i=>{s&&(r(i),n(!0))}),()=>{s=!1}},[]),{access:e,loaded:a}}function Tu(){return hm()}function $C(){const e=window.location.pathname.match(/^\/card\/([a-f0-9]{64})$/i),r=new URLSearchParams(window.location.search).get("card");return(e==null?void 0:e[1])??(r&&/^[a-f0-9]{64}$/i.test(r)?r:null)}function GC(){const e=window.location.pathname.replace(/\/+$/,"")||"/";if(e==="/data-deletion")return t.jsx(LN,{});const r={"/terms":"terms","/privacy":"privacy","/acceptable-use":"acceptable-use","/refunds":"refunds","/ai-disclosure":"ai-disclosure"};if(e==="/help")return t.jsx(RN,{});if(e==="/status")return t.jsx(TN,{});if(e==="/developers")return t.jsx(FN,{});const a=r[e];return a?t.jsx(DN,{kind:a}):null}function cl({children:e}){return t.jsxs("main",{className:"login-shell",children:[t.jsxs("section",{className:"login-brand-panel","aria-label":"SmartBizHelper welcome",children:[t.jsxs("div",{className:"login-brand-intro",children:[t.jsx("img",{src:Bs,alt:"SmartBizHelper.AI",className:"login-brand-logo"}),t.jsx("p",{className:"login-brand-eyebrow",children:"Your business. Your next move."}),t.jsx("h2",{children:"Run your business with confidence."}),t.jsx("p",{children:"One secure home for your tools, community, and next best move."})]}),t.jsxs("div",{className:"login-ness-wrap",children:[t.jsx("span",{children:"Meet Ness, your SmartBizHelper guide."}),t.jsx("img",{src:Pp,alt:"Ness waving hello"})]})]}),t.jsxs("section",{className:"login-card",children:[e,t.jsx(Ra,{className:"auth-ownership-footer"})]})]})}function XC({onSession:e,onForgotPassword:r}){const[a,n]=y.useState(""),[s,i]=y.useState(""),[c,o]=y.useState(null),[l,d]=y.useState(!1);async function u(h){if(h.preventDefault(),o(null),!pt)return o("Portal environment variables are not configured.");d(!0);const{data:f,error:m}=await pt.auth.signInWithPassword({email:a,password:s});
589if(d(!1),m||!f.session)return o((m==null?void 0:m.message)??"Unable to sign in.");e(f.session)}return t.jsxs(cl,{children:[t.jsx("a",{className:"login-back",href:"/",children:"â SmartBizHelper"}),t.jsx("h1",{children:"Welcome back"}),t.jsx("p",{className:"muted",children:"Sign in to run your business workspace."}),t.jsxs("form",{onSubmit:u,children:[t.jsx("label",{children:"Email"}),t.jsx("input",{type:"email",value:a,onChange:h=>n(h.target.value),autoComplete:"email",required:!0}),t.jsx("label",{children:"Password"}),t.jsx(Uc,{value:s,onChange:h=>i(h.target.value),autoComplete:"current-password",required:!0}),c&&t.jsx("div",{className:"error-box",children:c}),t.jsx("button",{className:"primary-button",disabled:l,children:l?"Signing inâ¦":"Sign in"}),t.jsx("button",{type:"button",className:"text-button",onClick:r,children:"Forgot password?"})]}),t.jsxs("div",{className:"guest-entry",children:[t.jsx("span",{children:"or"}),t.jsx("a",{href:"/?guest=1",children:"Explore as Guest"}),t.jsx("small",{children:"Read-only access to intentionally public SmartBizHelper content."})]})]})}function KC({onBack:e}){const[r,a]=y.useState(""),[n,s]=y.useState(null),[i,c]=y.useState(null);async function o(l){if(l.preventDefault(),!pt)return c("Portal environment variables are not configured.");const{error:d}=await pt.auth.resetPasswordForEmail(r,{redirectTo:`${window.location.origin}/`});if(d)return c(d.message);s("Check your email for a secure password reset link.")}return t.jsxs(cl,{children:[t.jsx("h1",{children:"Reset your password"}),t.jsxs("form",{onSubmit:o,children:[t.jsx("label",{children:"Email"}),t.jsx("input",{type:"email",value:r,onChange:l=>a(l.target.value),required:!0}),i&&t.jsx("div",{className:"error-box",children:i}),n&&t.jsx("div",{className:"success-box",children:n}),t.jsx("button",{className:"primary-button",children:"Send reset link"}),t.jsx("button",{type:"button",className:"secondary-button",onClick:e,children:"Back to sign in"})]})]})}function YC({onComplete:e}){const[r,a]=y.useState(""),[n,s]=y.useState(""),[i,c]=y.useState(null);async function o(l){if(l.preventDefault(),r.length<8)return c("Password must be at least 8 characters.");if(r!==n)return c("Passwords do not match.");const{error:d}=await pt.auth.updateUser({password:r});if(d)return c(d.message);e()}return t.jsxs(cl,{children:[t.jsx("h1",{children:"Create a new password"}),t.jsxs("form",{onSubmit:o,children:[t.jsx("label",{children:"New password"}),t.jsx(Uc,{value:r,onChange:l=>a(l.target.value),autoComplete:"new-password",required:!0}),t.jsx("label",{children:"Confirm password"}),t.jsx(Uc,{value:n,onChange:l=>s(l.target.value),autoComplete:"new-password",required:!0}),i&&t.jsx("div",{className:"error-box",children:i}),t.jsx("button",{className:"primary-button",children:"Update password"})]})]})}function da(e){return String(e.status??e.inventory_status??"untracked").toLowerCase()}function lo(e){return String(e.item_name??e.name??"Inventory item")}function Ar(e){const r=Number(e);return Number.isFinite(r)?r:0}function wn(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(Ar(e))}function Ur({label:e,value:r,detail:a,icon:n,tone:s=""}){return t.jsxs("article",{className:`metric-card ${s}`,children:[t.jsx("div",{className:"metric-icon",children:t.jsx(n,{size:24})}),t.jsx("p",{children:e}),t.jsx("strong",{children:r===null?"â":typeof r=="number"?r.toLocaleString():r}),t.jsx("span",{children:a})]})}function Na({icon:e,title:r,copy:a}){return t.jsxs("div",{className:"empty-state",children:[t.jsx(e,{size:30}),t.jsx("h3",{children:r}),t.jsx("p",{children:a})]})}function JC({data:e,navigate:r,websiteUrl:a}){var k,N,C,P;const{supabase:n,identity:s,permissions:i}=Hn(),c=y.useMemo(()=>{const T=e.inventoryRows.filter(W=>da(W).includes("out")).length,L=e.inventoryRows.filter(W=>da(W).includes("low")).length,M=e.inventoryRows.filter(W=>Ar(W.buy_qty??W.reorder_qty)>0||["out","low"].some(ee=>da(W).includes(ee))).length,E=Math.max((e.inventoryCount??e.inventoryRows.length)-T-L,0);return{out:T,low:L,buy:M,healthy:E}},[e]),o=e.inventoryRows.filter(T=>
589/out|low|untracked/.test(da(T))).slice(0,6),l=e.salesSummary,d=(l==null?void 0:l.status)==="synced"?l:null,u=d?wn(d.net_sales??d.gross_revenue):"Not synced yet",h=d?`${Ar(d.ticket_count).toLocaleString()} tickets · Avg ${wn(d.average_ticket)}`:"No current-day record for this location",f=e.forecastSummary,m=(f==null?void 0:f.status)==="waiting_for_inventory_data"?"â":(f==null?void 0:f.alert_count)??"â",x=Math.round(Ar(f==null?void 0:f.confidence_score)*100),p=f?f.status==="waiting_for_inventory_data"?"Waiting for enough inventory history":`${Ar(f.urgent_count)} urgent · ${x}% confidence`:"Forecast data unavailable",g=e.workspaceIntelligence,w=((g==null?void 0:g.sales_trend)??[]).slice(-5).reverse(),S=Ar(g==null?void 0:g.forecast_observation_days),b=Math.round(Ar(g==null?void 0:g.forecast_confidence_score)*100),j=[["sync","Sync Inventory",St],["sku","Add Item / Smart SKU",xa],["inventory","Adjust Stock",Xa],["items","Update PAR Levels",ta],["purchase","View Purchase Plan",en],["training","Training & SOPs",Pr]];return s.role==="team_member"?t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"page-heading",children:[t.jsx("p",{className:"eyebrow",children:"Team Member workspace"}),t.jsx("h1",{children:"Inventory"}),t.jsx("p",{className:"muted",children:"Only inventory assigned to your authorized location is shown."})]}),t.jsxs("section",{className:"metric-grid",children:[t.jsx(Ur,{label:"Inventory items",value:e.inventoryCount,detail:"Assigned location only",icon:Hr}),t.jsx(Ur,{label:"Needs attention",value:c.out+c.low,detail:`${c.out} out · ${c.low} low`,icon:Xr}),t.jsx(Ur,{label:"Healthy",value:c.healthy,detail:"Current assigned-location stock",icon:Kr})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Inventory work"}),t.jsx("p",{className:"muted",children:"View authorized stock and its change history."})]})}),t.jsxs("button",{className:"quick-action",type:"button",onClick:()=>r("inventory"),children:[i.granted.has("inventory.adjust")?"View and adjust inventory":"View inventory",t.jsx(zt,{size:17})]}),t.jsxs("button",{className:"quick-action",type:"button",onClick:()=>r("support"),children:["Help and Support",t.jsx(zt,{size:17})]})]}),e.error&&t.jsx("div",{className:"error-box",children:e.error})]}):t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"topbar-row",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Operations command center"}),t.jsx("h1",{children:"Workspace"}),t.jsx("p",{className:"muted",children:"What needs attention, what is moving, and what comes next."})]}),t.jsxs("div",{className:"topbar-actions",children:[t.jsx(aa,{size:19}),t.jsxs("button",{className:"date-chip",type:"button",onClick:()=>r("lobby"),children:["The Lobby ",t.jsx(Tt,{size:14})]}),a&&t.jsxs("a",{className:"date-chip",href:a,target:"_blank",rel:"noreferrer",children:["Return to Website ",t.jsx(Tt,{size:14})]})]})]}),t.jsx(BC,{supabase:n,identity:s}),t.jsxs("section",{className:"metric-grid five",children:[t.jsx(Ur,{label:"Today's Sales",value:u,detail:h,icon:Rr}),t.jsx(Ur,{label:"Buy Today",value:c.buy,detail:"Items needing replenishment",icon:en,tone:"metric-warning"}),t.jsx(Ur,{label:"Forecast Alerts",value:m,detail:p,icon:Pn}),t.jsx(Ur,{label:"Inventory Health",value:`${c.healthy} healthy`,detail:`${c.out} out · ${c.low} low`,icon:Ap,tone:"metric-blue"}),t.jsx(Ur,{label:"Today's Tasks",value:c.out+c.low,detail:"Priority inventory reviews",icon:Fu})]}),t.jsxs("section",{className:"panel",children:[t.jsx("div",{className:"panel-title",children:t.jsxs("div",{children:[t.jsx("h2",{children:"Quick Actions"}),t.jsx("p",{className:"muted",children:"Jump directly into the work."})]})}),t.jsx("div",{className:"action-grid six",children:j.map(([T,L,M])=>t.jsxs("button",{className:"quick-action",type:"button","data-automation-hook":`workspace.quick.${T}`,onClick:()=>r(T),children:[t.jsx("span",{children:t.jsx(M,{size:20})}),L,t.jsx(zt,{size:17})]},L))})]}),t.jsxs("section",{className:"workspace-grid",children:[t.jsxs("section",{className:"panel span-two",children:[t.jsxs("div",{className:"panel-title",children:[t.jsxs("div",{children:[t.jsx("h2",{children:"Items That Need My Attention"}),t.jsx("p",{className:"muted",children:"Live inventory exceptions from your protected portal view."})]}),t.jsx("button",{className:"link-button",onClick:()=>r("inventory"),children:"View inventory"})]}),o.length?t.jsx("div",{className:"attention-list",children:o.map((T,L)=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:lo(T)}),t.jsx("span",{children:String(T.category??"Uncategorized")})]}),t.jsxs("div",{className:"row-numbers",children:[t.jsxs("span",{children:["On hand: ",String(T.qty_on_hand??T.current_quantity??"â")]}),t.jsx("b",{className:`badge ${da(T)}`,children:da(T)})]})]},String(T.id??L)))}):t.jsx(Na,{icon:Kr,title:"Nothing urgent",copy:"No low, out, or untracked items are visible right now."})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Sales Trend"}),w.length?t.jsx("div",{className:"attention-list",children:w.map(T=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:new Date(`${T.business_date}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"})}),t.jsxs("span",{children:[Ar(T.ticket_count)," tickets"]})]}),t.jsx("div",{className:"row-numbers",children:t.jsx("strong",{children:wn(T.net_sales)})})]},T.business_date))}
589):t.jsx(Na,{icon:Rr,title:"No sales history yet",copy:"Daily sales will appear here after Clover summaries arrive."})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Top Selling Items"}),(N=(k=e.itemSales)==null?void 0:k.top_items)!=null&&N.length?t.jsx("div",{className:"attention-list",children:e.itemSales.top_items.slice(0,6).map((T,L)=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:String(T.item_name??"Unknown item")}),t.jsx("span",{children:String(T.sku??"Unmapped")})]}),t.jsxs("div",{className:"row-numbers",children:[t.jsxs("b",{children:[Ar(T.quantity).toLocaleString()," sold"]}),t.jsx("span",{children:wn(T.revenue)})]})]},String(T.item_id??L)))}):t.jsx(Na,{icon:Pn,title:"Item-level sales feed needed",copy:"Run the reviewed Clover item-sales sync after backfill approval."})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Sales by Category"}),(P=(C=e.itemSales)==null?void 0:C.categories)!=null&&P.length?t.jsx("div",{className:"attention-list",children:e.itemSales.categories.slice(0,6).map((T,L)=>t.jsxs("div",{className:"attention-row",children:[t.jsx("div",{children:t.jsx("strong",{children:String(T.category??"Uncategorized")})}),t.jsxs("div",{className:"row-numbers",children:[t.jsxs("b",{children:[Ar(T.quantity).toLocaleString()," sold"]}),t.jsx("span",{children:wn(T.revenue)})]})]},String(T.category??L)))}):t.jsx(Na,{icon:Rr,title:"Category sales feed needed",copy:"Category totals require the reviewed Clover item-level sales feed."})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Forecast Accuracy"}),t.jsx(Na,{icon:zn,title:g!=null&&g.forecast_accuracy_ready?"Accuracy available":`${S} forecast observation day${S===1?"":"s"}`,copy:g!=null&&g.forecast_accuracy_ready?"Forecast accuracy is being compared with actual usage.":`Learning signal confidence is ${b}%. True accuracy starts after forecasts can be compared with later actual usage and physical counts.`})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Inventory Turnover"}),t.jsx(Na,{icon:Hr,title:"Turnover needs usage history",copy:"Physical counts and recipe-driven usage will make this metric meaningful."})]}),t.jsxs("section",{className:"panel",children:[t.jsx("h2",{children:"Upcoming Needs"}),t.jsx(Na,{icon:Sn,title:f?`${Ar(f.alert_count)} forecast alerts active`:"No forecast window yet",copy:"Open Forecasting to review projected ingredient and supply needs."})]})]}),t.jsxs("section",{className:"panel purchase-summary",children:[t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Purchase plan summary"}),t.jsxs("h2",{children:[c.buy," items currently need review"]}),t.jsx("p",{className:"muted",children:"Build the shopping list from live low-stock and out-of-stock items."})]}),t.jsx("button",{className:"primary-inline",onClick:()=>r("purchase"),children:"Open Purchase Plan"})]}),e.error&&t.jsx("div",{className:"error-box",children:e.error})]})}function QC({data:e}){const[r,a]=y.useState(null),n=e.inventoryRows.filter(s=>Ar(s.buy_qty??s.reorder_qty)>0||/out|low/.test(da(s)));return t.jsxs(t.Fragment,{children:[t.jsx("header",{className:"page-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Purchasing"}),t.jsx("h1",{children:"Purchase Plans"}),t.jsx("p",{className:"muted",children:"A focused list of what to buy, how much, and where."})]})}),r&&t.jsx("div",{className:"success-box",children:r}),t.jsx("section",{className:"panel",children:n.length?t.jsx("div",{className:"attention-list",children:n.map((s,i)=>t.jsxs("div",{className:"attention-row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:lo(s)}),t.jsx("span",{children:String(s.preferred_vendor??"Vendor not assigned")})]}),t.jsxs("div",{className:"row-numbers",children:[t.jsxs("span",{children:["Suggested: ",String(s.buy_qty??s.reorder_qty??"Review")]}),t.jsx("b",{className:`badge ${da(s)}`,children:da(s)}),s.order_url?t.jsx("a",{className:"row-action",href:String(s.order_url),target:"_blank",rel:"noreferrer",children:"Order Now"}):t.jsx("button",{className:"row-action",onClick:()=>a(`${lo(s)} needs a vendor link.`),children:"Open Vendor"})]})]},String(s.id??i)))}):t.jsx(Na,{icon:en,title:"No purchase items",copy:"Low-stock and reorder suggestions will appear here."})})]})}function ZC({data:e}){const r=e.historicalSalesSummary;return t.jsxs(t.Fragment,{children:[t.jsx("header",{className:"page-heading",children:t.jsxs("div",{children:[t.jsx("p",{className:"eyebrow",children:"Business intelligence"}),t.jsx("h1",{children:"Reports & Trends"})]})}),t.jsx(IC,{}),t.jsxs("section",{className:"metric-grid",children:[t.jsx(Ur,{label:"Inventory Items",value:e.inventoryCount,detail
589:"Current tenant catalog",icon:Hr}),t.jsx(Ur,{label:"Snapshot History",value:e.snapshotCount,detail:"Records available for trend analysis",icon:Rr}),t.jsx(Ur,{label:"Latest Net Sales",value:r?wn(r.net_sales??r.gross_revenue):"â",detail:"Most recent historical summary",icon:Pn})]})]})}function e4({session:e}){var q;const{branding:r,supabase:a,identity:n,entitlements:s}=Hn(),i=y.useRef(null),c=mm(),[o,l]=y.useState(Tu),[d,u]=y.useState(()=>new URLSearchParams(window.location.search).get("workspace")==="tenant"?"workspace":"lobby"),[h,f]=y.useState(!1),[m,x]=y.useState(!1),[p,g]=y.useState(null),[w,S]=y.useState({inventoryCount:null,snapshotCount:null,inventoryRows:[],locations:[],salesSummary:null,historicalSalesSummary:null,forecastSummary:null,workspaceIntelligence:null,itemSales:null,error:null,loading:!0});y.useEffect(()=>{const J=()=>{l(Tu()),u(new URLSearchParams(window.location.search).get("workspace")==="tenant"?"workspace":"lobby"),f(!1)};return window.addEventListener("popstate",J),window.addEventListener(ga,J),()=>{window.removeEventListener("popstate",J),window.removeEventListener(ga,J)}},[]),y.useEffect(()=>{n.role==="team_member"&&u("workspace")},[n.role]),y.useEffect(()=>{async function J(){const le=n.role==="team_member",A={data:null,error:null},[V,I,D,K,z,Y,re,oe,Ce]=await Promise.all([a.from("portal_inventory_items").select("*",{count:"exact",head:!0}),a.from("portal_inventory_snapshots").select("*",{count:"exact",head:!0}),a.from("portal_inventory_items").select("*").order("item_name").limit(500),a.rpc("portal_list_my_inventory_locations"),le?Promise.resolve(A):a.rpc("portal_get_today_sales_summary"),le?Promise.resolve(A):a.rpc("portal_get_latest_sales_summary"),le?Promise.resolve(A):a.rpc("portal_get_forecast_alert_summary"),le?Promise.resolve(A):a.rpc("portal_get_workspace_intelligence"),le?Promise.resolve(A):a.rpc("portal_get_workspace_item_sales")]),F=V.error??I.error??D.error??K.error??z.error??Y.error??re.error??oe.error??Ce.error;S({inventoryCount:V.count,snapshotCount:I.count,inventoryRows:D.data??[],locations:K.data??[],salesSummary:z.data??null,historicalSalesSummary:Y.data??null,forecastSummary:re.data??null,workspaceIntelligence:oe.data??null,itemSales:Ce.data??null,error:(F==null?void 0:F.message)??null,loading:!1})}J()},[a,n.role]);async function b(){Ka("sbh"),await(pt==null?void 0:pt.auth.signOut())}const j=(J,le=d)=>{f(!1),l(J),u(le);const A=new URLSearchParams(window.location.search);A.set("area",String(J)),le==="lobby"?(A.delete("workspace"),A.delete("tenant")):(A.set("workspace","tenant"),A.set("tenant",String(n.clientId))),Aa(`${window.location.pathname}?${A.toString()}`)},k=()=>{if(Af(e)){const J=new URLSearchParams(window.location.search);J.set("area","workspace"),J.set("workspace","admin"),J.delete("tenant"),Aa(`${window.location.pathname}?${J.toString()}`);return}j("workspace","workspace")},N=J=>J==="workspace"?k():j(J,"lobby"),C=J=>j(J,J==="lobby"?"lobby":"workspace"),P=p??r,T=Qu(a,P.logo_path),L=((q=P.company_display_name)==null?void 0:q.trim())||"Your Business",M=/lil mama/i.test(L)?"https://www.lilmamasweets.com/":void 0,E=o==="events"&&c.some(J=>J.id==="grant-watch")?"events":c.some(J=>J.id===o)?o:"workspace",W=E==="welcome"?t.jsx(jC,{onNavigate:j,isPrivileged:["owner","admin"].includes(n.role)}):E==="onboarding"?t.jsx(wC,{userId:e.user.id,onNavigate:j}):E==="workspace"?t.jsx(JC,{data:w,navigate:j,websiteUrl:M}):E==="lobby"?t.jsx(km,{supabase:a,session:e,onWorkspace:()=>j("workspace","workspace"),onNavigate:J=>j(J)}):E==="web-design"?t.jsx(Sf,{}):E==="smart-finance"?t.jsx(kf,{}):E==="directory"?t.jsx(Tl,{supabase:a,mode:"directory"}):E==="marketplace"?t.jsx(Tl,{supabase:a,mode:"marketplace"}):E==="events"||E==="grant-watch"?t.jsx(_C,{supabase:a,canManage:["owner","admin","manager"].includes(n.role),section:E==="events"?"events":"opportunities"}):E==="plan"?t.jsxs(t.Fragment,{children:[t.jsx(Rm,{supabase:a}),t.jsx(cm,{supabase:a})]}):E==="sync"?t.jsx(iC,{session:e,onRefreshInventory:async()=>j("inventory","workspace")}):E==="inventory"?t.jsx(Nl,{data:w,supabase:a}):E==="items"?t.jsx(Nl,{data:w,supabase:a,mode:"my_items"}):E==="sku"?t.jsx(mf,{supabase:a}):E==="scanner"?t.jsx($S,{supabase:a}):E==="contacts"?t.jsx(KS,{supabase:a,canEditSmartCard:n.role==="owner",onOpenSmartCard:()=>j("smart-card")}):E==="smart-card"?t.jsx(wN,{supabase:a}):E==="notifications"?t.jsx(tC,{supabase:a}):E==="messages"?t.jsx(rC,{supabase:a}):E==="purchase"?t.jsx(QC,{data:w}):E==="reports"?t.jsx(ZC,{data:w}):E==="training"?t.jsx(lC,{supabase:a,branding:P}):E==="meetings"?t.jsx(dC,{supabase:a,branding:P}):E==="support"?t.jsx(nC,{supabase:a}):E==="settings"?t.jsx(dm,{supabase:a,branding:P,onBrandingChange:g}):t.jsx(FC,{module:E,onNavigate:j,supabase:a}),ee=d==="lobby",ce=J=>C(J),ue=()=>{x(!1),requestAnimationFrame(()=>{var J;return(J=i.current)==null?void 0:J.focus()})},te=t.jsxs("div",{className:"app-shell",children:[t.jsxs("aside",{className:h?"sidebar open":"sidebar",children:[t.jsxs("div",{className:"sidebar-brand",children:[T?t.jsx("img",{src:T,alt:L,className:"brand-logo-small tenant-logo"}):t.jsx("img",{src:Li,alt:"SmartBizHelper",className:"brand-logo-small"}),t.jsx("button",{className:"icon-button mobile-only",onClick:()=>f(!1),children:t.jsx(gt,{})})]}),t.jsx("nav",{children:c.map(({id:J,label:le,icon:A})=>{const V=E===J||J==="grant-watch"&&E==="events";return t.jsxs("button",{className:V?"nav-link active":"nav-link",onClick:()=>C(J),children:[t.jsx(A,{size:19}),t.jsx("span",{children:le})]},J)})}),t.jsxs("div",{className:"sidebar-footer",children:[t.jsx("div",{className:"avatar",children:L.charAt(0).toUpperCase()}),t.jsxs("div",{children:[t.jsx("strong",{children:L}),t.jsx("span",{children:e.user.email})]}),t.jsx("button",{className:"icon-button",onClick:b,children:t.jsx(Gu,{size:18})})]}),t.jsx(Ra,{className:"tenant-ownership-footer"})]}),t.jsxs("div",{className:"main-shell",children:[t.jsx(Tf,{session:e,identity:n,companyName:L,businessLogoUrl:T,onNavigate:ce,onOpenSmartCard:()=>x(!0),smartCardLauncherRef:i}),t.jsxs("div",{className:"mobile-bar",children:[t.jsx("button",{className:"icon-button",onClick:()=>f(!0),children:t.jsx(Ds,{})}),t.jsx("strong",{children:L})]}),t.jsx("main",{className:"content",children:W})]})]}),fe=t.jsx("div",{className:"app-shell lobby-shell",children:t.jsx(LC,{supabase:a,session:e,identity:n,companyName:L,businessLogoUrl:T,activePage:E,grantedEntitlements:s.granted,onNavigate:N,onOpenSmartCard:()=>x(!0),smartCardLauncherRef:i,onSignOut:b,children:W})});return t.jsxs(t.Fragment,{children:[ee?fe:te,m&&t.jsx(DC,{supabase:a,canEdit:n.role==="owner",onClose:ue,onNavigate:J=>{ue(),j(J,d)}}),!ee&&h&&t.jsx("button",{className:"scrim",onClick:()=>f(!1),"aria-label":"Close menu"})]})}function t4({session:e}){const[r,a]=y.useState(!1),n=new URLSearchParams(window.location.search),s=n.get("area"),i=["sku","smart-sku","smart_sku"].includes(s??"")?"sku":"workspace",c=n.get("tenant"),o=c&&/^[0-9]+$/.test(c)?Number(c):null;async function l(){Ka("sbh"),await(pt==null?void 0:pt.auth.signOut())}function d(h){var x;h.preventDefault();const f=(x=new FormData(h.currentTarget).get("tenant"))==null?void 0:x.trim();if(!f||!/^[0-9]+$/.test(f))return;const m=new URLSearchParams(window.location.search);m.set("tenant",f),window.location.assign(`${window.location.pathname}?${m.toString()}`)}const u=i!=="sku"?null:o===null?t.jsx("main",{className:"admin-command-center admin-route-page",children:t.jsxs("div",{className:"panel",children:[t.jsx("h2",{children:"Select a tenant to manage Smart SKU"}),t.jsx("p",{className:"muted",children:"Smart SKU is scoped to one business at a time. Choose which tenant you are editing before continuing."}),t.jsxs("form",{onSubmit:d,children:[t.jsxs("label",{children:["Tenant ID",t.jsx("input",{name:"tenant",type:"number",min:1,required:!0,placeholder:"e.g. 42"})]}),t.jsx("button",{className:"primary-inline",type:"submit",children:"Continue"})]})]})}):t.jsx("main",{className:"admin-command-center admin-route-page",children:t.jsx(mf,{supabase:pt})});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"admin-mobile-bar",children:[t.jsx("button",{className:"icon-button",type:"button",onClick:()=>a(!0),"aria-label":"Open Command Center navigation","aria-controls":"admin-command-center-sidebar","aria-expanded":r,children:t.jsx(Ds,{})}),t.jsx("strong",{children:"Command Center"})]}),t.jsx(im,{onSignOut:l,supabase:pt,mobileOpen:r,onClose:()=>a(!1),activePage:i}),i==="sku"?u:t.jsx(sm,{supabase:pt,email:e.user.email??"[email protected]"})," ",r&&t.jsx("button",{className:"admin-sidebar-scrim",type:"button",onClick:()=>a(!1),"aria-label":"Close Command Center navigation"})]})}function Au({session:e,platformAdminLobby:r=!1}){return t.jsx(pm,{session:e,platformAdminLobby:r,children:t.jsx(e4,{session:e})})}function r4(){const{access:e,loaded:r}=qC(),[,a]=y.useState(0);y.useEffect(()=>{const m=()=>a(x=>x+1);return window.addEventListener("popstate",m),window.addEventListener(ga,m),()=>{window.removeEventListener("popstate",m),window.removeEventListener(ga,m)}},[]);const[n,s]=y.useState(null),[i,c]=y.useState("login"),[o,l]=y.useState(!0);y.useEffect(()=>{if(!pt){l(!1);return}let m=!1;const{data:x}=pt.auth.onAuthStateChange((p,g)=>{if(p==="PASSWORD_RECOVERY"){m=!0,s(g),c("recovery"),l(!1);return}s(g),p==="SIGNED_OUT"&&c("login")});return pt.auth.getSession().then(({data:p})=>{m||s(p.session),l(!1)}),()=>x.subscription.unsubscribe()},[]);const d=$C();if(d)return t.jsx(kN,{token:d});if(!r)return t.jsx(Pi,{message:"Preparing your SmartBizHelper experience"});const u=new URLSearchParams(window.location.search).get("guest")==="1";if(u&&!window.location.hash)return e.guest_mode?t.jsx(QN,{supabase:pt,access:e,onSignIn:()=>{window.history.replaceState({},"",window.location.pathname),window.location.reload()}}):t.jsx(zc,{title:"Guest Mode is not open yet"});const h=GC();if(h)return h;if(o)return t.jsx(Pi,{message:"Confirming your secure session"});if(i==="recovery")return t.jsx(YC,{onComplete:()=>c("login")});if(n){const m=Af(n);if(!m&&!e.existing_login)return pt==null||pt.auth.signOut(),t.jsx(zc,{title:"Sign-in is not open yet"});const x=new URLSearchParams(window.location.search),p=x.get("area"),g=m&&x.get("workspace")==="admin"&&(p===null||p==="workspace"||p==="settings"||p==="sku"||p==="smart-sku"||p==="smart_sku"),w=m&&!g&&x.get("workspace")!=="tenant",S=g?t.jsx(t4,{session:n}):w?t.jsx(Au,{session:n,platformAdminLobby:!0}):t.jsx(Au,{session:n}),b=async()=>{await(pt==null?void 0:pt.auth.signOut())};return t.jsx(WC,{supabase:pt,session:n,onSignOut:b,children:t.jsx(UC,{supabase:pt,session:n,onSignOut:b,children:S})})}return i==="forgot"?t.jsx(KC,{onBack:()=>c("login")}):new URLSearchParams(window.location.search).get("auth")==="login"?t.jsx(XC,{onSession:s,onForgotPassword:()=>c("forgot")}):e.public_website?t.jsx(EN,{guestMode:u,access:e,supabase:pt}):t.jsx(zc,{title:"SmartBizHelper is not open yet"})}qf.createRoot(document.getElementById("root")).render(t.jsx($f.StrictMode,{children:t.jsx(r4,{})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.