create-prisma-php-app 1.19.502 → 1.20.1

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.
@@ -456,29 +456,62 @@ function convertToArrayObject($data)
456
456
  function wireCallback()
457
457
  {
458
458
  try {
459
- // Read input data
460
- $input = file_get_contents('php://input');
461
- $data = json_decode($input, true);
462
-
463
459
  // Initialize response
464
460
  $response = [
465
461
  'success' => false,
466
462
  'error' => 'Callback not provided',
467
- 'data' => $data
463
+ 'data' => null
468
464
  ];
469
465
 
470
466
  $callbackResponse = null;
467
+ $data = [];
468
+
469
+ // Check if the request includes one or more files
470
+ $hasFile = isset($_FILES['file']) && !empty($_FILES['file']['name'][0]);
471
+
472
+ // Process form data
473
+ if ($hasFile) {
474
+ // Handle file upload, including multiple files
475
+ $data = $_POST; // Form data will be available in $_POST
476
+
477
+ if (is_array($_FILES['file']['name'])) {
478
+ // Multiple files uploaded
479
+ $files = [];
480
+ foreach ($_FILES['file']['name'] as $index => $name) {
481
+ $files[] = [
482
+ 'name' => $name,
483
+ 'type' => $_FILES['file']['type'][$index],
484
+ 'tmp_name' => $_FILES['file']['tmp_name'][$index],
485
+ 'error' => $_FILES['file']['error'][$index],
486
+ 'size' => $_FILES['file']['size'][$index],
487
+ ];
488
+ }
489
+ $data['files'] = $files;
490
+ } else {
491
+ // Single file uploaded
492
+ $data['file'] = $_FILES['file']; // Attach single file information to data
493
+ }
494
+ } else {
495
+ // Handle non-file form data (likely JSON)
496
+ $input = file_get_contents('php://input');
497
+ $data = json_decode($input, true);
498
+
499
+ if (json_last_error() !== JSON_ERROR_NONE) {
500
+ // Fallback to handle form data in POST (non-JSON)
501
+ $data = $_POST;
502
+ }
503
+ }
471
504
 
472
505
  // Validate and call the dynamic function
473
506
  if (isset($data['callback'])) {
474
507
  // Sanitize and create a dynamic function name
475
- $callbackName = preg_replace('/[^a-zA-Z0-9_]/', '', $data['callback']); // Sanitize
508
+ $callbackName = preg_replace('/[^a-zA-Z0-9_]/', '', $data['callback']); // Sanitize the callback name
476
509
 
477
510
  // Check if the dynamic function is defined and callable
478
511
  if (function_exists($callbackName) && is_callable($callbackName)) {
479
512
  $dataObject = convertToArrayObject($data);
480
513
 
481
- // Call the anonymous function dynamically
514
+ // Call the function dynamically
482
515
  $callbackResponse = call_user_func($callbackName, $dataObject);
483
516
 
484
517
  // Handle different types of responses
@@ -499,6 +532,8 @@ function wireCallback()
499
532
  // Invalid callback provided
500
533
  $response['error'] = 'Invalid callback';
501
534
  }
535
+ } else {
536
+ $response['error'] = 'No callback provided';
502
537
  }
503
538
 
504
539
  // Output the JSON response only if the callbackResponse is not null
@@ -506,7 +541,7 @@ function wireCallback()
506
541
  echo json_encode($response);
507
542
  }
508
543
  } catch (Throwable $e) {
509
- // Handle any exceptions and prepare error response
544
+ // Handle any exceptions and prepare an error response
510
545
  $response = [
511
546
  'success' => false,
512
547
  'error' => 'Exception occurred',
@@ -32,6 +32,7 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
32
32
  $domainName = $_SERVER['HTTP_HOST'];
33
33
  $scriptName = dirname($_SERVER['SCRIPT_NAME']) . '/';
34
34
  $baseUrl = $protocol . $domainName . rtrim($scriptName, '/') . '/src/app/';
35
+ $documentUrl = $protocol . $domainName . rtrim($scriptName, '/') . '/';
35
36
  $referer = $_SERVER['HTTP_REFERER'] ?? 'Unknown';
36
37
 
37
38
  $params = [];
@@ -248,7 +248,8 @@ class Auth
248
248
  public function getPayload()
249
249
  {
250
250
  if (isset($_SESSION[self::PAYLOAD])) {
251
- return $_SESSION[self::PAYLOAD][self::PAYLOAD_NAME];
251
+ $value = $_SESSION[self::PAYLOAD][self::PAYLOAD_NAME];
252
+ return is_array($value) ? new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS) : $value;
252
253
  }
253
254
 
254
255
  return null;
@@ -0,0 +1,361 @@
1
+ <?php
2
+
3
+ namespace Lib\FileManager;
4
+
5
+ class UploadFile
6
+ {
7
+ protected string $destination;
8
+ protected array $messages = [];
9
+ protected array $errorCode = [];
10
+ protected int $maxSize = 51200; // 50KB default
11
+ protected array $permittedTypes = [
12
+ 'image/jpeg',
13
+ 'image/pjpeg',
14
+ 'image/gif',
15
+ 'image/png',
16
+ 'image/webp'
17
+ ];
18
+ protected string $newName = '';
19
+ protected bool $typeCheckingOn = true;
20
+ protected array $notTrusted = ['bin', 'cgi', 'exe', 'js', 'pl', 'php', 'py', 'sh'];
21
+ protected string $suffix = '.upload';
22
+ protected bool $renameDuplicates;
23
+
24
+ /**
25
+ * Constructor for the UploadFile class.
26
+ *
27
+ * @param string $uploadFolder The folder to which uploaded files will be moved.
28
+ * @throws \Exception If the upload folder is not a valid, writable folder.
29
+ */
30
+ public function __construct(string $uploadFolder)
31
+ {
32
+ if (!is_dir($uploadFolder) || !is_writable($uploadFolder)) {
33
+ throw new \Exception("$uploadFolder must be a valid, writable folder.");
34
+ }
35
+ // Ensure the folder ends with a '/'
36
+ $this->destination = rtrim($uploadFolder, '/') . '/';
37
+ }
38
+
39
+ /**
40
+ * Sets the maximum size for uploaded files.
41
+ *
42
+ * @param int $bytes The maximum size in bytes.
43
+ * @return void
44
+ */
45
+ public function setMaxSize(int $bytes): void
46
+ {
47
+ $serverMax = self::convertToBytes(ini_get('upload_max_filesize'));
48
+ if ($bytes > $serverMax) {
49
+ throw new \Exception('Maximum size cannot exceed server limit for individual files: ' . self::convertFromBytes($serverMax));
50
+ }
51
+ if ($bytes > 0) {
52
+ $this->maxSize = $bytes;
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Converts a string value representing a file size to bytes.
58
+ *
59
+ * @param string $val The string value representing the file size.
60
+ * @return int The file size in bytes.
61
+ */
62
+ public static function convertToBytes(string $val): int
63
+ {
64
+ $val = trim($val);
65
+ $last = strtolower($val[strlen($val) - 1]);
66
+ $multiplier = match ($last) {
67
+ 'g' => 1024 * 1024 * 1024,
68
+ 'm' => 1024 * 1024,
69
+ 'k' => 1024,
70
+ default => 1,
71
+ };
72
+ return (int) $val * $multiplier;
73
+ }
74
+
75
+ /**
76
+ * Converts the given number of bytes to a human-readable string representation.
77
+ *
78
+ * @param int $bytes The number of bytes to convert.
79
+ * @return string The human-readable string representation of the converted bytes.
80
+ */
81
+ public static function convertFromBytes(int $bytes): string
82
+ {
83
+ return $bytes >= 1024 * 1024
84
+ ? number_format($bytes / (1024 * 1024), 1) . ' MB'
85
+ : number_format($bytes / 1024, 1) . ' KB';
86
+ }
87
+
88
+ /**
89
+ * Disable type checking and set the allowed file types.
90
+ *
91
+ * @param string|null $suffix The file suffix to allow. If null, the current suffix will be used.
92
+ * @return void
93
+ */
94
+ public function allowAllTypes(?string $suffix = null): void
95
+ {
96
+ $this->typeCheckingOn = false;
97
+ $this->suffix = $suffix ? (strpos($suffix, '.') === 0 ? $suffix : ".$suffix") : $this->suffix;
98
+ }
99
+
100
+ /**
101
+ * Uploads file(s) to the server.
102
+ *
103
+ * @param bool $renameDuplicates (optional) Whether to rename duplicate files. Default is true.
104
+ * @return void
105
+ */
106
+ public function upload(bool $renameDuplicates = true): void
107
+ {
108
+ $this->renameDuplicates = $renameDuplicates;
109
+ if (empty($_FILES) || !is_array(current($_FILES))) {
110
+ // No file was uploaded or the structure is invalid, handle this as an error
111
+ $this->messages[] = "No files were uploaded.";
112
+ $this->errorCode[] = UPLOAD_ERR_NO_FILE;
113
+ return;
114
+ }
115
+
116
+ $uploaded = current($_FILES);
117
+
118
+ // Handle single and multiple file uploads using a unified approach
119
+ $files = is_array($uploaded['name']) ? $this->rearrangeFilesArray($uploaded) : [$uploaded];
120
+
121
+ foreach ($files as $file) {
122
+ if ($this->checkFile($file)) {
123
+ $this->moveFile($file);
124
+ }
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Updates an existing file by deleting the old file and uploading the new one, using the old file's name.
130
+ *
131
+ * @param array $file The new file information from $_FILES.
132
+ * @param string $oldFilename The name of the file to be replaced.
133
+ * @return bool True if the update was successful, false otherwise.
134
+ */
135
+ public function update(array $file, string $oldFilename): bool
136
+ {
137
+ // First, delete the old file
138
+ if (!$this->delete($oldFilename)) {
139
+ $this->messages[] = "Failed to delete the old file $oldFilename. Update aborted.";
140
+ $this->errorCode[] = UPLOAD_ERR_CANT_WRITE; // Error code for failure to update
141
+ return false;
142
+ }
143
+
144
+ // Now proceed to upload the new file with the old filename
145
+ if ($this->checkFile($file)) {
146
+ // Set the new file name to match the old file's name
147
+ $this->newName = $oldFilename;
148
+ $this->moveFile($file);
149
+ return true;
150
+ }
151
+
152
+ return false;
153
+ }
154
+
155
+ /**
156
+ * Renames a file in the destination folder.
157
+ *
158
+ * @param string $oldName The current name of the file.
159
+ * @param string $newName The new name for the file.
160
+ * @return bool True if the rename was successful, false otherwise.
161
+ */
162
+ public function rename(string $oldName, string $newName): bool
163
+ {
164
+ $oldPath = $this->destination . $oldName;
165
+
166
+ // Extract the file extension from the old file
167
+ $extension = pathinfo($oldName, PATHINFO_EXTENSION);
168
+
169
+ // Add the extension to the new name
170
+ $newNameWithExtension = str_replace(' ', '_', $newName) . '.' . $extension;
171
+ $newPath = $this->destination . $newNameWithExtension;
172
+
173
+ // Check if the file exists
174
+ if (!file_exists($oldPath)) {
175
+ $this->messages[] = "File $oldName does not exist.";
176
+ $this->errorCode[] = UPLOAD_ERR_NO_FILE; // Error code for file not found
177
+ return false;
178
+ }
179
+
180
+ // Validate that the new name doesn't already exist
181
+ if (file_exists($newPath)) {
182
+ $this->messages[] = "A file with the name $newNameWithExtension already exists.";
183
+ $this->errorCode[] = UPLOAD_ERR_CANT_WRITE; // Error code for name conflict
184
+ return false;
185
+ }
186
+
187
+ // Attempt to rename the file
188
+ if (rename($oldPath, $newPath)) {
189
+ $this->messages[] = "File $oldName renamed successfully to $newNameWithExtension";
190
+ $this->errorCode[] = 0; // Success code
191
+ return true;
192
+ } else {
193
+ $this->messages[] = "Failed to rename $oldName to $newNameWithExtension";
194
+ $this->errorCode[] = UPLOAD_ERR_CANT_WRITE; // Error code for rename failure
195
+ return false;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Deletes a file from the destination folder.
201
+ *
202
+ * @param string $filename The name of the file to delete.
203
+ * @return bool True if the file was deleted, false otherwise.
204
+ */
205
+ public function delete(string $filename): bool
206
+ {
207
+ $filePath = $this->destination . $filename;
208
+
209
+ if (!file_exists($filePath)) {
210
+ $this->messages[] = "File $filename does not exist.";
211
+ $this->errorCode[] = UPLOAD_ERR_NO_FILE; // Error code for file not found
212
+ return false;
213
+ }
214
+
215
+ if (unlink($filePath)) {
216
+ $this->messages[] = "File $filename deleted successfully.";
217
+ $this->errorCode[] = 0; // Success code
218
+ return true;
219
+ } else {
220
+ $this->messages[] = "Failed to delete $filename.";
221
+ $this->errorCode[] = UPLOAD_ERR_CANT_WRITE; // Error code for failure to delete
222
+ return false;
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Retrieves the messages associated with the file upload.
228
+ *
229
+ * @return array The array of messages.
230
+ */
231
+ public function getMessages(): array
232
+ {
233
+ return $this->messages;
234
+ }
235
+
236
+ /**
237
+ * Retrieves the error codes associated with the file upload.
238
+ *
239
+ * @return array The array of error codes.
240
+ */
241
+ public function getErrorCode(): array
242
+ {
243
+ return $this->errorCode;
244
+ }
245
+
246
+ protected function checkFile(array $file): bool
247
+ {
248
+ if ($file['error'] !== UPLOAD_ERR_OK) {
249
+ $this->getErrorMessage($file);
250
+ return false;
251
+ }
252
+ if (!$this->checkSize($file) || ($this->typeCheckingOn && !$this->checkType($file))) {
253
+ return false;
254
+ }
255
+ $this->checkName($file);
256
+ return true;
257
+ }
258
+
259
+ protected function getErrorMessage(array $file): void
260
+ {
261
+ $errorMessages = [
262
+ UPLOAD_ERR_INI_SIZE => $file['name'] . ' exceeds the maximum size: ' . self::convertFromBytes($this->maxSize),
263
+ UPLOAD_ERR_FORM_SIZE => $file['name'] . ' exceeds the form limit.',
264
+ UPLOAD_ERR_PARTIAL => $file['name'] . ' was only partially uploaded.',
265
+ UPLOAD_ERR_NO_FILE => 'No file submitted.',
266
+ ];
267
+
268
+ $this->errorCode = $file['error'];
269
+ $this->messages[] = $errorMessages[$file['error']] ?? 'Problem uploading ' . $file['name'];
270
+ }
271
+
272
+ protected function checkSize(array $file): bool
273
+ {
274
+ if ($file['size'] == 0) {
275
+ $this->messages[] = $file['name'] . ' is empty.';
276
+ $this->errorCode[] = UPLOAD_ERR_NO_FILE; // Log an error code for empty files
277
+ return false;
278
+ }
279
+ if ($file['size'] > $this->maxSize) {
280
+ $this->messages[] = $file['name'] . ' exceeds the maximum size: ' . self::convertFromBytes($this->maxSize);
281
+ $this->errorCode[] = UPLOAD_ERR_INI_SIZE; // Log an error code for exceeding size
282
+ return false;
283
+ }
284
+ return true;
285
+ }
286
+
287
+ protected function checkType(array $file): bool
288
+ {
289
+ if (!in_array($file['type'], $this->permittedTypes)) {
290
+ $this->messages[] = $file['name'] . ' is not a permitted type.';
291
+ $this->errorCode[] = UPLOAD_ERR_EXTENSION; // Log an error code for invalid file type
292
+ return false;
293
+ }
294
+ return true;
295
+ }
296
+
297
+ protected function checkName(array $file): void
298
+ {
299
+ $name = str_replace(' ', '_', $file['name']);
300
+ $nameParts = pathinfo($name);
301
+ $extension = $nameParts['extension'] ?? '';
302
+
303
+ // Handle trusted vs untrusted extensions
304
+ if (!$this->typeCheckingOn && (in_array($extension, $this->notTrusted) || empty($extension))) {
305
+ $this->newName = $name . $this->suffix;
306
+ }
307
+
308
+ // Rename duplicates if necessary
309
+ if ($this->renameDuplicates) {
310
+ $existingFiles = scandir($this->destination);
311
+ $originalName = $name;
312
+ $i = 1;
313
+
314
+ while (in_array($name, $existingFiles)) {
315
+ $name = "{$nameParts['filename']}_$i." . ($extension ?: ''); // Maintain the extension if available
316
+ $i++;
317
+ }
318
+
319
+ $this->newName = $name;
320
+ } else {
321
+ $this->newName = $name;
322
+ }
323
+ }
324
+
325
+ protected function moveFile(array $file): void
326
+ {
327
+ // Ensure the newName is set or fallback to the original file name
328
+ $filename = $this->newName ?: $file['name'];
329
+ $destination = $this->destination . $filename;
330
+ $success = move_uploaded_file($file['tmp_name'], $destination);
331
+
332
+ if ($success) {
333
+ $message = "{$file['name']} uploaded successfully.";
334
+ if ($this->newName && $this->newName !== $file['name']) {
335
+ $message .= " Renamed to {$this->newName}";
336
+ }
337
+ } else {
338
+ $message = "Failed to upload {$file['name']}.";
339
+ }
340
+
341
+ $this->messages[] = $message;
342
+ // Add a success/error code for file move
343
+ $this->errorCode[] = $success ? 0 : UPLOAD_ERR_CANT_WRITE; // 0 for success, error code for failure
344
+ }
345
+
346
+ // Utility function to restructure the $_FILES array for multiple uploads
347
+ protected function rearrangeFilesArray(array $files): array
348
+ {
349
+ $rearranged = [];
350
+ foreach ($files['name'] as $key => $name) {
351
+ $rearranged[] = [
352
+ 'name' => $files['name'][$key],
353
+ 'type' => $files['type'][$key],
354
+ 'tmp_name' => $files['tmp_name'][$key],
355
+ 'error' => $files['error'][$key],
356
+ 'size' => $files['size'][$key],
357
+ ];
358
+ }
359
+ return $rearranged;
360
+ }
361
+ }
@@ -104,10 +104,23 @@ class StateManager
104
104
 
105
105
  /**
106
106
  * Resets the application state to an empty array.
107
+ *
108
+ * @param string|null $key The key of the state value to reset.
107
109
  */
108
- public function resetState(): void
110
+ public function resetState(string $key = null): void
109
111
  {
110
- $this->state = [];
112
+ if ($key !== null) {
113
+ if (array_key_exists($key, $this->state)) {
114
+ $this->state[$key] = null;
115
+
116
+ if (array_key_exists($key, $GLOBALS)) {
117
+ $GLOBALS[$key] = null;
118
+ }
119
+ }
120
+ } else {
121
+ $this->state = [];
122
+ }
123
+
111
124
  $this->notifyListeners();
112
125
  $this->saveState();
113
126
  }
@@ -533,6 +533,14 @@ final class Validator
533
533
  return true;
534
534
  }
535
535
  break;
536
+ case 'extensions':
537
+ $extensions = explode(',', $parameter);
538
+ if (!self::isExtensionAllowed($value, $extensions)) {
539
+ return "The file must have one of the following extensions: " . implode(', ', $extensions) . ".";
540
+ } else {
541
+ return true;
542
+ }
543
+ break;
536
544
  case 'mimes':
537
545
  $mimeTypes = explode(',', $parameter);
538
546
  if (!self::isMimeTypeAllowed($value, $mimeTypes)) {
@@ -554,6 +562,29 @@ final class Validator
554
562
  }
555
563
  }
556
564
 
565
+ /**
566
+ * Check if a file's extension is in the list of allowed extensions.
567
+ *
568
+ * @param string $file The path or filename of the file.
569
+ * @param array $allowedExtensions The list of allowed extensions.
570
+ * @return bool True if the extension is allowed, false otherwise.
571
+ */
572
+ private static function isExtensionAllowed($file, array $allowedExtensions): bool
573
+ {
574
+ // Extract the file extension
575
+ $fileExtension = pathinfo($file, PATHINFO_EXTENSION);
576
+
577
+ // Check if the extension is in the allowed list
578
+ return in_array(strtolower($fileExtension), array_map('strtolower', $allowedExtensions), true);
579
+ }
580
+
581
+ /**
582
+ * Check if a file's MIME type is in the list of allowed MIME types.
583
+ *
584
+ * @param string $file The path or filename of the file.
585
+ * @param array $allowedMimeTypes The list of allowed MIME types.
586
+ * @return bool True if the MIME type is allowed, false otherwise.
587
+ */
557
588
  private static function isMimeTypeAllowed($file, array $allowedMimeTypes)
558
589
  {
559
590
  // Check if the file is a valid uploaded file
@@ -1 +1 @@
1
- var eventAttributesB6B56=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onwheel","onkeypress","onkeydown","onkeyup","onfocus","onblur","onchange","oninput","onselect","onsubmit","onreset","onresize","onscroll","onload","onunload","onabort","onerror","onbeforeunload","oncopy","oncut","onpaste","ondrag","ondragstart","ondragend","ondragover","ondragenter","ondragleave","ondrop","oncontextmenu","ontouchstart","ontouchmove","ontouchend","ontouchcancel","onpointerdown","onpointerup","onpointermove","onpointerover","onpointerout","onpointerenter","onpointerleave","onpointercancel"],stateA129A={checkedElements:new Set},responseDataDEAC2=null,store=null,isNavigatingA12E1=!1,redirectRegex3AE99=/redirect_7F834=(.+)/;function attachWireFunctionEvents(){handleHiddenAttribute();document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((e=>{if(handleAnchorTag(e),eventAttributesB6B56.forEach((t=>{const n=e.getAttribute(t),s=t.slice(2);n&&(e.removeAttribute(t),handleDebounce(e,s,n))})),e instanceof HTMLFormElement){const t=e.getAttribute("onsubmit");t&&(e.removeAttribute("onsubmit"),handleDebounce(e,"submit",t))}})),initializePpOnListeners()}function hasPpOnAttribute(e){const t=e.attributes;if(!t)return!1;for(let e=0;e<t.length;e++){const n=t[e].name;if(n.startsWith("pp-on:")||n.startsWith("data-pp-on:")||n.startsWith("pp-on-")||n.startsWith("data-pp-on-"))return!0}return!1}function findAllPpOnElements(e){const t=[];if(hasPpOnAttribute(e)&&t.push(e),document.evaluate){const n=document.evaluate('.//*[@*[starts-with(name(), "pp-on:") or starts-with(name(), "data-pp-on:") or starts-with(name(), "pp-on-") or starts-with(name(), "data-pp-on-")]]',e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);let s=n.iterateNext();for(;s;)t.push(s),s=n.iterateNext()}else if("function"==typeof e.getElementsByTagName){const n=e.getElementsByTagName("*");for(let e=0;e<n.length;e++)hasPpOnAttribute(n[e])&&t.push(n[e])}return t}function initializePpOnListeners(){findAllPpOnElements(document).forEach((e=>{Array.from(e.attributes).forEach((t=>{if(t.name.startsWith("pp-on:")){const n=t.name.split(":")[1],s=t.value;s&&e.addEventListener(n,(t=>{try{new Function("event",s).call(e,t)}catch(e){}}))}}))}))}function handleHiddenAttribute(){const e=document.querySelectorAll("[pp-visibility]"),t=document.querySelectorAll("[pp-display]");e.forEach((e=>handleVisibilityElementAttribute(e,"pp-visibility",handleElementVisibility))),t.forEach((e=>handleVisibilityElementAttribute(e,"pp-display",handleElementDisplay)))}function handleVisibilityElementAttribute(e,t,n){const s=e.getAttribute(t);if(s)if(isJsonLike(s)){n(e,parseJson(s))}else{const n=parseTime(s);if(n>0){const s="pp-visibility"===t?"visibility":"display";scheduleChange(e,n,s,"visibility"===s?"hidden":"none")}}}function isJsonLike(e){return(e=e.trim()).startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")}function handleElementVisibility(e,t){handleElementChange(e,t,"visibility","hidden","visible")}function handleElementDisplay(e,t){handleElementChange(e,t,"display","none","block")}function handleElementChange(e,t,n,s,a){const o=t.start?parseTime(t.start):0,i=t.end?parseTime(t.end):0;o>0?(e.style[n]=s,scheduleChange(e,o,n,a),i>0&&scheduleChange(e,o+i,n,s)):i>0&&scheduleChange(e,i,n,s)}function scheduleChange(e,t,n,s){setTimeout((()=>{requestAnimationFrame((()=>{e.style[n]=s}))}),t)}function parseTime(e){if("number"==typeof e)return e;const t=e.match(/^(\d+)(ms|s|m)?$/);if(t){const e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":return e;case"s":return 1e3*e;case"m":return 60*e*1e3;default:return e}}return 0}async function handleDebounce(e,t,n){const s=e.getAttribute("pp-debounce")||"",a=e.getAttribute("pp-before-request")||"",o=e.getAttribute("pp-after-request")||"",i=async t=>{t.preventDefault();try{a&&await invokeHandler(e,a,t),await invokeHandler(e,n,t),o&&"@close"!==o&&await invokeHandler(e,o,t),handlerAutofocusAttribute()}catch(e){}};if(s){const n=debounce(i,parseTime(s));e instanceof HTMLFormElement&&"submit"===t?e.addEventListener(t,(e=>{e.preventDefault(),n(e)})):e.addEventListener(t,n)}else e.addEventListener(t,i)}function handlerAutofocusAttribute(){const e=document.querySelectorAll("[pp-autofocus]");let t=!1;e.forEach((e=>{if(t)return;const n=e.getAttribute("pp-autofocus");if(!n||!isJsonLike(n))return;const s=parseJson(n);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)if("number"===e.type&&e instanceof HTMLInputElement){e.type="text";const t=e.value.length||0;e.setSelectionRange(t,t),e.type="number"}else if(s.start)e.setSelectionRange(0,0);else if(s.end){const t=e.value.length||0;e.setSelectionRange(t,t)}else if(s.length){const t=parseInt(s.length,10)||0;e.setSelectionRange(t,t)}e.focus(),t=!0}))}async function invokeHandler(e,t,n){try{const s=t.match(/^(\w+(\.\w+)*)\((.*)\)$/);if(s){const a=s[1].split("."),{context:o,methodName:i}=resolveContext(a);"function"==typeof o[i]?new Function("event",t).call(e,n):await handleParsedCallback(e,t)}else await handleParsedCallback(e,t)}catch(e){}}function resolveContext(e){let t=window;for(let n=0;n<e.length-1;n++)if(t=t[e[n]],!t)throw new Error(`Cannot find object ${e[n]} in the context.`);return{context:t,methodName:e[e.length-1]}}async function handleParsedCallback(e,t){const{funcName:n,data:s}=parseCallback(e,t);if(!n)return;const a=window[n];if("function"==typeof a){const t=e.hasAttribute("pp-after-request"),n=Array.isArray(s.args)?s.args:[],o=responseDataDEAC2?parseJson(responseDataDEAC2):{response:responseDataDEAC2};let i={args:n,element:e,data:s};t&&(i={...i,...o}),await a(i)}else responseDataDEAC2=null,responseDataDEAC2=await handleUndefinedFunction(e,n,s)}function handleAnchorTag(e){e instanceof HTMLAnchorElement&&e.addEventListener("click",(async e=>{const t=e.currentTarget,n=t.getAttribute("href"),s=t.getAttribute("target");if(n&&"_blank"!==s&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),!isNavigatingA12E1)){isNavigatingA12E1=!0;try{if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else{const e=t.getAttribute("pp-append-params");if(n.startsWith("?")&&"true"===e){const e=new URL(window.location.href),t=new URLSearchParams(e.search);let s="";const[a,o]=n.split("#");o&&(s=`#${o}`);new URLSearchParams(a.split("?")[1]).forEach(((e,n)=>{t.set(n,e)}));const i=`${e.pathname}?${t.toString()}${s}`;history.pushState(null,"",i)}else{const[e,t]=n.split("#"),s=`${e}${t?`#${t}`:""}`;history.pushState(null,"",s)}const s=n.indexOf("#");if(-1!==s){const e=n.slice(s+1),t=document.getElementById(e);if(t)t.scrollIntoView({behavior:"smooth"});else{await handleNavigation();const t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})}}else await handleNavigation()}}catch(e){}finally{isNavigatingA12E1=!1}}}))}async function handleNavigation(){try{const e=e=>{const t=e.querySelector("[pp-loading-transition]")?.getAttribute("pp-loading-transition");let n=250,s=250;if(t)try{const e=parseJson(t);n=parseTime(e.fadeIn||n),s=parseTime(e.fadeOut||s)}catch(e){}return{fadeIn:n,fadeOut:s}},t=(e,t)=>new Promise((n=>{e.style.transition=`opacity ${t}ms ease-out`,e.style.opacity="0",setTimeout((()=>{e.style.transition="",n()}),t)})),n=(e,t)=>{e.style.transition=`opacity ${t}ms ease-in`,e.style.opacity="1",setTimeout((()=>{e.style.transition=""}),t)},s=async s=>{const a=document.querySelector("[pp-loading-content='true']")||document.body;if(a){const{fadeIn:o,fadeOut:i}=e(s);await t(a,i),a.innerHTML=s.innerHTML,n(a,o)}},a=window.location.pathname,o=document.getElementById("loading-file-1B87E");if(o){let e=o.querySelector(`div[pp-loading-url='${a}']`);e||(e=o.querySelector("div[pp-loading-url='/']")),e&&await s(e)}const i=await pphpFetch(window.location.href),r=i.match(redirectRegex3AE99);if(r&&r[1]){const e=r[1];await handleRedirect(e)}else updateDocumentContent(i)}catch(e){}}function onUrlChange(){}function updateDocumentContent(e){const t=saveScrollPositions();if(document.removeAllEventListeners("DOMContentLoaded"),e.includes("<!DOCTYPE html>")){const t=e=>{Array.from(e.head.children).forEach((e=>{const t=e.tagName;if("META"===t){if(e.getAttribute("charset")||"viewport"===e.getAttribute("name"))return;const t=e.name,n=e.getAttribute("property"),s=document.head.querySelector(t?`meta[name="${t}"]`:`meta[property="${n}"]`);s?document.head.replaceChild(e.cloneNode(!0),s):document.head.appendChild(e.cloneNode(!0))}else if("TITLE"===t){const t=document.head.querySelector("title");t?document.head.replaceChild(e.cloneNode(!0),t):document.head.appendChild(e.cloneNode(!0))}else if("LINK"===t){const t=t=>{const n=document.head.querySelector('link[rel="icon"]');if(n)document.head.replaceChild(e.cloneNode(!0),n);else{const e=document.createElement("link");e.rel="icon",e.href=t,document.head.appendChild(e)}};if("icon"===e.getAttribute("rel")){t(e.href)}}})),loadAndValidateContent(e)};t((new DOMParser).parseFromString(e,"text/html"))}else{saveState();loadAndValidateContent((new DOMParser).parseFromString(e,"text/html")),restoreState()}restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("DOMContentLoaded"))}function loadAndValidateContent(e){const t=new Map,n=document.createDocumentFragment();function s(e,n){let a=null;if("SCRIPT"===e.tagName){const t=document.createElement("script"),n=e;n.src?(t.src=n.src,t.async=!1):t.textContent=n.textContent,a=t}else a=e.cloneNode(!1),t.set(e,a),Array.from(e.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE?a.appendChild(document.createTextNode(e.textContent||"")):e.nodeType===Node.ELEMENT_NODE&&s(e,a)}));n.appendChild(a)}Array.from(e.body.children).forEach((e=>{s(e,n)})),document.body.innerHTML="",document.body.appendChild(n)}function saveState(){const e=document.activeElement;stateA129A.focusId=e?.id||e?.name,stateA129A.focusValue=e?.value,stateA129A.focusChecked=e?.checked,stateA129A.focusType=e?.type,stateA129A.focusSelectionStart=e?.selectionStart,stateA129A.focusSelectionEnd=e?.selectionEnd,stateA129A.isSuspense=e.hasAttribute("pp-suspense"),stateA129A.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((e=>{stateA129A.checkedElements.add(e.id||e.name)})),document.querySelectorAll('input[type="radio"]:checked').forEach((e=>{stateA129A.checkedElements.add(e.id||e.name)}))}function restoreState(){if(stateA129A.focusId){const e=document.getElementById(stateA129A.focusId)||document.querySelector(`[name="${stateA129A.focusId}"]`);if(e instanceof HTMLInputElement){const t=e.value.length||0;void 0!==stateA129A.focusSelectionStart&&null!==stateA129A.focusSelectionEnd&&e.setSelectionRange(t,t),stateA129A.focusValue&&("checkbox"===e.type||"radio"===e.type?e.checked=!!stateA129A.focusChecked:"number"===e.type?(e.type="text",e.setSelectionRange(t,t),e.type="number"):""!==e.value&&(e.value=stateA129A.focusValue)),e.focus()}else if(e instanceof HTMLTextAreaElement){const t=e.value.length||0;void 0!==stateA129A.focusSelectionStart&&null!==stateA129A.focusSelectionEnd&&e.setSelectionRange(t,t),stateA129A.focusValue&&""!==e.value&&(e.value=stateA129A.focusValue),e.focus()}else e instanceof HTMLSelectElement&&(stateA129A.focusValue&&""!==e.value&&(e.value=stateA129A.focusValue),e.focus())}stateA129A.checkedElements.forEach((e=>{const t=document.getElementById(e);t&&(t.checked=!0)}))}function saveScrollPositions(){const e={};return document.querySelectorAll("*").forEach((t=>{(t.scrollTop||t.scrollLeft)&&(e[getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})})),e}function restoreScrollPositions(e){document.querySelectorAll("*").forEach((t=>{const n=getElementKey(t);e[n]&&(t.scrollTop=e[n].scrollTop,t.scrollLeft=e[n].scrollLeft)}))}function getElementKey(e){return e.id||e.className||e.tagName}async function pphpFetch(e,t){const n=await fetch(e,{...t,headers:{...t?.headers,"X-Requested-With":"XMLHttpRequest"}});return await n.text()}function parseCallback(e,t){let n={};const s=e.closest("form");if(s){new FormData(s).forEach(((e,t)=>{n[t]?Array.isArray(n[t])?n[t].push(e):n[t]=[n[t],e]:n[t]=e}))}else e instanceof HTMLInputElement?n=handleInputElement(e):(e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&(n[e.name]=e.value);const a=t.match(/(\w+)\((.*)\)/);if(a){const e=a[1];let t=a[2].trim();if(t.startsWith("{")&&t.endsWith("}"))try{const e=parseJson(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(e){}else{const e=t.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((e=>e.trim().replace(/^['"]|['"]$/g,"")));n.args=e}return{funcName:e,data:n}}return{funcName:t,data:n}}function handleInputElement(e){let t={};if(e.name)if("checkbox"===e.type)t[e.name]={value:e.value,checked:e.checked};else if("radio"===e.type){const n=document.querySelector(`input[name="${e.name}"]:checked`);t[e.name]=n?n.value:null}else t[e.name]=e.value;else"checkbox"===e.type||"radio"===e.type?t.value=e.checked:t.value=e.value;return t}function updateElementAttributes(e,t){for(const n in t)if(t.hasOwnProperty(n))switch(n){case"innerHTML":case"outerHTML":case"textContent":case"innerText":e[n]=decodeHTML(t[n]);break;case"insertAdjacentHTML":e.insertAdjacentHTML(t.position||"beforeend",decodeHTML(t[n].html));break;case"insertAdjacentText":e.insertAdjacentText(t.position||"beforeend",decodeHTML(t[n].text));break;case"setAttribute":e.setAttribute(t.attrName,decodeHTML(t[n]));break;case"removeAttribute":e.removeAttribute(t[n]);break;case"className":e.className=decodeHTML(t[n]);break;case"classList.add":e.classList.add(...decodeHTML(t[n]).split(","));break;case"classList.remove":e.classList.remove(...decodeHTML(t[n]).split(","));break;case"classList.toggle":e.classList.toggle(decodeHTML(t[n]));break;case"classList.replace":const[s,a]=decodeHTML(t[n]).split(",");e.classList.replace(s,a);break;case"dataset":e.dataset[t.attrName]=decodeHTML(t[n]);break;case"style":Object.assign(e.style,t[n]);break;case"value":e.value=decodeHTML(t[n]);break;case"checked":e.checked=t[n];break;default:e.setAttribute(n,decodeHTML(t[n]))}}function decodeHTML(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}function saveElementOriginalState(e){if(e.hasAttribute("pp-suspense")&&!e.hasAttribute("pp-original-state")){const t={};e.textContent&&(t.textContent=e.textContent.trim()),e.innerHTML&&(t.innerHTML=e.innerHTML.trim()),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(t.value=e.value);for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n];t[s.name]=s.value}e.setAttribute("pp-original-state",JSON.stringify(t))}e.querySelectorAll("[pp-suspense]").forEach((e=>saveElementOriginalState(e)))}async function handleSuspenseElement(e){let t=e.getAttribute("pp-suspense")||"";const n=(e,t)=>{for(const n in t)if(t.hasOwnProperty(n))for(const t of e.elements)if(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){const e=t.getAttribute("pp-suspense")||"";if(e)if(isJsonLike(e)){const n=parseJson(e);"disabled"!==n.onsubmit&&updateElementAttributes(t,n),n.targets&&n.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&a(s,n)}))}else s(t,e)}},s=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},a=(e,t)=>{e instanceof HTMLFormElement?n(e,t):updateElementAttributes(e,t)};try{if(t&&isJsonLike(t)){const s=parseJson(t);if(s)if(e instanceof HTMLFormElement){const t=new FormData(e),a={};t.forEach(((e,t)=>{a[t]=e})),s.disabled&&toggleFormElements(e,!0);const{disabled:o,...i}=s;updateElementAttributes(e,i),n(e,a)}else if(s.targets){s.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&a(s,n)}));const{targets:t,...n}=s;updateElementAttributes(e,n)}else{if("disabled"===s.empty&&""===e.value)return;const{empty:t,...n}=s;updateElementAttributes(e,n)}}else if(t)s(e,t);else if(e instanceof HTMLFormElement){const t=new FormData(e),s={};t.forEach(((e,t)=>{s[t]=e})),n(e,s)}}catch(e){}}function restoreSuspenseElement(e){const t=e.getAttribute("pp-original-state");if(e.hasAttribute("pp-suspense")&&t){const n=(e,t)=>{for(const n in t)t.hasOwnProperty(n)&&("textContent"===n?e.textContent=t[n]:"innerHTML"===n?e.innerHTML=t[n]:"disabled"===n?!0===t[n]?e.setAttribute("disabled","true"):e.removeAttribute("disabled"):e.setAttribute(n,t[n]));for(const n of Array.from(e.attributes))t.hasOwnProperty(n.name)||e.removeAttribute(n.name)},s=(e,t)=>{for(const s in t)if(t.hasOwnProperty(s))for(const t of Array.from(e.elements))if(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){const e=t.getAttribute("pp-original-state")||"";if(e){if(isJsonLike(e)){const s=parseJson(e);n(t,s)}else a(t,e);t.removeAttribute("pp-original-state")}}},a=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},o=(e,t)=>{e instanceof HTMLFormElement?s(e,t):n(e,t)};try{const a=JSON.parse(t);if(a)if(e instanceof HTMLFormElement){const t=new FormData(e),n={};if(t.forEach(((e,t)=>{n[t]=e})),s(e,n),e.hasAttribute("pp-suspense")){const t=e.getAttribute("pp-suspense")||"";if(parseJson(t).disabled)for(const t of Array.from(e.elements))(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&t.removeAttribute("disabled")}}else if(a.targets){a.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&o(s,n)}));const{targets:t,...s}=a;n(e,s)}else{const{empty:t,...s}=a;n(e,s)}}catch(e){}}e.querySelectorAll("[pp-suspense]").forEach((e=>restoreSuspenseElement(e))),e.removeAttribute("pp-original-state")}function parseJson(e){try{return isJsonLike(e)?(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\\'/g,"'")).replace(/(?<!\\)'/g,'"')).replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"')).replace(/(\w)"s/g,"$1's")).replace(/(\w)"(\w)/g,"$1'$2")).replace(/"(\w+)"\s*([\[\{])/g,'"$1": $2')).replace(/(\w+)\s*([\[\{])/g,'"$1": $2')).replace(/\\([^"\\/bfnrtu])/g,"\\\\$1"),JSON.parse(e)):null}catch(e){const t=e.message.match(/position (\d+)/);t&&parseInt(t[1]);return null}}function toggleFormElements(e,t){Array.from(e.elements).forEach((e=>{(e instanceof HTMLInputElement||e instanceof HTMLButtonElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&(e.disabled=t)}))}async function handleUndefinedFunction(e,t,n){const s={callback:t,...n},a={method:"POST",headers:{"Content-Type":"application/json",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(s)},o={method:"POST",headers:{"Content-Type":"application/json",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify({secondRequestC69CD:!0})};try{saveElementOriginalState(e),handleSuspenseElement(e);const t=window.location.pathname;let n=await pphpFetch(t,a);const s=extractJson(n)||"";let i={success:!1};if(s)try{i=JSON.parse(s)}catch(e){}const r=hasPpOnAttribute(e),c=e.getAttribute("pp-before-request")||"",l=e.getAttribute("pp-after-request")||"";if((r||c||l&&i.success)&&restoreSuspenseElement(e),r||c||l){let e="";if(i.success){e=n.replace(s,"")}else e=n;if(appendAfterbegin(e),!l&&!i.success)return}if(l&&i.success){handleAfterRequest(l,s);return appendAfterbegin(n.replace(s,"")),s}const u=await pphpFetch(t,o),d=n.match(redirectRegex3AE99);if(d&&d[1]){const e=d[1];await handleRedirect(e)}else{const e=(new DOMParser).parseFromString(u,"text/html");let t=document.createElement("div");if(t.id="afterbegin-8D95D",s)if(i.success){const e=n.replace(s,"");t.innerHTML=e}else t.innerHTML=n;else t.innerHTML=n;t.innerHTML&&e.body.insertAdjacentElement("afterbegin",t),updateDocumentContent(e.body.outerHTML)}}catch(e){}}function appendAfterbegin(e){if(!e)return;let t=document.getElementById("afterbegin-8D95D");t?(t.innerHTML=e,document.body.insertAdjacentElement("afterbegin",t)):(t=document.createElement("div"),t.id="afterbegin-8D95D",t.innerHTML=e,document.body.insertAdjacentElement("afterbegin",t))}function extractJson(e){const t=e.match(/\{[\s\S]*\}/);return t?t[0]:null}function handleAfterRequest(e,t){if(!isJsonLike(e))return;const n=parseJson(e),s=t?parseJson(t):null,a=n.targets;Array.isArray(a)&&a.forEach((e=>{const{id:t,...n}=e,a=document.querySelector(t);let o={};if(s){for(const t in n)if(n.hasOwnProperty(t))switch(t){case"innerHTML":case"outerHTML":case"textContent":case"innerText":"response"===n[t]&&(o[t]=e.responseKey?s[e.responseKey]:s.response);break;default:o[t]=n[t];break}}else o=n;a&&updateElementAttributes(a,o)}))}async function handleRedirect(e){if(e)try{const t=new URL(e,window.location.origin);t.origin!==window.location.origin?window.location.href=e:(history.pushState(null,"",e),await handleNavigation())}catch(e){}}function debounce(e,t=300,n=!1){let s;return function(...a){const o=this;s&&clearTimeout(s),s=setTimeout((()=>{s=null,n||e.apply(o,a)}),t),n&&!s&&e.apply(o,a)}}function copyCode(e,t,n,s,a=2e3){if(!(e instanceof HTMLElement))return;const o=e.closest(`.${t}`)?.querySelector("pre code"),i=o?.textContent?.trim()||"";i?navigator.clipboard.writeText(i).then((()=>{const t=e.querySelector("i");t&&(t.className=s),setTimeout((()=>{t&&(t.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}if((()=>{const e=EventTarget.prototype.addEventListener,t=new Map;EventTarget.prototype.addEventListener=function(n,s,a){t.has(this)||t.set(this,new Map);const o=t.get(this).get(n)||new Set;o.add(s),t.get(this).set(n,o),e.call(this,n,s,a)},EventTarget.prototype.removeAllEventListeners=function(e){t.has(this)&&t.get(this).has(e)&&(t.get(this).get(e).forEach((t=>{this.removeEventListener(e,t)})),t.get(this).delete(e))}})(),(e=>{const t=e.pushState,n=e.replaceState;e.pushState=function(n,s,a){const o=t.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),o},e.replaceState=function(t,s,a){const o=n.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),o}})(window.history),document.addEventListener("DOMContentLoaded",attachWireFunctionEvents),window.addEventListener("popstate",(async()=>{await handleNavigation()})),window.addEventListener("urlchange",(()=>{})),null===store){class e{static instance=null;state;listeners;constructor(e={}){this.state=e,this.listeners=[]}static getInstance(t={}){return e.instance||(e.instance=new e(t),e.instance.loadState()),e.instance}setState(e){this.state={...this.state,...e},this.listeners.forEach((e=>e(this.state))),this.saveState()}subscribe(e){return this.listeners.push(e),e(this.state),()=>{this.listeners=this.listeners.filter((t=>t!==e))}}saveState(){localStorage.setItem("appState_59E13",JSON.stringify(this.state))}loadState(){const e=localStorage.getItem("appState_59E13");e&&(this.state=JSON.parse(e),this.listeners.forEach((e=>e(this.state))))}resetState(){this.state={},this.listeners.forEach((e=>e(this.state))),localStorage.removeItem("appState_59E13")}}store=e.getInstance()}
1
+ var eventAttributesB6B56=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onwheel","onkeypress","onkeydown","onkeyup","onfocus","onblur","onchange","oninput","onselect","onsubmit","onreset","onresize","onscroll","onload","onunload","onabort","onerror","onbeforeunload","oncopy","oncut","onpaste","ondrag","ondragstart","ondragend","ondragover","ondragenter","ondragleave","ondrop","oncontextmenu","ontouchstart","ontouchmove","ontouchend","ontouchcancel","onpointerdown","onpointerup","onpointermove","onpointerover","onpointerout","onpointerenter","onpointerleave","onpointercancel"],stateA129A={checkedElements:new Set},responseDataDEAC2=null,store=null,isNavigatingA12E1=!1,redirectRegex3AE99=/redirect_7F834\s*=\s*(\/[^\s]+)/;function attachWireFunctionEvents(){handleHiddenAttribute();document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((e=>{if(handleAnchorTag(e),eventAttributesB6B56.forEach((t=>{const n=e.getAttribute(t),s=t.slice(2);n&&(e.removeAttribute(t),handleDebounce(e,s,n))})),e instanceof HTMLFormElement){const t=e.getAttribute("onsubmit");t&&(e.removeAttribute("onsubmit"),handleDebounce(e,"submit",t))}})),initializePpOnListeners()}function hasPpOnAttribute(e){const t=e.attributes;if(!t)return!1;for(let e=0;e<t.length;e++){const n=t[e].name;if(n.startsWith("pp-on:")||n.startsWith("data-pp-on:")||n.startsWith("pp-on-")||n.startsWith("data-pp-on-"))return!0}return!1}function findAllPpOnElements(e){const t=[];if(hasPpOnAttribute(e)&&t.push(e),document.evaluate){const n=document.evaluate('.//*[@*[starts-with(name(), "pp-on:") or starts-with(name(), "data-pp-on:") or starts-with(name(), "pp-on-") or starts-with(name(), "data-pp-on-")]]',e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);let s=n.iterateNext();for(;s;)t.push(s),s=n.iterateNext()}else if("function"==typeof e.getElementsByTagName){const n=e.getElementsByTagName("*");for(let e=0;e<n.length;e++)hasPpOnAttribute(n[e])&&t.push(n[e])}return t}function initializePpOnListeners(){findAllPpOnElements(document).forEach((e=>{Array.from(e.attributes).forEach((t=>{if(t.name.startsWith("pp-on:")){const n=t.name.split(":")[1],s=t.value;s&&e.addEventListener(n,(t=>{try{new Function("event",s).call(e,t)}catch(e){}}))}}))}))}function handleHiddenAttribute(){const e=document.querySelectorAll("[pp-visibility]"),t=document.querySelectorAll("[pp-display]");e.forEach((e=>handleVisibilityElementAttribute(e,"pp-visibility",handleElementVisibility))),t.forEach((e=>handleVisibilityElementAttribute(e,"pp-display",handleElementDisplay)))}function handleVisibilityElementAttribute(e,t,n){const s=e.getAttribute(t);if(s)if(isJsonLike(s)){n(e,parseJson(s))}else{const n=parseTime(s);if(n>0){const s="pp-visibility"===t?"visibility":"display";scheduleChange(e,n,s,"visibility"===s?"hidden":"none")}}}function isJsonLike(e){return"string"==typeof e&&((e=e.trim()).startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))}function handleElementVisibility(e,t){handleElementChange(e,t,"visibility","hidden","visible")}function handleElementDisplay(e,t){handleElementChange(e,t,"display","none","block")}function handleElementChange(e,t,n,s,a){const o=t.start?parseTime(t.start):0,i=t.end?parseTime(t.end):0;o>0?(e.style[n]=s,scheduleChange(e,o,n,a),i>0&&scheduleChange(e,o+i,n,s)):i>0&&scheduleChange(e,i,n,s)}function scheduleChange(e,t,n,s){setTimeout((()=>{requestAnimationFrame((()=>{e.style[n]=s}))}),t)}function parseTime(e){if("number"==typeof e)return e;const t=e.match(/^(\d+)(ms|s|m)?$/);if(t){const e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":return e;case"s":return 1e3*e;case"m":return 60*e*1e3;default:return e}}return 0}async function handleDebounce(e,t,n){const s=e.getAttribute("pp-debounce")||"",a=e.getAttribute("pp-before-request")||"",o=e.getAttribute("pp-after-request")||"",i=async t=>{t.preventDefault();try{a&&await invokeHandler(e,a,t),await invokeHandler(e,n,t),o&&"@close"!==o&&await invokeHandler(e,o,t),handlerAutofocusAttribute()}catch(e){}};if(s){const n=debounce(i,parseTime(s));e instanceof HTMLFormElement&&"submit"===t?e.addEventListener(t,(e=>{e.preventDefault(),n(e)})):e.addEventListener(t,n)}else e.addEventListener(t,i)}function handlerAutofocusAttribute(){const e=document.querySelectorAll("[pp-autofocus]");let t=!1;e.forEach((e=>{if(t)return;const n=e.getAttribute("pp-autofocus");if(!n||!isJsonLike(n))return;const s=parseJson(n);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)if("number"===e.type&&e instanceof HTMLInputElement){e.type="text";const t=e.value.length||0;e.setSelectionRange(t,t),e.type="number"}else if(s.start)e.setSelectionRange(0,0);else if(s.end){const t=e.value.length||0;e.setSelectionRange(t,t)}else if(s.length){const t=parseInt(s.length,10)||0;e.setSelectionRange(t,t)}e.focus(),t=!0}))}async function invokeHandler(e,t,n){try{const s=t.match(/^(\w+(\.\w+)*)\((.*)\)$/);if(s){const a=s[1].split("."),{context:o,methodName:i}=resolveContext(a);"function"==typeof o[i]?new Function("event",t).call(e,n):await handleParsedCallback(e,t)}else await handleParsedCallback(e,t)}catch(e){}}function resolveContext(e){let t=window;for(let n=0;n<e.length-1;n++)if(t=t[e[n]],!t)throw new Error(`Cannot find object ${e[n]} in the context.`);return{context:t,methodName:e[e.length-1]}}async function handleParsedCallback(e,t){const{funcName:n,data:s}=parseCallback(e,t);if(!n)return;const a=window[n];if("function"==typeof a){const t=e.hasAttribute("pp-after-request"),n=Array.isArray(s.args)?s.args:[],o=responseDataDEAC2?parseJson(responseDataDEAC2):{response:responseDataDEAC2};let i={args:n,element:e,data:s};t&&(i={...i,...o}),await a(i)}else responseDataDEAC2=null,responseDataDEAC2=await handleUndefinedFunction(e,n,s)}function handleAnchorTag(e){e instanceof HTMLAnchorElement&&e.addEventListener("click",(async e=>{const t=e.currentTarget,n=t.getAttribute("href"),s=t.getAttribute("target");if(n&&"_blank"!==s&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),!isNavigatingA12E1)){isNavigatingA12E1=!0;try{if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else{const e=t.getAttribute("pp-append-params");if(n.startsWith("?")&&"true"===e){const e=new URL(window.location.href),t=new URLSearchParams(e.search);let s="";const[a,o]=n.split("#");o&&(s=`#${o}`);new URLSearchParams(a.split("?")[1]).forEach(((e,n)=>{t.set(n,e)}));const i=`${e.pathname}?${t.toString()}${s}`;history.pushState(null,"",i)}else{const[e,t]=n.split("#"),s=`${e}${t?`#${t}`:""}`;history.pushState(null,"",s)}const s=n.indexOf("#");if(-1!==s){const e=n.slice(s+1),t=document.getElementById(e);if(t)t.scrollIntoView({behavior:"smooth"});else{await handleNavigation();const t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})}}else await handleNavigation()}}catch(e){}finally{isNavigatingA12E1=!1}}}))}async function handleNavigation(){try{const e=e=>{const t=e.querySelector("[pp-loading-transition]")?.getAttribute("pp-loading-transition");let n=250,s=250;if(t)try{const e=parseJson(t);n=parseTime(e.fadeIn||n),s=parseTime(e.fadeOut||s)}catch(e){}return{fadeIn:n,fadeOut:s}},t=(e,t)=>new Promise((n=>{e.style.transition=`opacity ${t}ms ease-out`,e.style.opacity="0",setTimeout((()=>{e.style.transition="",n()}),t)})),n=(e,t)=>{e.style.transition=`opacity ${t}ms ease-in`,e.style.opacity="1",setTimeout((()=>{e.style.transition=""}),t)},s=async s=>{const a=document.querySelector("[pp-loading-content='true']")||document.body;if(a){const{fadeIn:o,fadeOut:i}=e(s);await t(a,i),a.innerHTML=s.innerHTML,n(a,o)}},a=window.location.pathname,o=document.getElementById("loading-file-1B87E");if(o){let e=o.querySelector(`div[pp-loading-url='${a}']`);e||(e=o.querySelector("div[pp-loading-url='/']")),e&&await s(e)}const i=await pphpFetch(window.location.href),r=i.match(redirectRegex3AE99);if(r&&r[1]){const e=r[1];await handleRedirect(e)}else updateDocumentContent(i)}catch(e){}}function onUrlChange(){}function updateDocumentContent(e){const t=saveScrollPositions();if(document.removeAllEventListeners("DOMContentLoaded"),e.includes("<!DOCTYPE html>")){const t=e=>{Array.from(e.head.children).forEach((e=>{const t=e.tagName;if("META"===t){if(e.getAttribute("charset")||"viewport"===e.getAttribute("name"))return;const t=e.name,n=e.getAttribute("property"),s=document.head.querySelector(t?`meta[name="${t}"]`:`meta[property="${n}"]`);s?document.head.replaceChild(e.cloneNode(!0),s):document.head.appendChild(e.cloneNode(!0))}else if("TITLE"===t){const t=document.head.querySelector("title");t?document.head.replaceChild(e.cloneNode(!0),t):document.head.appendChild(e.cloneNode(!0))}else if("LINK"===t){const t=t=>{const n=document.head.querySelector('link[rel="icon"]');if(n)document.head.replaceChild(e.cloneNode(!0),n);else{const e=document.createElement("link");e.rel="icon",e.href=t,document.head.appendChild(e)}};if("icon"===e.getAttribute("rel")){t(e.href)}}})),loadAndValidateContent(e)};t((new DOMParser).parseFromString(e,"text/html"))}else{saveState();loadAndValidateContent((new DOMParser).parseFromString(e,"text/html")),restoreState()}restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("DOMContentLoaded"))}function loadAndValidateContent(e){const t=new Map,n=document.createDocumentFragment();function s(e,n){let a=null;if("SCRIPT"===e.tagName){const t=document.createElement("script"),n=e;n.src?(t.src=n.src,t.async=!1):t.textContent=n.textContent,a=t}else a=e.cloneNode(!1),t.set(e,a),Array.from(e.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE?a.appendChild(document.createTextNode(e.textContent||"")):e.nodeType===Node.ELEMENT_NODE&&s(e,a)}));n.appendChild(a)}Array.from(e.body.children).forEach((e=>{s(e,n)})),document.body.innerHTML="",document.body.appendChild(n)}function saveState(){const e=document.activeElement;stateA129A.focusId=e?.id||e?.name,stateA129A.focusValue=e?.value,stateA129A.focusChecked=e?.checked,stateA129A.focusType=e?.type,stateA129A.focusSelectionStart=e?.selectionStart,stateA129A.focusSelectionEnd=e?.selectionEnd,stateA129A.isSuspense=e.hasAttribute("pp-suspense"),stateA129A.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((e=>{stateA129A.checkedElements.add(e.id||e.name)})),document.querySelectorAll('input[type="radio"]:checked').forEach((e=>{stateA129A.checkedElements.add(e.id||e.name)}))}function restoreState(){if(stateA129A.focusId){const e=document.getElementById(stateA129A.focusId)||document.querySelector(`[name="${stateA129A.focusId}"]`);if(e instanceof HTMLInputElement){const t=e.value.length||0;void 0!==stateA129A.focusSelectionStart&&null!==stateA129A.focusSelectionEnd&&e.setSelectionRange(t,t),stateA129A.focusValue&&("checkbox"===e.type||"radio"===e.type?e.checked=!!stateA129A.focusChecked:"number"===e.type?(e.type="text",e.setSelectionRange(t,t),e.type="number"):""!==e.value&&(e.value=stateA129A.focusValue)),e.focus()}else if(e instanceof HTMLTextAreaElement){const t=e.value.length||0;void 0!==stateA129A.focusSelectionStart&&null!==stateA129A.focusSelectionEnd&&e.setSelectionRange(t,t),stateA129A.focusValue&&""!==e.value&&(e.value=stateA129A.focusValue),e.focus()}else e instanceof HTMLSelectElement&&(stateA129A.focusValue&&""!==e.value&&(e.value=stateA129A.focusValue),e.focus())}stateA129A.checkedElements.forEach((e=>{const t=document.getElementById(e);t&&(t.checked=!0)}))}function saveScrollPositions(){const e={};return document.querySelectorAll("*").forEach((t=>{(t.scrollTop||t.scrollLeft)&&(e[getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})})),e}function restoreScrollPositions(e){document.querySelectorAll("*").forEach((t=>{const n=getElementKey(t);e[n]&&(t.scrollTop=e[n].scrollTop,t.scrollLeft=e[n].scrollLeft)}))}function getElementKey(e){return e.id||e.className||e.tagName}async function pphpFetch(e,t){const n=await fetch(e,{...t,headers:{...t?.headers,"X-Requested-With":"XMLHttpRequest"}});return await n.text()}function parseCallback(e,t){let n={};const s=e.closest("form");if(s){new FormData(s).forEach(((e,t)=>{n[t]?Array.isArray(n[t])?n[t].push(e):n[t]=[n[t],e]:n[t]=e}))}else e instanceof HTMLInputElement?n=handleInputElement(e):(e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&(n[e.name]=e.value);const a=t.match(/(\w+)\((.*)\)/);if(a){const e=a[1];let t=a[2].trim();if(t.startsWith("{")&&t.endsWith("}"))try{const e=parseJson(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(e){}else{const e=t.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((e=>e.trim().replace(/^['"]|['"]$/g,"")));n.args=e}return{funcName:e,data:n}}return{funcName:t,data:n}}function handleInputElement(e){let t={};if(e.name)if("checkbox"===e.type)t[e.name]={value:e.value,checked:e.checked};else if("radio"===e.type){const n=document.querySelector(`input[name="${e.name}"]:checked`);t[e.name]=n?n.value:null}else t[e.name]=e.value;else"checkbox"===e.type||"radio"===e.type?t.value=e.checked:t.value=e.value;return t}function updateElementAttributes(e,t){for(const n in t)if(t.hasOwnProperty(n))switch(n){case"innerHTML":case"outerHTML":case"textContent":case"innerText":e[n]=decodeHTML(t[n]);break;case"insertAdjacentHTML":e.insertAdjacentHTML(t.position||"beforeend",decodeHTML(t[n].html));break;case"insertAdjacentText":e.insertAdjacentText(t.position||"beforeend",decodeHTML(t[n].text));break;case"setAttribute":e.setAttribute(t.attrName,decodeHTML(t[n]));break;case"removeAttribute":e.removeAttribute(t[n]);break;case"className":e.className=decodeHTML(t[n]);break;case"classList.add":e.classList.add(...decodeHTML(t[n]).split(","));break;case"classList.remove":e.classList.remove(...decodeHTML(t[n]).split(","));break;case"classList.toggle":e.classList.toggle(decodeHTML(t[n]));break;case"classList.replace":const[s,a]=decodeHTML(t[n]).split(",");e.classList.replace(s,a);break;case"dataset":e.dataset[t.attrName]=decodeHTML(t[n]);break;case"style":Object.assign(e.style,t[n]);break;case"value":e.value=decodeHTML(t[n]);break;case"checked":e.checked=t[n];break;default:e.setAttribute(n,decodeHTML(t[n]))}}function decodeHTML(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}function saveElementOriginalState(e){if(e.hasAttribute("pp-suspense")&&!e.hasAttribute("pp-original-state")){const t={};e.textContent&&(t.textContent=e.textContent.trim()),e.innerHTML&&(t.innerHTML=e.innerHTML.trim()),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(t.value=e.value);for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n];t[s.name]=s.value}e.setAttribute("pp-original-state",JSON.stringify(t))}e.querySelectorAll("[pp-suspense]").forEach((e=>saveElementOriginalState(e)))}async function handleSuspenseElement(e){let t=e.getAttribute("pp-suspense")||"";const n=(e,t)=>{for(const n in t)if(t.hasOwnProperty(n))for(const t of e.elements)if(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){const e=t.getAttribute("pp-suspense")||"";if(e)if(isJsonLike(e)){const n=parseJson(e);"disabled"!==n.onsubmit&&updateElementAttributes(t,n),n.targets&&n.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&a(s,n)}))}else s(t,e)}},s=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},a=(e,t)=>{e instanceof HTMLFormElement?n(e,t):updateElementAttributes(e,t)};try{if(t&&isJsonLike(t)){const s=parseJson(t);if(s)if(e instanceof HTMLFormElement){const t=new FormData(e),a={};t.forEach(((e,t)=>{a[t]=e})),s.disabled&&toggleFormElements(e,!0);const{disabled:o,...i}=s;updateElementAttributes(e,i),n(e,a)}else if(s.targets){s.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&a(s,n)}));const{targets:t,...n}=s;updateElementAttributes(e,n)}else{if("disabled"===s.empty&&""===e.value)return;const{empty:t,...n}=s;updateElementAttributes(e,n)}}else if(t)s(e,t);else if(e instanceof HTMLFormElement){const t=new FormData(e),s={};t.forEach(((e,t)=>{s[t]=e})),n(e,s)}}catch(e){}}function restoreSuspenseElement(e){const t=e.getAttribute("pp-original-state");if(e.hasAttribute("pp-suspense")&&t){const n=(e,t)=>{for(const n in t)t.hasOwnProperty(n)&&("textContent"===n?e.textContent=t[n]:"innerHTML"===n?e.innerHTML=t[n]:"disabled"===n?!0===t[n]?e.setAttribute("disabled","true"):e.removeAttribute("disabled"):e.setAttribute(n,t[n]));for(const n of Array.from(e.attributes))t.hasOwnProperty(n.name)||e.removeAttribute(n.name)},s=(e,t)=>{for(const s in t)if(t.hasOwnProperty(s))for(const t of Array.from(e.elements))if(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){const e=t.getAttribute("pp-original-state")||"";if(e){if(isJsonLike(e)){const s=parseJson(e);n(t,s)}else a(t,e);t.removeAttribute("pp-original-state")}}},a=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},o=(e,t)=>{e instanceof HTMLFormElement?s(e,t):n(e,t)};try{const a=JSON.parse(t);if(a)if(e instanceof HTMLFormElement){const t=new FormData(e),n={};if(t.forEach(((e,t)=>{n[t]=e})),s(e,n),e.hasAttribute("pp-suspense")){const t=e.getAttribute("pp-suspense")||"";if(parseJson(t).disabled)for(const t of Array.from(e.elements))(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&t.removeAttribute("disabled")}}else if(a.targets){a.targets.forEach((e=>{const{id:t,...n}=e,s=document.querySelector(t);s&&o(s,n)}));const{targets:t,...s}=a;n(e,s)}else{const{empty:t,...s}=a;n(e,s)}}catch(e){}}e.querySelectorAll("[pp-suspense]").forEach((e=>restoreSuspenseElement(e))),e.removeAttribute("pp-original-state")}function parseJson(e){try{return isJsonLike(e)?(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\\'/g,"'")).replace(/(?<!\\)'/g,'"')).replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"')).replace(/(\w)"s/g,"$1's")).replace(/(\w)"(\w)/g,"$1'$2")).replace(/"(\w+)"\s*([\[\{])/g,'"$1": $2')).replace(/(\w+)\s*([\[\{])/g,'"$1": $2')).replace(/\\([^"\\/bfnrtu])/g,"\\\\$1"),JSON.parse(e)):null}catch(e){const t=e.message.match(/position (\d+)/);t&&parseInt(t[1]);return null}}function toggleFormElements(e,t){Array.from(e.elements).forEach((e=>{(e instanceof HTMLInputElement||e instanceof HTMLButtonElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&(e.disabled=t)}))}async function pphpFetchFile(e,t,n,s){const a=new FormData,o=n.files;if(o)for(let e=0;e<o.length;e++)a.append("file[]",o[e]);a.append("callback",t);for(const e in s)s.hasOwnProperty(e)&&a.append(e,s[e]);const i=await fetch(e,{method:"POST",headers:{HTTP_PPHP_WIRE_REQUEST:"true"},body:a});return await i.text()}async function handleUndefinedFunction(e,t,n){const s=createFetchOptions({callback:t,...n}),a=createFetchOptions({secondRequestC69CD:!0});try{saveElementOriginalState(e),handleSuspenseElement(e);const o=window.location.pathname;let i="",r="",c={success:!1};const l=e.querySelector("input[type='file']");if(l){if(i=await pphpFetchFile(o,t,l,n),r=extractJson(i)||"",r)try{c=JSON.parse(r)}catch(e){}}else if(i=await pphpFetch(o,s),r=extractJson(i)||"",r)try{c=JSON.parse(r)}catch(e){}const u=hasPpOnAttribute(e),d=e.getAttribute("pp-before-request")||"",p=e.getAttribute("pp-after-request")||"";if((u||d||p&&c.success)&&restoreSuspenseElement(e),u||d||p){let e="";if(c.success){e=i.replace(r,"")}else e=i;if(appendAfterbegin(e),!p&&!c.success)return}if(p&&c.success){handleAfterRequest(p,r);return appendAfterbegin(i.replace(r,"")),r}const f=await pphpFetch(o,a);await handleResponseRedirectOrUpdate(i,f,r,c)}catch(e){}}function createFetchOptions(e){return{method:"POST",headers:{"Content-Type":"application/json",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(e)}}async function handleResponseRedirectOrUpdate(e,t,n,s){const a=e.match(redirectRegex3AE99);if(a&&a[1])await handleRedirect(a[1]);else{const a=(new DOMParser).parseFromString(t,"text/html");let o=document.createElement("div");if(o.id="afterbegin-8D95D",n)if(s.success){const t=e.replace(n,"");o.innerHTML=t}else o.innerHTML=e;else o.innerHTML=e;o.innerHTML&&a.body.insertAdjacentElement("afterbegin",o),updateDocumentContent(a.body.outerHTML)}}function appendAfterbegin(e){if(!e)return;const t="afterbegin-8D95D";let n=document.getElementById(t);n?(n.innerHTML=e,document.body.insertAdjacentElement("afterbegin",n)):(n=document.createElement("div"),n.id=t,n.innerHTML=e,document.body.insertAdjacentElement("afterbegin",n))}function extractJson(e){const t=e?.match(/\{[\s\S]*\}/);return t?t[0]:null}function handleAfterRequest(e,t){if(!isJsonLike(e))return;const n=parseJson(e),s=t?parseJson(t):null,a=n.targets;Array.isArray(a)&&a.forEach((e=>{const{id:t,...n}=e,a=document.querySelector(t);let o={};if(s){for(const t in n)if(n.hasOwnProperty(t))switch(t){case"innerHTML":case"outerHTML":case"textContent":case"innerText":"response"===n[t]&&(o[t]=e.responseKey?s[e.responseKey]:s.response);break;default:o[t]=n[t];break}}else o=n;a&&updateElementAttributes(a,o)}))}async function handleRedirect(e){if(e)try{const t=new URL(e,window.location.origin);t.origin!==window.location.origin?window.location.href=e:(history.pushState(null,"",e),await handleNavigation())}catch(e){}}function debounce(e,t=300,n=!1){let s;return function(...a){const o=this;s&&clearTimeout(s),s=setTimeout((()=>{s=null,n||e.apply(o,a)}),t),n&&!s&&e.apply(o,a)}}function copyCode(e,t,n,s,a=2e3){if(!(e instanceof HTMLElement))return;const o=e.closest(`.${t}`)?.querySelector("pre code"),i=o?.textContent?.trim()||"";i?navigator.clipboard.writeText(i).then((()=>{const t=e.querySelector("i");t&&(t.className=s),setTimeout((()=>{t&&(t.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}if((()=>{const e=EventTarget.prototype.addEventListener,t=new Map;EventTarget.prototype.addEventListener=function(n,s,a){t.has(this)||t.set(this,new Map);const o=t.get(this).get(n)||new Set;o.add(s),t.get(this).set(n,o),e.call(this,n,s,a)},EventTarget.prototype.removeAllEventListeners=function(e){t.has(this)&&t.get(this).has(e)&&(t.get(this).get(e).forEach((t=>{this.removeEventListener(e,t)})),t.get(this).delete(e))}})(),(e=>{const t=e.pushState,n=e.replaceState;e.pushState=function(n,s,a){const o=t.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),o},e.replaceState=function(t,s,a){const o=n.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),o}})(window.history),document.addEventListener("DOMContentLoaded",attachWireFunctionEvents),window.addEventListener("popstate",(async()=>{await handleNavigation()})),window.addEventListener("urlchange",(()=>{})),null===store){class e{static instance=null;state;listeners;constructor(e={}){this.state=e,this.listeners=[]}static getInstance(t={}){return e.instance||(e.instance=new e(t),e.instance.loadState()),e.instance}setState(e){this.state={...this.state,...e},this.listeners.forEach((e=>e(this.state))),this.saveState()}subscribe(e){return this.listeners.push(e),e(this.state),()=>{this.listeners=this.listeners.filter((t=>t!==e))}}saveState(){localStorage.setItem("appState_59E13",JSON.stringify(this.state))}loadState(){const e=localStorage.getItem("appState_59E13");e&&(this.state=JSON.parse(e),this.listeners.forEach((e=>e(this.state))))}resetState(){this.state={},this.listeners.forEach((e=>e(this.state))),localStorage.removeItem("appState_59E13")}}store=e.getInstance()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.19.502",
3
+ "version": "1.20.1",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",