1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="27d78e68-5cc9-4ebb-1e4c-ce87622f12b9")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,470858,681435,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(618566),o=e.i(146387),s=e.i(689664),i=e.i(726067),a=e.i(487738),l=e.i(632781),d=e.i(901279),c=e.i(846696),u=e.i(167881),h=e.i(23750),p=e.i(488360),f=e.i(330009),m=e.i(55224);function g(e,t){return e&&t?`This Bool will inherit access from â${t}â. People who only have access through â${e}â will lose access.`:t?`This Bool will inherit access from â${t}â. Anyone with access to the folder will also have access to this Bool.`:e?`People who only have access through â${e}â will lose access to this Bool.`:null}e.s(["folderMoveAccessCopy",0,g],681435);var v=e.i(647163);function w({open:e,onOpenChange:r,sourceFolderName:n,targetFolderName:o,onConfirm:s,busy:i=!1}){return(0,t.jsx)(f.AlertDialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(f.AlertDialogContent,{children:[(0,t.jsxs)(f.AlertDialogHeader,{children:[(0,t.jsx)(f.AlertDialogTitle,{children:"Change who has access?"}),(0,t.jsx)(f.AlertDialogDescription,{children:g(n,o)})]}),(0,t.jsxs)(f.AlertDialogFooter,{children:[(0,t.jsx)(f.AlertDialogCancel,{disabled:i,children:"Cancel"}),(0,t.jsxs)(f.AlertDialogAction,{disabled:i,onClick:s,children:[i&&(0,t.jsx)(l.Loader2,{"data-icon":"inline-start",className:"animate-spin"}),"Move"]})]})]})})}async function x(e,t){let r=await fetch(`/api/workspaces/${e}/folders`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t})});if(!r.ok){let e=await r.json().catch(()=>({}));return c.toast.error(e.error??"Couldn't create folder."),null}return await r.json()}function y({icon:e,label:r,selected:n,disabled:o,onClick:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,disabled:o,className:(0,v.cn)("flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors hover:bg-accent disabled:opacity-60",n&&"bg-accent/60"),children:[e,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:r}),n&&(0,t.jsx)(s.Check,{className:"size-4 text-primary"})]})}e.s(["FolderMoveAccessDialog",0,w,"MoveToFolderDialog",0,function({open:e,onOpenChange:s,projectId:f,projectName:v,workspaceId:b,currentFolderId:j,folders:k,workspaceTargets:C,confirmAccessChange:N=!1}){let S=(0,n.useRouter)(),[E,T]=(0,r.useState)(!1),[A,B]=(0,r.useState)(!1),[I,R]=(0,r.useState)(""),[P,M]=(0,r.useState)(null),L=j?k.find(e=>e.id===j)?.name??"the current folder":null;async function O(e,t,r=!1){if(E||e===j)return void s(!1);if(!r&&N&&g(L,e?t:null))return void M({folderId:e,label:t});T(!0);try{let r=await fetch(`/api/projects/${f}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folderId:e})});if(!r.ok){let e=await r.json().catch(()=>({}));c.toast.error(e.error??"Couldn't move the Bool.");return}c.toast.success(e?`Moved to â${t}â`:"Moved to top level"),s(!1),M(null),S.refresh()}catch{c.toast.error("Couldn't move the Bool.")}finally{T(!1)}}async function $(){let e=I.trim();if(!e||E)return;let t=null;T(!0);try{t=await x(b,e)}catch{c.toast.error("Couldn't create folder.")}finally{T(!1)}t&&(B(!1),R(""),await O(t.id,t.name))}async function D(e){if(!E){T(!0);try{let t=await fetch(`/api/projects/${f}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({workspaceId:e.id})});if(!t.ok){let e=await t.json().catch(()=>({}));c.toast.error(e.error??"Couldn't move the Bool.");return}c.toast.success(`Moved to ${e.name}. Sharing was reset to private.`),s(!1),S.refresh()}catch{c.toast.error("Couldn't move the Bool.")}finally{T(!1)}}}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.ResponsiveModal,{open:e,onOpenChange:s,title:C?"Move":"Move to folder",description:v,children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[C&&
2(0,t.jsx)("p",{className:"px-2 pb-1 text-xs font-medium text-muted-foreground",children:"Folder"}),(0,t.jsx)(y,{icon:(0,t.jsx)(i.Folder,{className:"size-4 text-muted-foreground"}),label:"Top level",selected:null===j,disabled:E,onClick:()=>void O(null,"Top level")}),(0,t.jsx)("div",{className:"my-1 h-px bg-border"}),(0,t.jsx)("div",{className:"max-h-[45vh] overflow-y-auto",children:0===k.length?(0,t.jsx)("p",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No folders yet â create one below."}):k.map(e=>(0,t.jsx)(y,{icon:(0,t.jsx)(i.Folder,{className:"size-4 text-muted-foreground"}),label:e.name,selected:e.id===j,disabled:E,onClick:()=>void O(e.id,e.name)},e.id))}),(0,t.jsx)("div",{className:"my-1 h-px bg-border"}),A?(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),$()},className:"flex items-center gap-2",children:[(0,t.jsx)(h.Input,{autoFocus:!0,value:I,onChange:e=>R(e.target.value),placeholder:"New folder name",maxLength:m.MAX_FOLDER_NAME,"aria-label":"New folder name",className:"h-9"}),(0,t.jsxs)(u.Button,{type:"submit",size:"sm",disabled:!I.trim()||E,children:[E&&(0,t.jsx)(l.Loader2,{"data-icon":"inline-start",className:"animate-spin"}),"Create"]})]}):(0,t.jsxs)("button",{type:"button",onClick:()=>B(!0),disabled:E,className:"flex items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(a.FolderPlus,{className:"size-4"}),"New folder"]}),C&&C.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"my-1 h-px bg-border"}),(0,t.jsx)("p",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:"Workspace"}),C.map(e=>(0,t.jsx)(y,{icon:e.personal?(0,t.jsx)(d.User,{className:"size-4 text-muted-foreground"}):(0,t.jsx)(o.Building2,{className:"size-4 text-muted-foreground"}),label:e.name,selected:!1,disabled:E,onClick:()=>void D(e)},e.id??"personal"))]})]})}),(0,t.jsx)(w,{open:null!==P,onOpenChange:e=>!e&&M(null),sourceFolderName:L,targetFolderName:P?.folderId?P.label:null,busy:E,onConfirm:()=>{P&&O(P.folderId,P.label,!0)}})]})},"NewFolderDialog",0,function({open:e,onOpenChange:o,workspaceId:s,onCreated:i}){let a=(0,n.useRouter)(),[d,f]=(0,r.useState)(""),[g,v]=(0,r.useState)(!1);async function w(){let e=d.trim();if(e&&!g){v(!0);try{let t=await x(s,e);if(!t)return;c.toast.success(`Folder â${t.name}â created`),f(""),o(!1),i?.(t),a.refresh()}catch{c.toast.error("Couldn't create folder.")}finally{v(!1)}}}return(0,t.jsx)(p.ResponsiveModal,{open:e,onOpenChange:o,title:"New folder",children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),w()},className:"flex flex-col gap-3",children:[(0,t.jsx)(h.Input,{autoFocus:!0,value:d,onChange:e=>f(e.target.value),placeholder:"Folder name",maxLength:m.MAX_FOLDER_NAME,"aria-label":"Folder name"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(u.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(!1),children:"Cancel"}),(0,t.jsxs)(u.Button,{type:"submit",size:"sm",disabled:!d.trim()||g,children:[g&&(0,t.jsx)(l.Loader2,{"data-icon":"inline-start",className:"animate-spin"}),"Create"]})]})]})})},"RenameFolderDialog",0,function({open:e,onOpenChange:o,folderId:s,currentName:i}){let a=(0,n.useRouter)(),[d,f]=(0,r.useState)(i),[g,v]=(0,r.useState)(!1);async function w(){let e=d.trim();if(!e||g||e===i)return void o(!1);v(!0);try{let t=await fetch(`/api/folders/${s}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok){let e=await t.json().catch(()=>({}));c.toast.error(e.error??"Couldn't rename folder.");return}o(!1),a.refresh()}catch{c.toast.error("Couldn't rename folder.")}finally{v(!1)}}return(0,t.jsx)(p.ResponsiveModal,{open:e,onOpenChange:o,title:"Rename folder",children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),w()},className:"flex flex-col gap-3",children:[(0,t.jsx)(h.Input,{autoFocus:!0,value:d,onChange:e=>f(e.target.value),placeholder:"Folder name",maxLength:m.MAX_FOLDER_NAME,"aria-label":"Folder name"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(u.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(!1),children:"Cancel"}),(0,t.jsxs)(u.Button,{type:"submit",size:"sm",disabled:!d.trim()||g,children:[g&&(0,t.jsx)(l.L
2oader2,{"data-icon":"inline-start",className:"animate-spin"}),"Save"]})]})]})})}],470858)},313949,611004,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(689664),o=e.i(508734),s=e.i(762368),i=e.i(846696),a=e.i(647163),l=e.i(167881),d=e.i(973134);let c=e.i(971759).escapeHtmlAttr;function u(e,t,r,n){let o=e+r,s=t+r;return`<rect x="${o+.5}" y="${s+.5}" width="6" height="6" rx="2" ry="2" fill="none" stroke="${n}" stroke-width="1"/><rect x="${o+2}" y="${s+2}" width="3" height="3" rx="1.1" ry="1.1" fill="${n}"/>`}function h(e,t={}){let{size:r=240,margin:n=3,color:o="#000000",background:s="#ffffff",dotStyle:i="rounded",logo:a,title:l="QR code"}=t,p=t.ecc??(a?"H":"Q"),f=d.default.create(e,{errorCorrectionLevel:p}),m=f.modules.size,g=f.modules.data,v=(e,t)=>1===g[e*m+t],w=m+2*n,x=function(e){let t=0x811c9dc5;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}(`${e}|${String(o)}|${i}|${m}`),y=`qg-${x}`,b=Array.isArray(o),j=b?`url(#${y})`:c(o),k=a?Math.max(5,Math.round(.26*m)):0,C=Math.floor((m-k)/2),N=C+k,S=(e,t)=>!!a&&e>=C&&e<N&&t>=C&&t<N,E=(e,t)=>e<7&&t<7||e<7&&t>=m-7||e>=m-7&&t<7,T=[];for(let e=0;e<m;e++)for(let t=0;t<m;t++){if(!v(e,t)||E(e,t)||S(e,t))continue;let r=t+n,o=e+n;"dots"===i?T.push(`<circle cx="${r+.5}" cy="${o+.5}" r="0.52" fill="${j}"/>`):"squares"===i?T.push(`<rect x="${r}" y="${o}" width="1" height="1" fill="${j}"/>`):T.push(`<rect x="${r+.06}" y="${o+.06}" width="0.88" height="0.88" rx="0.32" ry="0.32" fill="${j}"/>`)}T.push(u(0,0,n,j)),T.push(u(m-7,0,n,j)),T.push(u(0,m-7,n,j));let A="";if(a){let e=C+n-.6,t=C+n-.6,r=k+1.2;A+=`<rect x="${e}" y="${t}" width="${r}" height="${r}" rx="${.22*r}" ry="${.22*r}" fill="#ffffff"/>`;let o=.16*r,s=e+o,i=t+o,l=r-2*o;if("href"in a)A+=`<image href="${c(a.href)}" x="${s}" y="${i}" width="${l}" height="${l}" preserveAspectRatio="xMidYMid meet"/>`;else{let e=a.viewBox??"0 0 24 24";A+=`<svg x="${s}" y="${i}" width="${l}" height="${l}" viewBox="${e}" preserveAspectRatio="xMidYMid meet">${a.svg}</svg>`}}let B=b?`<defs><linearGradient id="${y}" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="${c(o[0])}"/><stop offset="1" stop-color="${c(o[1])}"/></linearGradient></defs>`:"",I=s&&"transparent"!==s?`<rect width="${w}" height="${w}" rx="${Math.min(.06*w,3)}" fill="${c(s)}"/>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${r}" viewBox="0 0 ${w} ${w}" role="img" aria-label="${c(l)}" shape-rendering="geometricPrecision"><title>${c(l)}</title>${B}${I}<g>${T.join("")}${A}</g></svg>`}async function p(e,t,r=4){let n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,o=new Image;o.decoding="async",await new Promise((e,t)=>{o.onload=()=>e(),o.onerror=()=>t(Error("Failed to render QR image")),o.src=n});let s=document.createElement("canvas");s.width=t*r,s.height=t*r;let i=s.getContext("2d");if(!i)throw Error("Canvas unsupported");return i.drawImage(o,0,0,s.width,s.height),await new Promise((e,t)=>s.toBlob(r=>r?e(r):t(Error("Encode failed")),"image/png"))}e.s(["BOOL_QR_LOGO",0,{viewBox:"7 10 427 463",svg:'<path fill="#0166fd" d="M431.664551,312.147461l.01709.010742c-.027222-.137329-.057739-.26947-.085205-.406372-1.44574-7.721863-3.53656-15.213745-6.194641-22.432556-7.857483-21.988708-18.710999-36.469238-25.687439-44.37146-.221985-.25354-.446289-.503662-.670471-.754028-.42157-.469177-.82489-.910339-1.212341-1.328125-.214966-.230896-.429016-.462891-.645752-.69104-.164612-.174561-.332703-.353821-.489563-.518127l.005737.021484c-1.837402-1.904846-3.73291-3.721863-5.692688-5.436646-.03241-.029236-.064392-.060547-.096802-.089722-.353271-.317566-.711243-.616882-1.066101-.928345-1.325684-1.121643-2.684082-2.194153-4.057983-3.242249-27.898865-21.283142
2-65.396667-27.542725-98.716064-23.6521-11.180481,1.836426-17.86615,7.287598-19.525024,18.700745-1.238953,8.524109-1.488159,23.753845-1.332397,32.393127.185181,10.270325,7.510925,18.986572,17.677002,20.723267,6.068542,1.036743,12.358093.712219,18.564941,1.003113.60614.028442,1.212524.055115,1.816833.09729,7.991516.557434,15.399231,2.233887,21.936829,5.522644.085876.043335.171143.087708.256775.13147,17.019836,8.706482,28.678406,26.402344,28.678406,46.832703,0,17.859253-8.910889,33.628601-22.520508,43.133179-8.522461,5.951843-18.882568,9.453491-30.066162,9.453491-29.042786,0-52.682983-22.710876-52.682983-54.023804,0,0,5.46582-104.278381,6.250183-116.854553.264404-4.239502,5.347382-113.926758,5.85202-122.024231.077698-1.24646.107361-2.4776.086182-3.692322.000671-.089233.006714-.177185.006714-.266602,0-10.292297-4.502319-19.528687-11.639038-25.862244-.111572-.162292-.214661-.308838-.331848-.480835-.462158-.330627-.927002-.646973-1.394043-.951172-5.149414-4.007141-11.459229-6.586487-18.343628-7.151855l.006287-.007935s-8.908188-.670528-16.357513,1.429245c-5.089996,1.434742-13.397705,5.42374-18.89299,7.781128-18.549545,7.957436-25.726242,11.439728-43.866989,19.32016-1.667847.724487-9.635147,4.252029-11.161819,5.116226-6.971252,3.564148-9.730927,6.120277-13.250328,9.392433-1.915527,1.681091-3.644104,3.568115-5.149475,5.630493-1.702942,2.251892-2.346985,3.671448-2.346985,3.671448l.003113.000427c-2.7323,4.947937-4.291504,10.634155-4.291504,16.686218,0,19.094475,15.479195,34.573662,34.573677,34.573662,4.594116,0,8.974976-.90387,12.985291-2.530701,3.285889-.950562,6.577698-2.07843,9.968262-3.013428,0,1.511597-8.5215,167.92746-9.200211,180.001007-.444519,7.906921-.474564,19.047119.076096,26.858093,1.507019,27.213623,16.793549,60.557953,42.511871,81.430023,24.055237,19.522461,54.711487,31.227905,88.105896,31.227905,77.27832,0,139.924744-57.642334,139.924744-134.920654,0-8.714233-.811096-17.237366-2.335449-25.51062Z"/><g fill="none" stroke-linecap="round" stroke-width="20"><line x1="78" y1="20" x2="110" y2="69" stroke="#00c2bb"/><line x1="17" y1="100" x2="81" y2="119" stroke="#7c36ef"/><line x1="29" y1="195" x2="94" y2="171" stroke="#fd6643"/></g>'},"qrSvg",0,h],611004),e.s(["QrCode",0,function({value:e,size:d=200,fluid:c=!1,options:u,actions:f=!1,filename:m="qr-code",className:g}){let[v,w]=(0,r.useState)(!1),x=(0,r.useMemo)(()=>h(e,{size:d,title:`QR code for ${e}`,...u}),[e,d,u]),y=(0,r.useMemo)(()=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(x)}`,[x]);async function b(){try{var e,t;let r,n;e=await p(x,d),t=`${m}.png`,r=URL.createObjectURL(e),(n=document.createElement("a")).href=r,n.download=t,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{i.toast.error("Couldn't export PNG")}}async function j(){try{await navigator.clipboard.write([new ClipboardItem({"image/png":p(x,d)})]),w(!0),i.toast.success("QR copied"),setTimeout(()=>w(!1),1500)}catch{i.toast.error("Couldn't copy image")}}return(0,t.jsxs)("div",{className:(0,a.cn)("flex flex-col items-center gap-2",c&&"w-full",g),children:[(0,t.jsx)("img",{src:y,alt:`QR code for ${e}`,width:d,height:d,className:(0,a.cn)("block rounded-xl",c&&"h-auto w-full"),style:{forcedColorAdjust:"none"}}),f&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>void b(),children:[(0,t.jsx)(s.Download,{className:"size-4"}),"Download"]}),(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>void j(),children:[v?(0,t.jsx)(n.Check,{className:"size-4"}):(0,t.jsx)(o.Copy,{className:"size-4"}),"Copy"]})]})]})}],313949)},305894,586615,487542,e=>{"use strict";var t=e.i(843476),r=e.i(618566),n=e.i(630374),o=e.i(271645),s=e.i(689664),i=e.i(716327),a=e.i(434322),l=e.i(726067),d=e.i(810818),c=e.i(926894),u=e.i(632781),h=e.i(96315),p=e.i(515281),f=e.i(281673),m=e.i(357443),g=e.i(882303),v=e.i(263676),w=e.i(846696),x=e.i(167881),y=e.i(994179),b=e.i(330009),j=e.i(184762),k=e.i(62870),C=e.i(63270),N=e.i(728231),S=e.i(907359),E=e.i(313949),T=e.i(611004);function A(e,t,r,n=8){let o=r.trim(),s=[];for(let r of e){let e=function(e,t){let r=e.trim().toLowerCase(),n=t.toLowerCase();if(!r)return{score:0,indices:[]};if(!n)return null;let o=0,s=0,i=0,a=[],l=-2;for(;o<r.length&&s<n.length;)r[o]===n[s]&&(s===l+1?i+=15:function(e,t){if(t<=0)return!0;let r=e[t-1];return" "===r||"-"===r||"_"===r||"."===r||"@"===r}(t,s)?i+=10:t[s]!==t[s].toLowerCase()?i+=5:i+=1,0===s&&(i+=10),a.push(s),l=s,o++),s++;return o<r.length?null:(i-=.4*Math.max(0,n.length-r.length-6),{score:i+=r.length/n.length*30,indices:a})}(o,t(r)??"");e&&s.push({item:r,match:e})}return o?s.sort((e,t)=>
2t.match.score-e.match.score):s.sort((e,r)=>(t(e.item)??"").localeCompare(t(r.item)??"")),s.slice(0,n)}function B(e){return"view"===e?"Can use":"publish"===e?"Can edit & publish":"Can edit"}e.s(["fuzzyFilter",0,A],586615);let I="bool:shares-changed";function R(e){return"view"===e?{role:"viewer",canPublish:!1}:"publish"===e?{role:"editor",canPublish:!0}:{role:"editor",canPublish:!1}}let P={editor:"Can edit",viewer:"Can use"},M={publish:"Can edit & publish",edit:"Can edit",view:"Can use"},L={...M,owner:"Make owner"},O={viewer:"Can view"},$={owner:"Owner",editor:"Can edit",viewer:"Can use",use:"Can use"};function D({meta:e}){return(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border bg-muted/30 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Your access"}),(0,t.jsx)(y.Badge,{variant:e.viewerCanManage?"default":"secondary",children:$[e.viewerRole]})]})}function z({projectId:e,myRequests:r,reload:n,setBusy:s}){let[i,a]=(0,o.useState)(null),[l,d]=(0,o.useState)(""),[c,u]=(0,o.useState)(""),h=new Set(r.filter(e=>"pending"===e.status).map(e=>e.type));async function f(t){if(t.preventDefault(),i){if("invite"===i&&l&&!(0,S.isValidShareEmail)(l))return void w.toast.error("Enter a valid email.");s(!0);try{let t=await fetch(`/api/projects/${e}/requests`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:i,requestedEmail:"invite"===i?l:null,note:c||null})});if(!t.ok)return void w.toast.error((await t.json().catch(()=>({})))?.error??"Couldn't send request.");w.toast.success("Request sent."),a(null),d(""),u(""),await n()}finally{s(!1)}}}return i?(0,t.jsxs)("form",{onSubmit:f,className:"space-y-2 rounded-md border p-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"edit"===i?"Request edit access":"Request to invite someone"}),"invite"===i&&(0,t.jsx)("input",{type:"email",value:l,onChange:e=>d(e.target.value),placeholder:"Email of the person to invite (optional)",className:"h-9 w-full rounded-md border bg-background px-3 text-base outline-none focus:ring-2 focus:ring-primary/40 md:text-sm"}),(0,t.jsx)(j.Textarea,{value:c,onChange:e=>u(e.target.value),placeholder:"Add a note (optional)",className:"min-h-[4rem]"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(x.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(null),children:"Cancel"}),(0,t.jsx)(x.Button,{type:"submit",size:"sm",children:"Send request"})]})]}):(0,t.jsxs)("div",{className:"space-y-2 rounded-md border p-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Need more access?"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(x.Button,{size:"sm",variant:"outline",disabled:h.has("edit"),onClick:()=>a("edit"),children:[(0,t.jsx)(p.Pencil,{className:"mr-1.5 size-3.5"}),h.has("edit")?"Edit access requested":"Request edit access"]}),(0,t.jsxs)(x.Button,{size:"sm",variant:"outline",disabled:h.has("invite"),onClick:()=>a("invite"),children:[(0,t.jsx)(m.UserPlus,{className:"mr-1.5 size-3.5"}),h.has("invite")?"Invite requested":"Request to invite"]})]})]})}function F({projectId:e,requests:r,reload:n,setBusy:o}){if(0===r.length)return null;async function s(t,r){o(!0);try{if(!(await fetch(`/api/projects/${e}/requests/${t}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({status:r})})).ok)return void w.toast.error("Couldn't update request.");w.toast.success("granted"===r?"Access granted.":"Request dismissed."),await n()}finally{o(!1)}}return(0,t.jsxs)("div",{className:"space-y-2 rounded-md border p-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Access requests"}),(0,t.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(ee,{url:e.requesterAvatarUrl??null,name:e.requesterUsername??e.requesterEmail}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[(0,t.jsx)("div",{className:"truncate font-medium",children:e.requesterUsername??e.requesterEmail}),(0,t.jsxs)("div",{className:"text-xs text-muted-foreground",children:["edit"===e.type?"Requests edit access":e.requestedEmail?`Requests to invite ${e.requestedEmail}`:"Requests permission to invite",e.note&&(0,t.jsxs)(t.Fragment,{children:[" · ",e.note]})]})]}),(0,t.jsxs)("div",{className:"flex shrink-0 gap-1",children:[(0,t.jsx)(x.Button,{size:"icon",variant:"ghost",className:"size-8",onClick:()=>void s(e.id,"dismissed"),children:(0,t.jsx)(v.X,{className:"size-4"})}),(0,t.jsx)(x.Button,{size:"sm",onClick:()=>void s(e.id,"granted"),children:"Grant"})]})]},e.id))})]})}function U(e){let[t,r]=(0,o.useState)([]),[n,s]=(0,o.useState)([]),[i,a]=(0,o.useState)([]),[l,d]=(0,o.useState)(null),c=(0,o.useCallback)(async()=>{let t=await fetch(`/api/projects/${e}/shares`,{cache:"no-store"});if(!t.ok)return void w.toast.error("Couldn't load sharing.");let n=await t.json();r(n.shares),s(n.requests??[]),a(n.myRequests??[]),d(n.meta)},[e]);return(0,o.useEffect)(()=>{c()},[c]),(0,o.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&c()};return window.addEventListener(I,t),()=>window.removeEventListener(I,t)},[e,c]),{shares:t,requests:n,myRequests:i,meta:l,reload:c}}function H(){return(0,t.jsx)("div",{className:"flex h-64 items-center justify-center",children:(0,t.jsx)(u.Loader2,{className:"size-5 animate-spin text-muted-foreground"})})}function _({projectId:e,meta:r,surface:n,onDone:o}){let s="editor"===n,i=s?`${window.location.origin}/projects/${e}`:r.liveUrl;return s&&"use"===r.viewerRole||"live"===n&&!r.deployed?null:(0,t.jsxs)("div",{className:"flex items-center justify-between border-t pt-3",children:[(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",className:"text-primary hover:text-primary",onClick:()=>{navigator.clipboard.writeText(i).then(()=>w.toast.success("Link copied")).catch(()=>w.toast.error("Copy failed"))},children:[(0,t.jsx)(c.Link2,{className:"size-4"}),s?"Copy editor link":"Copy live link"]}),o&&(0,t.jsx)(x.Button,{size:"sm",onClick:o,children:"Done"})]})}function q({projectId:e,onDone:r}){let{shares:n,requests:s,myRequests:i,meta:a,reload:l}=U(e),[d,c]=(0,o.useState)(!1),u=(0,o.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=r.email.trim().toLowerCase(),n=t.get(e);n?n.push(r):t.set(e,[r])}return[...t.values()].map(e=>{let t=e.find(e=>"editor"===e.surface),r=t??e[0],n=["editor","live"].filter(t=>e.some(e=>e.surface===t));return{...r,role:t?.role??"viewer",canPublish:t?.canPublish??!1,pending:e.every(e=>e.pending),username:e.find(e=>e.username)?.username??null,avatarUrl:e.find(e=>e.avatarUrl)?.avatarUrl??null,sourceSurfaces:n}})})(n),[n]);return a?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(D,{meta:a}),(0,t.jsxs)("section",{"aria-labelledby":"people-with-access",className:"space-y-2",children:[(0,t.jsx)("h3",{id:"people-with-access",className:"text-sm font-semibold",children:"People with access"}),(0,t.jsx)(J,{projectId:e,shares:u,meta:a,requests:s,myRequests:i,busy:d,setBusy:c,reload:l,unified:!0,showGeneralAccess:!1})]}),(0,t.jsx)(eh,{projectId:e,meta:a,busy:d,setBusy:c,reload:l}),(0,t.jsx)(_,{projectId:e,meta:a,surface:a.deployed?"live":"editor",onDone:r})]}):(0,t.jsx)(H,{})}function J({projectId:e,shares:r,meta:n,requests:o,myRequests:s,busy:i,setBusy:a,reload:l,unified:d=!1,showGeneralAccess:c=!0}){let u=n.viewerCanManage,h=d?r:r.filter(e=>"editor"===e.surface),p=n.groups.map(e=>{let t=n.groupShares.find(t=>t.groupId===e.id);return t?{id:e.id,name:e.name,role:t.role}:null}).filter(e=>!!e),f=new Set(p.map(e=>e.id)),m=new Set(h.map(e=>e.email.toLowerCase())),g=(n.inheritedAccess??[]).filter(e=>"workspace"!==e.subject),v=g.filter(e=>"group"===e.subject&&!!e.groupId&&!f.has(e.groupId)),x=function(e){let t=new Map;for(let r of e){if("email"!==r.subject||!r.email)continue;let e=r.email.toLowerCase(),n=t.get(e);(!n||el(ea(r))>el(ea(n)))&&t.set(e,r)}return[...t.values()]}(g),y=x.filter(e=>!m.has(e.email.toLowerCase()));async function b(t,r){if(0!==t.length){a(!0);try{let o=t.filter(e=>"group"===e.kind),s=t.filter(e=>
2"person"===e.kind),{role:i,canPublish:a}=R(r);if(o.length>0){let t=new Set(o.map(e=>e.id)),r=[...n.groupShares.filter(e=>!t.has(e.groupId)),...o.map(e=>({groupId:e.id,role:i}))],s=await fetch(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({groupShares:r})});if(!s.ok)return void w.toast.error((await s.json().catch(()=>({})))?.error??"Couldn't add groups.")}for(let t of s){let r=await fetch(`/api/projects/${e}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:t.email,surface:"editor",role:i,canPublish:a})});r.ok||w.toast.error((await r.json().catch(()=>({})))?.error??`Couldn't add ${t.email}.`)}w.toast.success("publish"===r?"Added with edit & publish access.":"edit"===r?"Added with edit access.":"Added with use access."),await l()}finally{a(!1)}}}async function j(t,r){a(!0);try{let n=await fetch(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({groupShares:t})});if(!n.ok)return void w.toast.error((await n.json().catch(()=>({})))?.error??"Couldn't update.");w.toast.success(r),await l()}finally{a(!1)}}return(0,t.jsxs)("div",{className:"space-y-3",children:[u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W,{projectId:e,meta:n,shares:r,busy:i,onInvite:b}),(0,t.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Collaborators use credits from this Bool's workspace."})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(et,{owner:n.owner,isYou:n.viewerIsOwner}),p.map(e=>(0,t.jsx)(X,{name:e.name,role:e.role,disabled:!u||i,onChangeRole:t=>void j(n.groupShares.map(r=>r.groupId===e.id?{...r,role:t}:r),"editor"===t?`${e.name} can now edit.`:`${e.name} can now use the app.`),onRemove:()=>void j(n.groupShares.filter(t=>t.groupId!==e.id),`Removed ${e.name}.`)},e.id)),v.map(e=>(0,t.jsx)(ei,{grant:e,surface:"editor"},`inherited-group-${e.groupId}`)),(0,t.jsx)(ec,{people:h,projectId:e,projectName:n.projectName,surface:"editor",roleEditable:!0,inheritedPeople:x,canManage:u,isOwner:n.viewerIsOwner,busy:i,setBusy:a,reload:l}),y.map(r=>(0,t.jsx)(ed,{grant:r,surface:"editor",projectId:e,canManage:u,busy:i,setBusy:a,reload:l,projectName:n.projectName},`inherited-person-${r.email}`))]}),u?(0,t.jsx)(F,{projectId:e,requests:o,reload:l,setBusy:a}):(0,t.jsx)(z,{projectId:e,myRequests:s,reload:l,setBusy:a}),c&&(0,t.jsx)(ep,{label:"editor",projectId:e,meta:n,busy:i,setBusy:a,reload:l})]})}function V(e){return e.displayName??e.username??e.email?.toLowerCase()??""}function Y({text:e,indices:r}){let n=new Set(r),o=[],s=0;for(;s<e.length;)if(n.has(s)){let r=s;for(;r<e.length&&n.has(r);)r++;o.push((0,t.jsx)("span",{className:"font-semibold text-primary",children:e.slice(s,r)},s)),s=r}else{let r=s;for(;r<e.length&&!n.has(r);)r++;o.push((0,t.jsx)("span",{children:e.slice(s,r)},s)),s=r}return(0,t.jsx)(t.Fragment,{children:o})}function W({projectId:e,meta:r,shares:n,busy:s,onInvite:i}){let[a,l]=(0,o.useState)(""),[d,c]=(0,o.useState)([]),[p,f]=(0,o.useState)("edit"),[m,w]=(0,o.useState)(!1),[y,b]=(0,o.useState)([]),[j,N]=(0,o.useState)(!1),[E,T]=(0,o.useState)(0),B=a.trim(),I=B.toLowerCase(),R=(0,o.useMemo)(()=>new Set(d.filter(e=>"group"===e.kind).map(e=>e.id)),[d]),P=(0,o.useMemo)(()=>new Set(r.groupShares.map(e=>e.groupId)),[r.groupShares]),L=(0,o.useMemo)(()=>new Set([...d.filter(e=>"person"===e.kind).map(e=>e.email.toLowerCase()),...n.map(e=>e.email.toLowerCase())].filter(Boolean)),[d,n]);(0,o.useEffect)(()=>{if(!m||!e||0===B.length)return;let t=new AbortController;N(!0);let r=setTimeout(()=>{(async()=>{try{let r=await fetch(`/api/projects/${e}/shares/members?q=${encodeURIComponent(B)}`,{signal:t.signal});if(!r.ok)throw Error("Failed to load members");let n=await r.json();b(n.members)}catch{b([])}finally{N(!1)}})()},150);return()=>{clearTimeout(r),t.abort()}},[e,B,m]);let O=(0,o.useMemo)(()=>A(r.groups.filter(e=>!P.has(e.id)&&!R.has(e.id)),e=>e.name,B,6),[r.groups,P,R,B]),$=(0,o.useMemo)(()=>A(y.filter(e=>e.email&&!L.has(e.email.toLowerCase())),e=>V(e),B,8),[y,L,B]),D=(0,o.useMemo)(()=>!(0,S.isValidShareEmail)(I)||L.has(I)||y.some(e=>e.email?.toLowerCase()===I)?null:I,[I,L,y]),z=(0,o.useMemo)(()=>[...$.map(e=>({kind:"person",...e})),...O.map(e=>({kind:"group",...e})),...D?[{kind:"email",email:D}]:[]],[$,O,D]);function F(e){c(t=>[...t,{kind:"group",id:e.id,name:e.name}]),l("")}function U(e){let t=e.email?.toLowerCase();t&&(c(r=>[...r,{kind:"person",email:t,userId:e.userId}]),l(""))}function H(e){c(t=>[...t,{kind:"person",email:e}]),l("")}function _(e){c(t=>t.filter((t,r)=>r!==e))}async function q(){let e=D?[...d,{kind:"person",email:D}]:d;0!==e.length&&(await i(e,p),c([]),l(""),T(0))}(0,o.useEffect)(()=>{T(z.length>0?0:-1)},[z.length]);let J=d.length>0||null!==D,X=m&&B.length>0;return(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start",children:[(0,t.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex min-h-9 flex-wrap items-center gap-1 rounded-md border bg-background px-1.5 py-1 focus-within:ring-2 focus-within:ring-primary/40",children:[d.map((e,r)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:["group"===e.kind?(0,t.jsx)(g.Users,{className:"size-3"}):(0,t.jsx)(h.Mail,{className:"size-3"}),(0,t.jsx)("span",{className:"max-w-[140px] truncate",children:"group"===e.kind?e.name:e.email}),(0,t.jsx)("button",{type:"button","aria-label":"Remove",onClick:()=>_(r),className:"text-muted-foreground hover:text-foreground",children:(0,t.jsx)(v.X,{className:"size-3"})})]}
2,"group"===e.kind?`g-${e.id}`:`p-${e.email}`)),(0,t.jsx)("input",{value:a,onChange:e=>l(e.target.value),onKeyDown:function(e){if("ArrowDown"===e.key)e.preventDefault(),z.length>0&&T(e=>(e+1)%z.length);else if("ArrowUp"===e.key)e.preventDefault(),z.length>0&&T(e=>(e-1+z.length)%z.length);else if("Enter"===e.key){if(e.preventDefault(),z.length>0){var t;let e=E>=0?E%z.length:0;"person"===(t=z[e]).kind?U(t.item):"group"===t.kind?F(t.item):"email"===t.kind&&H(t.email)}}else"Backspace"===e.key&&""===a&&d.length>0&&_(d.length-1)},onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),120),disabled:s,placeholder:0===d.length?"Add people or groupsâ¦":"",className:"h-6 min-w-[8rem] flex-1 bg-transparent px-1 text-base outline-none md:text-sm"})]}),X&&(0,t.jsxs)("div",{className:"surface-edge-float absolute left-0 right-0 top-full z-50 mt-1 max-h-64 overflow-auto rounded-md bg-popover p-1 shadow-md",children:[j&&0===z.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm text-muted-foreground",children:[(0,t.jsx)(u.Loader2,{className:"size-4 animate-spin"}),"Searchingâ¦"]}),!j&&0===z.length&&B&&(0,t.jsx)("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"No results found."}),z.map((e,r)=>{let n=r===E,s="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm";if("person"===e.kind){let i,a,l=e.item,d=V(l),c=(i=V(l).toLowerCase(),(a=l.email?.toLowerCase()??"")&&a!==i?a:l.username&&l.username!==l.displayName?l.username:null);return(0,t.jsxs)(o.Fragment,{children:[0===r&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"People"}),(0,t.jsxs)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),U(l)},className:`${s} ${n?"bg-accent":"hover:bg-accent"}`,children:[(0,t.jsxs)(C.Avatar,{size:"sm",children:[l.avatarUrl&&(0,t.jsx)(C.AvatarImage,{src:l.avatarUrl,alt:d}),(0,t.jsx)(C.AvatarFallback,{children:d.slice(0,2).toUpperCase()})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"truncate",children:(0,t.jsx)(Y,{text:d,indices:e.match.indices})}),c&&(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:c})]})]})]},`p-${l.userId}`)}if("group"===e.kind){let i=e.item;return(0,t.jsxs)(o.Fragment,{children:[r===$.length&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Groups"}),(0,t.jsxs)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),F(i)},className:`${s} ${n?"bg-accent":"hover:bg-accent"}`,children:[(0,t.jsx)(g.Users,{className:"size-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate",children:(0,t.jsx)(Y,{text:i.name,indices:e.match.indices})}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"group"})]})]},`g-${i.id}`)}return(0,t.jsxs)(o.Fragment,{children:[r===$.length+O.length&&(0,t.jsx)("div",{className:"border-t my-1"}),(0,t.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),H(e.email)},className:`${s} ${n?"bg-accent":"hover:bg-accent"}`,children:[(0,t.jsx)(h.Mail,{className:"size-4 text-muted-foreground"}),(0,t.jsxs)("span",{className:"flex-1 truncate",children:["Invite ",e.email]})]})]},`e-${e.email}`)})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(k.Select,{value:p,onValueChange:e=>f(e),items:M,children:[(0,t.jsx)(k.SelectTrigger,{className:"h-9 min-w-0 flex-1 sm:w-44 sm:flex-none sm:shrink-0",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{align:"end",alignItemWithTrigger:!1,className:"w-72 max-w-[calc(100vw-2rem)]",children:[(0,t.jsx)(k.SelectItem,{value:"publish",children:"Can edit & publish"}),(0,t.jsx)(k.SelectItem,{value:"edit",children:"Can edit"}),(0,t.jsx)(k.SelectItem,{value:"view",children:"Can use"})]})]}),(0,t.jsx)(x.Button,{size:"sm",className:"h-9 shrink-0",onClick:()=>void q(),disabled:s||!J,children:"Invite"})]})]})}function X({name:e,role:r,disabled:n,onChangeRole:o,onRemove:s}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-1.5 sm:gap-3",children:[(0,t.jsx)("div",{className:"grid size-9 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:(0,t.jsx)(g.Users,{className:"size-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium",children:e}),(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"Group · applies to everyone in it"})]}),(0,t.jsxs)(k.Select,{value:r,onValueChange:e=>o(e),disabled:n,items:P,children:[(0,t.jsx)(k.SelectTrigger,{className:"h-8 w-28 shrink-0 sm:w-44",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{align:"end",alignItemWithTrigger:!1,className:"w-72 max-w-[calc(100vw-2rem)]",children:[(0,t.jsx)(k.SelectItem,{value:"editor",children:"Can edit"}),(0,t.jsx)(k.SelectItem,{value:"viewer",children:"Can use"})]})]}),(0,t.jsx)(Z,{label:`Remove ${e}`,disabled:n,onClick:s})]})}function G({projectId:e,shares:r,meta:n,busy:s,setBusy:i,reload:a}){let l=n.viewerCanManage,d=r.filter(e=>"live"===e.surface),c=new Set(d.map(e=>e.email.toLowerCase())),u=(n.inheritedAccess??[]).filter(e=>"workspace"!==e.subject),h=u.filter(e=>"group"===e.subject),p=u.filter(e=>"email"===e.subject&&!!e.email&&!c.has(e.email.toLowerCase())),[f,m]=(0,o.useState)("");async function g(){if(!(0,S.isValidShareEmail)(f))return void w.toast.error("Enter a valid email.");i(!0);try{let t=await fetch(`/api/projects/${e}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:f,surface:"live",role:"viewer"})});if(!t.ok)return void w.toast.error((await t.json().catch(()=>({})))?.error??"Couldn't add.");m(""),await a()}finally{i(!1)}}return(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{value:f,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&void g(),placeholder:"Add people who can view the appâ¦",className:"h-9 flex-1 rounded-md border bg-background px-3 text-base outline-none focus:ring-2 focus:ring-primary/40 md:text-sm"}),(0,t.jsx)(x.Button,{size:"sm",onClick:()=>void g(),disabled:s||!f,children:"Invite"})]}),(0,t.jsx)(eu,{owner:n.owner,people:d,inheritedGroups:h,inheritedPeople:p,projectId:e,surface:"live",roleEditable:!1,isYou:n.viewerIsOwner,canManage:l,busy:s,setBusy:i,reload:a}),(0,t.jsx)(ep,{label:"live",projectId:e,meta:n,busy:s,setBusy:i,reload:a}),n.deployed&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-sm",children:[(0,t.jsx)("span",{className:"truncate text-xs",children:n.liveUrl.replace(/^https?:\/\//,"")}),(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs font-medium text-green-600",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"LIVE"]})]}),(0,t.jsx)(Q,{url:n.liveUrl})]})]})}let K={logo:T.BOOL_QR_LOGO};function Q({url:e}){let[r,n]=(0,o.useState)(!1);return(0,t.jsxs)("div",{className:"rounded-md border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"flex w-full items-center justify-between px-3 py-2 text-sm font-medium hover:bg-muted/50",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.QrCode,{className:"size-4"}),"Scan to open on a phone"]}),(0,t.jsx)(i.ChevronDown,{className:`size-4 transition-transform ${r?"rotate-180":""}`})]}),r&&(0,t.jsx)("div",{className:"border-t p-4",children:(0,t.jsx)(E.QrCode,{value:e,size:184,actions:!0,filename:"bool-live-app",options:K})})]})}function Z({label:e,disabled:r,onClick:n}){return(0,t.jsx)(x.Button,{variant:"ghost",size:"icon","aria-label":e,title:e,disabled:r,onClick:n,className:"size-8 shrink-0 text-muted-foreground hover:text-foreground",children:(0,t.jsx)(v.X,{className:"size-4"})})}function ee({url:e,name:r}){return e?(0,t.jsx)("img",{src:e,alt:"",className:"size-9 shrink-0 rounded-full object-cover"}):(0,t.jsx)("div",{className:"grid size-9 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase",children:r.slice(0,2)})}function et({owner:e,isYou:r}){let n=e.username??e.email??"You";return(0,t.jsxs)("div",{className:"flex items-center gap-3 py-1.5",children:[(0,t.jsx)(ee,{url:e.avatarUrl,name:n}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium",children:n}),e.email&&(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]}),(0,t.jsx)("span",{className:"px-2 text-sm text-muted-foreground",children:r?"You":"Owner"})]})}function er(e,t){return"live"===t?"Can view":"use"===e.rung?"Can use":e.canPublish?"Can edit & publish":"Can edit"}function en({grant:e}){return(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",className:"inline-flex size-7 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":"Inherited access"}),children:(0,t.jsx)(d.Info,{className:"size-3.5"})}),(0,t.jsx)(N.TooltipContent,{children:e.folderName?`Access inherited from the folder â${e.folderName}â`:"Access inherited from the workspace"})]})}function eo({open:e,onOpenChange:r,grant:n,projectName:o,from:s,to:i,busy:d,onConfirm:c}){let h=n.folderName??"Parent folder";return(0,t.jsx)(b.AlertDialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(b.AlertDialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(b.AlertDialogHeader,{children:[(0,t.jsx)(b.AlertDialogTitle,{children:"Update role on parent folder?"}),(0,t.jsxs)(b.AlertDialogDescription,{children:["Changing ",n.subjectLabel,"'s permissions on this Bool will also change their permissions on its parent folder."]}
2)]}),(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border bg-muted/20 p-4 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(l.Folder,{className:"mt-0.5 size-5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate font-medium",children:h}),(0,t.jsxs)("div",{className:"mt-0.5 text-muted-foreground",children:[(0,t.jsx)("span",{className:"line-through",children:B(s)}),(0,t.jsx)("span",{className:"px-2","aria-hidden":"true",children:"â"}),B(i)]})]})]}),(0,t.jsxs)("div",{className:"ml-2 flex items-start gap-3 border-l-2 pl-5",children:[(0,t.jsx)(a.FileCode2,{className:"mt-0.5 size-5 shrink-0 text-primary"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate font-medium",children:o}),(0,t.jsxs)("div",{className:"mt-0.5 text-muted-foreground",children:[(0,t.jsx)("span",{className:"line-through",children:B(s)}),(0,t.jsx)("span",{className:"px-2","aria-hidden":"true",children:"â"}),B(i)]})]})]})]}),(0,t.jsxs)(b.AlertDialogFooter,{children:[(0,t.jsx)(b.AlertDialogCancel,{disabled:d,children:"Cancel"}),(0,t.jsxs)(b.AlertDialogAction,{disabled:d,onClick:c,children:[d&&(0,t.jsx)(u.Loader2,{"data-icon":"inline-start",className:"animate-spin"}),"Update parent"]})]})]})})}async function es({grant:e,access:t}){return e.folderId?fetch(`/api/folders/${e.folderId}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subject:e.subject,groupId:e.groupId,email:e.email,..."view"===t?{role:"use",canPublish:!1}:{role:"edit",canPublish:"publish"===t}})}):null}function ei({grant:e,surface:r}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-1.5 sm:gap-3",children:[(0,t.jsx)("div",{className:"grid size-9 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:(0,t.jsx)(g.Users,{className:"size-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium",children:e.subjectLabel}),(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"Group"})]}),(0,t.jsx)(y.Badge,{variant:"secondary",className:"shrink-0",children:er(e,r)}),(0,t.jsx)(en,{grant:e})]})}function ea(e){return"use"===e.rung?"view":e.canPublish?"publish":"edit"}function el(e){return"view"===e?0:"edit"===e?1:2}function ed({grant:e,surface:r,projectId:n,canManage:s=!1,busy:i=!1,setBusy:a,reload:l,projectName:d="this Bool"}){let c=ea(e),[u,h]=(0,o.useState)(null);async function p(t){if(n&&e.email&&a&&l&&!(el(t)<=el(c))){a(!0);try{let r=await fetch(`/api/projects/${n}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:e.email,surface:"editor",...R(t)})});if(!r.ok)return void w.toast.error((await r.json().catch(()=>({})))?.error??"Couldn't update access.");w.toast.success(`Project access updated for ${e.subjectLabel}.`),await l()}finally{a(!1)}}}async function f(){if(u&&a&&l){a(!0);try{let t=await es({grant:e,access:u});if(!t?.ok)return void w.toast.error((await t?.json().catch(()=>({})))?.error??"You need permission to manage the parent folder.");w.toast.success(`Updated access on â${e.folderName??"parent folder"}â.`),h(null),await l()}finally{a(!1)}}}return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-1.5 sm:gap-3",children:[(0,t.jsx)(ee,{url:null,name:e.subjectLabel}),(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)("div",{className:"truncate text-sm font-medium",children:e.subjectLabel})}),"editor"===r&&"manage"!==e.rung?(0,t.jsxs)(k.Select,{value:c,onValueChange:t=>{if(el(t)<el(c)){e.folderId&&h(t);return}p(t)},disabled:!s||i,items:M,children:[(0,t.jsx)(k.SelectTrigger,{className:"h-8 w-28 shrink-0 sm:w-44",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{align:"end",alignItemWithTrigger:!1,className:"w-72 max-w-[calc(100vw-2rem)]",children:[(0,t.jsx)(k.SelectItem,{value:"publish",children:"Can edit & publish"}),(0,t.jsx)(k.SelectItem,{value:"edit",disabled:!e.folderId&&el(c)>1,children:"Can edit"}),(0,t.jsx)(k.SelectItem,{value:"view",disabled:!e.folderId&&el(c)>0,children:"Can use"})]})]}):(0,t.jsx)(y.Badge,{variant:"secondary",className:"shrink-0",children:er(e,r)}),(0,t.jsx)(en,{grant:e}),(0,t.jsx)(eo,{open:null!==u,onOpenChange:e=>!e&&h(null),grant:e,projectName:d,from:c,to:u??c,busy:i,onConfirm:()=>void f()})]})}function ec({people:e,projectId:r,projectName:n="this Bool",surface:s,roleEditable:i,inheritedPeople:a=[],canManage:l,isOwner:d=!1,busy:c,setBusy:h,reload:p}){let f=!l||c,[m,g]=(0,o.useState)(null),[v,x]=(0,o.useState)(null);async function y(e){h(!0);try{let t=await fetch(`/api/projects/${r}/owner`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({email:e.email})}),n=await t.json().catch(()=>({}));if(!t.ok)return void w.toast.error(n?.error??"Couldn't transfer ownership.");w.toast.success(`${e.username??e.email} is now the owner.`),await p()}finally{h(!1),x(null)}}async function j(e,t){h(!0);try{if(!(await fetch(`/api/projects/${r}/shares`,{method:e,headers:{"content-type":"application/json"},body:JSON.stringify(t)})).ok)return void w.toast.error("Couldn't update.");await p()}finally{h(!1)}}async function C(e){let t=e.sourceSurfaces??[s];h(!0);try{if((await Promise.all(t.map(t=>fetch(`/api/projects/${r}/shares`,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({email:e.email,surface:t})})))).some(e=>!e.ok))return void w.toast.error("Couldn't remove all direct access.");await p()}finally{h(!1)}}async function N(){if(m){h(!0);try{let e=await es({grant:m.grant,access:m.to});if(!e?.ok)return void w.toast.error((await e?.json().catch(()=>({})))?.error??"You need permission to manage the parent folder.");if(!(await fetch(`/api/projects/${r}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:m.person.email,surface:"editor",...R(m.to)})})).ok){w.toast.error("The folder was updated, but the Bool's direct role could not be changed."),await p();return}w.toast.success(`Updated access on â${m.grant.folderName??"parent folder"}â.`),g(null),await p()}finally{h(!1)}}}return(0,t.jsxs)(t.Fragment,{children:[e.map(e=>{var r,n;let o=a.find(t=>t.email?.toLowerCase()===e.email.toLowerCase()),s=(r=e.role,n=e.canPublish,"viewer"===r?"view":n?"publish":"edit"),l=o?ea(o):"view",c=o?el(s)>=el(l)?s:l:s;return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-1.5 sm:gap-3",children:[(0,t.jsx)(ee,{url:e.avatarUrl,name:e.username??e.email}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-sm font-medium",children:[(0,t.jsx)("span",{className:"truncate",children:e.username??e.email}),e.pending&&(0,t.jsx)("span",{className:"shrink-0 rounded bg-amber-500/10 px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-amber-700 dark:text-amber-400",children:"Pending"})]}),e.username&&(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]}),i?(0,t.jsxs)(k.Select,{value:c,onValueChange:t=>{"owner"===t?x(e):o?.folderId&&el(t)<el(l)?g({person:e,grant:o,from:c,to:t}):j("POST",{email:e.email,surface:"editor",...R(t)})},disabled:f,items:d?L:M,children:[(0,t.jsx)(k.SelectTrigger,{className:"h-8 w-28 shrink-0 sm:w-44",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{align:"end",alignItemWithTrigger:!1,className:"w-72 max-w-[calc(100vw-2rem)]",children:[(0,t.jsx)(k.SelectItem,{value:"publish",children:"Can edit & publish"}
2),(0,t.jsx)(k.SelectItem,{value:"edit",disabled:!!o&&!o.folderId&&el(l)>1,children:"Can edit"}),(0,t.jsx)(k.SelectItem,{value:"view",disabled:!!o&&!o.folderId&&el(l)>0,children:"Can use"}),d&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k.SelectSeparator,{}),(0,t.jsx)(k.SelectItem,{value:"owner",disabled:e.pending,children:"Make owner"})]})]})]}):(0,t.jsxs)(k.Select,{value:"viewer",disabled:f,items:O,children:[(0,t.jsx)(k.SelectTrigger,{className:"h-8 w-28 shrink-0",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsx)(k.SelectContent,{align:"end",children:(0,t.jsx)(k.SelectItem,{value:"viewer",children:"Can view"})})]}),o&&(0,t.jsx)(en,{grant:o}),(0,t.jsx)(Z,{label:`Remove ${e.username??e.email}`,disabled:f,onClick:()=>void C(e)})]},e.id)}),m&&(0,t.jsx)(eo,{open:!0,onOpenChange:e=>!e&&g(null),grant:m.grant,projectName:n,from:m.from,to:m.to,busy:c,onConfirm:()=>void N()}),v&&(0,t.jsx)(b.AlertDialog,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,t.jsxs)(b.AlertDialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(b.AlertDialogHeader,{children:[(0,t.jsxs)(b.AlertDialogTitle,{children:["Make ",v.username??v.email," the owner?"]}),(0,t.jsxs)(b.AlertDialogDescription,{children:["You will become an editor with publish rights. They will own ",n,"."]})]}),(0,t.jsxs)(b.AlertDialogFooter,{children:[(0,t.jsx)(b.AlertDialogCancel,{disabled:c,onClick:()=>x(null),children:"Cancel"}),(0,t.jsxs)(b.AlertDialogAction,{disabled:c,onClick:()=>void y(v),children:[c&&(0,t.jsx)(u.Loader2,{"data-icon":"inline-start",className:"animate-spin"}),"Transfer ownership"]})]})]})})]})}function eu({owner:e,people:r,inheritedGroups:n,inheritedPeople:o,projectId:s,surface:i,roleEditable:a,isYou:l,canManage:d,busy:c,setBusy:u,reload:h}){return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(et,{owner:e,isYou:l}),n?.map(e=>(0,t.jsx)(ei,{grant:e,surface:i},`inherited-group-${e.groupId}`)),(0,t.jsx)(ec,{people:r,projectId:s,surface:i,roleEditable:a,canManage:d,busy:c,setBusy:u,reload:h}),o?.map(e=>(0,t.jsx)(ed,{grant:e,surface:i},`inherited-person-${e.email}`))]})}function eh({projectId:e,meta:n,busy:o,setBusy:i,reload:a}){let l=(0,r.useRouter)(),d=!n.viewerCanManage||o,c=n.workspaceName??"Workspace",u=n.liveAccess,h=(n.inheritedAccess??[]).length>0;async function p(t){i(!0);try{let r=await fetch(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({liveAccess:t})});if(!r.ok)return void w.toast.error((await r.json().catch(()=>({})))?.error??"Couldn't update app access.");w.toast.success("link"===t?"Anyone with the link can use the app.":"workspace"===t?`${c} can use the app.`:"App access is restricted."),await a(),l.refresh()}finally{i(!1)}}return(0,t.jsxs)("section",{"aria-labelledby":"published-app-access",className:"space-y-2 border-t pt-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{id:"published-app-access",className:"text-sm font-semibold",children:"Published app"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose the broadest audience that can use the app. People above can have more access."})]}),(0,t.jsxs)(k.Select,{value:u,disabled:d,items:{restricted:"Restricted",workspace:`${c} \xb7 Can use`,link:"Anyone with the link · Can use"},onValueChange:e=>void p(e),children:[(0,t.jsx)(k.SelectTrigger,{className:"h-9 w-full","aria-label":"Published app access",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{align:"end",alignItemWithTrigger:!1,className:"w-80 max-w-[calc(100vw-2rem)]",children:[(0,t.jsx)(k.SelectItem,{value:"restricted",children:"Restricted â only people with access"}),"shared"===n.workspaceKind&&(0,t.jsxs)(k.SelectItem,{value:"workspace",children:[c," â Can use"]}),(0,t.jsx)(k.SelectItem,{value:"link",children:"Anyone with the link â Can use"})]})]}),"restricted"===u&&h&&(0,t.jsxs)("p",{className:"flex items-start gap-1 text-xs text-muted-foreground",children:[(0,t.jsx)(s.Check,{className:"mt-0.5 size-3 shrink-0"}),"Folder access still applies to this Bool."]}),n.deployed&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-sm",children:[(0,t.jsx)("span",{className:"min-w-0 truncate text-xs",children:n.liveUrl.replace(/^https?:\/\//,"")}),(0,t.jsxs)("span",{className:"ml-2 flex shrink-0 items-center gap-1 text-xs font-medium text-green-600",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"LIVE"]})]}),(0,t.jsx)(Q,{url:n.liveUrl})]})]})}function ep({label:e,projectId:n,meta:o,busy:i,setBusy:a,reload:l}){let d=(0,r.useRouter)(),c=!o.viewerCanManage||i,u="shared"!==o.workspaceKind,h=o.editorAcce
2ss,p=o.liveAccess;async function f(e,t){a(!0);try{let r=await fetch(`/api/projects/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!r.ok)return void w.toast.error((await r.json().catch(()=>({})))?.error??"Couldn't update.");w.toast.success(t),await l(),d.refresh()}finally{a(!1)}}let m=o.workspaceName??"Workspace",g=(o.inheritedAccess??[]).filter(t=>"editor"!==e||"use"!==t.rung),v=g.filter(e=>"workspace"!==e.subject),x=g.find(e=>"workspace"===e.subject);return(0,t.jsxs)("div",{className:"border-t pt-3",children:[(0,t.jsx)("div",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"General access"}),"editor"===e?(0,t.jsxs)(k.Select,{value:h,disabled:c,items:{restricted:"Restricted",workspace:`${m} \xb7 can view`},onValueChange:e=>{"restricted"===e?f({editorAccess:"restricted"},"Only added people can open the editor."):f({editorAccess:"workspace"},`Everyone in ${m} can view this bool.`)},children:[(0,t.jsx)(k.SelectTrigger,{className:"h-9 w-full",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{children:[(0,t.jsx)(k.SelectItem,{value:"restricted",children:"Restricted â only people you add"}),!u&&(0,t.jsxs)(k.SelectItem,{value:"workspace",children:[m," â everyone can view"]})]})]}):(0,t.jsxs)(k.Select,{value:p,disabled:c,items:{restricted:"Restricted",workspace:`${m} \xb7 can view`,link:"Anyone with the link"},onValueChange:e=>{"restricted"===e?f({liveAccess:"restricted"},"Only added people can view the live app."):"workspace"===e?f({liveAccess:"workspace"},`${m} can view the live app.`):f({liveAccess:"link"},"Anyone with the link can view.")},children:[(0,t.jsx)(k.SelectTrigger,{className:"h-9 w-full",children:(0,t.jsx)(k.SelectValue,{})}),(0,t.jsxs)(k.SelectContent,{children:[(0,t.jsx)(k.SelectItem,{value:"restricted",children:"Restricted â only people you add"}),!u&&(0,t.jsxs)(k.SelectItem,{value:"workspace",children:[m," â can view"]}),(0,t.jsx)(k.SelectItem,{value:"link",children:"Anyone with the link"})]})]}),(0,t.jsxs)("p",{className:"mt-1.5 flex items-start gap-1 text-xs text-muted-foreground",children:[(0,t.jsx)(s.Check,{className:"mt-0.5 size-3 shrink-0"}),"editor"===e?"restricted"===h?v.length>0?"Restricted â people and groups above can also access this from the folder":x?`Restricted â but everyone in ${m} has access from the folder`:"Only people and groups you add can open the editor":`Everyone in ${m} can view; add groups or people above to grant edit`:"link"===p?"Anyone with the link can view the live app":"workspace"===p?`Everyone in ${m} can view the live app`:v.length>0?"Restricted â people and groups above can also access this from the folder":x?`Restricted â but everyone in ${m} has access from the folder`:"Only people you add can open the live app"]})]})}e.s(["CollaborationPanel",0,function({projectId:e,onDone:r}){let{shares:n,requests:s,myRequests:i,meta:a,reload:l}=U(e),[d,c]=(0,o.useState)(!1);return a?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(J,{projectId:e,shares:n,meta:a,requests:s,myRequests:i,busy:d,setBusy:c,reload:l}),(0,t.jsx)(_,{projectId:e,meta:a,surface:"editor",onDone:r})]}):(0,t.jsx)(H,{})},"LiveSharePanel",0,function({projectId:e,onDone:r}){let{shares:n,meta:s,reload:i}=U(e),[a,l]=(0,o.useState)(!1);return s?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(G,{projectId:e,shares:n,meta:s,busy:a,setBusy:l,reload:i}),(0,t.jsx)(_,{projectId:e,meta:s,surface:"live",onDone:r})]}):(0,t.jsx)(H,{})},"SharePanel",0,q],487542),e.s(["ShareDialog",0,function({open:e,onOpenChange:o,projectId:s,projectName:i}){let a=(0,r.useRouter)();function l(){o(!1),setTimeout(()=>a.refresh(),200)}return(0,t.jsx)(n.Dialog,{open:e,onOpenChange:e=>e?o(!0):l(),children:(0,t.jsxs)(n.DialogContent,{className:"max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain sm:max-w-2xl",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)(n.DialogTitle,{className:"flex items-center gap-1.5 text-base",children:["Share",(0,t.jsxs)("span",{className:"font-normal text-muted-foreground",children:["· ",i]})]})}),e&&(0,t.jsx)(q,{projectId:s,onDone:l})]})})}],305894)},488360,e=>{"use strict";var t=e.i(843476),r=e.i(30593),n=e.i(630374),o=e.i(743687);e.s(["ResponsiveModal",0,function({open:e,onOpenChange:s,title:i,description:a,children:l,className:d}){return(0,r.useIsMobile)()?(0,t.jsx)(o.Drawer,{open:e,onOpenChange:s,children:(0,t.jsxs)(o.DrawerContent,{children:[(0,t.jsxs)(o.DrawerHeader,{className:"text-left",children:[(0,t.jsx)(o.DrawerTitle,{children:i}),a&&(0,t.jsx)(o.DrawerDescription,{children:a})]}),(0,t.jsx)("div",{className:"min-h-0 overflow-y-auto overscroll-contain px-4 pb-6",children:l})]})}):(0,t.jsx)(n.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(n.DialogContent,{className:d??"sm:max-w-md",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:i}),a&&(0,t.jsx)(n.DialogDescription,{children:a})]}),l]})})}])},408578,e=>{"use strict";var t=e.i(971759);let r=`<script> 3 (function () { 4 if (window.parent === window) return; // only active inside the editor preview iframe 5 6 var LOC = "data-bool-loc"; 7 var SRC = "data-bool-src"; 8 var TEXT = "data-bool-text"; 9 var ROWTEXT = "data-bool-text-row"; 10 var IMG = "data-bool-img"; 11 var HOST_ID = "__bool_element_overlay"; 12 var enabled = false;
13 var selected = null; // the selected DOM node 14 var selectedLoc = null; // its location string, for re-finding after HMR 15 var selectedIndex = 0; // which of that location's rows it is 16 var peers = []; // the other rows drawn from the same JSX 17 var peerBoxes = []; // their outlines (pool, grown as needed) 18 var peerScan = 0; // throttles re-reading the set (see tick) 19 var cssScan = 0; // throttles re-disarming the app's hover CSS 20 var outlined = []; // peers we've outlined, and what they had before 21 var hovered = null; // the node under the pointer 22 var hoverTarget = null; // the node we outline for it (see setHover) 23 var hoverPeers = []; // the other rows THAT node's JSX draws 24 var hoverBoxes = []; // their outlines (pool, grown as needed) 25 var host = null; // overlay host (shadow root inside) 26 var originX = 0; // the host's own viewport position, per frame 27 var originY = 0; // (see readOrigin â box coords are relative to it) 28 var hoverBox = null; 29 var hoverChip = null; // the tag name, shown while hovering 30 var selectBox = null; 31 // The tag label worn by the hover box and by every peer outline. 32 var CHIP_CSS = 33 "position:absolute;left:-1px;top:-18px;height:17px;padding:0 5px;" + 34 "border-radius:3px 3px 0 0;background:rgba(59,130,246,0.85);color:#fff;" + 35 "font:600 11px/17px ui-monospace,SFMono-Regular,Menlo,monospace;" + 36 "white-space:nowrap;"; 37 // Hover and selection are the same line, because they frame the same thing: 38 // hovering shows you what a click is about to select. A dotted border read 39 // as a different kind of object â a placeholder, a drop target â rather than 40 // as a preview of the solid one. 41 var HOVER_BORDER = "border:2px solid rgba(59,130,246,0.9);"; 42 // The multiplication sign, by code point. A literal one would be the only 43 // non-ASCII byte in a script spliced into whatever index.html a project 44 // happens to have, and an escape written here is eaten before it is emitted 45 // (see trimJsxEdges) â so neither spelling is available. 46 var TIMES = String.fromCharCode(215); 47 var styleTag = null; 48 var frame = 0; 49 var previewProps = []; // inline style props we set for live preview 50 var textBackup = null; // original textContent while previewing text 51 var settleWatch = null; // MutationObserver waiting for a saved edit to render 52 var settleTimer = 0; // its deadline, if the app never re-renders 53 var SETTLE_MS = 4000; // how long a saved edit gets to reach the screen 54 var lastRect = ""; 55 var pendingLoc = null; // a select() waiting for the app to render it 56 var pendingUntil = 0; 57 var hoverGuards = []; // app :hover rules we've disarmed, and their originals 58 var guardedCounts = null; // rule count per stylesheet, so a hot update is re-read 59 60 function post(msg) { 61 msg.source = "bool-edit"; 62 try { window.parent.postMessage(msg, "*"); } catch (e) {} 63 } 64 65 // ââ locating ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 66 // A DOM node can carry both attributes: its own -loc, plus a -src spread 67 // down from the component that wrapped it. The usage site wins, because 68 // that is the file the user is looking at and means to change. 69 function locOf(node) { 70 if (!node || !node.getAttribute) return null; 71 var s = node.getAttribute(SRC); 72 if (s) return { loc: s, kind: "usage" }; 73 var l = node.getAttribute(LOC); 74 if (l) return { loc: l, kind: "host" }; 75 return null; 76 } 77 78 function isOurs(node) { 79 return !!(node && node.id === HOST_ID); 80 } 81 82 // Walk up to the nearest node we can actually trace to source, and select 83 // THAT node â so the outline always frames the thing the toolbar can edit. 84 function resolve(node) { 85 while (node && node.nodeType === 1) { 86 if (isOurs(node)) return null; 87 if (node === document.body || node === document.documentElement) return null; 88 if (locOf(node)) return node; 89 node = node.parentElement; 90 } 91 return null; 92 } 93 94 // Every node rendered from one piece of JSX, in document order. A list 95 // drawn with .map() stamps the same location onto every row, so this is 96 // exactly the set an edit to that source will change. 97 function findAllByLoc(loc) { 98 if (!loc) return []; 99 var out = [];
100 try { 101 var nodes = document.querySelectorAll( 102 '[' + SRC + '="' + loc + '"],[' + LOC + '="' + loc + '"]' 103 ); 104 for (var i = 0; i < nodes.length; i++) { 105 // Respect the usage-site-wins rule: a node carrying a -src for some 106 // OTHER component isn't this location, whatever its -loc says. 107 var info = locOf(nodes[i]); 108 if (info && info.loc === loc) out.push(nodes[i]); 109 } 110 } catch (e) {} 111 return out; 112 } 113 114 function findByLoc(loc) { 115 var all = findAllByLoc(loc); 116 if (!all.length) return null; 117 // Come back to the SAME row after a hot update, not the first one that 118 // happens to share the location. 119 return all[selectedIndex] || all[0]; 120 } 121 122 function ancestorsOf(node) { 123 var out = []; 124 var p = node.parentElement; 125 while (p && p.nodeType === 1 && out.length < 8) { 126 if (p === document.body || p === document.documentElement) break; 127 var info = locOf(p); 128 if (info) out.push({ tag: p.tagName.toLowerCase(), loc: info.loc }); 129 p = p.parentElement; 130 } 131 return out; 132 } 133 134 // The nearest editable things INSIDE this one, so the badge menu is a tree 135 // you can walk down as well as up. Descends through wrappers the 136 // instrumenter didn't stamp â a plain layout div between a section and its 137 // heading shouldn't end the list â and stops at the first stamped element 138 // on each branch, which is the one a click would select. 139 // 140 // Deduped by location: a .map() draws its rows from ONE piece of JSX, so 141 // four <li> rows are four copies of a single menu entry, all selecting the 142 // same thing. The badge's \xd7N already says there are four. 143 function childrenOf(node) { 144 var out = []; 145 var seen = {}; 146 var walk = function (parent) { 147 for (var i = 0; i < parent.children.length; i++) { 148 if (out.length >= 12) return; 149 var child = parent.children[i]; 150 if (isOurs(child)) continue; 151 var info = locOf(child); 152 if (!info) { 153 walk(child); 154 } else if (!seen[info.loc]) { 155 seen[info.loc] = 1; 156 out.push({ tag: child.tagName.toLowerCase(), loc: info.loc }); 157 } 158 } 159 }; 160 walk(node); 161 return out; 162 } 163 164 function rectOf(node) { 165 var r = node.getBoundingClientRect(); 166 return { top: r.top, left: r.left, width: r.width, height: r.height }; 167 } 168 169 // The text node holding this element's own words â the words that belong to 170 // it rather than to a child element. Usually the only child; in a heading 171 // reading "Follow your appetite somewhere <span>interesting.</span>" it is 172 // the run before the span, which is exactly the run the source rewriter 173 // replaces. Whitespace-only nodes are skipped: they are the rendered form 174 // of the string expression prettier leaves between a word and an element. 175 function ownTextNode(node) { 176 if (!node) return null; 177 var fallback = null; 178 for (var i = 0; i < node.childNodes.length; i++) { 179 var child = node.childNodes[i]; 180 if (child.nodeType !== 3) continue; 181 if (child.nodeValue && child.nodeValue.trim()) return child; 182 if (!fallback) fallback = child; 183 } 184 return fallback; 185 } 186 187 // JSX drops the newline-and-indent that wraps a text run when it renders 188 // it, and the source rewriter puts it back the same way. React has usually 189 // done this for us already; a run that reaches us raw shouldn't put the 190 // file's indentation into the editor's text box. 191 // 192 // Written with char codes and no regex on purpose: this whole script is a 193 // template literal, so an escape like backslash-n here would be eaten at 194 // build time and emitted as a real newline (32 = space, 9 = tab, 10 = LF, 195 // 13 = CR). A whitespace run is only trimmed when it contains a newline, 196 // which is JSX's own rule â a lone trailing space is content. 197 function isWs(c) { return c === 32 || c === 9 || c === 10 || c === 13; } 198 199 function trimJsxEdges(value) { 200 var start = 0; 201 var end = value.length; 202 var i = 0; 203 var sawNewline = false;
204 while (i < end && isWs(value.charCodeAt(i))) { 205 if (value.charCodeAt(i) === 10) sawNewline = true; 206 i++; 207 } 208 if (sawNewline) start = i; 209 sawNewline = false; 210 var j = end; 211 while (j > start && isWs(value.charCodeAt(j - 1))) { 212 if (value.charCodeAt(j - 1) === 10) sawNewline = true; 213 j--; 214 } 215 if (sawNewline) end = j; 216 return value.slice(start, end); 217 } 218 219 // Where a text edit for this node has to land. The marker names the element 220 // whose literal it describes, so this is just "which of this node's two 221 // possible locations is the marked one" â the usage site if the component 222 // was handed a literal, otherwise the element's own definition site, which 223 // is where the words are when a component wraps them. 224 function markerLoc(node, info, attr) { 225 var marker = node.getAttribute(attr); 226 if (!marker) return null; 227 if (info && marker === info.loc) return marker; 228 var own = node.getAttribute(LOC); 229 return own && marker === own ? marker : null; 230 } 231 232 function textLocOf(node, info) {
233 return markerLoc(node, info, TEXT); 234 } 235 236 // Does a text edit here change this element alone? True when the words are 237 // one entry of a literal array a .map() draws, which is the one edit that 238 // does NOT apply to every element the same JSX makes. 239 function isRowText(node) { 240 if (!node) return false; 241 return !!markerLoc(node, locOf(node), ROWTEXT); 242 } 243 244 function describe(node) { 245 var info = locOf(node); 246 var cs = window.getComputedStyle(node); 247 var tag = node.tagName.toLowerCase(); 248 // Which words are this element's own. The instrumenter's marker decides 249 // whether they may be REWRITTEN (see textEditable); this is just what 250 // they say. 251 var own = ownTextNode(node); 252 var textLoc = textLocOf(node, info); 253 var isImage = tag === "img"; 254 return { 255 loc: info ? info.loc : null, 256 locKind: info ? info.kind : null, 257 tag: tag, 258 isImage: isImage, 259 src: isImage ? node.getAttribute("src") : null, 260 // What the browser actually loaded, which is the attribute resolved 261 // against THIS document â so the editor can show the picture instead of 262 // asking its own origin for a path that only exists in here. currentSrc 263 // is empty until the image loads; .src is the resolution either way. 264 srcResolved: isImage ? node.currentSrc || node.src || null : null, 265 alt: isImage ? node.getAttribute("alt") : null, 266 srcLoc: isImage ? markerLoc(node, info, IMG) : null, 267 text: own ? trimJsxEdges(own.nodeValue) : null, 268 textEditable: !!own && !!textLoc, 269 textLoc: textLoc, 270 textPerRow: isRowText(node), 271 rect: rectOf(node), 272 styles: { 273 opacity: cs.opacity, 274 fontSize: cs.fontSize, 275 color: cs.color, 276 backgroundColor: cs.backgroundColor, 277 fontFamily: cs.fontFamily, 278 fontWeight: cs.fontWeight, 279 textAlign: cs.textAlign, 280 paddingTop: cs.paddingTop, 281 paddingRight: cs.paddingRight, 282 paddingBottom: cs.paddingBottom, 283 paddingLeft: cs.paddingLeft, 284 marginTop: cs.marginTop, 285 marginRight: cs.marginRight, 286 marginBottom: cs.marginBottom, 287 marginLeft: cs.marginLeft 288 }, 289 ancestors: ancestorsOf(node), 290 children: childrenOf(node), 291 drawn: node === selected ? peers.length + 1 : findAllByLoc(info ? info.loc : null).length || 1 292 }; 293 } 294 295 // ââ overlay âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 296 // Rendered INSIDE the preview rather than over it in the editor: the boxes 297 // then track scrolling and layout for free, with no cross-frame coordinate 298 // maths. A shadow root keeps the app's CSS from reaching them. 299 // 300 // ABSOLUTE, NOT FIXED, and this is the whole reason the highlight sits 301 // still. A fixed box is anchored to the viewport, so keeping it on a 302 // scrolling element means rewriting its top/left every single frame â and 303 // scrolling is exactly when the main thread is least likely to get a frame. 304 // Miss one (a compositor-driven scroll, a React re-render, one long task) 305 // and the highlight is left behind and then snaps forward: the bounce. 306 // 307 // Positioned in the document instead, it IS part of the scrolling content, 308 // so the compositor moves it with the text whether or not our code runs. 309 // The rAF loop still re-places it, which is what keeps a genuinely 310 // viewport-anchored target (a sticky header) correct â but for ordinary 311 // content it now has nothing to correct. 312 function ensureOverlay() { 313 if (host && document.body.contains(host)) return; 314 host = document.createElement("div"); 315 host.id = HOST_ID; 316 host.setAttribute("aria-hidden", "true"); 317 host.style.cssText = 318 "position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:2147483646"; 319 var root = host.attachShadow ? host.attachShadow({ mode: "open" }) : host;
320 hoverBox = document.createElement("div"); 321 selectBox = document.createElement("div"); 322 // Every box says which kind it is. Two pools now grow into this root, so 323 // "the boxes after the first two" is no longer a way to name one. 324 hoverBox.className = "bool-hover"; 325 selectBox.className = "bool-select"; 326 var base = 327 "position:absolute;pointer-events:none;display:none;box-sizing:border-box;border-radius:2px;"; 328 hoverBox.style.cssText = base + HOVER_BORDER; 329 // Name what you are about to click before you click it. The editor's own 330 // badge only exists for a SELECTION, so without this the tag was 331 // something you learned by committing to it. Drawn here rather than in 332 // the editor because a hover badge has to keep up with the pointer, and a 333 // postMessage per mousemove would not. 334 hoverChip = document.createElement("span"); 335 hoverChip.style.cssText = CHIP_CSS + "opacity:0.85;"; 336 hoverBox.appendChild(hoverChip); 337 selectBox.style.cssText = 338 base + 339 "border:2px solid rgb(59,130,246);box-shadow:0 0 0 1px rgba(255,255,255,0.5);"; 340 root.appendChild(hoverBox); 341 root.appendChild(selectBox); 342 peerBoxes = []; 343 hoverBoxes = []; 344 document.body.appendChild(host); 345 } 346 347 // Outlines for the other rows the same JSX draws. Appended AFTER the two 348 // fixed boxes so anything indexing the shadow root keeps working. Quieter 349 // than the selection: they aren't what you clicked, they're what comes with 350 // it. 351 function ensurePeerBoxes(count) { 352 var root = host.shadowRoot || host; 353 while (peerBoxes.length < count) { 354 var box = document.createElement("div"); 355 box.className = "bool-peer"; 356 // Two highlights on purpose, because each survives where the other 357 // doesn't. This overlay tint sits above the page, so it shows over a 358 // photo â but against an opaque element that paints later it can lose. 359 // The inset outline in markPeers is painted BY the element, so it 360 // always shows, but on a full-bleed image it lands right against the 361 // card's own border. Together they're legible on anything. 362 box.style.cssText = 363 "position:absolute;pointer-events:none;display:none;box-sizing:border-box;" + 364 "border-radius:2px;background:rgba(59,130,246,0.18);"; 365 // Each one wears the tag name too, so a row of three reads as three 366 // selected things rather than one selected thing and two tinted ones. 367 // The editor draws the real badge (with the parent menu) over the 368 // element you clicked; these are the quiet copies. 369 var chip = document.createElement("span"); 370 chip.style.cssText = CHIP_CSS; 371 box.appendChild(chip); 372 root.appendChild(box); 373 peerBoxes.push(box); 374 } 375 for (var i = count; i < peerBoxes.length; i++) { 376 peerBoxes[i].style.display = "none"; 377 } 378 } 379 380 // The same pool for hovering. Plain outlines, no tint and no per-box chip: 381 // hovering is a glance, and the one chip on the box under the pointer 382 // already carries the count for the whole set. 383 function ensureHoverBoxes(count) { 384 if (!host) return; 385 var root = host.shadowRoot || host; 386 while (hoverBoxes.length < count) { 387 var box = document.createElement("div"); 388 box.className = "bool-hover-peer"; 389 box.style.cssText = 390 "position:absolute;pointer-events:none;display:none;box-sizing:border-box;" + 391 "border-radius:2px;" + HOVER_BORDER; 392 root.appendChild(box); 393 hoverBoxes.push(box); 394 } 395 for (var i = count; i < hoverBoxes.length; i++) { 396 hoverBoxes[i].style.display = "none"; 397 } 398 } 399 400 function placeBox(box, node) { 401 if (!box) return; 402 if (!node || !document.contains(node)) { 403 box.style.display = "none"; 404 return; 405 } 406 var r = node.getBoundingClientRect(); 407 // Relative to the overlay host, which sits in the document and scrolls 408 // with it â so for ordinary content this comes out the SAME on every 409 // frame of a scroll, and the browser is left to move the box with the 410 // text. Measured as a difference rather than added to scrollY so a body 411 // margin, a transformed ancestor or a positioned body all come out right 412 // without any of them being special-cased. 413 box.style.display = "block"; 414 box.style.top = r.top - originY + "px"; 415 box.style.left = r.left - originX + "px"; 416 box.style.width = r.width + "px"; 417 box.style.height = r.height + "px"; 418 } 419 420 // Where the overlay host currently is, in viewport terms. Read once per 421 // frame and reused by every box: it's the same for all of them, and it only 422 // changes when the page scrolls or reflows. 423 function readOrigin() { 424 if (!host) return; 425 var r = host.getBoundingClientRect(); 426 originX = r.left; 427 originY = r.top; 428 } 429 430 // The hover box, plus the tag name on it. Separate from placeBox because 431 // the label has to tuck inside the element when it is flush against the top 432 // of the viewport â the same flip the editor's selection badge does. 433 function placeHover(node) { 434 placeBox(hoverBox, node); 435 if (!hoverChip || !node || !document.contains(node)) return; 436 var label = node.tagName.toLowerCase(); 437 // Say how many BEFORE the click. Hovering one row of a nav outlines every 438 // row the same JSX draws, and without a count the other outlines look 439 // like a bug rather than like the answer to "what would I be editing".
440 if (hoverPeers.length) label += " " + TIMES + (hoverPeers.length + 1); 441 hoverChip.textContent = label; 442 var atTop = node.getBoundingClientRect().top < 19; 443 hoverChip.style.top = atTop ? "1px" : "-18px"; 444 hoverChip.style.borderRadius = atTop ? "3px" : "3px 3px 0 0"; 445 } 446 447 // What the pointer is over, and everything a click on it would take with it. 448 // 449 // A nav is one piece of JSX drawn N times, so the N rows are one editable 450 // thing â outlining only the row under the pointer said the opposite, and 451 // you found out otherwise by selecting it. This is the same set select() 452 // uses (findAllByLoc), just shown a step earlier. 453 function setHover(node) { 454 // A hot update can swap the hovered node out between pointer moves (this 455 // is re-run on every select, and select is how HMR re-finds things). Its 456 // attributes survive detachment, so without this the old node's location 457 // would light up every LIVE row while the pointer is over none of them. 458 if (node && !document.contains(node)) node = null; 459 hovered = node; 460 hoverPeers = []; 461 var info = node ? locOf(node) : null; 462 // Nothing the selection already outlines: hovering your own selection, or 463 // another row of it, would only lay a second line over the first. 464 hoverTarget = info && info.loc === selectedLoc ? null : node; 465 if (hoverTarget && info) { 466 var all = findAllByLoc(info.loc); 467 for (var i = 0; i < all.length; i++) { 468 if (all[i] !== hoverTarget) hoverPeers.push(all[i]); 469 } 470 } 471 ensureHoverBoxes(hoverPeers.length); 472 readOrigin(); 473 drawHover(); 474 } 475 476 function drawHover() { 477 placeHover(hoverTarget); 478 for (var i = 0; i < hoverPeers.length; i++) { 479 placeBox(hoverBoxes[i], hoverPeers[i]); 480 } 481 } 482 483 function ensureStyle() { 484 if (styleTag && document.head.contains(styleTag)) return; 485 styleTag = document.createElement("style"); 486 // A crosshair everywhere makes the mode legible, and killing text 487 // selection stops a click-drag from highlighting the app's copy. 488 styleTag.textContent = 489 "html.__bool-editing, html.__bool-editing * { cursor: crosshair !important; }" + 490 "html.__bool-editing * { user-select: none !important; -webkit-user-select: none !important; }"; 491 document.head.appendChild(styleTag); 492 } 493 494 // ââ the app's own hover, held off âââââââââââââââââââââââââââââââââââââ 495 // An image that zooms on hover moves out from under the outline you are 496 // trying to click, and a menu that opens on hover covers what you came to 497 // edit. JS hover handlers are swallowed like every other input, but :hover 498 // is decided by the browser rather than by an event â nothing can cancel 499 // it â so the RULES are what has to change. 500 // 501 // Each hover selector is put behind html:not(.__bool-editing), which is a 502 // no-op the moment the class comes off: even if a restore never runs (an 503 // HMR swap mid-edit, a reload), the app's hover behaves exactly as it did. 504 // The originals go back on disable anyway, so a preview that isn't being 505 // edited carries its own CSS byte for byte. 506 var HOVER_GUARD = "html:not(.__bool-editing)"; 507 508 function guardRule(rule) { 509 var sel = rule.selectorText; 510 if (sel && sel.indexOf(":hover") !== -1 && sel.indexOf(HOVER_GUARD) === -1) { 511 var parts = sel.split(","); 512 var changed = false; 513 for (var p = 0; p < parts.length; p++) { 514 var part = parts[p].trim(); 515 // Only the halves of a selector list that actually hover: leaving 516 // ".card:hover, .card.open" whole would disable the second one too. 517 if (part.indexOf(":hover") !== -1) { 518 // Valid in a nested rule as well â the & keeps its place. 519 parts[p] = HOVER_GUARD + " " + part;
520 changed = true; 521 } else { 522 parts[p] = part; 523 } 524 } 525 if (changed) { 526 try { 527 var before = rule.selectorText; 528 rule.selectorText = parts.join(","); 529 // A selector the engine won't take is left exactly as it was, and 530 // is not worth remembering as something to restore. 531 if (rule.selectorText !== before) { 532 hoverGuards.push({ rule: rule, selector: before }); 533 } 534 } catch (e) {} 535 } 536 } 537 var kids = rule.cssRules; 538 if (!kids) return; 539 for (var k = 0; k < kids.length; k++) guardRule(kids[k]); 540 } 541 542 function guardHover() { 543 if (!guardedCounts) guardedCounts = new WeakMap(); 544 var sheets = document.styleSheets; 545 for (var i = 0; i < sheets.length; i++) { 546 var sheet = sheets[i]; 547 var rules = null; 548 // A cross-origin stylesheet throws here. Nothing to do about it, and 549 // nothing that needs doing â it's a font or a CDN reset, not the app. 550 try { rules = sheet.cssRules; } catch (e) { rules = null; } 551 if (!rules) continue; 552 // Vite rewrites a style tag in place on a CSS hot update, so "seen it" 553 // is the rule count, not the sheet. Re-guarding is idempotent anyway. 554 if (guardedCounts.get(sheet) === rules.length) continue; 555 guardedCounts.set(sheet, rules.length); 556 for (var r = 0; r < rules.length; r++) guardRule(rules[r]); 557 } 558 } 559 560 function unguardHover() { 561 for (var i = 0; i < hoverGuards.length; i++) { 562 try { 563 hoverGuards[i].rule.selectorText = hoverGuards[i].selector; 564 } catch (e) {} 565 } 566 hoverGuards = []; 567 guardedCounts = null; 568 } 569 570 // ââ live preview ââââââââââââââââââââââââââââââââââââââââââââââââââââââ 571 function clearPreview() { 572 cancelSettle(); 573 var targets = editTargets(); 574 for (var t = 0; t < targets.length; t++) { 575 for (var i = 0; i < previewProps.length; i++) { 576 targets[t].style.removeProperty(previewProps[i]); 577 } 578 } 579 restoreText(); 580 previewProps = []; 581 } 582 583 function cancelSettle() { 584 if (settleWatch) { settleWatch.disconnect(); settleWatch = null; } 585 if (settleTimer) { clearTimeout(settleTimer); settleTimer = 0; } 586 } 587 588 // Drop the preview bookkeeping while LEAVING the screen as it is: used when 589 // the app has re-rendered the element itself, so what is showing is the 590 // app's own output. Restoring here (clearPreview) would write the stale 591 // pre-edit text back over the text the save just produced. 592 function forgetPreview() { 593 var targets = editTargets(); 594 for (var t = 0; t < targets.length; t++) { 595 for (var i = 0; i < previewProps.length; i++) { 596 targets[t].style.removeProperty(previewProps[i]); 597 } 598 } 599 previewProps = []; 600 textBackup = null; 601 } 602 603 // The editor has written the source. What is on screen â the live preview â 604 // is already what the file now says, but the app itself is still a sandbox 605 // sync and a hot update behind. Dropping the preview on the write made every 606 // save flash the OLD value for the length of that round trip; keeping it 607 // forever would leave an inline override standing in for a change that may 608 // never have reached the screen (a component that ignores className, say), 609 // which is worse: it looks saved until you click away. 610 // 611 // So hold the preview until the app re-renders this element â a hot update 612 // mutates its class or its text, and a replacement is caught by the rAF loop 613 // below â and drop it on a deadline if that never comes, which puts whatever 614 // really happened on screen while the user is still looking at it. 615 function settle() { 616 cancelSettle(); 617 if (!selected || (previewProps.length === 0 && textBackup === null)) return; 618 var node = selected; 619 // Arrived: the app re-rendered this element, so what's on
619screen is its 620 // own output â let go without touching it. 621 var arrived = function () { 622 cancelSettle(); 623 if (selected === node) forgetPreview(); 624 }; 625 // Never arrived: put the element back the way the app actually renders 626 // it. If the save didn't reach the screen, this is where that shows. 627 var gaveUp = function () { 628 cancelSettle(); 629 if (selected !== node) return; 630 clearPreview(); 631 // Tell the editor the write didn't reach the screen. A hot update that 632 // never fired is the common cause, and the bytes ARE on the sandbox by 633 // now, so reloading the frame settles it either way: the change appears, 634 // or it demonstrably isn't something this element renders. 635 post({ type: "stale" }); 636 }; 637 settleWatch = new MutationObserver(arrived); 638 settleWatch.observe(node, { 639 attributes: true, 640 attributeFilter: ["class", "style"], 641 childList: true, 642 characterData: true, 643 subtree: true 644 }); 645 settleTimer = setTimeout(gaveUp, SETTLE_MS); 646 } 647 648 function applyPreview(style) { 649 if (!selected) return; 650 cancelSettle(); // a fresh preview supersedes the one we were holding 651 var targets = editTargets(); 652 653 if (!style) { 654 for (var t = 0; t < targets.length; t++) { 655 for (var i = 0; i < previewProps.length; i++) { 656 targets[t].style.removeProperty(previewProps[i]); 657 } 658 } 659 previewProps = []; 660 return; 661 } 662 for (var key in style) { 663 if (!Object.prototype.hasOwnProperty.call(style, key)) continue; 664 for (var n = 0; n < targets.length; n++) { 665 targets[n].style.setProperty(key, style[key], "important"); 666 } 667 if (previewProps.indexOf(key) === -1) previewProps.push(key); 668 } 669 } 670 671 // A font the app has never loaded renders as its fallback, which makes the 672 // font picker look broken while it is in fact working. Pulling the 673 // stylesheet in here is preview-only: the app gets a real @import when the 674 // edit is saved. Deduped by href, and only ever fonts.googleapis.com, so a 675 // forged message can't turn the preview into a fetch for anything else. 676 function loadFont(href) { 677 if (typeof href !== "string") return; 678 if (href.indexOf("https://fonts.googleapis.com/") !== 0) return; 679 var existing = document.querySelectorAll("link[data-bool-font]"); 680 for (var i = 0; i < existing.length; i++) { 681 if (existing[i].getAttribute("href") === href) return; 682 } 683 var link = document.createElement("link"); 684 link.rel = "stylesheet"; 685 link.setAttribute("data-bool-font", "1"); 686 link.href = href; 687 document.head.appendChild(link); 688 } 689 690 function previewText(text) { 691 if (!selected) return; 692 cancelSettle(); 693 if (text === null) { 694 restoreText(); 695 return; 696 } 697 // NOT editTargets(). A style op rewrites one className and so changes 698 // every element that JSX draws, but array-backed text rewrites one entry 699 // of the array â the row you clicked, and only it. Previewing on all of 700 // them would show four nav items changing where the save changes one. 701 var targets = isRowText(selected) ? [selected] : editTargets(); 702 // Write into the element's OWN text node rather than over textContent: 703 // a heading with a styled word inside it would otherwise lose the span 704 // (and everything in it) the moment you typed a character. 705 if (textBackup === null) { 706 textBackup = []; 707 for (var b = 0; b < targets.length; b++) { 708 var backupNode = ownTextNode(targets[b]); 709 if (backupNode) { 710 textBackup.push({ node: backupNode, text: backupNode.nodeValue }); 711 } 712 } 713 } 714 for (var i = 0; i < textBackup.length; i++) { 715 textBackup[i].node.nodeValue = text; 716 } 717 } 718 719 function restoreText() { 720 if (textBackup === null) return; 721 for (var i = 0; i < textBackup.length; i++) { 722 if (document.contains(textBackup[i].node)) { 723 textBackup[i].node.nodeValue = textBackup[i].text; 724 } 725 } 726 textBackup = null; 727 } 728 729 // ââ selection âââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 730 function select(node) { 731 clearPreview(); 732 pendingLoc = null; 733 selected = node; 734 var info = node ? locOf(node) : null; 735 selectedLoc = info ? info.loc : null; 736 // One piece of JSX can draw many rows. They share a source location, so 737 // an edit to it changes all of them â they're outlined together, and the 738 // live preview runs on all of them, because that is what saving does. 739 peers = []; 740 selectedIndex = 0; 741 if (node && selectedLoc) { 742 var all = findAllByLoc(selectedLoc); 743 for (var i = 0; i < all.length; i++) { 744 if (all[i] === node) selectedIndex = i; 745 else peers.push(all[i]); 746 } 747 } 748 ensurePeerBoxes(peers.length); 749 markPeers(); 750 lastRect = ""; 751 // Placed now rather than on the next frame, so a click paints its outline 752 // immediately â which means this needs the origin now too. 753 readOrigin(); 754 placeBox(selectBox, node); 755 // The hover outline is defined against the selection â what it just 756 // became. Re-read it so the set we've now selected stops being drawn 757 // twice, and so the set we've just let go of starts being drawn again. 758 setHover(hovered); 759 post({ type: "selected", element: node ? describe(node) : null }); 760 } 761 762 // Outline the peers ON the elements. Drawn as part of the element's own 763 // paint, so it cannot end up behind it, and it follows border-radius and 764 // any transform for free â none of which an overlay rectangle does. 765 // !important because the app's own stylesheet often sets outline: none. 766 function markPeers() { 767 unmarkPeers(); 768 for (var i = 0; i < peers.length; i++) { 769 var node = peers[i]; 770 outlined.push({ 771 node: node, 772 outline: node.style.outline, 773 offset: node.style.outlineOffset 774 }); 775 node.style.setProperty("outline", "3px solid rgb(59,130,246)", "important"); 776 // INSIDE the element, not around it. A card that clips its overflow â 777 // the standard rounded image card â cuts off anything drawn outside its 778 // child, so a full-bleed photo showed no highlight at all while the DOM 779 // insisted the outline was there. Drawn inward it cannot be clipped, 780 // and it still reads correctly on a small element.
781 node.style.setProperty("outline-offset", "-3px", "important"); 782 } 783 } 784 785 // Has anything we outlined been repainted out from under us? 786 function peersLostOutline() { 787 for (var i = 0; i < outlined.length; i++) { 788 var node = outlined[i].node; 789 if (document.contains(node) && !node.style.outline) return true; 790 } 791 return false; 792 } 793 794 function unmarkPeers() { 795 for (var i = 0; i < outlined.length; i++) { 796 var entry = outlined[i]; 797 if (!document.contains(entry.node)) continue; 798 // Put back exactly what was there, including nothing. 799 if (entry.outline) entry.node.style.outline = entry.outline; 800 else entry.node.style.removeProperty("outline"); 801 if (entry.offset) entry.node.style.outlineOffset = entry.offset; 802 else entry.node.style.removeProperty("outline-offset"); 803 } 804 outlined = []; 805 } 806 807 /** The selection plus everything an edit to it would change. */ 808 function editTargets() { 809 var out = selected ? [selected] : []; 810 for (var i = 0; i < peers.length; i++) { 811 if (document.contains(peers[i])) out.push(peers[i]); 812 } 813 return out; 814 } 815 816 // Selecting by location has to tolerate an empty document. The editor sends 817 // this right after a reload â and the bridge answers "ready" while the page 818 // is still just a root div, so the element it names may be seconds away from 819 // existing. Hold the request and let the loop below keep looking; if it 820 // never turns up, report an empty selection so the toolbar clears rather 821 // than hovering over nothing. 822 function selectByLoc(loc) { 823 var node = findByLoc(loc); 824 if (node) return select(node); 825 pendingLoc = loc; 826 pendingUntil = Date.now() + 5000; 827 } 828 829 // ââ input interception ââââââââââââââââââââââââââââââââââââââââââââââââ 830 // Capture phase + stopPropagation, so the app's own handlers never see the 831 // event. Without this, clicking a nav link would navigate away from the 832 // element you were trying to edit. 833 function swallow(e) { 834 if (!enabled) return; 835 e.preventDefault(); 836 e.stopPropagation(); 837 } 838 839 /** Keep an event from the app without cancelling it â see the list below. */ 840 function block(e) { 841 if (!enabled) return; 842 e.stopPropagation(); 843 } 844 845 function onClick(e) { 846 if (!enabled) return; 847 e.preventDefault(); 848 e.stopPropagation(); 849 var node = resolve(e.target); 850 // A click on nothing traceable (the page background) deselects, which is 851 // the same "click outside to dismiss" reflex the rest of the editor has. 852 select(node); 853 } 854 855 function onMove(e) { 856 if (!enabled) return; 857 var node = resolve(e.target); 858 if (node !== hovered) setHover(node); 859 } 860 861 function onLeave() { 862 setHover(null); 863 } 864 865 // One rAF loop keeps both boxes glued to their elements through scrolling, 866 // layout shifts and CSS animations, and is also where we notice that HMR 867 // swapped the selected node out from under us. 868 function tick() { 869 frame = 0; 870 if (!enabled) return; 871 // Before anything is placed: every box below is positioned relative to 872 // this. 873 readOrigin(); 874 // A hot update brings new CSS, and it arrives armed. Cheap when nothing 875 // changed â it compares rule counts and stops. 876 if (++cssScan % 30 === 0) guardHover(); 877 if (pendingLoc) { 878 var awaited = findByLoc(pendingLoc); 879 if (awaited) select(awaited); 880 else if (Date.now() > pendingUntil) select(null); 881 } 882 if (selectedLoc && (!selected || !document.contains(selected))) { 883 var replacement = findByLoc(selectedLoc); 884 if (replacement) { 885 // Re-selecting drops any live preview: the source now holds the real 886 // value, so keeping an inline override would mask what was saved. 887 selected = null; 888 peers = []; 889 previewProps = []; 890 textBackup = null; 891 select(replacement); 892 } 893 } 894 // A row can appear or vanish under us (an item added to the list, a 895 // filter applied), so re-read the set rather than trusting the one taken 896 // at selection time. Not every frame though: this is an attribute scan of 897 // the whole document, and the boxes below are what has to keep up with 898 // scrolling, not the membership. 899 if (selected && selectedLoc) { 900 if (++peerScan % 15 === 0) { 901 var current = findAllByLoc(selectedLoc); 902 if (current.length - 1 !== peers.length) { 903 peers = []; 904 for (var p = 0; p < current.length; p++) { 905 if (current[p] !== selected) peers.push(current[p]); 906 } 907 ensurePeerBoxes(peers.length); 908 markPeers(); 909 post({ type: "selected", element: describe(selected) }); 910 } 911 // A hot update repaints an element from its props and drops the 912 // inline outline with it. Check every peer, not just the first: the 913 // one React re-rendered is rarely the one at the front of the list. 914 else if (peersLostOutline()) { 915 markPeers(); 916 } 917 } 918 // The boxes themselves DO track every frame â they follow scrolling. 919 for (var b = 0; b < peers.length; b++) { 920 placeBox(peerBoxes[b], peers[b]); 921 var chipEl = peerBoxes[b].firstChild; 922 if (chipEl) chipEl.textContent = peers[b].tagName.toLowerCase(); 923 } 924 } else if (peerBoxes.length) { 925 ensurePeerBoxes(0); 926 } 927 placeBox(selectBox, selected); 928 // The hovered set follows scrolling like the selected one does. Its 929 // MEMBERSHIP is re-read on the next pointer move rather than here: a 930 // document-wide attribute scan every frame is what peerScan exists to 931 // avoid, and a hover is over as soon as the pointer moves anyway. 932 if (hovered) drawHover(); 933 if (selected && document.contains(selected)) { 934 var r = rectOf(selected); 935 var key = r.top + ":" + r.left + ":" + r.width + ":" + r.height; 936 if (key !== lastRect) { 937 lastRect = key; 938 post({ type: "moved", rect: r }); 939 } 940 } 941 frame = window.requestAnimationFrame(tick); 942 } 943 944 function enable() { 945 if (enabled) return; 946 enabled = true; 947 ensureOverlay(); 948 ensureStyle(); 949 // Before the class goes on, so no frame is painted with the app's hover 950 // still armed under the pointer that just switched the mode on.
951 guardHover(); 952 document.documentElement.classList.add("__bool-editing"); 953 if (!frame) frame = window.requestAnimationFrame(tick); 954 } 955 956 function disable() { 957 enabled = false; 958 clearPreview(); 959 unguardHover(); 960 unmarkPeers(); 961 peers = []; 962 selected = null; 963 selectedLoc = null; 964 pendingLoc = null; 965 hovered = null; 966 hoverTarget = null; 967 hoverPeers = []; 968 lastRect = ""; 969 if (frame) { window.cancelAnimationFrame(frame); frame = 0; } 970 if (hoverBox) hoverBox.style.display = "none"; 971 if (selectBox) selectBox.style.display = "none"; 972 // Both pools, explicitly. The pooled boxes are only ever put away by the 973 // rAF loop, and the line above just cancelled it â so leaving Edit mode 974 // with a row of anything selected used to strand its tints and their tag 975 // chips over the app, with nothing left running to take them down. 976 // unmarkPeers() doesn't cover it: that's the outline ON the element, and 977 // these are the overlay half of the same highlight. 978 for (var h = 0; h < hoverBoxes.length; h++) { 979 hoverBoxes[h].style.display = "none"; 980 } 981 for (var pb = 0; pb < peerBoxes.length; pb++) { 982 peerBoxes[pb].style.display = "none"; 983 } 984 document.documentElement.classList.remove("__bool-editing"); 985 } 986 987 var swallowed = ["mousedown", "mouseup", "dblclick", "contextmenu", "submit", "pointerdown", "pointerup"]; 988 for (var i = 0; i < swallowed.length; i++) { 989 window.addEventListener(swallowed[i], swallow, true); 990 } 991 // The hover events, blocked for the same reason the :hover rules are 992 // guarded: an onMouseEnter that zooms a card moves it out from under the 993 // outline you were aiming at. stopPropagation only â preventDefault on a 994 // pointermove can suppress the compatibility mousemove the picker's own 995 // hover tracking runs on. Our handlers are on window too, and 996 // stopPropagation doesn't reach listeners on the same node, so the picker 997 // still sees every one of these. 998 var blocked = [ 999 "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave", 1000 "pointermove", "pointerover", "pointerout", "pointerenter", "pointerleave" 1001 ]; 1002 for (var b = 0; b < blocked.length; b++) { 1003 window.addEventListener(blocked[b], block, true); 1004 } 1005 window.addEventListener("click", onClick, true); 1006 window.addEventListener("mousemove", onMove, true); 1007 window.addEventListener("mouseleave", onLeave, true); 1008 1009 window.addEventListener("message", function (e) { 1010 var d = e && e.data; 1011 if (!d || d.source !== "bool-edit") return; 1012 if (d.action === "enable") return enable(); 1013 if (d.action === "disable") return disable(); 1014 if (!enabled) return; 1015 if (d.action === "clear") return select(null); 1016 if (d.action === "select") return selectByLoc(d.loc); 1017 if (d.action === "preview") return applyPreview(d.style || null); 1018 if (d.action === "loadFont") return loadFont(d.href); 1019 if (d.action === "previewText") { 1020 return previewText(typeof d.text === "string" ? d.text : null); 1021 } 1022 if (d.action === "settle") return settle(); 1023 if (d.action === "refresh") { 1024 lastRect = ""; 1025 if (selected) post({ type: "selected", element: describe(selected) }); 1026 } 1027 }); 1028 1029 post({ type: "ready" }); 1030 })(); 1031</script>`,n=(0,t.versionedBridge)("bool-element-bridge","click-to-edit support for the Bool editor; inert outside the editor preview. Leave in place.",r);n.version,n.tag;let o=n.script;n.inject,e.s(["ELEMENT_BRIDGE_SCRIPT",0,o,"ELEMENT_MESSAGE_SOURCE",0,"bool-edit"])},55224,e=>{"use strict";e.s(["MAX_FOLDER_NAME",0,50,"folderHref",0,function(e,t){return t?`${e}?folder=${encodeURIComponent(t)}`:e},"folderPlacement",0,function(e,t){return e&&t.has(e)?e:null},"isFolderDescendant",0,function(e,t,r){let n=r.get(e)??null,o=0;for(;n&&o++<1e3;){if(n===t)return!0;n=r.get(n)??null}return!1}])},971759,e=>{"use strict";e.s(["escapeHtmlAttr",0,function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},"versionedBridge",0,function(e,t,r,n=[]){let o=function(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)>>>0;return t.toString(36)}(n.length?`${r} 1032@retired:${n.join(",")}`:r),s=`${e}@${o}`,i=`<!-- ${s}: ${t} --> 1033${r}`,a=[e,...n].map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).sort((e,t)=>
1033t.length-e.length).join("|"),l=RegExp(`[^\\S\\n]*<!--\\s*(?:${a})[^]*?</script>\\n?`,"g");return{version:o,tag:s,script:i,inject(e){var t,r;let o;return e.includes(s)&&!n.some(t=>e.includes(t))?e:(t=e.replace(l,""),r=` ${i} 1034 `,(o=t.match(/<\/body\s*>/i))&&void 0!==o.index?t.slice(0,o.index)+r+t.slice(o.index):t+r)}}}])},448220,e=>{"use strict";var t=e.i(847107);function r(e){return e.replace(/\s+/g," ").trim().slice(0,80).trim()}e.s(["MAX_PROJECT_NAME_LEN",0,80,"nameIsPlaceholder",0,function(e){return e.name.trim()===(0,t.titleCaseSlug)(e.slug)},"normalizeProjectName",0,r,"projectNameProblem",0,function(e){return r(e)?null:"Give your bool a name."}])},651090,e=>{"use strict";var t=e.i(971759);let r="bool-runtime-error",n=`<script> 1035 (function () { 1036 if (window.parent === window) return; // only active inside the editor preview iframe 1037 // Say hello the instant this bridge runs, before any app code. The preview 1038 // panel's load watchdog treats any message from the frame as "the real app 1039 // loaded": Vercel's raw 410 SANDBOX_STOPPED / 502 SANDBOX_NOT_LISTENING 1040 // pages never run this script, so a load that stays silent is assumed dead 1041 // and healed. Source is deliberately NOT the error envelope below. 1042 try { window.parent.postMessage({ source: "bool-preview-ready" }, "*"); } catch (e) {} 1043 function report(message, stack) { 1044 try { 1045 window.parent.postMessage( 1046 { source: "${r}", message: String(message), stack: stack ? String(stack) : null }, 1047 "*" 1048 ); 1049 } catch (e) {} 1050 } 1051 window.addEventListener("error", function (e) { 1052 // Only real JS exceptions â e.error is absent for resource-load failures 1053 // (a missing image/script), which we don't want to surface as "issues". 1054 if (!e || !e.error) return; 1055 report(e.error.message || e.message || "Script error", e.error.stack || null); 1056 }); 1057 window.addEventListener("unhandledrejection", function (e) { 1058 var r = e && e.reason; 1059 if (r === undefined || r === null) return; 1060 // A rejection reason can be anything â an Error, a string, or a plain 1061 // object. Prefer .message; for non-Errors, JSON so we don't hand the 1062 // agent a useless "[object Object]". 1063 var msg = (r && r.message) || (typeof r === "object" ? null : r); 1064 if (!msg) { 1065 try { msg = JSON.stringify(r); } catch (e2) { msg = String(r); } 1066 } 1067 report(msg || "Unhandled promise rejection", (r && r.stack) || null); 1068 }); 1069 // Compile / HMR errors (a typo, a bad import â the most common way a manual 1070 // edit breaks the app) DON'T reach window.onerror: Vite catches them over 1071 // its HMR socket and renders a <vite-error-overlay> element. Watch for that 1072 // overlay and report its message so they surface the same prompt. 1073 function reportOverlay(node) { 1074 var text = ""; 1075 try { 1076 var root = node.shadowRoot || node; 1077 var el = 1078 (root.querySelector && root.querySelector(".message-body")) || 1079 (root.querySelector && root.querySelector(".message")); 1080 text = ((el && el.textContent) || node.textContent || "").trim(); 1081 } catch (e3) {} 1082 report(text || "Your app has a build error.", null); 1083 } 1084 function isOverlay(n) { 1085 return ( 1086 n && n.nodeName && n.nodeName.toLowerCase() === "vite-error-overlay" 1087 ); 1088 } 1089 // An overlay already on the page (error happened before this ran). 1090 try { 1091 var existing = 1092 document.querySelector && document.querySelector("vite-error-overlay"); 1093 if (existing) reportOverlay(existing); 1094 } catch (e4) {} 1095 try { 1096 new MutationObserver(function (muts) { 1097 for (var i = 0; i < muts.length; i++) { 1098 var added = muts[i].addedNodes || []; 1099 for (var j = 0; j < added.length; j++) { 1100 if (isOverlay(added[j])) reportOverlay(added[j]); 1101 } 1102 } 1103 }).observe(document.documentElement, { childList: true, subtree: true }); 1104 } catch (e5) {} 1105 })(); 1106</script>`,o=(0,t.versionedBridge)("bool-runtime-error-bridge","surfaces runtime errors to the Bool editor; inert outside the editor preview. Leave in place.",n);o.tag,o.script,o.inject,e.s(["RUNTIME_ERROR_MESSAGE_SOURCE",0,r])},907359,e=>{"use strict";let t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1106e.s(["isValidShareEmail",0,function(e){let r=e.trim().toLowerCase();return r.length<=320&&t.test(r)}])},323125,e=>{"use strict";let t=(0,e.i(456420).default)("archive-restore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);e.s(["ArchiveRestore",0,t],323125)},434322,810818,e=>{"use strict";let t=(0,e.i(456420).default)("file-code-corner",[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]]);e.s(["FileCode2",0,t],434322);var r=e.i(343420);e.s(["Info",()=>r.default],810818)},652671,e=>{"use strict";let t=(0,e.i(456420).default)("folder-input",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);e.s(["FolderInput",0,t],652671)},487738,e=>{"use strict";let t=(0,e.i(456420).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["FolderPlus",0,t],487738)},726067,e=>{"use strict";let t=(0,e.i(456420).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,t],726067)},120283,e=>{"use strict";let t=(0,e.i(456420).default)("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);e.s(["GitFork",0,t],120283)},281673,e=>{"use strict";let t=(0,e.i(456420).default)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);e.s(["QrCode",0,t],281673)},738750,(e,t,r)=>{t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},87201,(e,t,r)=>{let n,o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];r.getSymbolSize=function(e){if(!e)throw Error('"version" cannot be null or undefined');if(e<1||e>40)throw Error('"version" should be in range from 1 to 40');return 4*e+17},r.getSymbolTotalCodewords=function(e){return o[e]},r.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},r.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');n=e},r.isKanjiModeEnabled=function(){return void 0!==n},r.toSJIS=function(e){return n(e)}},473133,(e,t,r)=>{r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2},r.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},r.from=function(e,t){if(r.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw Error("Unknown EC Level: "+e)}}catch(e){return t}}},173666,(e,t,r)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n},811421,(e,t,r)=>{function n(e){if(!e||e<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,r,n){let o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n},720637,(e,t,r)=>{let n=e.r(87201).getSymbolSize;r.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,r=n(e),o=145===r?26:2*Math.ceil((r-13)/(2*t-2)),s=[r-7];for(let e=1;e<t-1;e++)s[e]=s[e-1]-o;return s.push(6),s.reverse()},r.getPositions=function(e){let t=[],n=r.getRowColCoords(e),o=n.length;for(let e=0;e<o;e++)for(let r=0;r<o;r++)(0!==e||0!==r)&&(0!==e||r!==o-1)&&(e!==o-1||0!==r)&&t.push([n[e],n[r]]);return t}},814002,(e,t,r)=>{let n=e.r(87201).getSymbolSize;r.getPositions=function(e){let t=n(e);return[[0,0],[t-7,0],[0,t-7]]}},237692,(e,t,r)=>{r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};r.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},r.from=function(e){return r.isValid(e)?parseInt(e,10):void 0},r.getPenaltyN1=function(e){let t=e.size,r=0,n=0,o=0,s=null,i=null;for(let a=0;a<t;a++){n=o=0,s=i=null;for(let l=0;l<t;l++){let t=e.get(a,l);t===s?n++:(n>=5&&(r+=3+(n-5)),s=t,n=1),(t=e.get(l,a))===i?o++:(o>=5&&(r+=3+(o-5)),i=t,o=1)}n>=5&&(r+=3+(n-5)),o>=5&&(r+=3+(o-5))}return r},r.getPenaltyN2=function(e){let t=e.size,r=0;for(let n=0;n<t-1;n++)for(let o=0;o<t-1;o++){let t=e.get(n,o)+e.get(n,o+1)+e.get(n+1,o)+e.get(n+1,o+1);(4===t||0===t)&&r++}return 3*r},r.getPenaltyN3=function(e){let t=e.size,r=0,n=0,o=0;for(let s=0;s<t;s++){n=o=0;for(let i=0;i<t;i++)n=n<<1&2047|e.get(s,i),i>=10&&(1488===n||93===n)&&r++,o=o<<1&2047|e.get(i,s),i>=10&&(1488===o||93===o)&&r++}return 40*r},r.getPenaltyN4=function(e){let t=0,r=e.data.length;for(let n=0;n<r;n++)t+=e.data[n];return 10*Math.abs(Math.ceil(100*t/r/5)-10)}
1106,r.applyMask=function(e,t){let n=t.size;for(let o=0;o<n;o++)for(let s=0;s<n;s++)t.isReserved(s,o)||t.xor(s,o,function(e,t,n){switch(e){case r.Patterns.PATTERN000:return(t+n)%2==0;case r.Patterns.PATTERN001:return t%2==0;case r.Patterns.PATTERN010:return n%3==0;case r.Patterns.PATTERN011:return(t+n)%3==0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case r.Patterns.PATTERN101:return t*n%2+t*n%3==0;case r.Patterns.PATTERN110:return(t*n%2+t*n%3)%2==0;case r.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,s,o))},r.getBestMask=function(e,t){let n=Object.keys(r.Patterns).length,o=0,s=1/0;for(let i=0;i<n;i++){t(i),r.applyMask(i,e);let n=r.getPenaltyN1(e)+r.getPenaltyN2(e)+r.getPenaltyN3(e)+r.getPenaltyN4(e);r.applyMask(i,e),n<s&&(s=n,o=i)}return o}},848125,(e,t,r)=>{let n=e.r(473133),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];r.getBlocksCount=function(e,t){switch(t){case n.L:return o[(e-1)*4+0];case n.M:return o[(e-1)*4+1];case n.Q:return o[(e-1)*4+2];case n.H:return o[(e-1)*4+3];default:return}},r.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return s[(e-1)*4+0];case n.M:return s[(e-1)*4+1];case n.Q:return s[(e-1)*4+2];case n.H:return s[(e-1)*4+3];default:return}}},654232,(e,t,r)=>{let n=new Uint8Array(512),o=new Uint8Array(256),s=1;for(let e=0;e<255;e++)n[e]=s,o[s]=e,256&(s<<=1)&&(s^=285);for(let e=255;e<512;e++)n[e]=n[e-255];r.log=function(e){if(e<1)throw Error("log("+e+")");return o[e]},r.exp=function(e){return n[e]},r.mul=function(e,t){return 0===e||0===t?0:n[o[e]+o[t]]}},950677,(e,t,r)=>{let n=e.r(654232);r.mul=function(e,t){let r=new Uint8Array(e.length+t.length-1);for(let o=0;o<e.length;o++)for(let s=0;s<t.length;s++)r[o+s]^=n.mul(e[o],t[s]);return r},r.mod=function(e,t){let r=new Uint8Array(e);for(;r.length-t.length>=0;){let e=r[0];for(let o=0;o<t.length;o++)r[o]^=n.mul(t[o],e);let o=0;for(;o<r.length&&0===r[o];)o++;r=r.slice(o)}return r},r.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let o=0;o<e;o++)t=r.mul(t,new Uint8Array([1,n.exp(o)]));return t}},962458,(e,t,r)=>{let n=e.r(950677);function o(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}o.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),o=this.degree-r.length;if(o>0){let e=new Uint8Array(this.degree);return e.set(r,o),e}return r},t.exports=o},67483,(e,t,r)=>{r.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},396592,(e,t,r)=>{let n="[0-9]+",o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",s="(?:(?![A-Z0-9 $%*+\\-./:]|"+(o=o.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";r.KANJI=RegExp(o,"g"),r.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),r.BYTE=RegExp(s,"g"),r.NUMERIC=RegExp(n,"g"),r.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let i=RegExp("^"+o+"$"),a=RegExp("^"+n+"$"),l=RegExp("^[A-Z0-9 $%*+\\-./:]+$");r.testKanji=function(e){return i.test(e)},r.testNumeric=function(e){return a.test(e)},r.testAlphanumeric=function(e){return l.test(e)}},150882,(e,t,r)=>{let n=e.r(67483),o=e.r(396592);r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!n.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]}
1106,r.getBestModeForData=function(e){return o.testNumeric(e)?r.NUMERIC:o.testAlphanumeric(e)?r.ALPHANUMERIC:o.testKanji(e)?r.KANJI:r.BYTE},r.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},r.isValid=function(e){return e&&e.bit&&e.ccBits},r.from=function(e,t){if(r.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return t}}},93547,(e,t,r)=>{let n=e.r(87201),o=e.r(848125),s=e.r(473133),i=e.r(150882),a=e.r(67483),l=n.getBCHDigit(7973);function d(e,t){return i.getCharCountIndicator(e,t)+4}r.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},r.getCapacity=function(e,t,r){if(!a.isValid(e))throw Error("Invalid QR Code version");void 0===r&&(r=i.BYTE);let s=(n.getSymbolTotalCodewords(e)-o.getTotalCodewordsCount(e,t))*8;if(r===i.MIXED)return s;let l=s-d(r,e);switch(r){case i.NUMERIC:return Math.floor(l/10*3);case i.ALPHANUMERIC:return Math.floor(l/11*2);case i.KANJI:return Math.floor(l/13);case i.BYTE:default:return Math.floor(l/8)}},r.getBestVersionForData=function(e,t){let n,o=s.from(t,s.M);if(Array.isArray(e)){if(e.length>1){for(let t=1;t<=40;t++)if(function(e,t){let r=0;return e.forEach(function(e){let n=d(e.mode,t);r+=n+e.getBitsLength()}),r}(e,t)<=r.getCapacity(t,o,i.MIXED))return t;return}if(0===e.length)return 1;n=e[0]}else n=e;return function(e,t,n){for(let o=1;o<=40;o++)if(t<=r.getCapacity(o,n,e))return o}(n.mode,n.getLength(),o)},r.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;n.getBCHDigit(t)-l>=0;)t^=7973<<n.getBCHDigit(t)-l;return e<<12|t}},857655,(e,t,r)=>{let n=e.r(87201),o=n.getBCHDigit(1335);r.getEncodedBits=function(e,t){let r=e.bit<<3|t,s=r<<10;for(;n.getBCHDigit(s)-o>=0;)s^=1335<<n.getBCHDigit(s)-o;return(r<<10|s)^21522}},494097,(e,t,r)=>{let n=e.r(150882);function o(e){this.mode=n.NUMERIC,this.data=e.toString()}o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,r;for(t=0;t+3<=this.data.length;t+=3)r=parseInt(this.data.substr(t,3),10),e.put(r,10);let n=this.data.length-t;n>0&&(r=parseInt(this.data.substr(t),10),e.put(r,3*n+1))},t.exports=o},112553,(e,t,r)=>{let n=e.r(150882),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(e){this.mode=n.ALPHANUMERIC,this.data=e}s.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*o.indexOf(this.data[t]);r+=o.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(o.indexOf(this.data[t]),6)},t.exports=s},882257,(e,t,r)=>{let n=e.r(150882);function o(e){this.mode=n.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)},t.exports=o},422644,(e,t,r)=>{let n=e.r(150882),o=e.r(87201);function s(e){this.mode=n.KANJI,this.data=e}s.getBitsLength=function(e){return 13*e},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=o.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r=(r>>>8&255)*192+(255&r),e.put(r,13)}},t.exports=s},245953,(e,t,r)=>{"use strict";var n={single_source_shortest_paths:function(e,t,r){var o,s,i,a,l,d,c,u={},h={};h[t]=0;var p=n.PriorityQueue.make();for(p.push(t,0);!p.empty();)for(i in s=(o=p.pop()).value,a=o.cost,l=e[s]||{})l.hasOwnProperty(i)&&(d=a+l[i],c=h[i],(void 0===h[i]||c>d)&&(h[i]=d,p.push(i,d),u[i]=s));if(void 0!==r&&void 0===h[r])throw Error(["Could not find a path from ",t," to ",r,"."].join(""));return u},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var o=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(e){var t,r=n.PriorityQueue,o={};for(t in e=e||{},r)r.hasOwnProperty(t)&&(o[t]=r[t]);return o.queue=[],o.sorter=e.sorter||r.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=n},297930,(e,t,r)=>{let n=e.r(150882),o=e.r(494097),s=e.r(112553),i=e.r(882257),a=e.r(422644),l=e.r(396592),d=e.r(87201),c=e.r(245953);function u(e){return unescape(encodeURIComponent(e)).length}function h(e,t,r){let n,o=[];for(;null!==(n=e.exec(r));)o.push({data:n[0],index:n.index,mode:t,length:n[0].length});return o}function p(e){let t,r,o=h(l.NUMERIC,n.NUMERIC,e),s=h(l.ALPHANUMERIC,n.ALPHANUMERIC,e);return d.isKanjiModeEnabled()?(t=h(l.BYTE,n.BYTE,e),r=h(l.KANJI,n.KANJI,e)):(t=h(l.BYTE_KANJI,n.BYTE,e),r=[]),o.concat(s,t,r).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,t){switch(t){case n.NUMERIC:return o.getBitsLength(e);case n.ALPHANUMERIC:return s.getBitsLength(e);case n.KANJI:return a.getBitsLength(e);case n.BYTE:return i.getBitsLength(e)}}function m(e,t){let r,l=n.getBestModeForData(e);if((r=n.from(t,l))!==n.BYTE&&r.bit<l.bit)throw Error('"'+e+'" cannot be encoded with mode '+n.toString(r)+".\n Suggested mode is: "+n.toString(l));switch(r===n.KANJI&&!d.isKanjiModeEnabled()&&(r=n.BYTE),r){case n.NUMERIC:return new o(e);case n.ALPHANUMERIC:return new s(e);case n.KANJI:return new a(e);case n.BYTE:return new i(e)}}r.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(m(t,null)):t.data&&e.push(m(t.data,t.mode)),e},[])},r.fromString=function(e,t){let o=function(e,t){let r={},o={start:{}},s=["start"];for(let i=0;i<e.length;i++){let a=e[i],l=[];for(let e=0;e<a.length;e++){let d=a[e],c=""+i+e;l.push(c),r[c]={node:d,lastCount:0},o[c]={};for(let e=0;e<s.length;e++){let i=s[e];r[i]&&r[i].node.mode===d.mode?(o[i][c]=f(r[i].lastCount+d.length,d.mode)-f(r[i].lastCount,d.mode),r[i].lastCount+=d.length):(r[i]&&(r[i].lastCount=d.length),o[i][c]=f(d.length,d.mode)+4+n.getCharCountIndicator(d.mode,t))}}s=l}for(let e=0;e<s.length;e++)o[s[e]].end=0;return{map:o,table:r}}(function(e){let t=[];for(let r=0;r<e.length;r++){let o=e[r];switch(o.mode){case n.NUMERIC:t.push([o,{data:o.data,mode:n.ALPHANUMERIC,length:o.length},{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.ALPHANUMERIC:t.push([o,{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.KANJI:t.push([o,{data:o.data,mode:n.BYTE,length:u(o.data)}]);break;case n.BYTE:t.push([{data:o.data,mode:n.BYTE,length:u(o.data)}])}}return t}(p(e,d.isKanjiModeEnabled())),t),s=c.find_path(o.map,"start","end"),i=[];for(let e=1;e<s.length-1;e++)i.push(o.table[s[e]].node);return r.fromArray(i.reduce(function(e,t){let r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?e[e.length-1].data+=t.data:e.push(t),e},[]))},r.rawSplit=function(e){return r.fromArray(p(e,d.isKanjiModeEnabled()))}},30671,(e,t,r)=>{let n=e.r(87201),o=e.r(473133),s=e.r(173666),i=e.r(811421),a=e.r(720637),l=e.r(814002),d=e.r(237692),c=e.r(848125),u=e.r(962458),h=e.r(93547),p=e.r(857655),f=e.r(150882),m=e.r(297930);function g(e,t,r){let n,o,s=e.size,i=p.getEncodedBits(t,r);for(n=0;n<15;n++)o=(i>>
vendor: 5,768 bytes, line 1106
1106n&1)==1,n<6?e.set(n,8,o,!0):n<8?e.set(n+1,8,o,!0):e.set(s-15+n,8,o,!0),n<8?e.set(8,s-n-1,o,!0):n<9?e.set(8,15-n-1+1,o,!0):e.set(8,15-n-1,o,!0);e.set(s-8,8,1,!0)}r.create=function(e,t){let r,p;if(void 0===e||""===e)throw Error("No input text");let v=o.M;return void 0!==t&&(v=o.from(t.errorCorrectionLevel,o.M),r=h.from(t.version),p=d.from(t.maskPattern),t.toSJISFunc&&n.setToSJISFunction(t.toSJISFunc)),function(e,t,r,o){let p;if(Array.isArray(e))p=m.fromArray(e);else if("string"==typeof e){let n=t;if(!n){let t=m.rawSplit(e);n=h.getBestVersionForData(t,r)}p=m.fromString(e,n||40)}else throw Error("Invalid data");let v=h.getBestVersionForData(p,r);if(!v)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<v)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+v+".\n")}else t=v;let w=function(e,t,r){let o=new s;r.forEach(function(t){o.put(t.mode.bit,4),o.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(o)});let i=(n.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,t))*8;for(o.getLengthInBits()+4<=i&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);let a=(i-o.getLengthInBits())/8;for(let e=0;e<a;e++)o.put(e%2?17:236,8);return function(e,t,r){let o,s,i=n.getSymbolTotalCodewords(t),a=i-c.getTotalCodewordsCount(t,r),l=c.getBlocksCount(t,r),d=i%l,h=l-d,p=Math.floor(i/l),f=Math.floor(a/l),m=f+1,g=p-f,v=new u(g),w=0,x=Array(l),y=Array(l),b=0,j=new Uint8Array(e.buffer);for(let e=0;e<l;e++){let t=e<h?f:m;x[e]=j.slice(w,w+t),y[e]=v.encode(x[e]),w+=t,b=Math.max(b,t)}let k=new Uint8Array(i),C=0;for(o=0;o<b;o++)for(s=0;s<l;s++)o<x[s].length&&(k[C++]=x[s][o]);for(o=0;o<g;o++)for(s=0;s<l;s++)k[C++]=y[s][o];return k}(o,e,t)}(t,r,p),x=new i(n.getSymbolSize(t));!function(e,t){let r=e.size,n=l.getPositions(t);for(let t=0;t<n.length;t++){let o=n[t][0],s=n[t][1];for(let t=-1;t<=7;t++)if(!(o+t<=-1)&&!(r<=o+t))for(let n=-1;n<=7;n++)s+n<=-1||r<=s+n||(t>=0&&t<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===t||6===t)||t>=2&&t<=4&&n>=2&&n<=4?e.set(o+t,s+n,!0,!0):e.set(o+t,s+n,!1,!0))}}(x,t);let y=x.size;for(let e=8;e<y-8;e++){let t=e%2==0;x.set(e,6,t,!0),x.set(6,e,t,!0)}return!function(e,t){let r=a.getPositions(t);for(let t=0;t<r.length;t++){let n=r[t][0],o=r[t][1];for(let t=-2;t<=2;t++)for(let r=-2;r<=2;r++)-2===t||2===t||-2===r||2===r||0===t&&0===r?e.set(n+t,o+r,!0,!0):e.set(n+t,o+r,!1,!0)}}(x,t),g(x,r,0),t>=7&&function(e,t){let r,n,o,s=e.size,i=h.getEncodedBits(t);for(let t=0;t<18;t++)r=Math.floor(t/3),n=t%3+s-8-3,o=(i>>t&1)==1,e.set(r,n,o,!0),e.set(n,r,o,!0)}(x,t),!function(e,t){let r=e.size,n=-1,o=r-1,s=7,i=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(o,a-r)){let n=!1;i<t.length&&(n=(t[i]>>>s&1)==1),e.set(o,a-r,n),-1==--s&&(i++,s=7)}if((o+=n)<0||r<=o){o-=n,n=-n;break}}}(x,w),isNaN(o)&&(o=d.getBestMask(x,g.bind(null,x,r))),d.applyMask(o,x),g(x,r,o),{modules:x,version:t,errorCorrectionLevel:r,maskPattern:o,segments:p}}(e,r,v,p)}},125950,(e,t,r)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}r.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:r,scale:r?4:o,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},r.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},r.getImageWidth=function(e,t){let n=r.getScale(e,t);return Math.floor((e+2*t.margin)*n)},r.qrToImageData=function(e,t,n){let o=t.modules.size,s=t.modules.data,i=r.getScale(o,n),a=Math.floor((o+2*n.margin)*i),l=n.margin*i,d=[n.color.light,n.color.dark];for(let t=0;t<a;t++)for(let r=0;r<a;r++){let c=(t*a+r)*4,u=n.color.light;t>=l&&r>=l&&t<a-l&&r<a-l&&(u=d[+!!s[Math.floor((t-l)/i)*o+Math.floor((r-l)/i)]]),e[c++]=u.r,e[c++]=u.g,e[c++]=u.b,e[c]=u.a}}},563037,(e,t,r)=>{let n=e.r(125950);r.render=function(e,t,r){var o;let s=r,i=t;void 0!==s||t&&t.getContext||(s=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),s=n.getOptions(s);let a=n.getImageWidth(e.modules.size,s),l=i.getContext("2d"),d=l.createImageData(a,a);return n.qrToImageData(d.data,e,s),o=i,l.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=a,o.width=a,o.style.height=a+"px",o.style.width=a+"px",l.putImageData(d,0,0),i},r.renderToDataURL=function(e,t,n){let o=n;void 0!==o||t&&t.getContext||(o=t,t=void 0),o||(o={});let s=r.render(e,t,o),i=o.type||"image/png",a=o.rendererOpts||{};return s.toDataURL(i,a.quality)}},310891,(e,t,r)=>{let n=e.r(125950);function o(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function s(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}r.render=function(e,t,r){let i=n.getOptions(t),a=e.modules.size,l=e.modules.data,d=a+2*i.margin,c=i.color.light.a?"<path "+o(i.color.light,"fill")+' d="M0 0h'+d+"v"+d+'H0z"/>':"",u="<path "+o(i.color.dark,"stroke")+' d="'+function(e,t,r){let n="",o=0,i=!1,a=0;for(let l=0;l<e.length;l++){let d=Math.floor(l%t),c=Math.floor(l/t);d||i||(i=!0),e[l]?(a++,l>0&&d>0&&e[l-1]||(n+=i?s("M",d+r,.5+c+r):s("m",o,0),o=0,i=!1),d+1<t&&e[l+1]||(n+=s("h",a),a=0)):o++}
1106return n}(l,a,i.margin)+'"/>',h='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+('viewBox="0 0 '+d+" ")+d+'" shape-rendering="crispEdges">'+c+u+"</svg>\n";return"function"==typeof r&&r(null,h),h}},973134,(e,t,r)=>{let n=e.r(738750),o=e.r(30671),s=e.r(563037),i=e.r(310891);function a(e,t,r,s,i){let a=[].slice.call(arguments,1),l=a.length,d="function"==typeof a[l-1];if(!d&&!n())throw Error("Callback required as last argument");if(d){if(l<2)throw Error("Too few arguments provided");2===l?(i=r,r=t,t=s=void 0):3===l&&(t.getContext&&void 0===i?(i=s,s=void 0):(i=s,s=r,r=t,t=void 0))}else{if(l<1)throw Error("Too few arguments provided");return 1===l?(r=t,t=s=void 0):2!==l||t.getContext||(s=r,r=t,t=void 0),new Promise(function(n,i){try{let i=o.create(r,s);n(e(i,t,s))}catch(e){i(e)}})}try{let n=o.create(r,s);i(null,e(n,t,s))}catch(e){i(e)}}r.create=o.create,r.toCanvas=a.bind(null,s.render),r.toDataURL=a.bind(null,s.renderToDataURL),r.toString=a.bind(null,function(e,t,r){return i.render(e,r)})}]); 1107 1108//# debugId=27d78e68-5cc9-4ebb-1e4c-ce87622f12b9
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.