create-prisma-php-app 1.28.4 → 1.28.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bootstrap.php
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
3
5
|
if (session_status() == PHP_SESSION_NONE) {
|
|
4
6
|
session_start();
|
|
5
7
|
}
|
|
@@ -290,7 +292,7 @@ function dynamicRoute($pathname)
|
|
|
290
292
|
|
|
291
293
|
function isGroupIdentifier($segment): bool
|
|
292
294
|
{
|
|
293
|
-
return preg_match('/^\(.*\)$/', $segment);
|
|
295
|
+
return (bool)preg_match('/^\(.*\)$/', $segment);
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
function matchGroupFolder($constructedPath): ?string
|
|
@@ -323,6 +325,11 @@ function matchGroupFolder($constructedPath): ?string
|
|
|
323
325
|
function getGroupFolder($pathname): string
|
|
324
326
|
{
|
|
325
327
|
$lastSlashPos = strrpos($pathname, '/');
|
|
328
|
+
|
|
329
|
+
if ($lastSlashPos === false) {
|
|
330
|
+
return "";
|
|
331
|
+
}
|
|
332
|
+
|
|
326
333
|
$pathWithoutFile = substr($pathname, 0, $lastSlashPos);
|
|
327
334
|
|
|
328
335
|
if (preg_match('/\(([^)]+)\)[^()]*$/', $pathWithoutFile, $matches)) {
|
|
@@ -874,7 +881,7 @@ try {
|
|
|
874
881
|
} else {
|
|
875
882
|
$_errorDetails = "Unhandled Exception: " . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8');
|
|
876
883
|
$_errorDetails .= "<br>File: " . htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8');
|
|
877
|
-
$_errorDetails .= "<br>Line: " . htmlspecialchars($e->getLine(), ENT_QUOTES, 'UTF-8');
|
|
884
|
+
$_errorDetails .= "<br>Line: " . htmlspecialchars((string)$e->getLine(), ENT_QUOTES, 'UTF-8');
|
|
878
885
|
$_errorDetails .= "<br/>TraceAsString: " . htmlspecialchars($e->getTraceAsString(), ENT_QUOTES, 'UTF-8');
|
|
879
886
|
$_errorDetails = "<div class='error'>$_errorDetails</div>";
|
|
880
887
|
}
|
|
@@ -8,11 +8,12 @@ use Lib\PrismaPHPSettings;
|
|
|
8
8
|
use DOMDocument;
|
|
9
9
|
use DOMElement;
|
|
10
10
|
use DOMComment;
|
|
11
|
+
use DOMNode;
|
|
11
12
|
|
|
12
13
|
class TemplateCompiler
|
|
13
14
|
{
|
|
14
|
-
protected static $classMappings = [];
|
|
15
|
-
protected static $selfClosingTags = [
|
|
15
|
+
protected static array $classMappings = [];
|
|
16
|
+
protected static array $selfClosingTags = [
|
|
16
17
|
'area',
|
|
17
18
|
'base',
|
|
18
19
|
'br',
|
|
@@ -44,11 +45,12 @@ class TemplateCompiler
|
|
|
44
45
|
$root = $dom->documentElement;
|
|
45
46
|
$output = "";
|
|
46
47
|
|
|
48
|
+
$outputParts = [];
|
|
47
49
|
foreach ($root->childNodes as $child) {
|
|
48
|
-
$
|
|
50
|
+
$outputParts[] = self::processNode($child);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
return $
|
|
53
|
+
return implode('', $outputParts);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
public static function convertToXml(string $templateContent): DOMDocument
|
|
@@ -83,6 +85,7 @@ class TemplateCompiler
|
|
|
83
85
|
);
|
|
84
86
|
}
|
|
85
87
|
libxml_clear_errors();
|
|
88
|
+
libxml_use_internal_errors(false);
|
|
86
89
|
|
|
87
90
|
return $dom;
|
|
88
91
|
}
|
|
@@ -125,43 +128,36 @@ class TemplateCompiler
|
|
|
125
128
|
);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
protected static function processNode($node): string
|
|
131
|
+
protected static function processNode(DOMNode $node): string
|
|
129
132
|
{
|
|
130
|
-
$output = "";
|
|
131
|
-
|
|
132
133
|
if ($node instanceof DOMElement) {
|
|
133
134
|
$componentName = $node->nodeName;
|
|
134
135
|
$attributes = [];
|
|
135
136
|
|
|
136
|
-
//
|
|
137
|
+
// Gather element attributes
|
|
137
138
|
foreach ($node->attributes as $attr) {
|
|
138
139
|
$attributes[$attr->name] = $attr->value;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
//
|
|
142
|
-
$
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
$innerContent .= self::processNode($child);
|
|
146
|
-
}
|
|
142
|
+
// Recursively get child content
|
|
143
|
+
$childOutput = [];
|
|
144
|
+
foreach ($node->childNodes as $child) {
|
|
145
|
+
$childOutput[] = self::processNode($child);
|
|
147
146
|
}
|
|
147
|
+
$innerContent = implode('', $childOutput);
|
|
148
148
|
|
|
149
|
-
//
|
|
150
|
-
$attributes[
|
|
149
|
+
// We'll store 'children' for potential component logic
|
|
150
|
+
$attributes['children'] = $innerContent;
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
$attributes,
|
|
155
|
-
$innerContent
|
|
156
|
-
);
|
|
152
|
+
// Pass to processComponent for final decision
|
|
153
|
+
return self::processComponent($componentName, $attributes);
|
|
157
154
|
} elseif ($node instanceof DOMComment) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// For text nodes and others
|
|
161
|
-
$output .= $node->textContent;
|
|
155
|
+
// Preserve HTML comments
|
|
156
|
+
return "<!--{$node->textContent}-->";
|
|
162
157
|
}
|
|
163
158
|
|
|
164
|
-
return
|
|
159
|
+
// For text/cdata nodes, return text
|
|
160
|
+
return $node->textContent;
|
|
165
161
|
}
|
|
166
162
|
|
|
167
163
|
protected static function initializeClassMappings(): void
|
|
@@ -171,50 +167,45 @@ class TemplateCompiler
|
|
|
171
167
|
}
|
|
172
168
|
}
|
|
173
169
|
|
|
174
|
-
protected static function processComponent(
|
|
175
|
-
|
|
176
|
-
array $attributes,
|
|
177
|
-
string $innerContent
|
|
178
|
-
): string {
|
|
170
|
+
protected static function processComponent(string $componentName, array $attributes): string
|
|
171
|
+
{
|
|
179
172
|
if (isset(self::$classMappings[$componentName])) {
|
|
180
|
-
$
|
|
173
|
+
$className = self::$classMappings[$componentName]['className'];
|
|
174
|
+
$filePath = self::$classMappings[$componentName]['filePath'];
|
|
181
175
|
|
|
182
176
|
// Ensure the required file is included
|
|
183
|
-
require_once str_replace('\\', '/', SRC_PATH . '/' . $
|
|
177
|
+
require_once str_replace('\\', '/', SRC_PATH . '/' . $filePath);
|
|
184
178
|
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
if (!class_exists($className)) {
|
|
180
|
+
throw new \RuntimeException("Class $className does not exist.");
|
|
181
|
+
}
|
|
187
182
|
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
$componentInstance = new $className($attributes);
|
|
183
|
+
// Instantiate the component
|
|
184
|
+
$componentInstance = new $className($attributes);
|
|
185
|
+
$renderedContent = $componentInstance->render();
|
|
192
186
|
|
|
193
|
-
|
|
194
|
-
|
|
187
|
+
// re-compile to handle further components
|
|
188
|
+
if (strpos($renderedContent, '<') !== false) {
|
|
189
|
+
return self::compile($renderedContent);
|
|
190
|
+
}
|
|
191
|
+
return $renderedContent;
|
|
192
|
+
}
|
|
195
193
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// Re-parse the rendered content
|
|
199
|
-
return self::compile($renderedContent);
|
|
200
|
-
}
|
|
194
|
+
return self::renderAsHtml($componentName, $attributes);
|
|
195
|
+
}
|
|
201
196
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
$attributesString = self::renderAttributes($attributes);
|
|
210
|
-
|
|
211
|
-
// Determine if the tag should be self-closing
|
|
212
|
-
if (in_array(strtolower($componentName), self::$selfClosingTags)) {
|
|
213
|
-
return "<$componentName $attributesString />";
|
|
214
|
-
} else {
|
|
215
|
-
return "<$componentName $attributesString>$innerContent</$componentName>";
|
|
216
|
-
}
|
|
197
|
+
protected static function renderAsHtml(string $tagName, array $attributes): string
|
|
198
|
+
{
|
|
199
|
+
$attrs = self::renderAttributes($attributes);
|
|
200
|
+
|
|
201
|
+
// Check if it's self-closing
|
|
202
|
+
if (in_array(strtolower($tagName), self::$selfClosingTags)) {
|
|
203
|
+
return "<{$tagName}{$attrs} />";
|
|
217
204
|
}
|
|
205
|
+
|
|
206
|
+
// Normal open/close
|
|
207
|
+
$innerContent = $attributes['children'] ?? '';
|
|
208
|
+
return "<{$tagName}{$attrs}>{$innerContent}</{$tagName}>";
|
|
218
209
|
}
|
|
219
210
|
|
|
220
211
|
protected static function renderAttributes(array $attributes): string
|
package/dist/src/app/js/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const eventAttributesB6B56=new Set(["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"]);(()=>{const e=EventTarget.prototype.addEventListener,t=EventTarget.prototype.removeEventListener,n=new Map;EventTarget.prototype.addEventListener=function(t,o,a){n.has(this)||n.set(this,new Map);const s=n.get(this).get(t)||new Set;s.add(o),n.get(this).set(t,s),e.call(this,t,o,a)},EventTarget.prototype.removeEventListener=function(e,o,a){if(n.has(this)&&n.get(this).has(e)){const t=n.get(this).get(e);t&&(t.delete(o),0===t.size&&n.get(this).delete(e))}t.call(this,e,o,a)},EventTarget.prototype.removeAllEventListeners=function(e){if(n.has(this)&&n.get(this).has(e)){const o=n.get(this).get(e);o&&(o.forEach((n=>{t.call(this,e,n)})),n.get(this).delete(e))}}})();const stateA129A={checkedElements:new Set};let responseDataDEAC2=null;var store=null;let isNavigatingA12E1=!1;const redirectRegex3AE99=/redirect_7F834\s*=\s*(\/[^\s]*)/;function observeDOMChanges(){new MutationObserver((e=>{for(const t of e)"childList"===t.type&&t.addedNodes.length>0&&attachWireFunctionEvents()})).observe(document.body,{childList:!0,subtree:!0})}function attachWireFunctionEvents(){handleHiddenAttribute();document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((e=>{if(handleAnchorTag(e),Array.from(e.attributes).filter((e=>eventAttributesB6B56.has(e.name))).forEach((t=>{const n=t.name.slice(2),o=t.value;e instanceof HTMLInputElement&&handleInputAppendParams(e,n),o&&(e.removeAttribute(t.name),handleDebounce(e,n,o))})),e instanceof HTMLFormElement){const t=e.getAttribute("onsubmit");t&&(e.removeAttribute("onsubmit"),handleDebounce(e,"submit",t))}}))}function handleInputAppendParams(e,t){"true"===e.getAttribute("pp-append-params")&&e.addEventListener(t,(e=>{const t=e.currentTarget,n=t.value.trim(),o=new URL(window.location.href),a=new URLSearchParams(o.search),s=t.name;if(s){n?a.set(s,n):a.delete(s);const e=a.toString()?`${o.pathname}?${a.toString()}`:o.pathname;history.replaceState(null,"",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 o=e.getAttribute(t);if(o)if(isJsonLike(o)){n(e,parseJson(o))}else{const n=parseTime(o);if(n>0){const o="pp-visibility"===t?"visibility":"display";scheduleChange(e,n,o,"visibility"===o?"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,o,a){const s=t.start?parseTime(t.start):0,r=t.end?parseTime(t.end):0;s>0?(e.style[n]=o,scheduleChange(e,s,n,a),r>0&&scheduleChange(e,s+r,n,o)):r>0&&scheduleChange(e,r,n,o)}function scheduleChange(e,t,n,o){setTimeout((()=>{requestAnimationFrame((()=>{e.style[n]=o}))}),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){e.removeEventListener(t,(()=>{}));const o=e.getAttribute("pp-debounce")||"",a=e.getAttribute("pp-before-request")||"",s=e.getAttribute("pp-after-request")||"",r=async t=>{t.preventDefault();try{a&&await invokeHandler(e,a,t),await invokeHandler(e,n,t),s&&"@close"!==s&&await invokeHandler(e,s,t),handlerAutofocusAttribute()}catch(e){}};if(o){const n=debounce(r,parseTime(o));e instanceof HTMLFormElement&&"submit"===t?e.addEventListener(t,(e=>{e.preventDefault(),n(e)})):e.addEventListener(t,n)}else e.addEventListener(t,r)}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 o=parseJson(n);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=["text","search","tel","url","password"];if(e instanceof HTMLInputElement)if(t.includes(e.type))if("number"===e.type){e.type="text";const t=e.value.length||0;e.setSelectionRange(t,t),e.type="number"}else setCursorPosition(e,o);else;else e instanceof HTMLTextAreaElement&&setCursorPosition(e,o)}e.focus(),t=!0}))}function setCursorPosition(e,t){if(t.start)e.setSelectionRange(0,0);else if(t.end){const t=e.value.length||0;e.setSelectionRange(t,t)}else if(t.length){const n=parseInt(t.length,10)||0;e.setSelectionRange(n,n)}}async function invokeHandler(e,t,n){try{const o=t.match(/^(\w+(\.\w+)*)\((.*)\)$/);if(o){const a=o[1],s=o[3],r=a.split("."),{context:i,methodName:c}=resolveContext(r);if("function"==typeof i[c])if(isJsonLike(s)){const t=parseJson(s);t.element=e,t.event=n;const o=[t];await i[c](...o)}else new Function("event",t).call(e,n);else 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:o}=parseCallback(e,t);if(!n)return;const a=window[n];if("function"==typeof a){const t=e.hasAttribute("pp-after-request"),n=Array.isArray(o.args)?o.args:[],s=responseDataDEAC2?parseJson(responseDataDEAC2):{response:responseDataDEAC2};let r={args:n,element:e,data:o};t&&(r={...r,...s}),await a(r)}else responseDataDEAC2=null,responseDataDEAC2=await handleUndefinedFunction(e,n,o)}function handleAnchorTag(e){e instanceof HTMLAnchorElement&&e.addEventListener("click",(async e=>{const t=e.currentTarget,n=t.getAttribute("href"),o=t.getAttribute("target");if(n&&"_blank"!==o&&!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 o="";const[a,s]=n.split("#");s&&(o=`#${s}`);new URLSearchParams(a.split("?")[1]).forEach(((e,n)=>{t.set(n,e)}));const r=`${e.pathname}?${t.toString()}${o}`;history.pushState(null,"",r)}else{const[e,t]=n.split("#"),o=`${e}${t?`#${t}`:""}`;history.pushState(null,"",o)}const o=n.indexOf("#");if(-1!==o){const e=n.slice(o+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,o=250;if(t)try{const e=parseJson(t);n=parseTime(e.fadeIn||n),o=parseTime(e.fadeOut||o)}catch(e){}return{fadeIn:n,fadeOut:o}},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)},o=async o=>{const a=document.querySelector("[pp-loading-content='true']")||document.body;if(a){const{fadeIn:s,fadeOut:r}=e(o);await t(a,r),a.innerHTML=o.innerHTML,n(a,s)}},a=window.location.pathname,s=document.getElementById("loading-file-1B87E");if(s){let e=null,t=a;for(;t&&(e=s.querySelector(`div[pp-loading-url='${t}']`),!e);){const e=t.lastIndexOf("/");t=e>0?t.substring(0,e):"/"}e||(e=s.querySelector("div[pp-loading-url='/']")),e&&await o(e)}const r=await pphpFetch(window.location.href),i=r.match(redirectRegex3AE99);if(i&&i[1]){const e=i[1];await handleRedirect(e)}else updateDocumentContent(r)}catch(e){}}function onUrlChange(){}async function updateBodyContent(e){const t=saveScrollPositions();saveState();const n=(new DOMParser).parseFromString(e,"text/html");document.removeAllEventListeners("PPBodyLoaded"),await appendCallbackResponse(n),restoreState(),restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("PPBodyLoaded"))}async function appendCallbackResponse(e){const t=e.getElementById("afterbegin-8D95D");if(t){const e=document.getElementById("afterbegin-8D95D");e?e.innerHTML=t.innerHTML:document.body.insertAdjacentHTML("afterbegin",t.outerHTML)}await populateDocumentBody(e)}async function updateDocumentContent(e){const t=saveScrollPositions(),n=(new DOMParser).parseFromString(e,"text/html"),o="pp-dynamic-script",a="pp-dynamic-link";document.head.querySelectorAll("[pp-dynamic-meta]").forEach((e=>e.remove()));document.head.querySelectorAll("[pp-dynamic-link]").forEach((e=>e.remove()));document.head.querySelectorAll("[pp-dynamic-script]").forEach((e=>e.remove()));document.removeAllEventListeners("PPBodyLoaded"),await(async e=>{Array.from(e.head.children).forEach((e=>{const t=e.tagName;if("SCRIPT"===t&&e.hasAttribute(o)){const t=document.createElement("script");Array.from(e.attributes).forEach((e=>t.setAttribute(e.name,e.value))),e.textContent&&(t.textContent=e.textContent),document.head.appendChild(t)}else if("META"===t){if(e.getAttribute("charset")||"viewport"===e.getAttribute("name"))return;const t=e.name,n=e.getAttribute("property"),o=document.head.querySelector(t?`meta[name="${t}"]`:`meta[property="${n}"]`);o?document.head.replaceChild(e.cloneNode(!0),o):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)}else if(e.hasAttribute(a)){const t=e.cloneNode(!0);document.head.appendChild(t)}}})),await populateDocumentBody(e)})(n),restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("PPBodyLoaded"))}function manageScriptTags(e,t){const n=e.querySelectorAll("script"),o=t?.querySelectorAll("script")||n;n.forEach(((e,t)=>{const n=document.createElement("script"),a=o[t]||e;Array.from(a.attributes).forEach((e=>{n.setAttribute(e.name,e.value)})),a.hasAttribute("src")||(n.textContent=a.textContent),e.parentNode?.replaceChild(n,e)}))}async function populateDocumentBody(e){try{const t=e.body.cloneNode(!0);manageScriptTags(t),document.body.replaceWith(t)}catch(e){}}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||"email"===e.type?(e.type="text",e.setSelectionRange(t,t),e.type="number"===e.type?"number":"email"):"date"===e.type||"month"===e.type||"week"===e.type||"time"===e.type||"datetime-local"===e.type||"color"===e.type||"file"===e.type||""!==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={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach((t=>{(t.scrollTop||t.scrollLeft)&&(e[getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})})),e}function restoreScrollPositions(e){requestAnimationFrame((()=>{const t=e.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop),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 reRunScripts(e){e.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");Array.from(e.attributes).forEach((e=>{t.setAttribute(e.name,e.value)})),e.hasAttribute("src")||(t.textContent=e.textContent),e.parentNode?.replaceChild(t,e)}))}async function pphpFetchFunction(e,t){const n=createFetchOptions({callback:e,...t});return await pphpFetch(window.location.href,n)}async function pphpSync(...e){try{const t=e.length>0?e.map((e=>`pp-sync="${e}"`)):['pp-sync="true"'],n=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()}),o=await pphpFetch(window.location.href,n),a=(new DOMParser).parseFromString(o,"text/html");t.forEach((e=>{const t=document.querySelectorAll(`[${e}]`),n=a.body.querySelectorAll(`[${e}]`);t.forEach(((e,t)=>{const o=n[t];o&&(e.innerHTML=o.innerHTML,reRunScripts(e))}))}))}catch(e){}}async function pphpFetchAndUpdateBodyContent(){const e=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()}),t=await pphpFetch(window.location.href,e);await updateBodyContent(t)}function parseCallback(e,t){let n={};const o=e.closest("form");if(o){new FormData(o).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[o,a]=decodeHTML(t[n]).split(",");e.classList.replace(o,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 o=e.attributes[n];t[o.name]=o.value}e.setAttribute("pp-original-state",JSON.stringify(t))}if(e instanceof HTMLFormElement){let t=null;const n=e.id;n&&(t=document.querySelector(`[form="${n}"]`)),n&&t||(t=Array.from(e.elements).find((e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement))),t&&(t.hasAttribute("pp-original-state")||saveElementOriginalState(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,o=document.querySelector(t);o&&a(o,n)}))}else o(t,e)}},o=(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 o=parseJson(t);if(o)if(e instanceof HTMLFormElement){const t=new FormData(e),a={};t.forEach(((e,t)=>{a[t]=e})),o.disabled&&toggleFormElements(e,!0);const{disabled:s,...r}=o;updateElementAttributes(e,r),n(e,a)}else if(o.targets){o.targets.forEach((e=>{const{id:t,...n}=e,o=document.querySelector(t);o&&a(o,n)}));const{targets:t,...n}=o;updateElementAttributes(e,n)}else{if("disabled"===o.empty&&""===e.value)return;const{empty:t,...n}=o;updateElementAttributes(e,n)}}else if(t)o(e,t);else if(e instanceof HTMLFormElement){const t=new FormData(e),o={};t.forEach(((e,t)=>{o[t]=e})),n(e,o)}}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)},o=(e,t)=>{for(const o in t)if(t.hasOwnProperty(o))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 o=parseJson(e);n(t,o)}else a(t,e);t.removeAttribute("pp-original-state")}}},a=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},s=(e,t)=>{e instanceof HTMLFormElement?o(e,t):n(e,t)};try{const a=parseJson(t);if(a)if(e instanceof HTMLFormElement){const t=e.id;if(t){const e=document.querySelector(`[form="${t}"]`);if(e){const t=e.getAttribute("pp-original-state");if(t&&isJsonLike(t)){const o=parseJson(t);n(e,o)}}}const a=new FormData(e),s={};if(a.forEach(((e,t)=>{s[t]=e})),o(e,s),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,o=document.querySelector(t);o&&s(o,n)}));const{targets:t,...o}=a;n(e,o)}else{const{empty:t,...o}=a;n(e,o)}}catch(e){}}e.querySelectorAll("[pp-suspense]").forEach((e=>restoreSuspenseElement(e))),e.removeAttribute("pp-original-state")}function parseJson(e){try{return JSON5.parse(e)}catch(e){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){const o=new FormData,a=n.files;if(a)for(let e=0;e<a.length;e++)o.append("file[]",a[e]);o.append("callback",t);const s=await fetch(e,{method:"POST",headers:{HTTP_PPHP_WIRE_REQUEST:"true"},body:o});return await s.text()}function getUrlParams(){const e={};return new URLSearchParams(window.location.search).forEach(((t,n)=>{e[n]=t})),e}async function handleUndefinedFunction(e,t,n){const o=createFetchOptions({callback:t,...n}),a=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()});try{saveElementOriginalState(e),handleSuspenseElement(e);const n=new URL(window.location.href);let s="",r="",i={success:!1};const c=e.querySelector("input[type='file']");if(c){if(s=await pphpFetchFile(n.href,t,c),r=extractJson(s)||"",r)try{i=parseJson(r)}catch(e){}}else{if(s=await pphpFetch(n.href,o),getRedirectUrl(s))return void await handleRedirect(getRedirectUrl(s)||"");if(r=extractJson(s)||"",r)try{i=parseJson(r)}catch(e){}}const l=e.getAttribute("pp-before-request")||"",u=e.getAttribute("pp-after-request")||"";if((l||u&&i.success)&&restoreSuspenseElement(e),l||u){let e="";if(i.success){e=s.replace(r,"")}else e=s;if(appendAfterbegin(e),!u&&!i.success)return}if(u&&i.success){handleAfterRequest(u,r);return appendAfterbegin(s.replace(r,"")),r}if("@close"===u)return i.success?r:void 0;const d=await pphpFetch(n.href,a);if(getRedirectUrl(d))return void await handleRedirect(getRedirectUrl(d)||"");await handleResponseRedirectOrUpdate(s,d,r,i)}catch(e){}}function createFetchOptions(e){return{method:"POST",headers:{"Content-Type":"application/json",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(e)}}function getRedirectUrl(e){const t=e.match(redirectRegex3AE99);return t?t[1]:null}function getUpdatedHTMLContent(e,t,n){const o=document.createElement("div");if(o.id="afterbegin-8D95D",n&&t?.success){const t=e.replace(n,"");o.innerHTML=t}else o.innerHTML=e;return o.innerHTML?o:null}async function handleResponseRedirectOrUpdate(e,t,n,o){const a=getUpdatedHTMLContent(e,n,o),s=(new DOMParser).parseFromString(t,"text/html");a&&s.body.insertAdjacentElement("afterbegin",a),updateBodyContent(s.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),o=t?parseJson(t):null,a=n.targets;Array.isArray(a)&&a.forEach((e=>{const{id:t,...n}=e,a=document.querySelector(t);let s={};if(o){for(const t in n)if(n.hasOwnProperty(t))switch(t){case"innerHTML":case"outerHTML":case"textContent":case"innerText":"response"===n[t]&&(s[t]=e.responseKey?o[e.responseKey]:o.response);break;default:s[t]=n[t];break}}else s=n;a&&updateElementAttributes(a,s)}))}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 o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||e.apply(s,a)}),t),n&&!o&&e.apply(s,a)}}function copyCode(e,t,n,o,a="img",s=2e3){if(!(e instanceof HTMLElement))return;const r=e.closest(`.${t}`)?.querySelector("pre code"),i=r?.textContent?.trim()||"";i?navigator.clipboard.writeText(i).then((()=>{const t=e.querySelector(a);if(t)for(const[e,n]of Object.entries(o))e in t?t[e]=n:t.setAttribute(e,n);setTimeout((()=>{if(t)for(const[e,o]of Object.entries(n))e in t?t[e]=o:t.setAttribute(e,o)}),s)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}if((e=>{const t=e.pushState,n=e.replaceState;e.pushState=function(n,o,a){const s=t.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),s},e.replaceState=function(t,o,a){const s=n.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),s}})(window.history),document.addEventListener("PPBodyLoaded",(()=>{attachWireFunctionEvents(),observeDOMChanges()})),document.addEventListener("DOMContentLoaded",(()=>{document.dispatchEvent(new Event("PPBodyLoaded"))})),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,t=!0){if(this.state={...this.state,...e},this.listeners.forEach((e=>e(this.state))),this.saveState(),t){const e=localStorage.getItem("appState_59E13");e&&pphpFetchFunction("appState_59E13",{appState_59E13:e})}}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=parseJson(e),this.listeners.forEach((e=>e(this.state))))}resetState(e,t=!0){if(e?(delete this.state[e],this.saveState()):(this.state={},localStorage.removeItem("appState_59E13")),this.listeners.forEach((e=>e(this.state))),t){pphpFetchFunction("appState_59E13",{appState_59E13:e?localStorage.getItem("appState_59E13"):null})}}}store=e.getInstance()}
|
|
1
|
+
const eventAttributesB6B56=new Set(["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"]);(()=>{const e=EventTarget.prototype.addEventListener,t=EventTarget.prototype.removeEventListener,n=new Map;EventTarget.prototype.addEventListener=function(t,o,a){n.has(this)||n.set(this,new Map);const s=n.get(this).get(t)||new Set;s.add(o),n.get(this).set(t,s),e.call(this,t,o,a)},EventTarget.prototype.removeEventListener=function(e,o,a){if(n.has(this)&&n.get(this).has(e)){const t=n.get(this).get(e);t&&(t.delete(o),0===t.size&&n.get(this).delete(e))}t.call(this,e,o,a)},EventTarget.prototype.removeAllEventListeners=function(e){if(n.has(this)&&n.get(this).has(e)){const o=n.get(this).get(e);o&&(o.forEach((n=>{t.call(this,e,n)})),n.get(this).delete(e))}}})();const stateA129A={checkedElements:new Set};let responseDataDEAC2=null;var store=null;let isNavigatingA12E1=!1;const redirectRegex3AE99=/redirect_7F834\s*=\s*(\/[^\s]*)/;function observeDOMChanges(){new MutationObserver((e=>{for(const t of e)"childList"===t.type&&t.addedNodes.length>0&&attachWireFunctionEvents()})).observe(document.body,{childList:!0,subtree:!0})}function attachWireFunctionEvents(){handleHiddenAttribute();document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((e=>{if(handleAnchorTag(e),Array.from(e.attributes).filter((e=>eventAttributesB6B56.has(e.name))).forEach((t=>{const n=t.name.slice(2),o=t.value;e instanceof HTMLInputElement&&handleInputAppendParams(e,n),o&&(e.removeAttribute(t.name),handleDebounce(e,n,o))})),e instanceof HTMLFormElement){const t=e.getAttribute("onsubmit");t&&(e.removeAttribute("onsubmit"),handleDebounce(e,"submit",t))}}))}function handleInputAppendParams(e,t){"true"===e.getAttribute("pp-append-params")&&e.addEventListener(t,(e=>{const t=e.currentTarget,n=t.value.trim(),o=new URL(window.location.href),a=new URLSearchParams(o.search),s=t.name;if(s){n?a.set(s,n):a.delete(s);const e=a.toString()?`${o.pathname}?${a.toString()}`:o.pathname;history.replaceState(null,"",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 o=e.getAttribute(t);if(o)if(isJsonLike(o)){n(e,parseJson(o))}else{const n=parseTime(o);if(n>0){const o="pp-visibility"===t?"visibility":"display";scheduleChange(e,n,o,"visibility"===o?"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,o,a){const s=t.start?parseTime(t.start):0,r=t.end?parseTime(t.end):0;s>0?(e.style[n]=o,scheduleChange(e,s,n,a),r>0&&scheduleChange(e,s+r,n,o)):r>0&&scheduleChange(e,r,n,o)}function scheduleChange(e,t,n,o){setTimeout((()=>{requestAnimationFrame((()=>{e.style[n]=o}))}),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){e.removeEventListener(t,(()=>{}));const o=e.getAttribute("pp-debounce")||"",a=e.getAttribute("pp-before-request")||"",s=e.getAttribute("pp-after-request")||"",r=async t=>{t.preventDefault();try{a&&await invokeHandler(e,a,t),await invokeHandler(e,n,t),s&&"@close"!==s&&await invokeHandler(e,s,t),handlerAutofocusAttribute()}catch(e){}};if(o){const n=debounce(r,parseTime(o));e instanceof HTMLFormElement&&"submit"===t?e.addEventListener(t,(e=>{e.preventDefault(),n(e)})):e.addEventListener(t,n)}else e.addEventListener(t,r)}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 o=parseJson(n);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=["text","search","tel","url","password"];if(e instanceof HTMLInputElement)if(t.includes(e.type))if("number"===e.type){e.type="text";const t=e.value.length||0;e.setSelectionRange(t,t),e.type="number"}else setCursorPosition(e,o);else;else e instanceof HTMLTextAreaElement&&setCursorPosition(e,o)}e.focus(),t=!0}))}function setCursorPosition(e,t){if(t.start)e.setSelectionRange(0,0);else if(t.end){const t=e.value.length||0;e.setSelectionRange(t,t)}else if(t.length){const n=parseInt(t.length,10)||0;e.setSelectionRange(n,n)}}async function invokeHandler(e,t,n){try{const o=t.match(/^(\w+(\.\w+)*)\((.*)\)$/);if(o){const a=o[1],s=o[3],r=a.split("."),{context:i,methodName:c}=resolveContext(r);if("function"==typeof i[c])if(isJsonLike(s)){const t=parseJson(s);t.element=e,t.event=n;const o=[t];await i[c](...o)}else new Function("event",t).call(e,n);else 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:o}=parseCallback(e,t);if(!n)return;const a=window[n];if("function"==typeof a){const t=e.hasAttribute("pp-after-request"),n=Array.isArray(o.args)?o.args:[],s=responseDataDEAC2?parseJson(responseDataDEAC2):{response:responseDataDEAC2};let r={args:n,element:e,data:o};t&&(r={...r,...s}),await a(r)}else responseDataDEAC2=null,responseDataDEAC2=await handleUndefinedFunction(e,n,o)}function handleAnchorTag(e){e instanceof HTMLAnchorElement&&e.addEventListener("click",(async e=>{const t=e.currentTarget,n=t.getAttribute("href"),o=t.getAttribute("target");if(n&&"_blank"!==o&&!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 o="";const[a,s]=n.split("#");s&&(o=`#${s}`);new URLSearchParams(a.split("?")[1]).forEach(((e,n)=>{t.set(n,e)}));const r=`${e.pathname}?${t.toString()}${o}`;history.pushState(null,"",r)}else{const[e,t]=n.split("#"),o=`${e}${t?`#${t}`:""}`;history.pushState(null,"",o)}const o=n.indexOf("#");if(-1!==o){const e=n.slice(o+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,o=250;if(t)try{const e=parseJson(t);n=parseTime(e.fadeIn||n),o=parseTime(e.fadeOut||o)}catch(e){}return{fadeIn:n,fadeOut:o}},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)},o=async o=>{const a=document.querySelector("[pp-loading-content='true']")||document.body;if(a){const{fadeIn:s,fadeOut:r}=e(o);await t(a,r),a.innerHTML=o.innerHTML,n(a,s)}},a=window.location.pathname,s=document.getElementById("loading-file-1B87E");if(s){let e=null,t=a;for(;t&&(e=s.querySelector(`div[pp-loading-url='${t}']`),!e);){const e=t.lastIndexOf("/");t=e>0?t.substring(0,e):"/"}e||(e=s.querySelector("div[pp-loading-url='/']")),e&&await o(e)}const r=await pphpFetch(window.location.href),i=r.match(redirectRegex3AE99);if(i&&i[1]){const e=i[1];await handleRedirect(e)}else updateDocumentContent(r)}catch(e){}}function onUrlChange(){}async function updateBodyContent(e){const t=saveScrollPositions();saveState();const n=(new DOMParser).parseFromString(e,"text/html");document.removeAllEventListeners("PPBodyLoaded"),await appendCallbackResponse(n),restoreState(),restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("PPBodyLoaded"))}async function appendCallbackResponse(e){const t=e.getElementById("afterbegin-8D95D");if(t){const e=document.getElementById("afterbegin-8D95D");e?e.innerHTML=t.innerHTML:document.body.insertAdjacentHTML("afterbegin",t.outerHTML)}await populateDocumentBody(e)}async function updateDocumentContent(e){const t=saveScrollPositions(),n=(new DOMParser).parseFromString(e,"text/html"),o="pp-dynamic-script",a="pp-dynamic-link";document.head.querySelectorAll("[pp-dynamic-meta]").forEach((e=>e.remove()));document.head.querySelectorAll("[pp-dynamic-link]").forEach((e=>e.remove()));document.head.querySelectorAll("[pp-dynamic-script]").forEach((e=>e.remove()));document.removeAllEventListeners("PPBodyLoaded"),await(async e=>{Array.from(e.head.children).forEach((e=>{const t=e.tagName;if("SCRIPT"===t&&e.hasAttribute(o)){const t=document.createElement("script");Array.from(e.attributes).forEach((e=>t.setAttribute(e.name,e.value))),e.textContent&&(t.textContent=e.textContent),document.head.appendChild(t)}else if("META"===t){if(e.getAttribute("charset")||"viewport"===e.getAttribute("name"))return;const t=e.name,n=e.getAttribute("property"),o=document.head.querySelector(t?`meta[name="${t}"]`:`meta[property="${n}"]`);o?document.head.replaceChild(e.cloneNode(!0),o):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)}else if(e.hasAttribute(a)){const t=e.cloneNode(!0);document.head.appendChild(t)}}})),await populateDocumentBody(e)})(n),restoreScrollPositions(t),attachWireFunctionEvents(),document.dispatchEvent(new Event("PPBodyLoaded"))}function manageScriptTags(e,t){const n=e.querySelectorAll("script"),o=t?.querySelectorAll("script")||n;n.forEach(((e,t)=>{const n=document.createElement("script"),a=o[t]||e;Array.from(a.attributes).forEach((e=>{n.setAttribute(e.name,e.value)})),a.hasAttribute("src")||(n.textContent=a.textContent),e.parentNode?.replaceChild(n,e)}))}async function populateDocumentBody(e){try{const t=e.body.cloneNode(!0);manageScriptTags(t),document.body.replaceWith(t)}catch(e){}}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||"email"===e.type?(e.type="text",e.setSelectionRange(t,t),e.type="number"===e.type?"number":"email"):"date"===e.type||"month"===e.type||"week"===e.type||"time"===e.type||"datetime-local"===e.type||"color"===e.type||"file"===e.type||""!==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={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach((t=>{(t.scrollTop||t.scrollLeft)&&(e[getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})})),e}function restoreScrollPositions(e){requestAnimationFrame((()=>{const t=e.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop),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 reRunScripts(e){e.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");Array.from(e.attributes).forEach((e=>{t.setAttribute(e.name,e.value)})),e.hasAttribute("src")||(t.textContent=e.textContent),e.parentNode?.replaceChild(t,e)}))}async function pphpFetchFunction(e,t){const n=createFetchOptions({callback:e,...t});return await pphpFetch(window.location.href,n)}async function pphpSync(...e){try{const t=e.length>0?e.map((e=>`pp-sync="${e}"`)):['pp-sync="true"'],n=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()}),o=await pphpFetch(window.location.href,n),a=(new DOMParser).parseFromString(o,"text/html");t.forEach((e=>{const t=document.querySelectorAll(`[${e}]`),n=a.body.querySelectorAll(`[${e}]`);t.forEach(((e,t)=>{const o=n[t];o&&(e.innerHTML=o.innerHTML,reRunScripts(e))}))}))}catch(e){}}async function pphpFetchAndUpdateBodyContent(){const e=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()}),t=await pphpFetch(window.location.href,e);await updateBodyContent(t)}function parseCallback(e,t){let n={};const o=e.closest("form");if(o){new FormData(o).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[o,a]=decodeHTML(t[n]).split(",");e.classList.replace(o,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 o=e.attributes[n];t[o.name]=o.value}e.setAttribute("pp-original-state",JSON.stringify(t))}if(e instanceof HTMLFormElement){let t=null;const n=e.id;n&&(t=document.querySelector(`[form="${n}"]`)),n&&t||(t=Array.from(e.elements).find((e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement))),t&&(t.hasAttribute("pp-original-state")||saveElementOriginalState(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,o=document.querySelector(t);o&&a(o,n)}))}else o(t,e)}},o=(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 o=parseJson(t);if(o)if(e instanceof HTMLFormElement){const t=new FormData(e),a={};t.forEach(((e,t)=>{a[t]=e})),o.disabled&&toggleFormElements(e,!0);const{disabled:s,...r}=o;updateElementAttributes(e,r),n(e,a)}else if(o.targets){o.targets.forEach((e=>{const{id:t,...n}=e,o=document.querySelector(t);o&&a(o,n)}));const{targets:t,...n}=o;updateElementAttributes(e,n)}else{if("disabled"===o.empty&&""===e.value)return;const{empty:t,...n}=o;updateElementAttributes(e,n)}}else if(t)o(e,t);else if(e instanceof HTMLFormElement){const t=new FormData(e),o={};t.forEach(((e,t)=>{o[t]=e})),n(e,o)}}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)},o=(e,t)=>{for(const o in t)if(t.hasOwnProperty(o))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 o=parseJson(e);n(t,o)}else a(t,e);t.removeAttribute("pp-original-state")}}},a=(e,t)=>{e instanceof HTMLInputElement?e.value=t:e.textContent=t},s=(e,t)=>{e instanceof HTMLFormElement?o(e,t):n(e,t)};try{const a=parseJson(t);if(a)if(e instanceof HTMLFormElement){const t=e.id;if(t){const e=document.querySelector(`[form="${t}"]`);if(e){const t=e.getAttribute("pp-original-state");if(t&&isJsonLike(t)){const o=parseJson(t);n(e,o)}}}const a=new FormData(e),s={};if(a.forEach(((e,t)=>{s[t]=e})),o(e,s),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,o=document.querySelector(t);o&&s(o,n)}));const{targets:t,...o}=a;n(e,o)}else{const{empty:t,...o}=a;n(e,o)}}catch(e){}}e.querySelectorAll("[pp-suspense]").forEach((e=>restoreSuspenseElement(e))),e.removeAttribute("pp-original-state")}function parseJson(e){try{return JSON5.parse(e)}catch(e){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){const o=new FormData,a=n.files;if(a)for(let e=0;e<a.length;e++)o.append("file[]",a[e]);o.append("callback",t);const s=await fetch(e,{method:"POST",headers:{HTTP_PPHP_WIRE_REQUEST:"true"},body:o});return await s.text()}function getUrlParams(){const e={};return new URLSearchParams(window.location.search).forEach(((t,n)=>{e[n]=t})),e}async function handleUndefinedFunction(e,t,n){const o=createFetchOptions({callback:t,...n}),a=createFetchOptions({secondRequestC69CD:!0,...getUrlParams()});try{saveElementOriginalState(e),handleSuspenseElement(e);const n=new URL(window.location.href);let s="",r="",i={success:!1};const c=e.querySelector("input[type='file']");if(c){if(s=await pphpFetchFile(n.href,t,c),r=extractJson(s)||"",r)try{i=parseJson(r)}catch(e){}}else{if(s=await pphpFetch(n.href,o),getRedirectUrl(s))return void await handleRedirect(getRedirectUrl(s)||"");if(r=extractJson(s)||"",r)try{i=parseJson(r)}catch(e){}}const l=e.getAttribute("pp-before-request")||"",u=e.getAttribute("pp-after-request")||"";if((l||u&&i.success)&&restoreSuspenseElement(e),l||u){let e="";if(i.success){e=s.replace(r,"")}else e=s;if(appendAfterbegin(e),!u&&!i.success)return}if(u&&i.success){handleAfterRequest(u,r);return appendAfterbegin(s.replace(r,"")),r}if("@close"===u)return i.success?r:void 0;const d=await pphpFetch(n.href,a);if(getRedirectUrl(d))return void await handleRedirect(getRedirectUrl(d)||"");await handleResponseRedirectOrUpdate(s,d,r,i)}catch(e){}}function createFetchOptions(e){return{method:"POST",headers:{"Content-Type":"application/json",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(e)}}function getRedirectUrl(e){const t=e.match(redirectRegex3AE99);return t?t[1]:null}function getUpdatedHTMLContent(e,t,n){const o=document.createElement("div");if(o.id="afterbegin-8D95D",n&&t?.success){const t=e.replace(n,"");o.innerHTML=t}else o.innerHTML=e;return o.innerHTML?o:null}async function handleResponseRedirectOrUpdate(e,t,n,o){const a=getUpdatedHTMLContent(e,n,o),s=(new DOMParser).parseFromString(t,"text/html");a&&s.body.insertAdjacentElement("afterbegin",a),updateBodyContent(s.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),o=t?parseJson(t):null,a=n.targets;Array.isArray(a)&&a.forEach((e=>{const{id:t,...n}=e,a=document.querySelector(t);let s={};if(o){for(const t in n)if(n.hasOwnProperty(t))switch(t){case"innerHTML":case"outerHTML":case"textContent":case"innerText":"response"===n[t]&&(s[t]=e.responseKey?o[e.responseKey]:o.response);break;default:s[t]=n[t];break}}else s=n;a&&updateElementAttributes(a,s)}))}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 o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||e.apply(s,a)}),t),n&&!o&&e.apply(s,a)}}function copyCode(e,t,n,o,a="img",s=2e3){if(!(e instanceof HTMLElement))return;const r=e.closest(`.${t}`)?.querySelector("pre code"),i=r?.textContent?.trim()||"";i?navigator.clipboard.writeText(i).then((()=>{const t=e.querySelector(a);if(t)for(const[e,n]of Object.entries(o))e in t?t[e]=n:t.setAttribute(e,n);setTimeout((()=>{if(t)for(const[e,o]of Object.entries(n))e in t?t[e]=o:t.setAttribute(e,o)}),s)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}if((e=>{const t=e.pushState,n=e.replaceState;e.pushState=function(n,o,a){const s=t.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),s},e.replaceState=function(t,o,a){const s=n.apply(e,arguments);return window.dispatchEvent(new Event("urlchange")),s}})(window.history),document.addEventListener("PPBodyLoaded",(()=>{attachWireFunctionEvents(),observeDOMChanges()})),document.addEventListener("DOMContentLoaded",(()=>{document.dispatchEvent(new Event("PPBodyLoaded"))})),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,t=!1){if(this.state={...this.state,...e},this.listeners.forEach((e=>e(this.state))),this.saveState(),t){const e=localStorage.getItem("appState_59E13");e&&pphpFetchFunction("appState_59E13",{appState_59E13:e})}}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=parseJson(e),this.listeners.forEach((e=>e(this.state))))}resetState(e,t=!1){if(e?(delete this.state[e],this.saveState()):(this.state={},localStorage.removeItem("appState_59E13")),this.listeners.forEach((e=>e(this.state))),t){pphpFetchFunction("appState_59E13",{appState_59E13:e?localStorage.getItem("appState_59E13"):null})}}}store=e.getInstance()}
|