trix_embed 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d839c80df9c7dc70b3336dccb40896128aadff60d97fc7d4ceb5d7afe14fe87a
4
- data.tar.gz: 56632a5f6852a5ea1d03348f724d96bc93cd306a497fa5e776660ab355ad8708
3
+ metadata.gz: 58e4027f5d92ef6c1bdc76a747cbc2e009cde8c2c3ae216f71ea0c923833ac28
4
+ data.tar.gz: ed7cf7cf36f578b86b6932074ad5eb5c6a26f05fd7e2430aabd5b4e6addad8ff
5
5
  SHA512:
6
- metadata.gz: 35e20db3bea5b867c1b5c9c0ddff48b7055670a11d78c94b299d4c1d9340082084d2cf2ad7c68eab6ae3a66f289a6b664ace9a6ca65c74664816d54203e4aa45
7
- data.tar.gz: d588233eb5e1d897dfdfc02fa40d65896e009698393db4fbd23221fd8e25fc1fa1a07e71545b04aa8083fde4af5e0be191f654c5ce0e95a49918a56a0ee65547
6
+ metadata.gz: 577cd6a7524581232bb8c5220fe7e9af303d4bd1e8d8911a5dc87e50d4afc8365bb258c0d21720dfec798fd3ca64141e86c38cd120a23865bd3ceca14b2d090d
7
+ data.tar.gz: f893d6260bfaf39c99bd08408f939df248272ee53ec1076cd33dde744be882eaec533cadb216b4a13dcbf9730fff2f10ef6a1a6a01bf5a67895fe879077a6c89
data/README.md CHANGED
@@ -153,13 +153,12 @@ bin/dev
153
153
  ## Releasing
154
154
 
155
155
  1. Run `yarn` and `bundle` to pick up the latest
156
- 1. Bump version numbers at `lib/trix_embed/version.rb` and `package.json` _(make sure they match)_. Pre-release versions use `.preN`
156
+ 1. Bump version number at `lib/trix_embed/version.rb`. Pre-release versions use `.preN`
157
+ 1. Bump version number at `package.json` _(make sure it matches)_. Pre-release versions use `-preN`
157
158
  1. Run `yarn build` - *builds both the Ruby gem and the NPM package*
158
159
  1. Commit and push changes to GitHub
159
160
  1. Run `rake release`
160
- 1. Run `yarn publish --new-version X.X.X --no-git-tag-version --access public`
161
- 1. Yarn will prompt you for the new version. Pre-release versions use `-preN`
162
- 1. Commit and push changes to GitHub
161
+ 1. Run `yarn publish --new-version X.X.X --no-git-tag-version --access public` _(use same version number)_
163
162
  1. Create a new release on GitHub ([here](https://github.com/hopsoft/trix_embed/releases)) and generate the changelog for the stable release for it
164
163
 
165
164
  ## License
@@ -1,41 +1,5 @@
1
1
  /*
2
- trix-embed 0.0.3 (MIT)
2
+ trix-embed 0.0.5 (MIT)
3
3
  Copyright © 2023 Nate Hopkins (hopsoft) <natehop@gmail.com>
4
4
  */
5
- var ge=Object.defineProperty,be=Object.defineProperties;var ye=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var xe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var N=(r,e,t)=>e in r?ge(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e)=>{for(var t in e||(e={}))xe.call(e,t)&&N(r,t,e[t]);if(B)for(var t of B(e))we.call(e,t)&&N(r,t,e[t]);return r},L=(r,e)=>be(r,ye(e));var J=(r,e,t)=>(N(r,typeof e!="symbol"?e+"":e,t),t);var _={version:"0.0.3"};var R={name:"AES-GCM",length:256},ve=!0,Ee=["encrypt","decrypt"];async function Le(){let e=["encrypt","decrypt"];return await crypto.subtle.generateKey(R,!0,e)}async function Te(r){let e=await crypto.subtle.exportKey("jwk",r);return JSON.stringify(e)}async function G(r){let e=JSON.parse(r);return await crypto.subtle.importKey("jwk",e,R,ve,Ee)}async function Se(r,e){let t=new TextEncoder().encode(String(r)),n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.encrypt(L(E({},R),{iv:n}),e,t),s={ciphertext:btoa(String.fromCharCode(...new Uint8Array(i))),iv:btoa(String.fromCharCode(...n))};return btoa(JSON.stringify(s))}async function Ae(r,e){let t=JSON.parse(atob(r)),n=new Uint8Array(atob(t.ciphertext).split("").map(a=>a.charCodeAt(0))),i=new Uint8Array(atob(t.iv).split("").map(a=>a.charCodeAt(0))),s=await crypto.subtle.decrypt(L(E({},R),{iv:i}),e,n);return new TextDecoder().decode(s)}async function T(){let r=await Le(),e=await Te(r);return btoa(e)}async function x(r,e=[]){let t=await G(atob(r));return Promise.all(e.map(n=>Se(n,t)))}async function X(r,e=[]){let t=await G(atob(r));return Promise.all(e.map(n=>Ae(n,t)))}async function Q(r=[]){let e=await T(),t=await x(e,r);return console.log(`data-trix-embed-key-value="${e}"`),console.log(`data-trix-embed-hosts-value='${JSON.stringify(t)}'`),{key:e,encryptedValues:t}}var Y=r=>Math.floor(Math.random()*r),w=(r,e=null)=>{let t=[...r];e==="all"&&(e=t.length);let n=t.length,i=[],s=new Set;for(;i.length<e;){let a=Y(n);for(;s.has(a);)a=Y(n);s.add(a),i.push(t[a])}return typeof e=="number"?i:i[0]};function b(r,e=t=>{}){try{let t=new URL(String(r).trim());return t&&e&&e(t),t}catch(t){console.info(`Failed to parse URL! value='${r}']`)}return null}function Z(r,e=t=>{}){var n;let t=(n=b(r))==null?void 0:n.host;return t&&e&&e(t),t}function O(r){return document.createTreeWalker(r,NodeFilter.SHOW_TEXT,e=>e.nodeValue.match(/http/gi)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)}function ke(r){let e=new Set,t=O(r),n;for(;n=t.nextNode();)n.nodeValue.split(/\s+/).filter(i=>i.startsWith("http")).forEach(i=>b(i,s=>e.add(s.href)));return[...e]}function U(r){if(r.src){let e=r.src.trim();if(e.length)return e}if(r.href){let e=r.href.trim();if(e.length)return e}return""}function Re(r){let e=new Set;return r.src&&b(r.src,n=>e.add(n.href)),r.href&&b(r.href,n=>e.add(n.href)),r.querySelectorAll("[src], [href]").forEach(n=>b(U(n),i=>e.add(i.href))),[...e]}function C(r,e=[],t=[]){let n=Z(r);return t.includes("*")||t.find(i=>n.endsWith(i))?!1:!!(e.find(i=>n.endsWith(i))||e.includes("*")&&(n||r.startsWith("data:")||r.startsWith("news:")||r.startsWith("tel:")))}function ee(r){return[...r.reduce((e,t)=>(Z(t,n=>e.add(n)),e),new Set)]}function te(r){let e=Re(r),t=ke(r);return[...new Set([...e,...t])]}var re={attachment:"trix-embed/attachment"};var ie={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",heic:"image/heic",heif:"image/heif",ico:"image/x-icon",jp2:"image/jp2",jpeg:"image/jpeg",jpg:"image/jpeg",jxr:"image/vnd.ms-photo",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp"};var Ue=ie,Me=["animate","animateMotion","animateTransform","area","audio","base","embed","feDisplacementMap","feImage","feTile","filter","font-face-uri","iframe","image","link","object","script","source","track","use","video"],Ne=["audio","embed","iframe","img","input","script","source","track","video","frame","frameset","object","picture","use"],ne="trix-editor",se="action-text-attachment",ae=Me.concat(Ne);function oe(r){return!!Object.values(ie).find(e=>e===P(r))}function P(r){let e;if(e=b(r),!e)return null;let t=e.pathname.lastIndexOf(".");if(!t)return null;let n=e.pathname.substring(t+1);return Ue[n]}var j,H,ce=new Set,Oe=`${ne}[data-controller~="trix-embed"]`;function de(r){var n;let{method:e,action:t}=r||{};return t=((n=b(t))==null?void 0:n.pathname)||t,`${e}:${t}`.trim().toLowerCase()}function me(r,e){if(!r)return;let t=de(r);ce.add({key:t,form:r,input:e})}function Ce(r){var l;let e=de(r),t=[...ce].filter(o=>o.key===e);if(!t.length)return!0;if(r.trixEmbedPasting)return!1;if(r.querySelector(Oe))return!0;let n=new FormData(r),i=((l=b(r.action))==null?void 0:l.searchParams)||new URLSearchParams;return!t.map(o=>o.input).map(o=>!(o.name&&(n.has(o.name)||i.has(o.name))||o.id&&(n.has(o.id)||i.has(o.id)))).includes(!1)}function le(r){Ce(r.target)||r.preventDefault()}function F(r){r.removeEventListener("submit",le,!0),r.addEventListener("submit",le,!0)}function Pe(){if(j)return;let r=Document.prototype.createElement;j={value:function(){let e=r.apply(this,arguments);try{String(arguments[0]).toUpperCase()==="FORM"&&F(e)}catch(t){}return e},configurable:!1},Object.defineProperty(Document.prototype,"createElement",j)}function D(r=0){if(!document.body&&r<10)return setTimeout(()=>D(r+1),50);H||(H=new MutationObserver(e=>e.forEach(t=>t.addedNodes.forEach(n=>{n instanceof HTMLFormElement&&F(n)}))),H.observe(document.body,{childList:!0,subtree:!0}))}addEventListener("load",()=>D());Pe();D();document.querySelectorAll("form").forEach(r=>F(r));var S=class{constructor(e){this.controller=e}preventAttachments(){var e,t,n,i,s;(e=this.editor)==null||e.removeAttribute("data-direct-upload-url"),(t=this.editor)==null||t.removeAttribute("data-blob-url-template"),(n=this.editor)==null||n.addEventListener("trix-file-accept",a=>a.preventDefault(),!0),(s=(i=this.toolbar)==null?void 0:i.querySelector('[data-trix-button-group="file-tools"]'))==null||s.remove()}async preventLinks(){var n,i;let e=await this.controller.allowedLinkHosts;!(await this.controller.blockedLinkHosts).length&&e.includes("*")||(i=(n=this.toolbar)==null?void 0:n.querySelector('[data-trix-action="link"]'))==null||i.remove()}protect(e=0){if(!this.toolbar&&e<10)return setTimeout(()=>this.protect(e+1),25);this.preventAttachments(),this.preventLinks(),this.form&&me(this.form,this.input)}get editor(){return this.controller.element}get toolbar(){return this.controller.toolbarElement}get form(){return this.controller.formElement}get input(){return this.controller.inputElement}};var A=class{constructor(e){var n,i,s;let t=[location.pathname,(i=b((n=e.formElement)==null?void 0:n.action))==null?void 0:i.pathname,(s=e.element.closest("[id]"))==null?void 0:s.id];this.controller=e,this.identifier=t.filter(a=>a&&a.length).join("/").replace(/\/{2,}/g,"/"),this.base=this.obfuscate(this.identifier)}split(e){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}obfuscate(e){var i;let t=[...e].map(s=>s.charCodeAt(0));return[(i=this.split(t)[1])==null?void 0:i.reverse(),t[0]].flat().join("")}read(e){return sessionStorage.getItem(this.generateStorageKey(e))}write(e,t){return sessionStorage.setItem(this.generateStorageKey(e),t)}remove(e){return sessionStorage.removeItem(this.generateStorageKey(e))}generateStorageKey(e){let t=[...this.obfuscate(e)],[n,i]=this.split(t);return btoa(`${n}/${this.base}/${i}`)}};var V={link:"<a href='{{url}}'>{{label}}</a>",embedded:`
6
- <span>
7
- <strong>{{label}}</strong>
8
- <span>{{description}}</span>
9
- <del>{{url}}</del>
10
- </span>
11
- `,prohibited:`
12
- <span>
13
- <strong>{{label}}</strong>
14
- <span>{{description}}</span>
15
- <del>{{url}}</del>
16
- </span>
17
- `,error:`
18
- <div data-trix-embed data-trix-embed-error>
19
- <h1>{{header}}</h1>
20
- <pre><code>{{error.stack}}</code></pre>
21
- </div>
22
- `,iframe:`
23
- <div data-trix-embed>
24
- <iframe src='{{src}}' loading='lazy' referrerpolicy='no-referrer' scrolling='no'></iframe>
25
- </div>
26
- `,image:`
27
- <div data-trix-embed>
28
- <img src='{{src}}' loading='lazy'></img>
29
- </div>
30
- `,warning:`
31
- <div data-trix-embed data-trix-embed-warning>
32
- <h1>{{header}}</h1>
33
- <h3>{{subheader}}</h3>
34
-
35
- <h2>{{prohibited.header}}</h2>
36
- <ul>{{prohibited.hosts}}</ul>
37
-
38
- <h2>{{allowed.header}}</h2>
39
- <ul>{{allowed.hosts}}</ul>
40
- </div>
41
- `};var je=[se,"a","abbr","acronym","address","b","big","blockquote","br","cite","code","dd","del","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","iframe","img","ins","kbd","li","ol","p","pre","samp","small","span","strong","sub","sup","time","tt","ul","var"],He=["abbr","allow","allowfullscreen","allowpaymentrequest","alt","caption","cite","content-type","credentialless","csp","data-trix-embed","data-trix-embed-error","data-trix-embed-prohibited","data-trix-embed-warning","datetime","filename","filesize","height","href","lang","loading","name","presentation","previewable","referrerpolicy","sandbox","sgid","src","srcdoc","title","url","width","xml:lang"],k=class{constructor(e){this.controller=e,this.initializeTempates()}sanitize(e){let t=document.createElement("template");t.innerHTML=`<div>${e}</div>`;let n=t.content.firstElementChild;return[n].concat([...n.querySelectorAll("*")]).forEach(s=>{je.includes(s.tagName.toLowerCase())?[...s.attributes].forEach(a=>{He.includes(a.name.toLowerCase())||s.removeAttribute(a.name)}):s.remove()}),n.innerHTML}initializeTempates(){this.templates=V,Object.keys(V).forEach(e=>this.initializeTemplate(e))}initializeTemplate(e){var s,a;let t=`${e}TemplateValue`,n=this.controller[t],i=n?(a=(s=document.getElementById(n))==null?void 0:s.innerHTML)==null?void 0:a.trim():null;return this.controller[t]=null,i&&(this.templates[e]=i),this.templates[e]}render(e,t={}){return this.templates[e].replace(/{{(.*?)}}/g,(i,s)=>s.split(".").reduce((a,l)=>a[l],t))}renderEmbed(e="https://example.com"){let t=oe(e)?this.render("image",{src:e}):this.render("iframe",{src:e});return this.sanitize(t)}renderEmbeds(e=["https://example.com","https://test.com"]){if(e!=null&&e.length)return e.map(t=>this.renderEmbed(t))}renderWarnings(e=["https://example.com","https://test.com"],t=[],n=[]){if(!(e!=null&&e.length))return;t=[...t].sort(),t.includes("*")&&t.splice(t.indexOf("*"),1),n=[...n],n.includes("*")&&n.splice(n.indexOf("*"),1);let i=[...new Set([...n,...ee(e)])].sort();return this.render("warning",{header:"Copy/Paste Warning",subheader:"Content includes URLs or media from prohibited hosts or restricted protocols.",prohibited:{header:"Prohibited Hosts",hosts:i.length?i.map(s=>`<li>${s}</li>`).join(""):"<li>URLs and media are restricted to allowed hosts and standard protocols.</li>"},allowed:{header:"Allowed Hosts",hosts:t.length?t.map(s=>`<li>${s}</li>`).join(""):"<li>Allowed hosts not configured.</li>"}})}renderError(e){return this.render("error",{header:"Unhandled Exception!",subheader:"Report this problem to a software engineer.",error:e})}};function he(r={Controller:null,Trix:null}){var n;let{Controller:e,Trix:t}=r;return n=class extends e{connect(){this.onPaste=this.paste.bind(this),this.element.addEventListener("trix-paste",this.onPaste,!0),this.onBeforeFetchResponse=this.beforeFetchResponse.bind(this),addEventListener("turbo:before-fetch-response",this.onBeforeFetchResponse,!0),this.onBeforeUnload=this.forgetConfig.bind(this),addEventListener("beforeunload",this.onBeforeUnload,!0),this.store=new A(this),this.guard=new S(this),!this.key&&this.rememberConfig().then(()=>{this.paranoid&&this.guard.protect()})}reconnect(){let i=this.element.getAttribute("data-controller")||"",s=new Set(i.split(" "));s.add("trix-embed"),this.element.setAttribute("data-controller",[...s].join(" ").trim())}disconnect(){this.element.removeEventListener("trix-paste",this.onPaste,!0),removeEventListener("turbo:before-fetch-response",this.onBeforeFetchResponse,!0),removeEventListener("beforeunload",this.onBeforeUnload,!0),this.reconnect()}beforeFetchResponse(i){try{i.target.querySelectorAll("trix-editor").includes(this.element)&&this.forgetConfig()}catch(s){}}async paste(i){this.formElement&&(this.formElement.trixEmbedPasting=!0);try{let{html:s,string:a,range:l}=i.paste,o=s||a||"",d=this.createTemplateElement(o),c=te(d);if(!c.length)return;i.preventDefault(),this.editor.setSelectedRange(l);try{let m=new k(this),h=await this.allowedMediaHosts,u=await this.blockedMediaHosts,p=new Set(c.filter(g=>P(g)));[...d.querySelectorAll("iframe")].forEach(g=>p.add(g.src)),p=[...p];let y=p.filter(g=>C(g,h,u)),v=p.filter(g=>!y.includes(g)),W=await this.allowedLinkHosts,K=await this.blockedLinkHosts,$=c.filter(g=>!p.includes(g)),z=$.filter(g=>C(g,W,K)),q=$.filter(g=>!z.includes(g));if(v.length||q.length){let g=[...new Set([...v,...q])],pe=[...new Set([...h,...W])].filter(M=>!this.reservedDomains.includes(M)),fe=[...new Set([...u,...K])].filter(M=>!this.reservedDomains.includes(M));await this.insert(m.renderWarnings(g,pe,fe))}if(y.length&&await this.insert(m.renderEmbeds(y)),c.length===1&&y.length===1)return;let I=this.sanitizePastedElement(d,{renderer:m,validMediaURLs:y,validLinkURLs:z}).innerHTML.trim();I.length&&await this.insert(I,{disposition:"inline"})}catch(m){this.insert(renderer.renderError(m))}}finally{this.formElement&&delete this.formElement.trixEmbedPasting}}createTemplateElement(i){let s=document.createElement("template");return s.innerHTML=`<div>${i.trim()}</div>`,s.content.firstElementChild}extractLabelFromElement(i,s={default:null}){let a=i.title;return a&&a.length||(a=i.textContent.trim(),a&&a.length)?a:s.default}sanitizePastedElement(i,s={renderer:null,validMediaURLs:[],validLinkURLs:[]}){let{renderer:a,validMediaURLs:l,validLinkURLs:o}=s;i=i.cloneNode(!0);let d=O(i),c=[],m;for(;m=d.nextNode();)m.replacements=m.replacements||new Set,c.push(m),m.nodeValue.split(/\s+/).filter(p=>p.startsWith("http")).forEach(p=>{var v;let f=(v=b(p))==null?void 0:v.href,y=o.includes(f)||o.includes(f)?a.render("link",{url:f,label:f}):a.render("prohibited",{url:f,label:"Prohibited URL:",description:""});m.replacements.add({match:p,replacement:y})});return c.forEach(h=>{if(!h.replacements.size)return;let u=h.nodeValue;[...h.replacements].sort((f,y)=>y.match.length-f.match.length).forEach(f=>u=u.replaceAll(f.match,f.replacement)),h.replaceWith(this.createTemplateElement(u))}),i.querySelectorAll("a").forEach(h=>{let u=U(h),p=this.extractLabelFromElement(h,{default:u}),f=o.includes(u)?a.render("link",{url:u,label:p}):a.render("prohibited",{url:u,label:"Prohibited Link:",description:`(${p})`});h.replaceWith(this.createTemplateElement(f))}),i.querySelectorAll(ae.join(", ")).forEach(h=>{let u=U(h),p=this.extractLabelFromElement(h,{default:u}),f=l.includes(u)?a.render("embedded",{url:u,label:"Allowed Media:",description:"(Embedded Above)"}):a.render("prohibited",{url:u,label:"Prohibited Media:",description:""});h.replaceWith(this.createTemplateElement(f))}),i.innerHTML.replaceAll(/(\n|\r|\f|\v)+/g,"<br>"),i}createAttachment(i){return new t.Attachment({content:i,contentType:re.attachment})}insertNewlines(i=1,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{for(let o=0;o<i;o++)this.editor.insertLineBreak();l()},a)})}insertAttachment(i,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{this.editor.insertAttachment(this.createAttachment(i)),this.insertNewlines(1,{delay:a}).finally(l)},a)})}insertHTML(i,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{this.editor.insertHTML(i),this.insertNewlines(1,{delay:a}).finally(l)},a)})}insert(i,s={delay:1,disposition:"attachment"}){let{delay:a,disposition:l}=s;return i!=null&&i.length?new Promise(o=>{setTimeout(()=>{if(typeof i=="string")return l==="inline"?this.insertHTML(i,{delay:a}).catch(d=>this.renderError(d)).finally(o):this.insertAttachment(i,{delay:a}).catch(d=>this.renderError(d)).finally(o);if(Array.isArray(i)){let d=l==="inline"?i.map(c=>this.insertHTML(c,{delay:a+1})):i.map(c=>this.insertAttachment(c,{delay:a+1}));return Promise.all(d).catch(c=>this.renderError(c)).finally(o)}o()})}):Promise.resolve()}get editor(){return this.element.editor}get toolbarElement(){let i=this.element.getAttribute("toolbar"),s=i?document.getElementById(i):null;if(!s){let a=this.element.previousElementSibling;s=a!=null&&a.tagName.match(/trix-toolbar/i)?a:null}return s}get formElement(){return this.element.closest("form")}get inputElement(){var s;let i=this.element.getAttribute("input");return i?(s=this.formElement)==null?void 0:s.querySelector(`#${i}`):null}get paranoid(){return!!this.store.read("paranoid")}get key(){try{return JSON.parse(this.store.read("key"))[2]}catch(i){return null}}get hostsValueDescriptors(){return Object.values(this.valueDescriptorMap).filter(i=>i.name.endsWith("HostsValue"))}get reservedDomains(){return["embed.example","embed.invalid","embed.local","embed.localhost","embed.test","trix.embed.example","trix.embed.invalid","trix.embed.local","trix.embed.localhost","trix.embed.test","trix.example","trix.invalid","trix.local","trix.localhost","trix.test","www.embed.example","www.embed.invalid","www.embed.local","www.embed.localhost","www.embed.test","www.trix.example","www.trix.invalid","www.trix.local","www.trix.localhost","www.trix.test"]}rememberConfig(){return new Promise(async i=>{let s,a=await T();s=await x(a,w(this.reservedDomains,3)),this.store.write("key",JSON.stringify([s[0],s[1],a,s[2]])),this.paranoidValue!==!1&&(s=await x(a,w(this.reservedDomains,4)),this.store.write("paranoid",JSON.stringify(s))),this.element.removeAttribute("data-trix-embed-paranoid-value"),this.hostsValueDescriptors.forEach(async l=>{let{name:o}=l,d=o.slice(0,o.lastIndexOf("Value")),c=this[o];c.length<4&&(c=c.concat(w(this.reservedDomains,4-c.length))),this.store.write(d,JSON.stringify(await x(a,c))),this.hasOwnProperty(d)||Object.defineProperty(this,d,{get:async()=>{try{return(await X(this.key,JSON.parse(this.store.read(d)))).filter(h=>!this.reservedDomains.includes(h))}catch(m){return console.error(`Failed to get '${d}'!`,m),[]}}}),this.element.removeAttribute(`data-trix-embed-${l.key}`)}),s=await x(a,w(this.reservedDomains,4)),this.store.write("securityHosts",s),s=await x(a,w(this.reservedDomains,4)),this.store.write("obscurityHosts",s),i()})}forgetConfig(){var i,s,a,l;try{(i=this.store)==null||i.remove("key"),(s=this.store)==null||s.remove("paranoid"),this.hostsValueDescriptors.forEach(async o=>{var m;let{name:d}=o,c=d.slice(0,d.lastIndexOf("Value"));(m=this.store)==null||m.remove(c)}),(a=this.store)==null||a.remove("securityHosts"),(l=this.store)==null||l.remove("obscurityHosts")}catch(o){}}},J(n,"values",{embeddedTemplate:String,errorTemplate:String,iframeTemplate:String,imageTemplate:String,linkTemplate:String,prohibitedTemplate:String,warningTemplate:String,allowedLinkHosts:Array,blockedLinkHosts:Array,allowedMediaHosts:Array,blockedMediaHosts:Array,paranoid:{type:Boolean,default:!0}}),n}var ue=!1,Fe={application:null,Controller:null,Trix:null};function De(r=Fe){if(ue)return;let{application:e,Controller:t,Trix:n}=r;e.register("trix-embed",he({Controller:t,Trix:n})),ue=!0}self.TrixEmbed=L(E({},_),{encryptValues:x,generateKey:T,generateKeyAndEncryptValues:Q,initialize:De});var Tt=self.TrixEmbed;export{Tt as default};
5
+ const _0x25ec03=_0x5b82;(function(_0x1653a9,_0x53037e){const _0x5e30e6=_0x5b82,_0xa0e205=_0x1653a9();while(!![]){try{const _0x387d76=-parseInt(_0x5e30e6(0x2c6))/0x1*(parseInt(_0x5e30e6(0x310))/0x2)+-parseInt(_0x5e30e6(0x2c4))/0x3*(-parseInt(_0x5e30e6(0x2fc))/0x4)+parseInt(_0x5e30e6(0x24a))/0x5*(parseInt(_0x5e30e6(0x27c))/0x6)+-parseInt(_0x5e30e6(0x289))/0x7*(-parseInt(_0x5e30e6(0x2b5))/0x8)+parseInt(_0x5e30e6(0x21c))/0x9*(parseInt(_0x5e30e6(0x2ce))/0xa)+parseInt(_0x5e30e6(0x276))/0xb*(-parseInt(_0x5e30e6(0x2ec))/0xc)+-parseInt(_0x5e30e6(0x2b6))/0xd*(parseInt(_0x5e30e6(0x248))/0xe);if(_0x387d76===_0x53037e)break;else _0xa0e205['push'](_0xa0e205['shift']());}catch(_0x125cc0){_0xa0e205['push'](_0xa0e205['shift']());}}}(_0x1733,0xb565e));var be=Object[_0x25ec03(0x2f4)],ye=Object[_0x25ec03(0x2e2)],xe=Object['getOwnPropertyDescriptors'],G=Object[_0x25ec03(0x2d1)],we=Object[_0x25ec03(0x293)]['hasOwnProperty'],ve=Object['prototype'][_0x25ec03(0x313)],N=(_0x45de01,_0x50186e,_0x3cbb86)=>_0x50186e in _0x45de01?be(_0x45de01,_0x50186e,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x3cbb86}):_0x45de01[_0x50186e]=_0x3cbb86,v=(_0x4b073f,_0x852a77)=>{const _0x4e4714=_0x25ec03;for(var _0x565983 in _0x852a77||(_0x852a77={}))we[_0x4e4714(0x2bb)](_0x852a77,_0x565983)&&N(_0x4b073f,_0x565983,_0x852a77[_0x565983]);if(G){for(var _0x565983 of G(_0x852a77))ve[_0x4e4714(0x2bb)](_0x852a77,_0x565983)&&N(_0x4b073f,_0x565983,_0x852a77[_0x565983]);}return _0x4b073f;},E=(_0x2e5804,_0x39716b)=>ye(_0x2e5804,xe(_0x39716b)),X=(_0x6503d4,_0x2f90a1,_0x3e7d9e)=>(N(_0x6503d4,typeof _0x2f90a1!=_0x25ec03(0x2b7)?_0x2f90a1+'':_0x2f90a1,_0x3e7d9e),_0x3e7d9e),Q={'version':'0.0.5'},R={'name':_0x25ec03(0x1ec),'length':0x100},Ee=!0x0,Le=[_0x25ec03(0x22d),_0x25ec03(0x237)];async function Te(){const _0x42b65c=_0x25ec03;let _0x2d1232=[_0x42b65c(0x22d),'decrypt'];return await crypto[_0x42b65c(0x2fa)][_0x42b65c(0x2aa)](R,!0x0,_0x2d1232);}async function Se(_0x1ef85c){const _0x9f2068=_0x25ec03;let _0x11c225=await crypto[_0x9f2068(0x2fa)][_0x9f2068(0x228)](_0x9f2068(0x2a5),_0x1ef85c);return JSON['stringify'](_0x11c225);}async function Y(_0x21430f){const _0x5227a5=_0x25ec03;let _0x55318f=JSON[_0x5227a5(0x2eb)](_0x21430f);return await crypto[_0x5227a5(0x2fa)]['importKey'](_0x5227a5(0x2a5),_0x55318f,R,Ee,Le);}function _0x1733(){const _0x59757c=['HostsValue','target','294kjCahX','write','413iXLBUl','connect','var','www.embed.localhost','TemplateValue','cloneNode','sup','replaceWith','1063670bWoyAg','[data-controller~=\x22trix-embed\x22]','catch','getOwnPropertySymbols','decode','error','push','submit','substring','<a\x20href=\x27{{url}}\x27>{{label}}</a>','figcaption','data-trix-embed-paranoid-value','protect','referrerpolicy','startsWith','www.trix.localhost','tagName','searchParams','video','add','defineProperties','join','removeAttribute','renderError','warning','use','[id]','allowedLinkHostsValue','Prohibited\x20Link:','parse','108FFQWeg','reconnect','remove','controller','trix.localhost','trix.test','track','templates','defineProperty','frame','www.trix.test','\x0a\x20\x20\x20\x20<div\x20data-trix-embed>\x0a\x20\x20\x20\x20\x20\x20<iframe\x20src=\x27{{src}}\x27\x20loading=\x27lazy\x27\x20referrerpolicy=\x27no-referrer\x27\x20scrolling=\x27no\x27></iframe>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','img','inputElement','subtle','keys','55372TUrDnU','name','info','embed','<li>','blockedHosts','isArray','reservedDomains','formElement','image/avif','https://test.com','previewable','data-trix-embed-warning','insertNewlines','read','www.trix.invalid','trim','textContent','trix-paste','data-trix-embed-prohibited','698XnMOjl','image/x-icon','all','propertyIsEnumerable','http','FILTER_ACCEPT','pre','charCodeAt','tel:','embed.test','has','image/gif','FORM','forgetConfig','prohibited','blockedLinkHosts','content','pathname','onBeforeFetchResponse','Content\x20includes\x20links\x20or\x20media\x20from\x20restricted\x20protocols\x20or\x20prohibited\x20hosts.','Prohibited\x20Media:','src','forEach','FILTER_SKIP','replacement','Copy/Paste\x20Warning','filter','cite','animate','image/jp2','action-text-attachment','data-trix-embed-error','bind','obscurityHosts','data-trix-embed','AES-GCM','base','loading','object','obfuscate','Prohibited\x20URL:','image/bmp','href','link','www.embed.test','finally','iframe','trix-embed/attachment','preventAttachments','samp','guard','[data-trix-button-group=\x22file-tools\x22]','querySelector','includes','load','createElement','sgid','news:','querySelectorAll','allowpaymentrequest','small','removeEventListener','del','(Embedded\x20Above)','image','[data-trix-action=\x22link\x22]','source','www.embed.local','values','form','Attachment','frameset','<li>Not\x20configured</li>','animateTransform','turbo:before-fetch-response','animateMotion','div','slice','trix-file-accept','toolbar','trix-embed','innerHTML','extractLabelFromElement','99ZPoyrt','string','</li>','sub','template','toLowerCase','register','trix.local','span','allowedMediaHosts','toolbarElement','trixEmbedPasting','exportKey','map','setSelectedRange','image/heif','find','encrypt','embed.example','body','trix.example','allowedLinkHosts','</div>','observe','firstElementChild','ceil','SHOW_TEXT','decrypt','setAttribute','action','Failed\x20to\x20get\x20\x27','image/heic','srcdoc','renderWarnings','kbd','font-face-uri','apply','code','image/tiff','input','All','setItem','audio','reverse','154MQyywr','element','3295kyPdtL','ciphertext','Value','nodeValue','trix.embed.local','width','renderEmbed','generateStorageKey','embed.localhost','random','rememberConfig','[src],\x20[href]','trix.invalid','addEventListener','reduce','initializeTempates','Prohibited\x20Hosts','title','alt','endsWith','key','picture','Report\x20this\x20problem\x20to\x20a\x20software\x20engineer.','allow','acronym','caption','script','renderEmbeds','time','replacements','trix.embed.localhost','\x0a\x20\x20\x20\x20<div\x20data-trix-embed\x20data-trix-embed-error>\x0a\x20\x20\x20\x20\x20\x20<h1>{{header}}</h1>\x0a\x20\x20\x20\x20\x20\x20<pre><code>{{error.stack}}</code></pre>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','getElementById','image/vnd.ms-photo','embed.invalid','<div>','abbr','blockedLinkHostsValue','insertAttachment','content-type','getRandomValues','replaceAll','allowedMediaHostsValue','number','868153hkUldB','getItem','initializeTemplate','blockedMediaHosts','Allowed\x20Media:','data-trix-embed-key-value=\x22','2640hTWNkR','lastIndexOf','log','fromCharCode','filename','split','configured','then','closest','csp','presentation','beforeFetchResponse','data-trix-embed-','4382iIhCXb','insertLineBreak','replace','xml:lang','default','previousElementSibling','paranoid','image/jpeg','render','preventDefault','prototype','\x0a\x20\x20\x20\x20<div\x20data-trix-embed>\x0a\x20\x20\x20\x20\x20\x20<img\x20src=\x27{{src}}\x27\x20loading=\x27lazy\x27></img>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','stringify','onPaste','datetime','encode','length','editor','embed.local','createTemplateElement','removeItem','lang','embedded','data-direct-upload-url','identifier','\x0a\x20\x20\x20\x20<div\x20data-trix-embed\x20data-trix-embed-warning>\x0a\x20\x20\x20\x20\x20\x20<h1>{{header}}</h1>\x0a\x20\x20\x20\x20\x20\x20<h3>{{subheader}}</h3>\x0a\x0a\x20\x20\x20\x20\x20\x20<h2>{{prohibited.header}}</h2>\x0a\x20\x20\x20\x20\x20\x20<ul>{{prohibited.hosts}}</ul>\x0a\x0a\x20\x20\x20\x20\x20\x20<h2>{{allowed.header}}</h2>\x0a\x20\x20\x20\x20\x20\x20<ul>{{allowed.hosts}}</ul>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','store','figure','jwk','big','trix-editor','attachment','onBeforeUnload','generateKey','dfn','inline','insert','nextNode','credentialless','https://example.com','\x0a\x20\x20\x20\x20<span>\x0a\x20\x20\x20\x20\x20\x20<strong>{{label}}</strong>\x0a\x20\x20\x20\x20\x20\x20<span>{{description}}</span>\x0a\x20\x20\x20\x20\x20\x20<del>{{url}}</del>\x0a\x20\x20\x20\x20</span>\x0a\x20\x20','concat','createAttachment','insertHTML','11424yzPsWK','2497287CCWNVu','symbol','hostsValueDescriptors','ins','size','call','paste','feImage','<br>','sanitize','Unhandled\x20Exception!','match'];_0x1733=function(){return _0x59757c;};return _0x1733();}async function ke(_0x412077,_0x5a8019){const _0x284a2e=_0x25ec03;let _0x3eea90=new TextEncoder()[_0x284a2e(0x298)](String(_0x412077)),_0x1fc97d=crypto[_0x284a2e(0x272)](new Uint8Array(0xc)),_0x7b4f0f=await crypto[_0x284a2e(0x2fa)]['encrypt'](E(v({},R),{'iv':_0x1fc97d}),_0x5a8019,_0x3eea90),_0x523aa3={'ciphertext':btoa(String['fromCharCode'](...new Uint8Array(_0x7b4f0f))),'iv':btoa(String[_0x284a2e(0x27f)](..._0x1fc97d))};return btoa(JSON[_0x284a2e(0x295)](_0x523aa3));}async function Ae(_0x5e86c8,_0x22ce58){const _0x407270=_0x25ec03;let _0x2ed876=JSON['parse'](atob(_0x5e86c8)),_0x7cca83=new Uint8Array(atob(_0x2ed876[_0x407270(0x24b)])['split']('')['map'](_0x493600=>_0x493600['charCodeAt'](0x0))),_0x52ded9=new Uint8Array(atob(_0x2ed876['iv'])[_0x407270(0x281)]('')[_0x407270(0x229)](_0x4c21c0=>_0x4c21c0['charCodeAt'](0x0))),_0x387fc4=await crypto[_0x407270(0x2fa)][_0x407270(0x237)](E(v({},R),{'iv':_0x52ded9}),_0x22ce58,_0x7cca83);return new TextDecoder()[_0x407270(0x2d2)](_0x387fc4);}async function L(){let _0x2cd2f=await Te(),_0x1ee26c=await Se(_0x2cd2f);return btoa(_0x1ee26c);}async function y(_0x5379ce,_0x26ca0c=[]){const _0x58ad3c=_0x25ec03;let _0x51cf77=await Y(atob(_0x5379ce));return Promise[_0x58ad3c(0x312)](_0x26ca0c['map'](_0x3882d8=>ke(_0x3882d8,_0x51cf77)));}async function Z(_0x5eadf3,_0x3e1230=[]){const _0x1ffbb0=_0x25ec03;let _0x32f1da=await Y(atob(_0x5eadf3));return Promise[_0x1ffbb0(0x312)](_0x3e1230['map'](_0x658293=>Ae(_0x658293,_0x32f1da)));}async function ee(_0xbcb685=[]){const _0x271882=_0x25ec03;let _0x3f2411=await L(),_0x49b7a1=await y(_0x3f2411,_0xbcb685);return console[_0x271882(0x27e)](_0x271882(0x27b)+_0x3f2411+'\x22'),console[_0x271882(0x27e)]('data-trix-embed-hosts-value=\x27'+JSON['stringify'](_0x49b7a1)+'\x27'),{'key':_0x3f2411,'encryptedValues':_0x49b7a1};}var te=_0x23bdb7=>Math['floor'](Math[_0x25ec03(0x253)]()*_0x23bdb7),w=(_0x4f97be,_0x5deb0d=null)=>{const _0x49cd25=_0x25ec03;let _0x23169d=[..._0x4f97be];_0x5deb0d===_0x49cd25(0x312)&&(_0x5deb0d=_0x23169d[_0x49cd25(0x299)]);let _0xa9c006=_0x23169d[_0x49cd25(0x299)],_0x5d4201=[],_0x17db60=new Set();for(;_0x5d4201[_0x49cd25(0x299)]<_0x5deb0d;){let _0x352877=te(_0xa9c006);for(;_0x17db60[_0x49cd25(0x31a)](_0x352877);)_0x352877=te(_0xa9c006);_0x17db60['add'](_0x352877),_0x5d4201[_0x49cd25(0x2d4)](_0x23169d[_0x352877]);}return typeof _0x5deb0d==_0x49cd25(0x275)?_0x5d4201:_0x5d4201[0x0];};function g(_0x308e7c,_0x21904f=_0x28bd86=>{}){const _0x12b85c=_0x25ec03;try{let _0x563822=new URL(String(_0x308e7c)['trim']());return _0x563822&&_0x21904f&&_0x21904f(_0x563822),_0x563822;}catch(_0x364bf1){console[_0x12b85c(0x2fe)]('Failed\x20to\x20parse\x20URL!\x20value=\x27'+_0x308e7c+'\x27]');}return null;}function re(_0x1bc740,_0x5efe72=_0x74c3dc=>{}){var _0x426130;let _0x136e2f=(_0x426130=g(_0x1bc740))==null?void 0x0:_0x426130['host'];return _0x136e2f&&_0x5efe72&&_0x5efe72(_0x136e2f),_0x136e2f;}function C(_0x566406){const _0x3b21fb=_0x25ec03;return document['createTreeWalker'](_0x566406,NodeFilter[_0x3b21fb(0x236)],_0x31fb3d=>_0x31fb3d['nodeValue'][_0x3b21fb(0x2c1)](/http/gi)?NodeFilter[_0x3b21fb(0x315)]:NodeFilter[_0x3b21fb(0x1e0)]);}function Re(_0xfd6f9){const _0x29f3f3=_0x25ec03;let _0x537c1b=new Set(),_0x51257c=C(_0xfd6f9),_0x3dc8ca;for(;_0x3dc8ca=_0x51257c['nextNode']();)_0x3dc8ca[_0x29f3f3(0x24d)][_0x29f3f3(0x281)](/\s+/)['filter'](_0x53f58f=>_0x53f58f[_0x29f3f3(0x2dc)](_0x29f3f3(0x314)))[_0x29f3f3(0x1df)](_0x7d83bc=>g(_0x7d83bc,_0x2da1d7=>_0x537c1b[_0x29f3f3(0x2e1)](_0x2da1d7[_0x29f3f3(0x1f3)])));return[..._0x537c1b];}function U(_0xe43e1d){const _0x321e78=_0x25ec03;if(_0xe43e1d[_0x321e78(0x1de)]){let _0x21b508=_0xe43e1d['src'][_0x321e78(0x30c)]();if(_0x21b508['length'])return _0x21b508;}if(_0xe43e1d[_0x321e78(0x1f3)]){let _0x56a7a5=_0xe43e1d[_0x321e78(0x1f3)][_0x321e78(0x30c)]();if(_0x56a7a5[_0x321e78(0x299)])return _0x56a7a5;}return'';}function Ue(_0x4fc340){const _0x25bf51=_0x25ec03;let _0x119f92=new Set();return _0x4fc340[_0x25bf51(0x1de)]&&g(_0x4fc340[_0x25bf51(0x1de)],_0x50b7b8=>_0x119f92[_0x25bf51(0x2e1)](_0x50b7b8[_0x25bf51(0x1f3)])),_0x4fc340['href']&&g(_0x4fc340['href'],_0x7e2c5f=>_0x119f92[_0x25bf51(0x2e1)](_0x7e2c5f[_0x25bf51(0x1f3)])),_0x4fc340['querySelectorAll'](_0x25bf51(0x255))[_0x25bf51(0x1df)](_0x810019=>g(U(_0x810019),_0x306ebc=>_0x119f92['add'](_0x306ebc[_0x25bf51(0x1f3)]))),[..._0x119f92];}function H(_0x30c919,_0x3e7684=[],_0x10b0f8=[]){const _0x5ae364=_0x25ec03;let _0x1655b8=re(_0x30c919);return _0x10b0f8[_0x5ae364(0x1fe)]('*')||_0x10b0f8[_0x5ae364(0x22c)](_0x9ab143=>_0x1655b8[_0x5ae364(0x25d)](_0x9ab143))?!0x1:!!(_0x3e7684[_0x5ae364(0x22c)](_0x586139=>_0x1655b8[_0x5ae364(0x25d)](_0x586139))||_0x3e7684[_0x5ae364(0x1fe)]('*')&&(_0x1655b8||_0x30c919[_0x5ae364(0x2dc)]('data:')||_0x30c919[_0x5ae364(0x2dc)](_0x5ae364(0x202))||_0x30c919[_0x5ae364(0x2dc)](_0x5ae364(0x318))));}function ie(_0x8f1c1){const _0x455b39=_0x25ec03;return[..._0x8f1c1[_0x455b39(0x258)]((_0x277f47,_0x181a8d)=>(re(_0x181a8d,_0x208ebd=>_0x277f47[_0x455b39(0x2e1)](_0x208ebd)),_0x277f47),new Set())];}function ne(_0x5a700f){let _0x2c03dc=Ue(_0x5a700f),_0x3138d8=Re(_0x5a700f);return[...new Set([..._0x2c03dc,..._0x3138d8])];}var se={'attachment':_0x25ec03(0x1f8)},ae={'avif':_0x25ec03(0x305),'bmp':_0x25ec03(0x1f2),'gif':_0x25ec03(0x31b),'heic':_0x25ec03(0x23b),'heif':_0x25ec03(0x22b),'ico':_0x25ec03(0x311),'jp2':_0x25ec03(0x1e6),'jpeg':'image/jpeg','jpg':_0x25ec03(0x290),'jxr':_0x25ec03(0x26b),'png':'image/png','svg':'image/svg+xml','tif':_0x25ec03(0x242),'tiff':_0x25ec03(0x242),'webp':'image/webp'},Me=ae,Ne=[_0x25ec03(0x1e5),_0x25ec03(0x214),_0x25ec03(0x212),'area',_0x25ec03(0x246),_0x25ec03(0x1ed),'embed','feDisplacementMap',_0x25ec03(0x2bd),'feTile',_0x25ec03(0x1e3),_0x25ec03(0x23f),_0x25ec03(0x1f7),_0x25ec03(0x209),_0x25ec03(0x1f4),_0x25ec03(0x1ef),'script',_0x25ec03(0x20b),'track',_0x25ec03(0x2e7),_0x25ec03(0x2e0)],Ce=[_0x25ec03(0x246),_0x25ec03(0x2ff),_0x25ec03(0x1f7),'img',_0x25ec03(0x243),_0x25ec03(0x264),_0x25ec03(0x20b),_0x25ec03(0x2f2),'video',_0x25ec03(0x2f5),_0x25ec03(0x210),_0x25ec03(0x1ef),_0x25ec03(0x25f),_0x25ec03(0x2e7)],oe='trix-editor',le=_0x25ec03(0x1e7),ce=Ne[_0x25ec03(0x2b2)](Ce);function de(_0x506ddd){const _0x52f289=_0x25ec03;return!!Object[_0x52f289(0x20d)](ae)[_0x52f289(0x22c)](_0x543690=>_0x543690===O(_0x506ddd));}function O(_0x3ae20f){const _0x4ee23e=_0x25ec03;let _0x231ad8;if(_0x231ad8=g(_0x3ae20f),!_0x231ad8)return null;let _0x40d123=_0x231ad8[_0x4ee23e(0x321)]['lastIndexOf']('.');if(!_0x40d123)return null;let _0x490d3d=_0x231ad8[_0x4ee23e(0x321)][_0x4ee23e(0x2d6)](_0x40d123+0x1);return Me[_0x490d3d];}var P,j,he=new Set(),He=oe+_0x25ec03(0x2cf);function ue(_0xaa26a){const _0x1ab9a1=_0x25ec03;var _0x5b6048;let {method:_0x3971e1,action:_0x4f20e7}=_0xaa26a||{};return _0x4f20e7=((_0x5b6048=g(_0x4f20e7))==null?void 0x0:_0x5b6048[_0x1ab9a1(0x321)])||_0x4f20e7,(_0x3971e1+':'+_0x4f20e7)[_0x1ab9a1(0x30c)]()[_0x1ab9a1(0x221)]();}function pe(_0x57bb13,_0x1ceb12){const _0x5f1d4c=_0x25ec03;if(!_0x57bb13)return;let _0x2512e5=ue(_0x57bb13);he[_0x5f1d4c(0x2e1)]({'key':_0x2512e5,'form':_0x57bb13,'input':_0x1ceb12});}function Oe(_0x3fbec1){const _0x13437d=_0x25ec03;var _0xecf7;let _0x2cca21=ue(_0x3fbec1),_0x441f25=[...he][_0x13437d(0x1e3)](_0x338125=>_0x338125[_0x13437d(0x25e)]===_0x2cca21);if(!_0x441f25[_0x13437d(0x299)])return!0x0;if(_0x3fbec1[_0x13437d(0x227)])return!0x1;if(_0x3fbec1[_0x13437d(0x1fd)](He))return!0x0;let _0x1fef73=new FormData(_0x3fbec1),_0x471eb9=((_0xecf7=g(_0x3fbec1[_0x13437d(0x239)]))==null?void 0x0:_0xecf7[_0x13437d(0x2df)])||new URLSearchParams();return!_0x441f25['map'](_0x2bd0b2=>_0x2bd0b2[_0x13437d(0x243)])[_0x13437d(0x229)](_0x2a2813=>!(_0x2a2813[_0x13437d(0x2fd)]&&(_0x1fef73['has'](_0x2a2813[_0x13437d(0x2fd)])||_0x471eb9[_0x13437d(0x31a)](_0x2a2813[_0x13437d(0x2fd)]))||_0x2a2813['id']&&(_0x1fef73[_0x13437d(0x31a)](_0x2a2813['id'])||_0x471eb9[_0x13437d(0x31a)](_0x2a2813['id']))))['includes'](!0x1);}function me(_0x1d2aa6){const _0x123a87=_0x25ec03;Oe(_0x1d2aa6[_0x123a87(0x2c3)])||_0x1d2aa6[_0x123a87(0x292)]();}function V(_0x1a449e){const _0x4f6e42=_0x25ec03;_0x1a449e['removeEventListener'](_0x4f6e42(0x2d5),me,!0x0),_0x1a449e[_0x4f6e42(0x257)](_0x4f6e42(0x2d5),me,!0x0);}function Pe(){const _0xa91ed9=_0x25ec03;if(P)return;let _0x53bb45=Document[_0xa91ed9(0x293)][_0xa91ed9(0x200)];P={'value':function(){const _0x1e5e61=_0xa91ed9;let _0x47c5fb=_0x53bb45[_0x1e5e61(0x240)](this,arguments);try{String(arguments[0x0])['toUpperCase']()===_0x1e5e61(0x31c)&&V(_0x47c5fb);}catch(_0x42d714){}return _0x47c5fb;},'configurable':!0x1},Object[_0xa91ed9(0x2f4)](Document[_0xa91ed9(0x293)],_0xa91ed9(0x200),P);}function F(_0x50363d=0x0){const _0x249c15=_0x25ec03;if(!document['body']&&_0x50363d<0x64)return setTimeout(()=>F(_0x50363d+0x1),0x19);j||(j=new MutationObserver(_0x36e795=>_0x36e795[_0x249c15(0x1df)](_0x7c2c7d=>_0x7c2c7d['addedNodes'][_0x249c15(0x1df)](_0x18e0f0=>{_0x18e0f0 instanceof HTMLFormElement&&V(_0x18e0f0);}))),j[_0x249c15(0x233)](document[_0x249c15(0x22f)],{'childList':!0x0,'subtree':!0x0}));}addEventListener(_0x25ec03(0x1ff),()=>F()),Pe(),F(),document[_0x25ec03(0x203)](_0x25ec03(0x20e))[_0x25ec03(0x1df)](_0xaf42c7=>V(_0xaf42c7));var T=class{constructor(_0x4cd962){const _0x5f2d5a=_0x25ec03;this[_0x5f2d5a(0x2ef)]=_0x4cd962;}[_0x25ec03(0x1f9)](){const _0x2cbbde=_0x25ec03;var _0x47dd3c,_0x5a024f,_0x33ce1b,_0x5b7f57,_0x589d17;(_0x47dd3c=this[_0x2cbbde(0x29a)])==null||_0x47dd3c['removeAttribute'](_0x2cbbde(0x2a0)),(_0x5a024f=this[_0x2cbbde(0x29a)])==null||_0x5a024f['removeAttribute']('data-blob-url-template'),(_0x33ce1b=this[_0x2cbbde(0x29a)])==null||_0x33ce1b[_0x2cbbde(0x257)](_0x2cbbde(0x217),_0x28639d=>_0x28639d[_0x2cbbde(0x292)](),!0x0),(_0x589d17=(_0x5b7f57=this['toolbar'])==null?void 0x0:_0x5b7f57[_0x2cbbde(0x1fd)](_0x2cbbde(0x1fc)))==null||_0x589d17[_0x2cbbde(0x2ee)]();}async['preventLinks'](){const _0x4d0381=_0x25ec03;var _0x3e6780,_0x5f3ffb;let _0x467d93=await this[_0x4d0381(0x2ef)][_0x4d0381(0x231)];!(await this[_0x4d0381(0x2ef)]['blockedLinkHosts'])['length']&&_0x467d93[_0x4d0381(0x1fe)]('*')||(_0x5f3ffb=(_0x3e6780=this[_0x4d0381(0x218)])==null?void 0x0:_0x3e6780[_0x4d0381(0x1fd)](_0x4d0381(0x20a)))==null||_0x5f3ffb[_0x4d0381(0x2ee)]();}[_0x25ec03(0x2da)](_0x70543d=0x0){const _0x82622f=_0x25ec03;if(!this[_0x82622f(0x218)]&&_0x70543d<0x64)return setTimeout(()=>this[_0x82622f(0x2da)](_0x70543d+0x1),0x19);this[_0x82622f(0x1f9)](),this['preventLinks'](),this['form']&&pe(this[_0x82622f(0x20e)],this[_0x82622f(0x243)]);}get[_0x25ec03(0x29a)](){return this['controller']['element'];}get[_0x25ec03(0x218)](){const _0x432955=_0x25ec03;return this[_0x432955(0x2ef)]['toolbarElement'];}get[_0x25ec03(0x20e)](){const _0xb2b5b6=_0x25ec03;return this[_0xb2b5b6(0x2ef)][_0xb2b5b6(0x304)];}get['input'](){const _0x1a0ea8=_0x25ec03;return this[_0x1a0ea8(0x2ef)][_0x1a0ea8(0x2f9)];}},S=class{constructor(_0x5356b0){const _0x4b3e49=_0x25ec03;var _0xfe6335,_0x4400cf,_0x55ebde;let _0x584ee0=[location[_0x4b3e49(0x321)],(_0x4400cf=g((_0xfe6335=_0x5356b0[_0x4b3e49(0x304)])==null?void 0x0:_0xfe6335[_0x4b3e49(0x239)]))==null?void 0x0:_0x4400cf['pathname'],(_0x55ebde=_0x5356b0[_0x4b3e49(0x249)][_0x4b3e49(0x284)](_0x4b3e49(0x2e8)))==null?void 0x0:_0x55ebde['id']];this[_0x4b3e49(0x2ef)]=_0x5356b0,this[_0x4b3e49(0x2a1)]=_0x584ee0[_0x4b3e49(0x1e3)](_0x5f4fd4=>_0x5f4fd4&&_0x5f4fd4[_0x4b3e49(0x299)])['join']('/')[_0x4b3e49(0x28b)](/\/{2,}/g,'/'),this[_0x4b3e49(0x1ed)]=this[_0x4b3e49(0x1f0)](this['identifier']);}[_0x25ec03(0x281)](_0x48dbb4){const _0xab7f4f=_0x25ec03;let _0x248dff=Math[_0xab7f4f(0x235)](_0x48dbb4[_0xab7f4f(0x299)]/0x2);return[_0x48dbb4[_0xab7f4f(0x216)](0x0,_0x248dff),_0x48dbb4[_0xab7f4f(0x216)](_0x248dff)];}['obfuscate'](_0x57fa32){const _0x479deb=_0x25ec03;var _0x3e58b1;let _0x397c7d=[..._0x57fa32]['map'](_0x217819=>_0x217819[_0x479deb(0x317)](0x0));return[(_0x3e58b1=this[_0x479deb(0x281)](_0x397c7d)[0x1])==null?void 0x0:_0x3e58b1[_0x479deb(0x247)](),_0x397c7d[0x0]]['flat']()['join']('');}[_0x25ec03(0x30a)](_0x2b1796){const _0x20e54b=_0x25ec03;return sessionStorage[_0x20e54b(0x277)](this[_0x20e54b(0x251)](_0x2b1796));}['write'](_0x15183e,_0x37ea35){const _0x3c37d8=_0x25ec03;return sessionStorage[_0x3c37d8(0x245)](this[_0x3c37d8(0x251)](_0x15183e),_0x37ea35);}[_0x25ec03(0x2ee)](_0x485822){const _0x3236df=_0x25ec03;return sessionStorage[_0x3236df(0x29d)](this[_0x3236df(0x251)](_0x485822));}['generateStorageKey'](_0x2c7846){const _0x1de9d8=_0x25ec03;let _0x3fe93e=[...this[_0x1de9d8(0x1f0)](_0x2c7846)],[_0x27bae8,_0x21a5be]=this[_0x1de9d8(0x281)](_0x3fe93e);return btoa(_0x27bae8+'/'+this[_0x1de9d8(0x1ed)]+'/'+_0x21a5be);}},D={'link':_0x25ec03(0x2d7),'embedded':_0x25ec03(0x2b1),'prohibited':_0x25ec03(0x2b1),'error':_0x25ec03(0x269),'iframe':_0x25ec03(0x2f7),'image':_0x25ec03(0x294),'warning':_0x25ec03(0x2a2)},je=[le,'a',_0x25ec03(0x26e),_0x25ec03(0x262),'address','b',_0x25ec03(0x2a6),'blockquote','br','cite',_0x25ec03(0x241),'dd',_0x25ec03(0x207),_0x25ec03(0x2ab),_0x25ec03(0x215),'dl','dt','em',_0x25ec03(0x2d8),_0x25ec03(0x2a4),'h1','h2','h3','h4','h5','h6','hr','i','iframe',_0x25ec03(0x2f8),_0x25ec03(0x2b9),_0x25ec03(0x23e),'li','ol','p',_0x25ec03(0x316),_0x25ec03(0x1fa),_0x25ec03(0x205),_0x25ec03(0x224),'strong',_0x25ec03(0x21f),_0x25ec03(0x2cc),_0x25ec03(0x266),'tt','ul',_0x25ec03(0x2c8)],Ve=['abbr',_0x25ec03(0x261),'allowfullscreen',_0x25ec03(0x204),_0x25ec03(0x25c),_0x25ec03(0x263),_0x25ec03(0x1e4),_0x25ec03(0x271),_0x25ec03(0x2af),_0x25ec03(0x285),_0x25ec03(0x1eb),_0x25ec03(0x1e8),_0x25ec03(0x30f),_0x25ec03(0x308),_0x25ec03(0x297),_0x25ec03(0x280),'filesize','height',_0x25ec03(0x1f3),_0x25ec03(0x29e),_0x25ec03(0x1ee),_0x25ec03(0x2fd),_0x25ec03(0x286),_0x25ec03(0x307),_0x25ec03(0x2db),'sandbox',_0x25ec03(0x201),'src',_0x25ec03(0x23c),_0x25ec03(0x25b),'url',_0x25ec03(0x24f),_0x25ec03(0x28c)],k=class{constructor(_0x34c807){const _0x57cd80=_0x25ec03;this[_0x57cd80(0x2ef)]=_0x34c807,this[_0x57cd80(0x259)]();}['sanitize'](_0xd68ef8){const _0x30d9a7=_0x25ec03;let _0x31130f=document[_0x30d9a7(0x200)](_0x30d9a7(0x220));_0x31130f[_0x30d9a7(0x21a)]='<div>'+_0xd68ef8+'</div>';let _0x2eef9c=_0x31130f['content'][_0x30d9a7(0x234)];return[_0x2eef9c]['concat']([..._0x2eef9c[_0x30d9a7(0x203)]('*')])[_0x30d9a7(0x1df)](_0x57fd14=>{const _0xe5e65d=_0x30d9a7;je[_0xe5e65d(0x1fe)](_0x57fd14['tagName'][_0xe5e65d(0x221)]())?[..._0x57fd14['attributes']][_0xe5e65d(0x1df)](_0x5e2b96=>{const _0x4b1221=_0xe5e65d;Ve[_0x4b1221(0x1fe)](_0x5e2b96['name'][_0x4b1221(0x221)]())||_0x57fd14['removeAttribute'](_0x5e2b96[_0x4b1221(0x2fd)]);}):_0x57fd14[_0xe5e65d(0x2ee)]();}),_0x2eef9c[_0x30d9a7(0x21a)];}[_0x25ec03(0x259)](){const _0x2c7d5a=_0x25ec03;this[_0x2c7d5a(0x2f3)]=D,Object[_0x2c7d5a(0x2fb)](D)[_0x2c7d5a(0x1df)](_0x5dd419=>this[_0x2c7d5a(0x278)](_0x5dd419));}['initializeTemplate'](_0xd3e339){const _0x5820c7=_0x25ec03;var _0x25048e,_0x4c5375;let _0x1c6d9f=_0xd3e339+_0x5820c7(0x2ca),_0x210670=this[_0x5820c7(0x2ef)][_0x1c6d9f],_0x4fc724=_0x210670?(_0x4c5375=(_0x25048e=document[_0x5820c7(0x26a)](_0x210670))==null?void 0x0:_0x25048e[_0x5820c7(0x21a)])==null?void 0x0:_0x4c5375[_0x5820c7(0x30c)]():null;return this[_0x5820c7(0x2ef)][_0x1c6d9f]=null,_0x4fc724&&(this[_0x5820c7(0x2f3)][_0xd3e339]=_0x4fc724),this['templates'][_0xd3e339];}[_0x25ec03(0x291)](_0x1f5e5b,_0x57fce7={}){const _0x32eef6=_0x25ec03;return this['templates'][_0x1f5e5b][_0x32eef6(0x28b)](/{{(.*?)}}/g,(_0x4c2b80,_0x37d89a)=>_0x37d89a[_0x32eef6(0x281)]('.')[_0x32eef6(0x258)]((_0x1f1674,_0x4866e1)=>_0x1f1674[_0x4866e1],_0x57fce7));}[_0x25ec03(0x250)](_0x4ece3c='https://example.com'){const _0xc7be0=_0x25ec03;let _0x441dfd=de(_0x4ece3c)?this['render'](_0xc7be0(0x209),{'src':_0x4ece3c}):this['render'](_0xc7be0(0x1f7),{'src':_0x4ece3c});return this[_0xc7be0(0x2bf)](_0x441dfd);}[_0x25ec03(0x265)](_0x4bd02d=[_0x25ec03(0x2b0),_0x25ec03(0x306)]){const _0x2eb31e=_0x25ec03;if(_0x4bd02d!=null&&_0x4bd02d[_0x2eb31e(0x299)])return _0x4bd02d[_0x2eb31e(0x229)](_0x4912d7=>this[_0x2eb31e(0x250)](_0x4912d7));}[_0x25ec03(0x23d)](_0x54e66e=[_0x25ec03(0x2b0),_0x25ec03(0x306)],_0x47ae60=[],_0x354555=[]){const _0x58b06b=_0x25ec03;if(_0x54e66e!=null&&_0x54e66e[_0x58b06b(0x299)])return _0x47ae60=[..._0x47ae60]['sort'](),_0x47ae60[_0x58b06b(0x1fe)]('*')&&(_0x47ae60=[_0x58b06b(0x244)]),_0x354555=[...new Set([..._0x354555,...ie(_0x54e66e)])]['sort'](),_0x354555['includes']('*')&&(_0x354555=['All']),this[_0x58b06b(0x291)](_0x58b06b(0x2e6),{'header':_0x58b06b(0x1e2),'subheader':_0x58b06b(0x1dc),'prohibited':{'header':_0x58b06b(0x25a),'hosts':_0x354555[_0x58b06b(0x299)]?_0x354555[_0x58b06b(0x229)](_0x21aee0=>_0x58b06b(0x300)+_0x21aee0+_0x58b06b(0x21e))['join'](''):_0x58b06b(0x211)},'allowed':{'header':'Allowed\x20Hosts','hosts':_0x47ae60['length']?_0x47ae60[_0x58b06b(0x229)](_0x3e3574=>_0x58b06b(0x300)+_0x3e3574+_0x58b06b(0x21e))[_0x58b06b(0x2e3)](''):_0x58b06b(0x211)}});}[_0x25ec03(0x2e5)](_0x1f5f1b){const _0x5229ad=_0x25ec03;return this['render'](_0x5229ad(0x2d3),{'header':_0x5229ad(0x2c0),'subheader':_0x5229ad(0x260),'error':_0x1f5f1b});}};function fe(_0x2c0490={'Controller':null,'Trix':null}){const _0x3dea0f=_0x25ec03;var _0x372023;let {Controller:_0x3e44dc,Trix:_0x3bd51a}=_0x2c0490;return _0x372023=class extends _0x3e44dc{[_0x3dea0f(0x2c7)](){const _0x3c68f2=_0x3dea0f;if(this[_0x3c68f2(0x296)]=this['paste']['bind'](this),this[_0x3c68f2(0x249)]['addEventListener'](_0x3c68f2(0x30e),this[_0x3c68f2(0x296)],!0x0),this[_0x3c68f2(0x322)]=this['beforeFetchResponse'][_0x3c68f2(0x1e9)](this),addEventListener(_0x3c68f2(0x213),this[_0x3c68f2(0x322)],!0x0),this[_0x3c68f2(0x2a9)]=this[_0x3c68f2(0x31d)]['bind'](this),addEventListener('beforeunload',this[_0x3c68f2(0x2a9)],!0x0),this[_0x3c68f2(0x2a3)]=new S(this),this[_0x3c68f2(0x1fb)]=new T(this),this['configured'])return this[_0x3c68f2(0x2da)]();this[_0x3c68f2(0x254)]()[_0x3c68f2(0x283)](()=>this[_0x3c68f2(0x2da)](this));}[_0x3dea0f(0x2ed)](){const _0x2e9b3d=_0x3dea0f;let _0x4bdbf2=this[_0x2e9b3d(0x249)]['getAttribute']('data-controller')||'',_0x1fc6db=new Set(_0x4bdbf2[_0x2e9b3d(0x281)]('\x20'));_0x1fc6db[_0x2e9b3d(0x2e1)](_0x2e9b3d(0x219)),this['element'][_0x2e9b3d(0x238)]('data-controller',[..._0x1fc6db][_0x2e9b3d(0x2e3)]('\x20')[_0x2e9b3d(0x30c)]());}['disconnect'](){const _0x351110=_0x3dea0f;this[_0x351110(0x249)][_0x351110(0x206)](_0x351110(0x30e),this[_0x351110(0x296)],!0x0),removeEventListener(_0x351110(0x213),this[_0x351110(0x322)],!0x0),removeEventListener('beforeunload',this['onBeforeUnload'],!0x0),this[_0x351110(0x2ed)]();}[_0x3dea0f(0x287)](_0x5afaf7){const _0x23f7e4=_0x3dea0f;try{_0x5afaf7[_0x23f7e4(0x2c3)]['querySelectorAll'](_0x23f7e4(0x2a7))[_0x23f7e4(0x1fe)](this[_0x23f7e4(0x249)])&&this[_0x23f7e4(0x31d)]();}catch(_0x374dc7){}}['protect'](){const _0x4de490=_0x3dea0f;this['paranoid']&&this['guard'][_0x4de490(0x2da)]();}async[_0x3dea0f(0x2bc)](_0x331459,_0x5c83c6=0x0){const _0xccf447=_0x3dea0f;if(!this['configured']&&_0x5c83c6<0x64)return setTimeout(()=>this[_0xccf447(0x2bc)](_0x331459,_0x5c83c6+0x1),0x19);this[_0xccf447(0x304)]&&(this['formElement'][_0xccf447(0x227)]=!0x0);try{let {html:_0x333f94,string:_0x30d08e,range:_0x7a61e1}=_0x331459[_0xccf447(0x2bc)],_0x341eb1=_0x333f94||_0x30d08e||'',_0xee63a6=this[_0xccf447(0x29c)](_0x341eb1),_0x33dc74=ne(_0xee63a6);if(!_0x33dc74['length'])return;_0x331459[_0xccf447(0x292)](),this[_0xccf447(0x29a)][_0xccf447(0x22a)](_0x7a61e1);let _0x42d7e4=new k(this);try{let _0xece02d=await this[_0xccf447(0x225)]||this[_0xccf447(0x274)]||[],_0x5c407a=await this[_0xccf447(0x279)]||this['blockedMediaHostsValue']||[],_0xfba6=new Set(_0x33dc74[_0xccf447(0x1e3)](_0x540e39=>O(_0x540e39)));[..._0xee63a6['querySelectorAll'](_0xccf447(0x1f7))][_0xccf447(0x1df)](_0x108af7=>_0xfba6[_0xccf447(0x2e1)](_0x108af7['src'])),_0xfba6=[..._0xfba6];let _0x45d0a5=_0xfba6[_0xccf447(0x1e3)](_0x5f32e0=>H(_0x5f32e0,_0xece02d,_0x5c407a)),_0xec9502=_0xfba6[_0xccf447(0x1e3)](_0x361ee5=>!_0x45d0a5['includes'](_0x361ee5)),_0x484c98=await this[_0xccf447(0x231)]||this[_0xccf447(0x2e9)]||[],_0x16ee64=await this[_0xccf447(0x31f)]||this[_0xccf447(0x26f)]||[],_0x4214d3=_0x33dc74[_0xccf447(0x1e3)](_0x233c30=>!_0xfba6[_0xccf447(0x1fe)](_0x233c30)),_0x4c8755=_0x4214d3[_0xccf447(0x1e3)](_0xf510d7=>H(_0xf510d7,_0x484c98,_0x16ee64)),_0x4a0857=_0x4214d3[_0xccf447(0x1e3)](_0x5a2eda=>!_0x4c8755['includes'](_0x5a2eda));if(_0xec9502[_0xccf447(0x299)]||_0x4a0857[_0xccf447(0x299)]){let _0x332460=[...new Set([..._0xec9502,..._0x4a0857])],_0x20b933=[...new Set([..._0xece02d,..._0x484c98])]['filter'](_0x2c7f91=>!this[_0xccf447(0x303)][_0xccf447(0x1fe)](_0x2c7f91)),_0x34bfdd=[...new Set([..._0x5c407a,..._0x16ee64])]['filter'](_0x3dc144=>!this[_0xccf447(0x303)]['includes'](_0x3dc144));console['log']('allowedHosts',_0x20b933),console[_0xccf447(0x27e)](_0xccf447(0x301),_0x34bfdd),await this[_0xccf447(0x2ad)](_0x42d7e4['renderWarnings'](_0x332460,_0x20b933,_0x34bfdd));}if(_0x45d0a5[_0xccf447(0x299)]&&await this[_0xccf447(0x2ad)](_0x42d7e4['renderEmbeds'](_0x45d0a5)),_0x33dc74[_0xccf447(0x299)]===0x1&&_0x45d0a5[_0xccf447(0x299)]===0x1)return;let _0x1873b8=this['sanitizePastedElement'](_0xee63a6,{'renderer':_0x42d7e4,'validMediaURLs':_0x45d0a5,'validLinkURLs':_0x4c8755})[_0xccf447(0x21a)][_0xccf447(0x30c)]();_0x1873b8[_0xccf447(0x299)]&&await this[_0xccf447(0x2ad)](_0x1873b8,{'disposition':'inline'});}catch(_0x420992){this[_0xccf447(0x2ad)](_0x42d7e4[_0xccf447(0x2e5)](_0x420992));}}finally{this[_0xccf447(0x304)]&&delete this[_0xccf447(0x304)][_0xccf447(0x227)];}}[_0x3dea0f(0x29c)](_0x3409fd){const _0xa05143=_0x3dea0f;let _0x9a6a2c=document[_0xa05143(0x200)](_0xa05143(0x220));return _0x9a6a2c['innerHTML']=_0xa05143(0x26d)+_0x3409fd['trim']()+_0xa05143(0x232),_0x9a6a2c[_0xa05143(0x320)]['firstElementChild'];}[_0x3dea0f(0x21b)](_0x302762,_0x5476af={'default':null}){const _0xf14e4c=_0x3dea0f;let _0x2395b0=_0x302762[_0xf14e4c(0x25b)];return _0x2395b0&&_0x2395b0[_0xf14e4c(0x299)]||(_0x2395b0=_0x302762[_0xf14e4c(0x30d)][_0xf14e4c(0x30c)](),_0x2395b0&&_0x2395b0[_0xf14e4c(0x299)])?_0x2395b0:_0x5476af[_0xf14e4c(0x28d)];}['sanitizePastedElement'](_0xee0d13,_0x1ed8e5={'renderer':null,'validMediaURLs':[],'validLinkURLs':[]}){const _0x39bae0=_0x3dea0f;let {renderer:_0x50a416,validMediaURLs:_0x565a22,validLinkURLs:_0x3ed902}=_0x1ed8e5;_0xee0d13=_0xee0d13[_0x39bae0(0x2cb)](!0x0);let _0x14dc0a=C(_0xee0d13),_0x5ede3c=[],_0x14eb23;for(;_0x14eb23=_0x14dc0a[_0x39bae0(0x2ae)]();)_0x14eb23[_0x39bae0(0x267)]=_0x14eb23[_0x39bae0(0x267)]||new Set(),_0x5ede3c[_0x39bae0(0x2d4)](_0x14eb23),_0x14eb23['nodeValue'][_0x39bae0(0x281)](/\s+/)[_0x39bae0(0x1e3)](_0x2e9f6d=>_0x2e9f6d[_0x39bae0(0x2dc)]('http'))[_0x39bae0(0x1df)](_0x1db479=>{const _0x5cfbc4=_0x39bae0;var _0x4ca75d;let _0x4cdf82=(_0x4ca75d=g(_0x1db479))==null?void 0x0:_0x4ca75d[_0x5cfbc4(0x1f3)],_0x1fb743=_0x3ed902[_0x5cfbc4(0x1fe)](_0x4cdf82)||_0x3ed902[_0x5cfbc4(0x1fe)](_0x4cdf82)?_0x50a416[_0x5cfbc4(0x291)](_0x5cfbc4(0x1f4),{'url':_0x4cdf82,'label':_0x4cdf82}):_0x50a416[_0x5cfbc4(0x291)](_0x5cfbc4(0x31e),{'url':_0x4cdf82,'label':_0x5cfbc4(0x1f1),'description':''});_0x14eb23[_0x5cfbc4(0x267)][_0x5cfbc4(0x2e1)]({'match':_0x1db479,'replacement':_0x1fb743});});return _0x5ede3c[_0x39bae0(0x1df)](_0x474abf=>{const _0x3b8efe=_0x39bae0;if(!_0x474abf[_0x3b8efe(0x267)][_0x3b8efe(0x2ba)])return;let _0x5f16ea=_0x474abf[_0x3b8efe(0x24d)];[..._0x474abf[_0x3b8efe(0x267)]]['sort']((_0x203b5a,_0x2da644)=>_0x2da644[_0x3b8efe(0x2c1)][_0x3b8efe(0x299)]-_0x203b5a['match']['length'])['forEach'](_0x4cbde8=>_0x5f16ea=_0x5f16ea[_0x3b8efe(0x273)](_0x4cbde8[_0x3b8efe(0x2c1)],_0x4cbde8[_0x3b8efe(0x1e1)])),_0x474abf[_0x3b8efe(0x2cd)](this[_0x3b8efe(0x29c)](_0x5f16ea));}),_0xee0d13[_0x39bae0(0x203)]('a')[_0x39bae0(0x1df)](_0x5a6afb=>{const _0x310403=_0x39bae0;let _0x470075=U(_0x5a6afb),_0x56cb59=this[_0x310403(0x21b)](_0x5a6afb,{'default':_0x470075}),_0x43e25b=_0x3ed902[_0x310403(0x1fe)](_0x470075)?_0x50a416[_0x310403(0x291)](_0x310403(0x1f4),{'url':_0x470075,'label':_0x56cb59}):_0x50a416[_0x310403(0x291)]('prohibited',{'url':_0x470075,'label':_0x310403(0x2ea),'description':'('+_0x56cb59+')'});_0x5a6afb[_0x310403(0x2cd)](this[_0x310403(0x29c)](_0x43e25b));}),_0xee0d13[_0x39bae0(0x203)](ce[_0x39bae0(0x2e3)](',\x20'))[_0x39bae0(0x1df)](_0x3a5984=>{const _0x5d40ad=_0x39bae0;let _0x508974=U(_0x3a5984),_0x18bacc=this[_0x5d40ad(0x21b)](_0x3a5984,{'default':_0x508974}),_0x89ac13=_0x565a22[_0x5d40ad(0x1fe)](_0x508974)?_0x50a416[_0x5d40ad(0x291)](_0x5d40ad(0x29f),{'url':_0x508974,'label':_0x5d40ad(0x27a),'description':_0x5d40ad(0x208)}):_0x50a416['render'](_0x5d40ad(0x31e),{'url':_0x508974,'label':_0x5d40ad(0x1dd),'description':''});_0x3a5984[_0x5d40ad(0x2cd)](this[_0x5d40ad(0x29c)](_0x89ac13));}),_0xee0d13[_0x39bae0(0x21a)][_0x39bae0(0x273)](/(\n|\r|\f|\v)+/g,_0x39bae0(0x2be)),_0xee0d13;}['createAttachment'](_0x53df96){const _0x49889f=_0x3dea0f;return new _0x3bd51a[(_0x49889f(0x20f))]({'content':_0x53df96,'contentType':se[_0x49889f(0x2a8)]});}[_0x3dea0f(0x309)](_0x341aa5=0x1,_0x2a647e={'delay':0x1}){let {delay:_0x1e28d4}=_0x2a647e;return new Promise(_0x5ebf0d=>{setTimeout(()=>{const _0x3c10ff=_0x5b82;for(let _0x540308=0x0;_0x540308<_0x341aa5;_0x540308++)this[_0x3c10ff(0x29a)][_0x3c10ff(0x28a)]();_0x5ebf0d();},_0x1e28d4);});}['insertAttachment'](_0x133f9e,_0x2fd468={'delay':0x1}){let {delay:_0xc14965}=_0x2fd468;return new Promise(_0x2e3903=>{setTimeout(()=>{const _0x3f3672=_0x5b82;this[_0x3f3672(0x29a)][_0x3f3672(0x270)](this[_0x3f3672(0x2b3)](_0x133f9e)),this[_0x3f3672(0x309)](0x1,{'delay':_0xc14965})[_0x3f3672(0x1f6)](_0x2e3903);},_0xc14965);});}[_0x3dea0f(0x2b4)](_0x8e1a46,_0x428c39={'delay':0x1}){let {delay:_0x330dbe}=_0x428c39;return new Promise(_0x3e6491=>{setTimeout(()=>{const _0x48845b=_0x5b82;this[_0x48845b(0x29a)]['insertHTML'](_0x8e1a46),this[_0x48845b(0x309)](0x1,{'delay':_0x330dbe})[_0x48845b(0x1f6)](_0x3e6491);},_0x330dbe);});}[_0x3dea0f(0x2ad)](_0xc5e31f,_0x50e4fb={'delay':0x1,'disposition':_0x3dea0f(0x2a8)}){let {delay:_0x2cb1b6,disposition:_0xbec439}=_0x50e4fb;return _0xc5e31f!=null&&_0xc5e31f['length']?new Promise(_0x3bd69b=>{setTimeout(()=>{const _0x321367=_0x5b82;if(typeof _0xc5e31f==_0x321367(0x21d))return _0xbec439===_0x321367(0x2ac)?this[_0x321367(0x2b4)](_0xc5e31f,{'delay':_0x2cb1b6})[_0x321367(0x2d0)](_0x4d66f2=>this[_0x321367(0x2e5)](_0x4d66f2))[_0x321367(0x1f6)](_0x3bd69b):this[_0x321367(0x270)](_0xc5e31f,{'delay':_0x2cb1b6})['catch'](_0x174918=>this[_0x321367(0x2e5)](_0x174918))['finally'](_0x3bd69b);if(Array[_0x321367(0x302)](_0xc5e31f)){let _0x2b9db1=_0xbec439===_0x321367(0x2ac)?_0xc5e31f['map'](_0x559f4e=>this[_0x321367(0x2b4)](_0x559f4e,{'delay':_0x2cb1b6+0x1})):_0xc5e31f[_0x321367(0x229)](_0x21f9f6=>this[_0x321367(0x270)](_0x21f9f6,{'delay':_0x2cb1b6+0x1}));return Promise[_0x321367(0x312)](_0x2b9db1)[_0x321367(0x2d0)](_0x4135a1=>this[_0x321367(0x2e5)](_0x4135a1))[_0x321367(0x1f6)](_0x3bd69b);}_0x3bd69b();});}):Promise['resolve']();}get[_0x3dea0f(0x29a)](){const _0x1a5094=_0x3dea0f;return this[_0x1a5094(0x249)][_0x1a5094(0x29a)];}get[_0x3dea0f(0x226)](){const _0x989688=_0x3dea0f;let _0x891a1e=this[_0x989688(0x249)]['getAttribute'](_0x989688(0x218)),_0x59cb0a=_0x891a1e?document[_0x989688(0x26a)](_0x891a1e):null;if(!_0x59cb0a){let _0xb213b3=this['element'][_0x989688(0x28e)];_0x59cb0a=_0xb213b3!=null&&_0xb213b3[_0x989688(0x2de)][_0x989688(0x2c1)](/trix-toolbar/i)?_0xb213b3:null;}return _0x59cb0a;}get['formElement'](){const _0x1d7362=_0x3dea0f;return this[_0x1d7362(0x249)][_0x1d7362(0x284)](_0x1d7362(0x20e));}get[_0x3dea0f(0x2f9)](){const _0x4f2cb8=_0x3dea0f;var _0x11990e;let _0x127625=this[_0x4f2cb8(0x249)]['getAttribute'](_0x4f2cb8(0x243));return _0x127625?(_0x11990e=this[_0x4f2cb8(0x304)])==null?void 0x0:_0x11990e[_0x4f2cb8(0x1fd)]('#'+_0x127625):null;}get[_0x3dea0f(0x28f)](){const _0x30836e=_0x3dea0f;return!!this['store'][_0x30836e(0x30a)](_0x30836e(0x28f));}get[_0x3dea0f(0x25e)](){const _0x5878fb=_0x3dea0f;try{return JSON[_0x5878fb(0x2eb)](this[_0x5878fb(0x2a3)][_0x5878fb(0x30a)](_0x5878fb(0x25e)))[0x2];}catch(_0x1a69bd){return null;}}get[_0x3dea0f(0x282)](){const _0xd91c00=_0x3dea0f;try{return this['store'][_0xd91c00(0x30a)]('configured')==='true';}catch(_0x115d1b){return!0x1;}}get['hostsValueDescriptors'](){const _0x2b7917=_0x3dea0f;return Object[_0x2b7917(0x20d)](this['valueDescriptorMap'])[_0x2b7917(0x1e3)](_0x447270=>_0x447270[_0x2b7917(0x2fd)][_0x2b7917(0x25d)](_0x2b7917(0x2c2)));}get['reservedDomains'](){const _0x2dbe87=_0x3dea0f;return[_0x2dbe87(0x22e),_0x2dbe87(0x26c),_0x2dbe87(0x29b),_0x2dbe87(0x252),_0x2dbe87(0x319),'trix.embed.example','trix.embed.invalid',_0x2dbe87(0x24e),_0x2dbe87(0x268),'trix.embed.test',_0x2dbe87(0x230),_0x2dbe87(0x256),_0x2dbe87(0x223),_0x2dbe87(0x2f0),_0x2dbe87(0x2f1),'www.embed.example','www.embed.invalid',_0x2dbe87(0x20c),_0x2dbe87(0x2c9),_0x2dbe87(0x1f5),'www.trix.example',_0x2dbe87(0x30b),'www.trix.local',_0x2dbe87(0x2dd),_0x2dbe87(0x2f6)];}['rememberConfig'](){return new Promise(async _0x2ab40b=>{const _0x5743c=_0x5b82;let _0x251233,_0x5b462a=await L();_0x251233=await y(_0x5b462a,w(this[_0x5743c(0x303)],0x3)),this['store']['write'](_0x5743c(0x25e),JSON[_0x5743c(0x295)]([_0x251233[0x0],_0x251233[0x1],_0x5b462a,_0x251233[0x2]])),this['paranoidValue']!==!0x1&&(_0x251233=await y(_0x5b462a,w(this[_0x5743c(0x303)],0x4)),this['store']['write'](_0x5743c(0x28f),JSON[_0x5743c(0x295)](_0x251233))),this[_0x5743c(0x249)][_0x5743c(0x2e4)](_0x5743c(0x2d9)),this[_0x5743c(0x2b8)]['forEach'](async _0x154325=>{const _0x206595=_0x5743c;let {name:_0x26cc38}=_0x154325,_0x3d0ff1=_0x26cc38['slice'](0x0,_0x26cc38['lastIndexOf'](_0x206595(0x24c))),_0x1f22f5=this[_0x26cc38];_0x1f22f5['length']<0x4&&(_0x1f22f5=_0x1f22f5[_0x206595(0x2b2)](w(this[_0x206595(0x303)],0x4-_0x1f22f5[_0x206595(0x299)]))),this[_0x206595(0x2a3)][_0x206595(0x2c5)](_0x3d0ff1,JSON['stringify'](await y(_0x5b462a,_0x1f22f5))),this['hasOwnProperty'](_0x3d0ff1)||Object['defineProperty'](this,_0x3d0ff1,{'get':async()=>{const _0xf8aa5=_0x206595;try{return(await Z(this[_0xf8aa5(0x25e)],JSON['parse'](this[_0xf8aa5(0x2a3)][_0xf8aa5(0x30a)](_0x3d0ff1))))[_0xf8aa5(0x1e3)](_0x230251=>!this['reservedDomains']['includes'](_0x230251));}catch(_0xbd12e1){return console[_0xf8aa5(0x2d3)](_0xf8aa5(0x23a)+_0x3d0ff1+'\x27!',_0xbd12e1),[];}}}),this['element'][_0x206595(0x2e4)](_0x206595(0x288)+_0x154325[_0x206595(0x25e)]);}),_0x251233=await y(_0x5b462a,w(this[_0x5743c(0x303)],0x4)),this[_0x5743c(0x2a3)][_0x5743c(0x2c5)]('securityHosts',_0x251233),_0x251233=await y(_0x5b462a,w(this[_0x5743c(0x303)],0x4)),this[_0x5743c(0x2a3)][_0x5743c(0x2c5)](_0x5743c(0x1ea),_0x251233),this['store'][_0x5743c(0x2c5)]('configured',!0x0),_0x2ab40b();});}['forgetConfig'](){const _0x960f3b=_0x3dea0f;var _0x384b94,_0x5d980e,_0xd10ddc,_0xa87f35,_0x388fd4;try{(_0x384b94=this[_0x960f3b(0x2a3)])==null||_0x384b94[_0x960f3b(0x2ee)](_0x960f3b(0x25e)),(_0x5d980e=this[_0x960f3b(0x2a3)])==null||_0x5d980e[_0x960f3b(0x2ee)](_0x960f3b(0x28f)),this[_0x960f3b(0x2b8)]['forEach'](async _0x1f4b95=>{const _0x297e9f=_0x960f3b;var _0x4f3e88;let {name:_0x3a9970}=_0x1f4b95,_0x4d46bf=_0x3a9970[_0x297e9f(0x216)](0x0,_0x3a9970[_0x297e9f(0x27d)](_0x297e9f(0x24c)));(_0x4f3e88=this['store'])==null||_0x4f3e88[_0x297e9f(0x2ee)](_0x4d46bf);}),(_0xd10ddc=this[_0x960f3b(0x2a3)])==null||_0xd10ddc[_0x960f3b(0x2ee)]('securityHosts'),(_0xa87f35=this['store'])==null||_0xa87f35[_0x960f3b(0x2ee)]('obscurityHosts'),(_0x388fd4=this['store'])==null||_0x388fd4['remove'](_0x960f3b(0x282));}catch(_0x7f4986){}}},X(_0x372023,_0x3dea0f(0x20d),{'embeddedTemplate':String,'errorTemplate':String,'iframeTemplate':String,'imageTemplate':String,'linkTemplate':String,'prohibitedTemplate':String,'warningTemplate':String,'allowedLinkHosts':Array,'blockedLinkHosts':Array,'allowedMediaHosts':Array,'blockedMediaHosts':Array,'paranoid':{'type':Boolean,'default':!0x0}}),_0x372023;}var ge=!0x1,Fe={'application':null,'Controller':null,'Trix':null};function De(_0x548be0=Fe){const _0x23dcf3=_0x25ec03;if(ge)return;let {application:_0xf317bc,Controller:_0x4ef87a,Trix:_0x26f7ab}=_0x548be0;_0xf317bc[_0x23dcf3(0x222)](_0x23dcf3(0x219),fe({'Controller':_0x4ef87a,'Trix':_0x26f7ab})),ge=!0x0;}self['TrixEmbed']=E(v({},Q),{'encryptValues':y,'generateKey':L,'generateKeyAndEncryptValues':ee,'initialize':De});function _0x5b82(_0x30e371,_0x4bfe96){const _0x1733aa=_0x1733();return _0x5b82=function(_0x5b8249,_0xe57db7){_0x5b8249=_0x5b8249-0x1dc;let _0x29c4d0=_0x1733aa[_0x5b8249];return _0x29c4d0;},_0x5b82(_0x30e371,_0x4bfe96);}var St=self['TrixEmbed'];export{St as default};
@@ -1 +1 @@
1
- {"inputs":{"app/javascript/metadata.js":{"bytes":86,"imports":[],"format":"esm"},"app/javascript/encryption.js":{"bytes":4095,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/enumerable.js":{"bytes":517,"imports":[],"format":"esm"},"app/javascript/urls.js":{"bytes":3338,"imports":[],"format":"esm"},"app/javascript/media.js":{"bytes":3618,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/forms.js":{"bytes":3377,"imports":[{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/guard.js":{"bytes":1211,"imports":[{"path":"app/javascript/forms.js","kind":"import-statement","original":"./forms"}],"format":"esm"},"app/javascript/store.js":{"bytes":1219,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/templates.js":{"bytes":1235,"imports":[],"format":"esm"},"app/javascript/renderer.js":{"bytes":5234,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/templates.js","kind":"import-statement","original":"./templates"}],"format":"esm"},"app/javascript/controller.js":{"bytes":16506,"imports":[{"path":"app/javascript/enumerable.js","kind":"import-statement","original":"./enumerable"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/guard.js","kind":"import-statement","original":"./guard"},{"path":"app/javascript/store.js","kind":"import-statement","original":"./store"},{"path":"app/javascript/renderer.js","kind":"import-statement","original":"./renderer"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/index.js":{"bytes":669,"imports":[{"path":"app/javascript/metadata.js","kind":"import-statement","original":"./metadata"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/controller.js","kind":"import-statement","original":"./controller"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"app/assets/builds/trix-embed.js":{"imports":[],"exports":["default"],"entryPoint":"app/javascript/index.js","inputs":{"app/javascript/metadata.js":{"bytesInOutput":24},"app/javascript/encryption.js":{"bytesInOutput":1346},"app/javascript/enumerable.js":{"bytesInOutput":226},"app/javascript/urls.js":{"bytesInOutput":1200},"app/javascript/media.js":{"bytesInOutput":935},"app/javascript/forms.js":{"bytesInOutput":1352},"app/javascript/guard.js":{"bytesInOutput":1002},"app/javascript/store.js":{"bytesInOutput":835},"app/javascript/templates.js":{"bytesInOutput":969},"app/javascript/renderer.js":{"bytesInOutput":2628},"app/javascript/controller.js":{"bytesInOutput":7934},"app/javascript/index.js":{"bytesInOutput":311}},"bytes":19276}}}
1
+ {"inputs":{"app/javascript/metadata.js":{"bytes":86,"imports":[],"format":"esm"},"app/javascript/encryption.js":{"bytes":4095,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/enumerable.js":{"bytes":517,"imports":[],"format":"esm"},"app/javascript/urls.js":{"bytes":3338,"imports":[],"format":"esm"},"app/javascript/media.js":{"bytes":3618,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/forms.js":{"bytes":3378,"imports":[{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/guard.js":{"bytes":1212,"imports":[{"path":"app/javascript/forms.js","kind":"import-statement","original":"./forms"}],"format":"esm"},"app/javascript/store.js":{"bytes":1219,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/templates.js":{"bytes":1235,"imports":[],"format":"esm"},"app/javascript/renderer.js":{"bytes":5087,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/templates.js","kind":"import-statement","original":"./templates"}],"format":"esm"},"app/javascript/controller.js":{"bytes":17141,"imports":[{"path":"app/javascript/enumerable.js","kind":"import-statement","original":"./enumerable"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/guard.js","kind":"import-statement","original":"./guard"},{"path":"app/javascript/store.js","kind":"import-statement","original":"./store"},{"path":"app/javascript/renderer.js","kind":"import-statement","original":"./renderer"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/index.js":{"bytes":669,"imports":[{"path":"app/javascript/metadata.js","kind":"import-statement","original":"./metadata"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/controller.js","kind":"import-statement","original":"./controller"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"app/assets/builds/trix-embed.js":{"imports":[],"exports":["default"],"entryPoint":"app/javascript/index.js","inputs":{"app/javascript/metadata.js":{"bytesInOutput":24},"app/javascript/encryption.js":{"bytesInOutput":1347},"app/javascript/enumerable.js":{"bytesInOutput":229},"app/javascript/urls.js":{"bytesInOutput":1203},"app/javascript/media.js":{"bytesInOutput":935},"app/javascript/forms.js":{"bytesInOutput":1353},"app/javascript/guard.js":{"bytesInOutput":1003},"app/javascript/store.js":{"bytesInOutput":835},"app/javascript/templates.js":{"bytesInOutput":969},"app/javascript/renderer.js":{"bytesInOutput":2505},"app/javascript/controller.js":{"bytesInOutput":8416},"app/javascript/index.js":{"bytesInOutput":312}},"bytes":19645}}}
@@ -48,11 +48,8 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
48
48
  this.store = new Store(this)
49
49
  this.guard = new Guard(this)
50
50
 
51
- if (this.key) return // already configured
52
-
53
- this.rememberConfig().then(() => {
54
- if (this.paranoid) this.guard.protect()
55
- })
51
+ if (this.configured) return this.protect()
52
+ this.rememberConfig().then(() => this.protect(this))
56
53
  }
57
54
 
58
55
  reconnect() {
@@ -76,7 +73,12 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
76
73
  } catch {}
77
74
  }
78
75
 
79
- async paste(event) {
76
+ protect() {
77
+ if (this.paranoid) this.guard.protect()
78
+ }
79
+
80
+ async paste(event, attempt = 0) {
81
+ if (!this.configured && attempt < 100) return setTimeout(() => this.paste(event, attempt + 1), 25)
80
82
  if (this.formElement) this.formElement.trixEmbedPasting = true
81
83
 
82
84
  try {
@@ -90,13 +92,12 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
90
92
 
91
93
  event.preventDefault()
92
94
  this.editor.setSelectedRange(range)
95
+ const renderer = new Renderer(this)
93
96
 
94
97
  try {
95
- const renderer = new Renderer(this)
96
-
97
98
  // Media URLs (images, videos, audio etc.)
98
- const allowedMediaHosts = await this.allowedMediaHosts
99
- const blockedMediaHosts = await this.blockedMediaHosts
99
+ const allowedMediaHosts = (await this.allowedMediaHosts) || this.allowedMediaHostsValue || []
100
+ const blockedMediaHosts = (await this.blockedMediaHosts) || this.blockedMediaHostsValue || []
100
101
  let mediaURLs = new Set(pastedURLs.filter(url => getMediaType(url)))
101
102
  const iframes = [...pastedElement.querySelectorAll('iframe')]
102
103
  iframes.forEach(frame => mediaURLs.add(frame.src))
@@ -107,8 +108,8 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
107
108
  const invalidMediaURLs = mediaURLs.filter(url => !validMediaURLs.includes(url))
108
109
 
109
110
  // Link URLs (non-media resources i.e. web pages etc.)
110
- const allowedLinkHosts = await this.allowedLinkHosts
111
- const blockedLinkHosts = await this.blockedLinkHosts
111
+ const allowedLinkHosts = (await this.allowedLinkHosts) || this.allowedLinkHostsValue || []
112
+ const blockedLinkHosts = (await this.blockedLinkHosts) || this.blockedLinkHostsValue || []
112
113
  const linkURLs = pastedURLs.filter(url => !mediaURLs.includes(url))
113
114
  const validLinkURLs = linkURLs.filter(url => validateURL(url, allowedLinkHosts, blockedLinkHosts))
114
115
  const invalidLinkURLs = linkURLs.filter(url => !validLinkURLs.includes(url))
@@ -122,6 +123,8 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
122
123
  const blockedHosts = [...new Set([...blockedMediaHosts, ...blockedLinkHosts])].filter(
123
124
  host => !this.reservedDomains.includes(host)
124
125
  )
126
+ console.log('allowedHosts', allowedHosts)
127
+ console.log('blockedHosts', blockedHosts)
125
128
  await this.insert(renderer.renderWarnings(invalidURLs, allowedHosts, blockedHosts))
126
129
  }
127
130
 
@@ -331,6 +334,14 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
331
334
  }
332
335
  }
333
336
 
337
+ get configured() {
338
+ try {
339
+ return this.store.read('configured') === 'true'
340
+ } catch {
341
+ return false
342
+ }
343
+ }
344
+
334
345
  get hostsValueDescriptors() {
335
346
  return Object.values(this.valueDescriptorMap).filter(descriptor =>
336
347
  descriptor.name.endsWith('HostsValue')
@@ -428,6 +439,7 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
428
439
  fakes = await encryptValues(key, sample(this.reservedDomains, 4))
429
440
  this.store.write('obscurityHosts', fakes)
430
441
 
442
+ this.store.write('configured', true)
431
443
  resolve()
432
444
  })
433
445
  }
@@ -445,6 +457,7 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
445
457
 
446
458
  this.store?.remove('securityHosts')
447
459
  this.store?.remove('obscurityHosts')
460
+ this.store?.remove('configured')
448
461
  } catch {}
449
462
  }
450
463
  }
@@ -91,7 +91,7 @@ function patch() {
91
91
  }
92
92
 
93
93
  function observe(attempt = 0) {
94
- if (!document.body && attempt < 10) return setTimeout(() => observe(attempt + 1), 50)
94
+ if (!document.body && attempt < 100) return setTimeout(() => observe(attempt + 1), 25)
95
95
 
96
96
  if (_observer) return
97
97
 
@@ -20,7 +20,7 @@ export default class Guard {
20
20
  }
21
21
 
22
22
  protect(attempt = 0) {
23
- if (!this.toolbar && attempt < 10) return setTimeout(() => this.protect(attempt + 1), 25)
23
+ if (!this.toolbar && attempt < 100) return setTimeout(() => this.protect(attempt + 1), 25)
24
24
 
25
25
  this.preventAttachments()
26
26
  this.preventLinks()
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated by bin/build.mjs
2
2
  export default {
3
- version: '0.0.3'
3
+ version: '0.0.5'
4
4
  }
@@ -167,27 +167,25 @@ export default class Renderer {
167
167
  if (!urls?.length) return
168
168
 
169
169
  allowedHosts = [...allowedHosts].sort()
170
- if (allowedHosts.includes('*')) allowedHosts.splice(allowedHosts.indexOf('*'), 1)
170
+ if (allowedHosts.includes('*')) allowedHosts = ['All']
171
171
 
172
- blockedHosts = [...blockedHosts]
173
- if (blockedHosts.includes('*')) blockedHosts.splice(blockedHosts.indexOf('*'), 1)
174
-
175
- const hosts = [...new Set([...blockedHosts, ...extractURLHosts(urls)])].sort()
172
+ blockedHosts = [...new Set([...blockedHosts, ...extractURLHosts(urls)])].sort()
173
+ if (blockedHosts.includes('*')) blockedHosts = ['All']
176
174
 
177
175
  return this.render('warning', {
178
176
  header: 'Copy/Paste Warning',
179
- subheader: 'Content includes URLs or media from prohibited hosts or restricted protocols.',
177
+ subheader: 'Content includes links or media from restricted protocols or prohibited hosts.',
180
178
  prohibited: {
181
179
  header: 'Prohibited Hosts',
182
- hosts: hosts.length
183
- ? hosts.map(host => `<li>${host}</li>`).join('')
184
- : '<li>URLs and media are restricted to allowed hosts and standard protocols.</li>'
180
+ hosts: blockedHosts.length
181
+ ? blockedHosts.map(host => `<li>${host}</li>`).join('')
182
+ : '<li>Not configured</li>'
185
183
  },
186
184
  allowed: {
187
185
  header: 'Allowed Hosts',
188
186
  hosts: allowedHosts.length
189
187
  ? allowedHosts.map(host => `<li>${host}</li>`).join('')
190
- : '<li>Allowed hosts not configured.</li>'
188
+ : '<li>Not configured</li>'
191
189
  }
192
190
  })
193
191
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrixEmbed
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trix_embed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hopkins (hopsoft)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails