@modern-js/module-tools-docs 2.0.0-beta.4
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/LICENSE +144 -0
- package/docs/.island/config.ts +245 -0
- package/docs/.island/dist/404.html +41 -0
- package/docs/.island/dist/assets/before-getting-started.1b82b538.js +87 -0
- package/docs/.island/dist/assets/before-getting-started.582a31cc.js +87 -0
- package/docs/.island/dist/assets/build-config.72eb0918.js +804 -0
- package/docs/.island/dist/assets/build-config.d8bb1658.js +809 -0
- package/docs/.island/dist/assets/build-preset.96805d7d.js +256 -0
- package/docs/.island/dist/assets/build-preset.c20dcd40.js +256 -0
- package/docs/.island/dist/assets/build-your-ui.7f349247.js +2 -0
- package/docs/.island/dist/assets/build-your-ui.a8361604.js +2 -0
- package/docs/.island/dist/assets/command-preview.2d45fc82.js +264 -0
- package/docs/.island/dist/assets/command-preview.dc51b953.js +264 -0
- package/docs/.island/dist/assets/components.esm.03560353.js +9 -0
- package/docs/.island/dist/assets/design-system.86694ff5.js +1254 -0
- package/docs/.island/dist/assets/design-system.c4745cce.js +639 -0
- package/docs/.island/dist/assets/dev.1d326a37.js +37 -0
- package/docs/.island/dist/assets/dev.1fd06000.js +37 -0
- package/docs/.island/dist/assets/down.f35427d3.svg +1 -0
- package/docs/.island/dist/assets/extension.12299fd6.js +2 -0
- package/docs/.island/dist/assets/extension.96dc63a4.js +2 -0
- package/docs/.island/dist/assets/getting-started.40e9218d.js +117 -0
- package/docs/.island/dist/assets/getting-started.b1ed3f10.js +114 -0
- package/docs/.island/dist/assets/github.3bf8ccee.svg +1 -0
- package/docs/.island/dist/assets/index.2b2347ea.js +33 -0
- package/docs/.island/dist/assets/index.6cef6f5f.js +4 -0
- package/docs/.island/dist/assets/index.cb118238.js +36 -0
- package/docs/.island/dist/assets/index.ccb6ce27.js +4 -0
- package/docs/.island/dist/assets/island_inject.11a12ecc.js +1 -0
- package/docs/.island/dist/assets/island_inject.b13deaee.js +1 -0
- package/docs/.island/dist/assets/loading.8c9bb911.svg +1 -0
- package/docs/.island/dist/assets/modify-output-product.7f6bff35.js +100 -0
- package/docs/.island/dist/assets/modify-output-product.b91eff1f.js +100 -0
- package/docs/.island/dist/assets/moon.6b705924.svg +3 -0
- package/docs/.island/dist/assets/plugin.895932d8.js +42 -0
- package/docs/.island/dist/assets/plugin.d2fbc531.js +42 -0
- package/docs/.island/dist/assets/publish-your-project.21b8309f.js +164 -0
- package/docs/.island/dist/assets/publish-your-project.8d398b17.js +166 -0
- package/docs/.island/dist/assets/right.89674cd7.svg +1 -0
- package/docs/.island/dist/assets/search.0aea6901.svg +1 -0
- package/docs/.island/dist/assets/search.1c85d17c.js +3 -0
- package/docs/.island/dist/assets/search.484eca11.js +222 -0
- package/docs/.island/dist/assets/search.54fca8d0.js +3 -0
- package/docs/.island/dist/assets/style.09015a4b.css +1 -0
- package/docs/.island/dist/assets/style.2e5f7bc2.css +1970 -0
- package/docs/.island/dist/assets/sun.841dac10.svg +11 -0
- package/docs/.island/dist/assets/test-your-project.18bd4582.js +190 -0
- package/docs/.island/dist/assets/test-your-project.f53bebf7.js +190 -0
- package/docs/.island/dist/assets/test.0da1f99f.js +67 -0
- package/docs/.island/dist/assets/test.0e81f002.js +66 -0
- package/docs/.island/dist/assets/translator.b1077c44.svg +1 -0
- package/docs/.island/dist/assets/use-micro-generator.7d9e4016.js +60 -0
- package/docs/.island/dist/assets/use-micro-generator.db5520c1.js +60 -0
- package/docs/.island/dist/assets/using-storybook.57ea6b77.js +260 -0
- package/docs/.island/dist/assets/using-storybook.a2212f2e.js +260 -0
- package/docs/.island/dist/assets/welcome.0449a9c8.js +13 -0
- package/docs/.island/dist/assets/welcome.a8448931.js +13 -0
- package/docs/.island/dist/assets/why-module-engineering-solution.6ae8c0e3.js +26 -0
- package/docs/.island/dist/assets/why-module-engineering-solution.c9a45cbd.js +26 -0
- package/docs/.island/dist/chunk-COLCRJ2V.js +1 -0
- package/docs/.island/dist/chunk-K5FMOYDC.js +10 -0
- package/docs/.island/dist/chunk-WE42KMYS.js +26 -0
- package/docs/.island/dist/client-entry.js +3 -0
- package/docs/.island/dist/en/api/build-config.html +344 -0
- package/docs/.island/dist/en/api/build-preset.html +82 -0
- package/docs/.island/dist/en/api/design-system.html +155 -0
- package/docs/.island/dist/en/api/dev.html +45 -0
- package/docs/.island/dist/en/api/index.html +41 -0
- package/docs/.island/dist/en/api/plugin.html +48 -0
- package/docs/.island/dist/en/api/test.html +58 -0
- package/docs/.island/dist/en/guide/before-getting-started.html +127 -0
- package/docs/.island/dist/en/guide/build-your-ui.html +41 -0
- package/docs/.island/dist/en/guide/command-preview.html +100 -0
- package/docs/.island/dist/en/guide/extension.html +41 -0
- package/docs/.island/dist/en/guide/getting-started.html +76 -0
- package/docs/.island/dist/en/guide/modify-output-product.html +140 -0
- package/docs/.island/dist/en/guide/publish-your-project.html +91 -0
- package/docs/.island/dist/en/guide/test-your-project.html +72 -0
- package/docs/.island/dist/en/guide/use-micro-generator.html +65 -0
- package/docs/.island/dist/en/guide/using-storybook.html +113 -0
- package/docs/.island/dist/en/guide/welcome.html +53 -0
- package/docs/.island/dist/en/guide/why-module-engineering-solution.html +49 -0
- package/docs/.island/dist/en/index.html +42 -0
- package/docs/.island/dist/react-dom.js +1 -0
- package/docs/.island/dist/react-dom_client.js +1 -0
- package/docs/.island/dist/react.js +1 -0
- package/docs/.island/dist/react_jsx-runtime.js +10 -0
- package/docs/.island/dist/ssr-manifest.json +57 -0
- package/docs/.island/dist/test-result.png +0 -0
- package/docs/.island/dist/why-module-solution.png +0 -0
- package/docs/.island/dist/zh/api/build-config.html +347 -0
- package/docs/.island/dist/zh/api/build-preset.html +82 -0
- package/docs/.island/dist/zh/api/design-system.html +149 -0
- package/docs/.island/dist/zh/api/dev.html +46 -0
- package/docs/.island/dist/zh/api/index.html +41 -0
- package/docs/.island/dist/zh/api/plugin.html +48 -0
- package/docs/.island/dist/zh/api/test.html +59 -0
- package/docs/.island/dist/zh/guide/before-getting-started.html +127 -0
- package/docs/.island/dist/zh/guide/build-your-ui.html +41 -0
- package/docs/.island/dist/zh/guide/command-preview.html +100 -0
- package/docs/.island/dist/zh/guide/extension.html +41 -0
- package/docs/.island/dist/zh/guide/getting-started.html +79 -0
- package/docs/.island/dist/zh/guide/modify-output-product.html +140 -0
- package/docs/.island/dist/zh/guide/publish-your-project.html +92 -0
- package/docs/.island/dist/zh/guide/test-your-project.html +72 -0
- package/docs/.island/dist/zh/guide/use-micro-generator.html +65 -0
- package/docs/.island/dist/zh/guide/using-storybook.html +114 -0
- package/docs/.island/dist/zh/guide/welcome.html +53 -0
- package/docs/.island/dist/zh/guide/why-module-engineering-solution.html +49 -0
- package/docs/.island/dist/zh/index.html +42 -0
- package/docs/.island/index.html +39 -0
- package/docs/.island/styles/index.css +10 -0
- package/docs/en/api/build-config.md +501 -0
- package/docs/en/api/build-preset.md +214 -0
- package/docs/en/api/design-system.md +524 -0
- package/docs/en/api/dev.md +32 -0
- package/docs/en/api/index.md +3 -0
- package/docs/en/api/plugin.md +34 -0
- package/docs/en/api/test.md +48 -0
- package/docs/en/guide/advance/asset.mdx +132 -0
- package/docs/en/guide/advance/build-umd.mdx +241 -0
- package/docs/en/guide/advance/copy.md +235 -0
- package/docs/en/guide/advance/external-dependency.mdx +125 -0
- package/docs/en/guide/advance/in-depth-about-build.md +266 -0
- package/docs/en/guide/advance/in-depth-about-dev-command.md +22 -0
- package/docs/en/guide/basic/before-getting-started.md +187 -0
- package/docs/en/guide/basic/command-preview.md +204 -0
- package/docs/en/guide/basic/modify-output-product.md +145 -0
- package/docs/en/guide/basic/publish-your-project.md +115 -0
- package/docs/en/guide/basic/test-your-project.mdx +158 -0
- package/docs/en/guide/basic/use-micro-generator.md +35 -0
- package/docs/en/guide/basic/using-storybook.mdx +187 -0
- package/docs/en/guide/intro/getting-started.md +78 -0
- package/docs/en/guide/intro/welcome.md +14 -0
- package/docs/en/guide/intro/why-module-engineering-solution.md +17 -0
- package/docs/en/index.md +35 -0
- package/docs/public/test-result.png +0 -0
- package/docs/public/why-module-solution.png +0 -0
- package/docs/zh/api/build-config.md +570 -0
- package/docs/zh/api/build-preset.md +220 -0
- package/docs/zh/api/design-system.md +1147 -0
- package/docs/zh/api/dev.md +33 -0
- package/docs/zh/api/index.md +3 -0
- package/docs/zh/api/plugins.md +108 -0
- package/docs/zh/api/testing.md +52 -0
- package/docs/zh/guide/advance/asset.mdx +132 -0
- package/docs/zh/guide/advance/build-umd.mdx +232 -0
- package/docs/zh/guide/advance/copy.md +235 -0
- package/docs/zh/guide/advance/external-dependency.mdx +125 -0
- package/docs/zh/guide/advance/in-depth-about-build.md +267 -0
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +26 -0
- package/docs/zh/guide/basic/before-getting-started.md +187 -0
- package/docs/zh/guide/basic/command-preview.md +204 -0
- package/docs/zh/guide/basic/modify-output-product.md +144 -0
- package/docs/zh/guide/basic/publish-your-project.md +112 -0
- package/docs/zh/guide/basic/test-your-project.mdx +158 -0
- package/docs/zh/guide/basic/use-micro-generator.md +35 -0
- package/docs/zh/guide/basic/using-storybook.mdx +186 -0
- package/docs/zh/guide/intro/getting-started.md +78 -0
- package/docs/zh/guide/intro/welcome.md +14 -0
- package/docs/zh/guide/intro/why-module-engineering-solution.md +17 -0
- package/docs/zh/index.md +29 -0
- package/package.json +19 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import C,{createContext as bo,useContext as Sn,useCallback as yo,useMemo as xo}from"react";import{unstable_batchedUpdates as wo}from"react-dom";import{jsx as h,jsxs as B,Fragment as G}from"react/jsx-runtime";function M(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}const Co=e=>/^#([A-Fa-f0-9]{3,4}){1,2}$/.test(e),Oo=(e,t)=>e.match(new RegExp(`.{${t}}`,"g")),To=e=>parseInt(e.repeat(2/e.length),16);function Fo(e,t){return typeof e<"u"?e/255:typeof t!="number"||t<0||t>1?1:t}function ko(e){if(!e)return;if(!Co(e))throw new Error("Invalid color string, must be a valid hex color");const t=Math.floor((e.length-1)/3),n=Oo(e.slice(1),t),[r,o,i,s]=n.map(To);return{r,g:o,b:i,a:Fo(s,1)}}function So(e){if(!e)return;const{r:t,g:n,b:r,a:o}=e,i=Math.round(o*255);return`#${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Ue(e,t){if(!e)return e;const{r:n,g:r,b:o,a:i}=ko(e);return So({r:n,g:r,b:o,a:i*t})}function R(e,t){return{prev:t(e.prev,"prev"),next:t(e.next,"next")}}function Bn(e,t){return{prev:(e==null?void 0:e.prev)===void 0?t:e.prev,next:(e==null?void 0:e.next)===void 0?t:e.next}}function at(e,t,n){return R(Bn(e,t),n)}function Bo(e,t){return t(e.prev)||t(e.next)}function jn(e){return e.lines.map(t=>t.tokens.map(n=>n.content).join("")).join(`
|
|
2
|
+
`)}function jo(e,t){return ft(e?En(e).map(In):[...t.keys()].map(n=>({[n+1]:!0})))}function En(e){return e.split(/,(?![^\[]*\])/g)}function ft(e){return e.reduce((t,n)=>Object.assign(t,n),{})}function Eo(e){return!!e.match(/(\d+)\[(.+)\]/)}function In(e){const t=e.match(/(\d+)\[(.+)\]/);if(t){const[,n,r]=t,o=r.split(",").map(Ln);return{[Number(n)]:o}}else return ft(ht(e).map(n=>({[n]:!0})))}function Ln(e){const[t,n]=e.split(":");if(!qe(t))throw new Xe(t);const r=Number(t);if(r<1)throw new _n;if(n){if(!qe(n))throw new Xe(n);return{start:r,end:+n}}else return{start:r,end:r}}function Io(e,t){if(e){const n=Nn(e),r=Object.keys(n).map(o=>parseInt(o,10));return[Math.min(...r),Math.max(...r)]}else return[0,t.length-1]}function Lo(e,t){if(e){const n=Nn(e);return Object.keys(n).map(o=>parseInt(o,10))}else return[...t.keys()]}function Nn(e){if(!e)throw new Error("Focus cannot be empty");try{const t=e.split(/,(?![^\[]*\])/g).map(No);return _o(t.flat())}catch(t){throw t}}function No(e){const t=e.match(/(\d+)\[(.+)\]/);if(t){const[,n,r]=t,o=r.split(",").map(ht),i=Number(n)-1,s=o.flat().map(c=>c-1);return[[i,s]]}else return ht(e).map(n=>[n-1,!0])}function ht(e){const[t,n]=e.split(":");if(!qe(t))throw new Xe(t);const r=Number(t);if(r<1)throw new _n;if(n){if(!qe(n))throw new Xe(n);const o=[];for(let i=r;i<=+n;i++)o.push(i);return o}else return[r]}function qe(e){e=e.toString();var t=Math.abs(e),n=parseInt(e,10);return!isNaN(t)&&n===t&&t.toString()===e}class _n extends Error{constructor(){super("Invalid line or column number in focus string"),Object.setPrototypeOf(this,new.target.prototype)}}class Xe extends Error{constructor(t){super(`Invalid number "${t}" in focus string`),this.number=t,Object.setPrototypeOf(this,new.target.prototype)}}function _o(e){const t={};let n=-1,r=e==null?0:e.length;for(;++n<r;){var o=e[n];t[o[0]]=o[1]}return t}var m;(function(e){e[e.CodeForeground=0]="CodeForeground",e[e.CodeBackground=1]="CodeBackground",e[e.EditorForeground=2]="EditorForeground",e[e.EditorBackground=3]="EditorBackground",e[e.FocusBorder=4]="FocusBorder",e[e.ActiveTabBackground=5]="ActiveTabBackground",e[e.ActiveTabForeground=6]="ActiveTabForeground",e[e.InactiveTabBackground=7]="InactiveTabBackground",e[e.InactiveTabForeground=8]="InactiveTabForeground",e[e.EditorGroupBorder=9]="EditorGroupBorder",e[e.EditorGroupHeaderBackground=10]="EditorGroupHeaderBackground",e[e.TabBorder=11]="TabBorder",e[e.ActiveTabBottomBorder=12]="ActiveTabBottomBorder",e[e.LineNumberForeground=13]="LineNumberForeground",e[e.InputForeground=14]="InputForeground",e[e.InputBackground=15]="InputBackground",e[e.InputBorder=16]="InputBorder",e[e.SelectionBackground=17]="SelectionBackground",e[e.IconForeground=18]="IconForeground",e[e.ListActiveSelectionBackground=19]="ListActiveSelectionBackground",e[e.ListActiveSelectionForeground=20]="ListActiveSelectionForeground",e[e.ListHoverBackground=21]="ListHoverBackground",e[e.ListHoverForeground=22]="ListHoverForeground",e[e.SideBarBackground=23]="SideBarBackground",e[e.SideBarForeground=24]="SideBarForeground",e[e.SideBarBorder=25]="SideBarBorder",e[e.LineHighlightBackground=26]="LineHighlightBackground",e[e.RangeHighlightBackground=27]="RangeHighlightBackground",e[e.EditorInfoForeground=28]="EditorInfoForeground"})(m||(m={}));const Re="#6FC3DF";function T(e,t){var n,r;const o=e.colors||{};switch(t){case m.CodeForeground:return((n=en(e))===null||n===void 0?void 0:n.foreground)||T(e,m.EditorForeground);case m.CodeBackground:return((r=en(e))===null||r===void 0?void 0:r.background)||T(e,m.EditorBackground);case m.EditorBackground:return o["editor.background"]||H(e,{light:"#fffffe",dark:"#1E1E1E",hc:"#000000"});case m.EditorForeground:return o["editor.foreground"]||H(e,{light:"#333333",dark:"#BBBBBB",hc:"#fffffe"});case m.FocusBorder:return o.focusBorder||H(e,{light:"#0090F1",dark:"#007FD4",hc:Re});case m.ActiveTabBackground:return o["tab.activeBackground"]||T(e,m.EditorBackground);case m.ActiveTabForeground:return o["tab.activeForeground"]||H(e,{dark:"#ffffff",light:"#333333",hc:"#ffffff"});case m.InactiveTabBackground:return o["tab.inactiveBackground"]||H(e,{dark:"#2D2D2D",light:"#ECECEC",hc:void 0});case m.InactiveTabForeground:return o["tab.inactiveForeground"]||H(e,{dark:Ue(T(e,m.ActiveTabForeground),.5),light:Ue(T(e,m.ActiveTabForeground),.7),hc:"#ffffff"});case m.TabBorder:return o["tab.border"]||H(e,{dark:"#252526",light:"#F3F3F3",hc:Re});case m.ActiveTabBottomBorder:return o["tab.activeBorder"]||T(e,m.ActiveTabBackground);case m.EditorGroupBorder:return o["editorGroup.border"]||H(e,{dark:"#444444",light:"#E7E7E7",hc:Re});case m.EditorGroupHeaderBackground:return o["editorGroupHeader.tabsBackground"]||H(e,{dark:"#252526",light:"#F3F3F3",hc:void 0});case m.LineNumberForeground:return o["editorLineNumber.foreground"]||H(e,{dark:"#858585",light:"#237893",hc:"#fffffe"});case m.InputBackground:return o["input.background"]||H(e,{dark:"#3C3C3C",light:"#fffffe",hc:"#000000"});case m.InputForeground:return o["input.foreground"]||T(e,m.EditorForeground);case m.InputBorder:return o["input.border"]||H(e,{dark:void 0,light:void 0,hc:Re});case m.SelectionBackground:return o["editor.selectionBackground"]||H(e,{light:"#ADD6FF",dark:"#264F78",hc:"#f3f518"});case m.IconForeground:return o["icon.foreground"]||H(e,{dark:"#C5C5C5",light:"#424242",hc:"#FFFFFF"});case m.SideBarBackground:return o["sideBar.background"]||H(e,{dark:"#252526",light:"#F3F3F3",hc:"#000000"});case m.SideBarForeground:return o["sideBar.foreground"]||T(e,m.EditorForeground);case m.SideBarBorder:return o["sideBar.border"]||T(e,m.SideBarBackground);case m.ListActiveSelectionBackground:return o["list.activeSelectionBackground"]||H(e,{dark:"#094771",light:"#0060C0",hc:"#000000"});case m.ListActiveSelectionForeground:return o["list.activeSelectionForeground"]||H(e,{dark:"#fffffe",light:"#fffffe",hc:"#fffffe"});case m.ListHoverBackground:return o["list.hoverBackground"]||H(e,{dark:"#2A2D2E",light:"#F0F0F0",hc:void 0});case m.ListHoverForeground:return o["list.hoverForeground"]||void 0;case m.LineHighlightBackground:return o["editor.lineHighlightBackground"]||H(e,{dark:void 0,light:void 0,hc:void 0});case m.RangeHighlightBackground:return o["editor.rangeHighlightBackground"]||H(e,{dark:"#ffffff0b",light:"#fdff0033",hc:void 0});case m.EditorInfoForeground:return o["editor.infoForeground"]||H(e,{dark:"#3794FF",light:"#1a85ff",hc:"#3794FF"});default:return"#f00"}}function Pn(e){const t=An(e);if(t==="dark")return"dark";if(t==="light")return"light"}function H(e,t){return t[An(e)]}function An(e){var t;return e.type?e.type:!((t=e.name)===null||t===void 0)&&t.toLowerCase().includes("light")?"light":"dark"}function Po(e){return{fg:T(e,m.CodeForeground),bg:T(e,m.CodeBackground)}}function en(e){let t=e.settings?e.settings:e.tokenColors;const n=t?t.find(r=>!r.name&&!r.scope):void 0;return n==null?void 0:n.settings}const Hn=typeof window<"u"?C.useLayoutEffect:C.useEffect,De=200;function Ao(e,t,n,r,o,i){const[s,c]=C.useState(null),l=$o(),u=C.useRef(null),{prevLongestLine:f,nextLongestLine:g,element:b}=C.useMemo(()=>{const w=tn(e.prev,t.prev),x=tn(e.next,t.next),O=(e.prev||e.next).trimEnd().split(Mn),j=O.length;if(o){const E=o==="focus"?Ro(t,O):o;let I=O.length;for(;I<E;)O.push(""),I++;for(;I>E;)O.pop(),I--;w&&!O.includes(w)&&(O[O.length-1]=w)}let k=!1;const S=B("code",{className:"ch-code-scroll-parent",children:[h("br",{}),O.map((E,I)=>{const _=!k&&E===w?u:void 0;return k=k||_!=null,B("div",{ref:_,children:[r?B("span",{className:"ch-code-line-number",children:["_",j]}):void 0,h("div",{style:{display:"inline-block",marginLeft:16},children:h("span",{children:E})})]},I)}),h("br",{})]});return{prevLongestLine:w,nextLongestLine:x,element:S}},[e]),p=[...i,l,f,g,n];return Hn(()=>{var w;if(u.current){const x=u.current,O=x==null?void 0:x.parentElement,j=O.parentElement,k=x==null?void 0:x.querySelector(":scope > div"),S=x==null?void 0:x.querySelector(":scope > span"),E=S?Ho(S):0,I=ct(k),_=I/f.length||1,U=g.length*_,ye=(w=lt(k))!==null&&w!==void 0?w:20,xe={containerWidth:ct(j.parentElement),containerHeight:lt(j.parentElement),contentWidth:ct(O.parentElement),contentHeight:lt(O.parentElement),lineWidths:[I||U||De,U||I||De],lineWidth:[Math.max(I||U||De,_*n),Math.max(U||I||De,_*n)],lineHeight:ye,colWidth:_,lineNumberWidth:E,deps:p};c(xe)}},p),!s||Mo(s.deps,p)?{element:b,dimensions:null}:{element:b,dimensions:s}}const Mn=/\r\n|\r|\n/;function tn(e,t){const n=e?e.split(Mn):[""],r=Lo(t,n);let o="";return n.forEach((i,s)=>{r.includes(s)&&i.length>o.length&&(o=i)}),o}function ct(e){const t=getComputedStyle(e);return parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)}function Ho(e){const t=getComputedStyle(e);return parseFloat(t.width)}function lt(e){if(!e)return null;const t=getComputedStyle(e);return parseFloat(t.height)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}function Mo(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1}function $o(){const[e,t]=C.useState(void 0);return C.useEffect(()=>{function n(){t(window.innerWidth)}return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Ro(e,t){const[n,r]=Io(e.prev,t);return r-n+1}function se(){}se.prototype={diff:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.callback;typeof r=="function"&&(o=r,r={}),this.options=r;var i=this;function s(x){return o?(setTimeout(function(){o(void 0,x)},0),!0):x}t=this.castInput(t),n=this.castInput(n),t=this.removeEmpty(this.tokenize(t)),n=this.removeEmpty(this.tokenize(n));var c=n.length,l=t.length,u=1,f=c+l,g=[{newPos:-1,components:[]}],b=this.extractCommon(g[0],n,t,0);if(g[0].newPos+1>=c&&b+1>=l)return s([{value:this.join(n),count:n.length}]);function p(){for(var x=-1*u;x<=u;x+=2){var O=void 0,j=g[x-1],k=g[x+1],S=(k?k.newPos:0)-x;j&&(g[x-1]=void 0);var E=j&&j.newPos+1<c,I=k&&0<=S&&S<l;if(!E&&!I){g[x]=void 0;continue}if(!E||I&&j.newPos<k.newPos?(O=Wo(k),i.pushComponent(O.components,void 0,!0)):(O=j,O.newPos++,i.pushComponent(O.components,!0,void 0)),S=i.extractCommon(O,n,t,x),O.newPos+1>=c&&S+1>=l)return s(Do(i,O.components,n,t,i.useLongestToken));g[x]=O}u++}if(o)(function x(){setTimeout(function(){if(u>f)return o();p()||x()},0)})();else for(;u<=f;){var w=p();if(w)return w}},pushComponent:function(t,n,r){var o=t[t.length-1];o&&o.added===n&&o.removed===r?t[t.length-1]={count:o.count+1,added:n,removed:r}:t.push({count:1,added:n,removed:r})},extractCommon:function(t,n,r,o){for(var i=n.length,s=r.length,c=t.newPos,l=c-o,u=0;c+1<i&&l+1<s&&this.equals(n[c+1],r[l+1]);)c++,l++,u++;return u&&t.components.push({count:u}),t.newPos=c,l},equals:function(t,n){return this.options.comparator?this.options.comparator(t,n):t===n||this.options.ignoreCase&&t.toLowerCase()===n.toLowerCase()},removeEmpty:function(t){for(var n=[],r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};function Do(e,t,n,r,o){for(var i=0,s=t.length,c=0,l=0;i<s;i++){var u=t[i];if(u.removed){if(u.value=e.join(r.slice(l,l+u.count)),l+=u.count,i&&t[i-1].added){var g=t[i-1];t[i-1]=t[i],t[i]=g}}else{if(!u.added&&o){var f=n.slice(c,c+u.count);f=f.map(function(p,w){var x=r[l+w];return x.length>p.length?x:p}),u.value=e.join(f)}else u.value=e.join(n.slice(c,c+u.count));c+=u.count,u.added||(l+=u.count)}}var b=t[s-1];return s>1&&typeof b.value=="string"&&(b.added||b.removed)&&e.equals("",b.value)&&(t[s-2].value+=b.value,t.pop()),t}function Wo(e){return{newPos:e.newPos,components:e.components.slice(0)}}var nn=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,rn=/\S/,$n=new se;$n.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!rn.test(e)&&!rn.test(t)};$n.tokenize=function(e){for(var t=e.split(/(\s+|[()[\]{}'"]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&nn.test(t[n])&&nn.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var wt=new se;wt.tokenize=function(e){var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var o=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=o:(this.options.ignoreWhitespace&&(o=o.trim()),t.push(o))}return t};function zo(e,t,n){return wt.diff(e,t,n)}var Go=new se;Go.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Uo=new se;Uo.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Ge(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ge=function(t){return typeof t}:Ge=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(e)}var qo=Object.prototype.toString,Be=new se;Be.useLongestToken=!0;Be.tokenize=wt.tokenize;Be.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,o=r===void 0?function(i,s){return typeof s>"u"?n:s}:r;return typeof e=="string"?e:JSON.stringify(gt(e,null,null,o),o," ")};Be.equals=function(e,t){return se.prototype.equals.call(Be,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function gt(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o,e));var i;for(i=0;i<t.length;i+=1)if(t[i]===e)return n[i];var s;if(qo.call(e)==="[object Array]"){for(t.push(e),s=new Array(e.length),n.push(s),i=0;i<e.length;i+=1)s[i]=gt(e[i],t,n,r,o);return t.pop(),n.pop(),s}if(e&&e.toJSON&&(e=e.toJSON()),Ge(e)==="object"&&e!==null){t.push(e),s={},n.push(s);var c=[],l;for(l in e)e.hasOwnProperty(l)&&c.push(l);for(c.sort(),i=0;i<c.length;i+=1)l=c[i],s[l]=gt(e[l],t,n,r,l);t.pop(),n.pop()}else s=e;return s}var pt=new se;pt.tokenize=function(e){return e.slice()};pt.join=pt.removeEmpty=function(e){return e};function Xo(e,t){let n=0,r=0;return{lines:Ko(e).map(s=>s.next===void 0?Object.assign(Object.assign({},t.prev[s.prev]),{lineNumber:{prev:s.prev+1},move:"exit",enterIndex:null,exitIndex:r++}):s.prev===void 0?Object.assign(Object.assign({},t.next[s.next]),{lineNumber:{next:s.next+1},move:"enter",enterIndex:n++,exitIndex:null}):Object.assign(Object.assign({},t.prev[s.prev]),{lineNumber:{prev:s.prev+1,next:s.next+1},move:"stay",enterIndex:null,exitIndex:null})),enterCount:n,exitCount:r}}function Ko(e){const t=zo(e.prev,e.next);let n=[],r=0,o=0;return t.forEach(i=>{if(i.added)for(let s=0;s<i.count;s++)n.push({next:o++});else if(i.removed)for(let s=0;s<i.count;s++)n.push({prev:r++});else for(let s=0;s<i.count;s++)n.push({prev:r++,next:o++})}),n}function Yo(e,t,n){const{lines:r}=e,o=M(e,["lines"]),i=R(t,(f,g)=>{const b=g==="prev"?r.filter(p=>p.move!=="enter"):r.filter(p=>p.move!=="exit");return jo(f,b)}),s=r.map(f=>{const{tokens:g}=f,b=M(f,["tokens"]),p={prev:f.lineNumber.prev?i.prev[f.lineNumber.prev]:!1,next:f.lineNumber.next?i.next[f.lineNumber.next]:!1},w={prev:f.lineNumber.prev?n.prev[f.lineNumber.prev]||[]:[],next:f.lineNumber.next?n.next[f.lineNumber.next]||[]:[]};return Object.assign({focused:R(p,x=>!!x),groups:Zo(g,p,w)},b)}),c=R(i,f=>Object.keys(f).map(g=>Number(g))),l=R(c,f=>Math.min(...f)),u=R(c,f=>Math.max(...f));return Object.assign({lines:s,firstFocusedLineNumber:l,lastFocusedLineNumber:u},o)}function Zo(e,t,n){const r=R(t,f=>Array.isArray(f)?f:[]),o=R(n,f=>f.map(({columnNumbers:g})=>g)),i=[...r.prev,...r.next,...o.prev,...o.next],s=Qo(e,i);let c=0,l=null;const u=[];return s.forEach(f=>{const g=on(c,t.prev),b=on(c,t.next),p=sn(c,n.prev),w=sn(c,n.next);(!l||l.focused.prev!==g||l.focused.next!==b||l.annotation.prev!==p||l.annotation.next!==w)&&(l={focused:{prev:g,next:b},tokens:[],annotation:{prev:p,next:w}},u.push(l)),l==null||l.tokens.push(f),c+=f.content.length}),u.map(f=>({focused:f.focused,tokens:f.tokens,element:Jo(f)}))}function Jo(e){return h(G,{children:e.tokens.map(({content:t,props:n},r)=>h("span",{...Object.assign({},n,{key:r+1}),children:t}))})}function Qo(e,t){const n=[...t.map(o=>o.start-1),...t.map(o=>o.end)];let r=e;return n.forEach(o=>{const i=[];let s=0;r.forEach(c=>{const l=s,u=s+c.content.length;if(l<o&&o<u){const g=o-l,b=c.content.slice(0,g),p=c.content.slice(g);i.push(Object.assign(Object.assign({},c),{content:b})),i.push(Object.assign(Object.assign({},c),{content:p}))}else i.push(c);s=u}),r=i}),r}function on(e,t){return Array.isArray(t)?t.some(({start:n,end:r})=>n-1<=e&&e<r):t}function sn(e,t){return t.find(({columnNumbers:n})=>n.start-1<=e&&e<n.end)}function je(e,t){if(e.fixed===!0)return e.value;{const[n,r]=e.interval,[o,i]=e.extremes;if(t<n)return o;if(t>r)return i;const s=(t-n)/(r-n),c=e.ease||Se.linear;return o+c(s)*(i-o)}}function an([e,t],n,r){if(r<=1)return[e,t];const o=t-e,i=o/Math.pow(r,1/8),s=(o-i)/(r-1),c=e+s*n,l=c+i;return[c,l]}const Se={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1}};function Vo(e,t,n,r){const[o,i]=t;return e.map(s=>{const c=R(s.lineNumber,b=>b&&b-1),{enterIndex:l,exitIndex:u}=s,f=s.move==="exit"?{fixed:!0,value:c.prev}:s.move==="enter"?{fixed:!0,value:c.next}:{fixed:!1,extremes:[c.prev,c.next],interval:[o,i],ease:Se.easeInOutCubic},g=s.move==="exit"?{fixed:!1,extremes:[0,-1],ease:Se.easeInQuad,interval:an([0,o],u,r)}:s.move==="enter"?{fixed:!1,extremes:[1,0],ease:Se.easeOutQuad,interval:an([i,1],l,n)}:{fixed:!0,value:0};return Object.assign(Object.assign({},s),{tweenX:g,tweenY:f})})}function ei(e,t){const n=at(e,[],i=>i.flatMap(s=>En(s.focus).map(c=>Object.assign(Object.assign({},s),{focus:c})))),r=at(n,[],i=>i.filter(cn)),o=at(n,[],i=>i.filter(s=>!cn(s)));return{inlineAnnotations:R(r,i=>ti(i,t)),multilineAnnotations:R(o,i=>ri(i,t))}}function cn(e){return Eo(e.focus)}function ti(e,t){const n={};return e.forEach(r=>{const o=In(r.focus),i=+Object.keys(o)[0],s=o[i],c=n[i]||[];c.push({columnNumbers:s[0],data:r.data,theme:t,Component:r.Component||ni()}),n[i]=c}),n}function ni(e,t){return({children:n})=>h("span",{style:{outline:"red 1px solid"},children:n})}function ri(e,t){return e.map(n=>({lineNumbers:Ln(n.focus),data:n.data,theme:t,Component:n.Component||oi(n,t)}))}function oi(e,t){const n=t.colors["editor.lineHighlightBackground"]||t.colors["editor.selectionHighlightBackground"];return({children:r,style:o})=>B("div",{style:Object.assign(Object.assign({},o),{background:n,cursor:"pointer"}),onClick:i=>alert("clicked"),className:"ch-code-bg-annotation",children:[h("span",{className:"ch-code-bg-annotation-border",style:{background:"#00a2d3",width:"3px",height:"100%",position:"absolute",left:0}}),r]})}function ii(e,t){return{prev:ln(e,t.prev,n=>n.lineNumber.prev),next:ln(e,t.next,n=>n.lineNumber.next)}}function ln(e,t,n){const r=[...t];r.sort((s,c)=>s.lineNumbers.start-c.lineNumbers.start);let o=0;const i=[];for(;o<e.length;){const s=r[0];let c=e[o];if(s&&n(c)>s.lineNumbers.start)throw"Code Hike can't handle two annotations for the same line";if(s&&n(c)===s.lineNumbers.start){const l={lines:[],annotation:s};for(;c&&(!n(c)||n(c)<=s.lineNumbers.end);)l.lines.push(c),c=e[++o];i.push(l),r.shift()}else if(!s)i.push({lines:e.slice(o)}),o=e.length;else{const l={lines:[]};for(;c&&(!n(c)||n(c)<s.lineNumbers.start);)l.lines.push(c),c=e[++o];i.push(l)}}return i}function si(e,t){return e.map(n=>{var{groups:r}=n,o=M(n,["groups"]);const{lineNumber:i}=o,s={prev:i.prev?t.prev[i.prev]||[]:[],next:i.next?t.next[i.next]||[]:[]};return Object.assign(Object.assign({},o),{annotatedGroups:ai(r,s)})})}function ai(e,t){let n=[...e],r=[...e];const o=[...t.prev],i=[...t.next],s=[];let c=1,l=1;for(;n.length>0||r.length>0;){const u=o[0],f=i[0],g=u&&u.columnNumbers.start===c,b=f&&f.columnNumbers.start===l;if(c<l)if(g){const p=u.columnNumbers.end+1;s.push({prev:{annotation:u,groups:Z(n,c,p)}}),c=p,o.shift()}else{const p=Math.min(l,(u==null?void 0:u.columnNumbers.start)||l);s.push({prev:{groups:Z(n,c,p)}}),c=p}else if(c>l)if(b){const p=f.columnNumbers.end+1;s.push({next:{annotation:f,groups:Z(r,l,p)}}),l=p,i.shift()}else{const p=Math.min(c,(f==null?void 0:f.columnNumbers.start)||c);s.push({next:{groups:Z(r,l,p)}}),l=p}else if(c==l)if(g&&b&&u.columnNumbers.end===f.columnNumbers.end){const p=f.columnNumbers.end+1;s.push({prev:{annotation:u,groups:Z(n,c,p)},next:{annotation:f,groups:Z(r,l,p)}}),c=p,l=p,o.shift(),i.shift()}else if(g){const p=u.columnNumbers.end+1;s.push({prev:{annotation:u,groups:Z(n,c,p)}}),c=p,o.shift()}else if(b){const p=f.columnNumbers.end+1;s.push({next:{annotation:f,groups:Z(r,l,p)}}),l=p,i.shift()}else if(!u&&!f)s.push({prev:{groups:n},next:{groups:r}}),n=[],r=[];else{const p=Math.min((u==null?void 0:u.columnNumbers.start)||Number.MAX_VALUE,(f==null?void 0:f.columnNumbers.start)||Number.MAX_VALUE);s.push({prev:{groups:Z(n,c,p)},next:{groups:Z(r,l,p)}}),c=p,l=p}}return s}function Z(e,t,n){const r=[];let o=t;for(;o<n&&e.length>0;){const i=e.shift();r.push(i);const s=i.tokens.reduce((c,l)=>c+l.content.length,0);o+=s}return r}function ci(e){const{highlightedLines:t,theme:n,focus:r}=e;return C.useMemo(()=>li(e),[t.prev,t.next,r.prev,r.next,n])}function li({theme:e,focus:t,annotations:n,highlightedLines:r,lang:o}){const i=ui(r),s=di(i,r),{inlineAnnotations:c,multilineAnnotations:l}=fi(n,e),u=hi(s,Bn(t,null),c),f=gi(u,c,l);return pi(f,i,o)}function ui(e){return R(e,t=>t.map(n=>n.tokens.map(r=>r.content).join("")).join(`
|
|
3
|
+
`).trimEnd().concat(`
|
|
4
|
+
`))}function di(e,t){return Xo(e,t)}function fi(e,t){return ei(e,t)}function hi(e,t,n){return Yo(e,t,n)}function gi(e,t,n){var{lines:r}=e,o=M(e,["lines"]);const i=si(r,t),s=ii(i,n);return Object.assign(Object.assign({},o),{lineGroups:s,lineCount:{prev:r.filter(c=>c.lineNumber.prev!=null).length,next:r.filter(c=>c.lineNumber.next!=null).length}})}function pi(e,t,n){const r=vi(e.enterCount,e.exitCount),o=R(e.lineGroups,i=>i.map(s=>Object.assign(Object.assign({},s),{lines:Vo(s.lines,r,e.enterCount,e.exitCount)})));return Object.assign(Object.assign({},e),{groups:o,verticalInterval:r,code:t,lang:n})}function vi(e,t){return e<=0&&t<=0?[0,1]:e<=0&&t>=1?[.33,1]:e>=1&&t<=0?[0,.67]:[.25,.75]}function mi({dimensions:e,codeStep:t,children:n,minZoom:r=0,maxZoom:o=1.2,center:i=!1,progress:s}){const{prev:c,next:l}=xi({codeStep:t,dimensions:e,minZoom:r,maxZoom:o,horizontalCenter:i}),u=ke(c.zoom,l.zoom,s),f=ke(c.dx,l.dx,s),g=ke(c.dy,l.dy,s,t.verticalInterval),b=ke(c.focusHeight,l.focusHeight,s),p=ke(c.focusWidth,l.focusWidth,s),x=((e==null?void 0:e.lineNumberWidth)||0)*u||16,O=Math.max(p+x,e.contentWidth),j=x/u;return h(bi,{width:e.containerWidth,height:e.containerHeight,lang:t.lang,children:h(yi,{dx:f,dy:g,scale:u,height:Math.max(b,e.contentHeight),width:O,children:n(p,j)})})}function bi({width:e,height:t,children:n,lang:r}){return h("code",{style:{width:e,height:t,position:"relative",overflow:"auto"},className:"ch-code-scroll-parent",children:n,"data-ch-lang":r})}function yi({dx:e,dy:t,scale:n,height:r,width:o,children:i}){return h("div",{style:{position:"absolute",top:0,left:0,transformOrigin:"top left",width:o,height:r,overflow:"hidden"},className:"ch-code-scroll-content",children:h("div",{style:{position:"absolute",top:0,left:0,transform:`translateX(${e}px) translateY(${t}px) scale(${n})`,transformOrigin:"left top",width:o/n,height:(r-2*t)/n},children:i})})}function xi(e){var{codeStep:t}=e,n=M(e,["codeStep"]);const{lineHeight:r,lineWidth:o}=n.dimensions,i={prev:{extremes:[t.firstFocusedLineNumber.prev-1,t.lastFocusedLineNumber.prev-1],originalContentHeight:t.lineCount.prev*r,lineWidth:o[0]},next:{extremes:[t.firstFocusedLineNumber.next-1,t.lastFocusedLineNumber.next-1],originalContentHeight:t.lineCount.next*r,lineWidth:o[1]}};return R(i,({extremes:s,originalContentHeight:c,lineWidth:l})=>wi(Object.assign({extremes:s,originalContentHeight:c,lineWidth:l},n)))}function wi({dimensions:e,lineWidth:t,minZoom:n,maxZoom:r,extremes:o,originalContentHeight:i,horizontalCenter:s}){const{lineHeight:c}=e,l=e==null?void 0:e.contentHeight,u=e==null?void 0:e.contentWidth,f=(o[1]-o[0]+3)*c,g=(e==null?void 0:e.lineNumberWidth)||16,b=16,p=Math.max(Math.min((u-g-b)/t,l/f,r),n),w=i*p,x=(o[0]-1)*c*p,O=(o[1]+2)*c*p,j=(O+x)/2,k=O-x,S=l>w?(l-w)/2:Ci(l/2-j,Math.max(l-w,-x),0),E=s?Math.max(u/2-t*p/2,0):0;return{zoom:p,dx:E,dy:S,focusHeight:k,focusWidth:t*p}}function Ci(e,t,n){return e<=t?t:e>=n?n:e}function ke(e,t,n,r=[0,1]){return je({fixed:!1,interval:r,extremes:[e,t],ease:Se.easeInOutCubic},n)}function Oi(e){return h(mi,{...Object.assign({},e),children:(t,n)=>h(Ti,{codeStep:e.codeStep,focusWidth:t,lineHeight:e.dimensions.lineHeight,progress:e.progress,theme:e.theme,startX:n,lineNumberWidth:e.dimensions.lineNumberWidth})})}function Ti({codeStep:e,progress:t,focusWidth:n,lineHeight:r,startX:o,theme:i,lineNumberWidth:s}){const c=t<.5?e.groups.prev:e.groups.next;return h(G,{children:c.map((l,u)=>{if(!l.annotation)return h(un,{lines:l.lines,t,focusWidth:n,lineHeight:r,startX:o,theme:i,lineNumberWidth:s},u);const f=je(l.lines[0].tweenY,t),g=l.annotation.lineNumbers.end-l.annotation.lineNumbers.start+1,b=l.annotation.Component;return h(b,{style:{position:"absolute",height:g*r,width:"100%",transform:`translateY(${f*r}px)`},data:l.annotation.data,theme:l.annotation.theme,isInline:!1,children:h(un,{lines:l.lines,t,focusWidth:n,lineHeight:r,startY:f,startX:o,theme:i,lineNumberWidth:s})},u)})})}function un({lines:e,focusWidth:t,lineHeight:n,t:r,startX:o,startY:i=0,theme:s,lineNumberWidth:c}){return h(G,{children:e.map((l,u)=>{const{tweenX:f,tweenY:g,focused:b}=l,p=je(f,r),w=je(g,r),x=Rn(b,r,p);return B(G,{children:[c?h("span",{className:"ch-code-line-number",style:{position:"absolute",top:0,left:0,transform:`translate(${p*t}px, ${(w-i)*n}px)`,width:c,opacity:x,color:T(s,m.LineNumberForeground)},children:r<.5?l.lineNumber.prev:l.lineNumber.next}):void 0,h(Si,{dx:o+p*t,dy:(w-i)*n,width:t,opacity:x,children:h(Fi,{line:l,progress:r,dx:p})})]})})})}function Fi({line:e,progress:t,dx:n}){return B("div",{style:{display:"inline-block",width:"100%"},children:[e.annotatedGroups.map((r,o)=>h(ki,{annotatedGroup:r,progress:t,dx:n},o)),h("br",{})]})}function ki({annotatedGroup:e,progress:t,dx:n}){var r,o,i;const s=t<.5?e.prev:e.next,c=(s==null?void 0:s.groups)||[],l=(r=s==null?void 0:s.annotation)===null||r===void 0?void 0:r.Component,u=c.map((f,g)=>{const b=Rn(f.focused,t,n);return h("span",{style:{opacity:b},children:f.element},g+1)});return l?h(l,{children:u,data:(o=s==null?void 0:s.annotation)===null||o===void 0?void 0:o.data,theme:(i=s==null?void 0:s.annotation)===null||i===void 0?void 0:i.theme,isInline:!0}):h(G,{children:u})}function Si({children:e,dx:t,dy:n,opacity:r,width:o}){return h("div",{style:{position:"absolute",top:0,left:0,transform:`translate(${t}px, ${n}px)`,width:o,display:r<=0?"none":void 0},children:e})}const dn=.33;function Rn(e,t,n){return je({fixed:!1,extremes:[e.prev?.99:dn,e.next?.99:dn],interval:[0,1]},t)-Math.abs(n)*1}function Ke({content:e,style:t,className:n}){const[r,o]=C.useState(!1);return B("svg",{style:t,onClick:()=>{Bi(e),o(!0),setTimeout(()=>{o(!1)},1200)},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:n,children:[h("title",{children:"Copy"}),r?h("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}):h("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6px",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})]})}function Bi(e){if(!navigator.clipboard){ji(e);return}navigator.clipboard.writeText(e)}function ji(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{var n=document.execCommand("copy")}catch{}document.body.removeChild(t)}function Ei({tween:e,theme:t}){return ci({highlightedLines:R(e,n=>n.code.lines),theme:t,focus:R(e,n=>n.focus),annotations:R(e,n=>n.annotations),lang:Bo(e,n=>{var r;return(r=n==null?void 0:n.code)===null||r===void 0?void 0:r.lang})})}const Ii=10;function Dn(e){var{tween:t,progress:n,config:r}=e,o=M(e,["tween","progress","config"]);const i=Ei({tween:t,theme:r.theme}),{element:s,dimensions:c}=Ao(i.code,R(t,l=>l.focus),r.minColumns||Ii,r.lineNumbers||!1,r.rows,[r.parentHeight]);return!c||r.debug?h(Li,{element:s,htmlProps:o,debug:r.debug}):h(Ni,{dimensions:c,stepInfo:i,config:r,progress:n,htmlProps:o})}function Li({element:e,htmlProps:t,debug:n}){return h(Wn,{htmlProps:t,style:{opacity:n?.9:0,overflow:"auto"},children:e})}function Ni({config:{minZoom:e=1,maxZoom:t=1,horizontalCenter:n=!1,theme:r},dimensions:o,stepInfo:i,progress:s,htmlProps:c,config:l}){var u;const{bg:f,fg:g}=Po(r);return B(Wn,{htmlProps:c,style:{opacity:1,backgroundColor:f,color:g,colorScheme:Pn(r),["--ch-selection-background"]:T(r,m.SelectionBackground)},children:[h(Oi,{codeStep:i,progress:s,dimensions:o,minZoom:e,maxZoom:t,center:n,theme:r}),l.showCopyButton?h(Ke,{className:"ch-code-button",content:(u=i==null?void 0:i.code)===null||u===void 0?void 0:u.prev}):void 0]})}function Wn({htmlProps:e,style:t,children:n}){return h("div",{...Object.assign({className:"ch-code-wrapper"},e,{style:Object.assign(Object.assign({margin:0,padding:0,position:"relative",whiteSpace:"pre",boxSizing:"content-box"},t),e==null?void 0:e.style),children:n})})}function Ct(){return typeof window<"u"?performance.now():0}function _i(e,t){var n=C.useRef(null);return n.current==null&&(n.current={config:zn(e,t),state:Pi(e,t)}),n.current}function zn(e,t){var n=t.stiffness,r=t.damping,o=t.mass,i=t.decimals,s=t.teleport;return{X:e,k:n!=null?n:170,c:r!=null?r:26,m:o!=null?o:1,teleport:s!=null?s:!1,decimals:i!=null?i:2}}function Pi(e,t){var n=t.from,r=t.initialSpeed;return{x0:n!=null?n:e,v0:r!=null?r:0,t0:Ct(),raf:null}}var ut=Math.sqrt,oe=Math.exp,fn=Math.sin,hn=Math.cos;function vt(e){var t=e.x0,n=e.v0,r=e.t0,o=e.t,i=e.k,s=e.c,c=e.m,l=e.X,u=t-l,f=(o-r)/1e3,g=s*s-4*i*c;if(g>0){var b=(-s+ut(g))/(2*c),p=(-s-ut(g))/(2*c),w=(u*b-n)/(b-p),x=(n-u*p)/(b-p);return{x:l+w*oe(p*f)+x*oe(b*f),v:w*p*oe(p*f)+x*b*oe(b*f)}}else if(g<0){var O=-s/(2*c),j=ut(-g)/(2*c),k=u,S=(n-O*u)/j;return{x:l+oe(O*f)*(k*hn(j*f)+S*fn(j*f)),v:oe(O*f)*((S*j+k*O)*hn(j*f)-(k*j-S*O)*fn(j*f))}}else{var E=-s/(2*c),I=u,_=n-E*u;return{x:l+(I+_*f)*oe(E*f),v:(_+I*E+_*E*f)*oe(E*f)}}}var Ye=[],mt=null;function gn(e){var t=Ye.push(e);return t===1&&(mt=requestAnimationFrame(Ai)),[mt,t-1]}function pn(e){var t=e[0],n=e[1];t===mt&&delete Ye[n]}function Ai(){var e=Ct(),t=Ye;Ye=[],wo(function(){return t.forEach(function(n){return n&&n(e)})})}var We=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Ot(e,t){t===void 0&&(t={});var n=C.useState(),r=n[1],o=zn(e,t),i=_i(e,t),s=i.state,c=i.config,l=Ct(),u=s.x0,f=s.v0,g=s.t0,b=c.k,p=c.c,w=c.m,x=c.X,O=o.teleport?{x,v:0}:vt({x0:u,v0:f,t0:g,t:l,k:b,c:p,m:w,X:x}),j=O.x,k=O.v,S=Hi(j,k,l,o);return We(function(){Object.assign(c,o)},[o.X,o.k,o.c,o.m,o.teleport]),We(function(){s.x0=j,s.v0=k,s.t0=l},[j,k,l]),We(function(){var E=function I(_){var U=s.x0,ye=s.v0,xe=s.t0,we=c.k,Ee=c.c,he=c.m,Ze=c.X,Ie=c.decimals,Je=vt({x0:U,v0:ye,t0:xe,t:_,k:we,c:Ee,m:he,X:Ze}),Qe=Je.x;fe(Qe,Ie)!==fe(U,Ie)?(s.raf=null,r(_)):s.raf=gn(I)};S&&s.raf==null?s.raf=gn(E):!S&&s.raf!=null&&(pn(s.raf),s.raf=null)}),We(function(){return function(){s.raf!=null&&pn(s.raf)}},[]),[fe(j,o.decimals),S]}function Hi(e,t,n,r){var o=r.decimals,i=r.X,s=r.k,c=r.c,l=r.m;if(fe(e,o)!==fe(i,o))return!0;var u=n+.016,f=vt({x0:e,v0:t,t0:n,t:u,k:s,c,m:l,X:i}),g=f.x;return fe(g,o)!==fe(i,o)}function fe(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}const Mi={stiffness:120,damping:24,mass:.2,decimals:3};function $i(e){var{step:t,config:n}=e,r=M(e,["step","config"]);const{tween:o,t:i}=Ri(t,n.spring);return h(Dn,{...Object.assign({tween:o,progress:i,config:n},r)})}function Ri(e,t=Mi){const[{target:n,steps:r,index:o},i]=C.useState({target:2,steps:[e,e,e],index:0});C.useEffect(()=>{r[r.length-1]!=e&&i(f=>Di(f,e,s))},[e]);const[s]=Ot(n,t),c=s-o;return c<=1?{tween:{prev:r[0],next:r[1]},t:c}:{tween:{prev:r[1],next:r[2]},t:c-1}}function Di(e,t,n){const{steps:r,target:o,index:i}=e,s=r.slice();return n-i<1?(s[2]=t,Object.assign(Object.assign({},e),{steps:s})):(s[0]=r[1],s[1]=r[2],s[2]=t,Object.assign(Object.assign({},e),{steps:s,target:o+1,index:i+1}))}const bt=bo({});function Gn({classes:e,children:t}){const n=Sn(bt),r=Un(n,e);return h(bt.Provider,{value:r,children:t})}function ee(e,t){const n=Sn(bt),r=Un(n,t);return yo(Wi(e,r),[e,r])}function Wi(e,t){return function(...r){const o=r.map(s=>e+(e&&s?"-":"")+s),i=o.slice();return o.forEach(s=>{s in t&&i.push(t[s])}),i.join(" ")}}function Un(e,t){return xo(()=>Object.assign(Object.assign({},e),t),[e,t])}const zi=C.forwardRef(function(e,t){var{title:n,children:r,titleBar:o,classes:i,theme:s,zoom:c=1,overflow:l}=e,u=M(e,["title","children","titleBar","classes","theme","zoom","overflow"]);const f=ee("ch-frame",i),g=o||h(qn,{title:n}),b={"--ch-frame-zoom":c,overflow:l};return h(Gn,{classes:i,children:h("div",{...Object.assign({},u,{ref:t}),children:B("div",{className:f(""),children:[h("div",{className:f("title-bar"),style:{background:T(s,m.EditorGroupHeaderBackground)},children:g}),h("div",{className:f("content"),children:h("div",{className:f("zoom"),style:b,children:r})})]})})})});C.forwardRef(function(e,t){var{title:n,children:r,titleBar:o,classes:i,overflow:s}=e,c=M(e,["title","children","titleBar","classes","overflow"]);const l=ee("ch",i),u=o||h(qn,{title:n});return h(Gn,{classes:i,children:h("div",{...Object.assign({},c,{ref:t}),children:B("div",{className:l("simple-frame"),children:[h("div",{className:l("frame-title-bar"),children:u}),r]})})})});function qn({title:e}){const t=ee("ch-frame");return B(G,{children:[h("div",{className:t("left-bar"),children:h(Tt,{})}),h("div",{className:t("middle-bar"),children:e}),h("div",{className:t("right-bar")})]})}function Tt(){const e=ee("ch-frame");return B("div",{className:e("buttons"),children:[h("div",{className:e("button","button-left")}),h("div",{className:e("button-space")}),h("div",{className:e("button","button-middle")}),h("div",{className:e("button-space")}),h("div",{className:e("button","button-right")})]})}const Gi=C.forwardRef(function(t,n){var r,{northPanel:o,southPanel:i,terminalPanel:s,style:c,height:l,northButton:u,southButton:f,theme:g,className:b,onTabClick:p}=t,w=M(t,["northPanel","southPanel","terminalPanel","style","height","northButton","southButton","theme","className","onTabClick"]);return B("div",{...Object.assign({ref:n},w,{className:"ch-editor-frame",style:Object.assign({background:T(g,m.EditorBackground)},c)}),children:[h("div",{className:"ch-frame-title-bar",style:{color:T(g,m.IconForeground),background:T(g,m.EditorGroupHeaderBackground)},children:h(vn,{tabs:o.tabs,showFrameButtons:!0,button:u,panel:"north",theme:g,onTabClick:p})}),h("div",{"data-ch-panel":"north",style:o.style,children:o.children}),i&&B(G,{children:[h("div",{className:"ch-frame-title-bar",style:{transform:(r=i.style)===null||r===void 0?void 0:r.transform,color:T(g,m.IconForeground),background:T(g,m.EditorGroupHeaderBackground)},children:h(vn,{tabs:i.tabs,showFrameButtons:!1,button:f,topBorder:!0,panel:"south",theme:g,onTabClick:p})}),h("div",{"data-ch-panel":"south",children:i.children,style:i.style})]})]})});function vn({tabs:e,button:t,showFrameButtons:n,topBorder:r,panel:o,theme:i,onTabClick:s}){const c=ee("ch-editor-tab");return B(G,{children:[r&&h("div",{style:{position:"absolute",height:"1px",background:T(i,m.EditorGroupBorder),width:"100%",top:0,zIndex:1}}),n?h(Tt,{}):h("div",{}),e.map(({title:l,active:u,style:f})=>h("div",{title:l,"data-ch-tab":o,className:c("",u?"active":"inactive"),style:Object.assign(Object.assign({},f),{background:T(i,u?m.ActiveTabBackground:m.InactiveTabBackground),color:T(i,u?m.ActiveTabForeground:m.InactiveTabForeground),borderRightColor:T(i,m.TabBorder),borderBottomColor:T(i,u?m.ActiveTabBottomBorder:m.InactiveTabBackground)}),onClick:s&&(()=>s(l)),children:h(Ui,{title:l})},l)),h("div",{style:{flex:1,minWidth:"0.8em"}}),t]})}function Ui({title:e}){if(!e)return h("div",{});const t=e.lastIndexOf("/")+1,n=e.substring(t),r=e.substring(0,t);return B("div",{children:[h("span",{style:{opacity:.5},children:r}),n]})}function qi(e){const[,...t]=e.split(/^\$\s*/gm),n=t.map(s=>{const[c,...l]=s.split(/\r?\n/);return{run:c,output:l.length>0?l.join(`
|
|
5
|
+
`):null}}),r=n[n.length-1],o=n.length>0&&r.output!=null;return{title:o?r.run.split(/(\s+)/)[0]:"bash",isRunning:o,commands:n}}const Xi=h("span",{className:"ch-terminal-prompt",children:"$"});function mn({text:e,progress:t=1,style:n}){const r=Ki(e,t);return h("pre",{style:n,className:"ch-terminal-content",children:r.map(({run:o,output:i},s)=>B(G,{children:[B("div",{children:[Xi," ",h("span",{children:o})]}),i&&h("div",{className:"ch-terminal-output",children:i})]}))})}function Ki(e,t){if(!e)return[];const n=Math.round(e.length*t),{commands:r}=qi(e.slice(0,n));return r}function Yi({prev:e="",prevKey:t,next:n="",nextKey:r,progress:o}){return h("div",{className:"ch-terminal",children:B("div",{style:{position:"relative",transform:`translateY(-${o*100}%)`},children:[h(mn,{text:e,progress:1},t),h(mn,{style:{position:"absolute"},text:n,progress:o},r)]})})}function Zi({steps:e,progress:t}){const n=e.map(s=>s.text),r=t%1,o=Ji(Math.floor(t),0,e.length-1),i=o+1;return h(Yi,{prev:n[o],prevKey:o,next:n[i]||"",nextKey:i,progress:r})}function Ji(e,t,n){return Math.min(Math.max(e,t),n)}function Qi({prev:e,next:t,t:n,backward:r}){const o=Vi({prev:e,next:t,t:n,backward:r});return o?B("div",{className:"ch-editor-terminal",style:{height:o},children:[h("div",{className:"ch-editor-terminal-tab",children:h("span",{children:"Terminal"})}),B("div",{className:"ch-editor-terminal-content",children:[h(Zi,{steps:[{text:e||""},{text:t||""}],progress:n}),")"]})]}):null}function Vi({prev:e,next:t,t:n,backward:r}){return!e&&!t?0:!e&&t?dt*Math.min(n*4,1):e&&!t?dt*Math.max(1-n*4,0):dt}const dt=150;function Ft(e){return Array.isArray(e.rows)?Object.assign(Object.assign({},e),{rows:e.rows[0]}):e}function kt(e){return Array.isArray(e.rows)?Object.assign(Object.assign({},e),{rows:e.rows[1]}):e}function es(e,t,n,r,o,i){const{prevSnapshot:s,nextSnapshot:c}=os(e,t,n);if(!s)return ts(t,n,i);if(!c||r===1)return bn(t,n,i);const l=t.southPanel||n.southPanel,{prevNorthFile:u,prevSouthFile:f,nextNorthFile:g,nextSouthFile:b}=St(t,n,r==0||o),{northStyle:p,southStyle:w}=ns(s,c,r),{northTabs:x,southTabs:O}=rs(s,c,u.name,f==null?void 0:f.name,r);return{northContent:be(g),northPanel:{tabs:x,style:p,children:h(me,{codeConfig:Ft(i),prevFile:u,nextFile:g,t:r,parentHeight:p.height||p.minHeight})},southContent:be(b),southPanel:l&&{tabs:O,style:w,children:h(me,{codeConfig:kt(i),prevFile:f,nextFile:b,t:r,parentHeight:(w==null?void 0:w.height)||(w==null?void 0:w.minHeight)})}}}function ts(e,t,n){const r=e.northPanel,o=e.southPanel,{prevNorthFile:i,prevSouthFile:s,nextNorthFile:c,nextSouthFile:l}=St(e,t,!0);return{northContent:be(i),northPanel:{tabs:r.tabs.map(u=>({title:u,active:u===r.active,style:{}})),style:{flexGrow:1,overflow:"hidden"},children:h(me,{codeConfig:Ft(n),prevFile:i,nextFile:i,t:0,parentHeight:"0"})},southContent:be(s),southPanel:o&&{tabs:o.tabs.map(u=>({title:u,active:u===o.active,style:{}})),style:{flexGrow:1,overflow:"hidden"},children:h(me,{codeConfig:kt(n),prevFile:s,nextFile:s,t:0,parentHeight:"0"})}}}function bn(e,t,n){var r;const o=t.northPanel,i=t.southPanel;let{prevNorthFile:s,prevSouthFile:c,nextNorthFile:l,nextSouthFile:u}=St(e,t,!1);return!i&&o.active===((r=e==null?void 0:e.southPanel)===null||r===void 0?void 0:r.active)&&(l=u),{northContent:be(l),northPanel:{tabs:o.tabs.map(g=>({title:g,active:g===o.active,style:{}})),style:{flexGrow:1,overflow:"hidden"},children:h(me,{codeConfig:Ft(n),prevFile:l,nextFile:l,t:1,parentHeight:"1"})},southContent:be(u),southPanel:i&&{tabs:i.tabs.map(g=>({title:g,active:g===i.active,style:{}})),style:{flexGrow:1,overflow:"hidden"},children:h(me,{codeConfig:kt(n),prevFile:u,nextFile:u,t:1,parentHeight:"1"})}}}function me({prevFile:e,nextFile:t,t:n,codeConfig:r,parentHeight:o}){var i;const s=Object.assign(Object.assign({},r==null?void 0:r.htmlProps),{style:Object.assign({height:"100%"},(i=r==null?void 0:r.htmlProps)===null||i===void 0?void 0:i.style)});return h(Dn,{...Object.assign({progress:n,tween:{prev:e,next:t},config:Object.assign(Object.assign({},r),{parentHeight:o})},s)})}function be(e){return e?jn(e.code):""}function St(e,t,n){var r,o;const i=e.northPanel.active,s=t.northPanel.active,c=(r=e.southPanel)===null||r===void 0?void 0:r.active,l=(o=t.southPanel)===null||o===void 0?void 0:o.active,u=e.files.find(S=>S.name===i),f=t.files.find(S=>S.name===s),g=c?e.files.find(S=>S.name===c):null,b=l?t.files.find(S=>S.name===l):null;return!c&&i===l?{prevNorthFile:f,nextNorthFile:f,prevSouthFile:u,nextSouthFile:b}:!l&&s===c?{prevNorthFile:u,nextNorthFile:u,prevSouthFile:g,nextSouthFile:f}:{prevNorthFile:i===s||n?u:f,nextNorthFile:i===s?f:n?u:f,prevSouthFile:c===l?g:n?g||b:b||g,nextSouthFile:c===l?b:n?g||b:b||g}}function ns(e,t,n){return e.southHeight===null&&t.southHeight===null?{northStyle:{minHeight:e.northHeight}}:e.southHeight!==null&&t.southHeight===null&&t.northKey!==e.southKey?{northStyle:{minHeight:ie(e.northHeight,t.northHeight,n)},southStyle:{minHeight:e.southHeight}}:e.southHeight!==null&&t.southHeight===null&&e.southKey===t.northKey?{northStyle:{minHeight:e.northHeight},southStyle:{position:"relative",minHeight:ie(e.southHeight,t.northHeight,n),transform:`translateY(${ie(0,-(e.northHeight+e.titleBarHeight),n)}px)`}}:e.southHeight===null&&t.southHeight!==null&&e.northKey!==t.southKey?{northStyle:{minHeight:ie(e.northHeight,t.northHeight,n)},southStyle:{position:"relative",minHeight:t.southHeight}}:e.southHeight===null&&t.southHeight!==null&&e.northKey===t.southKey?{northStyle:{minHeight:t.northHeight},southStyle:{position:"relative",minHeight:ie(e.northHeight,t.southHeight,n),transform:`translateY(${ie(-(t.northHeight+t.titleBarHeight),0,n)}px)`}}:{northStyle:{minHeight:ie(e.northHeight,t.northHeight,n)},southStyle:{minHeight:ie(e.southHeight,t.southHeight,n)}}}function ie(e,t,n){return e+(t-e)*n}function rs(e,t,n,r,o){return!e.southTabs&&ve(r,e.northTabs)?{northTabs:pe(t.northTabs,t.southTabs,e.southTabs,e.northTabs,n,o),southTabs:pe(t.southTabs,t.northTabs,e.northTabs,e.southTabs,r,o)}:!t.southTabs&&ve(r,t.northTabs)?{northTabs:pe(t.southTabs,t.northTabs,e.northTabs,e.southTabs,n,o),southTabs:pe(t.northTabs,t.southTabs,e.southTabs,e.northTabs,r,o)}:{northTabs:pe(t.northTabs,t.southTabs,e.northTabs,e.southTabs,n,o),southTabs:pe(t.southTabs,t.northTabs,e.southTabs,e.northTabs,r,o)}}function pe(e,t,n,r,o,i){const s=e?Object.keys(e).filter(u=>ve(u,n)||!n).map(u=>{const f=n&&n[u],g=e[u],b=f?f.left+(g.left-f.left)*i:g.left,p=f?f.width+(g.width-f.width)*i:g.width;return{active:u===o,title:u,style:{position:"absolute",transform:`translateX(${b}px)`,width:p}}}):[],c=e?Object.keys(e).filter(u=>n&&!ve(u,n)).map(u=>{const f=e[u];return{active:u===o,title:u,style:{position:"absolute",transform:`translateX(${f.left}px)`,opacity:i,width:f.width}}}):[];e&&Object.keys(e).filter(u=>ve(u,r)).map(u=>{const f=r[u],b=e[u].left-f.left;return{active:u===o,title:u,style:{position:"absolute",transform:`translateX(${b}px)`}}});const l=n?Object.keys(n).filter(u=>!ve(u,e)).map(u=>{const f=n[u];return{active:u===o,title:u,style:{position:"absolute",opacity:1-i,transform:`translateX(${f.left}px)`,width:f.width}}}):[];return[...c,...s,...l]}function ve(e,t){return t&&e&&e in t}const yn=typeof window<"u"?C.useLayoutEffect:C.useEffect;function os(e,t,n){const[{prevSnapshot:r,nextSnapshot:o},i]=C.useState({prevSnapshot:null,nextSnapshot:null});return yn(()=>{(r||o)&&i({prevSnapshot:null,nextSnapshot:null})},[t,n]),yn(()=>{if(r){if(!o){const s=e.current;i(c=>Object.assign(Object.assign({},c),{nextSnapshot:Object.assign(Object.assign({},xn(s,n)),wn(s,n))}))}}else{const s=e.current;i(c=>Object.assign(Object.assign({},c),{prevSnapshot:Object.assign(Object.assign({},xn(s,t)),wn(s,t))}))}}),{prevSnapshot:r,nextSnapshot:o}}function xn(e,t){var n;const r=e.querySelector("[data-ch-panel='north']"),o=e.querySelector("[data-ch-panel='south']");return{titleBarHeight:e.querySelector(".ch-frame-title-bar").getBoundingClientRect().height,northHeight:r.getBoundingClientRect().height,northKey:t.northPanel.active,southHeight:(o==null?void 0:o.getBoundingClientRect().height)||null,southKey:(n=t.southPanel)===null||n===void 0?void 0:n.active}}function wn(e,t){var n;const r=Array.from(e.querySelectorAll("[data-ch-tab='north']")),o=Array.from(e.querySelectorAll("[data-ch-tab='south']"));return{northTabs:Cn(r,t.northPanel.active),southTabs:Cn(o,(n=t.southPanel)===null||n===void 0?void 0:n.active)}}function Cn(e,t){if(!e[0])return null;const r=e[0].parentElement.getBoundingClientRect().left,o={};return e.forEach(i=>{const s=i.getAttribute("title"),c=i.getBoundingClientRect();o[s]={left:c.left-r,width:c.width,active:s===t}}),o}function is({files:e,theme:t,startingFileName:n}){const[r,o]=C.useState(()=>e.find(i=>i.name===n));return B("div",{className:"ch-code-browser",style:{color:T(t,m.EditorForeground)},children:[h(ss,{files:e,theme:t,activeFile:r,setActiveFile:o}),h(cs,{file:r,theme:t})]})}function ss({theme:e,files:t,activeFile:n,setActiveFile:r}){const o=C.useMemo(()=>ls(t),[t]);return h("div",{className:"ch-code-browser-sidebar",style:{borderColor:T(e,m.SideBarBorder),background:T(e,m.SideBarBackground),color:T(e,m.SideBarForeground),["--ch-list-selection-background"]:T(e,m.ListActiveSelectionBackground),["--ch-list-selection-foreground"]:T(e,m.ListActiveSelectionForeground),["--ch-hover-background"]:T(e,m.ListHoverBackground),["--ch-hover-foreground"]:T(e,m.ListHoverForeground)},children:h(Xn,{tree:o,activeFile:n,setActiveFile:r})})}function Xn({tree:e,activeFile:t,setActiveFile:n,level:r=0}){return h(G,{children:e.map(o=>h(as,{node:o,activeFile:t,setActiveFile:n,level:r},o.name))})}function as({node:e,activeFile:t,setActiveFile:n,level:r}){const o=e.children&&e.children.length>0,i=e.codeFile===t;return o?B("div",{children:[h("div",{className:"ch-code-browser-sidebar-folder",children:h("div",{style:{paddingLeft:r*1.5+"ch"},children:e.name})}),h(Xn,{tree:e.children,activeFile:t,setActiveFile:n,level:r+1})]}):h("div",{children:h("div",{className:"ch-code-browser-sidebar-file",onClick:()=>n(e.codeFile),style:i?{color:"var(--ch-list-selection-foreground)",background:"var(--ch-list-selection-background)"}:{},children:h("div",{style:{paddingLeft:r*1.5+"ch"},children:e.name})})})}function cs({file:e,theme:t}){return B("div",{className:"ch-code-browser-content",style:{background:T(t,m.CodeBackground),color:T(t,m.CodeForeground),["--ch-selection-background"]:T(t,m.SelectionBackground),colorScheme:Pn(t)},children:[h(Ke,{className:"ch-code-browser-button",content:jn(e.code)}),e.code.lines.map((n,r)=>h("div",{children:n.tokens.length===0?h("br",{}):n.tokens.map((o,i)=>h("span",{...Object.assign({key:i},o.props),children:o.content}))},r))]})}function ls(e){let t=[];for(const n of e){const r=n.name.split("/");let o=t;for(let i=0;i<r.length;i++){const s=r[i],c=i===r.length-1,l=o.findIndex(u=>u.name===s);if(l===-1){const u={name:s,children:[],codeFile:void 0};c&&(u.codeFile=n),o.push(u),o=u.children}else o=o[l].children}}return t=Kn(t),t}function Kn(e){for(const t of e)t.children=Kn(t.children);return e.sort((t,n)=>{const r=t.children&&t.children.length>0,o=n.children&&n.children.length>0;return r&&o||!r&&!o?t.name.localeCompare(n.name):r?-1:1})}function us({style:e,step:t,theme:n,className:r}){const[o,i]=C.useState(!1),[s,c]=C.useState(!0),l=C.useRef(null),u=t.files;return C.useEffect(()=>{l.current&&!l.current.showModal&&c(!1)},[]),s?B(G,{children:[h(ds,{className:r,style:e,onClick:()=>{l.current.showModal(),document.body.classList.add("ch-no-scroll"),i(!0)}}),B("dialog",{ref:l,className:"ch-expand-dialog",onClose:()=>{i(!1)},onClick:f=>{f.currentTarget===f.target&&(l.current.close(),document.body.classList.remove("ch-no-scroll"))},children:[h(fs,{onClick:()=>{l.current.close(),document.body.classList.remove("ch-no-scroll")}}),o?h("div",{className:"ch-expand-dialog-content",style:{borderColor:T(n,m.SideBarBorder)},children:h(is,{files:u,theme:n,startingFileName:t.northPanel.active})}):void 0]})]}):null}function ds({onClick:e,style:t,className:n}){return B("svg",{style:t,onClick:e,className:n,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",role:"button",children:[h("title",{children:"Expand"}),h("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})]})}function fs({onClick:e}){return B("svg",{onClick:e,className:"ch-expand-close",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",role:"button",children:[h("title",{children:"Close"}),h("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})]})}const hs={files:[{code:{lines:[],lang:"js"},focus:"",name:""}],northPanel:{active:"",tabs:[""],heightRatio:1}};function gs(e){var{prev:t=hs,next:n,t:r,backward:o,codeConfig:i,frameProps:s={}}=e,c=M(e,["prev","next","t","backward","codeConfig","frameProps"]);const l=C.createRef(),{showCopyButton:u,showExpandButton:f}=i,g=M(i,["showCopyButton","showExpandButton"]),{northPanel:b,southPanel:p,northContent:w,southContent:x}=es(l,t,n||t,r,o,g),[O,j]=C.useState(void 0);Hn(()=>{var _;const U=(_=l.current)===null||_===void 0?void 0:_.getBoundingClientRect().height;j(U)},[]);const k=Object.assign(Object.assign(Object.assign({},s),c),{style:Object.assign(Object.assign({},s==null?void 0:s.style),c==null?void 0:c.style)});O&&(k.style.height=O,k.style.maxHeight=O);const S=B(G,{children:[u?h(Ke,{className:"ch-editor-button",content:w}):void 0,f?h(us,{className:"ch-editor-button",step:n||t,theme:i.theme}):void 0]}),E=u?h(Ke,{className:"ch-editor-button",content:x}):void 0,I=h(Qi,{prev:t.terminal,next:(n||t).terminal,t:r,backward:o});return h(Gi,{...Object.assign({ref:l},k,{northPanel:b,southPanel:p,terminalPanel:I,theme:i.theme,northButton:S,southButton:E})})}const ps={stiffness:120,damping:24,mass:.2,decimals:3};function vs(e){var{northPanel:t,southPanel:n,files:r,terminal:o,springConfig:i}=e,s=M(e,["northPanel","southPanel","files","terminal","springConfig"]);const c=C.useMemo(()=>({northPanel:t,southPanel:n,files:r,terminal:o}),[t,n,r,o]),{prev:l,next:u,t:f}=ms(c,i);return h(gs,{...Object.assign({t:f,backward:!1,prev:l,next:u},s)})}function ms(e,t=ps){const[{target:n,steps:r,index:o},i]=C.useState({target:2,steps:[e,e,e],index:0});C.useEffect(()=>{r[r.length-1]!=e&&i(f=>bs(f,e,s))},[e]);const[s]=Ot(n,t),c=s-o;return c<=1?{prev:r[0],next:r[1],t:c}:{prev:r[1],next:r[2],t:c-1}}function bs(e,t,n){const{steps:r,target:o,index:i}=e,s=r.slice();return n-i<1?(s[2]=t,Object.assign(Object.assign({},e),{steps:s})):(s[0]=r[1],s[1]=r[2],s[2]=t,Object.assign(Object.assign({},e),{steps:s,target:o+1,index:i+1}))}function sa(e){const[t,n]=C.useState(e);function r(o){const i=Yn(t,o,null);n(Object.assign(Object.assign({},t),i))}return h(Bt,{...Object.assign({},t,{onTabClick:r})})}function ys(e){var t,n,r,o,i,s,c,l,u;const{lineNumbers:f,showCopyButton:g,showExpandButton:b,minZoom:p,maxZoom:w}=e,x=M(e,["lineNumbers","showCopyButton","showExpandButton","minZoom","maxZoom"]),O=Object.assign(Object.assign({},e.codeConfig),{maxZoom:w==null?(t=e.codeConfig)===null||t===void 0?void 0:t.maxZoom:w,minZoom:p==null?(n=e.codeConfig)===null||n===void 0?void 0:n.minZoom:p,horizontalCenter:(o=(r=e.codeConfig)===null||r===void 0?void 0:r.horizontalCenter)!==null&&o!==void 0?o:e.horizontalCenter,lineNumbers:f==null?(i=e.codeConfig)===null||i===void 0?void 0:i.lineNumbers:f,showCopyButton:g==null?(s=e.codeConfig)===null||s===void 0?void 0:s.showCopyButton:g,showExpandButton:b==null?(c=e.codeConfig)===null||c===void 0?void 0:c.showExpandButton:b,rows:e.rows,debug:(l=e.debug)!==null&&l!==void 0?l:(u=e.codeConfig)===null||u===void 0?void 0:u.debug});return Object.assign(Object.assign({},x),{codeConfig:O})}function Bt(e){var{onTabClick:t}=e,n=M(e,["onTabClick"]);const r=ys(n),{className:o,style:i,codeConfig:s}=r,c=M(r,["className","style","codeConfig"]);if(!n.southPanel&&n.files.length===1&&!n.files[0].name)return h("div",{className:`ch-codeblock not-prose ${o||""}`,style:i,children:h($i,{className:"ch-code",config:s,step:c.files[0]})});{const l=Object.assign(Object.assign({},c==null?void 0:c.frameProps),{onTabClick:t});return h("div",{className:`ch-codegroup not-prose ${o||""}`,style:i,children:h(vs,{...Object.assign({},c,{frameProps:l,codeConfig:s})})})}}function Yn(e,t,n){const r=t||e.northPanel.active,o=e.files.map(c=>c.name===r?Object.assign(Object.assign({},c),{focus:n===null?c.focus:n}):c);let i=Object.assign({},e.northPanel),s=e.southPanel&&Object.assign({},e.southPanel);return e.northPanel.tabs.includes(r)?i.active=r:s&&(s.active=r),{files:o,northPanel:i,southPanel:s}}C.createContext({props:null,setFocus:()=>{}});C.createContext({activatedId:void 0,activate:()=>{},reset:()=>{}});function xs(){const e=ee("ch-browser");return h("svg",{fill:"currentColor",preserveAspectRatio:"xMidYMid meet",height:"1em",viewBox:"13 10 14 23",className:e("button","back-button"),children:h("g",{children:h("path",{d:"m26.5 12.1q0 0.3-0.2 0.6l-8.8 8.7 8.8 8.8q0.2 0.2 0.2 0.5t-0.2 0.5l-1.1 1.1q-0.3 0.3-0.6 0.3t-0.5-0.3l-10.4-10.4q-0.2-0.2-0.2-0.5t0.2-0.5l10.4-10.4q0.3-0.2 0.5-0.2t0.6 0.2l1.1 1.1q0.2 0.2 0.2 0.5z"})})})}function ws(){const e=ee("ch-browser");return h("svg",{fill:"currentColor",preserveAspectRatio:"xMidYMid meet",height:"1em",viewBox:"13 10 14 23",className:e("button","forward-button"),children:h("g",{children:h("path",{d:"m26.3 21.4q0 0.3-0.2 0.5l-10.4 10.4q-0.3 0.3-0.6 0.3t-0.5-0.3l-1.1-1.1q-0.2-0.2-0.2-0.5t0.2-0.5l8.8-8.8-8.8-8.7q-0.2-0.3-0.2-0.6t0.2-0.5l1.1-1.1q0.3-0.2 0.5-0.2t0.6 0.2l10.4 10.4q0.2 0.2 0.2 0.5z"})})})}function Cs({href:e,style:t}){const n=ee("ch-browser");return h("a",{className:n("button","open-button"),title:"Open in new tab",href:e,style:t,target:"_blank",rel:"noopener noreferrer",children:h("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"3 3 18 18",height:"1em",width:"1em",className:n("open-icon"),xmlns:"http://www.w3.org/2000/svg",children:h("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"})})})}function Os({url:e,linkUrl:t,theme:n}){const r=T(n,m.InputBorder);return B(G,{children:[h(Tt,{}),h(xs,{}),h(ws,{}),h("input",{value:e||"",readOnly:!0,style:{background:T(n,m.InputBackground),color:T(n,m.InputForeground),border:r?`1px solid ${r}`:void 0}}),h(Cs,{href:t,style:{color:T(n,m.EditorForeground)}})]})}function Ts(e){return C.useMemo(()=>e?e.map(t=>{const{displayUrl:n,loadUrl:r}=Fs(t.url,t.loadUrl,t.prependOrigin);return{zoom:t.zoom||1,displayUrl:n,loadUrl:r,children:t.children}}):[{zoom:1}],[e])}function Fs(e,t,n){const r=typeof window<"u"?window.origin:"",o=e&&n===!0?r+e:e;return{displayUrl:o,loadUrl:t||o}}const ks=C.forwardRef(Ss);function Ss(e,t){var{progress:n=0,backward:r=!1,steps:o,transition:i="none",classes:s,theme:c}=e,l=M(e,["progress","backward","steps","transition","classes","theme"]);const u=ee("ch-mini-browser",s),f=Ts(o),g=Math.round(n),{zoom:b,displayUrl:p,loadUrl:w,children:x}=f[g];return h(zi,{...Object.assign({},l,{zoom:b,className:`${u("")} ${l.className||""}`,style:Object.assign(Object.assign({},Bs({progress:n,transition:i})),l.style),classes:s,titleBar:h(Os,{url:p,linkUrl:w,theme:c}),theme:c}),children:x||h("iframe",{ref:t,src:w})})}function Bs({progress:e,transition:t}){if(t==="slide"){const r=e-Math.floor(e),o=r<=.5?-50*r:50-50*r,i=Math.abs(r-.5)*2;return{transform:`translateX(${o}px)`,opacity:i*i}}return{}}function js(e){var{url:t,loadUrl:n,prependOrigin:r,children:o,zoom:i}=e,s=M(e,["url","loadUrl","prependOrigin","children","zoom"]);const[c,l]=Es({url:t,loadUrl:n,prependOrigin:r,children:o,zoom:i});return h(ks,{...Object.assign({},s,{steps:c,progress:l})})}function Es({url:e,loadUrl:t,prependOrigin:n,children:r,zoom:o}){const[i,s]=C.useState({target:0,steps:[{url:e,loadUrl:t,prependOrigin:n,children:r,zoom:o}]});C.useEffect(()=>{const l=i.steps[i.steps.length-1];(l.url!==e||l.loadUrl!==t||l.prependOrigin!==n||l.children!==r)&&s(u=>({target:u.target+1,steps:[...u.steps,{url:e,loadUrl:t,prependOrigin:n,children:r,zoom:o}]}))},[e,t,n,r,o]);const[c]=Ot(i.target,{stiffness:100,decimals:3});return[i.steps,c]}var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},jt={};Object.defineProperty(jt,"__esModule",{value:!0});function Is(e){return e==="vue-cli"?"src/main.js":e==="angular-cli"?"src/main.ts":e==="create-react-app-typescript"?"src/index.tsx":e==="parcel"?"index.html":e==="gatsby"?"src/pages/index.js":e==="nuxt"||e==="next"||e==="apollo"||e==="reason"||e==="sapper"?"package.json":e==="nest"?"src/main.ts":e==="static"?"index.html":"src/index.js"}jt.getMainFile=Is;var On="sandbox.config.json";function Ls(e,t){var n=t[On]||t["/"+On];if(n)try{var r=JSON.parse(n.content);if(r.template)return r.template}catch{}var o=e.dependencies,i=o===void 0?{}:o,s=e.devDependencies,c=s===void 0?{}:s,l=Object.keys(i).concat(Object.keys(c)),u=["nuxt","nuxt-edge"];if(l.some(function(p){return u.indexOf(p)>-1}))return"nuxt";if(l.indexOf("next")>-1)return"next";var f=["apollo-server","apollo-server-express","apollo-server-hapi","apollo-server-koa","apollo-server-lambda","apollo-server-micro"];if(l.some(function(p){return f.indexOf(p)>-1}))return"apollo";if(l.indexOf("ember-cli")>-1)return"ember";if(l.indexOf("sapper")>-1)return"sapper";var g=Object.keys(t);if(g.some(function(p){return p.endsWith(".vue")}))return"vue-cli";if(g.some(function(p){return p.endsWith(".re")}))return"reason";if(l.indexOf("gatsby")>-1)return"gatsby";if(l.indexOf("parcel-bundler")>-1)return"parcel";if(l.indexOf("react-scripts")>-1)return"create-react-app";if(l.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(l.indexOf("@angular/core")>-1)return"angular-cli";if(l.indexOf("preact-cli")>-1)return"preact-cli";if(l.indexOf("svelte")>-1)return"svelte";if(l.indexOf("vue")>-1)return"vue-cli";var b=["@dojo/core","@dojo/framework"];if(l.some(function(p){return b.indexOf(p)>-1}))return"@dojo/cli-create-app";if(l.indexOf("cx")>-1)return"cxjs";if(l.indexOf("@nestjs/core")>-1||l.indexOf("@nestjs/common")>-1)return"nest"}var Ns=jt.getTemplate=Ls,yt={exports:{}};(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,c="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",f="[object Boolean]",g="[object Date]",b="[object Error]",p="[object Function]",w="[object GeneratorFunction]",x="[object Map]",O="[object Number]",j="[object Null]",k="[object Object]",S="[object Promise]",E="[object Proxy]",I="[object RegExp]",_="[object Set]",U="[object String]",ye="[object Symbol]",xe="[object Undefined]",we="[object WeakMap]",Ee="[object ArrayBuffer]",he="[object DataView]",Ze="[object Float32Array]",Ie="[object Float64Array]",Je="[object Int8Array]",Qe="[object Int16Array]",Qn="[object Int32Array]",Vn="[object Uint8Array]",er="[object Uint8ClampedArray]",tr="[object Uint16Array]",nr="[object Uint32Array]",rr=/[\\^$.*+?()[\]{}|]/g,or=/^\[object .+?Constructor\]$/,ir=/^(?:0|[1-9]\d*)$/,L={};L[Ze]=L[Ie]=L[Je]=L[Qe]=L[Qn]=L[Vn]=L[er]=L[tr]=L[nr]=!0,L[c]=L[l]=L[Ee]=L[f]=L[he]=L[g]=L[b]=L[p]=L[x]=L[O]=L[k]=L[I]=L[_]=L[U]=L[we]=!1;var Et=typeof ze=="object"&&ze&&ze.Object===Object&&ze,sr=typeof self=="object"&&self&&self.Object===Object&&self,J=Et||sr||Function("return this")(),It=t&&!t.nodeType&&t,Lt=It&&!0&&e&&!e.nodeType&&e,Nt=Lt&&Lt.exports===It,Ve=Nt&&Et.process,_t=function(){try{return Ve&&Ve.binding&&Ve.binding("util")}catch{}}(),Pt=_t&&_t.isTypedArray;function ar(a,d){for(var v=-1,y=a==null?0:a.length,N=0,F=[];++v<y;){var A=a[v];d(A,v,a)&&(F[N++]=A)}return F}function cr(a,d){for(var v=-1,y=d.length,N=a.length;++v<y;)a[N+v]=d[v];return a}function lr(a,d){for(var v=-1,y=a==null?0:a.length;++v<y;)if(d(a[v],v,a))return!0;return!1}function ur(a,d){for(var v=-1,y=Array(a);++v<a;)y[v]=d(v);return y}function dr(a){return function(d){return a(d)}}function fr(a,d){return a.has(d)}function hr(a,d){return a==null?void 0:a[d]}function gr(a){var d=-1,v=Array(a.size);return a.forEach(function(y,N){v[++d]=[N,y]}),v}function pr(a,d){return function(v){return a(d(v))}}function vr(a){var d=-1,v=Array(a.size);return a.forEach(function(y){v[++d]=y}),v}var mr=Array.prototype,br=Function.prototype,Le=Object.prototype,et=J["__core-js_shared__"],At=br.toString,Y=Le.hasOwnProperty,Ht=function(){var a=/[^.]+$/.exec(et&&et.keys&&et.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}(),Mt=Le.toString,yr=RegExp("^"+At.call(Y).replace(rr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$t=Nt?J.Buffer:void 0,Ne=J.Symbol,Rt=J.Uint8Array,Dt=Le.propertyIsEnumerable,xr=mr.splice,ae=Ne?Ne.toStringTag:void 0,Wt=Object.getOwnPropertySymbols,wr=$t?$t.isBuffer:void 0,Cr=pr(Object.keys,Object),tt=ge(J,"DataView"),Ce=ge(J,"Map"),nt=ge(J,"Promise"),rt=ge(J,"Set"),ot=ge(J,"WeakMap"),Oe=ge(Object,"create"),Or=ue(tt),Tr=ue(Ce),Fr=ue(nt),kr=ue(rt),Sr=ue(ot),zt=Ne?Ne.prototype:void 0,it=zt?zt.valueOf:void 0;function ce(a){var d=-1,v=a==null?0:a.length;for(this.clear();++d<v;){var y=a[d];this.set(y[0],y[1])}}function Br(){this.__data__=Oe?Oe(null):{},this.size=0}function jr(a){var d=this.has(a)&&delete this.__data__[a];return this.size-=d?1:0,d}function Er(a){var d=this.__data__;if(Oe){var v=d[a];return v===r?void 0:v}return Y.call(d,a)?d[a]:void 0}function Ir(a){var d=this.__data__;return Oe?d[a]!==void 0:Y.call(d,a)}function Lr(a,d){var v=this.__data__;return this.size+=this.has(a)?0:1,v[a]=Oe&&d===void 0?r:d,this}ce.prototype.clear=Br,ce.prototype.delete=jr,ce.prototype.get=Er,ce.prototype.has=Ir,ce.prototype.set=Lr;function Q(a){var d=-1,v=a==null?0:a.length;for(this.clear();++d<v;){var y=a[d];this.set(y[0],y[1])}}function Nr(){this.__data__=[],this.size=0}function _r(a){var d=this.__data__,v=Pe(d,a);if(v<0)return!1;var y=d.length-1;return v==y?d.pop():xr.call(d,v,1),--this.size,!0}function Pr(a){var d=this.__data__,v=Pe(d,a);return v<0?void 0:d[v][1]}function Ar(a){return Pe(this.__data__,a)>-1}function Hr(a,d){var v=this.__data__,y=Pe(v,a);return y<0?(++this.size,v.push([a,d])):v[y][1]=d,this}Q.prototype.clear=Nr,Q.prototype.delete=_r,Q.prototype.get=Pr,Q.prototype.has=Ar,Q.prototype.set=Hr;function le(a){var d=-1,v=a==null?0:a.length;for(this.clear();++d<v;){var y=a[d];this.set(y[0],y[1])}}function Mr(){this.size=0,this.__data__={hash:new ce,map:new(Ce||Q),string:new ce}}function $r(a){var d=Ae(this,a).delete(a);return this.size-=d?1:0,d}function Rr(a){return Ae(this,a).get(a)}function Dr(a){return Ae(this,a).has(a)}function Wr(a,d){var v=Ae(this,a),y=v.size;return v.set(a,d),this.size+=v.size==y?0:1,this}le.prototype.clear=Mr,le.prototype.delete=$r,le.prototype.get=Rr,le.prototype.has=Dr,le.prototype.set=Wr;function _e(a){var d=-1,v=a==null?0:a.length;for(this.__data__=new le;++d<v;)this.add(a[d])}function zr(a){return this.__data__.set(a,r),this}function Gr(a){return this.__data__.has(a)}_e.prototype.add=_e.prototype.push=zr,_e.prototype.has=Gr;function te(a){var d=this.__data__=new Q(a);this.size=d.size}function Ur(){this.__data__=new Q,this.size=0}function qr(a){var d=this.__data__,v=d.delete(a);return this.size=d.size,v}function Xr(a){return this.__data__.get(a)}function Kr(a){return this.__data__.has(a)}function Yr(a,d){var v=this.__data__;if(v instanceof Q){var y=v.__data__;if(!Ce||y.length<n-1)return y.push([a,d]),this.size=++v.size,this;v=this.__data__=new le(y)}return v.set(a,d),this.size=v.size,this}te.prototype.clear=Ur,te.prototype.delete=qr,te.prototype.get=Xr,te.prototype.has=Kr,te.prototype.set=Yr;function Zr(a,d){var v=He(a),y=!v&&fo(a),N=!v&&!y&&st(a),F=!v&&!y&&!N&&Qt(a),A=v||y||N||F,$=A?ur(a.length,String):[],D=$.length;for(var P in a)(d||Y.call(a,P))&&!(A&&(P=="length"||N&&(P=="offset"||P=="parent")||F&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||so(P,D)))&&$.push(P);return $}function Pe(a,d){for(var v=a.length;v--;)if(Kt(a[v][0],d))return v;return-1}function Jr(a,d,v){var y=d(a);return He(a)?y:cr(y,v(a))}function Te(a){return a==null?a===void 0?xe:j:ae&&ae in Object(a)?oo(a):uo(a)}function Gt(a){return Fe(a)&&Te(a)==c}function Ut(a,d,v,y,N){return a===d?!0:a==null||d==null||!Fe(a)&&!Fe(d)?a!==a&&d!==d:Qr(a,d,v,y,Ut,N)}function Qr(a,d,v,y,N,F){var A=He(a),$=He(d),D=A?l:ne(a),P=$?l:ne(d);D=D==c?k:D,P=P==c?k:P;var z=D==k,K=P==k,W=D==P;if(W&&st(a)){if(!st(d))return!1;A=!0,z=!1}if(W&&!z)return F||(F=new te),A||Qt(a)?qt(a,d,v,y,N,F):no(a,d,D,v,y,N,F);if(!(v&o)){var q=z&&Y.call(a,"__wrapped__"),X=K&&Y.call(d,"__wrapped__");if(q||X){var re=q?a.value():a,V=X?d.value():d;return F||(F=new te),N(re,V,v,y,F)}}return W?(F||(F=new te),ro(a,d,v,y,N,F)):!1}function Vr(a){if(!Jt(a)||co(a))return!1;var d=Yt(a)?yr:or;return d.test(ue(a))}function eo(a){return Fe(a)&&Zt(a.length)&&!!L[Te(a)]}function to(a){if(!lo(a))return Cr(a);var d=[];for(var v in Object(a))Y.call(a,v)&&v!="constructor"&&d.push(v);return d}function qt(a,d,v,y,N,F){var A=v&o,$=a.length,D=d.length;if($!=D&&!(A&&D>$))return!1;var P=F.get(a);if(P&&F.get(d))return P==d;var z=-1,K=!0,W=v&i?new _e:void 0;for(F.set(a,d),F.set(d,a);++z<$;){var q=a[z],X=d[z];if(y)var re=A?y(X,q,z,d,a,F):y(q,X,z,a,d,F);if(re!==void 0){if(re)continue;K=!1;break}if(W){if(!lr(d,function(V,de){if(!fr(W,de)&&(q===V||N(q,V,v,y,F)))return W.push(de)})){K=!1;break}}else if(!(q===X||N(q,X,v,y,F))){K=!1;break}}return F.delete(a),F.delete(d),K}function no(a,d,v,y,N,F,A){switch(v){case he:if(a.byteLength!=d.byteLength||a.byteOffset!=d.byteOffset)return!1;a=a.buffer,d=d.buffer;case Ee:return!(a.byteLength!=d.byteLength||!F(new Rt(a),new Rt(d)));case f:case g:case O:return Kt(+a,+d);case b:return a.name==d.name&&a.message==d.message;case I:case U:return a==d+"";case x:var $=gr;case _:var D=y&o;if($||($=vr),a.size!=d.size&&!D)return!1;var P=A.get(a);if(P)return P==d;y|=i,A.set(a,d);var z=qt($(a),$(d),y,N,F,A);return A.delete(a),z;case ye:if(it)return it.call(a)==it.call(d)}return!1}function ro(a,d,v,y,N,F){var A=v&o,$=Xt(a),D=$.length,P=Xt(d),z=P.length;if(D!=z&&!A)return!1;for(var K=D;K--;){var W=$[K];if(!(A?W in d:Y.call(d,W)))return!1}var q=F.get(a);if(q&&F.get(d))return q==d;var X=!0;F.set(a,d),F.set(d,a);for(var re=A;++K<D;){W=$[K];var V=a[W],de=d[W];if(y)var Vt=A?y(de,V,W,d,a,F):y(V,de,W,a,d,F);if(!(Vt===void 0?V===de||N(V,de,v,y,F):Vt)){X=!1;break}re||(re=W=="constructor")}if(X&&!re){var Me=a.constructor,$e=d.constructor;Me!=$e&&"constructor"in a&&"constructor"in d&&!(typeof Me=="function"&&Me instanceof Me&&typeof $e=="function"&&$e instanceof $e)&&(X=!1)}return F.delete(a),F.delete(d),X}function Xt(a){return Jr(a,po,io)}function Ae(a,d){var v=a.__data__;return ao(d)?v[typeof d=="string"?"string":"hash"]:v.map}function ge(a,d){var v=hr(a,d);return Vr(v)?v:void 0}function oo(a){var d=Y.call(a,ae),v=a[ae];try{a[ae]=void 0;var y=!0}catch{}var N=Mt.call(a);return y&&(d?a[ae]=v:delete a[ae]),N}var io=Wt?function(a){return a==null?[]:(a=Object(a),ar(Wt(a),function(d){return Dt.call(a,d)}))}:vo,ne=Te;(tt&&ne(new tt(new ArrayBuffer(1)))!=he||Ce&&ne(new Ce)!=x||nt&&ne(nt.resolve())!=S||rt&&ne(new rt)!=_||ot&&ne(new ot)!=we)&&(ne=function(a){var d=Te(a),v=d==k?a.constructor:void 0,y=v?ue(v):"";if(y)switch(y){case Or:return he;case Tr:return x;case Fr:return S;case kr:return _;case Sr:return we}return d});function so(a,d){return d=d==null?s:d,!!d&&(typeof a=="number"||ir.test(a))&&a>-1&&a%1==0&&a<d}function ao(a){var d=typeof a;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?a!=="__proto__":a===null}function co(a){return!!Ht&&Ht in a}function lo(a){var d=a&&a.constructor,v=typeof d=="function"&&d.prototype||Le;return a===v}function uo(a){return Mt.call(a)}function ue(a){if(a!=null){try{return At.call(a)}catch{}try{return a+""}catch{}}return""}function Kt(a,d){return a===d||a!==a&&d!==d}var fo=Gt(function(){return arguments}())?Gt:function(a){return Fe(a)&&Y.call(a,"callee")&&!Dt.call(a,"callee")},He=Array.isArray;function ho(a){return a!=null&&Zt(a.length)&&!Yt(a)}var st=wr||mo;function go(a,d){return Ut(a,d)}function Yt(a){if(!Jt(a))return!1;var d=Te(a);return d==p||d==w||d==u||d==E}function Zt(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=s}function Jt(a){var d=typeof a;return a!=null&&(d=="object"||d=="function")}function Fe(a){return a!=null&&typeof a=="object"}var Qt=Pt?dr(Pt):eo;function po(a){return ho(a)?Zr(a):to(a)}function vo(){return[]}function mo(){return!1}e.exports=go})(yt,yt.exports);var _s=yt.exports,Tn=()=>Math.floor(Math.random()*1e6+Math.random()*1e6),Ps=e=>{try{return e.constructor.name}catch{return""}},As=class{constructor(e,t,n){this.type=e,this.handleMessage=t,this.target=n,this.outgoingMessages=new Set,this._messageListener=async r=>{var o;const{data:i}=r;if(i.$type!==this.getTypeId()||this.outgoingMessages.has(i.$id))return;let s={$originId:this.internalId,$type:this.getTypeId(),$id:i.$id};try{const c=await this.handleMessage(i.$data);s.$data=c}catch(c){c.message||console.error(c),s.$error={message:(o=c.message)!=null?o:"Unknown error"}}r.source?r.source.postMessage(s,"*"):this._postMessage(s)},this.createConnection(),this.internalId=Tn(),this.isWorker=Ps(n)==="Worker"}getTypeId(){return`p-${this.type}`}createConnection(){self.addEventListener("message",this._messageListener)}dispose(){self.removeEventListener("message",this._messageListener)}sendMessage(e){return new Promise(t=>{const n=Tn(),r={$originId:this.internalId,$type:this.getTypeId(),$data:e,$id:n};this.outgoingMessages.add(n);const o=i=>{const{data:s}=i;s.$type===this.getTypeId()&&s.$id===n&&s.$originId!==this.internalId&&(t(s.$data),self.removeEventListener("message",o))};self.addEventListener("message",o),this._postMessage(r)})}_postMessage(e){this.isWorker||typeof DedicatedWorkerGlobalScope<"u"&&this.target instanceof DedicatedWorkerGlobalScope?this.target.postMessage(e):this.target.postMessage(e,"*")}},Hs=class{constructor(e,t){this.globalListeners={},this.globalListenersCount=0,this.channelListeners={},this.channelListenersCount=0,this.channelId=Math.floor(Math.random()*1e6),this.frameWindow=e.contentWindow,this.origin=t,this.globalListeners=[],this.channelListeners=[],this.eventListener=this.eventListener.bind(this),typeof window<"u"&&window.addEventListener("message",this.eventListener)}cleanup(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0}register(){!this.frameWindow||this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)}dispatch(e){!this.frameWindow||this.frameWindow.postMessage({$id:this.channelId,codesandbox:!0,...e},this.origin)}globalListen(e){if(typeof e!="function")return()=>{};const t=this.globalListenersCount;return this.globalListeners[t]=e,this.globalListenersCount++,()=>{delete this.globalListeners[t]}}channelListen(e){if(typeof e!="function")return()=>{};const t=this.channelListenersCount;return this.channelListeners[t]=e,this.channelListenersCount++,()=>{delete this.channelListeners[t]}}eventListener(e){if(e.source!==this.frameWindow)return;const t=e.data;!t.codesandbox||(Object.values(this.globalListeners).forEach(n=>n(t)),t.$id===this.channelId&&Object.values(this.channelListeners).forEach(n=>n(t)))}};function Zn(e={},t={},n="/index.js"){return JSON.stringify({name:"sandpack-project",main:n,dependencies:e,devDependencies:t},null,2)}function Ms(e,t,n,r){const o={...e};if(!o["/package.json"]){if(!t)throw new Error("No dependencies specified, please specify either a package.json or dependencies.");if(!r)throw new Error("Missing 'entry' parameter. Either specify an entry point, or pass in a package.json with the 'main' field set.");o["/package.json"]={code:Zn(t,n,r)}}return o}function $s(e){if(e.title==="SyntaxError"){const{title:i,path:s,message:c,line:l,column:u}=e;return{title:i,path:s,message:c,line:l,column:u}}const t=Rs(e.payload.frames);if(!t)return{message:e.message};const n=Ws(t),r=Ds(t);return{message:zs(t._originalFileName,e.message,r,n),title:e.title,path:t._originalFileName,line:t._originalLineNumber,column:t._originalColumnNumber}}function Rs(e){if(!!e)return e.find(t=>!!t._originalFileName)}function Ds(e){return e?` (${e._originalLineNumber}:${e._originalColumnNumber})`:""}function Ws(e){const n=e._originalScriptCode[e._originalScriptCode.length-1].lineNumber.toString().length,r=2,o=3,i=r+n+o+e._originalColumnNumber;return e._originalScriptCode.reduce((s,c)=>{const l=c.highlight?">":" ",u=c.lineNumber.toString().length===n?`${c.lineNumber}`:` ${c.lineNumber}`,f=c.highlight?`
|
|
6
|
+
`+" ".repeat(i)+"^":"";return s+`
|
|
7
|
+
`+l+" "+u+" | "+c.content+f},"")}function zs(e,t,n,r){return`${e}: ${t}${n}
|
|
8
|
+
${r}`}var Gs=`https://${"0.19.0".replace(/\./g,"-")}-sandpack.codesandbox.io/`,Us=class{constructor(e,t,n={}){this.getTranspilerContext=()=>new Promise(i=>{const s=this.listen(c=>{c.type==="transpiler-context"&&(i(c.data),s())});this.dispatch({type:"get-transpiler-context"})});var r;if(this.options=n,this.sandboxInfo=t,this.bundlerURL=n.bundlerURL||Gs,this.bundlerState=void 0,this.errors=[],this.status="initializing",typeof e=="string"){this.selector=e;const i=document.querySelector(e);if(!i)throw new Error(`No element found for selector '${e}'`);this.element=i,this.iframe=document.createElement("iframe"),this.initializeElement()}else this.element=e,this.iframe=e;this.iframe.getAttribute("sandbox")||this.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts");const o=n.startRoute?new URL(n.startRoute,this.bundlerURL).toString():this.bundlerURL;(r=this.iframe.contentWindow)==null||r.location.replace(o),this.iframeProtocol=new Hs(this.iframe,this.bundlerURL),this.unsubscribeGlobalListener=this.iframeProtocol.globalListen(i=>{i.type!=="initialized"||!this.iframe.contentWindow||(this.iframeProtocol.register(),this.options.fileResolver&&(this.fileResolverProtocol=new As("file-resolver",async s=>s.m==="isFile"?this.options.fileResolver.isFile(s.p):this.options.fileResolver.readFile(s.p),this.iframe.contentWindow)),this.updatePreview(this.sandboxInfo,!0))}),this.unsubscribeChannelListener=this.iframeProtocol.channelListen(i=>{switch(i.type){case"start":{this.errors=[];break}case"status":{this.status=i.status;break}case"action":{i.action==="show-error"&&(this.errors=[...this.errors,$s(i)]);break}case"state":{this.bundlerState=i.state;break}}})}cleanup(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()}updateOptions(e){_s(this.options,e)||(this.options=e,this.updatePreview())}updatePreview(e=this.sandboxInfo,t){var n,r,o,i;this.sandboxInfo={...this.sandboxInfo,...e};const s=this.getFiles(),c=Object.keys(s).reduce((f,g)=>({...f,[g]:{code:s[g].code,path:g}}),{});let l=JSON.parse(Zn(this.sandboxInfo.dependencies,this.sandboxInfo.devDependencies,this.sandboxInfo.entry));try{l=JSON.parse(s["/package.json"].code)}catch(f){console.error("Could not parse package.json file: "+f.message)}const u=Object.keys(s).reduce((f,g)=>({...f,[g]:{content:s[g].code,path:g}}),{});this.dispatch({type:"compile",codesandbox:!0,version:3,isInitializationCompile:t,modules:c,reactDevTools:this.options.reactDevTools,externalResources:this.options.externalResources||[],hasFileResolver:Boolean(this.options.fileResolver),disableDependencyPreprocessing:this.sandboxInfo.disableDependencyPreprocessing,template:this.sandboxInfo.template||Ns(l,u),showOpenInCodeSandbox:(n=this.options.showOpenInCodeSandbox)!=null?n:!0,showErrorScreen:(r=this.options.showErrorScreen)!=null?r:!0,showLoadingScreen:(o=this.options.showLoadingScreen)!=null?o:!0,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstCompile,logLevel:(i=this.options.logLevel)!=null?i:xt.Info})}dispatch(e){this.iframeProtocol.dispatch(e)}listen(e){return this.iframeProtocol.channelListen(e)}getCodeSandboxURL(){const e=this.getFiles(),t=Object.keys(e).reduce((n,r)=>({...n,[r.replace("/","")]:{content:e[r].code,isBinary:!1}}),{});return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1",{method:"POST",body:JSON.stringify({files:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(n=>n.json()).then(n=>({sandboxId:n.sandbox_id,editorUrl:`https://codesandbox.io/s/${n.sandbox_id}`,embedUrl:`https://codesandbox.io/embed/${n.sandbox_id}`}))}getFiles(){const{sandboxInfo:e}=this;return e.files["/package.json"]===void 0?Ms(e.files,e.dependencies,e.devDependencies,e.entry):this.sandboxInfo.files}initializeElement(){if(this.iframe.style.border="0",this.iframe.style.width=this.options.width||"100%",this.iframe.style.height=this.options.height||"100%",this.iframe.style.overflow="hidden",!this.element.parentNode)throw new Error("Given element does not have a parent.");this.element.parentNode.replaceChild(this.iframe,this.element)}},xt;(function(e){e[e.None=0]="None",e[e.Error=10]="Error",e[e.Warning=20]="Warning",e[e.Info=30]="Info",e[e.Debug=40]="Debug"})(xt||(xt={}));function Fn(e){var{className:t,files:n,presetConfig:r,show:o,children:i,codeConfig:s,style:c,frameless:l}=e,u=M(e,["className","files","presetConfig","show","children","codeConfig","style","frameless"]);const f=r?h(qs,{files:n,presetConfig:r}):i;return h("div",{className:"ch-preview"+(t?" "+t:""),style:c,children:l?f:h(js,{...Object.assign({loadUrl:o,theme:s.theme},u,{children:f})})})}function qs({files:e,presetConfig:t}){const n=C.useRef(null),r=C.useRef(null);return C.useEffect(()=>{r.current=new Us(n.current,Object.assign(Object.assign({},t),{files:kn(t.files,e)}),{showOpenInCodeSandbox:!1})},[]),C.useEffect(()=>{r.current&&r.current.updatePreview(Object.assign(Object.assign({},t),{files:kn(t.files,e)}))},[e]),h("iframe",{ref:n})}function kn(e,t){const n=Object.assign({},e);return t.forEach(r=>{n["/"+r.name]={code:r.code.lines.map(o=>o.tokens.map(i=>i.content).join("")).join(`
|
|
9
|
+
`)}}),n}function Xs(e,t){const n=C.Children.toArray(e),r=t?n.slice(0,n.length/2):n,o=t?n.slice(n.length/2):void 0;return{stepsChildren:r,previewChildren:o}}function aa(e){var t,{children:n,editorSteps:r,codeConfig:o,start:i=0,presetConfig:s,className:c,style:l,hasPreviewSteps:u}=e,f=M(e,["children","editorSteps","codeConfig","start","presetConfig","className","style","hasPreviewSteps"]);const{stepsChildren:g,previewChildren:b}=Xs(n,u),p=s||u,[w,x]=C.useState({stepIndex:i,step:r[i]}),O=w.step;function j(S){const E=Yn(w.step,S,null);x(Object.assign(Object.assign({},w),{step:E}))}const k=g[0];return B("section",{className:`ch-spotlight ${p?"ch-spotlight-with-preview":""} ${c||""}`,style:l,children:[B("div",{className:"ch-spotlight-tabs",children:[!((t=k==null?void 0:k.props)===null||t===void 0)&&t.children?h("div",{children:g[0]}):null,g.map((S,E)=>E===0?null:h("div",{onClick:()=>x({stepIndex:E,step:r[E]}),className:"ch-spotlight-tab","data-selected":E===w.stepIndex?"true":void 0,children:S},E))]}),B("div",{className:"ch-spotlight-sticker",children:[h(Bt,{...Object.assign({},f,O,{codeConfig:o,onTabClick:j})}),s?h(Fn,{className:"ch-spotlight-preview",files:O.files,presetConfig:s,codeConfig:o}):u?h(Fn,{...Object.assign({className:"ch-spotlight-preview"},b[w.stepIndex].props)}):null]})]})}typeof window<"u"?C.useLayoutEffect:C.useEffect;C.createContext(void 0);typeof window<"u"?C.useLayoutEffect:C.useEffect;function ca(){const e=C.useContext(Ys);return e?h(Ks,{...Object.assign({},e)}):null}function Ks({editorStep:e,setFocus:t}){const n=o=>{t({fileName:o,focus:null,id:""})},r=M(e,["preset","presetConfig"]);return h(Bt,{...Object.assign({},r,{onTabClick:n})})}const Ys=C.createContext(null),la={box:Vs,bg:Jn,label:ta,link:na,mark:Zs,withClass:ea};function Zs(e){return e.isInline?h(Js,{...Object.assign({},e)}):h(Jn,{...Object.assign({},e)})}function Jn({children:e,data:t,style:n,theme:r}){const o="ch-code-multiline-mark "+(t!=null?t:""),i=T(r,m.RangeHighlightBackground),s=T(r,m.EditorInfoForeground);return B("div",{style:Object.assign(Object.assign({},n),{background:i}),className:o,children:[h("span",{className:"ch-code-multiline-mark-border",style:{background:s}}),e]})}function Js({children:e,data:t,theme:n}){const r=Qs(e)||Ue(T(n,m.CodeForeground),.2),o="ch-code-inline-mark "+(t!=null?t:"");return h("span",{className:o,style:{background:r},children:e})}function Qs(e){var t,n,r;const o=C.Children.toArray(e)[0],i=C.Children.toArray(((t=o==null?void 0:o.props)===null||t===void 0?void 0:t.children)||[])[0],s=C.Children.toArray(((n=i==null?void 0:i.props)===null||n===void 0?void 0:n.children)||[])[0],{color:c}=((r=s==null?void 0:s.props)===null||r===void 0?void 0:r.style)||{};if(c)return Ue(c,.2)}function Vs({children:e,data:t,theme:n}){var r,o;const i=typeof t=="string"?t:((o=(r=n.tokenColors.find(s=>{var c;return(c=s.scope)===null||c===void 0?void 0:c.includes("string")}))===null||r===void 0?void 0:r.settings)===null||o===void 0?void 0:o.foreground)||"yellow";return h("span",{className:"ch-code-box-annotation",style:{outline:`2px solid ${i}`},children:e})}function ea({children:e,data:t,style:n,theme:r}){return h("span",{style:n,className:t,children:e})}function ta({children:e,data:t,style:n,theme:r}){const o=r.colors["editor.lineHighlightBackground"]||r.colors["editor.selectionHighlightBackground"],[i,s]=C.useState(!1);return B("div",{style:Object.assign(Object.assign({},n),{background:i?o:void 0}),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[e,h("div",{style:{position:"absolute",right:0,paddingRight:16,display:i?"block":"none",opacity:.7},children:(t==null?void 0:t.children)||t})]})}function na({children:e,isInline:t,style:n,data:r}){const o=(r==null?void 0:r.url)||r,i=r==null?void 0:r.title;return h("a",{href:o,title:i,className:t?"ch-code-inline-link":"ch-code-link",style:n,children:e})}export{sa as C,aa as S,la as a,ca as b};
|