create-prisma-php-app 1.15.5 → 1.15.7

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.
@@ -7,8 +7,8 @@ function redirect(string $url, bool $replace = true, int $response_code = 0)
7
7
  echo "redirect_7F834=$url";
8
8
  } else {
9
9
  header("Location: $url", $replace, $response_code);
10
- exit;
11
10
  }
11
+ exit;
12
12
  }
13
13
 
14
14
  function isAjaxRequest()
@@ -8,51 +8,59 @@ namespace Lib;
8
8
  class StateManager
9
9
  {
10
10
  private const APP_STATE = 'app_state_F989A';
11
- private $state;
12
- private $listeners;
11
+ private array $state = [];
12
+ private array $listeners = [];
13
13
 
14
14
  /**
15
15
  * Initializes a new instance of the StateManager class.
16
- *
17
- * @param array $initialState The initial state of the application.
18
16
  */
19
- public function __construct(array $initialState = [])
17
+ public function __construct()
20
18
  {
21
19
  global $isWire;
22
20
 
23
- $this->state = $initialState;
24
- $this->listeners = [];
25
21
  $this->loadState();
26
22
 
27
- if (!$isWire) $this->resetState();
23
+ if (!$isWire) {
24
+ $this->resetState();
25
+ }
28
26
  }
29
27
 
30
28
  /**
31
- * Retrieves the current state of the application.
29
+ * Gets the state value for the specified key.
32
30
  *
33
- * @param string|null $key The key of the state value to retrieve. If null, returns the entire state.
34
- * @return mixed|null The state value corresponding to the given key, or null if the key is not found.
31
+ * @param string|null $key The key of the state value to get.
32
+ * @param mixed $initialValue The initial value to set if the key does not exist.
33
+ * @return mixed The state value for the specified key.
35
34
  */
36
- public function getState($key = null): mixed
35
+ public function getState(string $key = null, mixed $initialValue = null): mixed
37
36
  {
38
37
  if ($key === null) {
39
38
  return new \ArrayObject($this->state, \ArrayObject::ARRAY_AS_PROPS);
40
39
  }
41
40
 
42
- $value = $this->state[$key] ?? null;
41
+ if (!array_key_exists($key, $this->state)) {
42
+ if ($initialValue !== null) {
43
+ $this->setState($key, $initialValue);
44
+ }
45
+ } elseif ($initialValue !== null && $this->state[$key] !== $initialValue) {
46
+ $this->setState($key, $this->state[$key]);
47
+ }
48
+
49
+ $value = $this->state[$key] ?? $initialValue;
50
+
43
51
  return is_array($value) ? new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS) : $value;
44
52
  }
45
53
 
46
54
  /**
47
- * Updates the application state with the given update.
55
+ * Sets the state value for the specified key.
48
56
  *
49
- * @param string|array $key The key of the state value to update, or an array of key-value pairs to update multiple values.
50
- * @param mixed|null $value The value to update the state with, ignored if $key is an array.
57
+ * @param string $key The key of the state value to set.
58
+ * @param mixed $value The value to set.
51
59
  */
52
- public function setState($key, $value = null): void
60
+ public function setState(string $key, mixed $value = null): void
53
61
  {
54
- $update = is_array($key) ? $key : [$key => $value];
55
- $this->state = array_merge($this->state, $update);
62
+ $this->state[$key] = $value;
63
+
56
64
  $this->notifyListeners();
57
65
  $this->saveState();
58
66
  }
@@ -66,10 +74,8 @@ class StateManager
66
74
  public function subscribe(callable $listener): callable
67
75
  {
68
76
  $this->listeners[] = $listener;
69
- $listener($this->state); // Immediate call with current state
70
- return function () use ($listener) {
71
- $this->listeners = array_filter($this->listeners, fn ($l) => $l !== $listener);
72
- };
77
+ $listener($this->state);
78
+ return fn () => $this->listeners = array_filter($this->listeners, fn ($l) => $l !== $listener);
73
79
  }
74
80
 
75
81
  /**
@@ -77,7 +83,7 @@ class StateManager
77
83
  */
78
84
  private function saveState(): void
79
85
  {
80
- $_SESSION[self::APP_STATE] = json_encode($this->state);
86
+ $_SESSION[self::APP_STATE] = json_encode($this->state, JSON_THROW_ON_ERROR);
81
87
  }
82
88
 
83
89
  /**
@@ -86,8 +92,8 @@ class StateManager
86
92
  private function loadState(): void
87
93
  {
88
94
  if (isset($_SESSION[self::APP_STATE])) {
89
- $loadedState = json_decode($_SESSION[self::APP_STATE], true);
90
- if ($loadedState !== null) {
95
+ $loadedState = json_decode($_SESSION[self::APP_STATE], true, 512, JSON_THROW_ON_ERROR);
96
+ if (is_array($loadedState)) {
91
97
  $this->state = $loadedState;
92
98
  $this->notifyListeners();
93
99
  }
@@ -1 +1 @@
1
- "use strict";var eventAttributes=["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"];function attachWireFunctionEvents(){document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((t=>{t instanceof HTMLAnchorElement&&t.addEventListener("click",handleAnchorTag),eventAttributes.forEach((e=>{const n=t.getAttribute(e),o=e.slice(2);n&&(t.removeAttribute(e),handleDebounce(t,o,n))}))}))}async function handleDebounce(t,e,n){const o=t.getAttribute("pp-debounce"),a=t.getAttribute("pp-trigger"),s=async e=>{e.preventDefault(),a&&await invokeHandler(t,a),invokeHandler(t,n)};if(o){const n=debounce(s,parseInt(o,10));t.addEventListener(e,n)}else t.addEventListener(e,s)}async function invokeHandler(t,e){const{funcName:n,data:o}=parseCallback(t,e);if(n){const t=window[n];if("function"==typeof t)try{const e=Array.isArray(o)?o:[];await t(...e)}catch(t){}else await handleUndefinedFunction(n,o)}}async function handleAnchorTag(t){const e=t.currentTarget,n=e.getAttribute("href"),o=e.getAttribute("target");if(!n||"_blank"===o||t.metaKey||t.ctrlKey)return;t.preventDefault();if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else try{history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate",{state:null}))}catch(t){}}document.addEventListener("DOMContentLoaded",attachWireFunctionEvents);const state={checkedElements:new Set};function updateDocumentContent(t){if(t.includes("<!DOCTYPE html>")){const e=(new DOMParser).parseFromString(t,"text/html");document.replaceChild(document.adoptNode(e.documentElement),document.documentElement)}else{saveState();const e=saveScrollPositions(),n=(new DOMParser).parseFromString(t,"text/html"),o=Array.from(n.body.querySelectorAll("script")),a=n.body;diffAndPatch(document.body,a),restoreState(),restoreScrollPositions(e),o.forEach((t=>{if(t.src)loadScript(t.src);else{const e=document.createElement("script");e.textContent=t.textContent,document.body.appendChild(e),document.body.removeChild(e)}}))}attachWireFunctionEvents()}function diffAndPatch(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE||e.nodeType!==Node.TEXT_NODE?t instanceof HTMLElement&&e instanceof HTMLElement&&t.replaceWith(e):t.textContent!==e.textContent&&(t.textContent=e.textContent):t.parentNode?.replaceChild(e,t)}function updateAttributes(t,e){Array.from(e.attributes).forEach((e=>{t.getAttribute(e.name)!==e.value&&t.setAttribute(e.name,e.value)})),Array.from(t.attributes).forEach((n=>{e.hasAttribute(n.name)||t.removeAttribute(n.name)}))}function updateChildren(t,e){const n=t.childNodes,o=e.childNodes,a=Math.max(n.length,o.length);for(let e=0;e<a;e++){const a=n[e],s=o[e];a?s?diffAndPatch(a,s):t.removeChild(a):t.appendChild(s)}}function loadScript(t){const e=document.createElement("script");e.src=t,document.head.appendChild(e)}function saveState(){const t=document.activeElement;state.focusId=t?.id||t?.name,state.focusValue=t?.value,state.focusSelectionStart=t?.selectionStart,state.focusSelectionEnd=t?.selectionEnd,state.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((t=>{state.checkedElements.add(t.id||t.name)}))}function restoreState(){if(state.focusId){const t=document.getElementById(state.focusId)||document.querySelector(`[name="${state.focusId}"]`);t instanceof HTMLInputElement&&(t.focus(),"search"===t.type&&(t.value=state.focusValue||""),void 0!==state.focusSelectionStart&&null!==state.focusSelectionEnd&&t.setSelectionRange(state.focusSelectionStart||null,state.focusSelectionEnd||null))}state.checkedElements.forEach((t=>{const e=document.getElementById(t);e&&(e.checked=!0)}))}function saveScrollPositions(){const t={};return document.querySelectorAll("*").forEach((e=>{(e.scrollTop||e.scrollLeft)&&(t[getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})})),t}function restoreScrollPositions(t){document.querySelectorAll("*").forEach((e=>{const n=getElementKey(e);t[n]&&(e.scrollTop=t[n].scrollTop,e.scrollLeft=t[n].scrollLeft)}))}function getElementKey(t){return t.id||t.className||t.tagName}function parseCallback(t,e){let n={};if(t instanceof HTMLFormElement){const e=new FormData(t);n=Object.fromEntries(e.entries())}else t instanceof HTMLInputElement&&(t.name?"checkbox"===t.type||"radio"===t.type?n[t.name]=t.checked:n[t.name]=t.value:"checkbox"===t.type||"radio"===t.type?n.value=t.checked:n.value=t.value);const o=e.match(/(\w+)\((.*)\)/);if(o){const t=o[1];let e=o[2].trim();if(e.startsWith("{")&&e.endsWith("}")){const t=e.replace(/'/g,'"');try{const e=JSON.parse(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(t){}}else{const t=e.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((t=>t.trim().replace(/^['"]|['"]$/g,"")));n.args=t}return{funcName:t,data:n}}return{funcName:e,data:n}}async function handleUndefinedFunction(t,e){const n={callback:t,...e},o={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(n)},a={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify({secondRequest:!0})},s=async t=>{const e=await fetch(window.location.pathname,t);return await e.text()};try{const t=await s(o),e=await s(a);if(t.includes("redirect_7F834=")){const e=t.split("=")[1];await handleRedirect(e)}else{updateDocumentContent(t+e)}}catch(t){}}async function handleRedirect(t){if(t){history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate",{state:null}));try{const e=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await e.text())}catch(t){}}}function debounce(t,e=300,n=!1){let o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||t.apply(s,a)}),e),n&&!o&&t.apply(s,a)}}function copyCode(t,e,n,o,a=2e3){const s=t.closest(`.${e}`)?.querySelector("pre code"),c=s?.textContent?.trim()||"";c?navigator.clipboard.writeText(c).then((()=>{const e=t.querySelector("i");e&&(e.className=o),setTimeout((()=>{e&&(e.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}window.addEventListener("popstate",(async()=>{try{const t=await fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await t.text())}catch(t){}}));let api=null;if(void 0===api){class t{static instance=null;baseURL;constructor(t=window.location.origin){this.baseURL=t}static getInstance(e=window.location.origin){return t.instance||(t.instance=new t(e)),t.instance}async request(t,e,n=null,o={}){let a=`${this.baseURL}${e}`;const s={method:t,headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",...o}};if(n)if("GET"===t){a+=`?${new URLSearchParams(n).toString()}`}else"HEAD"!==t&&"OPTIONS"!==t&&(s.body=JSON.stringify(n));try{const e=await fetch(a,s);if("HEAD"===t)return e.headers;const n=e.headers.get("content-type");return n&&n.includes("application/json")?await e.json():await e.text()}catch(t){throw t}}get(t,e,n){return this.request("GET",t,e,n)}post(t,e,n){return this.request("POST",t,e,n)}put(t,e,n){return this.request("PUT",t,e,n)}delete(t,e,n){return this.request("DELETE",t,e,n)}patch(t,e,n){return this.request("PATCH",t,e,n)}head(t,e){return this.request("HEAD",t,null,e)}options(t,e){return this.request("OPTIONS",t,null,e)}}api=t.getInstance()}let store=null;if(void 0===store){class t{static instance=null;state;listeners;constructor(t={}){this.state=t,this.listeners=[]}static getInstance(e={}){return t.instance||(t.instance=new t(e),t.instance.loadState()),t.instance}setState(t,e=!1){this.state={...this.state,...t},this.listeners.forEach((t=>t(this.state))),e&&this.saveState()}subscribe(t){return this.listeners.push(t),t(this.state),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}saveState(){localStorage.setItem("appState",JSON.stringify(this.state))}loadState(){const t=localStorage.getItem("appState");t&&(this.state=JSON.parse(t),this.listeners.forEach((t=>t(this.state))))}resetState(t=!1){this.state={},this.listeners.forEach((t=>t(this.state))),t&&localStorage.removeItem("appState")}}store=t.getInstance()}
1
+ "use strict";var eventAttributes=["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"];document.addEventListener("DOMContentLoaded",attachWireFunctionEvents);const optimisticUpdates=new Map,state={checkedElements:new Set};function attachWireFunctionEvents(){document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((t=>{if(t instanceof HTMLAnchorElement&&t.addEventListener("click",handleAnchorTag),eventAttributes.forEach((e=>{const n=t.getAttribute(e),o=e.slice(2);n&&(t.removeAttribute(e),handleDebounce(t,o,n))})),t instanceof HTMLFormElement){const e=t.getAttribute("onsubmit");e&&(t.removeAttribute("onsubmit"),handleDebounce(t,"submit",e))}}))}async function handleDebounce(t,e,n){const o=t.getAttribute("pp-debounce"),a=t.getAttribute("pp-trigger"),s=async e=>{e.preventDefault();const o=saveOptimisticState(t);optimisticUpdates.set(t,o);try{a&&await invokeHandler(t,a),await invokeHandler(t,n)}catch(e){const n=optimisticUpdates.get(t);n&&revertOptimisticUpdate(t,n)}};if(o){const n=debounce(s,parseInt(o,10));t instanceof HTMLFormElement&&"submit"===e?t.addEventListener(e,(t=>{t.preventDefault(),n(t)})):t.addEventListener(e,n)}else t.addEventListener(e,s)}async function invokeHandler(t,e){const{funcName:n,data:o}=parseCallback(t,e);if(n){const t=window[n];if("function"==typeof t)try{const e=Array.isArray(o.args)?o.args:[];await t(...e,o)}catch(t){}else await handleUndefinedFunction(n,o)}}function extractStyles(t){const e={};for(let n=0;n<t.length;n++){const o=t[n];e[o]=t.getPropertyValue(o)}return e}function applyOptimisticUpdate(t,e){Object.entries(e.attributes).forEach((([e,n])=>{n?t.setAttribute(e,n):t.removeAttribute(e)})),Object.assign(t.style,e.styles),t.innerHTML=e.innerHTML||""}function revertOptimisticUpdate(t,e){"value"in e&&("checkbox"===t.type||"radio"===t.type?t.checked=!!e.value:t.value=e.value),"innerHTML"in e&&(t.innerHTML=e.innerHTML)}async function handleAnchorTag(t){const e=t.currentTarget,n=e.getAttribute("href"),o=e.getAttribute("target");if(!n||"_blank"===o||t.metaKey||t.ctrlKey)return;t.preventDefault();if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else try{history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate",{state:null}))}catch(t){}}function updateDocumentContent(t){if(t.includes("<!DOCTYPE html>")){const e=(new DOMParser).parseFromString(t,"text/html");document.replaceChild(document.adoptNode(e.documentElement),document.documentElement)}else{saveState();const e=saveScrollPositions(),n=(new DOMParser).parseFromString(t,"text/html"),o=Array.from(n.body.querySelectorAll("script")),a=n.body;diffAndPatch(document.body,a),restoreState(),restoreScrollPositions(e),o.forEach((t=>{if(t.src)loadScript(t.src);else{const e=document.createElement("script");e.textContent=t.textContent,document.body.appendChild(e),document.body.removeChild(e)}}))}attachWireFunctionEvents()}function diffAndPatch(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE||e.nodeType!==Node.TEXT_NODE?t instanceof HTMLElement&&e instanceof HTMLElement&&t.replaceWith(e):t.textContent!==e.textContent&&(t.textContent=e.textContent):t.parentNode?.replaceChild(e,t)}function updateAttributes(t,e){Array.from(e.attributes).forEach((e=>{t.getAttribute(e.name)!==e.value&&t.setAttribute(e.name,e.value)})),Array.from(t.attributes).forEach((n=>{e.hasAttribute(n.name)||t.removeAttribute(n.name)}))}function updateChildren(t,e){const n=t.childNodes,o=e.childNodes,a=Math.max(n.length,o.length);for(let e=0;e<a;e++){const a=n[e],s=o[e];a?s?diffAndPatch(a,s):t.removeChild(a):t.appendChild(s)}}function loadScript(t){const e=document.createElement("script");e.src=t,document.head.appendChild(e)}function saveState(){const t=document.activeElement;state.focusId=t?.id||t?.name,state.focusValue=t?.value,state.focusSelectionStart=t?.selectionStart,state.focusSelectionEnd=t?.selectionEnd,state.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((t=>{state.checkedElements.add(t.id||t.name)}))}function restoreState(){if(state.focusId){const t=document.getElementById(state.focusId)||document.querySelector(`[name="${state.focusId}"]`);t instanceof HTMLInputElement&&(t.focus(),"search"===t.type&&(t.value=state.focusValue||""),void 0!==state.focusSelectionStart&&null!==state.focusSelectionEnd&&t.setSelectionRange(state.focusSelectionStart||null,state.focusSelectionEnd||null))}state.checkedElements.forEach((t=>{const e=document.getElementById(t);e&&(e.checked=!0)}))}function saveScrollPositions(){const t={};return document.querySelectorAll("*").forEach((e=>{(e.scrollTop||e.scrollLeft)&&(t[getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})})),t}function restoreScrollPositions(t){document.querySelectorAll("*").forEach((e=>{const n=getElementKey(e);t[n]&&(e.scrollTop=t[n].scrollTop,e.scrollLeft=t[n].scrollLeft)}))}function getElementKey(t){return t.id||t.className||t.tagName}function parseCallback(t,e){let n={};const o=t.closest("form");if(o){new FormData(o).forEach(((t,e)=>{n[e]?Array.isArray(n[e])?n[e].push(t):n[e]=[n[e],t]:n[e]=t}))}else t instanceof HTMLInputElement?n=handleInputElement(t):(t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&(n[t.name]=t.value);const a=e.match(/(\w+)\((.*)\)/);if(a){const t=a[1];let e=a[2].trim();if(e.startsWith("{")&&e.endsWith("}")){const t=e.replace(/'/g,'"');try{const e=JSON.parse(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(t){}}else{const t=e.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((t=>t.trim().replace(/^['"]|['"]$/g,"")));n.args=t}return{funcName:t,data:n}}return{funcName:e,data:n}}function handleInputElement(t){let e={};return t.name?"checkbox"===t.type||"radio"===t.type?e[t.name]=t.checked:e[t.name]=t.value:"checkbox"===t.type||"radio"===t.type?e.value=t.checked:e.value=t.value,e}function captureState(t){const e={};for(const n of t.attributes)e[n.name]=n.value;return{attributes:e,styles:extractStyles(window.getComputedStyle(t)),innerHTML:t.innerHTML||""}}async function handleUndefinedFunction(t,e){const n={callback:t,...e},o={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(n)},a={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify({secondRequest:!0})},s=async t=>{const e=await fetch(window.location.pathname,t);return await e.text()};try{const t=await s(o),e=await s(a);if(t.includes("redirect_7F834=")){const e=t.split("=")[1];await handleRedirect(e)}else{updateDocumentContent(t+e)}}catch(t){revertOptimisticUpdate(document.body,captureState(document.body))}}function saveOptimisticState(t){return{value:t.value||t.checked||"",attributes:Array.from(t.attributes).reduce(((t,e)=>(t[e.name]=e.value,t)),{}),styles:extractStyles(window.getComputedStyle(t)),innerHTML:t.innerHTML}}async function handleRedirect(t){if(t){history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate",{state:null}));try{const e=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await e.text())}catch(t){}}}function debounce(t,e=300,n=!1){let o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||t.apply(s,a)}),e),n&&!o&&t.apply(s,a)}}function copyCode(t,e,n,o,a=2e3){const s=t.closest(`.${e}`)?.querySelector("pre code"),c=s?.textContent?.trim()||"";c?navigator.clipboard.writeText(c).then((()=>{const e=t.querySelector("i");e&&(e.className=o),setTimeout((()=>{e&&(e.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}window.addEventListener("popstate",(async()=>{try{const t=await fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await t.text())}catch(t){}}));let api=null;if(void 0===api){class t{static instance=null;baseURL;constructor(t=window.location.origin){this.baseURL=t}static getInstance(e=window.location.origin){return t.instance||(t.instance=new t(e)),t.instance}async request(t,e,n=null,o={}){let a=`${this.baseURL}${e}`;const s={method:t,headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",...o}};if(n)if("GET"===t){a+=`?${new URLSearchParams(n).toString()}`}else"HEAD"!==t&&"OPTIONS"!==t&&(s.body=JSON.stringify(n));try{const e=await fetch(a,s);if("HEAD"===t)return e.headers;const n=e.headers.get("content-type");return n&&n.includes("application/json")?await e.json():await e.text()}catch(t){throw t}}get(t,e,n){return this.request("GET",t,e,n)}post(t,e,n){return this.request("POST",t,e,n)}put(t,e,n){return this.request("PUT",t,e,n)}delete(t,e,n){return this.request("DELETE",t,e,n)}patch(t,e,n){return this.request("PATCH",t,e,n)}head(t,e){return this.request("HEAD",t,null,e)}options(t,e){return this.request("OPTIONS",t,null,e)}}api=t.getInstance()}let store=null;if(void 0===store){class t{static instance=null;state;listeners;constructor(t={}){this.state=t,this.listeners=[]}static getInstance(e={}){return t.instance||(t.instance=new t(e),t.instance.loadState()),t.instance}setState(t,e=!1){this.state={...this.state,...t},this.listeners.forEach((t=>t(this.state))),e&&this.saveState()}subscribe(t){return this.listeners.push(t),t(this.state),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}saveState(){localStorage.setItem("appState",JSON.stringify(this.state))}loadState(){const t=localStorage.getItem("appState");t&&(this.state=JSON.parse(t),this.listeners.forEach((t=>t(this.state))))}resetState(t=!1){this.state={},this.listeners.forEach((t=>t(this.state))),t&&localStorage.removeItem("appState")}}store=t.getInstance()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.15.5",
3
+ "version": "1.15.7",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",