cable_ready-element 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ var e;var t="http://www.w3.org/1999/xhtml",n="undefined"==typeof document?void 0:document,r=!!n&&"content"in n.createElement("template"),o=!!n&&n.createRange&&"createContextualFragment"in n.createRange();function a(t){return t=t.trim(),r?function(e){var t=n.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(t):o?function(t){return e||(e=n.createRange()).selectNode(n.body),e.createContextualFragment(t).childNodes[0]}(t):function(e){var t=n.createElement("body");return t.innerHTML=e,t.childNodes[0]}(t)}function i(e,t){var n,r,o=e.nodeName,a=t.nodeName;return o===a||(n=o.charCodeAt(0),r=a.charCodeAt(0),n<=90&&r>=97?o===a.toUpperCase():r<=90&&n>=97&&a===o.toUpperCase())}function s(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var l={OPTION:function(e,t){var n=e.parentNode;if(n){var r=n.nodeName.toUpperCase();"OPTGROUP"===r&&(r=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==r||n.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}s(e,t,"selected")},INPUT:function(e,t){s(e,t,"checked"),s(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var r=e.firstChild;if(r){var o=r.nodeValue;if(o==n||!n&&o==e.placeholder)return;r.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n,r,o=-1,a=0,i=e.firstChild;i;)if("OPTGROUP"===(r=i.nodeName&&i.nodeName.toUpperCase()))i=(n=i).firstChild;else{if("OPTION"===r){if(i.hasAttribute("selected")){o=a;break}a++}!(i=i.nextSibling)&&n&&(i=n.nextSibling,n=null)}e.selectedIndex=o}}};function c(){}function u(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var d=function(e){return function(r,o,s){if(s||(s={}),"string"==typeof o)if("#document"===r.nodeName||"HTML"===r.nodeName||"BODY"===r.nodeName){var d=o;(o=n.createElement("html")).innerHTML=d}else o=a(o);var m=s.getNodeKey||u,h=s.onBeforeNodeAdded||c,f=s.onNodeAdded||c,p=s.onBeforeElUpdated||c,b=s.onElUpdated||c,g=s.onBeforeNodeDiscarded||c,y=s.onNodeDiscarded||c,v=s.onBeforeElChildrenUpdated||c,w=!0===s.childrenOnly,E=Object.create(null),A=[];function T(e){A.push(e)}function S(e,t){if(1===e.nodeType)for(var n=e.firstChild;n;){var r=void 0;t&&(r=m(n))?T(r):(y(n),n.firstChild&&S(n,t)),n=n.nextSibling}}function C(e,t,n){!1!==g(e)&&(t&&t.removeChild(e),y(e),S(e,n))}function N(e){f(e);for(var t=e.firstChild;t;){var n=t.nextSibling,r=m(t);if(r){var o=E[r];o&&i(t,o)?(t.parentNode.replaceChild(o,t),x(o,t)):N(t)}else N(t);t=n}}function x(t,r,o){var a=m(r);if(a&&delete E[a],!o){if(!1===p(t,r))return;if(e(t,r),b(t),!1===v(t,r))return}"TEXTAREA"!==t.nodeName?function(e,t){var r,o,a,s,c,u=t.firstChild,d=e.firstChild;e:for(;u;){for(s=u.nextSibling,r=m(u);d;){if(a=d.nextSibling,u.isSameNode&&u.isSameNode(d)){u=s,d=a;continue e}o=m(d);var f=d.nodeType,p=void 0;if(f===u.nodeType&&(1===f?(r?r!==o&&((c=E[r])?a===c?p=!1:(e.insertBefore(c,d),o?T(o):C(d,e,!0),d=c):p=!1):o&&(p=!1),(p=!1!==p&&i(d,u))&&x(d,u)):3!==f&&8!=f||(p=!0,d.nodeValue!==u.nodeValue&&(d.nodeValue=u.nodeValue))),p){u=s,d=a;continue e}o?T(o):C(d,e,!0),d=a}if(r&&(c=E[r])&&i(c,u))e.appendChild(c),x(c,u);else{var b=h(u);!1!==b&&(b&&(u=b),u.actualize&&(u=u.actualize(e.ownerDocument||n)),e.appendChild(u),N(u))}u=s,d=a}!function(e,t,n){for(;t;){var r=t.nextSibling;(n=m(t))?T(n):C(t,e,!0),t=r}}(e,d,o);var g=l[e.nodeName];g&&g(e,t)}(t,r):l.TEXTAREA(t,r)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var r=m(n);r&&(E[r]=n),e(n),n=n.nextSibling}}(r);var L=r,O=L.nodeType,M=o.nodeType;if(!w)if(1===O)1===M?i(r,o)||(y(r),L=function(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}(r,function(e,r){return r&&r!==t?n.createElementNS(r,e):n.createElement(e)}(o.nodeName,o.namespaceURI))):L=o;else if(3===O||8===O){if(M===O)return L.nodeValue!==o.nodeValue&&(L.nodeValue=o.nodeValue),L;L=o}if(L===o)y(r);else{if(o.isSameNode&&o.isSameNode(L))return;if(x(L,o,w),A)for(var $=0,R=A.length;$<R;$++){var U=E[A[$]];U&&C(U,U.parentNode,!1)}}return!w&&L!==r&&r.parentNode&&(L.actualize&&(L=L.actualize(r.ownerDocument||n)),r.parentNode.replaceChild(L,r)),L}}((function(e,t){var n,r,o,a,i=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var s=i.length-1;s>=0;s--)r=(n=i[s]).name,o=n.namespaceURI,a=n.value,o?(r=n.localName||r,e.getAttributeNS(o,r)!==a&&("xmlns"===n.prefix&&(r=n.name),e.setAttributeNS(o,r,a))):e.getAttribute(r)!==a&&e.setAttribute(r,a);for(var l=e.attributes,c=l.length-1;c>=0;c--)r=(n=l[c]).name,(o=n.namespaceURI)?(r=n.localName||r,t.hasAttributeNS(o,r)||e.removeAttributeNS(o,r)):t.hasAttribute(r)||e.removeAttribute(r)}})),m="5.0.1";const h={INPUT:!0,TEXTAREA:!0,SELECT:!0},f={INPUT:!0,TEXTAREA:!0,OPTION:!0},p={"datetime-local":!0,"select-multiple":!0,"select-one":!0,color:!0,date:!0,datetime:!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,textarea:!0,time:!0,url:!0,week:!0};let b;var g={get element(){return b},set(e){b=e}};const y=e=>h[e.tagName]&&p[e.type],v=e=>{const t=(e&&e.nodeType===Node.ELEMENT_NODE?e:document.querySelector(e))||g.element;t&&t.focus&&t.focus()},w=(e,t,n={})=>{const r=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(r),window.jQuery&&window.jQuery(e).trigger(t,n)},E=e=>document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,A=(e,t=!1)=>{const n=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),r=[];for(let e=0;e<n.snapshotLength;e++)r.push(n.snapshotItem(e));return t?r.reverse():r},T=e=>Array.from(e).flat(),S=(e,t)=>{Array.from(e.selectAll?e.element:[e.element]).forEach(t)},C=(N=function(e,t,n){return e+(n?"-":"")+t.toLowerCase()},function(e){return x(e).reduce(N,"")});var N;const x=e=>(e=null==e?"":e).match(/([A-Z]{2,}|[0-9]+|[A-Z]?[a-z]+|[A-Z])/g)||[],L=(e,t)=>!e.cancel&&(e.delay?setTimeout(t,e.delay):t(),!0),O=(e,t)=>w(e,`cable-ready:before-${C(t.operation)}`,t),M=(e,t)=>w(e,`cable-ready:after-${C(t.operation)}`,t);function $(e,t=250){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}}function R(e){if(!e.ok)throw Error(e.statusText);return e}function U(e){return void 0===e||["string","number","boolean"].includes(typeof e)||console.warn(`Operation expects a string, number or boolean, but got ${e} (${typeof e})`),null!=e?e:""}function D(e){return void 0!==e&&"string"!=typeof e&&console.warn(`Operation expects a string, but got ${e} (${typeof e})`),null!=e?String(e):""}function k(e){return void 0===e||Array.isArray(e)||console.warn(`Operation expects an array, but got ${e} (${typeof e})`),null!=e?Array.from(e):[]}function I(e){return void 0!==e&&"object"!=typeof e&&console.warn(`Operation expects an object, but got ${e} (${typeof e})`),null!=e?Object(e):{}}function P(e){return void 0===e||Array.isArray(e)||"string"==typeof e||console.warn(`Operation expects an Array or a String, but got ${e} (${typeof e})`),null==e?"":Array.isArray(e)?Array.from(e):String(e)}async function q(e,t){try{const n=await fetch(e,{headers:{"X-REQUESTED-WITH":"XmlHttpRequest",...t}});if(null==n)return;return R(n),n}catch(t){console.error(`Could not fetch ${e}`)}}class H{constructor(e){this.maxSize=e,this.queue=[]}push(e){this.isFull()&&this.shift(),this.queue.push(e)}shift(){return this.queue.shift()}isFull(){return this.queue.length===this.maxSize}}Object.freeze({__proto__:null,BoundedQueue:H,after:M,assignFocus:v,before:O,debounce:$,dispatch:w,fragmentToString:function(e){return(new XMLSerializer).serializeToString(e)},getClassNames:T,graciouslyFetch:q,handleErrors:R,isTextInput:y,kebabize:C,operate:L,processElements:S,safeArray:k,safeObject:I,safeScalar:U,safeString:D,safeStringOrArray:P,xpathToElement:E,xpathToElementArray:A});const _=e=>(t,n)=>!X.map((r=>"function"!=typeof r||r(e,t,n))).includes(!1),j=e=>t=>{B.forEach((n=>{"function"==typeof n&&n(e,t)}))},z=(e,t,n)=>!(!f[t.tagName]&&t.isEqualNode(n)),F=(e,t,n)=>t!==g.element||!t.isContentEditable,V=(e,t,n)=>{const{permanentAttributeName:r}=e;if(!r)return!0;const o=t.closest(`[${r}]`);if(!o&&t===g.element&&y(t)){const e={value:!0};return Array.from(n.attributes).forEach((n=>{e[n.name]||t.setAttribute(n.name,n.value)})),!1}return!o},X=[z,V,F],B=[];Object.freeze({__proto__:null,didMorph:j,didMorphCallbacks:B,shouldMorph:_,shouldMorphCallbacks:X,verifyNotContentEditable:F,verifyNotMutable:z,verifyNotPermanent:V});var Y={append:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{html:n,focusSelector:r}=e;t.insertAdjacentHTML("beforeend",U(n)),v(r)})),M(t,e)}))},graft:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{parent:n,focusSelector:r}=e,o=document.querySelector(n);o&&(o.appendChild(t),v(r))})),M(t,e)}))},innerHtml:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{html:n,focusSelector:r}=e;t.innerHTML=U(n),v(r)})),M(t,e)}))},insertAdjacentHtml:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{html:n,position:r,focusSelector:o}=e;t.insertAdjacentHTML(r||"beforeend",U(n)),v(o)})),M(t,e)}))},insertAdjacentText:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{text:n,position:r,focusSelector:o}=e;t.insertAdjacentText(r||"beforeend",U(n)),v(o)})),M(t,e)}))},outerHtml:e=>{S(e,(t=>{const n=t.parentElement,r=n&&Array.from(n.children).indexOf(t);O(t,e),L(e,(()=>{const{html:n,focusSelector:r}=e;t.outerHTML=U(n),v(r)})),M(n?n.children[r]:document.documentElement,e)}))},prepend:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{html:n,focusSelector:r}=e;t.insertAdjacentHTML("afterbegin",U(n)),v(r)})),M(t,e)}))},remove:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{focusSelector:n}=e;t.remove(),v(n)})),M(document,e)}))},replace:e=>{S(e,(t=>{const n=t.parentElement,r=n&&Array.from(n.children).indexOf(t);O(t,e),L(e,(()=>{const{html:n,focusSelector:r}=e;t.outerHTML=U(n),v(r)})),M(n?n.children[r]:document.documentElement,e)}))},textContent:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{text:n,focusSelector:r}=e;t.textContent=U(n),v(r)})),M(t,e)}))},addCssClass:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n}=e;t.classList.add(...T([P(n)]))})),M(t,e)}))},removeAttribute:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n}=e;t.removeAttribute(D(n))})),M(t,e)}))},removeCssClass:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n}=e;t.classList.remove(...T([P(n)])),0===t.classList.length&&t.removeAttribute("class")})),M(t,e)}))},setAttribute:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n,value:r}=e;t.setAttribute(D(n),U(r))})),M(t,e)}))},setDatasetProperty:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n,value:r}=e;t.dataset[D(n)]=U(r)})),M(t,e)}))},setProperty:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n,value:r}=e;n in t&&(t[D(n)]=U(r))})),M(t,e)}))},setStyle:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n,value:r}=e;t.style[D(n)]=U(r)})),M(t,e)}))},setStyles:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{styles:n}=e;for(let[e,r]of Object.entries(n))t.style[D(e)]=U(r)})),M(t,e)}))},setValue:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{value:n}=e;t.value=U(n)})),M(t,e)}))},dispatchEvent:e=>{S(e,(t=>{O(t,e),L(e,(()=>{const{name:n,detail:r}=e;w(t,D(n),I(r))})),M(t,e)}))},setMeta:e=>{O(document,e),L(e,(()=>{const{name:t,content:n}=e;let r=document.head.querySelector(`meta[name='${t}']`);r||(r=document.createElement("meta"),r.name=D(t),document.head.appendChild(r)),r.content=U(n)})),M(document,e)},setTitle:e=>{O(document,e),L(e,(()=>{const{title:t}=e;document.title=U(t)})),M(document,e)},clearStorage:e=>{O(document,e),L(e,(()=>{const{type:t}=e;("session"===t?sessionStorage:localStorage).clear()})),M(document,e)},go:e=>{O(window,e),L(e,(()=>{const{delta:t}=e;history.go(t)})),M(window,e)},pushState:e=>{O(window,e),L(e,(()=>{const{state:t,title:n,url:r}=e;history.pushState(I(t),D(n),D(r))})),M(window,e)},redirectTo:e=>{O(window,e),L(e,(()=>{let{url:t,action:n,turbo:r}=e;n=n||"advance",t=D(t),void 0===r&&(r=!0),r?(window.Turbo&&window.Turbo.visit(t,{action:n}),window.Turbolinks&&window.Turbolinks.visit(t,{action:n}),window.Turbo||window.Turbolinks||(window.location.href=t)):window.location.href=t})),M(window,e)},reload:e=>{O(window,e),L(e,(()=>{window.location.reload()})),M(window,e)},removeStorageItem:e=>{O(document,e),L(e,(()=>{const{key:t,type:n}=e;("session"===n?sessionStorage:localStorage).removeItem(D(t))})),M(document,e)},replaceState:e=>{O(window,e),L(e,(()=>{const{state:t,title:n,url:r}=e;history.replaceState(I(t),D(n),D(r))})),M(window,e)},scrollIntoView:e=>{const{element:t}=e;O(t,e),L(e,(()=>{t.scrollIntoView(e)})),M(t,e)},setCookie:e=>{O(document,e),L(e,(()=>{const{cookie:t}=e;document.cookie=U(t)})),M(document,e)},setFocus:e=>{const{element:t}=e;O(t,e),L(e,(()=>{v(t)})),M(t,e)},setStorageItem:e=>{O(document,e),L(e,(()=>{const{key:t,value:n,type:r}=e;("session"===r?sessionStorage:localStorage).setItem(D(t),U(n))})),M(document,e)},consoleLog:e=>{O(document,e),L(e,(()=>{const{message:t,level:n}=e;n&&["warn","info","error"].includes(n)?console[n](t):console.log(t)})),M(document,e)},consoleTable:e=>{O(document,e),L(e,(()=>{const{data:t,columns:n}=e;console.table(t,k(n))})),M(document,e)},notification:e=>{O(document,e),L(e,(()=>{const{title:t,options:n}=e;Notification.requestPermission().then((r=>{e.permission=r,"granted"===r&&new Notification(D(t),I(n))}))})),M(document,e)},morph:e=>{S(e,(t=>{const{html:n}=e,r=document.createElement("template");r.innerHTML=String(U(n)).trim(),e.content=r.content;const o=t.parentElement,a=o&&Array.from(o.children).indexOf(t);O(t,e),L(e,(()=>{const{childrenOnly:n,focusSelector:o}=e;d(t,n?r.content:r.innerHTML,{childrenOnly:!!n,onBeforeElUpdated:_(e),onElUpdated:j(e)}),v(o)})),M(o?o.children[a]:document.documentElement,e)}))}};let Q=Y;const Z=e=>{Q={...Q,...e}};var G={get all(){return Q}};let J="warn";var K={get behavior(){return J},set(e){["warn","ignore","event","exception"].includes(e)?J=e:console.warn("Invalid 'onMissingElement' option. Defaulting to 'warn'.")}};const W=(e,t={onMissingElement:K.behavior})=>{const n={};e.forEach((e=>{e.batch&&(n[e.batch]=n[e.batch]?++n[e.batch]:1)})),e.forEach((e=>{const r=e.operation;try{if(e.selector?e.xpath?e.element=e.selectAll?A(e.selector):E(e.selector):e.element=e.selectAll?document.querySelectorAll(e.selector):document.querySelector(e.selector):e.element=document,e.element||"ignore"!==t.onMissingElement){g.set(document.activeElement);const t=G.all[r];t?(t(e),e.batch&&0==--n[e.batch]&&w(document,"cable-ready:batch-complete",{batch:e.batch})):console.error(`CableReady couldn't find the "${r}" operation. Make sure you use the camelized form when calling an operation method.`)}}catch(n){if(e.element)console.error(`CableReady detected an error in ${r||"operation"}: ${n.message}. If you need to support older browsers make sure you've included the corresponding polyfills. https://docs.stimulusreflex.com/setup#polyfills-for-ie11.`),console.error(n);else{const n=`CableReady ${r||""} operation failed due to missing DOM element for selector: '${e.selector}'`;switch(t.onMissingElement){case"ignore":break;case"event":w(document,"cable-ready:missing-element",{warning:n,operation:e});break;case"exception":throw n;default:console.warn(n)}}}}))};class ee extends HTMLElement{static get tagName(){throw new Error("Implement the tagName() getter in the inheriting class")}static define(){customElements.get(this.tagName)||customElements.define(this.tagName,this)}disconnectedCallback(){this.channel&&this.channel.unsubscribe()}createSubscription(e,t,n){this.channel=e.subscriptions.create({channel:t,identifier:this.identifier},{received:n})}get preview(){return document.documentElement.hasAttribute("data-turbolinks-preview")||document.documentElement.hasAttribute("data-turbo-preview")}get identifier(){return this.getAttribute("identifier")}}let te;const ne=[25,50,75,100,200,250,500,800,1e3,2e3],re=async(e=0)=>{if(te)return te;if(e>=ne.length)throw new Error("Couldn't obtain a Action Cable consumer within 5s");var t;return await(t=ne[e],new Promise((e=>setTimeout(e,t)))),await re(e+1)};var oe={setConsumer(e){te=e},get consumer(){return te},getConsumer:async()=>await re()};class ae extends ee{static get tagName(){return"cable-ready-stream-from"}async connectedCallback(){if(this.preview)return;const e=await oe.getConsumer();e?this.createSubscription(e,"CableReady::Stream",this.performOperations.bind(this)):console.error("The `cable_ready_stream_from` helper cannot connect. You must initialize CableReady with an Action Cable consumer.")}performOperations(e){e.cableReady&&W(e.operations,{onMissingElement:this.onMissingElement})}get onMissingElement(){const e=this.getAttribute("missing")||K.behavior;return["warn","ignore","event"].includes(e)?e:(console.warn("Invalid 'missing' attribute. Defaulting to 'warn'."),"warn")}}let ie=!1;var se={get enabled(){return ie},get disabled(){return!ie},get value(){return ie},set(e){ie=!!e},set debug(e){ie=!!e}};var le=(e,t)=>{if(se.disabled)return;const n=`↑ Updatable request affecting ${t.length} element(s): `;return console.log(n,{elements:t.map((e=>e.element)),identifiers:t.map((e=>e.element.getAttribute("identifier"))),data:e}),n},ce=(e,t)=>{if(se.disabled)return;const n=`❌ Updatable request canceled after ${new Date-e}ms: ${t}`;return console.log(n),n},ue=(e,t,n)=>{if(se.disabled)return;const r=`↓ Updatable response: All URLs fetched in ${new Date-e}ms`;return console.log(r,{element:t,urls:n}),r},de=(e,t)=>{if(se.disabled)return;const n=`↻ Updatable morph: starting after ${new Date-e}ms`;return console.log(n,{element:t}),n},me=(e,t)=>{if(se.disabled)return;const n=`↺ Updatable morph: completed after ${new Date-e}ms`;return console.log(n,{element:t}),n};class he extends ee{static get tagName(){return"cable-ready-updates-for"}constructor(){super();this.attachShadow({mode:"open"}).innerHTML="\n<style>\n :host {\n display: block;\n }\n</style>\n<slot></slot>\n",this.triggerElementLog=new H(10),this.targetElementLog=new H(10)}async connectedCallback(){if(this.preview)return;this.update=$(this.update.bind(this),this.debounce);const e=await oe.getConsumer();e?this.createSubscription(e,"CableReady::Stream",this.update):console.error("The `cable_ready_updates_for` helper cannot connect. You must initialize CableReady with an Action Cable consumer.")}async update(e){this.lastUpdateTimestamp=new Date;const t=Array.from(document.querySelectorAll(this.query),(e=>new fe(e))).filter((t=>t.shouldUpdate(e)));if(this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${le(e,t)}`),0===t.length)return void this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${ce(this.lastUpdateTimestamp,"All elements filtered out")}`);if(t[0].element!==this)return void this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${ce(this.lastUpdateTimestamp,"Update already requested")}`);g.set(document.activeElement),this.html={};const n=[...new Set(t.map((e=>e.url)))];await Promise.all(n.map((async e=>{if(!this.html.hasOwnProperty(e)){const t=await q(e,{"X-Cable-Ready":"update"});this.html[e]=await t.text()}}))),this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${ue(this.lastUpdateTimestamp,this,n)}`),this.index={},t.forEach((t=>{this.index.hasOwnProperty(t.url)?this.index[t.url]++:this.index[t.url]=0,t.process(e,this.html,this.index,this.lastUpdateTimestamp)}))}get query(){return`${this.tagName}[identifier="${this.identifier}"]`}get identifier(){return this.getAttribute("identifier")}get debounce(){return this.hasAttribute("debounce")?parseInt(this.getAttribute("debounce")):20}}class fe{constructor(e){this.element=e}async process(e,t,n,r){const o=n[this.url],a=document.createElement("template");this.element.setAttribute("updating","updating"),a.innerHTML=String(t[this.url]).trim(),await this.resolveTurboFrames(a.content);const i=a.content.querySelectorAll(this.query);if(i.length<=o)return void console.warn(`Update aborted due to insufficient number of elements. The offending url is ${this.url}, the offending element is:`,this.element);const s={element:this.element,html:i[o],permanentAttributeName:"data-ignore-updates"};w(this.element,"cable-ready:before-update",s),this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${de(r,this.element)}`),d(this.element,i[o],{childrenOnly:!0,onBeforeElUpdated:_(s),onElUpdated:e=>{this.element.removeAttribute("updating"),w(this.element,"cable-ready:after-update",s),v(s.focusSelector)}}),this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${me(r,this.element)}`)}async resolveTurboFrames(e){const t=[...e.querySelectorAll('turbo-frame[src]:not([loading="lazy"])')];return Promise.all(t.map((t=>new Promise((async n=>{const r=await q(t.getAttribute("src"),{"Turbo-Frame":t.id,"X-Cable-Ready":"update"}),o=document.createElement("template");o.innerHTML=await r.text(),await this.resolveTurboFrames(o.content);const a=`turbo-frame#${t.id}`,i=o.content.querySelector(a),s=i?i.innerHTML.trim():"";e.querySelector(a).innerHTML=s,n()})))))}shouldUpdate(e){return!this.ignoresInnerUpdates&&this.hasChangesSelectedForUpdate(e)}hasChangesSelectedForUpdate(e){const t=this.element.getAttribute("only");return!(t&&e.changed&&!t.split(" ").some((t=>e.changed.includes(t))))}get ignoresInnerUpdates(){return this.element.hasAttribute("ignore-inner-updates")&&this.element.hasAttribute("performing-inner-update")}get url(){return this.element.hasAttribute("url")?this.element.getAttribute("url"):location.href}get identifier(){return this.element.identifier}get query(){return this.element.query}}const pe=e=>{const t=e&&e.parentElement&&e.parentElement.closest("cable-ready-updates-for");t&&(t.setAttribute("performing-inner-update",""),pe(t))},be=e=>{const t=e&&e.parentElement&&e.parentElement.closest("cable-ready-updates-for");t&&(t.removeAttribute("performing-inner-update"),be(t))},ge=()=>{document.addEventListener("stimulus-reflex:before",(e=>{pe(e.detail.element)})),document.addEventListener("stimulus-reflex:after",(e=>{setTimeout((()=>{be(e.detail.element)}))})),document.addEventListener("turbo:submit-start",(e=>{pe(e.target)})),document.addEventListener("turbo:submit-end",(e=>{setTimeout((()=>{be(e.target)}))})),document.addEventListener("turbo-boost:command:start",(e=>{pe(e.target)})),document.addEventListener("turbo-boost:command:finish",(e=>{setTimeout((()=>{be(e.target)}))})),document.addEventListener("turbo-boost:command:error",(e=>{setTimeout((()=>{be(e.target)}))})),ae.define(),he.define()},ye={perform:W,performAsync:(e,t={onMissingElement:K.behavior})=>new Promise(((n,r)=>{try{n(W(e,t))}catch(e){r(e)}})),shouldMorphCallbacks:X,didMorphCallbacks:B,initialize:(e={})=>{const{consumer:t,onMissingElement:n,debug:r}=e;se.set(!!r),t?oe.setConsumer(t):console.error("CableReady requires a reference to your Action Cable `consumer` for its helpers to function.\nEnsure that you have imported the `CableReady` package as well as `consumer` from your `channels` folder, then call `CableReady.initialize({ consumer })`."),n&&MissingElement.set(n),ge()},addOperation:(e,t)=>{const n={};n[e]=t,Z(n)},addOperations:e=>{Z(e)},version:m,cable:oe,get DOMOperations(){return console.warn("DEPRECATED: Please use `CableReady.operations` instead of `CableReady.DOMOperations`"),G.all},get operations(){return G.all},get consumer(){return oe.consumer}};window.CableReady=ye;class ve extends HTMLElement{static define(){customElements.get("cable-ready")||customElements.define("cable-ready",this)}connectedCallback(){setTimeout((()=>{try{const e=JSON.parse(this.scriptElement.textContent);ye.perform(e)}catch(e){console.error(e)}finally{try{this.remove()}catch{}}}))}get scriptElement(){if(this.firstElementChild instanceof HTMLScriptElement&&"application/json"===this.firstElementChild.getAttribute("type"))return this.firstElementChild;throw new Error('First child element in a `<cable-ready>` tag must be `<script type="application/json">`.')}}ve.define();export{ve as CableReadyElement};
2
+ //# sourceMappingURL=cable_ready-element.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cable_ready-element.min.js","sources":["../../../node_modules/morphdom/dist/morphdom-esm.js","../../../node_modules/cable_ready/dist/cable_ready.js","../../../javascript/elements/cable_ready_element.js","../../../javascript/elements/index.js"],"sourcesContent":["var DOCUMENT_FRAGMENT_NODE = 11;\n\nfunction morphAttrs(fromNode, toNode) {\n var toNodeAttrs = toNode.attributes;\n var attr;\n var attrName;\n var attrNamespaceURI;\n var attrValue;\n var fromValue;\n\n // document-fragments dont have attributes so lets not do anything\n if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {\n return;\n }\n\n // update attributes on original DOM element\n for (var i = toNodeAttrs.length - 1; i >= 0; i--) {\n attr = toNodeAttrs[i];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n attrValue = attr.value;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);\n\n if (fromValue !== attrValue) {\n if (attr.prefix === 'xmlns'){\n attrName = attr.name; // It's not allowed to set an attribute with the XMLNS namespace without specifying the `xmlns` prefix\n }\n fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);\n }\n } else {\n fromValue = fromNode.getAttribute(attrName);\n\n if (fromValue !== attrValue) {\n fromNode.setAttribute(attrName, attrValue);\n }\n }\n }\n\n // Remove any extra attributes found on the original DOM element that\n // weren't found on the target element.\n var fromNodeAttrs = fromNode.attributes;\n\n for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {\n attr = fromNodeAttrs[d];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n\n if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {\n fromNode.removeAttributeNS(attrNamespaceURI, attrName);\n }\n } else {\n if (!toNode.hasAttribute(attrName)) {\n fromNode.removeAttribute(attrName);\n }\n }\n }\n}\n\nvar range; // Create a range object for efficently rendering strings to elements.\nvar NS_XHTML = 'http://www.w3.org/1999/xhtml';\n\nvar doc = typeof document === 'undefined' ? undefined : document;\nvar HAS_TEMPLATE_SUPPORT = !!doc && 'content' in doc.createElement('template');\nvar HAS_RANGE_SUPPORT = !!doc && doc.createRange && 'createContextualFragment' in doc.createRange();\n\nfunction createFragmentFromTemplate(str) {\n var template = doc.createElement('template');\n template.innerHTML = str;\n return template.content.childNodes[0];\n}\n\nfunction createFragmentFromRange(str) {\n if (!range) {\n range = doc.createRange();\n range.selectNode(doc.body);\n }\n\n var fragment = range.createContextualFragment(str);\n return fragment.childNodes[0];\n}\n\nfunction createFragmentFromWrap(str) {\n var fragment = doc.createElement('body');\n fragment.innerHTML = str;\n return fragment.childNodes[0];\n}\n\n/**\n * This is about the same\n * var html = new DOMParser().parseFromString(str, 'text/html');\n * return html.body.firstChild;\n *\n * @method toElement\n * @param {String} str\n */\nfunction toElement(str) {\n str = str.trim();\n if (HAS_TEMPLATE_SUPPORT) {\n // avoid restrictions on content for things like `<tr><th>Hi</th></tr>` which\n // createContextualFragment doesn't support\n // <template> support not available in IE\n return createFragmentFromTemplate(str);\n } else if (HAS_RANGE_SUPPORT) {\n return createFragmentFromRange(str);\n }\n\n return createFragmentFromWrap(str);\n}\n\n/**\n * Returns true if two node's names are the same.\n *\n * NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same\n * nodeName and different namespace URIs.\n *\n * @param {Element} a\n * @param {Element} b The target element\n * @return {boolean}\n */\nfunction compareNodeNames(fromEl, toEl) {\n var fromNodeName = fromEl.nodeName;\n var toNodeName = toEl.nodeName;\n var fromCodeStart, toCodeStart;\n\n if (fromNodeName === toNodeName) {\n return true;\n }\n\n fromCodeStart = fromNodeName.charCodeAt(0);\n toCodeStart = toNodeName.charCodeAt(0);\n\n // If the target element is a virtual DOM node or SVG node then we may\n // need to normalize the tag name before comparing. Normal HTML elements that are\n // in the \"http://www.w3.org/1999/xhtml\"\n // are converted to upper case\n if (fromCodeStart <= 90 && toCodeStart >= 97) { // from is upper and to is lower\n return fromNodeName === toNodeName.toUpperCase();\n } else if (toCodeStart <= 90 && fromCodeStart >= 97) { // to is upper and from is lower\n return toNodeName === fromNodeName.toUpperCase();\n } else {\n return false;\n }\n}\n\n/**\n * Create an element, optionally with a known namespace URI.\n *\n * @param {string} name the element name, e.g. 'div' or 'svg'\n * @param {string} [namespaceURI] the element's namespace URI, i.e. the value of\n * its `xmlns` attribute or its inferred namespace.\n *\n * @return {Element}\n */\nfunction createElementNS(name, namespaceURI) {\n return !namespaceURI || namespaceURI === NS_XHTML ?\n doc.createElement(name) :\n doc.createElementNS(namespaceURI, name);\n}\n\n/**\n * Copies the children of one DOM element to another DOM element\n */\nfunction moveChildren(fromEl, toEl) {\n var curChild = fromEl.firstChild;\n while (curChild) {\n var nextChild = curChild.nextSibling;\n toEl.appendChild(curChild);\n curChild = nextChild;\n }\n return toEl;\n}\n\nfunction syncBooleanAttrProp(fromEl, toEl, name) {\n if (fromEl[name] !== toEl[name]) {\n fromEl[name] = toEl[name];\n if (fromEl[name]) {\n fromEl.setAttribute(name, '');\n } else {\n fromEl.removeAttribute(name);\n }\n }\n}\n\nvar specialElHandlers = {\n OPTION: function(fromEl, toEl) {\n var parentNode = fromEl.parentNode;\n if (parentNode) {\n var parentName = parentNode.nodeName.toUpperCase();\n if (parentName === 'OPTGROUP') {\n parentNode = parentNode.parentNode;\n parentName = parentNode && parentNode.nodeName.toUpperCase();\n }\n if (parentName === 'SELECT' && !parentNode.hasAttribute('multiple')) {\n if (fromEl.hasAttribute('selected') && !toEl.selected) {\n // Workaround for MS Edge bug where the 'selected' attribute can only be\n // removed if set to a non-empty value:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12087679/\n fromEl.setAttribute('selected', 'selected');\n fromEl.removeAttribute('selected');\n }\n // We have to reset select element's selectedIndex to -1, otherwise setting\n // fromEl.selected using the syncBooleanAttrProp below has no effect.\n // The correct selectedIndex will be set in the SELECT special handler below.\n parentNode.selectedIndex = -1;\n }\n }\n syncBooleanAttrProp(fromEl, toEl, 'selected');\n },\n /**\n * The \"value\" attribute is special for the <input> element since it sets\n * the initial value. Changing the \"value\" attribute without changing the\n * \"value\" property will have no effect since it is only used to the set the\n * initial value. Similar for the \"checked\" attribute, and \"disabled\".\n */\n INPUT: function(fromEl, toEl) {\n syncBooleanAttrProp(fromEl, toEl, 'checked');\n syncBooleanAttrProp(fromEl, toEl, 'disabled');\n\n if (fromEl.value !== toEl.value) {\n fromEl.value = toEl.value;\n }\n\n if (!toEl.hasAttribute('value')) {\n fromEl.removeAttribute('value');\n }\n },\n\n TEXTAREA: function(fromEl, toEl) {\n var newValue = toEl.value;\n if (fromEl.value !== newValue) {\n fromEl.value = newValue;\n }\n\n var firstChild = fromEl.firstChild;\n if (firstChild) {\n // Needed for IE. Apparently IE sets the placeholder as the\n // node value and vise versa. This ignores an empty update.\n var oldValue = firstChild.nodeValue;\n\n if (oldValue == newValue || (!newValue && oldValue == fromEl.placeholder)) {\n return;\n }\n\n firstChild.nodeValue = newValue;\n }\n },\n SELECT: function(fromEl, toEl) {\n if (!toEl.hasAttribute('multiple')) {\n var selectedIndex = -1;\n var i = 0;\n // We have to loop through children of fromEl, not toEl since nodes can be moved\n // from toEl to fromEl directly when morphing.\n // At the time this special handler is invoked, all children have already been morphed\n // and appended to / removed from fromEl, so using fromEl here is safe and correct.\n var curChild = fromEl.firstChild;\n var optgroup;\n var nodeName;\n while(curChild) {\n nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();\n if (nodeName === 'OPTGROUP') {\n optgroup = curChild;\n curChild = optgroup.firstChild;\n } else {\n if (nodeName === 'OPTION') {\n if (curChild.hasAttribute('selected')) {\n selectedIndex = i;\n break;\n }\n i++;\n }\n curChild = curChild.nextSibling;\n if (!curChild && optgroup) {\n curChild = optgroup.nextSibling;\n optgroup = null;\n }\n }\n }\n\n fromEl.selectedIndex = selectedIndex;\n }\n }\n};\n\nvar ELEMENT_NODE = 1;\nvar DOCUMENT_FRAGMENT_NODE$1 = 11;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\n\nfunction noop() {}\n\nfunction defaultGetNodeKey(node) {\n if (node) {\n return (node.getAttribute && node.getAttribute('id')) || node.id;\n }\n}\n\nfunction morphdomFactory(morphAttrs) {\n\n return function morphdom(fromNode, toNode, options) {\n if (!options) {\n options = {};\n }\n\n if (typeof toNode === 'string') {\n if (fromNode.nodeName === '#document' || fromNode.nodeName === 'HTML' || fromNode.nodeName === 'BODY') {\n var toNodeHtml = toNode;\n toNode = doc.createElement('html');\n toNode.innerHTML = toNodeHtml;\n } else {\n toNode = toElement(toNode);\n }\n }\n\n var getNodeKey = options.getNodeKey || defaultGetNodeKey;\n var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;\n var onNodeAdded = options.onNodeAdded || noop;\n var onBeforeElUpdated = options.onBeforeElUpdated || noop;\n var onElUpdated = options.onElUpdated || noop;\n var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;\n var onNodeDiscarded = options.onNodeDiscarded || noop;\n var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;\n var childrenOnly = options.childrenOnly === true;\n\n // This object is used as a lookup to quickly find all keyed elements in the original DOM tree.\n var fromNodesLookup = Object.create(null);\n var keyedRemovalList = [];\n\n function addKeyedRemoval(key) {\n keyedRemovalList.push(key);\n }\n\n function walkDiscardedChildNodes(node, skipKeyedNodes) {\n if (node.nodeType === ELEMENT_NODE) {\n var curChild = node.firstChild;\n while (curChild) {\n\n var key = undefined;\n\n if (skipKeyedNodes && (key = getNodeKey(curChild))) {\n // If we are skipping keyed nodes then we add the key\n // to a list so that it can be handled at the very end.\n addKeyedRemoval(key);\n } else {\n // Only report the node as discarded if it is not keyed. We do this because\n // at the end we loop through all keyed elements that were unmatched\n // and then discard them in one final pass.\n onNodeDiscarded(curChild);\n if (curChild.firstChild) {\n walkDiscardedChildNodes(curChild, skipKeyedNodes);\n }\n }\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n /**\n * Removes a DOM node out of the original DOM\n *\n * @param {Node} node The node to remove\n * @param {Node} parentNode The nodes parent\n * @param {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.\n * @return {undefined}\n */\n function removeNode(node, parentNode, skipKeyedNodes) {\n if (onBeforeNodeDiscarded(node) === false) {\n return;\n }\n\n if (parentNode) {\n parentNode.removeChild(node);\n }\n\n onNodeDiscarded(node);\n walkDiscardedChildNodes(node, skipKeyedNodes);\n }\n\n // // TreeWalker implementation is no faster, but keeping this around in case this changes in the future\n // function indexTree(root) {\n // var treeWalker = document.createTreeWalker(\n // root,\n // NodeFilter.SHOW_ELEMENT);\n //\n // var el;\n // while((el = treeWalker.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n // // NodeIterator implementation is no faster, but keeping this around in case this changes in the future\n //\n // function indexTree(node) {\n // var nodeIterator = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT);\n // var el;\n // while((el = nodeIterator.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n function indexTree(node) {\n if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {\n var curChild = node.firstChild;\n while (curChild) {\n var key = getNodeKey(curChild);\n if (key) {\n fromNodesLookup[key] = curChild;\n }\n\n // Walk recursively\n indexTree(curChild);\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n indexTree(fromNode);\n\n function handleNodeAdded(el) {\n onNodeAdded(el);\n\n var curChild = el.firstChild;\n while (curChild) {\n var nextSibling = curChild.nextSibling;\n\n var key = getNodeKey(curChild);\n if (key) {\n var unmatchedFromEl = fromNodesLookup[key];\n // if we find a duplicate #id node in cache, replace `el` with cache value\n // and morph it to the child node.\n if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {\n curChild.parentNode.replaceChild(unmatchedFromEl, curChild);\n morphEl(unmatchedFromEl, curChild);\n } else {\n handleNodeAdded(curChild);\n }\n } else {\n // recursively call for curChild and it's children to see if we find something in\n // fromNodesLookup\n handleNodeAdded(curChild);\n }\n\n curChild = nextSibling;\n }\n }\n\n function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {\n // We have processed all of the \"to nodes\". If curFromNodeChild is\n // non-null then we still have some from nodes left over that need\n // to be removed\n while (curFromNodeChild) {\n var fromNextSibling = curFromNodeChild.nextSibling;\n if ((curFromNodeKey = getNodeKey(curFromNodeChild))) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n curFromNodeChild = fromNextSibling;\n }\n }\n\n function morphEl(fromEl, toEl, childrenOnly) {\n var toElKey = getNodeKey(toEl);\n\n if (toElKey) {\n // If an element with an ID is being morphed then it will be in the final\n // DOM so clear it out of the saved elements collection\n delete fromNodesLookup[toElKey];\n }\n\n if (!childrenOnly) {\n // optional\n if (onBeforeElUpdated(fromEl, toEl) === false) {\n return;\n }\n\n // update attributes on original DOM element first\n morphAttrs(fromEl, toEl);\n // optional\n onElUpdated(fromEl);\n\n if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {\n return;\n }\n }\n\n if (fromEl.nodeName !== 'TEXTAREA') {\n morphChildren(fromEl, toEl);\n } else {\n specialElHandlers.TEXTAREA(fromEl, toEl);\n }\n }\n\n function morphChildren(fromEl, toEl) {\n var curToNodeChild = toEl.firstChild;\n var curFromNodeChild = fromEl.firstChild;\n var curToNodeKey;\n var curFromNodeKey;\n\n var fromNextSibling;\n var toNextSibling;\n var matchingFromEl;\n\n // walk the children\n outer: while (curToNodeChild) {\n toNextSibling = curToNodeChild.nextSibling;\n curToNodeKey = getNodeKey(curToNodeChild);\n\n // walk the fromNode children all the way through\n while (curFromNodeChild) {\n fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n curFromNodeKey = getNodeKey(curFromNodeChild);\n\n var curFromNodeType = curFromNodeChild.nodeType;\n\n // this means if the curFromNodeChild doesnt have a match with the curToNodeChild\n var isCompatible = undefined;\n\n if (curFromNodeType === curToNodeChild.nodeType) {\n if (curFromNodeType === ELEMENT_NODE) {\n // Both nodes being compared are Element nodes\n\n if (curToNodeKey) {\n // The target node has a key so we want to match it up with the correct element\n // in the original DOM tree\n if (curToNodeKey !== curFromNodeKey) {\n // The current element in the original DOM tree does not have a matching key so\n // let's check our lookup to see if there is a matching element in the original\n // DOM tree\n if ((matchingFromEl = fromNodesLookup[curToNodeKey])) {\n if (fromNextSibling === matchingFromEl) {\n // Special case for single element removals. To avoid removing the original\n // DOM node out of the tree (since that can break CSS transitions, etc.),\n // we will instead discard the current node and wait until the next\n // iteration to properly match up the keyed target element with its matching\n // element in the original tree\n isCompatible = false;\n } else {\n // We found a matching keyed element somewhere in the original DOM tree.\n // Let's move the original DOM node into the current position and morph\n // it.\n\n // NOTE: We use insertBefore instead of replaceChild because we want to go through\n // the `removeNode()` function for the node that is being discarded so that\n // all lifecycle hooks are correctly invoked\n fromEl.insertBefore(matchingFromEl, curFromNodeChild);\n\n // fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = matchingFromEl;\n }\n } else {\n // The nodes are not compatible since the \"to\" node has a key and there\n // is no matching keyed node in the source tree\n isCompatible = false;\n }\n }\n } else if (curFromNodeKey) {\n // The original has a key\n isCompatible = false;\n }\n\n isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);\n if (isCompatible) {\n // We found compatible DOM elements so transform\n // the current \"from\" node to match the current\n // target DOM node.\n // MORPH\n morphEl(curFromNodeChild, curToNodeChild);\n }\n\n } else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {\n // Both nodes being compared are Text or Comment nodes\n isCompatible = true;\n // Simply update nodeValue on the original node to\n // change the text value\n if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {\n curFromNodeChild.nodeValue = curToNodeChild.nodeValue;\n }\n\n }\n }\n\n if (isCompatible) {\n // Advance both the \"to\" child and the \"from\" child since we found a match\n // Nothing else to do as we already recursively called morphChildren above\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n // No compatible match so remove the old node from the DOM and continue trying to find a\n // match in the original DOM. However, we only do this if the from node is not keyed\n // since it is possible that a keyed node might match up with a node somewhere else in the\n // target tree and we don't want to discard it just yet since it still might find a\n // home in the final DOM tree. After everything is done we will remove any keyed nodes\n // that didn't find a home\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = fromNextSibling;\n } // END: while(curFromNodeChild) {}\n\n // If we got this far then we did not find a candidate match for\n // our \"to node\" and we exhausted all of the children \"from\"\n // nodes. Therefore, we will just append the current \"to\" node\n // to the end\n if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {\n fromEl.appendChild(matchingFromEl);\n // MORPH\n morphEl(matchingFromEl, curToNodeChild);\n } else {\n var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);\n if (onBeforeNodeAddedResult !== false) {\n if (onBeforeNodeAddedResult) {\n curToNodeChild = onBeforeNodeAddedResult;\n }\n\n if (curToNodeChild.actualize) {\n curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);\n }\n fromEl.appendChild(curToNodeChild);\n handleNodeAdded(curToNodeChild);\n }\n }\n\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n }\n\n cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);\n\n var specialElHandler = specialElHandlers[fromEl.nodeName];\n if (specialElHandler) {\n specialElHandler(fromEl, toEl);\n }\n } // END: morphChildren(...)\n\n var morphedNode = fromNode;\n var morphedNodeType = morphedNode.nodeType;\n var toNodeType = toNode.nodeType;\n\n if (!childrenOnly) {\n // Handle the case where we are given two DOM nodes that are not\n // compatible (e.g. <div> --> <span> or <div> --> TEXT)\n if (morphedNodeType === ELEMENT_NODE) {\n if (toNodeType === ELEMENT_NODE) {\n if (!compareNodeNames(fromNode, toNode)) {\n onNodeDiscarded(fromNode);\n morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));\n }\n } else {\n // Going from an element node to a text node\n morphedNode = toNode;\n }\n } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node\n if (toNodeType === morphedNodeType) {\n if (morphedNode.nodeValue !== toNode.nodeValue) {\n morphedNode.nodeValue = toNode.nodeValue;\n }\n\n return morphedNode;\n } else {\n // Text node to something else\n morphedNode = toNode;\n }\n }\n }\n\n if (morphedNode === toNode) {\n // The \"to node\" was not compatible with the \"from node\" so we had to\n // toss out the \"from node\" and use the \"to node\"\n onNodeDiscarded(fromNode);\n } else {\n if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {\n return;\n }\n\n morphEl(morphedNode, toNode, childrenOnly);\n\n // We now need to loop over any keyed nodes that might need to be\n // removed. We only do the removal if we know that the keyed node\n // never found a match. When a keyed node is matched up we remove\n // it out of fromNodesLookup and we use fromNodesLookup to determine\n // if a keyed node has been matched up or not\n if (keyedRemovalList) {\n for (var i=0, len=keyedRemovalList.length; i<len; i++) {\n var elToRemove = fromNodesLookup[keyedRemovalList[i]];\n if (elToRemove) {\n removeNode(elToRemove, elToRemove.parentNode, false);\n }\n }\n }\n }\n\n if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {\n if (morphedNode.actualize) {\n morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);\n }\n // If we had to swap out the from node with a new node because the old\n // node was not compatible with the target node then we need to\n // replace the old DOM node in the original DOM tree. This is only\n // possible if the original DOM node was part of a DOM tree which\n // we know is the case if it has a parent node.\n fromNode.parentNode.replaceChild(morphedNode, fromNode);\n }\n\n return morphedNode;\n };\n}\n\nvar morphdom = morphdomFactory(morphAttrs);\n\nexport default morphdom;\n","import morphdom from \"morphdom\";\n\nvar name = \"cable_ready\";\n\nvar version = \"5.0.1\";\n\nvar description = \"CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.\";\n\nvar keywords = [ \"ruby\", \"rails\", \"websockets\", \"actioncable\", \"cable\", \"ssr\", \"stimulus_reflex\", \"client-side\", \"dom\" ];\n\nvar homepage = \"https://cableready.stimulusreflex.com\";\n\nvar bugs = \"https://github.com/stimulusreflex/cable_ready/issues\";\n\nvar repository = \"https://github.com/stimulusreflex/cable_ready\";\n\nvar license = \"MIT\";\n\nvar author = \"Nathan Hopkins <natehop@gmail.com>\";\n\nvar contributors = [ \"Andrew Mason <andrewmcodes@protonmail.com>\", \"Julian Rubisch <julian@julianrubisch.at>\", \"Marco Roth <marco.roth@intergga.ch>\", \"Nathan Hopkins <natehop@gmail.com>\" ];\n\nvar main = \"./dist/cable_ready.js\";\n\nvar module = \"./dist/cable_ready.js\";\n\nvar browser = \"./dist/cable_ready.js\";\n\nvar unpkg = \"./dist/cable_ready.umd.js\";\n\nvar umd = \"./dist/cable_ready.umd.js\";\n\nvar files = [ \"dist/*\", \"javascript/*\" ];\n\nvar scripts = {\n lint: \"yarn run format --check\",\n format: \"yarn run prettier-standard ./javascript/**/*.js rollup.config.mjs\",\n build: \"yarn rollup -c\",\n watch: \"yarn rollup -wc\",\n test: \"web-test-runner javascript/test/**/*.test.js\",\n \"docs:dev\": \"vitepress dev docs\",\n \"docs:build\": \"vitepress build docs && cp ./docs/_redirects ./docs/.vitepress/dist\",\n \"docs:preview\": \"vitepress preview docs\"\n};\n\nvar dependencies = {\n morphdom: \"2.6.1\"\n};\n\nvar devDependencies = {\n \"@open-wc/testing\": \"^3.1.7\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.0.1\",\n \"@rollup/plugin-terser\": \"^0.4.0\",\n \"@web/dev-server-esbuild\": \"^0.3.3\",\n \"@web/dev-server-rollup\": \"^0.3.21\",\n \"@web/test-runner\": \"^0.15.1\",\n \"prettier-standard\": \"^16.4.1\",\n rollup: \"^3.19.1\",\n sinon: \"^15.0.2\",\n vite: \"^4.1.4\",\n vitepress: \"^1.0.0-beta.1\",\n \"vitepress-plugin-search\": \"^1.0.4-alpha.19\"\n};\n\nvar packageInfo = {\n name: name,\n version: version,\n description: description,\n keywords: keywords,\n homepage: homepage,\n bugs: bugs,\n repository: repository,\n license: license,\n author: author,\n contributors: contributors,\n main: main,\n module: module,\n browser: browser,\n import: \"./dist/cable_ready.js\",\n unpkg: unpkg,\n umd: umd,\n files: files,\n scripts: scripts,\n dependencies: dependencies,\n devDependencies: devDependencies\n};\n\nconst inputTags = {\n INPUT: true,\n TEXTAREA: true,\n SELECT: true\n};\n\nconst mutableTags = {\n INPUT: true,\n TEXTAREA: true,\n OPTION: true\n};\n\nconst textInputTypes = {\n \"datetime-local\": true,\n \"select-multiple\": true,\n \"select-one\": true,\n color: true,\n date: true,\n datetime: true,\n email: true,\n month: true,\n number: true,\n password: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n textarea: true,\n time: true,\n url: true,\n week: true\n};\n\nlet activeElement;\n\nvar ActiveElement = {\n get element() {\n return activeElement;\n },\n set(element) {\n activeElement = element;\n }\n};\n\n// Indicates if the passed element is considered a text input.\n\nconst isTextInput = element => inputTags[element.tagName] && textInputTypes[element.type];\n\n// Assigns focus to the appropriate element... preferring the explicitly passed selector\n\n// * selector - a CSS selector for the element that should have focus\n\nconst assignFocus = selector => {\n const element = selector && selector.nodeType === Node.ELEMENT_NODE ? selector : document.querySelector(selector);\n const focusElement = element || ActiveElement.element;\n if (focusElement && focusElement.focus) focusElement.focus();\n};\n\n// Dispatches an event on the passed element\n\n// * element - the element\n// * name - the name of the event\n// * detail - the event detail\n\nconst dispatch = (element, name, detail = {}) => {\n const init = {\n bubbles: true,\n cancelable: true,\n detail: detail\n };\n const event = new CustomEvent(name, init);\n element.dispatchEvent(event);\n if (window.jQuery) window.jQuery(element).trigger(name, detail);\n};\n\n// Accepts an xPath query and returns the element found at that position in the DOM\n\nconst xpathToElement = xpath => document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n\n// Accepts an xPath query and returns all matching elements in the DOM\n\nconst xpathToElementArray = (xpath, reverse = false) => {\n const snapshotList = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n const snapshots = [];\n for (let i = 0; i < snapshotList.snapshotLength; i++) {\n snapshots.push(snapshotList.snapshotItem(i));\n }\n return reverse ? snapshots.reverse() : snapshots;\n};\n\n// Return an array with the class names to be used\n\n// * names - could be a string or an array of strings for multiple classes.\n\nconst getClassNames = names => Array.from(names).flat()\n// Perform operation for either the first or all of the elements returned by CSS selector\n\n// * operation - the instruction payload from perform\n// * callback - the operation function to run for each element\n\n;\n\nconst processElements = (operation, callback) => {\n Array.from(operation.selectAll ? operation.element : [ operation.element ]).forEach(callback);\n};\n\n// convert string to kebab-case\n// most other implementations (lodash) are focused on camelCase to kebab-case\n// instead, this uses word token boundaries to produce readable URL slugs and keys\n// this implementation will not support Emoji or other non-ASCII characters\n\nconst kebabize = createCompounder((function(result, word, index) {\n return result + (index ? \"-\" : \"\") + word.toLowerCase();\n}));\n\nfunction createCompounder(callback) {\n return function(str) {\n return words(str).reduce(callback, \"\");\n };\n}\n\nconst words = str => {\n str = str == null ? \"\" : str;\n return str.match(/([A-Z]{2,}|[0-9]+|[A-Z]?[a-z]+|[A-Z])/g) || [];\n};\n\n// Provide a standardized pipeline of checks and modifications to all operations based on provided options\n// Currently skips execution if cancelled and implements an optional delay\n\nconst operate = (operation, callback) => {\n if (!operation.cancel) {\n operation.delay ? setTimeout(callback, operation.delay) : callback();\n return true;\n }\n return false;\n};\n\n// Dispatch life-cycle events with standardized naming\nconst before = (target, operation) => dispatch(target, `cable-ready:before-${kebabize(operation.operation)}`, operation);\n\nconst after = (target, operation) => dispatch(target, `cable-ready:after-${kebabize(operation.operation)}`, operation);\n\nfunction debounce(fn, delay = 250) {\n let timer;\n return (...args) => {\n const callback = () => fn.apply(this, args);\n if (timer) clearTimeout(timer);\n timer = setTimeout(callback, delay);\n };\n}\n\nfunction handleErrors(response) {\n if (!response.ok) throw Error(response.statusText);\n return response;\n}\n\nfunction safeScalar(val) {\n if (val !== undefined && ![ \"string\", \"number\", \"boolean\" ].includes(typeof val)) console.warn(`Operation expects a string, number or boolean, but got ${val} (${typeof val})`);\n return val != null ? val : \"\";\n}\n\nfunction safeString(str) {\n if (str !== undefined && typeof str !== \"string\") console.warn(`Operation expects a string, but got ${str} (${typeof str})`);\n return str != null ? String(str) : \"\";\n}\n\nfunction safeArray(arr) {\n if (arr !== undefined && !Array.isArray(arr)) console.warn(`Operation expects an array, but got ${arr} (${typeof arr})`);\n return arr != null ? Array.from(arr) : [];\n}\n\nfunction safeObject(obj) {\n if (obj !== undefined && typeof obj !== \"object\") console.warn(`Operation expects an object, but got ${obj} (${typeof obj})`);\n return obj != null ? Object(obj) : {};\n}\n\nfunction safeStringOrArray(elem) {\n if (elem !== undefined && !Array.isArray(elem) && typeof elem !== \"string\") console.warn(`Operation expects an Array or a String, but got ${elem} (${typeof elem})`);\n return elem == null ? \"\" : Array.isArray(elem) ? Array.from(elem) : String(elem);\n}\n\nfunction fragmentToString(fragment) {\n return (new XMLSerializer).serializeToString(fragment);\n}\n\n// A proxy method to wrap a fetch call in error handling\n\n// * url - the URL to fetch\n// * additionalHeaders - an object of additional headers passed to fetch\n\nasync function graciouslyFetch(url, additionalHeaders) {\n try {\n const response = await fetch(url, {\n headers: {\n \"X-REQUESTED-WITH\": \"XmlHttpRequest\",\n ...additionalHeaders\n }\n });\n if (response == undefined) return;\n handleErrors(response);\n return response;\n } catch (e) {\n console.error(`Could not fetch ${url}`);\n }\n}\n\nclass BoundedQueue {\n constructor(maxSize) {\n this.maxSize = maxSize;\n this.queue = [];\n }\n push(item) {\n if (this.isFull()) {\n // Remove the oldest item to make space for the new one\n this.shift();\n }\n this.queue.push(item);\n }\n shift() {\n return this.queue.shift();\n }\n isFull() {\n return this.queue.length === this.maxSize;\n }\n}\n\nvar utils = Object.freeze({\n __proto__: null,\n BoundedQueue: BoundedQueue,\n after: after,\n assignFocus: assignFocus,\n before: before,\n debounce: debounce,\n dispatch: dispatch,\n fragmentToString: fragmentToString,\n getClassNames: getClassNames,\n graciouslyFetch: graciouslyFetch,\n handleErrors: handleErrors,\n isTextInput: isTextInput,\n kebabize: kebabize,\n operate: operate,\n processElements: processElements,\n safeArray: safeArray,\n safeObject: safeObject,\n safeScalar: safeScalar,\n safeString: safeString,\n safeStringOrArray: safeStringOrArray,\n xpathToElement: xpathToElement,\n xpathToElementArray: xpathToElementArray\n});\n\n// Indicates whether or not we should morph an element via onBeforeElUpdated callback\n// SEE: https://github.com/patrick-steele-idem/morphdom#morphdomfromnode-tonode-options--node\n\nconst shouldMorph = operation => (fromEl, toEl) => !shouldMorphCallbacks.map((callback => typeof callback === \"function\" ? callback(operation, fromEl, toEl) : true)).includes(false)\n// Execute any pluggable functions that modify elements after morphing via onElUpdated callback\n\n;\n\nconst didMorph = operation => el => {\n didMorphCallbacks.forEach((callback => {\n if (typeof callback === \"function\") callback(operation, el);\n }));\n};\n\nconst verifyNotMutable = (detail, fromEl, toEl) => {\n // Skip nodes that are equal:\n // https://github.com/patrick-steele-idem/morphdom#can-i-make-morphdom-blaze-through-the-dom-tree-even-faster-yes\n if (!mutableTags[fromEl.tagName] && fromEl.isEqualNode(toEl)) return false;\n return true;\n};\n\nconst verifyNotContentEditable = (detail, fromEl, toEl) => {\n if (fromEl === ActiveElement.element && fromEl.isContentEditable) return false;\n return true;\n};\n\nconst verifyNotPermanent = (detail, fromEl, toEl) => {\n const {permanentAttributeName: permanentAttributeName} = detail;\n if (!permanentAttributeName) return true;\n const permanent = fromEl.closest(`[${permanentAttributeName}]`);\n // only morph attributes on the active non-permanent text input\n if (!permanent && fromEl === ActiveElement.element && isTextInput(fromEl)) {\n const ignore = {\n value: true\n };\n Array.from(toEl.attributes).forEach((attribute => {\n if (!ignore[attribute.name]) fromEl.setAttribute(attribute.name, attribute.value);\n }));\n return false;\n }\n return !permanent;\n};\n\nconst shouldMorphCallbacks = [ verifyNotMutable, verifyNotPermanent, verifyNotContentEditable ];\n\nconst didMorphCallbacks = [];\n\nvar morph_callbacks = Object.freeze({\n __proto__: null,\n didMorph: didMorph,\n didMorphCallbacks: didMorphCallbacks,\n shouldMorph: shouldMorph,\n shouldMorphCallbacks: shouldMorphCallbacks,\n verifyNotContentEditable: verifyNotContentEditable,\n verifyNotMutable: verifyNotMutable,\n verifyNotPermanent: verifyNotPermanent\n});\n\nvar Operations = {\n // DOM Mutations\n append: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {html: html, focusSelector: focusSelector} = operation;\n element.insertAdjacentHTML(\"beforeend\", safeScalar(html));\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n graft: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {parent: parent, focusSelector: focusSelector} = operation;\n const parentElement = document.querySelector(parent);\n if (parentElement) {\n parentElement.appendChild(element);\n assignFocus(focusSelector);\n }\n }));\n after(element, operation);\n }));\n },\n innerHtml: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {html: html, focusSelector: focusSelector} = operation;\n element.innerHTML = safeScalar(html);\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n insertAdjacentHtml: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {html: html, position: position, focusSelector: focusSelector} = operation;\n element.insertAdjacentHTML(position || \"beforeend\", safeScalar(html));\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n insertAdjacentText: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {text: text, position: position, focusSelector: focusSelector} = operation;\n element.insertAdjacentText(position || \"beforeend\", safeScalar(text));\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n outerHtml: operation => {\n processElements(operation, (element => {\n const parent = element.parentElement;\n const idx = parent && Array.from(parent.children).indexOf(element);\n before(element, operation);\n operate(operation, (() => {\n const {html: html, focusSelector: focusSelector} = operation;\n element.outerHTML = safeScalar(html);\n assignFocus(focusSelector);\n }));\n after(parent ? parent.children[idx] : document.documentElement, operation);\n }));\n },\n prepend: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {html: html, focusSelector: focusSelector} = operation;\n element.insertAdjacentHTML(\"afterbegin\", safeScalar(html));\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n remove: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {focusSelector: focusSelector} = operation;\n element.remove();\n assignFocus(focusSelector);\n }));\n after(document, operation);\n }));\n },\n replace: operation => {\n processElements(operation, (element => {\n const parent = element.parentElement;\n const idx = parent && Array.from(parent.children).indexOf(element);\n before(element, operation);\n operate(operation, (() => {\n const {html: html, focusSelector: focusSelector} = operation;\n element.outerHTML = safeScalar(html);\n assignFocus(focusSelector);\n }));\n after(parent ? parent.children[idx] : document.documentElement, operation);\n }));\n },\n textContent: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {text: text, focusSelector: focusSelector} = operation;\n element.textContent = safeScalar(text);\n assignFocus(focusSelector);\n }));\n after(element, operation);\n }));\n },\n // Element Property Mutations\n addCssClass: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name} = operation;\n element.classList.add(...getClassNames([ safeStringOrArray(name) ]));\n }));\n after(element, operation);\n }));\n },\n removeAttribute: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name} = operation;\n element.removeAttribute(safeString(name));\n }));\n after(element, operation);\n }));\n },\n removeCssClass: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name} = operation;\n element.classList.remove(...getClassNames([ safeStringOrArray(name) ]));\n if (element.classList.length === 0) element.removeAttribute(\"class\");\n }));\n after(element, operation);\n }));\n },\n setAttribute: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name, value: value} = operation;\n element.setAttribute(safeString(name), safeScalar(value));\n }));\n after(element, operation);\n }));\n },\n setDatasetProperty: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name, value: value} = operation;\n element.dataset[safeString(name)] = safeScalar(value);\n }));\n after(element, operation);\n }));\n },\n setProperty: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name, value: value} = operation;\n if (name in element) element[safeString(name)] = safeScalar(value);\n }));\n after(element, operation);\n }));\n },\n setStyle: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name, value: value} = operation;\n element.style[safeString(name)] = safeScalar(value);\n }));\n after(element, operation);\n }));\n },\n setStyles: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {styles: styles} = operation;\n for (let [name, value] of Object.entries(styles)) element.style[safeString(name)] = safeScalar(value);\n }));\n after(element, operation);\n }));\n },\n setValue: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {value: value} = operation;\n element.value = safeScalar(value);\n }));\n after(element, operation);\n }));\n },\n // DOM Events and Meta-Operations\n dispatchEvent: operation => {\n processElements(operation, (element => {\n before(element, operation);\n operate(operation, (() => {\n const {name: name, detail: detail} = operation;\n dispatch(element, safeString(name), safeObject(detail));\n }));\n after(element, operation);\n }));\n },\n setMeta: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {name: name, content: content} = operation;\n let meta = document.head.querySelector(`meta[name='${name}']`);\n if (!meta) {\n meta = document.createElement(\"meta\");\n meta.name = safeString(name);\n document.head.appendChild(meta);\n }\n meta.content = safeScalar(content);\n }));\n after(document, operation);\n },\n setTitle: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {title: title} = operation;\n document.title = safeScalar(title);\n }));\n after(document, operation);\n },\n // Browser Manipulations\n clearStorage: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {type: type} = operation;\n const storage = type === \"session\" ? sessionStorage : localStorage;\n storage.clear();\n }));\n after(document, operation);\n },\n go: operation => {\n before(window, operation);\n operate(operation, (() => {\n const {delta: delta} = operation;\n history.go(delta);\n }));\n after(window, operation);\n },\n pushState: operation => {\n before(window, operation);\n operate(operation, (() => {\n const {state: state, title: title, url: url} = operation;\n history.pushState(safeObject(state), safeString(title), safeString(url));\n }));\n after(window, operation);\n },\n redirectTo: operation => {\n before(window, operation);\n operate(operation, (() => {\n let {url: url, action: action, turbo: turbo} = operation;\n action = action || \"advance\";\n url = safeString(url);\n if (turbo === undefined) turbo = true;\n if (turbo) {\n if (window.Turbo) window.Turbo.visit(url, {\n action: action\n });\n if (window.Turbolinks) window.Turbolinks.visit(url, {\n action: action\n });\n if (!window.Turbo && !window.Turbolinks) window.location.href = url;\n } else {\n window.location.href = url;\n }\n }));\n after(window, operation);\n },\n reload: operation => {\n before(window, operation);\n operate(operation, (() => {\n window.location.reload();\n }));\n after(window, operation);\n },\n removeStorageItem: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {key: key, type: type} = operation;\n const storage = type === \"session\" ? sessionStorage : localStorage;\n storage.removeItem(safeString(key));\n }));\n after(document, operation);\n },\n replaceState: operation => {\n before(window, operation);\n operate(operation, (() => {\n const {state: state, title: title, url: url} = operation;\n history.replaceState(safeObject(state), safeString(title), safeString(url));\n }));\n after(window, operation);\n },\n scrollIntoView: operation => {\n const {element: element} = operation;\n before(element, operation);\n operate(operation, (() => {\n element.scrollIntoView(operation);\n }));\n after(element, operation);\n },\n setCookie: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {cookie: cookie} = operation;\n document.cookie = safeScalar(cookie);\n }));\n after(document, operation);\n },\n setFocus: operation => {\n const {element: element} = operation;\n before(element, operation);\n operate(operation, (() => {\n assignFocus(element);\n }));\n after(element, operation);\n },\n setStorageItem: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {key: key, value: value, type: type} = operation;\n const storage = type === \"session\" ? sessionStorage : localStorage;\n storage.setItem(safeString(key), safeScalar(value));\n }));\n after(document, operation);\n },\n // Notifications\n consoleLog: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {message: message, level: level} = operation;\n level && [ \"warn\", \"info\", \"error\" ].includes(level) ? console[level](message) : console.log(message);\n }));\n after(document, operation);\n },\n consoleTable: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {data: data, columns: columns} = operation;\n console.table(data, safeArray(columns));\n }));\n after(document, operation);\n },\n notification: operation => {\n before(document, operation);\n operate(operation, (() => {\n const {title: title, options: options} = operation;\n Notification.requestPermission().then((result => {\n operation.permission = result;\n if (result === \"granted\") new Notification(safeString(title), safeObject(options));\n }));\n }));\n after(document, operation);\n },\n // Morph operations\n morph: operation => {\n processElements(operation, (element => {\n const {html: html} = operation;\n const template = document.createElement(\"template\");\n template.innerHTML = String(safeScalar(html)).trim();\n operation.content = template.content;\n const parent = element.parentElement;\n const idx = parent && Array.from(parent.children).indexOf(element);\n before(element, operation);\n operate(operation, (() => {\n const {childrenOnly: childrenOnly, focusSelector: focusSelector} = operation;\n morphdom(element, childrenOnly ? template.content : template.innerHTML, {\n childrenOnly: !!childrenOnly,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: didMorph(operation)\n });\n assignFocus(focusSelector);\n }));\n after(parent ? parent.children[idx] : document.documentElement, operation);\n }));\n }\n};\n\nlet operations = Operations;\n\nconst add = newOperations => {\n operations = {\n ...operations,\n ...newOperations\n };\n};\n\nconst addOperations = operations => {\n add(operations);\n};\n\nconst addOperation = (name, operation) => {\n const operations = {};\n operations[name] = operation;\n add(operations);\n};\n\nvar OperationStore = {\n get all() {\n return operations;\n }\n};\n\nlet missingElement = \"warn\";\n\nvar MissingElement$1 = {\n get behavior() {\n return missingElement;\n },\n set(value) {\n if ([ \"warn\", \"ignore\", \"event\", \"exception\" ].includes(value)) missingElement = value; else console.warn(\"Invalid 'onMissingElement' option. Defaulting to 'warn'.\");\n }\n};\n\nconst perform = (operations, options = {\n onMissingElement: MissingElement$1.behavior\n}) => {\n const batches = {};\n operations.forEach((operation => {\n if (!!operation.batch) batches[operation.batch] = batches[operation.batch] ? ++batches[operation.batch] : 1;\n }));\n operations.forEach((operation => {\n const name = operation.operation;\n try {\n if (operation.selector) {\n if (operation.xpath) {\n operation.element = operation.selectAll ? xpathToElementArray(operation.selector) : xpathToElement(operation.selector);\n } else {\n operation.element = operation.selectAll ? document.querySelectorAll(operation.selector) : document.querySelector(operation.selector);\n }\n } else {\n operation.element = document;\n }\n if (operation.element || options.onMissingElement !== \"ignore\") {\n ActiveElement.set(document.activeElement);\n const cableReadyOperation = OperationStore.all[name];\n if (cableReadyOperation) {\n cableReadyOperation(operation);\n if (!!operation.batch && --batches[operation.batch] === 0) dispatch(document, \"cable-ready:batch-complete\", {\n batch: operation.batch\n });\n } else {\n console.error(`CableReady couldn't find the \"${name}\" operation. Make sure you use the camelized form when calling an operation method.`);\n }\n }\n } catch (e) {\n if (operation.element) {\n console.error(`CableReady detected an error in ${name || \"operation\"}: ${e.message}. If you need to support older browsers make sure you've included the corresponding polyfills. https://docs.stimulusreflex.com/setup#polyfills-for-ie11.`);\n console.error(e);\n } else {\n const warning = `CableReady ${name || \"\"} operation failed due to missing DOM element for selector: '${operation.selector}'`;\n switch (options.onMissingElement) {\n case \"ignore\":\n break;\n\n case \"event\":\n dispatch(document, \"cable-ready:missing-element\", {\n warning: warning,\n operation: operation\n });\n break;\n\n case \"exception\":\n throw warning;\n\n default:\n console.warn(warning);\n }\n }\n }\n }));\n};\n\nconst performAsync = (operations, options = {\n onMissingElement: MissingElement$1.behavior\n}) => new Promise(((resolve, reject) => {\n try {\n resolve(perform(operations, options));\n } catch (err) {\n reject(err);\n }\n}));\n\nclass SubscribingElement extends HTMLElement {\n static get tagName() {\n throw new Error(\"Implement the tagName() getter in the inheriting class\");\n }\n static define() {\n if (!customElements.get(this.tagName)) {\n customElements.define(this.tagName, this);\n }\n }\n disconnectedCallback() {\n if (this.channel) this.channel.unsubscribe();\n }\n createSubscription(consumer, channel, receivedCallback) {\n this.channel = consumer.subscriptions.create({\n channel: channel,\n identifier: this.identifier\n }, {\n received: receivedCallback\n });\n }\n get preview() {\n return document.documentElement.hasAttribute(\"data-turbolinks-preview\") || document.documentElement.hasAttribute(\"data-turbo-preview\");\n }\n get identifier() {\n return this.getAttribute(\"identifier\");\n }\n}\n\nlet consumer;\n\nconst BACKOFF = [ 25, 50, 75, 100, 200, 250, 500, 800, 1e3, 2e3 ];\n\nconst wait = ms => new Promise((resolve => setTimeout(resolve, ms)));\n\nconst getConsumerWithRetry = async (retry = 0) => {\n if (consumer) return consumer;\n if (retry >= BACKOFF.length) {\n throw new Error(\"Couldn't obtain a Action Cable consumer within 5s\");\n }\n await wait(BACKOFF[retry]);\n return await getConsumerWithRetry(retry + 1);\n};\n\nvar CableConsumer = {\n setConsumer(value) {\n consumer = value;\n },\n get consumer() {\n return consumer;\n },\n async getConsumer() {\n return await getConsumerWithRetry();\n }\n};\n\nclass StreamFromElement extends SubscribingElement {\n static get tagName() {\n return \"cable-ready-stream-from\";\n }\n async connectedCallback() {\n if (this.preview) return;\n const consumer = await CableConsumer.getConsumer();\n if (consumer) {\n this.createSubscription(consumer, \"CableReady::Stream\", this.performOperations.bind(this));\n } else {\n console.error(\"The `cable_ready_stream_from` helper cannot connect. You must initialize CableReady with an Action Cable consumer.\");\n }\n }\n performOperations(data) {\n if (data.cableReady) perform(data.operations, {\n onMissingElement: this.onMissingElement\n });\n }\n get onMissingElement() {\n const value = this.getAttribute(\"missing\") || MissingElement$1.behavior;\n // stream_from does not support raising exceptions on missing elements because there's no way to catch them\n if ([ \"warn\", \"ignore\", \"event\" ].includes(value)) return value; else {\n console.warn(\"Invalid 'missing' attribute. Defaulting to 'warn'.\");\n return \"warn\";\n }\n }\n}\n\nlet debugging = false;\n\nvar Debug = {\n get enabled() {\n return debugging;\n },\n get disabled() {\n return !debugging;\n },\n get value() {\n return debugging;\n },\n set(value) {\n debugging = !!value;\n },\n set debug(value) {\n debugging = !!value;\n }\n};\n\nconst request = (data, blocks) => {\n if (Debug.disabled) return;\n const message = `↑ Updatable request affecting ${blocks.length} element(s): `;\n console.log(message, {\n elements: blocks.map((b => b.element)),\n identifiers: blocks.map((b => b.element.getAttribute(\"identifier\"))),\n data: data\n });\n return message;\n};\n\nconst cancel = (timestamp, reason) => {\n if (Debug.disabled) return;\n const duration = new Date - timestamp;\n const message = `❌ Updatable request canceled after ${duration}ms: ${reason}`;\n console.log(message);\n return message;\n};\n\nconst response = (timestamp, element, urls) => {\n if (Debug.disabled) return;\n const duration = new Date - timestamp;\n const message = `↓ Updatable response: All URLs fetched in ${duration}ms`;\n console.log(message, {\n element: element,\n urls: urls\n });\n return message;\n};\n\nconst morphStart = (timestamp, element) => {\n if (Debug.disabled) return;\n const duration = new Date - timestamp;\n const message = `↻ Updatable morph: starting after ${duration}ms`;\n console.log(message, {\n element: element\n });\n return message;\n};\n\nconst morphEnd = (timestamp, element) => {\n if (Debug.disabled) return;\n const duration = new Date - timestamp;\n const message = `↺ Updatable morph: completed after ${duration}ms`;\n console.log(message, {\n element: element\n });\n return message;\n};\n\nvar Log = {\n request: request,\n cancel: cancel,\n response: response,\n morphStart: morphStart,\n morphEnd: morphEnd\n};\n\nconst template = `\\n<style>\\n :host {\\n display: block;\\n }\\n</style>\\n<slot></slot>\\n`;\n\nclass UpdatesForElement extends SubscribingElement {\n static get tagName() {\n return \"cable-ready-updates-for\";\n }\n constructor() {\n super();\n const shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n shadowRoot.innerHTML = template;\n this.triggerElementLog = new BoundedQueue(10);\n this.targetElementLog = new BoundedQueue(10);\n }\n async connectedCallback() {\n if (this.preview) return;\n this.update = debounce(this.update.bind(this), this.debounce);\n const consumer = await CableConsumer.getConsumer();\n if (consumer) {\n this.createSubscription(consumer, \"CableReady::Stream\", this.update);\n } else {\n console.error(\"The `cable_ready_updates_for` helper cannot connect. You must initialize CableReady with an Action Cable consumer.\");\n }\n }\n async update(data) {\n this.lastUpdateTimestamp = new Date;\n const blocks = Array.from(document.querySelectorAll(this.query), (element => new Block(element))).filter((block => block.shouldUpdate(data)));\n this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.request(data, blocks)}`);\n if (blocks.length === 0) {\n this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.cancel(this.lastUpdateTimestamp, \"All elements filtered out\")}`);\n return;\n }\n // first <cable-ready-updates-for> element in the DOM *at any given moment* updates all of the others\n if (blocks[0].element !== this) {\n this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.cancel(this.lastUpdateTimestamp, \"Update already requested\")}`);\n return;\n }\n // hold a reference to the active element so that it can be restored after the morph\n ActiveElement.set(document.activeElement);\n // store all retrieved HTML in an object keyed by URL to minimize fetch calls\n this.html = {};\n const uniqueUrls = [ ...new Set(blocks.map((block => block.url))) ];\n await Promise.all(uniqueUrls.map((async url => {\n if (!this.html.hasOwnProperty(url)) {\n const response = await graciouslyFetch(url, {\n \"X-Cable-Ready\": \"update\"\n });\n this.html[url] = await response.text();\n }\n })));\n this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.response(this.lastUpdateTimestamp, this, uniqueUrls)}`);\n // track current block index for each URL; referred to as fragments\n this.index = {};\n blocks.forEach((block => {\n // if the block's URL is not in the index, initialize it to 0; otherwise, increment it\n this.index.hasOwnProperty(block.url) ? this.index[block.url]++ : this.index[block.url] = 0;\n block.process(data, this.html, this.index, this.lastUpdateTimestamp);\n }));\n }\n get query() {\n return `${this.tagName}[identifier=\"${this.identifier}\"]`;\n }\n get identifier() {\n return this.getAttribute(\"identifier\");\n }\n get debounce() {\n return this.hasAttribute(\"debounce\") ? parseInt(this.getAttribute(\"debounce\")) : 20;\n }\n}\n\nclass Block {\n constructor(element) {\n this.element = element;\n }\n async process(data, html, fragmentsIndex, startTimestamp) {\n const blockIndex = fragmentsIndex[this.url];\n const template = document.createElement(\"template\");\n this.element.setAttribute(\"updating\", \"updating\");\n template.innerHTML = String(html[this.url]).trim();\n await this.resolveTurboFrames(template.content);\n const fragments = template.content.querySelectorAll(this.query);\n if (fragments.length <= blockIndex) {\n console.warn(`Update aborted due to insufficient number of elements. The offending url is ${this.url}, the offending element is:`, this.element);\n return;\n }\n const operation = {\n element: this.element,\n html: fragments[blockIndex],\n permanentAttributeName: \"data-ignore-updates\"\n };\n dispatch(this.element, \"cable-ready:before-update\", operation);\n this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${Log.morphStart(startTimestamp, this.element)}`);\n morphdom(this.element, fragments[blockIndex], {\n childrenOnly: true,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: _ => {\n this.element.removeAttribute(\"updating\");\n dispatch(this.element, \"cable-ready:after-update\", operation);\n assignFocus(operation.focusSelector);\n }\n });\n this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${Log.morphEnd(startTimestamp, this.element)}`);\n }\n async resolveTurboFrames(documentFragment) {\n const reloadingTurboFrames = [ ...documentFragment.querySelectorAll('turbo-frame[src]:not([loading=\"lazy\"])') ];\n return Promise.all(reloadingTurboFrames.map((frame => new Promise((async resolve => {\n const frameResponse = await graciouslyFetch(frame.getAttribute(\"src\"), {\n \"Turbo-Frame\": frame.id,\n \"X-Cable-Ready\": \"update\"\n });\n const frameTemplate = document.createElement(\"template\");\n frameTemplate.innerHTML = await frameResponse.text();\n // recurse here to get all nested eager loaded frames\n await this.resolveTurboFrames(frameTemplate.content);\n const selector = `turbo-frame#${frame.id}`;\n const frameContent = frameTemplate.content.querySelector(selector);\n const content = frameContent ? frameContent.innerHTML.trim() : \"\";\n documentFragment.querySelector(selector).innerHTML = content;\n resolve();\n })))));\n }\n shouldUpdate(data) {\n // if everything that could prevent an update is false, update this block\n return !this.ignoresInnerUpdates && this.hasChangesSelectedForUpdate(data);\n }\n hasChangesSelectedForUpdate(data) {\n // if there's an only attribute, only update if at least one of the attributes changed is in the allow list\n const only = this.element.getAttribute(\"only\");\n return !(only && data.changed && !only.split(\" \").some((attribute => data.changed.includes(attribute))));\n }\n get ignoresInnerUpdates() {\n // don't update during a Reflex or Turbolinks redraw\n return this.element.hasAttribute(\"ignore-inner-updates\") && this.element.hasAttribute(\"performing-inner-update\");\n }\n get url() {\n return this.element.hasAttribute(\"url\") ? this.element.getAttribute(\"url\") : location.href;\n }\n get identifier() {\n return this.element.identifier;\n }\n get query() {\n return this.element.query;\n }\n}\n\nconst registerInnerUpdates = () => {\n document.addEventListener(\"stimulus-reflex:before\", (event => {\n recursiveMarkUpdatesForElements(event.detail.element);\n }));\n document.addEventListener(\"stimulus-reflex:after\", (event => {\n setTimeout((() => {\n recursiveUnmarkUpdatesForElements(event.detail.element);\n }));\n }));\n document.addEventListener(\"turbo:submit-start\", (event => {\n recursiveMarkUpdatesForElements(event.target);\n }));\n document.addEventListener(\"turbo:submit-end\", (event => {\n setTimeout((() => {\n recursiveUnmarkUpdatesForElements(event.target);\n }));\n }));\n document.addEventListener(\"turbo-boost:command:start\", (event => {\n recursiveMarkUpdatesForElements(event.target);\n }));\n document.addEventListener(\"turbo-boost:command:finish\", (event => {\n setTimeout((() => {\n recursiveUnmarkUpdatesForElements(event.target);\n }));\n }));\n document.addEventListener(\"turbo-boost:command:error\", (event => {\n setTimeout((() => {\n recursiveUnmarkUpdatesForElements(event.target);\n }));\n }));\n};\n\nconst recursiveMarkUpdatesForElements = leaf => {\n const closestUpdatesFor = leaf && leaf.parentElement && leaf.parentElement.closest(\"cable-ready-updates-for\");\n if (closestUpdatesFor) {\n closestUpdatesFor.setAttribute(\"performing-inner-update\", \"\");\n recursiveMarkUpdatesForElements(closestUpdatesFor);\n }\n};\n\nconst recursiveUnmarkUpdatesForElements = leaf => {\n const closestUpdatesFor = leaf && leaf.parentElement && leaf.parentElement.closest(\"cable-ready-updates-for\");\n if (closestUpdatesFor) {\n closestUpdatesFor.removeAttribute(\"performing-inner-update\");\n recursiveUnmarkUpdatesForElements(closestUpdatesFor);\n }\n};\n\nconst defineElements = () => {\n registerInnerUpdates();\n StreamFromElement.define();\n UpdatesForElement.define();\n};\n\nconst initialize = (initializeOptions = {}) => {\n const {consumer: consumer, onMissingElement: onMissingElement, debug: debug} = initializeOptions;\n Debug.set(!!debug);\n if (consumer) {\n CableConsumer.setConsumer(consumer);\n } else {\n console.error(\"CableReady requires a reference to your Action Cable `consumer` for its helpers to function.\\nEnsure that you have imported the `CableReady` package as well as `consumer` from your `channels` folder, then call `CableReady.initialize({ consumer })`.\");\n }\n if (onMissingElement) {\n MissingElement.set(onMissingElement);\n }\n defineElements();\n};\n\nconst global = {\n perform: perform,\n performAsync: performAsync,\n shouldMorphCallbacks: shouldMorphCallbacks,\n didMorphCallbacks: didMorphCallbacks,\n initialize: initialize,\n addOperation: addOperation,\n addOperations: addOperations,\n version: packageInfo.version,\n cable: CableConsumer,\n get DOMOperations() {\n console.warn(\"DEPRECATED: Please use `CableReady.operations` instead of `CableReady.DOMOperations`\");\n return OperationStore.all;\n },\n get operations() {\n return OperationStore.all;\n },\n get consumer() {\n return CableConsumer.consumer;\n }\n};\n\nwindow.CableReady = global;\n\nexport { morph_callbacks as MorphCallbacks, StreamFromElement, SubscribingElement, UpdatesForElement, utils as Utils, global as default };\n","import CableReady from 'cable_ready'\n\nexport default class CableReadyElement extends HTMLElement {\n static define () {\n if (!customElements.get('cable-ready')) {\n customElements.define('cable-ready', this)\n }\n }\n\n connectedCallback () {\n setTimeout(() => {\n try {\n const operations = JSON.parse(this.scriptElement.textContent)\n CableReady.perform(operations)\n } catch (error) {\n console.error(error)\n } finally {\n try {\n this.remove()\n } catch {}\n }\n })\n }\n\n get scriptElement () {\n if (\n this.firstElementChild instanceof HTMLScriptElement &&\n this.firstElementChild.getAttribute('type') === 'application/json'\n ) {\n return this.firstElementChild\n }\n throw new Error(\n 'First child element in a `<cable-ready>` tag must be `<script type=\"application/json\">`.'\n )\n }\n}\n","import CableReadyElement from './cable_ready_element'\n\nexport const defineElements = () => {\n CableReadyElement.define()\n}\n"],"names":["range","NS_XHTML","doc","document","undefined","HAS_TEMPLATE_SUPPORT","createElement","HAS_RANGE_SUPPORT","createRange","toElement","str","trim","template","innerHTML","content","childNodes","createFragmentFromTemplate","selectNode","body","createContextualFragment","createFragmentFromRange","fragment","createFragmentFromWrap","compareNodeNames","fromEl","toEl","fromCodeStart","toCodeStart","fromNodeName","nodeName","toNodeName","charCodeAt","toUpperCase","syncBooleanAttrProp","name","setAttribute","removeAttribute","specialElHandlers","OPTION","parentNode","parentName","hasAttribute","selected","selectedIndex","INPUT","value","TEXTAREA","newValue","firstChild","oldValue","nodeValue","placeholder","SELECT","optgroup","i","curChild","nextSibling","noop","defaultGetNodeKey","node","getAttribute","id","morphdom","morphAttrs","fromNode","toNode","options","toNodeHtml","getNodeKey","onBeforeNodeAdded","onNodeAdded","onBeforeElUpdated","onElUpdated","onBeforeNodeDiscarded","onNodeDiscarded","onBeforeElChildrenUpdated","childrenOnly","fromNodesLookup","Object","create","keyedRemovalList","addKeyedRemoval","key","push","walkDiscardedChildNodes","skipKeyedNodes","nodeType","removeNode","removeChild","handleNodeAdded","el","unmatchedFromEl","replaceChild","morphEl","toElKey","curToNodeKey","curFromNodeKey","fromNextSibling","toNextSibling","matchingFromEl","curToNodeChild","curFromNodeChild","outer","isSameNode","curFromNodeType","isCompatible","insertBefore","appendChild","onBeforeNodeAddedResult","actualize","ownerDocument","cleanupFromEl","specialElHandler","morphChildren","indexTree","morphedNode","morphedNodeType","toNodeType","nextChild","moveChildren","namespaceURI","createElementNS","len","length","elToRemove","morphdomFactory","attr","attrName","attrNamespaceURI","attrValue","toNodeAttrs","attributes","localName","getAttributeNS","prefix","setAttributeNS","fromNodeAttrs","d","hasAttributeNS","removeAttributeNS","packageInfo","inputTags","mutableTags","textInputTypes","color","date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week","activeElement","ActiveElement","element","set","isTextInput","tagName","type","assignFocus","selector","focusElement","Node","ELEMENT_NODE","querySelector","focus","dispatch","detail","event","CustomEvent","bubbles","cancelable","dispatchEvent","window","jQuery","trigger","xpathToElement","xpath","evaluate","XPathResult","FIRST_ORDERED_NODE_TYPE","singleNodeValue","xpathToElementArray","reverse","snapshotList","ORDERED_NODE_SNAPSHOT_TYPE","snapshots","snapshotLength","snapshotItem","getClassNames","names","Array","from","flat","processElements","operation","callback","selectAll","forEach","kebabize","result","word","index","toLowerCase","words","reduce","match","operate","cancel","delay","setTimeout","before","target","after","debounce","fn","timer","args","clearTimeout","apply","this","handleErrors","response","ok","Error","statusText","safeScalar","val","includes","console","warn","safeString","String","safeArray","arr","isArray","safeObject","obj","safeStringOrArray","elem","async","graciouslyFetch","additionalHeaders","fetch","headers","e","error","BoundedQueue","constructor","maxSize","queue","item","isFull","shift","freeze","__proto__","fragmentToString","XMLSerializer","serializeToString","shouldMorph","shouldMorphCallbacks","map","didMorph","didMorphCallbacks","verifyNotMutable","isEqualNode","verifyNotContentEditable","isContentEditable","verifyNotPermanent","permanentAttributeName","permanent","closest","ignore","attribute","Operations","append","html","focusSelector","insertAdjacentHTML","graft","parent","parentElement","innerHtml","insertAdjacentHtml","position","insertAdjacentText","outerHtml","idx","children","indexOf","outerHTML","documentElement","prepend","remove","replace","textContent","addCssClass","classList","add","removeCssClass","setDatasetProperty","dataset","setProperty","setStyle","style","setStyles","styles","entries","setValue","setMeta","meta","head","setTitle","title","clearStorage","sessionStorage","localStorage","clear","go","delta","history","pushState","state","redirectTo","action","turbo","Turbo","visit","Turbolinks","location","href","reload","removeStorageItem","removeItem","replaceState","scrollIntoView","setCookie","cookie","setFocus","setStorageItem","setItem","consoleLog","message","level","log","consoleTable","data","columns","table","notification","Notification","requestPermission","then","permission","morph","operations","newOperations","OperationStore","all","missingElement","MissingElement$1","behavior","perform","onMissingElement","batches","batch","querySelectorAll","cableReadyOperation","warning","SubscribingElement","HTMLElement","static","customElements","get","define","disconnectedCallback","channel","unsubscribe","createSubscription","consumer","receivedCallback","subscriptions","identifier","received","preview","BACKOFF","getConsumerWithRetry","retry","ms","Promise","resolve","CableConsumer","setConsumer","StreamFromElement","getConsumer","performOperations","bind","cableReady","debugging","Debug","enabled","disabled","debug","Log","blocks","elements","b","identifiers","timestamp","reason","Date","urls","UpdatesForElement","super","attachShadow","mode","triggerElementLog","targetElementLog","update","lastUpdateTimestamp","query","Block","filter","block","shouldUpdate","toLocaleString","uniqueUrls","Set","hasOwnProperty","process","parseInt","fragmentsIndex","startTimestamp","blockIndex","resolveTurboFrames","fragments","_","documentFragment","reloadingTurboFrames","frame","frameResponse","frameTemplate","frameContent","ignoresInnerUpdates","hasChangesSelectedForUpdate","only","changed","split","some","recursiveMarkUpdatesForElements","leaf","closestUpdatesFor","recursiveUnmarkUpdatesForElements","defineElements","addEventListener","global","performAsync","reject","err","initialize","initializeOptions","MissingElement","addOperation","addOperations","version","cable","DOMOperations","CableReady","CableReadyElement","connectedCallback","JSON","parse","scriptElement","firstElementChild","HTMLScriptElement"],"mappings":"AAAA,IAgEIA,EACJ,IAAIC,EAAW,+BAEXC,EAA0B,oBAAbC,cAA2BC,EAAYD,SACpDE,IAAyBH,GAAO,YAAaA,EAAII,cAAc,YAC/DC,IAAsBL,GAAOA,EAAIM,aAAe,6BAA8BN,EAAIM,cAgCtF,SAASC,EAAUC,GAEf,OADAA,EAAMA,EAAIC,OACNN,EAhCR,SAAoCK,GAChC,IAAIE,EAAWV,EAAII,cAAc,YAEjC,OADAM,EAASC,UAAYH,EACdE,EAASE,QAAQC,WAAW,EACvC,CAgCaC,CAA2BN,GACzBH,EA/Bf,SAAiCG,GAO7B,OANKV,IACDA,EAAQE,EAAIM,eACNS,WAAWf,EAAIgB,MAGVlB,EAAMmB,yBAAyBT,GAC9BK,WAAW,EAC/B,CAwBaK,CAAwBV,GAtBrC,SAAgCA,GAC5B,IAAIW,EAAWnB,EAAII,cAAc,QAEjC,OADAe,EAASR,UAAYH,EACdW,EAASN,WAAW,EAC/B,CAqBWO,CAAuBZ,EAClC,CAYA,SAASa,EAAiBC,EAAQC,GAC9B,IAEIC,EAAeC,EAFfC,EAAeJ,EAAOK,SACtBC,EAAaL,EAAKI,SAGtB,OAAID,IAAiBE,IAIrBJ,EAAgBE,EAAaG,WAAW,GACxCJ,EAAcG,EAAWC,WAAW,GAMhCL,GAAiB,IAAMC,GAAe,GAC/BC,IAAiBE,EAAWE,cAC5BL,GAAe,IAAMD,GAAiB,IACtCI,IAAeF,EAAaI,cAI3C,CA8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