tscircuit 0.0.1688 → 0.0.1689
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.min.js +2 -2
- package/package.json +3 -3
package/dist/browser.min.js
CHANGED
|
@@ -5695,7 +5695,7 @@ test("${l} should solve problem correctly", () => {
|
|
|
5695
5695
|
// Add more specific assertions based on expected output
|
|
5696
5696
|
// expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
|
|
5697
5697
|
})
|
|
5698
|
-
`,_=new Blob([u],{type:"text/plain"}),d=URL.createObjectURL(_),m=document.createElement("a");m.href=d,m.download=`${l}.test.ts`,m.click(),URL.revokeObjectURL(d)}catch(c){alert(`Error generating test.ts for ${t.constructor.name}: ${c instanceof Error?c.message:String(c)}`)}o(!1)};return G.jsxs("div",{className:`relative ${e}`,ref:r,children:[G.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&G.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:i,children:"Download JSON"}),G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Idt=t=>t.activeSubSolver?[t,...Idt(t.activeSubSolver)]:[t],vJn=({solver:t})=>{const e=Idt(t);return G.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>G.jsxs("div",{className:"flex items-center",children:[o>0&&G.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),G.jsx(PJn,{solver:n})]},n.constructor.name))})},SJn=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:r})=>{const[i,s]=Y.useReducer(p=>!p,!1),a=Y.useRef(void 0),c=()=>{!t.solved&&!t.failed&&(t.step(),e())},l=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),r&&r(t))},u=()=>{i?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),r&&t.solved&&r(t);return}t.step(),e()},n))},_=()=>{const p=t;if(p.getCurrentPhase&&!t.solved&&!t.failed){const x=p.getCurrentPhase();for(;p.getCurrentPhase()===x&&!t.solved&&!t.failed;)t.step();e()}},d=()=>{if(t.solved||t.failed||i)return;const p=window.prompt("Step until which iteration?",`${t.iterations}`);if(p===null)return;const x=Number(p);if(!Number.isFinite(x)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<x&&!t.solved&&!t.failed;)t.step();e(),t.solved&&r&&r(t)};Y.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),Y.useEffect(()=>{(t.solved||t.failed)&&i&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,i]);const m=t.getCurrentPhase!==void 0,h=m?t.getCurrentPhase():null;return G.jsxs("div",{className:"space-y-2 p-2 border-b",children:[G.jsx("div",{className:"flex items-center",children:G.jsx(vJn,{solver:t})}),G.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[G.jsx("button",{onClick:c,disabled:t.solved||t.failed||i,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),G.jsx("button",{onClick:l,disabled:t.solved||t.failed||i,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),G.jsx("button",{onClick:u,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${i?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:i?"Stop":"Animate"}),G.jsx("button",{onClick:d,disabled:t.solved||t.failed||i,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),m&&G.jsx("button",{onClick:_,disabled:t.solved||t.failed||i,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),G.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&G.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),h&&G.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",G.jsx("span",{className:"font-medium",children:h})]}),t.solved&&G.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&G.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&G.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},CJn=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},MJn=(t,e)=>{const o=t.pipelineDef[e].solverName,r=CJn(t,e),i=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let c=0;if(r==="Completed"){const d=t.pipelineDef[e+1],m=d?t.firstIterationOfPhase?.[d.solverName]:void 0;m!==void 0&&s!==null?c=m-s:s!==null&&(c=a-s)}else r==="In Progress"&&s!==null&&(c=a-s);const l=t.timeSpentOnPhase?.[o]??0;let u=0;r==="Completed"?u=1:r==="In Progress"&&i&&(u=i.progress??0);const _=i?.stats??null;return{index:e,name:o,status:r,firstIteration:s,iterations:c,progress:u,timeSpent:l,stats:_&&Object.keys(_).length>0?_:null,solverInstance:i??null}},TJn=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return G.jsx("span",{className:`font-medium ${e[t]}`,children:t})},wJn=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return G.jsxs("div",{className:"flex items-center gap-2",children:[G.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:G.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),G.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},EJn=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),DJn=({stats:t})=>{if(!t||Object.keys(t).length===0)return G.jsx("span",{children:"-"});const e=Object.entries(t),n=EJn(t);return G.jsxs("details",{className:"cursor-pointer",children:[G.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),G.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,r])=>G.jsxs("div",{children:[o,": ",String(r)]},o))})]})},Aye=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Aye);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=Aye(o));return e},AJn=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=Aye(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=`${e}_input.json`,i.click(),URL.revokeObjectURL(r)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},RJn=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,c)=>MJn(t,c)),r=a=>{e?.(a)},i=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):AJn(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return G.jsxs("div",{className:"border-t border-gray-200",children:[G.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:G.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),G.jsx("div",{className:"overflow-x-auto",children:G.jsxs("table",{className:"w-full text-sm",children:[G.jsx("thead",{children:G.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),G.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",G.jsx("sub",{children:"0"})]}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),G.jsx("tbody",{children:o.map(a=>G.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[G.jsx("td",{className:"px-4 py-2",children:G.jsxs("div",{className:"flex items-center gap-2",children:[G.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),G.jsx("button",{onClick:()=>r(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:G.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:G.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),G.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),G.jsx("td",{className:"px-4 py-2",children:G.jsx(TJn,{status:a.status})}),G.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),G.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),G.jsx("td",{className:"px-4 py-2",children:G.jsx(wJn,{progress:a.progress})}),G.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),G.jsx("td",{className:"px-4 py-2 text-gray-500",children:G.jsx(DJn,{stats:a.stats})}),G.jsx("td",{className:"px-4 py-2",children:a.solverInstance?G.jsxs("button",{onClick:()=>i(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[G.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:G.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),G.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},kJn=class extends cr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function NJn({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],r=t.circles??[],i=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;const u=(x,f)=>{typeof x=="number"&&(x<s&&(s=x),x>c&&(c=x)),typeof f=="number"&&(f<a&&(a=f),f>l&&(l=f))};for(const x of e)u(x.x,x.y);for(const x of n){const f=x.points??[];for(const g of f)u(g.x,g.y)}for(const x of o){const f=x.x??0,g=x.y??0,y=x.width??0,b=x.height??0;u(f,g),u(f+y,g+b)}for(const x of r){const f=x.x??0,g=x.y??0,y=x.radius??1;u(f-y,g-y),u(f+y,g+y)}for(const x of i)u(x.x,x.y);(!isFinite(s)||!isFinite(a)||!isFinite(c)||!isFinite(l))&&(s=-20,a=-20,c=20,l=20);const _=10,d=s-_,m=a-_,h=Math.max(1,c-s+2*_),p=Math.max(1,l-a+2*_);return G.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${d} ${m} ${h} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((x,f)=>G.jsx("rect",{x:x.x??0,y:x.y??0,width:x.width??0,height:x.height??0,fill:"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1},`rect-${f}`)),n.map((x,f)=>G.jsx("polyline",{fill:"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1,points:(x.points??[]).map(g=>`${g.x??0},${g.y??0}`).join(" ")},`line-${f}`)),r.map((x,f)=>G.jsx("circle",{cx:x.x??0,cy:x.y??0,r:x.radius??1.5,fill:x.fillColor??"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1},`circle-${f}`)),e.map((x,f)=>G.jsx("circle",{cx:x.x??0,cy:x.y??0,r:x.radius??1.5,fill:x.color??"black"},`point-${f}`)),i.map((x,f)=>G.jsx("text",{x:x.x??0,y:x.y??0,fontSize:x.fontSize??10,fill:x.color??"black",children:x.text??""},`text-${f}`))]})}var HJn=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[r,i]=Y.useReducer(u=>u+1,0),s=Y.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(u){return console.error("Visualization error:",u),{points:[],lines:[],rects:[],circles:[]}}},[t,r]),a=Y.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);Y.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const u=document.createElement("script");u.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(u)}},[]);const c=t.pipelineDef!==void 0,l=u=>{const _=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&_.currentPipelineStepIndex<=_.pipelineDef.findIndex(d=>d.solverName===u);)t.step();i()}};return G.jsxs("div",{children:[G.jsx(SJn,{solver:t,triggerRender:i,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?G.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):G.jsx(kJn,{fallback:G.jsx(NJn,{graphics:s}),children:G.jsx(bJn,{graphics:s})}),c&&G.jsx(RJn,{solver:t,onStepUntilPhase:l})]})};const IJn=()=>{Y.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},LJn=t=>t.toLowerCase().includes("pack")?VDn:t.toLowerCase().includes("rout")?jDn:TDn,OJn=({solverEvents:t=[]})=>{const[e,n]=Y.useState(null);IJn();const o=Y.useMemo(()=>{const a=new Map;for(const c of t){const l=`${c.componentName}-${c.solverName}`;a.set(l,c)}return a},[t]),r=Y.useMemo(()=>Array.from(o.keys()),[o]),i=e?o.get(e):null,s=Y.useMemo(()=>{if(!i)return{instance:null,error:null,classFound:!1};const a=zie[i.solverName];if(!a)return{instance:null,error:`Solver class "${i.solverName}" not found in SOLVERS registry. Available: ${Object.keys(zie).join(", ")}`,classFound:!1};try{const c=i.solverParams,l=c?.input!==void 0?c.input:c;return{instance:new a(l),error:null,classFound:!0}}catch(c){const l=c instanceof Error?c.message:String(c);return console.error("Failed to reconstruct solver:",c),{instance:null,error:`Failed to instantiate solver: ${l}`,classFound:!0}}},[i]);return t.length===0?G.jsx("div",{className:"rf-p-4",children:G.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:G.jsxs("div",{className:"rf-p-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),G.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):G.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[G.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[G.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[r.length," ",r.length===1?"Solver":"Solvers"]}),r.map(a=>{const c=o.get(a),l=e===a;return G.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${l?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const u=LJn(c.solverName);return G.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[G.jsx(u,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),G.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[G.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:c.componentName}),G.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:c.solverName})]})]})})()},a)})]}),G.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:i?s.instance?G.jsx(M5,{fallback:G.jsx("div",{className:"rf-p-4",children:G.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),G.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",i.solverName]})]})}),children:G.jsx(HJn,{solver:s.instance})}):G.jsxs("div",{className:"rf-p-4",children:[G.jsxs("div",{className:"rf-mb-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:i.solverName}),G.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",i.componentName]})]}),s.error&&G.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:G.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),G.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[G.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:G.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),G.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:G.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(i.solverParams,null,2)})})]})]}):G.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:G.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Ldt=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{Y.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{EW.captureException(o)}catch{}}},[t,e]),Y.useEffect(()=>{if(n&&n.length>0)for(const o of n){const r=new Error(o.message||"Circuit JSON Error");o.stack&&(r.stack=o.stack);try{EW.captureException(r,{error_type:o.type})}catch{}}},[n])},Odt="0.0.1885",FJn={version:Odt},bY=OIe()(FIe(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),BJn=t=>{const[e,n]=Y.useState([]),[o,r]=Y.useState(null),[i,s]=Y.useState(""),[a,c]=RT("eval-version-selection",null),l=bY(m=>m.setLastRunEvalVersion),u=bY(m=>m.lastRunEvalVersion);return Y.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(m=>m.json()).then(m=>{if(Array.isArray(m?.versions)){let h=[...m.versions];m.tags?.latest&&(r(m.tags.latest),h=h.filter(p=>p!==m.tags.latest)),n(h)}}).catch(()=>{})},[t]),Y.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,l(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,l(o)))},[t,a,o]),{versions:Y.useMemo(()=>e.filter(m=>m.includes(i)).slice(0,50),[e,i]),latestVersion:o,lastRunEvalVersion:u,search:i,setSearch:s,selectVersion:m=>{c(m),s("")}}},zJn=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[r,i]=Y.useState(""),[s,a]=Y.useState("");if(!o)return null;const c=t.filter(_=>_.toLowerCase().includes(s.toLowerCase())),l=s&&!t.includes(s),u=_=>{_.key==="Enter"&&(c.length===1?i(c[0]):l&&i(s))};return G.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:G.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[G.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),G.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:_=>a(_.target.value),onKeyDown:u}),G.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[c.map(_=>G.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${r===_?"bg-blue-50":""}`,onClick:()=>i(_),children:_},_)),l&&G.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${r===s?"bg-blue-50":""}`,onClick:()=>i(s),children:['Create new "',s,'"']})]}),G.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[G.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),G.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>r&&e(r),disabled:!r,children:r===s?`Create "${r}"`:`Save to ${r}`})]})]})})},VJn=t=>{const e=Y.useRef(null),n=eu(o=>o.recentEvents);Y.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};function $Jn(t){const e=WJn(t),n=Y.forwardRef((o,r)=>{const{children:i,...s}=o,a=Y.Children.toArray(i),c=a.find(XJn);if(c){const l=c.props.children,u=a.map(_=>_===c?Y.Children.count(l)>1?Y.Children.only(null):Y.isValidElement(l)?l.props.children:null:_);return G.jsx(e,{...s,ref:r,children:Y.isValidElement(l)?Y.cloneElement(l,void 0,u):null})}return G.jsx(e,{...s,ref:r,children:i})});return n.displayName=`${t}.Slot`,n}function WJn(t){const e=Y.forwardRef((n,o)=>{const{children:r,...i}=n;if(Y.isValidElement(r)){const s=GJn(r),a=jJn(i,r.props);return r.type!==Y.Fragment&&(a.ref=o?Rx(o,s):s),Y.cloneElement(r,a)}return Y.Children.count(r)>1?Y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var UJn=Symbol("radix.slottable");function XJn(t){return Y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===UJn}function jJn(t,e){const n={...e};for(const o in e){const r=t[o],i=e[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}function GJn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var PY="Dialog",[Fdt,Bdt]=d4(PY),[YJn,B4]=Fdt(PY),zdt=t=>{const{__scopeDialog:e,children:n,open:o,defaultOpen:r,onOpenChange:i,modal:s=!0}=t,a=Y.useRef(null),c=Y.useRef(null),[l,u]=DP({prop:o,defaultProp:r??!1,onChange:i,caller:PY});return G.jsx(YJn,{scope:e,triggerRef:a,contentRef:c,contentId:Jp(),titleId:Jp(),descriptionId:Jp(),open:l,onOpenChange:u,onOpenToggle:Y.useCallback(()=>u(_=>!_),[u]),modal:s,children:n})};zdt.displayName=PY;var Vdt="DialogTrigger",$dt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(Vdt,n),i=tu(e,r.triggerRef);return G.jsx(Cc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Nye(r.open),...o,ref:i,onClick:Vr(t.onClick,r.onOpenToggle)})});$dt.displayName=Vdt;var Rye="DialogPortal",[qJn,Wdt]=Fdt(Rye,{forceMount:void 0}),Udt=t=>{const{__scopeDialog:e,forceMount:n,children:o,container:r}=t,i=B4(Rye,e);return G.jsx(qJn,{scope:e,forceMount:n,children:Y.Children.map(o,s=>G.jsx(Fg,{present:n||i.open,children:G.jsx(Lj,{asChild:!0,container:r,children:s})}))})};Udt.displayName=Rye;var vY="DialogOverlay",Xdt=Y.forwardRef((t,e)=>{const n=Wdt(vY,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,i=B4(vY,t.__scopeDialog);return i.modal?G.jsx(Fg,{present:o||i.open,children:G.jsx(KJn,{...r,ref:e})}):null});Xdt.displayName=vY;var JJn=$Jn("DialogOverlay.RemoveScroll"),KJn=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(vY,n);return G.jsx(Uj,{as:JJn,allowPinchZoom:!0,shards:[r.contentRef],children:G.jsx(Cc.div,{"data-state":Nye(r.open),...o,ref:e,style:{pointerEvents:"auto",...o.style}})})}),Z8="DialogContent",jdt=Y.forwardRef((t,e)=>{const n=Wdt(Z8,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,i=B4(Z8,t.__scopeDialog);return G.jsx(Fg,{present:o||i.open,children:i.modal?G.jsx(QJn,{...r,ref:e}):G.jsx(ZJn,{...r,ref:e})})});jdt.displayName=Z8;var QJn=Y.forwardRef((t,e)=>{const n=B4(Z8,t.__scopeDialog),o=Y.useRef(null),r=tu(e,n.contentRef,o);return Y.useEffect(()=>{const i=o.current;if(i)return Y2e(i)},[]),G.jsx(Gdt,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vr(t.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Vr(t.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:Vr(t.onFocusOutside,i=>i.preventDefault())})}),ZJn=Y.forwardRef((t,e)=>{const n=B4(Z8,t.__scopeDialog),o=Y.useRef(!1),r=Y.useRef(!1);return G.jsx(Gdt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Gdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=t,a=B4(Z8,n),c=Y.useRef(null),l=tu(e,c);return D2e(),G.jsxs(G.Fragment,{children:[G.jsx(Sj,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:G.jsx(ZN,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Nye(a.open),...s,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),G.jsxs(G.Fragment,{children:[G.jsx(tKn,{titleId:a.titleId}),G.jsx(oKn,{contentRef:c,descriptionId:a.descriptionId})]})]})}),kye="DialogTitle",Ydt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(kye,n);return G.jsx(Cc.h2,{id:r.titleId,...o,ref:e})});Ydt.displayName=kye;var qdt="DialogDescription",Jdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(qdt,n);return G.jsx(Cc.p,{id:r.descriptionId,...o,ref:e})});Jdt.displayName=qdt;var Kdt="DialogClose",Qdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(Kdt,n);return G.jsx(Cc.button,{type:"button",...o,ref:e,onClick:Vr(t.onClick,()=>r.onOpenChange(!1))})});Qdt.displayName=Kdt;function Nye(t){return t?"open":"closed"}var Zdt="DialogTitleWarning",[eKn,eht]=AZt(Zdt,{contentName:Z8,titleName:kye,docsSlug:"dialog"}),tKn=({titleId:t})=>{const e=eht(Zdt),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
5698
|
+
`,_=new Blob([u],{type:"text/plain"}),d=URL.createObjectURL(_),m=document.createElement("a");m.href=d,m.download=`${l}.test.ts`,m.click(),URL.revokeObjectURL(d)}catch(c){alert(`Error generating test.ts for ${t.constructor.name}: ${c instanceof Error?c.message:String(c)}`)}o(!1)};return G.jsxs("div",{className:`relative ${e}`,ref:r,children:[G.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&G.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:i,children:"Download JSON"}),G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),G.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Idt=t=>t.activeSubSolver?[t,...Idt(t.activeSubSolver)]:[t],vJn=({solver:t})=>{const e=Idt(t);return G.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>G.jsxs("div",{className:"flex items-center",children:[o>0&&G.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),G.jsx(PJn,{solver:n})]},n.constructor.name))})},SJn=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:r})=>{const[i,s]=Y.useReducer(p=>!p,!1),a=Y.useRef(void 0),c=()=>{!t.solved&&!t.failed&&(t.step(),e())},l=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),r&&r(t))},u=()=>{i?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),r&&t.solved&&r(t);return}t.step(),e()},n))},_=()=>{const p=t;if(p.getCurrentPhase&&!t.solved&&!t.failed){const x=p.getCurrentPhase();for(;p.getCurrentPhase()===x&&!t.solved&&!t.failed;)t.step();e()}},d=()=>{if(t.solved||t.failed||i)return;const p=window.prompt("Step until which iteration?",`${t.iterations}`);if(p===null)return;const x=Number(p);if(!Number.isFinite(x)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<x&&!t.solved&&!t.failed;)t.step();e(),t.solved&&r&&r(t)};Y.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),Y.useEffect(()=>{(t.solved||t.failed)&&i&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,i]);const m=t.getCurrentPhase!==void 0,h=m?t.getCurrentPhase():null;return G.jsxs("div",{className:"space-y-2 p-2 border-b",children:[G.jsx("div",{className:"flex items-center",children:G.jsx(vJn,{solver:t})}),G.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[G.jsx("button",{onClick:c,disabled:t.solved||t.failed||i,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),G.jsx("button",{onClick:l,disabled:t.solved||t.failed||i,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),G.jsx("button",{onClick:u,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${i?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:i?"Stop":"Animate"}),G.jsx("button",{onClick:d,disabled:t.solved||t.failed||i,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),m&&G.jsx("button",{onClick:_,disabled:t.solved||t.failed||i,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),G.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&G.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),h&&G.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",G.jsx("span",{className:"font-medium",children:h})]}),t.solved&&G.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&G.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&G.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},CJn=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},MJn=(t,e)=>{const o=t.pipelineDef[e].solverName,r=CJn(t,e),i=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let c=0;if(r==="Completed"){const d=t.pipelineDef[e+1],m=d?t.firstIterationOfPhase?.[d.solverName]:void 0;m!==void 0&&s!==null?c=m-s:s!==null&&(c=a-s)}else r==="In Progress"&&s!==null&&(c=a-s);const l=t.timeSpentOnPhase?.[o]??0;let u=0;r==="Completed"?u=1:r==="In Progress"&&i&&(u=i.progress??0);const _=i?.stats??null;return{index:e,name:o,status:r,firstIteration:s,iterations:c,progress:u,timeSpent:l,stats:_&&Object.keys(_).length>0?_:null,solverInstance:i??null}},TJn=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return G.jsx("span",{className:`font-medium ${e[t]}`,children:t})},wJn=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return G.jsxs("div",{className:"flex items-center gap-2",children:[G.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:G.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),G.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},EJn=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),DJn=({stats:t})=>{if(!t||Object.keys(t).length===0)return G.jsx("span",{children:"-"});const e=Object.entries(t),n=EJn(t);return G.jsxs("details",{className:"cursor-pointer",children:[G.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),G.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,r])=>G.jsxs("div",{children:[o,": ",String(r)]},o))})]})},Aye=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Aye);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=Aye(o));return e},AJn=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=Aye(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=`${e}_input.json`,i.click(),URL.revokeObjectURL(r)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},RJn=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,c)=>MJn(t,c)),r=a=>{e?.(a)},i=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):AJn(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return G.jsxs("div",{className:"border-t border-gray-200",children:[G.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:G.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),G.jsx("div",{className:"overflow-x-auto",children:G.jsxs("table",{className:"w-full text-sm",children:[G.jsx("thead",{children:G.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),G.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",G.jsx("sub",{children:"0"})]}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),G.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),G.jsx("tbody",{children:o.map(a=>G.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[G.jsx("td",{className:"px-4 py-2",children:G.jsxs("div",{className:"flex items-center gap-2",children:[G.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),G.jsx("button",{onClick:()=>r(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:G.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:G.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),G.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),G.jsx("td",{className:"px-4 py-2",children:G.jsx(TJn,{status:a.status})}),G.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),G.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),G.jsx("td",{className:"px-4 py-2",children:G.jsx(wJn,{progress:a.progress})}),G.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),G.jsx("td",{className:"px-4 py-2 text-gray-500",children:G.jsx(DJn,{stats:a.stats})}),G.jsx("td",{className:"px-4 py-2",children:a.solverInstance?G.jsxs("button",{onClick:()=>i(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[G.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:G.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),G.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},kJn=class extends cr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function NJn({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],r=t.circles??[],i=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;const u=(x,f)=>{typeof x=="number"&&(x<s&&(s=x),x>c&&(c=x)),typeof f=="number"&&(f<a&&(a=f),f>l&&(l=f))};for(const x of e)u(x.x,x.y);for(const x of n){const f=x.points??[];for(const g of f)u(g.x,g.y)}for(const x of o){const f=x.x??0,g=x.y??0,y=x.width??0,b=x.height??0;u(f,g),u(f+y,g+b)}for(const x of r){const f=x.x??0,g=x.y??0,y=x.radius??1;u(f-y,g-y),u(f+y,g+y)}for(const x of i)u(x.x,x.y);(!isFinite(s)||!isFinite(a)||!isFinite(c)||!isFinite(l))&&(s=-20,a=-20,c=20,l=20);const _=10,d=s-_,m=a-_,h=Math.max(1,c-s+2*_),p=Math.max(1,l-a+2*_);return G.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${d} ${m} ${h} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((x,f)=>G.jsx("rect",{x:x.x??0,y:x.y??0,width:x.width??0,height:x.height??0,fill:"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1},`rect-${f}`)),n.map((x,f)=>G.jsx("polyline",{fill:"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1,points:(x.points??[]).map(g=>`${g.x??0},${g.y??0}`).join(" ")},`line-${f}`)),r.map((x,f)=>G.jsx("circle",{cx:x.x??0,cy:x.y??0,r:x.radius??1.5,fill:x.fillColor??"none",stroke:x.strokeColor??"black",strokeWidth:x.strokeWidth??1},`circle-${f}`)),e.map((x,f)=>G.jsx("circle",{cx:x.x??0,cy:x.y??0,r:x.radius??1.5,fill:x.color??"black"},`point-${f}`)),i.map((x,f)=>G.jsx("text",{x:x.x??0,y:x.y??0,fontSize:x.fontSize??10,fill:x.color??"black",children:x.text??""},`text-${f}`))]})}var HJn=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[r,i]=Y.useReducer(u=>u+1,0),s=Y.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(u){return console.error("Visualization error:",u),{points:[],lines:[],rects:[],circles:[]}}},[t,r]),a=Y.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);Y.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const u=document.createElement("script");u.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(u)}},[]);const c=t.pipelineDef!==void 0,l=u=>{const _=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&_.currentPipelineStepIndex<=_.pipelineDef.findIndex(d=>d.solverName===u);)t.step();i()}};return G.jsxs("div",{children:[G.jsx(SJn,{solver:t,triggerRender:i,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?G.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):G.jsx(kJn,{fallback:G.jsx(NJn,{graphics:s}),children:G.jsx(bJn,{graphics:s})}),c&&G.jsx(RJn,{solver:t,onStepUntilPhase:l})]})};const IJn=()=>{Y.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},LJn=t=>t.toLowerCase().includes("pack")?VDn:t.toLowerCase().includes("rout")?jDn:TDn,OJn=({solverEvents:t=[]})=>{const[e,n]=Y.useState(null);IJn();const o=Y.useMemo(()=>{const a=new Map;for(const c of t){const l=`${c.componentName}-${c.solverName}`;a.set(l,c)}return a},[t]),r=Y.useMemo(()=>Array.from(o.keys()),[o]),i=e?o.get(e):null,s=Y.useMemo(()=>{if(!i)return{instance:null,error:null,classFound:!1};const a=zie[i.solverName];if(!a)return{instance:null,error:`Solver class "${i.solverName}" not found in SOLVERS registry. Available: ${Object.keys(zie).join(", ")}`,classFound:!1};try{const c=i.solverParams,l=c?.input!==void 0?c.input:c;return{instance:new a(l),error:null,classFound:!0}}catch(c){const l=c instanceof Error?c.message:String(c);return console.error("Failed to reconstruct solver:",c),{instance:null,error:`Failed to instantiate solver: ${l}`,classFound:!0}}},[i]);return t.length===0?G.jsx("div",{className:"rf-p-4",children:G.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:G.jsxs("div",{className:"rf-p-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),G.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):G.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[G.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[G.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[r.length," ",r.length===1?"Solver":"Solvers"]}),r.map(a=>{const c=o.get(a),l=e===a;return G.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${l?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const u=LJn(c.solverName);return G.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[G.jsx(u,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),G.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[G.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:c.componentName}),G.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:c.solverName})]})]})})()},a)})]}),G.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:i?s.instance?G.jsx(M5,{fallback:G.jsx("div",{className:"rf-p-4",children:G.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),G.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",i.solverName]})]})}),children:G.jsx(HJn,{solver:s.instance})}):G.jsxs("div",{className:"rf-p-4",children:[G.jsxs("div",{className:"rf-mb-4",children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:i.solverName}),G.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",i.componentName]})]}),s.error&&G.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:G.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),G.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[G.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:G.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),G.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:G.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(i.solverParams,null,2)})})]})]}):G.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:G.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Ldt=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{Y.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{EW.captureException(o)}catch{}}},[t,e]),Y.useEffect(()=>{if(n&&n.length>0)for(const o of n){const r=new Error(o.message||"Circuit JSON Error");o.stack&&(r.stack=o.stack);try{EW.captureException(r,{error_type:o.type})}catch{}}},[n])},Odt="0.0.1887",FJn={version:Odt},bY=OIe()(FIe(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),BJn=t=>{const[e,n]=Y.useState([]),[o,r]=Y.useState(null),[i,s]=Y.useState(""),[a,c]=RT("eval-version-selection",null),l=bY(m=>m.setLastRunEvalVersion),u=bY(m=>m.lastRunEvalVersion);return Y.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(m=>m.json()).then(m=>{if(Array.isArray(m?.versions)){let h=[...m.versions];m.tags?.latest&&(r(m.tags.latest),h=h.filter(p=>p!==m.tags.latest)),n(h)}}).catch(()=>{})},[t]),Y.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,l(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,l(o)))},[t,a,o]),{versions:Y.useMemo(()=>e.filter(m=>m.includes(i)).slice(0,50),[e,i]),latestVersion:o,lastRunEvalVersion:u,search:i,setSearch:s,selectVersion:m=>{c(m),s("")}}},zJn=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[r,i]=Y.useState(""),[s,a]=Y.useState("");if(!o)return null;const c=t.filter(_=>_.toLowerCase().includes(s.toLowerCase())),l=s&&!t.includes(s),u=_=>{_.key==="Enter"&&(c.length===1?i(c[0]):l&&i(s))};return G.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:G.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[G.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),G.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:_=>a(_.target.value),onKeyDown:u}),G.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[c.map(_=>G.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${r===_?"bg-blue-50":""}`,onClick:()=>i(_),children:_},_)),l&&G.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${r===s?"bg-blue-50":""}`,onClick:()=>i(s),children:['Create new "',s,'"']})]}),G.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[G.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),G.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>r&&e(r),disabled:!r,children:r===s?`Create "${r}"`:`Save to ${r}`})]})]})})},VJn=t=>{const e=Y.useRef(null),n=eu(o=>o.recentEvents);Y.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};function $Jn(t){const e=WJn(t),n=Y.forwardRef((o,r)=>{const{children:i,...s}=o,a=Y.Children.toArray(i),c=a.find(XJn);if(c){const l=c.props.children,u=a.map(_=>_===c?Y.Children.count(l)>1?Y.Children.only(null):Y.isValidElement(l)?l.props.children:null:_);return G.jsx(e,{...s,ref:r,children:Y.isValidElement(l)?Y.cloneElement(l,void 0,u):null})}return G.jsx(e,{...s,ref:r,children:i})});return n.displayName=`${t}.Slot`,n}function WJn(t){const e=Y.forwardRef((n,o)=>{const{children:r,...i}=n;if(Y.isValidElement(r)){const s=GJn(r),a=jJn(i,r.props);return r.type!==Y.Fragment&&(a.ref=o?Rx(o,s):s),Y.cloneElement(r,a)}return Y.Children.count(r)>1?Y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var UJn=Symbol("radix.slottable");function XJn(t){return Y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===UJn}function jJn(t,e){const n={...e};for(const o in e){const r=t[o],i=e[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}function GJn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var PY="Dialog",[Fdt,Bdt]=d4(PY),[YJn,B4]=Fdt(PY),zdt=t=>{const{__scopeDialog:e,children:n,open:o,defaultOpen:r,onOpenChange:i,modal:s=!0}=t,a=Y.useRef(null),c=Y.useRef(null),[l,u]=DP({prop:o,defaultProp:r??!1,onChange:i,caller:PY});return G.jsx(YJn,{scope:e,triggerRef:a,contentRef:c,contentId:Jp(),titleId:Jp(),descriptionId:Jp(),open:l,onOpenChange:u,onOpenToggle:Y.useCallback(()=>u(_=>!_),[u]),modal:s,children:n})};zdt.displayName=PY;var Vdt="DialogTrigger",$dt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(Vdt,n),i=tu(e,r.triggerRef);return G.jsx(Cc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Nye(r.open),...o,ref:i,onClick:Vr(t.onClick,r.onOpenToggle)})});$dt.displayName=Vdt;var Rye="DialogPortal",[qJn,Wdt]=Fdt(Rye,{forceMount:void 0}),Udt=t=>{const{__scopeDialog:e,forceMount:n,children:o,container:r}=t,i=B4(Rye,e);return G.jsx(qJn,{scope:e,forceMount:n,children:Y.Children.map(o,s=>G.jsx(Fg,{present:n||i.open,children:G.jsx(Lj,{asChild:!0,container:r,children:s})}))})};Udt.displayName=Rye;var vY="DialogOverlay",Xdt=Y.forwardRef((t,e)=>{const n=Wdt(vY,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,i=B4(vY,t.__scopeDialog);return i.modal?G.jsx(Fg,{present:o||i.open,children:G.jsx(KJn,{...r,ref:e})}):null});Xdt.displayName=vY;var JJn=$Jn("DialogOverlay.RemoveScroll"),KJn=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(vY,n);return G.jsx(Uj,{as:JJn,allowPinchZoom:!0,shards:[r.contentRef],children:G.jsx(Cc.div,{"data-state":Nye(r.open),...o,ref:e,style:{pointerEvents:"auto",...o.style}})})}),Z8="DialogContent",jdt=Y.forwardRef((t,e)=>{const n=Wdt(Z8,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,i=B4(Z8,t.__scopeDialog);return G.jsx(Fg,{present:o||i.open,children:i.modal?G.jsx(QJn,{...r,ref:e}):G.jsx(ZJn,{...r,ref:e})})});jdt.displayName=Z8;var QJn=Y.forwardRef((t,e)=>{const n=B4(Z8,t.__scopeDialog),o=Y.useRef(null),r=tu(e,n.contentRef,o);return Y.useEffect(()=>{const i=o.current;if(i)return Y2e(i)},[]),G.jsx(Gdt,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vr(t.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Vr(t.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:Vr(t.onFocusOutside,i=>i.preventDefault())})}),ZJn=Y.forwardRef((t,e)=>{const n=B4(Z8,t.__scopeDialog),o=Y.useRef(!1),r=Y.useRef(!1);return G.jsx(Gdt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Gdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=t,a=B4(Z8,n),c=Y.useRef(null),l=tu(e,c);return D2e(),G.jsxs(G.Fragment,{children:[G.jsx(Sj,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:G.jsx(ZN,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Nye(a.open),...s,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),G.jsxs(G.Fragment,{children:[G.jsx(tKn,{titleId:a.titleId}),G.jsx(oKn,{contentRef:c,descriptionId:a.descriptionId})]})]})}),kye="DialogTitle",Ydt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(kye,n);return G.jsx(Cc.h2,{id:r.titleId,...o,ref:e})});Ydt.displayName=kye;var qdt="DialogDescription",Jdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(qdt,n);return G.jsx(Cc.p,{id:r.descriptionId,...o,ref:e})});Jdt.displayName=qdt;var Kdt="DialogClose",Qdt=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,r=B4(Kdt,n);return G.jsx(Cc.button,{type:"button",...o,ref:e,onClick:Vr(t.onClick,()=>r.onOpenChange(!1))})});Qdt.displayName=Kdt;function Nye(t){return t?"open":"closed"}var Zdt="DialogTitleWarning",[eKn,eht]=AZt(Zdt,{contentName:Z8,titleName:kye,docsSlug:"dialog"}),tKn=({titleId:t})=>{const e=eht(Zdt),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
5699
5699
|
|
|
5700
5700
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
5701
5701
|
|
|
@@ -5707,7 +5707,7 @@ Alternatively, you can use your own component as a description by assigning it a
|
|
|
5707
5707
|
|
|
5708
5708
|
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return Y.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},xKn=oht,gKn=rht,mht=iht,pht=sht,fht=_ht,xht=hht,ght=cht,yht=uht;const bht=xKn,yKn=gKn,Pht=Y.forwardRef(({className:t,...e},n)=>G.jsx(mht,{className:lr("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));Pht.displayName=mht.displayName;const Fye=Y.forwardRef(({className:t,...e},n)=>G.jsxs(yKn,{children:[G.jsx(Pht,{}),G.jsx(pht,{ref:n,className:lr("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...e})]}));Fye.displayName=pht.displayName;const Bye=({className:t,...e})=>G.jsx("div",{className:lr("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});Bye.displayName="AlertDialogHeader";const zye=({className:t,...e})=>G.jsx("div",{className:lr("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});zye.displayName="AlertDialogFooter";const Vye=Y.forwardRef(({className:t,...e},n)=>G.jsx(ght,{ref:n,className:lr("rf-text-lg rf-font-semibold",t),...e}));Vye.displayName=ght.displayName;const $ye=Y.forwardRef(({className:t,...e},n)=>G.jsx(yht,{ref:n,className:lr("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));$ye.displayName=yht.displayName;const bKn=Y.forwardRef(({className:t,...e},n)=>G.jsx(fht,{ref:n,className:lr(fE(),t),...e}));bKn.displayName=fht.displayName;const Wye=Y.forwardRef(({className:t,...e},n)=>G.jsx(xht,{ref:n,className:lr(fE({variant:"outline"}),"rf-mt-2 sm:rf-mt-0",t),...e}));Wye.displayName=xht.displayName;function PKn(t){const e=Y.useRef({value:t,previous:t});return Y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var MY="Checkbox",[vKn]=d4(MY),[SKn,Uye]=vKn(MY);function CKn(t){const{__scopeCheckbox:e,checked:n,children:o,defaultChecked:r,disabled:i,form:s,name:a,onCheckedChange:c,required:l,value:u="on",internal_do_not_use_render:_}=t,[d,m]=DP({prop:n,defaultProp:r??!1,onChange:c,caller:MY}),[h,p]=Y.useState(null),[x,f]=Y.useState(null),g=Y.useRef(!1),y=h?!!s||!!h.closest("form"):!0,b={checked:d,disabled:i,setChecked:m,control:h,setControl:p,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:g,required:l,defaultChecked:Vv(r)?!1:r,isFormControl:y,bubbleInput:x,setBubbleInput:f};return G.jsx(SKn,{scope:e,...b,children:MKn(_)?_(b):o})}var vht="CheckboxTrigger",Sht=Y.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...o},r)=>{const{control:i,value:s,disabled:a,checked:c,required:l,setControl:u,setChecked:_,hasConsumerStoppedPropagationRef:d,isFormControl:m,bubbleInput:h}=Uye(vht,t),p=tu(r,u),x=Y.useRef(c);return Y.useEffect(()=>{const f=i?.form;if(f){const g=()=>_(x.current);return f.addEventListener("reset",g),()=>f.removeEventListener("reset",g)}},[i,_]),G.jsx(Cc.button,{type:"button",role:"checkbox","aria-checked":Vv(c)?"mixed":c,"aria-required":l,"data-state":Eht(c),"data-disabled":a?"":void 0,disabled:a,value:s,...o,ref:p,onKeyDown:Vr(e,f=>{f.key==="Enter"&&f.preventDefault()}),onClick:Vr(n,f=>{_(g=>Vv(g)?!0:!g),h&&m&&(d.current=f.isPropagationStopped(),d.current||f.stopPropagation())})})});Sht.displayName=vht;var Xye=Y.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:o,checked:r,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:l,form:u,..._}=t;return G.jsx(CKn,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:a,required:s,onCheckedChange:l,name:o,form:u,value:c,internal_do_not_use_render:({isFormControl:d})=>G.jsxs(G.Fragment,{children:[G.jsx(Sht,{..._,ref:e,__scopeCheckbox:n}),d&&G.jsx(wht,{__scopeCheckbox:n})]})})});Xye.displayName=MY;var Cht="CheckboxIndicator",Mht=Y.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:o,...r}=t,i=Uye(Cht,n);return G.jsx(Fg,{present:o||Vv(i.checked)||i.checked===!0,children:G.jsx(Cc.span,{"data-state":Eht(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...t.style}})})});Mht.displayName=Cht;var Tht="CheckboxBubbleInput",wht=Y.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:s,required:a,disabled:c,name:l,value:u,form:_,bubbleInput:d,setBubbleInput:m}=Uye(Tht,t),h=tu(n,m),p=PKn(i),x=Vot(o);Y.useEffect(()=>{const g=d;if(!g)return;const y=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(y,"checked").set,S=!r.current;if(p!==i&&v){const M=new Event("click",{bubbles:S});g.indeterminate=Vv(i),v.call(g,Vv(i)?!1:i),g.dispatchEvent(M)}},[d,p,i,r]);const f=Y.useRef(Vv(i)?!1:i);return G.jsx(Cc.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??f.current,required:a,disabled:c,name:l,value:u,form:_,...e,tabIndex:-1,ref:h,style:{...e.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});wht.displayName=Tht;function MKn(t){return typeof t=="function"}function Vv(t){return t==="indeterminate"}function Eht(t){return Vv(t)?"indeterminate":t?"checked":"unchecked"}const lI=Y.forwardRef(({className:t,...e},n)=>G.jsx(Xye,{ref:n,className:lr("rf-peer rf-h-4 rf-w-4 rf-shrink-0 rf-rounded-sm rf-border rf-border-zinc-200 rf-border-zinc-900 rf-shadow focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 data-[state=checked]:rf-bg-zinc-900 data-[state=checked]:rf-text-zinc-50 dark:rf-border-zinc-800 dark:rf-border-zinc-50 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=checked]:rf-bg-zinc-50 dark:data-[state=checked]:rf-text-zinc-900",t),...e,children:G.jsx(Mht,{className:lr("rf-flex rf-items-center rf-justify-center rf-text-current"),children:G.jsx(T8,{className:"rf-h-4 rf-w-4"})})}));lI.displayName=Xye.displayName;const QE=Hye,TKn=Iye,Dht=Y.forwardRef(({className:t,...e},n)=>G.jsx(SY,{className:lr("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));Dht.displayName=SY.displayName;const eC=Y.forwardRef(({className:t,children:e,showOverlay:n=!0,...o},r)=>G.jsxs(TKn,{children:[G.jsx(Dht,{className:lr(n?"":"rf-hidden")}),G.jsx(CY,{ref:r,className:lr("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...o,children:e})]}));eC.displayName=CY.displayName;const tC=({className:t,...e})=>G.jsx("div",{className:lr("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});tC.displayName="DialogHeader";const uI=({className:t,...e})=>G.jsx("div",{className:lr("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});uI.displayName="DialogFooter";const nC=Y.forwardRef(({className:t,...e},n)=>G.jsx(Lye,{ref:n,className:lr("rf-text-lg rf-font-semibold",t),...e}));nC.displayName=Lye.displayName;const ZE=Y.forwardRef(({className:t,...e},n)=>G.jsx(Oye,{ref:n,className:lr("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));ZE.displayName=Oye.displayName;const TY={"tscircuit.com":{label:"tscircuit.com",placeholder:"Search tscircuit packages...",emptyMessage:"No packages found"},jlcpcb:{label:"JLCPCB Parts",placeholder:"Search JLCPCB parts (e.g. C14663)...",emptyMessage:"No parts found"},kicad:{label:"KiCad Footprints",placeholder:"Search KiCad footprints...",emptyMessage:"No footprints found"}},wKn="https://cdn.jsdelivr.net/npm/easyeda@latest/dist/browser/index.js";let jye=null;const EKn=async()=>(jye||(jye=import(wKn)),jye),DKn=async(t,e=10)=>{const n=encodeURIComponent(t),o=await fetch(`https://jlcsearch.tscircuit.com/api/search?limit=${e}&q=${n}`);if(!o.ok)throw new Error(`JLCPCB API error: ${o.status}`);return(await o.json()).components??[]},AKn=t=>({lcscId:t.lcsc,manufacturer:t.mfr,description:t.description,partNumber:`C${t.lcsc}`,package:t.package,price:t.price,stock:t.stock,isBasic:t.is_basic}),RKn=async(t,e)=>{const{fetchEasyEDAComponent:n,convertRawEasyToTsx:o}=await EKn(),r=await n(t,{fetch:(i,s)=>fetch(`${e?.apiBase??Ax}/proxy`,{...s,headers:{...s?.headers,"X-Target-Url":i.toString(),"X-Sender-Origin":s?.headers?.origin??"","X-Sender-Host":s?.headers?.host??"https://easyeda.com","X-Sender-Referer":s?.headers?.referer??"","X-Sender-User-Agent":s?.headers?.userAgent??"","X-Sender-Cookie":s?.headers?.cookie??"",authority:s?.headers?.authority??"","content-type":s?.headers?.["content-type"]??"",...e?.headers}})});return o({rawEasy:r})},kKn=({query:t,placeholder:e,isSearching:n,onQueryChange:o,onSubmit:r})=>{const i=Y.useCallback(s=>{s.key==="Enter"&&(s.preventDefault(),r())},[r]);return G.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mt-4",children:[G.jsxs("div",{className:"rf-relative rf-flex-grow",children:[G.jsx(T2e,{className:"rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground"}),G.jsx(age,{placeholder:e,className:"rf-pl-8",spellCheck:!1,autoComplete:"off",value:t,onChange:s=>o(s.target.value),onKeyDown:i})]}),G.jsx(dc,{onClick:r,disabled:n||t.trim().length<1,className:"sm:rf-px-4 rf-px-3",children:n?G.jsx($9,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):G.jsxs(G.Fragment,{children:[G.jsx(T2e,{className:"rf-h-4 rf-w-4 sm:rf-hidden"}),G.jsx("span",{className:"rf-hidden sm:rf-inline",children:"Search"})]})})]})},NKn=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}),HKn=t=>NKn.format(t),Aht=t=>{switch(t.source){case"tscircuit.com":{const e=t.package;return`tscircuit-${e.package_id??`${e.org_owner_tscircuit_handle??"unknown"}-${e.unscoped_name??e.name??"package"}`}`}case"jlcpcb":return`jlc-${t.component.lcscId}`;case"kicad":return`kicad-${t.footprint.path}`;default:return"unknown"}},IKn=t=>{switch(t.source){case"tscircuit.com":return t.package.unscoped_name;case"jlcpcb":return t.component.manufacturer;case"kicad":return t.footprint.qualifiedName}},LKn=t=>{switch(t.source){case"tscircuit.com":return t.package.description||(t.package.org_owner_tscircuit_handle?`Component by ${t.package.org_owner_tscircuit_handle}`:void 0);case"jlcpcb":return t.component.description;case"kicad":return t.footprint.description}},OKn=t=>{switch(t.source){case"tscircuit.com":return t.package.name;case"jlcpcb":return t.component.partNumber;case"kicad":return}},FKn=({results:t,selected:e,onSelect:n,onShowDetails:o})=>{const r=e?Aht(e):null;return G.jsx("div",{className:"rf-divide-y rf-w-full rf-overflow-hidden",children:t.map(i=>{const s=Aht(i),a=r===s,c=IKn(i),l=LKn(i),u=OKn(i),_=i.source==="jlcpcb"?i.component.stock:null,d=i.source==="jlcpcb"?i.component.price:null,m=i.source==="jlcpcb"?i.component.isBasic:null;return G.jsxs("div",{className:`rf-p-3 rf-flex rf-flex-col sm:rf-grid sm:rf-grid-cols-[minmax(0,1fr)_auto] rf-items-start sm:rf-items-center rf-cursor-pointer hover:rf-bg-zinc-100 rf-gap-2 rf-overflow-hidden ${a?"rf-bg-zinc-100":""}`,onClick:()=>n(i),children:[G.jsxs("div",{className:"rf-min-w-0 rf-overflow-hidden rf-w-full",children:[G.jsxs("div",{className:"rf-flex rf-items-start rf-gap-2 rf-min-w-0",children:[G.jsxs("div",{className:"rf-font-medium rf-text-sm rf-truncate rf-flex-1 rf-min-w-0 rf-flex rf-items-center rf-gap-1.5",children:[c,i.source==="jlcpcb"&&m!=null&&G.jsx("span",{className:`rf-text-xs rf-px-1.5 rf-py-0.5 rf-rounded rf-font-medium rf-flex-shrink-0 ${m?"rf-bg-green-100 rf-text-green-700":"rf-bg-orange-100 rf-text-orange-700"}`,children:m?"Basic":"Extended"}),i.source==="tscircuit.com"&&i.package.is_private&&G.jsx(WDn,{className:"rf-ml-1 rf-h-3 rf-w-3 rf-text-zinc-400 rf-flex-shrink-0"})]}),i.source==="jlcpcb"&&_!=null?G.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 sm:rf-hidden",children:[_.toLocaleString()," in stock"]}):null]}),G.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-truncate rf-w-full",children:[u?G.jsx("span",{className:"rf-mr-2",children:u}):null,l]})]}),G.jsxs("div",{children:[i.source==="tscircuit.com"&&o?G.jsx("div",{className:"rf-flex-shrink-0 rf-w-full sm:rf-w-auto",children:G.jsx(dc,{variant:"outline",size:"sm",className:"rf-text-xs rf-w-full sm:rf-w-auto",onClick:h=>{h.stopPropagation(),o(i)},children:"See Details"})}):i.source==="jlcpcb"&&_!=null?G.jsxs("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0",children:[_.toLocaleString()," in stock"]}):null,d!=null&&G.jsx("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 rf-text-right",children:HKn(d)})]})]},s)})})},Rht={importComponentDialog:101,importComponentDetailsDialog:102},BKn=({packageResult:t,isOpen:e,onOpenChange:n,isLoading:o,details:r,previewTab:i,onPreviewTabChange:s,isSubmitting:a,onImport:c})=>{const l=t?.package??null,u=l?.latest_pcb_preview_image_url,_=l?.latest_sch_preview_image_url,d=l?.latest_cad_preview_image_url,m=l?.unscoped_name?.split("/").pop()??l?.unscoped_name,h=l?.org_owner_tscircuit_handle??void 0,p=h?`https://tscircuit.com/${h}`:void 0,x=h&&m?`https://tscircuit.com/${h}/${m}`:void 0;return G.jsx(QE,{open:e,onOpenChange:n,children:G.jsxs(eC,{showOverlay:!1,style:{width:"calc(100vw - 2rem)",zIndex:Rht.importComponentDetailsDialog},className:"rf-max-w-5xl no-scrollbar !rf-overflow-y-auto rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-rounded-sm",children:[G.jsx(tC,{className:"rf-pb-4 rf-border-b",children:G.jsx("div",{className:"rf-flex rf-items-start rf-justify-between rf-gap-4",children:G.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[G.jsx(nC,{className:"rf-text-xl rf-font-semibold rf-truncate",children:m}),G.jsx(ZE,{children:l?.description})]})})}),G.jsxs("div",{className:"rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6",children:[h?G.jsxs("div",{children:[G.jsx("span",{className:"rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide",children:"Created by"}),G.jsx("div",{className:"rf-mt-1 rf-text-sm rf-font-medium",children:p?G.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"rf-text-black hover:rf-underline",children:h}):h})]}):null,(d||u||_)&&G.jsx(G.Fragment,{children:G.jsxs("div",{children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Preview"}),G.jsxs(gae,{value:i,onValueChange:f=>s(f),children:[G.jsxs(AW,{className:"rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",children:[u&&G.jsx(z6,{value:"pcb",children:"PCB"}),_&&G.jsx(z6,{value:"schematic",children:"Schematic"}),d&&G.jsx(z6,{value:"3d",children:"3D"})]}),G.jsxs("div",{className:"rf-mt-4",children:[G.jsx(a1,{value:"pcb",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:u?G.jsx("img",{src:u,alt:`${m??"package"} PCB preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),G.jsx(a1,{value:"schematic",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:_?G.jsx("img",{src:_,alt:`${m??"package"} schematic preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),G.jsx(a1,{value:"3d",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:d?G.jsx("img",{src:d,alt:`${m??"package"} 3D preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null})]})]})]})}),r?.ai_description?G.jsxs("section",{children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"AI Description"}),G.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:G.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed",children:r.ai_description})})]}):null,r?.ai_usage_instructions?G.jsxs("section",{children:[G.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"Usage Instructions"}),G.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:G.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap",children:r.ai_usage_instructions})})]}):null,o?G.jsxs("div",{className:"rf-flex rf-justify-center rf-items-center rf-gap-2 rf-text-gray-500",children:[G.jsx($9,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),G.jsx("span",{className:"rf-text-sm",children:"Loading package details..."})]}):null]}),G.jsxs(uI,{className:"rf-pt-4 rf-border-t rf-flex rf-flex-col sm:rf-flex-row rf-justify-between rf-gap-2",children:[G.jsx("div",{className:"rf-flex-1",children:x?G.jsxs(dc,{variant:"outline",size:"sm",className:"rf-gap-2 rf-w-full sm:rf-w-auto",onClick:()=>window.open(x,"_blank"),children:[G.jsx(LDn,{className:"rf-h-4 rf-w-4"}),"View on tscircuit.com"]}):null}),G.jsxs("div",{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[G.jsx(dc,{variant:"outline",onClick:()=>n(!1),className:"rf-order-2 sm:rf-order-1",children:"Close"}),G.jsx(dc,{onClick:c,disabled:a,className:"rf-bg-blue-600 hover:rf-bg-blue-700",children:a?G.jsx($9,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import Component"})]})]})]})})},zKn=()=>{const[t,e]=Y.useState(null),[n,o]=Y.useState(!1),r=Y.useCallback(async(s,a)=>{o(!0);try{const c=await fetch(`https://api.tscircuit.com/packages/get?name=${encodeURIComponent(`${s}/${a}`)}`);if(!c.ok)throw new Error(`Failed to load package details: ${c.status}`);const l=await c.json();e(l.package??null)}catch(c){console.error("Failed to fetch package details",c),e(null)}finally{o(!1)}},[]),i=Y.useCallback(()=>{e(null),o(!1)},[]);return{details:t,isLoading:n,fetchDetails:r,reset:i}},VKn=async(t,e)=>{const n={"Content-Type":"application/json"};e&&(n.Authorization=`Bearer ${e}`);const o=await fetch("https://registry-api.tscircuit.com/packages/search",{method:"POST",headers:n,body:JSON.stringify({query:t})});if(!o.ok)throw new Error(`tscircuit registry error: ${o.status}`);return(await o.json()).packages??[]},$Kn=({sessionToken:t})=>{const[e,n]=Y.useState([]),[o,r]=Y.useState(!1),[i,s]=Y.useState(null),[a,c]=Y.useState(!1),l=Y.useCallback(async _=>{const d=_.trim();if(!d)return[];r(!0),s(null);try{const h=(await VKn(d,t)).map(p=>({source:"tscircuit.com",package:p}));return n(h),h}catch(m){return console.error("Error searching tscircuit packages",m),n([]),s(m instanceof Error?m.message:"Failed to search tscircuit packages"),[]}finally{r(!1),c(!0)}},[t]),u=Y.useCallback(()=>{n([]),r(!1),s(null),c(!1)},[]);return{results:e,isSearching:o,error:i,hasSearched:a,search:l,reset:u}},WKn=t=>{const e=t.trim();return/^C\d+/i.test(e)?e.replace(/^C/i,""):e},UKn=()=>{const[t,e]=Y.useState([]),[n,o]=Y.useState(!1),[r,i]=Y.useState(null),[s,a]=Y.useState(!1),c=Y.useCallback(async u=>{const _=WKn(u);if(!_)return[];o(!0),i(null);try{const m=(await DKn(_,10)).map(h=>({source:"jlcpcb",component:AKn(h)}));return e(m),m}catch(d){return console.error("Error searching JLCPCB components",d),e([]),i(d instanceof Error?d.message:"Failed to search JLCPCB components"),[]}finally{o(!1),a(!0)}},[]),l=Y.useCallback(()=>{e([]),o(!1),i(null),a(!1)},[]);return{results:t,isSearching:n,error:r,hasSearched:s,search:c,reset:l}};function nb(t){return Array.isArray?Array.isArray(t):Hht(t)==="[object Array]"}function XKn(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function jKn(t){return t==null?"":XKn(t)}function M3(t){return typeof t=="string"}function kht(t){return typeof t=="number"}function GKn(t){return t===!0||t===!1||YKn(t)&&Hht(t)=="[object Boolean]"}function Nht(t){return typeof t=="object"}function YKn(t){return Nht(t)&&t!==null}function ay(t){return t!=null}function Gye(t){return!t.trim().length}function Hht(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const qKn="Incorrect 'index' type",JKn=t=>`Invalid value for key ${t}`,KKn=t=>`Pattern length exceeds max of ${t}.`,QKn=t=>`Missing ${t} property in key`,ZKn=t=>`Property 'weight' in key '${t}' must be a positive integer`,Iht=Object.prototype.hasOwnProperty;class eQn{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(o=>{let r=Lht(o);this._keys.push(r),this._keyMap[r.id]=r,n+=r.weight}),this._keys.forEach(o=>{o.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Lht(t){let e=null,n=null,o=null,r=1,i=null;if(M3(t)||nb(t))o=t,e=Oht(t),n=Yye(t);else{if(!Iht.call(t,"name"))throw new Error(QKn("name"));const s=t.name;if(o=s,Iht.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(ZKn(s));e=Oht(s),n=Yye(s),i=t.getFn}return{path:e,id:n,weight:r,src:o,getFn:i}}function Oht(t){return nb(t)?t:t.split(".")}function Yye(t){return nb(t)?t.join("."):t}function tQn(t,e){let n=[],o=!1;const r=(i,s,a)=>{if(ay(i))if(!s[a])n.push(i);else{let c=s[a];const l=i[c];if(!ay(l))return;if(a===s.length-1&&(M3(l)||kht(l)||GKn(l)))n.push(jKn(l));else if(nb(l)){o=!0;for(let u=0,_=l.length;u<_;u+=1)r(l[u],s,a+1)}else s.length&&r(l,s,a+1)}};return r(t,M3(e)?e.split("."):e,0),o?n:n[0]}var Oi={...{isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:tQn,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const nQn=/[^ ]+/g;function oQn(t=1,e=3){const n=new Map,o=Math.pow(10,e);return{get(r){const i=r.match(nQn).length;if(n.has(i))return n.get(i);const s=1/Math.pow(i,.5*t),a=parseFloat(Math.round(s*o)/o);return n.set(i,a),a},clear(){n.clear()}}}class qye{constructor({getFn:e=Oi.getFn,fieldNormWeight:n=Oi.fieldNormWeight}={}){this.norm=oQn(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,o)=>{this._keysMap[n.id]=o})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,M3(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();M3(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,o=this.size();n<o;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!ay(e)||Gye(e))return;let o={v:e,i:n,n:this.norm.get(e)};this.records.push(o)}_addObject(e,n){let o={i:n,$:{}};this.keys.forEach((r,i)=>{let s=r.getFn?r.getFn(e):this.getFn(e,r.path);if(ay(s)){if(nb(s)){let a=[];const c=[{nestedArrIndex:-1,value:s}];for(;c.length;){const{nestedArrIndex:l,value:u}=c.pop();if(ay(u))if(M3(u)&&!Gye(u)){let _={v:u,i:l,n:this.norm.get(u)};a.push(_)}else nb(u)&&u.forEach((_,d)=>{c.push({nestedArrIndex:d,value:_})})}o.$[i]=a}else if(M3(s)&&!Gye(s)){let a={v:s,n:this.norm.get(s)};o.$[i]=a}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Fht(t,e,{getFn:n=Oi.getFn,fieldNormWeight:o=Oi.fieldNormWeight}={}){const r=new qye({getFn:n,fieldNormWeight:o});return r.setKeys(t.map(Lht)),r.setSources(e),r.create(),r}function rQn(t,{getFn:e=Oi.getFn,fieldNormWeight:n=Oi.fieldNormWeight}={}){const{keys:o,records:r}=t,i=new qye({getFn:e,fieldNormWeight:n});return i.setKeys(o),i.setIndexRecords(r),i}function wY(t,{errors:e=0,currentLocation:n=0,expectedLocation:o=0,distance:r=Oi.distance,ignoreLocation:i=Oi.ignoreLocation}={}){const s=e/t.length;if(i)return s;const a=Math.abs(o-n);return r?s+a/r:a?1:s}function iQn(t=[],e=Oi.minMatchCharLength){let n=[],o=-1,r=-1,i=0;for(let s=t.length;i<s;i+=1){let a=t[i];a&&o===-1?o=i:!a&&o!==-1&&(r=i-1,r-o+1>=e&&n.push([o,r]),o=-1)}return t[i-1]&&i-o>=e&&n.push([o,i-1]),n}const oC=32;function sQn(t,e,n,{location:o=Oi.location,distance:r=Oi.distance,threshold:i=Oi.threshold,findAllMatches:s=Oi.findAllMatches,minMatchCharLength:a=Oi.minMatchCharLength,includeMatches:c=Oi.includeMatches,ignoreLocation:l=Oi.ignoreLocation}={}){if(e.length>oC)throw new Error(KKn(oC));const u=e.length,_=t.length,d=Math.max(0,Math.min(o,_));let m=i,h=d;const p=a>1||c,x=p?Array(_):[];let f;for(;(f=t.indexOf(e,h))>-1;){let M=wY(e,{currentLocation:f,expectedLocation:d,distance:r,ignoreLocation:l});if(m=Math.min(M,m),h=f+u,p){let w=0;for(;w<u;)x[f+w]=1,w+=1}}h=-1;let g=[],y=1,b=u+_;const v=1<<u-1;for(let M=0;M<u;M+=1){let w=0,D=b;for(;w<D;)wY(e,{errors:M,currentLocation:d+D,expectedLocation:d,distance:r,ignoreLocation:l})<=m?w=D:b=D,D=Math.floor((b-w)/2+w);b=D;let A=Math.max(1,d-D+1),I=s?_:Math.min(d+D,_)+u,H=Array(I+2);H[I+1]=(1<<M)-1;for(let z=I;z>=A;z-=1){let V=z-1,j=n[t.charAt(V)];if(p&&(x[V]=+!!j),H[z]=(H[z+1]<<1|1)&j,M&&(H[z]|=(g[z+1]|g[z])<<1|1|g[z+1]),H[z]&v&&(y=wY(e,{errors:M,currentLocation:V,expectedLocation:d,distance:r,ignoreLocation:l}),y<=m)){if(m=y,h=V,h<=d)break;A=Math.max(1,2*d-h)}}if(wY(e,{errors:M+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:l})>m)break;g=H}const S={isMatch:h>=0,score:Math.max(.001,y)};if(p){const M=iQn(x,a);M.length?c&&(S.indices=M):S.isMatch=!1}return S}function aQn(t){let e={};for(let n=0,o=t.length;n<o;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<o-n-1}return e}const EY=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class Bht{constructor(e,{location:n=Oi.location,threshold:o=Oi.threshold,distance:r=Oi.distance,includeMatches:i=Oi.includeMatches,findAllMatches:s=Oi.findAllMatches,minMatchCharLength:a=Oi.minMatchCharLength,isCaseSensitive:c=Oi.isCaseSensitive,ignoreDiacritics:l=Oi.ignoreDiacritics,ignoreLocation:u=Oi.ignoreLocation}={}){if(this.options={location:n,threshold:o,distance:r,includeMatches:i,findAllMatches:s,minMatchCharLength:a,isCaseSensitive:c,ignoreDiacritics:l,ignoreLocation:u},e=c?e:e.toLowerCase(),e=l?EY(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const _=(m,h)=>{this.chunks.push({pattern:m,alphabet:aQn(m),startIndex:h})},d=this.pattern.length;if(d>oC){let m=0;const h=d%oC,p=d-h;for(;m<p;)_(this.pattern.substr(m,oC),m),m+=oC;if(h){const x=d-oC;_(this.pattern.substr(x),x)}}else _(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,ignoreDiacritics:o,includeMatches:r}=this.options;if(e=n?e:e.toLowerCase(),e=o?EY(e):e,this.pattern===e){let p={isMatch:!0,score:0};return r&&(p.indices=[[0,e.length-1]]),p}const{location:i,distance:s,threshold:a,findAllMatches:c,minMatchCharLength:l,ignoreLocation:u}=this.options;let _=[],d=0,m=!1;this.chunks.forEach(({pattern:p,alphabet:x,startIndex:f})=>{const{isMatch:g,score:y,indices:b}=sQn(e,p,x,{location:i+f,distance:s,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:r,ignoreLocation:u});g&&(m=!0),d+=y,g&&b&&(_=[..._,...b])});let h={isMatch:m,score:m?d/this.chunks.length:1};return m&&r&&(h.indices=_),h}}class $v{constructor(e){this.pattern=e}static isMultiMatch(e){return zht(e,this.multiRegex)}static isSingleMatch(e){return zht(e,this.singleRegex)}search(){}}function zht(t,e){const n=t.match(e);return n?n[1]:null}class cQn extends $v{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class lQn extends $v{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const o=e.indexOf(this.pattern)===-1;return{isMatch:o,score:o?0:1,indices:[0,e.length-1]}}}class uQn extends $v{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class _Qn extends $v{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class dQn extends $v{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class hQn extends $v{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Vht extends $v{constructor(e,{location:n=Oi.location,threshold:o=Oi.threshold,distance:r=Oi.distance,includeMatches:i=Oi.includeMatches,findAllMatches:s=Oi.findAllMatches,minMatchCharLength:a=Oi.minMatchCharLength,isCaseSensitive:c=Oi.isCaseSensitive,ignoreDiacritics:l=Oi.ignoreDiacritics,ignoreLocation:u=Oi.ignoreLocation}={}){super(e),this._bitapSearch=new Bht(e,{location:n,threshold:o,distance:r,includeMatches:i,findAllMatches:s,minMatchCharLength:a,isCaseSensitive:c,ignoreDiacritics:l,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class $ht extends $v{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,o;const r=[],i=this.pattern.length;for(;(o=e.indexOf(this.pattern,n))>-1;)n=o+i,r.push([o,n-1]);const s=!!r.length;return{isMatch:s,score:s?0:1,indices:r}}}const Jye=[cQn,$ht,uQn,_Qn,hQn,dQn,lQn,Vht],Wht=Jye.length,mQn=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,pQn="|";function fQn(t,e={}){return t.split(pQn).map(n=>{let o=n.trim().split(mQn).filter(i=>i&&!!i.trim()),r=[];for(let i=0,s=o.length;i<s;i+=1){const a=o[i];let c=!1,l=-1;for(;!c&&++l<Wht;){const u=Jye[l];let _=u.isMultiMatch(a);_&&(r.push(new u(_,e)),c=!0)}if(!c)for(l=-1;++l<Wht;){const u=Jye[l];let _=u.isSingleMatch(a);if(_){r.push(new u(_,e));break}}}return r})}const xQn=new Set([Vht.type,$ht.type]);class gQn{constructor(e,{isCaseSensitive:n=Oi.isCaseSensitive,ignoreDiacritics:o=Oi.ignoreDiacritics,includeMatches:r=Oi.includeMatches,minMatchCharLength:i=Oi.minMatchCharLength,ignoreLocation:s=Oi.ignoreLocation,findAllMatches:a=Oi.findAllMatches,location:c=Oi.location,threshold:l=Oi.threshold,distance:u=Oi.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:o,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:s,location:c,threshold:l,distance:u},e=n?e:e.toLowerCase(),e=o?EY(e):e,this.pattern=e,this.query=fQn(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:o,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?EY(e):e;let s=0,a=[],c=0;for(let l=0,u=n.length;l<u;l+=1){const _=n[l];a.length=0,s=0;for(let d=0,m=_.length;d<m;d+=1){const h=_[d],{isMatch:p,indices:x,score:f}=h.search(e);if(p){if(s+=1,c+=f,o){const g=h.constructor.type;xQn.has(g)?a=[...a,...x]:a.push(x)}}else{c=0,s=0,a.length=0;break}}if(s){let d={isMatch:!0,score:c/s};return o&&(d.indices=a),d}}return{isMatch:!1,score:1}}}const Kye=[];function yQn(...t){Kye.push(...t)}function Qye(t,e){for(let n=0,o=Kye.length;n<o;n+=1){let r=Kye[n];if(r.condition(t,e))return new r(t,e)}return new Bht(t,e)}const DY={AND:"$and",OR:"$or"},Zye={PATH:"$path",PATTERN:"$val"},e5e=t=>!!(t[DY.AND]||t[DY.OR]),bQn=t=>!!t[Zye.PATH],PQn=t=>!nb(t)&&Nht(t)&&!e5e(t),Uht=t=>({[DY.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Xht(t,e,{auto:n=!0}={}){const o=r=>{let i=Object.keys(r);const s=bQn(r);if(!s&&i.length>1&&!e5e(r))return o(Uht(r));if(PQn(r)){const c=s?r[Zye.PATH]:i[0],l=s?r[Zye.PATTERN]:r[c];if(!M3(l))throw new Error(JKn(c));const u={keyId:Yye(c),pattern:l};return n&&(u.searcher=Qye(l,e)),u}let a={children:[],operator:i[0]};return i.forEach(c=>{const l=r[c];nb(l)&&l.forEach(u=>{a.children.push(o(u))})}),a};return e5e(t)||(t=Uht(t)),o(t)}function vQn(t,{ignoreFieldNorm:e=Oi.ignoreFieldNorm}){t.forEach(n=>{let o=1;n.matches.forEach(({key:r,norm:i,score:s})=>{const a=r?r.weight:null;o*=Math.pow(s===0&&a?Number.EPSILON:s,(a||1)*(e?1:i))}),n.score=o})}function SQn(t,e){const n=t.matches;e.matches=[],ay(n)&&n.forEach(o=>{if(!ay(o.indices)||!o.indices.length)return;const{indices:r,value:i}=o;let s={indices:r,value:i};o.key&&(s.key=o.key.src),o.idx>-1&&(s.refIndex=o.idx),e.matches.push(s)})}function CQn(t,e){e.score=t.score}function MQn(t,e,{includeMatches:n=Oi.includeMatches,includeScore:o=Oi.includeScore}={}){const r=[];return n&&r.push(SQn),o&&r.push(CQn),t.map(i=>{const{idx:s}=i,a={item:e[s],refIndex:s};return r.length&&r.forEach(c=>{c(i,a)}),a})}class eD{constructor(e,n={},o){this.options={...Oi,...n},this.options.useExtendedSearch,this._keyStore=new eQn(this.options.keys),this.setCollection(e,o)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof qye))throw new Error(qKn);this._myIndex=n||Fht(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){ay(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let o=0,r=this._docs.length;o<r;o+=1){const i=this._docs[o];e(i,o)&&(this.removeAt(o),o-=1,r-=1,n.push(i))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:o,includeScore:r,shouldSort:i,sortFn:s,ignoreFieldNorm:a}=this.options;let c=M3(e)?M3(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return vQn(c,{ignoreFieldNorm:a}),i&&c.sort(s),kht(n)&&n>-1&&(c=c.slice(0,n)),MQn(c,this._docs,{includeMatches:o,includeScore:r})}_searchStringList(e){const n=Qye(e,this.options),{records:o}=this._myIndex,r=[];return o.forEach(({v:i,i:s,n:a})=>{if(!ay(i))return;const{isMatch:c,score:l,indices:u}=n.searchIn(i);c&&r.push({item:i,idx:s,matches:[{score:l,value:i,norm:a,indices:u}]})}),r}_searchLogical(e){const n=Xht(e,this.options),o=(a,c,l)=>{if(!a.children){const{keyId:_,searcher:d}=a,m=this._findMatches({key:this._keyStore.get(_),value:this._myIndex.getValueForItemAtKeyId(c,_),searcher:d});return m&&m.length?[{idx:l,item:c,matches:m}]:[]}const u=[];for(let _=0,d=a.children.length;_<d;_+=1){const m=a.children[_],h=o(m,c,l);if(h.length)u.push(...h);else if(a.operator===DY.AND)return[]}return u},r=this._myIndex.records,i={},s=[];return r.forEach(({$:a,i:c})=>{if(ay(a)){let l=o(n,a,c);l.length&&(i[c]||(i[c]={idx:c,item:a,matches:[]},s.push(i[c])),l.forEach(({matches:u})=>{i[c].matches.push(...u)}))}}),s}_searchObjectList(e){const n=Qye(e,this.options),{keys:o,records:r}=this._myIndex,i=[];return r.forEach(({$:s,i:a})=>{if(!ay(s))return;let c=[];o.forEach((l,u)=>{c.push(...this._findMatches({key:l,value:s[u],searcher:n}))}),c.length&&i.push({idx:a,item:s,matches:c})}),i}_findMatches({key:e,value:n,searcher:o}){if(!ay(n))return[];let r=[];if(nb(n))n.forEach(({v:i,i:s,n:a})=>{if(!ay(i))return;const{isMatch:c,score:l,indices:u}=o.searchIn(i);c&&r.push({score:l,key:e,value:i,idx:s,norm:a,indices:u})});else{const{v:i,n:s}=n,{isMatch:a,score:c,indices:l}=o.searchIn(i);a&&r.push({score:c,key:e,value:i,norm:s,indices:l})}return r}}eD.version="7.1.0",eD.createIndex=Fht,eD.parseIndex=rQn,eD.config=Oi,eD.parseQuery=Xht,yQn(gQn);let t5e=null,_I=null,n5e=null;const TQn=async()=>t5e||_I||(_I=fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then(t=>t.json()).then(t=>(t5e=t,_I=null,t)),_I),wQn=async(t,e=20)=>{const n=await TQn();return n5e||(n5e=new eD(n)),n5e.search(t).slice(0,e).map(o=>o.item)},EQn=t=>{const e=t.replace(".pretty/","/").replace(".kicad_mod",""),n=`kicad:${e}`;return{path:t,qualifiedName:n,description:e}},DQn=()=>{const[t,e]=Y.useState([]),[n,o]=Y.useState(!1),[r,i]=Y.useState(null),[s,a]=Y.useState(!1),c=Y.useCallback(async u=>{const _=u.trim();if(!_)return[];o(!0),i(null);try{const m=(await wQn(_,20)).map(h=>({source:"kicad",footprint:EQn(h)}));return e(m),m}catch(d){return console.error("Error searching KiCad footprints",d),e([]),i(d instanceof Error?d.message:"Failed to search KiCad footprints"),[]}finally{o(!1),a(!0)}},[]),l=Y.useCallback(()=>{e([]),o(!1),i(null),a(!1)},[]);return{results:t,isSearching:n,error:r,hasSearched:s,search:c,reset:l}},AQn=({onTscircuitPackageSelected:t,onJlcpcbComponentTsxLoaded:e,onKicadStringSelected:n})=>{const o=[];return t&&o.push("tscircuit.com"),e&&o.push("jlcpcb"),n&&o.push("kicad"),o},RQn=({isOpen:t,onClose:e,jlcpcbProxyRequestHeaders:n,onKicadStringSelected:o,onTscircuitPackageSelected:r,onJlcpcbComponentTsxLoaded:i,jlcpcbProxyApiBase:s,tscircuitSessionToken:a})=>{xY();const c=Y.useMemo(()=>AQn({onKicadStringSelected:o,onTscircuitPackageSelected:r,onJlcpcbComponentTsxLoaded:i}),[o,r,i]),l=c.length>0,u=c.length===1,[_,d]=Y.useState(c[0]??"tscircuit.com"),[m,h]=Y.useState(""),[p,x]=Y.useState(null),{results:f,isSearching:g,error:y,hasSearched:b,search:v,reset:S}=$Kn({sessionToken:a}),{results:M,isSearching:w,error:D,hasSearched:A,search:I,reset:H}=UKn(),{results:O,isSearching:z,error:V,hasSearched:j,search:q,reset:K}=DQn(),{details:ne,isLoading:ce,fetchDetails:ee,reset:oe}=zKn(),[ie,ae]=Y.useState(null),[de,be]=Y.useState(!1),[Ce,De]=Y.useState("pcb"),[pe,Me]=Y.useState(null),[xe,We]=Y.useState(!1);Y.useEffect(()=>{Me(null)},[p]);const Xe=Y.useCallback(()=>{S(),H(),K(),x(null)},[H,K,S]);Y.useEffect(()=>{t||(Xe(),h(""),be(!1),ae(null),Me(null))},[t,Xe]),Y.useEffect(()=>{h(""),x(null),_==="tscircuit.com"?S():_==="jlcpcb"?H():_==="kicad"&&K()},[_,H,K,S]);const Je=ze=>{x(ze),ae(ze),De("pcb"),be(!0),oe();const Ue=ze.package.org_owner_tscircuit_handle,et=ze.package.unscoped_name;if(Ue&&et){const ot=et.split("/").pop()??et;ee(Ue,ot)}},fe=async()=>{m.trim()&&(x(null),_==="tscircuit.com"?await v(m):_==="jlcpcb"?await I(m):_==="kicad"&&await q(m))},Ye=async ze=>{try{if(Me(null),We(!0),ze.source==="kicad"){if(!o)throw new Error("KiCad handler not provided");await o({result:ze,footprint:ze.footprint.qualifiedName})}else if(ze.source==="jlcpcb"){if(!i)throw new Error("JLCPCB handler not provided");const Ue=await RKn(ze.component.partNumber,{headers:n,apiBase:s});await i({result:ze,tsx:Ue})}else if(ze.source==="tscircuit.com"){if(!r)throw new Error("tscircuit package handler not provided");const Ue=ze.package.org_owner_tscircuit_handle,et=ze.package.unscoped_name;if(!Ue||!et)throw new Error("Missing package metadata");const ot=et.split("/").pop()??et,at=`@tsci/${Ue}.${ot}`;await r({result:ze,fullPackageName:at})}return!0}catch(Ue){return console.error("Failed to import component",Ue),Me(Ue instanceof Error?Ue.message:"Failed to import component"),!1}finally{We(!1)}};let Oe=[],Ne=!1,Ve=null,Re=!1;_==="tscircuit.com"?(Oe=f,Ne=g,Ve=y,Re=b):_==="jlcpcb"?(Oe=M,Ne=w,Ve=D,Re=A):_==="kicad"&&(Oe=O,Ne=z,Ve=V,Re=j);const Pe=async()=>{if(!p)return;await Ye(p)&&(e(),Xe(),h(""))},Ee=ze=>{ze||e()},we=ze=>{be(ze),ze||ae(null)};return G.jsxs(QE,{open:t,onOpenChange:Ee,children:[G.jsxs(eC,{style:{width:"calc(100vw - 2rem)",zIndex:Rht.importComponentDialog},className:"rf-rounded-sm rf-max-h-[90vh] rf-overflow-y-auto rf-overflow-x-hidden rf-flex rf-flex-col",children:[G.jsxs(tC,{children:[G.jsxs(nC,{className:"rf-text-lg sm:rf-text-xl",children:["Import ",u?TY[_].label:""," ","Component"]}),G.jsx(ZE,{className:"rf-text-sm",children:l?"Search for components from available sources.":"Import options are disabled because no handlers were provided."})]}),l?G.jsxs(gae,{value:_,onValueChange:ze=>d(ze),className:"rf-min-w-0 rf-w-full",children:[!u&&G.jsx(AW,{className:"rf-flex rf-w-full rf-gap-2",children:c.map(ze=>G.jsx(z6,{value:ze,className:"rf-flex-1 rf-text-xs sm:rf-text-sm",children:TY[ze].label},ze))}),G.jsx(kKn,{query:m,placeholder:TY[_].placeholder,isSearching:Ne,onQueryChange:h,onSubmit:fe}),G.jsx("div",{className:"no-scrollbar rf-mt-4 rf-flex-1 rf-min-h-[200px] !rf-max-h-[40vh] !rf-overflow-y-auto rf-overflow-x-hidden rf-border rf-rounded-md rf-min-w-0",children:Ne?G.jsxs("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:[G.jsx($9,{className:"rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2"}),G.jsx("p",{children:"Searching..."})]}):Oe.length>0?G.jsx(FKn,{results:Oe,selected:p,onSelect:x,onShowDetails:_==="tscircuit.com"?Je:void 0}):G.jsx("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:Ve?`Error: ${Ve}`:Re?TY[_].emptyMessage:"Enter a search term to find components"})})]}):null,pe?G.jsx("div",{className:"rf-text-sm rf-text-red-600 rf-mt-2",children:pe}):null,G.jsxs(uI,{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[G.jsx(dc,{variant:"outline",onClick:e,className:"rf-order-2 sm:rf-order-1",children:"Cancel"}),G.jsx(dc,{onClick:Pe,disabled:!p||xe,className:"rf-order-1 sm:rf-order-2",children:xe?G.jsx($9,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import"})]})]}),G.jsx(BKn,{packageResult:ie,isOpen:de,onOpenChange:we,isLoading:ce,details:ne,previewTab:Ce,onPreviewTabChange:ze=>De(ze),isSubmitting:xe,onImport:()=>{ie&&Ye(ie).then(ze=>{ze&&(be(!1),e(),Xe(),h(""))})}})]})},kQn=t=>{const e=t.match(/export const (\w+) =/);if(!e)throw new Error("Could not determine component name from TSX contents");return e[1]},jht=t=>{const e=eu(s=>s.pushEvent),n=eu(s=>s.upsertFile),o=async({result:s,fullPackageName:a})=>{const l=s.package.unscoped_name??s.package.name;await ds.promise(e({event_type:"INSTALL_PACKAGE",full_package_name:a}),{loading:`Requesting install for "${l}"`,success:`Install requested for "${l}"`,error:u=>`Failed to request install: ${u instanceof Error?u.message:String(u)}`})},r=async({footprint:s})=>{await ds.promise(navigator.clipboard.writeText(s),{loading:`Copying "${s}"`,success:`Copied "${s}" to clipboard`,error:a=>`Failed to copy footprint: ${a instanceof Error?a.message:String(a)}`})},i=async({result:s,tsx:a})=>{const l=`imports/${kQn(a)}.tsx`;await ds.promise(n(l,a),{loading:`Importing ${s.component.partNumber}`,success:`Imported to "${l}"`,error:u=>`Failed to import component: ${u instanceof Error?u.message:String(u)}`})};return G.jsx(RQn,{...t,onTscircuitPackageSelected:o,onKicadStringSelected:r,onJlcpcbComponentTsxLoaded:i})};jht.displayName="ImportComponentDialogForCli";var o5e={exports:{}},Ght;function NQn(){return Ght||(Ght=1,(function(t,e){var n={env:{},version:""};(function(o){t.exports=o()})(function(){return(function o(r,i,s){function a(u,_){if(!i[u]){if(!r[u]){var d=typeof Xb=="function"&&Xb;if(!_&&d)return d(u,!0);if(c)return c(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var h=i[u]={exports:{}};r[u][0].call(h.exports,function(p){var x=r[u][1][p];return a(x||p)},h,h.exports,o,r,i,s)}return i[u].exports}for(var c=typeof Xb=="function"&&Xb,l=0;l<s.length;l++)a(s[l]);return a})({1:[function(o,r,i){var s=o("./utils"),a=o("./support"),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(l){for(var u,_,d,m,h,p,x,f=[],g=0,y=l.length,b=y,v=s.getTypeOf(l)!=="string";g<l.length;)b=y-g,d=v?(u=l[g++],_=g<y?l[g++]:0,g<y?l[g++]:0):(u=l.charCodeAt(g++),_=g<y?l.charCodeAt(g++):0,g<y?l.charCodeAt(g++):0),m=u>>2,h=(3&u)<<4|_>>4,p=1<b?(15&_)<<2|d>>6:64,x=2<b?63&d:64,f.push(c.charAt(m)+c.charAt(h)+c.charAt(p)+c.charAt(x));return f.join("")},i.decode=function(l){var u,_,d,m,h,p,x=0,f=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var y,b=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===c.charAt(64)&&b--,l.charAt(l.length-2)===c.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=a.uint8array?new Uint8Array(0|b):new Array(0|b);x<l.length;)u=c.indexOf(l.charAt(x++))<<2|(m=c.indexOf(l.charAt(x++)))>>4,_=(15&m)<<4|(h=c.indexOf(l.charAt(x++)))>>2,d=(3&h)<<6|(p=c.indexOf(l.charAt(x++))),y[f++]=u,h!==64&&(y[f++]=_),p!==64&&(y[f++]=d);return y}},{"./support":30,"./utils":32}],2:[function(o,r,i){var s=o("./external"),a=o("./stream/DataWorker"),c=o("./stream/Crc32Probe"),l=o("./stream/DataLengthProbe");function u(_,d,m,h,p){this.compressedSize=_,this.uncompressedSize=d,this.crc32=m,this.compression=h,this.compressedContent=p}u.prototype={getContentWorker:function(){var _=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return _.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),_},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(_,d,m){return _.pipe(new c).pipe(new l("uncompressedSize")).pipe(d.compressWorker(m)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,r,i){var s=o("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,r,i){var s=o("./utils"),a=(function(){for(var c,l=[],u=0;u<256;u++){c=u;for(var _=0;_<8;_++)c=1&c?3988292384^c>>>1:c>>>1;l[u]=c}return l})();r.exports=function(c,l){return c!==void 0&&c.length?s.getTypeOf(c)!=="string"?(function(u,_,d,m){var h=a,p=m+d;u^=-1;for(var x=m;x<p;x++)u=u>>>8^h[255&(u^_[x])];return-1^u})(0|l,c,c.length,0):(function(u,_,d,m){var h=a,p=m+d;u^=-1;for(var x=m;x<p;x++)u=u>>>8^h[255&(u^_.charCodeAt(x))];return-1^u})(0|l,c,c.length,0):0}},{"./utils":32}],5:[function(o,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(o,r,i){var s=null;s=typeof Promise<"u"?Promise:o("lie"),r.exports={Promise:s}},{lie:37}],7:[function(o,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=o("pako"),c=o("./utils"),l=o("./stream/GenericWorker"),u=s?"uint8array":"array";function _(d,m){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=m,this.meta={}}i.magic="\b\0",c.inherits(_,l),_.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(u,d.data),!1)},_.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},_.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},_.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(m){d.push({data:m,meta:d.meta})}},i.compressWorker=function(d){return new _("Deflate",d)},i.uncompressWorker=function(){return new _("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,r,i){function s(h,p){var x,f="";for(x=0;x<p;x++)f+=String.fromCharCode(255&h),h>>>=8;return f}function a(h,p,x,f,g,y){var b,v,S=h.file,M=h.compression,w=y!==u.utf8encode,D=c.transformTo("string",y(S.name)),A=c.transformTo("string",u.utf8encode(S.name)),I=S.comment,H=c.transformTo("string",y(I)),O=c.transformTo("string",u.utf8encode(I)),z=A.length!==S.name.length,V=O.length!==I.length,j="",q="",K="",ne=S.dir,ce=S.date,ee={crc32:0,compressedSize:0,uncompressedSize:0};p&&!x||(ee.crc32=h.crc32,ee.compressedSize=h.compressedSize,ee.uncompressedSize=h.uncompressedSize);var oe=0;p&&(oe|=8),w||!z&&!V||(oe|=2048);var ie=0,ae=0;ne&&(ie|=16),g==="UNIX"?(ae=798,ie|=(function(be,Ce){var De=be;return be||(De=Ce?16893:33204),(65535&De)<<16})(S.unixPermissions,ne)):(ae=20,ie|=(function(be){return 63&(be||0)})(S.dosPermissions)),b=ce.getUTCHours(),b<<=6,b|=ce.getUTCMinutes(),b<<=5,b|=ce.getUTCSeconds()/2,v=ce.getUTCFullYear()-1980,v<<=4,v|=ce.getUTCMonth()+1,v<<=5,v|=ce.getUTCDate(),z&&(q=s(1,1)+s(_(D),4)+A,j+="up"+s(q.length,2)+q),V&&(K=s(1,1)+s(_(H),4)+O,j+="uc"+s(K.length,2)+K);var de="";return de+=`
|
|
5709
5709
|
\0`,de+=s(oe,2),de+=M.magic,de+=s(b,2),de+=s(v,2),de+=s(ee.crc32,4),de+=s(ee.compressedSize,4),de+=s(ee.uncompressedSize,4),de+=s(D.length,2),de+=s(j.length,2),{fileRecord:d.LOCAL_FILE_HEADER+de+D+j,dirRecord:d.CENTRAL_FILE_HEADER+s(ae,2)+de+s(H.length,2)+"\0\0\0\0"+s(ie,4)+s(f,4)+D+j+H}}var c=o("../utils"),l=o("../stream/GenericWorker"),u=o("../utf8"),_=o("../crc32"),d=o("../signature");function m(h,p,x,f){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=x,this.encodeFileName=f,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(m,l),m.prototype.push=function(h){var p=h.meta.percent||0,x=this.entriesCount,f=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:x?(p+100*(x-f-1))/x:100}}))},m.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var x=a(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:x.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,x=a(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(x.dirRecord),p)this.push({data:(function(f){return d.DATA_DESCRIPTOR+s(f.crc32,4)+s(f.compressedSize,4)+s(f.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:x.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var h=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var x=this.bytesWritten-h,f=(function(g,y,b,v,S){var M=c.transformTo("string",S(v));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(g,2)+s(g,2)+s(y,4)+s(b,4)+s(M.length,2)+M})(this.dirRecords.length,x,h,this.zipComment,this.encodeFileName);this.push({data:f,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(h){this._sources.push(h);var p=this;return h.on("data",function(x){p.processChunk(x)}),h.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),h.on("error",function(x){p.error(x)}),this},m.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(h){var p=this._sources;if(!l.prototype.error.call(this,h))return!1;for(var x=0;x<p.length;x++)try{p[x].error(h)}catch{}return!0},m.prototype.lock=function(){l.prototype.lock.call(this);for(var h=this._sources,p=0;p<h.length;p++)h[p].lock()},r.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,r,i){var s=o("../compressions"),a=o("./ZipFileWorker");i.generateWorker=function(c,l,u){var _=new a(l.streamFiles,u,l.platform,l.encodeFileName),d=0;try{c.forEach(function(m,h){d++;var p=(function(y,b){var v=y||b,S=s[v];if(!S)throw new Error(v+" is not a valid compression method !");return S})(h.options.compression,l.compression),x=h.options.compressionOptions||l.compressionOptions||{},f=h.dir,g=h.date;h._compressWorker(p,x).withStreamInfo("file",{name:m,dir:f,date:g,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(_)}),_.entriesCount=d}catch(m){_.error(m)}return _}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,r,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var c in this)typeof this[c]!="function"&&(a[c]=this[c]);return a}}(s.prototype=o("./object")).loadAsync=o("./load"),s.support=o("./support"),s.defaults=o("./defaults"),s.version="3.10.1",s.loadAsync=function(a,c){return new s().loadAsync(a,c)},s.external=o("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,r,i){var s=o("./utils"),a=o("./external"),c=o("./utf8"),l=o("./zipEntries"),u=o("./stream/Crc32Probe"),_=o("./nodejsUtils");function d(m){return new a.Promise(function(h,p){var x=m.decompressed.getContentWorker().pipe(new u);x.on("error",function(f){p(f)}).on("end",function(){x.streamInfo.crc32!==m.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(m,h){var p=this;return h=s.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:c.utf8decode}),_.isNode&&_.isStream(m)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",m,!0,h.optimizedBinaryString,h.base64).then(function(x){var f=new l(h);return f.load(x),f}).then(function(x){var f=[a.Promise.resolve(x)],g=x.files;if(h.checkCRC32)for(var y=0;y<g.length;y++)f.push(d(g[y]));return a.Promise.all(f)}).then(function(x){for(var f=x.shift(),g=f.files,y=0;y<g.length;y++){var b=g[y],v=b.fileNameStr,S=s.resolve(b.fileNameStr);p.file(S,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:h.createFolders}),b.dir||(p.file(S).unsafeOriginalName=v)}return f.zipComment.length&&(p.comment=f.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,r,i){var s=o("../utils"),a=o("../stream/GenericWorker");function c(l,u){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(c,a),c.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(_){u.push({data:_,meta:{percent:0}})}).on("error",function(_){u.isPaused?this.generatedError=_:u.error(_)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},c.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},c.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=c},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,r,i){var s=o("readable-stream").Readable;function a(c,l,u){s.call(this,l),this._helper=c;var _=this;c.on("data",function(d,m){_.push(d)||_._helper.pause(),u&&u(m)}).on("error",function(d){_.emit("error",d)}).on("end",function(){_.push(null)})}o("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(o,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(o,r,i){function s(S,M,w){var D,A=c.getTypeOf(M),I=c.extend(w||{},_);I.date=I.date||new Date,I.compression!==null&&(I.compression=I.compression.toUpperCase()),typeof I.unixPermissions=="string"&&(I.unixPermissions=parseInt(I.unixPermissions,8)),I.unixPermissions&&16384&I.unixPermissions&&(I.dir=!0),I.dosPermissions&&16&I.dosPermissions&&(I.dir=!0),I.dir&&(S=g(S)),I.createFolders&&(D=f(S))&&y.call(this,D,!0);var H=A==="string"&&I.binary===!1&&I.base64===!1;w&&w.binary!==void 0||(I.binary=!H),(M instanceof d&&M.uncompressedSize===0||I.dir||!M||M.length===0)&&(I.base64=!1,I.binary=!0,M="",I.compression="STORE",A="string");var O=null;O=M instanceof d||M instanceof l?M:p.isNode&&p.isStream(M)?new x(S,M):c.prepareContent(S,M,I.binary,I.optimizedBinaryString,I.base64);var z=new m(S,O,I);this.files[S]=z}var a=o("./utf8"),c=o("./utils"),l=o("./stream/GenericWorker"),u=o("./stream/StreamHelper"),_=o("./defaults"),d=o("./compressedObject"),m=o("./zipObject"),h=o("./generate"),p=o("./nodejsUtils"),x=o("./nodejs/NodejsStreamInputAdapter"),f=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var M=S.lastIndexOf("/");return 0<M?S.substring(0,M):""},g=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},y=function(S,M){return M=M!==void 0?M:_.createFolders,S=g(S),this.files[S]||s.call(this,S,null,{dir:!0,createFolders:M}),this.files[S]};function b(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var M,w,D;for(M in this.files)D=this.files[M],(w=M.slice(this.root.length,M.length))&&M.slice(0,this.root.length)===this.root&&S(w,D)},filter:function(S){var M=[];return this.forEach(function(w,D){S(w,D)&&M.push(D)}),M},file:function(S,M,w){if(arguments.length!==1)return S=this.root+S,s.call(this,S,M,w),this;if(b(S)){var D=S;return this.filter(function(I,H){return!H.dir&&D.test(I)})}var A=this.files[this.root+S];return A&&!A.dir?A:null},folder:function(S){if(!S)return this;if(b(S))return this.filter(function(A,I){return I.dir&&S.test(A)});var M=this.root+S,w=y.call(this,M),D=this.clone();return D.root=w.name,D},remove:function(S){S=this.root+S;var M=this.files[S];if(M||(S.slice(-1)!=="/"&&(S+="/"),M=this.files[S]),M&&!M.dir)delete this.files[S];else for(var w=this.filter(function(A,I){return I.name.slice(0,S.length)===S}),D=0;D<w.length;D++)delete this.files[w[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var M,w={};try{if((w=c.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=w.type.toLowerCase(),w.compression=w.compression.toUpperCase(),w.type==="binarystring"&&(w.type="string"),!w.type)throw new Error("No output type specified.");c.checkSupport(w.type),w.platform!=="darwin"&&w.platform!=="freebsd"&&w.platform!=="linux"&&w.platform!=="sunos"||(w.platform="UNIX"),w.platform==="win32"&&(w.platform="DOS");var D=w.comment||this.comment||"";M=h.generateWorker(this,w,D)}catch(A){(M=new l("error")).error(A)}return new u(M,w.type||"string",w.mimeType)},generateAsync:function(S,M){return this.generateInternalStream(S).accumulate(M)},generateNodeStream:function(S,M){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(M)}};r.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(o,r,i){r.exports=o("stream")},{stream:void 0}],17:[function(o,r,i){var s=o("./DataReader");function a(c){s.call(this,c);for(var l=0;l<this.data.length;l++)c[l]=255&c[l]}o("../utils").inherits(a,s),a.prototype.byteAt=function(c){return this.data[this.zero+c]},a.prototype.lastIndexOfSignature=function(c){for(var l=c.charCodeAt(0),u=c.charCodeAt(1),_=c.charCodeAt(2),d=c.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===l&&this.data[m+1]===u&&this.data[m+2]===_&&this.data[m+3]===d)return m-this.zero;return-1},a.prototype.readAndCheckSignature=function(c){var l=c.charCodeAt(0),u=c.charCodeAt(1),_=c.charCodeAt(2),d=c.charCodeAt(3),m=this.readData(4);return l===m[0]&&u===m[1]&&_===m[2]&&d===m[3]},a.prototype.readData=function(c){if(this.checkOffset(c),c===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,l},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(o,r,i){var s=o("../utils");function a(c){this.data=c,this.length=c.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(c){this.checkIndex(this.index+c)},checkIndex:function(c){if(this.length<this.zero+c||c<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+c+"). Corrupted zip ?")},setIndex:function(c){this.checkIndex(c),this.index=c},skip:function(c){this.setIndex(this.index+c)},byteAt:function(){},readInt:function(c){var l,u=0;for(this.checkOffset(c),l=this.index+c-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=c,u},readString:function(c){return s.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},r.exports=a},{"../utils":32}],19:[function(o,r,i){var s=o("./Uint8ArrayReader");function a(c){s.call(this,c)}o("../utils").inherits(a,s),a.prototype.readData=function(c){this.checkOffset(c);var l=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,r,i){var s=o("./DataReader");function a(c){s.call(this,c)}o("../utils").inherits(a,s),a.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},a.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},a.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},a.prototype.readData=function(c){this.checkOffset(c);var l=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(o,r,i){var s=o("./ArrayReader");function a(c){s.call(this,c)}o("../utils").inherits(a,s),a.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(o,r,i){var s=o("../utils"),a=o("../support"),c=o("./ArrayReader"),l=o("./StringReader"),u=o("./NodeBufferReader"),_=o("./Uint8ArrayReader");r.exports=function(d){var m=s.getTypeOf(d);return s.checkSupport(m),m!=="string"||a.uint8array?m==="nodebuffer"?new u(d):a.uint8array?new _(s.transformTo("uint8array",d)):new c(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,r,i){var s=o("./GenericWorker"),a=o("../utils");function c(l){s.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(c,s),c.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(o,r,i){var s=o("./GenericWorker"),a=o("../crc32");function c(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o("../utils").inherits(c,s),c.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,r,i){var s=o("../utils"),a=o("./GenericWorker");function c(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(c,a),c.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(o,r,i){var s=o("../utils"),a=o("./GenericWorker");function c(l){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(_){u.dataIsReady=!0,u.data=_,u.max=_&&_.length||0,u.type=s.getTypeOf(_),u.isPaused||u._tickAndRepeat()},function(_){u.error(_)})}s.inherits(c,a),c.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(o,r,i){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,c){return this._listeners[a].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,c){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,c)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var c=this;return a.on("data",function(l){c.processChunk(l)}),a.on("end",function(){c.end()}),a.on("error",function(l){c.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,c){return this.extraStreamInfo[a]=c,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=s},{}],29:[function(o,r,i){var s=o("../utils"),a=o("./ConvertWorker"),c=o("./GenericWorker"),l=o("../base64"),u=o("../support"),_=o("../external"),d=null;if(u.nodestream)try{d=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(p,x){return new _.Promise(function(f,g){var y=[],b=p._internalType,v=p._outputType,S=p._mimeType;p.on("data",function(M,w){y.push(M),x&&x(w)}).on("error",function(M){y=[],g(M)}).on("end",function(){try{var M=(function(w,D,A){switch(w){case"blob":return s.newBlob(s.transformTo("arraybuffer",D),A);case"base64":return l.encode(D);default:return s.transformTo(w,D)}})(v,(function(w,D){var A,I=0,H=null,O=0;for(A=0;A<D.length;A++)O+=D[A].length;switch(w){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(H=new Uint8Array(O),A=0;A<D.length;A++)H.set(D[A],I),I+=D[A].length;return H;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+w+"'")}})(b,y),S);f(M)}catch(w){g(w)}y=[]}).resume()})}function h(p,x,f){var g=x;switch(x){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=x,this._mimeType=f,s.checkSupport(g),this._worker=p.pipe(new a(g)),p.lock()}catch(y){this._worker=new c("error"),this._worker.error(y)}}h.prototype={accumulate:function(p){return m(this,p)},on:function(p,x){var f=this;return p==="data"?this._worker.on(p,function(g){x.call(f,g.data,g.meta)}):this._worker.on(p,function(){s.delay(x,arguments,f)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},p)}},r.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!o("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(o,r,i){for(var s=o("./utils"),a=o("./support"),c=o("./nodejsUtils"),l=o("./stream/GenericWorker"),u=new Array(256),_=0;_<256;_++)u[_]=252<=_?6:248<=_?5:240<=_?4:224<=_?3:192<=_?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function m(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return a.nodebuffer?c.newBufferFrom(h,"utf-8"):(function(p){var x,f,g,y,b,v=p.length,S=0;for(y=0;y<v;y++)(64512&(f=p.charCodeAt(y)))==55296&&y+1<v&&(64512&(g=p.charCodeAt(y+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),y++),S+=f<128?1:f<2048?2:f<65536?3:4;for(x=a.uint8array?new Uint8Array(S):new Array(S),y=b=0;b<S;y++)(64512&(f=p.charCodeAt(y)))==55296&&y+1<v&&(64512&(g=p.charCodeAt(y+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),y++),f<128?x[b++]=f:(f<2048?x[b++]=192|f>>>6:(f<65536?x[b++]=224|f>>>12:(x[b++]=240|f>>>18,x[b++]=128|f>>>12&63),x[b++]=128|f>>>6&63),x[b++]=128|63&f);return x})(h)},i.utf8decode=function(h){return a.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):(function(p){var x,f,g,y,b=p.length,v=new Array(2*b);for(x=f=0;x<b;)if((g=p[x++])<128)v[f++]=g;else if(4<(y=u[g]))v[f++]=65533,x+=y-1;else{for(g&=y===2?31:y===3?15:7;1<y&&x<b;)g=g<<6|63&p[x++],y--;1<y?v[f++]=65533:g<65536?v[f++]=g:(g-=65536,v[f++]=55296|g>>10&1023,v[f++]=56320|1023&g)}return v.length!==f&&(v.subarray?v=v.subarray(0,f):v.length=f),s.applyFromCharCode(v)})(h=s.transformTo(a.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var p=s.transformTo(a.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var x=p;(p=new Uint8Array(x.length+this.leftOver.length)).set(this.leftOver,0),p.set(x,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var f=(function(y,b){var v;for((b=b||y.length)>y.length&&(b=y.length),v=b-1;0<=v&&(192&y[v])==128;)v--;return v<0||v===0?b:v+u[y[v]]>b?v:b})(p),g=p;f!==p.length&&(a.uint8array?(g=p.subarray(0,f),this.leftOver=p.subarray(f,p.length)):(g=p.slice(0,f),this.leftOver=p.slice(f,p.length))),this.push({data:i.utf8decode(g),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,s.inherits(m,l),m.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,r,i){var s=o("./support"),a=o("./base64"),c=o("./nodejsUtils"),l=o("./external");function u(x){return x}function _(x,f){for(var g=0;g<x.length;++g)f[g]=255&x.charCodeAt(g);return f}o("setimmediate"),i.newBlob=function(x,f){i.checkSupport("blob");try{return new Blob([x],{type:f})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(x),g.getBlob(f)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(x,f,g){var y=[],b=0,v=x.length;if(v<=g)return String.fromCharCode.apply(null,x);for(;b<v;)f==="array"||f==="nodebuffer"?y.push(String.fromCharCode.apply(null,x.slice(b,Math.min(b+g,v)))):y.push(String.fromCharCode.apply(null,x.subarray(b,Math.min(b+g,v)))),b+=g;return y.join("")},stringifyByChar:function(x){for(var f="",g=0;g<x.length;g++)f+=String.fromCharCode(x[g]);return f},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,c.allocBuffer(1)).length===1}catch{return!1}})()}};function m(x){var f=65536,g=i.getTypeOf(x),y=!0;if(g==="uint8array"?y=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(y=d.applyCanBeUsed.nodebuffer),y)for(;1<f;)try{return d.stringifyByChunk(x,g,f)}catch{f=Math.floor(f/2)}return d.stringifyByChar(x)}function h(x,f){for(var g=0;g<x.length;g++)f[g]=x[g];return f}i.applyFromCharCode=m;var p={};p.string={string:u,array:function(x){return _(x,new Array(x.length))},arraybuffer:function(x){return p.string.uint8array(x).buffer},uint8array:function(x){return _(x,new Uint8Array(x.length))},nodebuffer:function(x){return _(x,c.allocBuffer(x.length))}},p.array={string:m,array:u,arraybuffer:function(x){return new Uint8Array(x).buffer},uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return c.newBufferFrom(x)}},p.arraybuffer={string:function(x){return m(new Uint8Array(x))},array:function(x){return h(new Uint8Array(x),new Array(x.byteLength))},arraybuffer:u,uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return c.newBufferFrom(new Uint8Array(x))}},p.uint8array={string:m,array:function(x){return h(x,new Array(x.length))},arraybuffer:function(x){return x.buffer},uint8array:u,nodebuffer:function(x){return c.newBufferFrom(x)}},p.nodebuffer={string:m,array:function(x){return h(x,new Array(x.length))},arraybuffer:function(x){return p.nodebuffer.uint8array(x).buffer},uint8array:function(x){return h(x,new Uint8Array(x.length))},nodebuffer:u},i.transformTo=function(x,f){if(f=f||"",!x)return f;i.checkSupport(x);var g=i.getTypeOf(f);return p[g][x](f)},i.resolve=function(x){for(var f=x.split("/"),g=[],y=0;y<f.length;y++){var b=f[y];b==="."||b===""&&y!==0&&y!==f.length-1||(b===".."?g.pop():g.push(b))}return g.join("/")},i.getTypeOf=function(x){return typeof x=="string"?"string":Object.prototype.toString.call(x)==="[object Array]"?"array":s.nodebuffer&&c.isBuffer(x)?"nodebuffer":s.uint8array&&x instanceof Uint8Array?"uint8array":s.arraybuffer&&x instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(x){if(!s[x.toLowerCase()])throw new Error(x+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(x){var f,g,y="";for(g=0;g<(x||"").length;g++)y+="\\x"+((f=x.charCodeAt(g))<16?"0":"")+f.toString(16).toUpperCase();return y},i.delay=function(x,f,g){setImmediate(function(){x.apply(g||null,f||[])})},i.inherits=function(x,f){function g(){}g.prototype=f.prototype,x.prototype=new g},i.extend=function(){var x,f,g={};for(x=0;x<arguments.length;x++)for(f in arguments[x])Object.prototype.hasOwnProperty.call(arguments[x],f)&&g[f]===void 0&&(g[f]=arguments[x][f]);return g},i.prepareContent=function(x,f,g,y,b){return l.Promise.resolve(f).then(function(v){return s.blob&&(v instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(v))!==-1)&&typeof FileReader<"u"?new l.Promise(function(S,M){var w=new FileReader;w.onload=function(D){S(D.target.result)},w.onerror=function(D){M(D.target.error)},w.readAsArrayBuffer(v)}):v}).then(function(v){var S=i.getTypeOf(v);return S?(S==="arraybuffer"?v=i.transformTo("uint8array",v):S==="string"&&(b?v=a.decode(v):g&&y!==!0&&(v=(function(M){return _(M,s.uint8array?new Uint8Array(M.length):new Array(M.length))})(v))),v):l.Promise.reject(new Error("Can't read the data of '"+x+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,r,i){var s=o("./reader/readerFor"),a=o("./utils"),c=o("./signature"),l=o("./zipEntry"),u=o("./support");function _(d){this.files=[],this.loadOptions=d}_.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(m)+", expected "+a.pretty(d)+")")}},isSignature:function(d,m){var h=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===m;return this.reader.setIndex(h),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",h=a.transformTo(m,d);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,m,h,p=this.zip64EndOfCentralSize-44;0<p;)d=this.reader.readInt(2),m=this.reader.readInt(4),h=this.reader.readData(m),this.zip64ExtensibleData[d]={id:d,length:m,value:h}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,m;for(d=0;d<this.files.length;d++)m=this.files[d],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(c.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(c.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(c.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,c.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var m=d;if(this.checkSignature(c.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(c.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(c.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,c.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(c.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(c.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var p=m-h;if(0<p)this.isSignature(m,c.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=s(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=_},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,r,i){var s=o("./reader/readerFor"),a=o("./utils"),c=o("./compressedObject"),l=o("./crc32"),u=o("./utf8"),_=o("./compressions"),d=o("./support");function m(h,p){this.options=h,this.loadOptions=p}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var p,x;if(h.skip(22),this.fileNameLength=h.readInt(2),x=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(x),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(f){for(var g in _)if(Object.prototype.hasOwnProperty.call(_,g)&&_[g].magic===f)return _[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new c(this.compressedSize,this.uncompressedSize,this.crc32,p,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var p=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(p),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var p,x,f,g=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<g;)p=h.readInt(2),x=h.readInt(2),f=h.readData(x),this.extraFields[p]={id:p,length:x,value:f};h.setIndex(g)},handleUTF8:function(){var h=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var x=a.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(x)}var f=this.findExtraFieldUnicodeComment();if(f!==null)this.fileCommentStr=f;else{var g=a.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var p=s(h.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var p=s(h.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(h.length-5))}return null}},r.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,r,i){function s(p,x,f){this.name=p,this.dir=f.dir,this.date=f.date,this.comment=f.comment,this.unixPermissions=f.unixPermissions,this.dosPermissions=f.dosPermissions,this._data=x,this._dataBinary=f.binary,this.options={compression:f.compression,compressionOptions:f.compressionOptions}}var a=o("./stream/StreamHelper"),c=o("./stream/DataWorker"),l=o("./utf8"),u=o("./compressedObject"),_=o("./stream/GenericWorker");s.prototype={internalStream:function(p){var x=null,f="string";try{if(!p)throw new Error("No output type specified.");var g=(f=p.toLowerCase())==="string"||f==="text";f!=="binarystring"&&f!=="text"||(f="string"),x=this._decompressWorker();var y=!this._dataBinary;y&&!g&&(x=x.pipe(new l.Utf8EncodeWorker)),!y&&g&&(x=x.pipe(new l.Utf8DecodeWorker))}catch(b){(x=new _("error")).error(b)}return new a(x,f,"")},async:function(p,x){return this.internalStream(p).accumulate(x)},nodeStream:function(p,x){return this.internalStream(p||"nodebuffer").toNodejsStream(x)},_compressWorker:function(p,x){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var f=this._decompressWorker();return this._dataBinary||(f=f.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(f,p,x)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof _?this._data:new c(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<d.length;h++)s.prototype[d[h]]=m;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,r,i){(function(s){var a,c,l=s.MutationObserver||s.WebKitMutationObserver;if(l){var u=0,_=new l(p),d=s.document.createTextNode("");_.observe(d,{characterData:!0}),a=function(){d.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var x=s.document.createElement("script");x.onreadystatechange=function(){p(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},s.document.documentElement.appendChild(x)}:function(){setTimeout(p,0)};else{var m=new s.MessageChannel;m.port1.onmessage=p,a=function(){m.port2.postMessage(0)}}var h=[];function p(){var x,f;c=!0;for(var g=h.length;g;){for(f=h,h=[],x=-1;++x<g;)f[x]();g=h.length}c=!1}r.exports=function(x){h.push(x)!==1||c||a()}}).call(this,typeof xL<"u"?xL:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,r,i){var s=o("immediate");function a(){}var c={},l=["REJECTED"],u=["FULFILLED"],_=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,g!==a&&x(this,g)}function m(g,y,b){this.promise=g,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function h(g,y,b){s(function(){var v;try{v=y(b)}catch(S){return c.reject(g,S)}v===g?c.reject(g,new TypeError("Cannot resolve promise with itself")):c.resolve(g,v)})}function p(g){var y=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof y=="function")return function(){y.apply(g,arguments)}}function x(g,y){var b=!1;function v(w){b||(b=!0,c.reject(g,w))}function S(w){b||(b=!0,c.resolve(g,w))}var M=f(function(){y(S,v)});M.status==="error"&&v(M.value)}function f(g,y){var b={};try{b.value=g(y),b.status="success"}catch(v){b.status="error",b.value=v}return b}(r.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var y=this.constructor;return this.then(function(b){return y.resolve(g()).then(function(){return b})},function(b){return y.resolve(g()).then(function(){throw b})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,y){if(typeof g!="function"&&this.state===u||typeof y!="function"&&this.state===l)return this;var b=new this.constructor(a);return this.state!==_?h(b,this.state===u?g:y,this.outcome):this.queue.push(new m(b,g,y)),b},m.prototype.callFulfilled=function(g){c.resolve(this.promise,g)},m.prototype.otherCallFulfilled=function(g){h(this.promise,this.onFulfilled,g)},m.prototype.callRejected=function(g){c.reject(this.promise,g)},m.prototype.otherCallRejected=function(g){h(this.promise,this.onRejected,g)},c.resolve=function(g,y){var b=f(p,y);if(b.status==="error")return c.reject(g,b.value);var v=b.value;if(v)x(g,v);else{g.state=u,g.outcome=y;for(var S=-1,M=g.queue.length;++S<M;)g.queue[S].callFulfilled(y)}return g},c.reject=function(g,y){g.state=l,g.outcome=y;for(var b=-1,v=g.queue.length;++b<v;)g.queue[b].callRejected(y);return g},d.resolve=function(g){return g instanceof this?g:c.resolve(new this(a),g)},d.reject=function(g){var y=new this(a);return c.reject(y,g)},d.all=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,v=!1;if(!b)return this.resolve([]);for(var S=new Array(b),M=0,w=-1,D=new this(a);++w<b;)A(g[w],w);return D;function A(I,H){y.resolve(I).then(function(O){S[H]=O,++M!==b||v||(v=!0,c.resolve(D,S))},function(O){v||(v=!0,c.reject(D,O))})}},d.race=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,v=!1;if(!b)return this.resolve([]);for(var S=-1,M=new this(a);++S<b;)w=g[S],y.resolve(w).then(function(D){v||(v=!0,c.resolve(M,D))},function(D){v||(v=!0,c.reject(M,D))});var w;return M}},{immediate:36}],38:[function(o,r,i){var s={};(0,o("./lib/utils/common").assign)(s,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,r,i){var s=o("./zlib/deflate"),a=o("./utils/common"),c=o("./utils/strings"),l=o("./zlib/messages"),u=o("./zlib/zstream"),_=Object.prototype.toString,d=0,m=-1,h=0,p=8;function x(g){if(!(this instanceof x))return new x(g);this.options=a.assign({level:m,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},g||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=s.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(b!==d)throw new Error(l[b]);if(y.header&&s.deflateSetHeader(this.strm,y.header),y.dictionary){var v;if(v=typeof y.dictionary=="string"?c.string2buf(y.dictionary):_.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(b=s.deflateSetDictionary(this.strm,v))!==d)throw new Error(l[b]);this._dict_set=!0}}function f(g,y){var b=new x(y);if(b.push(g,!0),b.err)throw b.msg||l[b.err];return b.result}x.prototype.push=function(g,y){var b,v,S=this.strm,M=this.options.chunkSize;if(this.ended)return!1;v=y===~~y?y:y===!0?4:0,typeof g=="string"?S.input=c.string2buf(g):_.call(g)==="[object ArrayBuffer]"?S.input=new Uint8Array(g):S.input=g,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(M),S.next_out=0,S.avail_out=M),(b=s.deflate(S,v))!==1&&b!==d)return this.onEnd(b),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||v!==4&&v!==2)||(this.options.to==="string"?this.onData(c.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&b!==1);return v===4?(b=s.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===d):v!==2||(this.onEnd(d),!(S.avail_out=0))},x.prototype.onData=function(g){this.chunks.push(g)},x.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},i.Deflate=x,i.deflate=f,i.deflateRaw=function(g,y){return(y=y||{}).raw=!0,f(g,y)},i.gzip=function(g,y){return(y=y||{}).gzip=!0,f(g,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,r,i){var s=o("./zlib/inflate"),a=o("./utils/common"),c=o("./utils/strings"),l=o("./zlib/constants"),u=o("./zlib/messages"),_=o("./zlib/zstream"),d=o("./zlib/gzheader"),m=Object.prototype.toString;function h(x){if(!(this instanceof h))return new h(x);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},x||{});var f=this.options;f.raw&&0<=f.windowBits&&f.windowBits<16&&(f.windowBits=-f.windowBits,f.windowBits===0&&(f.windowBits=-15)),!(0<=f.windowBits&&f.windowBits<16)||x&&x.windowBits||(f.windowBits+=32),15<f.windowBits&&f.windowBits<48&&(15&f.windowBits)==0&&(f.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var g=s.inflateInit2(this.strm,f.windowBits);if(g!==l.Z_OK)throw new Error(u[g]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function p(x,f){var g=new h(f);if(g.push(x,!0),g.err)throw g.msg||u[g.err];return g.result}h.prototype.push=function(x,f){var g,y,b,v,S,M,w=this.strm,D=this.options.chunkSize,A=this.options.dictionary,I=!1;if(this.ended)return!1;y=f===~~f?f:f===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof x=="string"?w.input=c.binstring2buf(x):m.call(x)==="[object ArrayBuffer]"?w.input=new Uint8Array(x):w.input=x,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new a.Buf8(D),w.next_out=0,w.avail_out=D),(g=s.inflate(w,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&A&&(M=typeof A=="string"?c.string2buf(A):m.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,g=s.inflateSetDictionary(this.strm,M)),g===l.Z_BUF_ERROR&&I===!0&&(g=l.Z_OK,I=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);w.next_out&&(w.avail_out!==0&&g!==l.Z_STREAM_END&&(w.avail_in!==0||y!==l.Z_FINISH&&y!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=c.utf8border(w.output,w.next_out),v=w.next_out-b,S=c.buf2string(w.output,b),w.next_out=v,w.avail_out=D-v,v&&a.arraySet(w.output,w.output,b,v,0),this.onData(S)):this.onData(a.shrinkBuf(w.output,w.next_out)))),w.avail_in===0&&w.avail_out===0&&(I=!0)}while((0<w.avail_in||w.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(y=l.Z_FINISH),y===l.Z_FINISH?(g=s.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):y!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(w.avail_out=0))},h.prototype.onData=function(x){this.chunks.push(x)},h.prototype.onEnd=function(x){x===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},i.Inflate=h,i.inflate=p,i.inflateRaw=function(x,f){return(f=f||{}).raw=!0,p(x,f)},i.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var _=u.shift();if(_){if(typeof _!="object")throw new TypeError(_+"must be non-object");for(var d in _)_.hasOwnProperty(d)&&(l[d]=_[d])}}return l},i.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var a={arraySet:function(l,u,_,d,m){if(u.subarray&&l.subarray)l.set(u.subarray(_,_+d),m);else for(var h=0;h<d;h++)l[m+h]=u[_+h]},flattenChunks:function(l){var u,_,d,m,h,p;for(u=d=0,_=l.length;u<_;u++)d+=l[u].length;for(p=new Uint8Array(d),u=m=0,_=l.length;u<_;u++)h=l[u],p.set(h,m),m+=h.length;return p}},c={arraySet:function(l,u,_,d,m){for(var h=0;h<d;h++)l[m+h]=u[_+h]},flattenChunks:function(l){return[].concat.apply([],l)}};i.setTyped=function(l){l?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,c))},i.setTyped(s)},{}],42:[function(o,r,i){var s=o("./common"),a=!0,c=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{c=!1}for(var l=new s.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function _(d,m){if(m<65537&&(d.subarray&&c||!d.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(d,m));for(var h="",p=0;p<m;p++)h+=String.fromCharCode(d[p]);return h}l[254]=l[254]=1,i.string2buf=function(d){var m,h,p,x,f,g=d.length,y=0;for(x=0;x<g;x++)(64512&(h=d.charCodeAt(x)))==55296&&x+1<g&&(64512&(p=d.charCodeAt(x+1)))==56320&&(h=65536+(h-55296<<10)+(p-56320),x++),y+=h<128?1:h<2048?2:h<65536?3:4;for(m=new s.Buf8(y),x=f=0;f<y;x++)(64512&(h=d.charCodeAt(x)))==55296&&x+1<g&&(64512&(p=d.charCodeAt(x+1)))==56320&&(h=65536+(h-55296<<10)+(p-56320),x++),h<128?m[f++]=h:(h<2048?m[f++]=192|h>>>6:(h<65536?m[f++]=224|h>>>12:(m[f++]=240|h>>>18,m[f++]=128|h>>>12&63),m[f++]=128|h>>>6&63),m[f++]=128|63&h);return m},i.buf2binstring=function(d){return _(d,d.length)},i.binstring2buf=function(d){for(var m=new s.Buf8(d.length),h=0,p=m.length;h<p;h++)m[h]=d.charCodeAt(h);return m},i.buf2string=function(d,m){var h,p,x,f,g=m||d.length,y=new Array(2*g);for(h=p=0;h<g;)if((x=d[h++])<128)y[p++]=x;else if(4<(f=l[x]))y[p++]=65533,h+=f-1;else{for(x&=f===2?31:f===3?15:7;1<f&&h<g;)x=x<<6|63&d[h++],f--;1<f?y[p++]=65533:x<65536?y[p++]=x:(x-=65536,y[p++]=55296|x>>10&1023,y[p++]=56320|1023&x)}return _(y,p)},i.utf8border=function(d,m){var h;for((m=m||d.length)>d.length&&(m=d.length),h=m-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?m:h+l[d[h]]>m?h:m}},{"./common":41}],43:[function(o,r,i){r.exports=function(s,a,c,l){for(var u=65535&s|0,_=s>>>16&65535|0,d=0;c!==0;){for(c-=d=2e3<c?2e3:c;_=_+(u=u+a[l++]|0)|0,--d;);u%=65521,_%=65521}return u|_<<16|0}},{}],44:[function(o,r,i){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(o,r,i){var s=(function(){for(var a,c=[],l=0;l<256;l++){a=l;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;c[l]=a}return c})();r.exports=function(a,c,l,u){var _=s,d=u+l;a^=-1;for(var m=u;m<d;m++)a=a>>>8^_[255&(a^c[m])];return-1^a}},{}],46:[function(o,r,i){var s,a=o("../utils/common"),c=o("./trees"),l=o("./adler32"),u=o("./crc32"),_=o("./messages"),d=0,m=4,h=0,p=-2,x=-1,f=4,g=2,y=8,b=9,v=286,S=30,M=19,w=2*v+1,D=15,A=3,I=258,H=I+A+1,O=42,z=113,V=1,j=2,q=3,K=4;function ne(fe,Ye){return fe.msg=_[Ye],Ye}function ce(fe){return(fe<<1)-(4<fe?9:0)}function ee(fe){for(var Ye=fe.length;0<=--Ye;)fe[Ye]=0}function oe(fe){var Ye=fe.state,Oe=Ye.pending;Oe>fe.avail_out&&(Oe=fe.avail_out),Oe!==0&&(a.arraySet(fe.output,Ye.pending_buf,Ye.pending_out,Oe,fe.next_out),fe.next_out+=Oe,Ye.pending_out+=Oe,fe.total_out+=Oe,fe.avail_out-=Oe,Ye.pending-=Oe,Ye.pending===0&&(Ye.pending_out=0))}function ie(fe,Ye){c._tr_flush_block(fe,0<=fe.block_start?fe.block_start:-1,fe.strstart-fe.block_start,Ye),fe.block_start=fe.strstart,oe(fe.strm)}function ae(fe,Ye){fe.pending_buf[fe.pending++]=Ye}function de(fe,Ye){fe.pending_buf[fe.pending++]=Ye>>>8&255,fe.pending_buf[fe.pending++]=255&Ye}function be(fe,Ye){var Oe,Ne,Ve=fe.max_chain_length,Re=fe.strstart,Pe=fe.prev_length,Ee=fe.nice_match,we=fe.strstart>fe.w_size-H?fe.strstart-(fe.w_size-H):0,ze=fe.window,Ue=fe.w_mask,et=fe.prev,ot=fe.strstart+I,at=ze[Re+Pe-1],lt=ze[Re+Pe];fe.prev_length>=fe.good_match&&(Ve>>=2),Ee>fe.lookahead&&(Ee=fe.lookahead);do if(ze[(Oe=Ye)+Pe]===lt&&ze[Oe+Pe-1]===at&&ze[Oe]===ze[Re]&&ze[++Oe]===ze[Re+1]){Re+=2,Oe++;do;while(ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&ze[++Re]===ze[++Oe]&&Re<ot);if(Ne=I-(ot-Re),Re=ot-I,Pe<Ne){if(fe.match_start=Ye,Ee<=(Pe=Ne))break;at=ze[Re+Pe-1],lt=ze[Re+Pe]}}while((Ye=et[Ye&Ue])>we&&--Ve!=0);return Pe<=fe.lookahead?Pe:fe.lookahead}function Ce(fe){var Ye,Oe,Ne,Ve,Re,Pe,Ee,we,ze,Ue,et=fe.w_size;do{if(Ve=fe.window_size-fe.lookahead-fe.strstart,fe.strstart>=et+(et-H)){for(a.arraySet(fe.window,fe.window,et,et,0),fe.match_start-=et,fe.strstart-=et,fe.block_start-=et,Ye=Oe=fe.hash_size;Ne=fe.head[--Ye],fe.head[Ye]=et<=Ne?Ne-et:0,--Oe;);for(Ye=Oe=et;Ne=fe.prev[--Ye],fe.prev[Ye]=et<=Ne?Ne-et:0,--Oe;);Ve+=et}if(fe.strm.avail_in===0)break;if(Pe=fe.strm,Ee=fe.window,we=fe.strstart+fe.lookahead,ze=Ve,Ue=void 0,Ue=Pe.avail_in,ze<Ue&&(Ue=ze),Oe=Ue===0?0:(Pe.avail_in-=Ue,a.arraySet(Ee,Pe.input,Pe.next_in,Ue,we),Pe.state.wrap===1?Pe.adler=l(Pe.adler,Ee,Ue,we):Pe.state.wrap===2&&(Pe.adler=u(Pe.adler,Ee,Ue,we)),Pe.next_in+=Ue,Pe.total_in+=Ue,Ue),fe.lookahead+=Oe,fe.lookahead+fe.insert>=A)for(Re=fe.strstart-fe.insert,fe.ins_h=fe.window[Re],fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[Re+1])&fe.hash_mask;fe.insert&&(fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[Re+A-1])&fe.hash_mask,fe.prev[Re&fe.w_mask]=fe.head[fe.ins_h],fe.head[fe.ins_h]=Re,Re++,fe.insert--,!(fe.lookahead+fe.insert<A)););}while(fe.lookahead<H&&fe.strm.avail_in!==0)}function De(fe,Ye){for(var Oe,Ne;;){if(fe.lookahead<H){if(Ce(fe),fe.lookahead<H&&Ye===d)return V;if(fe.lookahead===0)break}if(Oe=0,fe.lookahead>=A&&(fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[fe.strstart+A-1])&fe.hash_mask,Oe=fe.prev[fe.strstart&fe.w_mask]=fe.head[fe.ins_h],fe.head[fe.ins_h]=fe.strstart),Oe!==0&&fe.strstart-Oe<=fe.w_size-H&&(fe.match_length=be(fe,Oe)),fe.match_length>=A)if(Ne=c._tr_tally(fe,fe.strstart-fe.match_start,fe.match_length-A),fe.lookahead-=fe.match_length,fe.match_length<=fe.max_lazy_match&&fe.lookahead>=A){for(fe.match_length--;fe.strstart++,fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[fe.strstart+A-1])&fe.hash_mask,Oe=fe.prev[fe.strstart&fe.w_mask]=fe.head[fe.ins_h],fe.head[fe.ins_h]=fe.strstart,--fe.match_length!=0;);fe.strstart++}else fe.strstart+=fe.match_length,fe.match_length=0,fe.ins_h=fe.window[fe.strstart],fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[fe.strstart+1])&fe.hash_mask;else Ne=c._tr_tally(fe,0,fe.window[fe.strstart]),fe.lookahead--,fe.strstart++;if(Ne&&(ie(fe,!1),fe.strm.avail_out===0))return V}return fe.insert=fe.strstart<A-1?fe.strstart:A-1,Ye===m?(ie(fe,!0),fe.strm.avail_out===0?q:K):fe.last_lit&&(ie(fe,!1),fe.strm.avail_out===0)?V:j}function pe(fe,Ye){for(var Oe,Ne,Ve;;){if(fe.lookahead<H){if(Ce(fe),fe.lookahead<H&&Ye===d)return V;if(fe.lookahead===0)break}if(Oe=0,fe.lookahead>=A&&(fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[fe.strstart+A-1])&fe.hash_mask,Oe=fe.prev[fe.strstart&fe.w_mask]=fe.head[fe.ins_h],fe.head[fe.ins_h]=fe.strstart),fe.prev_length=fe.match_length,fe.prev_match=fe.match_start,fe.match_length=A-1,Oe!==0&&fe.prev_length<fe.max_lazy_match&&fe.strstart-Oe<=fe.w_size-H&&(fe.match_length=be(fe,Oe),fe.match_length<=5&&(fe.strategy===1||fe.match_length===A&&4096<fe.strstart-fe.match_start)&&(fe.match_length=A-1)),fe.prev_length>=A&&fe.match_length<=fe.prev_length){for(Ve=fe.strstart+fe.lookahead-A,Ne=c._tr_tally(fe,fe.strstart-1-fe.prev_match,fe.prev_length-A),fe.lookahead-=fe.prev_length-1,fe.prev_length-=2;++fe.strstart<=Ve&&(fe.ins_h=(fe.ins_h<<fe.hash_shift^fe.window[fe.strstart+A-1])&fe.hash_mask,Oe=fe.prev[fe.strstart&fe.w_mask]=fe.head[fe.ins_h],fe.head[fe.ins_h]=fe.strstart),--fe.prev_length!=0;);if(fe.match_available=0,fe.match_length=A-1,fe.strstart++,Ne&&(ie(fe,!1),fe.strm.avail_out===0))return V}else if(fe.match_available){if((Ne=c._tr_tally(fe,0,fe.window[fe.strstart-1]))&&ie(fe,!1),fe.strstart++,fe.lookahead--,fe.strm.avail_out===0)return V}else fe.match_available=1,fe.strstart++,fe.lookahead--}return fe.match_available&&(Ne=c._tr_tally(fe,0,fe.window[fe.strstart-1]),fe.match_available=0),fe.insert=fe.strstart<A-1?fe.strstart:A-1,Ye===m?(ie(fe,!0),fe.strm.avail_out===0?q:K):fe.last_lit&&(ie(fe,!1),fe.strm.avail_out===0)?V:j}function Me(fe,Ye,Oe,Ne,Ve){this.good_length=fe,this.max_lazy=Ye,this.nice_length=Oe,this.max_chain=Ne,this.func=Ve}function xe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*w),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*M+1)),ee(this.dyn_ltree),ee(this.dyn_dtree),ee(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(D+1),this.heap=new a.Buf16(2*v+1),ee(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*v+1),ee(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function We(fe){var Ye;return fe&&fe.state?(fe.total_in=fe.total_out=0,fe.data_type=g,(Ye=fe.state).pending=0,Ye.pending_out=0,Ye.wrap<0&&(Ye.wrap=-Ye.wrap),Ye.status=Ye.wrap?O:z,fe.adler=Ye.wrap===2?0:1,Ye.last_flush=d,c._tr_init(Ye),h):ne(fe,p)}function Xe(fe){var Ye=We(fe);return Ye===h&&(function(Oe){Oe.window_size=2*Oe.w_size,ee(Oe.head),Oe.max_lazy_match=s[Oe.level].max_lazy,Oe.good_match=s[Oe.level].good_length,Oe.nice_match=s[Oe.level].nice_length,Oe.max_chain_length=s[Oe.level].max_chain,Oe.strstart=0,Oe.block_start=0,Oe.lookahead=0,Oe.insert=0,Oe.match_length=Oe.prev_length=A-1,Oe.match_available=0,Oe.ins_h=0})(fe.state),Ye}function Je(fe,Ye,Oe,Ne,Ve,Re){if(!fe)return p;var Pe=1;if(Ye===x&&(Ye=6),Ne<0?(Pe=0,Ne=-Ne):15<Ne&&(Pe=2,Ne-=16),Ve<1||b<Ve||Oe!==y||Ne<8||15<Ne||Ye<0||9<Ye||Re<0||f<Re)return ne(fe,p);Ne===8&&(Ne=9);var Ee=new xe;return(fe.state=Ee).strm=fe,Ee.wrap=Pe,Ee.gzhead=null,Ee.w_bits=Ne,Ee.w_size=1<<Ee.w_bits,Ee.w_mask=Ee.w_size-1,Ee.hash_bits=Ve+7,Ee.hash_size=1<<Ee.hash_bits,Ee.hash_mask=Ee.hash_size-1,Ee.hash_shift=~~((Ee.hash_bits+A-1)/A),Ee.window=new a.Buf8(2*Ee.w_size),Ee.head=new a.Buf16(Ee.hash_size),Ee.prev=new a.Buf16(Ee.w_size),Ee.lit_bufsize=1<<Ve+6,Ee.pending_buf_size=4*Ee.lit_bufsize,Ee.pending_buf=new a.Buf8(Ee.pending_buf_size),Ee.d_buf=1*Ee.lit_bufsize,Ee.l_buf=3*Ee.lit_bufsize,Ee.level=Ye,Ee.strategy=Re,Ee.method=Oe,Xe(fe)}s=[new Me(0,0,0,0,function(fe,Ye){var Oe=65535;for(Oe>fe.pending_buf_size-5&&(Oe=fe.pending_buf_size-5);;){if(fe.lookahead<=1){if(Ce(fe),fe.lookahead===0&&Ye===d)return V;if(fe.lookahead===0)break}fe.strstart+=fe.lookahead,fe.lookahead=0;var Ne=fe.block_start+Oe;if((fe.strstart===0||fe.strstart>=Ne)&&(fe.lookahead=fe.strstart-Ne,fe.strstart=Ne,ie(fe,!1),fe.strm.avail_out===0)||fe.strstart-fe.block_start>=fe.w_size-H&&(ie(fe,!1),fe.strm.avail_out===0))return V}return fe.insert=0,Ye===m?(ie(fe,!0),fe.strm.avail_out===0?q:K):(fe.strstart>fe.block_start&&(ie(fe,!1),fe.strm.avail_out),V)}),new Me(4,4,8,4,De),new Me(4,5,16,8,De),new Me(4,6,32,32,De),new Me(4,4,16,16,pe),new Me(8,16,32,32,pe),new Me(8,16,128,128,pe),new Me(8,32,128,256,pe),new Me(32,128,258,1024,pe),new Me(32,258,258,4096,pe)],i.deflateInit=function(fe,Ye){return Je(fe,Ye,y,15,8,0)},i.deflateInit2=Je,i.deflateReset=Xe,i.deflateResetKeep=We,i.deflateSetHeader=function(fe,Ye){return fe&&fe.state?fe.state.wrap!==2?p:(fe.state.gzhead=Ye,h):p},i.deflate=function(fe,Ye){var Oe,Ne,Ve,Re;if(!fe||!fe.state||5<Ye||Ye<0)return fe?ne(fe,p):p;if(Ne=fe.state,!fe.output||!fe.input&&fe.avail_in!==0||Ne.status===666&&Ye!==m)return ne(fe,fe.avail_out===0?-5:p);if(Ne.strm=fe,Oe=Ne.last_flush,Ne.last_flush=Ye,Ne.status===O)if(Ne.wrap===2)fe.adler=0,ae(Ne,31),ae(Ne,139),ae(Ne,8),Ne.gzhead?(ae(Ne,(Ne.gzhead.text?1:0)+(Ne.gzhead.hcrc?2:0)+(Ne.gzhead.extra?4:0)+(Ne.gzhead.name?8:0)+(Ne.gzhead.comment?16:0)),ae(Ne,255&Ne.gzhead.time),ae(Ne,Ne.gzhead.time>>8&255),ae(Ne,Ne.gzhead.time>>16&255),ae(Ne,Ne.gzhead.time>>24&255),ae(Ne,Ne.level===9?2:2<=Ne.strategy||Ne.level<2?4:0),ae(Ne,255&Ne.gzhead.os),Ne.gzhead.extra&&Ne.gzhead.extra.length&&(ae(Ne,255&Ne.gzhead.extra.length),ae(Ne,Ne.gzhead.extra.length>>8&255)),Ne.gzhead.hcrc&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending,0)),Ne.gzindex=0,Ne.status=69):(ae(Ne,0),ae(Ne,0),ae(Ne,0),ae(Ne,0),ae(Ne,0),ae(Ne,Ne.level===9?2:2<=Ne.strategy||Ne.level<2?4:0),ae(Ne,3),Ne.status=z);else{var Pe=y+(Ne.w_bits-8<<4)<<8;Pe|=(2<=Ne.strategy||Ne.level<2?0:Ne.level<6?1:Ne.level===6?2:3)<<6,Ne.strstart!==0&&(Pe|=32),Pe+=31-Pe%31,Ne.status=z,de(Ne,Pe),Ne.strstart!==0&&(de(Ne,fe.adler>>>16),de(Ne,65535&fe.adler)),fe.adler=1}if(Ne.status===69)if(Ne.gzhead.extra){for(Ve=Ne.pending;Ne.gzindex<(65535&Ne.gzhead.extra.length)&&(Ne.pending!==Ne.pending_buf_size||(Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),oe(fe),Ve=Ne.pending,Ne.pending!==Ne.pending_buf_size));)ae(Ne,255&Ne.gzhead.extra[Ne.gzindex]),Ne.gzindex++;Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),Ne.gzindex===Ne.gzhead.extra.length&&(Ne.gzindex=0,Ne.status=73)}else Ne.status=73;if(Ne.status===73)if(Ne.gzhead.name){Ve=Ne.pending;do{if(Ne.pending===Ne.pending_buf_size&&(Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),oe(fe),Ve=Ne.pending,Ne.pending===Ne.pending_buf_size)){Re=1;break}Re=Ne.gzindex<Ne.gzhead.name.length?255&Ne.gzhead.name.charCodeAt(Ne.gzindex++):0,ae(Ne,Re)}while(Re!==0);Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),Re===0&&(Ne.gzindex=0,Ne.status=91)}else Ne.status=91;if(Ne.status===91)if(Ne.gzhead.comment){Ve=Ne.pending;do{if(Ne.pending===Ne.pending_buf_size&&(Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),oe(fe),Ve=Ne.pending,Ne.pending===Ne.pending_buf_size)){Re=1;break}Re=Ne.gzindex<Ne.gzhead.comment.length?255&Ne.gzhead.comment.charCodeAt(Ne.gzindex++):0,ae(Ne,Re)}while(Re!==0);Ne.gzhead.hcrc&&Ne.pending>Ve&&(fe.adler=u(fe.adler,Ne.pending_buf,Ne.pending-Ve,Ve)),Re===0&&(Ne.status=103)}else Ne.status=103;if(Ne.status===103&&(Ne.gzhead.hcrc?(Ne.pending+2>Ne.pending_buf_size&&oe(fe),Ne.pending+2<=Ne.pending_buf_size&&(ae(Ne,255&fe.adler),ae(Ne,fe.adler>>8&255),fe.adler=0,Ne.status=z)):Ne.status=z),Ne.pending!==0){if(oe(fe),fe.avail_out===0)return Ne.last_flush=-1,h}else if(fe.avail_in===0&&ce(Ye)<=ce(Oe)&&Ye!==m)return ne(fe,-5);if(Ne.status===666&&fe.avail_in!==0)return ne(fe,-5);if(fe.avail_in!==0||Ne.lookahead!==0||Ye!==d&&Ne.status!==666){var Ee=Ne.strategy===2?(function(we,ze){for(var Ue;;){if(we.lookahead===0&&(Ce(we),we.lookahead===0)){if(ze===d)return V;break}if(we.match_length=0,Ue=c._tr_tally(we,0,we.window[we.strstart]),we.lookahead--,we.strstart++,Ue&&(ie(we,!1),we.strm.avail_out===0))return V}return we.insert=0,ze===m?(ie(we,!0),we.strm.avail_out===0?q:K):we.last_lit&&(ie(we,!1),we.strm.avail_out===0)?V:j})(Ne,Ye):Ne.strategy===3?(function(we,ze){for(var Ue,et,ot,at,lt=we.window;;){if(we.lookahead<=I){if(Ce(we),we.lookahead<=I&&ze===d)return V;if(we.lookahead===0)break}if(we.match_length=0,we.lookahead>=A&&0<we.strstart&&(et=lt[ot=we.strstart-1])===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]){at=we.strstart+I;do;while(et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&et===lt[++ot]&&ot<at);we.match_length=I-(at-ot),we.match_length>we.lookahead&&(we.match_length=we.lookahead)}if(we.match_length>=A?(Ue=c._tr_tally(we,1,we.match_length-A),we.lookahead-=we.match_length,we.strstart+=we.match_length,we.match_length=0):(Ue=c._tr_tally(we,0,we.window[we.strstart]),we.lookahead--,we.strstart++),Ue&&(ie(we,!1),we.strm.avail_out===0))return V}return we.insert=0,ze===m?(ie(we,!0),we.strm.avail_out===0?q:K):we.last_lit&&(ie(we,!1),we.strm.avail_out===0)?V:j})(Ne,Ye):s[Ne.level].func(Ne,Ye);if(Ee!==q&&Ee!==K||(Ne.status=666),Ee===V||Ee===q)return fe.avail_out===0&&(Ne.last_flush=-1),h;if(Ee===j&&(Ye===1?c._tr_align(Ne):Ye!==5&&(c._tr_stored_block(Ne,0,0,!1),Ye===3&&(ee(Ne.head),Ne.lookahead===0&&(Ne.strstart=0,Ne.block_start=0,Ne.insert=0))),oe(fe),fe.avail_out===0))return Ne.last_flush=-1,h}return Ye!==m?h:Ne.wrap<=0?1:(Ne.wrap===2?(ae(Ne,255&fe.adler),ae(Ne,fe.adler>>8&255),ae(Ne,fe.adler>>16&255),ae(Ne,fe.adler>>24&255),ae(Ne,255&fe.total_in),ae(Ne,fe.total_in>>8&255),ae(Ne,fe.total_in>>16&255),ae(Ne,fe.total_in>>24&255)):(de(Ne,fe.adler>>>16),de(Ne,65535&fe.adler)),oe(fe),0<Ne.wrap&&(Ne.wrap=-Ne.wrap),Ne.pending!==0?h:1)},i.deflateEnd=function(fe){var Ye;return fe&&fe.state?(Ye=fe.state.status)!==O&&Ye!==69&&Ye!==73&&Ye!==91&&Ye!==103&&Ye!==z&&Ye!==666?ne(fe,p):(fe.state=null,Ye===z?ne(fe,-3):h):p},i.deflateSetDictionary=function(fe,Ye){var Oe,Ne,Ve,Re,Pe,Ee,we,ze,Ue=Ye.length;if(!fe||!fe.state||(Re=(Oe=fe.state).wrap)===2||Re===1&&Oe.status!==O||Oe.lookahead)return p;for(Re===1&&(fe.adler=l(fe.adler,Ye,Ue,0)),Oe.wrap=0,Ue>=Oe.w_size&&(Re===0&&(ee(Oe.head),Oe.strstart=0,Oe.block_start=0,Oe.insert=0),ze=new a.Buf8(Oe.w_size),a.arraySet(ze,Ye,Ue-Oe.w_size,Oe.w_size,0),Ye=ze,Ue=Oe.w_size),Pe=fe.avail_in,Ee=fe.next_in,we=fe.input,fe.avail_in=Ue,fe.next_in=0,fe.input=Ye,Ce(Oe);Oe.lookahead>=A;){for(Ne=Oe.strstart,Ve=Oe.lookahead-(A-1);Oe.ins_h=(Oe.ins_h<<Oe.hash_shift^Oe.window[Ne+A-1])&Oe.hash_mask,Oe.prev[Ne&Oe.w_mask]=Oe.head[Oe.ins_h],Oe.head[Oe.ins_h]=Ne,Ne++,--Ve;);Oe.strstart=Ne,Oe.lookahead=A-1,Ce(Oe)}return Oe.strstart+=Oe.lookahead,Oe.block_start=Oe.strstart,Oe.insert=Oe.lookahead,Oe.lookahead=0,Oe.match_length=Oe.prev_length=A-1,Oe.match_available=0,fe.next_in=Ee,fe.input=we,fe.avail_in=Pe,Oe.wrap=Re,h},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,r,i){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(o,r,i){r.exports=function(s,a){var c,l,u,_,d,m,h,p,x,f,g,y,b,v,S,M,w,D,A,I,H,O,z,V,j;c=s.state,l=s.next_in,V=s.input,u=l+(s.avail_in-5),_=s.next_out,j=s.output,d=_-(a-s.avail_out),m=_+(s.avail_out-257),h=c.dmax,p=c.wsize,x=c.whave,f=c.wnext,g=c.window,y=c.hold,b=c.bits,v=c.lencode,S=c.distcode,M=(1<<c.lenbits)-1,w=(1<<c.distbits)-1;e:do{b<15&&(y+=V[l++]<<b,b+=8,y+=V[l++]<<b,b+=8),D=v[y&M];t:for(;;){if(y>>>=A=D>>>24,b-=A,(A=D>>>16&255)===0)j[_++]=65535&D;else{if(!(16&A)){if((64&A)==0){D=v[(65535&D)+(y&(1<<A)-1)];continue t}if(32&A){c.mode=12;break e}s.msg="invalid literal/length code",c.mode=30;break e}I=65535&D,(A&=15)&&(b<A&&(y+=V[l++]<<b,b+=8),I+=y&(1<<A)-1,y>>>=A,b-=A),b<15&&(y+=V[l++]<<b,b+=8,y+=V[l++]<<b,b+=8),D=S[y&w];n:for(;;){if(y>>>=A=D>>>24,b-=A,!(16&(A=D>>>16&255))){if((64&A)==0){D=S[(65535&D)+(y&(1<<A)-1)];continue n}s.msg="invalid distance code",c.mode=30;break e}if(H=65535&D,b<(A&=15)&&(y+=V[l++]<<b,(b+=8)<A&&(y+=V[l++]<<b,b+=8)),h<(H+=y&(1<<A)-1)){s.msg="invalid distance too far back",c.mode=30;break e}if(y>>>=A,b-=A,(A=_-d)<H){if(x<(A=H-A)&&c.sane){s.msg="invalid distance too far back",c.mode=30;break e}if(z=g,(O=0)===f){if(O+=p-A,A<I){for(I-=A;j[_++]=g[O++],--A;);O=_-H,z=j}}else if(f<A){if(O+=p+f-A,(A-=f)<I){for(I-=A;j[_++]=g[O++],--A;);if(O=0,f<I){for(I-=A=f;j[_++]=g[O++],--A;);O=_-H,z=j}}}else if(O+=f-A,A<I){for(I-=A;j[_++]=g[O++],--A;);O=_-H,z=j}for(;2<I;)j[_++]=z[O++],j[_++]=z[O++],j[_++]=z[O++],I-=3;I&&(j[_++]=z[O++],1<I&&(j[_++]=z[O++]))}else{for(O=_-H;j[_++]=j[O++],j[_++]=j[O++],j[_++]=j[O++],2<(I-=3););I&&(j[_++]=j[O++],1<I&&(j[_++]=j[O++]))}break}}break}}while(l<u&&_<m);l-=I=b>>3,y&=(1<<(b-=I<<3))-1,s.next_in=l,s.next_out=_,s.avail_in=l<u?u-l+5:5-(l-u),s.avail_out=_<m?m-_+257:257-(_-m),c.hold=y,c.bits=b}},{}],49:[function(o,r,i){var s=o("../utils/common"),a=o("./adler32"),c=o("./crc32"),l=o("./inffast"),u=o("./inftrees"),_=1,d=2,m=0,h=-2,p=1,x=852,f=592;function g(O){return(O>>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(O){var z;return O&&O.state?(z=O.state,O.total_in=O.total_out=z.total=0,O.msg="",z.wrap&&(O.adler=1&z.wrap),z.mode=p,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new s.Buf32(x),z.distcode=z.distdyn=new s.Buf32(f),z.sane=1,z.back=-1,m):h}function v(O){var z;return O&&O.state?((z=O.state).wsize=0,z.whave=0,z.wnext=0,b(O)):h}function S(O,z){var V,j;return O&&O.state?(j=O.state,z<0?(V=0,z=-z):(V=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15<z)?h:(j.window!==null&&j.wbits!==z&&(j.window=null),j.wrap=V,j.wbits=z,v(O))):h}function M(O,z){var V,j;return O?(j=new y,(O.state=j).window=null,(V=S(O,z))!==m&&(O.state=null),V):h}var w,D,A=!0;function I(O){if(A){var z;for(w=new s.Buf32(512),D=new s.Buf32(32),z=0;z<144;)O.lens[z++]=8;for(;z<256;)O.lens[z++]=9;for(;z<280;)O.lens[z++]=7;for(;z<288;)O.lens[z++]=8;for(u(_,O.lens,0,288,w,0,O.work,{bits:9}),z=0;z<32;)O.lens[z++]=5;u(d,O.lens,0,32,D,0,O.work,{bits:5}),A=!1}O.lencode=w,O.lenbits=9,O.distcode=D,O.distbits=5}function H(O,z,V,j){var q,K=O.state;return K.window===null&&(K.wsize=1<<K.wbits,K.wnext=0,K.whave=0,K.window=new s.Buf8(K.wsize)),j>=K.wsize?(s.arraySet(K.window,z,V-K.wsize,K.wsize,0),K.wnext=0,K.whave=K.wsize):(j<(q=K.wsize-K.wnext)&&(q=j),s.arraySet(K.window,z,V-j,q,K.wnext),(j-=q)?(s.arraySet(K.window,z,V-j,j,0),K.wnext=j,K.whave=K.wsize):(K.wnext+=q,K.wnext===K.wsize&&(K.wnext=0),K.whave<K.wsize&&(K.whave+=q))),0}i.inflateReset=v,i.inflateReset2=S,i.inflateResetKeep=b,i.inflateInit=function(O){return M(O,15)},i.inflateInit2=M,i.inflate=function(O,z){var V,j,q,K,ne,ce,ee,oe,ie,ae,de,be,Ce,De,pe,Me,xe,We,Xe,Je,fe,Ye,Oe,Ne,Ve=0,Re=new s.Buf8(4),Pe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!O||!O.state||!O.output||!O.input&&O.avail_in!==0)return h;(V=O.state).mode===12&&(V.mode=13),ne=O.next_out,q=O.output,ee=O.avail_out,K=O.next_in,j=O.input,ce=O.avail_in,oe=V.hold,ie=V.bits,ae=ce,de=ee,Ye=m;e:for(;;)switch(V.mode){case p:if(V.wrap===0){V.mode=13;break}for(;ie<16;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(2&V.wrap&&oe===35615){Re[V.check=0]=255&oe,Re[1]=oe>>>8&255,V.check=c(V.check,Re,2,0),ie=oe=0,V.mode=2;break}if(V.flags=0,V.head&&(V.head.done=!1),!(1&V.wrap)||(((255&oe)<<8)+(oe>>8))%31){O.msg="incorrect header check",V.mode=30;break}if((15&oe)!=8){O.msg="unknown compression method",V.mode=30;break}if(ie-=4,fe=8+(15&(oe>>>=4)),V.wbits===0)V.wbits=fe;else if(fe>V.wbits){O.msg="invalid window size",V.mode=30;break}V.dmax=1<<fe,O.adler=V.check=1,V.mode=512&oe?10:12,ie=oe=0;break;case 2:for(;ie<16;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(V.flags=oe,(255&V.flags)!=8){O.msg="unknown compression method",V.mode=30;break}if(57344&V.flags){O.msg="unknown header flags set",V.mode=30;break}V.head&&(V.head.text=oe>>8&1),512&V.flags&&(Re[0]=255&oe,Re[1]=oe>>>8&255,V.check=c(V.check,Re,2,0)),ie=oe=0,V.mode=3;case 3:for(;ie<32;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.head&&(V.head.time=oe),512&V.flags&&(Re[0]=255&oe,Re[1]=oe>>>8&255,Re[2]=oe>>>16&255,Re[3]=oe>>>24&255,V.check=c(V.check,Re,4,0)),ie=oe=0,V.mode=4;case 4:for(;ie<16;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.head&&(V.head.xflags=255&oe,V.head.os=oe>>8),512&V.flags&&(Re[0]=255&oe,Re[1]=oe>>>8&255,V.check=c(V.check,Re,2,0)),ie=oe=0,V.mode=5;case 5:if(1024&V.flags){for(;ie<16;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.length=oe,V.head&&(V.head.extra_len=oe),512&V.flags&&(Re[0]=255&oe,Re[1]=oe>>>8&255,V.check=c(V.check,Re,2,0)),ie=oe=0}else V.head&&(V.head.extra=null);V.mode=6;case 6:if(1024&V.flags&&(ce<(be=V.length)&&(be=ce),be&&(V.head&&(fe=V.head.extra_len-V.length,V.head.extra||(V.head.extra=new Array(V.head.extra_len)),s.arraySet(V.head.extra,j,K,be,fe)),512&V.flags&&(V.check=c(V.check,j,be,K)),ce-=be,K+=be,V.length-=be),V.length))break e;V.length=0,V.mode=7;case 7:if(2048&V.flags){if(ce===0)break e;for(be=0;fe=j[K+be++],V.head&&fe&&V.length<65536&&(V.head.name+=String.fromCharCode(fe)),fe&&be<ce;);if(512&V.flags&&(V.check=c(V.check,j,be,K)),ce-=be,K+=be,fe)break e}else V.head&&(V.head.name=null);V.length=0,V.mode=8;case 8:if(4096&V.flags){if(ce===0)break e;for(be=0;fe=j[K+be++],V.head&&fe&&V.length<65536&&(V.head.comment+=String.fromCharCode(fe)),fe&&be<ce;);if(512&V.flags&&(V.check=c(V.check,j,be,K)),ce-=be,K+=be,fe)break e}else V.head&&(V.head.comment=null);V.mode=9;case 9:if(512&V.flags){for(;ie<16;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(oe!==(65535&V.check)){O.msg="header crc mismatch",V.mode=30;break}ie=oe=0}V.head&&(V.head.hcrc=V.flags>>9&1,V.head.done=!0),O.adler=V.check=0,V.mode=12;break;case 10:for(;ie<32;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}O.adler=V.check=g(oe),ie=oe=0,V.mode=11;case 11:if(V.havedict===0)return O.next_out=ne,O.avail_out=ee,O.next_in=K,O.avail_in=ce,V.hold=oe,V.bits=ie,2;O.adler=V.check=1,V.mode=12;case 12:if(z===5||z===6)break e;case 13:if(V.last){oe>>>=7&ie,ie-=7&ie,V.mode=27;break}for(;ie<3;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}switch(V.last=1&oe,ie-=1,3&(oe>>>=1)){case 0:V.mode=14;break;case 1:if(I(V),V.mode=20,z!==6)break;oe>>>=2,ie-=2;break e;case 2:V.mode=17;break;case 3:O.msg="invalid block type",V.mode=30}oe>>>=2,ie-=2;break;case 14:for(oe>>>=7&ie,ie-=7&ie;ie<32;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if((65535&oe)!=(oe>>>16^65535)){O.msg="invalid stored block lengths",V.mode=30;break}if(V.length=65535&oe,ie=oe=0,V.mode=15,z===6)break e;case 15:V.mode=16;case 16:if(be=V.length){if(ce<be&&(be=ce),ee<be&&(be=ee),be===0)break e;s.arraySet(q,j,K,be,ne),ce-=be,K+=be,ee-=be,ne+=be,V.length-=be;break}V.mode=12;break;case 17:for(;ie<14;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(V.nlen=257+(31&oe),oe>>>=5,ie-=5,V.ndist=1+(31&oe),oe>>>=5,ie-=5,V.ncode=4+(15&oe),oe>>>=4,ie-=4,286<V.nlen||30<V.ndist){O.msg="too many length or distance symbols",V.mode=30;break}V.have=0,V.mode=18;case 18:for(;V.have<V.ncode;){for(;ie<3;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.lens[Pe[V.have++]]=7&oe,oe>>>=3,ie-=3}for(;V.have<19;)V.lens[Pe[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,Oe={bits:V.lenbits},Ye=u(0,V.lens,0,19,V.lencode,0,V.work,Oe),V.lenbits=Oe.bits,Ye){O.msg="invalid code lengths set",V.mode=30;break}V.have=0,V.mode=19;case 19:for(;V.have<V.nlen+V.ndist;){for(;Me=(Ve=V.lencode[oe&(1<<V.lenbits)-1])>>>16&255,xe=65535&Ve,!((pe=Ve>>>24)<=ie);){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(xe<16)oe>>>=pe,ie-=pe,V.lens[V.have++]=xe;else{if(xe===16){for(Ne=pe+2;ie<Ne;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(oe>>>=pe,ie-=pe,V.have===0){O.msg="invalid bit length repeat",V.mode=30;break}fe=V.lens[V.have-1],be=3+(3&oe),oe>>>=2,ie-=2}else if(xe===17){for(Ne=pe+3;ie<Ne;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}ie-=pe,fe=0,be=3+(7&(oe>>>=pe)),oe>>>=3,ie-=3}else{for(Ne=pe+7;ie<Ne;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}ie-=pe,fe=0,be=11+(127&(oe>>>=pe)),oe>>>=7,ie-=7}if(V.have+be>V.nlen+V.ndist){O.msg="invalid bit length repeat",V.mode=30;break}for(;be--;)V.lens[V.have++]=fe}}if(V.mode===30)break;if(V.lens[256]===0){O.msg="invalid code -- missing end-of-block",V.mode=30;break}if(V.lenbits=9,Oe={bits:V.lenbits},Ye=u(_,V.lens,0,V.nlen,V.lencode,0,V.work,Oe),V.lenbits=Oe.bits,Ye){O.msg="invalid literal/lengths set",V.mode=30;break}if(V.distbits=6,V.distcode=V.distdyn,Oe={bits:V.distbits},Ye=u(d,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,Oe),V.distbits=Oe.bits,Ye){O.msg="invalid distances set",V.mode=30;break}if(V.mode=20,z===6)break e;case 20:V.mode=21;case 21:if(6<=ce&&258<=ee){O.next_out=ne,O.avail_out=ee,O.next_in=K,O.avail_in=ce,V.hold=oe,V.bits=ie,l(O,de),ne=O.next_out,q=O.output,ee=O.avail_out,K=O.next_in,j=O.input,ce=O.avail_in,oe=V.hold,ie=V.bits,V.mode===12&&(V.back=-1);break}for(V.back=0;Me=(Ve=V.lencode[oe&(1<<V.lenbits)-1])>>>16&255,xe=65535&Ve,!((pe=Ve>>>24)<=ie);){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(Me&&(240&Me)==0){for(We=pe,Xe=Me,Je=xe;Me=(Ve=V.lencode[Je+((oe&(1<<We+Xe)-1)>>We)])>>>16&255,xe=65535&Ve,!(We+(pe=Ve>>>24)<=ie);){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}oe>>>=We,ie-=We,V.back+=We}if(oe>>>=pe,ie-=pe,V.back+=pe,V.length=xe,Me===0){V.mode=26;break}if(32&Me){V.back=-1,V.mode=12;break}if(64&Me){O.msg="invalid literal/length code",V.mode=30;break}V.extra=15&Me,V.mode=22;case 22:if(V.extra){for(Ne=V.extra;ie<Ne;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.length+=oe&(1<<V.extra)-1,oe>>>=V.extra,ie-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=23;case 23:for(;Me=(Ve=V.distcode[oe&(1<<V.distbits)-1])>>>16&255,xe=65535&Ve,!((pe=Ve>>>24)<=ie);){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if((240&Me)==0){for(We=pe,Xe=Me,Je=xe;Me=(Ve=V.distcode[Je+((oe&(1<<We+Xe)-1)>>We)])>>>16&255,xe=65535&Ve,!(We+(pe=Ve>>>24)<=ie);){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}oe>>>=We,ie-=We,V.back+=We}if(oe>>>=pe,ie-=pe,V.back+=pe,64&Me){O.msg="invalid distance code",V.mode=30;break}V.offset=xe,V.extra=15&Me,V.mode=24;case 24:if(V.extra){for(Ne=V.extra;ie<Ne;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}V.offset+=oe&(1<<V.extra)-1,oe>>>=V.extra,ie-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){O.msg="invalid distance too far back",V.mode=30;break}V.mode=25;case 25:if(ee===0)break e;if(be=de-ee,V.offset>be){if((be=V.offset-be)>V.whave&&V.sane){O.msg="invalid distance too far back",V.mode=30;break}Ce=be>V.wnext?(be-=V.wnext,V.wsize-be):V.wnext-be,be>V.length&&(be=V.length),De=V.window}else De=q,Ce=ne-V.offset,be=V.length;for(ee<be&&(be=ee),ee-=be,V.length-=be;q[ne++]=De[Ce++],--be;);V.length===0&&(V.mode=21);break;case 26:if(ee===0)break e;q[ne++]=V.length,ee--,V.mode=21;break;case 27:if(V.wrap){for(;ie<32;){if(ce===0)break e;ce--,oe|=j[K++]<<ie,ie+=8}if(de-=ee,O.total_out+=de,V.total+=de,de&&(O.adler=V.check=V.flags?c(V.check,q,de,ne-de):a(V.check,q,de,ne-de)),de=ee,(V.flags?oe:g(oe))!==V.check){O.msg="incorrect data check",V.mode=30;break}ie=oe=0}V.mode=28;case 28:if(V.wrap&&V.flags){for(;ie<32;){if(ce===0)break e;ce--,oe+=j[K++]<<ie,ie+=8}if(oe!==(4294967295&V.total)){O.msg="incorrect length check",V.mode=30;break}ie=oe=0}V.mode=29;case 29:Ye=1;break e;case 30:Ye=-3;break e;case 31:return-4;default:return h}return O.next_out=ne,O.avail_out=ee,O.next_in=K,O.avail_in=ce,V.hold=oe,V.bits=ie,(V.wsize||de!==O.avail_out&&V.mode<30&&(V.mode<27||z!==4))&&H(O,O.output,O.next_out,de-O.avail_out)?(V.mode=31,-4):(ae-=O.avail_in,de-=O.avail_out,O.total_in+=ae,O.total_out+=de,V.total+=de,V.wrap&&de&&(O.adler=V.check=V.flags?c(V.check,q,de,O.next_out-de):a(V.check,q,de,O.next_out-de)),O.data_type=V.bits+(V.last?64:0)+(V.mode===12?128:0)+(V.mode===20||V.mode===15?256:0),(ae==0&&de===0||z===4)&&Ye===m&&(Ye=-5),Ye)},i.inflateEnd=function(O){if(!O||!O.state)return h;var z=O.state;return z.window&&(z.window=null),O.state=null,m},i.inflateGetHeader=function(O,z){var V;return O&&O.state?(2&(V=O.state).wrap)==0?h:((V.head=z).done=!1,m):h},i.inflateSetDictionary=function(O,z){var V,j=z.length;return O&&O.state?(V=O.state).wrap!==0&&V.mode!==11?h:V.mode===11&&a(1,z,j,0)!==V.check?-3:H(O,z,j,j)?(V.mode=31,-4):(V.havedict=1,m):h},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,r,i){var s=o("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(_,d,m,h,p,x,f,g){var y,b,v,S,M,w,D,A,I,H=g.bits,O=0,z=0,V=0,j=0,q=0,K=0,ne=0,ce=0,ee=0,oe=0,ie=null,ae=0,de=new s.Buf16(16),be=new s.Buf16(16),Ce=null,De=0;for(O=0;O<=15;O++)de[O]=0;for(z=0;z<h;z++)de[d[m+z]]++;for(q=H,j=15;1<=j&&de[j]===0;j--);if(j<q&&(q=j),j===0)return p[x++]=20971520,p[x++]=20971520,g.bits=1,0;for(V=1;V<j&&de[V]===0;V++);for(q<V&&(q=V),O=ce=1;O<=15;O++)if(ce<<=1,(ce-=de[O])<0)return-1;if(0<ce&&(_===0||j!==1))return-1;for(be[1]=0,O=1;O<15;O++)be[O+1]=be[O]+de[O];for(z=0;z<h;z++)d[m+z]!==0&&(f[be[d[m+z]]++]=z);if(w=_===0?(ie=Ce=f,19):_===1?(ie=a,ae-=257,Ce=c,De-=257,256):(ie=l,Ce=u,-1),O=V,M=x,ne=z=oe=0,v=-1,S=(ee=1<<(K=q))-1,_===1&&852<ee||_===2&&592<ee)return 1;for(;;){for(D=O-ne,I=f[z]<w?(A=0,f[z]):f[z]>w?(A=Ce[De+f[z]],ie[ae+f[z]]):(A=96,0),y=1<<O-ne,V=b=1<<K;p[M+(oe>>ne)+(b-=y)]=D<<24|A<<16|I|0,b!==0;);for(y=1<<O-1;oe&y;)y>>=1;if(y!==0?(oe&=y-1,oe+=y):oe=0,z++,--de[O]==0){if(O===j)break;O=d[m+f[z]]}if(q<O&&(oe&S)!==v){for(ne===0&&(ne=q),M+=V,ce=1<<(K=O-ne);K+ne<j&&!((ce-=de[K+ne])<=0);)K++,ce<<=1;if(ee+=1<<K,_===1&&852<ee||_===2&&592<ee)return 1;p[v=oe&S]=q<<24|K<<16|M-x|0}}return oe!==0&&(p[M+oe]=O-ne<<24|64<<16|0),g.bits=q,0}},{"../utils/common":41}],51:[function(o,r,i){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(o,r,i){var s=o("../utils/common"),a=0,c=1;function l(Ve){for(var Re=Ve.length;0<=--Re;)Ve[Re]=0}var u=0,_=29,d=256,m=d+1+_,h=30,p=19,x=2*m+1,f=15,g=16,y=7,b=256,v=16,S=17,M=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H=new Array(2*(m+2));l(H);var O=new Array(2*h);l(O);var z=new Array(512);l(z);var V=new Array(256);l(V);var j=new Array(_);l(j);var q,K,ne,ce=new Array(h);function ee(Ve,Re,Pe,Ee,we){this.static_tree=Ve,this.extra_bits=Re,this.extra_base=Pe,this.elems=Ee,this.max_length=we,this.has_stree=Ve&&Ve.length}function oe(Ve,Re){this.dyn_tree=Ve,this.max_code=0,this.stat_desc=Re}function ie(Ve){return Ve<256?z[Ve]:z[256+(Ve>>>7)]}function ae(Ve,Re){Ve.pending_buf[Ve.pending++]=255&Re,Ve.pending_buf[Ve.pending++]=Re>>>8&255}function de(Ve,Re,Pe){Ve.bi_valid>g-Pe?(Ve.bi_buf|=Re<<Ve.bi_valid&65535,ae(Ve,Ve.bi_buf),Ve.bi_buf=Re>>g-Ve.bi_valid,Ve.bi_valid+=Pe-g):(Ve.bi_buf|=Re<<Ve.bi_valid&65535,Ve.bi_valid+=Pe)}function be(Ve,Re,Pe){de(Ve,Pe[2*Re],Pe[2*Re+1])}function Ce(Ve,Re){for(var Pe=0;Pe|=1&Ve,Ve>>>=1,Pe<<=1,0<--Re;);return Pe>>>1}function De(Ve,Re,Pe){var Ee,we,ze=new Array(f+1),Ue=0;for(Ee=1;Ee<=f;Ee++)ze[Ee]=Ue=Ue+Pe[Ee-1]<<1;for(we=0;we<=Re;we++){var et=Ve[2*we+1];et!==0&&(Ve[2*we]=Ce(ze[et]++,et))}}function pe(Ve){var Re;for(Re=0;Re<m;Re++)Ve.dyn_ltree[2*Re]=0;for(Re=0;Re<h;Re++)Ve.dyn_dtree[2*Re]=0;for(Re=0;Re<p;Re++)Ve.bl_tree[2*Re]=0;Ve.dyn_ltree[2*b]=1,Ve.opt_len=Ve.static_len=0,Ve.last_lit=Ve.matches=0}function Me(Ve){8<Ve.bi_valid?ae(Ve,Ve.bi_buf):0<Ve.bi_valid&&(Ve.pending_buf[Ve.pending++]=Ve.bi_buf),Ve.bi_buf=0,Ve.bi_valid=0}function xe(Ve,Re,Pe,Ee){var we=2*Re,ze=2*Pe;return Ve[we]<Ve[ze]||Ve[we]===Ve[ze]&&Ee[Re]<=Ee[Pe]}function We(Ve,Re,Pe){for(var Ee=Ve.heap[Pe],we=Pe<<1;we<=Ve.heap_len&&(we<Ve.heap_len&&xe(Re,Ve.heap[we+1],Ve.heap[we],Ve.depth)&&we++,!xe(Re,Ee,Ve.heap[we],Ve.depth));)Ve.heap[Pe]=Ve.heap[we],Pe=we,we<<=1;Ve.heap[Pe]=Ee}function Xe(Ve,Re,Pe){var Ee,we,ze,Ue,et=0;if(Ve.last_lit!==0)for(;Ee=Ve.pending_buf[Ve.d_buf+2*et]<<8|Ve.pending_buf[Ve.d_buf+2*et+1],we=Ve.pending_buf[Ve.l_buf+et],et++,Ee===0?be(Ve,we,Re):(be(Ve,(ze=V[we])+d+1,Re),(Ue=w[ze])!==0&&de(Ve,we-=j[ze],Ue),be(Ve,ze=ie(--Ee),Pe),(Ue=D[ze])!==0&&de(Ve,Ee-=ce[ze],Ue)),et<Ve.last_lit;);be(Ve,b,Re)}function Je(Ve,Re){var Pe,Ee,we,ze=Re.dyn_tree,Ue=Re.stat_desc.static_tree,et=Re.stat_desc.has_stree,ot=Re.stat_desc.elems,at=-1;for(Ve.heap_len=0,Ve.heap_max=x,Pe=0;Pe<ot;Pe++)ze[2*Pe]!==0?(Ve.heap[++Ve.heap_len]=at=Pe,Ve.depth[Pe]=0):ze[2*Pe+1]=0;for(;Ve.heap_len<2;)ze[2*(we=Ve.heap[++Ve.heap_len]=at<2?++at:0)]=1,Ve.depth[we]=0,Ve.opt_len--,et&&(Ve.static_len-=Ue[2*we+1]);for(Re.max_code=at,Pe=Ve.heap_len>>1;1<=Pe;Pe--)We(Ve,ze,Pe);for(we=ot;Pe=Ve.heap[1],Ve.heap[1]=Ve.heap[Ve.heap_len--],We(Ve,ze,1),Ee=Ve.heap[1],Ve.heap[--Ve.heap_max]=Pe,Ve.heap[--Ve.heap_max]=Ee,ze[2*we]=ze[2*Pe]+ze[2*Ee],Ve.depth[we]=(Ve.depth[Pe]>=Ve.depth[Ee]?Ve.depth[Pe]:Ve.depth[Ee])+1,ze[2*Pe+1]=ze[2*Ee+1]=we,Ve.heap[1]=we++,We(Ve,ze,1),2<=Ve.heap_len;);Ve.heap[--Ve.heap_max]=Ve.heap[1],(function(lt,xt){var Ct,Lt,$t,Ot,Dt,Wt,Cn=xt.dyn_tree,ge=xt.max_code,tt=xt.stat_desc.static_tree,ct=xt.stat_desc.has_stree,gt=xt.stat_desc.extra_bits,kt=xt.stat_desc.extra_base,Bt=xt.stat_desc.max_length,nn=0;for(Ot=0;Ot<=f;Ot++)lt.bl_count[Ot]=0;for(Cn[2*lt.heap[lt.heap_max]+1]=0,Ct=lt.heap_max+1;Ct<x;Ct++)Bt<(Ot=Cn[2*Cn[2*(Lt=lt.heap[Ct])+1]+1]+1)&&(Ot=Bt,nn++),Cn[2*Lt+1]=Ot,ge<Lt||(lt.bl_count[Ot]++,Dt=0,kt<=Lt&&(Dt=gt[Lt-kt]),Wt=Cn[2*Lt],lt.opt_len+=Wt*(Ot+Dt),ct&&(lt.static_len+=Wt*(tt[2*Lt+1]+Dt)));if(nn!==0){do{for(Ot=Bt-1;lt.bl_count[Ot]===0;)Ot--;lt.bl_count[Ot]--,lt.bl_count[Ot+1]+=2,lt.bl_count[Bt]--,nn-=2}while(0<nn);for(Ot=Bt;Ot!==0;Ot--)for(Lt=lt.bl_count[Ot];Lt!==0;)ge<($t=lt.heap[--Ct])||(Cn[2*$t+1]!==Ot&&(lt.opt_len+=(Ot-Cn[2*$t+1])*Cn[2*$t],Cn[2*$t+1]=Ot),Lt--)}})(Ve,Re),De(ze,at,Ve.bl_count)}function fe(Ve,Re,Pe){var Ee,we,ze=-1,Ue=Re[1],et=0,ot=7,at=4;for(Ue===0&&(ot=138,at=3),Re[2*(Pe+1)+1]=65535,Ee=0;Ee<=Pe;Ee++)we=Ue,Ue=Re[2*(Ee+1)+1],++et<ot&&we===Ue||(et<at?Ve.bl_tree[2*we]+=et:we!==0?(we!==ze&&Ve.bl_tree[2*we]++,Ve.bl_tree[2*v]++):et<=10?Ve.bl_tree[2*S]++:Ve.bl_tree[2*M]++,ze=we,at=(et=0)===Ue?(ot=138,3):we===Ue?(ot=6,3):(ot=7,4))}function Ye(Ve,Re,Pe){var Ee,we,ze=-1,Ue=Re[1],et=0,ot=7,at=4;for(Ue===0&&(ot=138,at=3),Ee=0;Ee<=Pe;Ee++)if(we=Ue,Ue=Re[2*(Ee+1)+1],!(++et<ot&&we===Ue)){if(et<at)for(;be(Ve,we,Ve.bl_tree),--et!=0;);else we!==0?(we!==ze&&(be(Ve,we,Ve.bl_tree),et--),be(Ve,v,Ve.bl_tree),de(Ve,et-3,2)):et<=10?(be(Ve,S,Ve.bl_tree),de(Ve,et-3,3)):(be(Ve,M,Ve.bl_tree),de(Ve,et-11,7));ze=we,at=(et=0)===Ue?(ot=138,3):we===Ue?(ot=6,3):(ot=7,4)}}l(ce);var Oe=!1;function Ne(Ve,Re,Pe,Ee){de(Ve,(u<<1)+(Ee?1:0),3),(function(we,ze,Ue,et){Me(we),ae(we,Ue),ae(we,~Ue),s.arraySet(we.pending_buf,we.window,ze,Ue,we.pending),we.pending+=Ue})(Ve,Re,Pe)}i._tr_init=function(Ve){Oe||((function(){var Re,Pe,Ee,we,ze,Ue=new Array(f+1);for(we=Ee=0;we<_-1;we++)for(j[we]=Ee,Re=0;Re<1<<w[we];Re++)V[Ee++]=we;for(V[Ee-1]=we,we=ze=0;we<16;we++)for(ce[we]=ze,Re=0;Re<1<<D[we];Re++)z[ze++]=we;for(ze>>=7;we<h;we++)for(ce[we]=ze<<7,Re=0;Re<1<<D[we]-7;Re++)z[256+ze++]=we;for(Pe=0;Pe<=f;Pe++)Ue[Pe]=0;for(Re=0;Re<=143;)H[2*Re+1]=8,Re++,Ue[8]++;for(;Re<=255;)H[2*Re+1]=9,Re++,Ue[9]++;for(;Re<=279;)H[2*Re+1]=7,Re++,Ue[7]++;for(;Re<=287;)H[2*Re+1]=8,Re++,Ue[8]++;for(De(H,m+1,Ue),Re=0;Re<h;Re++)O[2*Re+1]=5,O[2*Re]=Ce(Re,5);q=new ee(H,w,d+1,m,f),K=new ee(O,D,0,h,f),ne=new ee(new Array(0),A,0,p,y)})(),Oe=!0),Ve.l_desc=new oe(Ve.dyn_ltree,q),Ve.d_desc=new oe(Ve.dyn_dtree,K),Ve.bl_desc=new oe(Ve.bl_tree,ne),Ve.bi_buf=0,Ve.bi_valid=0,pe(Ve)},i._tr_stored_block=Ne,i._tr_flush_block=function(Ve,Re,Pe,Ee){var we,ze,Ue=0;0<Ve.level?(Ve.strm.data_type===2&&(Ve.strm.data_type=(function(et){var ot,at=4093624447;for(ot=0;ot<=31;ot++,at>>>=1)if(1&at&&et.dyn_ltree[2*ot]!==0)return a;if(et.dyn_ltree[18]!==0||et.dyn_ltree[20]!==0||et.dyn_ltree[26]!==0)return c;for(ot=32;ot<d;ot++)if(et.dyn_ltree[2*ot]!==0)return c;return a})(Ve)),Je(Ve,Ve.l_desc),Je(Ve,Ve.d_desc),Ue=(function(et){var ot;for(fe(et,et.dyn_ltree,et.l_desc.max_code),fe(et,et.dyn_dtree,et.d_desc.max_code),Je(et,et.bl_desc),ot=p-1;3<=ot&&et.bl_tree[2*I[ot]+1]===0;ot--);return et.opt_len+=3*(ot+1)+5+5+4,ot})(Ve),we=Ve.opt_len+3+7>>>3,(ze=Ve.static_len+3+7>>>3)<=we&&(we=ze)):we=ze=Pe+5,Pe+4<=we&&Re!==-1?Ne(Ve,Re,Pe,Ee):Ve.strategy===4||ze===we?(de(Ve,2+(Ee?1:0),3),Xe(Ve,H,O)):(de(Ve,4+(Ee?1:0),3),(function(et,ot,at,lt){var xt;for(de(et,ot-257,5),de(et,at-1,5),de(et,lt-4,4),xt=0;xt<lt;xt++)de(et,et.bl_tree[2*I[xt]+1],3);Ye(et,et.dyn_ltree,ot-1),Ye(et,et.dyn_dtree,at-1)})(Ve,Ve.l_desc.max_code+1,Ve.d_desc.max_code+1,Ue+1),Xe(Ve,Ve.dyn_ltree,Ve.dyn_dtree)),pe(Ve),Ee&&Me(Ve)},i._tr_tally=function(Ve,Re,Pe){return Ve.pending_buf[Ve.d_buf+2*Ve.last_lit]=Re>>>8&255,Ve.pending_buf[Ve.d_buf+2*Ve.last_lit+1]=255&Re,Ve.pending_buf[Ve.l_buf+Ve.last_lit]=255&Pe,Ve.last_lit++,Re===0?Ve.dyn_ltree[2*Pe]++:(Ve.matches++,Re--,Ve.dyn_ltree[2*(V[Pe]+d+1)]++,Ve.dyn_dtree[2*ie(Re)]++),Ve.last_lit===Ve.lit_bufsize-1},i._tr_align=function(Ve){de(Ve,2,3),be(Ve,b,H),(function(Re){Re.bi_valid===16?(ae(Re,Re.bi_buf),Re.bi_buf=0,Re.bi_valid=0):8<=Re.bi_valid&&(Re.pending_buf[Re.pending++]=255&Re.bi_buf,Re.bi_buf>>=8,Re.bi_valid-=8)})(Ve)}},{"../utils/common":41}],53:[function(o,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(o,r,i){(function(s){(function(a,c){if(!a.setImmediate){var l,u,_,d,m=1,h={},p=!1,x=a.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(a);f=f&&f.setTimeout?f:a,l={}.toString.call(a.process)==="[object process]"?function(v){n.nextTick(function(){y(v)})}:(function(){if(a.postMessage&&!a.importScripts){var v=!0,S=a.onmessage;return a.onmessage=function(){v=!1},a.postMessage("","*"),a.onmessage=S,v}})()?(d="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",b,!1):a.attachEvent("onmessage",b),function(v){a.postMessage(d+v,"*")}):a.MessageChannel?((_=new MessageChannel).port1.onmessage=function(v){y(v.data)},function(v){_.port2.postMessage(v)}):x&&"onreadystatechange"in x.createElement("script")?(u=x.documentElement,function(v){var S=x.createElement("script");S.onreadystatechange=function(){y(v),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(v){setTimeout(y,0,v)},f.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var S=new Array(arguments.length-1),M=0;M<S.length;M++)S[M]=arguments[M+1];var w={callback:v,args:S};return h[m]=w,l(m),m++},f.clearImmediate=g}function g(v){delete h[v]}function y(v){if(p)setTimeout(y,0,v);else{var S=h[v];if(S){p=!0;try{(function(M){var w=M.callback,D=M.args;switch(D.length){case 0:w();break;case 1:w(D[0]);break;case 2:w(D[0],D[1]);break;case 3:w(D[0],D[1],D[2]);break;default:w.apply(c,D)}})(S)}finally{g(v),p=!1}}}}function b(v){v.source===a&&typeof v.data=="string"&&v.data.indexOf(d)===0&&y(+v.data.slice(d.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof xL<"u"?xL:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(o5e)),o5e.exports}var HQn=NQn();const r5e=jy(HQn);var IQn=["circuit-json-to-bom-csv","circuit-json-to-bpc","circuit-json-to-connectivity-map","circuit-json-to-gerber","circuit-json-to-gltf","circuit-json-to-kicad","circuit-json-to-lbrn","circuit-json-to-pnp-csv","circuit-json-to-readable-netlist","circuit-json-to-simple-3d","circuit-json-to-spice","circuit-json-to-step","circuit-json-to-tscircuit","circuit-to-canvas","circuit-to-svg"],LQn=new Set(IQn),OQn=t=>{const e=t.indexOf("@");return e===-1?t:t.slice(0,e)},FQn=t=>{const e=OQn(t);if(!LQn.has(e))throw new Error(`Unsupported module: ${t}`);return`https://esm.run/${t}`};async function BQn(t){return import(FQn(t))}var rC=BQn,Yht=3,zQn=(t,e={})=>{e.flip_y_axis??=!1;const n=[];for(const o of t)if(o.type==="pcb_component"){const r=Gp(t).source_component.get(o.source_component_id);n.push({designator:r?.name??o.pcb_component_id,mid_x:o.center.x,mid_y:o.center.y*(e.flip_y_axis?-1:1),layer:o.layer,rotation:o.rotation})}return n},VQn=t=>yct.unparse(zQn(t).map(e=>({Designator:e.designator,"Mid X":e.mid_x.toFixed(Yht),"Mid Y":e.mid_y.toFixed(Yht),Layer:e.layer,Rotation:e.rotation})));const Wv=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,r=t instanceof Blob?t:new Blob([t],{type:o}),i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=n,document.body.appendChild(s),s.click(),setTimeout(()=>{document.body.removeChild(s),URL.revokeObjectURL(i)},0)},$Qn=async({circuitJson:t,projectName:e})=>{const n=new r5e,{stringifyGerberCommandLayers:o,convertSoupToGerberCommands:r,convertSoupToExcellonDrillCommands:i,stringifyExcellonDrill:s}=await rC("circuit-json-to-gerber"),a=t.filter(x=>!("error_type"in x)&&!("warning_type"in x)),c=r(a,{flip_y_axis:!1}),l=o(c);for(const[x,f]of Object.entries(l))n.file(`gerber/${x}.gbr`,f);const u=i({circuitJson:a,is_plated:!0,flip_y_axis:!1}),_=s(u);n.file("gerber/drill.drl",_);const d=await bct({circuitJson:t}),m=await l$n(d);n.file("bom.csv",m);const h=await VQn(t);n.file("pick_and_place.csv",h);const p=await n.generateAsync({type:"blob"});Wv(p,{fileName:`${e}_fabrication_files.zip`})},WQn=async({circuitJson:t,projectName:e})=>{let n;try{const{convertCircuitJsonToGltf:o}=await rC("circuit-json-to-gltf");console.log("convertCircuitJsonToGltf",o);const r=await o(t,{format:"glb",boardTextureResolution:1024});if(!r||!(r instanceof ArrayBuffer))throw new Error("Invalid GLB data returned from converter");n=new Blob([r],{type:"model/gltf-binary"})}catch(o){console.error("GLB Export Error:",o);return}Wv(n,{fileName:`${e}.glb`})},UQn=async({circuitJson:t,projectName:e})=>{const{convertCircuitJsonToPinoutSvg:n}=await rC("circuit-to-svg"),o=n(t);Wv(o,{fileName:`${e}-pinout.svg`,mimeType:"image/svg+xml"})},XQn=async({circuitJson:t,projectName:e})=>{const{CircuitJsonToKicadPcbConverter:n,CircuitJsonToKicadSchConverter:o,CircuitJsonToKicadProConverter:r}=await rC("circuit-json-to-kicad"),i=new o(t);i.runUntilFinished();const s=i.getOutputString(),a=new n(t);a.runUntilFinished();const c=a.getOutputString(),l=new r(t,{projectName:e,schematicFilename:`${e}.kicad_sch`,pcbFilename:`${e}.kicad_pcb`});l.runUntilFinished();const u=l.getOutputString(),_=new r5e;return _.file(`${e}.kicad_sch`,s),_.file(`${e}.kicad_pcb`,c),_.file(`${e}.kicad_pro`,u),_},jQn=async({circuitJson:t,projectName:e})=>{const o=await(await XQn({circuitJson:t,projectName:e})).generateAsync({type:"blob"});Wv(o,{fileName:`${e}_kicad_project.zip`})},GQn=async({circuitJson:t,libraryName:e})=>{const{CircuitJsonToKicadLibraryConverter:n}=await rC("circuit-json-to-kicad"),o=new n(t,{libraryName:e,footprintLibraryName:e});o.runUntilFinished();const r=o.getOutput(),i=new r5e;i.file(`${e}.kicad_sym`,r.kicadSymString);for(const s of r.footprints){const a=i.folder(`${e}.pretty`);a&&a.file(`${s.footprintName}.kicad_mod`,`${s.kicadModString}
|
|
5710
|
-
`)}if(r.model3dSourcePaths.length>0){const s=i.folder(`${e}.3dshapes`);if(s)for(const a of r.model3dSourcePaths)try{const c=a.split("/").pop()||a,l=await fetch(a);if(l.ok){const u=await l.arrayBuffer();s.file(c,u)}}catch{}}return i.file("fp-lib-table",r.fpLibTableString),i.file("sym-lib-table",r.symLibTableString),i},YQn=async({circuitJson:t,projectName:e})=>{const o=await(await GQn({circuitJson:t,libraryName:e})).generateAsync({type:"blob"});Wv(o,{fileName:`${e}_kicad_library.zip`})},qQn=async({circuitJson:t,projectName:e})=>{const{circuitJsonToStep:n}=await rC("circuit-json-to-step"),o=t.find(l=>l.type==="pcb_board"),r=o&&"width"in o?o.width:void 0,i=o&&"height"in o?o.height:void 0,s=o&&"thickness"in o?o.thickness:void 0;if(r===void 0||i===void 0||s===void 0){ds.error("Board dimensions not found. Please add a pcb_board with width, height, and thickness to your circuit.");return}let a;try{a=await n(t,{boardWidth:r,boardHeight:i,boardThickness:s,productName:e,includeComponents:!0,includeExternalMeshes:!0})}catch(l){const u=l instanceof Error?l.message:"Unknown error";ds.error(`Failed to convert circuit to STEP format: ${u}`);return}const c=new Blob([a],{type:"application/step"});try{Wv(c,{fileName:`${e}.step`})}catch(l){const u=l instanceof Error?l.message:"Unknown error";ds.error(`Failed to download STEP file: ${u}`)}},qht=async({circuitJson:t,projectName:e,options:n={}})=>{try{const{convertCircuitJsonToLbrn:o}=await rC("circuit-json-to-lbrn"),i=(await o(t,{includeSilkscreen:n.includeSilkscreen??!1})).toXml(),s=new Blob([i],{type:"application/lbrn"});Wv(s,{fileName:`${e}.lbrn2`})}catch(o){const r=o instanceof Error?o.message:"Unknown error";ds.error(`Failed to export to LBRN format: ${r}`)}},JQn=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},KQn=[{extension:"json",name:"Circuit JSON"},{extension:"zip",name:"Fabrication Files"},{extension:"zip",name:"KiCad Project"},{extension:"zip",name:"KiCad Library"},{extension:"glb",name:"GLB (Binary GLTF)"},{extension:"svg",name:"Pinout SVG"},{extension:"step",name:"STEP"},{extension:"lbrn2",name:"LightBurn"}],QQn=async({exportName:t,circuitJson:e,projectName:n})=>{const o=JQn(n);if(t==="Fabrication Files"){$Qn({circuitJson:e,projectName:o});return}if(t==="KiCad Project"){await jQn({circuitJson:e,projectName:o});return}if(t==="KiCad Library"){await YQn({circuitJson:e,projectName:o});return}if(t==="Circuit JSON"){Wv(JSON.stringify(e,null,2),{fileName:`${o}.circuit.json`,mimeType:"application/json"});return}if(t==="GLB (Binary GLTF)"){await WQn({circuitJson:e,projectName:o});return}if(t==="Pinout SVG"){UQn({circuitJson:e,projectName:o});return}if(t==="STEP"){await qQn({circuitJson:e,projectName:o});return}if(t==="LightBurn"){await qht({circuitJson:e,projectName:o});return}throw new Error(`Unsupported export type: "${t}"`)};class Uv extends Error{response;request;options;constructor(e,n,o){const r=e.status||e.status===0?e.status:"",i=e.statusText??"",s=`${r} ${i}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=o}}class Jht extends Error{name="NonError";value;constructor(e){let n="Non-error value was thrown";try{typeof e=="string"?n=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(n=e.message)}catch{}super(n),this.value=e}}class i5e extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new Jht(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const Kht=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",o=typeof globalThis.Request=="function";if(n&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(r){if(r instanceof Error&&r.message==="unsupported BodyInit type")return!1;throw r}return t&&!e})(),ZQn=typeof globalThis.AbortController=="function",Qht=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",eZn=typeof globalThis.ReadableStream=="function",tZn=typeof globalThis.FormData=="function",Zht=["get","post","put","patch","head","delete"],nZn={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},s5e=2147483647,oZn=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,emt=Symbol("stop");class tmt{options;constructor(e){this.options=e}}const rZn=t=>new tmt(t),iZn={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},sZn={next:!0},aZn={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},cZn=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=oZn,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,e+=typeof o=="string"?new TextEncoder().encode(o).length:o.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},nmt=(t,e,n)=>{let o,r=0;return t.pipeThrough(new TransformStream({transform(i,s){if(s.enqueue(i),o){r+=o.byteLength;let a=e===0?0:r/e;a>=1&&(a=1-Number.EPSILON),n?.({percent:a,totalBytes:Math.max(e,r),transferredBytes:r},o)}o=i},flush(){o&&(r+=o.byteLength,n?.({percent:1,totalBytes:Math.max(e,r),transferredBytes:r},o))}}))},lZn=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(nmt(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},uZn=(t,e,n)=>{if(!t.body)return t;const o=cZn(n??t.body);return new Request(t,{duplex:"half",body:nmt(t.body,o,e)})},iC=t=>t!==null&&typeof t=="object",AY=(...t)=>{for(const e of t)if((!iC(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return a5e({},...t)},omt=(t={},e={})=>{const n=new globalThis.Headers(t),o=e instanceof globalThis.Headers,r=new globalThis.Headers(e);for(const[i,s]of r.entries())o&&s==="undefined"||s===void 0?n.delete(i):n.set(i,s);return n};function RY(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:a5e(t[n]??[],e[n]??[])}const rmt=(t={},e={})=>({beforeRequest:RY(t,e,"beforeRequest"),beforeRetry:RY(t,e,"beforeRetry"),afterResponse:RY(t,e,"afterResponse"),beforeError:RY(t,e,"beforeError")}),_Zn=(t,e)=>{const n=new URLSearchParams;for(const o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams)for(const[r,i]of o.entries())n.append(r,i);else if(Array.isArray(o))for(const r of o){if(!Array.isArray(r)||r.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(r[0]),String(r[1]))}else if(iC(o))for(const[r,i]of Object.entries(o))i!==void 0&&n.append(r,String(i));else{const r=new URLSearchParams(o);for(const[i,s]of r.entries())n.append(i,s)}return n},a5e=(...t)=>{let e={},n={},o={},r;const i=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(iC(s)){for(let[a,c]of Object.entries(s)){if(a==="signal"&&c instanceof globalThis.AbortSignal){i.push(c);continue}if(a==="context"){if(c!=null&&(!iC(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");e={...e,context:c==null?{}:{...e.context,...c}};continue}if(a==="searchParams"){c==null?r=void 0:r=r===void 0?c:_Zn(r,c);continue}iC(c)&&a in e&&(c=a5e(e[a],c)),e={...e,[a]:c}}iC(s.hooks)&&(o=rmt(o,s.hooks),e.hooks=o),iC(s.headers)&&(n=omt(n,s.headers),e.headers=n)}return r!==void 0&&(e.searchParams=r),i.length>0&&(i.length===1?e.signal=i[0]:Qht?e.signal=AbortSignal.any(i):e.signal=i.at(-1)),e},dZn=t=>Zht.includes(t)?t.toUpperCase():t,imt={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},hZn=(t={})=>{if(typeof t=="number")return{...imt,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(n=>n.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return{...imt,...e}};class c5e extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function mZn(t,e,n,o){return new Promise((r,i)=>{const s=setTimeout(()=>{n&&n.abort(),i(new c5e(t))},o.timeout);o.fetch(t,e).then(r).catch(i).then(()=>{clearTimeout(s)})})}async function pZn(t,{signal:e}){return new Promise((n,o)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",r,{once:!0}));function r(){clearTimeout(i),o(e.reason)}const i=setTimeout(()=>{e?.removeEventListener("abort",r),n()},t)})}const fZn=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in aZn)&&!(o in iZn)&&(!(o in t)||o in sZn)&&(n[o]=e[o]);return n},xZn=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function gZn(t){return t instanceof Uv||t?.name===Uv.name}function yZn(t){return t instanceof c5e||t?.name===c5e.name}class dI{static create(e,n){const o=new dI(e,n),r=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>s5e)throw new RangeError(`The \`timeout\` option cannot be greater than ${s5e}`);await Promise.resolve();let s=await o.#p();for(const a of o.#e.hooks.afterResponse){const c=o.#_(s.clone());let l;try{l=await a(o.request,o.#m(),c,{retryCount:o.#r})}catch(_){throw o.#c(c),o.#c(s),_}if(l instanceof tmt)throw o.#c(c),o.#c(s),new i5e(l.options);const u=l instanceof globalThis.Response?l:s;c!==u&&o.#c(c),s!==u&&o.#c(s),s=u}if(o.#_(s),!s.ok&&(typeof o.#e.throwHttpErrors=="function"?o.#e.throwHttpErrors(s.status):o.#e.throwHttpErrors)){let a=new Uv(s,o.request,o.#m());for(const c of o.#e.hooks.beforeError)a=await c(a,{retryCount:o.#r});throw a}if(o.#e.onDownloadProgress){if(typeof o.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!eZn)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#c(s),lZn(a,o.#e.onDownloadProgress)}return s},i=o.#h(r).finally(()=>{const s=o.#s;o.#d(s?.body??void 0),o.#d(o.request.body??void 0)});for(const[s,a]of Object.entries(nZn))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(i[s]=async()=>{o.request.headers.set("accept",o.request.headers.get("accept")||a);const c=await i;if(s==="json"){if(c.status===204)return"";const l=await c.text();return l===""?"":n.parseJson?n.parseJson(l):JSON.parse(l)}return c[s]()});return i}static#o(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)):e}request;#n;#r=0;#t;#e;#s;#i;#l;constructor(e,n={}){if(this.#t=e,this.#e={...n,headers:omt(this.#t.headers,n.headers),hooks:rmt({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:dZn(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:hZn(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}ZQn&&Qht&&(this.#i=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal),Kht&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const o=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(tZn&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!o&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),xZn(this.#e.searchParams)){const i="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(dI.#o(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Kht)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#x(this.request,this.#e.body??void 0)}}#a(){const e=this.#e.retry.delay(this.#r);let n=e;this.#e.retry.jitter===!0?n=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(n=this.#e.retry.jitter(e),(!Number.isFinite(n)||n<0)&&(n=e));const o=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(o,n)}async#u(e){if(this.#r++,this.#r>this.#e.retry.limit)throw e;const n=e instanceof Error?e:new Jht(e);if(n instanceof i5e)return n.customDelay??this.#a();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const o=await this.#e.retry.shouldRetry({error:n,retryCount:this.#r});if(o===!1)throw e;if(o===!0)return this.#a()}if(yZn(e)&&!this.#e.retry.retryOnTimeout)throw e;if(gZn(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const o=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(o&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let r=Number(o)*1e3;Number.isNaN(r)?r=Date.parse(o)-Date.now():r>=Date.parse("2024-01-01")&&(r-=Date.now());const i=this.#e.retry.maxRetryAfter??r;return r<i?r:i}if(e.response.status===413)throw e}return this.#a()}#_(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>{})}#c(e){this.#d(e.body??void 0)}async#h(e){try{return await e()}catch(n){const o=Math.min(await this.#u(n),s5e);if(this.#r<1)throw n;if(await pZn(o,this.#i?{signal:this.#i}:{}),n instanceof i5e&&n.customRequest){const r=this.#e.signal?new globalThis.Request(n.customRequest,{signal:this.#e.signal}):new globalThis.Request(n.customRequest);this.#f(r)}for(const r of this.#e.hooks.beforeRetry){const i=await r({request:this.request,options:this.#m(),error:n,retryCount:this.#r});if(i instanceof globalThis.Request){this.#f(i);break}if(i instanceof globalThis.Response)return i;if(i===emt)return}return this.#h(e)}}async#p(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const n of this.#e.hooks.beforeRequest){const o=await n(this.request,this.#m(),{retryCount:this.#r});if(o instanceof Response)return o;if(o instanceof globalThis.Request){this.#f(o);break}}const e=fZn(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):mZn(this.#s,e,this.#n,this.#e)}#m(){if(!this.#l){const{hooks:e,...n}=this.#e;this.#l=Object.freeze(n)}return this.#l}#f(e){this.#l=void 0,this.request=this.#x(e)}#x(e,n){return!this.#e.onUploadProgress||!e.body?e:uZn(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}}const l5e=t=>{const e=(n,o)=>dI.create(n,AY(t,o));for(const n of Zht)e[n]=(o,r)=>dI.create(o,AY(t,r,{method:n}));return e.create=n=>l5e(AY(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),l5e(AY(t,n))),e.stop=emt,e.retry=rZn,e},bZn=l5e();class PZn extends Uv{constructor(e,n,o,r){super(e,n,o),this.name="RegistryHTTPError",this.message=r}}function kY(t){return typeof window<"u"?window[t]:null}function Xv(){const t=kY("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=kY("TSCIRCUIT_REGISTRY_TOKEN");return bZn.create({prefixUrl:t,headers:{Authorization:`Bearer ${e}`},timeout:3e4,hooks:{afterResponse:[async(n,o,r)=>{if(r.ok)return r;let i=null;try{i=await r.clone().json()}catch(_){console.error("Failed to parse registry error response",_)}const s=i?.error?.message??i?.error?.error_message??i?.message,a=i?.error?.error_code??i?.error_code,c=new URL(r.url),u=[`Registry request failed for ${`${c.pathname}${c.search}`} (${r.status})`];throw s&&u.push(`Server message: ${s}`),a&&u.push(`Error code: ${a}`),new PZn(r,n,o,u.join(" | "))}]}})}function NY(){return!!kY("TSCIRCUIT_REGISTRY_TOKEN")}const hI={get:(t,e)=>Xv().get(t,e),post:(t,e)=>Xv().post(t,e),put:(t,e)=>Xv().put(t,e),delete:(t,e)=>Xv().delete(t,e),patch:(t,e)=>Xv().patch(t,e)},vZn=({packageName:t,onSelectReview:e})=>{const n=eu(_=>_.fsMap),o=eu(_=>_.circuitJson),[r,i]=Y.useState([]),[s,a]=Y.useState(!1),[c,l]=Y.useState(!1);Y.useEffect(()=>{!t||!NY()||(a(!0),hI.get("ai_reviews/list",{searchParams:{package_name:t}}).json().then(_=>i(_.ai_reviews)).catch(_=>{console.error("Failed to load AI reviews",_),ds.error("Failed to load AI reviews")}).finally(()=>a(!1)))},[t]);const u=async()=>{if(!o){ds.error("Need Circuit JSON to Request AI Review");return}if(!NY()){ds.error("Missing registry token");return}l(!0);try{const{ai_review:_}=await hI.post("ai_reviews/create",{json:{package_name:t??"unknown",fs_map:Object.fromEntries(n),circuit_json:o}}).json();i(d=>[_,...d]),e(_),ds.success("AI review requested")}catch(_){console.error("Failed to create AI review",_),ds.error("Failed to request AI review")}finally{l(!1)}};return G.jsxs(G.Fragment,{children:[G.jsxs(tC,{children:[G.jsx(nC,{children:"AI Review"}),G.jsx(ZE,{children:"Select an AI review or request a new one."})]}),G.jsx("div",{className:"rf-flex rf-gap-4 rf-mt-4",children:G.jsx("div",{className:"rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0",children:s?G.jsx("div",{className:"rf-text-sm",children:"Loading..."}):r.length>0?r.map(_=>G.jsx("div",{className:"rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",onClick:()=>e(_),children:new Date(_.created_at||"").toLocaleString()},_.ai_review_id)):G.jsx("div",{className:"rf-text-sm rf-text-muted-foreground",children:"No AI reviews found."})})}),G.jsx(uI,{className:"rf-mt-4",children:G.jsx(dc,{onClick:u,disabled:c,children:c?"Requesting...":"Review my Board"})})]})};function u5e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var sC=u5e();function smt(t){sC=t}var mI={exec:()=>null};function Vc(t,e=""){let n=typeof t=="string"?t:t.source;const o={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(f2.caret,"$1"),n=n.replace(r,s),o},getRegex:()=>new RegExp(n,e)};return o}var f2={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},SZn=/^(?:[ \t]*(?:\n|$))+/,CZn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,MZn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pI=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,TZn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_5e=/(?:[*+-]|\d{1,9}[.)])/,amt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cmt=Vc(amt).replace(/bull/g,_5e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),wZn=Vc(amt).replace(/bull/g,_5e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),d5e=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,EZn=/^[^\n]+/,h5e=/(?!\s*\])(?:\\.|[^\[\]\\])+/,DZn=Vc(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",h5e).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),AZn=Vc(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_5e).getRegex(),HY="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m5e=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,RZn=Vc("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",m5e).replace("tag",HY).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lmt=Vc(d5e).replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex(),kZn=Vc(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lmt).getRegex(),p5e={blockquote:kZn,code:CZn,def:DZn,fences:MZn,heading:TZn,hr:pI,html:RZn,lheading:cmt,list:AZn,newline:SZn,paragraph:lmt,table:mI,text:EZn},umt=Vc("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex(),NZn={...p5e,lheading:wZn,table:umt,paragraph:Vc(d5e).replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",umt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex()},HZn={...p5e,html:Vc(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",m5e).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mI,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Vc(d5e).replace("hr",pI).replace("heading",` *#{1,6} *[^
|
|
5710
|
+
`)}if(r.model3dSourcePaths.length>0){const s=i.folder(`${e}.3dshapes`);if(s)for(const a of r.model3dSourcePaths)try{const c=a.split("/").pop()||a,l=await fetch(a);if(l.ok){const u=await l.arrayBuffer();s.file(c,u)}}catch{}}return i.file("fp-lib-table",r.fpLibTableString),i.file("sym-lib-table",r.symLibTableString),i},YQn=async({circuitJson:t,projectName:e})=>{const o=await(await GQn({circuitJson:t,libraryName:e})).generateAsync({type:"blob"});Wv(o,{fileName:`${e}_kicad_library.zip`})},qQn=async({circuitJson:t,projectName:e})=>{const{circuitJsonToStep:n}=await rC("circuit-json-to-step"),o=t.find(l=>l.type==="pcb_board"),r=o&&"width"in o?o.width:void 0,i=o&&"height"in o?o.height:void 0,s=o&&"thickness"in o?o.thickness:void 0;if(r===void 0||i===void 0||s===void 0){ds.error("Board dimensions not found. Please add a pcb_board with width, height, and thickness to your circuit.");return}let a;try{a=await n(t,{boardWidth:r,boardHeight:i,boardThickness:s,productName:e,includeComponents:!0,includeExternalMeshes:!0})}catch(l){const u=l instanceof Error?l.message:"Unknown error";ds.error(`Failed to convert circuit to STEP format: ${u}`);return}const c=new Blob([a],{type:"application/step"});try{Wv(c,{fileName:`${e}.step`})}catch(l){const u=l instanceof Error?l.message:"Unknown error";ds.error(`Failed to download STEP file: ${u}`)}},qht=async({circuitJson:t,projectName:e,options:n={}})=>{try{const{convertCircuitJsonToLbrn:o}=await rC("circuit-json-to-lbrn"),i=(await o(t,{includeSilkscreen:n.includeSilkscreen??!1,includeOxidationCleaningLayer:n.includeOxidationCleaningLayer??!0})).toXml(),s=new Blob([i],{type:"application/lbrn"});Wv(s,{fileName:`${e}.lbrn2`})}catch(o){const r=o instanceof Error?o.message:"Unknown error";ds.error(`Failed to export to LBRN format: ${r}`)}},JQn=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},KQn=[{extension:"json",name:"Circuit JSON"},{extension:"zip",name:"Fabrication Files"},{extension:"zip",name:"KiCad Project"},{extension:"zip",name:"KiCad Library"},{extension:"glb",name:"GLB (Binary GLTF)"},{extension:"svg",name:"Pinout SVG"},{extension:"step",name:"STEP"},{extension:"lbrn2",name:"LightBurn"}],QQn=async({exportName:t,circuitJson:e,projectName:n})=>{const o=JQn(n);if(t==="Fabrication Files"){$Qn({circuitJson:e,projectName:o});return}if(t==="KiCad Project"){await jQn({circuitJson:e,projectName:o});return}if(t==="KiCad Library"){await YQn({circuitJson:e,projectName:o});return}if(t==="Circuit JSON"){Wv(JSON.stringify(e,null,2),{fileName:`${o}.circuit.json`,mimeType:"application/json"});return}if(t==="GLB (Binary GLTF)"){await WQn({circuitJson:e,projectName:o});return}if(t==="Pinout SVG"){UQn({circuitJson:e,projectName:o});return}if(t==="STEP"){await qQn({circuitJson:e,projectName:o});return}if(t==="LightBurn"){await qht({circuitJson:e,projectName:o});return}throw new Error(`Unsupported export type: "${t}"`)};class Uv extends Error{response;request;options;constructor(e,n,o){const r=e.status||e.status===0?e.status:"",i=e.statusText??"",s=`${r} ${i}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=o}}class Jht extends Error{name="NonError";value;constructor(e){let n="Non-error value was thrown";try{typeof e=="string"?n=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(n=e.message)}catch{}super(n),this.value=e}}class i5e extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new Jht(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const Kht=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",o=typeof globalThis.Request=="function";if(n&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(r){if(r instanceof Error&&r.message==="unsupported BodyInit type")return!1;throw r}return t&&!e})(),ZQn=typeof globalThis.AbortController=="function",Qht=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",eZn=typeof globalThis.ReadableStream=="function",tZn=typeof globalThis.FormData=="function",Zht=["get","post","put","patch","head","delete"],nZn={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},s5e=2147483647,oZn=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,emt=Symbol("stop");class tmt{options;constructor(e){this.options=e}}const rZn=t=>new tmt(t),iZn={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},sZn={next:!0},aZn={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},cZn=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=oZn,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,e+=typeof o=="string"?new TextEncoder().encode(o).length:o.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},nmt=(t,e,n)=>{let o,r=0;return t.pipeThrough(new TransformStream({transform(i,s){if(s.enqueue(i),o){r+=o.byteLength;let a=e===0?0:r/e;a>=1&&(a=1-Number.EPSILON),n?.({percent:a,totalBytes:Math.max(e,r),transferredBytes:r},o)}o=i},flush(){o&&(r+=o.byteLength,n?.({percent:1,totalBytes:Math.max(e,r),transferredBytes:r},o))}}))},lZn=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(nmt(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},uZn=(t,e,n)=>{if(!t.body)return t;const o=cZn(n??t.body);return new Request(t,{duplex:"half",body:nmt(t.body,o,e)})},iC=t=>t!==null&&typeof t=="object",AY=(...t)=>{for(const e of t)if((!iC(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return a5e({},...t)},omt=(t={},e={})=>{const n=new globalThis.Headers(t),o=e instanceof globalThis.Headers,r=new globalThis.Headers(e);for(const[i,s]of r.entries())o&&s==="undefined"||s===void 0?n.delete(i):n.set(i,s);return n};function RY(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:a5e(t[n]??[],e[n]??[])}const rmt=(t={},e={})=>({beforeRequest:RY(t,e,"beforeRequest"),beforeRetry:RY(t,e,"beforeRetry"),afterResponse:RY(t,e,"afterResponse"),beforeError:RY(t,e,"beforeError")}),_Zn=(t,e)=>{const n=new URLSearchParams;for(const o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams)for(const[r,i]of o.entries())n.append(r,i);else if(Array.isArray(o))for(const r of o){if(!Array.isArray(r)||r.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(r[0]),String(r[1]))}else if(iC(o))for(const[r,i]of Object.entries(o))i!==void 0&&n.append(r,String(i));else{const r=new URLSearchParams(o);for(const[i,s]of r.entries())n.append(i,s)}return n},a5e=(...t)=>{let e={},n={},o={},r;const i=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(iC(s)){for(let[a,c]of Object.entries(s)){if(a==="signal"&&c instanceof globalThis.AbortSignal){i.push(c);continue}if(a==="context"){if(c!=null&&(!iC(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");e={...e,context:c==null?{}:{...e.context,...c}};continue}if(a==="searchParams"){c==null?r=void 0:r=r===void 0?c:_Zn(r,c);continue}iC(c)&&a in e&&(c=a5e(e[a],c)),e={...e,[a]:c}}iC(s.hooks)&&(o=rmt(o,s.hooks),e.hooks=o),iC(s.headers)&&(n=omt(n,s.headers),e.headers=n)}return r!==void 0&&(e.searchParams=r),i.length>0&&(i.length===1?e.signal=i[0]:Qht?e.signal=AbortSignal.any(i):e.signal=i.at(-1)),e},dZn=t=>Zht.includes(t)?t.toUpperCase():t,imt={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},hZn=(t={})=>{if(typeof t=="number")return{...imt,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(n=>n.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return{...imt,...e}};class c5e extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function mZn(t,e,n,o){return new Promise((r,i)=>{const s=setTimeout(()=>{n&&n.abort(),i(new c5e(t))},o.timeout);o.fetch(t,e).then(r).catch(i).then(()=>{clearTimeout(s)})})}async function pZn(t,{signal:e}){return new Promise((n,o)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",r,{once:!0}));function r(){clearTimeout(i),o(e.reason)}const i=setTimeout(()=>{e?.removeEventListener("abort",r),n()},t)})}const fZn=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in aZn)&&!(o in iZn)&&(!(o in t)||o in sZn)&&(n[o]=e[o]);return n},xZn=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function gZn(t){return t instanceof Uv||t?.name===Uv.name}function yZn(t){return t instanceof c5e||t?.name===c5e.name}class dI{static create(e,n){const o=new dI(e,n),r=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>s5e)throw new RangeError(`The \`timeout\` option cannot be greater than ${s5e}`);await Promise.resolve();let s=await o.#p();for(const a of o.#e.hooks.afterResponse){const c=o.#_(s.clone());let l;try{l=await a(o.request,o.#m(),c,{retryCount:o.#r})}catch(_){throw o.#c(c),o.#c(s),_}if(l instanceof tmt)throw o.#c(c),o.#c(s),new i5e(l.options);const u=l instanceof globalThis.Response?l:s;c!==u&&o.#c(c),s!==u&&o.#c(s),s=u}if(o.#_(s),!s.ok&&(typeof o.#e.throwHttpErrors=="function"?o.#e.throwHttpErrors(s.status):o.#e.throwHttpErrors)){let a=new Uv(s,o.request,o.#m());for(const c of o.#e.hooks.beforeError)a=await c(a,{retryCount:o.#r});throw a}if(o.#e.onDownloadProgress){if(typeof o.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!eZn)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#c(s),lZn(a,o.#e.onDownloadProgress)}return s},i=o.#h(r).finally(()=>{const s=o.#s;o.#d(s?.body??void 0),o.#d(o.request.body??void 0)});for(const[s,a]of Object.entries(nZn))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(i[s]=async()=>{o.request.headers.set("accept",o.request.headers.get("accept")||a);const c=await i;if(s==="json"){if(c.status===204)return"";const l=await c.text();return l===""?"":n.parseJson?n.parseJson(l):JSON.parse(l)}return c[s]()});return i}static#o(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)):e}request;#n;#r=0;#t;#e;#s;#i;#l;constructor(e,n={}){if(this.#t=e,this.#e={...n,headers:omt(this.#t.headers,n.headers),hooks:rmt({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:dZn(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:hZn(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}ZQn&&Qht&&(this.#i=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal),Kht&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const o=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(tZn&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!o&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),xZn(this.#e.searchParams)){const i="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(dI.#o(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Kht)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#x(this.request,this.#e.body??void 0)}}#a(){const e=this.#e.retry.delay(this.#r);let n=e;this.#e.retry.jitter===!0?n=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(n=this.#e.retry.jitter(e),(!Number.isFinite(n)||n<0)&&(n=e));const o=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(o,n)}async#u(e){if(this.#r++,this.#r>this.#e.retry.limit)throw e;const n=e instanceof Error?e:new Jht(e);if(n instanceof i5e)return n.customDelay??this.#a();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const o=await this.#e.retry.shouldRetry({error:n,retryCount:this.#r});if(o===!1)throw e;if(o===!0)return this.#a()}if(yZn(e)&&!this.#e.retry.retryOnTimeout)throw e;if(gZn(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const o=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(o&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let r=Number(o)*1e3;Number.isNaN(r)?r=Date.parse(o)-Date.now():r>=Date.parse("2024-01-01")&&(r-=Date.now());const i=this.#e.retry.maxRetryAfter??r;return r<i?r:i}if(e.response.status===413)throw e}return this.#a()}#_(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>{})}#c(e){this.#d(e.body??void 0)}async#h(e){try{return await e()}catch(n){const o=Math.min(await this.#u(n),s5e);if(this.#r<1)throw n;if(await pZn(o,this.#i?{signal:this.#i}:{}),n instanceof i5e&&n.customRequest){const r=this.#e.signal?new globalThis.Request(n.customRequest,{signal:this.#e.signal}):new globalThis.Request(n.customRequest);this.#f(r)}for(const r of this.#e.hooks.beforeRetry){const i=await r({request:this.request,options:this.#m(),error:n,retryCount:this.#r});if(i instanceof globalThis.Request){this.#f(i);break}if(i instanceof globalThis.Response)return i;if(i===emt)return}return this.#h(e)}}async#p(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const n of this.#e.hooks.beforeRequest){const o=await n(this.request,this.#m(),{retryCount:this.#r});if(o instanceof Response)return o;if(o instanceof globalThis.Request){this.#f(o);break}}const e=fZn(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):mZn(this.#s,e,this.#n,this.#e)}#m(){if(!this.#l){const{hooks:e,...n}=this.#e;this.#l=Object.freeze(n)}return this.#l}#f(e){this.#l=void 0,this.request=this.#x(e)}#x(e,n){return!this.#e.onUploadProgress||!e.body?e:uZn(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}}const l5e=t=>{const e=(n,o)=>dI.create(n,AY(t,o));for(const n of Zht)e[n]=(o,r)=>dI.create(o,AY(t,r,{method:n}));return e.create=n=>l5e(AY(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),l5e(AY(t,n))),e.stop=emt,e.retry=rZn,e},bZn=l5e();class PZn extends Uv{constructor(e,n,o,r){super(e,n,o),this.name="RegistryHTTPError",this.message=r}}function kY(t){return typeof window<"u"?window[t]:null}function Xv(){const t=kY("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=kY("TSCIRCUIT_REGISTRY_TOKEN");return bZn.create({prefixUrl:t,headers:{Authorization:`Bearer ${e}`},timeout:3e4,hooks:{afterResponse:[async(n,o,r)=>{if(r.ok)return r;let i=null;try{i=await r.clone().json()}catch(_){console.error("Failed to parse registry error response",_)}const s=i?.error?.message??i?.error?.error_message??i?.message,a=i?.error?.error_code??i?.error_code,c=new URL(r.url),u=[`Registry request failed for ${`${c.pathname}${c.search}`} (${r.status})`];throw s&&u.push(`Server message: ${s}`),a&&u.push(`Error code: ${a}`),new PZn(r,n,o,u.join(" | "))}]}})}function NY(){return!!kY("TSCIRCUIT_REGISTRY_TOKEN")}const hI={get:(t,e)=>Xv().get(t,e),post:(t,e)=>Xv().post(t,e),put:(t,e)=>Xv().put(t,e),delete:(t,e)=>Xv().delete(t,e),patch:(t,e)=>Xv().patch(t,e)},vZn=({packageName:t,onSelectReview:e})=>{const n=eu(_=>_.fsMap),o=eu(_=>_.circuitJson),[r,i]=Y.useState([]),[s,a]=Y.useState(!1),[c,l]=Y.useState(!1);Y.useEffect(()=>{!t||!NY()||(a(!0),hI.get("ai_reviews/list",{searchParams:{package_name:t}}).json().then(_=>i(_.ai_reviews)).catch(_=>{console.error("Failed to load AI reviews",_),ds.error("Failed to load AI reviews")}).finally(()=>a(!1)))},[t]);const u=async()=>{if(!o){ds.error("Need Circuit JSON to Request AI Review");return}if(!NY()){ds.error("Missing registry token");return}l(!0);try{const{ai_review:_}=await hI.post("ai_reviews/create",{json:{package_name:t??"unknown",fs_map:Object.fromEntries(n),circuit_json:o}}).json();i(d=>[_,...d]),e(_),ds.success("AI review requested")}catch(_){console.error("Failed to create AI review",_),ds.error("Failed to request AI review")}finally{l(!1)}};return G.jsxs(G.Fragment,{children:[G.jsxs(tC,{children:[G.jsx(nC,{children:"AI Review"}),G.jsx(ZE,{children:"Select an AI review or request a new one."})]}),G.jsx("div",{className:"rf-flex rf-gap-4 rf-mt-4",children:G.jsx("div",{className:"rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0",children:s?G.jsx("div",{className:"rf-text-sm",children:"Loading..."}):r.length>0?r.map(_=>G.jsx("div",{className:"rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",onClick:()=>e(_),children:new Date(_.created_at||"").toLocaleString()},_.ai_review_id)):G.jsx("div",{className:"rf-text-sm rf-text-muted-foreground",children:"No AI reviews found."})})}),G.jsx(uI,{className:"rf-mt-4",children:G.jsx(dc,{onClick:u,disabled:c,children:c?"Requesting...":"Review my Board"})})]})};function u5e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var sC=u5e();function smt(t){sC=t}var mI={exec:()=>null};function Vc(t,e=""){let n=typeof t=="string"?t:t.source;const o={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(f2.caret,"$1"),n=n.replace(r,s),o},getRegex:()=>new RegExp(n,e)};return o}var f2={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},SZn=/^(?:[ \t]*(?:\n|$))+/,CZn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,MZn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pI=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,TZn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_5e=/(?:[*+-]|\d{1,9}[.)])/,amt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cmt=Vc(amt).replace(/bull/g,_5e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),wZn=Vc(amt).replace(/bull/g,_5e).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),d5e=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,EZn=/^[^\n]+/,h5e=/(?!\s*\])(?:\\.|[^\[\]\\])+/,DZn=Vc(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",h5e).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),AZn=Vc(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_5e).getRegex(),HY="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m5e=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,RZn=Vc("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",m5e).replace("tag",HY).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lmt=Vc(d5e).replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex(),kZn=Vc(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lmt).getRegex(),p5e={blockquote:kZn,code:CZn,def:DZn,fences:MZn,heading:TZn,hr:pI,html:RZn,lheading:cmt,list:AZn,newline:SZn,paragraph:lmt,table:mI,text:EZn},umt=Vc("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex(),NZn={...p5e,lheading:wZn,table:umt,paragraph:Vc(d5e).replace("hr",pI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",umt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",HY).getRegex()},HZn={...p5e,html:Vc(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",m5e).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mI,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Vc(d5e).replace("hr",pI).replace("heading",` *#{1,6} *[^
|
|
5711
5711
|
]`).replace("lheading",cmt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},IZn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,LZn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_mt=/^( {2,}|\\)\n(?!\s*$)/,OZn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,IY=/[\p{P}\p{S}]/u,f5e=/[\s\p{P}\p{S}]/u,dmt=/[^\s\p{P}\p{S}]/u,FZn=Vc(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,f5e).getRegex(),hmt=/(?!~)[\p{P}\p{S}]/u,BZn=/(?!~)[\s\p{P}\p{S}]/u,zZn=/(?:[^\s\p{P}\p{S}]|~)/u,VZn=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,mmt=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,$Zn=Vc(mmt,"u").replace(/punct/g,IY).getRegex(),WZn=Vc(mmt,"u").replace(/punct/g,hmt).getRegex(),pmt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",UZn=Vc(pmt,"gu").replace(/notPunctSpace/g,dmt).replace(/punctSpace/g,f5e).replace(/punct/g,IY).getRegex(),XZn=Vc(pmt,"gu").replace(/notPunctSpace/g,zZn).replace(/punctSpace/g,BZn).replace(/punct/g,hmt).getRegex(),jZn=Vc("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,dmt).replace(/punctSpace/g,f5e).replace(/punct/g,IY).getRegex(),GZn=Vc(/\\(punct)/,"gu").replace(/punct/g,IY).getRegex(),YZn=Vc(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),qZn=Vc(m5e).replace("(?:-->|$)","-->").getRegex(),JZn=Vc("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",qZn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),LY=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,KZn=Vc(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",LY).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fmt=Vc(/^!?\[(label)\]\[(ref)\]/).replace("label",LY).replace("ref",h5e).getRegex(),xmt=Vc(/^!?\[(ref)\](?:\[\])?/).replace("ref",h5e).getRegex(),QZn=Vc("reflink|nolink(?!\\()","g").replace("reflink",fmt).replace("nolink",xmt).getRegex(),x5e={_backpedal:mI,anyPunctuation:GZn,autolink:YZn,blockSkip:VZn,br:_mt,code:LZn,del:mI,emStrongLDelim:$Zn,emStrongRDelimAst:UZn,emStrongRDelimUnd:jZn,escape:IZn,link:KZn,nolink:xmt,punctuation:FZn,reflink:fmt,reflinkSearch:QZn,tag:JZn,text:OZn,url:mI},ZZn={...x5e,link:Vc(/^!?\[(label)\]\((.*?)\)/).replace("label",LY).getRegex(),reflink:Vc(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",LY).getRegex()},g5e={...x5e,emStrongRDelimAst:XZn,emStrongLDelim:WZn,url:Vc(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},eeo={...g5e,br:Vc(_mt).replace("{2,}","*").getRegex(),text:Vc(g5e.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},OY={normal:p5e,gfm:NZn,pedantic:HZn},fI={normal:x5e,gfm:g5e,breaks:eeo,pedantic:ZZn},teo={"&":"&","<":"<",">":">",'"':""","'":"'"},gmt=t=>teo[t];function T3(t,e){if(e){if(f2.escapeTest.test(t))return t.replace(f2.escapeReplace,gmt)}else if(f2.escapeTestNoEncode.test(t))return t.replace(f2.escapeReplaceNoEncode,gmt);return t}function ymt(t){try{t=encodeURI(t).replace(f2.percentDecode,"%")}catch{return null}return t}function bmt(t,e){const n=t.replace(f2.findPipe,(i,s,a)=>{let c=!1,l=s;for(;--l>=0&&a[l]==="\\";)c=!c;return c?"|":" |"}),o=n.split(f2.splitPipe);let r=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),e)if(o.length>e)o.splice(e);else for(;o.length<e;)o.push("");for(;r<o.length;r++)o[r]=o[r].trim().replace(f2.slashPipe,"|");return o}function xI(t,e,n){const o=t.length;if(o===0)return"";let r=0;for(;r<o&&t.charAt(o-r-1)===e;)r++;return t.slice(0,o-r)}function neo(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===e[0])n++;else if(t[o]===e[1]&&(n--,n<0))return o;return n>0?-2:-1}function Pmt(t,e,n,o,r){const i=e.href,s=e.title||null,a=t[1].replace(r.other.outputLinkReplace,"$1");o.state.inLink=!0;const c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:s,text:a,tokens:o.inlineTokens(a)};return o.state.inLink=!1,c}function oeo(t,e,n){const o=t.match(n.other.indentCodeCompensation);if(o===null)return e;const r=o[1];return e.split(`
|
|
5712
5712
|
`).map(i=>{const s=i.match(n.other.beginningSpace);if(s===null)return i;const[a]=s;return a.length>=r.length?i.slice(r.length):i}).join(`
|
|
5713
5713
|
`)}var FY=class{options;rules;lexer;constructor(t){this.options=t||sC}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:xI(n,`
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.1689",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@tscircuit/capacity-autorouter": "^0.0.475",
|
|
56
56
|
"@tscircuit/checks": "0.0.125",
|
|
57
57
|
"@tscircuit/circuit-json-util": "^0.0.94",
|
|
58
|
-
"@tscircuit/cli": "^0.1.
|
|
58
|
+
"@tscircuit/cli": "^0.1.1303",
|
|
59
59
|
"@tscircuit/copper-pour-solver": "^0.0.23",
|
|
60
60
|
"@tscircuit/core": "^0.0.1205",
|
|
61
61
|
"@tscircuit/eval": "^0.0.797",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@tscircuit/miniflex": "^0.0.4",
|
|
69
69
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
70
70
|
"@tscircuit/props": "^0.0.513",
|
|
71
|
-
"@tscircuit/runframe": "^0.0.
|
|
71
|
+
"@tscircuit/runframe": "^0.0.1888",
|
|
72
72
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
73
73
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
74
74
|
"@tscircuit/simple-3d-svg": "^0.0.41",
|