@ragrails/api-playground-react 0.1.2 → 0.1.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/README.md +159 -68
- package/dist/index.cjs +12 -11
- package/dist/index.js +552 -1305
- package/dist/src/features/api-widget/{ApiWidget.d.ts → ApiPlayground.d.ts} +7 -7
- package/dist/src/features/api-widget/index.d.ts +2 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/lib/highlight.d.ts +1 -5
- package/dist/styles.css +1 -1
- package/package.json +39 -9
package/dist/index.js
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
+
const __RAGRAILS_API_PLAYGROUND_CSS__="/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-green-500:oklch(72.3% .219 149.579);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--font-heading:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.top-2{top:calc(var(--spacing) * 2)}.top-5{top:calc(var(--spacing) * 5)}.top-full{top:100%}.right-2{right:calc(var(--spacing) * 2)}.right-5{right:calc(var(--spacing) * 5)}.-bottom-px{bottom:-1px}.left-0{left:0}.isolate{isolation:isolate}.-z-10{z-index:calc(10 * -1)}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-4{margin-right:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.\\[field-sizing\\:content\\]{field-sizing:content}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-full{height:100%}.min-h-0{min-height:0}.min-h-10{min-height:calc(var(--spacing) * 10)}.w-3{width:calc(var(--spacing) * 3)}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-11{width:calc(var(--spacing) * 11)}.w-full{width:100%}.w-max{width:max-content}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-28{min-width:calc(var(--spacing) * 28)}.min-w-\\[7rem\\]{min-width:7rem}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-1{--tw-translate-x:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-6{--tw-translate-x:calc(var(--spacing) * 6);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.-skew-x-12{--tw-skew-x:skewX(calc(12deg * -1));transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\\[shimmer_2s_linear_infinite\\]{animation:2s linear infinite shimmer}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.\\[grid-template-rows\\:1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\\[\\#52b788\\]\\/25{border-color:oklab(70.6413% -.111726 .0387149/.25)}.border-\\[\\#FC7070\\]\\/20{border-color:oklab(71.4755% .158854 .0655041/.2)}.border-amber-500\\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\\/30{border-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.border-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-primary,.border-primary\\/30{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\\/30{border-color:color-mix(in oklab, var(--primary) 30%, transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\\/60{border-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.border-red-500\\/60{border-color:color-mix(in oklab, var(--color-red-500) 60%, transparent)}}.border-sky-500\\/30{border-color:#00a5ef4d}@supports (color:color-mix(in lab, red, red)){.border-sky-500\\/30{border-color:color-mix(in oklab, var(--color-sky-500) 30%, transparent)}}.border-transparent{border-color:#0000}.border-t-primary{border-top-color:var(--primary)}.border-t-transparent{border-top-color:#0000}.bg-\\[\\#4A0F0F\\]{background-color:#4a0f0f}.bg-\\[\\#52b788\\]\\/15{background-color:oklab(70.6413% -.111726 .0387149/.15)}.bg-\\[\\#EF5350\\]{background-color:#ef5350}.bg-amber-500\\/15{background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\\/15{background-color:color-mix(in oklab, var(--color-amber-500) 15%, transparent)}}.bg-bg{background-color:var(--bg)}.bg-primary{background-color:var(--primary)}.bg-primary-soft{background-color:var(--primary-soft)}.bg-sky-500\\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\\/15{background-color:color-mix(in oklab, var(--color-sky-500) 15%, transparent)}}.bg-surface{background-color:var(--surface)}.bg-surface-2{background-color:var(--surface-2)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-muted{--tw-gradient-from:var(--text-muted);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-content{--tw-gradient-via:var(--text);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\\/5{--tw-gradient-via:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.via-white\\/5{--tw-gradient-via:color-mix(in oklab, var(--color-white) 5%, transparent)}}.via-white\\/5{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\\/10{--tw-gradient-via:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.via-white\\/10{--tw-gradient-via:color-mix(in oklab, var(--color-white) 10%, transparent)}}.via-white\\/10{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\\/25{--tw-gradient-via:#ffffff40}@supports (color:color-mix(in lab, red, red)){.via-white\\/25{--tw-gradient-via:color-mix(in oklab, var(--color-white) 25%, transparent)}}.via-white\\/25{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-muted{--tw-gradient-to:var(--text-muted);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-\\[length\\:200\\%_100\\%\\]{background-size:200% 100%}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-7{padding-inline:calc(var(--spacing) * 7)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.pr-28{padding-right:calc(var(--spacing) * 28)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-heading{font-family:var(--font-heading)}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[16px\\]{font-size:16px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-\\[550\\]{--tw-font-weight:550;font-weight:550}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre{white-space:pre}.text-\\[\\#52b788\\]{color:#52b788}.text-\\[\\#FC7070\\]{color:#fc7070}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-content{color:var(--text)}.text-green-500{color:var(--color-green-500)}.text-muted,.text-muted\\/60{color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.text-muted\\/60{color:color-mix(in oklab, var(--text-muted) 60%, transparent)}}.text-primary{color:var(--primary)}.text-primary-contrast{color:var(--primary-contrast)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-sky-400{color:var(--color-sky-400)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-0{--tw-duration:0s;transition-duration:0s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\\:translate-x-full:is(:where(.group):hover *){--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\\:\\[animation\\:text-shimmer_1\\.2s_linear_1_forwards\\]:is(:where(.group):hover *){animation:1.2s linear forwards text-shimmer}.group-hover\\:text-transparent:is(:where(.group):hover *){color:#0000}.group-hover\\:duration-\\[1200ms\\]:is(:where(.group):hover *){--tw-duration:1.2s;transition-duration:1.2s}.group-hover\\/seg\\:\\[animation\\:text-shimmer_1\\.2s_linear_1_forwards\\]:is(:where(.group\\/seg):hover *){animation:1.2s linear forwards text-shimmer}.group-hover\\/seg\\:text-transparent:is(:where(.group\\/seg):hover *){color:#0000}}.group-disabled\\:hidden:is(:where(.group):disabled *){display:none}.placeholder\\:text-muted::placeholder,.placeholder\\:text-muted\\/50::placeholder{color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.placeholder\\:text-muted\\/50::placeholder{color:color-mix(in oklab, var(--text-muted) 50%, transparent)}}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.read-only\\:cursor-default:read-only{cursor:default}.focus-within\\:border-primary:focus-within,.focus-within\\:border-primary\\/60:focus-within{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-within\\:border-primary\\/60:focus-within{border-color:color-mix(in oklab, var(--primary) 60%, transparent)}}.focus-within\\:border-primary\\/70:focus-within{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-within\\:border-primary\\/70:focus-within{border-color:color-mix(in oklab, var(--primary) 70%, transparent)}}.focus-within\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-within\\:ring-primary\\/15:focus-within{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-within\\:ring-primary\\/15:focus-within{--tw-ring-color:color-mix(in oklab, var(--primary) 15%, transparent)}}.focus-within\\:ring-primary\\/20:focus-within{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-within\\:ring-primary\\/20:focus-within{--tw-ring-color:color-mix(in oklab, var(--primary) 20%, transparent)}}@media (hover:hover){.hover\\:border-primary\\/70:hover{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:border-primary\\/70:hover{border-color:color-mix(in oklab, var(--primary) 70%, transparent)}}.hover\\:bg-\\[\\#e53935\\]:hover{background-color:#e53935}.hover\\:bg-border:hover{background-color:var(--border)}.hover\\:bg-primary-hover:hover{background-color:var(--primary-hover)}.hover\\:bg-surface-2:hover{background-color:var(--surface-2)}.hover\\:text-content:hover{color:var(--text)}.hover\\:text-primary-hover:hover{color:var(--primary-hover)}}.focus\\:border-primary\\/60:focus{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus\\:border-primary\\/60:focus{border-color:color-mix(in oklab, var(--primary) 60%, transparent)}}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:ring-primary\\/20:focus{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus\\:ring-primary\\/20:focus{--tw-ring-color:color-mix(in oklab, var(--primary) 20%, transparent)}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-primary\\/60:focus-visible{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\:ring-primary\\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--primary) 60%, transparent)}}.active\\:scale-105:active{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}@media (prefers-reduced-motion:no-preference){.motion-safe\\:animate-\\[dropdown-expand_0\\.2s_ease-out\\]{animation:.2s ease-out dropdown-expand}.motion-safe\\:animate-\\[dropdown-expand_0\\.18s_ease-in_reverse_forwards\\]{animation:.18s ease-in reverse forwards dropdown-expand}.motion-safe\\:animate-\\[fade-in_0\\.6s_ease-out_both\\]{animation:.6s ease-out both fade-in}.motion-safe\\:animate-\\[widget-slide-in_180ms_ease-out\\]{animation:.18s ease-out widget-slide-in}}@media (prefers-reduced-motion:reduce){.motion-reduce\\:active\\:scale-100:active{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@media (min-width:40rem){.sm\\:inline{display:inline}}@media (min-width:48rem){.md\\:col-start-auto{grid-column-start:auto}.md\\:row-span-1{grid-row:span 1/span 1}.md\\:inline{display:inline}.md\\:grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}.md\\:grid-cols-\\[auto_1fr\\]{grid-template-columns:auto 1fr}.md\\:grid-cols-\\[auto_1fr_1fr_auto\\]{grid-template-columns:auto 1fr 1fr auto}.md\\:grid-cols-\\[minmax\\(0\\,0\\.7fr\\)_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,.7fr) minmax(0,1fr)}}.\\[\\&_button\\]\\:text-\\[14px\\] button{font-size:14px}[data-theme=light]{--bg:#f2f4f7;--surface:#fff;--surface-2:#e7ebf3;--border:#d2d7df;--text:#0f1216;--text-muted:#4b5563;--primary:#7855ff;--primary-contrast:#fff}[data-theme=dark]{--bg:#16171d;--surface:#1f2028;--surface-2:#2a2c36;--border:#2e303a;--text:#f3f4f6;--text-muted:#9ca3af;--primary:#7855ff;--primary-contrast:#fff}[data-theme]{--primary-hover:var(--primary)}@supports (color:color-mix(in lab, red, red)){[data-theme]{--primary-hover:color-mix(in srgb, var(--primary) 86%, #000)}}[data-theme]{--primary-soft:var(--primary)}@supports (color:color-mix(in lab, red, red)){[data-theme]{--primary-soft:color-mix(in srgb, var(--primary) 16%, transparent)}}@keyframes shimmer{to{transform:translate(100%)}}@keyframes text-shimmer{0%{background-position:200%}to{background-position:-200%}}@keyframes dropdown-expand{0%{opacity:0;grid-template-rows:0fr}to{opacity:1;grid-template-rows:1fr}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes widget-slide-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:var(--text-muted);font-style:italic}.token.punctuation{color:var(--text-muted)}.token.property,.token.tag,.token.symbol,.token.deleted{color:#7aa2f7}.token.number{color:#e5c07b}.token.boolean,.token.null,.token.keyword,.token.atrule,.token.important{color:var(--primary)}.token.string,.token.char,.token.attr-name,.token.attr-value,.token.regex,.token.inserted,.token.selector{color:#9ece6a}.token.operator,.token.entity,.token.url,.token.variable{color:var(--text)}.token.function,.token.class-name{color:#61afef}.token.builtin{color:#56b6c2}[data-theme=light] .token.property,[data-theme=light] .token.tag,[data-theme=light] .token.symbol,[data-theme=light] .token.deleted{color:#0550ae}[data-theme=light] .token.number{color:#953800}[data-theme=light] .token.string,[data-theme=light] .token.char,[data-theme=light] .token.attr-name,[data-theme=light] .token.attr-value,[data-theme=light] .token.regex,[data-theme=light] .token.inserted,[data-theme=light] .token.selector{color:#116329}[data-theme=light] .token.function,[data-theme=light] .token.class-name{color:#1f6feb}[data-theme=light] .token.builtin{color:#0e7490}@layer base{[data-theme] button:not(:disabled),[data-theme] [role=button]:not([aria-disabled=true]){cursor:pointer}}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:\"*\";inherits:false}@property --tw-rotate-y{syntax:\"*\";inherits:false}@property --tw-rotate-z{syntax:\"*\";inherits:false}@property --tw-skew-x{syntax:\"*\";inherits:false}@property --tw-skew-y{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:\"*\";inherits:false}@property --tw-gradient-from{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:\"*\";inherits:false}@property --tw-gradient-via-stops{syntax:\"*\";inherits:false}@property --tw-gradient-from-position{syntax:\"<length-percentage>\";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:\"<length-percentage>\";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:\"<length-percentage>\";inherits:false;initial-value:100%}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@property --tw-scale-x{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\"*\";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}";
|
|
2
|
+
if(typeof document!=="undefined"&&!document.getElementById("ragrails-api-playground-react-styles")){const style=document.createElement("style");style.id="ragrails-api-playground-react-styles";style.textContent=__RAGRAILS_API_PLAYGROUND_CSS__;(document.head||document.documentElement).appendChild(style);}
|
|
1
3
|
import e, { useEffect as t, useId as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
2
4
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
3
|
-
//#region \0rolldown/runtime.js
|
|
4
|
-
var u = Object.create, d = Object.defineProperty, f = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, m = Object.getPrototypeOf, h = Object.prototype.hasOwnProperty, g = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), _ = (e, t, n, r) => {
|
|
5
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i = p(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !h.call(e, s) && s !== n && d(e, s, {
|
|
6
|
-
get: ((e) => t[e]).bind(null, s),
|
|
7
|
-
enumerable: !(r = f(t, s)) || r.enumerable
|
|
8
|
-
});
|
|
9
|
-
return e;
|
|
10
|
-
}, v = (e, t, n) => (n = e == null ? {} : u(m(e)), _(t || !e || !e.__esModule ? d(n, "default", {
|
|
11
|
-
value: e,
|
|
12
|
-
enumerable: !0
|
|
13
|
-
}) : n, e));
|
|
14
|
-
//#endregion
|
|
15
5
|
//#region src/lib/cn.ts
|
|
16
|
-
function
|
|
6
|
+
function u(...e) {
|
|
17
7
|
return e.filter(Boolean).join(" ");
|
|
18
8
|
}
|
|
19
9
|
//#endregion
|
|
20
10
|
//#region src/components/ui/Icon.tsx
|
|
21
|
-
var
|
|
11
|
+
var d = {
|
|
22
12
|
copy: /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("path", {
|
|
23
13
|
fill: "currentColor",
|
|
24
14
|
d: "M15.24 2h-3.894c-1.764 0-3.162 0-4.255.148c-1.126.152-2.037.472-2.755 1.193c-.719.721-1.038 1.636-1.189 2.766C3 7.205 3 8.608 3 10.379v5.838c0 1.508.92 2.8 2.227 3.342c-.067-.91-.067-2.185-.067-3.247v-5.01c0-1.281 0-2.386.118-3.27c.127-.948.413-1.856 1.147-2.593s1.639-1.024 2.583-1.152c.88-.118 1.98-.118 3.257-.118h3.07c1.276 0 2.374 0 3.255.118A3.6 3.6 0 0 0 15.24 2"
|
|
@@ -208,61 +198,61 @@ var b = {
|
|
|
208
198
|
fill: "currentColor",
|
|
209
199
|
d: "M2.69 6.705a.75.75 0 0 0-1.38.59zm12.897 6.624l-.274-.698zm-6.546.409a.75.75 0 1 0-1.257-.818zm-2.67 1.353a.75.75 0 1 0 1.258.818zM22.69 7.295a.75.75 0 0 0-1.378-.59zM19 11.13l-.513-.547zm.97 2.03a.75.75 0 1 0 1.06-1.06zm-8.72 3.34a.75.75 0 0 0 1.5 0zm5.121-.591a.75.75 0 1 0 1.258-.818zm-10.84-4.25A.75.75 0 0 0 4.47 10.6zm-2.561.44a.75.75 0 0 0 1.06 1.06zM12 13.25c-3.224 0-5.539-1.605-7.075-3.26a13.6 13.6 0 0 1-1.702-2.28a12 12 0 0 1-.507-.946l-.022-.049l-.004-.01l-.001-.001L2 7l-.69.296h.001l.001.003l.003.006l.04.088q.039.088.117.243c.103.206.256.496.462.841c.41.69 1.035 1.61 1.891 2.533C5.54 12.855 8.224 14.75 12 14.75zm3.313-.62c-.97.383-2.071.62-3.313.62v1.5c1.438 0 2.725-.276 3.862-.723zm-7.529.29l-1.413 2.17l1.258.818l1.412-2.171zM22 7l-.69-.296h.001v.002l-.007.013l-.028.062a12 12 0 0 1-.64 1.162a13.3 13.3 0 0 1-2.15 2.639l1.027 1.094a14.8 14.8 0 0 0 3.122-4.26l.039-.085l.01-.024l.004-.007v-.003h.001v-.001zm-3.513 3.582c-.86.806-1.913 1.552-3.174 2.049l.549 1.396c1.473-.58 2.685-1.444 3.651-2.351zm-.017 1.077l1.5 1.5l1.06-1.06l-1.5-1.5zM11.25 14v2.5h1.5V14zm3.709-.262l1.412 2.171l1.258-.818l-1.413-2.171zm-10.49-3.14l-1.5 1.5L4.03 13.16l1.5-1.5z"
|
|
210
200
|
})
|
|
211
|
-
},
|
|
201
|
+
}, f = ({ name: e, size: t, className: n, ...r }) => /* @__PURE__ */ c("svg", {
|
|
212
202
|
xmlns: "http://www.w3.org/2000/svg",
|
|
213
203
|
viewBox: "0 0 24 24",
|
|
214
204
|
width: t ?? "1em",
|
|
215
205
|
height: t ?? "1em",
|
|
216
|
-
className:
|
|
206
|
+
className: u("inline-block shrink-0", n),
|
|
217
207
|
"aria-hidden": r["aria-label"] ? void 0 : !0,
|
|
218
208
|
...r,
|
|
219
|
-
children:
|
|
220
|
-
}),
|
|
209
|
+
children: d[e]
|
|
210
|
+
}), p = {
|
|
221
211
|
primary: "bg-primary text-primary-contrast hover:bg-primary-hover",
|
|
222
212
|
secondary: "bg-surface-2 text-content border border-border hover:bg-border",
|
|
223
213
|
ghost: "bg-transparent text-muted hover:text-content",
|
|
224
214
|
danger: "bg-[#EF5350] text-white hover:bg-[#e53935]"
|
|
225
|
-
},
|
|
215
|
+
}, m = {
|
|
226
216
|
sm: "text-[12px] px-3 py-1.5",
|
|
227
217
|
md: "text-[14px] px-4 py-2",
|
|
228
218
|
lg: "text-[16px] px-5 py-2.5"
|
|
229
|
-
},
|
|
219
|
+
}, h = {
|
|
230
220
|
sm: "gap-1.5",
|
|
231
221
|
md: "gap-2",
|
|
232
222
|
lg: "gap-2"
|
|
233
|
-
},
|
|
234
|
-
className:
|
|
223
|
+
}, g = ({ variant: e = "primary", size: t = "md", isLoading: n = !1, leftIcon: r, rightIcon: i, className: a, children: o, disabled: s, ...d }) => /* @__PURE__ */ l("button", {
|
|
224
|
+
className: u("group relative isolate overflow-hidden rounded-lg font-heading font-medium", "inline-flex items-center justify-center", "transition duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "active:scale-105 motion-reduce:active:scale-100", "disabled:opacity-50 disabled:cursor-not-allowed", p[e], m[t], a),
|
|
235
225
|
disabled: s || n,
|
|
236
|
-
...
|
|
226
|
+
...d,
|
|
237
227
|
children: [e !== "ghost" && /* @__PURE__ */ c("span", {
|
|
238
228
|
"aria-hidden": "true",
|
|
239
|
-
className:
|
|
229
|
+
className: u("pointer-events-none absolute inset-0 -z-10 -translate-x-full -skew-x-12", "bg-gradient-to-r from-transparent via-white/25 to-transparent", "transition-transform duration-0 ease-out", "group-hover:translate-x-full group-hover:duration-[1200ms] group-disabled:hidden")
|
|
240
230
|
}), /* @__PURE__ */ l("span", {
|
|
241
|
-
className:
|
|
231
|
+
className: u("inline-flex items-center", h[t]),
|
|
242
232
|
children: [
|
|
243
233
|
n ? /* @__PURE__ */ c("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : r,
|
|
244
234
|
/* @__PURE__ */ c("span", {
|
|
245
|
-
className:
|
|
235
|
+
className: u(e === "ghost" && "bg-gradient-to-r from-muted via-content to-muted bg-[length:200%_100%] bg-clip-text group-hover:text-transparent group-hover:[animation:text-shimmer_1.2s_linear_1_forwards]"),
|
|
246
236
|
children: o
|
|
247
237
|
}),
|
|
248
238
|
!n && i
|
|
249
239
|
]
|
|
250
240
|
})]
|
|
251
|
-
}),
|
|
241
|
+
}), _ = {
|
|
252
242
|
ghost: "text-muted hover:bg-surface-2 hover:text-content",
|
|
253
243
|
surface: "bg-surface-2 text-muted border border-border hover:text-content",
|
|
254
244
|
solid: "bg-primary text-primary-contrast hover:bg-primary-hover"
|
|
255
|
-
},
|
|
245
|
+
}, v = {
|
|
256
246
|
sm: "h-7 w-7",
|
|
257
247
|
md: "h-9 w-9"
|
|
258
|
-
},
|
|
259
|
-
className:
|
|
248
|
+
}, y = ({ variant: e = "ghost", size: t = "md", className: n, children: r, ...i }) => /* @__PURE__ */ c("button", {
|
|
249
|
+
className: u("inline-flex items-center justify-center rounded-lg transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:opacity-50 disabled:cursor-not-allowed", _[e], v[t], n),
|
|
260
250
|
...i,
|
|
261
251
|
children: r
|
|
262
252
|
});
|
|
263
253
|
//#endregion
|
|
264
254
|
//#region src/lib/clipboard.ts
|
|
265
|
-
async function
|
|
255
|
+
async function b(e) {
|
|
266
256
|
try {
|
|
267
257
|
if (navigator.clipboard && window.isSecureContext) try {
|
|
268
258
|
return await navigator.clipboard.writeText(e), !0;
|
|
@@ -281,13 +271,13 @@ async function k(e) {
|
|
|
281
271
|
return console.error("Failed to copy text:", e), !1;
|
|
282
272
|
}
|
|
283
273
|
}
|
|
284
|
-
function
|
|
274
|
+
function x(t = 2e3) {
|
|
285
275
|
let [n, r] = e.useState(!1), i = e.useRef(null);
|
|
286
276
|
return e.useEffect(() => () => {
|
|
287
277
|
i.current && clearTimeout(i.current);
|
|
288
278
|
}, []), {
|
|
289
279
|
copy: async (e) => {
|
|
290
|
-
let n = await
|
|
280
|
+
let n = await b(e);
|
|
291
281
|
return n && (r(!0), i.current && clearTimeout(i.current), i.current = window.setTimeout(() => {
|
|
292
282
|
r(!1);
|
|
293
283
|
}, t)), n;
|
|
@@ -297,44 +287,44 @@ function A(t = 2e3) {
|
|
|
297
287
|
}
|
|
298
288
|
//#endregion
|
|
299
289
|
//#region src/components/ui/CopyButton.tsx
|
|
300
|
-
var
|
|
301
|
-
let { copy: a, copied: o } =
|
|
302
|
-
return /* @__PURE__ */ c(
|
|
290
|
+
var S = ({ value: e, variant: t = "surface", size: n = "md", className: r, label: i = "Copy to clipboard" }) => {
|
|
291
|
+
let { copy: a, copied: o } = x(), s = n === "sm" ? 14 : 16;
|
|
292
|
+
return /* @__PURE__ */ c(y, {
|
|
303
293
|
"aria-label": o ? "Copied" : i,
|
|
304
294
|
variant: t,
|
|
305
295
|
size: n,
|
|
306
296
|
className: r,
|
|
307
297
|
onClick: () => a(e),
|
|
308
|
-
children: o ? /* @__PURE__ */ c(
|
|
298
|
+
children: o ? /* @__PURE__ */ c(f, {
|
|
309
299
|
name: "check",
|
|
310
300
|
size: s,
|
|
311
301
|
className: "text-green-500"
|
|
312
|
-
}) : /* @__PURE__ */ c(
|
|
302
|
+
}) : /* @__PURE__ */ c(f, {
|
|
313
303
|
name: "copy",
|
|
314
304
|
size: s
|
|
315
305
|
})
|
|
316
306
|
});
|
|
317
|
-
},
|
|
307
|
+
}, C = {
|
|
318
308
|
neutral: "bg-surface-2 text-muted border border-border",
|
|
319
309
|
primary: "bg-primary-soft text-primary border border-primary/30",
|
|
320
310
|
success: "bg-[#52b788]/15 text-[#52b788] border border-[#52b788]/25",
|
|
321
311
|
error: "bg-[#4A0F0F] text-[#FC7070] border border-[#FC7070]/20",
|
|
322
312
|
warning: "bg-amber-500/15 text-amber-500 border border-amber-500/30",
|
|
323
313
|
info: "bg-sky-500/15 text-sky-400 border border-sky-500/30"
|
|
324
|
-
},
|
|
325
|
-
className:
|
|
314
|
+
}, w = ({ tone: e = "neutral", className: t, children: n }) => /* @__PURE__ */ c("span", {
|
|
315
|
+
className: u("inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-heading font-[550]", C[e], t),
|
|
326
316
|
children: n
|
|
327
|
-
}),
|
|
317
|
+
}), ee = {
|
|
328
318
|
GET: "success",
|
|
329
319
|
POST: "info",
|
|
330
320
|
PUT: "warning",
|
|
331
321
|
PATCH: "primary",
|
|
332
322
|
DELETE: "error"
|
|
333
|
-
},
|
|
334
|
-
tone:
|
|
323
|
+
}, T = ({ method: e, className: t }) => /* @__PURE__ */ c(w, {
|
|
324
|
+
tone: ee[e],
|
|
335
325
|
className: t,
|
|
336
326
|
children: e
|
|
337
|
-
}),
|
|
327
|
+
}), te = ({ status: e, statusText: t, className: n }) => /* @__PURE__ */ l(w, {
|
|
338
328
|
tone: e >= 200 && e < 300 ? "success" : e >= 300 && e < 400 ? "warning" : "error",
|
|
339
329
|
className: n,
|
|
340
330
|
children: [
|
|
@@ -342,16 +332,16 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
342
332
|
" ",
|
|
343
333
|
t
|
|
344
334
|
]
|
|
345
|
-
}),
|
|
335
|
+
}), ne = {
|
|
346
336
|
sm: "h-4 w-4 rounded",
|
|
347
337
|
md: "h-5 w-5 rounded-md"
|
|
348
|
-
},
|
|
338
|
+
}, E = {
|
|
349
339
|
sm: "h-3 w-3",
|
|
350
340
|
md: "h-3.5 w-3.5"
|
|
351
|
-
},
|
|
341
|
+
}, D = {
|
|
352
342
|
sm: "text-xs",
|
|
353
343
|
md: "text-sm"
|
|
354
|
-
},
|
|
344
|
+
}, O = ({ checked: e, onChange: t, label: n, disabled: r, size: i = "md", className: a, "aria-label": o }) => {
|
|
355
345
|
let s = /* @__PURE__ */ c("button", {
|
|
356
346
|
type: "button",
|
|
357
347
|
role: "checkbox",
|
|
@@ -359,41 +349,41 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
359
349
|
"aria-label": o ?? n,
|
|
360
350
|
disabled: r,
|
|
361
351
|
onClick: () => t(!e),
|
|
362
|
-
className:
|
|
363
|
-
children: /* @__PURE__ */ c(
|
|
352
|
+
className: u("inline-flex shrink-0 items-center justify-center border transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:cursor-not-allowed disabled:opacity-50", ne[i], e ? "border-primary bg-primary text-primary-contrast" : "border-border bg-surface-2 text-transparent hover:border-primary/70"),
|
|
353
|
+
children: /* @__PURE__ */ c(f, {
|
|
364
354
|
name: "check",
|
|
365
|
-
className:
|
|
355
|
+
className: E[i]
|
|
366
356
|
})
|
|
367
357
|
});
|
|
368
358
|
return n ? /* @__PURE__ */ l("label", {
|
|
369
|
-
className:
|
|
359
|
+
className: u("inline-flex cursor-pointer select-none items-center gap-2", a),
|
|
370
360
|
children: [s, /* @__PURE__ */ c("span", {
|
|
371
|
-
className:
|
|
361
|
+
className: u("text-content", D[i]),
|
|
372
362
|
children: n
|
|
373
363
|
})]
|
|
374
364
|
}) : /* @__PURE__ */ c("span", {
|
|
375
365
|
className: a,
|
|
376
366
|
children: s
|
|
377
367
|
});
|
|
378
|
-
},
|
|
368
|
+
}, k = ({ label: e, flush: t, className: n, children: r }) => /* @__PURE__ */ l("div", {
|
|
379
369
|
className: "w-full",
|
|
380
370
|
children: [e && /* @__PURE__ */ c("div", {
|
|
381
371
|
className: "mb-2 text-sm text-muted",
|
|
382
372
|
children: e
|
|
383
373
|
}), /* @__PURE__ */ c("div", {
|
|
384
|
-
className:
|
|
374
|
+
className: u("rounded-xl border border-border bg-surface", !t && "p-3", n),
|
|
385
375
|
children: r
|
|
386
376
|
})]
|
|
387
|
-
}),
|
|
388
|
-
let
|
|
377
|
+
}), A = ({ items: e, activeId: n, onChange: i, variant: s = "underline", size: d = "md", className: f }) => {
|
|
378
|
+
let p = a({}), [m, h] = o({
|
|
389
379
|
left: 0,
|
|
390
380
|
top: 0,
|
|
391
381
|
width: 0,
|
|
392
382
|
height: 0
|
|
393
383
|
});
|
|
394
384
|
return r(() => {
|
|
395
|
-
let e =
|
|
396
|
-
e &&
|
|
385
|
+
let e = p.current[n];
|
|
386
|
+
e && h({
|
|
397
387
|
left: e.offsetLeft,
|
|
398
388
|
top: e.offsetTop,
|
|
399
389
|
width: e.offsetWidth,
|
|
@@ -401,8 +391,8 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
401
391
|
});
|
|
402
392
|
}, [n, e]), t(() => {
|
|
403
393
|
let e = () => {
|
|
404
|
-
let e =
|
|
405
|
-
e &&
|
|
394
|
+
let e = p.current[n];
|
|
395
|
+
e && h({
|
|
406
396
|
left: e.offsetLeft,
|
|
407
397
|
top: e.offsetTop,
|
|
408
398
|
width: e.offsetWidth,
|
|
@@ -411,25 +401,25 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
411
401
|
};
|
|
412
402
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
413
403
|
}, [n]), s === "segmented" ? /* @__PURE__ */ l("div", {
|
|
414
|
-
className:
|
|
404
|
+
className: u("relative inline-flex gap-1 rounded-lg border border-border bg-surface-2 p-1", f),
|
|
415
405
|
children: [/* @__PURE__ */ c("span", {
|
|
416
406
|
className: "pointer-events-none absolute z-0 rounded-md bg-primary transition-all duration-300 ease-out",
|
|
417
407
|
style: {
|
|
418
|
-
left:
|
|
419
|
-
top:
|
|
420
|
-
width:
|
|
421
|
-
height:
|
|
408
|
+
left: m.left,
|
|
409
|
+
top: m.top,
|
|
410
|
+
width: m.width,
|
|
411
|
+
height: m.height
|
|
422
412
|
}
|
|
423
413
|
}), e.map((e) => {
|
|
424
414
|
let t = e.id === n;
|
|
425
415
|
return /* @__PURE__ */ c("button", {
|
|
426
416
|
ref: (t) => {
|
|
427
|
-
|
|
417
|
+
p.current[e.id] = t;
|
|
428
418
|
},
|
|
429
419
|
onClick: () => i(e.id),
|
|
430
|
-
className:
|
|
420
|
+
className: u("group/seg relative z-10 cursor-pointer rounded-md font-heading transition-colors duration-150", d === "sm" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[14px]", t ? "text-primary-contrast" : "text-muted"),
|
|
431
421
|
children: /* @__PURE__ */ l("span", {
|
|
432
|
-
className:
|
|
422
|
+
className: u("relative z-10", !t && "bg-gradient-to-r from-muted via-content to-muted bg-[length:200%_100%] bg-clip-text group-hover/seg:text-transparent group-hover/seg:[animation:text-shimmer_1.2s_linear_1_forwards]"),
|
|
433
423
|
children: [e.label, e.badge !== void 0 && /* @__PURE__ */ c("span", {
|
|
434
424
|
className: "ml-1.5 opacity-70",
|
|
435
425
|
children: e.badge
|
|
@@ -438,15 +428,15 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
438
428
|
}, e.id);
|
|
439
429
|
})]
|
|
440
430
|
}) : /* @__PURE__ */ l("div", {
|
|
441
|
-
className:
|
|
431
|
+
className: u("relative flex gap-1 border-b border-border", f),
|
|
442
432
|
children: [e.map((e) => {
|
|
443
433
|
let t = e.id === n;
|
|
444
434
|
return /* @__PURE__ */ l("button", {
|
|
445
435
|
ref: (t) => {
|
|
446
|
-
|
|
436
|
+
p.current[e.id] = t;
|
|
447
437
|
},
|
|
448
438
|
onClick: () => i(e.id),
|
|
449
|
-
className:
|
|
439
|
+
className: u("inline-flex cursor-pointer items-center gap-1.5 font-heading transition-colors duration-150", d === "sm" ? "px-2 py-2 text-[12px]" : "px-3 py-2.5 text-[14px]", t ? "text-content" : "text-muted hover:text-content"),
|
|
450
440
|
children: [e.label, e.badge !== void 0 && /* @__PURE__ */ c("span", {
|
|
451
441
|
className: "text-xs text-muted",
|
|
452
442
|
children: e.badge
|
|
@@ -455,104 +445,104 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
455
445
|
}), /* @__PURE__ */ c("span", {
|
|
456
446
|
className: "pointer-events-none absolute -bottom-px h-0.5 rounded-full bg-primary transition-all duration-300 ease-out",
|
|
457
447
|
style: {
|
|
458
|
-
left:
|
|
459
|
-
width:
|
|
448
|
+
left: m.left,
|
|
449
|
+
width: m.width
|
|
460
450
|
}
|
|
461
451
|
})]
|
|
462
452
|
});
|
|
463
|
-
},
|
|
453
|
+
}, j = {
|
|
464
454
|
sm: "gap-1.5 rounded-md px-2.5",
|
|
465
455
|
md: "gap-2 rounded-lg px-3",
|
|
466
456
|
lg: "gap-2.5 rounded-lg px-4"
|
|
467
|
-
},
|
|
457
|
+
}, M = {
|
|
468
458
|
sm: "py-1.5 text-[12px]",
|
|
469
459
|
md: "py-2 text-sm",
|
|
470
460
|
lg: "py-2.5 text-base"
|
|
471
|
-
},
|
|
461
|
+
}, N = {
|
|
472
462
|
sm: "mb-1 text-xs",
|
|
473
463
|
md: "mb-1.5 text-sm",
|
|
474
464
|
lg: "mb-2 text-sm"
|
|
475
|
-
},
|
|
465
|
+
}, P = {
|
|
476
466
|
sm: "mt-1 text-[11px]",
|
|
477
467
|
md: "mt-1 text-xs",
|
|
478
468
|
lg: "mt-1.5 text-xs"
|
|
479
|
-
},
|
|
480
|
-
let
|
|
469
|
+
}, F = ({ label: e, error: t, hint: r, size: i = "md", leftSlot: a, rightSlot: o, className: s, containerClassName: d, id: f, ...p }) => {
|
|
470
|
+
let m = n(), h = f ?? m;
|
|
481
471
|
return /* @__PURE__ */ l("div", {
|
|
482
|
-
className:
|
|
472
|
+
className: u("w-full", d),
|
|
483
473
|
children: [
|
|
484
474
|
e && /* @__PURE__ */ c("label", {
|
|
485
|
-
htmlFor:
|
|
486
|
-
className:
|
|
475
|
+
htmlFor: h,
|
|
476
|
+
className: u("block font-medium text-muted", N[i]),
|
|
487
477
|
children: e
|
|
488
478
|
}),
|
|
489
479
|
/* @__PURE__ */ l("div", {
|
|
490
|
-
className:
|
|
480
|
+
className: u("flex items-center border bg-surface-2", "focus-within:border-primary/70 focus-within:ring-2 focus-within:ring-primary/15", j[i], t ? "border-red-500" : "border-border"),
|
|
491
481
|
children: [
|
|
492
482
|
a,
|
|
493
483
|
/* @__PURE__ */ c("input", {
|
|
494
|
-
id:
|
|
495
|
-
className:
|
|
496
|
-
...
|
|
484
|
+
id: h,
|
|
485
|
+
className: u("w-full bg-transparent text-content placeholder:text-muted", "focus:outline-none disabled:cursor-not-allowed disabled:opacity-60", M[i], s),
|
|
486
|
+
...p
|
|
497
487
|
}),
|
|
498
488
|
o
|
|
499
489
|
]
|
|
500
490
|
}),
|
|
501
491
|
t ? /* @__PURE__ */ c("p", {
|
|
502
|
-
className:
|
|
492
|
+
className: u("text-red-500", P[i]),
|
|
503
493
|
children: t
|
|
504
494
|
}) : r ? /* @__PURE__ */ c("p", {
|
|
505
|
-
className:
|
|
495
|
+
className: u("text-muted", P[i]),
|
|
506
496
|
children: r
|
|
507
497
|
}) : null
|
|
508
498
|
]
|
|
509
499
|
});
|
|
510
|
-
},
|
|
500
|
+
}, re = {
|
|
511
501
|
sm: "gap-1.5 px-2.5 py-1.5 text-[12px]",
|
|
512
502
|
md: "gap-1 px-2 py-1.5 text-[14px]"
|
|
513
|
-
},
|
|
503
|
+
}, I = {
|
|
514
504
|
sm: "px-2.5 py-1.5 text-[12px]",
|
|
515
505
|
md: "px-3 py-1.5 text-[14px]"
|
|
516
506
|
};
|
|
517
|
-
function
|
|
518
|
-
let [
|
|
507
|
+
function ie({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minWidthClassName: d = "min-w-[7rem]", className: p }) {
|
|
508
|
+
let [m, h] = o(!1), [g, _] = o(!1), v = a(null), y = e.find((e) => e.id === n) ?? e[0];
|
|
519
509
|
t(() => {
|
|
520
|
-
if (
|
|
521
|
-
|
|
510
|
+
if (m) {
|
|
511
|
+
_(!0);
|
|
522
512
|
return;
|
|
523
513
|
}
|
|
524
|
-
let e = window.setTimeout(() =>
|
|
514
|
+
let e = window.setTimeout(() => _(!1), 200);
|
|
525
515
|
return () => window.clearTimeout(e);
|
|
526
|
-
}, [
|
|
527
|
-
if (!
|
|
516
|
+
}, [m]), t(() => {
|
|
517
|
+
if (!m) return;
|
|
528
518
|
let e = (e) => {
|
|
529
|
-
|
|
519
|
+
v.current && !v.current.contains(e.target) && h(!1);
|
|
530
520
|
}, t = (e) => {
|
|
531
|
-
e.key === "Escape" &&
|
|
521
|
+
e.key === "Escape" && h(!1);
|
|
532
522
|
};
|
|
533
523
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
534
524
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
535
525
|
};
|
|
536
|
-
}, [
|
|
537
|
-
let
|
|
538
|
-
s || (r(e),
|
|
526
|
+
}, [m]);
|
|
527
|
+
let b = (e) => {
|
|
528
|
+
s || (r(e), h(!1));
|
|
539
529
|
};
|
|
540
530
|
return /* @__PURE__ */ l("div", {
|
|
541
|
-
ref:
|
|
542
|
-
className:
|
|
531
|
+
ref: v,
|
|
532
|
+
className: u("relative inline-flex", p),
|
|
543
533
|
children: [/* @__PURE__ */ l("button", {
|
|
544
534
|
type: "button",
|
|
545
535
|
"aria-haspopup": "listbox",
|
|
546
|
-
"aria-expanded":
|
|
536
|
+
"aria-expanded": m,
|
|
547
537
|
disabled: s,
|
|
548
|
-
onClick: () =>
|
|
549
|
-
className:
|
|
550
|
-
children: [
|
|
538
|
+
onClick: () => h((e) => !e),
|
|
539
|
+
className: u("inline-flex cursor-pointer items-center rounded-md font-heading transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:cursor-not-allowed disabled:opacity-60", re[i], y?.className ?? "text-content hover:bg-surface-2"),
|
|
540
|
+
children: [y?.label, /* @__PURE__ */ c(f, {
|
|
551
541
|
name: "chevron-down",
|
|
552
|
-
className:
|
|
542
|
+
className: u("h-4 w-4 text-muted transition-transform duration-200", m && "rotate-180")
|
|
553
543
|
})]
|
|
554
|
-
}),
|
|
555
|
-
className:
|
|
544
|
+
}), g && /* @__PURE__ */ c("div", {
|
|
545
|
+
className: u("absolute left-0 top-full z-20 mt-1 grid overflow-hidden rounded-lg border border-border bg-surface shadow-lg [grid-template-rows:1fr]", d, m ? "motion-safe:animate-[dropdown-expand_0.2s_ease-out]" : "motion-safe:animate-[dropdown-expand_0.18s_ease-in_reverse_forwards]"),
|
|
556
546
|
children: /* @__PURE__ */ c("ul", {
|
|
557
547
|
role: "listbox",
|
|
558
548
|
className: "min-h-0 overflow-hidden p-1",
|
|
@@ -563,9 +553,9 @@ function ce({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minW
|
|
|
563
553
|
"aria-selected": t,
|
|
564
554
|
children: /* @__PURE__ */ l("button", {
|
|
565
555
|
type: "button",
|
|
566
|
-
onClick: () =>
|
|
567
|
-
className:
|
|
568
|
-
children: [e.label, t && /* @__PURE__ */ c(
|
|
556
|
+
onClick: () => b(e.id),
|
|
557
|
+
className: u("flex w-full cursor-pointer items-center justify-between rounded-md font-heading transition-colors duration-150 hover:bg-surface-2", I[i], e.className ?? "text-muted hover:text-content", t && "bg-surface-2"),
|
|
558
|
+
children: [e.label, t && /* @__PURE__ */ c(f, {
|
|
569
559
|
name: "check",
|
|
570
560
|
className: "h-4 w-4"
|
|
571
561
|
})]
|
|
@@ -578,976 +568,233 @@ function ce({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minW
|
|
|
578
568
|
}
|
|
579
569
|
//#endregion
|
|
580
570
|
//#region src/components/ui/MethodSelect.tsx
|
|
581
|
-
var
|
|
571
|
+
var ae = [
|
|
582
572
|
"GET",
|
|
583
573
|
"POST",
|
|
584
574
|
"PUT",
|
|
585
575
|
"PATCH",
|
|
586
576
|
"DELETE"
|
|
587
|
-
],
|
|
577
|
+
], oe = {
|
|
588
578
|
GET: "text-[#52b788]",
|
|
589
579
|
POST: "text-sky-400",
|
|
590
580
|
PUT: "text-amber-400",
|
|
591
581
|
PATCH: "text-primary",
|
|
592
582
|
DELETE: "text-red-400"
|
|
593
|
-
},
|
|
583
|
+
}, se = (e) => e.map((e) => ({
|
|
594
584
|
id: e,
|
|
595
585
|
label: e,
|
|
596
|
-
className: `${
|
|
597
|
-
})),
|
|
586
|
+
className: `${oe[e]} font-semibold`
|
|
587
|
+
})), ce = ({ value: e, onChange: t, methods: n = ae, disabled: r, className: i }) => /* @__PURE__ */ c(ie, {
|
|
598
588
|
value: e,
|
|
599
589
|
onChange: t,
|
|
600
|
-
items:
|
|
590
|
+
items: se(n),
|
|
601
591
|
disabled: r,
|
|
602
592
|
minWidthClassName: "min-w-[7rem]",
|
|
603
593
|
className: i
|
|
604
|
-
}),
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
util: {
|
|
610
|
-
encode: function e(t) {
|
|
611
|
-
return t instanceof a ? new a(t.type, e(t.content), t.alias) : Array.isArray(t) ? t.map(e) : t.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
612
|
-
},
|
|
613
|
-
type: function(e) {
|
|
614
|
-
return Object.prototype.toString.call(e).slice(8, -1);
|
|
615
|
-
},
|
|
616
|
-
objId: function(e) {
|
|
617
|
-
return e.__id || Object.defineProperty(e, "__id", { value: ++n }), e.__id;
|
|
618
|
-
},
|
|
619
|
-
clone: function e(t, n) {
|
|
620
|
-
n ||= {};
|
|
621
|
-
var r, a;
|
|
622
|
-
switch (i.util.type(t)) {
|
|
623
|
-
case "Object":
|
|
624
|
-
if (a = i.util.objId(t), n[a]) return n[a];
|
|
625
|
-
for (var o in r = {}, n[a] = r, t) t.hasOwnProperty(o) && (r[o] = e(t[o], n));
|
|
626
|
-
return r;
|
|
627
|
-
case "Array": return a = i.util.objId(t), n[a] ? n[a] : (r = [], n[a] = r, t.forEach(function(t, i) {
|
|
628
|
-
r[i] = e(t, n);
|
|
629
|
-
}), r);
|
|
630
|
-
default: return t;
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
getLanguage: function(e) {
|
|
634
|
-
for (; e;) {
|
|
635
|
-
var n = t.exec(e.className);
|
|
636
|
-
if (n) return n[1].toLowerCase();
|
|
637
|
-
e = e.parentElement;
|
|
638
|
-
}
|
|
639
|
-
return "none";
|
|
640
|
-
},
|
|
641
|
-
setLanguage: function(e, n) {
|
|
642
|
-
e.className = e.className.replace(RegExp(t, "gi"), ""), e.classList.add("language-" + n);
|
|
643
|
-
},
|
|
644
|
-
currentScript: function() {
|
|
645
|
-
if (typeof document > "u") return null;
|
|
646
|
-
if (document.currentScript && document.currentScript.tagName === "SCRIPT") return document.currentScript;
|
|
647
|
-
try {
|
|
648
|
-
throw Error();
|
|
649
|
-
} catch (r) {
|
|
650
|
-
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1];
|
|
651
|
-
if (e) {
|
|
652
|
-
var t = document.getElementsByTagName("script");
|
|
653
|
-
for (var n in t) if (t[n].src == e) return t[n];
|
|
654
|
-
}
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
},
|
|
658
|
-
isActive: function(e, t, n) {
|
|
659
|
-
for (var r = "no-" + t; e;) {
|
|
660
|
-
var i = e.classList;
|
|
661
|
-
if (i.contains(t)) return !0;
|
|
662
|
-
if (i.contains(r)) return !1;
|
|
663
|
-
e = e.parentElement;
|
|
664
|
-
}
|
|
665
|
-
return !!n;
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
languages: {
|
|
669
|
-
plain: r,
|
|
670
|
-
plaintext: r,
|
|
671
|
-
text: r,
|
|
672
|
-
txt: r,
|
|
673
|
-
extend: function(e, t) {
|
|
674
|
-
var n = i.util.clone(i.languages[e]);
|
|
675
|
-
for (var r in t) n[r] = t[r];
|
|
676
|
-
return n;
|
|
677
|
-
},
|
|
678
|
-
insertBefore: function(e, t, n, r) {
|
|
679
|
-
r ||= i.languages;
|
|
680
|
-
var a = r[e], o = {};
|
|
681
|
-
for (var s in a) if (a.hasOwnProperty(s)) {
|
|
682
|
-
if (s == t) for (var c in n) n.hasOwnProperty(c) && (o[c] = n[c]);
|
|
683
|
-
n.hasOwnProperty(s) || (o[s] = a[s]);
|
|
684
|
-
}
|
|
685
|
-
var l = r[e];
|
|
686
|
-
return r[e] = o, i.languages.DFS(i.languages, function(t, n) {
|
|
687
|
-
n === l && t != e && (this[t] = o);
|
|
688
|
-
}), o;
|
|
689
|
-
},
|
|
690
|
-
DFS: function e(t, n, r, a) {
|
|
691
|
-
a ||= {};
|
|
692
|
-
var o = i.util.objId;
|
|
693
|
-
for (var s in t) if (t.hasOwnProperty(s)) {
|
|
694
|
-
n.call(t, s, t[s], r || s);
|
|
695
|
-
var c = t[s], l = i.util.type(c);
|
|
696
|
-
l === "Object" && !a[o(c)] ? (a[o(c)] = !0, e(c, n, null, a)) : l === "Array" && !a[o(c)] && (a[o(c)] = !0, e(c, n, s, a));
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
plugins: {},
|
|
701
|
-
highlightAll: function(e, t) {
|
|
702
|
-
i.highlightAllUnder(document, e, t);
|
|
703
|
-
},
|
|
704
|
-
highlightAllUnder: function(e, t, n) {
|
|
705
|
-
var r = {
|
|
706
|
-
callback: n,
|
|
707
|
-
container: e,
|
|
708
|
-
selector: "code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code"
|
|
709
|
-
};
|
|
710
|
-
i.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), i.hooks.run("before-all-elements-highlight", r);
|
|
711
|
-
for (var a = 0, o; o = r.elements[a++];) i.highlightElement(o, t === !0, r.callback);
|
|
712
|
-
},
|
|
713
|
-
highlightElement: function(t, n, r) {
|
|
714
|
-
var a = i.util.getLanguage(t), o = i.languages[a];
|
|
715
|
-
i.util.setLanguage(t, a);
|
|
716
|
-
var s = t.parentElement;
|
|
717
|
-
s && s.nodeName.toLowerCase() === "pre" && i.util.setLanguage(s, a);
|
|
718
|
-
var c = {
|
|
719
|
-
element: t,
|
|
720
|
-
language: a,
|
|
721
|
-
grammar: o,
|
|
722
|
-
code: t.textContent
|
|
723
|
-
};
|
|
724
|
-
function l(e) {
|
|
725
|
-
c.highlightedCode = e, i.hooks.run("before-insert", c), c.element.innerHTML = c.highlightedCode, i.hooks.run("after-highlight", c), i.hooks.run("complete", c), r && r.call(c.element);
|
|
726
|
-
}
|
|
727
|
-
if (i.hooks.run("before-sanity-check", c), s = c.element.parentElement, s && s.nodeName.toLowerCase() === "pre" && !s.hasAttribute("tabindex") && s.setAttribute("tabindex", "0"), !c.code) {
|
|
728
|
-
i.hooks.run("complete", c), r && r.call(c.element);
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
if (i.hooks.run("before-highlight", c), !c.grammar) {
|
|
732
|
-
l(i.util.encode(c.code));
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
if (n && e.Worker) {
|
|
736
|
-
var u = new Worker(i.filename);
|
|
737
|
-
u.onmessage = function(e) {
|
|
738
|
-
l(e.data);
|
|
739
|
-
}, u.postMessage(JSON.stringify({
|
|
740
|
-
language: c.language,
|
|
741
|
-
code: c.code,
|
|
742
|
-
immediateClose: !0
|
|
743
|
-
}));
|
|
744
|
-
} else l(i.highlight(c.code, c.grammar, c.language));
|
|
745
|
-
},
|
|
746
|
-
highlight: function(e, t, n) {
|
|
747
|
-
var r = {
|
|
748
|
-
code: e,
|
|
749
|
-
grammar: t,
|
|
750
|
-
language: n
|
|
751
|
-
};
|
|
752
|
-
if (i.hooks.run("before-tokenize", r), !r.grammar) throw Error("The language \"" + r.language + "\" has no grammar.");
|
|
753
|
-
return r.tokens = i.tokenize(r.code, r.grammar), i.hooks.run("after-tokenize", r), a.stringify(i.util.encode(r.tokens), r.language);
|
|
754
|
-
},
|
|
755
|
-
tokenize: function(e, t) {
|
|
756
|
-
var n = t.rest;
|
|
757
|
-
if (n) {
|
|
758
|
-
for (var r in n) t[r] = n[r];
|
|
759
|
-
delete t.rest;
|
|
760
|
-
}
|
|
761
|
-
var i = new c();
|
|
762
|
-
return l(i, i.head, e), s(e, i, t, i.head, 0), d(i);
|
|
763
|
-
},
|
|
764
|
-
hooks: {
|
|
765
|
-
all: {},
|
|
766
|
-
add: function(e, t) {
|
|
767
|
-
var n = i.hooks.all;
|
|
768
|
-
n[e] = n[e] || [], n[e].push(t);
|
|
769
|
-
},
|
|
770
|
-
run: function(e, t) {
|
|
771
|
-
var n = i.hooks.all[e];
|
|
772
|
-
if (!(!n || !n.length)) for (var r = 0, a; a = n[r++];) a(t);
|
|
773
|
-
}
|
|
774
|
-
},
|
|
775
|
-
Token: a
|
|
776
|
-
};
|
|
777
|
-
e.Prism = i;
|
|
778
|
-
function a(e, t, n, r) {
|
|
779
|
-
this.type = e, this.content = t, this.alias = n, this.length = (r || "").length | 0;
|
|
780
|
-
}
|
|
781
|
-
a.stringify = function e(t, n) {
|
|
782
|
-
if (typeof t == "string") return t;
|
|
783
|
-
if (Array.isArray(t)) {
|
|
784
|
-
var r = "";
|
|
785
|
-
return t.forEach(function(t) {
|
|
786
|
-
r += e(t, n);
|
|
787
|
-
}), r;
|
|
788
|
-
}
|
|
789
|
-
var a = {
|
|
790
|
-
type: t.type,
|
|
791
|
-
content: e(t.content, n),
|
|
792
|
-
tag: "span",
|
|
793
|
-
classes: ["token", t.type],
|
|
794
|
-
attributes: {},
|
|
795
|
-
language: n
|
|
796
|
-
}, o = t.alias;
|
|
797
|
-
o && (Array.isArray(o) ? Array.prototype.push.apply(a.classes, o) : a.classes.push(o)), i.hooks.run("wrap", a);
|
|
798
|
-
var s = "";
|
|
799
|
-
for (var c in a.attributes) s += " " + c + "=\"" + (a.attributes[c] || "").replace(/"/g, """) + "\"";
|
|
800
|
-
return "<" + a.tag + " class=\"" + a.classes.join(" ") + "\"" + s + ">" + a.content + "</" + a.tag + ">";
|
|
801
|
-
};
|
|
802
|
-
function o(e, t, n, r) {
|
|
803
|
-
e.lastIndex = t;
|
|
804
|
-
var i = e.exec(n);
|
|
805
|
-
if (i && r && i[1]) {
|
|
806
|
-
var a = i[1].length;
|
|
807
|
-
i.index += a, i[0] = i[0].slice(a);
|
|
808
|
-
}
|
|
809
|
-
return i;
|
|
810
|
-
}
|
|
811
|
-
function s(e, t, n, r, c, d) {
|
|
812
|
-
for (var f in n) if (!(!n.hasOwnProperty(f) || !n[f])) {
|
|
813
|
-
var p = n[f];
|
|
814
|
-
p = Array.isArray(p) ? p : [p];
|
|
815
|
-
for (var m = 0; m < p.length; ++m) {
|
|
816
|
-
if (d && d.cause == f + "," + m) return;
|
|
817
|
-
var h = p[m], g = h.inside, _ = !!h.lookbehind, v = !!h.greedy, y = h.alias;
|
|
818
|
-
if (v && !h.pattern.global) {
|
|
819
|
-
var b = h.pattern.toString().match(/[imsuy]*$/)[0];
|
|
820
|
-
h.pattern = RegExp(h.pattern.source, b + "g");
|
|
821
|
-
}
|
|
822
|
-
for (var x = h.pattern || h, S = r.next, C = c; S !== t.tail && !(d && C >= d.reach); C += S.value.length, S = S.next) {
|
|
823
|
-
var w = S.value;
|
|
824
|
-
if (t.length > e.length) return;
|
|
825
|
-
if (!(w instanceof a)) {
|
|
826
|
-
var T = 1, E;
|
|
827
|
-
if (v) {
|
|
828
|
-
if (E = o(x, C, e, _), !E || E.index >= e.length) break;
|
|
829
|
-
var D = E.index, O = E.index + E[0].length, k = C;
|
|
830
|
-
for (k += S.value.length; D >= k;) S = S.next, k += S.value.length;
|
|
831
|
-
if (k -= S.value.length, C = k, S.value instanceof a) continue;
|
|
832
|
-
for (var A = S; A !== t.tail && (k < O || typeof A.value == "string"); A = A.next) T++, k += A.value.length;
|
|
833
|
-
T--, w = e.slice(C, k), E.index -= C;
|
|
834
|
-
} else if (E = o(x, 0, w, _), !E) continue;
|
|
835
|
-
var D = E.index, j = E[0], M = w.slice(0, D), N = w.slice(D + j.length), P = C + w.length;
|
|
836
|
-
d && P > d.reach && (d.reach = P);
|
|
837
|
-
var F = S.prev;
|
|
838
|
-
M && (F = l(t, F, M), C += M.length), u(t, F, T);
|
|
839
|
-
var I = new a(f, g ? i.tokenize(j, g) : j, y, j);
|
|
840
|
-
if (S = l(t, F, I), N && l(t, S, N), T > 1) {
|
|
841
|
-
var L = {
|
|
842
|
-
cause: f + "," + m,
|
|
843
|
-
reach: P
|
|
844
|
-
};
|
|
845
|
-
s(e, t, n, S.prev, C, L), d && L.reach > d.reach && (d.reach = L.reach);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
function c() {
|
|
853
|
-
var e = {
|
|
854
|
-
value: null,
|
|
855
|
-
prev: null,
|
|
856
|
-
next: null
|
|
857
|
-
}, t = {
|
|
858
|
-
value: null,
|
|
859
|
-
prev: e,
|
|
860
|
-
next: null
|
|
861
|
-
};
|
|
862
|
-
e.next = t, this.head = e, this.tail = t, this.length = 0;
|
|
863
|
-
}
|
|
864
|
-
function l(e, t, n) {
|
|
865
|
-
var r = t.next, i = {
|
|
866
|
-
value: n,
|
|
867
|
-
prev: t,
|
|
868
|
-
next: r
|
|
869
|
-
};
|
|
870
|
-
return t.next = i, r.prev = i, e.length++, i;
|
|
871
|
-
}
|
|
872
|
-
function u(e, t, n) {
|
|
873
|
-
for (var r = t.next, i = 0; i < n && r !== e.tail; i++) r = r.next;
|
|
874
|
-
t.next = r, r.prev = t, e.length -= i;
|
|
875
|
-
}
|
|
876
|
-
function d(e) {
|
|
877
|
-
for (var t = [], n = e.head.next; n !== e.tail;) t.push(n.value), n = n.next;
|
|
878
|
-
return t;
|
|
879
|
-
}
|
|
880
|
-
if (!e.document) return e.addEventListener && (i.disableWorkerMessageHandler || e.addEventListener("message", function(t) {
|
|
881
|
-
var n = JSON.parse(t.data), r = n.language, a = n.code, o = n.immediateClose;
|
|
882
|
-
e.postMessage(i.highlight(a, i.languages[r], r)), o && e.close();
|
|
883
|
-
}, !1)), i;
|
|
884
|
-
var f = i.util.currentScript();
|
|
885
|
-
f && (i.filename = f.src, f.hasAttribute("data-manual") && (i.manual = !0));
|
|
886
|
-
function p() {
|
|
887
|
-
i.manual || i.highlightAll();
|
|
888
|
-
}
|
|
889
|
-
if (!i.manual) {
|
|
890
|
-
var m = document.readyState;
|
|
891
|
-
m === "loading" || m === "interactive" && f && f.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
|
|
892
|
-
}
|
|
893
|
-
return i;
|
|
894
|
-
}(typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {});
|
|
895
|
-
t !== void 0 && t.exports && (t.exports = n), typeof global < "u" && (global.Prism = n), n.languages.markup = {
|
|
896
|
-
comment: {
|
|
897
|
-
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
898
|
-
greedy: !0
|
|
594
|
+
}), le = {
|
|
595
|
+
json: [
|
|
596
|
+
{
|
|
597
|
+
type: "property",
|
|
598
|
+
pattern: /"(?:\\.|[^"\\])*"(?=\s*:)/y
|
|
899
599
|
},
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
600
|
+
{
|
|
601
|
+
type: "string",
|
|
602
|
+
pattern: /"(?:\\.|[^"\\])*"/y
|
|
903
603
|
},
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
inside: {
|
|
908
|
-
"internal-subset": {
|
|
909
|
-
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
910
|
-
lookbehind: !0,
|
|
911
|
-
greedy: !0,
|
|
912
|
-
inside: null
|
|
913
|
-
},
|
|
914
|
-
string: {
|
|
915
|
-
pattern: /"[^"]*"|'[^']*'/,
|
|
916
|
-
greedy: !0
|
|
917
|
-
},
|
|
918
|
-
punctuation: /^<!|>$|[[\]]/,
|
|
919
|
-
"doctype-tag": /^DOCTYPE/i,
|
|
920
|
-
name: /[^\s<>'"]+/
|
|
921
|
-
}
|
|
604
|
+
{
|
|
605
|
+
type: "number",
|
|
606
|
+
pattern: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/iy
|
|
922
607
|
},
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
608
|
+
{
|
|
609
|
+
type: "boolean",
|
|
610
|
+
pattern: /\b(?:true|false)\b/y
|
|
926
611
|
},
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
inside: {
|
|
931
|
-
tag: {
|
|
932
|
-
pattern: /^<\/?[^\s>\/]+/,
|
|
933
|
-
inside: {
|
|
934
|
-
punctuation: /^<\/?/,
|
|
935
|
-
namespace: /^[^\s>\/:]+:/
|
|
936
|
-
}
|
|
937
|
-
},
|
|
938
|
-
"special-attr": [],
|
|
939
|
-
"attr-value": {
|
|
940
|
-
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
941
|
-
inside: { punctuation: [{
|
|
942
|
-
pattern: /^=/,
|
|
943
|
-
alias: "attr-equals"
|
|
944
|
-
}, {
|
|
945
|
-
pattern: /^(\s*)["']|["']$/,
|
|
946
|
-
lookbehind: !0
|
|
947
|
-
}] }
|
|
948
|
-
},
|
|
949
|
-
punctuation: /\/?>/,
|
|
950
|
-
"attr-name": {
|
|
951
|
-
pattern: /[^\s>\/]+/,
|
|
952
|
-
inside: { namespace: /^[^\s>\/:]+:/ }
|
|
953
|
-
}
|
|
954
|
-
}
|
|
612
|
+
{
|
|
613
|
+
type: "keyword",
|
|
614
|
+
pattern: /\bnull\b/y
|
|
955
615
|
},
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}, /&#x?[\da-f]{1,8};/i]
|
|
960
|
-
}, n.languages.markup.tag.inside["attr-value"].inside.entity = n.languages.markup.entity, n.languages.markup.doctype.inside["internal-subset"].inside = n.languages.markup, n.hooks.add("wrap", function(e) {
|
|
961
|
-
e.type === "entity" && (e.attributes.title = e.content.replace(/&/, "&"));
|
|
962
|
-
}), Object.defineProperty(n.languages.markup.tag, "addInlined", { value: function(e, t) {
|
|
963
|
-
var r = {};
|
|
964
|
-
r["language-" + t] = {
|
|
965
|
-
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
966
|
-
lookbehind: !0,
|
|
967
|
-
inside: n.languages[t]
|
|
968
|
-
}, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
969
|
-
var i = { "included-cdata": {
|
|
970
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
971
|
-
inside: r
|
|
972
|
-
} };
|
|
973
|
-
i["language-" + t] = {
|
|
974
|
-
pattern: /[\s\S]+/,
|
|
975
|
-
inside: n.languages[t]
|
|
976
|
-
};
|
|
977
|
-
var a = {};
|
|
978
|
-
a[e] = {
|
|
979
|
-
pattern: RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)".replace(/__/g, function() {
|
|
980
|
-
return e;
|
|
981
|
-
}), "i"),
|
|
982
|
-
lookbehind: !0,
|
|
983
|
-
greedy: !0,
|
|
984
|
-
inside: i
|
|
985
|
-
}, n.languages.insertBefore("markup", "cdata", a);
|
|
986
|
-
} }), Object.defineProperty(n.languages.markup.tag, "addAttribute", { value: function(e, t) {
|
|
987
|
-
n.languages.markup.tag.inside["special-attr"].push({
|
|
988
|
-
pattern: RegExp("(^|[\"'\\s])(?:" + e + ")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))", "i"),
|
|
989
|
-
lookbehind: !0,
|
|
990
|
-
inside: {
|
|
991
|
-
"attr-name": /^[^\s=]+/,
|
|
992
|
-
"attr-value": {
|
|
993
|
-
pattern: /=[\s\S]+/,
|
|
994
|
-
inside: {
|
|
995
|
-
value: {
|
|
996
|
-
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
997
|
-
lookbehind: !0,
|
|
998
|
-
alias: [t, "language-" + t],
|
|
999
|
-
inside: n.languages[t]
|
|
1000
|
-
},
|
|
1001
|
-
punctuation: [{
|
|
1002
|
-
pattern: /^=/,
|
|
1003
|
-
alias: "attr-equals"
|
|
1004
|
-
}, /"|'/]
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
});
|
|
1009
|
-
} }), n.languages.html = n.languages.markup, n.languages.mathml = n.languages.markup, n.languages.svg = n.languages.markup, n.languages.xml = n.languages.extend("markup", {}), n.languages.ssml = n.languages.xml, n.languages.atom = n.languages.xml, n.languages.rss = n.languages.xml, (function(e) {
|
|
1010
|
-
var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1011
|
-
e.languages.css = {
|
|
1012
|
-
comment: /\/\*[\s\S]*?\*\//,
|
|
1013
|
-
atrule: {
|
|
1014
|
-
pattern: RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|" + t.source + ")*?(?:;|(?=\\s*\\{))"),
|
|
1015
|
-
inside: {
|
|
1016
|
-
rule: /^@[\w-]+/,
|
|
1017
|
-
"selector-function-argument": {
|
|
1018
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
1019
|
-
lookbehind: !0,
|
|
1020
|
-
alias: "selector"
|
|
1021
|
-
},
|
|
1022
|
-
keyword: {
|
|
1023
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
1024
|
-
lookbehind: !0
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
},
|
|
1028
|
-
url: {
|
|
1029
|
-
pattern: RegExp("\\burl\\((?:" + t.source + "|(?:[^\\\\\\r\\n()\"']|\\\\[\\s\\S])*)\\)", "i"),
|
|
1030
|
-
greedy: !0,
|
|
1031
|
-
inside: {
|
|
1032
|
-
function: /^url/i,
|
|
1033
|
-
punctuation: /^\(|\)$/,
|
|
1034
|
-
string: {
|
|
1035
|
-
pattern: RegExp("^" + t.source + "$"),
|
|
1036
|
-
alias: "url"
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
},
|
|
1040
|
-
selector: {
|
|
1041
|
-
pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + t.source + ")*(?=\\s*\\{)"),
|
|
1042
|
-
lookbehind: !0
|
|
1043
|
-
},
|
|
1044
|
-
string: {
|
|
1045
|
-
pattern: t,
|
|
1046
|
-
greedy: !0
|
|
1047
|
-
},
|
|
1048
|
-
property: {
|
|
1049
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
1050
|
-
lookbehind: !0
|
|
1051
|
-
},
|
|
1052
|
-
important: /!important\b/i,
|
|
1053
|
-
function: {
|
|
1054
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
1055
|
-
lookbehind: !0
|
|
1056
|
-
},
|
|
1057
|
-
punctuation: /[(){};:,]/
|
|
1058
|
-
}, e.languages.css.atrule.inside.rest = e.languages.css;
|
|
1059
|
-
var n = e.languages.markup;
|
|
1060
|
-
n && (n.tag.addInlined("style", "css"), n.tag.addAttribute("style", "css"));
|
|
1061
|
-
})(n), n.languages.clike = {
|
|
1062
|
-
comment: [{
|
|
1063
|
-
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1064
|
-
lookbehind: !0,
|
|
1065
|
-
greedy: !0
|
|
1066
|
-
}, {
|
|
1067
|
-
pattern: /(^|[^\\:])\/\/.*/,
|
|
1068
|
-
lookbehind: !0,
|
|
1069
|
-
greedy: !0
|
|
1070
|
-
}],
|
|
1071
|
-
string: {
|
|
1072
|
-
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
1073
|
-
greedy: !0
|
|
616
|
+
{
|
|
617
|
+
type: "operator",
|
|
618
|
+
pattern: /:/y
|
|
1074
619
|
},
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
620
|
+
{
|
|
621
|
+
type: "punctuation",
|
|
622
|
+
pattern: /[{}[\],]/y
|
|
623
|
+
}
|
|
624
|
+
],
|
|
625
|
+
bash: [
|
|
626
|
+
{
|
|
627
|
+
type: "comment",
|
|
628
|
+
pattern: /#.*/y
|
|
1079
629
|
},
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1084
|
-
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
1085
|
-
punctuation: /[{}[\];(),.:]/
|
|
1086
|
-
}, n.languages.javascript = n.languages.extend("clike", {
|
|
1087
|
-
"class-name": [n.languages.clike["class-name"], {
|
|
1088
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1089
|
-
lookbehind: !0
|
|
1090
|
-
}],
|
|
1091
|
-
keyword: [{
|
|
1092
|
-
pattern: /((?:^|\})\s*)catch\b/,
|
|
1093
|
-
lookbehind: !0
|
|
1094
|
-
}, {
|
|
1095
|
-
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
1096
|
-
lookbehind: !0
|
|
1097
|
-
}],
|
|
1098
|
-
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1099
|
-
number: {
|
|
1100
|
-
pattern: RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),
|
|
1101
|
-
lookbehind: !0
|
|
630
|
+
{
|
|
631
|
+
type: "string",
|
|
632
|
+
pattern: /'(?:[^']*)'|"(?:\\.|[^"\\])*"/y
|
|
1102
633
|
},
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))"),
|
|
1107
|
-
lookbehind: !0,
|
|
1108
|
-
greedy: !0,
|
|
1109
|
-
inside: {
|
|
1110
|
-
"regex-source": {
|
|
1111
|
-
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1112
|
-
lookbehind: !0,
|
|
1113
|
-
alias: "language-regex",
|
|
1114
|
-
inside: n.languages.regex
|
|
1115
|
-
},
|
|
1116
|
-
"regex-delimiter": /^\/|\/$/,
|
|
1117
|
-
"regex-flags": /^[a-z]+$/
|
|
1118
|
-
}
|
|
634
|
+
{
|
|
635
|
+
type: "function",
|
|
636
|
+
pattern: /\b(?:curl|wget|fetch|http|httpie)\b/y
|
|
1119
637
|
},
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
638
|
+
{
|
|
639
|
+
type: "variable",
|
|
640
|
+
pattern: /\$[A-Za-z_][\w]*|\$\{[^}]+\}/y
|
|
1123
641
|
},
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
lookbehind: !0,
|
|
1128
|
-
inside: n.languages.javascript
|
|
1129
|
-
},
|
|
1130
|
-
{
|
|
1131
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1132
|
-
lookbehind: !0,
|
|
1133
|
-
inside: n.languages.javascript
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1137
|
-
lookbehind: !0,
|
|
1138
|
-
inside: n.languages.javascript
|
|
1139
|
-
},
|
|
1140
|
-
{
|
|
1141
|
-
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
1142
|
-
lookbehind: !0,
|
|
1143
|
-
inside: n.languages.javascript
|
|
1144
|
-
}
|
|
1145
|
-
],
|
|
1146
|
-
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1147
|
-
}), n.languages.insertBefore("javascript", "string", {
|
|
1148
|
-
hashbang: {
|
|
1149
|
-
pattern: /^#!.*/,
|
|
1150
|
-
greedy: !0,
|
|
1151
|
-
alias: "comment"
|
|
642
|
+
{
|
|
643
|
+
type: "keyword",
|
|
644
|
+
pattern: /\b(?:if|then|else|fi|for|do|done|while|case|esac)\b/y
|
|
1152
645
|
},
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
inside: {
|
|
1157
|
-
"template-punctuation": {
|
|
1158
|
-
pattern: /^`|`$/,
|
|
1159
|
-
alias: "string"
|
|
1160
|
-
},
|
|
1161
|
-
interpolation: {
|
|
1162
|
-
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
1163
|
-
lookbehind: !0,
|
|
1164
|
-
inside: {
|
|
1165
|
-
"interpolation-punctuation": {
|
|
1166
|
-
pattern: /^\$\{|\}$/,
|
|
1167
|
-
alias: "punctuation"
|
|
1168
|
-
},
|
|
1169
|
-
rest: n.languages.javascript
|
|
1170
|
-
}
|
|
1171
|
-
},
|
|
1172
|
-
string: /[\s\S]+/
|
|
1173
|
-
}
|
|
646
|
+
{
|
|
647
|
+
type: "number",
|
|
648
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1174
649
|
},
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
if (n === void 0 || typeof document > "u") return;
|
|
1187
|
-
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1188
|
-
var e = "Loading…", t = function(e, t) {
|
|
1189
|
-
return "✖ Error " + e + " while fetching file: " + t;
|
|
1190
|
-
}, r = "✖ Error: File does not exist or is empty", i = {
|
|
1191
|
-
js: "javascript",
|
|
1192
|
-
py: "python",
|
|
1193
|
-
rb: "ruby",
|
|
1194
|
-
ps1: "powershell",
|
|
1195
|
-
psm1: "powershell",
|
|
1196
|
-
sh: "bash",
|
|
1197
|
-
bat: "batch",
|
|
1198
|
-
h: "c",
|
|
1199
|
-
tex: "latex"
|
|
1200
|
-
}, a = "data-src-status", o = "loading", s = "loaded", c = "failed", l = "pre[data-src]:not([" + a + "=\"" + s + "\"]):not([" + a + "=\"" + o + "\"])";
|
|
1201
|
-
function u(e, n, i) {
|
|
1202
|
-
var a = new XMLHttpRequest();
|
|
1203
|
-
a.open("GET", e, !0), a.onreadystatechange = function() {
|
|
1204
|
-
a.readyState == 4 && (a.status < 400 && a.responseText ? n(a.responseText) : a.status >= 400 ? i(t(a.status, a.statusText)) : i(r));
|
|
1205
|
-
}, a.send(null);
|
|
1206
|
-
}
|
|
1207
|
-
function d(e) {
|
|
1208
|
-
var t = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e || "");
|
|
1209
|
-
if (t) {
|
|
1210
|
-
var n = Number(t[1]), r = t[2], i = t[3];
|
|
1211
|
-
return r ? i ? [n, Number(i)] : [n, void 0] : [n, n];
|
|
1212
|
-
}
|
|
650
|
+
{
|
|
651
|
+
type: "operator",
|
|
652
|
+
pattern: /&&|\|\||[|&;=<>]/y
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
type: "punctuation",
|
|
656
|
+
pattern: /\\|[()[\]{}]/y
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
type: "builtin",
|
|
660
|
+
pattern: /-{1,2}[A-Za-z][\w-]*/y
|
|
1213
661
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
t.code = "", r.setAttribute(a, o);
|
|
1220
|
-
var f = r.appendChild(document.createElement("CODE"));
|
|
1221
|
-
f.textContent = e;
|
|
1222
|
-
var p = r.getAttribute("data-src"), m = t.language;
|
|
1223
|
-
if (m === "none") {
|
|
1224
|
-
var h = (/\.(\w+)$/.exec(p) || [, "none"])[1];
|
|
1225
|
-
m = i[h] || h;
|
|
1226
|
-
}
|
|
1227
|
-
n.util.setLanguage(f, m), n.util.setLanguage(r, m);
|
|
1228
|
-
var g = n.plugins.autoloader;
|
|
1229
|
-
g && g.loadLanguages(m), u(p, function(e) {
|
|
1230
|
-
r.setAttribute(a, s);
|
|
1231
|
-
var t = d(r.getAttribute("data-range"));
|
|
1232
|
-
if (t) {
|
|
1233
|
-
var i = e.split(/\r\n?|\n/g), o = t[0], c = t[1] == null ? i.length : t[1];
|
|
1234
|
-
o < 0 && (o += i.length), o = Math.max(0, Math.min(o - 1, i.length)), c < 0 && (c += i.length), c = Math.max(0, Math.min(c, i.length)), e = i.slice(o, c).join("\n"), r.hasAttribute("data-start") || r.setAttribute("data-start", String(o + 1));
|
|
1235
|
-
}
|
|
1236
|
-
f.textContent = e, n.highlightElement(f);
|
|
1237
|
-
}, function(e) {
|
|
1238
|
-
r.setAttribute(a, c), f.textContent = e;
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
}), n.plugins.fileHighlight = { highlight: function(e) {
|
|
1242
|
-
for (var t = (e || document).querySelectorAll(l), r = 0, i; i = t[r++];) n.highlightElement(i);
|
|
1243
|
-
} };
|
|
1244
|
-
var f = !1;
|
|
1245
|
-
n.fileHighlight = function() {
|
|
1246
|
-
f ||= (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1247
|
-
};
|
|
1248
|
-
})();
|
|
1249
|
-
}));
|
|
1250
|
-
(function(e) {
|
|
1251
|
-
var t = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", n = {
|
|
1252
|
-
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
1253
|
-
lookbehind: !0,
|
|
1254
|
-
alias: "punctuation",
|
|
1255
|
-
inside: null
|
|
1256
|
-
}, r = {
|
|
1257
|
-
bash: n,
|
|
1258
|
-
environment: {
|
|
1259
|
-
pattern: RegExp("\\$" + t),
|
|
1260
|
-
alias: "constant"
|
|
662
|
+
],
|
|
663
|
+
javascript: [
|
|
664
|
+
{
|
|
665
|
+
type: "comment",
|
|
666
|
+
pattern: /\/\/.*|\/\*.*?\*\//y
|
|
1261
667
|
},
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
greedy: !0,
|
|
1266
|
-
inside: {
|
|
1267
|
-
variable: [{
|
|
1268
|
-
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
1269
|
-
lookbehind: !0
|
|
1270
|
-
}, /^\$\(\(/],
|
|
1271
|
-
number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
1272
|
-
operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
1273
|
-
punctuation: /\(\(?|\)\)?|,|;/
|
|
1274
|
-
}
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
1278
|
-
greedy: !0,
|
|
1279
|
-
inside: { variable: /^\$\(|^`|\)$|`$/ }
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
pattern: /\$\{[^}]+\}/,
|
|
1283
|
-
greedy: !0,
|
|
1284
|
-
inside: {
|
|
1285
|
-
operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
1286
|
-
punctuation: /[\[\]]/,
|
|
1287
|
-
environment: {
|
|
1288
|
-
pattern: RegExp("(\\{)" + t),
|
|
1289
|
-
lookbehind: !0,
|
|
1290
|
-
alias: "constant"
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
},
|
|
1294
|
-
/\$(?:\w+|[#?*!@$])/
|
|
1295
|
-
],
|
|
1296
|
-
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
1297
|
-
};
|
|
1298
|
-
e.languages.bash = {
|
|
1299
|
-
shebang: {
|
|
1300
|
-
pattern: /^#!\s*\/.*/,
|
|
1301
|
-
alias: "important"
|
|
668
|
+
{
|
|
669
|
+
type: "string",
|
|
670
|
+
pattern: /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`/y
|
|
1302
671
|
},
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
672
|
+
{
|
|
673
|
+
type: "keyword",
|
|
674
|
+
pattern: /\b(?:await|async|const|let|var|return|if|else|for|while|try|catch|throw|new|import|export|from|function|class)\b/y
|
|
1306
675
|
},
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
alias: "function"
|
|
1311
|
-
}, {
|
|
1312
|
-
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
1313
|
-
alias: "function"
|
|
1314
|
-
}],
|
|
1315
|
-
"for-or-select": {
|
|
1316
|
-
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
1317
|
-
alias: "variable",
|
|
1318
|
-
lookbehind: !0
|
|
676
|
+
{
|
|
677
|
+
type: "boolean",
|
|
678
|
+
pattern: /\b(?:true|false|null|undefined)\b/y
|
|
1319
679
|
},
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t),
|
|
1324
|
-
lookbehind: !0,
|
|
1325
|
-
alias: "constant"
|
|
1326
|
-
} },
|
|
1327
|
-
alias: "variable",
|
|
1328
|
-
lookbehind: !0
|
|
680
|
+
{
|
|
681
|
+
type: "function",
|
|
682
|
+
pattern: /\b[A-Za-z_$][\w$]*(?=\s*\()/y
|
|
1329
683
|
},
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
lookbehind: !0
|
|
684
|
+
{
|
|
685
|
+
type: "number",
|
|
686
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1334
687
|
},
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
lookbehind: !0,
|
|
1339
|
-
greedy: !0,
|
|
1340
|
-
inside: r
|
|
1341
|
-
},
|
|
1342
|
-
{
|
|
1343
|
-
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
1344
|
-
lookbehind: !0,
|
|
1345
|
-
greedy: !0,
|
|
1346
|
-
inside: { bash: n }
|
|
1347
|
-
},
|
|
1348
|
-
{
|
|
1349
|
-
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
1350
|
-
lookbehind: !0,
|
|
1351
|
-
greedy: !0,
|
|
1352
|
-
inside: r
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
pattern: /(^|[^$\\])'[^']*'/,
|
|
1356
|
-
lookbehind: !0,
|
|
1357
|
-
greedy: !0
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
1361
|
-
greedy: !0,
|
|
1362
|
-
inside: { entity: r.entity }
|
|
1363
|
-
}
|
|
1364
|
-
],
|
|
1365
|
-
environment: {
|
|
1366
|
-
pattern: RegExp("\\$?" + t),
|
|
1367
|
-
alias: "constant"
|
|
688
|
+
{
|
|
689
|
+
type: "operator",
|
|
690
|
+
pattern: /=>|===|!==|==|!=|<=|>=|\+\+|--|&&|\|\||[+\-*/%=<>!?:]/y
|
|
1368
691
|
},
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
pattern: /
|
|
1372
|
-
|
|
692
|
+
{
|
|
693
|
+
type: "punctuation",
|
|
694
|
+
pattern: /[()[\]{}.,;]/y
|
|
695
|
+
}
|
|
696
|
+
],
|
|
697
|
+
python: [
|
|
698
|
+
{
|
|
699
|
+
type: "comment",
|
|
700
|
+
pattern: /#.*/y
|
|
1373
701
|
},
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
702
|
+
{
|
|
703
|
+
type: "string",
|
|
704
|
+
pattern: /'''[\s\S]*?'''|"""[\s\S]*?"""|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/y
|
|
1377
705
|
},
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
alias: "class-name"
|
|
706
|
+
{
|
|
707
|
+
type: "keyword",
|
|
708
|
+
pattern: /\b(?:import|from|as|def|class|return|if|elif|else|for|while|try|except|with|lambda|pass|None|True|False|and|or|not|in|is)\b/y
|
|
1382
709
|
},
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
710
|
+
{
|
|
711
|
+
type: "function",
|
|
712
|
+
pattern: /\b[A-Za-z_]\w*(?=\s*\()/y
|
|
1386
713
|
},
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
714
|
+
{
|
|
715
|
+
type: "number",
|
|
716
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1390
717
|
},
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
pattern: /^\d/,
|
|
1395
|
-
alias: "important"
|
|
1396
|
-
} }
|
|
718
|
+
{
|
|
719
|
+
type: "operator",
|
|
720
|
+
pattern: /==|!=|<=|>=|:=|[+\-*/%=<>]/y
|
|
1397
721
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
pattern: /(
|
|
1401
|
-
lookbehind: !0
|
|
1402
|
-
}
|
|
1403
|
-
}, n.inside = e.languages.bash;
|
|
1404
|
-
for (var i = [
|
|
1405
|
-
"comment",
|
|
1406
|
-
"function-name",
|
|
1407
|
-
"for-or-select",
|
|
1408
|
-
"assign-left",
|
|
1409
|
-
"parameter",
|
|
1410
|
-
"string",
|
|
1411
|
-
"environment",
|
|
1412
|
-
"function",
|
|
1413
|
-
"keyword",
|
|
1414
|
-
"builtin",
|
|
1415
|
-
"boolean",
|
|
1416
|
-
"file-descriptor",
|
|
1417
|
-
"operator",
|
|
1418
|
-
"punctuation",
|
|
1419
|
-
"number"
|
|
1420
|
-
], a = r.variable[1].inside, o = 0; o < i.length; o++) a[i[o]] = e.languages.bash[i[o]];
|
|
1421
|
-
e.languages.sh = e.languages.bash, e.languages.shell = e.languages.bash;
|
|
1422
|
-
})(Prism), Prism.languages.json = {
|
|
1423
|
-
property: {
|
|
1424
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
1425
|
-
lookbehind: !0,
|
|
1426
|
-
greedy: !0
|
|
1427
|
-
},
|
|
1428
|
-
string: {
|
|
1429
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
|
1430
|
-
lookbehind: !0,
|
|
1431
|
-
greedy: !0
|
|
1432
|
-
},
|
|
1433
|
-
comment: {
|
|
1434
|
-
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1435
|
-
greedy: !0
|
|
1436
|
-
},
|
|
1437
|
-
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
1438
|
-
punctuation: /[{}[\],]/,
|
|
1439
|
-
operator: /:/,
|
|
1440
|
-
boolean: /\b(?:false|true)\b/,
|
|
1441
|
-
null: {
|
|
1442
|
-
pattern: /\bnull\b/,
|
|
1443
|
-
alias: "keyword"
|
|
1444
|
-
}
|
|
1445
|
-
}, Prism.languages.webmanifest = Prism.languages.json, Prism.languages.python = {
|
|
1446
|
-
comment: {
|
|
1447
|
-
pattern: /(^|[^\\])#.*/,
|
|
1448
|
-
lookbehind: !0,
|
|
1449
|
-
greedy: !0
|
|
1450
|
-
},
|
|
1451
|
-
"string-interpolation": {
|
|
1452
|
-
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
1453
|
-
greedy: !0,
|
|
1454
|
-
inside: {
|
|
1455
|
-
interpolation: {
|
|
1456
|
-
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
1457
|
-
lookbehind: !0,
|
|
1458
|
-
inside: {
|
|
1459
|
-
"format-spec": {
|
|
1460
|
-
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
1461
|
-
lookbehind: !0
|
|
1462
|
-
},
|
|
1463
|
-
"conversion-option": {
|
|
1464
|
-
pattern: //,
|
|
1465
|
-
alias: "punctuation"
|
|
1466
|
-
},
|
|
1467
|
-
rest: null
|
|
1468
|
-
}
|
|
1469
|
-
},
|
|
1470
|
-
string: /[\s\S]+/
|
|
722
|
+
{
|
|
723
|
+
type: "punctuation",
|
|
724
|
+
pattern: /[()[\]{}.,:;]/y
|
|
1471
725
|
}
|
|
1472
|
-
},
|
|
1473
|
-
"triple-quoted-string": {
|
|
1474
|
-
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
1475
|
-
greedy: !0,
|
|
1476
|
-
alias: "string"
|
|
1477
|
-
},
|
|
1478
|
-
string: {
|
|
1479
|
-
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
1480
|
-
greedy: !0
|
|
1481
|
-
},
|
|
1482
|
-
function: {
|
|
1483
|
-
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
1484
|
-
lookbehind: !0
|
|
1485
|
-
},
|
|
1486
|
-
"class-name": {
|
|
1487
|
-
pattern: /(\bclass\s+)\w+/i,
|
|
1488
|
-
lookbehind: !0
|
|
1489
|
-
},
|
|
1490
|
-
decorator: {
|
|
1491
|
-
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
1492
|
-
lookbehind: !0,
|
|
1493
|
-
alias: ["annotation", "punctuation"],
|
|
1494
|
-
inside: { punctuation: /\./ }
|
|
1495
|
-
},
|
|
1496
|
-
keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
1497
|
-
builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
1498
|
-
boolean: /\b(?:False|None|True)\b/,
|
|
1499
|
-
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
1500
|
-
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
1501
|
-
punctuation: /[{}[\];(),.:]/
|
|
1502
|
-
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python, Prism.languages.go = Prism.languages.extend("clike", {
|
|
1503
|
-
string: {
|
|
1504
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
|
1505
|
-
lookbehind: !0,
|
|
1506
|
-
greedy: !0
|
|
1507
|
-
},
|
|
1508
|
-
keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
|
1509
|
-
boolean: /\b(?:_|false|iota|nil|true)\b/,
|
|
1510
|
-
number: [
|
|
1511
|
-
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
1512
|
-
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
1513
|
-
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
1514
726
|
],
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
727
|
+
go: [
|
|
728
|
+
{
|
|
729
|
+
type: "comment",
|
|
730
|
+
pattern: /\/\/.*|\/\*.*?\*\//y
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
type: "string",
|
|
734
|
+
pattern: /`[^`]*`|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/y
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
type: "keyword",
|
|
738
|
+
pattern: /\b(?:package|import|func|var|const|type|struct|interface|return|if|else|for|range|go|defer|select|case|switch|default|nil|true|false)\b/y
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
type: "builtin",
|
|
742
|
+
pattern: /\b(?:append|bool|byte|cap|close|complex64|complex128|copy|delete|error|float32|float64|int|int8|int16|int32|int64|len|make|new|panic|print|println|real|recover|rune|string|uint|uint8|uint16|uint32|uint64|uintptr)\b/y
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
type: "function",
|
|
746
|
+
pattern: /\b[A-Za-z_]\w*(?=\s*\()/y
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
type: "number",
|
|
750
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
type: "operator",
|
|
754
|
+
pattern: /:=|==|!=|<=|>=|\+\+|--|&&|\|\||[+\-*/%=<>!&|]/y
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
type: "punctuation",
|
|
758
|
+
pattern: /[()[\]{}.,;:]/y
|
|
759
|
+
}
|
|
760
|
+
]
|
|
1529
761
|
};
|
|
1530
|
-
function
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
762
|
+
function ue(e, t, n) {
|
|
763
|
+
for (let r of n) {
|
|
764
|
+
r.pattern.lastIndex = t;
|
|
765
|
+
let n = r.pattern.exec(e);
|
|
766
|
+
if (n?.index === t && n[0]) return {
|
|
767
|
+
type: r.type,
|
|
768
|
+
value: n[0]
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
return null;
|
|
1537
772
|
}
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
|
|
773
|
+
function de(e, t) {
|
|
774
|
+
if (t === "plain" || !e) return e;
|
|
775
|
+
let n = le[t], r = [], i = "", a = 0, o = 0;
|
|
776
|
+
for (; a < e.length;) {
|
|
777
|
+
let t = ue(e, a, n);
|
|
778
|
+
if (!t) {
|
|
779
|
+
i += e[a], a += 1;
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
i &&= (r.push(i), ""), r.push(/* @__PURE__ */ c("span", {
|
|
783
|
+
className: `token ${t.type}`,
|
|
784
|
+
children: t.value
|
|
785
|
+
}, o)), o += 1, a += t.value.length;
|
|
786
|
+
}
|
|
787
|
+
return i && r.push(i), r;
|
|
1541
788
|
}
|
|
1542
789
|
//#endregion
|
|
1543
790
|
//#region src/components/ui/CodeBlock.tsx
|
|
1544
|
-
var
|
|
1545
|
-
let
|
|
791
|
+
var L = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r = !0, maxHeight: a, reveal: o = !1, revealStagger: s = 70, className: d }) => {
|
|
792
|
+
let f = i(() => e.replace(/\n$/, "").split("\n"), [e]), p = String(f.length).length;
|
|
1546
793
|
return /* @__PURE__ */ l("div", {
|
|
1547
|
-
className:
|
|
794
|
+
className: u("group relative w-full overflow-hidden rounded-lg border border-border bg-surface-2", d),
|
|
1548
795
|
children: [r && /* @__PURE__ */ c("div", {
|
|
1549
796
|
className: "absolute right-2 top-2 z-10",
|
|
1550
|
-
children: /* @__PURE__ */ c(
|
|
797
|
+
children: /* @__PURE__ */ c(S, {
|
|
1551
798
|
value: e,
|
|
1552
799
|
size: "sm"
|
|
1553
800
|
})
|
|
@@ -1558,23 +805,23 @@ var W = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r
|
|
|
1558
805
|
className: "w-max min-w-full p-3 font-mono text-[14px] leading-relaxed text-content",
|
|
1559
806
|
children: /* @__PURE__ */ c("code", {
|
|
1560
807
|
className: "flex flex-col bg-transparent p-0 text-[14px] text-content",
|
|
1561
|
-
children:
|
|
1562
|
-
className:
|
|
808
|
+
children: f.map((e, r) => /* @__PURE__ */ l("span", {
|
|
809
|
+
className: u("flex", o && "motion-safe:animate-[fade-in_0.6s_ease-out_both]"),
|
|
1563
810
|
style: o ? { animationDelay: `${r * s}ms` } : void 0,
|
|
1564
811
|
children: [n && /* @__PURE__ */ c("span", {
|
|
1565
812
|
className: "mr-4 shrink-0 select-none text-right text-muted",
|
|
1566
|
-
style: { width: `${
|
|
813
|
+
style: { width: `${p}ch` },
|
|
1567
814
|
children: r + 1
|
|
1568
815
|
}), /* @__PURE__ */ c("span", {
|
|
1569
816
|
className: "whitespace-pre",
|
|
1570
|
-
children:
|
|
817
|
+
children: de(e, t) || " "
|
|
1571
818
|
})]
|
|
1572
819
|
}, r))
|
|
1573
820
|
})
|
|
1574
821
|
})
|
|
1575
822
|
})]
|
|
1576
823
|
});
|
|
1577
|
-
},
|
|
824
|
+
}, R = /* @__PURE__ */ new Set([
|
|
1578
825
|
"accept-charset",
|
|
1579
826
|
"accept-encoding",
|
|
1580
827
|
"access-control-request-headers",
|
|
@@ -1596,7 +843,7 @@ var W = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r
|
|
|
1596
843
|
"upgrade",
|
|
1597
844
|
"via"
|
|
1598
845
|
]);
|
|
1599
|
-
function
|
|
846
|
+
function fe(e) {
|
|
1600
847
|
return !e.auth || e.auth.type === "none" ? null : e.auth.type === "bearer" ? {
|
|
1601
848
|
key: "Authorization",
|
|
1602
849
|
value: `Bearer ${e.auth.token}`
|
|
@@ -1605,23 +852,23 @@ function _e(e) {
|
|
|
1605
852
|
value: e.auth.value
|
|
1606
853
|
};
|
|
1607
854
|
}
|
|
1608
|
-
function
|
|
855
|
+
function pe(e) {
|
|
1609
856
|
let t = new Headers();
|
|
1610
|
-
for (let n of e.headers ?? []) n.key.trim() && (
|
|
1611
|
-
let n =
|
|
1612
|
-
return n && !
|
|
857
|
+
for (let n of e.headers ?? []) n.key.trim() && (R.has(n.key.trim().toLowerCase()) || t.set(n.key, n.value));
|
|
858
|
+
let n = fe(e);
|
|
859
|
+
return n && !R.has(n.key.toLowerCase()) && t.set(n.key, n.value), t;
|
|
1613
860
|
}
|
|
1614
|
-
function
|
|
861
|
+
function me(e) {
|
|
1615
862
|
return [...e.entries()].map(([e, t]) => ({
|
|
1616
863
|
key: e,
|
|
1617
864
|
value: t
|
|
1618
865
|
}));
|
|
1619
866
|
}
|
|
1620
|
-
function
|
|
867
|
+
function z(e) {
|
|
1621
868
|
let t = new TextEncoder().encode(e).length;
|
|
1622
869
|
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
|
|
1623
870
|
}
|
|
1624
|
-
function
|
|
871
|
+
function he(e, t) {
|
|
1625
872
|
if (!(t?.includes("json") || /^[\s\n]*(?:\[|\{)/.test(e))) return e;
|
|
1626
873
|
try {
|
|
1627
874
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
@@ -1629,11 +876,11 @@ function xe(e, t) {
|
|
|
1629
876
|
return e;
|
|
1630
877
|
}
|
|
1631
878
|
}
|
|
1632
|
-
function
|
|
879
|
+
function ge(e) {
|
|
1633
880
|
return e instanceof Error ? e.message : "Request failed";
|
|
1634
881
|
}
|
|
1635
|
-
function
|
|
1636
|
-
let n =
|
|
882
|
+
function B(e, t = performance.now()) {
|
|
883
|
+
let n = ge(e);
|
|
1637
884
|
return {
|
|
1638
885
|
status: 0,
|
|
1639
886
|
statusText: "Network Error",
|
|
@@ -1647,27 +894,27 @@ function G(e, t = performance.now()) {
|
|
|
1647
894
|
error: n
|
|
1648
895
|
};
|
|
1649
896
|
}
|
|
1650
|
-
async function
|
|
897
|
+
async function V(e) {
|
|
1651
898
|
let t = performance.now();
|
|
1652
899
|
try {
|
|
1653
900
|
let n = await fetch(e.url, {
|
|
1654
901
|
method: e.method,
|
|
1655
|
-
headers:
|
|
902
|
+
headers: pe(e),
|
|
1656
903
|
body: e.body && e.method !== "GET" ? e.body : void 0
|
|
1657
|
-
}), r = await n.text(), i =
|
|
904
|
+
}), r = await n.text(), i = he(r, n.headers.get("content-type"));
|
|
1658
905
|
return {
|
|
1659
906
|
status: n.status,
|
|
1660
907
|
statusText: n.statusText || (n.ok ? "OK" : "Error"),
|
|
1661
|
-
headers:
|
|
908
|
+
headers: me(n.headers),
|
|
1662
909
|
body: i,
|
|
1663
910
|
timeMs: Math.round(performance.now() - t),
|
|
1664
|
-
size:
|
|
911
|
+
size: z(r)
|
|
1665
912
|
};
|
|
1666
913
|
} catch (e) {
|
|
1667
|
-
return
|
|
914
|
+
return B(e, t);
|
|
1668
915
|
}
|
|
1669
916
|
}
|
|
1670
|
-
function
|
|
917
|
+
function H(e) {
|
|
1671
918
|
let t = e.sampleResponse ?? JSON.stringify({
|
|
1672
919
|
ok: !0,
|
|
1673
920
|
request: e.title
|
|
@@ -1684,20 +931,20 @@ function we(e) {
|
|
|
1684
931
|
}],
|
|
1685
932
|
body: t,
|
|
1686
933
|
timeMs: 142,
|
|
1687
|
-
size:
|
|
934
|
+
size: z(t)
|
|
1688
935
|
};
|
|
1689
936
|
}
|
|
1690
937
|
//#endregion
|
|
1691
938
|
//#region src/features/api-widget/request-model.ts
|
|
1692
|
-
var
|
|
939
|
+
var U = "Authorization", _e = "Bearer ", ve = [{
|
|
1693
940
|
key: "Content-Type",
|
|
1694
941
|
value: "application/json",
|
|
1695
942
|
enabled: !0
|
|
1696
943
|
}];
|
|
1697
|
-
function
|
|
944
|
+
function ye(e) {
|
|
1698
945
|
return e.type === "none" ? null : e.type === "bearer" ? {
|
|
1699
|
-
key:
|
|
1700
|
-
value: `${
|
|
946
|
+
key: U,
|
|
947
|
+
value: `${_e}${e.token}`,
|
|
1701
948
|
enabled: !0
|
|
1702
949
|
} : {
|
|
1703
950
|
key: e.key,
|
|
@@ -1705,57 +952,57 @@ function De(e) {
|
|
|
1705
952
|
enabled: !0
|
|
1706
953
|
};
|
|
1707
954
|
}
|
|
1708
|
-
function
|
|
955
|
+
function W(e, t) {
|
|
1709
956
|
return e.toLowerCase() === t.toLowerCase();
|
|
1710
957
|
}
|
|
1711
|
-
function
|
|
1712
|
-
return e.toLowerCase().startsWith(
|
|
958
|
+
function be(e) {
|
|
959
|
+
return e.toLowerCase().startsWith(_e.toLowerCase());
|
|
1713
960
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return
|
|
961
|
+
function xe(e) {
|
|
962
|
+
return be(e) ? e.slice(7) : e;
|
|
1716
963
|
}
|
|
1717
|
-
function
|
|
1718
|
-
return e ?
|
|
964
|
+
function Se(e) {
|
|
965
|
+
return e ? W(e.key, U) && be(e.value) ? {
|
|
1719
966
|
type: "bearer",
|
|
1720
|
-
token:
|
|
967
|
+
token: xe(e.value)
|
|
1721
968
|
} : {
|
|
1722
969
|
type: "apiKey",
|
|
1723
|
-
key: e.key ||
|
|
970
|
+
key: e.key || U,
|
|
1724
971
|
value: e.value,
|
|
1725
972
|
in: "header"
|
|
1726
973
|
} : { type: "none" };
|
|
1727
974
|
}
|
|
1728
|
-
function
|
|
1729
|
-
return e.type === "apiKey" ? e.key :
|
|
975
|
+
function Ce(e) {
|
|
976
|
+
return e.type === "apiKey" ? e.key : U;
|
|
1730
977
|
}
|
|
1731
|
-
function
|
|
1732
|
-
return t.type === "none" ?
|
|
978
|
+
function G(e, t) {
|
|
979
|
+
return t.type === "none" ? W(e.key, U) : W(e.key, Ce(t));
|
|
1733
980
|
}
|
|
1734
|
-
function
|
|
1735
|
-
return e.auth ? e.auth :
|
|
981
|
+
function we(e) {
|
|
982
|
+
return e.auth ? e.auth : Se(e.headers?.find((e) => W(e.key, U)));
|
|
1736
983
|
}
|
|
1737
|
-
function
|
|
1738
|
-
let n = (e.headers?.length ? e.headers :
|
|
984
|
+
function Te(e, t) {
|
|
985
|
+
let n = (e.headers?.length ? e.headers : ve).filter((e) => !G(e, t)).map((e) => ({
|
|
1739
986
|
...e,
|
|
1740
987
|
enabled: !0
|
|
1741
|
-
})), r =
|
|
988
|
+
})), r = ye(t);
|
|
1742
989
|
return r ? [...n, r] : n;
|
|
1743
990
|
}
|
|
1744
|
-
function
|
|
1745
|
-
if (t.type === "none") return e.map((e) =>
|
|
991
|
+
function Ee(e, t, n) {
|
|
992
|
+
if (t.type === "none") return e.map((e) => G(e, n) || W(e.key, U) ? {
|
|
1746
993
|
...e,
|
|
1747
994
|
enabled: !1
|
|
1748
995
|
} : e);
|
|
1749
|
-
let r =
|
|
1750
|
-
return r ? [...e.filter((e) => !
|
|
996
|
+
let r = ye(t);
|
|
997
|
+
return r ? [...e.filter((e) => !G(e, n) && !G(e, t)), r] : e;
|
|
1751
998
|
}
|
|
1752
|
-
function
|
|
1753
|
-
return e.filter((e) => e.enabled && e.key.trim() && !
|
|
999
|
+
function De(e, t) {
|
|
1000
|
+
return e.filter((e) => e.enabled && e.key.trim() && !G(e, t)).map(({ key: e, value: t }) => ({
|
|
1754
1001
|
key: e,
|
|
1755
1002
|
value: t
|
|
1756
1003
|
}));
|
|
1757
1004
|
}
|
|
1758
|
-
function
|
|
1005
|
+
function K(e) {
|
|
1759
1006
|
return JSON.stringify({
|
|
1760
1007
|
method: e.method,
|
|
1761
1008
|
url: e.url,
|
|
@@ -1764,7 +1011,7 @@ function Y(e) {
|
|
|
1764
1011
|
body: e.body ?? ""
|
|
1765
1012
|
});
|
|
1766
1013
|
}
|
|
1767
|
-
function
|
|
1014
|
+
function Oe(e, t) {
|
|
1768
1015
|
let n = t.body.trim() ? t.body : void 0;
|
|
1769
1016
|
return {
|
|
1770
1017
|
...e,
|
|
@@ -1772,18 +1019,18 @@ function Ie(e, t) {
|
|
|
1772
1019
|
url: t.url,
|
|
1773
1020
|
body: n,
|
|
1774
1021
|
auth: t.auth,
|
|
1775
|
-
headers:
|
|
1022
|
+
headers: De(t.headers, t.auth)
|
|
1776
1023
|
};
|
|
1777
1024
|
}
|
|
1778
1025
|
//#endregion
|
|
1779
1026
|
//#region src/features/api-widget/ApiConsole.tsx
|
|
1780
|
-
var
|
|
1027
|
+
var ke = "{\n \n}", q = "Authorization", Ae = [
|
|
1781
1028
|
"GET",
|
|
1782
1029
|
"POST",
|
|
1783
1030
|
"PUT",
|
|
1784
1031
|
"PATCH",
|
|
1785
1032
|
"DELETE"
|
|
1786
|
-
],
|
|
1033
|
+
], je = [
|
|
1787
1034
|
{
|
|
1788
1035
|
id: "body",
|
|
1789
1036
|
label: "Body"
|
|
@@ -1796,13 +1043,13 @@ var Le = "{\n \n}", X = "Authorization", Re = [
|
|
|
1796
1043
|
id: "auth",
|
|
1797
1044
|
label: "Auth"
|
|
1798
1045
|
}
|
|
1799
|
-
],
|
|
1046
|
+
], Me = [{
|
|
1800
1047
|
id: "response",
|
|
1801
1048
|
label: "Response"
|
|
1802
1049
|
}, {
|
|
1803
1050
|
id: "history",
|
|
1804
1051
|
label: "History"
|
|
1805
|
-
}],
|
|
1052
|
+
}], Ne = ["body", "headers"], Pe = [
|
|
1806
1053
|
{
|
|
1807
1054
|
id: "none",
|
|
1808
1055
|
label: "None",
|
|
@@ -1819,38 +1066,38 @@ var Le = "{\n \n}", X = "Authorization", Re = [
|
|
|
1819
1066
|
className: "font-semibold text-content hover:bg-surface-2"
|
|
1820
1067
|
}
|
|
1821
1068
|
];
|
|
1822
|
-
function
|
|
1069
|
+
function Fe(e) {
|
|
1823
1070
|
return Math.max(3, e.split("\n").length);
|
|
1824
1071
|
}
|
|
1825
|
-
function
|
|
1072
|
+
function Ie(e) {
|
|
1826
1073
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
1827
1074
|
}
|
|
1828
|
-
function
|
|
1075
|
+
function Le(e) {
|
|
1829
1076
|
try {
|
|
1830
|
-
return
|
|
1077
|
+
return Ie(e);
|
|
1831
1078
|
} catch {
|
|
1832
1079
|
return e;
|
|
1833
1080
|
}
|
|
1834
1081
|
}
|
|
1835
|
-
var
|
|
1836
|
-
className:
|
|
1082
|
+
var Re = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
1083
|
+
className: u("flex min-h-10 items-center rounded-md border border-transparent bg-surface-2 px-3 text-sm text-content", "focus-within:border-primary/60 focus-within:ring-2 focus-within:ring-primary/20", t),
|
|
1837
1084
|
children: e
|
|
1838
|
-
}),
|
|
1085
|
+
}), ze = ({ value: e, onChange: t }) => /* @__PURE__ */ c("div", {
|
|
1839
1086
|
className: "inline-flex items-center gap-4",
|
|
1840
|
-
children:
|
|
1087
|
+
children: Ne.map((n) => /* @__PURE__ */ c("button", {
|
|
1841
1088
|
type: "button",
|
|
1842
1089
|
onClick: () => t(n),
|
|
1843
|
-
className:
|
|
1090
|
+
className: u("text-xs font-medium capitalize transition-colors", e === n ? "text-content" : "text-muted hover:text-content"),
|
|
1844
1091
|
children: n
|
|
1845
1092
|
}, n))
|
|
1846
|
-
}),
|
|
1093
|
+
}), Be = ({ method: e, url: t, isSending: n, editable: r, onMethodChange: i, onUrlChange: a, onSend: o }) => /* @__PURE__ */ l("div", {
|
|
1847
1094
|
className: "grid gap-3 md:grid-cols-[1fr_auto]",
|
|
1848
|
-
children: [/* @__PURE__ */ l(
|
|
1095
|
+
children: [/* @__PURE__ */ l(Re, {
|
|
1849
1096
|
className: "min-w-0",
|
|
1850
|
-
children: [/* @__PURE__ */ c(
|
|
1097
|
+
children: [/* @__PURE__ */ c(ce, {
|
|
1851
1098
|
value: e,
|
|
1852
1099
|
onChange: i,
|
|
1853
|
-
methods:
|
|
1100
|
+
methods: Ae,
|
|
1854
1101
|
disabled: !r
|
|
1855
1102
|
}), /* @__PURE__ */ c("input", {
|
|
1856
1103
|
value: t,
|
|
@@ -1859,24 +1106,24 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1859
1106
|
"aria-label": "Request URL",
|
|
1860
1107
|
className: "min-w-0 flex-1 bg-transparent px-2 py-2 font-mono text-[14px] text-muted outline-none read-only:cursor-default"
|
|
1861
1108
|
})]
|
|
1862
|
-
}), /* @__PURE__ */ c(
|
|
1109
|
+
}), /* @__PURE__ */ c(g, {
|
|
1863
1110
|
size: "md",
|
|
1864
1111
|
variant: "primary",
|
|
1865
1112
|
isLoading: n,
|
|
1866
1113
|
onClick: o,
|
|
1867
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1114
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
1868
1115
|
name: "send",
|
|
1869
1116
|
className: "h-4 w-4"
|
|
1870
1117
|
}),
|
|
1871
1118
|
className: "min-h-10 px-7",
|
|
1872
1119
|
children: "Send"
|
|
1873
1120
|
})]
|
|
1874
|
-
}),
|
|
1121
|
+
}), Ve = ({ header: e, index: t, editable: n, onUpdate: r, onRemove: i }) => /* @__PURE__ */ l("div", {
|
|
1875
1122
|
className: "grid grid-cols-[auto_1fr_auto] gap-3 md:grid-cols-[auto_1fr_1fr_auto]",
|
|
1876
1123
|
children: [
|
|
1877
1124
|
/* @__PURE__ */ c("span", {
|
|
1878
1125
|
className: "flex h-8 items-center",
|
|
1879
|
-
children: /* @__PURE__ */ c(
|
|
1126
|
+
children: /* @__PURE__ */ c(O, {
|
|
1880
1127
|
size: "sm",
|
|
1881
1128
|
checked: e.enabled,
|
|
1882
1129
|
onChange: (e) => r(t, { enabled: e }),
|
|
@@ -1884,7 +1131,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1884
1131
|
"aria-label": `Enable ${e.key}`
|
|
1885
1132
|
})
|
|
1886
1133
|
}),
|
|
1887
|
-
/* @__PURE__ */ c(
|
|
1134
|
+
/* @__PURE__ */ c(F, {
|
|
1888
1135
|
size: "sm",
|
|
1889
1136
|
value: e.key,
|
|
1890
1137
|
onChange: (e) => r(t, { key: e.target.value }),
|
|
@@ -1892,7 +1139,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1892
1139
|
"aria-label": "Header name",
|
|
1893
1140
|
className: "font-mono"
|
|
1894
1141
|
}),
|
|
1895
|
-
/* @__PURE__ */ c(
|
|
1142
|
+
/* @__PURE__ */ c(F, {
|
|
1896
1143
|
size: "sm",
|
|
1897
1144
|
value: e.value,
|
|
1898
1145
|
onChange: (e) => r(t, { value: e.target.value }),
|
|
@@ -1907,13 +1154,13 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1907
1154
|
onClick: () => i(t),
|
|
1908
1155
|
disabled: !n,
|
|
1909
1156
|
className: "row-span-2 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-2 hover:text-content disabled:cursor-not-allowed disabled:opacity-40 md:row-span-1",
|
|
1910
|
-
children: /* @__PURE__ */ c(
|
|
1157
|
+
children: /* @__PURE__ */ c(f, {
|
|
1911
1158
|
name: "trash",
|
|
1912
1159
|
className: "h-4 w-4"
|
|
1913
1160
|
})
|
|
1914
1161
|
})
|
|
1915
1162
|
]
|
|
1916
|
-
}),
|
|
1163
|
+
}), He = ({ body: e, error: t, editable: n, onBodyChange: r, onClearError: i }) => /* @__PURE__ */ l("div", {
|
|
1917
1164
|
className: "space-y-2",
|
|
1918
1165
|
children: [t && /* @__PURE__ */ c("div", {
|
|
1919
1166
|
className: "text-xs text-muted",
|
|
@@ -1926,16 +1173,16 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1926
1173
|
readOnly: !n,
|
|
1927
1174
|
"aria-label": "Request body",
|
|
1928
1175
|
spellCheck: !1,
|
|
1929
|
-
rows:
|
|
1930
|
-
className:
|
|
1176
|
+
rows: Fe(e),
|
|
1177
|
+
className: u("w-full resize-none overflow-hidden rounded-lg border border-border bg-surface-2 p-3 [field-sizing:content]", "font-mono text-[13px] leading-relaxed text-content outline-none placeholder:text-muted read-only:cursor-default")
|
|
1931
1178
|
})]
|
|
1932
|
-
}),
|
|
1179
|
+
}), Ue = ({ auth: e, editable: t, onChange: n }) => {
|
|
1933
1180
|
let [r, i] = o(!1), a = /* @__PURE__ */ c("button", {
|
|
1934
1181
|
type: "button",
|
|
1935
1182
|
"aria-label": r ? "Hide secret" : "Show secret",
|
|
1936
1183
|
onClick: () => i((e) => !e),
|
|
1937
1184
|
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted transition-colors hover:text-content",
|
|
1938
|
-
children: /* @__PURE__ */ c(
|
|
1185
|
+
children: /* @__PURE__ */ c(f, {
|
|
1939
1186
|
name: r ? "eye-closed" : "eye",
|
|
1940
1187
|
className: "h-4 w-4"
|
|
1941
1188
|
})
|
|
@@ -1943,7 +1190,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1943
1190
|
return /* @__PURE__ */ l("div", {
|
|
1944
1191
|
className: "grid items-start gap-3 md:grid-cols-[auto_1fr]",
|
|
1945
1192
|
children: [
|
|
1946
|
-
/* @__PURE__ */ c(
|
|
1193
|
+
/* @__PURE__ */ c(ie, {
|
|
1947
1194
|
value: e.type,
|
|
1948
1195
|
onChange: (t) => {
|
|
1949
1196
|
t === "none" && n({ type: "none" }), t === "bearer" && n({
|
|
@@ -1951,12 +1198,12 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1951
1198
|
token: e.type === "bearer" ? e.token : ""
|
|
1952
1199
|
}), t === "apiKey" && n({
|
|
1953
1200
|
type: "apiKey",
|
|
1954
|
-
key: e.type === "apiKey" ? e.key :
|
|
1201
|
+
key: e.type === "apiKey" ? e.key : q,
|
|
1955
1202
|
value: e.type === "apiKey" ? e.value : "",
|
|
1956
1203
|
in: "header"
|
|
1957
1204
|
});
|
|
1958
1205
|
},
|
|
1959
|
-
items:
|
|
1206
|
+
items: Pe,
|
|
1960
1207
|
size: "md",
|
|
1961
1208
|
disabled: !t,
|
|
1962
1209
|
minWidthClassName: "min-w-28"
|
|
@@ -1965,7 +1212,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1965
1212
|
className: "rounded-lg border border-border bg-surface-2 p-2.5 text-xs text-muted",
|
|
1966
1213
|
children: "Auth is disabled for this request."
|
|
1967
1214
|
}),
|
|
1968
|
-
e.type === "bearer" && /* @__PURE__ */ c(
|
|
1215
|
+
e.type === "bearer" && /* @__PURE__ */ c(F, {
|
|
1969
1216
|
size: "sm",
|
|
1970
1217
|
type: r ? "text" : "password",
|
|
1971
1218
|
value: e.token,
|
|
@@ -1979,7 +1226,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1979
1226
|
}),
|
|
1980
1227
|
e.type === "apiKey" && /* @__PURE__ */ l("div", {
|
|
1981
1228
|
className: "grid gap-3 md:grid-cols-[minmax(0,0.7fr)_minmax(0,1fr)]",
|
|
1982
|
-
children: [/* @__PURE__ */ c(
|
|
1229
|
+
children: [/* @__PURE__ */ c(F, {
|
|
1983
1230
|
size: "sm",
|
|
1984
1231
|
value: e.key,
|
|
1985
1232
|
onChange: (t) => n({
|
|
@@ -1990,7 +1237,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1990
1237
|
}),
|
|
1991
1238
|
readOnly: !t,
|
|
1992
1239
|
className: "font-mono"
|
|
1993
|
-
}), /* @__PURE__ */ c(
|
|
1240
|
+
}), /* @__PURE__ */ c(F, {
|
|
1994
1241
|
size: "sm",
|
|
1995
1242
|
type: r ? "text" : "password",
|
|
1996
1243
|
value: e.value,
|
|
@@ -2007,19 +1254,19 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2007
1254
|
})
|
|
2008
1255
|
]
|
|
2009
1256
|
});
|
|
2010
|
-
},
|
|
1257
|
+
}, We = ({ activeTab: e, auth: t, headers: n, body: r, bodyError: i, editable: a, onAuthChange: o, onHeaderUpdate: s, onHeaderRemove: u, onHeaderAdd: d, onBodyChange: p, onBodyErrorClear: m }) => e === "body" ? /* @__PURE__ */ c(He, {
|
|
2011
1258
|
body: r,
|
|
2012
1259
|
error: i,
|
|
2013
1260
|
editable: a,
|
|
2014
|
-
onBodyChange:
|
|
2015
|
-
onClearError:
|
|
2016
|
-
}) : e === "auth" ? /* @__PURE__ */ c(
|
|
1261
|
+
onBodyChange: p,
|
|
1262
|
+
onClearError: m
|
|
1263
|
+
}) : e === "auth" ? /* @__PURE__ */ c(Ue, {
|
|
2017
1264
|
auth: t,
|
|
2018
1265
|
editable: a,
|
|
2019
1266
|
onChange: o
|
|
2020
1267
|
}) : /* @__PURE__ */ l("div", {
|
|
2021
1268
|
className: "space-y-2.5",
|
|
2022
|
-
children: [n.map((e, t) => /* @__PURE__ */ c(
|
|
1269
|
+
children: [n.map((e, t) => /* @__PURE__ */ c(Ve, {
|
|
2023
1270
|
header: e,
|
|
2024
1271
|
index: t,
|
|
2025
1272
|
editable: a,
|
|
@@ -2030,19 +1277,19 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2030
1277
|
onClick: d,
|
|
2031
1278
|
disabled: !a,
|
|
2032
1279
|
className: "inline-flex items-center gap-1.5 rounded-md px-1 py-1 text-xs font-medium text-primary transition-colors hover:text-primary-hover disabled:cursor-not-allowed disabled:opacity-40",
|
|
2033
|
-
children: [/* @__PURE__ */ c(
|
|
1280
|
+
children: [/* @__PURE__ */ c(f, {
|
|
2034
1281
|
name: "plus",
|
|
2035
1282
|
className: "h-4 w-4"
|
|
2036
1283
|
}), "Add header"]
|
|
2037
1284
|
})]
|
|
2038
|
-
}),
|
|
1285
|
+
}), Ge = ({ responsePanel: e, response: t }) => {
|
|
2039
1286
|
let n = e === "body", r = t.headers.map((e) => `${e.key}: ${e.value}`).join("\n"), i = n ? t.body : r || "No response headers";
|
|
2040
1287
|
return /* @__PURE__ */ l("div", {
|
|
2041
1288
|
className: "relative p-3",
|
|
2042
1289
|
children: [/* @__PURE__ */ l("div", {
|
|
2043
1290
|
className: "absolute right-5 top-5 z-10 flex items-center gap-1",
|
|
2044
1291
|
children: [
|
|
2045
|
-
/* @__PURE__ */ c(
|
|
1292
|
+
/* @__PURE__ */ c(y, {
|
|
2046
1293
|
"aria-label": "Download response",
|
|
2047
1294
|
variant: "surface",
|
|
2048
1295
|
size: "sm",
|
|
@@ -2050,12 +1297,12 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2050
1297
|
let e = new Blob([i], { type: n ? "application/json" : "text/plain" }), t = URL.createObjectURL(e), r = document.createElement("a");
|
|
2051
1298
|
r.href = t, r.download = n ? "response.json" : "response-headers.txt", r.click(), URL.revokeObjectURL(t);
|
|
2052
1299
|
},
|
|
2053
|
-
children: /* @__PURE__ */ c(
|
|
1300
|
+
children: /* @__PURE__ */ c(f, {
|
|
2054
1301
|
name: "download",
|
|
2055
1302
|
size: 14
|
|
2056
1303
|
})
|
|
2057
1304
|
}),
|
|
2058
|
-
/* @__PURE__ */ c(
|
|
1305
|
+
/* @__PURE__ */ c(y, {
|
|
2059
1306
|
"aria-label": "Share response",
|
|
2060
1307
|
variant: "surface",
|
|
2061
1308
|
size: "sm",
|
|
@@ -2068,17 +1315,17 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2068
1315
|
} catch {}
|
|
2069
1316
|
else await navigator.clipboard?.writeText(i);
|
|
2070
1317
|
},
|
|
2071
|
-
children: /* @__PURE__ */ c(
|
|
1318
|
+
children: /* @__PURE__ */ c(f, {
|
|
2072
1319
|
name: "share",
|
|
2073
1320
|
size: 14
|
|
2074
1321
|
})
|
|
2075
1322
|
}),
|
|
2076
|
-
/* @__PURE__ */ c(
|
|
1323
|
+
/* @__PURE__ */ c(S, {
|
|
2077
1324
|
value: i,
|
|
2078
1325
|
size: "sm"
|
|
2079
1326
|
})
|
|
2080
1327
|
]
|
|
2081
|
-
}), /* @__PURE__ */ c(
|
|
1328
|
+
}), /* @__PURE__ */ c(L, {
|
|
2082
1329
|
code: i,
|
|
2083
1330
|
language: n ? "json" : "plain",
|
|
2084
1331
|
copyable: !1,
|
|
@@ -2087,17 +1334,17 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2087
1334
|
})]
|
|
2088
1335
|
});
|
|
2089
1336
|
};
|
|
2090
|
-
function
|
|
1337
|
+
function Ke(e) {
|
|
2091
1338
|
let t = Math.max(0, Math.round((Date.now() - e) / 1e3));
|
|
2092
1339
|
if (t < 5) return "just now";
|
|
2093
1340
|
if (t < 60) return `${t}s ago`;
|
|
2094
1341
|
let n = Math.round(t / 60);
|
|
2095
1342
|
return n < 60 ? `${n}m ago` : `${Math.round(n / 60)}h ago`;
|
|
2096
1343
|
}
|
|
2097
|
-
var
|
|
1344
|
+
var qe = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PURE__ */ l("div", {
|
|
2098
1345
|
className: "flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border px-6 py-10 text-center",
|
|
2099
1346
|
children: [
|
|
2100
|
-
/* @__PURE__ */ c(
|
|
1347
|
+
/* @__PURE__ */ c(f, {
|
|
2101
1348
|
name: "restart",
|
|
2102
1349
|
className: "h-6 w-6 text-muted"
|
|
2103
1350
|
}),
|
|
@@ -2136,7 +1383,7 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2136
1383
|
onClick: () => t(e),
|
|
2137
1384
|
className: "flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-2",
|
|
2138
1385
|
children: [
|
|
2139
|
-
/* @__PURE__ */ c(
|
|
1386
|
+
/* @__PURE__ */ c(T, {
|
|
2140
1387
|
method: e.request.method,
|
|
2141
1388
|
className: "shrink-0"
|
|
2142
1389
|
}),
|
|
@@ -2144,7 +1391,7 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2144
1391
|
className: "min-w-0 flex-1 truncate font-mono text-[13px] text-content",
|
|
2145
1392
|
children: e.request.url
|
|
2146
1393
|
}),
|
|
2147
|
-
/* @__PURE__ */ c(
|
|
1394
|
+
/* @__PURE__ */ c(te, {
|
|
2148
1395
|
status: e.response.status,
|
|
2149
1396
|
statusText: e.response.statusText,
|
|
2150
1397
|
className: "shrink-0"
|
|
@@ -2155,40 +1402,40 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2155
1402
|
}),
|
|
2156
1403
|
/* @__PURE__ */ c("span", {
|
|
2157
1404
|
className: "hidden shrink-0 text-xs text-muted md:inline",
|
|
2158
|
-
children:
|
|
1405
|
+
children: Ke(e.at)
|
|
2159
1406
|
})
|
|
2160
1407
|
]
|
|
2161
1408
|
})
|
|
2162
|
-
},
|
|
1409
|
+
}, K(e.request)))
|
|
2163
1410
|
})]
|
|
2164
1411
|
});
|
|
2165
|
-
async function
|
|
1412
|
+
async function Je(e, t) {
|
|
2166
1413
|
let n = performance.now();
|
|
2167
1414
|
try {
|
|
2168
|
-
return t ? await t(e) : await
|
|
1415
|
+
return t ? await t(e) : await V(e);
|
|
2169
1416
|
} catch (e) {
|
|
2170
|
-
return
|
|
1417
|
+
return B(e, n);
|
|
2171
1418
|
}
|
|
2172
1419
|
}
|
|
2173
|
-
var
|
|
2174
|
-
let
|
|
1420
|
+
var Ye = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack: a, onImport: d, className: p }) => {
|
|
1421
|
+
let m = i(() => we(e), [e]), h = i(() => Te(e, m), [e, m]), _ = Le(e.body ?? ke), v = e.body ?? "", [y, b] = o("body"), [x, S] = o("response"), [C, w] = o("body"), [ee, T] = o(!1), [ne, E] = o([]), [D, O] = o(null), [j, M] = o(null), N = i(() => H(e), [e]), P = j ?? N, F = h.filter((e) => e.enabled).length, re = je.map((e) => e.id === "headers" ? {
|
|
2175
1422
|
...e,
|
|
2176
1423
|
badge: F
|
|
2177
|
-
} : e),
|
|
1424
|
+
} : e), I = (n) => {
|
|
2178
1425
|
if (!r) return;
|
|
2179
|
-
let i =
|
|
1426
|
+
let i = Oe(e, {
|
|
2180
1427
|
method: e.method,
|
|
2181
1428
|
url: e.url,
|
|
2182
|
-
body:
|
|
2183
|
-
auth:
|
|
2184
|
-
headers:
|
|
1429
|
+
body: v,
|
|
1430
|
+
auth: m,
|
|
1431
|
+
headers: h,
|
|
2185
1432
|
...n
|
|
2186
1433
|
});
|
|
2187
1434
|
t?.(i);
|
|
2188
1435
|
};
|
|
2189
1436
|
return /* @__PURE__ */ l("div", {
|
|
2190
|
-
className:
|
|
2191
|
-
children: [/* @__PURE__ */ l(
|
|
1437
|
+
className: u("space-y-3", p),
|
|
1438
|
+
children: [/* @__PURE__ */ l(k, {
|
|
2192
1439
|
flush: !0,
|
|
2193
1440
|
children: [
|
|
2194
1441
|
/* @__PURE__ */ l("div", {
|
|
@@ -2202,7 +1449,7 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2202
1449
|
"aria-label": "Back to request snippets",
|
|
2203
1450
|
onClick: a,
|
|
2204
1451
|
className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-content transition-colors hover:bg-surface-2",
|
|
2205
|
-
children: /* @__PURE__ */ c(
|
|
1452
|
+
children: /* @__PURE__ */ c(f, {
|
|
2206
1453
|
name: "arrow-left",
|
|
2207
1454
|
className: "h-5 w-5"
|
|
2208
1455
|
})
|
|
@@ -2210,62 +1457,62 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2210
1457
|
className: "font-heading text-sm font-semibold text-content",
|
|
2211
1458
|
children: "Try it Out"
|
|
2212
1459
|
})]
|
|
2213
|
-
}), r &&
|
|
1460
|
+
}), r && d && /* @__PURE__ */ c(g, {
|
|
2214
1461
|
type: "button",
|
|
2215
1462
|
size: "sm",
|
|
2216
1463
|
variant: "ghost",
|
|
2217
|
-
onClick:
|
|
2218
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1464
|
+
onClick: d,
|
|
1465
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2219
1466
|
name: "download",
|
|
2220
1467
|
className: "h-4 w-4"
|
|
2221
1468
|
}),
|
|
2222
1469
|
children: "Import"
|
|
2223
1470
|
})]
|
|
2224
|
-
}), /* @__PURE__ */ c(
|
|
1471
|
+
}), /* @__PURE__ */ c(Be, {
|
|
2225
1472
|
method: e.method,
|
|
2226
1473
|
url: e.url,
|
|
2227
|
-
isSending:
|
|
1474
|
+
isSending: ee,
|
|
2228
1475
|
editable: r,
|
|
2229
|
-
onMethodChange: (e) =>
|
|
2230
|
-
onUrlChange: (e) =>
|
|
1476
|
+
onMethodChange: (e) => I({ method: e }),
|
|
1477
|
+
onUrlChange: (e) => I({ url: e }),
|
|
2231
1478
|
onSend: async () => {
|
|
2232
|
-
let t =
|
|
1479
|
+
let t = Oe(e, {
|
|
2233
1480
|
method: e.method,
|
|
2234
1481
|
url: e.url,
|
|
2235
|
-
body:
|
|
2236
|
-
auth:
|
|
2237
|
-
headers:
|
|
2238
|
-
}), r =
|
|
2239
|
-
|
|
2240
|
-
let i = await
|
|
2241
|
-
|
|
1482
|
+
body: v,
|
|
1483
|
+
auth: m,
|
|
1484
|
+
headers: h
|
|
1485
|
+
}), r = K(t);
|
|
1486
|
+
T(!0);
|
|
1487
|
+
let i = await Je(t, n);
|
|
1488
|
+
T(!1), M(i), S("response"), E((e) => [{
|
|
2242
1489
|
request: t,
|
|
2243
1490
|
response: i,
|
|
2244
1491
|
at: Date.now()
|
|
2245
|
-
}, ...e.filter((e) =>
|
|
1492
|
+
}, ...e.filter((e) => K(e.request) !== r)].slice(0, 25));
|
|
2246
1493
|
}
|
|
2247
1494
|
})]
|
|
2248
1495
|
}),
|
|
2249
1496
|
/* @__PURE__ */ l("div", {
|
|
2250
1497
|
className: "flex items-center justify-between gap-3 border-y border-border px-3",
|
|
2251
|
-
children: [/* @__PURE__ */ c(
|
|
2252
|
-
items:
|
|
2253
|
-
activeId:
|
|
2254
|
-
onChange: (e) =>
|
|
1498
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1499
|
+
items: re,
|
|
1500
|
+
activeId: y,
|
|
1501
|
+
onChange: (e) => b(e),
|
|
2255
1502
|
className: "border-b-0"
|
|
2256
|
-
}),
|
|
1503
|
+
}), y === "body" && /* @__PURE__ */ c(g, {
|
|
2257
1504
|
type: "button",
|
|
2258
1505
|
size: "sm",
|
|
2259
1506
|
variant: "ghost",
|
|
2260
1507
|
onClick: () => {
|
|
2261
1508
|
try {
|
|
2262
|
-
|
|
1509
|
+
I({ body: Ie(_) }), O(null);
|
|
2263
1510
|
} catch {
|
|
2264
|
-
|
|
1511
|
+
O("Invalid JSON");
|
|
2265
1512
|
}
|
|
2266
1513
|
},
|
|
2267
1514
|
disabled: !r,
|
|
2268
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1515
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2269
1516
|
name: "magic",
|
|
2270
1517
|
className: "h-4 w-4"
|
|
2271
1518
|
}),
|
|
@@ -2274,107 +1521,107 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2274
1521
|
}),
|
|
2275
1522
|
/* @__PURE__ */ c("div", {
|
|
2276
1523
|
className: "p-3",
|
|
2277
|
-
children: /* @__PURE__ */ c(
|
|
2278
|
-
activeTab:
|
|
2279
|
-
auth:
|
|
2280
|
-
headers:
|
|
2281
|
-
body:
|
|
2282
|
-
bodyError:
|
|
1524
|
+
children: /* @__PURE__ */ c(We, {
|
|
1525
|
+
activeTab: y,
|
|
1526
|
+
auth: m,
|
|
1527
|
+
headers: h,
|
|
1528
|
+
body: _,
|
|
1529
|
+
bodyError: D,
|
|
2283
1530
|
editable: r,
|
|
2284
1531
|
onAuthChange: (e) => {
|
|
2285
|
-
|
|
1532
|
+
I({
|
|
2286
1533
|
auth: e,
|
|
2287
|
-
headers:
|
|
1534
|
+
headers: Ee(h, e, m)
|
|
2288
1535
|
});
|
|
2289
1536
|
},
|
|
2290
1537
|
onHeaderUpdate: (e, t) => {
|
|
2291
|
-
let n =
|
|
1538
|
+
let n = h[e], r = h.map((n, r) => r === e ? {
|
|
2292
1539
|
...n,
|
|
2293
1540
|
...t
|
|
2294
1541
|
} : n), i = r[e];
|
|
2295
|
-
|
|
2296
|
-
auth: i && (n &&
|
|
1542
|
+
I({
|
|
1543
|
+
auth: i && (n && G(n, m) || G(i, m) || W(i.key, q)) ? i.enabled ? Se(i) : { type: "none" } : m,
|
|
2297
1544
|
headers: r
|
|
2298
1545
|
});
|
|
2299
1546
|
},
|
|
2300
1547
|
onHeaderRemove: (e) => {
|
|
2301
|
-
let t =
|
|
2302
|
-
|
|
2303
|
-
auth: t && (
|
|
2304
|
-
headers:
|
|
1548
|
+
let t = h[e];
|
|
1549
|
+
I({
|
|
1550
|
+
auth: t && (G(t, m) || W(t.key, q)) ? { type: "none" } : m,
|
|
1551
|
+
headers: h.filter((t, n) => n !== e)
|
|
2305
1552
|
});
|
|
2306
1553
|
},
|
|
2307
1554
|
onHeaderAdd: () => {
|
|
2308
|
-
|
|
1555
|
+
I({ headers: [...h, {
|
|
2309
1556
|
key: "",
|
|
2310
1557
|
value: "",
|
|
2311
1558
|
enabled: !0
|
|
2312
1559
|
}] });
|
|
2313
1560
|
},
|
|
2314
|
-
onBodyChange: (e) =>
|
|
2315
|
-
onBodyErrorClear: () =>
|
|
1561
|
+
onBodyChange: (e) => I({ body: e }),
|
|
1562
|
+
onBodyErrorClear: () => O(null)
|
|
2316
1563
|
})
|
|
2317
1564
|
})
|
|
2318
1565
|
]
|
|
2319
|
-
}), /* @__PURE__ */ l(
|
|
1566
|
+
}), /* @__PURE__ */ l(k, {
|
|
2320
1567
|
flush: !0,
|
|
2321
1568
|
children: [/* @__PURE__ */ l("div", {
|
|
2322
1569
|
className: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-3",
|
|
2323
|
-
children: [/* @__PURE__ */ c(
|
|
2324
|
-
items:
|
|
2325
|
-
activeId:
|
|
2326
|
-
onChange: (e) =>
|
|
1570
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1571
|
+
items: Me,
|
|
1572
|
+
activeId: x,
|
|
1573
|
+
onChange: (e) => S(e),
|
|
2327
1574
|
className: "border-b-0"
|
|
2328
|
-
}),
|
|
2329
|
-
value:
|
|
2330
|
-
onChange:
|
|
1575
|
+
}), x === "response" && /* @__PURE__ */ c(ze, {
|
|
1576
|
+
value: C,
|
|
1577
|
+
onChange: w
|
|
2331
1578
|
})]
|
|
2332
|
-
}),
|
|
1579
|
+
}), x === "response" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
|
|
2333
1580
|
className: "flex flex-wrap items-center gap-5 border-b border-border px-3 py-3 text-xs text-muted",
|
|
2334
1581
|
children: [
|
|
2335
|
-
/* @__PURE__ */ c(
|
|
1582
|
+
/* @__PURE__ */ c(te, {
|
|
2336
1583
|
status: P.status,
|
|
2337
1584
|
statusText: P.statusText
|
|
2338
1585
|
}),
|
|
2339
1586
|
/* @__PURE__ */ l("span", { children: [P.timeMs, "ms"] }),
|
|
2340
1587
|
/* @__PURE__ */ c("span", { children: P.size })
|
|
2341
1588
|
]
|
|
2342
|
-
}), /* @__PURE__ */ c(
|
|
2343
|
-
responsePanel:
|
|
1589
|
+
}), /* @__PURE__ */ c(Ge, {
|
|
1590
|
+
responsePanel: C,
|
|
2344
1591
|
response: P
|
|
2345
1592
|
})] }) : /* @__PURE__ */ c("div", {
|
|
2346
1593
|
className: "p-3",
|
|
2347
|
-
children: /* @__PURE__ */ c(
|
|
2348
|
-
entries:
|
|
1594
|
+
children: /* @__PURE__ */ c(qe, {
|
|
1595
|
+
entries: ne,
|
|
2349
1596
|
onSelect: (e) => {
|
|
2350
|
-
t?.(e.request), M(e.response),
|
|
1597
|
+
t?.(e.request), M(e.response), S("response");
|
|
2351
1598
|
},
|
|
2352
|
-
onClear: () =>
|
|
1599
|
+
onClear: () => E([])
|
|
2353
1600
|
})
|
|
2354
1601
|
})]
|
|
2355
1602
|
})]
|
|
2356
1603
|
});
|
|
2357
|
-
},
|
|
1604
|
+
}, Xe = [
|
|
2358
1605
|
"GET",
|
|
2359
1606
|
"POST",
|
|
2360
1607
|
"PUT",
|
|
2361
1608
|
"PATCH",
|
|
2362
1609
|
"DELETE"
|
|
2363
|
-
],
|
|
1610
|
+
], Ze = /* @__PURE__ */ new Set([
|
|
2364
1611
|
"-d",
|
|
2365
1612
|
"--data",
|
|
2366
1613
|
"--data-raw",
|
|
2367
1614
|
"--data-binary",
|
|
2368
1615
|
"--data-ascii"
|
|
2369
|
-
]),
|
|
2370
|
-
function
|
|
1616
|
+
]), Qe = /* @__PURE__ */ new Set(["-H", "--header"]), $e = /* @__PURE__ */ new Set(["-X", "--request"]), et = /* @__PURE__ */ new Set(["--url"]), tt = "authorization", nt = "Bearer ";
|
|
1617
|
+
function rt(e) {
|
|
2371
1618
|
return e.replace(/\\\s*\n\s*/g, " ").trim();
|
|
2372
1619
|
}
|
|
2373
|
-
function
|
|
1620
|
+
function it(e) {
|
|
2374
1621
|
return e.trim().replace(/^```(?:bash|sh|shell|zsh|curl)?\s*/i, "").replace(/\s*```$/i, "").replace(/^\s*[$>]\s*/gm, "").replace(/\\n/g, "\n").replace(/\\"/g, "\"").replace(/\\'/g, "'");
|
|
2375
1622
|
}
|
|
2376
|
-
function
|
|
2377
|
-
let t = [], n = "", r = null, i = !1, a =
|
|
1623
|
+
function at(e) {
|
|
1624
|
+
let t = [], n = "", r = null, i = !1, a = rt(it(e)), o = () => {
|
|
2378
1625
|
n &&= (t.push(n), "");
|
|
2379
1626
|
};
|
|
2380
1627
|
for (let e = 0; e < a.length; e++) {
|
|
@@ -2408,30 +1655,30 @@ function pt(e) {
|
|
|
2408
1655
|
}
|
|
2409
1656
|
return i && (n += "\\"), o(), t;
|
|
2410
1657
|
}
|
|
2411
|
-
function
|
|
1658
|
+
function ot(e) {
|
|
2412
1659
|
let t = e.findIndex((e) => e === "curl" || e.endsWith("/curl"));
|
|
2413
1660
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
2414
1661
|
}
|
|
2415
|
-
function
|
|
1662
|
+
function st(e) {
|
|
2416
1663
|
return /^(?:https?:\/\/\S+|\/\S*|[A-Za-z0-9.-]+\.[A-Za-z]{2,}\S*)$/.test(e);
|
|
2417
1664
|
}
|
|
2418
|
-
function
|
|
1665
|
+
function J(e) {
|
|
2419
1666
|
return e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") ? e : `https://${e}`;
|
|
2420
1667
|
}
|
|
2421
|
-
function
|
|
1668
|
+
function ct(e) {
|
|
2422
1669
|
let t = e.toUpperCase();
|
|
2423
|
-
return
|
|
1670
|
+
return Xe.includes(t) ? t : null;
|
|
2424
1671
|
}
|
|
2425
|
-
function
|
|
1672
|
+
function Y(e) {
|
|
2426
1673
|
let t = e.indexOf(":");
|
|
2427
1674
|
return t < 0 ? null : {
|
|
2428
1675
|
key: e.slice(0, t).trim(),
|
|
2429
1676
|
value: e.slice(t + 1).trim()
|
|
2430
1677
|
};
|
|
2431
1678
|
}
|
|
2432
|
-
function
|
|
2433
|
-
let t = e.find((e) => e.key.toLowerCase() ===
|
|
2434
|
-
if (t) return t.value.toLowerCase().startsWith(
|
|
1679
|
+
function lt(e) {
|
|
1680
|
+
let t = e.find((e) => e.key.toLowerCase() === tt);
|
|
1681
|
+
if (t) return t.value.toLowerCase().startsWith(nt.toLowerCase()) ? {
|
|
2435
1682
|
type: "bearer",
|
|
2436
1683
|
token: t.value.slice(7)
|
|
2437
1684
|
} : {
|
|
@@ -2441,72 +1688,72 @@ function vt(e) {
|
|
|
2441
1688
|
in: "header"
|
|
2442
1689
|
};
|
|
2443
1690
|
}
|
|
2444
|
-
function
|
|
1691
|
+
function ut(e) {
|
|
2445
1692
|
try {
|
|
2446
1693
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
2447
1694
|
} catch {
|
|
2448
1695
|
return e;
|
|
2449
1696
|
}
|
|
2450
1697
|
}
|
|
2451
|
-
function
|
|
2452
|
-
let t =
|
|
1698
|
+
function X(e) {
|
|
1699
|
+
let t = ot(at(e));
|
|
2453
1700
|
if (t.length === 0) return null;
|
|
2454
1701
|
let n = [], r = [], i = null, a = "";
|
|
2455
1702
|
for (let e = 0; e < t.length; e++) {
|
|
2456
1703
|
let o = t[e], s = t[e + 1];
|
|
2457
|
-
if (
|
|
2458
|
-
i =
|
|
1704
|
+
if ($e.has(o) && s) {
|
|
1705
|
+
i = ct(s) ?? i, e++;
|
|
2459
1706
|
continue;
|
|
2460
1707
|
}
|
|
2461
1708
|
if (o.startsWith("-X") && o.length > 2) {
|
|
2462
|
-
i =
|
|
1709
|
+
i = ct(o.slice(2)) ?? i;
|
|
2463
1710
|
continue;
|
|
2464
1711
|
}
|
|
2465
|
-
if (
|
|
2466
|
-
let t =
|
|
1712
|
+
if (Qe.has(o) && s) {
|
|
1713
|
+
let t = Y(s);
|
|
2467
1714
|
t && n.push(t), e++;
|
|
2468
1715
|
continue;
|
|
2469
1716
|
}
|
|
2470
1717
|
if (o.startsWith("-H") && o.length > 2) {
|
|
2471
|
-
let e =
|
|
1718
|
+
let e = Y(o.slice(2));
|
|
2472
1719
|
e && n.push(e);
|
|
2473
1720
|
continue;
|
|
2474
1721
|
}
|
|
2475
|
-
if (
|
|
1722
|
+
if (Ze.has(o) && s !== void 0) {
|
|
2476
1723
|
r.push(s), e++;
|
|
2477
1724
|
continue;
|
|
2478
1725
|
}
|
|
2479
|
-
let c = [...
|
|
1726
|
+
let c = [...Ze].find((e) => o.startsWith(`${e}=`));
|
|
2480
1727
|
if (c) {
|
|
2481
1728
|
r.push(o.slice(c.length + 1));
|
|
2482
1729
|
continue;
|
|
2483
1730
|
}
|
|
2484
|
-
if (
|
|
2485
|
-
a =
|
|
1731
|
+
if (et.has(o) && s) {
|
|
1732
|
+
a = J(s), e++;
|
|
2486
1733
|
continue;
|
|
2487
1734
|
}
|
|
2488
1735
|
if (o.startsWith("--url=")) {
|
|
2489
|
-
a =
|
|
1736
|
+
a = J(o.slice(6));
|
|
2490
1737
|
continue;
|
|
2491
1738
|
}
|
|
2492
|
-
!o.startsWith("-") &&
|
|
1739
|
+
!o.startsWith("-") && st(o) && (a = J(o));
|
|
2493
1740
|
}
|
|
2494
1741
|
if (!a) return null;
|
|
2495
|
-
let o = r.length ?
|
|
1742
|
+
let o = r.length ? ut(r.join("&")) : "", s = i ?? (o ? "POST" : "GET"), c = lt(n);
|
|
2496
1743
|
return {
|
|
2497
1744
|
title: "Imported request",
|
|
2498
1745
|
method: s,
|
|
2499
1746
|
url: a,
|
|
2500
|
-
headers: c ? n.filter((e) => e.key.toLowerCase() !==
|
|
1747
|
+
headers: c ? n.filter((e) => e.key.toLowerCase() !== tt) : n,
|
|
2501
1748
|
auth: c,
|
|
2502
1749
|
body: o || void 0
|
|
2503
1750
|
};
|
|
2504
1751
|
}
|
|
2505
1752
|
//#endregion
|
|
2506
1753
|
//#region src/features/api-widget/ImportCard.tsx
|
|
2507
|
-
var
|
|
1754
|
+
var dt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Content-Type: application/json' \\\n -d '{ \"title\": \"API client\", \"body\": \"Live request\", \"userId\": 1 }'", ft = ({ onImport: e, onCancel: t, className: n }) => {
|
|
2508
1755
|
let [r, i] = o(""), [a, s] = o(null);
|
|
2509
|
-
return /* @__PURE__ */ c(
|
|
1756
|
+
return /* @__PURE__ */ c(k, {
|
|
2510
1757
|
flush: !0,
|
|
2511
1758
|
className: n,
|
|
2512
1759
|
children: /* @__PURE__ */ l("div", {
|
|
@@ -2519,7 +1766,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2519
1766
|
"aria-label": "Back",
|
|
2520
1767
|
onClick: t,
|
|
2521
1768
|
className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-content transition-colors hover:bg-surface-2",
|
|
2522
|
-
children: /* @__PURE__ */ c(
|
|
1769
|
+
children: /* @__PURE__ */ c(f, {
|
|
2523
1770
|
name: "arrow-left",
|
|
2524
1771
|
className: "h-5 w-5"
|
|
2525
1772
|
})
|
|
@@ -2539,9 +1786,9 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2539
1786
|
},
|
|
2540
1787
|
spellCheck: !1,
|
|
2541
1788
|
rows: 5,
|
|
2542
|
-
placeholder:
|
|
1789
|
+
placeholder: dt,
|
|
2543
1790
|
"aria-label": "cURL command",
|
|
2544
|
-
className:
|
|
1791
|
+
className: u("w-full resize-none rounded-lg border bg-surface-2 p-3 font-mono text-[13px] leading-relaxed text-content outline-none", "placeholder:text-muted/50 focus:ring-2 focus:ring-primary/20", a ? "border-red-500/60" : "border-border focus:border-primary/60")
|
|
2545
1792
|
}),
|
|
2546
1793
|
a && /* @__PURE__ */ c("p", {
|
|
2547
1794
|
className: "text-xs text-red-400",
|
|
@@ -2549,10 +1796,10 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2549
1796
|
}),
|
|
2550
1797
|
/* @__PURE__ */ c("div", {
|
|
2551
1798
|
className: "flex items-center justify-end",
|
|
2552
|
-
children: /* @__PURE__ */ c(
|
|
1799
|
+
children: /* @__PURE__ */ c(g, {
|
|
2553
1800
|
size: "sm",
|
|
2554
1801
|
onClick: () => {
|
|
2555
|
-
let t =
|
|
1802
|
+
let t = X(r);
|
|
2556
1803
|
if (!t) {
|
|
2557
1804
|
s("Could not parse a valid cURL command. Make sure it includes a URL.");
|
|
2558
1805
|
return;
|
|
@@ -2560,7 +1807,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2560
1807
|
e(t, r), i(""), s(null);
|
|
2561
1808
|
},
|
|
2562
1809
|
disabled: !r.trim(),
|
|
2563
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1810
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2564
1811
|
name: "download",
|
|
2565
1812
|
className: "h-4 w-4"
|
|
2566
1813
|
}),
|
|
@@ -2570,7 +1817,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2570
1817
|
]
|
|
2571
1818
|
})
|
|
2572
1819
|
});
|
|
2573
|
-
},
|
|
1820
|
+
}, pt = [
|
|
2574
1821
|
{
|
|
2575
1822
|
id: "curl",
|
|
2576
1823
|
label: "cURL"
|
|
@@ -2588,10 +1835,10 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2588
1835
|
label: "Go"
|
|
2589
1836
|
}
|
|
2590
1837
|
];
|
|
2591
|
-
function
|
|
1838
|
+
function mt(e) {
|
|
2592
1839
|
return e === "curl" ? "bash" : e;
|
|
2593
1840
|
}
|
|
2594
|
-
function
|
|
1841
|
+
function ht(e) {
|
|
2595
1842
|
return !e || e.type === "none" ? null : e.type === "bearer" ? {
|
|
2596
1843
|
key: "Authorization",
|
|
2597
1844
|
value: `Bearer ${e.token}`
|
|
@@ -2600,17 +1847,17 @@ function wt(e) {
|
|
|
2600
1847
|
value: e.value
|
|
2601
1848
|
};
|
|
2602
1849
|
}
|
|
2603
|
-
function
|
|
2604
|
-
let t =
|
|
1850
|
+
function Z(e) {
|
|
1851
|
+
let t = ht(e.auth);
|
|
2605
1852
|
return t ? [...(e.headers ?? []).filter((e) => e.key.toLowerCase() !== t.key.toLowerCase()), t] : e.headers ?? [];
|
|
2606
1853
|
}
|
|
2607
|
-
function
|
|
1854
|
+
function gt(e) {
|
|
2608
1855
|
let t = `curl -X ${e.method} '${e.url}'`;
|
|
2609
|
-
for (let n of
|
|
1856
|
+
for (let n of Z(e)) t += ` \\\n -H '${n.key}: ${n.value}'`;
|
|
2610
1857
|
return e.body && (t += ` \\\n -d '${e.body}'`), t;
|
|
2611
1858
|
}
|
|
2612
|
-
function
|
|
2613
|
-
let t = [`method: '${e.method}'`], n =
|
|
1859
|
+
function _t(e) {
|
|
1860
|
+
let t = [`method: '${e.method}'`], n = Z(e);
|
|
2614
1861
|
if (n.length) {
|
|
2615
1862
|
let e = n.map((e) => ` '${e.key}': '${e.value}'`).join(",\n");
|
|
2616
1863
|
t.push(`headers: {\n${e}\n }`);
|
|
@@ -2624,12 +1871,12 @@ function Et(e) {
|
|
|
2624
1871
|
"console.log(data);"
|
|
2625
1872
|
].join("\n");
|
|
2626
1873
|
}
|
|
2627
|
-
function
|
|
1874
|
+
function vt(e) {
|
|
2628
1875
|
let t = [
|
|
2629
1876
|
"import requests",
|
|
2630
1877
|
"",
|
|
2631
1878
|
`url = "${e.url}"`
|
|
2632
|
-
], n = ["url"], r =
|
|
1879
|
+
], n = ["url"], r = Z(e);
|
|
2633
1880
|
if (r.length) {
|
|
2634
1881
|
t.push("", "headers = {");
|
|
2635
1882
|
for (let e of r) t.push(` "${e.key}": "${e.value}",`);
|
|
@@ -2637,7 +1884,7 @@ function Dt(e) {
|
|
|
2637
1884
|
}
|
|
2638
1885
|
return e.body && (t.push("", `payload = ${e.body}`), n.push("json=payload")), t.push("", `response = requests.${e.method.toLowerCase()}(${n.join(", ")})`, "print(response.json())"), t.join("\n");
|
|
2639
1886
|
}
|
|
2640
|
-
function
|
|
1887
|
+
function yt(e) {
|
|
2641
1888
|
let t = [
|
|
2642
1889
|
"\"fmt\"",
|
|
2643
1890
|
"\"io\"",
|
|
@@ -2651,39 +1898,39 @@ function Ot(e) {
|
|
|
2651
1898
|
];
|
|
2652
1899
|
for (let e of t) n.push(`\t${e}`);
|
|
2653
1900
|
n.push(")", "", "func main() {"), e.body ? (n.push(`\tpayload := strings.NewReader(\`${e.body}\`)`), n.push(`\treq, _ := http.NewRequest("${e.method}", "${e.url}", payload)`)) : n.push(`\treq, _ := http.NewRequest("${e.method}", "${e.url}", nil)`);
|
|
2654
|
-
for (let t of
|
|
1901
|
+
for (let t of Z(e)) n.push(`\treq.Header.Set("${t.key}", "${t.value}")`);
|
|
2655
1902
|
return n.push(" res, _ := http.DefaultClient.Do(req)", " defer res.Body.Close()", "", " body, _ := io.ReadAll(res.Body)", " fmt.Println(string(body))", "}"), n.join("\n");
|
|
2656
1903
|
}
|
|
2657
|
-
function
|
|
1904
|
+
function Q(e, t) {
|
|
2658
1905
|
switch (t) {
|
|
2659
|
-
case "curl": return
|
|
2660
|
-
case "javascript": return
|
|
2661
|
-
case "python": return
|
|
2662
|
-
case "go": return
|
|
1906
|
+
case "curl": return gt(e);
|
|
1907
|
+
case "javascript": return _t(e);
|
|
1908
|
+
case "python": return vt(e);
|
|
1909
|
+
case "go": return yt(e);
|
|
2663
1910
|
}
|
|
2664
1911
|
}
|
|
2665
1912
|
//#endregion
|
|
2666
1913
|
//#region src/features/api-widget/RequestSnippet.tsx
|
|
2667
|
-
var
|
|
2668
|
-
let [n, r] = o("curl"), a = i(() =>
|
|
1914
|
+
var bt = ({ request: e, onTryItOut: t }) => {
|
|
1915
|
+
let [n, r] = o("curl"), a = i(() => Q(e, n), [e, n]), s = !!t;
|
|
2669
1916
|
return /* @__PURE__ */ l("div", {
|
|
2670
1917
|
className: "space-y-3",
|
|
2671
|
-
children: [/* @__PURE__ */ l(
|
|
1918
|
+
children: [/* @__PURE__ */ l(k, {
|
|
2672
1919
|
label: e.title,
|
|
2673
1920
|
children: [/* @__PURE__ */ l("div", {
|
|
2674
1921
|
className: "relative flex items-center justify-between",
|
|
2675
|
-
children: [/* @__PURE__ */ c(
|
|
2676
|
-
items:
|
|
1922
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1923
|
+
items: pt,
|
|
2677
1924
|
activeId: n,
|
|
2678
1925
|
onChange: (e) => {
|
|
2679
1926
|
r(e);
|
|
2680
1927
|
},
|
|
2681
1928
|
className: "[&_button]:text-[14px]"
|
|
2682
|
-
}), s && /* @__PURE__ */ c(
|
|
1929
|
+
}), s && /* @__PURE__ */ c(g, {
|
|
2683
1930
|
size: "sm",
|
|
2684
1931
|
variant: "primary",
|
|
2685
1932
|
onClick: t,
|
|
2686
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1933
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
2687
1934
|
name: "arrow-right",
|
|
2688
1935
|
className: "h-4 w-4"
|
|
2689
1936
|
}),
|
|
@@ -2691,15 +1938,15 @@ var At = ({ request: e, onTryItOut: t }) => {
|
|
|
2691
1938
|
})]
|
|
2692
1939
|
}), /* @__PURE__ */ c("div", {
|
|
2693
1940
|
className: "mt-4",
|
|
2694
|
-
children: /* @__PURE__ */ c(
|
|
1941
|
+
children: /* @__PURE__ */ c(L, {
|
|
2695
1942
|
code: a,
|
|
2696
|
-
language:
|
|
1943
|
+
language: mt(n),
|
|
2697
1944
|
showLineNumbers: !0
|
|
2698
1945
|
})
|
|
2699
1946
|
})]
|
|
2700
|
-
}), e.sampleResponse && /* @__PURE__ */ c(
|
|
1947
|
+
}), e.sampleResponse && /* @__PURE__ */ c(k, {
|
|
2701
1948
|
label: "",
|
|
2702
|
-
children: /* @__PURE__ */ c(
|
|
1949
|
+
children: /* @__PURE__ */ c(L, {
|
|
2703
1950
|
code: e.sampleResponse,
|
|
2704
1951
|
language: "json"
|
|
2705
1952
|
})
|
|
@@ -2707,8 +1954,8 @@ var At = ({ request: e, onTryItOut: t }) => {
|
|
|
2707
1954
|
});
|
|
2708
1955
|
};
|
|
2709
1956
|
//#endregion
|
|
2710
|
-
//#region src/features/api-widget/
|
|
2711
|
-
function
|
|
1957
|
+
//#region src/features/api-widget/ApiPlayground.tsx
|
|
1958
|
+
function xt(e) {
|
|
2712
1959
|
let [n, r] = o(() => typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
2713
1960
|
return t(() => {
|
|
2714
1961
|
if (e !== "system") return;
|
|
@@ -2716,7 +1963,7 @@ function jt(e) {
|
|
|
2716
1963
|
return n(), t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
2717
1964
|
}, [e]), e === "system" ? n : e;
|
|
2718
1965
|
}
|
|
2719
|
-
function
|
|
1966
|
+
function St(e) {
|
|
2720
1967
|
try {
|
|
2721
1968
|
let t = new URL(e.url);
|
|
2722
1969
|
return `${e.method} ${t.pathname || "/"}`;
|
|
@@ -2724,7 +1971,7 @@ function Mt(e) {
|
|
|
2724
1971
|
return `${e.method} ${e.url || "/"}`;
|
|
2725
1972
|
}
|
|
2726
1973
|
}
|
|
2727
|
-
var
|
|
1974
|
+
var Ct = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__PURE__ */ l(k, {
|
|
2728
1975
|
label: "Invalid request",
|
|
2729
1976
|
children: [
|
|
2730
1977
|
/* @__PURE__ */ l("div", {
|
|
@@ -2732,11 +1979,11 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2732
1979
|
children: [/* @__PURE__ */ c("div", {
|
|
2733
1980
|
className: "text-sm font-medium text-content",
|
|
2734
1981
|
children: "cURL"
|
|
2735
|
-
}), t && n && /* @__PURE__ */ c(
|
|
1982
|
+
}), t && n && /* @__PURE__ */ c(g, {
|
|
2736
1983
|
size: "sm",
|
|
2737
1984
|
variant: "primary",
|
|
2738
1985
|
onClick: r,
|
|
2739
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1986
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
2740
1987
|
name: "download",
|
|
2741
1988
|
className: "h-4 w-4"
|
|
2742
1989
|
}),
|
|
@@ -2745,7 +1992,7 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2745
1992
|
}),
|
|
2746
1993
|
/* @__PURE__ */ c("div", {
|
|
2747
1994
|
className: "mt-4",
|
|
2748
|
-
children: /* @__PURE__ */ c(
|
|
1995
|
+
children: /* @__PURE__ */ c(L, {
|
|
2749
1996
|
code: e.trim() || "Paste or pass a cURL request with a URL.",
|
|
2750
1997
|
language: "bash",
|
|
2751
1998
|
showLineNumbers: !0
|
|
@@ -2757,28 +2004,28 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2757
2004
|
})
|
|
2758
2005
|
]
|
|
2759
2006
|
});
|
|
2760
|
-
function
|
|
2007
|
+
function $(e, t, n) {
|
|
2761
2008
|
return {
|
|
2762
2009
|
...e,
|
|
2763
|
-
title: t ??
|
|
2010
|
+
title: t ?? St(e),
|
|
2764
2011
|
sampleResponse: n
|
|
2765
2012
|
};
|
|
2766
2013
|
}
|
|
2767
|
-
var
|
|
2768
|
-
let p =
|
|
2014
|
+
var wt = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editable: s = !0, allowImport: l = !0, mode: u = "dark", syncSnippet: d = !1, customization: f }) => {
|
|
2015
|
+
let p = xt(u), [m, h] = o("idle"), [g, _] = o(e);
|
|
2769
2016
|
t(() => {
|
|
2770
2017
|
_(e);
|
|
2771
2018
|
}, [e]);
|
|
2772
2019
|
let v = i(() => {
|
|
2773
|
-
let e =
|
|
2774
|
-
return e ?
|
|
2020
|
+
let e = X(g);
|
|
2021
|
+
return e ? $(e, n, r) : null;
|
|
2775
2022
|
}, [
|
|
2776
2023
|
g,
|
|
2777
2024
|
n,
|
|
2778
2025
|
r
|
|
2779
2026
|
]), y = d ? g : e, b = i(() => {
|
|
2780
|
-
let e =
|
|
2781
|
-
return e ?
|
|
2027
|
+
let e = X(y);
|
|
2028
|
+
return e ? $(e, n, r) : null;
|
|
2782
2029
|
}, [
|
|
2783
2030
|
y,
|
|
2784
2031
|
n,
|
|
@@ -2786,7 +2033,7 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2786
2033
|
]), x = (e) => {
|
|
2787
2034
|
_(e), a?.(e);
|
|
2788
2035
|
}, S = (e) => {
|
|
2789
|
-
x(
|
|
2036
|
+
x(Q(e, "curl"));
|
|
2790
2037
|
}, C = (e, t) => {
|
|
2791
2038
|
x(t.trim()), h("console");
|
|
2792
2039
|
};
|
|
@@ -2799,23 +2046,23 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2799
2046
|
className: "bg-bg text-content text-left",
|
|
2800
2047
|
children: m === "import" ? /* @__PURE__ */ c("div", {
|
|
2801
2048
|
className: "motion-safe:animate-[widget-slide-in_180ms_ease-out]",
|
|
2802
|
-
children: /* @__PURE__ */ c(
|
|
2049
|
+
children: /* @__PURE__ */ c(ft, {
|
|
2803
2050
|
onImport: C,
|
|
2804
2051
|
onCancel: () => h(v ? "console" : "idle")
|
|
2805
2052
|
})
|
|
2806
2053
|
}, "import") : m === "console" && v ? /* @__PURE__ */ c("div", {
|
|
2807
2054
|
className: "motion-safe:animate-[widget-slide-in_180ms_ease-out]",
|
|
2808
|
-
children: /* @__PURE__ */ c(
|
|
2055
|
+
children: /* @__PURE__ */ c(Ye, {
|
|
2809
2056
|
request: v,
|
|
2810
2057
|
onRequestChange: S,
|
|
2811
2058
|
editable: s,
|
|
2812
2059
|
onBack: () => h("idle"),
|
|
2813
2060
|
onImport: l && s ? () => h("import") : void 0
|
|
2814
2061
|
})
|
|
2815
|
-
}, "console") : b ? /* @__PURE__ */ c(
|
|
2062
|
+
}, "console") : b ? /* @__PURE__ */ c(bt, {
|
|
2816
2063
|
request: b,
|
|
2817
2064
|
onTryItOut: () => h("console")
|
|
2818
|
-
}) : /* @__PURE__ */ c(
|
|
2065
|
+
}) : /* @__PURE__ */ c(Ct, {
|
|
2819
2066
|
request: y,
|
|
2820
2067
|
allowImport: l,
|
|
2821
2068
|
editable: s,
|
|
@@ -2824,4 +2071,4 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2824
2071
|
});
|
|
2825
2072
|
};
|
|
2826
2073
|
//#endregion
|
|
2827
|
-
export {
|
|
2074
|
+
export { Ye as ApiConsole, wt as ApiPlayground, ft as ImportCard, bt as RequestSnippet, pt as SNIPPET_LANGUAGES, V as executeWidgetRequest, Q as generateSnippet, mt as highlightFor, H as mockWidgetResponse, X as parseCurl, B as widgetErrorResponse };
|