Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/universal-editor-cors

Package Overview
Dependencies
Maintainers
21
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/universal-editor-cors - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

2

dist/universal-editor-embedded.js

@@ -1,1 +0,1 @@

(()=>{var e,t,n,r,o,i,s,a;(t=e||(e={})).Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack",(r=n||(n={})).Fulfilled="fulfilled",r.Rejected="rejected",(i=o||(o={})).ConnectionDestroyed="ConnectionDestroyed",i.ConnectionTimeout="ConnectionTimeout",i.NoIframeSrc="NoIframeSrc",(s||(s={})).DataCloneError="DataCloneError",(a||(a={})).Message="message";const c=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});var l=(t,r,o)=>{const{localName:i,local:l,remote:d,originForSending:u,originForReceiving:m}=t;let p=!1;const E=t=>{if(t.source!==d||t.data.penpal!==e.Call)return;if("*"!==m&&t.origin!==m)return void o(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const a=t.data,{methodName:l,args:E,id:g}=a;o(`${i}: Received ${l}() call`);const f=t=>r=>{if(o(`${i}: Sending ${l}() reply`),p)return void o(`${i}: Unable to send ${l}() reply due to destroyed connection`);const a={penpal:e.Reply,id:g,resolution:t,returnValue:r};t===n.Rejected&&r instanceof Error&&(a.returnValue=c(r),a.returnValueIsError=!0);try{d.postMessage(a,u)}catch(t){if(t.name===s.DataCloneError){const r={penpal:e.Reply,id:g,resolution:n.Rejected,returnValue:c(t),returnValueIsError:!0};d.postMessage(r,u)}throw t}};new Promise((e=>e(r[l].apply(r,E)))).then(f(n.Fulfilled),f(n.Rejected))};return l.addEventListener(a.Message,E),()=>{p=!0,l.removeEventListener(a.Message,E)}};let d=0;const u=e=>e?e.split("."):[],m=(e,t,n)=>{const r=u(t);return r.reduce(((e,t,o)=>(void 0===e[t]&&(e[t]={}),o===r.length-1&&(e[t]=n),e[t])),e),e},p=(e,t)=>{const n={};return Object.keys(e).forEach((r=>{const o=e[r],i=((e,t)=>{const n=u(t||"");return n.push(e),(e=>e.join("."))(n)})(r,t);"object"==typeof o&&Object.assign(n,p(o,i)),"function"==typeof o&&(n[i]=o)})),n},E=e=>{const t={};for(const n in e)m(t,n,e[n]);return t};var g,f,h=(t,r,i,s,c)=>{const{localName:l,local:u,remote:m,originForSending:p,originForReceiving:g}=r;let f=!1;c(`${l}: Connecting call sender`);const h=t=>(...r)=>{let i;c(`${l}: Sending ${t}() call`);try{m.closed&&(i=!0)}catch(e){i=!0}if(i&&s(),f){const e=new Error(`Unable to send ${t}() call due to destroyed connection`);throw e.code=o.ConnectionDestroyed,e}return new Promise(((o,i)=>{const s=++d,E=r=>{if(r.source!==m||r.data.penpal!==e.Reply||r.data.id!==s)return;if("*"!==g&&r.origin!==g)return void c(`${l} received message from origin ${r.origin} which did not match expected origin ${g}`);const d=r.data;c(`${l}: Received ${t}() reply`),u.removeEventListener(a.Message,E);let p=d.returnValue;d.returnValueIsError&&(p=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(p)),(d.resolution===n.Fulfilled?o:i)(p)};u.addEventListener(a.Message,E);const f={penpal:e.Call,id:s,methodName:t,args:r};m.postMessage(f,p)}))},y=i.reduce(((e,t)=>(e[t]=h(t),e)),{});return Object.assign(t,E(y)),()=>{f=!0}},y=(e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=o.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}},v=(t,n,r,o)=>{const{destroy:i,onDestroy:s}=r;return r=>{if(!(t instanceof RegExp?t.test(r.origin):"*"===t||t===r.origin))return void o(`Child: Handshake - Received SYN-ACK from origin ${r.origin} which did not match expected origin ${t}`);o("Child: Handshake - Received SYN-ACK, responding with ACK");const a="null"===r.origin?"*":r.origin,c={penpal:e.Ack,methodNames:Object.keys(n)};window.parent.postMessage(c,a);const d={localName:"Child",local:window,remote:window.parent,originForSending:a,originForReceiving:r.origin},u=l(d,n,o);s(u);const m={},p=h(m,d,r.data.methodNames,i,o);return s(p),m}},R=(t={})=>{const{parentOrigin:n="*",methods:r={},timeout:o,debug:i=!1}=t,s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),c=((e,t)=>{const n=[];let r=!1;return{destroy(o){r||(r=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(o)})))},onDestroy(e){r?e():n.push(e)}}})("Child",s),{destroy:l,onDestroy:d}=c,u=p(r),m=v(n,u,c,s);return{promise:new Promise(((t,r)=>{const i=y(o,l),c=n=>{if((()=>{try{clearTimeout()}catch(e){return!1}return!0})()&&n.source===parent&&n.data&&n.data.penpal===e.SynAck){const e=m(n);e&&(window.removeEventListener(a.Message,c),i(),t(e))}};window.addEventListener(a.Message,c),(()=>{s("Child: Handshake - Sending SYN");const t={penpal:e.Syn},r=n instanceof RegExp?"*":n;window.parent.postMessage(t,r)})(),d((e=>{window.removeEventListener(a.Message,c),e&&r(e)}))})),destroy(){l()}}};(f=g||(g={})).ID="itemID",f.TYPE="itemType",f.SCOPE="itemScope",f.PROP="itemProp";const T={UUID:"id",ID:g.ID.toLowerCase(),TYPE:g.TYPE.toLowerCase(),SCOPE:g.SCOPE.toLowerCase(),PROP:g.PROP.toLowerCase(),PARENTID:"parentid",EDITOR_BEHAVIOR:"data-editor-behavior",EDITOR_LABEL:"data-editor-itemlabel"};var b,w,A,I;(w=b||(b={})).EDIT="edit",w.PREVIEW="preview",(I=A||(A={})).TEXT="text",I.IMAGE="image",I.MEDIA="media",I.RICHTEXT="richtext",I.REFERENCE="reference",I.CONTAINER="container";const C="universal-editor-message-bus.herokuapp.com",P="/gql",L="urn:adobe:aem:editor:",S="urn:auecon:",O={USER_INPUT_RELAY_MESSAGE:"REMOTE_APP_USER_INPUT",OVERLAY_INPUT_MESSAGE:"OVERLAY_INPUT_MESSAGE",DEMO_APP_HOST:"ue-remote-app.adobe.net/?authorHost=https://author-p15902-e145656-cmstg.adobeaemcloud.com&publishHost=https://publish-p15902-e145656-cmstg.adobeaemcloud.com",GRAPHQL_HOST:C,GRAPHQL_PORT_PUBLIC:443,GRAPHQL_PORT_LOCAL:4e3,GRAPHQL_PATH:P,GRAPHQL_URL:`${C}:443${P}`,EDITABLE_SELECTOR:`[${T.TYPE}]`,CANVAS_PATH:"/canvas",PARENT_SELECTOR:`[${T.SCOPE}][${T.ID}]`,URN_PREFIX:L,DEPRECATED_URN_PREFIX:S,META_SELECTOR:`meta[name^='${L}'],meta[name^='${S}']`,DEMO_APP_HOST_PROD:"ue-remote-app.adobe.net",FRAGMENT_TYPE:"reference",UNIFIED_SHELL_STAGE:"https://experience-stage.adobe.com",UNIFIED_SHELL_PROD:"https://experience.adobe.com",HEADLESS_CF_EDITOR_URL:"#/aem/cf/editor/editor",CONTAINER_SELECTOR:`[${T.TYPE}=container]`,COMPONENT_ITEM_TYPE:"component",TRANSPARENT_BACKGROUND:"rgba(0, 0, 0, 0)",TARGET_ORIGIN:"*"};var _=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const M=[];for(let e=0;e<256;++e)M.push((e+256).toString(16).slice(1));var D,N=function(e){if(!function(e){return"string"==typeof e&&_.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function $(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function U(e,t){return e<<t|e>>>32-t}function H(e,t,n){var r,o,i,s,a;function c(){var l=Date.now()-s;l<t&&l>=0?r=setTimeout(c,t-l):(r=null,n||(a=e.apply(i,o),i=o=null))}null==t&&(t=100);var l=function(){i=this,o=arguments,s=Date.now();var l=n&&!r;return r||(r=setTimeout(c,t)),l&&(a=e.apply(i,o),i=o=null),a};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(a=e.apply(i,o),i=o=null,clearTimeout(r),r=null)},l}!function(e,t,n){function r(e,t,n,r){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof t&&(t=N(t)),16!==(null===(o=t)||void 0===o?void 0:o.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+e.length);if(i.set(t),i.set(e,t.length),i=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];i[t]=n}i[o-1][14]=8*(e.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=i[e][t];for(let e=16;e<80;++e)r[e]=U(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],s=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),i=U(o,5)+$(n,s,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=U(s,30)>>>0,s=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}(i),i[6]=15&i[6]|80,i[8]=63&i[8]|128,n){r=r||0;for(let e=0;e<16;++e)n[r+e]=i[e];return n}return function(e,t=0){return(M[e[t+0]]+M[e[t+1]]+M[e[t+2]]+M[e[t+3]]+"-"+M[e[t+4]]+M[e[t+5]]+"-"+M[e[t+6]]+M[e[t+7]]+"-"+M[e[t+8]]+M[e[t+9]]+"-"+M[e[t+10]]+M[e[t+11]]+M[e[t+12]]+M[e[t+13]]+M[e[t+14]]+M[e[t+15]]).toLowerCase()}(i)}try{r.name="v5"}catch(e){}r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8"}(),H.debounce=H,D=H;var x=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const k=[];for(let e=0;e<256;++e)k.push((e+256).toString(16).slice(1));var F=function(e){if(!function(e){return"string"==typeof e&&x.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function V(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function B(e,t){return e<<t|e>>>32-t}var Y=function(e,t,n){function r(e,t,n,r){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof t&&(t=F(t)),16!==(null===(o=t)||void 0===o?void 0:o.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+e.length);if(i.set(t),i.set(e,t.length),i=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];i[t]=n}i[o-1][14]=8*(e.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=i[e][t];for(let e=16;e<80;++e)r[e]=B(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],s=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),i=B(o,5)+V(n,s,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=B(s,30)>>>0,s=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}(i),i[6]=15&i[6]|80,i[8]=63&i[8]|128,n){r=r||0;for(let e=0;e<16;++e)n[r+e]=i[e];return n}return function(e,t=0){return(k[e[t+0]]+k[e[t+1]]+k[e[t+2]]+k[e[t+3]]+"-"+k[e[t+4]]+k[e[t+5]]+"-"+k[e[t+6]]+k[e[t+7]]+"-"+k[e[t+8]]+k[e[t+9]]+"-"+k[e[t+10]]+k[e[t+11]]+k[e[t+12]]+k[e[t+13]]+k[e[t+14]]+k[e[t+15]]).toLowerCase()}(i)}try{r.name="v5"}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}();const G={element:window.document},j=150,K="Component",q=e=>{const t=window.getComputedStyle(e).backgroundColor,n=e.parentElement;return t===O.TRANSPARENT_BACKGROUND&&n?q(n):t},X=e=>{if(!(e&&e instanceof HTMLElement))return;const t=window.getComputedStyle(e);return{content:e.innerText,htmlContent:e.innerHTML,style:{font:t.getPropertyValue("font"),visibility:e.style.visibility,color:t.getPropertyValue("color"),textAlign:t.getPropertyValue("text-align"),textTransform:t.getPropertyValue("text-transform"),border:t.getPropertyValue("border"),padding:t.getPropertyValue("padding"),backgroundColor:q(e),width:t.getPropertyValue("width"),height:t.getPropertyValue("height")}}},z=e=>{e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();const t={pageHeight:document.documentElement.scrollHeight,pageYOffset:window.pageYOffset,type:e.type,x:null,y:null,keyModifiers:{advancedSelect:e.ctrlKey,multiSelect:e.shiftKey,metaKey:e.metaKey},editables:[]};"scroll"!==e.type&&(t.x=e.x,t.y=e.y,t.editables=document.elementsFromPoint(e.x,e.y).filter((e=>e.matches(O.EDITABLE_SELECTOR))).map((e=>{const t=X(e),n=ee(e);return{content:(null==t?void 0:t.content)||"",htmlContent:(null==t?void 0:t.htmlContent)||"",style:(null==t?void 0:t.style)||{},...n}}))),parent.postMessage({type:O.OVERLAY_INPUT_MESSAGE,payload:t},O.TARGET_ORIGIN)},W=e=>z(e),Q="OverlayBlockingElement",Z=()=>{document.removeEventListener("scroll",W),document.removeEventListener("mousemove",z),document.removeEventListener("mousedown",z),document.removeEventListener("mouseup",z),document.removeEventListener("click",z);const e=document.getElementById(Q);e&&e.remove()},J=e=>{const t=e.closest(O.PARENT_SELECTOR);return(null==t?void 0:t.getAttribute(T.ID))||""},ee=e=>{const t=e.getAttribute(T.TYPE)||"",n=e.getAttribute(T.ID)||void 0,r=e.getAttribute(T.PROP)||void 0,{parentid:o,selector:i,isComponent:s}=((e,{itemid:t,itemtype:n,itemprop:r})=>{const o=n===O.COMPONENT_ITEM_TYPE||e.getAttribute(T.EDITOR_BEHAVIOR)===O.COMPONENT_ITEM_TYPE;let i="",s="";if(t)i=`[${T.ID}="${t}"]`,s=(e=>{var t;const n=null===(t=e.parentElement)||void 0===t?void 0:t.closest(O.CONTAINER_SELECTOR),r=null==n?void 0:n.getAttribute(T.ID);if(r)return Y(`${r}`,Y.URL);const o=null==n?void 0:n.getAttribute(T.PROP),i=n&&J(n);return o&&i?Y(`${i}_${o}`,Y.URL):""})(e)||"";else{const t=J(e);s=Y(`${t}`,Y.URL),i=`[${T.ID}="${t}"] ${e.tagName.toLocaleLowerCase()}[${T.TYPE}="${n}"]`,r&&(i+=`[${T.PROP}="${r}"]`)}return{parentid:s,selector:i,isComponent:o}})(e,{itemid:n,itemtype:t,itemprop:r}),a=X(e),c=Y(`${n||o}${r?`_${r}`:""}`,Y.URL);let l={rect:e.getBoundingClientRect(),itemtype:t,label:e.getAttribute(T.EDITOR_LABEL)||t||K,id:c,itemid:n,itemprop:r,parentid:o,selector:i,pageYOffset:window.pageYOffset,isComponent:s};return[A.TEXT,A.RICHTEXT].includes(t)&&(l={...l,...a}),l},te={viewport:{width:0,height:0},frame:{width:0,height:0},scroll:{x:0,y:0}},ne=({editor:e})=>{null==e||e.updateFrameDetails({details:te})},re=({target:e})=>{const t=e.documentElement;te.scroll.x=t.scrollLeft,te.scroll.y=t.scrollTop},oe=({target:e})=>{const t=Math.max(e.document.documentElement.clientWidth||0,e.innerWidth||0),n=Math.max(e.document.documentElement.clientHeight||0,e.innerHeight||0),{width:r,height:o}=e.document.documentElement.getBoundingClientRect();te.viewport={width:t,height:n},te.frame={width:Math.ceil(r),height:Math.ceil(o)}},ie=({editor:e})=>{const t=[];[...document.styleSheets].forEach((e=>{try{const{cssRules:n}=e;[...n].find((e=>e instanceof CSSFontFaceRule))&&e.href&&t.push(e.href)}catch(n){e.href&&t.push(e.href)}})),e.addCustomFonts(t)},se=({editor:e})=>{const t=G.element,n=(0,D.debounce)((()=>{const n=(e=>{const{scrollLeft:t,scrollTop:n}=e.documentElement,r=e.querySelectorAll(O.EDITABLE_SELECTOR)||[],o=new Map;return r.forEach((e=>{const t=ee(e),n=o.get(t.id);if(o.set(t.id,{...t,children:(null==n?void 0:n.children)||[]}),t.parentid){const e=o.get(t.parentid);e?e.children.push(t.id):o.set(e.id,{children:[t.id]})}})),{editables:o,offset:{x:t,y:n},selected:{}}})(t);e.repaintEditables({editables:n})}),j);n(),window.removeEventListener("resize",n),window.addEventListener("resize",n),(({element:e,callback:t})=>{const n=new MutationObserver(t);n.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),n.disconnect})({element:t,callback:n})},ae=({editor:e})=>{const t=window;t.document.addEventListener("scroll",(0,D.debounce)((({target:t})=>{re({target:t}),ne({editor:e})}),j)),t.addEventListener("resize",(0,D.debounce)((({target:t})=>{oe({target:t}),ne({editor:e})}),j)),t.addEventListener("orientationchange",(0,D.debounce)((({target:n})=>{re({target:t.document}),oe({target:n}),ne({editor:e})}),j));const n=(0,D.debounce)((()=>{oe({target:t}),ne({editor:e})}),j);new ResizeObserver(n).observe(t.document.body),requestAnimationFrame((()=>{re({target:t.document}),oe({target:t}),ne({editor:e})}))},ce=({editor:e})=>{document.addEventListener("click",(t=>(({event:e,editor:t})=>{const n=e.target.closest("A");n&&(e.preventDefault(),t.navigateTo({href:n.href}))})({event:t,editor:e})),{capture:!0})},le=()=>{window.addEventListener("keydown",(({type:e,key:t,altKey:n,metaKey:r,shiftKey:o,ctrlKey:i})=>{const s={type:e,key:t,altKey:n,metaKey:r,shiftKey:o,ctrlKey:i};parent.postMessage({type:O.USER_INPUT_RELAY_MESSAGE,value:s},"*")}))},de=e=>e.split("/").pop()||"",ue=e=>{const[t="",n=""]=e.split("/");return`${n.toUpperCase()} ${t}`},me=e=>{const{naturalWidth:t,naturalHeight:n}=e;return t&&n&&`${t} x ${n}`||""},pe=e=>{const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(0))} ${["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}`},Ee=Object.freeze({edit:"adobe-ue-edit",preview:"adobe-ue-preview"});var ge;ge=function(e){return function(t,n,r){var o=r.subscribe;return r.subscribe=function(e,t,n){var i=e;if(t){var s=(null==n?void 0:n.equalityFn)||Object.is,a=e(r.getState());i=function(n){var r=e(n);if(!s(a,r)){var o=a;t(a=r,o)}},null!=n&&n.fireImmediately&&t(a,a)}return o(i)},e(t,n,r)}};var fe=function(e){var t,n=new Set,r=function(e,r){var o="function"==typeof e?e(t):e;if(!Object.is(o,t)){var i=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((function(e){return e(t,i)}))}},o=function(){return t},i={setState:r,getState:o,subscribe:function(e){return n.add(e),function(){return n.delete(e)}},destroy:function(){return n.clear()}};return t=e(r,o,i),i};const he=({set:e},{mode:t})=>{e((e=>{const n=t===b.EDIT||t===b.PREVIEW;return{...e,mode:t,isInEditor:n}}))},ye=function(e){return e&&e.__esModule?e.default:e}((function(e){return e?fe(e):fe}))(ge(((e,t)=>({mode:null,isInEditor:!1,setMode:he.bind(null,{get:t,set:e})})))),ve=({selector:e,classNames:t,operation:n="toggle"})=>{const r=document.querySelector(e);if(r)for(const e of t)r.classList[n](e)},Re=new RegExp(`^${O.URN_PREFIX}|^${O.DEPRECATED_URN_PREFIX}`),Te={updateAppMode:e=>{if(!e)return;const{mode:t,setMode:n}=ye.getState();if(t){if(t===e)return;ve({selector:"html",classNames:Object.values(Ee)})}else ve({selector:"html",classNames:[Ee[e]]});n({mode:e})},getEditableElement:e=>{const t=document.querySelector(e);return t&&t instanceof HTMLElement?X(t):void 0},updateField:async({selector:e,value:t,beforeSelector:n})=>{const r=document.querySelector(e);return r&&(n?((e,t)=>{const n=document.querySelector(t);n&&n.before(e)})(r,n):t&&((e,t)=>{(null==e?void 0:e.getAttribute("itemtype"))===A.IMAGE&&(e.src=t),(null==e?void 0:e.getAttribute("itemtype"))!==A.TEXT&&(null==e?void 0:e.getAttribute("itemtype"))!==A.RICHTEXT||(e.innerHTML=t)})(r,t)),!0},removeField:({selector:e})=>{const t=document.querySelector(e);t&&t.remove()},getUrnMappings:()=>{const e=document.querySelectorAll(O.META_SELECTOR);return Array.from(e).reduce(((e,{name:t,content:n})=>({...e,[t.replace(Re,"")]:n})),{})},getMediaProperties:async e=>{const t=document.querySelector(e),n=null==t?void 0:t.getAttribute("src");if(!n||!t)return;const r=await(async e=>{try{return await fetch(e).then((e=>e.blob()))}catch{return}})(n),{type:o,size:i}=r||{};return{name:de(n),mimeType:o?ue(o):"",resolution:me(t),size:i?pe(i):"",src:n,alt:t.getAttribute("alt")||""}},scrollEditableIntoView:e=>{const t=document.querySelector(e);if(t){const e=t.getBoundingClientRect();!(e.top>=0&&e.bottom<=window.innerHeight)&&t.scrollIntoView({behavior:"smooth"})}},toggleEditableVisibility:(e,t)=>{const n=document.querySelector(e);n&&(t?n.style.removeProperty("color"):n.style.color="rgba(0, 0, 0, 0)")},getRichTextColors:e=>{const t=document.querySelector(e),n=[];if(t.getAttribute("itemtype")===A.RICHTEXT)for(const e of t.children){const t=window.getComputedStyle(e).color;n.push(t)}return n}};(async()=>{const e=R({methods:Te}),t=await e.promise;var n;ie({editor:t}),se({editor:t}),ae({editor:t}),ce({editor:t}),le(),n=e=>{e===b.PREVIEW&&Z(),e===b.EDIT&&(Z(),(()=>{const e=document.createElement("div");e.id=Q,e.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2147483647;",document.body.appendChild(e)})(),document.addEventListener("scroll",W),document.addEventListener("mousemove",z),document.addEventListener("mousedown",z),document.addEventListener("mouseup",z),document.addEventListener("click",z))},ye.subscribe((e=>[e.mode]),(([e],[t])=>{e!==t&&n(e)}))})()})();
(()=>{var e,t,n,r,o,i,s,c;(t=e||(e={})).Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack",(r=n||(n={})).Fulfilled="fulfilled",r.Rejected="rejected",(i=o||(o={})).ConnectionDestroyed="ConnectionDestroyed",i.ConnectionTimeout="ConnectionTimeout",i.NoIframeSrc="NoIframeSrc",(s||(s={})).DataCloneError="DataCloneError",(c||(c={})).Message="message";const a=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});var l=(t,r,o)=>{const{localName:i,local:l,remote:d,originForSending:u,originForReceiving:m}=t;let p=!1;const E=t=>{if(t.source!==d||t.data.penpal!==e.Call)return;if("*"!==m&&t.origin!==m)return void o(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const c=t.data,{methodName:l,args:E,id:g}=c;o(`${i}: Received ${l}() call`);const f=t=>r=>{if(o(`${i}: Sending ${l}() reply`),p)return void o(`${i}: Unable to send ${l}() reply due to destroyed connection`);const c={penpal:e.Reply,id:g,resolution:t,returnValue:r};t===n.Rejected&&r instanceof Error&&(c.returnValue=a(r),c.returnValueIsError=!0);try{d.postMessage(c,u)}catch(t){if(t.name===s.DataCloneError){const r={penpal:e.Reply,id:g,resolution:n.Rejected,returnValue:a(t),returnValueIsError:!0};d.postMessage(r,u)}throw t}};new Promise((e=>e(r[l].apply(r,E)))).then(f(n.Fulfilled),f(n.Rejected))};return l.addEventListener(c.Message,E),()=>{p=!0,l.removeEventListener(c.Message,E)}};let d=0;const u=e=>e?e.split("."):[],m=(e,t,n)=>{const r=u(t);return r.reduce(((e,t,o)=>(void 0===e[t]&&(e[t]={}),o===r.length-1&&(e[t]=n),e[t])),e),e},p=(e,t)=>{const n={};return Object.keys(e).forEach((r=>{const o=e[r],i=((e,t)=>{const n=u(t||"");return n.push(e),(e=>e.join("."))(n)})(r,t);"object"==typeof o&&Object.assign(n,p(o,i)),"function"==typeof o&&(n[i]=o)})),n},E=e=>{const t={};for(const n in e)m(t,n,e[n]);return t};var g,f,h=(t,r,i,s,a)=>{const{localName:l,local:u,remote:m,originForSending:p,originForReceiving:g}=r;let f=!1;a(`${l}: Connecting call sender`);const h=t=>(...r)=>{let i;a(`${l}: Sending ${t}() call`);try{m.closed&&(i=!0)}catch(e){i=!0}if(i&&s(),f){const e=new Error(`Unable to send ${t}() call due to destroyed connection`);throw e.code=o.ConnectionDestroyed,e}return new Promise(((o,i)=>{const s=++d,E=r=>{if(r.source!==m||r.data.penpal!==e.Reply||r.data.id!==s)return;if("*"!==g&&r.origin!==g)return void a(`${l} received message from origin ${r.origin} which did not match expected origin ${g}`);const d=r.data;a(`${l}: Received ${t}() reply`),u.removeEventListener(c.Message,E);let p=d.returnValue;d.returnValueIsError&&(p=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(p)),(d.resolution===n.Fulfilled?o:i)(p)};u.addEventListener(c.Message,E);const f={penpal:e.Call,id:s,methodName:t,args:r};m.postMessage(f,p)}))},y=i.reduce(((e,t)=>(e[t]=h(t),e)),{});return Object.assign(t,E(y)),()=>{f=!0}},y=(e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=o.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}},v=(t,n,r,o)=>{const{destroy:i,onDestroy:s}=r;return r=>{if(!(t instanceof RegExp?t.test(r.origin):"*"===t||t===r.origin))return void o(`Child: Handshake - Received SYN-ACK from origin ${r.origin} which did not match expected origin ${t}`);o("Child: Handshake - Received SYN-ACK, responding with ACK");const c="null"===r.origin?"*":r.origin,a={penpal:e.Ack,methodNames:Object.keys(n)};window.parent.postMessage(a,c);const d={localName:"Child",local:window,remote:window.parent,originForSending:c,originForReceiving:r.origin},u=l(d,n,o);s(u);const m={},p=h(m,d,r.data.methodNames,i,o);return s(p),m}},R=(t={})=>{const{parentOrigin:n="*",methods:r={},timeout:o,debug:i=!1}=t,s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),a=((e,t)=>{const n=[];let r=!1;return{destroy(o){r||(r=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(o)})))},onDestroy(e){r?e():n.push(e)}}})("Child",s),{destroy:l,onDestroy:d}=a,u=p(r),m=v(n,u,a,s);return{promise:new Promise(((t,r)=>{const i=y(o,l),a=n=>{if((()=>{try{clearTimeout()}catch(e){return!1}return!0})()&&n.source===parent&&n.data&&n.data.penpal===e.SynAck){const e=m(n);e&&(window.removeEventListener(c.Message,a),i(),t(e))}};window.addEventListener(c.Message,a),(()=>{s("Child: Handshake - Sending SYN");const t={penpal:e.Syn},r=n instanceof RegExp?"*":n;window.parent.postMessage(t,r)})(),d((e=>{window.removeEventListener(c.Message,a),e&&r(e)}))})),destroy(){l()}}};(f=g||(g={})).ID="itemID",f.TYPE="itemType",f.SCOPE="itemScope",f.PROP="itemProp";const T={UUID:"id",ID:g.ID.toLowerCase(),TYPE:g.TYPE.toLowerCase(),SCOPE:g.SCOPE.toLowerCase(),PROP:g.PROP.toLowerCase(),PARENTID:"parentid",EDITOR_BEHAVIOR:"data-editor-behavior",EDITOR_LABEL:"data-editor-itemlabel"};var b,w,A,C;(w=b||(b={})).EDIT="edit",w.PREVIEW="preview",(C=A||(A={})).TEXT="text",C.IMAGE="image",C.MEDIA="media",C.RICHTEXT="richtext",C.REFERENCE="reference",C.CONTAINER="container";const I="universal-editor-message-bus.herokuapp.com",P="/gql",S="urn:adobe:aem:editor:",L="urn:auecon:",O={USER_INPUT_RELAY_MESSAGE:"REMOTE_APP_USER_INPUT",OVERLAY_INPUT_MESSAGE:"OVERLAY_INPUT_MESSAGE",DEMO_APP_HOST:"ue-remote-app.adobe.net/?authorHost=https://author-p15902-e145656-cmstg.adobeaemcloud.com&publishHost=https://publish-p15902-e145656-cmstg.adobeaemcloud.com",GRAPHQL_HOST:I,GRAPHQL_PORT_PUBLIC:443,GRAPHQL_PORT_LOCAL:4e3,GRAPHQL_PATH:P,GRAPHQL_URL:`${I}:443${P}`,EDITABLE_SELECTOR:`[${T.TYPE}]`,CANVAS_PATH:"/canvas",PARENT_SELECTOR:`[${T.SCOPE}][${T.ID}]`,URN_PREFIX:S,DEPRECATED_URN_PREFIX:L,META_SELECTOR:`meta[name^='${S}'],meta[name^='${L}']`,DEMO_APP_HOST_PROD:"ue-remote-app.adobe.net",FRAGMENT_TYPE:"reference",UNIFIED_SHELL_STAGE:"https://experience-stage.adobe.com",UNIFIED_SHELL_PROD:"https://experience.adobe.com",HEADLESS_CF_EDITOR_URL:"#/aem/cf/editor/editor",CONTAINER_SELECTOR:`[${T.TYPE}=container]`,COMPONENT_ITEM_TYPE:"component",TRANSPARENT_BACKGROUND:"rgba(0, 0, 0, 0)",TARGET_ORIGIN:"*"};var _=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const M=[];for(let e=0;e<256;++e)M.push((e+256).toString(16).slice(1));var D,N=function(e){if(!function(e){return"string"==typeof e&&_.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function $(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function U(e,t){return e<<t|e>>>32-t}function H(e,t,n){var r,o,i,s,c;function a(){var l=Date.now()-s;l<t&&l>=0?r=setTimeout(a,t-l):(r=null,n||(c=e.apply(i,o),i=o=null))}null==t&&(t=100);var l=function(){i=this,o=arguments,s=Date.now();var l=n&&!r;return r||(r=setTimeout(a,t)),l&&(c=e.apply(i,o),i=o=null),c};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(c=e.apply(i,o),i=o=null,clearTimeout(r),r=null)},l}!function(e,t,n){function r(e,t,n,r){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof t&&(t=N(t)),16!==(null===(o=t)||void 0===o?void 0:o.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+e.length);if(i.set(t),i.set(e,t.length),i=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];i[t]=n}i[o-1][14]=8*(e.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=i[e][t];for(let e=16;e<80;++e)r[e]=U(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],s=n[1],c=n[2],a=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),i=U(o,5)+$(n,s,c,a)+l+t[n]+r[e]>>>0;l=a,a=c,c=U(s,30)>>>0,s=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+c>>>0,n[3]=n[3]+a>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}(i),i[6]=15&i[6]|80,i[8]=63&i[8]|128,n){r=r||0;for(let e=0;e<16;++e)n[r+e]=i[e];return n}return function(e,t=0){return(M[e[t+0]]+M[e[t+1]]+M[e[t+2]]+M[e[t+3]]+"-"+M[e[t+4]]+M[e[t+5]]+"-"+M[e[t+6]]+M[e[t+7]]+"-"+M[e[t+8]]+M[e[t+9]]+"-"+M[e[t+10]]+M[e[t+11]]+M[e[t+12]]+M[e[t+13]]+M[e[t+14]]+M[e[t+15]]).toLowerCase()}(i)}try{r.name="v5"}catch(e){}r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8"}(),H.debounce=H,D=H;var x=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const k=[];for(let e=0;e<256;++e)k.push((e+256).toString(16).slice(1));var F=function(e){if(!function(e){return"string"==typeof e&&x.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function V(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function B(e,t){return e<<t|e>>>32-t}var Y=function(e,t,n){function r(e,t,n,r){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof t&&(t=F(t)),16!==(null===(o=t)||void 0===o?void 0:o.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+e.length);if(i.set(t),i.set(e,t.length),i=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];i[t]=n}i[o-1][14]=8*(e.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=i[e][t];for(let e=16;e<80;++e)r[e]=B(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],s=n[1],c=n[2],a=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),i=B(o,5)+V(n,s,c,a)+l+t[n]+r[e]>>>0;l=a,a=c,c=B(s,30)>>>0,s=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+c>>>0,n[3]=n[3]+a>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}(i),i[6]=15&i[6]|80,i[8]=63&i[8]|128,n){r=r||0;for(let e=0;e<16;++e)n[r+e]=i[e];return n}return function(e,t=0){return(k[e[t+0]]+k[e[t+1]]+k[e[t+2]]+k[e[t+3]]+"-"+k[e[t+4]]+k[e[t+5]]+"-"+k[e[t+6]]+k[e[t+7]]+"-"+k[e[t+8]]+k[e[t+9]]+"-"+k[e[t+10]]+k[e[t+11]]+k[e[t+12]]+k[e[t+13]]+k[e[t+14]]+k[e[t+15]]).toLowerCase()}(i)}try{r.name="v5"}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}();const G={element:window.document},j=150,K="Component",q=e=>{const t=window.getComputedStyle(e).backgroundColor,n=e.parentElement;return t===O.TRANSPARENT_BACKGROUND&&n?q(n):t},X=e=>{if(!(e&&e instanceof HTMLElement))return;const t=window.getComputedStyle(e);return{content:e.innerText,htmlContent:e.innerHTML,style:{font:t.getPropertyValue("font"),visibility:e.style.visibility,color:t.getPropertyValue("color"),textAlign:t.getPropertyValue("text-align"),textTransform:t.getPropertyValue("text-transform"),border:t.getPropertyValue("border"),padding:t.getPropertyValue("padding"),backgroundColor:q(e),width:t.getPropertyValue("width"),height:t.getPropertyValue("height")}}},z=e=>{e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();const t={pageHeight:document.documentElement.scrollHeight,pageYOffset:window.pageYOffset,type:e.type,x:null,y:null,keyModifiers:{advancedSelect:e.ctrlKey,multiSelect:e.shiftKey,metaKey:e.metaKey},editables:[]};"scroll"!==e.type&&(t.x=e.x,t.y=e.y,t.editables=document.elementsFromPoint(e.x,e.y).filter((e=>e.matches(O.EDITABLE_SELECTOR))).map((e=>{const t=X(e),n=ee(e);return{content:(null==t?void 0:t.content)||"",htmlContent:(null==t?void 0:t.htmlContent)||"",style:(null==t?void 0:t.style)||{},...n}}))),parent.postMessage({type:O.OVERLAY_INPUT_MESSAGE,payload:t},O.TARGET_ORIGIN)},W=e=>z(e),Q="OverlayBlockingElement",Z=()=>{document.removeEventListener("scroll",W),document.removeEventListener("mousemove",z),document.removeEventListener("mousedown",z),document.removeEventListener("mouseup",z),document.removeEventListener("click",z);const e=document.getElementById(Q);e&&e.remove()},J=e=>{const t=e.closest(O.PARENT_SELECTOR);return(null==t?void 0:t.getAttribute(T.ID))||""},ee=e=>{const t=e.getAttribute(T.TYPE)||"",n=e.getAttribute(T.ID)||void 0,r=e.getAttribute(T.PROP)||void 0,{parentid:o,selector:i,isComponent:s}=((e,{itemid:t,itemtype:n,itemprop:r})=>{const o=n===O.COMPONENT_ITEM_TYPE||e.getAttribute(T.EDITOR_BEHAVIOR)===O.COMPONENT_ITEM_TYPE;let i="",s="";if(t)i=`[${T.ID}="${t}"]`,s=(e=>{var t;const n=null===(t=e.parentElement)||void 0===t?void 0:t.closest(O.CONTAINER_SELECTOR),r=null==n?void 0:n.getAttribute(T.ID);if(r)return Y(`${r}`,Y.URL);const o=null==n?void 0:n.getAttribute(T.PROP),i=n&&J(n);return o&&i?Y(`${i}_${o}`,Y.URL):""})(e)||"";else{const t=J(e);s=Y(`${t}`,Y.URL),i=`[${T.ID}="${t}"] ${e.tagName.toLocaleLowerCase()}[${T.TYPE}="${n}"]`,r&&(i+=`[${T.PROP}="${r}"]`)}return{parentid:s,selector:i,isComponent:o}})(e,{itemid:n,itemtype:t,itemprop:r}),c=X(e),a=Y(`${n||o}${r?`_${r}`:""}`,Y.URL);let l={rect:e.getBoundingClientRect(),itemtype:t,label:e.getAttribute(T.EDITOR_LABEL)||t||K,id:a,itemid:n,itemprop:r,parentid:o,selector:i,pageYOffset:window.pageYOffset,isComponent:s};return[A.TEXT,A.RICHTEXT].includes(t)&&(l={...l,...c}),l},te={viewport:{width:0,height:0},frame:{width:0,height:0},scroll:{x:0,y:0}},ne=({editor:e})=>{null==e||e.updateFrameDetails({details:te})},re=({target:e})=>{const t=e.documentElement;te.scroll.x=t.scrollLeft,te.scroll.y=t.scrollTop},oe=({target:e})=>{const t=Math.max(e.document.documentElement.clientWidth||0,e.innerWidth||0),n=Math.max(e.document.documentElement.clientHeight||0,e.innerHeight||0),{width:r,height:o}=e.document.documentElement.getBoundingClientRect();te.viewport={width:t,height:n},te.frame={width:Math.ceil(r),height:Math.ceil(o)}},ie=({editor:e})=>{const t=[];[...document.styleSheets].forEach((e=>{try{const{cssRules:n}=e;[...n].find((e=>e instanceof CSSFontFaceRule))&&e.href&&t.push(e.href)}catch(n){e.href&&t.push(e.href)}})),e.addCustomFonts(t)},se=({editor:e})=>{const t=G.element,n=(0,D.debounce)((()=>{const n=(e=>{const{scrollLeft:t,scrollTop:n}=e.documentElement,r=e.querySelectorAll(O.EDITABLE_SELECTOR)||[],o=new Map;return r.forEach((e=>{const t=ee(e),n=o.get(t.id);if(o.set(t.id,{...t,children:(null==n?void 0:n.children)||[]}),t.parentid){const e=o.get(t.parentid);e?e.children.push(t.id):o.set(e.id,{children:[t.id]})}})),{editables:o,offset:{x:t,y:n},selected:{}}})(t);e.repaintEditables({editables:n})}),j);n(),window.removeEventListener("resize",n),window.addEventListener("resize",n),(({element:e,callback:t})=>{const n=new MutationObserver(t);n.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),n.disconnect})({element:t,callback:n})},ce=({editor:e})=>{const t=window;t.document.addEventListener("scroll",(0,D.debounce)((({target:t})=>{re({target:t}),ne({editor:e})}),j)),t.addEventListener("resize",(0,D.debounce)((({target:t})=>{oe({target:t}),ne({editor:e})}),j)),t.addEventListener("orientationchange",(0,D.debounce)((({target:n})=>{re({target:t.document}),oe({target:n}),ne({editor:e})}),j));const n=(0,D.debounce)((()=>{oe({target:t}),ne({editor:e})}),j);new ResizeObserver(n).observe(t.document.body),requestAnimationFrame((()=>{re({target:t.document}),oe({target:t}),ne({editor:e})}))},ae=({editor:e})=>{document.addEventListener("click",(t=>(({event:e,editor:t})=>{const n=e.target.closest("A");n&&(e.preventDefault(),t.navigateTo({href:n.href}))})({event:t,editor:e})),{capture:!0})},le=()=>{window.addEventListener("keydown",(({type:e,key:t,altKey:n,metaKey:r,shiftKey:o,ctrlKey:i})=>{const s={type:e,key:t,altKey:n,metaKey:r,shiftKey:o,ctrlKey:i};parent.postMessage({type:O.USER_INPUT_RELAY_MESSAGE,value:s},"*")}))},de=e=>e.split("/").pop()||"",ue=e=>{const[t="",n=""]=e.split("/");return`${n.toUpperCase()} ${t}`},me=e=>{const{naturalWidth:t,naturalHeight:n}=e;return t&&n&&`${t} x ${n}`||""},pe=e=>{const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(0))} ${["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}`},Ee=Object.freeze({edit:"adobe-ue-edit",preview:"adobe-ue-preview"});var ge;ge=function(e){return function(t,n,r){var o=r.subscribe;return r.subscribe=function(e,t,n){var i=e;if(t){var s=(null==n?void 0:n.equalityFn)||Object.is,c=e(r.getState());i=function(n){var r=e(n);if(!s(c,r)){var o=c;t(c=r,o)}},null!=n&&n.fireImmediately&&t(c,c)}return o(i)},e(t,n,r)}};var fe=function(e){var t,n=new Set,r=function(e,r){var o="function"==typeof e?e(t):e;if(!Object.is(o,t)){var i=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((function(e){return e(t,i)}))}},o=function(){return t},i={setState:r,getState:o,subscribe:function(e){return n.add(e),function(){return n.delete(e)}},destroy:function(){return n.clear()}};return t=e(r,o,i),i};const he=({set:e},{mode:t})=>{e((e=>{const n=t===b.EDIT||t===b.PREVIEW;return{...e,mode:t,isInEditor:n}}))},ye=function(e){return e&&e.__esModule?e.default:e}((function(e){return e?fe(e):fe}))(ge(((e,t)=>({mode:null,isInEditor:!1,setMode:he.bind(null,{get:t,set:e})})))),ve=({selector:e,classNames:t,operation:n="toggle"})=>{const r=document.querySelector(e);if(r)for(const e of t)r.classList[n](e)},Re=new RegExp(`^${O.URN_PREFIX}|^${O.DEPRECATED_URN_PREFIX}`),Te={updateAppMode:e=>{if(!e)return;const{mode:t,setMode:n}=ye.getState();if(t){if(t===e)return;ve({selector:"html",classNames:Object.values(Ee)})}else ve({selector:"html",classNames:[Ee[e]]});n({mode:e})},getEditableElement:e=>{const t=document.querySelector(e);return t&&t instanceof HTMLElement?X(t):void 0},updateField:async({selector:e,value:t})=>{const n=document.querySelector(e);n&&t&&((e,t)=>{(null==e?void 0:e.getAttribute("itemtype"))===A.IMAGE?e.src=t:(null==e?void 0:e.getAttribute("itemtype"))!==A.TEXT&&(null==e?void 0:e.getAttribute("itemtype"))!==A.RICHTEXT||(e.innerHTML=t)})(n,t)},removeField:({selector:e})=>{const t=document.querySelector(e);t&&t.remove()},getUrnMappings:()=>{const e=document.querySelectorAll(O.META_SELECTOR);return Array.from(e).reduce(((e,{name:t,content:n})=>({...e,[t.replace(Re,"")]:n})),{})},getMediaProperties:async e=>{const t=document.querySelector(e),n=null==t?void 0:t.getAttribute("src");if(!n||!t)return;const r=await(async e=>{try{return await fetch(e).then((e=>e.blob()))}catch{return}})(n),{type:o,size:i}=r||{};return{name:de(n),mimeType:o?ue(o):"",resolution:me(t),size:i?pe(i):"",src:n,alt:t.getAttribute("alt")||""}},scrollEditableIntoView:e=>{const t=document.querySelector(e);if(t){const e=t.getBoundingClientRect();!(e.top>=0&&e.bottom<=window.innerHeight)&&t.scrollIntoView({behavior:"smooth"})}},toggleEditableVisibility:(e,t)=>{const n=document.querySelector(e);n&&(t?n.style.removeProperty("color"):n.style.color="rgba(0, 0, 0, 0)")},getRichTextColors:e=>{const t=document.querySelector(e),n=[];if(t.getAttribute("itemtype")===A.RICHTEXT)for(const e of t.children){const t=window.getComputedStyle(e).color;n.push(t)}return n},updateContainer:async({selector:e,containerSelector:t,currPos:n,newPos:r})=>{const o=document.querySelector(e),i=document.querySelector(t);if(o&&i){const t=i.querySelector(e);((e,t,n,r,o)=>{const i=t.children[n];i?!r||o>n?i.before(e):i.after(e):t.appendChild(t)})(o,i,r,!!t,n)}}};(async()=>{const e=R({methods:Te}),t=await e.promise;var n;ie({editor:t}),se({editor:t}),ce({editor:t}),ae({editor:t}),le(),n=e=>{e===b.PREVIEW&&Z(),e===b.EDIT&&(Z(),(()=>{const e=document.createElement("div");e.id=Q,e.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2147483647;",document.body.appendChild(e)})(),document.addEventListener("scroll",W),document.addEventListener("mousemove",z),document.addEventListener("mousedown",z),document.addEventListener("mouseup",z),document.addEventListener("click",z))},ye.subscribe((e=>[e.mode]),(([e],[t])=>{e!==t&&n(e)}))})()})();
{
"name": "@adobe/universal-editor-cors",
"version": "1.2.2",
"version": "1.2.3",
"description": "Utility providing communication layer between edited App and Universal Editor.",

@@ -5,0 +5,0 @@ "main": "dist/universal-editor-embedded.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc