Current section
Files
Jump to
Current section
Files
priv/static/livex.min.js
var LiveView=(()=>{var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,y=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var g=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))w.call(e,t)&&g(r,t,e[t]);if(y)for(var t of y(e))U.call(e,t)&&g(r,t,e[t]);return r};var A=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},$=(r,e,t,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of b(e))!w.call(r,a)&&a!==t&&u(r,a,{get:()=>e[a],enumerable:!(c=m(e,a))||c.enumerable});return r};var v=r=>$(u({},"__esModule",{value:!0}),r);var L={};A(L,{enhanceLiveSocket:()=>S});function O(r){return encodeURIComponent(r).replace(/%5B/g,"[").replace(/%5D/g,"]")}function E(r,e){let t=r,c={};Object.entries(e).forEach(([i,n])=>{let o=new RegExp(`:${i}(?=/|$)`,"g");o.test(t)?t=t.replace(o,encodeURIComponent(String(n))):c[i]=n});let a=[];function l(i,n){i!=null&&(typeof i=="object"&&!Array.isArray(i)?Object.entries(i).forEach(([o,s])=>l(s,`${n}[${o}]`)):Array.isArray(i)?i.forEach((o,s)=>l(o,`${n}[${s}]`)):a.push(`${O(n)}=${encodeURIComponent(String(i))}`))}return Object.entries(c).forEach(([i,n])=>l(n,i)),a.length?`${t}?${a.join("&")}`:t}function R(){let r=document.getElementById("lv-page-params");if(!r)throw new Error('Element with id "lv-page-params" not found.');let e=r.getAttribute("lv-route");if(!e)throw new Error('Attribute "lv-route" not found.');let t={},c={};Array.from(r.attributes).forEach(({name:n,value:o})=>{if(n.startsWith("lv-url-")){let s=n.slice(7);t[s]=JSON.parse(o)}else if(n.startsWith("lv-data-")){let s=n.slice(8);c[s]=JSON.parse(o)}}),document.querySelectorAll("div[data-phx-component]").forEach(n=>{let o=n.id;if(!o)return;let s=`_${o}`;Array.from(n.attributes).forEach(({name:f,value:p})=>{if(f.startsWith("lv-url-")){let h=f.slice(7);t[s]=t[s]||{},t[s][h]=JSON.parse(p)}else if(f.startsWith("lv-data-")){let h=f.slice(8);c[s]=c[s]||{},c[s][h]=JSON.parse(p)}})});let a=E(e,t),l={};Object.keys(t).forEach(n=>l[n]=t[n]),Object.entries(c).forEach(([n,o])=>{l[n]&&typeof l[n]=="object"&&typeof o=="object"?l[n]=d(d({},l[n]),o):l[n]=o});let i=E(e,l);return{primaryUrl:a,combinedUrl:i}}function S(r){return r.domCallbacks.onPatchEnd=function(e){try{let t=R(),c=new URL(t.primaryUrl,window.location.origin),a=new URL(t.combinedUrl,window.location.origin);r.historyPatch(c.href,"push"),window.liveSocket.href=c.href,window.liveSocket.main&&window.liveSocket.main.setHref(a.href)}catch(t){console.error("Error updating URL:",t)}},r.pushPatchUrl=(e,t={})=>{r.historyPatch(e,t)},window.addEventListener("phx:js-execute",({detail:e})=>{r.execJS(document.body,e.ops)}),r}return v(L);})();