PageSourceSearch

https://chucklechamp26-audio-diffusion-style-transfer.hf.space/assets/styles.db46e346.js

js chucklechamp26-audio-diffusion-style-transfer.hf.space collected 2026-10-03 10:21:44 UTC 6,211 bytes, 167 lines download raw bytes

1const get_style = (styles, key) => {
2  return style_handlers[key](styles[key]);
3};
4function get_styles(styles, allowed_styles) {
5  const processed_styles = allowed_styles.reduce((acc, next) => {
6    if (styles[next] === void 0 || !style_handlers[next])
7      acc[next] = " ";
8    else {
9      acc[next] = ` ${get_style(styles, next)} `;
10    }
11    return acc;
12  }, {});
13  processed_styles.classes = ` ${Object.values(processed_styles).join(" ").replace(/\s+/g, " ").trim()} `;
14  return processed_styles;
15}
16const style_handlers = {
17  rounded(rounded) {
18    let _style = Array.isArray(rounded) ? rounded : bool_to_tuple(rounded);
19    return tuple_to_class(_style, "!rounded-", ["tl", "tr", "br", "bl"], ["lg", "none"]);
20  },
21  border(border) {
22    let _style = Array.isArray(border) ? border : bool_to_tuple(border);
23    return tuple_to_class(_style, "!border-", ["t", "r", "b", "l"], [false, "0"]);
24  },
25  margin(margin) {
26    let _style = Array.isArray(margin) ? margin : bool_to_tuple(margin);
27    return tuple_to_class(_style, "!m", ["t", "r", "b", "l"], [false, "0"]);
28  },
29  container(container_visible) {
30    return container_visible ? "" : `!p-0 !m-0 !border-0 !shadow-none !overflow-visible !bg-transparent`;
31  },
32  label_container(visible) {
33    return visible ? "" : `!border-0 !shadow-none !overflow-visible !bg-transparent`;
34  },
35  grid(grid) {
36    let grid_map = ["", "sm:", "md:", "lg:", "xl:", "2xl:"];
37    let _grid = Array.isArray(grid) ? grid : [grid];
38    return [0, 0, 0, 0, 0, 0].map((_, i) => `${grid_map[i]}grid-cols-${_grid?.[i] || _grid?.[_grid?.length - 1]}`).join(" ");
39  },
40  height(height) {
41    return height === "auto" ? "auto" : "";
42  },
43  full_width(full_width) {
44    return full_width ? "!w-full" : "";
45  },
46  equal_height(equal_height) {
47    return equal_height ? "" : "unequal-height";
48  },
49  mobile_collapse(mobile_collapse) {
50    return mobile_collapse ? "flex-col" : "mobile-row";
51  },
52  visible(visible) {
53    return visible ? "" : "!hidden";
54  },
55  item_container(visible) {
56    return visible ? "" : "!border-none";
57  }
58};
59function bool_to_tuple(bool) {
60  return !!bool ? [true, true, true, true] : [false, false, false, false];
61}
62function tuple_to_class(tuple, prefix = "", position_map, condition_map) {
63  const [_true_class, _false_class] = condition_map;
64  return tuple.map((condition, i) => {
65    if (!_true_class && condition) {
66      return "";
67    } else if (!_false_class && !condition) {
68      return "";
69    }
70    const suffix = !condition_map[0] ? condition_map[1] : condition ? condition_map[0] : condition_map[1];
71    return `${prefix}${position_map[i]}-${suffix}`;
72  }).join(" ").replace(/\s+/g, " ").trim();
73}
74const create_classes = (styles, prefix = "") => {
75  let classes = [];
76  let target_styles = {};
77  if (prefix === "") {
78    target_styles = styles;
79  } else {
80    for (const prop in styles) {
81      if (prop.startsWith(prefix + "_")) {
82        const propname = prop.substring(prop.indexOf("_") + 1);
83        target_styles[propname] = styles[prop];
84      }
85    }
86  }
87  if (target_styles.hasOwnProperty("margin")) {
88    if (!Array.isArray(target_styles.margin)) {
89      target_styles.margin = !!target_styles.margin ? [true, true, true, true] : [false, false, false, false];
90    }
91    let margin_map = ["t", "r", "b", "l"];
92    target_styles.margin.forEach((margin, i) => {
93      if (!margin) {
94        classes.push(`!m${margin_map[i]}-0`);
95      }
96    });
97  }
98  if (target_styles.hasOwnProperty("border")) {
99    if (!Array.isArray(target_styles.border)) {
100      target_styles.border = !!target_styles.border ? [true, true, true, true] : [false, false, false, false];
101    }
102    let border_map = ["t", "r", "b", "l"];
103    target_styles.border.forEach((border, i) => {
104      if (!border) {
105        classes.push(`!border-${border_map[i]}-0`);
106      }
107    });
108  }
109  switch (target_styles.rounded) {
110    case true:
111      classes.push("!rounded-lg");
112      break;
113    case false:
114      classes.push("!rounded-none");
115      break;
116  }
117  switch (target_styles.full_width) {
118    case true:
119      classes.push("!w-full");
120      break;
121  }
122  switch (target_styles.text_color) {
123    case "red":
124      classes.push("!text-red-500", "dark:text-red-100");
125      break;
126    case "yellow":
127      classes.push("!text-yellow-500", "dark:text-yellow-100");
128      break;
129    case "green":
130      classes.push("!text-green-500", "dark:text-green-100");
131      break;
132    case "blue":
133      classes.push("!text-blue-500", "dark:text-blue-100");
134      break;
135    case "purple":
136      classes.push("!text-purple-500", "dark:text-purple-100");
137      break;
138    case "black":
139      classes.push("!text-gray-700", "dark:text-gray-50");
140      break;
141  }
142  switch (target_styles.bg_color) {
143    case "red":
144      classes.push("!bg-red-100 !from-red-100 !to-red-200 !border-red-300", "dark:!bg-red-700 dark:!from-red-700 dark:!to-red-800 dark:!border-red-900");
145      break;
146    case "yellow":
147      classes.push("!bg-yellow-100 !from-yellow-100 !to-yellow-200 !border-yellow-300", "dark:!bg-yellow-700 dark:!from-yellow-700 dark:!to-yellow-800 dark:!border-yellow-900");
148      break;
149    case "green":
150      classes.push("!bg-green-100 !from-green-100 !to-green-200 !border-green-300", "dark:!bg-green-700 dark:!from-green-700 dark:!to-green-800 dark:!border-green-900  !text-gray-800");
151      break;
152    case "blue":
153      classes.push("!bg-blue-100 !from-blue-100 !to-blue-200 !border-blue-300", "dark:!bg-blue-700 dark:!from-blue-700 dark:!to-blue-800 dark:!border-blue-900");
154      break;
155    case "purple":
156      classes.push("!bg-purple-100 !from-purple-100 !to-purple-200 !border-purple-300", "dark:!bg-purple-700 dark:!from-purple-700 dark:!to-purple-800 dark:!border-purple-900");
157      break;
158    case "black":
159      classes.push("!bg-gray-100 !from-gray-100 !to-gray-200 !border-gray-300", "dark:!bg-gray-700 dark:!from-gray-700 dark:!to-gray-800 dark:!border-gray-900");
160    case "pink":
161      classes.push("!bg-pink-100 !from-pink-100 !to-pink-200 !border-pink-300", "dark:!bg-pink-700 dark:!from-pink-700 dark:!to-pink-800 dark:!border-pink-900 !text-gray-800");
162      break;
163  }
164  return " " + classes.join(" ");
165};
166
167export { create_classes as c, get_styles as g };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.