@icij/murmur-next 4.0.14 → 4.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/murmur.js +3027 -3025
- package/dist/lib/murmur.js.map +1 -1
- package/dist/lib/murmur.umd.cjs +1 -1
- package/dist/lib/murmur.umd.cjs.map +1 -1
- package/lib/components/HapticCopy.vue +13 -11
- package/package.json +1 -2
package/dist/lib/murmur.umd.cjs
CHANGED
|
@@ -787,7 +787,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
787
787
|
* https://clipboardjs.com/
|
|
788
788
|
*
|
|
789
789
|
* Licensed MIT © Zeno Rocha
|
|
790
|
-
*/(function(e,t){(function(r,i){e.exports=i()})(Xr,function(){return function(){var n={686:function(a,o,s){s.d(o,{default:function(){return ce}});var c=s(279),f=s.n(c),h=s(370),p=s.n(h),m=s(817),_=s.n(m);function y(H){try{return document.execCommand(H)}catch(ne){return!1}}var w=function(ne){var le=_()(ne);return y("cut"),le},v=w;function b(H){var ne=document.documentElement.getAttribute("dir")==="rtl",le=document.createElement("textarea");le.style.fontSize="12pt",le.style.border="0",le.style.padding="0",le.style.margin="0",le.style.position="absolute",le.style[ne?"right":"left"]="-9999px";var ue=window.pageYOffset||document.documentElement.scrollTop;return le.style.top="".concat(ue,"px"),le.setAttribute("readonly",""),le.value=H,le}var k=function(ne,le){var ue=b(ne);le.container.appendChild(ue);var ge=_()(ue);return y("copy"),ue.remove(),ge},S=function(ne){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},ue="";return typeof ne=="string"?ue=k(ne,le):ne instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(ne==null?void 0:ne.type)?ue=k(ne.value,le):(ue=_()(ne),y("copy")),ue},E=S;function T(H){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?T=function(le){return typeof le}:T=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},T(H)}var x=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},le=ne.action,ue=le===void 0?"copy":le,ge=ne.container,_e=ne.target,he=ne.text;if(ue!=="copy"&&ue!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(_e!==void 0)if(_e&&T(_e)==="object"&&_e.nodeType===1){if(ue==="copy"&&_e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(ue==="cut"&&(_e.hasAttribute("readonly")||_e.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(he)return E(he,{container:ge});if(_e)return ue==="cut"?v(_e):E(_e,{container:ge})},M=x;function I(H){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?I=function(le){return typeof le}:I=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},I(H)}function A(H,ne){if(!(H instanceof ne))throw new TypeError("Cannot call a class as a function")}function P(H,ne){for(var le=0;le<ne.length;le++){var ue=ne[le];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(H,ue.key,ue)}}function R(H,ne,le){return ne&&P(H.prototype,ne),le&&P(H,le),H}function G(H,ne){if(typeof ne!="function"&&ne!==null)throw new TypeError("Super expression must either be null or a function");H.prototype=Object.create(ne&&ne.prototype,{constructor:{value:H,writable:!0,configurable:!0}}),ne&&D(H,ne)}function D(H,ne){return D=Object.setPrototypeOf||function(ue,ge){return ue.__proto__=ge,ue},D(H,ne)}function L(H){var ne=Y();return function(){var ue=X(H),ge;if(ne){var _e=X(this).constructor;ge=Reflect.construct(ue,arguments,_e)}else ge=ue.apply(this,arguments);return z(this,ge)}}function z(H,ne){return ne&&(I(ne)==="object"||typeof ne=="function")?ne:V(H)}function V(H){if(H===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return H}function Y(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(H){return!1}}function X(H){return X=Object.setPrototypeOf?Object.getPrototypeOf:function(le){return le.__proto__||Object.getPrototypeOf(le)},X(H)}function Z(H,ne){var le="data-clipboard-".concat(H);if(ne.hasAttribute(le))return ne.getAttribute(le)}var ee=function(H){G(le,H);var ne=L(le);function le(ue,ge){var _e;return A(this,le),_e=ne.call(this),_e.resolveOptions(ge),_e.listenClick(ue),_e}return R(le,[{key:"resolveOptions",value:function(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof ge.action=="function"?ge.action:this.defaultAction,this.target=typeof ge.target=="function"?ge.target:this.defaultTarget,this.text=typeof ge.text=="function"?ge.text:this.defaultText,this.container=I(ge.container)==="object"?ge.container:document.body}},{key:"listenClick",value:function(ge){var _e=this;this.listener=p()(ge,"click",function(he){return _e.onClick(he)})}},{key:"onClick",value:function(ge){var _e=ge.delegateTarget||ge.currentTarget,he=this.action(_e)||"copy",te=M({action:he,container:this.container,target:this.target(_e),text:this.text(_e)});this.emit(te?"success":"error",{action:he,text:te,trigger:_e,clearSelection:function(){_e&&_e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(ge){return Z("action",ge)}},{key:"defaultTarget",value:function(ge){var _e=Z("target",ge);if(_e)return document.querySelector(_e)}},{key:"defaultText",value:function(ge){return Z("text",ge)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(ge){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return E(ge,_e)}},{key:"cut",value:function(ge){return v(ge)}},{key:"isSupported",value:function(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],_e=typeof ge=="string"?[ge]:ge,he=!!document.queryCommandSupported;return _e.forEach(function(te){he=he&&!!document.queryCommandSupported(te)}),he}}]),le}(f()),ce=ee},828:function(a){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var s=Element.prototype;s.matches=s.matchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||s.webkitMatchesSelector}function c(f,h){for(;f&&f.nodeType!==o;){if(typeof f.matches=="function"&&f.matches(h))return f;f=f.parentNode}}a.exports=c},438:function(a,o,s){var c=s(828);function f(m,_,y,w,v){var b=p.apply(this,arguments);return m.addEventListener(y,b,v),{destroy:function(){m.removeEventListener(y,b,v)}}}function h(m,_,y,w,v){return typeof m.addEventListener=="function"?f.apply(null,arguments):typeof y=="function"?f.bind(null,document).apply(null,arguments):(typeof m=="string"&&(m=document.querySelectorAll(m)),Array.prototype.map.call(m,function(b){return f(b,_,y,w,v)}))}function p(m,_,y,w){return function(v){v.delegateTarget=c(v.target,_),v.delegateTarget&&w.call(m,v)}}a.exports=h},879:function(a,o){o.node=function(s){return s!==void 0&&s instanceof HTMLElement&&s.nodeType===1},o.nodeList=function(s){var c=Object.prototype.toString.call(s);return s!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in s&&(s.length===0||o.node(s[0]))},o.string=function(s){return typeof s=="string"||s instanceof String},o.fn=function(s){var c=Object.prototype.toString.call(s);return c==="[object Function]"}},370:function(a,o,s){var c=s(879),f=s(438);function h(y,w,v){if(!y&&!w&&!v)throw new Error("Missing required arguments");if(!c.string(w))throw new TypeError("Second argument must be a String");if(!c.fn(v))throw new TypeError("Third argument must be a Function");if(c.node(y))return p(y,w,v);if(c.nodeList(y))return m(y,w,v);if(c.string(y))return _(y,w,v);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function p(y,w,v){return y.addEventListener(w,v),{destroy:function(){y.removeEventListener(w,v)}}}function m(y,w,v){return Array.prototype.forEach.call(y,function(b){b.addEventListener(w,v)}),{destroy:function(){Array.prototype.forEach.call(y,function(b){b.removeEventListener(w,v)})}}}function _(y,w,v){return f(document.body,y,w,v)}a.exports=h},817:function(a){function o(s){var c;if(s.nodeName==="SELECT")s.focus(),c=s.value;else if(s.nodeName==="INPUT"||s.nodeName==="TEXTAREA"){var f=s.hasAttribute("readonly");f||s.setAttribute("readonly",""),s.select(),s.setSelectionRange(0,s.value.length),f||s.removeAttribute("readonly"),c=s.value}else{s.hasAttribute("contenteditable")&&s.focus();var h=window.getSelection(),p=document.createRange();p.selectNodeContents(s),h.removeAllRanges(),h.addRange(p),c=h.toString()}return c}a.exports=o},279:function(a){function o(){}o.prototype={on:function(s,c,f){var h=this.e||(this.e={});return(h[s]||(h[s]=[])).push({fn:c,ctx:f}),this},once:function(s,c,f){var h=this;function p(){h.off(s,p),c.apply(f,arguments)}return p._=c,this.on(s,p,f)},emit:function(s){var c=[].slice.call(arguments,1),f=((this.e||(this.e={}))[s]||[]).slice(),h=0,p=f.length;for(h;h<p;h++)f[h].fn.apply(f[h].ctx,c);return this},off:function(s,c){var f=this.e||(this.e={}),h=f[s],p=[];if(h&&c)for(var m=0,_=h.length;m<_;m++)h[m].fn!==c&&h[m].fn._!==c&&p.push(h[m]);return p.length?f[s]=p:delete f[s],this}},a.exports=o,a.exports.TinyEmitter=o}},r={};function i(a){if(r[a])return r[a].exports;var o=r[a]={exports:{}};return n[a](o,o.exports,i),o.exports}return function(){i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,{a:o}),o}}(),function(){i.d=function(a,o){for(var s in o)i.o(o,s)&&!i.o(a,s)&&Object.defineProperty(a,s,{enumerable:!0,get:o[s]})}}(),function(){i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)}}(),i(686)}().default})})(gb);var D$=gb.exports;const B$=_t(D$);function F$(e,t){return new Promise(function(n,r){const i=document.createElement("button");t=typeof t=="object"?t:document.body;const a=new B$(i,{text:()=>e,container:t});a.on("success",()=>{a.destroy(),n()}),a.on("error",o=>{a.destroy(),r(o)}),i.click()})}function V$(e,t){function n(r){r.clipboardData.setData("text/html",e),r.clipboardData.setData("text/plain",t),r.preventDefault()}document.addEventListener("copy",n),document.execCommand("copy"),document.removeEventListener("copy",n)}const z$=u.defineComponent({name:"HapticCopy",components:{BTooltip:ye.BTooltip,FontAwesomeLayers:ZA,Fa:xn},props:{text:{type:[String,Number],default:null},plain:{type:String,default:null},hideLabel:{type:Boolean},label:{type:String,default:null},tooltipHideDelay:{type:Number,default:1e3},tooltipPlacement:{type:String,default:"top"},html:{type:Boolean},noTooltip:{type:Boolean}},emits:["attempt","success","error","hideClipboardTooltip"],setup(e,{emit:t,expose:n}){const{t:r,te:i}=tr(),a=u.ref(null),o=u.ref(null),s=u.ref(""),c=u.ref(void 0),f=u.ref(!1),h=u.computed(()=>Iu("haptic-copy-"));u.onBeforeMount(()=>{Lr.add(ab.faClipboard),Lr.add(ob.faClipboardCheck)});const p=u.computed(()=>{var E;return(E=o.value)!=null&&E.id.length?`#${o.value.id}`:null});function m(){return o.value?F$(e.text,o.value):Promise.resolve()}function _(){return V$(e.text,e.plain||e.text)}function y(){return e.html?_():m()}function w(){return ct(this,null,function*(){try{t("attempt"),yield y(),yield b("haptic-copy.tooltip.succeed"),t("success")}catch(E){yield b("haptic-copy.tooltip.failed"),t("error",E)}S(k,e.tooltipHideDelay)})}function v(E){return i(E)?r(E):E}function b(E="haptic-copy.tooltip.succeed"){return ct(this,null,function*(){s.value=v(E),f.value=!0})}function k(){return ct(this,null,function*(){f.value=!1,c.value=void 0,t("hideClipboardTooltip")})}function S(E=$u,T=0){return clearTimeout(c.value),new Promise(x=>{c.value=setTimeout(x,T)}).finally(u.nextTick).then(E)}return u.onUnmounted(()=>{k()}),n({hide:k}),{t:r,tooltip:a,el:o,buttonId:h,showClipboardTooltip:f,tooltipContainer:p,tooltipContent:s,tooltipTimeout:c,copy:w,closeTooltip:k,openTooltip:b,nextTimeout:S}}}),U$=["id"];function H$(e,t,n,r,i,a){const o=u.resolveComponent("fa"),s=u.resolveComponent("font-awesome-layers"),c=ye.BTooltip;return u.openBlock(),u.createElementBlock("button",{id:e.buttonId,ref:"el",class:"btn haptic-copy",onMouseleave:t[0]||(t[0]=(...f)=>e.closeTooltip&&e.closeTooltip(...f)),onClick:t[1]||(t[1]=u.withModifiers((...f)=>e.copy&&e.copy(...f),["stop"]))},[u.renderSlot(e.$slots,"default",{},()=>[u.createVNode(s,null,{default:u.withCtx(()=>[u.createVNode(u.Transition,{name:"spin"},{default:u.withCtx(()=>[e.tooltipTimeout?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(o,{key:0,class:"haptic-copy__icon",icon:"clipboard"}))]),_:1}),u.createVNode(u.Transition,{name:"spin"},{default:u.withCtx(()=>[e.tooltipTimeout?(u.openBlock(),u.createBlock(o,{key:0,class:"haptic-copy__icon",icon:"clipboard-check"})):u.createCommentVNode("",!0)]),_:1})]),_:1}),u.createElementVNode("span",{class:u.normalizeClass([{"sr-only":e.hideLabel},"ms-1 haptic-copy__label"])},u.toDisplayString(e.label||e.t("haptic-copy.label")),3)]),e.noTooltip?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(c,{key:0,ref:"tooltip","model-value":e.showClipboardTooltip,placement:e.tooltipPlacement,target:e.buttonId,manual:"",noninteractive:""},{default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.tooltipContent),1)]),_:1},8,["model-value","placement","target"]))],40,U$)}const yl=Je(z$,[["render",H$]]),W$=u.defineComponent({name:"AdvancedLinkForm",components:{BTabs:ye.BTabs,BTab:ye.BTab,BInputGroup:ye.BInputGroup,BFormInput:ye.BFormInput,HapticCopy:yl},props:{link:{type:String,default:null},title:{type:String,default:null},forms:{type:Array,default:()=>["raw","markdown","rich","html"]},modelValue:{type:Number,default:0},card:{type:Boolean},pills:{type:Boolean},small:{type:Boolean},vertical:{type:Boolean},activeNavItemClass:{type:String,default:null},noFade:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const{t:n}=tr(),r=u.ref(null),i=u.ref(null),a=u.ref(null),o=u.ref(null),s=u.computed(()=>e.title||e.link),c=u.computed(()=>`[${s.value}](${e.link})`),f=u.computed(()=>`<a href="${e.link}" target="_blank">${s.value}</a>`),h=u.computed(()=>["card","pills","small","vertical"].reduce((S,E)=>(S[`advanced-link-form--${E}`]=e[E],S),{})),p=u.computed(()=>e.small?"sm":"md"),m=u.computed(()=>k=>e.forms.indexOf(k)>-1),_=k=>{k.value instanceof HTMLTextAreaElement&&k.value.select()},y=()=>_(r);function w(){if(!i.value)return;const k=window.getSelection?window.getSelection():null;if(k){const S=document.createRange();S.selectNodeContents(i.value),k.removeAllRanges(),k.addRange(S)}else if(document.body.createTextRange){const S=document.body.createTextRange();S.moveToElementText(i.value),S.select()}}function v(){_(a)}function b(){_(o)}return{t:n,titleOrLink:s,linkAsMarkdown:c,linkAsHtml:f,formClasses:h,size:p,showForm:m,selectRaw:y,selectRich:w,selectMarkdown:v,selectHtml:b}}}),Y$=["href"],j$={class:"text-muted mt-2 mb-0"},G$={class:"text-muted mt-2 mb-0"};function q$(e,t,n,r,i,a){const o=ye.BFormInput,s=u.resolveComponent("haptic-copy"),c=ye.BInputGroup,f=ye.BTab,h=ye.BTabs;return u.openBlock(),u.createBlock(h,{class:u.normalizeClass(["advanced-link-form",e.formClasses]),"content-class":e.card?"mt-0":"mt-3",card:e.card,pills:e.pills,"model-value":e.modelValue,small:e.small,vertical:e.vertical,"active-nav-item-class":e.activeNavItemClass,"no-fade":e.noFade,"onUpdate:modelValue":t[1]||(t[1]=p=>e.$emit("update:modelValue"))},{default:u.withCtx(()=>[e.showForm("raw")?(u.openBlock(),u.createBlock(f,{key:0,title:e.t("advanced-link-form.raw.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__raw",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"rawInput",readonly:"","model-value":e.link,class:"advanced-link-form__raw__input",onClick:e.selectRaw},null,8,["model-value","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.link,onAttempt:e.selectRaw},null,8,["text","onAttempt"])]),_:1},8,["size"])],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("rich")?(u.openBlock(),u.createBlock(f,{key:1,title:e.t("advanced-link-form.rich.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__rich",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createElementVNode("a",{ref:"richInput",href:e.link,class:"form-control advanced-link-form__rich__input",onClick:t[0]||(t[0]=u.withModifiers((...p)=>e.selectRich&&e.selectRich(...p),["prevent"]))},u.toDisplayString(e.titleOrLink),9,Y$),u.createVNode(s,{class:"btn-secondary",html:"",text:e.linkAsHtml,plain:e.link,onAttempt:e.selectRich},null,8,["text","plain","onAttempt"])]),_:1},8,["size"]),u.createElementVNode("p",j$,u.toDisplayString(e.t("advanced-link-form.rich.description")),1)],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("markdown")?(u.openBlock(),u.createBlock(f,{key:2,title:e.t("advanced-link-form.markdown.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__markdown",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"markdownInput",readonly:"","model-value":e.linkAsMarkdown,class:"advanced-link-form__markdown__input",onClick:e.selectMarkdown},null,8,["model-value","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.linkAsMarkdown,onAttempt:e.selectMarkdown},null,8,["text","onAttempt"])]),_:1},8,["size"]),u.createElementVNode("p",G$,u.toDisplayString(e.t("advanced-link-form.markdown.description")),1)],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("html")?(u.openBlock(),u.createBlock(f,{key:3,title:e.t("advanced-link-form.html.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__html",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"htmlInput",readonly:"",modelValue:e.linkAsHtml,class:"advanced-link-form__html__input",onClick:e.selectHtml},null,8,["modelValue","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.linkAsHtml,onAttempt:e.selectHtml},null,8,["text","onAttempt"])]),_:1},8,["size"])],2)]),_:1},8,["title"])):u.createCommentVNode("",!0)]),_:1},8,["content-class","card","pills","model-value","small","vertical","active-nav-item-class","no-fade","class"])}const _b=Je(W$,[["render",q$],["__scopeId","data-v-983b8f4a"]]);var Pu={exports:{}};/**
|
|
790
|
+
*/(function(e,t){(function(r,i){e.exports=i()})(Xr,function(){return function(){var n={686:function(a,o,s){s.d(o,{default:function(){return ce}});var c=s(279),f=s.n(c),h=s(370),p=s.n(h),m=s(817),_=s.n(m);function y(H){try{return document.execCommand(H)}catch(ne){return!1}}var w=function(ne){var le=_()(ne);return y("cut"),le},v=w;function b(H){var ne=document.documentElement.getAttribute("dir")==="rtl",le=document.createElement("textarea");le.style.fontSize="12pt",le.style.border="0",le.style.padding="0",le.style.margin="0",le.style.position="absolute",le.style[ne?"right":"left"]="-9999px";var ue=window.pageYOffset||document.documentElement.scrollTop;return le.style.top="".concat(ue,"px"),le.setAttribute("readonly",""),le.value=H,le}var k=function(ne,le){var ue=b(ne);le.container.appendChild(ue);var ge=_()(ue);return y("copy"),ue.remove(),ge},S=function(ne){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},ue="";return typeof ne=="string"?ue=k(ne,le):ne instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(ne==null?void 0:ne.type)?ue=k(ne.value,le):(ue=_()(ne),y("copy")),ue},E=S;function T(H){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?T=function(le){return typeof le}:T=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},T(H)}var x=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},le=ne.action,ue=le===void 0?"copy":le,ge=ne.container,_e=ne.target,he=ne.text;if(ue!=="copy"&&ue!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(_e!==void 0)if(_e&&T(_e)==="object"&&_e.nodeType===1){if(ue==="copy"&&_e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(ue==="cut"&&(_e.hasAttribute("readonly")||_e.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(he)return E(he,{container:ge});if(_e)return ue==="cut"?v(_e):E(_e,{container:ge})},M=x;function I(H){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?I=function(le){return typeof le}:I=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},I(H)}function A(H,ne){if(!(H instanceof ne))throw new TypeError("Cannot call a class as a function")}function P(H,ne){for(var le=0;le<ne.length;le++){var ue=ne[le];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(H,ue.key,ue)}}function R(H,ne,le){return ne&&P(H.prototype,ne),le&&P(H,le),H}function G(H,ne){if(typeof ne!="function"&&ne!==null)throw new TypeError("Super expression must either be null or a function");H.prototype=Object.create(ne&&ne.prototype,{constructor:{value:H,writable:!0,configurable:!0}}),ne&&D(H,ne)}function D(H,ne){return D=Object.setPrototypeOf||function(ue,ge){return ue.__proto__=ge,ue},D(H,ne)}function L(H){var ne=Y();return function(){var ue=X(H),ge;if(ne){var _e=X(this).constructor;ge=Reflect.construct(ue,arguments,_e)}else ge=ue.apply(this,arguments);return z(this,ge)}}function z(H,ne){return ne&&(I(ne)==="object"||typeof ne=="function")?ne:V(H)}function V(H){if(H===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return H}function Y(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(H){return!1}}function X(H){return X=Object.setPrototypeOf?Object.getPrototypeOf:function(le){return le.__proto__||Object.getPrototypeOf(le)},X(H)}function Z(H,ne){var le="data-clipboard-".concat(H);if(ne.hasAttribute(le))return ne.getAttribute(le)}var ee=function(H){G(le,H);var ne=L(le);function le(ue,ge){var _e;return A(this,le),_e=ne.call(this),_e.resolveOptions(ge),_e.listenClick(ue),_e}return R(le,[{key:"resolveOptions",value:function(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof ge.action=="function"?ge.action:this.defaultAction,this.target=typeof ge.target=="function"?ge.target:this.defaultTarget,this.text=typeof ge.text=="function"?ge.text:this.defaultText,this.container=I(ge.container)==="object"?ge.container:document.body}},{key:"listenClick",value:function(ge){var _e=this;this.listener=p()(ge,"click",function(he){return _e.onClick(he)})}},{key:"onClick",value:function(ge){var _e=ge.delegateTarget||ge.currentTarget,he=this.action(_e)||"copy",te=M({action:he,container:this.container,target:this.target(_e),text:this.text(_e)});this.emit(te?"success":"error",{action:he,text:te,trigger:_e,clearSelection:function(){_e&&_e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(ge){return Z("action",ge)}},{key:"defaultTarget",value:function(ge){var _e=Z("target",ge);if(_e)return document.querySelector(_e)}},{key:"defaultText",value:function(ge){return Z("text",ge)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(ge){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return E(ge,_e)}},{key:"cut",value:function(ge){return v(ge)}},{key:"isSupported",value:function(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],_e=typeof ge=="string"?[ge]:ge,he=!!document.queryCommandSupported;return _e.forEach(function(te){he=he&&!!document.queryCommandSupported(te)}),he}}]),le}(f()),ce=ee},828:function(a){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var s=Element.prototype;s.matches=s.matchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||s.webkitMatchesSelector}function c(f,h){for(;f&&f.nodeType!==o;){if(typeof f.matches=="function"&&f.matches(h))return f;f=f.parentNode}}a.exports=c},438:function(a,o,s){var c=s(828);function f(m,_,y,w,v){var b=p.apply(this,arguments);return m.addEventListener(y,b,v),{destroy:function(){m.removeEventListener(y,b,v)}}}function h(m,_,y,w,v){return typeof m.addEventListener=="function"?f.apply(null,arguments):typeof y=="function"?f.bind(null,document).apply(null,arguments):(typeof m=="string"&&(m=document.querySelectorAll(m)),Array.prototype.map.call(m,function(b){return f(b,_,y,w,v)}))}function p(m,_,y,w){return function(v){v.delegateTarget=c(v.target,_),v.delegateTarget&&w.call(m,v)}}a.exports=h},879:function(a,o){o.node=function(s){return s!==void 0&&s instanceof HTMLElement&&s.nodeType===1},o.nodeList=function(s){var c=Object.prototype.toString.call(s);return s!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in s&&(s.length===0||o.node(s[0]))},o.string=function(s){return typeof s=="string"||s instanceof String},o.fn=function(s){var c=Object.prototype.toString.call(s);return c==="[object Function]"}},370:function(a,o,s){var c=s(879),f=s(438);function h(y,w,v){if(!y&&!w&&!v)throw new Error("Missing required arguments");if(!c.string(w))throw new TypeError("Second argument must be a String");if(!c.fn(v))throw new TypeError("Third argument must be a Function");if(c.node(y))return p(y,w,v);if(c.nodeList(y))return m(y,w,v);if(c.string(y))return _(y,w,v);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function p(y,w,v){return y.addEventListener(w,v),{destroy:function(){y.removeEventListener(w,v)}}}function m(y,w,v){return Array.prototype.forEach.call(y,function(b){b.addEventListener(w,v)}),{destroy:function(){Array.prototype.forEach.call(y,function(b){b.removeEventListener(w,v)})}}}function _(y,w,v){return f(document.body,y,w,v)}a.exports=h},817:function(a){function o(s){var c;if(s.nodeName==="SELECT")s.focus(),c=s.value;else if(s.nodeName==="INPUT"||s.nodeName==="TEXTAREA"){var f=s.hasAttribute("readonly");f||s.setAttribute("readonly",""),s.select(),s.setSelectionRange(0,s.value.length),f||s.removeAttribute("readonly"),c=s.value}else{s.hasAttribute("contenteditable")&&s.focus();var h=window.getSelection(),p=document.createRange();p.selectNodeContents(s),h.removeAllRanges(),h.addRange(p),c=h.toString()}return c}a.exports=o},279:function(a){function o(){}o.prototype={on:function(s,c,f){var h=this.e||(this.e={});return(h[s]||(h[s]=[])).push({fn:c,ctx:f}),this},once:function(s,c,f){var h=this;function p(){h.off(s,p),c.apply(f,arguments)}return p._=c,this.on(s,p,f)},emit:function(s){var c=[].slice.call(arguments,1),f=((this.e||(this.e={}))[s]||[]).slice(),h=0,p=f.length;for(h;h<p;h++)f[h].fn.apply(f[h].ctx,c);return this},off:function(s,c){var f=this.e||(this.e={}),h=f[s],p=[];if(h&&c)for(var m=0,_=h.length;m<_;m++)h[m].fn!==c&&h[m].fn._!==c&&p.push(h[m]);return p.length?f[s]=p:delete f[s],this}},a.exports=o,a.exports.TinyEmitter=o}},r={};function i(a){if(r[a])return r[a].exports;var o=r[a]={exports:{}};return n[a](o,o.exports,i),o.exports}return function(){i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,{a:o}),o}}(),function(){i.d=function(a,o){for(var s in o)i.o(o,s)&&!i.o(a,s)&&Object.defineProperty(a,s,{enumerable:!0,get:o[s]})}}(),function(){i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)}}(),i(686)}().default})})(gb);var D$=gb.exports;const B$=_t(D$);function F$(e,t){return new Promise(function(n,r){const i=document.createElement("button");t=typeof t=="object"?t:document.body;const a=new B$(i,{text:()=>e,container:t});a.on("success",()=>{a.destroy(),n()}),a.on("error",o=>{a.destroy(),r(o)}),i.click()})}function V$(e,t){function n(r){r.clipboardData.setData("text/html",e),r.clipboardData.setData("text/plain",t),r.preventDefault()}document.addEventListener("copy",n),document.execCommand("copy"),document.removeEventListener("copy",n)}const z$=u.defineComponent({name:"HapticCopy",components:{BTooltip:ye.BTooltip,FontAwesomeLayers:ZA,Fa:xn},props:{text:{type:[String,Number],default:null},plain:{type:String,default:null},hideLabel:{type:Boolean},label:{type:String,default:null},tooltipHideDelay:{type:Number,default:1e3},tooltipPlacement:{type:String,default:"top"},html:{type:Boolean},noTooltip:{type:Boolean}},emits:["attempt","success","error","hideClipboardTooltip"],setup(e,{emit:t,expose:n}){const{t:r,te:i}=tr(),a=u.ref(null),o=u.ref(null),s=u.ref(""),c=u.ref(void 0),f=u.ref(!1),h=u.computed(()=>Iu("haptic-copy-"));u.onBeforeMount(()=>{Lr.add(ab.faClipboard),Lr.add(ob.faClipboardCheck)});const p=u.computed(()=>{var E;return(E=o.value)!=null&&E.id.length?`#${o.value.id}`:null});function m(){return o.value?F$(e.text,o.value):Promise.resolve()}function _(){return V$(e.text,e.plain||e.text)}function y(){return e.html?_():m()}function w(){return ct(this,null,function*(){try{t("attempt"),yield y(),yield b("haptic-copy.tooltip.succeed"),t("success")}catch(E){yield b("haptic-copy.tooltip.failed"),t("error",E)}S(k,e.tooltipHideDelay)})}function v(E){return i(E)?r(E):E}function b(E="haptic-copy.tooltip.succeed"){return ct(this,null,function*(){s.value=v(E),f.value=!0})}function k(){return ct(this,null,function*(){f.value=!1,c.value=void 0,t("hideClipboardTooltip")})}function S(E=$u,T=0){return clearTimeout(c.value),new Promise(x=>{c.value=setTimeout(x,T)}).finally(u.nextTick).then(E)}return u.onUnmounted(()=>{k()}),n({hide:k}),{t:r,tooltip:a,el:o,buttonId:h,showClipboardTooltip:f,tooltipContainer:p,tooltipContent:s,tooltipTimeout:c,copy:w,closeTooltip:k,openTooltip:b,nextTimeout:S}}}),U$=["id"];function H$(e,t,n,r,i,a){const o=u.resolveComponent("fa"),s=u.resolveComponent("font-awesome-layers"),c=ye.BTooltip;return u.openBlock(),u.createElementBlock("button",{id:e.buttonId,ref:"el",class:"btn haptic-copy",onMouseleave:t[0]||(t[0]=(...f)=>e.closeTooltip&&e.closeTooltip(...f)),onClick:t[1]||(t[1]=u.withModifiers((...f)=>e.copy&&e.copy(...f),["stop"]))},[u.renderSlot(e.$slots,"default",{},()=>[u.createVNode(s,null,{default:u.withCtx(()=>[u.createVNode(u.Transition,{name:"spin"},{default:u.withCtx(()=>[e.tooltipTimeout?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(o,{key:0,class:"haptic-copy__icon",icon:"clipboard"}))]),_:1}),u.createVNode(u.Transition,{name:"spin"},{default:u.withCtx(()=>[e.tooltipTimeout?(u.openBlock(),u.createBlock(o,{key:0,class:"haptic-copy__icon",icon:"clipboard-check"})):u.createCommentVNode("",!0)]),_:1})]),_:1}),u.createElementVNode("span",{class:u.normalizeClass([{"sr-only":e.hideLabel},"ms-1 haptic-copy__label"])},u.toDisplayString(e.label||e.t("haptic-copy.label")),3)]),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[e.noTooltip?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(c,{key:0,ref:"tooltip","model-value":e.showClipboardTooltip,placement:e.tooltipPlacement,target:e.buttonId,manual:"",noninteractive:""},{default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.tooltipContent),1)]),_:1},8,["model-value","placement","target"]))]))],40,U$)}const yl=Je(z$,[["render",H$]]),W$=u.defineComponent({name:"AdvancedLinkForm",components:{BTabs:ye.BTabs,BTab:ye.BTab,BInputGroup:ye.BInputGroup,BFormInput:ye.BFormInput,HapticCopy:yl},props:{link:{type:String,default:null},title:{type:String,default:null},forms:{type:Array,default:()=>["raw","markdown","rich","html"]},modelValue:{type:Number,default:0},card:{type:Boolean},pills:{type:Boolean},small:{type:Boolean},vertical:{type:Boolean},activeNavItemClass:{type:String,default:null},noFade:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const{t:n}=tr(),r=u.ref(null),i=u.ref(null),a=u.ref(null),o=u.ref(null),s=u.computed(()=>e.title||e.link),c=u.computed(()=>`[${s.value}](${e.link})`),f=u.computed(()=>`<a href="${e.link}" target="_blank">${s.value}</a>`),h=u.computed(()=>["card","pills","small","vertical"].reduce((S,E)=>(S[`advanced-link-form--${E}`]=e[E],S),{})),p=u.computed(()=>e.small?"sm":"md"),m=u.computed(()=>k=>e.forms.indexOf(k)>-1),_=k=>{k.value instanceof HTMLTextAreaElement&&k.value.select()},y=()=>_(r);function w(){if(!i.value)return;const k=window.getSelection?window.getSelection():null;if(k){const S=document.createRange();S.selectNodeContents(i.value),k.removeAllRanges(),k.addRange(S)}else if(document.body.createTextRange){const S=document.body.createTextRange();S.moveToElementText(i.value),S.select()}}function v(){_(a)}function b(){_(o)}return{t:n,titleOrLink:s,linkAsMarkdown:c,linkAsHtml:f,formClasses:h,size:p,showForm:m,selectRaw:y,selectRich:w,selectMarkdown:v,selectHtml:b}}}),Y$=["href"],j$={class:"text-muted mt-2 mb-0"},G$={class:"text-muted mt-2 mb-0"};function q$(e,t,n,r,i,a){const o=ye.BFormInput,s=u.resolveComponent("haptic-copy"),c=ye.BInputGroup,f=ye.BTab,h=ye.BTabs;return u.openBlock(),u.createBlock(h,{class:u.normalizeClass(["advanced-link-form",e.formClasses]),"content-class":e.card?"mt-0":"mt-3",card:e.card,pills:e.pills,"model-value":e.modelValue,small:e.small,vertical:e.vertical,"active-nav-item-class":e.activeNavItemClass,"no-fade":e.noFade,"onUpdate:modelValue":t[1]||(t[1]=p=>e.$emit("update:modelValue"))},{default:u.withCtx(()=>[e.showForm("raw")?(u.openBlock(),u.createBlock(f,{key:0,title:e.t("advanced-link-form.raw.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__raw",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"rawInput",readonly:"","model-value":e.link,class:"advanced-link-form__raw__input",onClick:e.selectRaw},null,8,["model-value","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.link,onAttempt:e.selectRaw},null,8,["text","onAttempt"])]),_:1},8,["size"])],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("rich")?(u.openBlock(),u.createBlock(f,{key:1,title:e.t("advanced-link-form.rich.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__rich",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createElementVNode("a",{ref:"richInput",href:e.link,class:"form-control advanced-link-form__rich__input",onClick:t[0]||(t[0]=u.withModifiers((...p)=>e.selectRich&&e.selectRich(...p),["prevent"]))},u.toDisplayString(e.titleOrLink),9,Y$),u.createVNode(s,{class:"btn-secondary",html:"",text:e.linkAsHtml,plain:e.link,onAttempt:e.selectRich},null,8,["text","plain","onAttempt"])]),_:1},8,["size"]),u.createElementVNode("p",j$,u.toDisplayString(e.t("advanced-link-form.rich.description")),1)],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("markdown")?(u.openBlock(),u.createBlock(f,{key:2,title:e.t("advanced-link-form.markdown.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__markdown",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"markdownInput",readonly:"","model-value":e.linkAsMarkdown,class:"advanced-link-form__markdown__input",onClick:e.selectMarkdown},null,8,["model-value","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.linkAsMarkdown,onAttempt:e.selectMarkdown},null,8,["text","onAttempt"])]),_:1},8,["size"]),u.createElementVNode("p",G$,u.toDisplayString(e.t("advanced-link-form.markdown.description")),1)],2)]),_:1},8,["title"])):u.createCommentVNode("",!0),e.showForm("html")?(u.openBlock(),u.createBlock(f,{key:3,title:e.t("advanced-link-form.html.tab")},{default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["advanced-link-form__html",{small:e.small}])},[u.createVNode(c,{size:e.size},{default:u.withCtx(()=>[u.createVNode(o,{ref:"htmlInput",readonly:"",modelValue:e.linkAsHtml,class:"advanced-link-form__html__input",onClick:e.selectHtml},null,8,["modelValue","onClick"]),u.createVNode(s,{class:"btn-secondary",text:e.linkAsHtml,onAttempt:e.selectHtml},null,8,["text","onAttempt"])]),_:1},8,["size"])],2)]),_:1},8,["title"])):u.createCommentVNode("",!0)]),_:1},8,["content-class","card","pills","model-value","small","vertical","active-nav-item-class","no-fade","class"])}const _b=Je(W$,[["render",q$],["__scopeId","data-v-983b8f4a"]]);var Pu={exports:{}};/**
|
|
791
791
|
* @license
|
|
792
792
|
* Lodash <https://lodash.com/>
|
|
793
793
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|