vendor: 16,084 bytes, lines 1-14
1import{g as Se,c as Ee,r as J,j as n}from"./index-VtoEPkXG.js";import{a as xe}from"./campaignData-DPxBzQLp.js";var we={exports:{}};/* @license 2Papa Parse 3v5.5.4 4https://github.com/mholt/PapaParse 5License: MIT 6*/(function(T,ne){((V,w)=>{T.exports=w()})(Ee,function V(){var w=typeof self<"u"?self:typeof window<"u"?window:w!==void 0?w:{},W,v=!w.document&&!!w.postMessage,d=w.IS_PAPA_WORKER||!1,B={},S=0,l={};function ee(e){return e.charCodeAt(0)===65279?e.slice(1):e}function $(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(t){var i=Q(t);i.chunkSize=parseInt(i.chunkSize),t.step||t.chunk||(i.chunkSize=null),this._handle=new oe(i),(this._handle.streamer=this)._config=i}).call(this,e),this.parseChunk=function(t,i){var a=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<a){let m=this._config.newline;m||(s=this._config.quoteChar||'"',m=this._handle.guessLineEndings(t,s)),t=[...t.split(m).slice(a)].join(m)}this.isFirstChunk&&b(this._config.beforeFirstChunk)&&(s=this._config.beforeFirstChunk(t))!==void 0&&(t=s),this.isFirstChunk=!1,this._halted=!1;var a=this._partialLine+t,s=(this._partialLine="",this._handle.parse(a,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(t=s.meta.cursor,a=(this._finished||(this._partialLine=a.substring(t-this._baseIndex),this._baseIndex=t),s&&s.data&&(this._rowCount+=s.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),d)w.postMessage({results:s,workerId:l.WORKER_ID,finished:a});else if(b(this._config.chunk)&&!i){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!a||!b(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(t){b(this._config.error)?this._config.error(t):d&&this._config.error&&w.postMessage({workerId:l.WORKER_ID,error:t,finished:!1})}}function te(e){var t;(e=e||{}).chunkSize||(e.chunkSize=l.RemoteChunkSize),$.call(this,e),this._nextChunk=v?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(i){this._input=i,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),v||(t.onload=E(this._chunkLoaded,this),t.onerror=E(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!v),this._config.downloadRequestHeaders){var i,a=this._config.downloadRequestHeaders;for(i in a)t.setRequestHeader(i,a[i])}var s;this._config.chunkSize&&(s=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+s));try{t.send(this._config.downloadRequestBody)}catch(m){this._chunkError(m.message)}v&&t.status===0&&this._chunkError()}},this._chunkLoaded=function(){t.readyState===4&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(i=>(i=i.getResponseHeader("Content-Range"))!==null?parseInt(i.substring(i.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(i){i=t.statusText||i,this._sendError(new Error(i))}}function le(e){(e=e||{}).chunkSize||(e.chunkSize=l.LocalChunkSize),$.call(this,e);var t,i,a=typeof FileReader<"u";this.stream=function(s){this._input=s,i=s.slice||s.webkitSlice||s.mozSlice,a?((t=new FileReader).onload=E(this._chunkLoaded,this),t.onerror=E(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var s=this._input,m=(this._config.chunkSize&&(m=Math.min(this._start+this._config.chunkSize,this._input.size),s=i.call(s,this._start,m)),t.readAsText(s,this._config.encoding));a||this._chunkLoaded({target:{result:m}})},this._chunkLoaded=function(s){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(s.target.result)},this._chunkError=function(){this._sendError(t.error)}}function ie(e){var t;$.call(this,e=e||{}),this.stream=function(i){return t=i,this._nextChunk()},this._nextChunk=function(){var i,a;if(!this._finished)return i=this._config.chunkSize,t=i?(a=t.substring(0,i),t.substring(i)):(a=t,""),this._finished=!t,this.parseChunk(a)}}function de(e){$.call(this,e=e||{});var t=[],i=!0,a=!1;this.pause=function(){$.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){$.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(s){this._input=s,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){a&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=!0},this._streamData=E(function(s){try{t.push(typeof s=="string"?s:s.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(m){this._streamError(m)}},this),this._streamError=E(function(s){this._streamCleanUp(),this._sendError(s)},this),this._streamEnd=E(function(){this._streamCleanUp(),a=!0,this._streamData("")},this),this._streamCleanUp=E(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function oe(e){var t,i,a,s,m=Math.pow(2,53),A=-m,q=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,H=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,g=this,P=0,u=0,L=!1,h=!1,y=[],o={data:[],errors:[],meta:{}};function F(x){return e.skipEmptyLines==="greedy"?x.join("").trim()==="":x.length===1&&x[0].length===0}function R(){if(o&&a&&(K("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),a=!1),e.skipEmptyLines&&(o.data=o.data.filter(function(r){return!F(r)})),N()){let r=function(c,O){c=ee(c),b(e.transformHeader)&&(c=e.transformHeader(c,O)),y.push(c)};if(o)if(Array.isArray(o.data[0])){for(var x=0;N()&&x<o.data.length;x++)o.data[x].forEach(r);o.data.splice(0,1)}else o.data.forEach(r)}function _(r,c){for(var O=e.header?{}:[],k=0;k<r.length;k++){var j=k,f=r[k],f=((M,p)=>(I=>(e.dynamicTypingFunction&&e.dynamicTyping[I]===void 0&&(e.dynamicTyping[I]=e.dynamicTypingFunction(I)),(e.dynamicTyping[I]||e.dynamicTyping)===!0))(M)?p==="true"||p==="TRUE"||p!=="false"&&p!=="FALSE"&&((I=>{if(q.test(I)&&(I=parseFloat(I),A<I&&I<m))return 1})(p)?parseFloat(p):H.test(p)?new Date(p):p===""?null:p):p)(j=e.header?k>=y.length?"__parsed_extra":y[k]:j,f=e.transform?e.transform(f,j):f);j==="__parsed_extra"?(O[j]=O[j]||[],O[j].push(f)):O[j]=f}return e.header&&(k>y.length?K("FieldMismatch","TooManyFields","Too many fields: expected "+y.length+" fields but parsed "+k,u+c):k<y.length&&K("FieldMismatch","TooFewFields","Too few fields: expected "+y.length+" fields but parsed "+k,u+c)),O}var C;o&&(e.header||e.dynamicTyping||e.transform)&&(C=1,!o.data.length||Array.isArray(o.data[0])?(o.data=o.data.map(_),C=o.data.length):o.data=_(o.data,0),e.header&&o.meta&&(o.meta.fields=y),u+=C)}function N(){return e.header&&y.length===0}function K(x,_,C,r){x={type:x,code:_,message:C},r!==void 0&&(x.row=r),o.errors.push(x)}b(e.step)&&(s=e.step,e.step=function(x){o=x,N()?R():(R(),o.data.length!==0&&(P+=x.data.length,e.preview&&P>e.preview?i.abort():(o.data=o.data[0],s(o,g))))}),this.parse=function(x,_,C){var r=e.quoteChar||'"',r=(e.newline||(e.newline=this.guessLineEndings(x,r)),a=!1,e.delimiter?b(e.delimiter)&&(e.delimiter=e.delimiter(x),o.meta.delimiter=e.delimiter):((r=((c,O,k,j,f)=>{var M,p,I,ae;f=f||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var ce=0;ce<f.length;ce++){for(var Y,ge=f[ce],z=0,Z=0,D=0,G=(I=void 0,new ue({comments:j,delimiter:ge,newline:O,preview:10}).parse(c)),re=0;re<G.data.length;re++)k&&F(G.data[re])?D++:(Y=G.data[re].length,Z+=Y,I===void 0?I=Y:0<Y&&(z+=Math.abs(Y-I),I=Y));0<G.data.length&&(Z/=G.data.length-D),(p===void 0||z<=p)&&(ae===void 0||ae<Z)&&1.99<Z&&(p=z,M=ge,ae=Z)}return{successful:!!(e.delimiter=M),bestDelimiter:M}})(x,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=r.bestDelimiter:(a=!0,e.delimiter=l.DefaultDelimiter),o.meta.delimiter=e.delimiter),Q(e));return e.preview&&e.header&&r.preview++,t=x,i=new ue(r),o=i.parse(t,_,C),R(),L?{meta:{paused:!0}}:o||{meta:{paused:!1}}},this.paused=function(){return L},this.pause=function(){L=!0,i.abort(),t=b(e.chunk)?"":t.substring(i.getCharIndex())},this.resume=function(){g.streamer._halted?(L=!1,g.streamer.parseChunk(t,!0)):setTimeout(g.resume,3)},this.aborted=function(){return h},this.abort=function(){h=!0,i.abort(),o.meta.aborted=!0,b(e.complete)&&e.complete(o),t=""},this.guessLineEndings=function(c,r){c=c.substring(0,1048576);var r=new RegExp(se(r)+"([^]*?)"+se(r),"gm"),C=(c=c.replace(r,"")).split("\r"),r=c.split(` 7`),c=1<r.length&&r[0].length<C[0].length;if(C.length===1||c)return` 8`;for(var O=0,k=0;k<C.length;k++)C[k][0]===` 9`&&O++;return O>=C.length/2?`\r 10`:"\r"}}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e){var t=(e=e||{}).delimiter,i=e.newline,a=e.comments,s=e.step,m=e.preview,A=e.fastMode,q=null,H=!1,g=e.quoteChar==null?'"':e.quoteChar,P=g;if(e.escapeChar!==void 0&&(P=e.escapeChar),(typeof t!="string"||-1<l.BAD_DELIMITERS.indexOf(t))&&(t=","),a===t)throw new Error("Comment character same as delimiter");a===!0?a="#":(typeof a!="string"||-1<l.BAD_DELIMITERS.indexOf(a))&&(a=!1),i!==` 11`&&i!=="\r"&&i!==`\r 12`&&(i=` 13`);var u=0,L=!1;this.parse=function(h,y,o){if(typeof h!="string")throw new Error("Input must be a string");var F=h.length,R=t.length,N=i.length,K=a.length,x=b(s),_=[],C=[],r=[],c=u=0;if(!h)return z();if(A||A!==!1&&h.indexOf(g)===-1){for(var O=h.split(i),k=0;k<O.length;k++){if(r=O[k],u+=r.length,k!==O.length-1)u+=i.length;else if(o)return z();if(!a||r.substring(0,K)!==a){if(x){if(_=[],ae(r.split(t)),Z(),L)return z()}else ae(r.split(t));if(m&&m<=k)return _=_.slice(0,m),z(!0)}}return z()}for(var j=h.indexOf(t,u),f=h.indexOf(i,u),M=new RegExp(se(P)+se(g),"g"),p=h.indexOf(g,u);;)if(h[u]===g)for(p=u,u++;;){if((p=h.indexOf(g,p+1))===-1)return o||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:_.length,index:u}),Y();if(p===F-1)return Y(h.substring(u,p).replace(M,g));if(g===P&&h[p+1]===P)p++;else if(g===P||p===0||h[p-1]!==P){j!==-1&&j<p+1&&(j=h.indexOf(t,p+1));var I=ce((f=f!==-1&&f<p+1?h.indexOf(i,p+1):f)===-1?j:Math.min(j,f));if(h.substr(p+1+I,R)===t){r.push(h.substring(u,p).replace(M,g)),h[u=p+1+I+R]!==g&&(p=h.indexOf(g,u)),j=h.indexOf(t,u),f=h.indexOf(i,u);break}if(I=ce(f),h.substring(p+1+I,p+1+I+N)===i){if(r.push(h.substring(u,p).replace(M,g)),ge(p+1+I+N),j=h.indexOf(t,u),p=h.indexOf(g,u),x&&(Z(),L))return z();if(m&&_.length>=m)return z(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:u}),p++}}else if(a&&r.length===0&&h.substring(u,u+K)===a){if(f===-1)return z();u=f+N,f=h.indexOf(i,u),j=h.indexOf(t,u)}else if(j!==-1&&(j<f||f===-1))r.push(h.substring(u,j)),u=j+R,j=h.indexOf(t,u);else{if(f===-1)break;if(r.push(h.substring(u,f)),ge(f+N),x&&(Z(),L))return z();if(m&&_.length>=m)return z(!0)}return Y();function ae(D){_.push(D),c=u}function ce(D){var G=0;return G=D!==-1&&(D=h.substring(p+1,D))&&D.trim()===""?D.length:G}function Y(D){return o||(D===void 0&&(D=h.substring(u)),r.push(D),u=F,ae(r),x&&Z()),z()}function ge(D){u=D,ae(r),r=[],f=h.indexOf(i,u)}function z(D){if(e.header&&!y&&_.length&&!H){var G=_[0],re=Object.create(null),ve=new Set(G);let be=!1;for(let he=0;he<G.length;he++){let X=ee(G[he]);if(re[X=b(e.transformHeader)?e.transformHeader(X,he):X]){let ye,ke=re[X];for(;ye=X+"_"+ke,ke++,ve.has(ye););ve.add(ye),G[he]=ye,re[X]++,be=!0,(q=q===null?{}:q)[ye]=X}else re[X]=1,G[he]=X;ve.add(X)}be&&console.warn("Duplicate headers found and renamed."),H=!0}return{data:_,errors:C,meta:{delimiter:t,linebreak:i,aborted:L,truncated:!!D,cursor:c+(y||0),renamedHeaders:q}}}function Z(){s(z()),_=[],C=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return u}}function _e(e){var t=e.data,i=B[t.workerId],a=!1;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){a=!0,fe(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:me,resume:me};if(b(i.userStep)){for(var m=0;m<t.results.data.length&&(i.userStep({data:t.results.data[m],errors:t.results.errors,meta:t.results.meta},s),!a);m++);delete t.results}else b(i.userChunk)&&(i.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!a&&fe(t.workerId,t.results)}function fe(e,t){var i=B[e];b(i.userComplete)&&i.userComplete(t),i.terminate(),delete B[e]}function me(){throw new Error("Not implemented.")}function Q(e){if(typeof e!="object"||e===null)return e;var t,i=Array.isArray(e)?[]:{};for(t in e)i[t]=Q(e[t]);return i}function E(e,t){return function(){e.apply(t,arguments)}}function b(e){return typeof e=="function"}return l.parse=function(e,t){var i=(t=t||{}).dynamicTyping||!1;if(b(i)&&(t.dynamicTypingFunction=i,i={}),t.dynamicTyping=i,t.transform=!!b(t.transform)&&t.transform,!t.worker||!l.WORKERS_SUPPORTED)return i=null,l.NODE_STREAM_INPUT,typeof e=="string"?(e=ee(e),i=new(t.download?te:ie)(t)):e.readable===!0&&b(e.read)&&b(e.on)?i=new de(t):(w.File&&e instanceof File||e instanceof Object)&&(i=new le(t)),i.stream(e);(i=(()=>{var a;return!!l.WORKERS_SUPPORTED&&(a=(()=>{var s=w.URL||w.webkitURL||null,m=V.toString();return l.BLOB_URL||(l.BLOB_URL=s.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",m,")();"],{type:"text/javascript"})))})(),(a=new w.Worker(a)).onmessage=_e,a.id=S++,B[a.id]=a)})()).userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=b(t.step),t.chunk=b(t.chunk),t.complete=b(t.complete),t.error=b(t.error),delete t.worker,i.postMessage({input:e,config:t,workerId:i.id})},l.unparse=function(e,t){var i=!1,a=!0,s=",",m=`\r 14`,A='"',q=A+A,H=!1,g=null,P=!1,u=((()=>{if(typeof t=="object"){if(typeof t.delimiter!="string"||l.BAD_DELIMITERS.filter(function(y){return t.delimiter.indexOf(y)!==-1}).length||(s=t.delimiter),typeof t.quotes!="boolean"&&typeof t.quotes!="function"&&!Array.isArray(t.quotes)||(i=t.quotes),typeof t.skipEmptyLines!="boolean"&&typeof t.skipEmptyLines!="string"||(H=t.skipEmptyLines),typeof t.newline=="string"&&(m=t.newline),typeof t.quoteChar=="string"&&(A=t.quoteChar,q=A+A),typeof t.header=="boolean"&&(a=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");g=t.columns}t.escapeChar!==void 0&&(q=t.escapeChar+A),t.escapeFormulae instanceof RegExp?P=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(P=/^[=+\-@\t\r].*$/)}})(),new RegExp(se(A),"g"));if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return L(null,e,H);if(typeof e[0]=="object")return L(g||Object.keys(e[0]),e,H)}
14else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||g),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||typeof e.data[0]=="object"||(e.data=[e.data])),L(e.fields||[],e.data||[],H);throw new Error("Unable to serialize unrecognized input");function L(y,o,F){var R="",N=(typeof y=="string"&&(y=JSON.parse(y)),typeof o=="string"&&(o=JSON.parse(o)),Array.isArray(y)&&0<y.length),K=!Array.isArray(o[0]);if(N&&a){for(var x=0;x<y.length;x++)0<x&&(R+=s),R+=h(y[x],x);0<o.length&&(R+=m)}for(var _=0;_<o.length;_++){var C=(N?y:o[_]).length,r=!1,c=N?Object.keys(o[_]).length===0:o[_].length===0;if(F&&!N&&(r=F==="greedy"?o[_].join("").trim()==="":o[_].length===1&&o[_][0].length===0),F==="greedy"&&N){for(var O=[],k=0;k<C;k++){var j=K?y[k]:k;O.push(o[_][j])}r=O.join("").trim()===""}if(!r){for(var f=0;f<C;f++){0<f&&!c&&(R+=s);var M=N&&K?y[f]:f;R+=h(o[_][M],f)}_<o.length-1&&(!F||0<C&&!c)&&(R+=m)}}return R}function h(y,o){var F,R,N;return y==null?"":y.constructor===Date?JSON.stringify(y).slice(1,25):(N=!1,P&&typeof y=="string"&&P.test(y)&&(y="'"+y,N=!0),R=(F=y.toString()).replace(u,q),(N=N||i===!0||typeof i=="function"&&i(y,o)||Array.isArray(i)&&i[o]||((K,x)=>{for(var _=0;_<x.length;_++)if(-1<K.indexOf(x[_]))return!0;return!1})(R,l.BAD_DELIMITERS)||-1<R.indexOf(s)||-1<F.indexOf(A)||R.charAt(0)===" "||R.charAt(R.length-1)===" ")?A+R+A:R)}},l.RECORD_SEP="�",l.UNIT_SEP="�",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",` 15`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!v&&!!w.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=ue,l.ParserHandle=oe,l.NetworkStreamer=te,l.FileStreamer=le,l.StringStreamer=ie,l.ReadableStreamStreamer=de,w.jQuery&&((W=w.jQuery).fn.parse=function(e){var t=e.config||{},i=[];return this.each(function(m){if(!(W(this).prop("tagName").toUpperCase()==="INPUT"&&W(this).attr("type").toLowerCase()==="file"&&w.FileReader)||!this.files||this.files.length===0)return!0;for(var A=0;A<this.files.length;A++)i.push({file:this.files[A],inputElem:this,instanceConfig:W.extend({},t)})}),a(),this;function a(){if(i.length===0)b(e.complete)&&e.complete();else{var m,A,q,H,g=i[0];if(b(e.before)){var P=e.before(g.file,g.inputElem);if(typeof P=="object"){if(P.action==="abort")return m="AbortError",A=g.file,q=g.inputElem,H=P.reason,void(b(e.error)&&e.error({name:m},A,q,H));if(P.action==="skip")return void s();typeof P.config=="object"&&(g.instanceConfig=W.extend(g.instanceConfig,P.config))}else if(P==="skip")return void s()}var u=g.instanceConfig.complete;g.instanceConfig.complete=function(L){b(u)&&u(L,g.file,g.inputElem),s()},l.parse(g.file,g.instanceConfig)}}function s(){i.splice(0,1),a()}}),d&&(w.onmessage=function(e){e=e.data,l.WORKER_ID===void 0&&e&&(l.WORKER_ID=e.workerId),typeof e.input=="string"?w.postMessage({workerId:l.WORKER_ID,results:l.parse(e.input,e.config),finished:!0}):(w.File&&e.input instanceof File||e.input instanceof Object)&&(e=l.parse(e.input,e.config))&&w.postMessage({workerId:l.WORKER_ID,results:e,finished:!0})}),(te.prototype=Object.create($.prototype)).constructor=te,(le.prototype=Object.create($.prototype)).constructor=le,(ie.prototype=Object.create(ie.prototype)).constructor=ie,(de.prototype=Object.create($.prototype)).constructor=de,l})})(we);var Re=we.exports;const Ce=Se(Re);function pe(){return new Date().toISOString().slice(0,7)}async function U(T,ne,V={}){const w=await fetch(T,{...V,headers:{...V.headers||{},authorization:`Bearer ${ne}`}}),W=await w.text();let v;try{v=JSON.parse(W)}catch{throw new Error(w.status===404||W.startsWith("<!")?"The API service returned HTML instead of JSON. Restart your Vite dev server to activate the API middleware.":"The API returned an invalid response.")}if(!w.ok)throw new Error(v.error||"Request failed");return v}function je(T,ne){const[V,w]=(T||pe()).split("-").map(Number),v=new Date(Date.UTC(V,w-1+ne,1)).toISOString().slice(0,7),d=pe();return v>d?d:v}function Te(){var L,h,y,o,F,R,N,K,x,_,C;const[T,ne]=J.useState(()=>sessionStorage.getItem("shipyard_admin_password")||""),[V,w]=J.useState(""),[W,v]=J.useState(""),[d,B]=J.useState(null),[S,l]=J.useState(pe()),[ee,$]=J.useState(""),[te,le]=J.useState("Cursor Personal export"),[ie,de]=J.useState(""),[oe,se]=J.useState(null),[ue,_e]=J.useState(""),[fe,me]=J.useState(""),[Q,E]=J.useState(!1),b=S===pe(),e=J.useMemo(()=>((d==null?void 0:d.imports)||[]).filter(r=>b||r.verificationState!=="draft").reduce((r,c)=>r+Number(c.totalTokens||0),0),[b,d]);J.useEffect(()=>{T&&(E(!0),U(`/api/admin-reports?period=${S}`,T).then(B).catch(r=>{v(r.message),(r.message.includes("password")||r.message.includes("Authentication")||r.message.includes("authorized"))&&(ne(""),sessionStorage.removeItem("shipyard_admin_password"))}).finally(()=>E(!1)))},[S,T]);async function t(r){r.preventDefault(),E(!0),v("");try{const c=await U(`/api/admin-reports?period=${S}`,V);sessionStorage.setItem("shipyard_admin_password",V),ne(V),B(c)}catch(c){v(c.message||"Invalid admin password")}finally{E(!1)}}function i(){sessionStorage.removeItem("shipyard_admin_password"),ne(""),B(null)}async function a(){E(!0),v("");try{const r=await U("/api/usage-sync",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({period:S})});v(`Sync finished: ${r.synced} source${r.synced===1?"":"s"} connected.`),B(await U(`/api/admin-reports?period=${S}`,T))}catch(r){v(r.message)}finally{E(!1)}}function s(r){const c=r.target.value.replace(/[^0-9]/g,"");if(!c){$("");return}const O=Number(c);
15$(O.toLocaleString("en-US"))}async function m(r){se(r),r!=null&&r.name.toLowerCase().endsWith(".csv")&&Ce.parse(r,{header:!0,complete:({data:c})=>{const O=["total tokens","tokens","total_tokens","totaltokens"],k=c.reduce((j,f)=>j+Object.entries(f).reduce((M,[p,I])=>O.includes(p.toLowerCase())&&M+Number(String(I).replaceAll(",",""))||M,0),0);k>0&&$(k.toLocaleString("en-US"))}})}async function A(r){r.preventDefault(),E(!0),v("");try{let c=null;if(oe){const j=new Uint8Array(await oe.arrayBuffer());let f="";j.forEach(M=>{f+=String.fromCharCode(M)}),c={name:oe.name,type:oe.type||"application/octet-stream",base64:btoa(f)}}const O=te==="Custom label..."?ie:te,k=Number(String(ee).replaceAll(",",""));await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"add-import",period:S,sourceLabel:O,totalTokens:k,evidence:c})}),$(""),se(null),v("Private source added to the draft."),B(await U(`/api/admin-reports?period=${S}`,T))}catch(c){v(c.message)}finally{E(!1)}}async function q(r){if(window.confirm("Remove this imported usage entry?")){E(!0),v("");try{await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"remove-import",period:S,importId:r})}),v("Source entry removed."),B(await U(`/api/admin-reports?period=${S}`,T))}catch(c){v(c.message)}finally{E(!1)}}}async function H(){if(window.confirm(`Clear all imported usage and shipped outputs for ${S}? This will reset this month's draft.`)){E(!0),v("");try{await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"clear-month",period:S})}),v(`Month ${S} data cleared and reset.`),B(await U(`/api/admin-reports?period=${S}`,T))}catch(r){v(r.message)}finally{E(!1)}}}async function g(r){if(window.confirm("Remove this shipped result?")){E(!0),v("");try{await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"remove-output",period:S,outputId:r})}),v("Shipped output removed."),B(await U(`/api/admin-reports?period=${S}`,T))}catch(c){v(c.message)}finally{E(!1)}}}async function P(r){r.preventDefault(),E(!0);try{await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"add-output",period:S,title:ue,url:fe})}),_e(""),me(""),v("Build output added."),B(await U(`/api/admin-reports?period=${S}`,T))}catch(c){v(c.message)}finally{E(!1)}}async function u(){if(b){v("The current month is a public preview. Publish it after the month closes.");return}if(window.confirm("Publish this completed month? Published reports are revised rather than overwritten.")){E(!0);try{await U("/api/admin-reports",T,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"publish",period:S})}),v("Monthly Build Activity Report published."),B(await U(`/api/admin-reports?period=${S}`,T))}catch(r){v(r.message)}finally{E(!1)}}}return T?n.jsxs("div",{className:"reports-admin",children:[n.jsxs("header",{children:[n.jsxs("div",{children:[n.jsx("span",{children:"TOKEN SHIPYARD / REPORTS"}),n.jsx("strong",{children:"ADMIN OPERATOR"})]}),n.jsx("button",{onClick:i,children:"Sign out"})]}),n.jsxs("main",{children:[n.jsxs("div",{className:"admin-title",children:[n.jsxs("div",{children:[n.jsx("span",{children:b?"CURRENT MONTH PREVIEW":"MONTHLY BUILD ACTIVITY"}),n.jsx("h1",{children:S})]}),n.jsxs("div",{className:"period-navigator",children:[n.jsx("button",{type:"button",onClick:()=>l(je(S,-1)),title:"Previous month",children:"â"}),n.jsx("input",{type:"month",value:S,max:pe(),onChange:r=>l(r.target.value)}),n.jsx("button",{type:"button",onClick:()=>l(je(S,1)),disabled:S>=pe(),title:"Next month",children:"â"})]})]}),W&&n.jsx("div",{className:"admin-notice",children:W}),n.jsxs("section",{className:"admin-overview",children:[n.jsxs("div",{children:[n.jsx("span",{children:b?"PREVIEW AGGREGATE":"PUBLIC AGGREGATE"}),n.jsx("strong",{children:xe(e)})]}),n.jsxs("div",{children:[n.jsx("span",{children:"REPORT STATUS"}),n.jsx("strong",{children:b?"preview":((L=d==null?void 0:d.report)==null?void 0:L.status)||"draft"})]}),n.jsxs("div",{children:[n.jsx("span",{children:"API VERIFIED"}),n.jsx("strong",{children:((h=d==null?void 0:d.imports)==null?void 0:h.filter(r=>r.verificationState==="api_verified").length)||0})]}),n.jsx("button",{disabled:Q,onClick:a,children:Q?"Workingâ¦":"Sync official APIs"})]}),n.jsxs("div",{className:"admin-columns",children:[n.jsxs("section",{className:"admin-card",children:[n.jsxs("div",{className:"admin-card-title",children:[n.jsx("span",{children:"01"}),n.jsx("h2",{children:"Usage sources"})]}),n.jsx("div",{className:"source-statuses",children:(y=d==null?void 0:d.sources)==null?void 0:y.map(r=>n.jsxs("div",{children:[n.jsx("i",{className:`status-${r.status}`}),n.jsx("span",{children:r.name}),n.jsx("small",{children:r.status})]},r.id))}),n.jsx("div",{className:"import-list",children:(o=d==null?void 0:d.imports)!=null&&o.length?d.imports.map(r=>n.jsxs("div",{children:[n.jsxs("p",{children:[n.jsx("strong",{children:r.sourceLabel}),n.jsxs("small",{children:[r.verificationState.replaceAll("_"," ")," · ",r.completeness]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[n.jsx("b",{children:xe(r.totalTokens)}),n.jsx("button",{type:"button",onClick:()=>q(r.id),title:"Delete entry",style:{padding:"2px 8px",background:"transparent",border:"1px solid rgba(255,90,90,0.3)",color:"#ff7a7a",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"â"})]})]},r.id)):n.jsx("p",{className:"admin-empty",children:"No usage imported for this month."})}),n.jsxs("form",{onSubmit:A,className:"admin-form",children:[n.jsx("h3",{children:"Add private evidence"}),n.jsxs("label",{children:["Internal source label",n.jsxs("select",{value:te,onChange:r=>le(r.target.value),children:[n.jsx("option",{value:"Cursor Personal export",children:"Cursor Personal export"}),n.jsx("option",{value:"Cursor Business organization",children:"Cursor Business organization (Manual override)"}),n.jsx("option",{value:"Anthropic Console export",children:"Anthropic Console export"}),n.jsx("option",{value:"Gemini / Google AI export",children:"Gemini / Google AI export"}),n.jsx("option",{value:"OpenAI API organization",children:"OpenAI API organization (Manual override)"}),n.jsx("option",{value:"OpenRouter organization",children:"OpenRouter organization (Manual override)"}),n.jsx("option",{value:"Custom label...",children:"Custom label..."})]})]}),te==="Custom label..."&&n.jsxs("label",{children:["Custom source label",n.jsx("input",{value:ie,onChange:r=>de(r.target.value),placeholder:"e.g. Personal Claude Pro",required:!0})]}),n.jsxs("label",{children:["Aggregate tokens",n.jsx("input",{type:"text",inputMode:"numeric",value:ee,onChange:s,placeholder:"e.g. 2,000,000,000",required:!0}),ee&&n.jsxs("small",{style:{color:"#d8fc6c",marginTop:"6px",fontSize:"11px",fontFamily:"monospace"},children:[xe(Number(ee.replaceAll(",","")))," (",Number(ee.replaceAll(",","")).toLocaleStr
15ing()," tokens)"]})]}),n.jsxs("label",{children:["Private CSV or screenshot (Optional for updates)",n.jsx("input",{type:"file",accept:".csv,image/png,image/jpeg,image/webp",onChange:r=>m(r.target.files[0])})]}),n.jsx("button",{disabled:Q,children:"Add / Update privately verified source"})]})]}),n.jsxs("section",{className:"admin-card",children:[n.jsxs("div",{className:"admin-card-title",children:[n.jsx("span",{children:"02"}),n.jsx("h2",{children:"Shipped output"})]}),n.jsx("div",{className:"import-list",children:(F=d==null?void 0:d.outputs)!=null&&F.length?d.outputs.map(r=>n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 0",borderBottom:"1px solid rgba(255,255,255,.07)"},children:[n.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",style:{textDecoration:"none",color:"inherit"},children:n.jsxs("p",{style:{margin:0},children:[n.jsx("strong",{children:r.title}),n.jsx("br",{}),n.jsx("small",{style:{opacity:.6},children:r.outputType})]})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[n.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",style:{color:"#d8fc6c",textDecoration:"none",fontWeight:"bold"},children:"â"}),n.jsx("button",{type:"button",onClick:()=>g(r.id),title:"Delete output",style:{padding:"2px 8px",background:"transparent",border:"1px solid rgba(255,90,90,0.3)",color:"#ff7a7a",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"â"})]})]},r.id)):n.jsx("p",{className:"admin-empty",children:"No selected launches yet. GitHub activity syncs separately."})}),n.jsxs("form",{onSubmit:P,className:"admin-form",children:[n.jsx("h3",{children:"Add a shipped result"}),n.jsxs("label",{children:["Title",n.jsx("input",{value:ue,onChange:r=>_e(r.target.value),required:!0})]}),n.jsxs("label",{children:["Canonical URL",n.jsx("input",{type:"url",value:fe,onChange:r=>me(r.target.value),required:!0})]}),n.jsx("button",{disabled:Q,children:"Add output"})]})]})]}),(((R=d==null?void 0:d.imports)==null?void 0:R.length)>0||((N=d==null?void 0:d.outputs)==null?void 0:N.length)>0)&&n.jsx("div",{style:{textAlign:"right",marginBottom:"8px"},children:n.jsx("button",{type:"button",onClick:H,disabled:Q,style:{background:"none",border:"none",color:"rgba(255,90,90,0.5)",fontSize:"11px",fontFamily:'"IBM Plex Mono", monospace',textTransform:"uppercase",letterSpacing:"0.08em",cursor:"pointer",padding:"4px 0"},children:"Reset month data"})}),n.jsxs("section",{className:"publish-card",children:[n.jsxs("div",{children:[n.jsx("span",{children:b?"PUBLIC PREVIEW · NOT FINAL":"PUBLIC PREVIEW"}),n.jsxs("h2",{children:[xe(e)," tokens processed in ",S]}),n.jsxs("p",{children:[((K=d==null?void 0:d.imports)==null?void 0:K.filter(r=>r.verificationState==="api_verified").length)||0," API verified · ",((x=d==null?void 0:d.imports)==null?void 0:x.filter(r=>r.verificationState==="private_verified").length)||0," privately verified · ",((_=d==null?void 0:d.outputs)==null?void 0:_.length)||0," products shipped"]})]}),n.jsxs("button",{disabled:Q||b,onClick:u,children:[b?"Publish after month closes":((C=d==null?void 0:d.report)==null?void 0:C.status)==="published"?"Publish revision":"Publish completed month"," â"]})]})]})]}):n.jsx("div",{className:"reports-admin",children:n.jsxs("form",{className:"admin-login",onSubmit:t,children:[n.jsx("span",{children:"PRIVATE CONTROL ROOM"}),n.jsx("h1",{children:"Monthly build reports."}),n.jsx("p",{children:"Restricted to the shipyard operator. Enter password to unlock."}),n.jsx("input",{type:"password",required:!0,value:V,onChange:r=>w(r.target.value),placeholder:"Enter Password"}),n.jsx("button",{disabled:Q,children:Q?"Unlockingâ¦":"Unlock Control Room"}),W&&n.jsx("small",{className:"form-error",children:W})]})})}export{Te 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.