1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1697],{34031:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(57437),a=n(2265),s=n(39951),i=n(94508);function l(e){let{children:t,onFiles:n,busy:l=!1,className:o}=e,u=(0,a.useRef)(0),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=e=>{var t;(null===(t=e.dataTransfer)||void 0===t?void 0:t.types.includes("Files"))&&(e.preventDefault(),"drop"===e.type&&(u.current=0,d(!1)))};return window.addEventListener("dragover",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragover",e),window.removeEventListener("drop",e)}},[]),(0,r.jsxs)("div",{className:(0,i.cn)("relative",o),onDragEnter:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),u.current+=1,d(!0))},onDragLeave:e=>{0!==u.current&&(e.preventDefault(),u.current=Math.max(0,u.current-1),0===u.current&&d(!1))},onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.dataTransfer.dropEffect=l?"none":"copy")},onDrop:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),u.current=0,d(!1),e.dataTransfer.files.length>0&&n(Array.from(e.dataTransfer.files)))},children:[t,c&&(0,r.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-50 flex items-center justify-center rounded-[inherit] bg-background/95 p-3 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"flex h-full min-h-28 w-full flex-col items-center justify-center rounded-xl border-2 border-dashed border-primary/70 bg-primary/5 px-5 text-center shadow-sm",children:[(0,r.jsx)("span",{className:"mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary",children:(0,r.jsx)(s.$,{className:"h-5 w-5",weight:"bold"})}),(0,r.jsx)("p",{className:"text-sm font-semibold text-foreground",children:l?"Upload already in progress":"Drop files to attach"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l?"Wait for the current files to finish, then try again.":"Release anywhere in this composer. Up to 10 files at a time."})]})})]})}},74507:function(e,t,n){n.d(t,{l:function(){return C}});var r=n(57437),a=n(2265),s=n(29827),i=n(11713),l=n(21770),o=n(26110),u=n(62869),c=n(93022),d=n(15529),p=n(39328),m=n(73278),f=n(18904),_=n(62130),h=n(80382),g=n(23594),x=n(68772),y=n(1892),v=n(50513),b=n(14438),w=n(59010),N=n(42097),j=n(48622),k=n(51082),S=n(71487);function A(e,t){if(e){let t=e.trim().split(" ");return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():t[0].slice(0,2).toUpperCase()}return t.slice(0,2).toUpperCase()}function C(e){var t;let{isOpen:n,onClose:C,appId:R,appName:z,userGithubRepoUrl:U}=e,{getToken:D,user:E}=(0,w.a)(),{apiKey:F}=(0,N.Z)(),I=(0,s.NL)(),T=U?function(e){try{let t=e.trim().replace(/\.git$/,"").replace(/\/$/,"").match(/github\.com[/:]([^/]+)\/([^/#?]+)/i);if(!t)return null;let n=t[1],r=t[2];if(!n||!r)return null;return"https://github.com/".concat(n,"/").concat(r,"/settings/access")}catch(e){return null}}(U):null,[P,L]=(0,a.useState)(null),[O,M]=(0,a.useState)(""),[Q,K]=(0,a.useState)(!1),[q,H]=(0,a.useState)(null);(0,a.useEffect)(()=>{n&&(0,S.trackShareModalOpened)(null==E?void 0:E.id,R)},[n,null==E?void 0:E.id,R]);let{data:$=[],isLoading:G}=(0,i.a)({queryKey:["orgMembers",null==E?void 0:E.id],queryFn:async()=>{let e=D(),t=await (0,k.BN)(e);return t?(await (0,k.e4)(e,t._id)).filter(e=>e.user_id!==(null==E?void 0:E.id)):[]},enabled:n&&!!(null==E?void 0:E.id),staleTime:3e5,gcTime:6e5}),{data:W=[],isLoading:B}=(0,i.a)({queryKey:["appShares",R],queryFn:async()=>{let e=D();return(0,j.FW)(R,e)},enabled:n&&!!R,staleTime:3e4}),V=(0,a.useMemo)(()=>{let e=O.toLowerCase();return $.filter(t=>{var n;return t.email.toLowerCase().includes(e)||(null!==(n=t.name)&&void 0!==n?n:"").toLowerCase().includes(e)})},[$,O]),Y=(0,l.D)({mutationFn:async e=>{let t=D();return(0,j.NY)(R,e.user_id,"write",t,e.email,F)},onSuccess:(e,t)=>{(0,S.trackAppShared)(null==E?void 0:E.id,R,{recipient_count:1,access_level:"write"}),H(e.agents_shared),L(null),I.invalidateQueries({queryKey:["appShares",R]}),b.Am.success(e.message||"Shared with ".concat(t.email))},onError:e=>{b.Am.error(e.detail||e.message||"Failed to share app")}}),Z=(0,l.D)({mutationFn:async e=>{let t=D();return e.shared_with_user_id?(0,j.q4)(R,e.shared_with_user_id,t,F):(0,j.EK)(R,e.shared_with_email,t)},onMutate:async e=>{await I.cancelQueries({queryKey:["appShares",R]});let t=I.getQueryData(["appShares",R]);return I.setQueryData(["appShares",R],t=>(null!=t?t:[]).filter(t=>t.id!==e.id)),{previous:t}},onSuccess:(e,t)=>{(0,S.trackShareAccessRevoked)(null==E?void 0:E.id,R),b.Am.success("Removed ".concat(t.shared_with_email))}
1,onError:(e,t,n)=>{(null==n?void 0:n.previous)&&I.setQueryData(["appShares",R],n.previous),b.Am.error(e.detail||e.message||"Failed to remove share")},onSettled:()=>{I.invalidateQueries({queryKey:["appShares",R]})}});return(0,r.jsx)(o.Vq,{open:n,onOpenChange:e=>{e||(H(null),L(null),C())},children:(0,r.jsxs)(o.cZ,{className:"max-w-lg p-4 sm:p-6 h-auto max-h-[85vh] overflow-y-auto",onClick:()=>{K(!1)},children:[(0,r.jsxs)(o.fK,{className:"pr-6",children:[(0,r.jsxs)(o.$N,{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(d.L,{className:"w-4 h-4 flex-shrink-0"}),(0,r.jsxs)("span",{className:"truncate",children:['Share "',z,'"']})]}),(0,r.jsxs)(o.Be,{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,r.jsx)(p.d,{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0"}),"Sharing includes agents, knowledge bases, and all resources. Same-org members only."]})]}),(0,r.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(m.b,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-foreground",children:"GitHub repo access"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Add collaborators on GitHub so they can pull and deploy with their own GitHub account. The repo link stays the original one."}),T?(0,r.jsxs)("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:["Open GitHub collaborators",(0,r.jsx)(f.O,{className:"w-3.5 h-3.5"})]}):(0,r.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"Connect or push this app to GitHub first to invite repo collaborators."})]})]})}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 sm:items-start",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex-1 relative",children:[G?(0,r.jsx)("div",{className:"stagger-in",children:(0,r.jsx)(c.O,{className:"h-10 w-full rounded-md"})}):(0,r.jsxs)("button",{type:"button",onClick:()=>{K(e=>!e)},className:"plan-rise-in w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md border border-border bg-background text-foreground hover:bg-muted/50 transition-colors text-left",children:[(0,r.jsx)(_.Q,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 truncate",children:P?"".concat(null!==(t=P.name)&&void 0!==t?t:P.email):"Select org memberâ¦"})]}),Q&&(0,r.jsxs)("div",{className:"absolute z-50 top-full mt-1 w-full rounded-md border border-border bg-popover shadow-lg",children:[(0,r.jsx)("div",{className:"p-2 border-b border-border",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(h.Y,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),(0,r.jsx)("input",{autoFocus:!0,placeholder:"Search name or emailâ¦",value:O,onChange:e=>M(e.target.value),onClick:e=>e.stopPropagation(),className:"w-full pl-7 pr-3 py-1.5 text-sm bg-transparent outline-none placeholder:text-muted-foreground"})]})}),(0,r.jsx)("ul",{className:"max-h-44 overflow-y-auto py-1",children:0===V.length?(0,r.jsx)("li",{className:"px-3 py-4 text-xs text-center text-muted-foreground",children:0===$.length?"No other org members found":"No matches"}):V.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",onClick:()=>{L(e),K(!1),M("")},className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-muted/60 transition-colors ".concat((null==P?void 0:P.user_id)===e.user_id?"bg-muted/40":""),children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-full bg-primary/15 text-primary flex items-center justify-center text-xs font-semibold flex-shrink-0",children:A(e.name,e.email)}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[e.name&&(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,r.jsx)("p",{className:"truncate ".concat(e.name?"text-xs text-muted-foreground":"text-sm"),children:e.email})]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground capitalize flex-shrink-0",children:e.role})]})},e.user_id))})]})]}),(0,r.jsx)(u.z,{size:"sm",disabled:!P||Y.isPending,onClick:()=>
1P&&Y.mutate(P),className:"w-full sm:w-auto sm:flex-shrink-0",children:Y.isPending?(0,r.jsx)(g.U,{className:"w-4 h-4 animate-spin"}):"Share"})]}),null!==q&&(0,r.jsxs)("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-1.5 overflow-hidden",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Agent sharing results"}),0===q.length?(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"No agents found in this app."}):q.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[e.success?(0,r.jsx)(x.f,{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0"}):(0,r.jsx)(y.Q,{className:"w-3.5 h-3.5 text-red-400 flex-shrink-0"}),(0,r.jsx)("span",{className:"truncate text-foreground shrink-0 max-w-[40%]",children:e.agent_name||e.agent_id}),!e.success&&e.error&&(0,r.jsx)("span",{className:"text-red-400 truncate min-w-0",children:e.error})]},e.agent_id))]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"People with access"}),B?(0,r.jsx)("div",{className:"stagger-in max-h-44 space-y-1",children:[0,1,2].map(e=>(0,r.jsx)(c.O,{className:"h-10 w-full rounded-md"},e))}):0===W.length?(0,r.jsx)("p",{className:"plan-rise-in text-sm text-muted-foreground/60 py-4 text-center",children:"No one has access yet"}):(0,r.jsx)("div",{className:"plan-rise-in max-h-44 overflow-y-auto space-y-1",children:W.map(e=>{var t,n;let a=Z.isPending&&(null===(t=Z.variables)||void 0===t?void 0:t.id)===e.id,s=$.find(t=>t.user_id===e.shared_with_user_id||t.email===e.shared_with_email);return(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-md bg-muted/50",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("div",{className:"w-6 h-6 rounded-full bg-primary/15 text-primary flex items-center justify-center text-xs font-semibold flex-shrink-0",children:A(null!==(n=null==s?void 0:s.name)&&void 0!==n?n:null,e.shared_with_email)}),(0,r.jsxs)("div",{className:"min-w-0",children:[(null==s?void 0:s.name)&&(0,r.jsx)("p",{className:"text-xs font-medium truncate",children:s.name}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.shared_with_email})]})]}),(0,r.jsx)("button",{onClick:()=>Z.mutate(e),disabled:a,className:"p-1 text-muted-foreground hover:text-red-400 hover:bg-red-900/10 rounded transition-colors flex-shrink-0",title:"Revoke access",children:a?(0,r.jsx)(g.U,{className:"w-3.5 h-3.5 animate-spin"}):(0,r.jsx)(v.X,{className:"w-3.5 h-3.5"})})]},e.id)})})]})]})})}},69304:function(e,t,n){n.d(t,{Ei:function(){return g},Tu:function(){return _},aM:function(){return c},bC:function(){return h},ue:function(){return f},yo:function(){return u}});var r=n(57437),a=n(2265),s=n(49027),i=n(90535),l=n(20653),o=n(94508);let u=s.fC,c=s.xz;s.x8;let d=s.h_,p=a.forwardRef((e,t)=>{let{className:n,...a}=e;return(0,r.jsx)(s.aV,{className:(0,o.cn)("fixed inset-0 z-[200] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...a,ref:t})});p.displayName=s.aV.displayName;let m=(0,i.cva)("fixed z-[200] gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),f=a.forwardRef((e,t)=>{let{side:n="right",className:a,children:i,...u}=e;return(0,r.jsxs)(d,{children:[(0,r.jsx)(p,{}),(0,r.jsxs)(s.VY,{ref:t,className:(0,o.cn)(m({side:n}),a),...u,children:[i,(0,r.jsxs)(s.x8,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent",children:[(0,r.jsx)(l.Pxu,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=s.VY.displayName;let _=e=>{let{className:t,...n}=e;return(0,r.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...n})};_.displayName="SheetHeader";let h=a.forwardRef((e,t)=>{let{className:n,...a}=e;return(0,r.jsx)(s.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold text-foreground",n),...a})});h.displayName=s.Dx.displayName;let g=a.forwardRef((e,t)=>{let{className:n,...a}=e;return(0,r.jsx)(s.dk,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",n),...a})});g.displayName=s.dk.displayName},94949:function(e,t,n){n.d(t,{FL:function(){return m},Hm:function(){return d},LP:function(){return o},Ri:function(){return l}});var r=n(2265),a=n(14438),s=n(417),i=n(42097);function l(e){return e.map(e=>({...e}))}function o(e,t){let n=t.filter(e=>e.url).map(e=>"<<".concat(e.url,"><").concat(e.name,">>")).join("\n");return n?"".concat(e,"\n\n").concat(n):e}let u=["pdf","docx","pptx","jpg","jpeg","png","gif","webp","txt","md","markdown","xlsx","csv","zip"],c=RegExp("\\.(".concat(u.join("|"),")$"),"i"),d=u.map(e=>".".concat(e)).join(","),p=u.map(e=>e.toUpperCase()).join(", ");function m(){let[e,t]=(0,r.useState)([]),n=(0,r.useRef)(null),l=(0,r.useRef)(0),o=async e=>{l.current+=1,t(t=>[...t,{name:e.name,url:"",type:e.type,size:e.size,isUploading:!0}]);try{let n=await (0,s.i)(e);return t(t=>t.map(t=>t.name===e.name&&t.isUploading?{...t,url:n.url,assetId:n.assetId,isUploading:!1}:t)),a.Am.success("".concat(e.name," uploaded")),!0}catch(r){let n=(r instanceof Error&&r.message?r.message:"The upload service returned an unknown error.").slice(0,512);return console.error("File upload error:",r),a.Am.error("Failed to upload ".concat(e.name),{description:n}),t(t=>{var r;return r=e.name,t.map(e=>e.name===r&&e.isUploading?{...e,isUploading:!1,uploadError:n}:e)}),!1}finally{l.current=Math.max(0,l.current-1)}},u=async t=>{if(0===t.length)return;let n=[];for(let e of t){let t=function(e){if(!c.test(e.name))return"".concat(e.name," is not a supported file type. Allowed: ").concat(p,".");let t=/\.(xlsx|csv|zip)$/i.test(e.name);return e.size>(t?20971520:52428800)?"".concat(e.name," exceeds the ").concat(t?"20 MB":"50 MB"," limit."):null}(e);t?a.Am.error(t):n.push(e)}if(0===n.length)return;let r=Math.max(0,10-e.length),s=n.slice(0,r);for(let e of n.slice(r))a.Am.error("".concat(e.name," was not added. A maximum of ").concat(10," files can be attached."));if(0!==s.length){var u;if(!(i.Z.getState().apiKey.trim()||(null===(u=localStorage.getItem("lyzrApiKey"))||void 0===u?void 0:u.trim()))){!function(){if("initializing"===i.Z.getState().apiKeyInitializationStatus){a.Am.error("Your API key is still initializing. Try again in a moment.");return}a.Am.error("No API key is available. Refresh the page or check your API key in account settings.")}();return}if(l.current>0||e.some(e=>e.isUploading)){a.Am.error("Please wait for the current files to finish processing.");return}for(let e of s)await o(e)}};return{uploadedFiles:e,setUploadedFiles:t,fileInputRef:n,handleFileUpload:async e=>{let t=e.target.files;t&&0!==t.length&&(await u(Array.from(t)),e.target.value="")},handlePasteFile:async e=>{await u([e])},handleFiles:u,removeFile:e=>{t(t=>t.filter(t=>t.name!==e))},clearFiles:()=>{t([])}}}},70364:function(e,t,n){n.d(t,{Dz:function(){return l},R4:function(){return o},a6:function(){return i},e6:function(){return c},rg:function(){return a},v0:function(){return s},xG:function(){return u}});var r=n(97855);async function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new URLSearchParams;e.search&&t.append("search",e.search),e.category&&t.append("category",e.category),e.models&&e.models.length>0&&e.models.forEach(e=>t.append("models",e)),e.integrations&&e.integrations.length>
10&&e.integrations.forEach(e=>t.append("integrations",e)),e.sort&&t.append("sort",e.sort),e.page&&t.append("page",e.page.toString()),e.limit&&t.append("limit",e.limit.toString());let n=t.toString();return(0,r.R1)("/api/v1/marketplace/".concat(n?"?".concat(n):""))}async function s(e,t,n,a){let s={};return n&&(s.name=n),a&&(s.lyzr_api_key=a),(0,r.sg)("/api/v1/marketplace/".concat(e,"/clone"),s,t)}async function i(e,t,n,a){let s={};return n&&(s.name=n),a&&(s.lyzr_api_key=a),(0,r.sg)("/api/v1/apps/".concat(e,"/duplicate"),s,t)}async function l(e,t,n){return(0,r.sg)("/api/v1/apps/".concat(e,"/publish"),t,n)}async function o(e,t,n){return(0,r.SC)("/api/v1/apps/".concat(e,"/marketplace"),{method:"PATCH",body:JSON.stringify(t),token:n})}async function u(e,t){return(0,r.SC)("/api/v1/apps/".concat(e,"/unpublish"),{method:"DELETE",token:t})}async function c(e,t){return(0,r.R1)("/api/v1/apps/".concat(e,"/marketplace-status"),t)}},48622:function(e,t,n){n.d(t,{EK:function(){return s},FW:function(){return a},NY:function(){return l},OA:function(){return i},q4:function(){return o}});var r=n(97855);async function a(e,t){return(0,r.R1)("/api/v1/apps/".concat(e,"/shares"),t)}async function s(e,t,n){return(0,r.QW)("/api/v1/apps/".concat(e,"/shares/").concat(encodeURIComponent(t)),n)}async function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100;return(0,r.R1)("/api/v1/apps/shared-with-me?skip=".concat(t,"&limit=").concat(n),e)}async function l(e,t,n,a,s,i){return(0,r.sg)("/api/v1/apps/".concat(e,"/shares/with-agents"),{user_id:t,email:null!=s?s:null,access_level:n,lyzr_api_key:null!=i?i:null},a)}async function o(e,t,n,a){let s=a?"?lyzr_api_key=".concat(encodeURIComponent(a)):"";return(0,r.QW)("/api/v1/apps/".concat(e,"/shares/with-agents/").concat(encodeURIComponent(t)).concat(s),n)}},417:function(e,t,n){n.d(t,{i:function(){return a}});var r=n(39004);async function a(e){let t=new FormData;t.append("file",e);let n=(0,r.bW)(),a={};n&&(a.Authorization="Bearer ".concat(n));let s=await fetch("".concat("https://api.beta.architect.new","/api/v1/assets/upload"),{method:"POST",body:t,headers:a});if(!s.ok)throw Error("Asset upload failed: ".concat(s.status," ").concat(await s.text()));let i=await s.json();return{assetId:i.assetId,url:i.url,fileName:i.fileName,mimeType:i.mimeType,fileSize:i.fileSize}}},63746:function(e,t,n){n.d(t,{M1:function(){return d},NI:function(){return c},QR:function(){return l},UG:function(){return p},_9:function(){return u},bO:function(){return a.bO},by:function(){return a.by},c1:function(){return s},fU:function(){return a.fU},rz:function(){return o}});var r=n(97855),a=n(70640);function s(e,t,n){return!!e&&(!t||!!n)}let i="pendingCodebaseImport";function l(e){if(!e){sessionStorage.removeItem(i);return}sessionStorage.setItem(i,JSON.stringify(e))}function o(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=sessionStorage.getItem(i);if(!t)return null;e&&sessionStorage.removeItem(i);try{let e=JSON.parse(t);return(null==e?void 0:e.github_url)?e:null}catch(e){return null}}async function u(e,t,n){return(0,r.sg)("/api/v1/apps/".concat(encodeURIComponent(e),"/import-codebase"),t,n)}async function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.R1)("/api/v1/apps/".concat(encodeURIComponent(e),"/import-codebase").concat(n?"?verify=true":""),t)}async function d(e,t){return(0,r.QW)("/api/v1/apps/".concat(encodeURIComponent(e),"/import-codebase"),t)}function p(e){return e.replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"")}},88314:function(e,t,n){n.d(t,{$w:function(){return r},BD:function(){return y},Dt:function(){return d},UQ:function(){return b},ji:function(){return k},kP:function(){return w},l_:function(){return a},ry:function(){return c}});let r=2;function a(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?e*r:null}function s(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function i(e){return"number"==typeof e&&Number.isFinite(e)}function l(e){return i(e)&&e>=0}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){return"sandbox_ledger"===e||"legacy_traces"===e}function c(e){if(!l(e))return"â";if(0===e)return"0.0000";let t=e.toFixed(4);return 0===Number(t)?"<0.0001":t}function d(e){return Array.isArray(e)?{contributing:e.reduce((e,t)=>
1{if(!s(t))return e;let n=l(t.credits_used)&&t.credits_used>0,r=l(t.billed_usd)&&t.billed_usd>0,a=l(t.raw_cost_usd)&&t.raw_cost_usd>0,i=l(t.cost_usd)&&t.cost_usd>0;return n||r||a||i?e+1:e},0),total:e.length}:{contributing:0,total:0}}function p(e){return null===e||"string"==typeof e}function m(e){return s(e)&&"string"==typeof e.trace_id&&"string"==typeof e.sandbox_id&&p(e.assigned_at)&&i(e.credits_used)}function f(e){var t,n,r,c;if(!s(e)||"string"!=typeof e.app_id||"string"!=typeof e.app_name||"string"!=typeof e.generated_name||!p(e.deployment_url)||!p(e.screenshot_uri)||"string"!=typeof e.status||!p(e.created_at)||!i(e.credits_used)||!i(e.sandbox_count)||!p(e.last_used_at)||!Array.isArray(e.traces)||!e.traces.every(m))return null;let d=u(e.cost_source)?e.cost_source:u(e.source)?e.source:"legacy_traces",f=l(e.cost_usd)?e.cost_usd:null,_=l(e.billed_usd)?e.billed_usd:null,h=null!=f?f:_;if(null===h)return null;let g=o(e,"raw_cost_usd")?null===e.raw_cost_usd?null:l(e.raw_cost_usd)?e.raw_cost_usd:void 0:null;if(void 0===g)return null;let x=null!=_?_:"sandbox_ledger"===d?null!==(t=a(null!=g?g:f))&&void 0!==t?t:h:l(e.credits_used)?e.credits_used:h,y=o(e,"markup")?null===e.markup?null:l(e.markup)?e.markup:void 0:null;if(void 0===y)return null;let v="missing"===(n=e.ledger_state)||"empty"===n||"partial"===n||"ready"===n?e.ledger_state:void 0,b="string"==typeof e.source?e.source:d,w="boolean"==typeof e.estimated?e.estimated:"legacy_traces"===d||null===g;return{...e,credits_used:x,cost_usd:x,source:b,raw_cost_usd:g,billed_usd:x,markup:y,cost_source:d,estimated:w,...v?{ledger_state:v}:{},wallet:null==(r=e.wallet)?null:s(r)&&("pending"===(c=r.sync_state)||"unattributed"===c||"applied"===c||"partial"===c||"insufficient"===c)&&l(r.target_internal_units)&&l(r.applied_internal_units)&&l(r.unpaid_internal_units)&&p(r.as_of)?{sync_state:r.sync_state,target_internal_units:r.target_internal_units,applied_internal_units:r.applied_internal_units,unpaid_internal_units:r.unpaid_internal_units,as_of:r.as_of}:null}}function _(e){return e.reduce((e,t)=>e+t.billed_usd,0)}function h(e){return 0===e.length?0:e.some(e=>null===e.raw_cost_usd)?null:e.reduce((e,t)=>{var n;return e+(null!==(n=t.raw_cost_usd)&&void 0!==n?n:0)},0)}function g(e){return[...e].sort((e,t)=>{let n=e.created_at&&new Date(e.created_at).getTime()||0;return(t.created_at&&new Date(t.created_at).getTime()||0)-n})}function x(e){if(!s(e)||"string"!=typeof e.user_id||"string"!=typeof e.email||!i(e.total_credits_used)||!i(e.credits_remaining)||!i(e.app_count)||!Array.isArray(e.per_app))return null;let t=g(e.per_app.map(f).filter(e=>null!==e)),n=_(t),r=o(e,"total_raw_cost_usd")&&null===e.total_raw_cost_usd?null:o(e,"total_raw_cost_usd")&&l(e.total_raw_cost_usd)?e.total_raw_cost_usd:h(t);return{...e,total_credits_used:n,per_app:t,total_cost_usd:n,total_raw_cost_usd:r,total_billed_usd:n}}function y(e){if(!s(e)||"string"!=typeof e.user_id||!i(e.total_credits_used)||!i(e.credits_remaining)||!i(e.app_count)||!Array.isArray(e.per_app))return null;let t=g(e.per_app.map(f).filter(e=>null!==e)),n=_(t),r=o(e,"total_raw_cost_usd")&&null===e.total_raw_cost_usd?null:o(e,"total_raw_cost_usd")&&l(e.total_raw_cost_usd)?e.total_raw_cost_usd:h(t);return{...e,total_credits_used:n,per_app:t,total_cost_usd:n,total_raw_cost_usd:r,total_billed_usd:n}}function v(e){if(!s(e)||"string"!=typeof e.date)return null;let t=l(e.credits)?e.credits:0,n=l(e.exact_credits)?e.exact_credits:0;return{date:e.date,credits:t,exact_credits:n,attributed_credits:Math.max(0,t-n),app_count:l(e.app_count)?Math.round(e.app_count):0}}function b(e){var t;if(!s(e)||"string"!=typeof e.start_date||"string"!=typeof e.end_date||!Array.isArray(e.points))return null;let n=e.points.map(v).filter(e=>null!==e).sort((e,t)=>e.date.localeCompare(t.date)),r=n.reduce((e,t)=>e+t.credits,0),a=n.reduce((e,t)=>null===e||t.credits>e.credits?t:e,null);return{scope:"string"==typeof e.scope?e.scope:"user",bucket:"string"==typeof e.bucket?e.bucket:"day",start_date:e.start_date,end_date:e.end_date,points:n,total_credits:r,total_credits_all_time:l(e.total_credits_all_time)?e.total_credits_all_time:r,attributed_credits:n.reduce((e,t)=>
1e+t.attributed_credits,0),app_count:l(e.app_count)?Math.round(e.app_count):0,user_count:l(e.user_count)?Math.round(e.user_count):0,peak_credits:null!==(t=null==a?void 0:a.credits)&&void 0!==t?t:0,peak_date:a&&a.credits>0?a.date:null}}function w(e){if(!s(e)||!i(e.total_credits_used)||!i(e.user_count)||!Array.isArray(e.per_user))return null;let t=e.per_user.map(x).filter(e=>null!==e),n=t.reduce((e,t)=>e+t.total_billed_usd,0),r=o(e,"total_raw_cost_usd")&&null===e.total_raw_cost_usd?null:o(e,"total_raw_cost_usd")&&l(e.total_raw_cost_usd)?e.total_raw_cost_usd:t.some(e=>null===e.total_raw_cost_usd)?null:t.reduce((e,t)=>{var n;return e+(null!==(n=t.total_raw_cost_usd)&&void 0!==n?n:0)},0);return{...e,total_credits_used:n,per_user:t,total_cost_usd:n,total_raw_cost_usd:r,total_billed_usd:n}}function N(e){return s(e)&&"string"==typeof e.app_id&&"string"==typeof e.app_name&&p(e.cloned_at)&&i(e.earn_count)&&i(e.earn_limit)&&i(e.credits_earned)}function j(e){return s(e)&&"string"==typeof e.app_id&&"string"==typeof e.app_name&&"string"==typeof e.cloned_by&&p(e.cloned_at)&&i(e.earn_count)}function k(e){return s(e)&&"string"==typeof e.user_id&&i(e.total_clone_credits)&&Array.isArray(e.cloned_apps)&&e.cloned_apps.every(N)&&Array.isArray(e.owned_clones)&&e.owned_clones.every(j)?e:null}}}]);
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.