(()=>{"use strict";var e,t={34827:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var r=n(o(73609));r.default.widget("IKS.hallowagtaillink",{options:{uuid:"",editable:null},populateToolbar:function(e){var t=this,o=function(){var e=t.options.editable.getSelection().commonAncestorContainer;return r.default(e).parents("a").get(0)},n=r.default('<span class="'+this.widgetName+'"></span>'),a=r.default("<span></span>");(a=a.hallobutton({uuid:t.options.uuid,editable:t.options.editable,label:"Add/Edit Link",icon:"icon-link",command:null,queryState:function(){return a.hallobutton("checked",!!o())}})).on("click",(function(){var e,n,a,i=window.chooserUrls.pageChooser,l={allow_external_link:!0,allow_email_link:!0,allow_phone_link:!0,allow_anchor_link:!0},s=o(),d=t.options.editable.getSelection();return s?(e=s.getAttribute("href"),a=s.getAttribute("data-parent-id"),n=s.getAttribute("data-linktype"),l.link_text=s.innerText,"page"===n&&a?i=window.chooserUrls.pageChooser+a.toString()+"/":e.startsWith("mailto:")?(i=window.chooserUrls.emailLinkChooser,e=e.replace("mailto:",""),l.link_url=e):e.startsWith("tel:")?(i=window.chooserUrls.phoneLinkChooser,e=e.replace("tel:",""),l.link_url=e):e.startsWith("#")?(i=window.chooserUrls.anchorLinkChooser,e=e.replace("#",""),l.link_url=e):n||(i=window.chooserUrls.externalLinkChooser,l.link_url=e)):d.collapsed||(l.link_text=d.toString()),ModalWorkflow({url:i,urlParams:l,onload:PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS,responses:{pageChosen:function(e){var o,n;return s?(o=s,n=!0):d.collapsed?(o=document.createElement("a"),d.insertNode(o),n=!1):(o=document.createElement("a"),d.surroundContents(o),r.default("a[href]",o).each((function(){for(var e=this.parentNode;this.firstChild;)e.insertBefore(this.firstChild,this);e.removeChild(this)})),n=!0),o.setAttribute("href",e.url),e.id?(o.setAttribute("data-id",e.id),o.setAttribute("data-parent-id",e.parentId),o.setAttribute("data-linktype","page")):(o.removeAttribute("data-id"),o.removeAttribute("data-parent-id"),o.removeAttribute("data-linktype")),!e.prefer_this_title_as_link_text&&n||(o.innerText=e.title),t.options.editable.element.trigger("change")}}})})),n.append(a);var i=r.default("<span></span>");(i=i.hallobutton({uuid:t.options.uuid,editable:t.options.editable,label:"Remove Link",icon:"icon-chain-broken",command:null,queryState:function(){return o()?i.hallobutton("enable"):i.hallobutton("disable")}})).on("click",(function(){var e,n;o()&&((n=(e=rangy.getSelection()).getRangeAt(0)).setStartBefore(e.anchorNode.parentNode),n.setEndAfter(e.anchorNode.parentNode),e.setSingleRange(n,!1),document.execCommand("unlink"),t.options.editable.element.trigger("change"))})),n.append(i),n.hallobuttonset(),e.append(n)}})},73609:e=>{e.exports=jQuery}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={id:e,loaded:!1,exports:{}};return t[e].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.m=t,e=[],n.O=(t,o,r,a)=>{if(!o){var i=1/0;for(d=0;d<e.length;d++){for(var[o,r,a]=e[d],l=!0,s=0;s<o.length;s++)(!1&a||i>=a)&&Object.keys(n.O).every((e=>n.O[e](o[s])))?o.splice(s--,1):(l=!1,a<i&&(i=a));l&&(e.splice(d--,1),t=r())}return t}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[o,r,a]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=846,(()=>{var e={846:0};n.O.j=t=>0===e[t];var t=(t,o)=>{var r,a,[i,l,s]=o,d=0;for(r in l)n.o(l,r)&&(n.m[r]=l[r]);if(s)var u=s(n);for(t&&t(o);d<i.length;d++)a=i[d],n.o(e,a)&&e[a]&&e[a][0](),e[i[d]]=0;return n.O(u)},o=globalThis.webpackChunkwagtail=globalThis.webpackChunkwagtail||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})(),n.O(void 0,[876],(()=>n(34827)));var r=n.O(void 0,[876],(()=>n(90971)));r=n.O(r)})();
//# sourceMappingURL=hallo-wagtaillink.js.map