var G=Object.defineProperty;var _=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var B=(p,l,i)=>l in p?G(p,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[l]=i,V=(p,l)=>{for(var i in l||(l={}))U.call(l,i)&&B(p,i,l[i]);if(_)for(var i of _(l))H.call(l,i)&&B(p,i,l[i]);return p};var E=(p,l,i)=>new Promise((d,u)=>{var w=c=>{try{y(i.next(c))}catch(f){u(f)}},P=c=>{try{y(i.throw(c))}catch(f){u(f)}},y=c=>c.done?d(c.value):Promise.resolve(c.value).then(w,P);y((i=i.apply(p,l)).next())});import{d as J,s as z,j as K,v as Q,o as C,c as M,a as h,x as g,z as k,y as L,F as W,m as O,l as X,A as Y,B as N,C as j,T as $}from"./index.js?v=acacf0dc";var Z=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},q={exports:{}};(function(p){(function(l){const i="(0?\\d+|0x[a-f0-9]+)",d={fourOctet:new RegExp(`^${i}\\.${i}\\.${i}\\.${i}$`,"i"),threeOctet:new RegExp(`^${i}\\.${i}\\.${i}$`,"i"),twoOctet:new RegExp(`^${i}\\.${i}$`,"i"),longValue:new RegExp(`^${i}$`,"i")},u=new RegExp("^0[0-7]+$","i"),w=new RegExp("^0x[a-f0-9]+$","i"),P="%[0-9a-z]{1,}",y="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(P,"i"),native:new RegExp(`^(::)?(${y})?([0-9a-f]+)?(::)?(${P})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${i}\\.${i}\\.${i}\\.${i}(${P})?)$`,"i"),transitional:new RegExp(`^((?:${y})|(?:::)(?:${y})?)${i}\\.${i}\\.${i}\\.${i}(${P})?$`,"i")};function f(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r=0,n=-1,o=(t.match(c.zoneIndex)||[])[0],s,I;for(o&&(o=o.substring(1),t=t.replace(/%.+$/,""));(n=t.indexOf(":",n+1))>=0;)r++;if(t.substr(0,2)==="::"&&r--,t.substr(-2,2)==="::"&&r--,r>e)return null;for(I=e-r,s=":";I--;)s+="0:";return t=t.replace("::",s),t[0]===":"&&(t=t.slice(1)),t[t.length-1]===":"&&(t=t.slice(0,-1)),e=function(){const S=t.split(":"),A=[];for(let F=0;F0;){if(s=r-n,s<0&&(s=0),t[o]>>s!==e[o]>>s)return!1;n-=r,o+=1}return!0}function m(t){if(w.test(t))return parseInt(t,16);if(t[0]==="0"&&!isNaN(parseInt(t[1],10))){if(u.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function R(t,e){for(;t.length=0;o-=1)if(s=this.octets[o],s in n){if(I=n[s],r&&I!==0)return null;I!==8&&(r=!0),e+=I}else return null;return 32-e},t.prototype.range=function(){return a.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return a.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),a.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[];let s=0;for(;s<4;)o.push(parseInt(r[s],10)|parseInt(n[s],10)^255),s++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},a.IPv4.isIPv4=function(t){return this.parser(t)!==null},a.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(e){return!1}},a.IPv4.isValidFourPartDecimal=function(t){return!!(a.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},a.IPv4.networkAddressFromCIDR=function(t){let e,r,n,o,s;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(o)}catch(I){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},a.IPv4.parse=function(t){const e=this.parser(t);if(e===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},a.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const r=parseInt(e[2]);if(r>=0&&r<=32){const n=[this.parse(e[1]),r];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},a.IPv4.parser=function(t){let e,r,n;if(e=t.match(d.fourOctet))return function(){const o=e.slice(1,6),s=[];for(let I=0;I4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const o=[];let s;for(s=0;s<=24;s+=8)o.push(n>>s&255);return o}().reverse()}else return(e=t.match(d.twoOctet))?function(){const o=e.slice(1,4),s=[];if(n=m(o[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return s.push(m(o[0])),s.push(n>>16&255),s.push(n>>8&255),s.push(n&255),s}():(e=t.match(d.threeOctet))?function(){const o=e.slice(1,5),s=[];if(n=m(o[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return s.push(m(o[0])),s.push(m(o[1])),s.push(n>>8&255),s.push(n&255),s}():null},a.IPv4.subnetMaskFromPrefixLength=function(t){if(t=parseInt(t),t<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r=0;I-=1)if(o=this.parts[I],o in n){if(s=n[o],r&&s!==0)return null;s!==16&&(r=!0),e+=s}else return null;return 128-e},t.prototype.range=function(){return a.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let e;const r=[],n=this.parts;for(let o=0;o>8),r.push(e&255);return r},t.prototype.toFixedLengthString=function(){const e=function(){const n=[];for(let o=0;o>8,r&255,n>>8,n&255])},t.prototype.toNormalizedString=function(){const e=function(){const n=[];for(let o=0;oo&&(n=s.index,o=s[0].length);return o<0?r:`${r.substring(0,n)}::${r.substring(n+o)}`},t.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},t}(),a.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[];let s=0;for(;s<16;)o.push(parseInt(r[s],10)|parseInt(n[s],10)^255),s++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},a.IPv6.isIPv6=function(t){return this.parser(t)!==null},a.IPv6.isValid=function(t){if(typeof t=="string"&&t.indexOf(":")===-1)return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(e){return!1}},a.IPv6.networkAddressFromCIDR=function(t){let e,r,n,o,s;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(o)}catch(I){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${I})`)}},a.IPv6.parse=function(t){const e=this.parser(t);if(e.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},a.IPv6.parseCIDR=function(t){let e,r,n;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return n=[this.parse(r[1]),e],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},a.IPv6.parser=function(t){let e,r,n,o,s,I;if(n=t.match(c.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(c.native.test(t))return f(t,8);if((n=t.match(c.transitional))&&(I=n[6]||"",e=f(n[1].slice(0,-1)+I,6),e.parts)){for(s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(t/8);for(;rD.isValid(p),b=p=>{const l=D.IPv4.parse(p).toByteArray();return l[0]<<24|l[1]<<16|l[2]<<8|l[3]},T=p=>D.fromByteArray([p>>24&255,p>>16&255,p>>8&255,p&255]).toString(),et=p=>{if(!D.IPv4.isIPv4(p))return!1;let l=0,i=b(p);for(let d=31;d>=0&&(i&1<{let u=b(p)&b(l),w=b(i),P=b(d),c=~b(l);return wu+1&&P{let i=b(l),d=b(p)&i,u=~i,w;return u>=105?(w=d|u-5,d=d|100):u>=3?(w=d|u-1,d=d|2):(d=d|1,w=d),[T(d),T(w)]};var x={isValidMask:et,isValidIP:tt,isValidMaskRange:nt,calcMaskRange:rt};const st=["onSubmit"],ot=h("div",{class:"label-name"},[h("span",null,"\u5185\u7F51\u5730\u5740")],-1),it={class:"label-value"},at=h("div",{class:"label-name"},[h("span",null,"\u5B50\u7F51\u63A9\u7801")],-1),ut={class:"label-value"},lt=h("div",{class:"label-name"},[h("span",null,"\u4FEE\u6539DHCP\u670D\u52A1")],-1),dt={class:"label-value"},ct={class:"label-flex"},pt=N("\u5173\u95ED"),ft=N("\u542F\u7528"),ht=h("div",{class:"label-name"},[h("span",null,"IP\u6C60\u8D77\u59CB\u5730\u5740")],-1),It={class:"label-value"},vt=h("div",{class:"label-name"},[h("span",null,"IP\u6C60\u7ED3\u675F\u5730\u5740")],-1),wt={class:"label-value"},mt={class:"label-btns"},Pt=["disabled"],yt={key:1,class:"label-msg"},xt=J({__name:"index",setup(p){return E(this,null,function*(){let l,i;const d=z(""),u=K({lanIp:"",netMask:"255.255.255.0",enableDhcp:!1,dhcpStart:"",dhcpEnd:""}),w=z(!1),P=()=>E(this,null,function*(){w.value=!0;const c=yield j.Guide.GetLan.GET();if(c.data){const{result:f}=c.data;f&&(u.lanIp=f.lanIp,u.netMask=f.netMask,u.enableDhcp=f.enableDhcp||!1,u.dhcpStart=f.dhcpStart,u.dhcpEnd=f.dhcpEnd,f.lanIp,location.hostname)}w.value=!1});[l,i]=Q(()=>P()),yield l,i();const y=()=>E(this,null,function*(){const c=V({},u);if(!x.isValidIP(c.lanIp)){$.Error("IPv4\u5730\u5740\u683C\u5F0F\u9519\u8BEF");return}if(!x.isValidMask(c.netMask)){$.Error("IPv4\u5B50\u7F51\u63A9\u7801\u683C\u5F0F\u9519\u8BEF");return}if(c.enableDhcp&&!x.isValidIP(c.dhcpStart)||!x.isValidIP(c.dhcpEnd)||!x.isValidMaskRange(c.lanIp,c.netMask,c.dhcpStart,c.dhcpEnd)){$.Error("DHCP\u7684IP\u6C60\u683C\u5F0F\u9519\u8BEF\u6216\u8D85\u51FA\u5B50\u7F51\u8303\u56F4");return}const f=$.Loading("\u6B63\u5728\u914D\u7F6E,\u8BF7\u7A0D\u7B49\u2026");let v=!1;try{const m=yield j.Guide.LanIp.POST(c);if(m.data){const{result:R,success:a,error:t}=m.data;if(t){d.value=t;return}if((a||0)==0){v=!0;return}}}catch(m){d.value=m}v&&(d.value=`\u66F4\u65B0\u6210\u529F,\u8BF7\u8FDB\u5165 ${c.lanIp} \u8DEF\u7531\u5668\u5730\u5740`),f.Close()});return(c,f)=>(C(),M("form",{class:"form-container",onSubmit:Y(y,["prevent"])},[ot,h("div",it,[g(h("input",{type:"text",placeholder:"192.168.100.1","onUpdate:modelValue":f[0]||(f[0]=v=>u.lanIp=v),required:""},null,512),[[k,u.lanIp,void 0,{trim:!0}]])]),at,h("div",ut,[g(h("input",{type:"text",placeholder:"255.255.255.0","onUpdate:modelValue":f[1]||(f[1]=v=>u.netMask=v),required:""},null,512),[[k,u.netMask,void 0,{trim:!0}]])]),lt,h("div",dt,[h("div",ct,[h("label",null,[g(h("input",{type:"radio",value:!1,"onUpdate:modelValue":f[2]||(f[2]=v=>u.enableDhcp=v)},null,512),[[L,u.enableDhcp]]),pt]),h("label",null,[g(h("input",{type:"radio",value:!0,"onUpdate:modelValue":f[3]||(f[3]=v=>u.enableDhcp=v)},null,512),[[L,u.enableDhcp]]),ft])])]),u.enableDhcp?(C(),M(W,{key:0},[ht,h("div",It,[g(h("input",{type:"text",placeholder:"192.168.100.100","onUpdate:modelValue":f[4]||(f[4]=v=>u.dhcpStart=v),required:""},null,512),[[k,u.dhcpStart,void 0,{trim:!0}]])]),vt,h("div",wt,[g(h("input",{type:"text",placeholder:"192.168.100.100","onUpdate:modelValue":f[5]||(f[5]=v=>u.dhcpEnd=v),required:""},null,512),[[k,u.dhcpEnd,void 0,{trim:!0}]])])],64)):O("",!0),h("div",mt,[h("button",{class:"sumbit",disabled:w.value},"\u4FDD\u5B58",8,Pt)]),d.value?(C(),M("div",yt,[h("span",null,X(d.value),1)])):O("",!0)],40,st))})}});export{xt as default};