1import{aq as mt,aG as zr,aH as Dr,aI as Nl,aJ as kl,aK as Ot,c as ct,r as $,W as We,F as je,q as ve,Q as fe,j as e,$ as Me,a0 as Le,a1 as Ue,a2 as qe,a3 as Ke,I as At,af as da,an as Ct,a4 as le,B as z,aB as Cl,a5 as Ze,L as Ie,E as Us,C as ge,b as Sl,X as rt,O as De,p as tt,T as Ea,au as er,K as st,N as at,aa as bt,a as Te,aL as _l,a6 as ft,aD as Tl,ak as wt,aM as Or,_ as ts,ac as vs,a7 as Qe,U as $t,aN as Fl,a9 as xt,f as Br,aO as ws,M as bs,n as qs,aP as $r,aQ as tr,aR as Mr,aS as Lr,aT as Ur,aU as qr,aV as Vr,aW as Gr,ad as Al,v as Ma,w as La,x as Ua,ao as sr,D as Hr,h as Kr,k as Wr,m as qa,aw as Zr,al as ar,aX as Dt,z as ps,d as Qr,J as El,Z as Bs,aY as Il,aZ as Yr,S as ir,a_ as Pl,a$ as oa,b0 as Rl,b1 as rr,b2 as zl,u as Dl,A as Ia,P as Ol,b3 as Bl,as as zs,V as ds,y as hs,b4 as $l,a8 as Pa,b5 as nr,ab as lr}from"./index-tc5-nNLC.js";import{L as q}from"./label-MwGx_WS4.js";import{T as as,a as is,b as Re,c as ze}from"./tabs-D2OfY7RH.js";import{S as ss,a as Ml,b as Ll,c as Ul,d as ql}from"./index-CA8G2zMx.js";import{R as Jr}from"./index-CJAmMy_E.js";import{T as nt}from"./textarea-DN2rY_yY.js";import{S as fa}from"./switch-B37nBmXq.js";import{C as gs}from"./checkbox-DUKovseV.js";import{S as Oe,a as Be,b as $e,c as Ve,d as ae}from"./select-Bsa-6vNv.js";import{a as aa}from"./addDays-LHkC9Hbt.js";import{f as Mt}from"./format-D3jHS6VA.js";import{s as Vl,i as Gl}from"./setMonth-XnH47YBf.js";import{S as ha}from"./send-B0Xv9vwc.js";import{C as Hl}from"./calendar-plus-D4DZjrPg.js";import{T as ma}from"./twitter-DFPk9uR7.js";import{F as ua}from"./facebook-DbspwSBJ.js";import{Y as Ms}from"./youtube-BIudLhIY.js";import{I as fs}from"./instagram-1o4cdpgt.js";import{C as Bt}from"./circle-check-B8vEXYAG.js";import{p as Kl}from"./parseISO-DzkD68en.js";import{E as Lt}from"./eye-7YOw3q0i.js";import{S as Ls}from"./save-IxPgLFqm.js";import{T as js}from"./type-CI5hK1ZH.js";import{P as Wl}from"./paintbrush-CfsRqtAP.js";import{P as Zl}from"./party-popper-GuyWa3aC.js";import{C as Kt}from"./copy-Bquar6tk.js";import{M as Va}from"./mail-DG8jvVe4.js";import{P as Ql}from"./phone-DkyZOs2j.js";import{H as Za}from"./hash-B1pZho-G.js";import{L as Yl}from"./list-Czfb4XTV.js";import{S as Jl}from"./square-check-big-CjvE2IRz.js";import{U as Ft}from"./upload-KKjnUBTz.js";import{G as ba}from"./grip-vertical-wW0VvTEo.js";import{I as ut}from"./image-CUhS0kqX.js";import{A as Ga}from"./arrow-left-kYemJdx8.js";import{G as ys}from"./globe-CrY5Q3gB.js";import{M as xa}from"./mic-vocal-FCXr3-US.js";import{D as St}from"./download-DtCkiRGd.js";import{E as pa}from"./external-link-wMXh6D17.js";import{A as or,a as cr,b as dr,c as hr,d as mr,e as ur,f as xr,g as pr}from"./alert-dialog-BhS3-18U.js";import{C as Xr}from"./crown-BaX0qJx5.js";import{C as ht}from"./circle-check-big-CUgqPmz6.js";import{P as en}from"./pencil-C45dJbNG.js";import{E as Xl}from"./ellipsis-vertical-DKxVzYXD.js";import{A as eo,a as to,b as so,c as ao}from"./accordion-CDMY0rhQ.js";import{F as io}from"./file-check-DNqLAA85.js";import{M as gr}from"./message-square-BbWo1nY5.js";import{u as tn,a as ga,s as sn,K as an,P as rn,D as nn,c as ln,S as on,h as cn,b as dn,d as hn,C as mn}from"./sortable.esm-BSiVliNl.js";import{L as un}from"./lock-CWiCoas5.js";import{C as Ha}from"./chevron-left-ObYy0wWc.js";import{P as Ka}from"./pause-Dw-0TJF1.js";import{P as ca}from"./play-DZhwD__F.js";import{F as ro}from"./file-video-B2iNHg8C.js";import{S as Qa}from"./smartphone-Cj9B-Tof.js";import{U as no}from"./utensils-DFWiThh_.js";import{S as fr}from"./square-pen-Bm9oADRS.js";import{F as Ra}from"./file-image-0Ms4XWGh.js";import{L as lo}from"./layout-grid-CVeRfsFQ.js";import{S as Xe}from"./slider-C2Y0X2uK.js";import{R as oo}from"./rocket-BSE7fGo7.js";import{S as Wa}from"./scissors-lbXQ6ZKf.js";import{C as ia}from"./captions-BCYgmtHC.js";import{S as co}from"./skip-forward-Dewm6kiF.js";import{F as ho}from"./filter-DmG6gd0Q.js";import{S as mo}from"./sliders-horizontal-cT5PL8wM.js";import{S as br}from"./sun-CoS5iVHK.js";import{M as uo}from"./moon-CiX55F7n.js";import{P as xo}from"./pen-line-B7H07o8v.js";import"./index-C-y5wYFI.js";import"./chevron-down-DOFZ7rzv.js";import"./chevron-up-1gTexUQn.js";import"./differenceInCalendarDays-YJe1lx93.js";import"./index-DL2Sqs6c.js";/** 2 * @license lucide-react v0.453.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 po=mt("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 7 * @license lucide-react v0.453.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 jr=mt("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** 12 * @license lucide-react v0.453.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 go=mt("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** 17 * @license lucide-react v0.453.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 fo=mt("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** 22 * @license lucide-react v0.453.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 bo=mt("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** 27 * @license lucide-react v0.453.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 jo=mt("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",ke
31y:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** 32 * @license lucide-react v0.453.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 vo=mt("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** 37 * @license lucide-react v0.453.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 xn=mt("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** 42 * @license lucide-react v0.453.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 wo=mt("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** 47 * @license lucide-react v0.453.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 vr=mt("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"}]]);/** 52 * @license lucide-react v0.453.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 pn=mt("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** 57 * @license lucide-react v0.453.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 gn=mt("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** 62 * @license lucide-react v0.453.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 yo=mt("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** 67 * @license lucide-react v0.453.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 No=mt("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** 72 * @license lucide-react v0.453.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 wr=mt("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** 77 * @license lucide-react v0.453.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 ko=mt("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);function Co(p,P){const l=+zr(p);return Dr(p,l+P)}function So(p,P){return Co(p,P*Nl)}function ra(p,P){let l=zr(p);return isNaN(+l)?Dr(p,NaN):(P.year!=null&&l.setFullYear(P.year),P.month!=null&&(l=Vl(l,P.month)),P.date!=null&&l.setDate(P.date),P.hours!=null&&l.setHours(P.hours),P.minutes!=null&&l.setMinutes(P.minutes),P.seconds!=null&&l.setSeconds(P.seconds),P.milliseconds!=null&&l.setMilliseconds(P.milliseconds),l)}function na(p){throw new Error('Could not dynamically require "'+p+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fn={exports:{}};/*! 82 83JSZip v3.10.1 - A JavaScript class for generating and reading zip files 84<http://stuartk.com/jszip> 85
vendor: 4,668 bytes, lines 86-91
86(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com> 87Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. 88 89JSZip uses the library pako released under the MIT license : 90https://github.com/nodeca/pako/blob/main/LICENSE 91*/(function(p,P){(function(l){p.exports=l()})(function(){return function l(_,b,o){function c(r,d){if(!b[r]){if(!_[r]){var j=typeof na=="function"&&na;if(!d&&j)return j(r,!0);if(i)return i(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var m=b[r]={exports:{}};_[r][0].call(m.exports,function(y){var h=_[r][1][y];return c(h||y)},m,m.exports,l,_,b,o)}return b[r].exports}for(var i=typeof na=="function"&&na,u=0;u<o.length;u++)c(o[u]);return c}({1:[function(l,_,b){var o=l("./utils"),c=l("./support"),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";b.encode=function(u){for(var r,d,j,s,m,y,h,f=[],g=0,v=u.length,x=v,k=o.getTypeOf(u)!=="string";g<u.length;)x=v-g,j=k?(r=u[g++],d=g<v?u[g++]:0,g<v?u[g++]:0):(r=u.charCodeAt(g++),d=g<v?u.charCodeAt(g++):0,g<v?u.charCodeAt(g++):0),s=r>>2,m=(3&r)<<4|d>>4,y=1<x?(15&d)<<2|j>>6:64,h=2<x?63&j:64,f.push(i.charAt(s)+i.charAt(m)+i.charAt(y)+i.charAt(h));return f.join("")},b.decode=function(u){var r,d,j,s,m,y,h=0,f=0,g="data:";if(u.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var v,x=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===i.charAt(64)&&x--,u.charAt(u.length-2)===i.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=c.uint8array?new Uint8Array(0|x):new Array(0|x);h<u.length;)r=i.indexOf(u.charAt(h++))<<2|(s=i.indexOf(u.charAt(h++)))>>4,d=(15&s)<<4|(m=i.indexOf(u.charAt(h++)))>>2,j=(3&m)<<6|(y=i.indexOf(u.charAt(h++))),v[f++]=r,m!==64&&(v[f++]=d),y!==64&&(v[f++]=j);return v}},{"./support":30,"./utils":32}],2:[function(l,_,b){var o=l("./external"),c=l("./stream/DataWorker"),i=l("./stream/Crc32Probe"),u=l("./stream/DataLengthProbe");function r(d,j,s,m,y){this.compressedSize=d,this.uncompressedSize=j,this.crc32=s,this.compression=m,this.compressedContent=y}r.prototype={getContentWorker:function(){var d=new c(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),j=this;return d.on("end",function(){if(this.streamInfo.data_length!==j.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new c(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},r.createWorkerFrom=function(d,j,s){return d.pipe(new i).pipe(new u("uncompressedSize")).pipe(j.compressWorker(s)).pipe(new u("compressedSize")).withStreamInfo("compression",j)},_.exports=r},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(l,_,b){var o=l("./stream/GenericWorker");b.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},b.DEFLATE=l("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(l,_,b){var o=l("./utils"),c=function(){for(var i,u=[],r=0;r<256;r++){i=r;for(var d=0;d<8;d++)i=1&i?3988292384^i>>>1:i>>>1;u[r]=i}return u}();_.exports=function(i,u){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(r,d,j,s){var m=c,y=s+j;r^=-1;for(var h=s;h<y;h++)r=r>>>8^m[255&(r^d[h])];return-1^r}(0|u,i,i.length,0):function(r,d,j,s){var m=c,y=s+j;r^=-1;for(var h=s;h<y;h++)r=r>>>8^m[255&(r^d.charCodeAt(h))];return-1^r}(0|u,i,i.length,0):0}},{"./utils":32}],5:[function(l,_,b){b.base64=!1,b.binary=!1,b.dir=!1,b.createFolders=!0,b.date=null,b.compression=null,b.compressionOptions=null,b.comment=null,b.unixPermissions=null,b.dosPermissions=null},{}],6:[function(l,_,b){var o=null;o=typeof Promise<"u"?Promise:l("lie"),_.exports={Promise:o}},{lie:37}],7:[function(l,_,b){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",c=l("pako"),i=l("./utils"),u=l("./stream/GenericWorker"),r=o?"uint8array":"array";function d(j,s){u.call(this,"FlateWorker/"+j),this._pako=null,this._pakoAction=j,this._pakoOptions=s,this.meta={}}b.magic="\b\0",i.inherits(d,u),d.prototype.processChunk=function(j){this.meta=j.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(r,j.data),!1)},d.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)}
vendor: 4,939 bytes, lines 91-92
91,d.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new c[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var j=this;this._pako.onData=function(s){j.push({data:s,meta:j.meta})}},b.compressWorker=function(j){return new d("Deflate",j)},b.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(l,_,b){function o(m,y){var h,f="";for(h=0;h<y;h++)f+=String.fromCharCode(255&m),m>>>=8;return f}function c(m,y,h,f,g,v){var x,k,D=m.file,K=m.compression,U=v!==r.utf8encode,Q=i.transformTo("string",v(D.name)),R=i.transformTo("string",r.utf8encode(D.name)),O=D.comment,ne=i.transformTo("string",v(O)),C=i.transformTo("string",r.utf8encode(O)),W=R.length!==D.name.length,n=C.length!==O.length,S="",oe="",J="",xe=D.dir,Z=D.date,Y={crc32:0,compressedSize:0,uncompressedSize:0};y&&!h||(Y.crc32=m.crc32,Y.compressedSize=m.compressedSize,Y.uncompressedSize=m.uncompressedSize);var L=0;y&&(L|=8),U||!W&&!n||(L|=2048);var F=0,he=0;xe&&(F|=16),g==="UNIX"?(he=798,F|=function(te,Fe){var He=te;return te||(He=Fe?16893:33204),(65535&He)<<16}(D.unixPermissions,xe)):(he=20,F|=function(te){return 63&(te||0)}(D.dosPermissions)),x=Z.getUTCHours(),x<<=6,x|=Z.getUTCMinutes(),x<<=5,x|=Z.getUTCSeconds()/2,k=Z.getUTCFullYear()-1980,k<<=4,k|=Z.getUTCMonth()+1,k<<=5,k|=Z.getUTCDate(),W&&(oe=o(1,1)+o(d(Q),4)+R,S+="up"+o(oe.length,2)+oe),n&&(J=o(1,1)+o(d(ne),4)+C,S+="uc"+o(J.length,2)+J);var ie="";return ie+=` 92\0`,ie+=o(L,2),ie+=K.magic,ie+=o(x,2),ie+=o(k,2),ie+=o(Y.crc32,4),ie+=o(Y.compressedSize,4),ie+=o(Y.uncompressedSize,4),ie+=o(Q.length,2),ie+=o(S.length,2),{fileRecord:j.LOCAL_FILE_HEADER+ie+Q+S,dirRecord:j.CENTRAL_FILE_HEADER+o(he,2)+ie+o(ne.length,2)+"\0\0\0\0"+o(F,4)+o(f,4)+Q+S+ne}}var i=l("../utils"),u=l("../stream/GenericWorker"),r=l("../utf8"),d=l("../crc32"),j=l("../signature");function s(m,y,h,f){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=h,this.encodeFileName=f,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(s,u),s.prototype.push=function(m){var y=m.meta.percent||0,h=this.entriesCount,f=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,u.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:h?(y+100*(h-f-1))/h:100}}))},s.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var y=this.streamFiles&&!m.file.dir;if(y){var h=c(m,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(m){this.accumulate=!1;var y=this.streamFiles&&!m.file.dir,h=c(m,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),y)this.push({data:function(f){return j.DATA_DESCRIPTOR+o(f.crc32,4)+o(f.compressedSize,4)+o(f.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var m=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var h=this.bytesWritten-m,f=function(g,v,x,k,D){var K=i.transformTo("string",D(k));return j.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(g,2)+o(g,2)+o(v,4)+o(x,4)+o(K.length,2)+K}(this.dirRecords.length,h,m,this.zipComment,this.encodeFileName);this.push({data:f,meta:{percent:100}})},s.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},s.prototype.registerPrevious=function(m){this._sources.push(m);var y=this;return m.on("data",function(h){y.processChunk(h)}),m.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),m.on("error",function(h){y.error(h)}),this},s.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},s.prototype.error=function(m){var y=this._sources;if(!u.prototype.error.call(this,m))return!1;for(var h=0;h<y.length;h++)try{y[h].error(m)}catch{}return!0},s.prototype.lock=function(){u.prototype.lock.call(this);for(var m=this._sources,y=0;y<m.length;y++)m[y].lock()},_.exports=s},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(l,_,b){var o=l("../compressions"),c=l("./ZipFileWorker");b.generateWorker=function(i,u,r){var d=new c(u.streamFiles,r,u.platform,u.encodeFileName),j=0;
vendor: 1,884 bytes, line 92
92try{i.forEach(function(s,m){j++;var y=function(v,x){var k=v||x,D=o[k];if(!D)throw new Error(k+" is not a valid compression method !");return D}(m.options.compression,u.compression),h=m.options.compressionOptions||u.compressionOptions||{},f=m.dir,g=m.date;m._compressWorker(y,h).withStreamInfo("file",{name:s,dir:f,date:g,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(d)}),d.entriesCount=j}catch(s){d.error(s)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(l,_,b){function o(){if(!(this instanceof o))return new o;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var c=new o;for(var i in this)typeof this[i]!="function"&&(c[i]=this[i]);return c}}(o.prototype=l("./object")).loadAsync=l("./load"),o.support=l("./support"),o.defaults=l("./defaults"),o.version="3.10.1",o.loadAsync=function(c,i){return new o().loadAsync(c,i)},o.external=l("./external"),_.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(l,_,b){var o=l("./utils"),c=l("./external"),i=l("./utf8"),u=l("./zipEntries"),r=l("./stream/Crc32Probe"),d=l("./nodejsUtils");function j(s){return new c.Promise(function(m,y){var h=s.decompressed.getContentWorker().pipe(new r);h.on("error",function(f){y(f)}).on("end",function(){h.streamInfo.crc32!==s.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}_.exports=function(s,m){var y=this;return m=o.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),d.isNode&&d.isStream(s)?c.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",s,!0,m.o
vendor: 2,505 bytes, line 92
92ptimizedBinaryString,m.base64).then(function(h){var f=new u(m);return f.load(h),f}).then(function(h){var f=[c.Promise.resolve(h)],g=h.files;if(m.checkCRC32)for(var v=0;v<g.length;v++)f.push(j(g[v]));return c.Promise.all(f)}).then(function(h){for(var f=h.shift(),g=f.files,v=0;v<g.length;v++){var x=g[v],k=x.fileNameStr,D=o.resolve(x.fileNameStr);y.file(D,x.decompressed,{binary:!0,optimizedBinaryString:!0,date:x.date,dir:x.dir,comment:x.fileCommentStr.length?x.fileCommentStr:null,unixPermissions:x.unixPermissions,dosPermissions:x.dosPermissions,createFolders:m.createFolders}),x.dir||(y.file(D).unsafeOriginalName=k)}return f.zipComment.length&&(y.comment=f.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(l,_,b){var o=l("../utils"),c=l("../stream/GenericWorker");function i(u,r){c.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(r)}o.inherits(i,c),i.prototype._bindStream=function(u){var r=this;(this._stream=u).pause(),u.on("data",function(d){r.push({data:d,meta:{percent:0}})}).on("error",function(d){r.isPaused?this.generatedError=d:r.error(d)}).on("end",function(){r.isPaused?r._upstreamEnded=!0:r.end()})},i.prototype.pause=function(){return!!c.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},_.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(l,_,b){var o=l("readable-stream").Readable;function c(i,u,r){o.call(this,u),this._helper=i;var d=this;i.on("data",function(j,s){d.push(j)||d._helper.pause(),r&&r(s)}).on("error",function(j){d.emit("error",j)}).on("end",function(){d.push(null)})}l("../utils").inherits(c,o),c.prototype._read=function(){this._helper.resume()},_.exports=c},{"../utils":32,"readable-stream":16}],14:[function(l,_,b){_.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,c){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,c);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,c)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var c=new Buffer(o);return c.fill(0),c},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(l,_,b){function o(D,K,U){var Q,R=i.getTypeOf(K),O
vendor: 7,295 bytes, line 92
92=i.extend(U||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(D=g(D)),O.createFolders&&(Q=f(D))&&v.call(this,Q,!0);var ne=R==="string"&&O.binary===!1&&O.base64===!1;U&&U.binary!==void 0||(O.binary=!ne),(K instanceof j&&K.uncompressedSize===0||O.dir||!K||K.length===0)&&(O.base64=!1,O.binary=!0,K="",O.compression="STORE",R="string");var C=null;C=K instanceof j||K instanceof u?K:y.isNode&&y.isStream(K)?new h(D,K):i.prepareContent(D,K,O.binary,O.optimizedBinaryString,O.base64);var W=new s(D,C,O);this.files[D]=W}var c=l("./utf8"),i=l("./utils"),u=l("./stream/GenericWorker"),r=l("./stream/StreamHelper"),d=l("./defaults"),j=l("./compressedObject"),s=l("./zipObject"),m=l("./generate"),y=l("./nodejsUtils"),h=l("./nodejs/NodejsStreamInputAdapter"),f=function(D){D.slice(-1)==="/"&&(D=D.substring(0,D.length-1));var K=D.lastIndexOf("/");return 0<K?D.substring(0,K):""},g=function(D){return D.slice(-1)!=="/"&&(D+="/"),D},v=function(D,K){return K=K!==void 0?K:d.createFolders,D=g(D),this.files[D]||o.call(this,D,null,{dir:!0,createFolders:K}),this.files[D]};function x(D){return Object.prototype.toString.call(D)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(D){var K,U,Q;for(K in this.files)Q=this.files[K],(U=K.slice(this.root.length,K.length))&&K.slice(0,this.root.length)===this.root&&D(U,Q)},filter:function(D){var K=[];return this.forEach(function(U,Q){D(U,Q)&&K.push(Q)}),K},file:function(D,K,U){if(arguments.length!==1)return D=this.root+D,o.call(this,D,K,U),this;if(x(D)){var Q=D;return this.filter(function(O,ne){return!ne.dir&&Q.test(O)})}var R=this.files[this.root+D];return R&&!R.dir?R:null},folder:function(D){if(!D)return this;if(x(D))return this.filter(function(R,O){return O.dir&&D.test(R)});var K=this.root+D,U=v.call(this,K),Q=this.clone();return Q.root=U.name,Q},remove:function(D){D=this.root+D;var K=this.files[D];if(K||(D.slice(-1)!=="/"&&(D+="/"),K=this.files[D]),K&&!K.dir)delete this.files[D];else for(var U=this.filter(function(R,O){return O.name.slice(0,D.length)===D}),Q=0;Q<U.length;Q++)delete this.files[U[Q].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(D){var K,U={};try{if((U=i.extend(D||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:c.utf8encode})).type=U.type.toLowerCase(),U.compression=U.compression.toUpperCase(),U.type==="binarystring"&&(U.type="string"),!U.type)throw new Error("No output type specified.");i.checkSupport(U.type),U.platform!=="darwin"&&U.platform!=="freebsd"&&U.platform!=="linux"&&U.platform!=="sunos"||(U.platform="UNIX"),U.platform==="win32"&&(U.platform="DOS");var Q=U.comment||this.comment||"";K=m.generateWorker(this,U,Q)}catch(R){(K=new u("error")).error(R)}return new r(K,U.type||"string",U.mimeType)},generateAsync:function(D,K){return this.generateInternalStream(D).accumulate(K)},generateNodeStream:function(D,K){return(D=D||{}).type||(D.type="nodebuffer"),this.generateInternalStream(D).toNodejsStream(K)}};_.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(l,_,b){_.exports=l("stream")},{stream:void 0}],17:[function(l,_,b){var o=l("./DataReader");function c(i){o.call(this,i);for(var u=0;u<this.data.length;u++)i[u]=255&i[u]}l("../utils").inherits(c,o),c.prototype.byteAt=function(i){return this.data[this.zero+i]},c.prototype.lastIndexOfSignature=function(i){for(var u=i.charCodeAt(0),r=i.charCodeAt(1),d=i.charCodeAt(2),j=i.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===u&&this.data[s+1]===r&&this.data[s+2]===d&&this.data[s+3]===j)return s-this.zero;return-1},c.prototype.readAndCheckSignature=function(i){var u=i.charCodeAt(0),r=i.charCodeAt(1),d=i.charCodeAt(2),j=i.charCodeAt(3),s=this.readData(4);return u===s[0]&&r===s[1]&&d===s[2]&&j===s[3]},c.prototype.readData=function(i){if(this.checkOffset(i),i===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},_.exports=c},{"../utils":32,"./DataReader":18}],18:[function(l,_,b){var o=l("../utils");function c(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}c.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var u,r=0;for(this.checkOffset(i),u=this.index+i-1;u>=this.index;u--)r=(r<<8)+this.byteAt(u);return this.index+=i,r},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},_.exports=c},{"../utils":32}],19:[function(l,_,b){var o=l("./Uint8ArrayReader");function c(i){o.call(this,i)}l("../utils").inherits(c,o),c.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},_.exports=c},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(l,_,b){var o=l("./DataReader");function c(i){o.call(this,i)}l("../utils").inherits(c,o),c.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},c.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},c.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},c.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},_.exports=c},{"../utils":32,"./DataReader":18}],21:[function(l,_,b){var o=l("./ArrayReader");function c(i){o.call(this,i)}l("../utils").inherits(c,o),c.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},_.exports=c},{"../utils":32,"./ArrayReader":17}],22:[function(l,_,b){var o=l("../utils"),c=l("../support"),i=l("./ArrayReader"),u=l("./StringReader"),r=l("./NodeBufferReader"),d=l("./Uint8ArrayReader");_.exports=function(j){var s=o.getTypeOf(j);return o.checkSupport(s),s!=="string"||c.uint8array?s==="nodebuffer"?new r(j):c.uint8array?new d(o.transformTo("uint8array",j)):new i(o.transformTo("array",j)):new u(j)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(l,_,b){b.LOCAL_FILE_HEADER="PK��",b.CENTRAL_FILE_HEADER="PK��",b.CENTRAL_DIRECTORY_END="PK��",b.ZIP
vendor: 4,292 bytes, line 92
9264_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",b.ZIP64_CENTRAL_DIRECTORY_END="PK��",b.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(l,_,b){var o=l("./GenericWorker"),c=l("../utils");function i(u){o.call(this,"ConvertWorker to "+u),this.destType=u}c.inherits(i,o),i.prototype.processChunk=function(u){this.push({data:c.transformTo(this.destType,u.data),meta:u.meta})},_.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(l,_,b){var o=l("./GenericWorker"),c=l("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}l("../utils").inherits(i,o),i.prototype.processChunk=function(u){this.streamInfo.crc32=c(u.data,this.streamInfo.crc32||0),this.push(u)},_.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(l,_,b){var o=l("../utils"),c=l("./GenericWorker");function i(u){c.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(i,c),i.prototype.processChunk=function(u){if(u){var r=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=r+u.data.length}c.prototype.processChunk.call(this,u)},_.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(l,_,b){var o=l("../utils"),c=l("./GenericWorker");function i(u){c.call(this,"DataWorker");var r=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(d){r.dataIsReady=!0,r.data=d,r.max=d&&d.length||0,r.type=o.getTypeOf(d),r.isPaused||r._tickAndRepeat()},function(d){r.error(d)})}o.inherits(i,c),i.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,r=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,r);break;case"uint8array":u=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":u=this.data.slice(this.index,r)}return this.index=r,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},_.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(l,_,b){function o(c){this.name=c||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(c){this.emit("data",c)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(c){this.emit("error",c)}return!0},error:function(c){return!this.isFinished&&(this.isPaused?this.generatedError=c:(this.isFinished=!0,this.emit("error",c),this.previous&&this.previous.error(c),this.cleanUp()),!0)},on:function(c,i){return this._listeners[c].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(c,i){if(this._listeners[c])for(var u=0;u<this._listeners[c].length;u++)this._listeners[c][u].call(this,i)},pipe:function(c){return c.registerPrevious(this)},registerPrevious:function(c){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=c.streamInfo,this.mergeStreamInfo(),this.previous=c;var i=this;return c.on("data",function(u){i.processChunk(u)}),c.on("end",function(){i.end()}),c.on("error",function(u){i.error(u)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var c=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),c=!0),this.previous&&this.previous.resume(),!c},flush:function(){},processChunk:function(c){this.push(c)},withStreamInfo:function(c,i){return this.extraStreamInfo[c]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var c in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,c)&&
vendor: 12,954 bytes, line 92
92(this.streamInfo[c]=this.extraStreamInfo[c])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var c="Worker "+this.name;return this.previous?this.previous+" -> "+c:c}},_.exports=o},{}],29:[function(l,_,b){var o=l("../utils"),c=l("./ConvertWorker"),i=l("./GenericWorker"),u=l("../base64"),r=l("../support"),d=l("../external"),j=null;if(r.nodestream)try{j=l("../nodejs/NodejsStreamOutputAdapter")}catch{}function s(y,h){return new d.Promise(function(f,g){var v=[],x=y._internalType,k=y._outputType,D=y._mimeType;y.on("data",function(K,U){v.push(K),h&&h(U)}).on("error",function(K){v=[],g(K)}).on("end",function(){try{var K=function(U,Q,R){switch(U){case"blob":return o.newBlob(o.transformTo("arraybuffer",Q),R);case"base64":return u.encode(Q);default:return o.transformTo(U,Q)}}(k,function(U,Q){var R,O=0,ne=null,C=0;for(R=0;R<Q.length;R++)C+=Q[R].length;switch(U){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":for(ne=new Uint8Array(C),R=0;R<Q.length;R++)ne.set(Q[R],O),O+=Q[R].length;return ne;case"nodebuffer":return Buffer.concat(Q);default:throw new Error("concat : unsupported type '"+U+"'")}}(x,v),D);f(K)}catch(U){g(U)}v=[]}).resume()})}function m(y,h,f){var g=h;switch(h){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=h,this._mimeType=f,o.checkSupport(g),this._worker=y.pipe(new c(g)),y.lock()}catch(v){this._worker=new i("error"),this._worker.error(v)}}m.prototype={accumulate:function(y){return s(this,y)},on:function(y,h){var f=this;return y==="data"?this._worker.on(y,function(g){h.call(f,g.data,g.meta)}):this._worker.on(y,function(){o.delay(h,arguments,f)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new j(this,{objectMode:this._outputType!=="nodebuffer"},y)}},_.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(l,_,b){if(b.base64=!0,b.array=!0,b.string=!0,b.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",b.nodebuffer=typeof Buffer<"u",b.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")b.blob=!1;else{var o=new ArrayBuffer(0);try{b.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var c=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);c.append(o),b.blob=c.getBlob("application/zip").size===0}catch{b.blob=!1}}}try{b.nodestream=!!l("readable-stream").Readable}catch{b.nodestream=!1}},{"readable-stream":16}],31:[function(l,_,b){for(var o=l("./utils"),c=l("./support"),i=l("./nodejsUtils"),u=l("./stream/GenericWorker"),r=new Array(256),d=0;d<256;d++)r[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;r[254]=r[254]=1;function j(){u.call(this,"utf-8 decode"),this.leftOver=null}function s(){u.call(this,"utf-8 encode")}b.utf8encode=function(m){return c.nodebuffer?i.newBufferFrom(m,"utf-8"):function(y){var h,f,g,v,x,k=y.length,D=0;for(v=0;v<k;v++)(64512&(f=y.charCodeAt(v)))==55296&&v+1<k&&(64512&(g=y.charCodeAt(v+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),v++),D+=f<128?1:f<2048?2:f<65536?3:4;for(h=c.uint8array?new Uint8Array(D):new Array(D),v=x=0;x<D;v++)(64512&(f=y.charCodeAt(v)))==55296&&v+1<k&&(64512&(g=y.charCodeAt(v+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),v++),f<128?h[x++]=f:(f<2048?h[x++]=192|f>>>6:(f<65536?h[x++]=224|f>>>12:(h[x++]=240|f>>>18,h[x++]=128|f>>>12&63),h[x++]=128|f>>>6&63),h[x++]=128|63&f);return h}(m)},b.utf8decode=function(m){return c.nodebuffer?o.transformTo("nodebuffer",m).toString("utf-8"):function(y){var h,f,g,v,x=y.length,k=new Array(2*x);for(h=f=0;h<x;)if((g=y[h++])<128)k[f++]=g;else if(4<(v=r[g]))k[f++]=65533,h+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&h<x;)g=g<<6|63&y[h++],v--;1<v?k[f++]=65533:g<65536?k[f++]=g:(g-=65536,k[f++]=55296|g>>10&1023,k[f++]=56320|1023&g)}return k.length!==f&&(k.subarray?k=k.subarray(0,f):k.length=f),o.applyFromCharCode(k)}(m=o.transformTo(c.uint8array?"uint8array":"array",m))},o.inherits(j,u),j.prototype.processChunk=function(m){var y=o.transformTo(c.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var h=y;(y=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),y.set(h,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var f=function(v,x){var k;for((x=x||v.length)>v.length&&(x=v.length),k=x-1;0<=k&&(192&v[k])==128;)k--;return k<0||k===0?x:k+r[v[k]]>x?k:x}(y),g=y;f!==y.length&&(c.uint8array?(g=y.subarray(0,f),this.leftOver=y.subarray(f,y.length)):(g=y.slice(0,f),this.leftOver=y.slice(f,y.length))),this.push({data:b.utf8decode(g),meta:m.meta})},j.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:b.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},b.Utf8DecodeWorker=j,o.inherits(s,u),s.prototype.processChunk=function(m){this.push({data:b.utf8encode(m.data),meta:m.meta})},b.Utf8EncodeWorker=s},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(l,_,b){var o=l("./support"),c=l("./base64"),i=l("./nodejsUtils"),u=l("./external");function r(h){return h}function d(h,f){for(var g=0;g<h.length;++g)f[g]=255&h.charCodeAt(g);return f}l("setimmediate"),b.newBlob=function(h,f){b.checkSupport("blob");try{return new Blob([h],{type:f})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(h),g.getBlob(f)}catch{throw new Error("Bug : can't construct the Blob.")}}};var j={stringifyByChunk:function(h,f,g){var v=[],x=0,k=h.length;if(k<=g)return String.fromCharCode.apply(null,h);for(;x<k;)f==="array"||f==="nodebuffer"?v.push(String.fromCharCode.apply(null,h.slice(x,Math.min(x+g,k)))):v.push(String.fromCharCode.apply(null,h.subarray(x,Math.min(x+g,k)))),x+=g;return v.join("")},stringifyByChar:function(h){for(var f="",g=0;g<h.length;g++)f+=String.fromCharCode(h[g]);return f},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,i.allocBuffer(1)).length===1}catch{return!1}}()}};function s(h){var f=65536,g=b.getTypeOf(h),v=!0;if(g==="uint8array"?v=j.applyCanBeUsed.uint8array:g==="nodebuffer"&&(v=j.applyCanBeUsed.nodebuffer),v)for(;1<f;)try{return j.stringifyByChunk(h,g,f)}catch{f=Math.floor(f/2)}return j.stringifyByChar(h)}function m(h,f){for(var g=0;g<h.length;g++)f[g]=h[g];return f}b.applyFromCharCode=s;var y={};y.string={string:r,array:function(h){return d(h,new Array(h.length))},arraybuffer:function(h){return y.string.uint8array(h).buffer},uint8array:function(h){return d(h,new Uint8Array(h.length))},nodebuffer:function(h){return d(h,i.allocBuffer(h.length))}},y.array={string:s,array:r,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return i.newBufferFrom(h)}},y.arraybuffer={string:function(h){return s(new Uint8Array(h))},array:function(h){return m(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:r,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return i.newBufferFrom(new Uint8Array(h))}},y.uint8array={string:s,array:function(h){return m(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:r,nodebuffer:function(h){return i.newBufferFrom(h)}},y.nodebuffer={string:s,array:function(h){return m(h,new Array(h.length))},arraybuffer:function(h){return y.nodebuffer.uint8array(h).buffer},uint8array:function(h){return m(h,new Uint8Array(h.length))},nodebuffer:r},b.transformTo=function(h,f){if(f=f||"",!h)return f;b.checkSupport(h);var g=b.getTypeOf(f);return y[g][h](f)},b.resolve=function(h){for(var f=h.split("/"),g=[],v=0;v<f.length;v++){var x=f[v];x==="."||x===""&&v!==0&&v!==f.length-1||(x===".."?g.pop():g.push(x))}return g.join("/")},b.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":o.nodebuffer&&i.isBuffer(h)?"nodebuffer":o.uint8array&&h instanceof Uint8Array?"uint8array":o.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},b.checkSupport=function(h){if(!o[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},b.MAX_VALUE_16BITS=65535,b.MAX_VALUE_32BITS=-1,b.pretty=function(h){var f,g,v="";for(g=0;g<(h||"").length;g++)v+="\\x"+((f=h.charCodeAt(g))<16?"0":"")+f.toString(16).toUpperCase();return v},b.delay=function(h,f,g){setImmediate(function(){h.apply(g||null,f||[])})},b.inherits=function(h,f){function g(){}g.prototype=f.prototype,h.prototype=new g},b.extend=function(){var h,f,g={};for(h=0;h<arguments.length;h++)for(f in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],f)&&g[f]===void 0&&(g[f]=arguments[h][f]);return g},b.prepareContent=function(h,f,g,v,x){return u.Promise.resolve(f).then(function(k){return o.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new u.Promise(function(D,K){var U=new FileReader;U.onload=function(Q){D(Q.target.result)},U.onerror=function(Q){K(Q.target.error)},U.readAsArrayBuffer(k)}):k}).then(function(k){var D=b.getTypeOf(k);return D?(D==="arraybuffer"?k=b.transformTo("uint8array",k):D==="string"&&(x?k=c.decode(k):g&&v!==!0&&(k=function(K){return d(K,o.uint8array?new Uint8Array(K.length):new Array(K.length))}(k))),k):u.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(l,_,b){var o=l("./reader/readerFor"),c=l("./utils"),i=l("./signature"),u=l("./zipEntry"),r=l("./support");function d(j){this.files=[],this.loadOptions=j}d.prototype={checkSignature:function(j){if(!this.reader.readAndCheckSignature(j)){this.reader.index-=4;var s=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+c.pretty(s)+", expected "+c.pretty(j)+")")}},isSignature:function(j,s){var m=this.reader.index;this.reader.setIndex(j);var y=this.reader.readString(4)===s;return this.reader.setIndex(m),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var j=this.reader.readData(this.zipCommentLength),s=r.uint8array?"uint8array":"array",m=c.transformTo(s,j);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var j,s,m,y=this.zip64EndOfCentralSize-44;0<y;)j=this.reader.readInt(2),s=this.reader.readInt(4),m=this.reader.readData(s),this.zip64ExtensibleData[j]={id:j,length:s,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var j,s;for(j=0;j<this.files.length;j++)s=this.files[j],this.reader.setIndex(s.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),s.readLocalPart(this.reader),s.handleUTF8(),s.processAttributes()},readCentralDir:function(){var j;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(j=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(j);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var j=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(j<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip f
92ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(j);var s=j;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===c.MAX_VALUE_16BITS||this.diskWithCentralDirStart===c.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===c.MAX_VALUE_16BITS||this.centralDirRecords===c.MAX_VALUE_16BITS||this.centralDirSize===c.MAX_VALUE_32BITS||this.centralDirOffset===c.MAX_VALUE_32BITS){if(this.zip64=!0,(j=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(j),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var y=s-m;if(0<y)this.isSignature(s,i.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(j){this.reader=o(j)},load:function(j){this.prepareReader(j),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},_.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(l,_,b){var o=l("./reader/readerFor"),c=l("./utils"),i=l("./compressedObject"),u=l("./crc32"),r=l("./utf8"),d=l("./compressions"),j=l("./support");function s(m,y){this.options=m,this.loadOptions=y}s.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var y,h;if(m.skip(22),this.fileNameLength=m.readInt(2),h=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(h),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=function(f){for(var g in d)if(Object.prototype.hasOwnProperty.call(d,g)&&d[g].magic===f)return d[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+c.pretty(this.compressionMethod)+" unknown (inner file : "+c.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,y,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var y=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(y),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=o(this.extraFields[1].value);this.uncompressedSize===c.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===c.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===c.MAX_VALUE_32BITS&&
vendor: 8,645 bytes, line 92
92(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===c.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var y,h,f,g=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<g;)y=m.readInt(2),h=m.readInt(2),f=m.readData(h),this.extraFields[y]={id:y,length:h,value:f};m.setIndex(g)},handleUTF8:function(){var m=j.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=r.utf8decode(this.fileName),this.fileCommentStr=r.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var h=c.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var f=this.findExtraFieldUnicodeComment();if(f!==null)this.fileCommentStr=f;else{var g=c.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var y=o(m.value);return y.readInt(1)!==1||u(this.fileName)!==y.readInt(4)?null:r.utf8decode(y.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var y=o(m.value);return y.readInt(1)!==1||u(this.fileComment)!==y.readInt(4)?null:r.utf8decode(y.readData(m.length-5))}return null}},_.exports=s},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(l,_,b){function o(y,h,f){this.name=y,this.dir=f.dir,this.date=f.date,this.comment=f.comment,this.unixPermissions=f.unixPermissions,this.dosPermissions=f.dosPermissions,this._data=h,this._dataBinary=f.binary,this.options={compression:f.compression,compressionOptions:f.compressionOptions}}var c=l("./stream/StreamHelper"),i=l("./stream/DataWorker"),u=l("./utf8"),r=l("./compressedObject"),d=l("./stream/GenericWorker");o.prototype={internalStream:function(y){var h=null,f="string";try{if(!y)throw new Error("No output type specified.");var g=(f=y.toLowerCase())==="string"||f==="text";f!=="binarystring"&&f!=="text"||(f="string"),h=this._decompressWorker();var v=!this._dataBinary;v&&!g&&(h=h.pipe(new u.Utf8EncodeWorker)),!v&&g&&(h=h.pipe(new u.Utf8DecodeWorker))}catch(x){(h=new d("error")).error(x)}return new c(h,f,"")},async:function(y,h){return this.internalStream(y).accumulate(h)},nodeStream:function(y,h){return this.internalStream(y||"nodebuffer").toNodejsStream(h)},_compressWorker:function(y,h){if(this._data instanceof r&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var f=this._decompressWorker();return this._dataBinary||(f=f.pipe(new u.Utf8EncodeWorker)),r.createWorkerFrom(f,y,h)},_decompressWorker:function(){return this._data instanceof r?this._data.getContentWorker():this._data instanceof d?this._data:new i(this._data)}};for(var j=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],s=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<j.length;m++)o.prototype[j[m]]=s;_.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(l,_,b){(function(o){var c,i,u=o.MutationObserver||o.WebKitMutationObserver;if(u){var r=0,d=new u(y),j=o.document.createTextNode("");d.observe(j,{characterData:!0}),c=function(){j.data=r=++r%2}}else if(o.setImmediate||o.MessageChannel===void 0)c="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var h=o.document.createElement("script");h.onreadystatechange=function(){y(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},o.document.documentElement.appendChild(h)}:function(){setTimeout(y,0)};else{var s=new o.MessageChannel;s.port1.onmessage=y,c=function(){s.port2.postMessage(0)}}var m=[];function y(){var h,f;i=!0;for(var g=m.length;g;){for(f=m,m=[],h=-1;++h<g;)f[h]();g=m.length}i=!1}_.exports=function(h){m.push(h)!==1||i||c()}}).call(this,typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(l,_,b){var o=l("immediate");function c(){}var i={},u=["REJECTED"],r=["FULFILLED"],d=["PENDING"];function j(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,g!==c&&h(this,g)}function s(g,v,x){this.promise=g,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}function m(g,v,x){o(function(){var k;try{k=v(x)}catch(D){return i.reject(g,D)}k===g?i.reject(g,new TypeError("Cannot resolve promise with itself")):i.resolve(g,k)})}function y(g){var v=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof v=="function")return function(){v.apply(g,arguments)}}function h(g,v){var x=!1;function k(U){x||(x=!0,i.reject(g,U))}function D(U){x||(x=!0,i.resolve(g,U))}var K=f(function(){v(D,k)});K.status==="error"&&k(K.value)}function f(g,v){var x={};try{x.value=g(v),x.status="success"}catch(k){x.status="error",x.value=k}return x}(_.exports=j).prototype.finally=function(g){if(typeof g!="function")return this;var v=this.constructor;return this.then(function(x){return v.resolve(g()).then(function(){return x})},function(x){return v.resolve(g()).then(function(){throw x})})},j.prototype.catch=function(g){return this.then(null,g)},j.prototype.then=function(g,v){if(typeof g!="function"&&this.state===r||typeof v!="function"&&this.state===u)return this;var x=new this.constructor(c);return this.state!==d?m(x,this.state===r?g:v,this.outcome):this.queue.push(new s(x,g,v)),x},s.prototype.callFulfilled=function(g){i.resolve(this.promise,g)},s.prototype.otherCallFulfilled=function(g){m(this.promise,this.onFulfilled,g)},s.prototype.callRejected=function(g){i.reject(this.promise,g)},s.prototype.otherCallRejected=function(g){m(this.promise,this.onRejected,g)},i.resolve=function(g,v){var x=f(y,v);if(x.status==="error")return i.reject(g,x.value);var k=x.value;if(k)h(g,k);else{g.state=r,g.outcome=v;for(var D=-1,K=g.queue.length;++D<K;)g.queue[D].callFulfilled(v)}return g},i.reject=function(g,v){g.state=u,g.outcome=v;for(var x=-1,k=g.queue.length;++x<k;)g.queue[x].callRejected(v);return g},j.resolve=function(g){return g instanceof this?g:i.resolve(new this(c),g)},j.reject=function(g){var v=new this(c);return i.reject(v,g)},j.all=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=g.length,k=!1;if(!x)return this.resolve([]);for(var D=new Array(x),K=0,U=-1,Q=new this(c);++U<x;)R(g[U],U);return Q;function R(O,ne){v.resolve(O).then(function(C){D[ne]=C,++K!==x||k||(k=!0,i.resolve(Q,D))},function(C){k||(k=!0,i.reject(Q,C))})}},j.race=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=g.length,k=!1;if(!x)return this.resolve([]);for(var D=-1,K=new this(c);++D<x;)U=g[D],v.resolve(U).then(function(Q){k||(k=!0,i.resolve(K,Q))},function(Q){k||(k=!0,i.reject(K,Q))});var U;return K}},{immediate:36}],38:[function(l,_,b){var o={};(0,l("./lib/utils/common").assign)(o,l("./lib/deflate"),l("./lib/inflate"),l("./lib/zlib/constants")),_.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(l,_,b){var o=l("./zlib/deflate"),c=l("./utils/common"),i=l("./utils/strings"),u=l("./zlib/messages"),r=l("./zlib/zstream"),d=Object.prototype.toString,j=0,s=-1,m=0,y=8;function h(g){if(!(this instanceof h))return new h(g);this.options=c.assign({level:s,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},g||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,this.strm.avail_out=0;var x=o.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(x!==j)throw new Error(u[x]);if(v.header&&o.deflateSetHeader(this.strm,v.header),v.dictionary){var k;if(k=typeof v.dictionary=="string"?i.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(x=o.deflateSetDictionary(this.strm,k))!==j)throw new Error(u[x]);this._dict_set=!0}}function f(g,v){var x=new h(v);if(x.push(g,!0),x.err)throw x.msg||u[x.err];return x.result}h.prototype.push=function(g,v){var x,k,D=this.strm,K=this.options.chunkSize;if(this.ended)return!1;k=v===~~v?v:v===!0?4:0,typeof g=="string"?D.input=i.string2buf(g):d.call(g)==="[object ArrayBuffer]"?D.input=new
vendor: 6,219 bytes, line 92
92Uint8Array(g):D.input=g,D.next_in=0,D.avail_in=D.input.length;do{if(D.avail_out===0&&(D.output=new c.Buf8(K),D.next_out=0,D.avail_out=K),(x=o.deflate(D,k))!==1&&x!==j)return this.onEnd(x),!(this.ended=!0);D.avail_out!==0&&(D.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(i.buf2binstring(c.shrinkBuf(D.output,D.next_out))):this.onData(c.shrinkBuf(D.output,D.next_out)))}while((0<D.avail_in||D.avail_out===0)&&x!==1);return k===4?(x=o.deflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===j):k!==2||(this.onEnd(j),!(D.avail_out=0))},h.prototype.onData=function(g){this.chunks.push(g)},h.prototype.onEnd=function(g){g===j&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},b.Deflate=h,b.deflate=f,b.deflateRaw=function(g,v){return(v=v||{}).raw=!0,f(g,v)},b.gzip=function(g,v){return(v=v||{}).gzip=!0,f(g,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(l,_,b){var o=l("./zlib/inflate"),c=l("./utils/common"),i=l("./utils/strings"),u=l("./zlib/constants"),r=l("./zlib/messages"),d=l("./zlib/zstream"),j=l("./zlib/gzheader"),s=Object.prototype.toString;function m(h){if(!(this instanceof m))return new m(h);this.options=c.assign({chunkSize:16384,windowBits:0,to:""},h||{});var f=this.options;f.raw&&0<=f.windowBits&&f.windowBits<16&&(f.windowBits=-f.windowBits,f.windowBits===0&&(f.windowBits=-15)),!(0<=f.windowBits&&f.windowBits<16)||h&&h.windowBits||(f.windowBits+=32),15<f.windowBits&&f.windowBits<48&&!(15&f.windowBits)&&(f.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var g=o.inflateInit2(this.strm,f.windowBits);if(g!==u.Z_OK)throw new Error(r[g]);this.header=new j,o.inflateGetHeader(this.strm,this.header)}function y(h,f){var g=new m(f);if(g.push(h,!0),g.err)throw g.msg||r[g.err];return g.result}m.prototype.push=function(h,f){var g,v,x,k,D,K,U=this.strm,Q=this.options.chunkSize,R=this.options.dictionary,O=!1;if(this.ended)return!1;v=f===~~f?f:f===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof h=="string"?U.input=i.binstring2buf(h):s.call(h)==="[object ArrayBuffer]"?U.input=new Uint8Array(h):U.input=h,U.next_in=0,U.avail_in=U.input.length;do{if(U.avail_out===0&&(U.output=new c.Buf8(Q),U.next_out=0,U.avail_out=Q),(g=o.inflate(U,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&R&&(K=typeof R=="string"?i.string2buf(R):s.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,g=o.inflateSetDictionary(this.strm,K)),g===u.Z_BUF_ERROR&&O===!0&&(g=u.Z_OK,O=!1),g!==u.Z_STREAM_END&&g!==u.Z_OK)return this.onEnd(g),!(this.ended=!0);U.next_out&&(U.avail_out!==0&&g!==u.Z_STREAM_END&&(U.avail_in!==0||v!==u.Z_FINISH&&v!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(x=i.utf8border(U.output,U.next_out),k=U.next_out-x,D=i.buf2string(U.output,x),U.next_out=k,U.avail_out=Q-k,k&&c.arraySet(U.output,U.output,x,k,0),this.onData(D)):this.onData(c.shrinkBuf(U.output,U.next_out)))),U.avail_in===0&&U.avail_out===0&&(O=!0)}while((0<U.avail_in||U.avail_out===0)&&g!==u.Z_STREAM_END);return g===u.Z_STREAM_END&&(v=u.Z_FINISH),v===u.Z_FINISH?(g=o.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===u.Z_OK):v!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(U.avail_out=0))},m.prototype.onData=function(h){this.chunks.push(h)},m.prototype.onEnd=function(h){h===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},b.Inflate=m,b.inflate=y,b.inflateRaw=function(h,f){return(f=f||{}).raw=!0,y(h,f)},b.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(l,_,b){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";b.assign=function(u){for(var r=Array.prototype.slice.call(arguments,1);r.length;){var d=r.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var j in d)d.hasOwnProperty(j)&&(u[j]=d[j])}}return u},b.shrinkBuf=function(u,r){return u.length===r?u:u.subarray?u.subarray(0,r):(u.length=r,u)};var c={arraySet:function(u,r,d,j,s){if(r.subarray&&u.subarray)u.set(r.subarray(d,d+j),s);else for(var m=0;m<j;m++)u[s+m]=r[d+m]},flattenChunks:function(u){var r,d,j,s,m,y;for(r=j=0,d=u.length;r<d;r++)j+=u[r].length;for(y=new Uint8Array(j),r=s=0,d=u.length;r<d;r++)m=u[r],y.set(m,s),s+=m.length;return y}},i={arraySet:function(u,r,d,j,s){for(var m=0;m<j;m++)u[s+m]=r[d+m]},flattenChunks:function(u){return[].concat.apply([],u)}};b.setTyped=function(u){u?(b.Buf8=Uint8Array,b.Buf16=Uint16Array,b.Buf32=Int32Array,b.assign(b,c)):(b.Buf8=Array,b.Buf16=Array,b.Buf32=Array,b.assign(b,i))},b.setTyped(o)},{}],42:[function(l,_,b){var o=l("./common"),c=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch{c=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{i=!1}for(var u=new o.Buf8(256),r=0;r<256;r++)u[r]=252<=r?6:248<=r?5:240<=r?4:224<=r?3:192<=r?2:1;function d(j,s){if(s<65537&&(j.subarray&&i||!j.subarray&&c))return String.fromCharCode.apply(null,o.shrinkBuf(j,s));for(var m="",y=0;y<s;y++)m+=String.fromCharCode(j[y]);return m}u[254]=u[254]=1,b.string2buf=function(j){var s,m,y,h,f,g=j.length,v=0;for(h=0;h<g;h++)(64512&(m=j.charCodeAt(h)))==55296&&h+1<g&&(64512&(y=j.charCodeAt(h+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),h++),v+=m<128?1:m<2048?2:m<65536?3:4;for(s=new o.Buf8(v),h=f=0;f<v;h++)(64512&(m=j.charCodeAt(h)))==55296&&h+1<g&&(64512&(y=j.charCodeAt(h+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),h++),m<128?s[f++]=m:(m<2048?s[f++]=192|m>>>6:(m<65536?s[f++]=224|m>>>12:(s[f++]=240|m>>>18,s[f++]=128|m>>>12&63),s[f++]=128|m>>>6&63),s[f++]=128|63&m);return s},b.buf2binstring=function(j){return d(j,j.length)},b.binstring2buf=function(j){for(var s=new o.Buf8(j.length),m=0,y=s.length;m<y;m++)s[m]=j.charCodeAt(m);return s},b.buf2string=function(j,s){var m,y,h,f,g=s||j.length,v=new Array(2*g);for(m=y=0;m<g;)if((h=j[m++])<128)v[y++]=h;else if(4<(f=u[h]))v[y++]=65533,m+=f-1;else{for(h&=f===2?31:f===3?15:7;1<f&&m<g;)h=h<<6|63&j[m++],f--;1<f?v[y++]=65533:h<65536?v[y++]=h:(h-=65536,v[y++]=55296|h>>
vendor: 11,602 bytes, line 92
9210&1023,v[y++]=56320|1023&h)}return d(v,y)},b.utf8border=function(j,s){var m;for((s=s||j.length)>j.length&&(s=j.length),m=s-1;0<=m&&(192&j[m])==128;)m--;return m<0||m===0?s:m+u[j[m]]>s?m:s}},{"./common":41}],43:[function(l,_,b){_.exports=function(o,c,i,u){for(var r=65535&o|0,d=o>>>16&65535|0,j=0;i!==0;){for(i-=j=2e3<i?2e3:i;d=d+(r=r+c[u++]|0)|0,--j;);r%=65521,d%=65521}return r|d<<16|0}},{}],44:[function(l,_,b){_.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(l,_,b){var o=function(){for(var c,i=[],u=0;u<256;u++){c=u;for(var r=0;r<8;r++)c=1&c?3988292384^c>>>1:c>>>1;i[u]=c}return i}();_.exports=function(c,i,u,r){var d=o,j=r+u;c^=-1;for(var s=r;s<j;s++)c=c>>>8^d[255&(c^i[s])];return-1^c}},{}],46:[function(l,_,b){var o,c=l("../utils/common"),i=l("./trees"),u=l("./adler32"),r=l("./crc32"),d=l("./messages"),j=0,s=4,m=0,y=-2,h=-1,f=4,g=2,v=8,x=9,k=286,D=30,K=19,U=2*k+1,Q=15,R=3,O=258,ne=O+R+1,C=42,W=113,n=1,S=2,oe=3,J=4;function xe(a,V){return a.msg=d[V],V}function Z(a){return(a<<1)-(4<a?9:0)}function Y(a){for(var V=a.length;0<=--V;)a[V]=0}function L(a){var V=a.state,M=V.pending;M>a.avail_out&&(M=a.avail_out),M!==0&&(c.arraySet(a.output,V.pending_buf,V.pending_out,M,a.next_out),a.next_out+=M,V.pending_out+=M,a.total_out+=M,a.avail_out-=M,V.pending-=M,V.pending===0&&(V.pending_out=0))}function F(a,V){i._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,V),a.block_start=a.strstart,L(a.strm)}function he(a,V){a.pending_buf[a.pending++]=V}function ie(a,V){a.pending_buf[a.pending++]=V>>>8&255,a.pending_buf[a.pending++]=255&V}function te(a,V){var M,N,w=a.max_chain_length,B=a.strstart,X=a.prev_length,ee=a.nice_match,G=a.strstart>a.w_size-ne?a.strstart-(a.w_size-ne):0,se=a.window,de=a.w_mask,re=a.prev,pe=a.strstart+O,Ge=se[B+X-1],Ae=se[B+X];a.prev_length>=a.good_match&&(w>>=2),ee>a.lookahead&&(ee=a.lookahead);do if(se[(M=V)+X]===Ae&&se[M+X-1]===Ge&&se[M]===se[B]&&se[++M]===se[B+1]){B+=2,M++;do;while(se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&se[++B]===se[++M]&&B<pe);if(N=O-(pe-B),B=pe-O,X<N){if(a.match_start=V,ee<=(X=N))break;Ge=se[B+X-1],Ae=se[B+X]}}while((V=re[V&de])>G&&--w!=0);return X<=a.lookahead?X:a.lookahead}function Fe(a){var V,M,N,w,B,X,ee,G,se,de,re=a.w_size;do{if(w=a.window_size-a.lookahead-a.strstart,a.strstart>=re+(re-ne)){for(c.arraySet(a.window,a.window,re,re,0),a.match_start-=re,a.strstart-=re,a.block_start-=re,V=M=a.hash_size;N=a.head[--V],a.head[V]=re<=N?N-re:0,--M;);for(V=M=re;N=a.prev[--V],a.prev[V]=re<=N?N-re:0,--M;);w+=re}if(a.strm.avail_in===0)break;if(X=a.strm,ee=a.window,G=a.strstart+a.lookahead,se=w,de=void 0,de=X.avail_in,se<de&&(de=se),M=de===0?0:(X.avail_in-=de,c.arraySet(ee,X.input,X.next_in,de,G),X.state.wrap===1?X.adler=u(X.adler,ee,de,G):X.state.wrap===2&&(X.adler=r(X.adler,ee,de,G)),X.next_in+=de,X.total_in+=de,de),a.lookahead+=M,a.lookahead+a.insert>=R)for(B=a.strstart-a.insert,a.ins_h=a.window[B],a.ins_h=(a.ins_h<<a.hash_shift^a.window[B+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[B+R-1])&a.hash_mask,a.prev[B&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=B,B++,a.insert--,!(a.lookahead+a.insert<R)););}while(a.lookahead<ne&&a.strm.avail_in!==0)}function He(a,V){for(var M,N;;){if(a.lookahead<ne){if(Fe(a),a.lookahead<ne&&V===j)return n;if(a.lookahead===0)break}if(M=0,a.lookahead>=R&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+R-1])&a.hash_mask,M=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),M!==0&&a.strstart-M<=a.w_size-ne&&(a.match_length=te(a,M)),a.match_length>=R)if(N=i._tr_tally(a,a.strstart-a.match_start,a.match_length-R),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=R){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+R-1])&a.hash_mask,M=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else N=i._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(N&&(F(a,!1),a.strm.avail_out===0))return n}return a.insert=a.strstart<R-1?a.strstart:R-1,V===s?(F(a,!0),a.strm.avail_out===0?oe:J):a.last_lit&&(F(a,!1),a.strm.avail_out===0)?n:S}function we(a,V){for(var M,N,w;;){if(a.lookahead<ne){if(Fe(a),a.lookahead<ne&&V===j)return n;if(a.lookahead===0)break}if(M=0,a.lookahead>=R&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+R-1])&a.hash_mask,M=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=R-1,M!==0&&a.prev_length<a.max_lazy_match&&a.strstart-M<=a.w_size-ne&&(a.match_length=te(a,M),a.match_length<=5&&(a.strategy===1||a.match_length===R&&4096<a.strstart-a.match_start)&&(a.match_length=R-1)),a.prev_length>=R&&a.match_length<=a.prev_length){for(w=a.strstart+a.lookahead-R,N=i._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-R),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=w&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+R-1])&a.hash_mask,M=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=R-1,a.strstart++,N&&(F(a,!1),a.strm.avail_out===0))return n}else if(a.match_available){if((N=i._tr_tally(a,0,a.window[a.strstart-1]))&&F(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return n}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(N=i._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<R-1?a.strstart:R-1,V===s?(F(a,!0),a.strm.avail_out===0?oe:J):a.last_lit&&(F(a,!1),a.strm.avail_out===0)?n:S}function be(a,V,M,N,w){this.good_length=a,this.max_lazy=V,this.nice_length=M,this.max_chain=N,this.func=w}function I(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new c.Buf16(2*U),this.dyn_dtree=new c.Buf16(2*(2*D+1)),this.bl_tree=new c.Buf16(2*(2*K+1)),Y(this.dyn_ltree),Y(this.dyn_dtree),Y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new c.Buf16(Q+1),this.heap=new c.Buf16(2*k+1),Y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new c.Buf16(2*k+1),Y(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function me(a){var V;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=g,(V=a.state).pending=0,V.pending_out=0,V.wrap<0&&(V.wrap=-V.wrap),V.status=V.wrap?C:W,a.adler=V.wrap===2?0:1,V.last_flush=j,i._tr_init(V),m):xe(a,y)}function ke(a){var V=me(a);return V===m&&function(M){M.window_size=2*M.w_size,Y(M.head),M.max_lazy_match=o[M.level].max_lazy,M.good_match=o[M.level].good_length,M.nice_match=o[M.level].nice_length,M.max_chain_length=o[M.level].max_chain,M.strstart=0,M.block_start=0,M.lookahead=0,M.insert=0,M.match_length=M.prev_length=R-1,M.match_available=0,M.ins_h=0}(a.state),V}function A(a,V,M,N,w,B){if(!a)return y;var X=1;if(V===h&&(V=6),N<0?(X=0,N=-N):15<N&&(X=2,N-=16),w<1||x<w||M!==v||N<8||15<N||V<0||9<V||B<0||f<B)return xe(a,y);N===8&&(N=9);var ee=new I;return(a.state=ee).strm=a,ee.wrap=X,ee.gzhead=null,ee.w_bits=N,ee.w_size=1<<ee.w_bits,ee.w_mask=ee.w_size-1,ee.hash_bits=w+7,ee.hash_size=1<<ee.hash_bits,ee.hash_mask=ee.hash_size-1,ee.hash_shift=~~((ee.hash_bits+R-1)/R),ee.window=new c.Buf8(2*ee.w_size),ee.head=new c.Buf16(ee.hash_size),ee.prev=new c.Buf16(ee.w_size),ee.lit_bufsize=1<<w+6,ee.pending_buf_size=4*ee.lit_bufsize,ee.pending_buf=new c.Buf8(ee.pending_buf_size),ee.d_buf=1*ee.lit_bufsize,ee.l_buf=3*ee.lit_bufsize,ee.level=V,ee.strategy=B,ee.method=M,ke(a)}o=[new be(0,0,0,0,function(a,V){var M=65535;for(M>a.pending_buf_size-5&&(M=a.pending_buf_size-5);;){if(a.lookahead<=1){if(Fe(a),a.lookahead===0&&V===j)return n;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var N=a.block_start+M;if((a.strstart===0||a.strstart>=N)&&(a.lookahead=a.strstart-N,a.strstart=N,F(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-ne&&(F(a,!1),a.strm.avail_out===0))return n}return a.insert=0,V===s?(F(a,!0),a.strm.avail_out===0?oe:J):(a.strstart>a.block_start&&(F(a,!1),a.strm.avail_out),n)}),new be(4,4,8,4,He),new be(4,5,16,8,He),new be(4,6,32,32,He),new be(4,4,16,16,we),new be(8,16,32,32,we),new be(8,16,128,128,we),new be(8,32,128,256,we),new be(32,128,258,1024,we),new be(32,258,258,4096,we)],b.deflateInit=function(a,V){return A(a,V,v,15,8,0)},b.deflateInit2=A,b.deflateReset=ke,b.deflateResetKeep=me,b.deflateSetHeader=function(a,V){return a&&a.state?a.state.wrap!==2?y:(a.state.gzhead=V,m):y},b.deflate=function(a,V){var M,N,w,B;if(!a||!a.state||5<V||V<0)return a?xe(a,y):y;if(N=a.state,!a.output||!a.input&&a.avail_in!==0||N.status===666&&V!==s)return xe(a,a.avail_out===0?-5:y);if(N.strm=a,M=N.last_flush,N.last_flush=V,N.status===C)if(N.wrap===2)a.adler=0,he(N,31),he(N,139),he(N,8),N.gzhead?(he(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),he(N,255&N.gzhead.time),he(N,N.gzhead.time>>8&255),he(N,N.gzhead.time>>16&255),he(N,N.gzhead.time>>24&255),he(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),he(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(he(N,255&N.gzhead.extra.length),he(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(a.adler=r(a.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(he(N,0),he(N,0),he(N,0),he(N,0),he(N,0),he(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),he(N,3),N.status=W);else{var X=v+(N.w_bits-8<<4)<<8;X|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(X|=32),X+=31-X%31,N.status=W,ie(N,X),N.strstart!==0&&(ie(N,a.adler>>>16),ie(N,65535&a.adler)),a.adler=1}if(N.status===69)if(N.gzhead.extra){for(w=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),L(a),w=N.pending,N.pending!==N.pending_buf_size));)he(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){w=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),L(a),w=N.pending,N.pending===N.pending_buf_size)){B=1;break}B=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,he(N,B)}while(B!==0);N.gzhead.hcrc&&N.pending>
vendor: 21,202 bytes, line 92
92w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),B===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){w=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),L(a),w=N.pending,N.pending===N.pending_buf_size)){B=1;break}B=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,he(N,B)}while(B!==0);N.gzhead.hcrc&&N.pending>w&&(a.adler=r(a.adler,N.pending_buf,N.pending-w,w)),B===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&L(a),N.pending+2<=N.pending_buf_size&&(he(N,255&a.adler),he(N,a.adler>>8&255),a.adler=0,N.status=W)):N.status=W),N.pending!==0){if(L(a),a.avail_out===0)return N.last_flush=-1,m}else if(a.avail_in===0&&Z(V)<=Z(M)&&V!==s)return xe(a,-5);if(N.status===666&&a.avail_in!==0)return xe(a,-5);if(a.avail_in!==0||N.lookahead!==0||V!==j&&N.status!==666){var ee=N.strategy===2?function(G,se){for(var de;;){if(G.lookahead===0&&(Fe(G),G.lookahead===0)){if(se===j)return n;break}if(G.match_length=0,de=i._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,de&&(F(G,!1),G.strm.avail_out===0))return n}return G.insert=0,se===s?(F(G,!0),G.strm.avail_out===0?oe:J):G.last_lit&&(F(G,!1),G.strm.avail_out===0)?n:S}(N,V):N.strategy===3?function(G,se){for(var de,re,pe,Ge,Ae=G.window;;){if(G.lookahead<=O){if(Fe(G),G.lookahead<=O&&se===j)return n;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=R&&0<G.strstart&&(re=Ae[pe=G.strstart-1])===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]){Ge=G.strstart+O;do;while(re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&re===Ae[++pe]&&pe<Ge);G.match_length=O-(Ge-pe),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=R?(de=i._tr_tally(G,1,G.match_length-R),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(de=i._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),de&&(F(G,!1),G.strm.avail_out===0))return n}return G.insert=0,se===s?(F(G,!0),G.strm.avail_out===0?oe:J):G.last_lit&&(F(G,!1),G.strm.avail_out===0)?n:S}(N,V):o[N.level].func(N,V);if(ee!==oe&&ee!==J||(N.status=666),ee===n||ee===oe)return a.avail_out===0&&(N.last_flush=-1),m;if(ee===S&&(V===1?i._tr_align(N):V!==5&&(i._tr_stored_block(N,0,0,!1),V===3&&(Y(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),L(a),a.avail_out===0))return N.last_flush=-1,m}return V!==s?m:N.wrap<=0?1:(N.wrap===2?(he(N,255&a.adler),he(N,a.adler>>8&255),he(N,a.adler>>16&255),he(N,a.adler>>24&255),he(N,255&a.total_in),he(N,a.total_in>>8&255),he(N,a.total_in>>16&255),he(N,a.total_in>>24&255)):(ie(N,a.adler>>>16),ie(N,65535&a.adler)),L(a),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?m:1)},b.deflateEnd=function(a){var V;return a&&a.state?(V=a.state.status)!==C&&V!==69&&V!==73&&V!==91&&V!==103&&V!==W&&V!==666?xe(a,y):(a.state=null,V===W?xe(a,-3):m):y},b.deflateSetDictionary=function(a,V){var M,N,w,B,X,ee,G,se,de=V.length;if(!a||!a.state||(B=(M=a.state).wrap)===2||B===1&&M.status!==C||M.lookahead)return y;for(B===1&&(a.adler=u(a.adler,V,de,0)),M.wrap=0,de>=M.w_size&&(B===0&&(Y(M.head),M.strstart=0,M.block_start=0,M.insert=0),se=new c.Buf8(M.w_size),c.arraySet(se,V,de-M.w_size,M.w_size,0),V=se,de=M.w_size),X=a.avail_in,ee=a.next_in,G=a.input,a.avail_in=de,a.next_in=0,a.input=V,Fe(M);M.lookahead>=R;){for(N=M.strstart,w=M.lookahead-(R-1);M.ins_h=(M.ins_h<<M.hash_shift^M.window[N+R-1])&M.hash_mask,M.prev[N&M.w_mask]=M.head[M.ins_h],M.head[M.ins_h]=N,N++,--w;);M.strstart=N,M.lookahead=R-1,Fe(M)}return M.strstart+=M.lookahead,M.block_start=M.strstart,M.insert=M.lookahead,M.lookahead=0,M.match_length=M.prev_length=R-1,M.match_available=0,a.next_in=ee,a.input=G,a.avail_in=X,M.wrap=B,m},b.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(l,_,b){_.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(l,_,b){_.exports=function(o,c){var i,u,r,d,j,s,m,y,h,f,g,v,x,k,D,K,U,Q,R,O,ne,C,W,n,S;i=o.state,u=o.next_in,n=o.input,r=u+(o.avail_in-5),d=o.next_out,S=o.output,j=d-(c-o.avail_out),s=d+(o.avail_out-257),m=i.dmax,y=i.wsize,h=i.whave,f=i.wnext,g=i.window,v=i.hold,x=i.bits,k=i.lencode,D=i.distcode,K=(1<<i.lenbits)-1,U=(1<<i.distbits)-1;e:do{x<15&&(v+=n[u++]<<x,x+=8,v+=n[u++]<<x,x+=8),Q=k[v&K];t:for(;;){if(v>>>=R=Q>>>24,x-=R,(R=Q>>>16&255)===0)S[d++]=65535&Q;else{if(!(16&R)){if(!(64&R)){Q=k[(65535&Q)+(v&(1<<R)-1)];continue t}if(32&R){i.mode=12;break e}o.msg="invalid literal/length code",i.mode=30;break e}O=65535&Q,(R&=15)&&(x<R&&(v+=n[u++]<<x,x+=8),O+=v&(1<<R)-1,v>>>=R,x-=R),x<15&&(v+=n[u++]<<x,x+=8,v+=n[u++]<<x,x+=8),Q=D[v&U];s:for(;;){if(v>>>=R=Q>>>24,x-=R,!(16&(R=Q>>>16&255))){if(!(64&R)){Q=D[(65535&Q)+(v&(1<<R)-1)];continue s}o.msg="invalid distance code",i.mode=30;break e}if(ne=65535&Q,x<(R&=15)&&(v+=n[u++]<<x,(x+=8)<R&&(v+=n[u++]<<x,x+=8)),m<(ne+=v&(1<<R)-1)){o.msg="invalid distance too far back",i.mode=30;break e}if(v>>>=R,x-=R,(R=d-j)<ne){if(h<(R=ne-R)&&i.sane){o.msg="invalid distance too far back",i.mode=30;break e}if(W=g,(C=0)===f){if(C+=y-R,R<O){for(O-=R;S[d++]=g[C++],--R;);C=d-ne,W=S}}else if(f<R){if(C+=y+f-R,(R-=f)<O){for(O-=R;S[d++]=g[C++],--R;);if(C=0,f<O){for(O-=R=f;S[d++]=g[C++],--R;);C=d-ne,W=S}}}else if(C+=f-R,R<O){for(O-=R;S[d++]=g[C++],--R;);C=d-ne,W=S}for(;2<O;)S[d++]=W[C++],S[d++]=W[C++],S[d++]=W[C++],O-=3;O&&(S[d++]=W[C++],1<O&&(S[d++]=W[C++]))}else{for(C=d-ne;S[d++]=S[C++],S[d++]=S[C++],S[d++]=S[C++],2<(O-=3););O&&(S[d++]=S[C++],1<O&&(S[d++]=S[C++]))}break}}break}}while(u<r&&d<s);u-=O=x>>3,v&=(1<<(x-=O<<3))-1,o.next_in=u,o.next_out=d,o.avail_in=u<r?r-u+5:5-(u-r),o.avail_out=d<s?s-d+257:257-(d-s),i.hold=v,i.bits=x}},{}],49:[function(l,_,b){var o=l("../utils/common"),c=l("./adler32"),i=l("./crc32"),u=l("./inffast"),r=l("./inftrees"),d=1,j=2,s=0,m=-2,y=1,h=852,f=592;function g(C){return(C>>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(C){var W;return C&&C.state?(W=C.state,C.total_in=C.total_out=W.total=0,C.msg="",W.wrap&&(C.adler=1&W.wrap),W.mode=y,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new o.Buf32(h),W.distcode=W.distdyn=new o.Buf32(f),W.sane=1,W.back=-1,s):m}function k(C){var W;return C&&C.state?((W=C.state).wsize=0,W.whave=0,W.wnext=0,x(C)):m}function D(C,W){var n,S;return C&&C.state?(S=C.state,W<0?(n=0,W=-W):(n=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?m:(S.window!==null&&S.wbits!==W&&(S.window=null),S.wrap=n,S.wbits=W,k(C))):m}function K(C,W){var n,S;return C?(S=new v,(C.state=S).window=null,(n=D(C,W))!==s&&(C.state=null),n):m}var U,Q,R=!0;function O(C){if(R){var W;for(U=new o.Buf32(512),Q=new o.Buf32(32),W=0;W<144;)C.lens[W++]=8;for(;W<256;)C.lens[W++]=9;for(;W<280;)C.lens[W++]=7;for(;W<288;)C.lens[W++]=8;for(r(d,C.lens,0,288,U,0,C.work,{bits:9}),W=0;W<32;)C.lens[W++]=5;r(j,C.lens,0,32,Q,0,C.work,{bits:5}),R=!1}C.lencode=U,C.lenbits=9,C.distcode=Q,C.distbits=5}function ne(C,W,n,S){var oe,J=C.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new o.Buf8(J.wsize)),S>=J.wsize?(o.arraySet(J.window,W,n-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(S<(oe=J.wsize-J.wnext)&&(oe=S),o.arraySet(J.window,W,n-S,oe,J.wnext),(S-=oe)?(o.arraySet(J.window,W,n-S,S,0),J.wnext=S,J.whave=J.wsize):(J.wnext+=oe,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=oe))),0}b.inflateReset=k,b.inflateReset2=D,b.inflateResetKeep=x,b.inflateInit=function(C){return K(C,15)},b.inflateInit2=K,b.inflate=function(C,W){var n,S,oe,J,xe,Z,Y,L,F,he,ie,te,Fe,He,we,be,I,me,ke,A,a,V,M,N,w=0,B=new o.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!C||!C.state||!C.output||!C.input&&C.avail_in!==0)return m;(n=C.state).mode===12&&(n.mode=13),xe=C.next_out,oe=C.output,Y=C.avail_out,J=C.next_in,S=C.input,Z=C.avail_in,L=n.hold,F=n.bits,he=Z,ie=Y,V=s;e:for(;;)switch(n.mode){case y:if(n.wrap===0){n.mode=13;break}for(;F<16;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(2&n.wrap&&L===35615){B[n.check=0]=255&L,B[1]=L>>>8&255,n.check=i(n.check,B,2,0),F=L=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&L)<<8)+(L>>8))%31){C.msg="incorrect header check",n.mode=30;break}if((15&L)!=8){C.msg="unknown compression method",n.mode=30;break}if(F-=4,a=8+(15&(L>>>=4)),n.wbits===0)n.wbits=a;else if(a>n.wbits){C.msg="invalid window size",n.mode=30;break}n.dmax=1<<a,C.adler=n.check=1,n.mode=512&L?10:12,F=L=0;break;case 2:for(;F<16;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(n.flags=L,(255&n.flags)!=8){C.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){C.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=L>>8&1),512&n.flags&&(B[0]=255&L,B[1]=L>>>8&255,n.check=i(n.check,B,2,0)),F=L=0,n.mode=3;case 3:for(;F<32;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.head&&(n.head.time=L),512&n.flags&&(B[0]=255&L,B[1]=L>>>8&255,B[2]=L>>>16&255,B[3]=L>>>24&255,n.check=i(n.check,B,4,0)),F=L=0,n.mode=4;case 4:for(;F<16;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.head&&(n.head.xflags=255&L,n.head.os=L>>8),512&n.flags&&(B[0]=255&L,B[1]=L>>>8&255,n.check=i(n.check,B,2,0)),F=L=0,n.mode=5;case 5:if(1024&n.flags){for(;F<16;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.length=L,n.head&&(n.head.extra_len=L),512&n.flags&&(B[0]=255&L,B[1]=L>>>8&255,n.check=i(n.check,B,2,0)),F=L=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(Z<(te=n.length)&&(te=Z),te&&(n.head&&(a=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),o.arraySet(n.head.extra,S,J,te,a)),512&n.flags&&(n.check=i(n.check,S,te,J)),Z-=te,J+=te,n.length-=te),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(Z===0)break e;for(te=0;a=S[J+te++],n.head&&a&&n.length<65536&&(n.head.name+=String.fromCharCode(a)),a&&te<Z;);if(512&n.flags&&(n.check=i(n.check,S,te,J)),Z-=te,J+=te,a)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(Z===0)break e;for(te=0;a=S[J+te++],n.head&&a&&n.length<65536&&(n.head.comment+=String.fromCharCode(a)),a&&te<Z;);if(512&n.flags&&(n.check=i(n.check,S,te,J)),Z-=te,J+=te,a)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;F<16;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(L!==(65535&n.check)){C.msg="header crc mismatch",n.mode=30;break}F=L=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),C.adler=n.check=0,n.mode=12;break;case 10:for(;F<32;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}C.adler=n.check=g(L),F=L=0,n.mode=11;case 11:if(n.havedict===0)return C.next_out=xe,C.avail_out=Y,C.next_in=J,C.avail_in=Z,n.hold=L,n.bits=F,2;C.adler=n.check=1,n.mode=12;case 12:if(W===5||W===6)break e;case 13:if(n.last){L>>>=7&F,F-=7&F,n.mode=27;break}for(;F<3;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}switch(n.last=1&L,F-=1,3&(L>>>=1)){case 0:n.mode=14;break;case 1:if(O(n),n.mode=20,W!==6)break;L>>>=2,F-=2;break e;case 2:n.mode=17;break;case 3:C.msg="invalid block type",n.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if((65535&L)!=(L>>>16^65535)){C.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&L,F=L=0,n.mode=15,W===6)break e;case 15:n.mode=16;case 16:if(te=n.length){if(Z<te&&(te=Z),Y<te&&(te=Y),te===0)break e;o.arraySet(oe,S,J,te,xe),Z-=te,J+=te,Y-=te,xe+=te,n.length-=te;break}n.mode=12;break;case 17:for(;F<14;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(n.nlen=257+(31&L),L>>>=5,F-=5,n.ndist=1+(31&L),L>>>=5,F-=5,n.ncode=4+(15&L),L>>>=4,F-=4,286<n.nlen||30<n.ndist){C.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;F<3;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.lens[X[n.have++]]=7&L,L>>>=3,F-=3}for(;n.have<19;)n.lens[X[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},V=r(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,V){C.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;be=(w=n.lencode[L&(1<<n.lenbits)-1])>>>16&255,I=65535&w,!((we=w>>>24)<=F);){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(I<16)L>>>=we,F-=we,n.lens[n.have++]=I;else{if(I===16){for(N=we+2;F<N;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(L>>>=we,F-=we,n.have===0){C.msg="invalid bit length repeat",n.mode=30;break}a=n.lens[n.have-1],te=3+(3&L),L>>>=2,F-=2}else if(I===17){for(N=we+3;F<N;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}F-=we,a=0,te=3+(7&(L>>>=we)),L>>>=3,F-=3}else{for(N=we+7;F<N;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}F-=we,a=0,te=11+(127&(L>>>=we)),L>>>=7,F-=7}if(n.have+te>n.nlen+n.ndist){C.msg="invalid bit length repeat",n.mode=30;break}for(;te--;)n.lens[n.have++]=a}}if(n.mode===30)break;if(n.lens[256]===0){C.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,M={bits:n.lenbits},V=r(d,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,V){C.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},V=r(j,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,V){C.msg="invalid distances set",n.mode=30;break}if(n.mode=20,W===6)break e;case 20:n.mode=21;case 21:if(6<=Z&&258<=Y){C.next_out=xe,C.avail_out=Y,C.next_in=J,C.avail_in=Z,n.hold=L,n.bits=F,u(C,ie),xe=C.next_out,oe=C.output,Y=C.avail_out,J=C.next_in,S=C.input,Z=C.avail_in,L=n.hold,F=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;be=(w=n.lencode[L&(1<<n.lenbits)-1])>>>16&255,I=65535&w,!((we=w>>>24)<=F);){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(be&&!(240&be)){for(me=we,ke=be,A=I;be=(w=n.lencode[A+((L&(1<<me+ke)-1)>>me)])>>>16&255,I=65535&w,!(me+(we=w>>>24)<=F);){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}L>>>=me,F-=me,n.back+=me}if(L>>>=we,F-=we,n.back+=we,n.length=I,be===0){n.mode=26;break}if(32&be){n.back=-1,n.mode=12;break}if(64&be){C.msg="invalid literal/length code",n.mode=30;break}n.extra=15&be,n.mode=22;case 22:if(n.extra){for(N=n.extra;F<N;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.length+=L&(1<<n.extra)-1,L>>>=n.extra,F-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;be=(w=n.distcode[L&(1<<n.distbits)-1])>>>16&255,I=65535&w,!((we=w>>>24)<=F);){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(!(240&be)){for(me=we,ke=be,A=I;be=(w=n.distcode[A+((L&(1<<me+ke)-1)>>me)])>>>16&255,I=65535&w,!(me+(we=w>>>24)<=F);){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}L>>>=me,F-=me,n.back+=me}if(L>>>=we,F-=we,n.back+=we,64&be){C.msg="invalid distance code",n.mode=30;break}n.offset=I,n.extra=15&be,n.mode=24;case 24:if(n.extra){for(N=n.extra;F<N;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}n.offset+=L&(1<<n.extra)-1,L>>>=n.extra,F-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){C.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(Y===0)break e;if(te=ie-Y,n.offset>te){if((te=n.offset-te)>n.whave&&n.sane){C.msg="invalid distance too far back",n.mode=30;break}Fe=te>n.wnext?(te-=n.wnext,n.wsize-te):n.wnext-te,te>n.length&&(te=n.length),He=n.window}else He=oe,Fe=xe-n.offset,te=n.length;for(Y<te&&(te=Y),Y-=te,n.length-=te;oe[xe++]=He[Fe++],--te;);n.length===0&&(n.mode=21);break;case 26:if(Y===0)break e;oe[xe++]=n.length,Y--,n.mode=21;break;case 27:if(n.wrap){for(;F<32;){if(Z===0)break e;Z--,L|=S[J++]<<F,F+=8}if(ie-=Y,C.total_out+=ie,n.total+=ie,ie&&(C.adler=n.check=n.flags?i(n.check,oe,ie,xe-ie):c(n.check,oe,ie,xe-ie)),ie=Y,(n.flags?L:g(L))!==n.check){C.msg="incorrect data check",n.mode=30;break}F=L=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;F<32;){if(Z===0)break e;Z--,L+=S[J++]<<F,F+=8}if(L!==(4294967295&n.total)){C.msg="incorrect length check",n.mode=30;break}F=L=0}n.mode=29;case 29:V=1;break e;case 30:V=-3;break e;case 31:return-4;case 32:default:return m}return C.next_out=xe,C.avail_out=Y,C.next_in=J,C.avail_in=Z,n.hold=L,n.bits=F,(n.wsize||ie!==C.avail_out&&n.mode<30&&(n.mode<27||W!==4))&&ne(C,C.output,C.next_out,ie-C.avail_out)?(n.mode=31,-4):(he-=C.avail_in,ie-=C.avail_out,C.total_in+=he,C.total_out+=ie,n.total+=ie,n.wrap&&ie&&(C.adler=n.check=n.flags?i(n.check,oe,ie,C.next_out-ie):c(n.check,oe,ie,C.next_out-ie)),C.data_type=n.bits+(n.last?64:0)+(n.mode===12?128:0)+(n.mode===20||n.mode===15?256:0),(he==0&&ie===0||W===4)&&V===s&&(V=-5),V)},b.inflateEnd=function(C){if(!C||!C.state)return m;var W=C.state;return W.window&&(W.window=null),C.state=null,s},b.inflateGetHeader=function(C,W){var n;return C&&C.state&&2&(n=C.state).wrap?((n.head=W).done=!1,s):m},b.inflateSetDictionary=function(C,W){var n,S=W.length;return C&&C.state?(n=C.state).wrap!==0&&n.mode!==11?m:n.mode===11&&c(1,W,S,0)!==n.check?-3:ne(C,W,S,S)?(n.mode=31,-4):(n.havedict=1,s):m},b.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(l,_,b){var o=l("../utils/common"),c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],r=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];_.exports=function(d,j,s,m,y,h,f,g){var v,x,k,D,K,U,Q,R,O,ne=g.bits,C=0,W=0,n=0,S=0,oe=0,J=0,xe=0,Z=0,Y=0,L=0,F=null,he=0,ie=new o.Buf16(16),te=new o.Buf16(16),Fe=null,He=0;for(C=0;C<=15;C++)ie[C]=0;for(W=0;W<m;W++)ie[j[s+W]]++;for(oe=ne,S=15;1<=S&&ie[S]===0;S--);if(S<oe&&(oe=S),S===0)return y[h++]=20971520,y[h++]=20971520,g.bits=1,0;for(n=1;n<S&&ie[n]===0;n++);for(oe<n&&(oe=n),C=Z=1;C<=15;C++)if(Z<<=1,(Z-=ie[C])<0)return-1;if(0<Z&&(d===0||S!==1))return-1;for(te[1]=0,C=1;C<15;C++)te[C+1]=te[C]+ie[C];for(W=0;W<m;W++)j[s+W]!==0&&(f[te[j[s+W]]++]=W);if(U=d===0?(F=Fe=f,19):d===1?(F=c,he-=257,Fe=i,He-=257,256):(F=u,Fe=r,-1),C=n,K=h,xe=W=L=0,k=-1,D=(Y=1<<(J=oe))-1,d===1&&852<Y||d===2&&592<Y)return 1;for(;;){for(Q=C-xe,O=f[W]<U?(R=0,f[W]):f[W]>U?(R=Fe[He+f[W]],F[he+f[W]]):(R=96,0),v=1<<C-xe,n=x=1<<J;y[K+(L>>xe)+(x-=v)]=Q<<24|R<<16|O|0,x!==0;);for(v=1<<C-1;L&v;)v>>=1;if(v!==0?(L&=v-1,L+=v):L=0,W++,--ie[C]==0){if(C===S)break;C=j[s+f[W]]}if(oe<C&&(L&D)!==k){for(xe===0&&(xe=oe),K+=n,Z=1<<(J=C-xe);J+xe<S&&!((Z-=ie[J+xe])<=0);)J++,Z<<=1;if(Y+=1<<J,d===1&&852<Y||d===2&&592<Y)return 1;y[k=L&D]=oe<<24|J<<16|K-h|0}}return L!==0&&(y[K+L]=C-xe<<24|64<<16|0),g.bits=oe,0}},{"../utils/common":41}],51:[function(l,_,b){_.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(l,_,b){var o=l("../utils/common"),c=0,i=1;function u(w){for(var B=w.length;0<=--B;)w[B]=0}var r=0,d=29,j=256,s=j+1+d,m=30,y=19,h=2*s+1,f=15,g=16,v=7,x=256,k=16,D=17,K=18,U=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ne=new Array(2*(s+2));u(ne);var C=new Array(2*m);u(C);var W=new Array(512);u(W);var n=new Array(256);u(n);var S=new Array(d);u(S);var oe,J,xe,Z=new Array(m);function Y(w,B,X,ee,G){this.static_tree=w,this.extra_bits=B,this.extra_base=X,this.elems=ee,this.max_length=G,this.has_stree=w&&w.length}function L(w,B){this.dyn_tree=w,this.max_code=0,this.stat_desc=B}function F(w){return w<256?W[w]:W[256+(w>>>7)]}function he(w,B){w.pending_buf[w.pending++]=255&B,w.pending_buf[w.pending++]=B>>>8&255}function ie(w,B,X){w.bi_valid>g-X?(w.bi_buf|=B<<w.bi_valid&65535,he(w,w.bi_buf),w.bi_buf=B>>g-w.bi_valid,w.bi_valid+=X-g):(w.bi_buf|=B<<w.bi_valid&65535,w.bi_valid+=X)}function te(w,B,X){ie(w,X[2*B],X[2*B+1])}function Fe(w,B){for(var X=0;X|=1&w,w>>>=1,X<<=1,0<--B;);return X>>>1}function He(w,B,X){var ee,G,se=new Array(f+1),de=0;for(ee=1;ee<=f;ee++)se[ee]=de=de+X[ee-1]<<1;for(G=0;G<=B;G++){var re=w[2*G+1];re!==0&&(w[2*G]=Fe(se[re]++,re))}}function we(w){var B;for(B=0;B<s;B++)w.dyn_ltree[2*B]=0;for(B=0;B<m;B++)w.dyn_dtree[2*B]=0;for(B=0;B<y;B++)w.bl_tree[2*B]=0;w.dyn_ltree[2*x]=1,w.opt_len=w.static_len=0,w.last_lit=w.matches=0}function be(w){8<w.bi_valid?he(w,w.bi_buf):0<w.bi_valid&&(w.pending_buf[w.pending++]=w.bi_buf),w.bi_buf=0,w.bi_valid=0}function I(w,B,X,ee){var G=2*B,se=2*X;return w[G]<w[se]||w[G]===w[se]&&ee[B]<=ee[X]}function me(w,B,X){for(var ee=w.heap[X],G=X<<1;G<=w.heap_len&&(G<w.heap_len&&I(B,w.heap[G+1],w.heap[G],w.depth)&&G++,!I(B,ee,w.heap[G],w.depth));)w.heap[X]=w.heap[G],X=G,G<<=1;w.heap[X]=ee}function ke(w,B,X){var ee,G,se,de,re=0;
vendor: 6,684 bytes, line 92
92if(w.last_lit!==0)for(;ee=w.pending_buf[w.d_buf+2*re]<<8|w.pending_buf[w.d_buf+2*re+1],G=w.pending_buf[w.l_buf+re],re++,ee===0?te(w,G,B):(te(w,(se=n[G])+j+1,B),(de=U[se])!==0&&ie(w,G-=S[se],de),te(w,se=F(--ee),X),(de=Q[se])!==0&&ie(w,ee-=Z[se],de)),re<w.last_lit;);te(w,x,B)}function A(w,B){var X,ee,G,se=B.dyn_tree,de=B.stat_desc.static_tree,re=B.stat_desc.has_stree,pe=B.stat_desc.elems,Ge=-1;for(w.heap_len=0,w.heap_max=h,X=0;X<pe;X++)se[2*X]!==0?(w.heap[++w.heap_len]=Ge=X,w.depth[X]=0):se[2*X+1]=0;for(;w.heap_len<2;)se[2*(G=w.heap[++w.heap_len]=Ge<2?++Ge:0)]=1,w.depth[G]=0,w.opt_len--,re&&(w.static_len-=de[2*G+1]);for(B.max_code=Ge,X=w.heap_len>>1;1<=X;X--)me(w,se,X);for(G=pe;X=w.heap[1],w.heap[1]=w.heap[w.heap_len--],me(w,se,1),ee=w.heap[1],w.heap[--w.heap_max]=X,w.heap[--w.heap_max]=ee,se[2*G]=se[2*X]+se[2*ee],w.depth[G]=(w.depth[X]>=w.depth[ee]?w.depth[X]:w.depth[ee])+1,se[2*X+1]=se[2*ee+1]=G,w.heap[1]=G++,me(w,se,1),2<=w.heap_len;);w.heap[--w.heap_max]=w.heap[1],function(Ae,jt){var rs,Nt,Ut,Je,ns,Et,kt=jt.dyn_tree,Wt=jt.max_code,Ns=jt.stat_desc.static_tree,ja=jt.stat_desc.has_stree,va=jt.stat_desc.extra_bits,Zt=jt.stat_desc.extra_base,It=jt.stat_desc.max_length,qt=0;for(Je=0;Je<=f;Je++)Ae.bl_count[Je]=0;for(kt[2*Ae.heap[Ae.heap_max]+1]=0,rs=Ae.heap_max+1;rs<h;rs++)It<(Je=kt[2*kt[2*(Nt=Ae.heap[rs])+1]+1]+1)&&(Je=It,qt++),kt[2*Nt+1]=Je,Wt<Nt||(Ae.bl_count[Je]++,ns=0,Zt<=Nt&&(ns=va[Nt-Zt]),Et=kt[2*Nt],Ae.opt_len+=Et*(Je+ns),ja&&(Ae.static_len+=Et*(Ns[2*Nt+1]+ns)));if(qt!==0){do{for(Je=It-1;Ae.bl_count[Je]===0;)Je--;Ae.bl_count[Je]--,Ae.bl_count[Je+1]+=2,Ae.bl_count[It]--,qt-=2}while(0<qt);for(Je=It;Je!==0;Je--)for(Nt=Ae.bl_count[Je];Nt!==0;)Wt<(Ut=Ae.heap[--rs])||(kt[2*Ut+1]!==Je&&(Ae.opt_len+=(Je-kt[2*Ut+1])*kt[2*Ut],kt[2*Ut+1]=Je),Nt--)}}(w,B),He(se,Ge,w.bl_count)}function a(w,B,X){var ee,G,se=-1,de=B[1],re=0,pe=7,Ge=4;for(de===0&&(pe=138,Ge=3),B[2*(X+1)+1]=65535,ee=0;ee<=X;ee++)G=de,de=B[2*(ee+1)+1],++re<pe&&G===de||(re<Ge?w.bl_tree[2*G]+=re:G!==0?(G!==se&&w.bl_tree[2*G]++,w.bl_tree[2*k]++):re<=10?w.bl_tree[2*D]++:w.bl_tree[2*K]++,se=G,Ge=(re=0)===de?(pe=138,3):G===de?(pe=6,3):(pe=7,4))}function V(w,B,X){var ee,G,se=-1,de=B[1],re=0,pe=7,Ge=4;for(de===0&&(pe=138,Ge=3),ee=0;ee<=X;ee++)if(G=de,de=B[2*(ee+1)+1],!(++re<pe&&G===de)){if(re<Ge)for(;te(w,G,w.bl_tree),--re!=0;);else G!==0?(G!==se&&(te(w,G,w.bl_tree),re--),te(w,k,w.bl_tree),ie(w,re-3,2)):re<=10?(te(w,D,w.bl_tree),ie(w,re-3,3)):(te(w,K,w.bl_tree),ie(w,re-11,7));se=G,Ge=(re=0)===de?(pe=138,3):G===de?(pe=6,3):(pe=7,4)}}u(Z);var M=!1;function N(w,B,X,ee){ie(w,(r<<1)+(ee?1:0),3),function(G,se,de,re){be(G),he(G,de),he(G,~de),o.arraySet(G.pending_buf,G.window,se,de,G.pending),G.pending+=de}(w,B,X)}b._tr_init=function(w){M||(function(){var B,X,ee,G,se,de=new Array(f+1);for(G=ee=0;G<d-1;G++)for(S[G]=ee,B=0;B<1<<U[G];B++)n[ee++]=G;for(n[ee-1]=G,G=se=0;G<16;G++)for(Z[G]=se,B=0;B<1<<Q[G];B++)W[se++]=G;for(se>>=7;G<m;G++)for(Z[G]=se<<7,B=0;B<1<<Q[G]-7;B++)W[256+se++]=G;for(X=0;X<=f;X++)de[X]=0;for(B=0;B<=143;)ne[2*B+1]=8,B++,de[8]++;for(;B<=255;)ne[2*B+1]=9,B++,de[9]++;for(;B<=279;)ne[2*B+1]=7,B++,de[7]++;for(;B<=287;)ne[2*B+1]=8,B++,de[8]++;for(He(ne,s+1,de),B=0;B<m;B++)C[2*B+1]=5,C[2*B]=Fe(B,5);oe=new Y(ne,U,j+1,s,f),J=new Y(C,Q,0,m,f),xe=new Y(new Array(0),R,0,y,v)}(),M=!0),w.l_desc=new L(w.dyn_ltree,oe),w.d_desc=new L(w.dyn_dtree,J),w.bl_desc=new L(w.bl_tree,xe),w.bi_buf=0,w.bi_valid=0,we(w)},b._tr_stored_block=N,b._tr_flush_block=function(w,B,X,ee){var G,se,de=0;0<w.level?(w.strm.data_type===2&&(w.strm.data_type=function(re){var pe,Ge=4093624447;for(pe=0;pe<=31;pe++,Ge>>>=1)if(1&Ge&&re.dyn_ltree[2*pe]!==0)return c;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return i;for(pe=32;pe<j;pe++)if(re.dyn_ltree[2*pe]!==0)return i;return c}(w)),A(w,w.l_desc),A(w,w.d_desc),de=function(re){var pe;for(a(re,re.dyn_ltree,re.l_desc.max_code),a(re,re.dyn_dtree,re.d_desc.max_code),A(re,re.bl_desc),pe=y-1;3<=pe&&re.bl_tree[2*O[pe]+1]===0;pe--);return re.opt_len+=3*(pe+1)+5+5+4,pe}(w),G=w.opt_len+3+7>>>3,(se=w.static_len+3+7>>>3)<=G&&(G=se)):G=se=X+5,X+4<=G&&B!==-1?N(w,B,X,ee):w.strategy===4||se===G?(ie(w,2+(ee?1:0),3),ke(w,ne,C)):(ie(w,4+(ee?1:0),3),function(re,pe,Ge,Ae){var jt;for(ie(re,pe-257,5),ie(re,Ge-1,5),ie(re,Ae-4,4),jt=0;jt<Ae;jt++)ie(re,re.bl_tree[2*O[jt]+1],3);V(re,re.dyn_ltree,pe-1),V(re,re.dyn_dtree,Ge-1)}(w,w.l_desc.max_code+1,w.d_desc.max_code+1,de+1),ke(w,w.dyn_ltree,w.dyn_dtree)),we(w),ee&&be(w)},b._tr_tally=function(w,B,X){return w.pending_buf[w.d_buf+2*w.last_lit]=B>>>8&255,w.pending_buf[w.d_buf+2*w.last_lit+1]=255&B,w.pending_buf[w.l_buf+w.last_lit]=255&X,w.last_lit++,B===0?w.dyn_ltree[2*X]++:(w.matches++,B--,w.dyn_ltree[2*(n[X]+j+1)]++,w.dyn_dtree[2*F(B)]++),w.last_lit===w.lit_bufsize-1},b._tr_align=function(w){ie(w,2,3),te(w,x,ne),function(B){B.bi_valid===16?(he(B,B.bi_buf),B.bi_buf=0,B.bi_valid=0):8<=B.bi_valid&&(B.pending_buf[B.pending++]=255&B.bi_buf,B.bi_buf>>=8,B.bi_valid-=8)}(w)}},{"../utils/common":41}],53:[function(l,_,b){_.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(l,_,b){(function(o){(function(c,i){if(!c.setImmediate){var u,r,d,j,s=1,m={},y=!1,h=c.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(c);f=f&&f.setTimeout?f:c,u={}.toString.call(c.process)==="[object process]"?function(k){process.nextTick(function(){v(k)})}:function(){if(c.postMessage&&!c.importScripts){var k=!0,D=c.onmessage;return c.onmessage=function(){k=!1},c.postMessage("","*"),c.onmessage=D,k}}()?(j="setImmediate$"+Math.random()+"$",c.addEventListener?c.addEventListener("message",x,!1):c.attachEvent("onmessage",x),function(k){c.postMessage(j+k,"*")}):c.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){v(k.data)},function(k){d.port2.postMessage(k)}):h&&"onreadystatechange"in h.createElement("script")?(r=h.documentElement,function(k){var D=h.createElement("script");D.onreadystatechange=function(){v(k),D.onreadystatechange=null,r.removeChild(D),D=null},r.appendChild(D)}):function(k){setTimeout(v,0,k)},f.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var D=new Array(arguments.length-1),K=0;K<D.length;K++)D[K]=arguments[K+1];var U={callback:k,args:D};return m[s]=U,u(s),s++},f.clearImmediate=g}function g(k){delete m[k]}function v(k){if(y)setTimeout(v,0,k);else{var D=m[k];if(D){y=!0;try{(function(K){var U=K.callback,Q=K.args;switch(Q.length){case 0:U();break;case 1:U(Q[0]);break;case 2:U(Q[0],Q[1]);break;case 3:U(Q[0],Q[1],Q[2]);break;default:U.apply(i,Q)}})(D)}finally{g(k),y=!1}}}}
92function x(k){k.source===c&&typeof k.data=="string"&&k.data.indexOf(j)===0&&v(+k.data.slice(j.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(fn);var _o=fn.exports;const To=kl(_o);var bn={exports:{}};(function(p,P){(function(l,_){_()})(Ot,function(){function l(r,d){return typeof d>"u"?d={autoBom:!1}:typeof d!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),d={autoBom:!d}),d.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(r.type)?new Blob(["\uFEFF",r],{type:r.type}):r}function _(r,d,j){var s=new XMLHttpRequest;s.open("GET",r),s.responseType="blob",s.onload=function(){u(s.response,d,j)},s.onerror=function(){console.error("could not download file")},s.send()}function b(r){var d=new XMLHttpRequest;d.open("HEAD",r,!1);try{d.send()}catch{}return 200<=d.status&&299>=d.status}function o(r){try{r.dispatchEvent(new MouseEvent("click"))}catch{var d=document.createEvent("MouseEvents");
92d.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),r.dispatchEvent(d)}}var c=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof Ot=="object"&&Ot.global===Ot?Ot:void 0,i=c.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=c.saveAs||(typeof window!="object"||window!==c?function(){}:"download"in HTMLAnchorElement.prototype&&!i?function(r,d,j){var s=c.URL||c.webkitURL,m=document.createElement("a");d=d||r.name||"download",m.download=d,m.rel="noopener",typeof r=="string"?(m.href=r,m.origin===location.origin?o(m):b(m.href)?_(r,d,j):o(m,m.target="_blank")):(m.href=s.createObjectURL(r),setTimeout(function(){s.revokeObjectURL(m.href)},4e4),setTimeout(function(){o(m)},0))}:"msSaveOrOpenBlob"in navigator?function(r,d,j){if(d=d||r.name||"download",typeof r!="string")navigator.msSaveOrOpenBlob(l(r,j),d);else if(b(r))_(r,d,j);else{var s=document.createElement("a");s.href=r,s.target="_blank",setTimeout(function(){o(s)})}}:function(r,d,j,s){if(s=s||open("","_blank"),s&&(s.document.title=s.document.body.innerText="downloading..."),typeof r=="string")return _(r,d,j);var m=r.type==="application/octet-stream",y=/constructor/i.test(c.HTMLElement)||c.safari,h=/CriOS\/[\d]+/.test(navigator.userAgent);if((h||m&&y||i)&&typeof FileReader<"u"){var f=new FileReader;f.onloadend=function(){var x=f.result;x=h?x:x.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=x:location=x,s=null},f.readAsDataURL(r)}else{var g=c.URL||c.webkitURL,v=g.createObjectURL(r);s?s.location=v:location.href=v,s=null,setTimeout(function(){g.revokeObjectURL(v)},4e4)}});c.saveAs=u.saveAs=u,p.exports=u})})(bn);var yr=bn.exports;const Nr={instagram:fs,tiktok:ss,youtube:Ms,facebook:ua,twitter:ma},kr={instagram:"Instagram Reels",tiktok:"TikTok",youtube:"YouTube Shorts",facebook:"Facebook",twitter:"Twitter/X"},Fo=[{platform:"instagram",enabled:!0,aspectRatio:"9:16",resolution:"1080p",format:"mp4"},{platform:"tiktok",enabled:!0,aspectRatio:"9:16",resolution:"1080p",format:"mp4"},{platform:"youtube",enabled:!1,aspectRatio:"9:16",resolution:"1080p",format:"mp4"},{platform:"facebook",enabled:!1,aspectRatio:"9:16",resolution:"1080p",format:"mp4"},{platform:"twitter",enabled:!1,aspectRatio:"16:9",resolution:"720p",format:"mp4"}];function Ao({open:p,onOpenChange:P,reelId:l,projectId:_,defaultTitle:b="",defaultCaption:o="",videoPreviewUrl:c}){const{toast:i}=ct(),[u,r]=$.useState("schedule"),[d,j]=$.useState(Fo),[s,m]=$.useState(b),[y,h]=$.useState(o),[f,g]=$.useState(()=>{const Y=aa(new Date,1);return Mt(ra(Y,{hours:9,minutes:0,seconds:0}),"yyyy-MM-dd'T'HH:mm")}),[v,x]=$.useState(()=>Intl.DateTimeFormat().resolvedOptions().timeZone),[k,D]=$.useState(!1),[K,U]=$.useState("weekly"),[Q,R]=$.useState(!0),[O,ne]=$.useState(!0);$.useEffect(()=>{b&&m(b),o&&h(o)},[b,o]);const{data:C,isLoading:W}=We({queryKey:["/api/premium/distribution-queue",{reelId:l}],enabled:p}),n=je({mutationFn:async Y=>await fe("POST","/api/premium/distribution-queue",Y),onSuccess:()=>{i({title:"Post Scheduled!",description:"Your content will be published at the scheduled time."}),ve.invalidateQueries({queryKey:["/api/premium/distribution-queue"]}),P(!1)},onError:Y=>{i({title:"Scheduling Failed",description:Y.message||"Failed to schedule distribution",variant:"destructive"})}}),S=je({mutationFn:async Y=>await fe("POST",`/api/premium/distribution-queue/${Y}/cancel`),onSuccess:()=>{i({title:"Post Cancelled",description:"The scheduled post has been cancelled."}),ve.invalidateQueries({queryKey:["/api/premium/distribution-queue"]})},onError:Y=>{i({title:"Cancel Failed",description:Y.message||"Failed to cancel distribution",variant:"destructive"})}}),oe=Y=>{j(L=>L.map(F=>F.platform===Y?{...F,enabled:!F.enabled}:F))},J=()=>{const Y=d.filter(F=>F.enabled);if(Y.length===0){i({title:"No Platforms Selected",description:"Please select at least one platform to publish to.",variant:"destructive"});return}const L=new Date(f);if(Gl(L,new Date)){i({title:"Invalid Schedule Time",description:"Please select a future date and time.",variant:"destructive"});return}n.mutate({reelId:l,projectId:_,scheduledAt:L,timezone:v,platforms:Y,title:s||void 0,description:y||void 0,isRecurring:k,recurringPattern:k?K:void 0,notifyOnComplete:Q,notifyOnError:O})},xe=Y=>
92{switch(Y){case"pending":return e.jsx(De,{variant:"outline",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",children:"Scheduled"});case"processing":return e.jsx(De,{variant:"outline",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Processing"});case"completed":return e.jsx(De,{variant:"outline",className:"bg-green-500/20 text-green-400 border-green-500/30",children:"Published"});case"failed":return e.jsx(De,{variant:"outline",className:"bg-red-500/20 text-red-400 border-red-500/30",children:"Failed"});case"cancelled":return e.jsx(De,{variant:"outline",className:"bg-gray-500/20 text-gray-400 border-gray-500/30",children:"Cancelled"});default:return e.jsx(De,{variant:"outline",children:Y})}},Z=[{label:"In 1 hour",value:()=>So(new Date,1)},{label:"Tomorrow 9 AM",value:()=>ra(aa(new Date,1),{hours:9,minutes:0,seconds:0})},{label:"Tomorrow 6 PM",value:()=>ra(aa(new Date,1),{hours:18,minutes:0,seconds:0})},{label:"This Weekend",value:()=>{const Y=new Date,L=(6-Y.getDay()+7)%7||7;return ra(aa(Y,L),{hours:10,minutes:0,seconds:0})}}];return e.jsx(Me,{open:p,onOpenChange:P,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-2xl max-h-[90vh]",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(ha,{className:"w-5 h-5 text-accent"}),"Schedule Distribution"]}),e.jsx(Ke,{className:"text-gray-400",children:"Schedule your content to publish across multiple platforms"})]}),e.jsxs(as,{value:u,onValueChange:Y=>r(Y),children:[e.jsxs(is,{className:"grid w-full grid-cols-2 bg-white/10",children:[e.jsxs(Re,{value:"schedule",className:"data-[state=active]:bg-accent data-[state=active]:text-black",children:[e.jsx(Hl,{className:"w-4 h-4 mr-2"}),"Schedule New"]}),e.jsxs(Re,{value:"history",className:"data-[state=active]:bg-accent data-[state=active]:text-black",children:[e.jsx(At,{className:"w-4 h-4 mr-2"}),"Scheduled (",(C==null?void 0:C.total)||0,")"]})]}),e.jsxs(ze,{value:"schedule",className:"space-y-4 mt-4",children:[e.jsx(da,{className:"h-[400px] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[c&&e.jsxs("div",{className:"relative aspect-video rounded-lg overflow-hidden bg-black/50",children:[e.jsx("video",{src:c,className:"w-full h-full object-contain",muted:!0,autoPlay:!0,loop:!0}),e.jsxs("div",{className:"absolute bottom-2 left-2 bg-black/60 px-2 py-1 rounded text-xs text-white flex items-center",children:[e.jsx(Ct,{className:"w-3 h-3 mr-1"}),"Preview"]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-3 block font-medium",children:"Select Platforms"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:d.map(Y=>{const L=Nr[Y.platform];return e.jsxs("button",{onClick:()=>oe(Y.platform),className:`flex items-center gap-2 p-3 rounded-lg border-2 transition-all ${Y.enabled?"border-accent bg-accent/20 text-white":"border-white/20 bg-white/5 text-gray-400 hover:bg-white/10"}`,"data-testid":`platform-toggle-${Y.platform}`,children:[e.jsx(L,{className:"w-5 h-5"}),e.jsx("span",{className:"text-sm font-medium",children:kr[Y.platform]}),Y.enabled&&e.jsx(Bt,{className:"w-4 h-4 ml-auto text-accent"})]},Y.platform)})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Title (optional)"}),e.jsx(le,{value:s,onChange:Y=>m(Y.target.value),placeholder:"Enter a title for your post",className:"bg-white/10 border-white/20 text-white","data-testid":"distribution-title"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Caption"}),e.jsx(nt,{value:y,onChange:Y=>h(Y.target.value),placeholder:"Write your caption...",className:"bg-white/10 border-white/20 text-white min-h-[80px]","data-testid":"distribution-caption"})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Quick Schedule"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Z.map((Y,L)=>e.jsx(z,{variant:"outline",size:"sm",onClick:()=>g(Mt(Y.value(),"yyyy-MM-dd'T'HH:mm")),className:"bg-white/10 border-white/20 text-white hover:bg-white/20","data-testid":`quick-schedule-${L}`,children:Y.label},L))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Schedule Date & Time"}),e.jsx(le,{type:"datetime-local",value:f,onChange:Y=>g(Y.target.value),className:"bg-white/10 border-white/20 text-white","data-testid":"schedule-datetime"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Timezone"}),e.jsxs(Oe,{value:v,onValueChange:x,children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"timezone-select",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"America/Ne
92w_York",children:"Eastern (ET)"}),e.jsx(ae,{value:"America/Chicago",children:"Central (CT)"}),e.jsx(ae,{value:"America/Denver",children:"Mountain (MT)"}),e.jsx(ae,{value:"America/Los_Angeles",children:"Pacific (PT)"}),e.jsx(ae,{value:"Europe/London",children:"London (GMT)"}),e.jsx(ae,{value:"Europe/Paris",children:"Paris (CET)"}),e.jsx(ae,{value:"Asia/Tokyo",children:"Tokyo (JST)"}),e.jsx(ae,{value:"Australia/Sydney",children:"Sydney (AEST)"})]})]})]})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg border border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yo,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-sm font-medium",children:"Recurring Post"})]}),e.jsx(fa,{checked:k,onCheckedChange:D,"data-testid":"recurring-toggle"})]}),k&&e.jsxs(Oe,{value:K,onValueChange:Y=>U(Y),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"recurring-pattern",children:e.jsx($e,{placeholder:"Select frequency"})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"daily",children:"Daily"}),e.jsx(ae,{value:"weekly",children:"Weekly"}),e.jsx(ae,{value:"biweekly",children:"Every 2 Weeks"}),e.jsx(ae,{value:"monthly",children:"Monthly"})]})]})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg border border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Cl,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-sm font-medium",children:"Notifications"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(gs,{id:"notify-complete",checked:Q,onCheckedChange:Y=>R(Y),"data-testid":"notify-complete"}),e.jsx("label",{htmlFor:"notify-complete",className:"text-sm text-gray-300 cursor-pointer",children:"Notify me when post is published"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(gs,{id:"notify-error",checked:O,onCheckedChange:Y=>ne(Y),"data-testid":"notify-error"}),e.jsx("label",{htmlFor:"notify-error",className:"text-sm text-gray-300 cursor-pointer",children:"Notify me if publishing fails"})]})]})]})]})}),e.jsxs(Ze,{className:"mt-4 pt-4 border-t border-white/10",children:[e.jsx(z,{variant:"outline",onClick:()=>P(!1),className:"bg-white/10 border-white/20 text-white",children:"Cancel"}),e.jsx(z,{onClick:J,disabled:n.isPending||d.filter(Y=>Y.enabled).length===0,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"schedule-button",children:n.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Scheduling..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ha,{className:"w-4 h-4 mr-2"}),"Schedule Post"]})})]})]}),e.jsx(ze,{value:"history",className:"mt-4",children:e.jsx(da,{className:"h-[450px]",children:W?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ie,{className:"w-6 h-6 animate-spin text-accent"})}):(C==null?void 0:C.items.length)===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Us,{className:"w-12 h-12 mx-auto mb-3 text-gray-500"}),e.jsx("p",{className:"text-gray-400",children:"No scheduled posts yet"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Schedule your first post to see it here"})]}):e.jsx("div",{className:"space-y-3",children:C==null?void 0:C.items.map(Y=>e.jsx(ge,{className:"bg-white/5 border-white/10 p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[xe(Y.status),Y.title&&e.jsx("span",{className:"text-sm font-medium text-white truncate max-w-[200px]",children:Y.title})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(At,{className:"w-3 h-3"}),Mt(Kl(Y.scheduledAt),"MMM d, yyyy h:mm a")]}),e.jsx("div",{className:"flex items-center gap-2 mt-2",children:Y.platforms.map(L=>{const F=Nr[L.platform];return e.jsx("div",{className:"w-6 h-6 rounded-full bg-white/10 flex items-center justify-center",title:kr[L.platform],children:e.jsx(F,{className:"w-3 h-3 text-gray-300"})},L.platform)})}),Y.error&&e.jsxs("div",{className:"mt-2 p-2 bg-red-500/10 border border-red-500/30 rounded text-xs text-red-400 flex items-start gap-2",children:[e.jsx(Sl,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:Y.error})]})]}),Y.status==="pending"&&e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S.mutate(Y.id),disabled:S.isPending,className:"text-red-400 hover:text-red-300 hover:bg-red-500/10","data-testid":`cancel-post-${Y.id}`,children:e.jsx(rt,{className:"w-4 h-4"})})]})},Y.id))})})})]})]})})}const za=[{type:"text",label:"Text Input",icon:js,description:"Single line text"},{type:"email",label:"Email",icon:Va,description:"Email address"},{type:"phone",label:"Phone",icon:Ql,description:"Phone number"},{type:"number",label:"Number",icon:Za,description:"Numeric value"},{type:"date",label:"Date",icon:Us,description:"Date picker"},{type:"textarea",label:"Text Area",icon:ts,description:"Multi-line text"},{type:"select",label:"Dropdown",icon:Yl,description:"Single selection"},{type:"checkbox",label:"Checkbox",icon:Jl,description:"Multiple selections"},{type:"radio",label:"Radio Buttons",icon:Fl,description:"Single selection"},{type:"file",label:"File Upload",icon:Ft,description:"File attachment"},{type:"heading",label:"Section Heading",icon:wo,description:"Visual separator"},{type:"paragraph",label:"Paragraph",icon:po,description:"Informational text"}],Cr=[{builtInType:"first_name",label:"First Name",fieldType:"text",isRequired:!0},{builtInType:"last_name",label:"Last Name",fieldType:"text",isRequired:!0},{builtInType:"email",label:"Email Address",fieldType:"email",isRequired:!0},{builtInType:"phone",label:"Phone Number",fieldType:"phone",isRequired:!1},{builtInType:"ticket_type",label:"Ticket Type",fieldType:"select",isRequired:!0},{builtInType:"dietary",label:"Dietary Restrictions",fieldType:"select",isRequired:!1},{builtInType:"accessibility",label:"Accessibility Needs",fieldType:"textarea",isRequired:!1}],Eo=[{value:"city_event",label:"City Event",icon:_l,color:"from-blue-600 to-blue-800"},{value:"concert",label:"Concert / Show",icon:ft,color:"from-purple-600 to-purple-800"},{value:"conference",label:"Conference",icon:Tl,color:"from-green-600 to-green-800"},{value:"festival",label:"Festival",icon:Zl,color:"from-orange-600 to-orange-800"},{value:"workshop",label:"Workshop",icon:wt,color:"from-pink-600 to-pink-800"},{value:"sports",label:"Sports Event",icon:Or,color:"from-red-600 to-red-800"}],zt={primaryColor:"#6366f1",secondaryColor:"#8b5cf6",accentColor:"#f59e0b",backgroundColor:"#ffffff",textColor:"#1f2937",logoUrl:"",headerImageUrl:"",layoutStyle:"standard",fontFamily:"Inter",borderRadius:"medium"},Io=[{value:"standard",label:"Standard",icon:gn,description:"Single column, clean layout"},{value:"compact",label:"Compact",icon:pn,description:"Space-efficient design"},{value:"two_column",label:"Two Column",icon:fo,description:"Side-by-side fields"},{value:"wizard",label:"Wizard",icon:tt,description:"Multi-step form"}],Po=[{value:"Inter",label:"Inter (Modern)"},{value:"Roboto",label:"Roboto (Clean)"},{value:"Poppins",label:"Poppins (Friendly)"},{value:"Playfair Display",label:"Playfair Display (Elegant)"},{value:"Montserrat",label:"Montserrat (Bold)"}],Gt=[{value:"none",label:"Sharp",preview:"0px"},{value:"small",label:"Subtle",preview:"4px"},{value:"medium",label:"Rounded",preview:"8px"},{value:"large",label:"Pill",preview:"16px"}];function Ro({eventId:p,onSave:P}){var we,be,I,me,ke;const{toast:l}=ct(),[_,b]=$.useState("templates"),[o,c]=$.useState([]),[i,u]=$.useState([]),[r,d]=$.useState(null),[j,s]=$.useState(null),[m,y]=$.useState(!1),[h,f]=$.useState(!1),[g,v]=$.useState(!1),[x,k]=$.useState(zt),[D,K]=$.useState(!1),{data:U}=We({queryKey:[`/api/city-events/${p}`],enabled:!!p});$.useEffect(()=>{U&&!D&&k({primaryColor:U.brandingPrimaryColor||zt.primaryColor,secondaryColor:U.brandingSecondaryColor||zt.secondaryColor,accentColor:U.brandingAccentColor||zt.accentColor,backgroundColor:U.brandingBackgroun
92dColor||zt.backgroundColor,textColor:zt.textColor,logoUrl:U.brandingLogoUrl||"",headerImageUrl:U.brandingHeaderImageUrl||"",layoutStyle:U.brandingLayoutStyle||zt.layoutStyle,fontFamily:U.brandingFontFamily||zt.fontFamily,borderRadius:U.brandingBorderRadius||zt.borderRadius})},[U,p]),$.useEffect(()=>{K(!1)},[p]);const Q=A=>{k(a=>({...a,...A})),K(!0)},{data:R,isLoading:O}=We({queryKey:["/api/city-events/form-templates"]}),{data:ne}=We({queryKey:["/api/city-events",p,"form-fields"],enabled:!!p}),{data:C}=We({queryKey:["/api/city-events",p,"ticket-types"],enabled:!!p}),W=je({mutationFn:async A=>(await fe("POST",`/api/city-events/${p}/apply-template/${A}`)).json(),onSuccess:(A,a)=>{c(A.fields.map((M,N)=>({...M,orderIndex:N}))),u(A.ticketTypes);const V=R==null?void 0:R.find(M=>M.id===a);if(V){const M=V.colorScheme;k(N=>({...N,primaryColor:(M==null?void 0:M.primary)||N.primaryColor,secondaryColor:(M==null?void 0:M.secondary)||N.secondaryColor,accentColor:(M==null?void 0:M.accent)||N.accentColor,backgroundColor:(M==null?void 0:M.background)||N.backgroundColor,logoUrl:V.logoUrl||"",headerImageUrl:V.headerImageUrl||"",layoutStyle:V.layoutStyle||"standard"}))}b("fields"),l({title:"Template applied",description:"Form fields, ticket types, and branding have been set up"}),ve.invalidateQueries({queryKey:["/api/city-events",p,"form-fields"]}),ve.invalidateQueries({queryKey:["/api/city-events",p,"ticket-types"]})},onError:()=>{l({title:"Error",description:"Failed to apply template",variant:"destructive"})}}),n=je({mutationFn:async A=>A.id?(await fe("PATCH",`/api/city-events/form-fields/${A.id}`,A)).json():(await fe("POST",`/api/city-events/${p}/form-fields`,A)).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/city-events",p,"form-fields"]}),l({title:"Field saved"})}}),S=je({mutationFn:async A=>{await fe("DELETE",`/api/city-events/form-fields/${A}`)},onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/city-events",p,"form-fields"]}),l({title:"Field deleted"})}}),oe=je({mutationFn:async A=>A.id?(await fe("PATCH",`/api/city-events/ticket-types/${A.id}`,A)).json():(await fe("POST",`/api/city-events/${p}/ticket-types`,A)).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/city-events",p,"ticket-types"]}),l({title:"Ticket type saved"})}}),J=je({mutationFn:async A=>{await fe("DELETE",`/api/city-events/ticket-types/${A}`)},onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/city-events",p,"ticket-types"]}),l({title:"Ticket type deleted"})}}),xe=je({mutationFn:async A=>(await fe("PATCH",`/api/city-events/${p}`,{brandingPrimaryColor:A.primaryColor,brandingSecondaryColor:A.secondaryColor,brandingAccentColor:A.accentColor,brandingBackgroundColor:A.backgroundColor,brandingLogoUrl:A.logoUrl||null,brandingHeaderImageUrl:A.headerImageUrl||null,brandingFontFamily:A.fontFamily,brandingLayoutStyle:A.layoutStyle,brandingBorderRadius:A.borderRadius})).json(),onSuccess:()=>{K(!1),ve.invalidateQueries({queryKey:[`/api/city-events/${p}`]}),l({title:"Branding saved!",description:"Your branding settings have been updated"})},onError:()=>{l({title:"Failed to save branding",variant:"destructive"})}}),Z=A=>{const a=za.find(M=>M.type===A),V={fieldType:A,label:(a==null?void 0:a.label)||"New Field",placeholder:"",helpText:"",isRequired:!1,isBuiltIn:!1,options:A==="select"||A==="radio"||A==="checkbox"?[{value:"option1",label:"Option 1"}]:void 0,orderIndex:o.length,columnWidth:"full"};c([...o,V]),d(V),f(!1),b("fields")},Y=A=>{const a=Cr.find(M=>M.builtInType===A);if(!a)return;const V={fieldType:a.fieldType,label:a.label,placeholder:"",helpText:"",isRequired:a.isRequired,isBuiltIn:!0,builtInType:a.builtInType,orderIndex:o.length,columnWidth:"half"};c([...o,V]),f(!1),b("fields")},L=(A,a)=>{const V=[...o];V[A]={...V[A],...a},c(V),r&&r.orderIndex===A&&d(V[A])},F=A=>{const a=o[A];a.id&&S.mutate(a.id),c(o.filter((V,M)=>M!==A)),(r==null?void 0:r.orderIndex)===A&&d(null)},he=()=>{const A={name:"New Ticket Type",description:"",priceCents:0,perks:[]};u([...i,A]),v(!1)},ie=(A,a)=>{const V=[...i];V[A]={...V[A],...a},u(V)},te=A=>{const a=i[A];a.id&&J.mutate(a.id),u(i.filter((V,M)=>M!==A))},Fe=async()=>{for(const A of o)await n.mutateAsync(A);for(const A of i)await oe.mutateAsync(A);l({title:"Form saved",description:"All fields and ticket types have been saved"}),P==null||P()},He=A=>{const a=za.find(V=>V.type===A);return(a==null?void 0:a.icon)||js};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold","data-testid":"text-form-builder
92-title",children:"Registration Form Builder"}),e.jsx("p",{className:"text-muted-foreground",children:"Customize your event registration form and ticket types"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{variant:"outline",onClick:()=>y(!0),"data-testid":"button-preview-form",children:[e.jsx(Lt,{className:"w-4 h-4 mr-2"}),"Preview"]}),e.jsxs(z,{onClick:Fe,disabled:n.isPending,"data-testid":"button-save-form",children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Save Form"]})]})]}),e.jsxs(as,{value:_,onValueChange:b,children:[e.jsxs(is,{className:"grid w-full grid-cols-5","data-testid":"tabs-form-builder",children:[e.jsxs(Re,{value:"templates","data-testid":"tab-templates",children:[e.jsx(tt,{className:"w-4 h-4 mr-2"}),"Templates"]}),e.jsxs(Re,{value:"fields","data-testid":"tab-fields",children:[e.jsx(js,{className:"w-4 h-4 mr-2"}),"Fields"]}),e.jsxs(Re,{value:"tickets","data-testid":"tab-tickets",children:[e.jsx(Ea,{className:"w-4 h-4 mr-2"}),"Tickets"]}),e.jsxs(Re,{value:"branding","data-testid":"tab-branding",children:[e.jsx(Wl,{className:"w-4 h-4 mr-2"}),"Branding"]}),e.jsxs(Re,{value:"settings","data-testid":"tab-settings",children:[e.jsx(er,{className:"w-4 h-4 mr-2"}),"Settings"]})]}),e.jsxs(ze,{value:"templates",className:"space-y-6",children:[e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(tt,{className:"w-5 h-5"}),"Pre-Built Templates"]}),e.jsx(bt,{children:"Choose a template to quickly set up your registration form with recommended fields and ticket types"})]}),e.jsx(Te,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Eo.map(A=>e.jsx(ge,{className:`cursor-pointer transition-all hover:shadow-lg hover:scale-[1.02] ${(j==null?void 0:j.category)===A.value?"ring-2 ring-primary":""}`,onClick:()=>{const a=R==null?void 0:R.find(V=>V.category===A.value);a&&(s(a),W.mutate(a.id))},"data-testid":`template-card-${A.value}`,children:e.jsxs(Te,{className:"p-6",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${A.color} flex items-center justify-center mb-4`,children:e.jsx(A.icon,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"font-semibold mb-1",children:A.label}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Pre-configured fields for ",A.label.toLowerCase()," events"]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx(De,{variant:"secondary",children:"Quick Setup"}),(R==null?void 0:R.find(a=>a.category===A.value))&&e.jsx(De,{variant:"outline",children:"Available"})]})]})},A.value))})})]}),R&&R.length>0&&e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsx(at,{children:"Available Templates"}),e.jsx(bt,{children:"Browse and apply pre-built registration form templates"})]}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-3",children:R.map(A=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg hover:bg-accent/50 cursor-pointer",onClick:()=>{s(A),W.mutate(A.id)},"data-testid":`template-item-${A.id}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(ts,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:A.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:A.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{variant:"outline",children:A.category}),A.isSystemTemplate&&e.jsx(De,{children:"Official"}),e.jsxs(z,{size:"sm",variant:"outline","data-testid":`button-apply-template-${A.id}`,children:[e.jsx(Kt,{className:"w-4 h-4 mr-1"}),"Apply"]})]})]},A.id))})})]})]}),e.jsx(ze,{value:"fields",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 space-y-4",children:e.jsxs(ge,{children:[e.jsxs(st,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(at,{children:"Form Fields"}),e.jsx(bt,{children:"Drag to reorder, click to edit"})]}),e.jsxs(Me,{open:h,onOpenChange:f,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{"data-testid":"button-add-field",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"Add Field"]})}),e.jsxs(Le,{className:"max-w-2xl",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Form Field"}),e.jsx(Ke,{children:"Choose a field type to add to your form"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"Built-in Fields"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Cr.map(A=>e.jsxs(z,{variant:"outline",className:"justify-start h-auto py-3",onClick:()=>Y(A.builtInType),"data-testid":`button-add-builtin-${A.builtInType}`,children:[e.jsx($t,{className:"w-4 h-4 mr-2"}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{children:A.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:A.isRequired?"Required":"Optional"})]})]},A.builtInType))})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"Custom Fields"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:za.map(A=>e.jsxs(z,{variant:"outline",className:"justify-start h-auto py-3 flex-col items-start",onClick:()=>Z(A.type),"data-testid":`button-add-${A.type}`,children:[e.jsx(A.icon,{className:"w-4 h-4 mb-1"}),e.jsx("div",{className:"text-sm",children:A.label})]},A.type))})]})]})]})]})]}),e.jsx(Te,{children:o.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(js,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No fields added yet"}),e.jsx("p",{className:"text-sm",children:"Choose a template or add fields manually"})]}):e.jsx("div",{className:"space-y-2",children:o.map((A,a)=>{const V=He(A.fieldType);return e.jsxs("div",{className:`flex items-center gap-3 p-3 border rounded-lg cursor-pointer transition-colors ${(r==null?void 0:r.orderIndex)===a?"border-primary bg-primary/5":"hover:bg-accent/50"}`,onClick:()=>d(A),"data-testid":`field-item-${a}`,children:[e.jsx(ba,{className:"w-4 h-4 text-muted-foreground cursor-move"}),e.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center",children:e.jsx(V,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:A.label}),e.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:A.fieldType})]}),A.isRequired&&e.jsx(De,{variant:"secondary",children:"Required"}),A.isBuiltIn&&e.jsx(De,{variant:"outline",children:"Built-in"}),e.jsx(z,{variant:"ghost",size:"icon",onClick:M=>{M.stopPropagation(),F(a)},"data-testid":`button-delete-field-${a}`,children:e.jsx(xt,{className:"w-4 h-4 text-destructive"})})]},a)})})})]})}),e.jsx("div",{children:e.jsxs(ge,{children:[e.jsx(st,{children:e.jsx(at,{children:"Field Settings"})}),e.jsx(Te,{children:r?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Label"}),e.jsx(le,{value:r.label,onChange:A=>L(r.orderIndex,{label:A.target.value}),"data-testid":"input-field-label"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Placeholder"}),e.jsx(le,{value:r.placeholder||"",onChange:A=>L(r.orderIndex,{placeholder:A.target.value}),"data-testid":"input-field-placeholder"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Help Text"}),e.jsx(nt,{value:r.helpText||"",onChange:A=>L(r.orderIndex,{helpText:A.target.value}),rows:2,"data-testid":"input-field-helptext"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(q,{children:"Required"}),e.jsx(fa,{checked:r.isRequired,onCheckedChange:A=>L(r.orderIndex,{isRequired:A}),"data-testid":"switch-field-required"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Width"}),e.jsxs(Oe,{value:r.columnWidth,onValueChange:A=>L(r.orderIndex,{columnWidth:A}),children:[e.jsx(Be,{"data-testid":"select-field-width",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"full",children:"Full Width"}),e.jsx(ae,{value:"half",children:"Half Width"}),e.jsx(ae,{value:"third",children:"Third Width"})]})]})]}),(r.fieldType==="select"||r.fieldType==="radio"||r.fieldType==="checkbox")&&e.jsxs("div",{children:[e.jsx(q,{children:"Options"}),e.jsxs("div",{className:"space-y-2 mt-2",children:[(we=r.options)==null?void 0:we.map((A,a)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:A.label,onChange:V=>{const M=[...r.options||[]];M[a]={...M[a],label:V.target.value,value:V.target.value.toLowerCase().replace(/\s+/g,"_")},L(r.orderIndex,{options:M})},placeholder:"Option label","data-testid":`input-option-${a}`}),e.jsx(z,{variant:"ghost",size:"icon",onClick:()=>{var M;const V=(M=r.options)==null?void 0:M.filter((N,w)=>w!==a);L(r.orderIndex,{options:V})},children:e.jsx(rt,{className:"w-4 h-4"})})]},a)),e.jsxs(z,{variant:"outline",size:"sm",onClick:()=>{var a,V;const A=[...r.options||[],{value:`option${(((a=r.options)==null?void 0:a.length)||0)+1}`,label:`Option ${(((V=r.options)==null?void 0:V.length)||0)+1}`}];L(r.orderIndex,{options:A})},"data-testid":"button-add-option",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Option"]})]})]})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(er,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Select a field to edit"})]})})]})})]})}),e.jsx(ze,{value:"tickets",className:"space-y-6",children:e.jsxs(ge,{children:[e.jsxs(st,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"w-5 h-5"}),"Ticket Types"]}),e.jsx(bt,{children:"Configure different ticket options and pricing"})]}),e.jsxs(z,{onClick:he,"data-testid":"button-add-ticket",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"Add Ticket Type"]})]}),e.jsx(Te,{children:i.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(Ea,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No ticket types configured"}),e.jsx("p",{className:"text-sm",children:"Add ticket types to enable paid registration"})]}):e.jsx("div",{className:"space-y-4",children:i.map((A,a)=>e.jsx(ge,{"data-testid":`ticket-type-${a}`,children:e.jsxs(Te,{className:"p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Ticket Name"}),e.jsx(le,{value:A.name,onChange:V=>ie(a,{name:V.target.value}),placeholder:"e.g., General Admission","data-testid":`input-ticket-name-${a}`})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Price (cents)"}),e.jsx(le,{type:"number",value:A.priceCents,onChange:V=>ie(a,{priceCents:parseInt(V.target.value)||0}),placeholder:"0 = free","data-testid":`input-ticket-price-${a}`})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Max Quantity"}),e.jsx(le,{type:"number",value:A.maxQuantity||"",onChange:V=>ie(a,{maxQuantity:V.target.value?parseInt(V.target.value):void 0}),placeholder:"Unlimited","data-testid":`input-ticket-quantity-${a}`})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(z,{variant:"destructive",size:"icon",onClick:()=>te(a),"data-testid":`button-delete-ticket-${a}`,children:e.jsx(xt,{className:"w-4 h-4"})})})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(q,{children:"Description"}),e.jsx(nt,{value:A.description||"",onChange:V=>ie(a,{description:V.target.value}),placeholder:"Describe what's included...",rows:2,"data-testid":`input-ticket-description-${a}`})]})]})},a))})})]})}),e.jsx(ze,{value:"branding",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"w-5 h-5"}),"Color Scheme"]}),e.jsx(bt,{children:"Customize the colors of your registration form"})]}),e.jsx(Te,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Primary Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx("input",{type:"color",value:x.primaryColor,onChange:A=>Q({primaryColor:A.target.value}),className:"w-10 h-10 rounded cursor-pointer border","data-testid":"input-primary-color"}),e.jsx(le,{value:x.primaryColor,onChange:A=>Q({primaryColor:A.target.value}),className:"flex-1","data-testid":"input-primary-color-text"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Buttons, links, accents"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Secondary Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx("input",{type:"color",value:x.secondaryColor,onChange:A=>Q({secondaryColor:A.target.value}),className:"w-10 h-10 rounded cursor-pointer border","data-testid":"input-secondary-color"}),e.jsx(le,{value:x.secondaryColor,onChange:A=>Q({secondaryColor:A.target.value}),className:"flex-1","data-testid":"input-secondary-color-text"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Highlights, badges"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Accent Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx("input",{type:"color",value:x.accentColor,onChange:A=>Q({accentColor:A.target.value}),className:"w-10 h-10 rounded cursor-pointer border","data-testid":"input-accent-color"}),e.jsx(le,{value:x.accentColor,onChange:A=>Q({accentColor:A.target.value}),className:"flex-1","data-testid":"input-accent-color-text"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Special emphasis"})]}
92),e.jsxs("div",{children:[e.jsx(q,{children:"Background Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx("input",{type:"color",value:x.backgroundColor,onChange:A=>Q({backgroundColor:A.target.value}),className:"w-10 h-10 rounded cursor-pointer border","data-testid":"input-background-color"}),e.jsx(le,{value:x.backgroundColor,onChange:A=>Q({backgroundColor:A.target.value}),className:"flex-1","data-testid":"input-background-color-text"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Form background"})]})]})})]}),e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(ut,{className:"w-5 h-5"}),"Logo & Header"]}),e.jsx(bt,{children:"Add your brand imagery"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Logo URL"}),e.jsx(le,{value:x.logoUrl,onChange:A=>Q({logoUrl:A.target.value}),placeholder:"https://example.com/logo.png","data-testid":"input-logo-url"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Displayed at the top of your form"}),x.logoUrl&&e.jsx("div",{className:"mt-2 p-4 border rounded-lg bg-muted/50",children:e.jsx("img",{src:x.logoUrl,alt:"Logo preview",className:"max-h-16 object-contain"})})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Header Image URL"}),e.jsx(le,{value:x.headerImageUrl,onChange:A=>Q({headerImageUrl:A.target.value}),placeholder:"https://example.com/header.jpg","data-testid":"input-header-image-url"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Banner image at the top of the form"}),x.headerImageUrl&&e.jsx("div",{className:"mt-2 p-2 border rounded-lg bg-muted/50",children:e.jsx("img",{src:x.headerImageUrl,alt:"Header preview",className:"w-full max-h-32 object-cover rounded"})})]})]})]}),e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(pn,{className:"w-5 h-5"}),"Layout & Typography"]}),e.jsx(bt,{children:"Choose how your form is displayed"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Form Layout"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:Io.map(A=>e.jsxs("div",{className:`p-3 border rounded-lg cursor-pointer transition-all hover:border-primary ${x.layoutStyle===A.value?"border-primary bg-primary/5 ring-1 ring-primary":""}`,onClick:()=>Q({layoutStyle:A.value}),"data-testid":`layout-option-${A.value}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(A.icon,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-sm",children:A.label})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A.description})]},A.value))})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Font Family"}),e.jsxs(Oe,{value:x.fontFamily,onValueChange:A=>Q({fontFamily:A}),children:[e.jsx(Be,{"data-testid":"select-font-family",children:e.jsx($e,{})}),e.jsx(Ve,{children:Po.map(A=>e.jsx(ae,{value:A.value,children:e.jsx("span",{style:{fontFamily:A.value},children:A.label})},A.value))})]})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Corner Radius"}),e.jsx("div",{className:"flex gap-2 mt-2",children:Gt.map(A=>e.jsx("div",{className:`flex-1 p-3 border text-center cursor-pointer transition-all hover:border-primary ${x.borderRadius===A.value?"border-primary bg-primary/5 ring-1 ring-primary":""}`,style:{borderRadius:A.preview},onClick:()=>Q({borderRadius:A.value}),"data-testid":`radius-option-${A.value}`,children:e.jsx("span",{className:"text-sm font-medium",children:A.label})},A.value))})]})]})]}),e.jsxs(z,{onClick:()=>xe.mutate(x),disabled:xe.isPending,className:"w-full mt-4","data-testid":"button-save-form-branding",children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),xe.isPending?"Saving...":"Save Branding"]})]}),e.jsx("div",{children:e.jsxs(ge,{className:"sticky top-4",children:[e.jsxs(st,{children:[e.jsxs(at,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"w-5 h-5"}),"Live Preview"]}),e.jsx(bt,{children:"See how your branding looks in real-time"})]}),e.jsx(Te,{children:e.jsxs("div",{className:"border rounded-lg overflow-hidden",style:{backgroundColor:x.backgroundColor,fontFamily:x.fontFamily},"data-testid":"branding-preview",children:[x.headerImageUrl&&e.jsx("img",{src:x.headerImageUrl,alt:"Header",className:"w-full h-24 object-cover"}),e.jsxs("div",{className:"p-6",children:[x.logoUrl&&e.jsx("div",{className:"mb-4",children:e.jsx("img",{src:x.logoUrl,alt:"Logo",className:"h-10 object-contain"})}),e.jsx("h2",{className:"text-xl font-bold mb-2",style:{color:x.textColor},children:"Event Registration"}),e.jsx("p",{className:"text-sm mb-6",style:{color:x.textColor,opacity:.7},children:"Complete the form below to register"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium block mb-1",style:{color:x.textColor},children:"Full Name *"}),e.jsx("input",{type:"text",placeholder:"John Doe",disabled:!0,className:"w-full px-3 py-2 border bg-white/50",style:{borderRadius:(be=Gt.find(A=>A.value===x.borderRadius))==null?void 0:be.preview,borderColor:x.primaryColor+"40"}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium block mb-1",style:{color:x.textColor},children:"Email Address *"}),e.jsx("input",{type:"email",placeholder:"[email protected]",disabled:!0,className:"w-full px-3 py-2 border bg-white/50",style:{borderRadius:(I=Gt.find(A=>A.value===x.borderRadius))==null?void 0:I.preview,borderColor:x.primaryColor+"40"}})]}),e.jsx("button",{className:"w-full py-2.5 text-white font-medium",style:{backgroundColor:x.primaryColor,borderRadius:(me=Gt.find(A=>A.value===x.borderRadius))==null?void 0:me.preview},children:"Register Now"})]})]})]})})]})})]})}),e.jsx(ze,{value:"settings",className:"space-y-6",children:e.jsxs(ge,{children:[e.jsxs(st,{children:[e.jsx(at,{children:"Form Settings"}),e.jsx(bt,{children:"Configure registration form behavior and appearance"})]}),e.jsx(Te,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Confirmation Message"}
92),e.jsx(nt,{placeholder:"Thank you for registering! We look forward to seeing you at the event.",rows:4,"data-testid":"input-confirmation-message"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Shown after successful registration"})]}),e.jsxs("div",{children:[e.jsx(q,{children:"Terms & Conditions"}),e.jsx(nt,{placeholder:"By registering, you agree to our terms and conditions...",rows:4,"data-testid":"input-terms"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Required checkbox before submission"})]})]})})]})})]}),e.jsx(Me,{open:m,onOpenChange:y,children:e.jsx(Le,{className:"max-w-2xl max-h-[80vh] overflow-y-auto p-0",children:e.jsxs("div",{className:"overflow-hidden",style:{backgroundColor:x.backgroundColor,fontFamily:x.fontFamily},"data-testid":"preview-dialog-branded",children:[x.headerImageUrl&&e.jsx("img",{src:x.headerImageUrl,alt:"Header",className:"w-full h-32 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsx(Ue,{className:"mb-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[x.logoUrl&&e.jsx("img",{src:x.logoUrl,alt:"Logo",className:"h-12 object-contain"}),e.jsxs("div",{children:[e.jsx(qe,{style:{color:x.textColor},children:"Form Preview"}),e.jsx(Ke,{children:"This is how your registration form will appear to attendees"})]})]})}),e.jsxs("div",{className:"space-y-4",children:[o.map((A,a)=>{var V,M,N;return e.jsx("div",{className:`${A.columnWidth==="half"?"w-1/2":A.columnWidth==="third"?"w-1/3":"w-full"} inline-block p-2`,children:A.fieldType==="heading"?e.jsx("h3",{className:"text-lg font-semibold",style:{color:x.textColor},children:A.label}):A.fieldType==="paragraph"?e.jsx("p",{style:{color:x.textColor,opacity:.7},children:A.label}):e.jsxs("div",{children:[e.jsxs(q,{style:{color:x.textColor},children:[A.label,A.isRequired&&e.jsx("span",{style:{color:x.accentColor},className:"ml-1",children:"*"})]}),A.fieldType==="textarea"?e.jsx(nt,{placeholder:A.placeholder,disabled:!0,style:{borderRadius:(V=Gt.find(w=>w.value===x.borderRadius))==null?void 0:V.preview,borderColor:x.primaryColor+"40"}}):A.fieldType==="select"?e.jsx(Oe,{disabled:!0,children:e.jsx(Be,{style:{borderRadius:(M=Gt.find(w=>w.value===x.borderRadius))==null?void 0:M.preview,borderColor:x.primaryColor+"40"},children:e.jsx($e,{placeholder:A.placeholder||"Select..."})})}):e.jsx(le,{type:A.fieldType,placeholder:A.placeholder,disabled:!0,style:{borderRadius:(N=Gt.find(w=>w.value===x.borderRadius))==null?void 0:N.preview,borderColor:x.primaryColor+"40"}}),A.helpText&&e.jsx("p",{className:"text-xs mt-1",style:{color:x.textColor,opacity:.6},children:A.helpText})]})},a)}),o.length>0&&e.jsx("div",{className:"pt-4",children:e.jsx("button",{className:"w-full py-2.5 text-white font-medium",style:{backgroundColor:x.primaryColor,borderRadius:(ke=Gt.find(A=>A.value===x.borderRadius))==null?void 0:ke.preview},children:"Register Now"})})]})]})]})})})]})}function zo(){const{user:p}=Br(),{toast:P}=ct(),[l,_]=$.useState(null),[b,o]=$.useState(!1),[c,i]=$.useState("overview"),[u,r]=$.useState(!1),{data:d,isLoading:j}=We({queryKey:[`/api/city-events?plannerId=${p==null?void 0:p.id}`],enabled:!!(p!=null&&p.id)}),{data:s}=We({queryKey:[`/api/city-events/${l}`],enabled:!!l}),m=je({mutationFn:async v=>(await fe("POST","/api/city-events",v)).json(),onSuccess:v=>{ve.invalidateQueries({queryKey:[`/api/city-events?plannerId=${p==null?void 0:p.id}`]}),o(!1),_(v.id),P({title:"Event created successfully!"})},onError:()=>{P({title:"Failed to create event",variant:"destructive"})}}),y=je({mutationFn:async v=>{await fe("DELETE",`/api/city-events/${v}`)},onSuccess:()=>{ve.invalidateQueries({queryKey:[`/api/city-events?plannerId=${p==null?void 0:p.id}`]}),_(null),P({title:"Event deleted"})}}),h=je({mutationFn:async v=>(await fe("PATCH",`/api/city-events/${v}`,{status:"published"})).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:[`/api/city-events?plannerId=${p==null?void 0:p.id}`]}),ve.invalidateQueries({queryKey:[`/api/city-events/${l}`]}),P({title:"Event published!",description:"Your event is now visible to the public."})}}),f=(d==null?void 0:d.data)||[],g=()=>{l&&(navigator.clipboard.writeText(`${window.location.origin}/agenda/${l}`),r(!0),setTimeout(()=>r(!1),2e3),P({title:"Link copied!"}))};return l?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>_(null),className:"text-gray-300 hover:text-white","data-testid":"button-back-to-events",children:[e.jsx(Ga,{className:"w-4 h-4 mr-1"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:s==null?void 0:s.title}),e.jsxs("p",{className:"text-gray-400 text-sm",children:[s==null?void 0:s.hostCity,", ",s==null?void 0:s.hostCountry]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z,{variant:"outline",size:"sm",onClick:g,className:"border-white/20 text-gray-300","data-testid":"button-copy-agenda-link",children:[u?e.jsx(qs,{className:"w-4 h-4 mr-1"}):e.jsx(Kt,{className:"w-4 h-4 mr-1"}),"Copy Agenda Link"]}),e.jsxs(z,{variant:"outline",size:"sm",onClick:()=>window.open(`/agenda/${l}`,"_blank"),className:"border-white/20 text-gray-300","data-testid":"button-preview-agenda",children:[e.jsx(Lt,{className:"w-4 h-4 mr-1"}),"Preview"]}),(s==null?void 0:s.status)==="draft"&&e.jsxs(z,{onClick:()=>h.mutate(l),disabled:h.isPending,"data-testid":"button-publish-event",children:[e.jsx(ys,{className:"w-4 h-4 mr-1"}),h.isPending?"Publishing...":"Publish"]}),(s==null?void 0:s.status)==="published"&&e.jsxs(De,{variant:"default",className:"px-3 py-1 bg-green-600",children:[e.jsx(ys,{className:"w-3 h-3 mr-1"}),"Live"]}),e.jsx(z,{variant:"destructive",size:"sm",onClick:()=>{y.mutate(l)},"data-testid":"button-delete-event",children:e.jsx(xt,{className:"w-4 h-4"})})]})]}),e.jsxs(as,{value:c,onValueChange:i,className:"w-full",children:[e.jsxs(is,{className:"bg-white/10 border-white/20",children:[e.jsxs(Re,{value:"overview",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-overview",children:[e.jsx(Us,{className:"w-4 h-4 mr-1"}),"Overview"]}),e.jsxs(Re,{value:"agenda",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-agenda",children:[e.jsx(ws,{className:"w-4 h-4 mr-1"}),"Agenda"]}
92),e.jsxs(Re,{value:"speakers",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-speakers",children:[e.jsx(xa,{className:"w-4 h-4 mr-1"}),"Speakers"]}),e.jsxs(Re,{value:"registrations",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-registrations",children:[e.jsx($t,{className:"w-4 h-4 mr-1"}),"Registrations"]}),e.jsxs(Re,{value:"form-builder",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-form-builder",children:[e.jsx(vo,{className:"w-4 h-4 mr-1"}),"Form Builder"]}),e.jsxs(Re,{value:"qr-codes",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-qr-codes",children:[e.jsx($r,{className:"w-4 h-4 mr-1"}),"QR Codes"]}),e.jsxs(Re,{value:"branding",className:"data-[state=active]:bg-accent data-[state=active]:text-black","data-testid":"event-tab-branding",children:[e.jsx(wt,{className:"w-4 h-4 mr-1"}),"Branding"]})]}),e.jsx(ze,{value:"overview",className:"mt-4",children:e.jsx(Oo,{event:s})}),e.jsx(ze,{value:"agenda",className:"mt-4",children:e.jsx(Bo,{eventId:l})}),e.jsx(ze,{value:"speakers",className:"mt-4",children:e.jsx($o,{eventId:l})}),e.jsx(ze,{value:"registrations",className:"mt-4",children:e.jsx(Mo,{eventId:l})}),e.jsx(ze,{value:"form-builder",className:"mt-4",children:e.jsx(Ro,{eventId:l})}),e.jsx(ze,{value:"qr-codes",className:"mt-4",children:e.jsx(Lo,{eventId:l,eventTitle:(s==null?void 0:s.title)||""})}),e.jsx(ze,{value:"branding",className:"mt-4",children:e.jsx(Uo,{eventId:l,event:s})})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Events & Agendas"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Create and manage events, agendas, and registrations"})]}),e.jsxs(Me,{open:b,onOpenChange:o,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{"data-testid":"button-create-event",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"New Event"]})}),e.jsxs(Le,{className:"sm:max-w-[500px] bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Create New Event"}),e.jsx(Ke,{className:"text-gray-400",children:"Set up a new event with registration and agenda"})]}),e.jsx(Do,{onSubmit:v=>m.mutate(v),isPending:m.isPending})]})]})]}),j?e.jsx("div",{className:"text-center py-12 text-gray-400",children:"Loading events..."}):f.length===0?e.jsx(ge,{className:"glass-card border-white/20",children:e.jsxs(Te,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(Us,{className:"w-16 h-16 text-gray-500 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No events yet"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:"Create your first event to get started"}),e.jsxs(z,{onClick:()=>o(!0),"data-testid":"button-create-first-event",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"Create Event"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.map(v=>e.jsxs(ge,{className:"glass-card border-white/20 cursor-pointer hover:border-accent/50 transition-colors",onClick:()=>_(v.id),"data-testid":`event-card-${v.id}`,children:[e.jsxs(st,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(at,{className:"text-white text-lg",children:v.title}),e.jsx(De,{variant:v.status==="published"?"default":"secondary",children:v.status})]}),e.jsx(bt,{className:"text-gray-400",children:v.hostCity&&v.hostCountry?`${v.hostCity}, ${v.hostCountry}`:"Location TBD"})]}),e.jsx(Te,{children:e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ws,{className:"w-4 h-4"}),v.startDate?Mt(new Date(v.startDate),"MMM d, yyyy"):"Date TBD"]}),v.venue&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(bs,{className:"w-4 h-4"}),v.venue]})]})})]},v.id))})]})}function Do({onSubmit:p,isPending:P}
92){const[l,_]=$.useState({title:"",shortDescription:"",description:"",category:"conference",startDate:"",endDate:"",venue:"",hostCity:"",hostCountry:"USA",timezone:"America/New_York"}),b=o=>{o.preventDefault(),p({...l,startDate:l.startDate?new Date(l.startDate).toISOString():null,endDate:l.endDate?new Date(l.endDate).toISOString():null,status:"draft"})};return e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Event Title"}),e.jsx(le,{value:l.title,onChange:o=>_({...l,title:o.target.value}),placeholder:"National Cannabis Festival 2026",className:"bg-white/10 border-white/20 text-white",required:!0,"data-testid":"input-event-title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Short Description"}),e.jsx(le,{value:l.shortDescription,onChange:o=>_({...l,shortDescription:o.target.value}),placeholder:"The Nation's Premier Cannabis Celebration",className:"bg-white/10 border-white/20 text-white","data-testid":"input-short-description"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Category"}),e.jsxs(Oe,{value:l.category,onValueChange:o=>_({...l,category:o}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-category",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"conference",className:"text-white",children:"Conference"}),e.jsx(ae,{value:"festival",className:"text-white",children:"Festival"}),e.jsx(ae,{value:"workshop",className:"text-white",children:"Workshop"}),e.jsx(ae,{value:"meetup",className:"text-white",children:"Meetup"}),e.jsx(ae,{value:"concert",className:"text-white",children:"Concert"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Timezone"}),e.jsxs(Oe,{value:l.timezone,onValueChange:o=>_({...l,timezone:o}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-timezone",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"America/New_York",className:"text-white",children:"Eastern Time"}),e.jsx(ae,{value:"America/Chicago",className:"text-white",children:"Central Time"}),e.jsx(ae,{value:"America/Denver",className:"text-white",children:"Mountain Time"}),e.jsx(ae,{value:"America/Los_Angeles",className:"text-white",children:"Pacific Time"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Start Date"}),e.jsx(le,{type:"date",value:l.startDate,onChange:o=>_({...l,startDate:o.target.value}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-start-date"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"End Date"}),e.jsx(le,{type:"date",value:l.endDate,onChange:o=>_({...l,endDate:o.target.value}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-end-date"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Venue"}),e.jsx(le,{value:l.venue,onChange:o=>_({...l,venue:o.target.value}),placeholder:"RFK Festival Grounds",className:"bg-white/10 border-white/20 text-white","data-testid":"input-venue"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"City"}),e.jsx(le,{value:l.hostCity,onChange:o=>_({...l,hostCity:o.target.value}),placeholder:"Washington DC",className:"bg-white/10 border-white/20 text-white","data-testid":"input-city"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Country"}),e.jsx(le,{value:l.hostCountry,onChange:o=>_({...l,hostCountry:o.target.value}),placeholder:"USA",className:"bg-white/10 border-white/20 text-white","data-testid":"input-country"})]})]}),e.jsx(Ze,{children:e.jsx(z,{type:"submit",disabled:P,"data-testid":"button-submit-event",children:P?"Creating...":"Create Event"})})]})}function Oo({event:p}){var P,l,_;return p?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsx(st,{children:e.jsx(at,{className:"text-white",children:"Event Details"})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Title"}),e.jsx("p",{className:"text-white",children:p.title})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Description"}),e.jsx("p",{className:"text-white",children:p.shortDescription||"No description"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Start Date"}),e.jsx("p",{className:"text-white",children:p.startDate?Mt(new Date(p.startDate),"MMM d, yyyy"):"TBD"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"End Date"}),e.jsx("p",{className:"text-white",children:p.endDate?Mt(new Date(p.endDate),"MMM d, yyyy"):"TBD"})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Venue"}),e.jsx("p",{className:"text-white",children:p.venue||"TBD"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Location"}),e.jsxs("p",{className:"text-white",children:[p.hostCity,", ",p.hostCountry]})]})]})]}),e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsx(st,{children:e.jsx(at,{className:"text-white",children:"Qu
92ick Stats"})}),e.jsx(Te,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-4 text-center",children:[e.jsx(ws,{className:"w-8 h-8 mx-auto text-accent mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:((P=p.days)==null?void 0:P.length)||0}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Days"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-4 text-center",children:[e.jsx(xa,{className:"w-8 h-8 mx-auto text-accent mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:((l=p.speakers)==null?void 0:l.length)||0}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Speakers"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-4 text-center",children:[e.jsx(At,{className:"w-8 h-8 mx-auto text-accent mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:((_=p.sessions)==null?void 0:_.length)||0}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Sessions"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-4 text-center",children:[e.jsx($t,{className:"w-8 h-8 mx-auto text-accent mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:p.registrationCount||0}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Registrations"})]})]})})]})]}):null}function Bo({eventId:p}){const{toast:P}=ct(),[l,_]=$.useState(!1),[b,o]=$.useState(!1),[c,i]=$.useState({title:"",description:"",date:"",dayNumber:1}),[u,r]=$.useState({title:"",description:"",sessionType:"session",startTime:"",endTime:"",location:"",eventDayId:"",speakerId:""}),{data:d}=We({queryKey:[`/api/city-events/${p}/days`],enabled:!!p}),{data:j}=We({queryKey:[`/api/city-events/${p}/sessions`],enabled:!!p}),{data:s}=We({queryKey:[`/api/city-events/${p}/speakers`],enabled:!!p}),m=je({mutationFn:async x=>(await fe("POST",`/api/city-events/${p}/days`,x)).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:[`/api/city-events/${p}/days`]}),_(!1),i({title:"",description:"",date:"",dayNumber:(d==null?void 0:d.length)+1||1}),P({title:"Day added successfully!"})},onError:()=>{P({title:"Failed to add day",variant:"destructive"})}}),y=je({mutationFn:async x=>(await fe("POST",`/api/city-events/${p}/sessions`,x)).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:[`/api/city-events/${p}/sessions`]}),o(!1),r({title:"",description:"",sessionType:"session",startTime:"",endTime:"",location:"",eventDayId:"",speakerId:""}),P({title:"Session added successfully!"})},onError:()=>{P({title:"Failed to add session",variant:"destructive"})}}),h=x=>{x.preventDefault(),m.mutate({...c,dayNumber:c.dayNumber||((d==null?void 0:d.length)||0)+1,date:c.date?new Date(c.date).toISOString():null})},[f,g]=$.useState(null),v=x=>{if(x.preventDefault(),g(null),!u.eventDayId){g("Please select a day for this session"),P({title:"Please select a day for this session",variant:"destructive"});return}if(!u.title.trim()){g("Session title is required"),P({title:"Session title is required",variant:"destructive"});return}y.mutate({...u,startTime:u.startTime?new Date(u.startTime).toISOString():null,endTime:u.endTime?new Date(u.endTime).toISOString():null,speakerId:u.speakerId||null})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Event Agenda"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Me,{open:l,onOpenChange:_,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{size:"sm",variant:"outline",className:"border-white/20 text-gray-300","data-testid":"button-add-day",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Day"]})}),e.jsxs(Le,{className:"sm:max-w-[425px] bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Event Day"}),e.jsx(Ke,{className:"text-gray-400",children:"Add a new day to your event agenda"})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Day Title"}),e.jsx(le,{value:c.title,onChange:x=>i({...c,title:x.target.value}),placeholder:"Opening Day",className:"bg-white/10 border-white/20 text-white",required:!0,"data-testid":"input-day-title"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Day Number"}),e.jsx(le,{type:"number",min:"1",value:c.dayNumber,onChange:x=>i({...c,dayNumber:parseInt(x.target.value)}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-day-number"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Date"}),e.jsx(le,{type:"date",value:c.date,onChange:x=>i({...c,date:x.target.value}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-day-date"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Description"}),e.jsx(nt,{value:c.description,onChange:x=>i({...c,description:x.target.value}),placeholder:"What's happening on this day...",className:"bg-white/10 border-white/20 text-white","data-testid":"input-day-description"})]}),e.jsx(Ze,{children:e.jsx(z,{type:"submit",disabled:m.isPending,"data-testid":"button-submit-day",children:m.isPending?"Adding...":"Add Day"})})]})]})]}),e.jsxs(Me,{open:b,onOpenChange:o,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{size:"sm","data-testid":"button-add-session",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Session"]})}),e.jsxs(Le,{className:"sm:max-w-[500px] bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Session"}),e.jsx(Ke,{className:"text-gray-400",children:"Add a session to your event agenda"})]}),e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Session Title"}),e.jsx(le,{value:u.title,onChange:x=>
92r({...u,title:x.target.value}),placeholder:"Keynote: Opening Remarks",className:"bg-white/10 border-white/20 text-white",required:!0,"data-testid":"input-session-title"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(q,{className:"text-white",children:["Day ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs(Oe,{value:u.eventDayId,onValueChange:x=>{r({...u,eventDayId:x}),f&&f.includes("day")&&g(null)},children:[e.jsx(Be,{className:`bg-white/10 text-white ${f!=null&&f.includes("day")?"border-red-500":"border-white/20"}`,"data-testid":"select-session-day",children:e.jsx($e,{placeholder:"Select day"})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:d==null?void 0:d.map(x=>e.jsxs(ae,{value:x.id,className:"text-white",children:["Day ",x.dayNumber,": ",x.title]},x.id))})]}),(f==null?void 0:f.includes("day"))&&e.jsx("p",{className:"text-red-400 text-xs mt-1",children:f})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Session Type"}),e.jsxs(Oe,{value:u.sessionType,onValueChange:x=>r({...u,sessionType:x}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-session-type",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"keynote",className:"text-white",children:"Keynote"}),e.jsx(ae,{value:"session",className:"text-white",children:"Session"}),e.jsx(ae,{value:"workshop",className:"text-white",children:"Workshop"}),e.jsx(ae,{value:"panel",className:"text-white",children:"Panel"}),e.jsx(ae,{value:"networking",className:"text-white",children:"Networking"}),e.jsx(ae,{value:"break",className:"text-white",children:"Break"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Start Time"}),e.jsx(le,{type:"datetime-local",value:u.startTime,onChange:x=>r({...u,startTime:x.target.value}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-session-start"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"End Time"}),e.jsx(le,{type:"datetime-local",value:u.endTime,onChange:x=>r({...u,endTime:x.target.value}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-session-end"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Location"}),e.jsx(le,{value:u.location,onChange:x=>r({...u,location:x.target.value}),placeholder:"Main Stage",className:"bg-white/10 border-white/20 text-white","data-testid":"input-session-location"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Speaker"}),e.jsxs(Oe,{value:u.speakerId,onValueChange:x=>r({...u,speakerId:x}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-session-speaker",children:e.jsx($e,{placeholder:"Select speaker"})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"",className:"text-white",children:"No speaker"}),s==null?void 0:s.map(x=>e.jsx(ae,{value:x.id,className:"text-white",children:x.name},x.id))]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Description"}),e.jsx(nt,{value:u.description,onChange:x=>r({...u,description:x.target.value}),placeholder:"What will be covered in this session...",className:"bg-white/10 border-white/20 text-white","data-testid":"input-session-description"})]}),e.jsx(Ze,{children:e.jsx(z,{type:"submit",disabled:y.isPending,"data-testid":"button-submit-session",children:y.isPending?"Adding...":"Add Session"})})]})]})]})]})]}),!d||d.length===0?e.jsx(ge,{className:"glass-card border-white/20",children:e.jsxs(Te,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ws,{className:"w-12 h-12 text-gray-500 mb-4"}),e.jsx("h4",{className:"text-white font-medium mb-2",children:"No agenda days yet"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:"Start by adding days to your event"}),e.jsxs(z,{size:"sm",onClick:()=>_(!0),"data-testid":"button-add-first-day",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add First Day"]})]})}):e.jsx("div",{className:"space-y-4",children:d.map(x=>e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsxs(st,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(at,{className:"text-white text-lg",children:["Day ",x.dayNumber,": ",x.title]}),e.jsx(De,{variant:"secondary",children:x.date?Mt(new Date(x.date),"MMM d"):"No date"})]}),e.jsx(bt,{className:"text-gray-400",children:x.description})]}),e.jsx(Te,{children:j&&j.filter(k=>k.eventDayId===x.id).length>0?e.jsx("div",{className:"space-y-2",children:j.filter(k=>k.eventDayId===x.id).sort((k,D)=>new Date(k.startTime).getTime()-new Date(D.startTime).getTime()).map(k=>e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-white/5 rounded-lg",children:[e.jsx("div",{className:"text-gray-400 text-sm w-24",children:k.startTime?Mt(new Date(k.startTime),"h:mm a"):"--:--"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-white font-medium",children:k.title}),e.jsx("p",{className:"text-gray-400 text-sm",children:k.location})]}),e.jsx(De,{variant:"secondary",children:k.sessionType})]},k.id))}):e.jsx("p",{className:"text-gray-400 text-sm text-center py-4",children:"No sessions for this day"})})]},x.id))})]})}function $o({eventId:p}){const{toast:P}=ct(),[l,_]=$.useState(!1),[b,o]=$.useState({name:"",title:"",company:"",bio:"",email:"",ph
92otoUrl:"",linkedinUrl:"",twitterHandle:""}),{data:c}=We({queryKey:[`/api/city-events/${p}/speakers`],enabled:!!p}),i=je({mutationFn:async r=>(await fe("POST",`/api/city-events/${p}/speakers`,r)).json(),onSuccess:()=>{ve.invalidateQueries({queryKey:[`/api/city-events/${p}/speakers`]}),_(!1),o({name:"",title:"",company:"",bio:"",email:"",photoUrl:"",linkedinUrl:"",twitterHandle:""}),P({title:"Speaker added successfully!"})},onError:()=>{P({title:"Failed to add speaker",variant:"destructive"})}}),u=r=>{r.preventDefault(),i.mutate(b)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Speakers"}),e.jsxs(Me,{open:l,onOpenChange:_,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{size:"sm","data-testid":"button-add-speaker",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Speaker"]})}),e.jsxs(Le,{className:"sm:max-w-[500px] bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Speaker"}),e.jsx(Ke,{className:"text-gray-400",children:"Add a speaker to your event"})]}),e.jsxs("form",{onSubmit:u,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Name"}),e.jsx(le,{value:b.name,onChange:r=>o({...b,name:r.target.value}),placeholder:"John Smith",className:"bg-white/10 border-white/20 text-white",required:!0,"data-testid":"input-speaker-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Title"}),e.jsx(le,{value:b.title,onChange:r=>o({...b,title:r.target.value}),placeholder:"CEO",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-title"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Company"}),e.jsx(le,{value:b.company,onChange:r=>o({...b,company:r.target.value}),placeholder:"Acme Corp",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-company"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Email"}),e.jsx(le,{type:"email",value:b.email,onChange:r=>o({...b,email:r.target.value}),placeholder:"[email protected]",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-email"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Bio"}),e.jsx(nt,{value:b.bio,onChange:r=>o({...b,bio:r.target.value}),placeholder:"Speaker biography...",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-bio"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Photo URL"}),e.jsx(le,{value:b.photoUrl,onChange:r=>o({...b,photoUrl:r.target.value}),placeholder:"https://example.com/photo.jpg",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-photo"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"LinkedIn URL"}),e.jsx(le,{value:b.linkedinUrl,onChange:r=>o({...b,linkedinUrl:r.target.value}),placeholder:"linkedin.com/in/...",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-linkedin"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white",children:"Twitter Handle"}),e.jsx(le,{value:b.twitterHandle,onChange:r=>o({...b,twitterHandle:r.target.value}),placeholder:"@username",className:"bg-white/10 border-white/20 text-white","data-testid":"input-speaker-twitter"})]})]}),e.jsx(Ze,{children:e.jsx(z,{type:"submit",disabled:i.isPending,"data-testid":"button-submit-speaker",children:i.isPending?"Adding...":"Add Speaker"})})]})]})]})]}),!c||c.length===0?e.jsx(ge,{className:"glass-card border-white/20",children:e.jsxs(Te,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(xa,{
92className:"w-12 h-12 text-gray-500 mb-4"}),e.jsx("h4",{className:"text-white font-medium mb-2",children:"No speakers yet"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:"Add speakers to your event"}),e.jsxs(z,{size:"sm",onClick:()=>_(!0),"data-testid":"button-add-first-speaker",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add First Speaker"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map(r=>e.jsx(ge,{className:"glass-card border-white/20",children:e.jsx(Te,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[r.photoUrl?e.jsx("img",{src:r.photoUrl,alt:r.name,className:"w-16 h-16 rounded-full object-cover"}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-accent/20 flex items-center justify-center",children:e.jsx(xa,{className:"w-8 h-8 text-accent"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:r.name}),e.jsx("p",{className:"text-gray-400 text-sm",children:r.title}),e.jsx("p",{className:"text-gray-500 text-xs",children:r.company})]})]})})},r.id))})]})}function Mo({eventId:p}){const{toast:P}=ct(),{data:l}=We({queryKey:[`/api/city-events/${p}/registrations`],enabled:!!p}),_=()=>{if(!l||l.length===0){P({title:"No registrations to export",variant:"destructive"});return}const b=["Name","Email","Status","Ticket Type","Registered At"],o=l.map(r=>[r.attendeeName||"Anonymous",r.attendeeEmail||"",r.status||"",r.ticketType||"general",r.createdAt?Mt(new Date(r.createdAt),"yyyy-MM-dd HH:mm"):""]),c=[b.join(","),...o.map(r=>r.map(d=>`"${d.replace(/"/g,'""')}"`).join(","))].join(` 93`),i=new Blob([c],{type:"text/csv;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(i),u.download=`registrations-${p}.csv`,u.click(),URL.revokeObjectURL(u.href),P({title:"Registrations exported successfully!"})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Registrations"}),e.jsx("div",{className:"flex gap-2",children:e.jsxs(z,{size:"sm",variant:"outline",className:"border-white/20 text-gray-300",onClick:_,disabled:!l||l.length===0,"data-testid":"button-export-registrations",children:[e.jsx(St,{className:"w-4 h-4 mr-1"}),"Export CSV"]})})]}),!l||l.length===0?e.jsx(ge,{className:"glass-card border-white/20",children:e.jsxs(Te,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx($t,{className:"w-12 h-12 text-gray-500 mb-4"}),e.jsx("h4",{className:"text-white font-medium mb-2",children:"No registrations yet"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Share your event to start getting registrations"})]})}):e.jsx(ge,{className:"glass-card border-white/20",children:e.jsxs(Te,{className:"pt-6",children:[e.jsxs("div",{className:"mb-4 text-gray-400 text-sm",children:[l.length," registration",l.length!==1?"s":""]}),e.jsx("div",{className:"space-y-2",children:l.map(b=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white/5 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:b.attendeeName||"Anonymous"}),e.jsx("p",{className:"text-gray-400 text-sm",children:b.attendeeEmail})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{variant:b.status==="confirmed"?"default":"secondary",children:b.status}),e.jsx(De,{variant:"outline",className:"border-white/20 text-gray-300",children:b.ticketType})]})]},b.id))})]})})]})}function Lo({eventId:p,eventTitle:P}){const{toast:l}=ct(),[_,b]=$.useState(null),o=`${window.location.origin}/events/${p}`,c=`${window.location.origin}/agenda/${p}`,i=(r,d)=>{navigator.clipboard.writeText(r),b(d),setTimeout(()=>b(null),2e3),l({title:`${d} link copied!`})},u=(r,d)=>{const j=document.getElementById(r);if(!j)return;const s=new XMLSerializer().serializeToString(j),m=document.createElement("canvas"),y=m.getContext("2d"),h=new Image;h.onload=()=>{m.width=h.width,m.height=h.height,y==null||y.drawImage(h,0,0);const f=m.toDataURL("image/png"),g=document.createElement("a");g.download=d,g.href=f,g.click()},h.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(s))),l({title:"QR Code downloaded!"})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h3",{className:"text-lg font-semibold text-white",children:"QR Codes & Links"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsxs(st,{children:[e.jsxs(at,{className:"text-white flex items-center gap-2",children:[e.jsx($t,{className:"w-5 h-5"}),"Registration QR"]}),e.jsx(bt,{className:"text-gray-400",children:"Scan to register for the event"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsx("div",{className:"bg-white p-4 rounded-lg flex items-center justify-center",children:e.jsx(tr,{id:"registration-qr",value:o,size:192,level:"H",includeMargin:!0,"data-testid":"qr-registration"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{variant:"outline",className:"flex-1 border-white/20 text-gray-300",onClick:()=>i(o,"Registration"),"data-testid":"button-copy-registration-link",children:[_==="Registration"?e.jsx(qs,{className:"w-4 h-4 mr-1"}):e.jsx(Kt,{className:"w-4 h-4 mr-1"}),"Copy Link"]}),e.jsxs(z,{variant:"outline",className:"flex-1 border-white/20 text-gray-300",onClick:()=>u("registration-qr",`registration-${p}.png`),"data-testid":"button-download-registration-qr",children:[e.jsx(St,{className:"w-4 h-4 mr-1"}),"Download"]})]}),e.jsxs(z,{variant:"ghost",className:"w-full text-gray-400 hover:text-white",onClick:()=>window.open(o,"_blank"),"data-testid":"button-open-registration",children:[e.jsx(pa,{className:"w-4 h-4 mr-1"}),"Open Registration Page"]})]})]}),e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsxs(st,{children:[e.jsxs(at,{className:"text-white flex items-center gap-2",children:[e.jsx(ws,{className:"w-5 h-5"}),"Agenda QR"]}),e.jsx(bt,{className:"text-gray-400",children:"Scan to view the event agenda"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsx("div",{className:"bg-white p-4 rounded-lg flex items-center justify-center",children:e.jsx(tr,{id:"agenda-qr",value:c,size:192,level:"H",includeMargin:!0,"data-testid":"qr-agenda"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{variant:"outline",className:"flex-1 border-white/20 text-gray-300",onClick:()=>i(c,"Agenda"),"data-testid":"button-copy-agenda-link",children:[_==="Agenda"?e.jsx(qs,{className:"w-4 h-4 mr-1"}):e.jsx(Kt,{className:"w-4 h-4 mr-1"}),"Copy Link"]}),e.jsxs(z,{variant:"outline",className:"flex-1 border-white/20 text-gray-300",onClick:()=>u("agenda-qr",`agenda-${p}.png`),"data-testid":"button-download-agenda-qr",children:[e.jsx(St,{className:"w-4 h-4 mr-1"}),"Download"]})]}),e.jsxs(z,{variant:"ghost",className:"w-full text-gray-400 hover:text-white",onClick:()=>window.open(c,"_blank"),"data-testid":"button-open-agenda",children:[e.jsx(pa,{className:"w-4 h-4 mr-1"}),"Open Agenda Page"]})]})]})]})]})}function Uo({eventId:p,event:P}){const{toast:l}=ct(),[_,b]=$.useState({primaryColor:"#2E7D32",secondaryColor:"#1B5E20",accentColor:"#FFD700",backgroundColor:"#FFFFFF",fontFamily:"Inter",borderRadius:"medium"});$.useEffect(()=>{const i=(P==null?void 0:P.branding)||{};b({primaryColor:i.primaryColor||"#2E7D32",secondaryColor:i.secondaryColor||"#1B5E20",accentColor:i.accentColor||"#FFD700",backgroundColor:i.backgroundColor||"#FFFFFF",fontFamily:i.fontFamily||"Inter",borderRadius:i.borderRadius||"medium"})},[P]);const o=je({mutationFn:async i=>(await fe("PATCH",`/api/city-events/${p}`,{branding:i})).json(),onSuccess:()=>
93{ve.invalidateQueries({queryKey:[`/api/city-events/${p}`]}),l({title:"Branding updated!"})},onError:()=>{l({title:"Failed to update branding",variant:"destructive"})}}),c=()=>{o.mutate(_)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Event Branding"}),e.jsx(z,{onClick:c,disabled:o.isPending,"data-testid":"button-save-branding",children:o.isPending?"Saving...":"Save Branding"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsx(st,{children:e.jsx(at,{className:"text-white",children:"Colors"})}),e.jsx(Te,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Primary Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:_.primaryColor,onChange:i=>b({..._,primaryColor:i.target.value}),className:"w-8 h-8 rounded border border-white/20 cursor-pointer","data-testid":"input-primary-color-picker"}),e.jsx(le,{type:"text",value:_.primaryColor,onChange:i=>b({..._,primaryColor:i.target.value}),className:"bg-white/10 border-white/20 text-white",placeholder:"#2E7D32","data-testid":"input-primary-color"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Secondary Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:_.secondaryColor,onChange:i=>b({..._,secondaryColor:i.target.value}),className:"w-8 h-8 rounded border border-white/20 cursor-pointer","data-testid":"input-secondary-color-picker"}),e.jsx(le,{type:"text",value:_.secondaryColor,onChange:i=>b({..._,secondaryColor:i.target.value}),className:"bg-white/10 border-white/20 text-white",placeholder:"#1B5E20","data-testid":"input-secondary-color"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Accent Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:_.accentColor,onChange:i=>b({..._,accentColor:i.target.value}),className:"w-8 h-8 rounded border border-white/20 cursor-pointer","data-testid":"input-accent-color-picker"}),e.jsx(le,{type:"text",value:_.accentColor,onChange:i=>b({..._,accentColor:i.target.value}),className:"bg-white/10 border-white/20 text-white",placeholder:"#FFD700","data-testid":"input-accent-color"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Backgroun
93d Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:_.backgroundColor,onChange:i=>b({..._,backgroundColor:i.target.value}),className:"w-8 h-8 rounded border border-white/20 cursor-pointer","data-testid":"input-background-color-picker"}),e.jsx(le,{type:"text",value:_.backgroundColor,onChange:i=>b({..._,backgroundColor:i.target.value}),className:"bg-white/10 border-white/20 text-white",placeholder:"#FFFFFF","data-testid":"input-background-color"})]})]})]})})]}),e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsx(st,{children:e.jsx(at,{className:"text-white",children:"Typography & Style"})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Font Family"}),e.jsxs(Oe,{value:_.fontFamily,onValueChange:i=>b({..._,fontFamily:i}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-font-family",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"Inter",className:"text-white",children:"Inter"}),e.jsx(ae,{value:"Poppins",className:"text-white",children:"Poppins"}),e.jsx(ae,{value:"Montserrat",className:"text-white",children:"Montserrat"}),e.jsx(ae,{value:"Roboto",className:"text-white",children:"Roboto"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-gray-400 text-sm",children:"Border Radius"}),e.jsxs(Oe,{value:_.borderRadius,onValueChange:i=>b({..._,borderRadius:i}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-border-radius",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"none",className:"text-white",children:"None"}),e.jsx(ae,{value:"small",className:"text-white",children:"Small"}),e.jsx(ae,{value:"medium",className:"text-white",children:"Medium"}),e.jsx(ae,{value:"large",className:"text-white",children:"Large"})]})]})]}),e.jsxs("div",{className:"pt-4 mt-4 border-t border-white/10",children:[e.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"Preview"}),e.jsxs("div",{className:"p-4 rounded-lg",style:{backgroundColor:_.backgroundColor,borderRadius:_.borderRadius==="none"?"0":_.borderRadius==="small"?"4px":_.borderRadius==="medium"?"8px":"16px"},children:[e.jsx("p",{className:"font-semibold mb-2",style:{color:_.primaryColor,fontFamily:_.fontFamily},children:"Event Title Preview"}),e.jsx("p",{className:"text-sm mb-2",style:{color:_.secondaryColor,fontFamily:_.fontFamily},children:"Secondary text styling"}),e.jsx("button",{className:"px-4 py-2 rounded text-white text-sm",style:{backgroundColor:_.accentColor,borderRadius:_.borderRadius==="none"?"0":_.borderRadius==="small"?"4px":_.borderRadius==="medium"?"8px":"16px"},children:"Sample Button"})]})]})]})]})]})]})}const Sr={owner:{label:"Owner",description:"Full control over the project",icon:Xr},editor:{label:"Editor",description:"Can edit and submit for review",icon:en},reviewer:{label:"Reviewer",description:"Can approve or request changes",icon:ht},viewer:{label:"Viewer",description:"Can only view the project",icon:Lt}};function _r(p,P,l){return p&&P?`${p[0]}${P[0]}`.toUpperCase():p?p.slice(0,2).toUpperCase():l?l.slice(0,2).toUpperCase():"??"}function Da(p){return p?p.firstName&&p.lastName?`${p.firstName} ${p.lastName}`:p.firstName?p.firstName:p.email||"Unknown User":"Unknown User"}function qo({projectId:p,isOwner:P,onLockStatusChange:l}){var W,n,S,oe,J,xe;const{toast:_}=ct(),[b,o]=$.useState(!1),[c,i]=$.useState(!1),[u,r]=$.useState(""),[d,j]=$.useState("editor"),[s,m]=$.useState(""),[y,h]=$.useState(!1),[f,g]=$.useState(null),[v,x]=$.useState(null),{data:k,isLoading:D}=We({queryKey:["/api/studio/projects",p,"collaborators"],enabled:!!p&&b}),{data:K}=We({queryKey:["/api/studio/projects",p,"pending-invitations"],enabled:!!p&&b&&P}),U=je({mutationFn:async Z=>fe("POST",`/api/studio/projects/${p}/collaborators/invite`,Z),onSuccess:Z=>{_({title:"Invitation Sent",description:`An invitation has been sent to ${u}`}
93),i(!1),r(""),j("editor"),m(""),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"pending-invitations"]}),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"collaborators"]})},onError:Z=>{_({title:"Failed to Send Invitation",description:Z.message||"Something went wrong",variant:"destructive"})}}),Q=je({mutationFn:async({collaboratorId:Z,role:Y})=>fe("PATCH",`/api/studio/projects/${p}/collaborators/${Z}`,{role:Y}),onSuccess:()=>{_({title:"Role Updated",description:"Collaborator role has been updated"}),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"collaborators"]})},onError:Z=>{_({title:"Failed to Update Role",description:Z.message||"Something went wrong",variant:"destructive"})}}),R=je({mutationFn:async Z=>fe("DELETE",`/api/studio/projects/${p}/collaborators/${Z}`),onSuccess:()=>{_({title:"Collaborator Removed",description:"The collaborator has been removed from this project"}),h(!1),g(null),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"collaborators"]})},onError:Z=>{_({title:"Failed to Remove",description:Z.message||"Something went wrong",variant:"destructive"})}}),O=je({mutationFn:async Z=>fe("DELETE",`/api/studio/projects/${p}/invitations/${Z}`),onSuccess:()=>{_({title:"Invitation Cancelled",description:"The invitation has been cancelled"}),x(null),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"pending-invitations"]})},onError:Z=>{_({title:"Failed to Cancel",description:Z.message||"Something went wrong",variant:"destructive"})}}),ne=()=>{if(!u){_({title:"Email Required",description:"Please enter an email address",variant:"destructive"});return}U.mutate({email:u,role:d,message:s||void 0})},C=(((W=k==null?void 0:k.collaborators)==null?void 0:W.length)||0)+1;return e.jsxs(e.Fragment,{children:[e.jsxs(Mr,{open:b,onOpenChange:o,children:[e.jsx(Lr,{asChild:!0,children:e.jsxs(z,{variant:"outline",size:"sm",className:"gap-2","data-testid":"btn-collaborators",children:[e.jsx($t,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Collaborators"}),e.jsx(De,{variant:"secondary",className:"ml-1 text-xs",children:C})]})}),e.jsxs(Ur,{className:"w-full sm:max-w-md",children:[e.jsxs(qr,{children:[e.jsxs(Vr,{className:"flex items-center gap-2",children:[e.jsx($t,{className:"h-5 w-5"}),"Project Collaborators"]}),e.jsx(Gr,{children:"Manage who can view, edit, and approve this project"})]}),e.jsxs("div",{className:"mt-6 space-y-6",children:[P&&e.jsxs(z,{className:"w-full gap-2",onClick:()=>i(!0),"data-testid":"btn-invite-collaborator",children:[e.jsx(Al,{className:"h-4 w-4"}),"Invite Collaborator"]}),e.jsx(da,{className:"h-[calc(100vh-280px)]",children:e.jsx("div",{className:"space-y-4 pr-4",children:D?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ie,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[(k==null?void 0:k.owner)&&e.jsx(ge,{className:"border-amber-200 bg-amber-50/50 dark:border-amber-800 dark:bg-amber-950/20",children:e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Ma,{children:[e.jsx(La,{src:((n=k.owner.user)==null?void 0:n.profileImageUrl)||void 0}),e.jsx(Ua,{children:_r((S=k.owner.user)==null?void 0:S.firstName,(oe=k.owner.user)==null?void 0:oe.lastName,(J=k.owner.user)==null?void 0:J.email)})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[Da(k.owner.user),e.jsx(Xr,{className:"h-4 w-4 text-amber-500"})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:(xe=k.owner.user)==null?void 0:xe.email})]})]}),e.jsx(De,{className:"bg-amber-500 hover:bg-amber-600",children:"Owner"})]})})}),e.jsx(sr,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Team Members"}),k!=null&&k.collaborators&&k.collaborators.length>0?e.jsx("div",{className:"space-y-2",children:k.collaborators.map(Z=>{var Y,L,F,he,ie,te;return e.jsx(ge,{"data-testid":`collaborator-card-${Z.id}`,children:e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Ma,{children:[e.jsx(La,{src:((Y=Z.user)==null?void 0:Y.profileImageUrl)||void 0}),e.jsx(Ua,{children:_r((L=Z.user)==null?void 0:L.firstName,(F=Z.user)==null?void 0:F.lastName,(he=Z.user)==null?void 0:he.email)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Da(Z.user)}),e.jsx("div",{className:"text-sm text-muted-foreground",children:(ie=Z.user)==null?void 0:ie.email})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[P?e.jsxs(Oe,{value:Z.role,onValueChange:Fe=>{Q.mutate({collaboratorId:Z.id,role:Fe})},children:[e.jsx(Be,{className:"w-[110px]","data-testid":`select-role-${Z.id}`,children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"editor",children:"Editor"}),e.jsx(ae,{value:"reviewer",children:"Reviewer"}),e.jsx(ae,{value:"viewer",children:"Viewer"})]})]}):e.jsx(De,{variant:"secondary",children:((te=Sr[Z.role])==null?void 0:te.label)||Z.role}),P&&e.jsxs(Hr,{children:[e.jsx(Kr,{asChild:!0,children:e.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(Xl,{className:"h-4 w-4"})})}),e.jsx(Wr,{align:"end",children:e.jsxs(qa,{className:"text-destructive",onClick:()=>{g(Z),h(!0)},children:[e.jsx(xt,{className:"h-4 w-4 mr-2"}),"Remove"]})})]})]})]})})},Z.id)})}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx($t,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No collaborators yet"}),P&&e.jsx("p",{className:"text-sm",children:"Invite someone to work on this project together"})]})]}),P&&K&&K.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(sr,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h4",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(At,{className:"h-4 w-4"}),"Pending Invitations"]}),e.jsx("div",{className:"space-y-2",children:K.map(Z=>{var Y;return e.jsx(ge,{className:"border-dashed","data-testid":`invitation-card-${Z.id}`,children:e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Va,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Z.inviteeEmail}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Invited as ",(Y=Sr[Z.role])==null?void 0:Y.label]})]})]}),e.jsx(z,{variant:"ghost",size:"icon",onClick:()=>x(Z.id),children:e.jsx(rt,{className:"h-4 w-4"})})]})})},Z.id)})})]})]})]})})})]})]})]}),e.jsx(Me,{open:c,onOpenChange:i,children:e.jsxs(Le,{children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Invite Collaborator"}),e.jsx(Ke,{children:"Send an invitation to collaborate on this project"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{htmlFor:"email",children:"Email Address"}),e.jsx(le,{id:"email",type:"email",placeholder:"[email protected]",value:u,onChange:Z=>r(Z.target.value),"data-testid":"input-invite-email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{htmlFor:"role",children:"Role"}),e.jsxs(Oe,{value:d,onValueChange:j,children:[e.jsx(Be,{"data-testid":"select-invite-role",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"editor",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(en,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{children:"Editor"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Can edit and submit for review"})]})]})}),e.jsx(ae,{value:"reviewer",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{children:"Reviewer"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Can approve or request changes"})]})]})}),e.jsx(ae,{value:"viewer",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{children:"Viewer"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Read-only access"})]})]})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{htmlFor:"message",children:"Message (optional)"}),e.jsx(nt,{id:"message",placeholder:"Add a personal message to the invitation...",value:s,onChange:Z=>m(Z.target.value),rows:3,"data-testid":"textarea-invite-message"})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(z,{onClick:ne,disabled:U.isPending,"data-testid":"btn-send-invite",children:U.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Va,{className:"h-4 w-4 mr-2"}),"Send Invitation"]})})]})]})}),e.jsx(or,{open:y,onOpenChange:h,children:e.jsxs(cr,{children:[e.jsxs(dr,{children:[e.jsx(hr,{children:"Remove Collaborator"}),e.jsxs(mr,{children:["Are you sure you want to remove ",Da((f==null?void 0:f.user)||null)," from this project? They will no longer have access."]})]}),e.jsxs(ur,{children:[e.jsx(xr,{children:"Cancel"}),e.jsx(pr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{f&&R.mutate(f.id)},disabled:R.isPending,children:R.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):"Remove"})]})]})}),e.jsx(or,{open:!!v,onOpenChange:()=>x(null),children:e.jsxs(cr,{children:[e.jsxs(dr,{children:[e.jsx(hr,{children:"Cancel Invitation"}),e.jsx(mr,{children:"Are you sure you want to cancel this invitation? The invite link will no longer work."})]}),e.jsxs(ur,{children:[e.jsx(xr,{children:"Keep Invitation"}),e.jsx(pr,{onClick:()=>{v&&O.mutate(v)},disabled:O.isPending,children:O.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):"Cancel Invitation"})]})]})})]})}const Ds={draft:{label:"Draft",color:"bg-slate-500",icon:At},in_review:{label:"In Review",color:"bg-blue-500",icon:xn},changes_requested:{label:"Changes Requested",color:"bg-orange-500",icon:Zr},approved:{label:"Approved",color:"bg-green-500",icon:Bt},scheduled:{label:"Scheduled",color:"bg-purple-500",icon:At},published:{label:"Published",color:"bg-emerald-500",icon:io}};function Vo(p,P,l){return p&&P?`${p[0]}${P[0]}`.toUpperCase():p?p.slice(0,2).toUpperCase():l?l.slice(0,2).toUpperCase():"??"}function Tr(p){return p?p.firstName&&p.lastName?`${p.firstName} ${p.lastName}`:p.firstName?p.firstName:p.email||"Unknown User":"Unknown User"}function Go({projectId:p,workflowState:P,activeReviewId:l,userRole:_,approvalRequired:b=!1,onWorkflowStateChange:o}){var J,xe,Z,Y,L;const{toast:c}
93=ct(),[i,u]=$.useState(!1),[r,d]=$.useState(!1),[j,s]=$.useState(!1),[m,y]=$.useState(!1),[h,f]=$.useState(""),[g,v]=$.useState(""),[x,k]=$.useState(""),D=(_==="owner"||_==="editor")&&(P==="draft"||P==="changes_requested"),K=(_==="owner"||_==="reviewer")&&P==="in_review",{data:U,isLoading:Q}=We({queryKey:["/api/studio/projects",p,"reviews"],enabled:!!p&&i}),{data:R,isLoading:O}=We({queryKey:["/api/studio/reviews",l,"comments"],enabled:!!l&&i}),ne=je({mutationFn:async F=>fe("POST",`/api/studio/projects/${p}/submit-review`,{notes:F}),onSuccess:F=>{c({title:"Submitted for Review",description:"Your project has been submitted for review"}),d(!1),f(""),o==null||o("in_review"),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"reviews"]})},onError:F=>{c({title:"Submission Failed",description:F.message||"Could not submit for review",variant:"destructive"})}}),C=je({mutationFn:async F=>fe("POST",`/api/studio/reviews/${l}/approve`,{notes:F}),onSuccess:()=>{c({title:"Project Approved",description:"The project has been approved and is ready for publishing"}),s(!1),v(""),o==null||o("approved"),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"reviews"]})},onError:F=>
93{c({title:"Approval Failed",description:F.message||"Could not approve",variant:"destructive"})}}),W=je({mutationFn:async F=>fe("POST",`/api/studio/reviews/${l}/request-changes`,{notes:F}),onSuccess:()=>{c({title:"Changes Requested",description:"The author has been notified to make changes"}),y(!1),v(""),o==null||o("changes_requested"),ve.invalidateQueries({queryKey:["/api/studio/projects",p,"reviews"]})},onError:F=>{c({title:"Request Failed",description:F.message||"Could not request changes",variant:"destructive"})}}),n=je({mutationFn:async F=>fe("POST",`/api/studio/reviews/${l}/comments`,{body:F}),onSuccess:()=>{k(""),ve.invalidateQueries({queryKey:["/api/studio/reviews",l,"comments"]})},onError:F=>{c({title:"Comment Failed",description:F.message||"Could not add comment",variant:"destructive"})}}),S=je({mutationFn:async F=>fe("POST",`/api/studio/comments/${F}/resolve`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/studio/reviews",l,"comments"]})},onError:F=>{c({title:"Could Not Resolve",description:F.message||"Something went wrong",variant:"destructive"})}});U!=null&&U.find(F=>F.id===l)||(U==null||U[0]);const oe=((J=Ds[P])==null?void 0:J.icon)||At;return e.jsxs(e.Fragment,{children:[e.jsxs(Mr,{open:i,onOpenChange:u,children:[e.jsx(Lr,{asChild:!0,children:e.jsxs(z,{variant:"outline",size:"sm",className:"gap-2","data-testid":"btn-review-workflow",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:((xe=Ds[P])==null?void 0:xe.label)||"Draft"}),e.jsx(De,{className:`${((Z=Ds[P])==null?void 0:Z.color)||"bg-slate-500"} text-white ml-1`,children:b?"Approval Required":""})]})}),e.jsxs(Ur,{className:"w-full sm:max-w-lg",children:[e.jsxs(qr,{children:[e.jsxs(Vr,{className:"flex items-center gap-2",children:[e.jsx(xn,{className:"h-5 w-5"}),"Review Workflow"]}),e.jsx(Gr,{children:"Submit for review, track approval status, and manage feedback"})]}),e.jsxs("div",{className:"mt-6 space-y-6",children:[e.jsxs(ge,{children:[e.jsxs(st,{className:"pb-3",children:[e.jsxs(at,{className:"text-base flex items-center gap-2",children:["Current Status",e.jsx(De,{className:`${((Y=Ds[P])==null?void 0:Y.color)||"bg-slate-500"} text-white`,children:((L=Ds[P])==null?void 0:L.label)||"Draft"})]}),e.jsxs(bt,{children:[P==="draft"&&"Make changes and submit for review when ready",P==="in_review"&&"Waiting for reviewer approval",P==="changes_requested"&&"Please address the requested changes",P==="approved"&&"Ready to schedule or publish",P==="scheduled"&&"Scheduled for distribution",P==="published"&&"Successfully published"]})]}),e.jsxs(Te,{className:"space-y-3",children:[D&&e.jsxs(z,{className:"w-full gap-2",onClick:()=>d(!0),"data-testid":"btn-submit-review",children:[e.jsx(ha,{className:"h-4 w-4"}),P==="changes_requested"?"Resubmit for Review":"Submit for Review"]}),K&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{className:"flex-1 gap-2 bg-green-600 hover:bg-green-700",onClick:()=>s(!0),"data-testid":"btn-approve",children:[e.jsx(Bt,{className:"h-4 w-4"}),"Approve"]}),e.jsxs(z,{className:"flex-1 gap-2",variant:"outline",onClick:()=>y(!0),"data-testid":"btn-request-changes",children:[e.jsx(Ga,{className:"h-4 w-4"}),"Request Changes"]})]}),!D&&!K&&P==="in_review"&&e.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[e.jsx(At,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Waiting for reviewer"})]})]})]}),e.jsx(da,{className:"h-[calc(100vh-400px)]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[l&&e.jsxs(ge,{children:[e.jsx(st,{className:"pb-2",children:e.jsxs(at,{className:"text-base flex items-center gap-2",children:[e.jsx(gr,{className:"h-4 w-4"}),"Review Comments"]})}),e.jsxs(Te,{className:"space-y-3",children:[O?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Ie,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):R&&R.length>0?e.jsx("div",{className:"space-y-3",children:R.map(F=>{var he,ie,te,Fe;return e.jsxs("div",{className:`p-3 rounded-lg border ${F.resolved?"bg-muted/50 opacity-60":"bg-background"}`,"data-testid":`comment-${F.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ma,{className:"h-6 w-6",children:[e.jsx(La,{src:((he=F.author)==null?void 0:he.profileImageUrl)||void 0}),e.jsx(Ua,{className:"text-xs",children:Vo((ie=F.author)==null?void 0:ie.firstName,(te=F.author)==null?void 0:te.lastName,(Fe=F.author)==null?void 0:Fe.email)})]}),e.jsx("span",{className:"text-sm font-medium",children:Tr(F.author)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ar(new Date(F.createdAt),{addSuffix:!0})})]}),!F.resolved&&(_==="owner"||_==="editor")&&e.jsxs(z,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>S.mutate(F.id),disabled:S.isPending,children:[e.jsx(qs,{className:"h-3 w-3 mr-1"}),"Resolve"]}),F.resolved&&e.jsx(De,{variant:"secondary",className:"text-xs",children:"Resolved"})]}),e.jsx("p",{className:"mt-2 text-sm",children:F.body})]},F.id)})}):e.jsx("p",{className:"text-center text-sm text-muted-foreground py-4",children:"No comments yet"}),e.jsxs("div",{className:"pt-2 space-y-2",children:[e.jsx(nt,{placeholder:"Add a comment...",value:x,onChange:F=>k(F.target.value),rows:2,"data-testid":"input-new-comment"}),e.jsx(z,{size:"sm",disabled:!x.trim()||n.isPending,onClick:()=>n.mutate(x),"data-testid":"btn-add-comment",children:n.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(gr,{className:"h-4 w-4 mr-1"}),"Comment"]})})]})]})]}),e.jsx(eo,{type:"single",collapsible:!0,className:"w-full",children:e.jsxs(to,{value:"history",children:[e.jsxs(so,{className:"text-sm",children:["Review History (",(U==null?void 0:U.length)||0,")"]}),e.jsx(ao,{children:Q?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Ie,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):U&&U.length>0?e.jsx("div",{className:"space-y-3",children:U.map(F=>e.jsxs("div",{className:`p-3 rounded-lg border ${F.id===l?"border-primary":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:["v",F.versionSnapshot||"?"]}),e.jsx(De,{variant:F.status==="approved"?"default":F.status==="changes_requested"?"destructive":"secondary",children:F.status})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ar(new Date(F.submittedAt),{addSuffix:!0})})]}),F.submissionNotes&&e.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:['"',F.submissionNotes,'"']}),F.decisionNotes&&e.jsxs("p",{className:"text-sm mt-2 p-2 bg-muted rounded",children:[e.jsx("strong",{children:"Feedback:"})," ",F.decisionNotes]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Submitted by ",Tr(F.submittedBy)]})]},F.id))}):e.jsx("p",{className:"text-center text-sm text-muted-foreground py-4",children:"No review history yet"})})]})})]})})]})]})]}),e.jsx(Me,{open:r,onOpenChange:d,children:e.jsxs(Le,{children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Submit for Review"}),e.jsx(Ke,{children:"Your project will be reviewed by a team member before publishing"})]}),e.jsxs("div",{className:"py-4",children:[e.jsx(q,{htmlFor:"submission-notes",children:"Notes for Reviewer (optional)"}),e.jsx(nt,{id:"submission-notes",placeholder:"Describe what you'd like reviewed, any concerns, or specific feedback needed...",value:h,onChange:F=>f(F.target.value),rows:4,className:"mt-2","data-testid":"textarea-submission-notes"})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(z,{onClick:()=>ne.mutate(h),disabled:ne.isPending,"data-testid":"btn-confirm-submit",children:ne.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(ha,{className:"h-4 w-4 mr-2"}),"Submit"]})})]})]})}),e.jsx(Me,{open:j,onOpenChange:s,children:e.jsxs(Le,{children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-green-600",children:[e.jsx(Bt,{className:"h-5 w-5"}),"Approve Project"]}),e.jsx(Ke,{children:"Approving will allow the project to be scheduled for distribution"})]}),e.jsxs("div",{className:"py-4",children:[e.jsx(q,{htmlFor:"approval-notes",children:"Approval Notes (optional)"}),e.jsx(nt,{id:"approval-notes",placeholder:"Any final comments or notes...",value:g,onChange:F=>v(F.target.value),rows:3,className:"mt-2","data-testid":"textarea-approval-notes"})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(z,{className:"bg-green-600 hover:bg-green-700",onClick:()=>C.mutate(g),disabled:C.isPending,"data-testid":"btn-confirm-approve",children:C.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(Bt,{className:"h-4 w-4 mr-2"}),"Approve"]})})]})]})}),e.jsx(Me,{open:m,onOpenChange:y,children:e.jsxs(Le,{children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-orange-600",children:[e.jsx(Zr,{className:"h-5 w-5"}),"Request Changes"]}),e.jsx(Ke,{children:"Explain what changes are needed before approval"})]}),e.jsxs("div",{className:"py-4",children:[e.jsx(q,{htmlFor:"change-notes",children:"Required Changes"}),e.jsx(nt,{id:"change-notes",placeholder:"Describe the changes needed...",value:g,onChange:F=>v(F.target.value),rows:4,className:"mt-2","data-testid":"textarea-change-notes"})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(z,{variant:"outline",className:"border-orange-500 text-orange-600 hover:bg-orange-50",onClick:()=>
93W.mutate(g),disabled:W.isPending||!g.trim(),"data-testid":"btn-confirm-request-changes",children:W.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Request Changes"]})})]})]})})]})}function Ho({slide:p,isActive:P,onClick:l,onDelete:_}){const{attributes:b,listeners:o,setNodeRef:c,transform:i,transition:u,isDragging:r}=hn({id:p.id}),d={transform:mn.Transform.toString(i),transition:u,opacity:r?.5:1};return e.jsxs("div",{ref:c,style:d,className:`relative group flex-shrink-0 w-24 h-24 rounded-lg overflow-hidden border-2 cursor-pointer transition-all ${P?"border-accent ring-2 ring-accent/50":"border-white/20 hover:border-white/40"}`,onClick:l,"data-testid":`slide-thumb-${p.id}`,children:[p.media?e.jsx("img",{src:p.media.url,alt:p.caption||"Slide",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-gray-700 flex items-center justify-center",children:e.jsx(ut,{className:"h-8 w-8 text-gray-500"})}),e.jsx("div",{...b,...o,className:"absolute top-1 left-1 p-1 bg-black/50 rounded opacity-0 group-hover:opacity-100 cursor-grab",children:e.jsx(ba,{className:"h-3 w-3 text-white"})}),e.jsx("button",{onClick:j=>{j.stopPropagation(),_()},className:"absolute top-1 right-1 p-1 bg-red-500/80 rounded opacity-0 group-hover:opacity-100 hover:bg-red-600","data-testid":`delete-slide-${p.id}`,children:e.jsx(rt,{className:"h-3 w-3 text-white"})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-white text-xs px-1 py-0.5 text-center",children:p.order})]})}function Ko(){const{toast:p}=ct(),P=$.useRef(null),[l,_]=$.useState(null),[b,o]=$.useState([]),[c,i]=$.useState(0),[u,r]=$.useState(!1),[d,j]=$.useState(!1),[s,m]=$.useState(!1),[y,h]=$.useState(!1),[f,g]=$.useState(""),[v,x]=$.useState(""),[k,D]=$.useState(!1),K=tn(ga(rn),ga(an,{coordinateGetter:sn})),{data:U,isLoading:Q}=We({queryKey:["/api/media/decks"],enabled:!0}),{data:R}=We({queryKey:["/api/media/assets"],enabled:!0}),{data:O}=We({queryKey:["/api/social-auth/connections"],enabled:s}),ne=(U==null?void 0:U.decks)||[],C=(R==null?void 0:R.assets)||[],W=(O==null?void 0:O.connections)||[],n=je({mutationFn:async I=>fe("POST","/api/media/decks",I),onSuccess:I=>{ve.invalidateQueries({queryKey:["/api/media/decks"]}),_(I.deck),o([]),j(!1),g(""),x(""),p({title:"Deck created",description:"Your new slide deck is ready"})},onError:()=>{p({title:"Error",description:"Failed to create deck",variant:"destructive"})}}),S=je({mutationFn:async I=>{const me=new FormData;Array.from(I).forEach(A=>{me.append("files",A)}),me.append("isPublic","true");const ke=await fetch("/api/media/upload",{method:"POST",body:me,credentials:"include"});if(!ke.ok)throw new Error("Upload failed");return ke.json()},onSuccess:I=>{var me,ke;ve.invalidateQueries({queryKey:["/api/media/assets"]}),l&&((me=I.assets)==null?void 0:me.length)>0&&Y(I.assets),p({title:"Upload complete",description:`Uploaded ${((ke=I.assets)==null?void 0:ke.length)||0} file(s)`})},onError:()=>{p({title:"Upload failed",description:"Could not upload files",variant:"destructive"})}}),oe=je({mutationFn:async({deckId:I,slides:me})=>fe("POST",`/api/media/decks/${I}/slides`,{slides:me}),onSuccess:I=>{if(I.slides){const me=I.slides.map(ke=>({...ke,media:C.find(A=>A.id===ke.mediaAssetId)}));o(ke=>[...ke,...me])}},onError:()=>{p({title:"Error",description:"Failed to add slides",variant:"destructive"})}}),J=je({mutationFn:async({deckId:I,platform:me})=>fe("POST",`/api/media/decks/${I}/share`,{platform:me}),onSuccess:I=>{p({title:"Shared!",description:I.message||"Deck shared successfully"}),ve.invalidateQueries({queryKey:["/api/media/decks"]})},onError:()=>{p({title:"Error",description:"Failed to share deck",variant:"destructive"})}}),xe=je({mutationFn:async I=>fe("DELETE",`/api/media/decks/${I}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/media/decks"]}),_(null),o([]),p({title:"Deleted",description:"Deck has been removed"})},onError:()=>{p({title:"Error",description:"Failed to delete deck",variant:"destructive"})}}),Z=$.useCallback(async I=>{_(I);try{const me=await fetch(`/api/media/decks/${I.id}`,{credentials:"include"});if(me.ok){const ke=await me.json();o(ke.slides||[]),i(0)}}catch(me){console.error("Failed to load deck:",me)}},[]),Y=I=>{if(!l)return;const me=I.map((ke,A)=>({mediaAssetId:ke.id,caption:ke.caption||"",duration:5}));oe.mutate({deckId:l.id,slides:me})},L=async I=>{const me=I.target.files;!me||me.length===0||(h(!0),await S.mutateAsync(me),h(!1),P.current&&(P.current.value=""))},F=I=>{const{active:me,over:ke}=I;ke&&me.id!==ke.id&&o(A=>{const a=A.findIndex(N=>N.id===me.id),V=A.findIndex(N=>N.id===ke.id),M=dn(A,a,V).map((N,w)=>({...N,order:w+1}));return l&&fe("PATCH",`/api/media/decks/${l.id}/reorder`,{slideIds:M.map(N=>N.id)}).catch(console.error),M})},he=async I=>{try{await fe("DELETE",`/api/media/slides/${I}`),o(me=>me.filter(ke=>ke.id!==I)),c>=b.length-1&&i(Math.max(0,b.length-2))}catch{p({title:"Error",description:"Failed to delete slide",variant:"destructive"})}},ie=()=>{i(I=>(I+1)%b.length)},te=()=>{i(I=>(I-1+b.length)%b.length)},Fe=()=>{r(!u)},He=()=>{if(l!=null&&l.shareToken){const I=`${window.location.origin}/slides/${l.shareToken}`;navigator.clipboard.writeText(I),D(!0),setTimeout(()=>D(!1),2e3)}},we=I=>{switch(I){case"instagram":return e.jsx(fs,{className:"h-4 w-4"});case"facebook":return e.jsx(ua,{className:"h-4 w-4"});case"twitter":return e.jsx(ma,{className:"h-4 w-4"});case"tiktok":return e.jsx(ss,{className:"h-4 w-4"});case"youtube":return e.jsx(Ms,{className:"h-4 w-4"});case"linkedin":return e.jsx(Jr,{className:"h-4 w-4"});default:return e.jsx(ys,{className:"h-4 w-4"})}},be=b[c];return e.jsxs("div",{className:"space-y-6","data-testid":"slide-deck-builder",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Dt,{className:"h-6 w-6 text-accent"}),"Slide Decks"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"Create and share image slideshows"})]}),e.jsxs(z,{onClick:()=>j(!0),className:"bg-accent hover:bg-accent/90","data-testid":"create-deck-btn",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),"New Deck"]})]}),l?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{_(null),o([])},className:"text-gray-400 hover:text-white","data-testid":"back-to-decks-btn",children:[e.jsx(Ha,{className:"h-4 w-4 mr-1"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:l.title}),e.jsxs("p",{className:"text-sm text-gray-400",children:[b.length," slides"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:b.length===0,className:"border-accent text-accent hover:bg-accent/10","data-testid":"share-deck-btn",children:[e.jsx(ps,{className:"h-4 w-4 mr-2"}),"Share"]}),e.jsx(z,{variant:"destructive",size:"sm",onClick:()=>xe.mutate(l.id),"data-testid":"delete-deck-btn",children:e.jsx(xt,{className:"h-4 w-4"})})]})]}),e.jsx(ge,{className:"glass-card border-white/20 overflow-hidden",children:e.jsxs("div",{className:"aspect-video relative bg-black flex items-center justify-center",children:[be!=null&&be.media?e.jsx("img",{src:be.media.url,alt:be.caption||"Slide",className:"max-w-full max-h-full object-contain"}):b.length===0?e.jsxs("div",{className:"text-center text-gray-500",children:[e.jsx(ut,{className:"h-16 w-16 mx-auto mb-4"}),e.jsx("p",{children:"Upload images to get started"})]}):e.jsxs("div",{className:"text-center text-gray-500",children:[e.jsx(ut,{className:"h-16 w-16 mx-auto mb-4"}),e.jsx("p",{children:"No image for this slide"})]}),(be==null?void 0:be.caption)&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-4",children:e.jsx("p",{className:"text-white text-center",children:be.caption})}),b.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:te,className:"absolute left-2 top-1/2 -translate-y-1/2 p-2 bg-black/50 rounded-full hover:bg-black/70 transition-colors","data-testid":"prev-slide-btn",children:e.jsx(Ha,{className:"h-6 w-6 text-white"})}),e.jsx("button",{onClick:ie,className:"absolute right-2 top-1/2 -translate-y-1/2 p-2 bg-black/50 rounded-full hover:bg-black/70 transition-colors","data-testid":"next-sl
93ide-btn",children:e.jsx(Qr,{className:"h-6 w-6 text-white"})})]}),b.length>0&&e.jsxs("div",{className:"absolute top-4 right-4 bg-black/50 px-3 py-1 rounded-full text-white text-sm",children:[c+1," / ",b.length]})]})}),e.jsx(ge,{className:"glass-card border-white/20 p-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("input",{ref:P,type:"file",multiple:!0,accept:"image/*",onChange:L,className:"hidden","data-testid":"file-upload-input"}),e.jsx(z,{onClick:()=>{var I;return(I=P.current)==null?void 0:I.click()},disabled:y,className:"h-24 w-24 flex flex-col items-center justify-center bg-accent/20 hover:bg-accent/30 border-2 border-dashed border-accent/50","data-testid":"upload-images-btn",children:y?e.jsx(Ie,{className:"h-6 w-6 animate-spin text-accent"}):e.jsxs(e.Fragment,{children:[e.jsx(Ft,{className:"h-6 w-6 text-accent mb-1"}),e.jsx("span",{className:"text-xs text-accent",children:"Upload"})]})})]}),e.jsx("div",{className:"flex-1 overflow-x-auto",children:e.jsx(nn,{sensors:K,collisionDetection:ln,onDragEnd:F,children:e.jsx(on,{items:b.map(I=>I.id),strategy:cn,children:e.jsx("div",{className:"flex gap-2 py-2",children:b.map((I,me)=>e.jsx(Ho,{slide:I,isActive:me===c,onClick:()=>i(me),onDelete:()=>he(I.id)},I.id))})})})}),b.length>1&&e.jsx("div",{className:"flex-shrink-0 flex items-center gap-2",children:e.jsx(z,{variant:"outline",size:"icon",onClick:Fe,className:"border-white/20","data-testid":"play-slideshow-btn",children:u?e.jsx(Ka,{className:"h-4 w-4"}):e.jsx(ca,{className:"h-4 w-4"})})})]})}),C.length>0&&e.jsxs(ge,{className:"glass-card border-white/20",children:[e.jsx(st,{className:"pb-2",children:e.jsx(at,{className:"text-lg text-white",children:"Media Library"})}),e.jsx(Te,{children:e.jsx("div",{className:"grid grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2",children:C.filter(I=>I.type==="image").slice(0,16).map(I=>e.jsx("button",{onClick:()=>Y([I]),className:"aspect-square rounded-lg overflow-hidden border border-white/20 hover:border-accent transition-colors","data-testid":`add-asset-${I.id}`,children:e.jsx("img",{src:I.url,alt:I.originalFilename,className:"w-full h-full object-cover"})},I.id))})})]})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Q?e.jsx("div",{className:"col-span-full flex items-center justify-center py-12",children:e.jsx(Ie,{className:"h-8 w-8 animate-spin text-accent"})}):ne.length===0?e.jsxs(ge,{className:"col-span-full glass-card border-white/20 p-12 text-center",children:[e.jsx(Dt,{className:"h-12 w-12 mx-auto mb-4 text-gray-500"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No slide decks yet"}),e.jsx("p",{className:"text-gray-400 mb-4",children:"Create your first deck to start sharing images"}),e.jsxs(z,{onClick:()=>j(!0),className:"bg-accent hover:bg-accent/90","data-testid":"create-first-deck-btn",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),"Create Deck"]})]}):ne.map(I=>e.jsxs(ge,{className:"glass-card border-white/20 overflow-hidden cursor-pointer hover:border-accent/50 transition-colors",onClick:()=>Z(I),"data-testid":`deck-card-${I.id}`,children:[e.jsxs("div",{className:"aspect-video relative bg-gray-800",children:[I.coverImageUrl?e.jsx("img",{src:I.coverImageUrl,alt:I.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Dt,{className:"h-12 w-12 text-gray-600"})}),e.jsx("div",{className:"absolute top-2 right-2",children:I.isPublic?e.jsxs(De,{className:"bg-green-500/20 text-green-400 border-green-500/30",children:[e.jsx(ys,{className:"h-3 w-3 mr-1"}),"Public"]}):e.jsxs(De,{className:"bg-gray-500/20 text-gray-400 border-gray-500/30",children:[e.jsx(un,{className:"h-3 w-3 mr-1"}),"Private"]})})]}),e.jsxs(Te,{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-white truncate",children:I.title}),e.jsx("p",{className:"text-sm text-gray-400 truncate",children:I.description||"No description"}),e.jsx("div",{className:"flex items-center gap-4 mt-2 text-xs text-gray-500",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Lt,{className:"h-3 w-3"}),I.viewCount," views"]})})]})]},I.id))}),e.jsx(Me,{open:d,onOpenChange:j,children:e.jsxs(Le,{className:"bg-gray-900 border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Create New Slide Deck"}),e.jsx(Ke,{className:"text-gray-400",children:"Start a new collection of images to share"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{children:"Title"}),e.jsx(le,{value:f,onChange:I=>g(I.target.value),placeholder:"My Travel Photos",className:"bg-gray-800 border-white/20","data-testid":"deck-title-input"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{children:"Description (optional)"}
93),e.jsx(nt,{value:v,onChange:I=>x(I.target.value),placeholder:"A collection of photos from my trip...",className:"bg-gray-800 border-white/20","data-testid":"deck-description-input"})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"ghost",onClick:()=>j(!1),children:"Cancel"}),e.jsxs(z,{onClick:()=>n.mutate({title:f,description:v}),disabled:!f.trim()||n.isPending,className:"bg-accent hover:bg-accent/90","data-testid":"confirm-create-deck-btn",children:[n.isPending?e.jsx(Ie,{className:"h-4 w-4 animate-spin mr-2"}):null,"Create Deck"]})]})]})}),e.jsx(Me,{open:s,onOpenChange:m,children:e.jsxs(Le,{className:"bg-gray-900 border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Share Slide Deck"}),e.jsxs(Ke,{className:"text-gray-400",children:['Share "',l==null?void 0:l.title,'" with your audience']})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{children:"Share Link"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{readOnly:!0,value:l!=null&&l.shareToken?`${window.location.origin}/slides/${l.shareToken}`:"Publishing will generate a link",className:"bg-gray-800 border-white/20","data-testid":"share-link-input"}),e.jsx(z,{onClick:He,variant:"outline",disabled:!(l!=null&&l.shareToken),className:"border-white/20","data-testid":"copy-link-btn",children:k?e.jsx(ht,{className:"h-4 w-4 text-green-500"}):e.jsx(Kt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{children:"Share to Social Media"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:["instagram","facebook","twitter","tiktok","youtube","linkedin"].map(I=>{const me=W.find(A=>A.platform===I),ke=(me==null?void 0:me.status)==="connected";return e.jsxs(z,{variant:"outline",onClick:()=>{l&&J.mutate({deckId:l.id,platform:I})},disabled:!ke||J.isPending,className:`flex items-center justify-start gap-2 ${ke?"border-accent/50 hover:bg-accent/10":"border-white/20 opacity-50"}`,"data-testid":`share-${I}-btn`,children:[we(I),e.jsx("span",{className:"capitalize",children:I}),!ke&&e.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Not connected"})]},I)})}),W.length===0&&e.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Connect social accounts in Settings to enable direct sharing"})]})]}),e.jsx(Ze,{children:e.jsx(z,{variant:"ghost",onClick:()=>m(!1),children:"Close"})})]})})]})}const Oa=[{id:"instories",name:"Instories",icon:e.jsx(tt,{className:"w-5 h-5"}),color:"bg-gradient-to-r from-purple-500 to-pink-500"},{id:"canva",name:"Canva",icon:e.jsx(Ml,{className:"w-5 h-5"}),color:"bg-[#00C4CC]"},{id:"capcut",name:"CapCut",icon:e.jsx(ro,{className:"w-5 h-5"}),color:"bg-black"},{id:"inshot",name:"InShot",icon:e.jsx(Ct,{className:"w-5 h-5"}),color:"bg-gradient-to-r from-pink-400 to-red-500"},{id:"adobe_express",name:"Adobe Express",icon:e.jsx(tt,{className:"w-5 h-5"}),color:"bg-[#FF0000]"},{id:"camera_roll",name:"Camera Roll",icon:e.jsx(El,{className:"w-5 h-5"}),color:"bg-gray-600"},{id:"other",name:"Other App",icon:e.jsx(Qa,{className:"w-5 h-5"}),color:"bg-slate-500"}];function Wo({open:p,onOpenChange:P,onImport:l,campaignId:_,campaignName:b}){const[o,c]=$.useState("instories"),[i,u]=$.useState([]),[r,d]=$.useState(!1),[j,s]=$.useState(""),m=$.useRef(null),{toast:y}=ct(),h=async k=>{var U;const D=k.target.files;if(!(D!=null&&D.length))return;d(!0);const K=[];for(const Q of Array.from(D)){const R=Q.type.startsWith("video/"),O=Q.type.startsWith("image/");if(!R&&!O){y({title:"Unsupported file type",description:`${Q.name} is not a supported image or video format.`,variant:"destructive"});continue}const ne=URL.createObjectURL(Q);let C;R&&(C=await f(Q));const W=o==="other"?j||"Unknown App":((U=Oa.find(n=>n.id===o))==null?void 0:U.name)||"Unknown";K.push({id:`import-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:Q,preview:ne,type:R?"video":"image",source:o,sourceName:W,originalFilename:Q.name,duration:C})}u(Q=>[...Q,...K]),d(!1),m.current&&(m.current.value="")},f=k=>new Promise(D=>{const K=document.createElement("video");K.preload="metadata",K.onloadedmetadata=()=>{URL.revokeObjectURL(K.src),D(K.duration)},K.onerror=()=>D(0),K.src=URL.createObjectURL(k)}),g=k=>{u(D=>{const K=D.find(U=>U.id===k);return K&&URL.revokeObjectURL(K.preview),D.filter(U=>U.id!==k)})},v=()=>{var k;if(i.length===0){y({title:"No files selected",description:"Please upload at least one image or video to import.",variant:"destructive"});return}l(i),y({title:"Content imported!",description:`${i.length} file(s) imported from ${((k=Oa.find(D=>D.id===o))==null?void 0:k.name)||"external app"}.`}),u([]),P(!1)},x=()=>
93{i.forEach(k=>URL.revokeObjectURL(k.preview)),u([]),P(!1)};return e.jsx(Me,{open:p,onOpenChange:x,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Ft,{className:"w-6 h-6 text-purple-400"}),"Import Content from External Apps"]}),e.jsxs(Ke,{className:"text-gray-400",children:["Upload content you created in other apps like Instories, Canva, or CapCut.",b&&e.jsxs("span",{className:"block mt-1 text-purple-300",children:["For campaign: ",e.jsx("strong",{children:b})]})]})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-3 block",children:"Where did you create this content?"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:Oa.map(k=>e.jsxs("button",{onClick:()=>c(k.id),className:`p-3 rounded-lg border-2 transition-all flex flex-col items-center gap-2 ${o===k.id?"border-purple-500 bg-purple-500/20":"border-white/20 bg-white/5 hover:bg-white/10"}`,"data-testid":`source-${k.id}`,children:[e.jsx("div",{className:`p-2 rounded-full ${k.color} text-white`,children:k.icon}),e.jsx("span",{className:"text-sm font-medium",children:k.name})]},k.id))})]}),o==="other"&&e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"App Name"}),e.jsx(le,{value:j,onChange:k=>s(k.target.value),placeholder:"e.g., Splice, VSCO, Unfold...",className:"bg-white/10 border-white/20 text-white placeholder:text-gray-500","data-testid":"custom-source-name"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Upload Your Content"}),e.jsxs("div",{onClick:()=>{var k;return(k=m.current)==null?void 0:k.click()},className:"border-2 border-dashed border-white/30 rounded-lg p-8 text-center cursor-pointer hover:bg-white/5 transition-colors",children:[e.jsx("input",{ref:m,type:"file",accept:"image/*,video/*",multiple:!0,onChange:h,className:"hidden","data-testid":"file-input"}),e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"p-4 bg-purple-500/20 rounded-full",children:e.jsx(Ft,{className:"w-8 h-8 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Click to upload files"}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"Supports images and videos (MP4, MOV, JPG, PNG, WEBP)"})]})]})]})]}),i.length>0&&e.jsxs("div",{children:[e.jsxs(q,{className:"text-white mb-3 block",children:["Imported Files (",i.length,")"]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 max-h-64 overflow-y-auto",children:i.map(k=>e.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black/40 border border-white/10",children:[k.type==="video"?e.jsx("video",{src:k.preview,className:"w-full h-32 object-cover",muted:!0}):e.jsx("img",{src:k.preview,alt:k.originalFilename,className:"w-full h-32 object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-2",children:[e.jsx("p",{className:"text-xs text-white truncate",children:k.originalFilename}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[k.type==="video"?e.jsx(Ct,{className:"w-3 h-3 text-purple-400"}):e.jsx(ut,{className:"w-3 h-3 text-blue-400"}),e.jsx("span",{className:"text-xs text-gray-400",children:k.type==="video"&&k.duration?`${Math.floor(k.duration)}s`:k.type})]})]}),e.jsx("button",{onClick:()=>g(k.id),className:"absolute top-2 right-2 p-1 bg-red-500/80 rounded-full hover:bg-red-600 transition-colors","data-testid":`remove-file-${k.id}`,children:e.jsx(rt,{className:"w-3 h-3 text-white"})}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("span",{className:"text-xs bg-black/60 px-2 py-0.5 rounded-full text-gray-300",children:k.sourceName})})]},k.id))})]}),r&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-4",children:[e.jsx(Ie,{className:"w-5 h-5 animate-spin text-purple-400"}),e.jsx("span",{className:"text-gray-400",children:"Processing files..."})]}),e.jsx("div",{className:"p-4 bg-gradient-to-r from-purple-500/10 to-pink-500/10 rounded-lg border border-purple-500/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{className:"w-5 h-5 text-purple-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white font-medium",children:"Content Attribution"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"We track where your content comes from for analytics. This helps you understand which creation tools work best for your campaigns."})]})]})})]}),e.jsxs(Ze,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(z,{variant:"outline",onClick:x,className:"bg-white/10 border-white/20 text-white hover:bg-white/20","data-testid":"cancel-import",children:"Cancel"}),e.jsx(z,{onClick:v,disabled:i.length===0||r,className:"bg-purple-600 hover:bg-purple-700 text-white","data-testid":"confirm-import",children:r?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ht,{className:"w-4 h-4 mr-2"}),"Import ",i.length," File",i.length!==1?"s":""]})})]})]})})}const Fr=[{id:"destination-reveal",name:"Destination Reveal",description:"Perfect for DMO campaigns - reveal a travel destination with animated text",category:"travel",preview:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",colors:{primary:"#667eea",secondary:"#764ba2",accent:"#fff",text:"#ffffff"},font:"Montserrat",animation:"zoom",elements:["location","cta","social"],tags:["DMO","travel","destination"]}
93,{id:"offer-countdown",name:"Offer Countdown",description:"Urgency-driven template with countdown timer for limited offers",category:"promo",preview:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",colors:{primary:"#f5576c",secondary:"#f093fb",accent:"#ffeb3b",text:"#ffffff"},font:"Poppins",animation:"pulse",elements:["timer","discount","cta"],tags:["sale","discount","urgency"]},{id:"creator-spotlight",name:"Creator Spotlight",description:"Highlight a creator or influencer with their content",category:"campaign",preview:"linear-gradient(135deg, #11998e 0%, #38ef7d 100%)",colors:{primary:"#11998e",secondary:"#38ef7d",accent:"#fff",text:"#ffffff"},font:"Inter",animation:"slide",elements:["social","logo"],tags:["influencer","creator","UGC"]},{id:"game-day",name:"Game Day Hype",description:"Sports event template with team colors and excitement",category:"sports",preview:"linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #e94560 100%)",colors:{primary:"#e94560",secondary:"#1a1a2e",accent:"#ffd700",text:"#ffffff"},font:"Bebas Neue",animation:"bounce",elements:["timer","cta","social"],tags:["sports","game","team"]},{id:"foodie-feature",name:"Foodie Feature",description:"Mouth-watering template for restaurant and food promotions",category:"food",preview:"linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%)",colors:{primary:"#ff6b6b",secondary:"#ff9a56",accent:"#fff5e6",text:"#ffffff"},font:"Playfair Display",animation:"fade",elements:["location","cta","discount"],tags:["restaurant","food","dining"]},{id:"event-invite",name:"Event Invite",description:"Elegant invitation template for events and gatherings",category:"event",preview:"linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%)",colors:{primary:"#4ca1af",secondary:"#2c3e50",accent:"#f39c12",text:"#ffffff"},font:"Lora",animation:"fade",elements:["timer","location","cta"],tags:["event","invitation","RSVP"]},{id:"flash-sale",name:"Flash Sale",description:"High-energy template for time-limited sales",category:"promo",preview:"linear-gradient(135deg, #f12711 0%, #f5af19 100%)",colors:{primary:"#f12711",secondary:"#f5af19",accent:"#fff",text:"#ffffff"},font:"Oswald",animation:"bounce",elements:["timer","discount","cta"],tags:["sale","flash","discount"]},{id:"adventure-call",name:"Adventure Call",description:"Outdoor adventure and activity promotion",category:"travel",preview:"linear-gradient(135deg, #134e5e 0%, #71b280 100%)",colors:{primary:"#134e5e",secondary:"#71b280",accent:"#fff",text:"#ffffff"},font:"Montserrat",animation:"slide",elements:["location","cta"],tags:["adventure","outdoor","activity"]},{id:"vip-exclusive",name:"VIP Exclusive",description:"Premium template for exclusive offers and VIP content",category:"promo",preview:"linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%)",colors:{primary:"#302b63",secondary:"#24243e",accent:"#d4af37",text:"#ffffff"},font:"Playfair Display",animation:"fade",elements:["logo","cta"],tags:["VIP","exclusive","premium"]},{id:"march-madness",name:"March Madness",description:"Basketball tournament hype template",category:"sports",preview:"linear-gradient(135deg, #ff4e50 0%, #f9d423 100%)",colors:{primary:"#ff4e50",secondary:"#f9d423",accent:"#fff",text:"#ffffff"},font:"Bebas Neue",animation:"bounce",elements:["timer","cta","social"],tags:["basketball","tournament","NCAA"]},{id:"local-gem",name:"Local Gem",description:"Discover hidden local spots and businesses",category:"travel",preview:"linear-gradient(135deg, #8e44ad 0%, #3498db 100%)",colors:{primary:"#8e44ad",secondary:"#3498db",accent:"#fff",text:"#ffffff"},font:"Poppins",animation:"zoom",elements:["location","cta","discount"],tags:["local","hidden gem","discover"]},{id:"reward-unlock",name:"Reward Unlock",description:"Gamified reward template for loyalty programs",category:"campaign",preview:"linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%)",colors:{primary:"#56ab2f",secondary:"#a8e6cf",accent:"#ffd700",text:"#ffffff"},font:"Inter",animation:"pulse",elements:["cta","discount"],tags:["reward","loyalty","gamification"]}],Ar={campaign:e.jsx(Yr,{className:"w-4 h-4"}),travel:e.jsx(bs,{className:"w-4 h-4"}),food:e.jsx(no,{className:"w-4 h-4"}),sports:e.jsx(Or,{className:"w-4 h-4"}),event:e.jsx(Us,{className:"w-4 h-4"}),promo:e.jsx(Il,{className:"w-4 h-4"})},Er={campaign:"Campaigns",travel:"Travel & DMO",food:"Food & Dining",sports:"Sports",event:"Events",promo:"Promotions"};function Zo({open:p,onOpenChange:P,onSelect:l,campaignType:_}){const[b,o]=$.useState("all"),[c,i]=$.useState(null),u=b==="all"?Fr:Fr.filter(d=>d.category===b),r=()=>{c&&(l(c),P(!1),i(null))};return e.jsx(Me,{open:p,onOpenChange:P,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Qa,{className:"w-6 h-6 text-pink-400"}),"Story Templates",e.jsx(De,{className:"bg-gradient-to-r from-pink-500 to-purple-500 text-white border-0 ml-2",children:"9:16 Vertical"})]}
93),e.jsx(Ke,{className:"text-gray-400",children:"Quick-start templates optimized for Instagram Stories, TikTok, and Reels"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 pb-4 border-b border-white/10",children:[e.jsxs(z,{variant:b==="all"?"default":"outline",size:"sm",onClick:()=>o("all"),className:b==="all"?"bg-purple-600 hover:bg-purple-700":"bg-white/10 border-white/20 text-white hover:bg-white/20","data-testid":"filter-all",children:[e.jsx(tt,{className:"w-4 h-4 mr-1"}),"All"]}),Object.keys(Er).map(d=>e.jsxs(z,{variant:b===d?"default":"outline",size:"sm",onClick:()=>o(d),className:b===d?"bg-purple-600 hover:bg-purple-700":"bg-white/10 border-white/20 text-white hover:bg-white/20","data-testid":`filter-${d}`,children:[Ar[d],e.jsx("span",{className:"ml-1",children:Er[d]})]},d))]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-4",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:u.map(d=>e.jsx("button",{onClick:()=>i(d),className:`relative rounded-xl overflow-hidden transition-all border-2 ${(c==null?void 0:c.id)===d.id?"border-pink-500 ring-2 ring-pink-500/50 scale-[1.02]":"border-transparent hover:border-white/30"}`,"data-testid":`template-${d.id}`,children:e.jsxs("div",{className:"aspect-[9/16] w-full flex flex-col items-center justify-center p-4 relative",style:{background:d.preview},children:[e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"text-lg font-bold mb-1 drop-shadow-lg",style:{fontFamily:d.font,color:d.colors.text},children:d.name}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1 mt-2",children:d.elements.slice(0,3).map(j=>e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-black/30 text-white/90",children:j.toUpperCase()},j))})]}),(c==null?void 0:c.id)===d.id&&e.jsx("div",{className:"absolute top-2 right-2 p-1 bg-pink-500 rounded-full",children:e.jsx(ht,{className:"w-4 h-4 text-white"})}),e.jsx("div",{className:"absolute bottom-2 left-2",children:e.jsx("span",{className:"text-xs bg-black/50 px-2 py-1 rounded-full flex items-center gap-1",children:Ar[d.category]})})]})},d.id))})}),c&&e.jsx("div",{className:"pt-4 border-t border-white/10",children:e.jsxs("div",{className:"flex items-start gap-4 bg-white/5 rounded-lg p-4",children:[e.jsx("div",{className:"w-16 h-28 rounded-lg flex-shrink-0",style:{background:c.preview}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:c.name}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:c.description}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:c.tags.map(d=>e.jsx(De,{variant:"outline",className:"text-xs bg-white/10 border-white/20 text-gray-300",children:d},d))}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Bs,{className:"w-3 h-3 text-yellow-400"}),c.animation," animation"]}),e.jsxs("span",{children:["Font: ",c.font]})]})]})]})})]}),e.jsxs(Ze,{className:"flex-col sm:flex-row gap-2 pt-4 border-t border-white/10",children:[e.jsx(z,{variant:"outline",onClick:()=>P(!1),className:"bg-white/10 border-white/20 text-white hover:bg-white/20","data-testid":"cancel-template",children:"Cancel"}),e.jsxs(z,{onClick:r,disabled:!c,className:"bg-gradient-to-r from-pink-500 to-purple-500 hover:from-pink-600 hover:to-purple-600 text-white","data-testid":"use-template",children:[e.jsx(tt,{className:"w-4 h-4 mr-2"}),"Use This Template"]})]})]})})}const Ba={name:"",description:"",primaryColor:"#3b82f6",secondaryColor:"#1e40af",accentColor:"#f59e0b",backgroundColor:"#ffffff",textColor:"#1f2937",fontFamily:"Inter",headingFontFamily:"",logoUrl:"",qrForegroundColor:"#000000",qrBackgroundColor:"#ffffff",qrLogoOverlay:!1,qrFrameStyle:"none",qrFrameText:"",socialCaptionTemplate:"",socialHashtags:[],socialMentions:[],borderRadius:"medium",shadowStyle:"medium",isDefault:!1,isActive:!0},Ir=["Inter","Roboto","Open Sans","Montserrat","Poppins","Lato","Playfair Display","Merriweather","Oswald","Raleway"],jn=[{value:"none",label:"No Frame"},{value:"simple",label:"Simple Border"},{value:"rounded",label:"Rounded Border"},{value:"badge",label:"Badge Style"},{value:"banner-top",label:"Top Banner"},{value:"banner-bottom",label:"Bottom Banner"},{value:"full-wrap",label:"Full Wrap"}],Qo=[{value:"none",label:"Sharp"},{value:"small",label:"Subtle"},{value:"medium",label:"Medium"},{value:"large",label:"Large"},{value:"full",label:"Pill"}],Yo=[{value:"none",label:"No Shadow"},{value:"small",label:"Subtle"},{value:"medium",label:"Medium"},{value:"large",label:"Dramatic"}];function Ht({label:p,value:P,onChange:l,testId:_}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{className:"text-white text-sm",children:p}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border border-white/20 cursor-pointer",style:{backgroundColor:P},onClick:()=>{var b;return(b=document.getElementById(_))==null?void 0:b.click()}}),e.jsx(le,{id:_,type:"color",value:P,onChange:b=>l(b.target.value),className:"w-0 h-0 opacity-0 absolute","data-testid":_}),e.jsx(le,{value:P,onChange:b=>l(b.target.value),className:"bg-white/10 border-white/20 text-white font-mono text-sm flex-1",placeholder:"#000000"})]})]})}function Pr({formData:p,setFormData:P,hashtagInput:l,setHashtagInput:_,mentionInput:b,setMentionInput:o,addHashtag:c,removeHashtag:i,addMention:u,removeMention:r}){var d,j;return e.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto pr-2",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Kit Name *"}),e.jsx(le,{value:p.name,onChange:s=>P({...p,name:s.target.value}),className:"bg-white/10 border-white/20 text-white mt-1",placeholder:"My Brand Kit","data-testid":"input-kit-name"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Description"}),e.jsx(nt,{value:p.description||"",onChange:s=>P({...p,description:s.target.value}),className:"bg-white/10 border-white/20 text-white mt-1",placeholder:"Describe this brand kit...","data-testid":"input-kit-description"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(wt,{className:"w-4 h-4"})," Colors"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ht,{label:"Primary",value:p.primaryColor||"#3b82f6",onChange:s=>P({...p,primaryColor:s}),testId:"color-primary"}),e.jsx(Ht,{label:"Secondary",value:p.secondaryColor||"#1e40af",onChange:s=>P({...p,secondaryColor:s}),testId:"color-secondary"}),e.jsx(Ht,{label:"Accent",value:p.accentColor||"#f59e0b",onChange:s=>P({...p,accentColor:s}),testId:"color-accent"}
93),e.jsx(Ht,{label:"Background",value:p.backgroundColor||"#ffffff",onChange:s=>P({...p,backgroundColor:s}),testId:"color-background"}),e.jsx(Ht,{label:"Text",value:p.textColor||"#1f2937",onChange:s=>P({...p,textColor:s}),testId:"color-text"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-white font-semibold",children:"Typography"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Body Font"}),e.jsxs(Oe,{value:p.fontFamily,onValueChange:s=>P({...p,fontFamily:s}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white mt-1","data-testid":"select-body-font",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Ir.map(s=>e.jsx(ae,{value:s,className:"text-white",style:{fontFamily:s},children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Heading Font"}),e.jsxs(Oe,{value:p.headingFontFamily||p.fontFamily,onValueChange:s=>P({...p,headingFontFamily:s}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white mt-1","data-testid":"select-heading-font",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Ir.map(s=>e.jsx(ae,{value:s,className:"text-white",style:{fontFamily:s},children:s},s))})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx($r,{className:"w-4 h-4"})," QR Code Styling"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ht,{label:"QR Foreground",value:p.qrForegroundColor||"#000000",onChange:s=>P({...p,qrForegroundColor:s}),testId:"color-qr-foreground"}),e.jsx(Ht,{label:"QR Background",value:p.qrBackgroundColor||"#ffffff",onChange:s=>P({...p,qrBackgroundColor:s}),testId:"color-qr-background"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Frame Style"}),e.jsxs(Oe,{value:p.qrFrameStyle,onValueChange:s=>P({...p,qrFrameStyle:s}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white mt-1","data-testid":"select-qr-frame",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:jn.map(s=>e.jsx(ae,{value:s.value,className:"text-white",children:s.label},s.value))})]})]}),p.qrFrameStyle!=="none"&&e.jsxs(e.Fragment,{children:[e.jsx(Ht,{label:"Frame Color",value:p.qrFrameColor||p.primaryColor||"#3b82f6",onChange:s=>P({...p,qrFrameColor:s}),testId:"color-qr-frame"}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Frame Text (CTA)"}),e.jsx(le,{value:p.qrFrameText||"",onChange:s=>P({...p,qrFrameText:s.target.value}),className:"bg-white/10 border-white/20 text-white mt-1",placeholder:"Scan to explore","data-testid":"input-qr-frame-text"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fa,{checked:p.qrLogoOverlay,onCheckedChange:s=>P({...p,qrLogoOverlay:s}),"data-testid":"switch-qr-logo-overlay"}),e.jsx(q,{className:"text-white text-sm",children:"Add logo overlay to QR code"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-white font-semibold",children:"Social Media Templates"}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Caption Template"}),e.jsx(nt,{value:p.socialCaptionTemplate||"",onChange:s=>P({...p,socialCaptionTemplate:s.target.value}),className:"bg-white/10 border-white/20 text-white mt-1",placeholder:"Check out this amazing spot! {{location}} #travel",rows:3,"data-testid":"input-caption-template"}),e.jsxs("p",{className:"text-gray-400 text-xs mt-1",children:["Use ","{{location}}",", ","{{name}}",", ","{{link}}"," as placeholders"]})]}),e.jsxs("div",{children:[e.jsxs(q,{className:"text-white text-sm flex items-center gap-2",children:[e.jsx(Za,{className:"w-3 h-3"})," Default Hashtags"]}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(le,{value:l,onChange:s=>_(s.target.value),className:"bg-white/10 border-white/20 text-white flex-1",placeholder:"travel",onKeyDown:s=>s.key==="Enter"&&(s.preventDefault(),c()),"data-testid":"input-hashtag"}),e.jsx(z,{onClick:c,size:"sm",variant:"secondary","data-testid":"btn-add-hashtag",children:e.jsx(Qe,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(d=p.socialHashtags)==null?void 0:d.map((s,m)=>e.jsxs("span",{className:"bg-accent/20 text-accent px-2 py-1 rounded text-sm flex items-center gap-1",children:[s,e.jsx("button",{onClick:()=>i(m),className:"hover:text-white",children:"Ã"})]},m))})]}),e.jsxs("div",{children:[e.jsxs(q,{className:"text-white text-sm flex items-center gap-2",children:[e.jsx(go,{className:"w-3 h-3"})," Default Mentions"]}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(le,{value:b,onChange:s=>o(s.target.value),className:"bg-white/10 border-white/20 text-white flex-1",placeholder:"username",onKeyDown:s=>s.key==="Enter"&&(s.preventDefault(),u()),"data-testid":"input-mention"}),e.jsx(z,{onClick:u,size:"sm",variant:"secondary","data-testid":"btn-add-mention",children:e.jsx(Qe,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(j=p.socialMentions)==null?void 0:j.map((s,m)=>e.jsxs("span",{className:"bg-blue-500/20 text-blue-400 px-2 py-1 rounded text-sm flex items-center gap-1",children:[s,e.jsx("button",{onClick:()=>r(m),className:"hover:text-white",children:"Ã"})]},m))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-white font-semibold",children:"Style Options"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Border Radius"}),e.jsxs(Oe,{value:p.borderRadius,onValueChange:s=>P({...p,borderRadius:s}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white mt-1","data-testid":"select-border-radius",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Qo.map(s=>e.jsx(ae,{value:s.value,className:"text-white",children:s.label},s.value))})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Shadow Style"}),e.jsxs(Oe,{value:p.shadowStyle,onValueChange:s=>P({...p,shadowStyle:s}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white mt-1","data-testid":"select-shadow-style",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Yo.map(s=>e.jsx(ae,{value:s.value,className:"text-white",children:s.label},s.value))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white text-sm",children:"Logo URL"}),e.jsx(le,{value:p.logoUrl||"",onChange:s=>P({...p,logoUrl:s.target.value}),className:"bg-white/10 border-white/20 text-white mt-1",placeholder:"https://example.com/logo.png","data-testid":"input-logo-url"})]})]})}function Jo(){const{toast:p}=ct(),[P,l]=$.useState(!1),[_,b]=$.useState(!1),[o,c]=$.useState(null),[i,u]=$.useState(Ba),[r,d]=$.useState(""),[j,s]=$.useState(""),{data:m=[],isLoading:y}=We({queryKey:["/api/creator/brand-kits"]}),h=je({mutationFn:async O=>fe("POST","/api/creator/brand-kits",O),onSuccess:()=>
93{ve.invalidateQueries({queryKey:["/api/creator/brand-kits"]}),l(!1),u(Ba),p({title:"Brand kit created successfully"})},onError:O=>{p({title:"Failed to create brand kit",description:O.message,variant:"destructive"})}}),f=je({mutationFn:async({id:O,data:ne})=>fe("PATCH",`/api/creator/brand-kits/${O}`,ne),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/creator/brand-kits"]}),b(!1),c(null),p({title:"Brand kit updated successfully"})},onError:O=>{p({title:"Failed to update brand kit",description:O.message,variant:"destructive"})}}),g=je({mutationFn:async O=>fe("DELETE",`/api/creator/brand-kits/${O}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/creator/brand-kits"]}),p({title:"Brand kit deleted successfully"})},onError:O=>{p({title:"Failed to delete brand kit",description:O.message,variant:"destructive"})}}),v=je({mutationFn:async O=>fe("POST",`/api/creator/brand-kits/${O}/set-default`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/creator/brand-kits"]}),p({title:"Default brand kit updated"})},onError:O=>{p({title:"Failed to set default",description:O.message,variant:"destructive"})}}),x=()=>{h.mutate(i)},k=()=>{o&&f.mutate({id:o.id,data:i})},D=O=>{c(O),u(O),b(!0)},K=()=>{if(r.trim()){const O=r.startsWith("#")?r:`#${r}`;u({...i,socialHashtags:[...i.socialHashtags||[],O]}),d("")}},U=O=>{var ne;u({...i,socialHashtags:(ne=i.socialHashtags)==null?void 0:ne.filter((C,W)=>W!==O)})},Q=()=>{if(j.trim()){const O=j.startsWith("@")?j:`@${j}`;u({...i,socialMentions:[...i.socialMentions||[],O]}),s("")}},R=O=>{var ne;u({...i,socialMentions:(ne=i.socialMentions)==null?void 0:ne.filter((C,W)=>W!==O)})};return y?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Ie,{className:"w-8 h-8 animate-spin text-accent"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white","data-testid":"brand-kit-title",children:"Brand Kits"}),e.jsx("p",{className:"text-gray-400",children:"Create and manage branded styles for your QR codes and social content"})]}),e.jsxs(z,{onClick:()=>{u(Ba),l(!0)},className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-create-brand-kit",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"})," New Brand Kit"]})]}),m.length===0?e.jsxs(ge,{className:"glass-card border-white/20 p-12 text-center",children:[e.jsx(wt,{className:"w-12 h-12 mx-auto text-gray-500 mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"No Brand Kits Yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:"Create your first brand kit to style your QR codes and social content"}),e.jsxs(z,{onClick:()=>l(!0),className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-create-first-kit",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"})," Create Brand Kit"]})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:m.map(O=>{var ne;return e.jsxs(ge,{className:`glass-card border-white/20 overflow-hidden ${O.isDefault?"ring-2 ring-accent":""}`,"data-testid":`brand-kit-card-${O.id}`,children:[e.jsxs("div",{className:"h-24 relative",style:{background:`linear-gradient(135deg, ${O.primaryColor} 0%, ${O.secondaryColor} 100%)`},children:[O.isDefault&&e.jsxs("span",{className:"absolute top-2 right-2 bg-accent text-black px-2 py-1 rounded-full text-xs flex items-center gap-1",children:[e.jsx(ir,{className:"w-3 h-3"})," Default"]}),e.jsx("div",{className:"absolute -bottom-6 left-4 w-12 h-12 rounded-lg border-2 border-white/20 flex items-center justify-center",style:{backgroundColor:O.backgroundColor},children:e.jsx(wt,{className:"w-6 h-6",style:{color:O.primaryColor}})})]}),e.jsxs("div",{className:"p-4 pt-8",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1","data-testid":`kit-name-${O.id}`,children:O.name}),O.description&&e.jsx("p",{className:"text-gray-400 text-sm mb-3 line-clamp-2",children:O.description}),e.jsx("div",{className:"flex items-center gap-2 mb-4",children:[O.primaryColor,O.secondaryColor,O.accentColor,O.backgroundColor,O.textColor].map((C,W)=>e.jsx("div",{className:"w-6 h-6 rounded-full border border-white/20",style:{backgroundColor:C},title:C},W))}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400 mb-4",children:[e.jsx("span",{style:{fontFamily:O.fontFamily},children:O.fontFamily}),O.qrFrameStyle!=="none"&&e.jsx("span",{className:"bg-white/10 px-2 py-0.5 rounded text-xs",children:(ne=jn.find(C=>C.value===O.qrFrameStyle))==null?void 0:ne.label})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z,{variant:"outline",size:"sm",onClick:()=>D(O),className:"flex-1 border-white/20 text-white hover:bg-white/10","data-testid":`btn-edit-kit-${O.id}`,children:[e.jsx(fr,{className:"w-3 h-3 mr-1"})," Edit"]}),!O.isDefault&&e.jsx(z,{variant:"outline",size:"sm",onClick:()=>v.mutate(O.id),className:"border-white/20 text-white hover:bg-white/10","data-testid":`btn-set-default-${O.id}`,children:e.jsx(ir,{className:"w-3 h-3"})}),e.jsx(z,{variant:"outline",size:"sm",onClick:()=>{confirm("Are you sure you want to delete this brand kit?")&&g.mutate(O.id)},className:"border-red-500/50 text-red-400 hover:bg-red-500/10","data-testid":`btn-delete-kit-${O.id}`,children:e.jsx(xt,{className:"w-3 h-3"})})]})]})]},O.id)})}),e.jsx(Me,{open:P,onOpenChange:l,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white max-w-2xl",children:[e.jsx(Ue,{children:e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"w-5 h-5 text-accent"}),"Create Brand Kit"]})}),e.jsx(Pr,{formData:i,setFormData:u,hashtagInput:r,setHashtagInput:d,mentionInput:j,setMentionInput:s,addHashtag:K,removeHashtag:U,addMention:Q,removeMention:R}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>l(!1),className:"border-white/20 text-white hover:bg-white/10",children:"Cancel"}),e.jsxs(z,{onClick:x,disabled:!i.name||h.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-save-new-kit",children:[h.isPending?e.jsx(Ie,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(ht,{className:"w-4 h-4 mr-2"}),"Create Kit"]})]})]})}),e.jsx(Me,{open:_,onOpenChange:b,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white max-w-2xl",children:[e.jsx(Ue,{children:e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(fr,{className:"w-5 h-5 text-accent"}),"Edit Brand Kit"]})}),e.jsx(Pr,{formData:i,setFormData:u,hashtagInput:r,setHashtagInput:d,mentionInput:j,setMentionInput:s,addHashtag:K,removeHashtag:U,addMention:Q,removeMention:R}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>b(!1),className:"border-white/20 text-white hover:bg-white/10",children:"Cancel"}),e.jsxs(z,{onClick:k,disabled:!i.name||f.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-save-edit-kit",children:[f.isPending?e.jsx(Ie,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(ht,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})})]})}const Xo=[{id:"instagram",name:"Instagram",icon:e.jsx(Ll,{className:"h-4 w-4"}),color:"text-pink-500",getCaption:p=>`${p.headline||"Check this out!"} ð 94 95${p.subheadline||""} 96
97#MarchMadness #Basketball #NIL #CollegeBasketball #GameDay`},{id:"tiktok",name:"TikTok",icon:e.jsx(ss,{className:"h-4 w-4"}),color:"text-black dark:text-white",getCaption:p=>`${p.headline||"Check this out!"} ð ${p.subheadline||""} #MarchMadness #Basketball #NIL #CollegeHoops #Gameday #FYP`},{id:"twitter",name:"X (Twitter)",icon:e.jsx(Ul,{className:"h-4 w-4"}),color:"text-black dark:text-white",getCaption:p=>`${p.headline||"Check this out!"} ð 98 99${p.subheadline||""} 100 101#MarchMadness #CollegeBasketball`,getShareUrl:p=>`https://twitter.com/intent/tweet?text=${encodeURIComponent(`${p.headline||"Check this out!"} ð 102 103#MarchMadness #CollegeBasketball`)}`},{id:"facebook",name:"Facebook",icon:e.jsx(ql,{className:"h-4 w-4"}),color:"text-blue-600",getCaption:p=>`${p.headline||"Check this out!"} ð 104 105${p.subheadline||""} 106 107Join the excitement!`}];function ec({asset:p,onShare:P}){const{toast:l}=ct(),[_,b]=$.useState(null),o=async c=>{const i=c.getCaption(p);try{await navigator.clipboard.writeText(i),b(c.id),setTimeout(()=>b(null),2e3),l({title:`Caption copied for ${c.name}!`,description:"Now download the image and paste the caption when posting."}),P(c.id),c.getShareUrl&&window.open(c.getShareUrl(p),"_blank")}catch{l({title:"Could not copy caption",description:"Please copy the caption manually.",variant:"destructive"})}};return e.jsxs(Hr,{children:[e.jsx(Kr,{asChild:!0,children:e.jsxs(z,{size:"sm",variant:"outline","data-testid":`button-share-${p.id}`,children:[e.jsx(ps,{className:"h-4 w-4 mr-1"}),"Share"]})}),e.jsxs(Wr,{align:"end",className:"w-56",children:[e.jsx(Rl,{children:"Quick Share"}),e.jsx(rr,{}),Xo.map(c=>e.jsxs(qa,{onClick:()=>o(c),className:"cursor-pointer","data-testid":`share-option-${c.id}-${p.id}`,children:[e.jsx("span",{className:`mr-2 ${c.color}`,children:c.icon}),c.name,_===c.id?e.jsx(qs,{className:"ml-auto h-4 w-4 text-green-500"}):e.jsx(Kt,{className:"ml-auto h-4 w-4 text-muted-foreground"})]},c.id)),e.jsx(rr,{}),e.jsxs(qa,{onClick:()=>{p.fileUrl&&window.open(p.fileUrl,"_blank")},className:"cursor-pointer","data-testid":`share-open-${p.id}`,children:[e.jsx(pa,{className:"mr-2 h-4 w-4"}),"Open Image"]})]})]})}function tc(){var C,W,n;const{toast:p}=ct(),[P,l]=$.useState(!1),[_,b]=$.useState(null),[o,c]=$.useState(null),[i,u]=$.useState({name:"",description:"",headline:"",subheadline:"",campaignId:"",tags:""}),[r,d]=$.useState({name:"",description:"",brandKitId:"",format:"png",headline:"",subheadline:"",bodyText:"",callToAction:"",campaignId:"",tags:""}),{data:j=[],isLoading:s}=We({queryKey:["/api/creator/assets/templates"]}),{data:m=[]}=We({queryKey:["/api/creator/brand-kits"]}),{data:y=[],isLoading:h,refetch:f}=We({queryKey:["/api/creator/assets"]}),g=je({mutationFn:async S=>(await fe("POST","/api/creator/assets/generate",S)).json(),onSuccess:()=>{p({title:"Asset generated successfully!"}),ve.invalidateQueries({queryKey:["/api/creator/assets"]}),l(!1),U()},onError:S=>{p({title:"Failed to generate asset",description:S.message,variant:"destructive"})}}),v=je({mutationFn:async S=>{const oe=await fetch("/api/creator/assets/upload",{method:"POST",body:S,credentials:"include"});if(!oe.ok){const J=await oe.json();throw new Error(J.error||"Upload failed")}return oe.json()},onSuccess:()=>{p({title:"Asset uploaded successfully!"}),ve.invalidateQueries({queryKey:["/api/creator/assets"]}),l(!1),U()},onError:S=>{p({title:"Failed to upload asset",description:S.message,variant:"destructive"})}}),x=je({mutationFn:async S=>{await fe("DELETE",`/api/creator/assets/${S}`)},onSuccess:()=>{p({title:"Asset deleted"}),ve.invalidateQueries({queryKey:["/api/creator/assets"]})},onError:S=>{p({title:"Failed to delete asset",description:S.message,variant:"destructive"})}}),k=je({mutationFn:async S=>(await fe("POST",`/api/creator/assets/${S}/download`)).json(),onSuccess:S=>{window.open(S.downloadUrl,"_blank"),p({title:"Download started"})},onError:S=>{p({title:"Failed to download",description:S.message,variant:"destructive"})}}),D=je({mutationFn:async({assetId:S,platform:oe})=>(await fe("POST",`/api/creator/assets/${S}/share`,{platform:oe})).json(),onSuccess:()=>
107{ve.invalidateQueries({queryKey:["/api/creator/assets"]})}}),K=(S,oe)=>{D.mutate({assetId:S,platform:oe})},U=()=>{d({name:"",description:"",brandKitId:"",format:"png",headline:"",subheadline:"",bodyText:"",callToAction:"",campaignId:"",tags:""}),u({name:"",description:"",headline:"",subheadline:"",campaignId:"",tags:""}),c(null),b(null)},Q=()=>{if(!o){p({title:"Please select a file to upload",variant:"destructive"});return}if(!i.name){p({title:"Please enter an asset name",variant:"destructive"});return}const S=new FormData;S.append("file",o),S.append("name",i.name),i.description&&S.append("description",i.description),i.headline&&S.append("headline",i.headline),i.subheadline&&S.append("subheadline",i.subheadline),i.campaignId&&S.append("campaignId",i.campaignId),i.tags&&S.append("tags",JSON.stringify(i.tags.split(",").map(oe=>oe.trim()))),v.mutate(S)},R=()=>{if(!_){p({title:"Please select a template",variant:"destructive"});return}if(!r.name){p({title:"Please enter an asset name",variant:"destructive"});return}g.mutate({templateId:_.id,name:r.name,description:r.description||void 0,brandKitId:r.brandKitId||void 0,format:r.format,headline:r.headline||void 0,subheadline:r.subheadline||void 0,bodyText:r.bodyText||void 0,callToAction:r.callToAction||void 0,campaignId:r.campaignId||void 0,tags:r.tags?r.tags.split(",").map(S=>S.trim()):void 0})},O=S=>{switch(S){case"banner":return e.jsx(gn,{className:"h-4 w-4"});case"social_post":return e.jsx(ut,{className:"h-4 w-4"});case"story":return e.jsx(oa,{className:"h-4 w-4"});case"qr_styled":return e.jsx(Ra,{className:"h-4 w-4"});case"promo_card":return e.jsx(wt,{className:"h-4 w-4"});default:return e.jsx(ut,{className:"h-4 w-4"})}},ne=S=>{switch(S){case"gif":return"bg-purple-100 text-purple-800";case"jpeg":return"bg-blue-100 text-blue-800";case"png":return"bg-green-100 text-green-800";default:return"bg-gray-100 text-gray-800"}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Branded Assets"}),e.jsx("p",{className:"text-muted-foreground",children:"Create branded images and GIFs for your campaigns"})]}),e.jsxs(Me,{open:P,onOpenChange:l,children:[e.jsx(vs,{asChild:!0,children:e.jsxs(z,{"data-testid":"button-create-asset",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),"Create Asset"]})}),e.jsxs(Le,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Create Branded Asset"}),e.jsx(Ke,{children:"Choose a template and customize your branded image or GIF"})]}),e.jsxs(as,{defaultValue:"upload",className:"w-full",children:[e.jsxs(is,{className:"grid w-full grid-cols-4",children:[e.jsx(Re,{value:"upload","data-testid":"tab-upload",children:"Upload"}),e.jsx(Re,{value:"template","data-testid":"tab-template",children:"Template"}),e.jsx(Re,{value:"content","data-testid":"tab-content",children:"Content"}),e.jsx(Re,{value:"styling","data-testid":"tab-styling",children:"Styling"})]}),e.jsxs(ze,{value:"upload",className:"space-y-4",children:[e.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center",children:[e.jsx("input",{type:"file",id:"file-upload",accept:"image/png,image/jpeg,image/gif",className:"hidden",onChange:S=>{var J;const oe=(J=S.target.files)==null?void 0:J[0];oe&&(c(oe),i.name||u({...i,name:oe.name.replace(/\.[^/.]+$/,"")}))},"data-testid":"input-file-upload"}),e.jsx("label",{htmlFor:"file-upload",className:"cursor-pointer",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(Ft,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"text-sm font-medium",children:o?o.name:"Click to upload an existing branded file"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPEG, or GIF (max 10MB)"})]})})]}),o&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"upload-name",children:"Asset Name *"}),e.jsx(le,{id:"upload-name",placeholder:"e.g., Game Day Promo",value:i.name,onChange:S=>u({...i,name:S.target.value}),"data-testid":"input-upload-name"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"upload-headline",children:"Headline (for sharing)"}),e.jsx(le,{id:"upload-headline",placeholder:"Main message for social captions",value:i.headline,onChange:S=>u({...i,headline:S.target.value}),"data-testid":"input-upload-headline"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"upload-subheadline",children:"Subheadline"}),e.jsx(le,{id:"upload-subheadline",placeholder:"Supporting text",value:i.subheadline,onChange:S=>u({...i,subheadline:S.target.value}),"data-testid":"input-upload-subheadline"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"upload-tags",children:"Tags (comma-separated)"}),e.jsx(le,{id:"upload-tags",placeholder:"e.g., march-madness, promo, basketball",value:i.tags,onChange:S=>u({...i,tags:S.target.value}),"data-testid":"input-upload-tags"})]}),e.jsx(z,{onClick:Q,disabled:v.isPending,className:"w-full","data-testid":"button-upload-asset",children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"mr-2 h-4 w-4 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ft,{className:"mr-2 h-4 w-4"}),"Upload Asset"]})})]})]}),e.jsx(ze,{value:"template",className:"space-y-4",children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:s?e.jsx("div",{className:"col-span-3 flex items-center justify-center py-8",children:e.jsx(Ie,{className:"h-6 w-6 animate-spin"})}):j.map(S=>
107e.jsx(ge,{className:`cursor-pointer transition-all hover:border-primary ${(_==null?void 0:_.id)===S.id?"border-primary ring-2 ring-primary":""}`,onClick:()=>b(S),"data-testid":`template-${S.id}`,children:e.jsxs(Te,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[O(S.assetType),e.jsx("span",{className:"font-medium text-sm",children:S.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:S.description}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[S.defaultWidth,"x",S.defaultHeight]}),e.jsx("span",{children:"â¢"}),e.jsx("span",{children:S.supportedFormats.join(", ").toUpperCase()})]})]})},S.id))})}),e.jsx(ze,{value:"content",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"name",children:"Asset Name *"}),e.jsx(le,{id:"name",placeholder:"e.g., March Madness Promo",value:r.name,onChange:S=>d({...r,name:S.target.value}),"data-testid":"input-asset-name"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"headline",children:"Headline"}),e.jsx(le,{id:"headline",placeholder:"Main message or title",value:r.headline,onChange:S=>d({...r,headline:S.target.value}),"data-testid":"input-headline"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"subheadline",children:"Subheadline"}),e.jsx(le,{id:"subheadline",placeholder:"Supporting text",value:r.subheadline,onChange:S=>d({...r,subheadline:S.target.value}),"data-testid":"input-subheadline"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"bodyText",children:"Body Text"}),e.jsx(nt,{id:"bodyText",placeholder:"Additional details or description",value:r.bodyText,onChange:S=>d({...r,bodyText:S.target.value}),"data-testid":"input-body-text",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"callToAction",children:"Call to Action"}),e.jsx(le,{id:"callToAction",placeholder:"e.g., Scan Now, Join Today",value:r.callToAction,onChange:S=>d({...r,callToAction:S.target.value}),"data-testid":"input-cta"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"tags",children:"Tags (comma-separated)"}),e.jsx(le,{id:"tags",placeholder:"e.g., promo, basketball, event",value:r.tags,onChange:S=>d({...r,tags:S.target.value}),"data-testid":"input-tags"})]})]})}),e.jsx(ze,{value:"styling",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"brandKit",children:"Brand Kit"}),e.jsxs(Oe,{value:r.brandKitId,onValueChange:S=>d({...r,brandKitId:S}),children:[e.jsx(Be,{"data-testid":"select-brand-kit",children:e.jsx($e,{placeholder:"Select a brand kit (
107optional)"})}),e.jsx(Ve,{children:m.map(S=>e.jsx(ae,{value:S.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full border",style:{backgroundColor:S.primaryColor||"#3b82f6"}}),S.name,S.isDefault&&e.jsx(De,{variant:"secondary",className:"ml-1 text-xs",children:"Default"})]})},S.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your brand kit colors, fonts, and styling will be applied to the asset"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"format",children:"Output Format"}),e.jsxs(Oe,{value:r.format,onValueChange:S=>d({...r,format:S}),children:[e.jsx(Be,{"data-testid":"select-format",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[((C=_==null?void 0:_.supportedFormats)==null?void 0:C.includes("png"))&&e.jsx(ae,{value:"png",children:"PNG (High Quality)"}),((W=_==null?void 0:_.supportedFormats)==null?void 0:W.includes("jpeg"))&&e.jsx(ae,{value:"jpeg",children:"JPEG (Smaller Size)"}),((n=_==null?void 0:_.supportedFormats)==null?void 0:n.includes("gif"))&&e.jsx(ae,{value:"gif",children:"GIF (Animated)"}),!_&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{value:"png",children:"PNG (High Quality)"}),e.jsx(ae,{value:"jpeg",children:"JPEG (Smaller Size)"}),e.jsx(ae,{value:"gif",children:"GIF (Animated)"})]})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(q,{htmlFor:"description",children:"Description (Internal)"}),e.jsx(nt,{id:"description",placeholder:"Internal notes about this asset",value:r.description,onChange:S=>d({...r,description:S.target.value}),"data-testid":"input-description",rows:2})]})]})})]}),e.jsxs(Ze,{children:[e.jsx(Pl,{asChild:!0,children:e.jsx(z,{variant:"outline",onClick:U,children:"Cancel"})}),e.jsx(z,{onClick:R,disabled:g.isPending||!_||!r.name,"data-testid":"button-generate-asset",children:g.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"h-4 w-4 mr-2"}),"Generate Asset"]})})]})]})]})]}),h?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ie,{className:"h-8 w-8 animate-spin"})}):y.length===0?e.jsx(ge,{children:e.jsxs(Te,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(Ra,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No assets yet"}),e.jsx("p",{className:"text-muted-foreground text-center mb-4",children:"Create branded images and GIFs for your campaigns using your brand kits"}),e.jsxs(z,{onClick:()=>l(!0),"data-testid":"button-create-first-asset",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),"Create Your First Asset"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(S=>e.jsxs(ge,{className:"overflow-hidden","data-testid":`asset-card-${S.id}`,children:[e.jsxs("div",{className:"aspect-video bg-muted relative",children:[S.thumbnailUrl||S.fileUrl?e.jsx("img",{src:S.thumbnailUrl||S.fileUrl||"",alt:S.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Ra,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx(De,{className:`absolute top-2 right-2 ${ne(S.format)}`,children:S.format.toUpperCase()}),S.status==="generating"&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsx(Ie,{className:"h-8 w-8 animate-spin text-white"})})]}),e.jsxs(Te,{className:"p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-2",children:e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium truncate","data-testid":`text-asset-name-${S.id}`,children:S.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[S.width,"x",S.height," ⢠",S.assetType]})]})}),S.headline&&e.jsx("p",{className:"text-sm text-muted-foreground truncate mb-2",children:S.headline}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(z,{size:"sm",variant:"outline",onClick:()=>k.mutate(S.id),disabled:S.status!=="ready","data-testid":`button-download-${S.id}`,children:[e.jsx(St,{className:"h-4 w-4 mr-1"}),"Download"]}),S.status==="ready"&&e.jsx(ec,{asset:S,onShare:oe=>K(S.id,oe)}),S.fileUrl&&e.jsx(z,{size:"sm",variant:"ghost",onClick:()=>window.open(S.fileUrl||"","_blank"),"data-testid":`button-preview-${S.id}`,children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx(z,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>x.mutate(S.id),"data-testid":`button-delete-${S.id}`,children:e.jsx(xt,{className:"h-4 w-4"})})]}),S.downloadCount&&S.downloadCount>0||S.shareCount&&S.shareCount>0?e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[S.downloadCount&&S.downloadCount>0&&e.jsxs("span",{children:["Downloaded ",S.downloadCount,"x"]}),S.downloadCount&&S.downloadCount>0&&S.shareCount&&S.shareCount>0&&" ⢠",S.shareCount&&S.shareCount>0&&e.jsxs("span",{children:["Shared ",S.shareCount,"x"]})]}):null]})]},S.id))})]})}function sc(){var L,F,he,ie,te,Fe,He,we,be;const{toast:p}=ct(),[P,l]=$.useState(!1),[_,b]=$.useState(!1),[o,c]=$.useState(!1),[i,u]=$.useState(!1),[r,d
107]=$.useState(null),[j,s]=$.useState(null),[m,y]=$.useState(null),[h,f]=$.useState({title:"",subtitle:"",description:"",pageSize:"letter",orientation:"portrait",primaryColor:"#1E3A5F",secondaryColor:"#F4A261",accentColor:"#2A9D8F"}),[g,v]=$.useState({zoneNumber:1,name:"",description:"",color:"#E63946"}),[x,k]=$.useState({name:"",boothNumber:"",category:"",description:"",zoneId:"",sponsorTier:""}),[D,K]=$.useState({pageNumber:1,pageType:"vendor_list",title:""}),{data:U=[],isLoading:Q}=We({queryKey:["/api/event-programs/programs"]}),{data:R,isLoading:O}=We({queryKey:["/api/event-programs/programs",r==null?void 0:r.id],enabled:!!(r!=null&&r.id)}),ne=je({mutationFn:I=>fe("POST","/api/event-programs/programs",I),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs"]}),l(!1),f({title:"",subtitle:"",description:"",pageSize:"letter",orientation:"portrait",primaryColor:"#1E3A5F",secondaryColor:"#F4A261",accentColor:"#2A9D8F"}),p({title:"Program created successfully"})},onError:I=>{p({title:"Error creating program",description:I.message,variant:"destructive"})}}),C=je({mutationFn:()=>fe("POST","/api/event-programs/demo/festival-template"),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs"]}),p({title:"Demo festival template created!"})},onError:I=>{p({title:"Error creating demo",description:I.message,variant:"destructive"})}}),W=je({mutationFn:I=>fe("DELETE",`/api/event-programs/programs/${I}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs"]}),d(null),p({title:"Program deleted"})}}),n=je({mutationFn:I=>fe("POST",`/api/event-programs/programs/${I}/generate-pdf`),onSuccess:I=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),p({title:"PDF generated!",description:"Your program PDF is ready to download."})},onError:I=>{p({title:"Error generating PDF",description:I.message,variant:"destructive"})}}),S=je({mutationFn:I=>fe("POST",`/api/event-programs/programs/${r==null?void 0:r.id}/zones`,I),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),b(!1),v({zoneNumber:1,name:"",description:"",color:"#E63946"}),p({title:"Zone added"})}}),oe=je({mutationFn:I=>fe("DELETE",`/api/event-programs/programs/${r==null?void 0:r.id}/zones/${I}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),p({title:"Zone deleted"})}}),J=je({mutationFn:I=>fe("POST",`/api/event-programs/programs/${r==null?void 0:r.id}/vendors`,{...I,zoneId:I.zoneId||null,sponsorTier:I.sponsorTier||null}),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),c(!1),k({name:"",boothNumber:"",category:"",description:"",zoneId:"",sponsorTier:""}),p({title:"Vendor added"})}}),xe=je({mutationFn:I=>fe("DELETE",`/api/event-programs/programs/${r==null?void 0:r.id}/vendors/${I}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),p({title:"Vendor deleted"})}}),Z=je({mutationFn:I=>fe("POST",`/api/event-programs/programs/${r==null?void 0:r.id}/pages`,I),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),u(!1),K({pageNumber:1,pageType:"vendor_list",title:""}),p({title:"Page added"})}}),Y=je({mutationFn:I=>fe("DELETE",`/api/event-programs/programs/${r==null?void 0:r.id}/pages/${I}`),onSuccess:()=>{ve.invalidateQueries({queryKey:["/api/event-programs/programs",r==null?void 0:r.id]}),p({title:"Page deleted"})}});return Q?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ie,{className:"w-8 h-8 animate-spin text-accent"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white",children:"Event Programs"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Create PDF programs for festivals, conventions, and events"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{variant:"outline",onClick:()=>C.mutate(),disabled:C.isPending,className:"border-white/20 text-white hover:bg-white/10","data-testid":"btn-create-demo",children:[C.isPending?e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(tt,{className:"w-4 h-4 mr-2"}),"Create Demo Template"]}),e.jsxs(z,{onClick:()=>l(!0),className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-create-program",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"New Program"]})]})]}),r?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(z,{variant:"ghost",onClick:()=>d(null),className:"text-gray-400 hover:text-white","data-testid":"btn-back-to-list",children:"â Back to Programs"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{variant:"outline",onClick:()=>n.mutate(r.id),disabled:n.isPending,className:"border-white/20 text-white hover:bg-white/10","data-testid":"btn-generate-pdf",children:[n.isPending?e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(ts,{className:"w-4 h-4 mr-2"}),"Generate PDF"]}),(R==null?void 0:R.pdfUrl)&&e.jsx(z,{asChild:!0,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-download-pdf",children:e.jsxs("a",{href:R.pdfUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(St,{className:"w-4 h-4 mr-2"}),"Download PDF"]})}),e.jsx(z,{variant:"destructive",onClick:()=>{confirm("Are you sure you want to delete this program?")&&W.mutate(r.id)},"data-testid":"btn-delete-program",children:e.jsx(xt,{className:"w-4 h-4"})})]})]}),e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("div",{className:"w-16 h-16 rounded-lg flex items-center justify-center",style:{backgroundColor:(R==null?void 0:R.primaryColor)||"#1E3A5F"},children:e.jsx(ts,{className:"w-8 h-8 text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:(R==null?void 0:R.title)||r.title}
107),((R==null?void 0:R.subtitle)||r.subtitle)&&e.jsx("p",{className:"text-gray-400",children:(R==null?void 0:R.subtitle)||r.subtitle}),e.jsxs("p",{className:"text-gray-500 text-sm mt-1",children:[(R==null?void 0:R.pageSize)||"letter"," ⢠",(R==null?void 0:R.orientation)||"portrait"]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(bs,{className:"w-4 h-4 text-accent"}),"Zones (",((L=R==null?void 0:R.zones)==null?void 0:L.length)||0,")"]}),e.jsxs(z,{size:"sm",variant:"outline",onClick:()=>b(!0),className:"border-white/20 text-white hover:bg-white/10","data-testid":"btn-add-zone",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Zone"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(F=R==null?void 0:R.zones)==null?void 0:F.map(I=>e.jsxs("div",{className:"p-3 rounded-lg border border-white/10 bg-white/5 group","data-testid":`zone-${I.id}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:I.color||"#888"}}),e.jsx("span",{className:"text-white text-sm font-medium",children:I.name})]}),e.jsxs("p",{className:"text-gray-500 text-xs",children:["Zone #",I.zoneNumber]}),e.jsxs(z,{size:"sm",variant:"ghost",className:"mt-2 h-6 text-xs text-red-400 hover:text-red-300 opacity-0 group-hover:opacity-100",onClick:()=>oe.mutate(I.id),"data-testid":`btn-delete-zone-${I.id}`,children:[e.jsx(xt,{className:"w-3 h-3 mr-1"}),"Delete"]})]},I.id))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(zl,{className:"w-4 h-4 text-accent"}),"Vendors (",((he=R==null?void 0:R.vendors)==null?void 0:he.length)||0,")"]}),e.jsxs(z,{size:"sm",variant:"outline",onClick:()=>c(!0),className:"border-white/20 text-white hover:bg-white/10","data-testid":"btn-add-vendor",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Vendor"]})]}),e.jsxs("div",{className:"space-y-2",children:[(ie=R==null?void 0:R.vendors)==null?void 0:ie.slice(0,5).map(I=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-white/10 bg-white/5 group","data-testid":`vendor-${I.id}`,children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-white text-sm",children:I.name}),I.boothNumber&&e.jsxs("span",{className:"text-gray-500 text-xs ml-2",children:["Booth ",I.boothNumber]}),I.sponsorTier&&e.jsx("span",{className:"ml-2 px-2 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:I.sponsorTier})]}),e.jsx(z,{size:"sm",variant:"ghost",className:"h-6 text-xs text-red-400 hover:text-red-300 opacity-0 group-hover:opacity-100",onClick:()=>xe.mutate(I.id),"data-testid":`btn-delete-vendor-${I.id}`,children:e.jsx(xt,{className:"w-3 h-3"})})]},I.id)),(((te=R==null?void 0:R.vendors)==null?void 0:te.length)||0)>5&&e.jsxs("p",{className:"text-gray-500 text-sm text-center",children:["+",(((Fe=R==null?void 0:R.vendors)==null?void 0:Fe.length)||0)-5," more vendors"]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(lo,{className:"w-4 h-4 text-accent"}),"Pages (",((He=R==null?void 0:R.pages)==null?void 0:He.length)||0,")"]}),e.jsxs(z,{size:"sm",variant:"outline",onClick:()=>u(!0),className:"border-white/20 text-white hover:bg-white/10","data-testid":"btn-add-page",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Add Page"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(we=R==null?void 0:R.pages)==null?void 0:we.map(I=>e.jsxs("div",{className:"p-3 rounded-lg border border-white/10 bg-white/5 group","data-testid":`page-${I.id}`,children:[e.jsx("span",{className:"text-white text-sm",children:I.title||I.pageType}),e.jsxs("p",{className:"text-gray-500 text-xs",children:["Page #",I.pageNumber," ⢠",I.pageType]}),e.jsxs(z,{size:"sm",variant:"ghost",className:"mt-2 h-6 text-xs text-red-400 hover:text-red-300 opacity-0 group-hover:opacity-100",onClick:()=>Y.mutate(I.id),"data-testid":`btn-delete-page-${I.id}`,children:[e.jsx(xt,{className:"w-3 h-3 mr-1"}),"Delete"]})]},I.id))})]})]})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:U.length===0?e.jsxs(ge,{className:"col-span-full glass-card border-white/20 p-8 text-center",children:[e.jsx(ts,{className:"w-12 h-12 text-gray-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-white font-medium mb-2",children:"No programs yet"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:"Create your first event program or use the demo template to get started."}),e.jsxs(z,{variant:"outline",onClick:()=>C.mutate(),disabled:C.isPending,className:"border-accent text-accent hover:bg-accent/10","data-testid":"btn-create-first-demo",children:[e.jsx(tt,{className:"w-4 h-4 mr-2"}),"Create Demo Template"]})]}):U.map(I=>e.jsxs(ge,{className:"glass-card border-white/20 p-4 cursor-pointer hover:border-accent/50 transition-colors",onClick:()=>d(I),"data-testid":`program-card-${I.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:I.primaryColor||"#1E3A5F"},children:e.jsx(ts,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:`px-2 py-1 rounded text-xs ${I.status==="published"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:I.status})]}),e.jsx("h3",{className:"text-white font-medium mb-1",children:I.title}),I.subtitle&&e.jsx("p",{className:"text-gray-400 text-sm",children:I.subtitle}),I.pdfUrl&&e.jsxs("div",{className:"mt-3 flex items-center text-accent text-sm",children:[e.jsx(St,{className:"w-4 h-4 mr-1"}),"PDF Ready"]})]},I.id))}),e.jsx(Me,{open:P,onOpenChange:l,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Create New Program"}),e.jsx(Ke,{className:"text-gray-400",children:"Set up a new event program with your branding."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Title *"}),e.jsx(le,{value:h.title,onChange:I=>f({...h,title:I.target.value}),placeholder:"Summer Music Festival",className:"bg-white/10 border-white/20 text-white","data-testid":"input-program-title"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Subtitle"}),e.jsx(le,{value:h.subtitle,onChange:I=>f({...h,subtitle:I.target.value}),placeholder:"August 15-17, 2026",className:"bg-white/10 border-white/20 text-white","data-testid":"input-program-subtitle"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Description"}),e.jsx(nt,{value:h.description,onChange:I=>f({...h,description:I.target.value}),placeholder:"A 3-day music festival...",className:"bg-white/10 border-white/20 text-white","data-testid":"input-program-description"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Page Size"}),e.jsxs(Oe,{value:h.pageSize,onValueChange:I=>f({...h,pageSize:I}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-page-size",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"letter",children:"Letter"}),e.jsx(ae,{value:"a4",children:"A4"}),e.jsx(ae,{value:"tabloid",children:"Tabloid"})]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Orientation"}),e.jsxs(Oe,{value:h.orientation,onValueChange:I=>f({...h,orientation:I}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-orientation",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"portrait",children:"Portrait"}),e.jsx(ae,{value:"landscape",children:"Landscape"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Primary Color"}),e.jsx(le,{type:"color",value:h.primaryColor,onChange:I=>f({...h,primaryColor:I.target.value}),className:"h-10 p-1 bg-white/10 border-white/20","data-testid":"input-primary-color"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Secondary Color"}),e.jsx(le,{type:"color",value:h.secondaryColor,onChange:I=>f({...h,secondaryColor:I.target.value}),className:"h-10 p-1 bg-white/10 border-white/20","data-testid":"input-secondary-color"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Accent Color"}),e.jsx(le,{type:"color",value:h.accentColor,onChange:I=>f({...h,accentColor:I.target.value}),className:"h-10 p-1 bg-white/10 border-white/20","data-testid":"input-accent-color"})]})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>l(!1),className:"border-white/20 text-white",children:"Cancel"}),e.jsxs(z,{onClick:()=>ne.mutate(h),disabled:!h.title||ne.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-submit-create-program",children:[ne.isPending&&e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Create Program"]})]})]})}),e.jsx(Me,{open:_,onOpenChange:b,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Zone"}),e.jsx(Ke,{className:"text-gray-400",children:"Define a venue area for your event."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Zone Number"}),e.jsx(le,{type:"number",value:g.zoneNumber,onChange:I=>v({...g,zoneNumber:parseInt(I.target.value)||1}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-zone-number"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Name *"}),e.jsx(le,{value:g.name,onChange:I=>v({...g,name:I.target.value}),placeholder:"Main Stage",className:"bg-white/10 border-white/20 text-white","data-testid":"input-zone-name"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Description"}
107),e.jsx(le,{value:g.description,onChange:I=>v({...g,description:I.target.value}),placeholder:"Primary performance area",className:"bg-white/10 border-white/20 text-white","data-testid":"input-zone-description"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Color"}),e.jsx(le,{type:"color",value:g.color,onChange:I=>v({...g,color:I.target.value}),className:"h-10 p-1 bg-white/10 border-white/20","data-testid":"input-zone-color"})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>b(!1),className:"border-white/20 text-white",children:"Cancel"}),e.jsx(z,{onClick:()=>S.mutate(g),disabled:!g.name||S.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-submit-add-zone",children:"Add Zone"})]})]})}),e.jsx(Me,{open:o,onOpenChange:c,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Vendor"}),e.jsx(Ke,{className:"text-gray-400",children:"Add a vendor to your event program."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Vendor Name *"}),e.jsx(le,{value:x.name,onChange:I=>k({...x,name:I.target.value}),placeholder:"Food Truck Deluxe",className:"bg-white/10 border-white/20 text-white","data-testid":"input-vendor-name"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Booth Number"}),e.jsx(le,{value:x.boothNumber,onChange:I=>k({...x,boothNumber:I.target.value}),placeholder:"A1",className:"bg-white/10 border-white/20 text-white","data-testid":"input-vendor-booth"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Category"}),e.jsx(le,{value:x.category,onChange:I=>k({...x,category:I.target.value}),placeholder:"Food",className:"bg-white/10 border-white/20 text-white","data-testid":"input-vendor-category"})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Zone"}),e.jsxs(Oe,{value:x.zoneId||"none",onValueChange:I=>k({...x,zoneId:I==="none"?"":I}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-vendor-zone",children:e.jsx($e,{placeholder:"Select zone (optional)"})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"none",children:"No Zone"}),(be=R==null?void 0:R.zones)==null?void 0:be.map(I=>e.jsx(ae,{value:I.id,children:I.name},I.id))]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Sponsor Tier"}),e.jsxs(Oe,{value:x.sponsorTier||"none",onValueChange:I=>k({...x,sponsorTier:I==="none"?"":I}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-sponsor-tier",children:e.jsx($e,{placeholder:"None"})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"none",children:"None"}),e.jsx(ae,{value:"platinum",children:"Platinum"}),e.jsx(ae,{value:"gold",children:"Gold"}),e.jsx(ae,{value:"silver",children:"Silver"}),e.jsx(ae,{value:"bronze",children:"Bronze"})]})]})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>c(!1),className:"border-white/20 text-white",children:"Cancel"}),e.jsx(z,{onClick:()=>J.mutate(x),disabled:!x.name||J.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-submit-add-vendor",children:"Add Vendor"})]})]})}),e.jsx(Me,{open:i,onOpenChange:u,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white",children:[e.jsxs(Ue,{children:[e.jsx(qe,{children:"Add Page"}),e.jsx(Ke,{className:"text-gray-400",children:"Add a page to your event program."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Page Number"}),e.jsx(le,{type:"number",value:D.pageNumber,onChange:I=>K({...D,pageNumber:parseInt(I.target.value)||1}),className:"bg-white/10 border-white/20 text-white","data-testid":"input-page-number"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Page Type"}),e.jsxs(Oe,{value:D.pageType,onValueChange:I=>K({...D,pageType:I}),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"select-page-type",children:e.jsx($e,{})}),e.jsxs(Ve,{className:"bg-[#1E293B] border-white/20",children:[e.jsx(ae,{value:"cover",children:"Cover Page"}),e.jsx(ae,{value:"map",children:"Zone Map"}),e.jsx(ae,{value:"vendor_list",children:"Vendor Directory"}),e.jsx(ae,{value:"schedule",children:"Schedule"}),e.jsx(ae,{value:"sponsors",children:"Sponsors"}),e.jsx(ae,{value:"custom",children:"Custom Content"})]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white",children:"Title"}),e.jsx(le,{value:D.title,onChange:I=>K({...D,title:I.target.value}),placeholder:"Welcome to the Festival",className:"bg-white/10 border-white/20 text-white","data-testid":"input-page-title"})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>u(!1),className:"border-white/20 text-white",children:"Cancel"}),e.jsx(z,{onClick:()=>Z.mutate(D),disabled:Z.isPending,className:"bg-accent hover:bg-accent/90 text-black","data-testid":"btn-submit-add-page",children:"Add Page"})]})]})})]})}const ms=[{id:"9:16",name:"Vertical",ratio:"9/16",width:1080,height:1920,platform:"TikTok, Reels, Shorts",icon:"ð±"},{id:"16:9",name:"Landscape",ratio:"16/9",width:1920,height:1080,platform:"YouTube, TV",icon:"ð¥ï¸"},{id:"1:1",name:"Square",ratio:"1/1",width:1080,height:1080,platform:"Instagram, Facebook",icon:"â¬"},{id:"4:5",name:"Portrait",ratio:"4/5",width:1080,height:1350,platform:"Instagram Feed",icon:"ð·"},{id:"4:3",name:"Standard",ratio:"4/3",width:1440,height:1080,platform:"Traditional Video",icon:"ðº"},{id:"21:9",name:"Cinematic",ratio:"21/9",width:2560,height:1080,platform:"Widescreen Film",icon:"ð¬"},{id:"2:3",name:"Tall Portrait",ratio:"2/3",width:1080,height:1620,platform:"Pinterest",icon:"ð"}],Se={luxury:{id:"luxury",name:"Luxury Escape",description:"Elegant high-end travel experience",colors:{primary:"#D4AF37",secondary:"#000000",text:"#FFFFFF",accent:"#C0A040"},font:"Playfair Display",music:"Classical Piano",transitions:"Elegant Fade",icon:"ð",category:"lifestyle"},backpacker:{id:"backpacker",name:"Backpacker",description:"Authentic budget travel vibes",colors:{primary:"#FF6B35",
107secondary:"#004E89",text:"#FFFFFF",accent:"#F7C59F"},font:"Montserrat",music:"Indie Folk",transitions:"Quick Cuts",icon:"ð",category:"travel"},nightlife:{id:"nightlife",name:"Nightlife",description:"Vibrant party and club scenes",colors:{primary:"#FF00FF",secondary:"#00FFFF",text:"#FFFFFF",accent:"#FF69B4"},font:"Futura",music:"Electronic Dance",transitions:"Strobe Flash",icon:"ð",category:"lifestyle"},adventure:{id:"adventure",name:"Adventure",description:"Thrilling outdoor experiences",colors:{primary:"#00A86B",secondary:"#FFA500",text:"#FFFFFF",accent:"#228B22"},font:"Bebas Neue",music:"Epic Orchestral",transitions:"Dynamic Zoom",icon:"ðï¸",category:"nature"},classic:{id:"classic",name:"Classic",description:"Clean and versatile style",colors:{primary:"#FFFFFF",secondary:"#000000",text:"#FFFFFF",accent:"#888888"},font:"Inter",music:"Upbeat Pop",transitions:"Smooth Slide",icon:"â¨",category:"general"},foodie:{id:"foodie",name:"Foodie",description:"Delicious culinary adventures",colors:{primary:"#E74C3C",secondary:"#F39C12",text:"#FFFFFF",accent:"#D35400"},font:"Lora",music:"Upbeat Jazz",transitions:"Smooth Pan",icon:"ð½ï¸",category:"lifestyle"},wellness:{id:"wellness",name:"Wellness & Spa",description:"Relaxing retreat experiences",colors:{primary:"#9B59B6",secondary:"#3498DB",text:"#FFFFFF",accent:"#E8DAEF"},font:"Quicksand",music:"Ambient Nature",transitions:"Gentle Fade",icon:"ð§",category:"lifestyle"},cultural:{id:"cultural",name:"Cultural Heritage",description:"Rich history and traditions",colors:{primary:"#8B4513",secondary:"#DAA520",text:"#FFFFFF",accent:"#CD853F"},font:"Cormorant Garamond",music:"World Music",transitions:"Cross Dissolve",icon:"ðï¸",category:"travel"},family:{id:"family",name:"Family Fun",description:"Kid-friendly adventures",colors:{primary:"#3498DB",secondary:"#E74C3C",text:"#FFFFFF",accent:"#F1C40F"},font:"Nunito",music:"Playful Pop",transitions:"Bounce In",icon:"ð¨âð©âð§âð¦",category:"travel"},romantic:{id:"romantic",name:"Romantic Getaway",description:"Love and couple travels",colors:{primary:"#E91E63",secondary:"#9C27B0",text:"#FFFFFF",accent:"#FCE4EC"},font:"Dancing Script",music:"Romantic Acoustic",transitions:"Soft Blur",icon:"ð",category:"lifestyle"},minimalist:{id:"minimalist",name:"Minimalist",description:"Clean and modern aesthetic",colors:{primary:"#2C3E50",secondary:"#ECF0F1",text:"#FFFFFF",accent:"#95A5A6"},font:"Helvetica Neue",music:"Lo-Fi Beats",transitions:"Simple Cut",icon:"â»ï¸",category:"general"},vintage:{id:"vintage",name:"Vintage",description:"Retro nostalgic feel",colors:{primary:"#D4A574",secondary:"#8B7355",text:"#FFF8E7",accent:"#C19A6B"},font:"Courier Prime",music:"Oldies Acoustic",transitions:"Film Flicker",icon:"ð»",category:"general"},urban:{id:"urban",name:"Urban Explorer",description:"City streets and architecture",colors:{primary:"#34495E",secondary:"#1ABC9C",text:"#FFFFFF",accent:"#16A085"},font:"Oswald",music:"Hip-Hop Beats",transitions:"Street Slide",icon:"ðï¸",category:"travel"},beach:{id:"beach",name:"Beach Paradise",description:"Tropical ocean vibes",colors:{primary:"#00CED1",secondary:"#FFD700",text:"#FFFFFF",accent:"#20B2AA"},font:"Pacifico",music:"Tropical House",transitions:"Wave Wipe",icon:"ðï¸",category:"nature"},mountain:{id:"mountain",name:"Mountain Majesty",description:"Peaks and alpine scenery",colors:{primary:"#2E8B57",secondary:"#87CEEB",text:"#FFFFFF",accent:"#4682B4"},font:"Raleway",music:"Cinematic Strings",transitions:"Altitude Rise",icon:"â°ï¸",category:"nature"}},ac=["ð","â","â¤ï¸","ð¥","âï¸","ðºï¸","ð¸","ð¬","ð","ð«"],Os=[{type:"none",name:"None",icon:"â",description:"No transition"},{type:"fade",name:"Fade",icon:"ð
",description:"Smooth fade in/out"},{type:"zoom",name:"Zoom",icon:"ð",description:"Zoom in effect"},{type:"slide-left",name:"Slide Left",icon:"â¬
ï¸",description:"Slide from right to left"},{type:"slide-right",name:"Slide Right",icon:"â¡ï¸",description:"Slide from left to right"},{type:"slide-up",name:"Slide Up",icon:"â¬ï¸",description:"Slide from bottom to top"},{type:"slide-down",name:"Slide Down",icon:"â¬ï¸",description:"Slide from top to bottom"},{type:"wipe",name:"Wipe",icon:"ð§¹",description:"Wipe transition"},{type:"dissolve",name:"Dissolve",icon:"â¨",description:"Cross dissolve"},{type:"blur",name:"Blur",icon:"ð«",description:"Blur transition"}],xs=[{type:"none",name:"None",css:"none",preview:"Original"},{type:"vintage",name:"Vintage",css:"sepia(0.4) contrast(1.1) brightness(0.95) saturate(0.9)",preview:"ðï¸"},{type:"sepia",name:"Sepia",css:"sepia(0.8)",preview:"ð"},{type:"warm",name:"Warm",css:"sepia(0.2) saturate(1.2) brightness(1.05)",preview:"âï¸"},{type:"cool",name:"Cool",css:"saturate(0.9) hue-rotate(10deg) brightness(1.05)",preview:"âï¸"},{type:"dramatic",name:"Dramatic",css:"contrast(1.3) saturate(1.2) brightness(0.9)",preview:"ð"},{type:"noir",name:"Noir",css:"grayscale(1) contrast(1.2) brightness(0.9)",preview:"ð¤"},{type:"vivid",name:"Vivid",css:"saturate(1.5) contrast(1.1) brightness(1.05)",preview:"ð"},{type:"muted",name:"Muted",css:"saturate(0.6) contrast(0.95) brightness(1.05)",preview:"ð«ï¸"},{type:"sunset",name:"Sunset",css:"sepia(0.3) saturate(1.4) hue-rotate(-10deg) brightness(1.05)",preview:"ð
"},{type:"ocean",name:"Ocean",css:"saturate(1.1) hue-rotate(20deg) brightness(1.05)",preview:"ð"},{type:"forest",name:"Forest",css:"saturate(1.2) hue-rotate(30deg) brightness(0.95)",preview:"ð²"},{type:"cinematic",name:"Cinematic",css:"contrast(1.15) saturate(0.95) brightness(0.95)",preview:"ð¬"}],$s=[{type:"none",name:"None",icon:"â",css:""},{type:"blur",name:"Blur",icon:"ð",css:"blur(2px)"},{type:"sharpen",name:"Sharpen",icon:"ðª",css:"contrast(1.2)"},{type:"grain",name:"Film Grain",icon:"ð½ï¸",css:""},{type:"glow",name:"Glow",icon:"â¨",css:"brightness(1.1) contrast(0.95)"},{type:"vignette",name:"Vignette",icon:"ð²",css:""},{type:"lens-flare",name:"Lens Flare",icon:"ð¡",css:""},{type:"light-leak",name:"Light Leak",icon:"ð",css:""},{type:"dust",name:"Dust & Scratches",icon:"ðï¸",css:""},{type:"glitch",name:"Glitch",icon:"ðº",css:""}],us={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,highlights:0,shadows:0,vignette:0},Tt={type:"none",duration:.5},ic=[{id:"upbeat-1",name:"Summer Vibes",artist:"Studio Sounds",duration:180,category:"upbeat",mood:["happy","energetic"],bpm:120,isCustom:!1},{id:"upbeat-2",name:"Good Morning",artist:"Melody House",duration:150,category:"upbeat",mood:["cheerful","bright"],bpm:115,isCustom:!1},{id:"upbeat-3",name:"Happy Days",artist:"Sunny Beats",duration:195,category:"upbeat",mood:["fun","playful"],bpm:128,isCustom:!1},{id:"chill-1",name:"Sunset Dreams",artist:"Lo-Fi Collective",duration:240,category:"chill",mood:["relaxed","peaceful"],bpm:85,isCu
107stom:!1},{id:"chill-2",name:"Ocean Breeze",artist:"Calm Waters",duration:210,category:"chill",mood:["serene","tranquil"],bpm:75,isCustom:!1},{id:"chill-3",name:"Late Night Coffee",artist:"Lo-Fi Collective",duration:185,category:"chill",mood:["cozy","mellow"],bpm:80,isCustom:!1},{id:"cinematic-1",name:"Epic Journey",artist:"Orchestra One",duration:300,category:"cinematic",mood:["inspiring","grand"],bpm:90,isCustom:!1},{id:"cinematic-2",name:"New Horizons",artist:"Film Score Lab",duration:270,category:"cinematic",mood:["hopeful","uplifting"],bpm:95,isCustom:!1},{id:"cinematic-3",name:"Rising Sun",artist:"Orchestra One",duration:220,category:"cinematic",mood:["emotional","powerful"],bpm:85,isCustom:!1},{id:"ambient-1",name:"Floating",artist:"Atmosphere",duration:360,category:"ambient",mood:["dreamy","ethereal"],bpm:60,isCustom:!1},{id:"ambient-2",name:"Forest Whispers",artist:"Nature Sounds",duration:300,category:"ambient",mood:["natural","calm"],bpm:55,isCustom:!1},{id:"ambient-3",name:"Deep Space",artist:"Cosmos Audio",duration:420,category:"ambient",mood:["mysterious","vast"],bpm:50,isCustom:!1},{id:"adventure-1",name:"Expedition",artist:"Action Tracks",duration:165,category:"adventure",mood:["exciting","bold"],bpm:135,isCustom:!1},{id:"adventure-2",name:"Mountain Peak",artist:"Epic Sounds",duration:195,category:"adventure",mood:["triumphant","heroic"],bpm:130,isCustom:!1},{id:"romantic-1",name:"First Kiss",artist:"Love Songs Co",duration:210,category:"romantic",mood:["tender","sweet"],bpm:72,isCustom:!1},{id:"romantic-2",name:"Candlelight",artist:"Acoustic Hearts",duration:240,category:"romantic",mood:["intimate","warm"],bpm:68,isCustom:!1},{id:"dramatic-1",name:"Tension Rising",artist:"Suspense Studios",duration:180,category:"dramatic",mood:["intense","suspenseful"],bpm:100,isCustom:!1},{id:"dramatic-2",name:"Dark Clouds",artist:"Moody Music",duration:200,category:"dramatic",mood:["ominous","brooding"],bpm:88,isCustom:!1},{id:"electronic-1",name:"Neon Nights",artist:"Synth Wave",duration:210,category:"electronic",mood:["energetic","modern"],bpm:128,isCustom:!1},{id:"electronic-2",name:"Digital Dreams",artist:"Future Bass",duration:185,category:"electronic",mood:["futuristic","vibrant"],bpm:140,isCustom:!1}],Rr=[{id:"upbeat",name:"Upbeat",icon:"ð",description:"Happy & energetic tracks"},{id:"chill",name:"Chill",icon:"â",description:"Relaxed & mellow vibes"},{id:"cinematic",name:"Cinematic",icon:"ð¬",description:"Epic orchestral scores"},{id:"ambient",name:"Ambient",icon:"ð",description:"Atmospheric soundscapes"},{id:"adventure",name:"Adventure",icon:"ðï¸",description:"Bold & exciting tracks"},{id:"romantic",name:"Romantic",icon:"ð",description:"Sweet & tender melodies"},{id:"dramatic",name:"Dramatic",icon:"ð",description:"Intense & suspenseful"},{id:"electronic",name:"Electronic",icon:"ð§",description:"Modern beats & synths"}],rc=p=>{const P=[];if(p.brightness!==0&&P.push(`brightness(${1+p.brightness/100})`),p.contrast!==0&&P.push(`contrast(${1+p.contrast/100})`),p.saturation!==0&&P.push(`saturate(${1+p.saturation/100})`),p.temperature!==0&&(p.temperature>0?P.push(`sepia(${p.temperature/200})`):P.push(`hue-rotate(${p.temperature/5}deg)`)),p.tint!==0&&P.push(`hue-rotate(${p.tint/2}deg)`),p.highlights!==0){const l=1+p.highlights/300;P.push(`brightness(${l})`)}if(p.shadows!==0){const l=1+p.shadows/200;P.push(`contrast(${l})`)}return P.length>0?P.join(" "):"none"},la=p=>{const P=xs.find(o=>o.type===p.filter),l=rc(p.colorGrading),_=$s.find(o=>o.type===p.effect),b=[];return P&&P.css!=="none"&&b.push(P.css),l!=="none"&&b.push(l),_&&_.css&&b.push(_.css),b.length>0?b.join(" "):"none"};function $a({data:p,width:P,height:l,color:_="#3B82F6",className:b=""}){const o=$.useRef(null);return $.useEffect(()=>{const c=o.current;if(!c)return;const i=c.getContext("2d");if(!i)return;i.clearRect(0,0,P,l);const u=p||Array.from({length:50},()=>Math.random()*.8+.2),r=P/u.length,d=l/2;i.fillStyle=_,u.forEach((j,s)=>{const m=j*l*.8,y=s*r,h=d-m/2;i.beginPath(),i.roundRect(y+1,h,r-2,m,1),i.fill()})},[p,P,l,_]),e.jsx("canvas",{ref:o,width:P,height:l,className:b})}function nc({clip:p,isSelected:P,onSelect:l,onTrim:_,onSplit:b,formatTime:o,pixelsPerSecond:c}
107){const{attributes:i,listeners:u,setNodeRef:r,transform:d,transition:j,isDragging:s}=hn({id:p.id}),m={transform:mn.Transform.toString(d),transition:j,width:`${Math.max(p.clipDuration*c,60)}px`};return e.jsxs("div",{ref:r,style:m,className:`relative h-20 rounded-lg border-2 overflow-hidden cursor-pointer transition-all flex-shrink-0 ${s?"opacity-50 z-50":""} ${P?"border-accent ring-2 ring-accent/50":"border-white/20 hover:border-white/40"}`,onClick:l,"data-testid":`timeline-clip-${p.id}`,children:[e.jsxs("div",{...i,...u,className:"absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-black/60 to-transparent flex items-center px-2 cursor-grab active:cursor-grabbing z-10",children:[e.jsx(ba,{className:"w-3 h-3 text-white/70 mr-1"}),e.jsx("span",{className:"text-xs text-white truncate flex-1",children:p.mediaItem.name})]}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-gray-800 to-gray-700",children:p.mediaItem.type==="video"?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Ct,{className:"w-6 h-6 text-blue-400"})}):e.jsx("img",{src:p.mediaItem.thumbnail,alt:"",className:"w-full h-full object-cover opacity-60"})}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 h-6 bg-gradient-to-t from-black/80 to-transparent flex items-center justify-between px-2",children:[e.jsx("span",{className:"text-xs text-white/80 font-mono",children:o(p.clipDuration)}),e.jsx("div",{className:"flex gap-1",children:p.mediaItem.type==="video"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:y=>{y.stopPropagation(),_()},className:"p-1 hover:bg-white/20 rounded transition-colors",title:"Trim clip",children:e.jsx(Wa,{className:"w-3 h-3 text-white"})}),e.jsx("button",{onClick:y=>{y.stopPropagation(),b()},className:"p-1 hover:bg-white/20 rounded transition-colors",title:"Split clip",children:e.jsx(Qe,{className:"w-3 h-3 text-white rotate-45"})})]})})]}),p.mediaItem.trimStart>0||p.mediaItem.trimEnd<p.mediaItem.originalDuration?e.jsx("div",{className:"absolute top-1 right-1 bg-yellow-500/80 text-black text-xs px-1 rounded",children:"Trimmed"}):null,p.mediaItem.transitionIn&&p.mediaItem.transitionIn.type!=="none"&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-3 bg-gradient-to-r from-green-500/60 to-transparent flex items-center justify-center",title:`Transition In: ${p.mediaItem.transitionIn.type}`,children:e.jsx("span",{className:"text-xs",children:"â·"})}),p.mediaItem.transitionOut&&p.mediaItem.transitionOut.type!=="none"&&e.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-3 bg-gradient-to-l from-orange-500/60 to-transparent flex items-center justify-center",title:`Transition Out: ${p.mediaItem.transitionOut.type}`,children:e.jsx("span",{className:"text-xs",children:"â"})}),(p.mediaItem.filter!=="none"||p.mediaItem.effect!=="none")&&e.jsxs("div",{className:"absolute top-6 right-1 flex gap-0.5",children:[p.mediaItem.filter!=="none"&&e.jsx("span",{className:"bg-purple-500/80 w-2 h-2 rounded-full",title:`Filter: ${p.mediaItem.filter}`}),p.mediaItem.effect!=="none"&&e.jsx("span",{className:"bg-blue-500/80 w-2 h-2 rounded-full",title:`Effect: ${p.mediaItem.effect}`})]})]})}function Ad(){var Pi,Ri,zi,Di,Oi,Bi,$i,Mi,Li,Ui,qi,Vi,Gi,Hi,Ki,Wi,Zi,Qi,Yi,Ji,Xi;const{user:p}=Br(),{toast:P}=ct(),[,l]=Dl(),_=new URLSearchParams(window.location.search),b=_.get("inspired_by"),o=_.get("location"),c=_.get("route_id"),i=_.get("tab"),[u,r]=$.useState(i||"slides"),[d,j]=$.useState([]),[s,m]=$.useState(null),[y,h]=$.useState(!1),[f,g]=$.useState(!1),[v,x]=$.useState(!1),[k,D]=$.useState(!1),[K,U]=$.useState("text"),[Q,R]=$.useState(""),[O,ne]=$.useState("classic"),[C,W]=$.useState("9:16"),[n,S]=$.useState("all"),[oe,J]=$.useState(!1),[xe,Z]=$.useState(!1),[Y,L]=$.useState("side-by-side"),[F,he]=$.useState([]),[ie,te]=$.useState(""),[Fe,He]=$.useState(!1),[we,be]=$.useState(!1),[I,me]=$.useState(!1),[ke,A]=$.useState(!1),[a,V]=$.useState(0),M=$.useRef(null),N=$.useRef(null),w=$.useRef([]),B=$.useRef(null);$.useEffect(()=>{(b||o||c)&&d.length===0&&A(!0)},[b,o,c,d.length]);const[X,ee]=$.useState(!1),[G,se]=$.useState(0),[de,re]=$.useState(0),[pe,Ge]=$.useState(!1),[Ae,jt]=$.useState(0),[rs,Nt]=$.useState(0),[Ut,Je]=$.useState(!1),[ns,Et]=$.useState(!1),kt=$.useRef(null),[Wt,Ns]=$.useState(!1),[ja,va]=$.useState("filters"),[Zt,It]=$.useState(!1),[qt,Ya]=$.useState(!1),[vn,wa]=$.useState(null),[Ja,Xa]=$.useState(""),[ya,ei]=$.useState(!1),[Vs,ti]=$.useState("all"),[ks,wn]=$.useState(""),[lc,oc]=$.useState(null),[Ee,pt]=$.useState(null),[si,ai]=$.useState([]);$.useRef(null);const ii=$.useRef(null),[yn,Gs]=$.useState(!1),[Nn,Hs]=$.useState(!1),[Cs,ri]=$.useState(""),[ni,li]=$.useState(""),[ls,Ss]=$.useState("private"),[Na,oi]=$.useState(!1),[ka,ci]=$.useState(!1),[_s,Qt]=$.useState([]),[Pe,gt]=$.useState({masterVolume:100,originalAudioVolume:100,originalAudioMuted:!1,duckingEnabled:!1,duckingAmou
107nt:50,duckingThreshold:30,duckingAttack:100,duckingRelease:500}),[Ks,kn]=$.useState("mixer"),[Ws,di]=$.useState(!1),[Cn,hi]=$.useState(!1),[Sn,mi]=$.useState(!1),[yt,ui]=$.useState("photo"),[os,Zs]=$.useState(""),[Ca,_n]=$.useState("all"),[dt,Qs]=$.useState(null),[Ts,Ys]=$.useState(!1),[Js,Tn]=$.useState(1),[Xs,xi]=$.useState(new Set),[pi,gi]=$.useState("reel"),[Fn,An]=$.useState(!0),[Vt,fi]=$.useState(!1),[bi,Yt]=$.useState(0),[ji,En]=$.useState(null),[Jt,In]=$.useState(null),[Pt,Pn]=$.useState(new Set),[vi,Rn]=$.useState(""),[ea,wi]=$.useState(!1),[yi,Ni]=$.useState([]),zn=_.get("welcome"),{data:Fs=[]}=We({queryKey:[`/api/commissions/campaigns/creator/${p==null?void 0:p.id}`],enabled:!!(p!=null&&p.id)}),{data:Dn=[],isLoading:On}=We({queryKey:["/api/social-accounts"],enabled:!!p}),As=Dn.filter(t=>t.status==="connected"),ki={instagram:{icon:fs,color:"#E4405F",name:"Instagram"},tiktok:{icon:ss,color:"#000000",name:"TikTok"},youtube:{icon:Ms,color:"#FF0000",name:"YouTube"},facebook:{icon:ua,color:"#1877F2",name:"Facebook"},twitter:{icon:ma,color:"#1DA1F2",name:"Twitter"},linkedin:{icon:Jr,color:"#0A66C2",name:"LinkedIn"}},Bn=t=>{Pn(T=>{const E=new Set(T);return E.has(t)?E.delete(t):E.add(t),E})},$n=async()=>{var H,ce;if(Pt.size===0){P({title:"No platforms selected",description:"Please select at least one platform to publish to",variant:"destructive"});return}if(!Jt&&d.length===0){P({title:"No content to publish",description:"Please export your content first before publishing",variant:"destructive"});return}wi(!0),Ni([]);const t=[],T=Array.from(Pt);for(const ue of T)try{const ye=As.find(_e=>_e.platform===ue);if(!ye){t.push({platform:ue,success:!1,error:"Account not connected"});continue}const Ye=await(await fetch("/api/social-accounts/publish",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({connectionId:ye.id,platform:ue,mediaUrl:Jt||((H=d[0])==null?void 0:H.url),mediaType:((ce=d[0])==null?void 0:ce.type)==="video"?"video":"image",caption:vi||ie,hashtags:F})})).json();Ye.success?t.push({platform:ue,success:!0}):t.push({platform:ue,success:!1,error:Ye.error||"Publishing failed"})}catch(ye){t.push({platform:ue,success:!1,error:ye.message||"Network error"})}Ni(t),wi(!1);const E=t.filter(ue=>ue.success).length;E>0?P({title:"Published successfully!",description:`Published to ${E} of ${t.length} platforms`}):P({title:"Publishing failed",description:"Could not publish to any platform. Check your connections.",variant:"destructive"})},Mn=tn(ga(rn,{activationConstraint:{distance:8}}),ga(an,{coordinateGetter:sn})),ta=t=>t.trimEnd-t.trimStart,Ln=()=>d.reduce((t,T)=>t+ta(T),0),Ci=(()=>{let t=0;return[...d].sort((T,E)=>T.orderIndex-E.orderIndex).map(T=>{const E=ta(T),H={id:T.id,mediaItem:T,startTime:t,endTime:t+E,clipDuration:E};return t+=E,H})})(),Xt=Ln(),Un=t=>{const{active:T,over:E}=t;E&&T.id!==E.id&&j(H=>{const ce=H.findIndex(Ne=>Ne.id===T.id),ue=H.findIndex(Ne=>Ne.id===E.id);return dn(H,ce,ue).map((Ne,Ye)=>({...Ne,orderIndex:Ye}))})},cs=(t,T,E)=>{j(H=>H.map(ce=>ce.id===t?{...ce,trimStart:T,trimEnd:E}:ce)),(s==null?void 0:s.id)===t&&m(H=>H?{...H,trimStart:T,trimEnd:E}:null)},qn=(t,T)=>{const E=d.find(Ne=>Ne.id===t);if(!E||E.type!=="video")return;const H=E.trimStart+T;if(H<=E.trimStart||H>=E.trimEnd){P({title:"Cannot split here",description:"Split point must be within the clip",variant:"destructive"});return}const ce=Math.random().toString(36).substr(2,9),ue={...E,trimEnd:H},ye={...E,id:ce,sourceId:E.sourceId,trimStart:H,name:`${E.name} (part 2)`,orderIndex:E.orderIndex+1,overlays:[]};j(Ne=>{const Ye=Ne.findIndex(Ce=>Ce.id===t),_e=[...Ne];return _e[Ye]=ue,_e.splice(Ye+1,0,ye),_e.map((Ce,ot)=>({...Ce,orderIndex:ot}))}),Et(!1),P({title:"Clip split",description:"Clip has been divided into two parts"})},Si=(t,T)=>{j(E=>E.map(H=>H.id===t?{...H,transitionIn:T}:H)),(s==null?void 0:s.id)===t&&m(E=>E?{...E,transitionIn:T}:null)},_i=(t,T)=>{j(E=>E.map(H=>H.id===t?{...H,transitionOut:T}:H)),(s==null?void 0:s.id)===t&&m(E=>E?{...E,transitionOut:T}:null)},Ti=(t,T)=>{j(E=>E.map(H=>H.id===t?{...H,filter:T}:H)),(s==null?void 0:s.id)===t&&m(E=>E?{...E,filter:T}:null)},Rt=(t,T)=>{j(E=>E.map(H=>H.id===t?{...H,colorGrading:{...H.colorGrading,...T}}:H)),(s==null?void 0:s.id)===t&&m(E=>E?{...E,colorGrading:{...E.colorGrading,...T}}:null)},Fi=(t,T)=>{j(E=>E.map(H=>H.id===t?{...H,effect:T}:H)),(s==null?void 0:s.id)===t&&m(E=>E?{...E,effect:T}:null)},Vn=t=>{Rt(t,us)},Gn=t=>{var T;j(E=>E.map(H=>({...H,filter:t}))),s&&m(E=>E?{...E,filter:t}:null),P({title:"Filter applied",description:`Applied "${(T=xs.find(E=>E.type===t))==null?void 0:T.name}" to all clips`})},Hn=(t,T)=>{var E;j(H=>H.map(ce=>({...ce,transitionIn:t,transitionOut:t}))),P({title:"Transition applied",description:`Applied "${(E=Os.find(H=>H.type===t.type))==null?void 0:E.name}" to all clips`})},[Sa,Kn]=$.useState(""),[Es,_a]=$.useState(["instagram_carousel"]),[dc,Wn]=$.useState(null),[Ta,Zn]=$.useState(null),[Fa,Is]=$.useState(!1),es=$.useRef(null),{data:_t}=We({queryKey:["/api/routes"]}),Aa=je({mutationFn:async t=>{const T=t.platforms.map(H=>H==="instagram_carousel"?"carousel":H==="tiktok_reel"?"reel":H==="youtube_thumbnail"?"thumbnail":"general"),E=await fetch("/api/batch-content/create",{method:"POST",body:JSON.stringify({routeId:t.routeId,platforms:t.platforms,contentTypes:T}),headers:{"Content-Type":"application/json"}});if(!E.ok){const H=await E.json().catch(()=>({message:"Failed to generate batch content"}));throw new Error(H.message||"Failed to generate batch content")}return E.json()},onSuccess:t=>{Wn(t.id),P({title:"Content Generation Started!",description:"Your content is being generated
107with AI..."}),Qn(t.id)},onError:t=>{P({title:"Generation failed",description:t.message||"Could not generate batch content",variant:"destructive"})}}),Qn=async t=>{Is(!0);const T=async()=>{try{const ce=await fetch(`/api/batch-content/jobs/${t}`);if(!ce.ok)throw new Error(`Server returned ${ce.status}: ${ce.statusText}`);const ue=await ce.json();return ue.status==="completed"?(Zn(ue.generatedContent),Is(!1),P({title:"Content Generated!",description:`Created ${ue.completedPieces||0} pieces of content`}),!0):ue.status==="failed"?(Is(!1),P({title:"Generation Failed",description:ue.error||"An error occurred during generation",variant:"destructive"}),!0):!1}catch(ce){return console.error("Error polling job status:",ce),Is(!1),P({title:"Polling Error",description:ce instanceof Error?ce.message:"Failed to check generation status",variant:"destructive"}),!0}},E=60;let H=0;es.current=setInterval(async()=>{H++;const ce=await T();(ce||H>=E)&&(es.current&&(clearInterval(es.current),es.current=null),H>=E&&!ce&&(Is(!1),P({title:"Timeout",description:"Content generation is taking longer than expected",variant:"destructive"})))},2e3)};$.useEffect(()=>()=>{es.current&&(clearInterval(es.current),es.current=null)},[]);const Yn=t=>{const T=t.target.files;T&&(Array.from(T).forEach((E,H)=>{const ce=URL.createObjectURL(E),ue=E.type.startsWith("video/")?"video":"image",ye=Math.random().toString(36).substr(2,9),Ne=ue==="image"?5:0,Ye={id:ye,sourceId:ye,type:ue,url:ce,thumbnail:ce,name:E.name,duration:Ne,originalDuration:Ne,trimStart:0,trimEnd:Ne,orderIndex:0,overlays:[],transitionIn:{...Tt},transitionOut:{...Tt},filter:"none",colorGrading:{...us},effect:"none",captions:[]};if(ue==="video"){const _e=URL.createObjectURL(E),Ce=document.createElement("video");Ce.preload="metadata",Ce.onloadedmetadata=()=>{const ot=Ce.duration;j(it=>it.map(et=>et.id===ye?{...et,duration:ot,originalDuration:ot,trimEnd:ot}:et)),URL.revokeObjectURL(_e)},Ce.onerror=()=>{URL.revokeObjectURL(_e)},Ce.src=_e}j(_e=>[..._e,{...Ye,orderIndex:_e.length}])}),t.target.value="")},Jn=t=>{t.preventDefault();const T=t.dataTransfer.files;Array.from(T).forEach((E,H)=>{const ce=URL.createObjectURL(E),ue=E.type.startsWith("video/")?"video":"image",ye=Math.random().toString(36).substr(2,9),Ne=ue==="image"?5:0,Ye={id:ye,sourceId:ye,type:ue,url:ce,thumbnail:ce,name:E.name,duration:Ne,originalDuration:Ne,trimStart:0,trimEnd:Ne,orderIndex:0,overlays:[],transitionIn:{...Tt},transitionOut:{...Tt},filter:"none",colorGrading:{...us},effect:"none",captions:[]};if(ue==="video"){const _e=URL.createObjectURL(E),Ce=document.createElement("video");Ce.preload="metadata",Ce.onloadedmetadata=()=>{const ot=Ce.duration;j(it=>it.map(et=>et.id===ye?{...et,duration:ot,originalDuration:ot,trimEnd:ot}:et)),URL.revokeObjectURL(_e)},Ce.onerror=()=>{URL.revokeObjectURL(_e)},Ce.src=_e}j(_e=>[..._e,{...Ye,orderIndex:_e.length}])})},Xn=t=>{t.forEach(T=>{const E=T.preview,H=T.id,ce=T.type==="image"?5:T.duration||0,ue={id:H,sourceId:H,type:T.type,url:E,thumbnail:E,name:`[${T.sourceName}] ${T.originalFilename}`,duration:ce,originalDuration:ce,trimStart:0,trimEnd:ce,orderIndex:0,overlays:[],transitionIn:{...Tt},transitionOut:{...Tt},filter:"none",colorGrading:{...us},effect:"none",captions:[]};if(T.type==="video"){const ye=document.createElement("video");ye.preload="metadata",ye.onloadedmetadata=()=>{const Ne=ye.duration;j(Ye=>Ye.map(_e=>_e.id===H?{..._e,duration:Ne,originalDuration:Ne,trimEnd:Ne}:_e))},ye.src=E}j(ye=>[...ye,{...ue,orderIndex:ye.length}])})},el=t=>{W("9:16"),P({title:`${t.name} template applied!`,description:`Format set to 9:16 vertical. ${t.description}`})},tl=async()=>{if(!s){P({title:"No media selected",description:"Select a clip to add voice narration",variant:"destructive"});return}try{const t=await navigator.mediaDevices.getUserMedia({audio:!0}),T=new MediaRecorder(t);N.current=T,w.current=[],T.ondataavailable=E=>{w.current.push(E.data)},T.onstop=()=>{const E=new Blob(w.current,{type:"audio/wav"}),H={id:Math.random().toString(36).substr(2,9),audioBlob:E,duration:0};j(ce=>ce.map(ue=>ue.id===s.id?{...ue,voiceOverlay:H}:ue)),m(ce=>ce?{...ce,voiceOverlay:H}:null),P({title:"Voice recorded",description:"Narration added to clip"})},T.start(),J(!0)}catch{P({title:"Recording failed",description:"Could not access microphone",variant:"destructive"})}},sl=()=>{N.current&&oe&&(N.current.stop(),N.current.stream.getTracks().forEac
107h(t=>t.stop()),J(!1))},al=async()=>{var t;if(d.length===0){P({title:"No media",description:"Upload clips to generate highlight reel",variant:"destructive"});return}Z(!0);try{const T=await fetch("/api/media/generate-highlight-reel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mediaItems:d.map(Ce=>({id:Ce.id,type:Ce.type,name:Ce.name,url:Ce.url})),templateStyle:O})});if(!T.ok){const Ce=await T.json().catch(()=>({error:"Failed to generate highlight reel"}));throw new Error(Ce.error||Ce.details||"Failed to generate highlight reel")}const E=await T.json();if(!E||!E.reelPlan)throw new Error("Invalid response from server");const H=E.reelPlan,ce=Se[O],ue=Array.isArray(H.captions)?H.captions:[],ye=Ce=>({top:15,center:50,bottom:85})[Ce]||85,Ne=(Ce,ot,it)=>Math.max(ot,Math.min(Ce,it)),Ye=d.map((Ce,ot)=>{const it=ue.find(et=>et.clipIndex===ot);if(it&&it.text){const et=Number(it.x),vt=Number.isFinite(et)?et:50,Rs={id:Math.random().toString(36).substr(2,9),type:"text",content:it.text,x:Ne(vt,0,100),y:Ne(ye(it.position||"bottom"),0,100),fontSize:Ne(it.fontSize||32,16,64),color:it.color||ce.colors.text};return{...Ce,overlays:[...Ce.overlays,Rs]}}return Ce});j(Ye),Z(!1),x(!1);const _e=((t=H.overall)==null?void 0:t.title)||"Your Travel Story";P({title:"AI Highlight Reel Generated!",description:`Created ${O} style reel: "${_e}"`}),H.overall&&console.log("AI Reel Plan:",{title:H.overall.title||"Untitled",duration:H.overall.duration||"Unknown",music:H.musicSuggestion||"No music suggested",hook:H.overall.hook||"No hook",cta:H.overall.cta||"No CTA"})}catch(T){console.error("Error generating highlight reel:",T),Z(!1),x(!1),P({title:"Generation Failed",description:T instanceof Error?T.message:"Could not generate highlight reel",variant:"destructive"})}},Ai=()=>
107{if(!s)return;const t=Se[O],T={id:Math.random().toString(36).substr(2,9),type:K,content:K==="text"||K==="location"?Q:"â",x:50,y:50,fontSize:24,color:t.colors.text};j(E=>E.map(H=>H.id===s.id?{...H,overlays:[...H.overlays,T]}:H)),m(E=>E?{...E,overlays:[...E.overlays,T]}:null),R("")},il=t=>{s&&(j(T=>T.map(E=>E.id===s.id?{...E,overlays:E.overlays.filter(H=>H.id!==t)}:E)),m(T=>T?{...T,overlays:T.overlays.filter(E=>E.id!==t)}:null))},rl=t=>{j(T=>T.filter(E=>E.id!==t)),(s==null?void 0:s.id)===t&&m(null)},lt=t=>{const T=Math.floor(t/60),E=Math.floor(t%60);return`${T}:${E.toString().padStart(2,"0")}`},nl=()=>{B.current&&(X?B.current.pause():B.current.play(),ee(!X))},ll=()=>{B.current&&se(B.current.currentTime)},ol=()=>{B.current&&re(B.current.duration)},cl=t=>{const T=parseFloat(t.target.value);B.current&&(B.current.currentTime=T,se(T))},dl=()=>{B.current&&(B.current.currentTime=Math.max(0,B.current.currentTime-10))},hl=()=>{B.current&&(B.current.currentTime=Math.min(de,B.current.currentTime+10))},ml=()=>{B.current&&(B.current.muted=!pe,Ge(!pe))},ul=()=>{ee(!1),se(0),B.current&&(B.current.currentTime=0)};$.useEffect(()=>{ee(!1),se(0),re(0)},[s==null?void 0:s.id]),$.useEffect(()=>{if(B.current){const t=Pe.originalAudioMuted?0:Pe.originalAudioVolume*Pe.masterVolume/1e4;B.current.volume=Math.min(1,Math.max(0,t)),B.current.muted=Pe.originalAudioMuted,Ge(Pe.originalAudioMuted)}},[Pe.originalAudioVolume,Pe.originalAudioMuted,Pe.masterVolume]);const xl=async()=>{h(!0)},pl=async()=>{if(d.length===0){P({title:"No media to export",description:"Please add media files first",variant:"destructive"});return}fi(!0),Yt(0);try{if(d.length===1){const ce=d[0];Yt(50);const ye=await(await fetch(ce.url)).blob(),Ne=ce.type==="video"?"mp4":"jpg",Ye=ce.name.replace(/\.[^/.]+$/,"")||"clip_1";yr.saveAs(ye,`slant_export_${Ye}.${Ne}`),Yt(100),P({title:"Export complete!",description:"Your file has been downloaded"}),h(!1);return}const t=new To,T=t.folder("slant_export");for(let ce=0;ce<d.length;ce++){const ue=d[ce];Yt(Math.round((ce+.5)/d.length*80));const Ye=await(await(await fetch(ue.url)).blob()).arrayBuffer(),_e=ue.type==="video"?"mp4":"jpg",Ce=ue.name.replace(/\.[^/.]+$/,"")||`clip_${ce+1}`,ot=`${String(ce+1).padStart(2,"0")}_${Ce}.${_e}`;T==null||T.file(ot,Ye)}Yt(90);const E=await t.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});Yt(100);const H=new Date().toISOString().slice(0,10);yr.saveAs(E,`slant_export_${H}.zip`),P({title:"Export complete!",description:`Downloaded ${d.length} files as ZIP`}),h(!1)}catch(t){console.error("Export error:",t),P({title:"Export failed",description:"There was an error exporting your media",variant:"destructive"})}finally{fi(!1),Yt(0)}},gl=async()=>{var t,T,E,H,ce,ue,ye,Ne,Ye;if(!p){P({title:"Sign in required",description:"Please sign in to save reels to your profile",variant:"destructive"});return}if(!Cs.trim()){P({title:"Title required",description:"Please enter a title for your reel",variant:"destructive"});return}if(d.length===0){P({title:"No media",description:"Please add at least one image or video to save",variant:"destructive"});return}oi(!0);try{const _e=((t=d[0])==null?void 0:t.url)||null,Ce=await fetch("/api/premium/reels",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({title:Cs.trim(),description:ni.trim()||null,templateId:`template-${O}`,sourceType:"manual",aspectRatio:C,visibility:ls,thumbnailUrl:_e,customizations:{template:O,backgroundMusic:((T=Ee==null?void 0:Ee.track)==null?void 0:T.name)||null,transitionType:((H=(E=d[0])==null?void 0:E.transitionIn)==null?void 0:H.type)||"none"}})});if(!Ce.ok){const et=await Ce.json();throw new Error(et.error||"Failed to save reel")}const ot=await Ce.json(),it=[];for(let et=0;et<d.length;et++){const vt=d[et];try{const Rs=await fetch(`/api/premium/reels/${ot.id}/segments`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({position:et,mediaType:vt.type==="image"?"photo":"video",mediaUrl:vt.url,thumbnailUrl:vt.thumbnail||vt.url,sourceType:"uploaded",durationMs:(vt.duration||3)*1e3,transitionIn:((ce=vt.transitionIn)==null?void 0:ce.type)||"fade",transitionOut:((ue=vt.transitionOut)==null?void 0:ue.type)||"fade",transitionDurationMs:(((ye=vt.transitionIn)==null?void 0:ye.duration)||.5)*1e3,caption:((Ye=(Ne=vt.captions)==null?void 0:Ne[0])==null?void 0:Ye.text)||null,captionStyle:vt.captionSettings?JSON.stringify(vt.captionSettings):null})});if(!Rs.ok){const yl=await Rs.json();it.push(`Clip ${et+1}: ${yl.error||"Failed to save"}`)}}catch{it.push(`Clip ${et+1}: Network error`)}}if(it.length>0&&it.length<d.length)P({title:"Reel saved with warnings",description:`Some clips could not be saved: ${it.join(", ")}`,variant:"destructive"});else{if(it.length===d.length)throw new Error("Failed to save any clips to the reel");P({title:"Reel saved!",description:`Your reel "${Cs}" has been saved to your profile${ls==="public"?" and is now visible to everyone":""}`})}Hs(!1),ri(""),li(""),Ss("private")}catch(_e){console.error("Error saving reel:",_e),P({title:"Failed to save",description:_e.message||"An error occurred while saving your reel",variant:"destructive"})}finally{oi(!1)}},fl=()=>{const t=[];Array.isArray(_t)&&_t.length>0&&_t.forEach(H=>{H.destinations&&H.destinations.length>0&&H.destinations.forEach(ce=>{const ue=ce.name.replace(/\s+/g,"");t.push(`#${ue}`)})});const T={luxury:["#LuxuryTravel","#FiveStarLife","#LuxuryDestinations","#TravelInStyle"],backpacker:["#BackpackerLife","#BudgetTravel","#SoloTravel","#Wanderlust"],nightlife:["#Nightlife","#PartyTravel","#NightOut","#TravelParty"],adventure:["#AdventureTravel","#ExploreMore","#TravelAdventure","#OutdoorTravel"],classic:["#TravelGram","#TravelPhotography","#Explore","#Wanderlust"],foodie:["#FoodTravel","#FoodieAdventures","#CulinaryTravel","#TravelEats"],wellness:["#WellnessTravel","#SpaRetreat","#MindfulTravel","#WellnessJourney"],cultural:["#CultureTrip","#HeritageTravel","#HistoricalPlaces","#CulturalExplorer"],family:["#FamilyTravel","#TravelWithKids","#FamilyVacation","#FamilyAdventure"],romantic:["#CoupleGoals","#RomanticGetaway","#LoveTravel","#TravelCouple"],minimalist:["#MinimalTravel","#SlowTravel","#SimpleTravel","#ConsciousTravel"],vintage:["#VintageVibes","#RetroTravel","#NostalgiaTrip","#ClassicTravel"],urban:["#UrbanExplorer","#CityTrip","#StreetPhotography","#CityVibes"],beach:["#BeachLife","#TropicalVibes","#OceanLove","#IslandHopping"],mountain:["#MountainLife","#HikingAdventures","#AlpineVie
107ws","#PeakExperiences"]};t.push(...T[O]),t.push("#Slant","#TravelCreator","#TravelContent","#InstaTravel","#TravelBlogger");const E=Array.from(new Set(t)).slice(0,20);return he(E),E},Ps=async(t,T,E=1)=>{var H,ce;if(!t.trim()){P({title:"Search query required",description:"Please enter a search term",variant:"destructive"});return}Ys(!0),Tn(E);try{const ue=T==="photo"?"/api/stock-media/photos":"/api/stock-media/videos",ye=new URLSearchParams({query:t.trim(),page:E.toString(),perPage:"15"});Ca!=="all"&&ye.append("orientation",Ca);const Ne=await fetch(`${ue}?${ye}`);if(!Ne.ok){const _e=await Ne.json();if(_e.setup)P({title:"Stock media not configured",description:_e.message,variant:"destructive"});else throw new Error(_e.error||"Search failed");return}const Ye=await Ne.json();Qs(Ye),(T==="photo"&&!((H=Ye.photos)!=null&&H.length)||T==="video"&&!((ce=Ye.videos)!=null&&ce.length))&&P({title:"No results found",description:`No ${T}s found for "${t}"`})}catch(ue){console.error("Stock media search error:",ue),P({title:"Search failed",description:ue.message||"Failed to search stock media",variant:"destructive"})}finally{Ys(!1)}},bl=async()=>{Ys(!0);try{const T=await fetch(`${yt==="photo"?"/api/stock-media/curated":"/api/stock-media/popular-videos"}?perPage=15`);if(!T.ok){const H=await T.json();H.setup&&P({title:"Stock media not configured",description:H.message});return}const E=await T.json();Qs(E)}catch(t){console.error("Failed to load curated content:",t)}finally{Ys(!1)}},jl=t=>{const T={id:`stock-photo-${t.id}-${Date.now()}`,sourceId:`pexels-${t.id}`,type:"image",url:t.src.large,thumbnail:t.src.medium,name:t.alt||`Photo by ${t.photographer}`,duration:5,originalDuration:5,trimStart:0,trimEnd:5,orderIndex:d.length,overlays:[],transitionIn:Tt,transitionOut:Tt,filter:"none",colorGrading:us,effect:"none",captions:[]};j(E=>[...E,T]),xi(E=>{const H=new Set(E);return H.add(t.id),H}),P({title:"Photo added",description:`"${t.alt||"Stock photo"}" added to timeline`})},vl=t=>{var ce;const T=t.videoFiles.find(ue=>ue.quality==="hd")||t.videoFiles[0];if(!T){P({title:"Error",description:"No video file available",variant:"destructive"});return}const E=((ce=t.videoPictures[0])==null?void 0:ce.picture)||"",H={id:`stock-video-${t.id}-${Date.now()}`,sourceId:`pexels-video-${t.id}`,type:"video",url:T.link,thumbnail:E,name:`Video by ${t.user.name}`,duration:t.duration,originalDuration:t.duration,trimStart:0,trimEnd:t.duration,orderIndex:d.length,overlays:[],transitionIn:Tt,transitionOut:Tt,filter:"none",colorGrading:us,effect:"none",captions:[]};j(ue=>[...ue,H]),xi(ue=>{const ye=new Set(ue);return ye.add(t.id),ye}),P({title:"Video added",description:`${t.duration}s video added to timeline`})},Ei=async t=>{if(!t||t.type!=="video"){P({title:"Cannot generate captions",description:"Please select a video clip first",variant:"destructive"});return}Ya(!0);try{const E=await(await fetch(t.url)).blob(),H=new FormData;H.append("media",E,t.name||"video.mp4"),H.append("language","auto");const ce=await fetch("/api/creator-studio/transcribe",{method:"POST",body:H,credentials:"include"});if(!ce.ok){const ye=await ce.json();throw new Error(ye.userFriendly||ye.error||"Transcription failed")}const ue=await ce.json();ue.captions&&ue.captions.length>0?(j(ye=>ye.map(Ne=>Ne.id===t.id?{...Ne,captions:ue.captions}:Ne)),P({title:"Captions generated",description:`${ue.captions.length} captions created from audio`})):P({title:"No speech detected",description:"Could not find any speech in the video audio",variant:"destructive"})}catch(T){console.error("Caption generation error:",T),P({title:"Caption generation failed",description:T.message||"Please try again later",variant:"destructive"})}finally{Ya(!1)}},wl=()=>{var E,H;const t=fl();let T=`⨠Created with Slant Creator Studio 108 109`;if(Array.isArray(_t)&&_t.length>0&&((H=(E=_t[0])==null?void 0:E.destinations)==null?void 0:H.length)>0){const ce=_t[0].destinations.map(ue=>ue.name).slice(0,3).join(" â ");T+=`ð ${ce} 110 111`}T+=`Create your own travel content at slant.app 112 113`,T+=t.join(" "),te(T),He(!0)},Ii=async()=>{try{await navigator.clipboard.writeText(ie),me(!0),P({title:"Caption copied!",description:"Paste it when sharing on social media"}),setTimeout(()=>me(!1),2e3)}catch{P({title:"Copy failed",description:"Please copy the caption manually",variant:"destructive"})}},sa=t=>{const T=window.location.origin,E=encodeURIComponent(ie),H={instagram:"instagram://story-camera",tiktok:"https://www.tiktok.com/upload",facebook:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(T)}"e=${E}`,twitter:`https://twitter.com/intent/tweet?text=${E}&url=${encodeURIComponent(T)}`};(t==="instagram"||t==="tiktok")&&(Ii(),P({title:`Opening ${t}...`,description:"Caption copied! Paste it when uploading"})),window.open(H[t],"_blank")};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-[#0F172A] via-[#1E293B] to-[#334155]",children:[e.jsxs("div",{className:"container mx-auto p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white mb-2","data-testid":"studio-title",children:"Creator Studio"}),e.jsx("p",{className:"text-gray-400",children:"Create stunning AI-powered visual stories from your travel content"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qo,{projectId:"demo-project",isOwner:!0}),e.jsx(Go,{projectId:"demo-project",workflowState:"draft",userRole:"owner",approvalRequired:!1})]})]})}),e.jsx("div",{className:"mb-8","data-testid":"getting-started-section",children:e.jsxs("div",{className:"relative rounded-2xl overflow-hidden border border-white/10 bg-white/[0.03]",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-cyan-500/5 via-purple-500/5 to-pink-500/5 pointer-events-none"}),e.jsxs("div",{className:"relative p-6 md:p-8",children:[zn==="1"&&e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(oo,{className:"w-4 h-4 text-cyan-400"}),e.jsx("span",{className:"text-cyan-400 text-sm font-medium",children:"Welcome to your Creator Studio!"})]}),e.jsx("h2",{className:"text-xl font-semibold text-white mb-1",children:"What would you like to do?"}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Pick a starting point â you can change anything later."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6","data-testid":"creator-primary-ctas",children:[e.jsxs("button",{onClick:()=>l("/campaigns/create"),className:"group flex items-start gap-4 p-5 rounded-xl bg-white/[0.04] hover:bg-white/[0.08] border border-white/10 hover:border-cyan-500/40 transition-all text-left","data-testid":"cta-create-campaign",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-cyan-500/20 to-blue-500/20 flex items-center justify-center flex-shrink-0 group-hover:from-cyan-500/30 group-hover:to-blue-500/30 transition-all",children:e.jsx(Yr,{className:"w-5 h-5 text-cyan-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-white font-medium",children:"Create a Campaign"}),e.jsx(Ia,{className:"w-4 h-4 text-gray-500 group-hover:text-cyan-400 group-hover:translate-x-0.5 transition-all"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-0.5",children:"Launch a QR-powered fan experience with booking and attribution built in."})]})]}),e.jsxs("button",{onClick:()=>l("/trips/new"),className:"group flex items-start gap-4 p-5 rounded-xl bg-white/[0.04] hover:bg-white/[0.08] border border-white/10 hover:border-purple-500/40 transition-all text-left","data-testid":"cta-plan-trip",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500/20 to-pink-500/20 flex items-center justify-center flex-shrink-0 group-hover:from-purple-500/30 group-hover:to-pink-500/30 transition-all",children:e.jsx(Ol,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-white font-medium",children:"Plan a Trip for Fans"}),e.jsx(Ia,{className:"w-4 h-4 text-gray-500 group-hover:text-purple-400 group-hover:translate-x-0.5 transition-all"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-0.5",children:"AI builds a
113shareable group itinerary from a destination and dates in seconds."})]})]})]}),e.jsx("div",{className:"flex justify-center mb-5",children:e.jsxs("button",{onClick:()=>l("/creator-studio-agent"),className:"flex items-center gap-2 text-sm text-purple-400/80 hover:text-purple-300 transition-colors group","data-testid":"cta-import-brief",children:[e.jsx(tt,{className:"w-3.5 h-3.5 group-hover:scale-110 transition-transform"}),"Got a brief? Import it with AI â"]})}),Fs.length>0?e.jsxs("div",{className:"border-t border-white/10 pt-4",children:[e.jsx("p",{className:"text-gray-500 text-xs uppercase tracking-wide mb-3",children:"Continue where you left off"}),e.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/[0.03] border border-white/[0.06] hover:bg-white/[0.06] transition-all",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-md bg-gradient-to-br from-slate-600 to-slate-700 flex items-center justify-center flex-shrink-0",children:e.jsx(Bl,{className:"w-4 h-4 text-gray-300"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-white text-sm font-medium truncate",children:((Pi=Fs[0])==null?void 0:Pi.name)||"Recent Campaign"}),e.jsx("p",{className:"text-gray-500 text-xs",children:((Ri=Fs[0])==null?void 0:Ri.status)||"Draft"})]})]}),((zi=Fs[0])==null?void 0:zi.id)&&e.jsxs("button",{onClick:()=>l(`/campaign/${Fs[0].id}/dashboard`),className:"flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300 font-medium flex items-center gap-1","data-testid":"cta-continue-campaign",children:["Continue ",e.jsx(Ia,{className:"w-3 h-3"})]})]})]}):e.jsx("div",{className:"border-t border-white/10 pt-4",children:e.jsxs("p",{className:"text-gray-500 text-sm text-center",children:[e.jsx(tt,{className:"w-4 h-4 inline mr-1 text-purple-400"}),"Your first campaign or trip will appear here once created."]})})]})]})}),e.jsxs(as,{value:u,onValueChange:r,className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-6 px-6 mb-6",children:e.jsxs(is,{className:"bg-white/10 border-white/20 inline-flex w-auto min-w-full sm:min-w-0",children:[e.jsxs(Re,{value:"slides",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-slides",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Slide Decks"]}),e.jsxs(Re,{value:"batch",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-batch",children:[e.jsx(Bs,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"AI Batch Creation"]}),e.jsxs(Re,{value:"editor",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-editor",children:[e.jsx(Ct,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Media Editor"]}),e.jsxs(Re,{value:"events",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-events",children:[e.jsx(ws,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Events & Agendas"]}),e.jsxs(Re,{value:"brand-kits",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-brand-kits",children:[e.jsx(wt,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Brand Kits"]}),e.jsxs(Re,{value:"branded-assets",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-branded-assets",children:[e.jsx(ut,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Branded Assets"]}),e.jsxs(Re,{value:"programs",className:"data-[state=active]:bg-accent data-[state=active]:text-black whitespace-nowrap","data-testid":"tab-programs",children:[e.jsx(ts,{className:"w-4 h-4 mr-2 flex-shrink-0"}),"Event Programs"]})]})}),e.jsx(ze,{value:"slides",className:"space-y-6",children:e.jsx(Ko,{})}),e.jsx(ze,{value:"batch",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(tt,{className:"w-5 h-5 text-accent"}),"AI Batch Content Generator"]}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Generate multiple platform-optimized content pieces from a single route using AI"}),e.jsxs("div",{className:"mb-6",children:[e.jsx(q,{className:"text-white mb-2 block",children:"Select Route"}),e.jsxs(Oe,{value:Sa,onValueChange:Kn,children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white","data-testid":"route-select",children:e.jsx($e,{placeholder:"Choose a route..."})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Array.isArray(_t)&&_t.length>0?_t.map(t=>e.jsx(ae,{value:t.id.toString(),className:"text-white",children:t.name},t.id)):e.jsx(ae,{value:"no-routes",disabled:!0,className:"text-gray-400",children:"No routes available"})})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx(q,{className:"text-white mb-3 block",children:"Select Platforms"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-3 p-3 bg-white/5 rounded-lg",children:[e.jsx(gs,{id:"instagram",checked:Es.includes("instagram_carousel"),onCheckedChange:t=>{_a(T=>t?[...T,"instagram_carousel"]:T.filter(E=>E!=="instagram_carousel"))},"data-testid":"checkbox-instagram"}),e.jsxs(q,{htmlFor:"instagram",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(fs,{className:"w-5 h-5 text-pink-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:"Instagram Carousel"}),e.jsx("p",{className:"text-gray-400 text-xs",children:"10 slides with captions & hashtags"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3 p-3 bg-white/5 rounded-lg",children:[e.jsx(gs,{id:"tiktok",checked:Es.includes("tiktok_reel"),onCheckedChange:t=>{_a(T=>t?[...T,"tiktok_reel"]:T.filter(E=>E!=="tiktok_reel"))},"data-testid":"checkbox-tiktok"}),e.jsxs(q,{htmlFor:"tiktok",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(ss,{className:"w-5 h-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:"TikTok Reel Script"}),e.jsx("p",{className:"text-gray-400 text-xs",children:"Hook, scenes & call-to-action"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3 p-3 bg-white/5 rounded-lg",children:[e.jsx(gs,{id:"youtube",checked:Es.includes("youtube_thumbnail"),onCheckedChange:t=>{_a(T=>t?[...T,"youtube_thumbnail"]:T.filter(E=>E!=="youtube_thumbnail"))},"data-testid":"checkbox-youtube"}),e.jsxs(q,{htmlFor:"youtube",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Ms,{className:"w-5 h-5 text-red-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:"YouTube Thumbnail Design"}),e.jsx("p",{className:"text-gray-400 text-xs",children:"Thumbnail concept & title"})]})]})]})]})]}),e.jsx(z,{className:"w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white",onClick:()=>Aa.mutate({routeId:Sa,platforms:Es}),disabled:!Sa||Es.length===0||Aa.isPending||Fa,"data-testid":"generate-batch-button",children:Aa.isPending||Fa?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),Fa?"Generating with AI...":"Starting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Generate Content"]})})]}),e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsx("h3",{className:"text-white font-semibold mb-3",children:"What You'll Get"}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-300",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(ht,{className:"w-4 h-4 text-accent mt-0.5 flex-shrink-0"}),"Platform-optimized content for each social media"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(ht,{className:"w-4 h-4 text-accent mt-0.5 flex-shrink-0"}),"AI-generated captions, hooks, and hashtags"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(ht,{className:"w-4 h-4 text-accent mt-0.5 flex-shrink-0"}),"Design suggestions and visual concepts"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(ht,{className:"w-4 h-4 text-accent mt-0.5 flex-shrink-0"}),"Ready to use or customize further"]}
113)]})]})]}),e.jsx("div",{children:e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:"Generated Content"}),Ta?e.jsx("div",{className:"space-y-4 max-h-[600px] overflow-y-auto",children:Array.isArray(Ta)&&Ta.map((t,T)=>e.jsxs(ge,{className:"bg-white/5 border-white/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.platform==="instagram_carousel"&&e.jsx(fs,{className:"w-5 h-5 text-pink-500"}),t.platform==="tiktok_reel"&&e.jsx(ss,{className:"w-5 h-5"}),t.platform==="youtube_thumbnail"&&e.jsx(Ms,{className:"w-5 h-5 text-red-500"}),e.jsxs("h3",{className:"font-semibold text-white",children:[t.platform==="instagram_carousel"&&"Instagram Carousel",t.platform==="tiktok_reel"&&"TikTok Reel Script",t.platform==="youtube_thumbnail"&&"YouTube Thumbnail",t.contentType&&` (${t.contentType})`]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-xs uppercase tracking-wide",children:"AI-Generated Content"}),e.jsx("div",{className:"mt-2 p-3 bg-white/5 rounded-lg",children:e.jsx("pre",{className:"text-sm text-gray-300 whitespace-pre-wrap font-sans",children:t.content})})]}),t.hashtags&&e.jsxs("div",{children:[e.jsx(q,{className:"text-gray-400 text-xs uppercase tracking-wide",children:"Hashtags"}),e.jsx("div",{className:"mt-2 p-3 bg-white/5 rounded-lg",children:e.jsx("p",{className:"text-sm text-gray-300",children:t.hashtags})})]}),t.metadata&&e.jsx("div",{className:"pt-2 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsxs("span",{children:["Route: ",t.metadata.routeTitle]}),t.metadata.destinations&&t.metadata.destinations.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"â¢"}),e.jsxs("span",{children:[t.metadata.destinations.length," destinations"]})]})]})})]}),e.jsxs(z,{variant:"outline",size:"sm",className:"w-full mt-3 bg-white/10 border-white/20 text-white hover:bg-white/20",onClick:()=>{const E=`${t.content} 114 115${t.hashtags||""}`.trim();navigator.clipboard.writeText(E),P({title:"Copied!",description:"Content copied to clipboard"})},"data-testid":`copy-${T}`,children:[e.jsx(Kt,{className:"w-4 h-4 mr-2"}),"Copy Content"]})]},T))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(tt,{className:"w-12 h-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:'Select a route and platforms, then click "Generate Content" to see AI-powered content here'})]})]})})]})}),e.jsxs(ze,{value:"editor",children:[e.jsxs("div",{className:"flex gap-2 mb-6",children:[e.jsxs(z,{className:"bg-purple-600 hover:bg-purple-700 text-white",onClick:()=>x(!0),disabled:d.length===0,"data-testid":"ai-generate-button",children:[e.jsx(tt,{className:"w-4 h-4 mr-2"}),"AI Highlight Reel"]}),e.jsxs(z,{variant:"outline",className:"bg-white/10 border-white/20 text-white",onClick:()=>D(!0),disabled:d.length===0,"data-testid":"remix-button",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2"}),"Remix Reel"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-4",children:[e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:"Style & Format"}),e.jsxs("div",{className:"mb-5",children:[e.jsx(q,{className:"text-sm text-gray-400 mb-2 block",children:"Aspect Ratio"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ms.map(t=>e.jsxs("button",{onClick:()=>W(t.id),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs transition-all ${C===t.id?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":`aspect-ratio-${t.id.replace(":","-")}`,children:[e.jsx("span",{children:t.icon}),e.jsx("span",{children:t.name})]},t.id))}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:[(Di=ms.find(t=>t.id===C))==null?void 0:Di.platform," ⢠",(Oi=ms.find(t=>t.id===C))==null?void 0:Oi.width,"x",(Bi=ms.find(t=>
115t.id===C))==null?void 0:Bi.height]})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx(q,{className:"text-sm text-gray-400 mb-2 block",children:"Template Category"}),e.jsx("div",{className:"flex gap-1 overflow-x-auto pb-2",children:["all","travel","lifestyle","nature","general"].map(t=>e.jsx("button",{onClick:()=>S(t),className:`px-3 py-1.5 rounded-full text-xs whitespace-nowrap transition-all capitalize ${n===t?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":`template-category-${t}`,children:t==="all"?"ð All":t==="travel"?"âï¸ Travel":t==="lifestyle"?"⨠Lifestyle":t==="nature"?"ð¿ Nature":"ð· General"},t))})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-64 overflow-y-auto",children:Object.values(Se).filter(t=>n==="all"||t.category===n).map(t=>e.jsxs("button",{onClick:()=>ne(t.id),className:`p-3 rounded-lg text-left transition-all ${O===t.id?"bg-accent/20 border-2 border-accent":"bg-white/5 border-2 border-transparent hover:bg-white/10"}`,"data-testid":`template-${t.id}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-lg",children:t.icon}),e.jsx("span",{className:"text-white text-sm font-medium",children:t.name})]}),e.jsx("p",{className:"text-xs text-gray-400 line-clamp-1",children:t.description}),e.jsxs("div",{className:"flex gap-1 mt-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:t.colors.primary},title:"Primary"}),e.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:t.colors.secondary},title:"Secondary"}),t.colors.accent&&e.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:t.colors.accent},title:"Accent"})]})]},t.id))}),e.jsxs("div",{className:"mt-4 p-3 bg-white/5 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-lg",children:Se[O].icon}),e.jsx("span",{className:"text-white font-medium",children:Se[O].name})]}),e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:Se[O].description}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-gray-400",children:[e.jsx(ft,{className:"w-3 h-3"}),e.jsx("span",{children:Se[O].music})]}),e.jsxs("div",{className:"flex items-center gap-1 text-gray-400",children:[e.jsx(ca,{className:"w-3 h-3"}),e.jsx("span",{children:Se[O].transitions})]})]}),e.jsxs(z,{variant:"outline",size:"sm",className:"w-full bg-accent/20 border-accent/50 text-accent hover:bg-accent/30",onClick:()=>Gs(!0),disabled:d.length===0,"data-testid":"preview-template-button",children:[e.jsx(Lt,{className:"w-4 h-4 mr-2"}),"Preview Template"]}),d.length===0&&e.jsx("p",{className:"text-xs text-gray-500 mt-2 text-center",children:"Upload media to preview"})]})]}),e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:"Upload Media"}),e.jsxs("div",{className:"border-2 border-dashed border-white/20 rounded-lg p-8 text-center hover:border-accent/50 transition-colors cursor-pointer",onDragOver:t=>t.preventDefault(),onDrop:Jn,onClick:()=>{var t;return(t=M.current)==null?void 0:t.click()},"data-testid":"upload-area",children:[e.jsx(Ft,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-white text-sm mb-1",children:"Drop clips or photos here"}),e.jsx("p",{className:"text-gray-400 text-xs",children:"or click to browse"}),e.jsx("input",{ref:M,type:"file",accept:"image/*,video/*",multiple:!0,className:"hidden",onChange:Yn,"data-testid":"file-input"})]}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsxs(z,{variant:"outline",className:"w-full bg-gradient-to-r from-purple-500/10 to-pink-500/10 border-purple-500/30 text-white hover:bg-purple-500/20",onClick:()=>hi(!0),"data-testid":"import-external-button",children:[e.jsx(tt,{className:"w-4 h-4 mr-2 text-purple-400"}),"Import from Instories, Canva, CapCut..."]}),e.jsxs(z,{variant:"outline",className:"w-full bg-gradient-to-r from-pink-500/10 to-orange-500/10 border-pink-500/30 text-white hover:bg-pink-500/20",onClick:()=>mi(!0),"data-testid":"story-templates-button",children:[e.jsx(Qa,{className:"w-4 h-4 mr-2 text-pink-400"}),"Story Templates (9:16)"]})]})]}),e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:"Media Library"}),e.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:d.length===0?e.jsx("p",{className:"text-gray-400 text-sm text-center py-8",children:"No media uploaded yet"}):d.map((t,T)=>e.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-colors ${(s==null?void 0:s.id)===t.id?"bg-accent/20 border border-accent":"bg-white/5 hover:bg-white/10 border border-transparent"}`,onClick:()=>m(t),"data-testid":`media-item-${t.id}`,children:[e.jsx(ba,{className:"w-4 h-4 text-gray-400"}),t.type==="video"?e.jsx(Ct,{className:"w-8 h-8 text-blue-400"}):e.jsx(ut,{className:"w-8 h-8 text-green-400"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-sm text-white block truncate",children:t.name}),t.voiceOverlay&&e.jsxs("span",{className:"text-xs text-purple-400 flex items-center gap-1",children:[e.jsx(zs,{className:"w-3 h-3"}),"Voice added"]})]}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:E=>{E.stopPropagation(),rl(t.id)},"data-testid":`delete-${t.id}`,children:e.jsx(xt,{className:"w-4 h-4"})})]},t.id))})]})]}),e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 mb-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Preview"})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",className:`${oe?"bg-red-600 border-red-600 text-white":"bg-white/10 border-white/20 text-white"}`,onClick:oe?sl:tl,disabled:!s,"data-testid":"voice-record-button",children:oe?e.jsxs(e.Fragment,{children:[e.jsx(Ka,{className:"w-4 h-4 mr-2"}),"Stop Recording"]}):e.jsxs(e.Fragment,{children:[e.jsx(zs,{className:"w-4 h-4 mr-2"}),"Record Voice"]})}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white",onClick:()=>g(!f),"data-testid":"toggle-overlays",children:[e.jsx(js,{className:"w-4 h-4 mr-2"}),"Add Overlay"]}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white","data-testid":"trim-button",children:[e.jsx(Wa,{className:"w-4 h-4 mr-2"}),"Trim"]}),e.jsxs(z,{variant:"outline",size:"sm",className:`bg-white/10 border-white/20 text-white ${Wt?"bg-accent/20 border-accent":""}`,onClick:()=>Ns(!Wt),"data-testid":"effects-button",children:[e.jsx(wt,{className:"w-4 h-4 mr-2"}),"Effects"]}),e.jsxs(z,{variant:"outline",size:"sm",className:`bg-white/10 border-white/20 text-white ${Zt?"bg-accent/20 border-accent":""}`,onClick:()=>It(!Zt),"data-testid":"captions-button",children:[e.jsx(ia,{className:"w-4 h-4 mr-2"}),"Captions"]}),e.jsxs(z,{variant:"outline",size:"sm",className:`bg-white/10 border-white/20 text-white ${ya?"bg-accent/20 border-accent":""}`,onClick:()=>ei(!ya),"data-testid":"music-button",children:[e.jsx(ft,{className:"w-4 h-4 mr-2"}),"Music"]}),e.jsxs(z,{variant:"outline",size:"sm",className:`bg-white/10 border-white/20 text-white ${ka?"bg-accent/20 border-accent":""}`,onClick:()=>ci(!ka),"data-testid":"mixer-button",children:[e.jsx(wr,{className:"w-4 h-4 mr-2"}),"Mixer"]}),e.jsxs(z,{variant:"outline",size:"sm",className:`bg-white/10 border-white/20 text-white ${Ws?"bg-accent/20 border-accent":""}`,onClick:()=>{di(!Ws),!Ws&&!dt&&bl()},"data-testid":"stock-media-button",children:[e.jsx(vr,{className:"w-4 h-4 mr-2"}),"Stock Media"]})]})]}),s?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative bg-black rounded-lg overflow-hidden mx-auto",style:{aspectRatio:(($i=ms.find(t=>
115t.id===C))==null?void 0:$i.ratio)||"16/9",maxHeight:"400px"},children:[s.type==="image"?e.jsx("img",{src:s.url,alt:s.name,className:"w-full h-full object-contain",style:{filter:la(s)},"data-testid":"preview-image"}):e.jsx("video",{ref:B,src:s.url,className:"w-full h-full object-contain",style:{filter:la(s)},onTimeUpdate:ll,onLoadedMetadata:ol,onEnded:ul,onPlay:()=>ee(!0),onPause:()=>ee(!1),"data-testid":"preview-video"}),(s.effect==="vignette"||s.colorGrading.vignette>0)&&e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:`radial-gradient(circle, transparent ${50-s.colorGrading.vignette/3}%, rgba(0,0,0,${s.effect==="vignette"?.5:s.colorGrading.vignette/100}) 100%)`}}),(s.filter!=="none"||s.effect!=="none")&&e.jsxs("div",{className:"absolute top-2 left-2 flex gap-1",children:[s.filter!=="none"&&e.jsx("span",{className:"bg-purple-600/80 text-white text-xs px-2 py-0.5 rounded-full",children:(Mi=xs.find(t=>t.type===s.filter))==null?void 0:Mi.name}),s.effect!=="none"&&e.jsx("span",{className:"bg-blue-600/80 text-white text-xs px-2 py-0.5 rounded-full",children:(Li=$s.find(t=>t.type===s.effect))==null?void 0:Li.name})]}),s.overlays.map(t=>e.jsxs("div",{className:"absolute cursor-move group",style:{left:`${t.x}%`,top:`${t.y}%`,fontSize:`${t.fontSize}px`,color:t.color},"data-testid":`overlay-${t.id}`,children:[t.type==="location"&&e.jsx(bs,{className:"inline w-5 h-5 mr-1"}),e.jsx("span",{className:"font-bold drop-shadow-lg",children:t.content}),e.jsx("button",{className:"absolute -top-2 -right-2 bg-red-500 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>il(t.id),children:e.jsx(rt,{className:"w-3 h-3 text-white"})})]},t.id)),s.voiceOverlay&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-purple-600 text-white px-3 py-1 rounded-full flex items-center gap-2",children:[e.jsx(zs,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:"Voice narration added"})]}),s.captions.length>0&&(()=>{const t=s.captions.find(E=>G>=E.startTime&&G<=E.endTime);if(!t)return null;const T=t.style||s.captionSettings||{fontSize:24,color:"#ffffff",backgroundColor:"rgba(0,0,0,0.7)",position:"bottom"};return e.jsx("div",{className:`absolute left-0 right-0 px-4 py-2 flex justify-center pointer-events-none ${T.position==="top"?"top-4":"bottom-12"}`,"data-testid":"caption-overlay",children:e.jsx("span",{style:{fontSize:`${T.fontSize}px`,color:T.color,backgroundColor:T.backgroundColor,padding:"4px 12px",borderRadius:"4px",maxWidth:"90%",textAlign:"center"},children:t.text})})})(),s.captions.length>0&&e.jsxs("div",{className:"absolute top-2 right-2 bg-blue-600/80 text-white text-xs px-2 py-0.5 rounded-full flex items-center gap-1",children:[e.jsx(ia,{className:"w-3 h-3"}),s.captions.length]})]}),s.type==="video"&&e.jsxs("div",{className:"bg-white/5 rounded-lg p-4 border border-white/10",children:[e.jsx("div",{className:"mb-3",children:e.jsx("input",{type:"range",min:0,max:de||100,value:G,onChange:cl,className:"w-full h-2 bg-white/20 rounded-lg appearance-none cursor-pointer accent-accent [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:shadow-lg","data-testid":"video-scrubber"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"icon",className:"h-9 w-9 text-white hover:bg-white/10",onClick:dl,"data-testid":"skip-backward-button",children:e.jsx(No,{className:"w-5 h-5"})}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-11 w-11 text-white hover:bg-white/10 bg-accent/20",onClick:nl,"data-testid":"play-pause-button",children:X?e.jsx(Ka,{className:"w-6 h-6"}):e.jsx(ca,{className:"w-6 h-6 ml-0.5"})}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-9 w-9 text-white hover:bg-white/10",onClick:hl,"data-testid":"skip-forward-button",children:e.jsx(co,{className:"w-5 h-5"})}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-9 w-9 text-white hover:bg-white/10",onClick:ml,"data-testid":"mute-button",children:pe?e.jsx(ds,{className:"w-5 h-5"}):e.jsx(hs,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"text-white text-sm font-mono","data-testid":"time-display",children:[lt(G)," / ",lt(de)]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-white/10",children:[e.jsx("span",{className:"text-xs text-gray-400 mr-2",children:"Jump to:"}),[0,25,50,75,100].map(t=>e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-white/70 hover:text-white hover:bg-white/10",onClick:()=>
115{if(B.current&&de){const T=t/100*de;B.current.currentTime=T,se(T)}},"data-testid":`jump-${t}`,children:[t,"%"]},t))]})]})]}):e.jsx("div",{className:"aspect-video bg-black rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ut,{className:"w-16 h-16 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Select a clip to preview"})]})}),f&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsx("h3",{className:"text-white font-semibold mb-3",children:"Add Overlay"}),e.jsxs(as,{value:K,onValueChange:t=>U(t),children:[e.jsxs(is,{className:"bg-white/10 mb-3",children:[e.jsx(Re,{value:"text","data-testid":"overlay-tab-text",children:"Text"}),e.jsx(Re,{value:"sticker","data-testid":"overlay-tab-sticker",children:"Sticker"}),e.jsx(Re,{value:"location","data-testid":"overlay-tab-location",children:"Location"})]}),e.jsx(ze,{value:"text",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{placeholder:"Enter text...",value:Q,onChange:t=>R(t.target.value),className:"bg-white/10 border-white/20 text-white","data-testid":"text-overlay-input"}),e.jsx(z,{onClick:Ai,className:"w-full bg-accent hover:bg-accent/90",disabled:!Q||!s,"data-testid":"add-text-overlay",children:"Add Text"})]})}),e.jsx(ze,{value:"sticker",children:e.jsx("div",{className:"grid grid-cols-5 gap-2",children:ac.map(t=>e.jsx("button",{className:"text-3xl p-2 hover:bg-white/10 rounded transition-colors",onClick:()=>{if(!s)return;const T={id:Math.random().toString(36).substr(2,9),type:"sticker",content:t,x:50,y:50,fontSize:32};j(E=>E.map(H=>H.id===s.id?{...H,overlays:[...H.overlays,T]}:H))},"data-testid":`sticker-${t}`,children:t},t))})}),e.jsx(ze,{value:"location",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{placeholder:"Location name...",value:Q,onChange:t=>R(t.target.value),className:"bg-white/10 border-white/20 text-white","data-testid":"location-overlay-input"}),e.jsxs(z,{onClick:Ai,className:"w-full bg-accent hover:bg-accent/90",disabled:!Q||!s,"data-testid":"add-location-overlay",children:[e.jsx(bs,{className:"w-4 h-4 mr-2"}),"Add Location"]})]})})]})]}),Wt&&!s&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(wt,{className:"w-5 h-5"}),"Effects & Transitions"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>Ns(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ut,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Upload and select a clip to apply effects"})]})]}),Wt&&s&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(wt,{className:"w-5 h-5"}),"Effects & Transitions"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>Ns(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsxs(as,{value:ja,onValueChange:t=>va(t),children:[e.jsxs(is,{className:"bg-white/10 mb-4 grid grid-cols-4 w-full",children:[e.jsxs(Re,{value:"filters",className:"text-xs","data-testid":"effects-tab-filters",children:[e.jsx(ho,{className:"w-3 h-3 mr-1"}),"Filters"]}),e.jsxs(Re,{value:"transitions",className:"text-xs","data-testid":"effects-tab-transitions",children:[e.jsx(jr,{className:"w-3 h-3 mr-1"}),"Transitions"]}),e.jsxs(Re,{value:"color",className:"text-xs","data-testid":"effects-tab-color",children:[e.jsx(mo,{className:"w-3 h-3 mr-1"}),"Color"]}),e.jsxs(Re,{value:"effects",className:"text-xs","data-testid":"effects-tab-effects",children:[e.jsx(tt,{className:"w-3 h-3 mr-1"}),"Effects"]})]}),e.jsxs(ze,{value:"filters",className:"space-y-3",children:[e.jsx("div",{className:"grid grid-cols-4 gap-2",children:xs.map(t=>e.jsxs("button",{onClick:()=>Ti(s.id,t.type),className:`p-3 rounded-lg border transition-all text-center ${s.filter===t.type?"border-accent bg-accent/20 text-white":"border-white/10 bg-white/5 text-gray-300 hover:border-white/30"}`,"data-testid":`filter-${t.type}`,children:[e.jsx("span",{className:"text-xl block mb-1",children:t.preview}),e.jsx("span",{className:"text-xs",children:t.name})]},t.type))}),e.jsx(z,{variant:"outline",size:"sm",className:"w-full bg-white/5 border-white/20 text-white",onClick:()=>Gn(s.filter),"data-testid":"apply-filter-all",children:"Apply to All Clips"})]}),e.jsxs(ze,{value:"transitions",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-sm text-gray-400 mb-2 block",children:"Transition In"}
115),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:Os.map(t=>e.jsxs("button",{onClick:()=>Si(s.id,{type:t.type,duration:.5}),className:`p-2 rounded-lg border transition-all text-center ${s.transitionIn.type===t.type?"border-accent bg-accent/20 text-white":"border-white/10 bg-white/5 text-gray-300 hover:border-white/30"}`,title:t.description,"data-testid":`transition-in-${t.type}`,children:[e.jsx("span",{className:"text-lg block",children:t.icon}),e.jsx("span",{className:"text-xs",children:t.name})]},`in-${t.type}`))})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-sm text-gray-400 mb-2 block",children:"Transition Out"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:Os.map(t=>e.jsxs("button",{onClick:()=>_i(s.id,{type:t.type,duration:.5}),className:`p-2 rounded-lg border transition-all text-center ${s.transitionOut.type===t.type?"border-accent bg-accent/20 text-white":"border-white/10 bg-white/5 text-gray-300 hover:border-white/30"}`,title:t.description,"data-testid":`transition-out-${t.type}`,children:[e.jsx("span",{className:"text-lg block",children:t.icon}),e.jsx("span",{className:"text-xs",children:t.name})]},`out-${t.type}`))})]}),(s.transitionIn.type!=="none"||s.transitionOut.type!=="none")&&e.jsxs("div",{children:[e.jsxs(q,{className:"text-sm text-gray-400 mb-2 block",children:["Duration: ",s.transitionIn.duration.toFixed(1),"s"]}),e.jsx(Xe,{value:[s.transitionIn.duration],min:.1,max:2,step:.1,onValueChange:([t])=>{Si(s.id,{...s.transitionIn,duration:t}),_i(s.id,{...s.transitionOut,duration:t})},className:"w-full"})]})]}),e.jsx(z,{variant:"outline",size:"sm",className:"w-full bg-white/5 border-white/20 text-white",onClick:()=>Hn(s.transitionIn),disabled:s.transitionIn.type==="none","data-testid":"apply-transitions-all",children:"Apply to All Clips"})]}),e.jsxs(ze,{value:"color",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(br,{className:"w-4 h-4"}),"Brightness"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.brightness})]}),e.jsx(Xe,{value:[s.colorGrading.brightness],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{brightness:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(bo,{className:"w-4 h-4"}),"Contrast"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.contrast})]}),e.jsx(Xe,{value:[s.colorGrading.contrast],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{contrast:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(jo,{className:"w-4 h-4"}),"Saturation"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.saturation})]}),e.jsx(Xe,{value:[s.colorGrading.saturation],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{saturation:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(ko,{className:"w-4 h-4"}),"Temperature"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.temperature})]}),e.jsx(Xe,{value:[s.colorGrading.temperature],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{temperature:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(wt,{className:"w-4 h-4"}),"Tint"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.tint})]}),e.jsx(Xe,{value:[s.colorGrading.tint],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{tint:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(br,{className:"w-4 h-4"}),"Highlights"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.highlights})]}),e.jsx(Xe,{value:[s.colorGrading.highlights],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{highlights:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(uo,{className:"w-4 h-4"}),"Shadows"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.shadows})]}),e.jsx(Xe,{value:[s.colorGrading.shadows],min:-100,max:100,step:1,onValueChange:([t])=>Rt(s.id,{shadows:t}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(q,{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx($l,{className:"w-4 h-4"}),"Vignette"]}),e.jsx("span",{className:"text-xs text-white font-mono",children:s.colorGrading.vignette})]}),e.jsx(Xe,{value:[s.colorGrading.vignette],min:0,max:100,step:1,onValueChange:([t])=>Rt(s.id,{vignette:t}),className:"w-full"})]})]}),e.jsx(z,{variant:"outline",size:"sm",className:"w-full bg-white/5 border-white/20 text-white",onClick:()=>Vn(s.id),"data-testid":"reset-color-grading",children:"Reset Color Grading"})]}),e.jsxs(ze,{value:"effects",className:"space-y-3",children:[e.jsx("div",{className:"grid grid-cols-5 ga
115p-2",children:$s.map(t=>e.jsxs("button",{onClick:()=>Fi(s.id,t.type),className:`p-2 rounded-lg border transition-all text-center ${s.effect===t.type?"border-accent bg-accent/20 text-white":"border-white/10 bg-white/5 text-gray-300 hover:border-white/30"}`,"data-testid":`effect-${t.type}`,children:[e.jsx("span",{className:"text-lg block mb-1",children:t.icon}),e.jsx("span",{className:"text-xs",children:t.name})]},t.type))}),e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:[e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"Active Effects:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.filter!=="none"&&e.jsxs("span",{className:"px-2 py-1 bg-purple-600/30 text-purple-300 text-xs rounded-full flex items-center gap-1",children:[(Ui=xs.find(t=>t.type===s.filter))==null?void 0:Ui.preview,(qi=xs.find(t=>t.type===s.filter))==null?void 0:qi.name,e.jsx("button",{onClick:()=>Ti(s.id,"none"),className:"hover:text-white",children:e.jsx(rt,{className:"w-3 h-3"})})]}),s.effect!=="none"&&e.jsxs("span",{className:"px-2 py-1 bg-blue-600/30 text-blue-300 text-xs rounded-full flex items-center gap-1",children:[(Vi=$s.find(t=>t.type===s.effect))==null?void 0:Vi.icon,(Gi=$s.find(t=>t.type===s.effect))==null?void 0:Gi.name,e.jsx("button",{onClick:()=>Fi(s.id,"none"),className:"hover:text-white",children:e.jsx(rt,{className:"w-3 h-3"})})]}),s.transitionIn.type!=="none"&&e.jsxs("span",{className:"px-2 py-1 bg-green-600/30 text-green-300 text-xs rounded-full",children:["In: ",(Hi=Os.find(t=>t.type===s.transitionIn.type))==null?void 0:Hi.name]}),s.transitionOut.type!=="none"&&e.jsxs("span",{className:"px-2 py-1 bg-orange-600/30 text-orange-300 text-xs rounded-full",children:["Out: ",(Ki=Os.find(t=>t.type===s.transitionOut.type))==null?void 0:Ki.name]}),s.filter==="none"&&s.effect==="none"&&s.transitionIn.type==="none"&&s.transitionOut.type==="none"&&e.jsx("span",{className:"text-xs text-gray-500",children:"No effects applied"})]})]})]})]})]}),Zt&&s&&s.type==="video"&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(ia,{className:"w-5 h-5"}),"AI Auto-Captions"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>It(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),s.captions.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"Generate captions automatically using AI speech-to-text transcription."}),e.jsx(z,{className:"w-full bg-accent hover:bg-accent/90",onClick:()=>Ei(s),disabled:qt,"data-testid":"generate-captions-btn",children:qt?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating Captions..."]}):e.jsxs(e.Fragment,{children:[e.jsx(tt,{className:"w-4 h-4 mr-2"}),"Generate AI Captions"]})})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-gray-400",children:[s.captions.length," captions generated"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",className:"bg-white/5 border-white/20 text-white text-xs",onClick:()=>{j(t=>t.map(T=>T.id===s.id?{...T,captions:[]}:T))},"data-testid":"clear-captions-btn",children:"Clear All"}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/5 border-white/20 text-white text-xs",onClick:()=>Ei(s),disabled:qt,"data-testid":"regenerate-captions-btn",children:[e.jsx(tt,{className:"w-3 h-3 mr-1"}),"Regenerate"]})]})]}),e.jsx("div",{className:"max-h-64 overflow-y-auto space-y-2",children:s.captions.map((t,T)=>e.jsx("div",{className:`p-3 rounded-lg border transition-all ${G>=t.startTime&&G<=t.endTime?"bg-accent/20 border-accent":"bg-white/5 border-white/10"}`,"data-testid":`caption-item-${T}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex-shrink-0 text-xs text-gray-500 font-mono w-20",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(At,{className:"w-3 h-3"}),lt(t.startTime)]}),e.jsxs("div",{className:"text-gray-600",children:["â ",lt(t.endTime)]})]}),e.jsx("div",{className:"flex-1",children:vn===t.id?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:Ja,onChange:E=>Xa(E.target.value),className:"bg-white/10 border-white/20 text-white text-sm",autoFocus:!0,"data-testid":"caption-edit-input"}),e.jsx(z,{size:"sm",className:"bg-accent",onClick:()=>{j(E=>E.map(H=>H.id===s.id?{...H,captions:H.captions.map(ce=>ce.id===t.id?{...ce,text:Ja}:ce)}:H)),wa(null)},children:e.jsx(ht,{className:"w-4 h-4"})}),e.jsx(z,{size:"sm",variant:"ghost",onClick:()=>wa(null),children:e.jsx(rt,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"text-white text-sm",children:t.text}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx("button",{className:"text-gray-400 hover:text-white p-1",onClick:()=>{wa(t.id),Xa(t.text)},"data-testid":`edit-caption-${T}`,children:e.jsx(xo,{className:"w-3 h-3"})}),e.jsx("button",{className:"text-gray-400 hover:text-red-400 p-1",onClick:()=>{j(E=>E.map(H=>H.id===s.id?{...H,captions:H.captions.filter(ce=>ce.id!==t.id)}:H))},"data-testid":`delete-caption-${T}`,children:e.jsx(xt,{className:"w-3 h-3"})})]})]})})]})},t.id))}),e.jsxs("div",{className:"pt-3 border-t border-white/10",children:[e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"Caption Style"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Position"}),e.jsxs(Oe,{value:((Wi=s.captionSettings)==null?void 0:Wi.position)||"bottom",onValueChange:t=>{j(T=>T.map(E=>
115E.id===s.id?{...E,captionSettings:{...E.captionSettings,position:t}}:E))},children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"top",children:"Top"}),e.jsx(ae,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Font Size"}),e.jsxs(Oe,{value:String(((Zi=s.captionSettings)==null?void 0:Zi.fontSize)||24),onValueChange:t=>{j(T=>T.map(E=>E.id===s.id?{...E,captionSettings:{...E.captionSettings,fontSize:parseInt(t)}}:E))},children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"16",children:"Small"}),e.jsx(ae,{value:"24",children:"Medium"}),e.jsx(ae,{value:"32",children:"Large"})]})]})]})]})]})]})]}),Zt&&(!s||s.type!=="video")&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(ia,{className:"w-5 h-5"}),"AI Auto-Captions"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>It(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Ct,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Select a video clip to generate AI captions"})]})]}),ya&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(ft,{className:"w-5 h-5"}),"Music Library"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>ei(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),Ee&&e.jsx("div",{className:"mb-4 p-3 bg-accent/10 rounded-lg border border-accent/30",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded bg-accent/20 flex items-center justify-center",children:e.jsx(ft,{className:"w-5 h-5 text-accent"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:Ee.track.name}),e.jsx("p",{className:"text-gray-400 text-xs",children:Ee.track.artist})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hs,{className:"w-4 h-4 text-gray-400"}),e.jsx(Xe,{value:[Ee.volume],onValueChange:([t])=>pt(T=>T?{...T,volume:t}:null),max:100,step:1,className:"w-20"}),e.jsxs("span",{className:"text-xs text-gray-400 w-8",children:[Ee.volume,"%"]})]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>pt(null),"data-testid":"remove-music-btn",children:e.jsx(rt,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("div",{className:"flex-1 relative",children:e.jsx(le,{placeholder:"Search tracks...",value:ks,onChange:t=>wn(t.target.value),className:"bg-white/10 border-white/20 text-white placeholder:text-gray-500","data-testid":"music-search-input"})}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white",onClick:()=>{var t;return(t=ii.current)==null?void 0:t.click()},"data-testid":"upload-audio-btn",children:[e.jsx(Ft,{className:"w-4 h-4 mr-1"}),"Upload"]}),e.jsx("input",{ref:ii,type:"file",accept:"audio/*",className:"hidden",onChange:t=>{var E;const T=(E=t.target.files)==null?void 0:E[0];if(T){const H={id:`custom-${Date.now()}`,name:T.name.replace(/\.[^/.]+$/,""),artist:"Custom Upload",duration:0,category:"upbeat",mood:["custom"],bpm:0,audioBlob:T,isCustom:!0};ai(ce=>[...ce,H]),P({title:"Audio uploaded",description:`${H.name} added to your library`})}t.target.value=""}})]}),e.jsxs("div",{className:"flex gap-1 mb-4 overflow-x-auto pb-2",children:[e.jsx("button",{onClick:()=>ti("all"),className:`px-3 py-1.5 rounded-full text-xs whitespace-nowrap transition-all ${Vs==="all"?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":"music-category-all",children:"All"}),Rr.map(t=>e.jsxs("button",{onClick:()=>ti(t.id),className:`px-3 py-1.5 rounded-full text-xs whitespace-nowrap transition-all flex items-center gap-1 ${Vs===t.id?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":`music-category-${t.id}`,children:[e.jsx("span",{children:t.icon}),e.jsx("span",{children:t.name})]},t.id))]}),e.jsxs("div",{className:"max-h-64 overflow-y-auto space-y-2",children:[si.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Your Uploads"}),si.map(t=>e.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-all","data-testid":`track-${t.id}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded bg-purple-600/20 flex items-center justify-center",children:e.jsx(ft,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-gray-400 text-xs",children:t.artist})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>{ai(T=>T.filter(E=>E.id!==t.id)),P({title:"Track removed",description:"Audio removed from your library"})},"data-testid":`delete-track-${t.id}`,children:e.jsx(xt,{className:"w-4 h-4"})}),e.jsx(z,{size:"sm",className:"bg-accent hover:bg-accent/90",onClick:()=>{pt({track:t,volume:50,fadeIn:1,fadeOut:1,startOffset:0,loop:!0}),P({title:"Music added",description:`${t.name} set as background music`})},"data-testid":`add-track-${t.id}`,children:e.jsx(Qe,{className:"w-4 h-4"})})]})]})},t.id))]}),ic.filter(t=>{const T=Vs==="all"||t.category===Vs,E=ks===""||t.name.toLowerCase().includes(ks.toLowerCase())||t.artist.toLowerCase().includes(ks.toLowerCase())||t.mood.some(H=>H.toLowerCase().includes(ks.toLowerCase()));return T&&E}).map(t=>{const T=Rr.find(H=>H.id===t.category),E=(Ee==null?void 0:Ee.track.id)===t.id;return e.jsx("div",{className:`p-3 rounded-lg border transition-all ${E?"bg-accent/20 border-accent":"bg-white/5 border-white/10 hover:bg-white/10"}`,"data-testid":`track-${t.id}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded flex items-center justify-center ${E?"bg-accent/30":"bg-white/10"}`,children:e.jsx("span",{className:"text-lg",children:(T==null?void 0:T.icon)||"ðµ"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[e.jsx("span",{children:t.artist}),e.jsx("span",{children:"â¢"}),e.jsxs("span",{children:[Math.floor(t.duration/60),":",(t.duration%60).toString().padStart(2,"0")]}),e.jsx("span",{children:"â¢"}),e.jsxs("span",{children:[t.bpm," BPM"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.mood.slice(0,2).map(H=>e.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs bg-white/10 text-gray-300 capitalize",children:H},H)),e.jsx(z,{size:"sm",className:E?"bg-accent/50":"bg-accent hover:bg-accent/90",onClick:()=>{E?pt(null):(pt({track:t,volume:50,fadeIn:1,fadeOut:1,startOffset:0,loop:!0}),P({title:"Music added",description:`${t.name} set as background music`}))},"data-testid":`add-track-${t.id}
115`,children:E?e.jsx(ht,{className:"w-4 h-4"}):e.jsx(Qe,{className:"w-4 h-4"})})]})]})},t.id)})]}),Ee&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-white/10",children:[e.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Music Settings"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-xs text-gray-400 mb-1 block",children:"Fade In"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{value:[Ee.fadeIn],onValueChange:([t])=>pt(T=>T?{...T,fadeIn:t}:null),max:5,step:.5,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-gray-400 w-8",children:[Ee.fadeIn,"s"]})]})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-xs text-gray-400 mb-1 block",children:"Fade Out"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{value:[Ee.fadeOut],onValueChange:([t])=>pt(T=>T?{...T,fadeOut:t}:null),max:5,step:.5,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-gray-400 w-8",children:[Ee.fadeOut,"s"]})]})]})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(gs,{id:"loop-music",checked:Ee.loop,onCheckedChange:t=>pt(T=>T?{...T,loop:!!t}:null)}),e.jsx(q,{htmlFor:"loop-music",className:"text-sm text-gray-300",children:"Loop music throughout project"})]})]})]}),ka&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(wr,{className:"w-5 h-5"}),"Audio Mixer"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>ci(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex gap-1 mb-4",children:["mixer","layers","ducking"].map(t=>e.jsx("button",{onClick:()=>kn(t),className:`px-3 py-1.5 rounded-lg text-xs capitalize transition-all ${Ks===t?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":`mixer-tab-${t}`,children:t},t))}),Ks==="mixer"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-gradient-to-r from-purple-500/10 to-blue-500/10 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(hs,{className:"w-4 h-4 text-purple-400"}),"Master Volume"]}),e.jsxs("span",{className:"text-xs text-gray-400 font-mono",children:[Pe.masterVolume,"%"]})]}),e.jsx(Xe,{value:[Pe.masterVolume],onValueChange:([t])=>gt(T=>({...T,masterVolume:t})),max:100,step:1,className:"w-full","data-testid":"master-volume-slider"})]}),e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",className:`p-1 ${Pe.originalAudioMuted?"text-red-400":"text-gray-400"} hover:text-white`,onClick:()=>gt(t=>({...t,originalAudioMuted:!t.originalAudioMuted})),"data-testid":"mute-original-audio-btn",children:Pe.originalAudioMuted?e.jsx(ds,{className:"w-4 h-4"}):e.jsx(Ct,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-white text-sm",children:"Original Video Audio"})]}),e.jsxs("span",{className:"text-xs text-gray-400 font-mono",children:[Pe.originalAudioVolume,"%"]})]}),e.jsx(Xe,{value:[Pe.originalAudioVolume],onValueChange:([t])=>gt(T=>({...T,originalAudioVolume:t})),max:100,step:1,className:"w-full",disabled:Pe.originalAudioMuted,"data-testid":"original-audio-volume-slider"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Adjust the volume of the video's native audio track"})]}),Ee&&e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-white text-sm",children:"Backgroun
115d Music"}),e.jsx("span",{className:"text-xs text-gray-500 truncate max-w-[120px]",children:Ee.track.name})]}),e.jsxs("span",{className:"text-xs text-gray-400 font-mono",children:[Ee.volume,"%"]})]}),e.jsx(Xe,{value:[Ee.volume],onValueChange:([t])=>pt(T=>T?{...T,volume:t}:null),max:100,step:1,className:"w-full","data-testid":"background-music-volume-slider"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white text-xs",onClick:()=>{gt(t=>({...t,originalAudioVolume:100})),Ee&&pt(t=>t?{...t,volume:30}:null)},"data-testid":"preset-dialogue-btn",children:"Dialogue Focus"}),e.jsx(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white text-xs",onClick:()=>{gt(t=>({...t,originalAudioVolume:50})),Ee&&pt(t=>t?{...t,volume:50}:null)},"data-testid":"preset-balanced-btn",children:"Balanced"}),e.jsx(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white text-xs",onClick:()=>{gt(t=>({...t,originalAudioVolume:20})),Ee&&pt(t=>t?{...t,volume:80}:null)},"data-testid":"preset-music-btn",children:"Music Focus"})]})]}),Ks==="layers"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-400",children:"Audio Layers"}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white text-xs",onClick:()=>{const t={id:`layer-${Date.now()}`,type:"sfx",name:`Sound Effect ${_s.length+1}`,volume:80,pan:0,muted:!1,solo:!1,fadeIn:0,fadeOut:0,startOffset:0,duration:5,loop:!1};Qt(T=>[...T,t])},"data-testid":"add-layer-btn",children:[e.jsx(Qe,{className:"w-3 h-3 mr-1"}),"Add Layer"]})]}),e.jsx("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-blue-600/20 flex items-center justify-center",children:e.jsx(Ct,{className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:"Original Audio"}),e.jsx("p",{className:"text-gray-500 text-xs",children:"Video native audio"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",className:`p-1 ${Pe.originalAudioMuted?"text-red-400":"text-gray-400"} hover:text-white`,onClick:()=>gt(t=>({...t,originalAudioMuted:!t.originalAudioMuted})),"data-testid":"layer-mute-original",children:Pe.originalAudioMuted?e.jsx(ds,{className:"w-4 h-4"}):e.jsx(hs,{className:"w-4 h-4"})}),e.jsx(Xe,{value:[Pe.originalAudioVolume],onValueChange:([t])=>gt(T=>({...T,originalAudioVolume:t})),max:100,step:1,className:"w-24",disabled:Pe.originalAudioMuted})]})]})}),Ee&&e.jsx("div",{className:"p-3 bg-white/5 rounded-lg border border-accent/30",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-accent/20 flex items-center justify-center",children:e.jsx(ft,{className:"w-4 h-4 text-accent"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-white text-sm font-medium truncate",children:Ee.track.name}),e.jsx("p",{className:"text-gray-500 text-xs",children:Ee.track.artist})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{value:[Ee.volume],onValueChange:([t])=>pt(T=>T?{...T,volume:t}:null),max:100,step:1,className:"w-24"}),e.jsx(z,{variant:"ghost",size:"sm",className:"p-1 text-red-400 hover:text-red-300",onClick:()=>pt(null),"data-testid":"remove-music-layer",children:e.jsx(rt,{className:"w-4 h-4"})})]})]})}),_s.map(t=>e.jsx("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded flex items-center justify-center ${t.type==="voiceover"?"bg-green-600/20":t.type==="sfx"?"bg-orange-600/20":"bg-purple-600/20"}`,children:t.type==="voiceover"?e.jsx(zs,{className:"w-4 h-4 text-green-400"}):t.type==="sfx"?e.jsx(Bs,{className:"w-4 h-4 text-orange-400"}):e.jsx(ft,{className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(le,{value:t.name,onChange:T=>Qt(E=>E.map(H=>H.id===t.id?{...H,name:T.target.value}:H)),className:"bg-transparent border-none p-0 h-auto text-white text-sm font-medium focus:ring-0","data-testid":`layer-name-${t.id}`}),e.jsx("p",{className:"text-gray-500 text-xs capitalize",children:t.type})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",className:`p-1 ${t.muted?"text-red-400":"text-gray-400"} hover:text-white`,onClick:()=>Qt(T=>T.map(E=>
115E.id===t.id?{...E,muted:!E.muted}:E)),"data-testid":`layer-mute-${t.id}`,children:t.muted?e.jsx(ds,{className:"w-4 h-4"}):e.jsx(hs,{className:"w-4 h-4"})}),e.jsx(z,{variant:"ghost",size:"sm",className:`p-1 ${t.solo?"text-yellow-400":"text-gray-400"} hover:text-white`,onClick:()=>Qt(T=>T.map(E=>E.id===t.id?{...E,solo:!E.solo}:E)),"data-testid":`layer-solo-${t.id}`,children:"S"}),e.jsx(Xe,{value:[t.volume],onValueChange:([T])=>Qt(E=>E.map(H=>H.id===t.id?{...H,volume:T}:H)),max:100,step:1,className:"w-24",disabled:t.muted}),e.jsx(z,{variant:"ghost",size:"sm",className:"p-1 text-red-400 hover:text-red-300",onClick:()=>Qt(T=>T.filter(E=>E.id!==t.id)),"data-testid":`remove-layer-${t.id}`,children:e.jsx(xt,{className:"w-4 h-4"})})]})]})},t.id)),_s.length===0&&!Ee&&e.jsxs("div",{className:"text-center py-6 text-gray-400",children:[e.jsx(Dt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No additional audio layers"}),e.jsx("p",{className:"text-xs",children:"Add music or sound effects to your project"})]})]}),Ks==="ducking"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Audio Ducking"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Automatically lower music when speech is detected"})]}),e.jsx(fa,{checked:Pe.duckingEnabled,onCheckedChange:t=>gt(T=>({...T,duckingEnabled:t})),"data-testid":"ducking-toggle"})]}),Pe.duckingEnabled&&e.jsxs("div",{className:"space-y-3 pt-3 border-t border-white/10",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Duck Amount"}),e.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:[Pe.duckingAmount,"%"]})]}),e.jsx(Xe,{value:[Pe.duckingAmount],onValueChange:([t])=>gt(T=>({...T,duckingAmount:t})),max:100,step:5,className:"w-full","data-testid":"ducking-amount-slider"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"How much to reduce music volume"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Sensitivity"}),e.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:[Pe.duckingThreshold,"%"]})]}),e.jsx(Xe,{value:[Pe.duckingThreshold],onValueChange:([t])=>gt(T=>({...T,duckingThreshold:t})),max:100,step:5,className:"w-full","data-testid":"ducking-threshold-slider"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Voice detection sensitivity"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Attack"}),e.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:[Pe.duckingAttack,"ms"]})]}),e.jsx(Xe,{value:[Pe.duckingAttack],onValueChange:([t])=>gt(T=>({...T,duckingAttack:t})),max:500,step:25,className:"w-full","data-testid":"ducking-attack-slider"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Release"}),e.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:[Pe.duckingRelease,"ms"]})]}),e.jsx(Xe,{value:[Pe.duckingRelease],onValueChange:([t])=>gt(T=>({...T,duckingRelease:t})),max:2e3,step:100,className:"w-full","data-testid":"ducking-release-slider"})]})]})]})]}),!Ee&&e.jsxs("div",{className:"text-center py-4 text-gray-400",children:[e.jsx(ft,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Add background music to use ducking"})]})]})]}),Ws&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(vr,{className:"w-5 h-5"}),"Stock Media Library"]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>di(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>{ui("photo"),Qs(null),Zs("")},className:`flex-1 px-3 py-2 rounded-lg text-sm font-medium transition-all flex items-center justify-center gap-2 ${yt==="photo"?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":"stock-type-photo",children:[e.jsx(ut,{className:"w-4 h-4"}),"Photos"]}),e.jsxs("button",{onClick:()=>{ui("video"),Qs(null),Zs("")},className:`flex-1 px-3 py-2 rounded-lg text-sm font-medium transition-all flex items-center justify-center gap-2 ${yt==="video"?"bg-accent text-white":"bg-white/10 text-gray-300 hover:bg-white/20"}`,"data-testid":"stock-type-video",children:[e.jsx(Ct,{className:"w-4 h-4"}),"Videos"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(le,{placeholder:`Search ${yt==="photo"?"photos":"videos"}...`,value:os,onChange:t=>Zs(t.target.value),onKeyDown:t=>{t.key==="Enter"&&Ps(os,yt)},className:"pl-10 bg-white/10 border-white/20 text-white placeholder:text-gray-500","data-testid":"stock-search-input"})]}),e.jsxs(Oe,{value:Ca,onValueChange:t=>_n(t),children:[e.jsx(Be,{className:"w-32 bg-white/10 border-white/20 text-white",children:e.jsx($e,{})}),e.jsxs(Ve,{children:[e.jsx(ae,{value:"all",children:"All"}),e.jsx(ae,{value:"landscape",children:"Landscape"}),e.jsx(ae,{value:"portrait",children:"Portrait"}),e.jsx(ae,{value:"square",children:"Square"})]})]}),e.jsx(z,{onClick:()=>Ps(os,yt),disabled:Ts||!os.trim(),className:"bg-accent hover:bg-accent/90","data-testid":"stock-search-btn",children:Ts?e.jsx(Ie,{className:"w-4 h-4 animate-spin"}):e.jsx(Pa,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["travel","beach","city","nature","food","people","landscape","adventure"].map(t=>e.jsx("button",{onClick:()=>{Zs(t),Ps(t,yt)},className:"px-2.5 py-1 bg-white/10 hover:bg-white/20 rounded-full text-xs text-gray-300 capitalize transition-colors","data-testid":`stock-quick-search-${t}`,children:t},t))})]}),e.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Ts?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ie,{className:"w-8 h-8 animate-spin text-accent"})}):yt==="photo"&&((Qi=dt==null?void 0:dt.photos)!=null&&Qi.length)?e.jsx("div",{className:"grid grid-cols-3 gap-2",children:dt.photos.map(t=>e.jsxs("div",{className:`relative group cursor-pointer rounded-lg overflow-hidden border-2 transition-all ${Xs.has(t.id)?"border-accent ring-2 ring-accent/30":"border-transparent hover:border-white/30"}`,style:{backgroundColor:t.avgColor},onClick:()=>jl(t),"data-testid":`stock-photo-${t.id}`,children:[e.jsx("img",{src:t.src.medium,alt:t.alt,className:"w-full aspect-square object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-trans
115parent opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-2",children:e.jsx("p",{className:"text-white text-xs truncate",children:t.photographer})})}),Xs.has(t.id)&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(ht,{className:"w-5 h-5 text-accent"})}),e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",onClick:T=>T.stopPropagation(),className:"p-1 bg-black/50 rounded-full hover:bg-black/70",children:e.jsx(pa,{className:"w-3 h-3 text-white"})})})]},t.id))}):yt==="video"&&((Yi=dt==null?void 0:dt.videos)!=null&&Yi.length)?e.jsx("div",{className:"grid grid-cols-2 gap-3",children:dt.videos.map(t=>{var T,E;return e.jsxs("div",{className:`relative group cursor-pointer rounded-lg overflow-hidden border-2 transition-all ${Xs.has(t.id)?"border-accent ring-2 ring-accent/30":"border-transparent hover:border-white/30"}`,onClick:()=>vl(t),"data-testid":`stock-video-${t.id}`,children:[e.jsx("img",{src:((T=t.videoPictures[0])==null?void 0:T.picture)||"",alt:`Video by ${t.user.name}`,className:"w-full aspect-video object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:e.jsx(ca,{className:"w-10 h-10 text-white/80"})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-black/80",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-white text-xs truncate",children:t.user.name}),e.jsxs("span",{className:"text-white/80 text-xs font-mono",children:[t.duration,"s"]})]})}),Xs.has(t.id)&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(ht,{className:"w-5 h-5 text-accent"})}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("span",{className:"px-1.5 py-0.5 bg-black/50 rounded text-[10px] text-white font-mono",children:((E=t.videoFiles.find(H=>H.quality==="hd"))==null?void 0:E.quality)||"SD"})})]},t.id)})}):dt&&(((Ji=dt.photos)==null?void 0:Ji.length)===0||((Xi=dt.videos)==null?void 0:Xi.length)===0)?e.jsxs("div",{className:"text-center py-12 text-gray-400",children:[e.jsx(Pa,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No results found"}),e.jsx("p",{className:"text-sm",children:"Try different keywords"})]}):e.jsxs("div",{className:"text-center py-12 text-gray-400",children:[e.jsx(ys,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsxs("p",{children:["Search for ",yt==="photo"?"photos":"videos"]}),e.jsx("p",{className:"text-sm",children:"Free stock media from Pexels"})]})}),dt&&dt.totalResults>15&&e.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-white/10",children:[e.jsxs("p",{className:"text-xs text-gray-400",children:["Page ",Js," ⢠",dt.totalResults.toLocaleString()," results"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",disabled:Js===1||Ts,onClick:()=>Ps(os,yt,Js-1),className:"bg-white/10 border-white/20 text-white",children:e.jsx(Ha,{className:"w-4 h-4"})}),e.jsx(z,{variant:"outline",size:"sm",disabled:!dt.nextPage||Ts,onClick:()=>Ps(os,yt,Js+1),className:"bg-white/10 border-white/20 text-white",children:e.jsx(Qr,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"mt-4 pt-3 border-t border-white/10",children:e.jsxs("p",{className:"text-xs text-gray-500 text-center flex items-center justify-center gap-1",children:["Photos and videos provided by",e.jsx("a",{href:"https://www.pexels.com",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:"Pexels"})]})})]})]}),e.jsxs(ge,{className:"glass-card border-white/20 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Timeline"}),d.length>0&&e.jsxs("span",{className:"text-sm text-gray-400 font-mono",children:[lt(Xt)," total"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:s&&s.type==="video"&&e.jsxs(e.Fragment,{children:[e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white",onClick:()=>Je(!Ut),"data-testid":"timeline-trim-btn",children:[e.jsx(Wa,{className:"w-4 h-4 mr-1"}),"Trim"]}),e.jsxs(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white",onClick:()=>Et(!0),"data-testid":"timeline-split-btn",children:[e.jsx(Qe,{className:"w-4 h-4 mr-1 rotate-45"}),"Split"]})]})})]}),e.jsxs("div",{ref:kt,className:"relative bg-black/30 rounded-lg p-4 min-h-[120px] overflow-x-auto","data-testid":"timeline-track",children:[d.length===0?e.jsx("div",{className:"flex items-center justify-center h-20",children:e.jsx("p",{className:"text-gray-400 text-sm",children:"Upload media to start building your sequence"})}):e.jsx(nn,{sensors:Mn,collisionDetection:ln,onDragEnd:Un,children:e.jsx(on,{items:Ci.map(t=>
115t.id),strategy:cn,children:e.jsx("div",{className:"flex gap-2 items-center",children:Ci.map(t=>e.jsx(nc,{clip:t,isSelected:(s==null?void 0:s.id)===t.id,onSelect:()=>m(t.mediaItem),onTrim:()=>{m(t.mediaItem),Je(!0)},onSplit:()=>{m(t.mediaItem),Et(!0)},formatTime:lt,pixelsPerSecond:30},t.id))})})}),d.length>0&&e.jsx("div",{className:"mt-3 border-t border-white/10 pt-2",children:e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 font-mono",children:[e.jsx("span",{children:"0:00"}),e.jsx("span",{children:lt(Xt/4)}),e.jsx("span",{children:lt(Xt/2)}),e.jsx("span",{children:lt(Xt*3/4)}),e.jsx("span",{children:lt(Xt)})]})}),(Ee||_s.length>0)&&d.length>0&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 mb-2",children:[e.jsx(ft,{className:"w-3 h-3"}),e.jsx("span",{children:"Audio Tracks"})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white/5 rounded-lg border border-white/10",children:[e.jsx("div",{className:"w-6 flex-shrink-0",children:e.jsx(z,{variant:"ghost",size:"sm",className:`p-0 h-6 w-6 ${Pe.originalAudioMuted?"text-red-400":"text-blue-400"}`,onClick:()=>gt(t=>({...t,originalAudioMuted:!t.originalAudioMuted})),"data-testid":"timeline-mute-original",children:Pe.originalAudioMuted?e.jsx(ds,{className:"w-3 h-3"}):e.jsx(hs,{className:"w-3 h-3"})})}),e.jsxs("div",{className:"flex-1 h-6 bg-blue-900/30 rounded overflow-hidden relative",children:[e.jsx($a,{width:Math.max(Xt*30,200),height:24,color:Pe.originalAudioMuted?"#4B5563":"#3B82F6"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent to-blue-900/50",style:{opacity:Pe.originalAudioMuted?.7:0}})]}),e.jsxs("span",{className:"text-xs text-gray-500 w-8 text-right",children:[Pe.originalAudioVolume,"%"]})]}),Ee&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-accent/5 rounded-lg border border-accent/20",children:[e.jsx("div",{className:"w-6 flex-shrink-0",children:e.jsx(ft,{className:"w-3 h-3 text-accent"})}),e.jsx("div",{className:"flex-1 h-6 bg-accent/10 rounded overflow-hidden",children:e.jsx($a,{width:Math.max(Xt*30,200),height:24,color:"hsl(var(--accent))",data:Ee.track.waveformData})}),e.jsx("span",{className:"text-xs text-gray-500 truncate max-w-[80px]",children:Ee.track.name}),e.jsxs("span",{className:"text-xs text-gray-500 w-8 text-right",children:[Ee.volume,"%"]})]}),_s.map(t=>e.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg border ${t.type==="voiceover"?"bg-green-900/10 border-green-800/30":t.type==="sfx"?"bg-orange-900/10 border-orange-800/30":"bg-purple-900/10 border-purple-800/30"}`,children:[e.jsx("div",{className:"w-6 flex-shrink-0",children:e.jsx(z,{variant:"ghost",size:"sm",className:`p-0 h-6 w-6 ${t.muted?"text-red-400":t.type==="voiceover"?"text-green-400":t.type==="sfx"?"text-orange-400":"text-purple-400"}`,onClick:()=>Qt(T=>T.map(E=>E.id===t.id?{...E,muted:!E.muted}:E)),"data-testid":`timeline-mute-layer-${t.id}`,children:t.muted?e.jsx(ds,{className:"w-3 h-3"}):t.type==="voiceover"?e.jsx(zs,{className:"w-3 h-3"}):e.jsx(Bs,{className:"w-3 h-3"})})}),e.jsx("div",{className:`flex-1 h-6 rounded overflow-hidden ${t.type==="voiceover"?"bg-green-900/20":t.type==="sfx"?"bg-orange-900/20":"bg-purple-900/20"}`,children:e.jsx($a,{width:Math.max(t.duration*30,60),height:24,color:t.muted?"#4B5563":t.type==="voiceover"?"#22C55E":t.type==="sfx"?"#F97316":"#A855F7",data:t.waveformData})}),e.jsx("span",{className:"text-xs text-gray-500 truncate max-w-[80px]",children:t.name}),e.jsxs("span",{className:"text-xs text-gray-500 w-8 text-right",children:[t.volume,"%"]})]},t.id))]})]}),Ut&&s&&s.type==="video"&&e.jsxs("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-white font-semibold",children:["Trim: ",s.name]}),e.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:()=>Je(!1),children:e.jsx(rt,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm text-gray-400 mb-2",children:[e.jsxs("span",{children:["Start: ",lt(s.trimStart)]}),e.jsxs("span",{children:["End: ",lt(s.trimEnd)]})]}),e.jsxs("div",{className:"relative h-12 bg-gray-800 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"absolute h-full bg-accent/30",style:{left:`${s.trimStart/s.originalDuration*100}%`,width:`${(s.trimEnd-s.trimStart)/s.originalDuration*100}%`}}),e.jsx("input",{type:"range",min:0,max:s.originalDuration,step:.1,value:s.trimStart,onCh
115ange:t=>{const T=parseFloat(t.target.value);T<s.trimEnd-.5&&cs(s.id,T,s.trimEnd)},className:"absolute w-full h-full opacity-0 cursor-ew-resize","data-testid":"trim-start-slider"})]}),e.jsxs("div",{className:"flex gap-4 mt-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"Start Time"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/10 border-white/20",onClick:()=>cs(s.id,Math.max(0,s.trimStart-.5),s.trimEnd),children:"-"}),e.jsx("span",{className:"text-white font-mono text-sm flex-1 text-center",children:lt(s.trimStart)}),e.jsx(z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/10 border-white/20",onClick:()=>cs(s.id,Math.min(s.trimEnd-.5,s.trimStart+.5),s.trimEnd),children:"+"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(q,{className:"text-xs text-gray-400",children:"End Time"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/10 border-white/20",onClick:()=>cs(s.id,s.trimStart,Math.max(s.trimStart+.5,s.trimEnd-.5)),children:"-"}),e.jsx("span",{className:"text-white font-mono text-sm flex-1 text-center",children:lt(s.trimEnd)}),e.jsx(z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/10 border-white/20",onClick:()=>cs(s.id,s.trimStart,Math.min(s.originalDuration,s.trimEnd+.5)),children:"+"})]})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-white/10",children:[e.jsxs("span",{className:"text-sm text-gray-400",children:["Clip duration: ",e.jsx("span",{className:"text-white font-mono",children:lt(ta(s))})]}),e.jsx(z,{variant:"outline",size:"sm",className:"bg-white/10 border-white/20 text-white",onClick:()=>cs(s.id,0,s.originalDuration),children:"Reset Trim"})]})]})})]})]}),e.jsx(Me,{open:ns,onOpenChange:Et,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20",children:[e.jsxs(Ue,{children:[e.jsx(qe,{className:"text-white",children:"Split Clip"}),e.jsxs(Ke,{className:"text-gray-400",children:['Split "',s==null?void 0:s.name,'" at the current playhead position']})]}),s&&s.type==="video"&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-gray-400 mb-2",children:"Split at:"}),e.jsx("p",{className:"text-2xl text-white font-mono",children:lt(G)})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"This will create:"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 bg-white/10 rounded p-2 text-center",children:[e.jsx("p",{className:"text-sm text-white",children:"Part 1"}),e.jsxs("p",{className:"text-xs text-gray-400 font-mono",children:["0:00 - ",lt(G)]})]}),e.jsxs("div",{className:"flex-1 bg-white/10 rounded p-2 text-center",children:[e.jsx("p",{className:"text-sm text-white",children:"Part 2"}),e.jsxs("p",{className:"text-xs text-gray-400 font-mono",children:[lt(G)," - ",lt(ta(s))]})]})]})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",className:"bg-white/10 border-white/20 text-white",onClick:()=>Et(!1),children:"Cancel"}),e.jsx(z,{className:"bg-accent hover:bg-accent/90 text-black",onClick:()=>{s&&G>0&&qn(s.id,G)},disabled:!s||G<=0,"data-testid":"confirm-split-btn",children:"Split Clip"})]})]})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(z,{className:"flex-1 bg-accent hover:bg-accent/90 text-black font-semibold",onClick:xl,disabled:d.length===0,"data-testid":"export-button",children:[e.jsx(St,{className:"w-4 h-4 mr-2"}),"Export for Social Media"]}),e.jsxs(z,{variant:"outline",className:"bg-white/10 border-white/20 text-white hover:bg-white/20",onClick:wl,disabled:d.length===0,"data-testid":"share-button",children:[e.jsx(ps,{className:"w-4 h-4 mr-2"}),"Share"]})]}),e.jsxs(z,{variant:"outline",className:"w-full mt-3 bg-gradient-to-r from-green-600/20 to-emerald-600/20 border-green-500/30 text-white hover:from-green-600/30 hover:to-emerald-600/30",onClick:()=>Hs(!0),disabled:d.length===0,"data-testid":"save-to-profile-button",children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Save to My Profile"]}),e.jsxs(z,{variant:"outline",className:"w-full mt-3 bg-gradient-to-r from-purple-600/20 to-pink-600/20 border-purple-500/30 text-white hover:from-purple-600/30 hover:to-pink-600/30",onClick:()=>be(!0),disabled:d.length===0,"data-testid":"schedule-distribution-button",children:[e.jsx(At,{className:"w-4 h-4 mr-2"}),"Schedule Multi-Platform Distribution"]})]})]})]}),e.jsx(ze,{value:"events",className:"space-y-6",children:e.jsx(zo,{})}),e.jsx(ze,{value:"brand-kits",className:"space-y-6",children:e.jsx(Jo,{})}),e.jsx(ze,{value:"branded-assets",className:"space-y-6",children:e.jsx(tc,{})}),e.jsx(ze,{value:"programs",className:"space-y-6",children:e.jsx(sc,{})})]})]}),e.jsx(Me,{open:v,onOpenChange:x,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-md",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(tt,{className:"w-5 h-5 text-purple-400"}),"Generate AI Highlight Reel"]}),e.jsx(Ke,{className:"text-gray-400",children:"AI will auto-generate a 30-60 second video with music, transitions, and captions"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Template Style"}),e.jsxs(Oe,{value:O,onValueChange:t=>ne(t),children:[e.jsx(Be,{className:"bg-white/10 border-white/20 text-white",children:e.jsx($e,{})}),e.jsx(Ve,{className:"bg-[#1E293B] border-white/20",children:Object.values(Se).map(t=>e.jsx(ae,{value:t.id,className:"text-white",children:t.name},t.id))})]})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-semibold text-white mb-2",children:"AI Features"}),e.jsxs("ul",{className:"space-y-1 text-sm text-gray-400",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"w-4 h-4 text-purple-400"}),"Auto-select music: ",Se[O].music]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(nr,{className:"w-4 h-4 text-purple-400"}),"Smart transitions: ",Se[O].transitions]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(js,{className:"w-4 h-4 text-purple-400"}),"Auto-generate captions from route data"]})]})]})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>x(!1),className:"bg-white/10 border-white/20 text-white",children:"Cancel"}),e.jsx(z,{className:"bg-purple-600 hover:bg-purple-700 text-white",onClick:al,disabled:xe,"data-testid":"confirm-ai-generate",children:xe?"Generating...":"Generate Reel"})]})]})}),e.jsx(Me,{open:k,onOpenChange:D,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-md",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(Dt,{className:"w-5 h-5 text-blue-400"}),"Create Remix Reel"]}),e.jsx(Ke,{className:"text-gray-400",children:"Show your version side-by-side with the original route"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Remix Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{className:`p-4 rounded-lg border-2 transition-colors ${Y==="side-by-side"?"border-accent bg-accent/20":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>L("side-by-side"),"data-testid":"remix-side-by-side",children:[e.jsx(Dt,{className:"w-6 h-6 mb-2 mx-auto text-accent"}),e.jsx("p",{className:"text-sm font-medium text-center",children:"Side-by-Side"}),e.jsx("p",{className:"text-xs text-gray-400 text-center mt-1",children:"TikTok Duet style"})]}),e.jsxs("button",{className:`p-4 rounded-lg border-2 transition-colors ${Y==="overlay"?"border-accent bg-accent/20":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>L("overlay"),"data-testid":"remix-overlay",children:[e.jsx(Dt,{className:"w-6 h-6 mb-2 mx-auto text-accent"}),e.jsx("p",{className:"text-sm font-medium text-center",children:"Overlay"}),e.jsx("p",{className:"text-xs text-gray-400 text-center mt-1",children:"Picture-in-picture"})]})]})]}),e.jsx("div",{className:"p-4 bg-white/5 rounded-lg",children:e.jsx("p",{className:"text-sm text-gray-300",children:'Your remix will show "Original Slant vs. My Remix" allowing viewers to compare routes'})})]}),e.jsxs(Ze,{children:[e.jsx(z,{variant:"outline",onClick:()=>D(!1),className:"bg-white/10 border-white/20 text-white",children:"Cancel"}),e.jsx(z,{className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{D(!1),P({title:"Remix created!",description:`${Y} mode enabled`})},"data-testid":"confirm-remix",children:"Create Remix"})]})]})}),e.jsx(Me,{open:y,onOpenChange:t=>{Vt||h(t)},children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-lg",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(St,{className:"w-5 h-5 text-accent"}),"Export Your Creation"]}),e.jsx(Ke,{className:"text-gray-400",children:"Download your media files to share on social platforms"})]}),e.jsxs("div",{className:"space-y-4",children:[Vt&&e.jsxs("div",{className:"p-4 bg-accent/10 border border-accent/20 rounded-lg","data-testid":"export-progress-container",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm text-white","data-testid":"export-status-text",children:ji?"Rendering video...":"Preparing download..."}),e.jsxs("span",{className:"text-sm text-accent font-medium","data-testid":"export-progress-percent",children:[bi,"%"]})]}),e.jsx("div",{className:"w-full bg-white/10 rounded-full h-2",children:e.jsx("div",{className:"bg-accent rounded-full h-2 transition-all duration-300",style:{width:`${bi}%`},"data-testid":"export-progress-bar"})}),ji&&e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"This may take a few minutes. You can close this dialog and we'll notify you when it's ready."})]}),Jt&&!Vt&&e.jsxs("div",{className:"p-4 bg-green-500/10 border border-green-500/20 rounded-lg","data-testid":"export-complete-container",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(Bt,{className:"w-6 h-6 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium","data-testid":"export-ready-title",children:"Video Ready!"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Your rendered video is ready to download and share"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(z,{className:"flex-1 bg-green-600 hover:bg-green-700 text-white",onClick:()=>window.open(Jt,"_blank"),"data-testid":"download-rendered-video",children:[e.jsx(St,{className:"w-4 h-4 mr-2"}),"Download Video"]}),e.jsx(z,{variant:"outline",className:"bg-white/10 border-white/20 text-white",onClick:()=>{In(null),En(null)},"data-testid":"clear-export",children:"New Export"})]})]}),!Vt&&!Jt&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Export Format"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{className:`p-3 border rounded-lg text-left transition-colors ${pi==="reel"?"bg-accent/20 border-accent":"bg-white/5 hover:bg-white/10 border-white/20"}`,onClick:()=>gi("reel"),"data-testid":"format-reel",children:[e.jsx(Ct,{className:"w-5 h-5 mb-1 text-accent"}),e.jsx("p",{className:"text-sm font-medium text-white",children:"Reel/Story"}),e.jsx("p",{className:"text-xs text-gray-400",children:"9:16 vertical"})]}),e.jsxs("button",{className:`p-3 border rounded-lg text-left transition-colors ${pi==="carousel"?"bg-accent/20 border-accent":"bg-white/5 hover:bg-white/10 border-white/20"}`,onClick:()=>gi("carousel"),"data-testid":"format-carousel",children:[e.jsx(ut,{className:"w-5 h-5 mb-1 text-accent"}),e.jsx("p",{className:"text-sm font-medium text-white",children:"Carousel"}),e.jsx("p",{className:"text-xs text-gray-400",children:"1:1 square"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"branding-checkbox",checked:Fn,onChange:t=>An(t.target.checked),className:"rounded","data-testid":"branding-checkbox"}),e.jsx(q,{htmlFor:"branding-checkbox",className:"text-white cursor-pointer",children:'Include "Created in Slant" branding'})]}),e.jsx("div",{className:"p-3 bg-white/5 rounded-lg","data-testid":"export-media-count",children:e.jsxs("p",{className:"text-sm text-gray-300",children:[d.length," ",d.length===1?"file":"files"," ready to export",d.length>1&&e.jsx("span",{className:"text-gray-400",children:" (will download as ZIP)"}),d.some(t=>t.type==="video")&&d.some(t=>t.type==="image")&&e.jsxs("span",{className:"text-gray-400",children:[" - ",d.filter(t=>t.type==="video").length," videos, ",d.filter(t=>t.type==="image").length," images"]})]})}),As.length>0&&e.jsxs("div",{className:"p-4 bg-gradient-to-br from-purple-500/10 to-pink-500/10 border border-purple-500/20 rounded-lg","data-testid":"direct-publish-section",children:[e.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-2",children:[e.jsx(ps,{className:"w-4 h-4 text-purple-400"}),"Publish Directly"]}),e.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Select platforms to publish your content directly after export"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 mb-3",children:As.map(t=>{const T=ki[t.platform];if(!T)return null;const E=T.icon,H=Pt.has(t.platform);return e.jsxs("button",{onClick:()=>Bn(t.platform),className:`flex items-center gap-2 p-2 rounded-lg border transition-all ${H?"bg-white/20 border-purple-400":"bg-white/5 border-white/10 hover:bg-white/10"}`,"data-testid":`select-platform-${t.platform}`,children:[e.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center",style:{backgroundColor:`${T.color}20`},children:e.jsx(E,{className:"w-3.5 h-3.5",style:{color:T.color}})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:"text-xs font-medium text-white",children:T.name}),e.jsxs("p",{className:"text-[10px] text-gray-400 truncate",children:["@",t.platformUsername||t.platformDisplayName]})]}),H&&e.jsx(Bt,{className:"w-4 h-4 text-purple-400"})]},t.id)})}),Pt.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{placeholder:"Add a caption for your post...",value:vi,onChange:t=>Rn(t.target.value),className:"bg-white/10 border-white/20 text-white text-sm","data-testid":"publish-caption-input"}),e.jsxs("p",{className:"text-[10px] text-gray-400",children:["Publishing to ",Pt.size," platform",Pt.size>1?"s":""]})]}),yi.length>0&&e.jsx("div",{className:"mt-3 space-y-1",children:yi.map((t,T)=>{const E=ki[t.platform];return e.jsxs("div",{className:`flex items-center gap-2 p-2 rounded text-xs ${t.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,"data-testid":`publish-result-${t.platform}`,children:[t.success?e.jsx(Bt,{className:"w-3 h-3"}):e.jsx(rt,{className:"w-3 h-3"}),e.jsx("span",{children:(E==null?void 0:E.name)||t.platform}),t.error&&e.jsxs("span",{className:"text-gray-400",children:["- ",t.error]})]},T)})})]}),As.length===0&&!On&&e.jsx("div",{className:"p-3 bg-purple-500/10 border border-purple-500/20 rounded-lg","data-testid":"connect-accounts-cta",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(lr,{className:"w-5 h-5 text-purple-400 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white font-medium",children:"Publish Directly to Social Media"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Connect your social accounts to publish content directly without downloading."}),e.jsx(z,{variant:"outline",size:"sm",className:"mt-2 bg-purple-500/20 border-purple-400/30 text-purple-300 hover:bg-purple-500/30",onClick:()=>window.location.href="/settings/social-accounts","data-testid":"link-to-social-settings",children:"Connect Accounts"})]})]})}),e.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg","data-testid":"export-instructions",children:e.jsxs("p",{className:"text-xs text-blue-300",children:[e.jsx("strong",{children:"Tip:"})," ",As.length>0?"Export your files and optionally publish d
115irectly to your connected accounts above.":"Download your files, then upload them to TikTok, Instagram, Facebook, or Twitter using their apps."]})})]})]}),e.jsxs(Ze,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(z,{variant:"outline",onClick:()=>h(!1),className:"bg-white/10 border-white/20 text-white",disabled:Vt||ea,"data-testid":"cancel-export",children:Vt||ea?"Close":"Cancel"}),Jt&&Pt.size>0&&e.jsx(z,{className:"bg-purple-600 hover:bg-purple-700 text-white",onClick:$n,disabled:ea,"data-testid":"publish-button",children:ea?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Publishing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ps,{className:"w-4 h-4 mr-2"}),"Publish to ",Pt.size," Platform",Pt.size>1?"s":""]})}),!Jt&&e.jsx(z,{className:"bg-accent hover:bg-accent/90 text-black",onClick:pl,disabled:Vt||d.length===0,"data-testid":"confirm-export",children:Vt?e.jsx(e.Fragment,{children:"Processing..."}):e.jsxs(e.Fragment,{children:[e.jsx(St,{className:"w-4 h-4 mr-2"}),"Download Files"]})})]})]})}),e.jsx(Me,{open:Fe,onOpenChange:He,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-lg",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2",children:[e.jsx(ps,{className:"w-5 h-5 text-accent"}),"Share Your Slant"]}),e.jsx(Ke,{className:"text-gray-400",children:"Share your creation and help others discover Slant"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Caption with Hashtags"}),e.jsx("div",{className:"bg-white/5 border border-white/20 rounded-lg p-4 max-h-48 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-gray-300 whitespace-pre-wrap",children:ie})}),e.jsx(z,{variant:"outline",size:"sm",className:"mt-2 bg-white/10 border-white/20 text-white hover:bg-white/20",onClick:Ii,"data-testid":"copy-caption-button",children:I?e.jsxs(e.Fragment,{children:[e.jsx(Bt,{className:"w-4 h-4 mr-2"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{className:"w-4 h-4 mr-2"}),"Copy Caption"]})})]}),e.jsxs("div",{children:[e.jsxs(q,{className:"text-white mb-2 flex items-center gap-2",children:[e.jsx(Za,{className:"w-4 h-4"}),"Generated Hashtags"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:F.slice(0,10).map((t,T)=>e.jsx("span",{className:"px-2 py-1 bg-accent/20 text-accent rounded-full text-xs","data-testid":`hashtag-${T}`,children:t},T))})]}),e.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-blue-500 flex items-center justify-center flex-shrink-0 text-white text-xs font-bold",children:"1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-white font-medium",children:"Download your files first"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Export your media so you can upload it to social platforms"}),e.jsxs(z,{size:"sm",className:"mt-2 bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{He(!1),h(!0)},"data-testid":"go-to-export",children:[e.jsx(St,{className:"w-4 h-4 mr-2"}),"Go to Export"]})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-accent flex items-center justify-center flex-shrink-0 text-black text-xs font-bold",children:"2"}),e.jsx(q,{className:"text-white",children:"Open platform & upload your files"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(z,{variant:"outline",className:"bg-gradient-to-r from-purple-600 to-pink-600 border-0 text-white hover:from-purple-700 hover:to-pink-700",onClick:()=>sa("instagram"),"data-testid":"share-instagram",children:[e.jsx(fs,{className:"w-5 h-5 mr-2"}),"Instagram"]}),e.jsxs(z,{variant:"outline",className:"bg-black border-white/20 text-white hover:bg-gray-900",onClick:()=>sa("tiktok"),"data-testid":"share-tiktok",children:[e.jsx(ss,{className:"w-5 h-5 mr-2"}),"TikTok"]}),e.jsxs(z,{variant:"outline",className:"bg-blue-600 border-0 text-white hover:bg-blue-700",onClick:()=>sa("facebook"),"data-testid":"share-facebook",children:[e.jsx(ua,{className:"w-5 h-5 mr-2"}),"Facebook"]}),e.jsxs(z,{variant:"outline",className:"bg-sky-500 border-0 text-white hover:bg-sky-600",onClick:()=>sa("twitter"),"data-testid":"share-twitter",children:[e.jsx(ma,{className:"w-5 h-5 mr-2"}),"Twitter"]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"Caption is auto-copied when you click a platform button"})]}),e.jsx("div",{className:"p-3 bg-accent/10 border border-accent/20 rounded-lg",children:e.jsxs("p",{className:"text-xs text-gray-300",children:[e.jsx("strong",{children:"Help grow the Slant community!"})," Every share helps creators discover the platform and create amazing travel content."]})})]}),e.jsx(Ze,{children:e.jsx(z,{variant:"outline",onClick:()=>He(!1),className:"bg-white/10 border-white/20 text-white",children:"Close"})})]})}),e.jsx(Me,{open:ke,onOpenChange:A,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-lg",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(tt,{className:"w-6 h-6 text-green-400"}),"Create Your Travel Story"]}),e.jsx(Ke,{className:"text-gray-400",children:o?`Share your experience in ${o}`:b?"Create your own story inspired by what you just watched":"Turn your route into an engaging story"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:`p-4 rounded-lg border-2 transition-all cursor-pointer ${a===0?"border-green-500 bg-green-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>{var t;V(0),A(!1),(t=M.current)==null||t.click()},"data-testid":"quick-start-upload",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-green-500/20 flex items-center justify-center flex-shrink-0",children:e.jsx(Ft,{className:"w-5 h-5 text-green-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-white",children:"Upload Your Media"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Add photos or videos from your trip"})]})]})}),e.jsx("div",{className:`p-4 rounded-lg border-2 transition-all cursor-pointer ${a===1?"border-purple-500 bg-purple-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>{V(1),A(!1),x(!0)},"data-testid":"quick-start-ai",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-purple-500/20 flex items-center justify-center flex-shrink-0",children:e.jsx(nr,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-white",children:"AI Auto-Generate"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Let AI create a highlight reel with music & captions"})]})]})}),e.jsx("div",{className:"p-4 rounded-lg border-2 transition-all cursor-pointer border-white/20 bg-white/5 hover:bg-white/10",onClick:()=>{A(!1),ne("adventure"),P({title:"Template selected!",description:"Adventure style applied. Upload media to begin."})},"data-testid":"quick-start-template",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/20 flex items-center justify-center flex-shrink-0",children:e.jsx(oa,{className:"w-5 h-5 text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-white",children:"Start with Template"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Choose a style that matches your trip vibe"})]})]})})]}),o&&e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg flex items-center gap-3",children:[e.jsx(bs,{className:"w-5 h-5 text-accent flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white",children:"Location auto-set to"}),e.jsx("p",{className:"text-accent font-medium",children:o})]})]}),e.jsx("div",{className:"p-3 bg-accent/10 border border-accent/20 rounded-lg",children:e.jsxs("p",{className:"text-xs text-gray-300",children:["ð¡ ",e.jsx("strong",{children:"Pro tip:"}
115)," Vertical videos (9:16) perform best on TikTok and Instagram Reels!"]})})]}),e.jsxs(Ze,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(z,{variant:"outline",onClick:()=>A(!1),className:"bg-white/10 border-white/20 text-white",children:"Skip Guide"}),e.jsxs(z,{className:"bg-green-600 hover:bg-green-700 text-white",onClick:()=>{var t;A(!1),(t=M.current)==null||t.click()},"data-testid":"quick-start-begin",children:[e.jsx(Ft,{className:"w-4 h-4 mr-2"}),"Upload & Start Creating"]})]})]})}),e.jsx(Me,{open:yn,onOpenChange:Gs,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Lt,{className:"w-6 h-6 text-accent"}),"Template Preview: ",Se[O].name]}),e.jsxs(Ke,{className:"text-gray-400",children:["See how your media will look with the ",Se[O].name," template theme applied"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-lg border-2",style:{borderColor:Se[O].colors.primary,background:`linear-gradient(135deg, ${Se[O].colors.secondary}20 0%, ${Se[O].colors.primary}20 100%)`},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("span",{className:"text-2xl",children:Se[O].icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg",style:{color:Se[O].colors.primary},children:Se[O].name}),e.jsx("p",{className:"text-sm text-gray-400",children:Se[O].description})]})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Theme colors:"}),e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-white/30",style:{backgroundColor:Se[O].colors.primary},title:"Primary"}),e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-white/30",style:{backgroundColor:Se[O].colors.secondary},title:"Secondary"}),Se[O].colors.accent&&e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-white/30",style:{backgroundColor:Se[O].colors.accent},title:"Accent"}),e.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["Font: ",Se[O].font]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-medium mb-3 flex items-center gap-2",children:[e.jsx(oa,{className:"w-4 h-4"}),"Your Media with Template Style"]}),d.length===0?e.jsxs("div",{className:"text-center py-12 bg-white/5 rounded-lg",children:[e.jsx(ut,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No media uploaded yet"})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:d.slice(0,6).map((t,T)=>{var E;return e.jsxs("div",{className:"relative rounded-lg overflow-hidden border-2",style:{borderColor:Se[O].colors.primary,aspectRatio:((E=ms.find(H=>H.id===C))==null?void 0:E.ratio)||"16/9"},"data-testid":`template-preview-item-${T}`,children:[t.type==="image"?e.jsx("img",{src:t.url,alt:t.name,className:"w-full h-full object-cover",style:{filter:la(t)}}):e.jsx("video",{src:t.url,className:"w-full h-full object-cover",style:{filter:la(t)},muted:!0}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:`linear-gradient(to top, ${Se[O].colors.secondary}90 0%, transparent 40%)`}}),e.jsx("div",{className:"absolute bottom-2 left-2 right-2 text-center",style:{color:Se[O].colors.text,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:e.jsx("p",{className:"text-xs font-medium truncate",style:{fontFamily:Se[O].font},children:t.name.replace(/\.[^/.]+$/,"")})}),e.jsx("div",{className:"absolute top-2 left-2 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",style:{backgroundColor:Se[O].colors.primary,color:Se[O].colors.text},children:T+1})]},t.id)})}),d.length>6&&e.jsxs("p",{className:"text-center text-gray-400 text-sm mt-3",children:["+",d.length-6," more clips in your reel"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ft,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-sm text-white font-medium",children:"Suggested Music"})]}),e.jsx("p",{className:"text-xs text-gray-400",children:Se[O].music})]}),e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(jr,{className:"w-4 h-4 text-blue-400"}),e.jsx("span",{className:"text-sm text-white font-medium",children:"Transitions"})]}),e.jsx("p",{className:"text-xs text-gray-400",children:Se[O].transitions})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(z,{variant:"outline",className:"flex-1 bg-white/10 border-white/20 text-white",onClick:()=>Gs(!1),children:"Close Preview"}),e.jsxs(z,{className:"flex-1",style:{backgroundColor:Se[O].colors.primary,color:Se[O].colors.text},onClick:()=>{Gs(!1),P({title:"Template applied!",description:`${Se[O].name} style will be used when you export or share.`})},"data-testid":"apply-template-button",children:[e.jsx(ht,{className:"w-4 h-4 mr-2"}),"Apply This Template"]})]})]})]})}),e.jsx(Me,{open:Nn,onOpenChange:Hs,children:e.jsxs(Le,{className:"bg-[#1E293B] border-white/20 text-white sm:max-w-md",children:[e.jsxs(Ue,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Ls,{className:"w-6 h-6 text-green-400"}),"Save Reel to Your Profile"]}),e.jsx(Ke,{className:"text-gray-400",children:"Save this reel to your Slant profile and choose who can see it"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Reel Title *"}),e.jsx(le,{value:Cs,onChange:t=>ri(t.target.value),placeholder:"My Travel Adventure",className:"bg-white/10 border-white/20 text-white placeholder:text-gray-500","data-testid":"reel-title-input"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-2 block",children:"Description (optional)"}),e.jsx("textarea",{value:ni,onChange:t=>li(t.target.value),placeholder:"Share a bit about your trip...",className:"w-full h-20 bg-white/10 border border-white/20 rounded-md px-3 py-2 text-white placeholder:text-gray-500 resize-none focus:outline-none focus:ring-2 focus:ring-accent","data-testid":"reel-description-input"})]}),e.jsxs("div",{children:[e.jsx(q,{className:"text-white mb-3 block",children:"Who can see this reel?"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:`p-3 rounded-lg border-2 cursor-pointer transition-all ${ls==="private"?"border-green-500 bg-green-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>Ss("private"),"data-testid":"visibility-private",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(un,{className:"w-5 h-5 text-gray-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:"Private"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Only you can see this reel"})]})]})}),e.jsx("div",{className:`p-3 rounded-lg border-2 cursor-pointer transition-all ${ls==="followers"?"border-green-500 bg-green-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>Ss("followers"),"data-testid":"visibility-followers",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($t,{className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:"Followers Only"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Only people who follow you can see this"})]})]})}),e.jsx("div",{className:`p-3 rounded-lg border-2 cursor-pointer transition-all ${ls==="unlisted"?"border-green-500 bg-green-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>Ss("unlisted"),"data-testid":"visibility-unlisted",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(lr,{className:"w-5 h-5 text-purple-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:"Unlisted"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Anyone with the link can view, but won't appear in search"})]})]})}),e.jsx("div",{className:`p-3 rounded-lg border-2 cursor-pointer transition-all ${ls==="public"?"border-green-500 bg-green-500/10":"border-white/20 bg-white/5 hover:bg-white/10"}`,onClick:()=>Ss("public"),"data-testid":"visibility-public",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ys,{className:"w-5 h-5 text-green-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:"Public"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Everyone can discover and view this reel"})]})]})})]})]}),e.jsxs("div",{className:"p-3 bg-white/5 rounded-lg flex items-center gap-3",children:[e.jsx(oa,{className:"w-5 h-5 text-accent flex-shrink-0"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-white",children:[d.length," clip",d.length!==1?"s":""," in this reel"]}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Template: ",Se[O].name," ⢠Aspect: ",C]})]})]})]}),e.jsxs(Ze,{className:"flex-col sm:flex-row gap-2 mt-4",children:[e.jsx(z,{variant:"outline",onClick:()=>Hs(!1),className:"bg-white/10 border-white/20 text-white",disabled:Na,children:"Cancel"}),e.jsx(z,{className:"bg-green-600 hover:bg-green-700 text-white",onClick:gl,disabled:Na||!Cs.trim(),"data-testid":"confirm-save-reel-button",children:Na?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Save Reel"]})})]})]})}),e.jsx(Ao,{open:we,onOpenChange:be,reelId:`reel-${Date.now()}`,defaultTitle:"",defaultCaption:ie}),e.jsx(Wo,{open:Cn,onOpenChange:hi,onImport:Xn}),e.jsx(Zo,{open:Sn,onOpenChange:mi,onSelect:el})]})}
115export{Ad as default};
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.