PageSourceSearch

https://www.saabclub.nl/apps/framework/build/web-component/g2ui-highlight-feed-BLQQbKko.js

js saabclub.nl collected 2026-10-02 10:01:24 UTC 18,388 bytes, 92 lines download raw bytes

1import{Y,p as G,_ as J,P as Q,D as X,H as K}from"../post-GibXXg97.js";import{F,I as Z}from"../base-Ci7vLHE_.js";import ee from"./g2ui-highlight-message-BAvnr_hU.js";import te from"./g2ui-posted-message-mGANrOaz.js";import ie from"./g2ui-input-image-C57SKrXb.js";import se from"./g2ui-input-checklist-BLA9WzPQ.js";import"../events-DNd9BXmE.js";import"../preload-helper-BVLnHgTN.js";import"./g2ui-avatar-buYzc9-t.js";import"./g2ui-lightbox-BlkDBrpN.js";import"../internals--3vI9LC5.js";var ae=Object.defineProperty,O=s=>{throw TypeError(s)},le=(s,t,i)=>t in s?ae(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,oe=(s,t,i)=>le(s,t+"",i),_=(s,t,i)=>t.has(s)||O("Cannot "+i),e=(s,t,i)=>(_(s,t,"read from private field"),i?i.call(s):t.get(s)),y=(s,t,i)=>t.has(s)?O("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),w=(s,t,i,n)=>(_(s,t,"write to private field"),t.set(s,i),i),g=(s,t,i)=>(_(s,t,"access private method"),i),C,D,E,T,W;const P=class B extends Y{constructor(){super(),y(this,E),y(this,C),y(this,D,!1),w(this,C,F().newTranslator())}connectedCallback(){if(super.connectedCallback(),g(this,E,T).call(this),!e(this,D)){const t=this.shadowRoot.querySelectorAll(".wrapper g2ui-highlight-message");for(const i of t)g(this,E,W).call(this,i.value);w(this,D,!0)}}attributeChangedCallback(t,i,n){var d,h;if(e(this,D)&&(super.attributeChangedCallback(t,i,n),(t==="features"||t==="display"||t==="user-id")&&i!==n)){for(const o of this.value.messages.values())g(this,E,W).call(this,o),((d=this.value.thread)==null?void 0:d.id)===o.id&&this.showThread(o,{force:!0});(h=this.shadowRoot.querySelector("div.post"))==null||h.remove(),g(this,E,T).call(this)}}addMessages(t){const i=super.addMessages(t);return new G(()=>{const n=i.complete();for(const d of n)g(this,E,W).call(this,d)})}static register(){ee.register(),te.register(),ie.register(),se.register(),J(),customElements.get("g2ui-post-highlight")||customElements.define("g2ui-post-highlight",ne),customElements.get("g2ui-highlight-feed")||customElements.define("g2ui-highlight-feed",B)}};C=new WeakMap,D=new WeakMap,E=new WeakSet,T=function(){const s=this.shadowRoot.querySelector(".wrapper"),t=this.value.features,i=this.value.display;if(t.includes("post")&&this.getAttribute("user-id")&&!this.shadowRoot.querySelector("div.post")){const n=this.ownerDocument.createElement("div");n.classList.add("post");const d=this.listenerRegistry.get(n);n.innerHTML=`
2        ${i.includes("compose")?'<button type="button" class="new">+</button>':""}
3        <dialog>
4          <header>
5            <h2>${e(this,C).lookup("publish_highlight")}</h2>
6            <button type="button" class="close">${e(this,C).lookup("close")}</button>
7          </header>
8        </dialog>
9      `;const h=n.querySelector("button.new"),o=n.querySelector("dialog"),p=n.querySelector("button.close");d.getChildListener(p).addEventListener("click",()=>o.close()),d.getChildListener(o).addEventListener("close",()=>{o.dispatchEvent(new Event("modal:close",{bubbles:!0,composed:!0}))}),h&&d.getChildListener(h).addEventListener("click",async()=>{let l=o.querySelector("g2ui-post-highlight");if(l!=null&&l.editing&&(l.remove(),l=null),!l){const{endpoint:{highlight:{suggestion:u}}}=this.value.info;l=this.ownerDocument.createElement("g2ui-post-highlight"),l.setAttribute("user-id",this.getAttribute("user-id")),l.setAttribute("user-name",this.getAttribute("user-name")),l.setAttribute("user-avatar",this.getAttribute("user-avatar")),l.setAttribute("features",this.getAttribute("features")),l.setAttribute("suggest",u),d.getChildListener(l).addEventListener("posted",async({detail:{formData:m,highlight:v}})=>{const r=this.addMessages([v.value]);o.close(),await this.value.postHighlight(v.value,m),r.complete(),v.classList.remove("loading")}),o.appendChild(l)}o.showModal(),o.dispatchEvent(new Event("modal:open",{bubbles:!0,composed:!0}))}),this.shadowRoot.insertBefore(n,s)}},W=function(s){if(s.type!=="highlight"||!s.id||!this.getAttribute("user-id"))return;const t=this.value.features,i=this.listenerRegistry.get(s.element);if(t.includes("manage")||s.element.getAttribute("manage")==="user"){const n=s.element.querySelector(".actions").querySelector(".manage");X(n,"button.edit",()=>{var d;const h=this.ownerDocument.createElement("button");h.classList.add("edit"),h.textContent=e(this,C).lookup("edit"),n.insertBefore(h,(d=n.querySelector("button.delete"))==null?void 0:d.nextElementSibling),i.getChildListener(h).addEventListener("click",async()=>{var o;const p=this.shadowRoot.querySelector(".post"),l=p.querySelector("dialog"),u=this.ownerDocument.createElement("g2ui-post-highlight");u.editFor(s.element),u.setAttribute("user-id",this.getAttribute("user-id")),u.setAttribute("user-name",this.getAttribute("user-name")),u.setAttribute("user-avatar",this.getAttribute("user-avatar")),i.getChildListener(u).addEventListener("updated",async({detail:{formData:m}})=>{try{await this.value.editHighlight(s,m),l.close(),u.remove(),p.classList.add("hide"),p.querySelector(".new").classList.remove("hide"),await this.showThread(s,{force:!0})}catch{u.classList.add("error")}}),p.classList.remove("hide"),p.querySelector(".new").classList.add("hide"),(o=l.querySelector("g2ui-post-highlight"))==null||o.remove(),l.appendChild(u),l.showModal(),l.dispatchEvent(new Event("modal:open",{bubbles:!0,composed:!0})),i.getChildListener(l).addEventListener("close",()=>{p.classList.add("hide"),p.querySelector(".new").classList.remove("hide")},{once:!0}),n.classList.remove("open")})})}},oe(P,"adopt",[new URL("/apps/framework/build/css/g2ui-highlight-feed-DLxVAwif.css",import.meta.url)]);let ye=P;var c,a,H,L,k,R,b,j,z,x,I,N,U;
9class ne extends HTMLElement{constructor(){super(),y(this,b),y(this,c),y(this,a),y(this,H,[]),y(this,L),y(this,k,[]),y(this,R,!0),w(this,c,F().newTranslator()),w(this,a,this.ownerDocument.createElement("g2ui-highlight-message")),e(this,a).setAttribute("part","message")}connectedCallback(){const t=this.getRootNode().host;if(w(this,H,(this.getAttribute("features")||"").split(" ")),w(this,k,t.value.info.post.feed),w(this,R,t.value.info.post.replyDefaultEnabled??!0),!this.querySelector("form")){this.innerHTML=`
10      <div class="body">
11        <div class="container">
12          ${this.hasAttribute("suggest")?`
13            <div class="tabs">
14              <ul>
15                <li class="is-active">
16                  <button id="tabCompose">${e(this,c).lookup("compose")}</button>
17                </li>
18                <li>
19                  <button id="tabSuggestion">${e(this,c).lookup("suggestions")}</button>
20                </li>
21              </ul>
22            </div>
23          `:""}
24          <div class="panels">
25            <section class="compose is-active">
26              <form>
27                <fieldset class="properties is-active">
28                  <legend>${e(this,c).lookup("properties")}</legend>
29
30                  <label>
31                    ${e(this,c).lookup("image")}
32                    <g2ui-input-image name="attachment[0]" required="required" accept="image/jpeg, image/jpeg, image/gif, image/webp, image/png" aspect-ratio="3 / 4" min="500x500" max="2000x2000"></g2ui-input-image>
33                  </label>
34                  <label>
35                    ${e(this,c).lookup("color-overlay")}
36                    <input type="range" name="color-overlay" min="0" max="100" step="10" value="0"  list="opacity"/>
37                    <datalist id="opacity">
38                        <option value="0" label="0%"></option>
39                        <option value="10" label="10%"></option>
40                        <option value="20" label="20%"></option>
41                        <option value="30" label="30%"></option>
42                        <option value="40" label="40%"></option>
43                        <option value="50" label="50%"></option>
44                        <option value="60" label="60%"></option>
45                        <option value="70" label="70%"></option>
46                        <option value="80" label="80%"></option>
47                        <option value="90" label="90%"></option>
48                        <option value="100" label="100%"></option>
49                    </datalist>
50                  </label>
51                  <label>
52                    ${e(this,c).lookup("title")}
53                    <input type="text" name="title" required/>
54                  </label>
55                  <label>
56                    ${e(this,c).lookup("subtitle")}
57                    <input type="text" name="subtitle" />
58                  </label>
59                  <label class="title-hide">
60                    <input type="checkbox" name="title-hide" value="1"/>
61                    ${e(this,c).lookup("title-hide")}
62                  </label>
63                  <label>
64                    ${e(this,c).lookup("content")}
65                    <textarea autocomplete="off"
66                              spellcheck="true"
67                              placeholder="..."
68                              rows="3"
69                              name="content"></textarea>
70                  </label>
71                  <label>
72                    ${e(this,c).lookup("url")}
73                    <input type="url" name="url" placeholder="https://" />
74                  </label>
75                </fieldset>
76                <button class="step" type="button">${e(this,c).lookup("next")}</button>
77                <input type="submit" disabled value="${e(this,L)?e(this,c).lookup("save"):e(this,c).lookup("publish")}"/>
78              </form>
79            </section>
80            <section class="suggestion">
81              <form>
82                <div class="suggestions">
83
84                </div>
85              </form>
86            </section>
87          </div>
88        </div>
89        <div class="preview">
90        </div>
91      </div>
92    `;const i=this.querySelector("#tabCompose");i&&i.addEventListener("click",async()=>{this.querySelector(".tabs li.is-active").classList.remove("is-active"),i.closest("li").classList.add("is-active"),this.querySelector("section.is-active").classList.remove("is-active"),this.querySelector("section.compose").classList.add("is-active"),g(this,b,x).call(this)});const n=this.querySelector("#tabSuggestion");if(n){const u=this.querySelector(".suggestions");n.addEventListener("click",async()=>{this.querySelector(".tabs li.is-active").classList.remove("is-active"),n.closest("li").classList.add("is-active"),this.querySelector("section.is-active").classList.remove("is-active"),this.querySelector("section.suggestion").classList.add("is-active"),u.querySelectorAll("label").forEach(S=>S.remove());const m=await fetch(this.getAttribute("suggest")),{suggestion:v}=await m.json(),r={};for(const S of v){const q=this.ownerDocument.createElement("label"),f=this.ownerDocument.createElement("input");f.type="radio",f.name="suggestion",f.value=S.id;const M=this.ownerDocument.createElement("button");M.textContent=e(this,c).lookup("use"),M.type="submit",M.classList.add("use"),q.appendChild(f),q.appendChild(M),q.appendChild(this.ownerDocument.createTextNode(S.suggestion)),f.addEventListener("change",V=>{const A=this.ownerDocument.createElement("g2ui-highlight-message");A.setAttribute("role","article"),A.setAttribute("part","message"),A.value.updateWithServerData(r[V.target.value]),A.setAttribute("part","message"),g(this,b,I).call(this,A)}),u.appendChild(q),r[S.id]=S}const $=this.querySelector(".suggestion form");$.addEventListener("submit",S=>{S.preventDefault();const q=new FormData($);
92if(r[q.get("suggestion")]){const f=this.ownerDocument.createElement("g2ui-highlight-message");f.setAttribute("role","article"),f.setAttribute("part","message"),f.value.updateWithServerData(r[q.get("suggestion")]),g(this,b,j).call(this,f),this.querySelector(".tabs li.is-active").classList.remove("is-active"),i.closest("li").classList.add("is-active"),this.querySelector("section.is-active").classList.remove("is-active"),this.querySelector("section.compose").classList.add("is-active")}})})}g(this,b,z).call(this,t),g(this,b,x).call(this);const d=this.querySelector("textarea");d&&Q(d);const h=this.querySelector("form");h.addEventListener("submit",async u=>{u.preventDefault(),u.stopImmediatePropagation();const m=await g(this,b,N).call(this);if(e(this,L))e(this,L).value.copy(e(this,a).value),this.dispatchEvent(new CustomEvent("updated",{detail:{formData:m,highlight:e(this,L)}}));else{const v=g(this,b,U).call(this,m);v.parentElement.removeChild(v),this.dispatchEvent(new CustomEvent("posted",{detail:{formData:m,highlight:v}}))}h.reset(),w(this,a,this.ownerDocument.createElement("g2ui-highlight-message")),e(this,a).setAttribute("part","message"),g(this,b,x).call(this),h.querySelector("g2ui-input-image").clearAttachment(),h.querySelector("fieldset.is-active").classList.remove("is-active"),h.querySelector("fieldset").classList.add("is-active"),h.querySelector(".step").textContent=e(this,c).lookup("next"),h.querySelector('input[type="submit"]').disabled=!0});const o=[...this.querySelectorAll("form fieldset")],p=this.querySelector('form input[type="submit"]'),l=this.querySelector("form .step");l.addEventListener("click",()=>{const u=o.findIndex(v=>v.classList.contains("is-active")),m=o[u];if(o[u+1]){for(const $ of m.elements)if(!$.reportValidity())return!1;const v=o[u+1],r=o[o.length-1];m.classList.remove("is-active"),v.classList.add("is-active"),r===v?(l.textContent=e(this,c).lookup("prev"),p.disabled=!1):p.disabled=!0}else{const v=o[u-1],r=o[0];m.classList.remove("is-active"),v.classList.add("is-active"),r===v&&(l.textContent=e(this,c).lookup("next")),p.disabled=!0}})}}get editing(){return!!e(this,L)}editFor(t){w(this,L,t),e(this,a).value.copy(t.value),this.classList.add("editing")}}c=new WeakMap,a=new WeakMap,H=new WeakMap,L=new WeakMap,k=new WeakMap,R=new WeakMap,b=new WeakSet,j=function(s){w(this,a,s),e(this,a).setAttribute("part","message"),g(this,b,x).call(this,s)},z=function(){const s=this.querySelector("form"),t=this.querySelector("fieldset.publication")||this.ownerDocument.createElement("fieldset");t.classList.add("publication");const i=this.ownerDocument.createElement("legend");if(i.textContent=e(this,c).lookup("publication"),t.appendChild(i),e(this,k).length>1){const l=this.ownerDocument.createElement("label"),u=this.ownerDocument.createElement("g2ui-input-checklist");u.options.replaceWithSerialized(e(this,k).map(({id:m,name:v,always:r})=>({name:"feed[]",value:m,label:v,checked:r,disabled:r}))),u.setAttribute("id","feeds"),l.textContent=e(this,c).lookup("feeds"),l.appendChild(u),t.append(l)}const n=this.ownerDocument.createElement("label"),d=this.ownerDocument.createElement("g2ui-input-checklist");d.setAttribute("required","required"),d.options.replaceWithSerialized([{name:"recipient[]",value:"public",label:e(this,c).lookup("public_visibility")},{name:"recipient[]",value:"private",label:e(this,c).lookup("private_visibility")}]),d.setAttribute("id","visibility"),n.textContent=e(this,c).lookup("visibility"),n.appendChild(d),t.appendChild(n);const h=this.ownerDocument.createElement("label"),o=this.ownerDocument.createElement("g2ui-input-checklist"),p=[{name:"conversation",value:"conversation",label:e(this,c).lookup("enable_conversation")}];e(this,H).includes("notify")&&p.push({name:"push",value:"push",label:e(this,c).lookup("send_push_notification")}),o.options.replaceWithSerialized(p),o.setAttribute("id","actions"),h.textContent=e(this,c).lookup("actions"),h.appendChild(o),t.appendChild(h),s.insertBefore(t,s.querySelector("fieldset:last-of-type").nextElementSibling)},x=function(){var s;e(this,a).value.conversation=e(this,a).value.conversation??e(this,R),e(this,a).value.feeds=e(this,a).value.feeds??e(this,k).filter(({always:r})=>r).map(({id:r})=>r.toString()),e(this,a).setAttribute("part","message");const t=this.querySelector("form");if((s=t.querySelector('input[name = "id"]'))==null||s.remove(),e(this,a).value.id){const r=this.ownerDocument.createElement("input");r.type="hidden",r.name="id",r.value=e(this,a).value.id,t.insertBefore(r,t.firstElementChild)}const i=t.querySelector('input[name="title"]');i.value=e(this,a).value.title,i.addEventListener("input",()=>e(this,a).value.title=i.value);const n=t.querySelector('input[name="subtitle"]');n.value=e(this,a).value.subtitle,n.addEventListener("input",()=>e(this,a).value.subtitle=n.value);const d=t.querySelector('input[name="title-hide"]');d.checked=e(this,a).value.titleHide,d.addEventListener("change",()=>e(this,a).value.titleHide=d.checked);
92const h=t.querySelector('g2ui-input-checklist[id="actions"]');h.values=e(this,a).value.conversation?["conversation"]:[],h.addEventListener("change",()=>e(this,a).value.conversation=h.values.includes("conversation"));const o=t.querySelector('input[name="color-overlay"]');o.value=e(this,a).value.colorOverlay,o.addEventListener("input",()=>e(this,a).value.colorOverlay=parseInt(o.value));const p=t.querySelector('input[name="url"]'),l=e(this,a).value.routing;l.has("url")&&(p.value=l.get("url")),l.get("internal")===!0?(p.disabled=!0,p.placeholder=""):p.addEventListener("change",()=>p.value?l.set("url",p.value):l.delete("url"));const u=t.querySelector('textarea[name="content"]');u.value=e(this,a).value.source;const m=this.querySelector("#visibility");if(m.values=e(this,a).value.recipients,e(this,k).length>1){const r=this.querySelector("#feeds");r.values=e(this,a).value.feeds}const v=this.querySelector("g2ui-input-image");for(const r of e(this,a).value.attachments.images)v.loadAttachment(r);v.addEventListener("change",r=>{e(this,a).value.attachments=new Z(r.target.attachment?[r.target.attachment]:[])}),g(this,b,I).call(this,e(this,a))},I=function(s){const t=this.querySelector(".preview");for(;t.firstChild;)t.removeChild(t.firstChild);e(this,a).classList.remove("conversation"),t.appendChild(s)},N=async function(){return new FormData(this.querySelector("form"))},U=function(s){const t=new Date,i=e(this,a);return i.setAttribute("part","message"),i.setAttribute("manage","user"),i.value.title=s.get("title"),i.value.titleHide=!!s.get("title-hide"),i.value.colorOverlay=parseInt(s.get("color-overlay")),i.value.subtitle=s.get("subtitle"),i.value.source=s.get("content"),i.value.content=K(i.value.source),i.value.conversation=!!s.get("conversation"),i.value.time=t,i.value.sortId=`000-${t.toISOString()}-`,i.classList.add("loading"),i};export{ne as PostHighlight,ye as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.